@marimo-team/frontend 0.13.7-dev8 → 0.13.7

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 (103) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-CLc0tWMC.js → ConnectedDataExplorerComponent-SPd9J9Jd.js} +1 -1
  2. package/dist/assets/{VegaLite-DeIA1FjI.js → VegaLite-CfrhxQTt.js} +1 -1
  3. package/dist/assets/_baseEach-BZq8ro2R.js +1 -0
  4. package/dist/assets/_baseMap-CgH3S7tf.js +1 -0
  5. package/dist/assets/_baseUniq-BlG7tqN9.js +1 -0
  6. package/dist/assets/{_createAggregator-UrANbXdP.js → _createAggregator-BMg2kDgI.js} +1 -1
  7. package/dist/assets/{any-language-editor-Cfa0V48Y.js → any-language-editor-B8nrBC5v.js} +1 -1
  8. package/dist/assets/{architectureDiagram-IEHRJDOE-CP5nWQay.js → architectureDiagram-IEHRJDOE-CNDgNtds.js} +1 -1
  9. package/dist/assets/{blockDiagram-JOT3LUYC-pMp2cXt0.js → blockDiagram-JOT3LUYC-BhPMvGuz.js} +1 -1
  10. package/dist/assets/{c4Diagram-VJAJSXHY-Bn4nvkHl.js → c4Diagram-VJAJSXHY-DBmHW1Tc.js} +1 -1
  11. package/dist/assets/channel-yYXUy_xM.js +1 -0
  12. package/dist/assets/{chunk-4BMEZGHF-BVHPUEv5.js → chunk-4BMEZGHF-C4WyEzfS.js} +1 -1
  13. package/dist/assets/{chunk-A2AXSNBT-Cr_zhb-n.js → chunk-A2AXSNBT-CYMiznMa.js} +1 -1
  14. package/dist/assets/{chunk-AEK57VVT-Cw97WREt.js → chunk-AEK57VVT-DAy0e1hK.js} +1 -1
  15. package/dist/assets/{chunk-D6G4REZN-CbomMNl3.js → chunk-D6G4REZN-Dh_XJA-F.js} +1 -1
  16. package/dist/assets/{chunk-RZ5BOZE2-D-i5I5dS.js → chunk-RZ5BOZE2-CVV4deO-.js} +1 -1
  17. package/dist/assets/{chunk-XZIHB7SX-BxAeN6c9.js → chunk-XZIHB7SX-ZOCEvE6V.js} +1 -1
  18. package/dist/assets/{circle-play-NJSP28OU.js → circle-play-B9gdPydf.js} +1 -1
  19. package/dist/assets/classDiagram-GIVACNV2-BRk86heq.js +1 -0
  20. package/dist/assets/classDiagram-v2-COTLJTTW-BRk86heq.js +1 -0
  21. package/dist/assets/clone-D9Pmw_hi.js +1 -0
  22. package/dist/assets/{compile-B99z9p1c.js → compile-DAujqn9X.js} +1 -1
  23. package/dist/assets/{dagre-OKDRZEBW-DFwLfrsP.js → dagre-OKDRZEBW-B00wSc9g.js} +1 -1
  24. package/dist/assets/{data-editor-BnkfFTyP.js → data-editor-eoN_TbKv.js} +1 -1
  25. package/dist/assets/{diagram-SSKATNLV-DNHawSaS.js → diagram-SSKATNLV-DWsenAkm.js} +1 -1
  26. package/dist/assets/{diagram-VNBRO52H-mAGMWxSF.js → diagram-VNBRO52H-BqpwEoU3.js} +1 -1
  27. package/dist/assets/edit-page-DZp_rSlr.js +134 -0
  28. package/dist/assets/{erDiagram-Q7BY3M3F-B7JQx89Q.js → erDiagram-Q7BY3M3F-CTihBXfs.js} +1 -1
  29. package/dist/assets/{flowDiagram-4HSFHLVR-CrIteLwE.js → flowDiagram-4HSFHLVR-Dw1I2JK9.js} +1 -1
  30. package/dist/assets/{ganttDiagram-APWFNJXF-B82yNILY.js → ganttDiagram-APWFNJXF-Dfno6ACW.js} +4 -4
  31. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-BX1zzD_4.js → gitGraphDiagram-7IBYFJ6S-B6pNfkOn.js} +1 -1
  32. package/dist/assets/{graph-n5raD8-X.js → graph-C950VsSg.js} +1 -1
  33. package/dist/assets/home-page-BfEVB0RE.js +9 -0
  34. package/dist/assets/{index-C4VFj4aB.js → index-4h4O6nRv.js} +189 -189
  35. package/dist/assets/{index-D2X6Wktl.js → index-B32BD8ML.js} +1 -1
  36. package/dist/assets/{index-CiXJGIA5.js → index-BReLwzk9.js} +1 -1
  37. package/dist/assets/{index-CHjC2BHW.js → index-BsOqXuBR.js} +1 -1
  38. package/dist/assets/{index-ChvXZz4O.js → index-Bw6nMMjK.js} +1 -1
  39. package/dist/assets/{index-CVS30d8t.js → index-C9JkGklH.js} +1 -1
  40. package/dist/assets/{index-f2YtY2NK.js → index-CACmVird.js} +1 -1
  41. package/dist/assets/{index-HeByvlyV.js → index-C_ZC0Pbb.js} +1 -1
  42. package/dist/assets/{index-2n81G4S2.js → index-Cn8na8w_.js} +1 -1
  43. package/dist/assets/{index-BVjb7S6F.js → index-CnJV0FTF.js} +1 -1
  44. package/dist/assets/{index-BaaSOg-V.js → index-D5hUHK5w.js} +1 -1
  45. package/dist/assets/{index-Ch51YLFK.js → index-DA5tFAUA.js} +1 -1
  46. package/dist/assets/{index-2V-aA6ro.js → index-DFOm8T5F.js} +1 -1
  47. package/dist/assets/{index-De6_X4XZ.js → index-DHYiQbpy.js} +1 -1
  48. package/dist/assets/{index-BLczHwIF.js → index-DQnwIxh3.js} +1 -1
  49. package/dist/assets/{index-CGXa2hxu.js → index-DVdXgva6.js} +1 -1
  50. package/dist/assets/index-DredxwTT.css +1 -0
  51. package/dist/assets/{index-MuEQoKhf.js → index-QE0FByci.js} +1 -1
  52. package/dist/assets/{index-DoMH_weu.js → index-Ti1pGFal.js} +1 -1
  53. package/dist/assets/{index-CJD1KDty.js → index-lHXhF8CG.js} +1 -1
  54. package/dist/assets/infoDiagram-PH2N3AL5-BEdTv4E_.js +2 -0
  55. package/dist/assets/{journeyDiagram-U35MCT3I-BFBt52HP.js → journeyDiagram-U35MCT3I-BKq0dUUZ.js} +1 -1
  56. package/dist/assets/{kanban-definition-NDS4AKOZ-D6o6rwO8.js → kanban-definition-NDS4AKOZ-hfU78n8b.js} +1 -1
  57. package/dist/assets/{layout-BuG044DG.js → layout-BE1mGV9M.js} +1 -1
  58. package/dist/assets/linear-CpOBkXrn.js +1 -0
  59. package/dist/assets/{mermaid-DNnTn1ax.js → mermaid-Dx1YHI40.js} +25 -25
  60. package/dist/assets/min-COShMcb5.js +1 -0
  61. package/dist/assets/{mindmap-definition-ALO5MXBD-CKIhzL5r.js → mindmap-definition-ALO5MXBD-DBWu3X2I.js} +1 -1
  62. package/dist/assets/{pieDiagram-IB7DONF6-Cl9LWE0V.js → pieDiagram-IB7DONF6-CG--7A2y.js} +1 -1
  63. package/dist/assets/{quadrantDiagram-7GDLP6J5-BWkeBvxF.js → quadrantDiagram-7GDLP6J5-CR95yuc9.js} +1 -1
  64. package/dist/assets/{radar-MK3ICKWK-DfEvYX9n.js → radar-MK3ICKWK-P7Kr7WKS.js} +1 -1
  65. package/dist/assets/{react-plotly-DnYa98wl.js → react-plotly-Do2-vcI3.js} +1 -1
  66. package/dist/assets/{requirementDiagram-KVF5MWMF-B3GypB5w.js → requirementDiagram-KVF5MWMF-Cc4v27SO.js} +1 -1
  67. package/dist/assets/{run-page-AYFVu0sg.js → run-page-CQQTftoA.js} +1 -1
  68. package/dist/assets/{sankeyDiagram-QLVOVGJD-Duwbvz1H.js → sankeyDiagram-QLVOVGJD-Ds8zmpo_.js} +1 -1
  69. package/dist/assets/{save-worker-Metbq5yy.js → save-worker-D7xNPs7e.js} +1 -1
  70. package/dist/assets/{sequenceDiagram-X6HHIX6F-CPZ3p0P0.js → sequenceDiagram-X6HHIX6F-BHG7YzOi.js} +1 -1
  71. package/dist/assets/{slides-component-ji4ZW29g.js → slides-component-D1WRXnf2.js} +1 -1
  72. package/dist/assets/{sortBy-Bb9JPW3o.js → sortBy-Bu414hs4.js} +1 -1
  73. package/dist/assets/{stateDiagram-DGXRK772-DBMoid7W.js → stateDiagram-DGXRK772-BwQo4nG0.js} +1 -1
  74. package/dist/assets/stateDiagram-v2-YXO3MK2T-B9B0143E.js +1 -0
  75. package/dist/assets/{terminal-BvrOH4Uo.js → terminal-j9tsgxej.js} +1 -1
  76. package/dist/assets/time-BsEmS0HK.js +1 -0
  77. package/dist/assets/{timeline-definition-BDJGKUSR-D3iIxPo0.js → timeline-definition-BDJGKUSR-B-QwYPaI.js} +1 -1
  78. package/dist/assets/{tracing-gp4drB6-.js → tracing-CI6jZFQo.js} +2 -2
  79. package/dist/assets/tree-BBHkcIuT.js +17 -0
  80. package/dist/assets/{useMarimoWebSocket-BsUbqg1d.js → useMarimoWebSocket-B_7wuFNI.js} +7 -7
  81. package/dist/assets/{vega-component-DZEBlVKg.js → vega-component-wyKSIIHc.js} +1 -1
  82. package/dist/assets/worker-BWN2kUSa.js +1 -0
  83. package/dist/assets/{worker--c-Qm4dm.js → worker-D-UG5-wL.js} +1 -1
  84. package/dist/assets/{xychartDiagram-VJFVF3MP-lnK1D7Dl.js → xychartDiagram-VJFVF3MP-DYRP2CPz.js} +1 -1
  85. package/dist/index.html +2 -2
  86. package/package.json +1 -1
  87. package/dist/assets/_baseEach-Cyw-LuDI.js +0 -1
  88. package/dist/assets/_baseMap-C1RlaUrw.js +0 -1
  89. package/dist/assets/_baseUniq-Q2eJnBNa.js +0 -1
  90. package/dist/assets/channel-pbDhyq1Y.js +0 -1
  91. package/dist/assets/classDiagram-GIVACNV2-DrKh0GDa.js +0 -1
  92. package/dist/assets/classDiagram-v2-COTLJTTW-DrKh0GDa.js +0 -1
  93. package/dist/assets/clone-DTrfPVDc.js +0 -1
  94. package/dist/assets/edit-page-DqQ_uRQm.js +0 -134
  95. package/dist/assets/home-page-CAkv18DE.js +0 -9
  96. package/dist/assets/index-DWX453Nv.css +0 -1
  97. package/dist/assets/infoDiagram-PH2N3AL5-BEA8jVe9.js +0 -2
  98. package/dist/assets/linear-HjYCbFKN.js +0 -1
  99. package/dist/assets/min-DUCyIShx.js +0 -1
  100. package/dist/assets/stateDiagram-v2-YXO3MK2T-C6Yw638v.js +0 -1
  101. package/dist/assets/time-Dhxp9qd9.js +0 -1
  102. package/dist/assets/tree-BMOusOrc.js +0 -17
  103. package/dist/assets/worker-kTJmA5be.js +0 -1
@@ -1,134 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-f2YtY2NK.js","./VegaLite-DeIA1FjI.js","./index-C4VFj4aB.js","./index-DWX453Nv.css","./compile-B99z9p1c.js","./time-Dhxp9qd9.js","./timer-DFzT7np-.js","./linear-HjYCbFKN.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-Cuwikxov.js","./step-BwsUM5iJ.js","./index-2n81G4S2.js","./tracing-gp4drB6-.js","./useMarimoWebSocket-BsUbqg1d.js","./index-CJD1KDty.js","./index-D2X6Wktl.js","./index-HeByvlyV.js","./index-DoMH_weu.js","./index-De6_X4XZ.js","./index-BaaSOg-V.js","./index-BLczHwIF.js","./index-CVS30d8t.js","./index-Ch51YLFK.js","./index-CGXa2hxu.js","./index-BVjb7S6F.js","./index-CHjC2BHW.js","./index-MuEQoKhf.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-CHJ5qNM_.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-D7xaZ7Da.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-Dri_5nFc.js","./fortran-DL7KluxX.js","./gas-5kEe4nk0.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CmdsSjFB.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-FFvkTduk.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-OdhglgkO.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-BQXy8elZ.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./useMarimoWebSocket-DcAzAz16.css","./tree-BMOusOrc.js","./tree-C1rhMrxo.css","./circle-play-NJSP28OU.js","./_createAggregator-UrANbXdP.js","./_baseEach-Cyw-LuDI.js","./transform-Cyp0GDF-.js","./sortBy-Bb9JPW3o.js","./_baseMap-C1RlaUrw.js","./terminal-BvrOH4Uo.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var WL=Object.defineProperty;var h3=Bt=>{throw TypeError(Bt)};var qL=(Bt,Et,fn)=>Et in Bt?WL(Bt,Et,{enumerable:!0,configurable:!0,writable:!0,value:fn}):Bt[Et]=fn;var ee=(Bt,Et,fn)=>qL(Bt,typeof Et!="symbol"?Et+"":Et,fn),GL=(Bt,Et,fn)=>Et.has(Bt)||h3("Cannot "+fn);var f3=(Bt,Et,fn)=>(GL(Bt,Et,"read from private field"),fn?fn.call(Bt):Et.get(Bt)),m3=(Bt,Et,fn)=>Et.has(Bt)?h3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Bt):Et.set(Bt,fn);import{u as Pe,S as A,hZ as YL,h_ as JL,h$ as p3,i0 as KL,i1 as XL,i2 as ZL,R as K,i3 as QL,i4 as kr,i5 as eF,i6 as Wf,i7 as g3,i8 as tF,i9 as nF,ia as _3,ib as Zl,d as X,ac as qn,ic as Ei,j as h,dm as qf,dn as b3,dp as oF,dr as Gf,dt as Yf,f0 as Ql,id as Jf,dk as Kf,dl as Xf,dq as Zf,ie as rF,ig as y3,ea as x3,aH as Qe,Q as zt,ih as iF,dP as co,ii as w3,ij as v3,ik as Qf,il as k3,im as em,L as mt,aj as Ot,cx as tm,a2 as De,io as sF,eb as ut,ip as S3,iq as aF,a8 as lt,ir as nm,ef as Js,is as C3,it as ec,T as We,bs as zn,al as $t,iu as tc,iv as Ii,d$ as Ai,iw as lF,ix as Ks,iy as cF,e8 as dF,iz as N3,iA as j3,dH as uF,as as om,iB as Sr,bg as or,iC as hF,iD as E3,aq as Xs,ew as I3,ar as Zs,iE as fF,a7 as bn,iF as rm,iG as Cr,a3 as rr,a4 as Ti,a5 as ir,bK as Nr,iH as uo,af as ho,e0 as Mi,gb as A3,fD as Oi,ge as mF,bw as yn,fB as im,aJ as nc,iI as sm,iJ as pF,iK as T3,iL as am,iM as gF,fC as _F,iN as fo,iO as M3,fH as lm,iP as Qs,iQ as oc,dW as bF,Z as Gn,a6 as Di,bI as jr,iR as ea,aM as un,a9 as Ri,ap as Me,eY as Ro,bB as O3,eh as Qt,iS as yF,eJ as xF,du as rc,iT as cm,bh as dm,iU as wF,iV as um,e5 as Pi,iW as vF,iX as hm,bN as Bn,iY as kF,dN as Ae,iZ as Je,i_ as fm,i$ as Dt,j0 as D3,j1 as SF,fi as mm,bb as jn,aE as Yn,f$ as R3,g0 as P3,g1 as CF,g5 as NF,g2 as L3,ag as Te,dG as jF,bd as ic,bk as sc,be as ac,bi as rn,e9 as Po,j2 as EF,g3 as F3,j3 as IF,fU as z3,fW as B3,j4 as U3,j5 as AF,j6 as TF,a1 as MF,a0 as OF,e4 as ta,j7 as lc,j8 as Li,j9 as cc,ja as DF,jb as RF,jc as V3,jd as hn,fG as $3,dI as dc,bE as PF,je as LF,ab as pm,bf as FF,jf as zF,gf as H3,bA as uc,jg as gm,aa as na,dX as W3,jh as BF,$ as UF,fY as VF,ji as $F,jj as HF,jk as WF,jl as qF,jm as GF,jn as YF,di as Er,jo as hc,jp as Fi,o as Ir,n as st,fl as Lo,jq as Un,jr as dt,js as zi,jt as Gt,ju as _m,dM as Jn,jv as JF,jw as KF,by as q3,bz as G3,jx as Y3,jy as XF,gi as oa,jz as fc,bv as mc,gh as Bi,jA as J3,jB as pc,ec as bm,jC as ZF,jD as QF,jE as ez,jF as tz,jG as K3,jH as nz,jI as X3,jJ as Z3,jK as oz,jL as Q3,jM as e4,ed as gc,jN as rz,aI as iz,jO as sz,fk as Kn,jP as az,jQ as lz,jR as Ui,jS as _c,jT as Vi,fv as sr,jU as ym,jV as ra,jW as ia,jX as sa,jY as cz,fc as bc,jZ as xm,j_ as yc,eI as xc,r as dz,j$ as uz,k0 as hz,k1 as t4,t as D,k2 as fz,k3 as mz,k4 as wm,fO as vm,k5 as n4,fo as pz,aB as km,k6 as o4,k7 as gz,k8 as _z,k9 as bz,ka as yz,kb as xz,kc as wz,kd as vz,ke as kz,kf as Sz,kg as Cz,kh as Nz,ki as jz,kj as Ez,kk as Iz,kl as Az,km as Tz,kn as Mz,ko as Oz,kp as Dz,kq as Rz,kr as aa,ks as Pz,kt as Lz,ku as Fz,kv as zz,kw as Bz,kx as Uz,ky as r4,kz as Vz,kA as $z,kB as Hz,kC as i4,kD as Wz,kE as qz,kF as s4,kG as Gz,kH as $i,kI as Vn,kJ as Yz,kK as Jz,kL as Kz,kM as Xz,kN as Zz,kO as Qz,kP as eB,kQ as tB,kR as nB,kS as oB,kT as ar,kU as rB,kV as iB,kW as sB,kX as aB,ei as lB,kY as cB,kZ as a4,em as dB,k_ as wc,k$ as uB,l0 as hB,l1 as fB,l2 as mB,ah as Ar,l3 as vc,el as pB,l4 as Sm,l5 as kc,l6 as la,l7 as ca,l8 as Sc,l9 as lr,la as l4,lb as Fo,lc as Hi,ld as Cm,le as da,lf as Wi,lg as Nm,lh as jm,li as c4,lj as Cc,lk as gB,ad as ua,ll as ha,lm as _B,eH as Nc,ln as bB,lo as Em,lp as yB,lq as xB,lr as jc,ls as wB,lt as d4,lu as Im,gg as fa,lv as vB,lw as kB,lx as SB,ly as CB,ft as NB,bH as jB,gj as jt,lz as ma,lA as qi,lB as EB,lC as IB,lD as Am,lE as AB,lF as TB,bx as u4,lG as MB,lH as OB,lI as Ec,lJ as h4,eB as Ic,bJ as f4,ak as Ac,lK as Tm,lL as DB,lM as RB,dZ as PB,fg as LB,e_ as FB,W as m4,lN as zB,lO as BB,lP as p4,lQ as UB,lR as VB,lS as g4,lT as $B,lU as HB,bL as _4,lV as WB,lW as Mm,e3 as qB,lX as zo,dE as b4,lY as y4,e7 as x4,f6 as Om,lZ as Dm,l_ as w4,aO as Rm,dF as Tc,l$ as v4,m0 as GB,bG as Pm,m1 as YB,f2 as Lm,fV as JB,fZ as KB,g4 as Fm,g7 as XB,m2 as ZB,m3 as zm,m4 as QB,m5 as eU,m6 as tU,m7 as nU,m8 as oU,m9 as rU,ma as iU,mb as sU,U as aU,mc as Mc,V as lU,md as k4,fa as cU,me as S4,dw as C4,bt as Xn,mf as dU,eZ as uU,mg as hU,mh as N4,mi as fU,eG as mU,mj as pU,mk as gU,d_ as _U,ml as bU,mm as yU,an as Oc,mn as xU,ao as cr,dz as j4,mo as Bm,mp as wU,eg as E4,mq as I4,mr as vU,ms as kU,mt as SU,mu as CU,mv as NU,mw as jU,mx as A4,fR as Um,fP as Vm,fK as Gi,fQ as Tr,my as T4,fS as $m,fL as Mr,dQ as EU,mz as Hm,mA as IU,am as AU,mB as TU,fu as M4,E as Yi,mC as MU,mD as OU,mE as DU,mF as RU,mG as pa,mH as PU,mI as LU,mJ as FU,mK as zU,mL as BU,mM as O4,mN as UU,fj as VU,mO as $U,mP as HU,mQ as WU,mR as qU,g6 as GU,mS as YU,mT as JU,mU as KU,mV as D4,mW as R4,eX as P4,mX as XU,mY as L4,mZ as ZU,m_ as QU,m$ as Dc,n0 as eV,n1 as tV,n2 as nV,C as Wm,n3 as oV,n4 as rV,n5 as iV,bc as sV,n6 as F4,dO as aV,fM as lV,fN as cV,n7 as dV,n8 as Ji,n9 as uV,na as Rc,nb as hV,nc as fV,y as z4,nd as mV,dc as pV,ne as gV,eO as _V,bu as bV,br as yV,nf as Pc,ng as B4,nh as U4,ni as V4,nj as xV,e2 as wV,__tla as vV}from"./index-C4VFj4aB.js";import{G as kV,M as Lc,c as Fc,L as $4,g as SV,d as CV,e as ga,A as NV,s as jV,k as EV,B as H4,a as IV,b as AV,Y as TV,f as xn,h as Yt,u as zc,C as MV,S as OV,K as DV,i as RV,j as PV,l as W4,m as LV,n as qm,o as FV,p as zV,q as BV,r as _a,t as q4,v as UV,w as VV,P as Gm,x as $V,y as Ym,T as HV}from"./tree-BMOusOrc.js";import{c as G4,d as Y4,L as J4,P as Ki,I as Jm,e as WV,f as K4,N as X4,V as Z4,S as Q4,F as eS,g as tS,M as qV,l as nS,h as GV,E as oS,i as YV,j as Km,k as JV,m as KV,n as XV,o as ZV,p as QV,q as e$,s as t$,t as n$,v as o$,u as r$,C as i$,R as rS,a as s$,A as a$,w as l$,x as c$,O as d$,T as u$,y as h$,z as f$,__tla as m$}from"./useMarimoWebSocket-BsUbqg1d.js";import{c as p$}from"./_createAggregator-UrANbXdP.js";import{s as Zn,i as dr,T as Xm,a as Zm}from"./transform-Cyp0GDF-.js";import{g as iS}from"./timer-DFzT7np-.js";import{i as g$}from"./zoom-COrs4lFh.js";import{s as ba}from"./sortBy-Bb9JPW3o.js";let Qm,Bc,En,ep,sS,ya,tp,_$=Promise.all([(()=>{try{return vV}catch{}})(),(()=>{try{return m$}catch{}})()]).then(async()=>{var Jl,u3;var Bt=p$(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,fn,np,Uc,Xi,Zi,op,rp,ip,sp,xa,Vc,ap,wa,lp,$c,cp,dp,Hc,up,hp,fp,va,mp,Wc,pp,gp,_p,bp,yp,xp,qc,wp,Gc,vp,kp,Sp,Cp,Np,ka,jp,Ep,Yc,Ip,Ap,Tp,Jc,Mp,Op,Dp,Sa,Kc,Xc,Rp,Pp,Lp,Fp,zp,Bp,Qi,Up,Vp,$p,Zc,Qc,Hp,Wp,Ca,ur,hr;Et=Pe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),fn=Pe("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),np=Pe("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Uc=Pe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Xi=Pe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Zi=Pe("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),op=Pe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),rp=Pe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),ep=Pe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),ip=Pe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),sp=Pe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),xa=Pe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Vc=Pe("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),ap=Pe("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),wa=Pe("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),lp=Pe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),$c=Pe("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),cp=Pe("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),dp=Pe("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Hc=Pe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),up=Pe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),hp=Pe("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),fp=Pe("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),va=Pe("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),mp=Pe("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Wc=Pe("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),pp=Pe("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),gp=Pe("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),_p=Pe("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),bp=Pe("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),yp=Pe("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),xp=Pe("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),qc=Pe("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),wp=Pe("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Gc=Pe("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),vp=Pe("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),kp=Pe("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),Sp=Pe("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),Cp=Pe("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Np=Pe("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),ka=Pe("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),jp=Pe("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Ep=Pe("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Yc=Pe("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),Ip=Pe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ap=Pe("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Tp=Pe("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Jc=Pe("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Mp=Pe("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Op=Pe("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Dp=Pe("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),Sa=Pe("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Kc=Pe("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Xc=Pe("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Rp=Pe("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Pp=Pe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Lp=Pe("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Fp=Pe("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),zp=Pe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Bp=Pe("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),Qi=Pe("square-plus",[["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"}]]),Up=Pe("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Vp=Pe("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),$p=Pe("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),Zc=Pe("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Qc=Pe("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Hp=Pe("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),Wp=Pe("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),Ca=Pe("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),ur=Pe("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),hr=Pe("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const aS=A.createContext({}),lS=A.forwardRef(function(t,e){[t,e]=XL(t,e,aS);let{toolbarProps:n}=function(i,s){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=i;let[d,u]=A.useState(!1);YL(()=>{var p;u(!(!s.current||!(!((p=s.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=JL(),m=f==="rtl"&&c==="horizontal";let _=KL(s);const g=A.useRef(null);return{toolbarProps:{...p3(i,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=s.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=ZL({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=p3(t);return delete r.id,K.createElement("div",{...QL(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Na(t,e){const n=+kr(t)-+kr(e);return n<0?-1:n>0?1:n}function cS(t,e){const n=kr(t,e==null?void 0:e.in);return+function(o,r){const i=kr(o,r==null?void 0:r.in);return i.setHours(23,59,59,999),i}(n,e)==+function(o,r){const i=kr(o,r==null?void 0:r.in),s=i.getMonth();return i.setFullYear(i.getFullYear(),s+1,0),i.setHours(23,59,59,999),i}(n,e)}function dS(t,e,n){const[o,r,i]=Wf(n==null?void 0:n.in,t,t,e),s=Na(r,i),a=Math.abs(function(d,u,f){const[m,_]=Wf(f==null?void 0:f.in,d,u);return 12*(m.getFullYear()-_.getFullYear())+(m.getMonth()-_.getMonth())}(r,i));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-s*a);let l=Na(r,i)===-s;cS(o)&&a===1&&Na(o,i)===1&&(l=!1);const c=s*(a-+l);return c===0?0:c}function uS(t,e,n){const o=function(r,i){return+kr(r)-+kr(i)}(t,e)/1e3;return(r=>{const i=(0,Math.trunc)(r);return i===0?0:i})(o)}function hS(t,e){return function(n,o,r){const i=tF(),s=(r==null?void 0:r.locale)??i.locale??nF,a=Na(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=Wf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),u=uS(d,c),f=(g3(d)-g3(c))/1e3,m=Math.round((u-f)/60);let _;if(m<2)return m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<_3){const g=Math.round(m/60);return s.formatDistance("aboutXHours",g,l)}if(m<2520)return s.formatDistance("xDays",1,l);if(m<Zl){const g=Math.round(m/_3);return s.formatDistance("xDays",g,l)}if(m<2*Zl)return _=Math.round(m/Zl),s.formatDistance("aboutXMonths",_,l);if(_=dS(d,c),_<12){const g=Math.round(m/Zl);return s.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?s.formatDistance("aboutXYears",p,l):g<9?s.formatDistance("overXYears",p,l):s.formatDistance("almostXYears",p+1,l)}}(t,function(n){return eF(n,Date.now())}(t),e)}const fS=()=>{const t=X.c(7),{selectedLayout:e}=G4(),{setLayoutView:n}=Y4();if(qn()&&!Ei("wasm_layouts"))return null;let o,r,i,s;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Kf,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:h.jsx(Xf,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(qf,{children:h.jsxs(b3,{children:[h.jsx(oF,{children:"View as"}),J4.map(pS)]})}),t[3]=i):i=t[3],t[4]!==e||t[5]!==o?(s=h.jsxs(Zf,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,i]}),t[4]=e,t[5]=o,t[6]=s):s=t[6],s};function mS(t){const e=qp(t);return h.jsx(e,{className:"h-4 w-4"})}function qp(t){switch(t){case"vertical":return vp;case"grid":return kV;case"slides":return Jc;default:return Ql(t),Jf}}function Gp(t){return Yf(t)}function pS(t){return h.jsx(Gf,{value:t,children:h.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[mS(t),h.jsx("span",{children:Gp(t)})]})},t)}function gS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(s,a){const l=X.c(10);let c;l[0]!==a||l[1]!==s?(c=new rF(s,a),l[0]=a,l[1]=s,l[2]=c):c=l[2];const d=c;let u;l[3]!==d?(u=()=>d.get(),l[3]=d,l[4]=u):u=l[4];const[f,m]=A.useState(u);let _;l[5]!==d?(_=b=>{m(b),d.set(b)},l[5]=d,l[6]=_):_=l[6];const g=_;let p;return l[7]!==g||l[8]!==f?(p=[f,g],l[7]=g,l[8]=f,l[9]=p):p=l[9],p}("marimo:commands",e);let r,i;return t[1]!==n||t[2]!==o?(r=s=>{const a=(l=[s,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(i={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Yp(t){return t.dropdown!==void 0}function ja(t,e=""){return t.flatMap(n=>n.label?Yp(n)?ja(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const es=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let i;e[0]!==n?(i=K.Children.toArray(n),e[0]=n,e[1]=i):i=e[1];const[s,a]=i,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=h.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==s||e[6]!==c?(d=h.jsxs("div",{className:"multi-icon relative w-fit",children:[s,c]}),e[5]=s,e[6]=c,e[7]=d):d=e[7],d};function ed(t){const e=X.c(3),n=td();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Qe(o)}function Jp(){const t=X.c(2),e=td();let n;return t[0]!==e?(n=()=>e(w3(co())),t[0]=e,t[1]=n):n=t[1],Qe(n)}function td(){const t=X.c(2),{prepareForRun:e}=zt();let n;return t[0]!==e?(n=async o=>{var a;if(o.length===0)return;const{cellHandles:r,cellData:i}=co(),s=[];for(const l of o){const c=r[l],d=(a=c.current)==null?void 0:a.editorView;let u;d?(v3(d)!=="markdown"&&Qf(d),u=k3(d)):u=i[l].code,s.push(u),e({cellId:l})}await em({cellIds:o,codes:s}).catch(_S)},t[0]=e,t[1]=n):n=t[1],Qe(n)}function _S(t){mt.error(t)}const Ea=Ot(null),bS=Ot(!1),nd=Ot({chats:[],activeChatId:null}),yS=Ot(t=>{const e=t(nd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(nd,o=>({...o,activeChatId:n}))}),od=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],tm(window,"keydown",n,o);const r=t.children??"Undo";let i,s;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(sF,{className:"ml-2",shortcut:"cmd-z"}),e[3]=i):i=e[3],e[4]!==r||e[5]!==t?(s=h.jsxs(De,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",i]}),e[4]=r,e[5]=t,e[6]=s):s=e[6],s};function rd(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=zt();let o;return t[0]!==e||t[1]!==n?(o=r=>{if(ut.get(S3))return;const{cellId:i}=r;e({cellId:i}),aF({cellId:i}).catch(()=>{n()});const{dismiss:s}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:h.jsx(od,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=s},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function Kp(t,e,n,o=ut){if(e in o.get(nm))return!1;const{cellData:r,cellIds:i}=o.get(Js),s=new RegExp(`import[ ]+${t}[ ]+as[ ]+${e}`,"g");for(const a of i.inOrderIds)if(s.test(r[a].code))return!1;return n(`import ${t} as ${e}`),!0}function Bo(t,e,n){return Kp("marimo","mo",o=>{const r=C3.create();e({cellId:n??"__end__",before:!1,code:o,lastCodeRun:t?o:void 0,newCellId:r,autoFocus:!1}),t&&em({cellIds:[r],codes:[o]})})}function Xp(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=zt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const i=ec(r.cellId);if(!i)return;const s=k3(i);e(r);const{dismiss:a}=lt({title:"Cell split",action:h.jsx(od,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:s}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function id(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:i,moveCell:s,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=zt(),u=Xp(),f=ed(n==null?void 0:n.cellId),m=!We(S3),_=rd(),{openModal:g}=zn(),p=$t(Ea),b=We(tc),x=We(Ii),y=We(Ai),v=We(lF);if(!n||y){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:S,config:k,getEditorView:N,name:E,hasOutput:I,hasConsoleOutput:T,status:M}=n;let R;e[1]!==S||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const j={disabled:!k.disabled};await Cr({configs:{[S]:j}}),r({cellId:S,config:j})},e[1]=S,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const B=R;let O;e[5]!==S||e[6]!==k.hide_code||e[7]!==N||e[8]!==r?(O=async()=>{const j={hide_code:!k.hide_code};await Cr({configs:{[S]:j}}),r({cellId:S,config:j});const H=N();H&&(j.hide_code?H.contentDOM.blur():H.focus())},e[5]=S,e[6]=k.hide_code,e[7]=N,e[8]=r,e[9]=O):O=e[9];const z=O;let F,V,L,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx($p,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==S||e[12]!==E||e[13]!==g||e[14]!==i?(V=()=>{g(h.jsxs(rr,{children:[h.jsx(Ti,{children:h.jsx(ir,{children:"Rename cell"})}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Nr,{htmlFor:"cell-name",children:"Cell name"}),h.jsx(X4,{placeholder:"cell name",value:E,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>i({cellId:S,name:j})})]})]}))},e[11]=S,e[12]=E,e[13]=g,e[14]=i,e[15]=V):V=e[15],e[16]!==S||e[17]!==i?(L=j=>i({cellId:S,name:j}),e[16]=S,e[17]=i,e[18]=L):L=e[18],e[19]!==E||e[20]!==L?(C=h.jsx(X4,{placeholder:"cell name",value:E,onChange:L}),e[19]=E,e[20]=L,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==S||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==N||e[34]!==T||e[35]!==I||e[36]!==s||e[37]!==E||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==u||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==B||e[47]!==z?($=[[{icon:F,label:"Name",disableClick:!0,handle:kS,handleHeadless:V,rightElement:C},{icon:h.jsx(Ki,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:h.jsx(Ks,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(j=>(j==null?void 0:j.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:h.jsx(Kc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>u({cellId:S})},{icon:h.jsx(Jm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const H=document.getElementById(y3.create(j));H&&(H.classList.add("printing-output"),x3(H,"result.png").finally(()=>{H.classList.remove("printing-output")}))}(S)},{icon:h.jsx(dF,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=N();j&&cF({[S]:j})}},{icon:k.hide_code?h.jsx(N3,{size:13,strokeWidth:1.5}):h.jsx(j3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:k.disabled?h.jsx(ur,{size:13,strokeWidth:1.5}):h.jsx(hr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:h.jsx(uF,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:B}),handle:B},{icon:h.jsx(om,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:S})}}],[{icon:h.jsx(Lc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=N();j&&(Bo(x,o),Sr(j,"markdown",{keepCodeAsIs:!0}))}},{icon:h.jsx(or,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=N();j&&(Bo(x,o),Sr(j,"sql",{keepCodeAsIs:!0}))}},{icon:h.jsx(Fc,{}),label:"Toggle as Python",handle:()=>{const j=N();j&&(Bo(x,o),hF(j,"python",{force:!0}))}}],[{icon:h.jsxs(es,{children:[h.jsx(xa,{size:13,strokeWidth:1.5}),h.jsx(E3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:h.jsxs(es,{children:[h.jsx(xa,{size:13,strokeWidth:1.5}),h.jsx(Xs,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:h.jsx(E3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>s({cellId:S,before:!0})},{icon:h.jsx(Xs,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>s({cellId:S,before:!1})},{icon:h.jsx(I3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>s({cellId:S,direction:"left"}),hidden:v!=="columns"},{icon:h.jsx(Zs,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>s({cellId:S,direction:"right"}),hidden:v!=="columns"},{icon:h.jsx(rp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:S})},{icon:h.jsx(op,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S})},{icon:h.jsx(fF,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:S})}],[{icon:h.jsx($4,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!K4(E),tooltip:K4(E)?void 0:"Only named cells can be linked to",handle:async()=>{await bn(WV(E)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:h.jsx(rm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:S})}}]].map(wS).filter(xS),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=S,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=N,e[34]=T,e[35]=I,e[36]=s,e[37]=E,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=u,e[43]=M,e[44]=V,e[45]=C,e[46]=B,e[47]=z,e[48]=$):$=e[48],$}function xS(t){return t.length>0}function wS(t){return t.filter(vS)}function vS(t){return!t.hidden}function kS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}const Ia=Ot(null);function Or(){return We(Ia)}const SS=Ot(t=>{const e=t(Ia);return e?e===uo?null:Zp(e,t(Js)):null});function Zp(t,e){var l;const{cellData:n,cellHandles:o,cellRuntime:r}=e,i=n[t],s=r[t],a=(l=o[t])==null?void 0:l.current;return!i||!a?null:{cellId:t,name:i.name,config:i.config,status:s?s.status:"idle",getEditorView:()=>a.editorView,hasOutput:(s==null?void 0:s.output)!=null,hasConsoleOutput:(s==null?void 0:s.consoleOutputs)!=null}}function CS(t){return!t.hidden}const sd=Ot(!1),Qp=()=>{const t=X.c(37),[e,n]=yn(sd),o=CV(),r=We(SS),i=We(im);let s;t[0]!==r?(s={cell:r},t[0]=r,t[1]=s):s=t[1];let a=id(s).flat();a=ja(a);const l=function(){const L=X.c(45),{theme:C}=ho(),[$,j]=Mi(),[H,Y]=A3();let Z;L[0]!==j?(Z=async ie=>{await Oi({config:ie}).then(()=>{j(ie)})},L[0]=j,L[1]=Z):Z=L[1];const G=Z;let re;L[2]!==Y?(re=async ie=>{await mF({config:ie}).then(()=>{Y(ie)})},L[2]=Y,L[3]=re):re=L[3];const ne=re;let te;if(L[4]!==H||L[5]!==$||L[6]!==ne||L[7]!==G||L[8]!==C){let ie,ue,le;L[10]!==H?(ie=et=>et!==H.width,L[10]=H,L[11]=ie):ie=L[11],L[12]!==H||L[13]!==ne?(ue=et=>({label:`App config > Set width=${et}`,handle:()=>{ne({...H,width:et})}}),L[12]=H,L[13]=ne,L[14]=ue):ue=L[14],L[15]!==$||L[16]!==G||L[17]!==C?(le={label:"Config > Toggle dark mode",handle:()=>{G({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},L[15]=$,L[16]=G,L[17]=C,L[18]=le):le=L[18];const _e=$.keymap.preset==="vim";let ce,Ne;L[19]!==$||L[20]!==G?(ce=()=>{G({...$,keymap:{...$.keymap,preset:"vim"}})},L[19]=$,L[20]=G,L[21]=ce):ce=L[21],L[22]!==_e||L[23]!==ce?(Ne={label:"Config > Switch keymap to VIM",hidden:_e,handle:ce},L[22]=_e,L[23]=ce,L[24]=Ne):Ne=L[24];const je=$.keymap.preset==="default";let de,Ee,ge;L[25]!==$||L[26]!==G?(de=()=>{G({...$,keymap:{...$.keymap,preset:"default"}})},L[25]=$,L[26]=G,L[27]=de):de=L[27],L[28]!==de||L[29]!==je?(Ee={label:"Config > Switch keymap to default (current: VIM)",hidden:je,handle:de},L[28]=de,L[29]=je,L[30]=Ee):Ee=L[30],L[31]!==$||L[32]!==G?(ge=()=>{G({...$,completion:{...$.completion,copilot:!1}})},L[31]=$,L[32]=G,L[33]=ge):ge=L[33];const Oe=$.completion.copilot!=="github";let Fe,$e;L[34]!==ge||L[35]!==Oe?(Fe={label:"Config > Disable GitHub Copilot",handle:ge,hidden:Oe},L[34]=ge,L[35]=Oe,L[36]=Fe):Fe=L[36],L[37]!==$||L[38]!==G?($e=()=>{G({...$,completion:{...$.completion,copilot:"github"}})},L[37]=$,L[38]=G,L[39]=$e):$e=L[39];const Xe=$.completion.copilot==="github";let Le;L[40]!==$e||L[41]!==Xe?(Le={label:"Config > Enable GitHub Copilot",handle:$e,hidden:Xe},L[40]=$e,L[41]=Xe,L[42]=Le):Le=L[42],te=[...SV().filter(ie).map(ue),le,Ne,Ee,Fe,Le],L[4]=H,L[5]=$,L[6]=ne,L[7]=G,L[8]=C,L[9]=te}else te=L[9];const q=te;let Q;return L[43]!==q?(Q=q.filter(CS),L[43]=q,L[44]=Q):Q=L[44],Q}();let c=Eg();c=[...ja(c),...ja(l)];const d=c.filter(NS),u=nc.keyBy(d,jS),{recentCommands:f,addRecentCommand:m}=gS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==i||t[5]!==n?(p=L=>{_F(i.getHotkey("global.commandPalette").key)(L)&&(L.preventDefault(),n(ES))},t[4]=i,t[5]=n,t[6]=p):p=t[6],tm(document,"keydown",p),t[7]!==m||t[8]!==i||t[9]!==o||t[10]!==n?(b=(L,C)=>{const $=o[L];if(!$)return null;const j=i.getHotkey(L);return h.jsxs(fo,{disabled:C.disabled,onSelect:()=>{m(L),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[h.jsxs("span",{children:[j.name,C.tooltip&&h.jsx("span",{className:"ml-2",children:C.tooltip})]}),h.jsx(M3,{children:h.jsx(lm,{shortcut:j.key})})]},L)},t[7]=m,t[8]=i,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==i||t[14]!==n?(y=(L,C,$,j)=>{const H=$===void 0?{}:$;return h.jsxs(fo,{disabled:H.disabled,onSelect:()=>{m(L),n(!1),requestAnimationFrame(()=>{C()})},value:L,children:[h.jsxs("span",{children:[L,H.tooltip&&h.jsxs("span",{className:"ml-2",children:["(",H.tooltip,")"]})]}),j&&h.jsx(M3,{children:h.jsx(lm,{shortcut:i.getHotkey(j).key})})]},L)},t[12]=m,t[13]=i,t[14]=n,t[15]=y):y=t[15];const v=y,S=gF;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(Qs,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const N=am;let E;t[17]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx(oc,{children:"No results found."}),t[17]=E):E=t[17];const I=f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(sm,{heading:"Recently Used",children:f.map(L=>{const C=u[L];return pF(L)?x(L,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!Yp(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),h.jsx(T3,{})]}),T=sm,M=i.iterate().map(L=>{if(g.has(L))return null;const C=u[L];return x(L,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),R=d.map(L=>g.has(L.label)?null:v(L.label,L.handleHeadless||L.handle,{disabled:L.disabled,tooltip:L.tooltip}));let B;t[18]!==g||t[19]!==v?(B=L=>g.has(L.label)?null:v(`Cell > ${L.label}`,L.handleHeadless||L.handle,{disabled:L.disabled,tooltip:L.tooltip}),t[18]=g,t[19]=v,t[20]=B):B=t[20];const O=a.map(B);let z,F,V;return t[21]!==T||t[22]!==R||t[23]!==O||t[24]!==M?(z=h.jsxs(T,{heading:"Commands",children:[M,R,O]}),t[21]=T,t[22]=R,t[23]=O,t[24]=M,t[25]=z):z=t[25],t[26]!==N||t[27]!==z||t[28]!==E||t[29]!==I?(F=h.jsxs(N,{children:[E,I,z]}),t[26]=N,t[27]=z,t[28]=E,t[29]=I,t[30]=F):F=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==k?(V=h.jsxs(S,{open:e,onOpenChange:n,children:[k,F]}),t[31]=S,t[32]=e,t[33]=n,t[34]=F,t[35]=k,t[36]=V):V=t[36],V};function NS(t){return!t.hotkey}function jS(t){return t.label}function ES(t){return!t}const Aa="https://static.marimo.app",IS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=A.useState("");let i;i=Math.random().toString(36).slice(2,6);const s=`${o}-${i}`,a=`${Aa}/static/${s}`;let l,c,d,u,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==s?(l=async y=>{y.preventDefault(),n();const v=await bF({download:!1,includeCode:!0,files:Z4.INSTANCE.filenames()}),S=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Aa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:s})}).catch(()=>{S.dismiss(),lt({title:"Error uploading static page",description:h.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",h.jsx("a",{href:Gn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),lt({title:"Static page uploaded!",description:h.jsxs("div",{children:["The URL has been copied to your clipboard.",h.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=s,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ir,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs(Ti,{children:[c,h.jsxs(Di,{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"," ",h.jsx("a",{href:Aa,target:"_blank",children:Aa}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=u):u=e[5],e[6]!==o?(f=h.jsx(jr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(m=h.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:",h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(AS,{text:a}),h.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=h.jsx(De,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(p=h.jsx(De,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await bn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=h.jsxs(ea,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=h.jsx(rr,{className:"w-fit",children:h.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},AS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=un.stopPropagation(async c=>{c.preventDefault(),await bn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const i=r;let s,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Ri,{size:14,strokeWidth:1.5}),e[2]=s):s=e[2],e[3]!==i?(a=h.jsx(De,{"data-testid":"copy-static-notebook-url-button",onClick:i,size:"xs",variant:"secondary",children:s}),e[3]=i,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=h.jsx(Me,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function eg(){const t=X.c(3),{openConfirm:e}=zn(),n=$t(Ro);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:h.jsx(O3,{onClick:async()=>{n({state:Qt.CLOSING}),await yF(),xF()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const ad=[{type:"files",Icon:pp,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:rc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:or,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ka,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ga,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Xc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:cm,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Zc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:dm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:NV,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Lp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:xp,tooltip:"Secrets",hidden:qn(),position:"sidebar"},{type:"scratchpad",Icon:wF,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:om,tooltip:"View errors",position:"footer"}];function tg(){const t=X.c(2),e=$t(um);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let i;i=null;for(const s of Array.from(o)){const a=s.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){i=Pi.parse(s.parentNode.id);break}}e(s=>({mode:vF(s.mode),cellAnchor:i})),requestAnimationFrame(()=>{var s;i!==null&&((s=document.getElementById(Pi.create(i)))==null||s.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Dr(){return Ae.string().optional().describe(Je.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function ng(){return Ae.string().optional().describe(Je.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ta(){return Ae.string().optional().describe(Je.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function og(){return Ae.string().optional().describe(Je.of({label:"URI",optionRegex:".*uri.*"}))}function Rr(){return Ae.string().nonempty().describe(Je.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Uo(){return Ae.string().describe(Je.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Pr(){return Ae.string().nonempty().describe(Je.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Lr(t){const e=Ae.coerce.string().describe(Je.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function rg(){return Ae.boolean().default(!1).describe(Je.of({label:"Read Only"}))}const ig=Ae.object({type:Ae.literal("postgres"),host:Rr(),port:Lr(5432).optional(),database:Uo(),username:Pr(),password:Dr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),sg=Ae.object({type:Ae.literal("mysql"),host:Rr(),port:Lr(3306),database:Uo(),username:Pr(),password:Dr(),ssl:Ae.boolean().default(!1).describe(Je.of({label:"Use SSL"}))}).describe(Je.of({direction:"two-columns"})),ag=Ae.object({type:Ae.literal("sqlite"),database:Uo().describe(Je.of({label:"Database Path"}))}).describe(Je.of({direction:"two-columns"})),lg=Ae.object({type:Ae.literal("duckdb"),database:Uo().describe(Je.of({label:"Database Path"})),read_only:rg()}).describe(Je.of({direction:"two-columns"})),cg=Ae.object({type:Ae.literal("motherduck"),database:Uo().default("my_db").describe(Je.of({label:"Database Name"})),token:ng()}).describe(Je.of({direction:"two-columns"})),dg=Ae.object({type:Ae.literal("snowflake"),account:Ae.string().nonempty().describe(Je.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ae.string().optional().describe(Je.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Uo(),schema:Ae.string().optional().describe(Je.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Pr(),password:Dr(),role:Ae.string().optional().describe(Je.of({label:"Role"}))}).describe(Je.of({direction:"two-columns"})),ug=Ae.object({type:Ae.literal("bigquery"),project:Ae.string().nonempty().describe(Je.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ae.string().nonempty().describe(Je.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ae.string().describe(Je.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Je.of({direction:"two-columns"})),hg=Ae.object({type:Ae.literal("clickhouse_connect"),host:Rr(),port:Lr(8123).optional(),username:Pr(),password:Dr(),secure:Ae.boolean().default(!1).describe(Je.of({label:"Use HTTPs"}))}).describe(Je.of({direction:"two-columns"})),fg=Ae.object({type:Ae.literal("timeplus"),host:Rr().default("localhost"),port:Lr(8123).optional(),username:Pr().default("default"),password:Dr().default("")}).describe(Je.of({direction:"two-columns"})),mg=Ae.object({type:Ae.literal("chdb"),database:Uo().describe(Je.of({label:"Database Path"})),read_only:rg()}).describe(Je.of({direction:"two-columns"})),pg=Ae.object({type:Ae.literal("trino"),host:Rr(),port:Lr(8080),database:Uo(),schema:Ae.string().describe(Je.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Pr(),password:Dr(),async_support:Ae.boolean().default(!1).describe(Je.of({label:"Async Support"}))}).describe(Je.of({direction:"two-columns"})),gg=Ae.object({type:Ae.literal("iceberg"),name:Ae.string().describe(Je.of({label:"Catalog Name"})),catalog:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("REST"),warehouse:Ta(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:ng()}),Ae.object({type:Ae.literal("SQL"),warehouse:Ta(),uri:Ae.string().optional().describe(Je.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ae.object({type:Ae.literal("Hive"),warehouse:Ta(),uri:og()}),Ae.object({type:Ae.literal("Glue"),warehouse:Ta(),uri:og()}),Ae.object({type:Ae.literal("DynamoDB"),"dynamodb.profile-name":Ae.string().optional().describe(Je.of({label:"Profile Name"})),"dynamodb.region":Ae.string().optional().describe(Je.of({label:"Region"})),"dynamodb.access-key-id":Ae.string().optional().describe(Je.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ae.string().optional().describe(Je.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ae.string().optional().describe(Je.of({label:"Session Token",inputType:"password"}))})]).describe(Je.of({special:"tabs"}))}),_g=Ae.object({type:Ae.literal("datafusion"),sessionContext:Ae.boolean().optional().describe(Je.of({label:"Use Session Context"}))}),bg=Ae.object({type:Ae.literal("pyspark"),host:Rr().optional(),port:Lr().optional()}),TS=Ae.discriminatedUnion("type",[ig,sg,ag,lg,cg,dg,ug,hg,fg,mg,pg,gg,_g,bg]),ld="env:";function Ma(t){return typeof t=="string"&&t.startsWith(ld)}function cd(t){return`${ld}${t}`}const yg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck"};class mn{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class MS{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),Ma(n)){const r=n.replace(ld,""),i=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=i,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Fr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Fr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return Ma(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
3
- `)}}class OS extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),i=this.secrets.printInFString("port",this.connection.port),s=this.secrets.printInFString("database",this.connection.database);return Dt(`
4
- DATABASE_URL = f"postgresql://${o}:${n}@${r}:${i}/${s}"
5
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
6
- `)}}class DS extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),i=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port);return Dt(`
7
- DATABASE_URL = f"mysql+pymysql://${r}:${n}@${i}:${s}/${o}"
8
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
9
- `)}}class RS extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.database?this.secrets.printInFString("database",this.connection.database):"",n=e.startsWith("{")&&e.endsWith("}")?`DATABASE_URL = f"sqlite:///${e}"`:`DATABASE_URL = "sqlite:///${e}"`;return Dt(`
10
- ${n}
11
- engine = ${this.orm}.create_engine(DATABASE_URL)
12
- `)}}class PS extends mn{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"SNOWFLAKE_PASSWORD",!1),n={account:this.secrets.print("account",this.connection.account),user:this.secrets.print("user",this.connection.username),database:this.secrets.print("database",this.connection.database),warehouse:this.connection.warehouse?this.secrets.print("warehouse",this.connection.warehouse):void 0,schema:this.connection.schema?this.secrets.print("schema",this.connection.schema):void 0,role:this.connection.role?this.secrets.print("role",this.connection.role):void 0,password:e};return Dt(`
13
- engine = ${this.orm}.create_engine(
14
- URL(
15
- ${xg(n,o=>` ${o}`)},
16
- )
17
- )
18
- `)}}class LS extends mn{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return Dt(`
19
- credentials = json.loads("""${this.connection.credentials_json}""")
20
- engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
21
- `)}}class FS extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return Dt(`
22
- DATABASE_URL = "${e}"
23
- engine = ${this.orm}.connect(DATABASE_URL, read_only=${Fr(this.connection.read_only)})
24
- `)}}class zS extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return Dt(`
25
- conn = duckdb.connect("md:${e}")
26
- `);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return Dt(`
27
- conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
28
- `)}}class BS extends mn{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),n={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?e:void 0};return Dt(`
29
- engine = ${this.orm}.get_client(
30
- ${xg(n,o=>` ${o}`)},
31
- )
32
- `)}}class US extends mn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0),n=this.secrets.printInFString("username",this.connection.username),o=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port);return Dt(`
33
- DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
34
- engine = ${this.orm}.create_engine(DATABASE_URL)
35
- `)}}class VS extends mn{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return Dt(`
36
- engine = ${this.orm}.connect(${e}, read_only=${Fr(this.connection.read_only)})
37
- `)}}class $S extends mn{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),i=this.secrets.printInFString("port",this.connection.port),s=this.secrets.printInFString("database",this.connection.database),a=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return Dt(`
38
- engine = ${this.orm}.create_engine(f"${e}://${o}:${a}@${r}:${i}/${s}${n}")
39
- `)}}class HS extends mn{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:fm(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([s,a])=>a!=null&&a!==""&&s!=="type"));for(const[s,a]of Object.entries(e))Ma(a)?e[s]=this.secrets.print(s,a):typeof a=="string"&&(e[s]=`"${a}"`);const n=(o=e,r=s=>` ${s}`,Object.entries(o).filter(([,s])=>s!=null&&s!=="").map(([s,a])=>{const l=`"${s}"`;return r(typeof a=="boolean"?`${l}: ${Fr(a)}`:`${l}: ${a}`)}).join(`,
40
- `));var o,r;const i=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return Dt(`
41
- catalog = RestCatalog(
42
- ${i},
43
- **{
44
- ${n}
45
- },
46
- )
47
- `);case"SQL":return Dt(`
48
- catalog = SqlCatalog(
49
- ${i},
50
- **{
51
- ${n}
52
- },
53
- )
54
- `);case"Hive":return Dt(`
55
- catalog = HiveCatalog(
56
- ${i},
57
- **{
58
- ${n}
59
- },
60
- )
61
- `);case"Glue":return Dt(`
62
- catalog = GlueCatalog(
63
- ${i},
64
- **{
65
- ${n}
66
- },
67
- )
68
- `);case"DynamoDB":return Dt(`
69
- catalog = DynamoDBCatalog(
70
- ${i},
71
- **{
72
- ${n}
73
- },
74
- )
75
- `);default:fm(this.connection.catalog)}}}class WS extends mn{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?Dt(`
76
- ctx = SessionContext()
77
- # Sample table
78
- _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
79
-
80
- con = ibis.datafusion.connect(ctx)
81
- `):Dt(`
82
- con = ibis.datafusion.connect()
83
- `)}}class qS extends mn{generateImports(){return["import ibis","from pyspark.sql import SparkSession"]}generateConnectionCode(){if(this.connection.host||this.connection.port){const e=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port);return Dt(`
84
- session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
85
- con = ibis.pyspark.connect(session)
86
- `)}return Dt(`
87
- con = ibis.pyspark.connect()
88
- `)}}class GS{constructor(){this.secrets=new MS}createGenerator(e,n){switch(e.type){case"postgres":return new OS(e,n,this.secrets);case"mysql":return new DS(e,n,this.secrets);case"sqlite":return new RS(e,n,this.secrets);case"snowflake":return new PS(e,n,this.secrets);case"bigquery":return new LS(e,n,this.secrets);case"duckdb":return new FS(e,n,this.secrets);case"motherduck":return new zS(e,n,this.secrets);case"clickhouse_connect":return new BS(e,n,this.secrets);case"timeplus":return new US(e,n,this.secrets);case"chdb":return new VS(e,n,this.secrets);case"trino":return new $S(e,n,this.secrets);case"iceberg":return new HS(e,n,this.secrets);case"datafusion":return new WS(e,n,this.secrets);case"pyspark":return new qS(e,n,this.secrets);default:fm(e)}}}function Fr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function xg(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Fr(o)}`:`${n}=${o}`)).join(`,
89
- `)}function wg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const vg=t=>{const e=X.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[i,s]=K.useState(""),[a,l]=K.useState(""),[c,d]=K.useState(n[0]);let u;e[0]!==i||e[1]!==c||e[2]!==r||e[3]!==a?(u=async V=>{if(V.preventDefault(),c)if(i&&a&&c)try{await SF({key:i,value:a,provider:"dotenv",name:c}),lt({title:"Secret created",description:"The secret has been created successfully."}),r(i)}catch{lt({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else lt({title:"Error",description:"Please fill in all fields.",variant:"danger"});else lt({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=i,e[1]=c,e[2]=r,e[3]=a,e[4]=u):u=e[4];const f=u;let m,_,g,p,b,x,y,v,S,k,N,E,I,T,M,R;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsxs(Ti,{children:[h.jsx(ir,{children:"Add Secret"}),h.jsx(Di,{children:"Add a new secret to your environment variables."})]}),e[5]=m):m=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Nr,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=V=>{s(V.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==i?(p=h.jsxs("div",{className:"grid gap-2",children:[_,h.jsx(jr,{id:"key",value:i,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=i,e[9]=p):p=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Nr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(x=V=>l(V.target.value),e[11]=x):x=e[11],e[12]!==a?(y=h.jsx(jr,{id:"value",type:"text",value:a,onChange:x,required:!0,autoComplete:"off"}),e[12]=a,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(v=window.location.href.startsWith("http://")&&h.jsx(D3,{children:"Note: You are sending this key over http."}),e[14]=v):v=e[14],e[15]!==y?(S=h.jsxs("div",{className:"grid gap-2",children:[b,y,v]}),e[15]=y,e[16]=S):S=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(Nr,{htmlFor:"location",children:"Location"}),e[17]=k):k=e[17],e[18]!==n.length?(N=n.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=N):N=e[19],e[20]!==c||e[21]!==n?(E=n.length>0&&h.jsxs(Zf,{value:c,onValueChange:V=>d(V),children:[h.jsx(Kf,{children:h.jsx(Xf,{placeholder:"Select a provider"})}),h.jsx(qf,{children:n.map(YS)})]}),e[20]=c,e[21]=n,e[22]=E):E=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsxs(D3,{children:["You can configure the location by setting the"," ",h.jsx(mm,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=I):I=e[23],e[24]!==N||e[25]!==E?(T=h.jsxs("div",{className:"grid gap-2",children:[k,N,E,I]}),e[24]=N,e[25]=E,e[26]=T):T=e[26],e[27]!==S||e[28]!==T||e[29]!==p?(M=h.jsxs("div",{className:"grid gap-4 py-4",children:[p,S,T]}),e[27]=S,e[28]=T,e[29]=p,e[30]=M):M=e[30],e[31]!==o?(R=h.jsx(De,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=R):R=e[32];const B=!i||!a||!c;let O,z,F;return e[33]!==B?(O=h.jsx(De,{type:"submit",disabled:B,children:"Add Secret"}),e[33]=B,e[34]=O):O=e[34],e[35]!==R||e[36]!==O?(z=h.jsxs(ea,{children:[R,O]}),e[35]=R,e[36]=O,e[37]=z):z=e[37],e[38]!==f||e[39]!==M||e[40]!==z?(F=h.jsx(rr,{children:h.jsxs("form",{onSubmit:f,children:[m,M,z]})}),e[38]=f,e[39]=M,e[40]=z,e[41]=F):F=e[41],F};function YS(t){return h.jsx(Gf,{value:t,children:t},t)}const kg=A.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:jn.NOOP}),JS=t=>{const e=X.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,loading:i,error:s,reload:a}=Yn(QS,o);let l,c,d,u;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==s||e[6]!==i||e[7]!==a||e[8]!==l||e[9]!==c?(d={secretKeys:l,providerNames:c,loading:i,error:s,refreshSecrets:a},e[5]=s,e[6]=i,e[7]=a,e[8]=l,e[9]=c,e[10]=d):d=e[10],e[11]!==n||e[12]!==d?(u=h.jsx(kg.Provider,{value:d,children:n}),e[11]=n,e[12]=d,e[13]=u):u=e[13],u};function KS(t){return t.provider!=="env"}function XS(t){return t.name}function ZS(t){return t.keys}async function QS(){const t=await Q4.request({}),e=wg(t.secrets).filter(KS).map(XS);return{secretKeys:t.secrets.flatMap(ZS).sort(),providerNames:e}}const Sg=[{name:"PostgreSQL",schema:ig,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:sg,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:ag,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:lg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:cg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:dg,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:hg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:fg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:ug,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:mg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:pg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:_g,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:bg,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}}],Cg=[{name:"Iceberg",schema:gg,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],eC=t=>{const e=X.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=u=>{const{name:f,schema:m,color:_,logo:g}=u;return h.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(m),children:[h.jsx(U3,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),h.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let i,s,a,l,c,d;return e[2]!==r?(i=Sg.map(r),e[2]=r,e[3]=i):i=e[3],e[4]!==i?(s=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:i}),e[4]=i,e[5]=s):s=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",h.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Cg.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==s||e[12]!==c?(d=h.jsxs(h.Fragment,{children:[s,a,c]}),e[11]=s,e[12]=c,e[13]=d):d=e[13],d},tC=[{isMatch:t=>{if(t instanceof Ae.ZodString||t instanceof Ae.ZodNumber){const{optionRegex:e}=Je.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:i}=A.useContext(kg),{openModal:s,closeModal:a}=zn(),{label:l,description:c,optionRegex:d=""}=Je.parse(t._def.description||""),[u,f]=Bt(o,m=>new RegExp(d,"i").test(m));return h.jsx(R3,{control:e.control,name:n,render:({field:m})=>h.jsxs(P3,{children:[h.jsx(CF,{children:l}),h.jsx(NF,{children:c}),h.jsx(L3,{children:h.jsxs("div",{className:"flex gap-2",children:[t instanceof Ae.ZodString?h.jsx(jr,{...m,value:m.value,onChange:m.onChange,className:Te("flex-1")}):h.jsx(jF,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),h.jsxs(ic,{children:[h.jsx(sc,{asChild:!0,children:h.jsx(De,{variant:"outline",size:"icon",className:Te(Ma(m.value)&&"bg-accent"),children:h.jsx(qc,{className:"h-3 w-3"})})}),h.jsxs(ac,{align:"end",className:"max-h-60 overflow-y-auto",children:[h.jsxs(rn,{onSelect:()=>{s(h.jsx(vg,{providerNames:r,onSuccess:_=>{i(),m.onChange(cd(_)),a()},onClose:a}))},children:[h.jsx(xa,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),u.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(Po,{}),h.jsx(EF,{children:"Recommended"})]}),u.map(_=>h.jsx(rn,{onSelect:()=>m.onChange(cd(_)),children:_},_)),f.length>0&&h.jsx(Po,{}),f.map(_=>h.jsx(rn,{onSelect:()=>m.onChange(cd(_)),children:_},_))]})]})]})}),h.jsx(F3,{})]})})}}],nC=t=>{var $;const e=X.c(49),{schema:n,onSubmit:o,onBack:r}=t;let i,s,a;e[0]!==n?(i=IF(n),e[0]=n,e[1]=i):i=e[1],e[2]!==n?(s=z3(n),e[2]=n,e[3]=s):s=e[3],e[4]!==i||e[5]!==s?(a={defaultValues:i,resolver:s,reValidateMode:"onChange"},e[4]=i,e[5]=s,e[6]=a):a=e[6];const l=B3(a),c=($=[...Sg,...Cg].find(j=>j.schema===n))==null?void 0:$.connectionLibraries,[d,u]=A.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=zt(),m=Or();let _;e[7]!==f||e[8]!==m?(_=j=>{f({code:j,before:!1,cellId:m??"__end__",skipIfCodeExists:!0,autoFocus:!0})},e[7]=f,e[8]=m,e[9]=_):_=e[9];const g=_;let p;e[10]!==g||e[11]!==o||e[12]!==d?(p=j=>{g(function(H,Y){if(!(Y in yg))throw new Error(`Unsupported library: ${Y}`);TS.parse(H);const Z=new GS,G=Z.createGenerator(H,Y),re=G.generateConnectionCode(),ne=Z.secrets,te=[...new Set([...ne.imports,...G.imports])].sort();te.push("");const q=ne.formatSecrets();return q&&te.push(q),te.push(re.trim()),te.join(`
90
- `)}(j,d)),o()},e[10]=g,e[11]=o,e[12]=d,e[13]=p):p=e[13];const b=p;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(AF,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=h.jsx(JS,{children:h.jsx(TF,{schema:n,form:l,renderers:tC,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let S;e[21]!==r?(S=h.jsx(De,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=S):S=e[22];const k=!l.formState.isValid;let N,E;e[23]!==k?(N=h.jsx(De,{type:"submit",disabled:k,children:"Add"}),e[23]=k,e[24]=N):N=e[24],e[25]!==S||e[26]!==N?(E=h.jsxs("div",{className:"flex gap-2",children:[S,N]}),e[25]=S,e[26]=N,e[27]=E):E=e[27];const I=Zf;let T,M;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=j=>u(j),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(M=h.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[h.jsx(Kf,{children:h.jsx(Xf,{placeholder:"Select a library"})}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=M):M=e[29];const R=qf,B=b3,O=c==null?void 0:c.libraries.map(rC);let z,F,V,L,C;return e[30]!==B||e[31]!==O?(z=h.jsx(B,{children:O}),e[30]=B,e[31]=O,e[32]=z):z=e[32],e[33]!==R||e[34]!==z?(F=h.jsx(R,{children:z}),e[33]=R,e[34]=z,e[35]=F):F=e[35],e[36]!==I||e[37]!==d||e[38]!==T||e[39]!==M||e[40]!==F?(V=h.jsx("div",{children:h.jsxs(I,{value:d,onValueChange:T,children:[M,F]})}),e[36]=I,e[37]=d,e[38]=T,e[39]=M,e[40]=F,e[41]=V):V=e[41],e[42]!==E||e[43]!==V?(L=h.jsxs("div",{className:"flex gap-2 justify-between",children:[E,V]}),e[42]=E,e[43]=V,e[44]=L):L=e[44],e[45]!==L||e[46]!==x||e[47]!==v?(C=h.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,L]}),e[45]=L,e[46]=x,e[47]=v,e[48]=C):C=e[48],C},oC=t=>{const e=X.c(5),{onSubmit:n}=t,[o,r]=A.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(eC,{onSelect:r}),e[0]=a):a=e[0],a}let i,s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=()=>r(null),e[1]=i):i=e[1],e[2]!==n||e[3]!==o?(s=h.jsx(nC,{schema:o,onSubmit:n,onBack:i}),e[2]=n,e[3]=o,e[4]=s):s=e[4],s},Ng=t=>{const e=X.c(6),{children:n}=t,[o,r]=A.useState(!1);let i,s,a;return e[0]!==n?(i=h.jsx(MF,{asChild:!0,children:n}),e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(jg,{onClose:()=>r(!1)}),e[2]=s):s=e[2],e[3]!==o||e[4]!==i?(a=h.jsxs(OF,{open:o,onOpenChange:r,children:[i,s]}),e[3]=o,e[4]=i,e[5]=a):a=e[5],a},jg=t=>{const e=X.c(4),{onClose:n}=t;let o,r,i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ir,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsxs(Ti,{className:"mb-4",children:[o,h.jsxs(Di,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",h.jsx(mm,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(i=h.jsxs(rr,{className:"max-h-[75vh] overflow-y-auto",children:[r,h.jsx(oC,{onSubmit:()=>n()})]}),e[2]=n,e[3]=i):i=e[3],i};function rC(t){return h.jsx(Gf,{value:t,children:yg[t]},t)}const iC=()=>{const t=X.c(2),{updateCellConfig:e}=zt();let n;return t[0]!==e?(n=async()=>{const o=new ta,r=co(),i=r.cellIds.inOrderIds,s={};for(const l of i){if(r.cellData[l]===void 0)continue;const{code:c,config:d}=r.cellData[l];d.hide_code||o.isSupported(c)&&(s[l]={hide_code:!0})}const a=nc.entries(s);if(a.length!==0){await Cr({configs:s});for(const[l,c]of a)e({cellId:l,config:c})}},t[0]=e,t[1]=n):n=t[1],n},ts=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Eg(){const t=X.c(150),e=lc(),{openModal:n,closeModal:o}=zn(),{toggleApplication:r}=Li(),{selectedPanel:i}=cc(),[s]=yn(um),a=We(Ai),l=iC(),{updateCellConfig:c,undoDeleteCell:d,clearAllCellOutputs:u,upsertSetupCell:f,collapseAllCells:m,expandAllCells:_}=zt(),g=eg(),p=Jp(),b=function(Ft){const vt=X.c(4),{openPrompt:Cn,closeModal:Nn}=zn();let ji;return vt[0]!==Nn||vt[1]!==Cn||vt[2]!==Ft?(ji=()=>{if(!Ft)return null;const Kl=hm.guessDeliminator(Ft),Vf=Bn.basename(Ft);Cn({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Vf}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:$f=>{const Xl=Kl.join(Bn.dirname(Ft),$f);kF({source:Ft,destination:Xl}).then(()=>{Nn(),lt({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${Xl}`,"_blank")})}})},vt[0]=Nn,vt[1]=Cn,vt[2]=Ft,vt[3]=ji):ji=vt[3],ji}(e),x=$t(sd),y=$t(jV),v=$t(EV),S=We(DF),k=We(RF),N=We(V3),{selectedLayout:E}=G4(),{setLayoutView:I}=Y4(),T=tg(),M=jC;let R,B,O,z,F,V,L,C,$,j,H,Y,Z;t[0]===Symbol.for("react.memo_cache_sentinel")?(R=h.jsx(Rp,{size:14,strokeWidth:1.5}),t[0]=R):R=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx(LF,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1],t[2]!==o||t[3]!==n?(O={icon:B,label:"Publish HTML to web",handle:async()=>{n(h.jsx(IS,{onClose:o}))}},t[2]=o,t[3]=n,t[4]=O):O=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(z={icon:h.jsx($4,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:NC},t[5]=z):z=t[5],t[6]!==O?(F={icon:R,label:"Share",handle:ts,dropdown:[O,z]},t[6]=O,t[7]=F):F=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(V=h.jsx(pm,{size:14,strokeWidth:1.5}),t[8]=V):V=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(eS,{size:14,strokeWidth:1.5}),t[9]=L):L=t[9],t[10]!==e?(C={icon:L,label:"Download as HTML",handle:async()=>{e?await tS({filename:e,includeCode:!0}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[10]=e,t[11]=C):C=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(eS,{size:14,strokeWidth:1.5}),t[12]=$):$=t[12],t[13]!==e?(j={icon:$,label:"Download as HTML (exclude code)",handle:async()=>{e?await tS({filename:e,includeCode:!1}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[13]=e,t[14]=j):j=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(H={icon:h.jsx(Lc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:CC},Y={icon:h.jsx(lp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:SC},t[15]=H,t[16]=Y):(H=t[15],Y=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Jm,{size:14,strokeWidth:1.5}),t[17]=Z):Z=t[17];const G=s.mode!=="present";let re,ne,te;t[18]!==s.mode?(re=s.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",hn("global.hideCode",!1)]}),t[18]=s.mode,t[19]=re):re=t[19],t[20]!==G||t[21]!==re?(ne={divider:!0,icon:Z,label:"Download as PNG",disabled:G,tooltip:re,handle:kC},t[20]=G,t[21]=re,t[22]=ne):ne=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(te=h.jsx(FF,{size:14,strokeWidth:1.5}),t[23]=te):te=t[23];const q=s.mode!=="present";let Q,ie,ue,le,_e,ce,Ne,je,de,Ee,ge,Oe,Fe,$e,Xe;if(t[24]!==s.mode?(Q=s.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",hn("global.hideCode",!1)]}),t[24]=s.mode,t[25]=Q):Q=t[25],t[26]!==q||t[27]!==Q?(ie={icon:te,label:"Download as PDF",disabled:q,tooltip:Q,handle:wC},t[26]=q,t[27]=Q,t[28]=ie):ie=t[28],t[29]!==ne||t[30]!==ie||t[31]!==C||t[32]!==j?(ue={icon:V,label:"Download",handle:ts,dropdown:[C,j,H,Y,ne,ie]},t[29]=ne,t[30]=ie,t[31]=C,t[32]=j,t[33]=ue):ue=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(le=h.jsx(Ip,{size:14,strokeWidth:1.5}),t[34]=le):le=t[34],t[35]!==i||t[36]!==r?(_e=ad.flatMap(Ft=>{const{type:vt,Icon:Cn,hidden:Nn}=Ft;return Nn?[]:{label:Yf(vt),rightElement:M(i===vt),icon:h.jsx(Cn,{size:14,strokeWidth:1.5}),handle:()=>r(vt)}}),t[35]=i,t[36]=r,t[37]=_e):_e=t[37],t[38]!==_e?(ce={divider:!0,icon:le,label:"Helper panel",handle:ts,dropdown:_e},t[38]=_e,t[39]=ce):ce=t[39],t[40]===Symbol.for("react.memo_cache_sentinel")?(Ne=h.jsx(Jc,{size:14,strokeWidth:1.5}),t[40]=Ne):Ne=t[40],t[41]!==s.mode?(je=s.mode==="present"?h.jsx($3,{size:14,strokeWidth:1.5}):h.jsx(Gc,{size:14,strokeWidth:1.5}),t[41]=s.mode,t[42]=je):je=t[42],t[43]!==T?(de=()=>{T()},t[43]=T,t[44]=de):de=t[44],t[45]!==je||t[46]!==de?(Ee={icon:je,label:"Toggle app view",hotkey:"global.hideCode",handle:de},t[45]=je,t[46]=de,t[47]=Ee):Ee=t[47],t[48]!==E||t[49]!==I||t[50]!==Ee||t[51]!==T||t[52]!==s.mode){let Ft;t[54]!==E||t[55]!==I||t[56]!==T||t[57]!==s.mode?(Ft=(vt,Cn)=>{const Nn=qp(vt);return{divider:Cn===0,label:Gp(vt),icon:h.jsx(Nn,{size:14,strokeWidth:1.5}),rightElement:h.jsx("div",{className:"w-8 flex justify-end",children:E===vt&&h.jsx(dc,{size:14})}),handle:()=>{I(vt),s.mode==="edit"&&T()}}},t[54]=E,t[55]=I,t[56]=T,t[57]=s.mode,t[58]=Ft):Ft=t[58],ge={icon:Ne,label:"Present as",handle:ts,dropdown:[Ee,...J4.map(Ft)]},t[48]=E,t[49]=I,t[50]=Ee,t[51]=T,t[52]=s.mode,t[53]=ge}else ge=t[53];t[59]===Symbol.for("react.memo_cache_sentinel")?(Oe=h.jsx(mp,{size:14,strokeWidth:1.5}),t[59]=Oe):Oe=t[59],t[60]!==e?(Fe=!e||qn(),t[60]=e,t[61]=Fe):Fe=t[61],t[62]!==b||t[63]!==Fe?($e={icon:Oe,label:"Create notebook copy",hidden:Fe,handle:b},t[62]=b,t[63]=Fe,t[64]=$e):$e=t[64],t[65]===Symbol.for("react.memo_cache_sentinel")?(Xe=h.jsx(Vc,{size:14,strokeWidth:1.5}),t[65]=Xe):Xe=t[65];const Le=!e;let et,nt;t[66]!==Le?(et={icon:Xe,label:"Copy code to clipboard",hidden:Le,handle:xC},t[66]=Le,t[67]=et):et=t[67],t[68]===Symbol.for("react.memo_cache_sentinel")?(nt=h.jsx(hr,{size:14,strokeWidth:1.5}),t[68]=nt):nt=t[68];const it=!S||a;let oe,ve,Ie;t[69]!==c?(oe=async()=>{const Ft=co(),vt=zF(Ft),Cn=nc.fromEntries(vt.map(yC));await Cr({configs:Cn});for(const Nn of vt)c({cellId:Nn,config:{disabled:!1}})},t[69]=c,t[70]=oe):oe=t[70],t[71]!==it||t[72]!==oe?(ve={icon:nt,label:"Enable all cells",hidden:it,handle:oe},t[71]=it,t[72]=oe,t[73]=ve):ve=t[73],t[74]===Symbol.for("react.memo_cache_sentinel")?(Ie=h.jsx(ur,{size:14,strokeWidth:1.5}),t[74]=Ie):Ie=t[74];const ze=!k||a;let J,me,pe,he,ke,xe,Ue,Ze,ae,Se,Ce,Be,He,Re,Ge;t[75]!==c?(J=async()=>{const Ft=co(),vt=w3(Ft),Cn=nc.fromEntries(vt.map(bC));await Cr({configs:Cn});for(const Nn of vt)c({cellId:Nn,config:{disabled:!0}})},t[75]=c,t[76]=J):J=t[76],t[77]!==ze||t[78]!==J?(me={icon:Ie,label:"Disable all cells",hidden:ze,handle:J},t[77]=ze,t[78]=J,t[79]=me):me=t[79],t[80]===Symbol.for("react.memo_cache_sentinel")?(pe=h.jsx(j3,{size:14,strokeWidth:1.5}),t[80]=pe):pe=t[80],t[81]!==l?(he={icon:pe,label:"Hide all markdown code",handle:l},t[81]=l,t[82]=he):he=t[82],t[83]===Symbol.for("react.memo_cache_sentinel")?(ke=h.jsx(sp,{size:14,strokeWidth:1.5}),t[83]=ke):ke=t[83],t[84]!==m?(xe={icon:ke,label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:m},t[84]=m,t[85]=xe):xe=t[85],t[86]===Symbol.for("react.memo_cache_sentinel")?(Ue=h.jsx(ip,{size:14,strokeWidth:1.5}),t[86]=Ue):Ue=t[86],t[87]!==_?(Ze={icon:Ue,label:"Expand all sections",hotkey:"global.expandAllSections",handle:_},t[87]=_,t[88]=Ze):Ze=t[88],t[89]===Symbol.for("react.memo_cache_sentinel")?(ae=h.jsx(dp,{size:14,strokeWidth:1.5}),t[89]=ae):ae=t[89],t[90]!==f?(Se={icon:ae,label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},t[90]=f,t[91]=Se):Se=t[91],t[92]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx(om,{size:14,strokeWidth:1.5}),t[92]=Ce):Ce=t[92],t[93]!==u?(Be={icon:Ce,label:"Clear all outputs",handle:()=>{u()}},t[93]=u,t[94]=Be):Be=t[94],t[95]===Symbol.for("react.memo_cache_sentinel")?(He=h.jsx(hp,{size:14,strokeWidth:1.5}),t[95]=He):He=t[95],t[96]!==p?(Re={icon:He,label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{p()}},t[96]=p,t[97]=Re):Re=t[97],t[98]===Symbol.for("react.memo_cache_sentinel")?(Ge=h.jsx(Qc,{size:14,strokeWidth:1.5}),t[98]=Ge):Ge=t[98];const ot=!N||a;let Ye,rt,gt,xt,Mt,wt,Vt,Sn,dn,on,Zt,Wn,lo,yi,xi,wi,vi,ki,nr,Si;t[99]!==d?(Ye=()=>{d()},t[99]=d,t[100]=Ye):Ye=t[100],t[101]!==ot||t[102]!==Ye?(rt={icon:Ge,label:"Undo cell deletion",hidden:ot,handle:Ye},t[101]=ot,t[102]=Ye,t[103]=rt):rt=t[103],t[104]===Symbol.for("react.memo_cache_sentinel")?(gt=h.jsx(or,{size:14,strokeWidth:1.5}),t[104]=gt):gt=t[104],t[105]!==o||t[106]!==n?(xt={icon:gt,label:"Add database connection",handle:()=>{n(h.jsx(jg,{onClose:o}))}},t[105]=o,t[106]=n,t[107]=xt):xt=t[107],t[108]===Symbol.for("react.memo_cache_sentinel")?(Mt=h.jsx($c,{size:14,strokeWidth:1.5}),t[108]=Mt):Mt=t[108],t[109]!==x?(wt={divider:!0,icon:Mt,label:"Command palette",hotkey:"global.commandPalette",handle:()=>x(_C)},t[109]=x,t[110]=wt):wt=t[110],t[111]===Symbol.for("react.memo_cache_sentinel")?(Vt=h.jsx(H3,{size:14,strokeWidth:1.5}),t[111]=Vt):Vt=t[111],t[112]!==y?(Sn={icon:Vt,label:"User settings",handle:()=>y(gC)},t[112]=y,t[113]=Sn):Sn=t[113],t[114]===Symbol.for("react.memo_cache_sentinel")?(dn=h.jsx(wp,{size:14,strokeWidth:1.5}),t[114]=dn):dn=t[114],t[115]!==v?(on={icon:dn,label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(pC)},t[115]=v,t[116]=on):on=t[116],t[117]===Symbol.for("react.memo_cache_sentinel")?(Zt={icon:h.jsx(H4,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:mC},Wn=h.jsx(uc,{size:14,strokeWidth:1.5}),t[117]=Zt,t[118]=Wn):(Zt=t[117],Wn=t[118]),t[119]===Symbol.for("react.memo_cache_sentinel")?(lo={icon:Wn,label:"Resources",handle:ts,dropdown:[{icon:h.jsx(H4,{size:14,strokeWidth:1.5}),label:"Documentation",handle:fC},{icon:h.jsx(IV,{size:14,strokeWidth:1.5}),label:"GitHub",handle:hC},{icon:h.jsx(AV,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uC},{icon:h.jsx(TV,{size:14,strokeWidth:1.5}),label:"YouTube",handle:dC},{icon:h.jsx(dm,{size:14,strokeWidth:1.5}),label:"Changelog",handle:cC}]},t[119]=lo):lo=t[119],t[120]===Symbol.for("react.memo_cache_sentinel")?(yi=h.jsx(yp,{size:14,strokeWidth:1.5}),t[120]=yi):yi=t[120],t[121]===Symbol.for("react.memo_cache_sentinel")?(xi={divider:!0,icon:yi,label:"Return home",hidden:!location.search.includes("file"),handle:lC},wi=h.jsx(va,{size:14,strokeWidth:1.5}),t[121]=xi,t[122]=wi):(xi=t[121],wi=t[122]),t[123]===Symbol.for("react.memo_cache_sentinel")?(vi={icon:wi,label:"New notebook",hidden:!location.search.includes("file"),handle:aC},ki=h.jsx(Up,{size:14,strokeWidth:1.5}),t[123]=vi,t[124]=ki):(vi=t[123],ki=t[124]),t[125]!==g?(nr={icon:ki,label:"Restart kernel",variant:"danger",handle:g},t[125]=g,t[126]=nr):nr=t[126],t[127]!==ue||t[128]!==ce||t[129]!==ge||t[130]!==$e||t[131]!==et||t[132]!==ve||t[133]!==F||t[134]!==me||t[135]!==he||t[136]!==xe||t[137]!==Ze||t[138]!==Se||t[139]!==Be||t[140]!==Re||t[141]!==rt||t[142]!==xt||t[143]!==wt||t[144]!==Sn||t[145]!==on||t[146]!==nr?(Si=[F,ue,ce,ge,$e,et,ve,me,he,xe,Ze,Se,Be,Re,rt,xt,wt,Sn,on,Zt,lo,xi,vi,nr],t[127]=ue,t[128]=ce,t[129]=ge,t[130]=$e,t[131]=et,t[132]=ve,t[133]=F,t[134]=me,t[135]=he,t[136]=xe,t[137]=Ze,t[138]=Se,t[139]=Be,t[140]=Re,t[141]=rt,t[142]=xt,t[143]=wt,t[144]=Sn,t[145]=on,t[146]=nr,t[147]=Si):Si=t[147];const Ci=Si;let Ni;return t[148]!==Ci?(Ni=Ci.filter(sC),t[148]=Ci,t[149]=Ni):Ni=t[149],Ni}function sC(t){return!t.hidden}function aC(){const t=PF();window.open(t,"_blank")}function lC(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function cC(){window.open(Gn.releasesPage,"_blank")}function dC(){window.open(Gn.youtube,"_blank")}function uC(){window.open(Gn.discordLink,"_blank")}function hC(){window.open(Gn.githubPage,"_blank")}function fC(){window.open(Gn.docsPage,"_blank")}function mC(){window.open(Gn.docsPage,"_blank")}function pC(t){return!t}function gC(t){return!t}function _C(t){return!t}function bC(t){return[t,{disabled:!0}]}function yC(t){return[t,{disabled:!1}]}async function xC(){const t=await gm();await bn(t.contents),lt({title:"Copied",description:"Code copied to clipboard."})}async function wC(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(vC,0),setTimeout(()=>window.dispatchEvent(e),0)}function vC(){return window.print()}async function kC(){const t=document.getElementById("App");t&&await x3(t,document.title)}async function SC(){const t=await gm();na(new Blob([t.contents],{type:"text/plain"}),W3.toPY(document.title))}async function CC(){const t=await BF({download:!1});na(new Blob([t],{type:"text/plain"}),W3.toMarkdown(document.title))}async function NC(){const t=await gm(),e=UF({code:t.contents});await bn(e),lt({title:"Copied",description:"Link copied to clipboard."})}function jC(t){return h.jsx("div",{className:"w-8 flex justify-end",children:t&&h.jsx(dc,{size:14})})}const EC=()=>{const t=X.c(10),e=Eg();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(xn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:h.jsx(qV,{strokeWidth:1.8})}),t[0]=n):n=t[0];const o=n,r=IC;let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=f=>{const m=h.jsx(rn,{variant:f.variant,disabled:f.disabled,onSelect:_=>f.handle(_),"data-testid":`notebook-menu-dropdown-${f.label}`,children:r(f)},f.label);return f.tooltip?h.jsx(Me,{content:f.tooltip,side:"left",delayDuration:100,children:h.jsx("span",{children:m})},f.label):m},t[1]=i):i=t[1];const s=i;let a,l,c,d,u;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(sc,{asChild:!0,children:o}),t[2]=a):a=t[2],t[3]!==e){let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=m=>m.hidden?null:m.dropdown?h.jsxs($F,{children:[h.jsx(HF,{"data-testid":`notebook-menu-dropdown-${m.label}`,children:r(m)}),h.jsx(WF,{children:h.jsx(qF,{children:m.dropdown.map(_=>h.jsxs(K.Fragment,{children:[_.divider&&h.jsx(Po,{}),s(_)]},_.label))})})]},m.label):h.jsxs(K.Fragment,{children:[m.divider&&h.jsx(Po,{}),s(m)]},m.label),t[5]=f):f=t[5],l=e.map(f),t[3]=e,t[4]=l}else l=t[4];return t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Po,{}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:h.jsxs("span",{children:["Version: ",VF()]})}),t[7]=d):d=t[7],t[8]!==l?(u=h.jsxs(ic,{modal:!1,children:[a,h.jsxs(ac,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),t[8]=l,t[9]=u):u=t[9],u};function IC(t){return h.jsxs(h.Fragment,{children:[t.icon&&h.jsx("span",{className:"flex-0 mr-2",children:t.icon}),h.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&h.jsx(GF,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}const en=YF({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Ig(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(ut.set(en,{type:"setFind",find:n}),ut.set(en,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):ut.set(en,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return ut.get(en).isOpen?(ut.set(en,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{ut.set(en,{type:"setIsOpen",isOpen:!0})}),!0):(ut.set(en,{type:"setIsOpen",isOpen:!0}),!0)}function AC(){return!!ut.get(en).isOpen&&(ut.set(en,{type:"setIsOpen",isOpen:!1}),!0)}function dd(t){return Er("create"in t,'Expected query to have a "create" method'),t}function Oa(t){return()=>{const e=ut.get(en),n=new hc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:dd(n).create(),search:n})}}const Ag=t=>Oa(({query:e})=>{const n=Fi(),o=ut.get(en).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let i=n.indexOf(o.view);i<0&&(i=0);const s=[...n,...n].slice(i);for(const a of s){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Ir.single(0)});continue}const c=Ir.single(l.from,l.to);return a.dispatch({selection:c,effects:[st.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),ut.set(en,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),ud=Ag("next"),Tg=Ag("prev"),TC=Oa(({query:t})=>{var o;const e=Fi(),n=[];for(const r of e){if(r.state.readOnly)continue;const i=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!i||i.length===0)continue;const s=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:s}],userEvent:"input.replace.all"})}),r.dispatch({changes:i,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),MC=Oa(({query:t})=>{const e=Fi(),n=ut.get(en).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const i=[...e,...e].slice(r);for(const s of i){const a=t.nextMatch(s.state,0,o??0);if(!a){o=null,s.dispatch({selection:Ir.single(0)});continue}const l=s.state.toText(t.getReplacement(a));return s.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),ud()}return!1}),OC=Oa(({query:t})=>{const e=Fi();let n=0;const o=new Map;for(const r of e){const i=t.matchAll(r.state,1e9)||[];for(const s of i){const{from:a,to:l}=s,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),hd=Gt.define();function Mg(){const t=Fi();for(const e of t)e.state.readOnly||e.dispatch({effects:hd.of(new hc({search:""}))})}const Da=Un.define({create(){const t=ut.get(en);return dd(new hc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(hd)&&(t=dd(n.value).create());return t}}),DC=dt.mark({class:"cm-searchMatch"}),RC=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),PC=Lo.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Da))}update(t){const e=t.state.field(Da);(e!==t.startState.field(Da)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new zi,o=e.visibleRanges,r=o.length;for(let i=0;i<r;i++){let{to:s}=o[i];const{from:a}=o[i];for(;i<r-1&&s>o[i+1].from-500;)s=o[++i].to;t.highlight(e.state,a,s,(l,c)=>{const d=e.state.selection.ranges.some(u=>u.from===l&&u.to===c);n.add(l,c,d?RC:DC)})}return n.finish()}},{decorations:t=>t.decorations}),LC=st.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),FC=()=>{var Xe;const t=X.c(102),[e,n]=A.useState(!1),[o,r]=yn(en),[i,s]=A.useState(),a=A.useRef(null),l=We(im);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&Ig(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],Yt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const Le=OC();s(Le===!1?void 0:Le)},t[3]=d):d=t[3];const u=d;let f,m,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),A.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return s(void 0),void Mg();u(),function(){const Le=ut.get(en),et=Fi();for(const nt of et)nt.state.readOnly||nt.dispatch({effects:hd.of(new hc({search:Le.findText,caseSensitive:Le.caseSensitive,regexp:Le.regexp,replace:Le.replaceText,wholeWord:Le.wholeWord}))})}()}else Mg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],A.useEffect(_,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==i||t[17]!==p?(b=p&&i?(Xe=i.position.get(p.view))==null?void 0:Xe.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=i,t[17]=p,t[18]=b):b=t[18];const x=b;let y,v,S,k,N,E,I,T,M,R,B;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(S=Le=>{Le.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=S):S=t[22],t[23]!==r?(k=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=k):k=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(Jn,{className:"w-4 h-4"}),t[25]=N):N=t[25],t[26]!==k?(E=h.jsx("div",{className:"absolute top-0 right-0",children:h.jsx(De,{"data-testid":"close-find-replace-button",onClick:k,size:"xs",variant:"text",children:N})}),t[26]=k,t[27]=E):E=t[27],t[28]!==r?(I=Le=>{r({type:"setFind",find:Le.target.value})},t[28]=r,t[29]=I):I=t[29],t[30]!==o.findText||t[31]!==I?(T=h.jsx(jr,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:BC,onChange:I}),t[30]=o.findText,t[31]=I,t[32]=T):T=t[32],t[33]!==r?(M=Le=>{r({type:"setReplace",replace:Le.target.value})},t[33]=r,t[34]=M):M=t[34],t[35]!==o.replaceText||t[36]!==M?(R=h.jsx(jr,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:M}),t[35]=o.replaceText,t[36]=M,t[37]=R):R=t[37],t[38]!==T||t[39]!==R?(B=h.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,R]}),t[38]=T,t[39]=R,t[40]=B):B=t[40];const O=o.caseSensitive?"on":"off";let z,F,V;t[41]!==r?(z=Le=>r({type:"setCaseSensitive",caseSensitive:Le}),t[41]=r,t[42]=z):z=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(JF,{className:"w-4 h-4"}),t[43]=F):F=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==z?(V=h.jsx(Me,{content:"Case Sensitive",children:h.jsx(_m,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:z,children:F})}),t[44]=o.caseSensitive,t[45]=O,t[46]=z,t[47]=V):V=t[47];const L=o.wholeWord?"on":"off";let C,$,j;t[48]!==r?(C=Le=>r({type:"setWholeWord",wholeWord:Le}),t[48]=r,t[49]=C):C=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(Wp,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==L||t[53]!==C?(j=h.jsx(Me,{content:"Match Whole Word",children:h.jsx(_m,{size:"sm",pressed:o.wholeWord,"data-state":L,onPressedChange:C,children:$})}),t[51]=o.wholeWord,t[52]=L,t[53]=C,t[54]=j):j=t[54];const H=o.regexp?"on":"off";let Y,Z,G,re,ne;t[55]!==r?(Y=Le=>r({type:"setRegex",regexp:Le}),t[55]=r,t[56]=Y):Y=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Mp,{className:"w-4 h-4"}),t[57]=Z):Z=t[57],t[58]!==o.regexp||t[59]!==H||t[60]!==Y?(G=h.jsx(Me,{content:"Use Regular Expression",children:h.jsx(_m,{size:"sm",pressed:o.regexp,"data-state":H,onPressedChange:Y,children:Z})}),t[58]=o.regexp,t[59]=H,t[60]=Y,t[61]=G):G=t[61],t[62]!==V||t[63]!==j||t[64]!==G?(re=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[V,j,G]}),t[62]=V,t[63]=j,t[64]=G,t[65]=re):re=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{MC()&&u()},t[66]=ne):ne=t[66];const te=o.findText==="";let q,Q;t[67]!==te?(q=h.jsx(De,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:ne,disabled:te,children:"Replace Next"}),t[67]=te,t[68]=q):q=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Le=TC();if(!Le)return;u();const{dismiss:et}=lt({title:"Replaced all occurrences",action:h.jsx(od,{"data-testid":"undo-replace-all-button",onClick:()=>{Le(),nt()}})}),nt=et},t[69]=Q):Q=t[69];const ie=o.findText==="";let ue,le,_e,ce,Ne,je,de,Ee,ge,Oe,Fe,$e;return t[70]!==ie?(ue=h.jsx(De,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:ie,children:"Replace All"}),t[70]=ie,t[71]=ue):ue=t[71],t[72]!==q||t[73]!==ue?(le=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[q,ue]}),t[72]=q,t[73]=ue,t[74]=le):le=t[74],t[75]!==re||t[76]!==le?(_e=h.jsxs("div",{className:"flex flex-col gap-2",children:[re,le]}),t[75]=re,t[76]=le,t[77]=_e):_e=t[77],t[78]!==B||t[79]!==_e?(ce=h.jsxs("div",{className:"flex items-center gap-3",children:[B,_e]}),t[78]=B,t[79]=_e,t[80]=ce):ce=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(Ne=h.jsx(Me,{content:"Find Previous",children:h.jsx(De,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:UC,children:h.jsx(Et,{className:"w-4 h-4"})})}),t[81]=Ne):Ne=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(je=h.jsx(Me,{content:"Find Next",children:h.jsx(De,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:VC,children:h.jsx(Uc,{className:"w-4 h-4"})})}),t[82]=je):je=t[82],t[83]!==x||t[84]!==i?(de=i!=null&&x==null&&h.jsxs("span",{className:"text-sm",children:[i.count," matches"]}),t[83]=x,t[84]=i,t[85]=de):de=t[85],t[86]!==x||t[87]!==i?(Ee=i!=null&&x!=null&&h.jsxs("span",{className:"text-sm",children:[x+1," of ",i.count]}),t[86]=x,t[87]=i,t[88]=Ee):Ee=t[88],t[89]!==de||t[90]!==Ee?(ge=h.jsxs("div",{className:"flex items-center gap-2",children:[Ne,je,de,Ee]}),t[89]=de,t[90]=Ee,t[91]=ge):ge=t[91],t[92]!==l?(Oe=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Oe):Oe=t[93],t[94]!==Oe.key?(Fe=h.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",h.jsx(lm,{shortcut:Oe.key})," ","again to open the native browser search."]}),t[94]=Oe.key,t[95]=Fe):Fe=t[95],t[96]!==E||t[97]!==ce||t[98]!==ge||t[99]!==Fe||t[100]!==S?($e=h.jsx(KF,{restoreFocus:!0,autoFocus:!0,children:h.jsxs("div",{onFocus:y,onClick:zC,onBlur:v,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:S,children:[E,ce,ge,Fe]})}),t[96]=E,t[97]=ce,t[98]=ge,t[99]=Fe,t[100]=S,t[101]=$e):$e=t[101],$e};function zC(t){t.stopPropagation(),t.preventDefault()}function BC(t){t.key==="Enter"&&(t.shiftKey?Tg():ud())}function UC(){return Tg()}function VC(){return ud()}function Og(t){const e=X.c(3),[n,o]=A.useState(!1);let r,i;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const s=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(s)},i=[t],e[0]=t,e[1]=r,e[2]=i):(r=e[1],i=e[2]),A.useEffect(r,i),t&&n}const $C=()=>{const t=X.c(6),e=$t(sd);let n;t[0]!==e?(n=()=>e(HC),t[0]=e,t[1]=n):n=t[1];const o=n;let r,i,s;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=hn("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx($c,{strokeWidth:1.5,size:18}),t[3]=i):i=t[3],t[4]!==o?(s=h.jsx(Me,{content:r,children:h.jsx(xn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:i})}),t[4]=o,t[5]=s):s=t[5],s};function HC(t){return!t}const ns=t=>{const{children:e}=t;return We(Ai)?null:e},WC=t=>{const{children:e}=t;return We(Ai)?e:null},Dg=t=>{const e=X.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:i,onNameChange:s,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=i!==void 0&&i,[u,f]=A.useState(c);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[_,g]=A.useState(m),[p,b]=A.useState(!1),x=A.useRef(null),y=A.useRef(!1);let v,S,k;e[1]!==c?(v=()=>{f(c)},S=[c],e[1]=c,e[2]=v,e[3]=S):(v=e[2],S=e[3]),A.useEffect(v,S),e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{b(!0)},e[4]=k):k=e[4];const N=k;let E;e[5]!==c||e[6]!==l?(E=Q=>{var ie;(ie=Q.relatedTarget)!=null&&ie.closest(".filename-input")||(b(!1),l&&f(c))},e[5]=c,e[6]=l,e[7]=E):E=e[7];const I=E;let T;e[8]!==u?(T=Bn.dirname(u||""),e[8]=u,e[9]=T):T=e[9];const M=T,R=Bn.basename(u||""),B=_.filter(Q=>Bn.basename(Q.path).startsWith(R));let O,z;e[10]!==M||e[11]!==p?(O=async()=>{if(!p)return void g([]);const Q=await Y3({path:M});g(Q.files)},z=[M,p],e[10]=M,e[11]=p,e[12]=O,e[13]=z):(O=e[12],z=e[13]);const{loading:F}=Yn(O,z),V=function(Q,ie,ue){if(Q&&!Q.endsWith("/")&&((Ei("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(Bn.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!ie.some(le=>le.path===Q||Bn.basename(le.path)===Q)&&!(ue&&(ue===Q||Bn.basename(ue)===Q))))return Q}(u,_,c),L=(V||B.length>0)&&h.jsxs(am,{className:"font-mono",children:[!F&&h.jsx(oc,{children:"No files"}),V&&h.jsxs(fo,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;V&&(y.current=!0,s(V),(Q=x.current)==null||Q.blur())},children:[h.jsx(fp,{className:"w-4 h-4 mr-2"})," ",h.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",h.jsx("span",{className:"font-medium text-sm",children:Bn.basename(V)})]})]},"_rename_"),B.map(Q=>{const ie=Q.isDirectory?"directory":q3(Q.path),ue=G3[ie];return h.jsxs(fo,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[h.jsx(ue,{className:"w-4 h-4 mr-2"})," ",Bn.basename(Q.path)]},Q.path)})]}),C=10*Math.max(20,(u==null?void 0:u.length)||(o==null?void 0:o.length)||0),$=p?u||"":c||"";let j,H,Y;e[14]!==d||e[15]!==C?(j=d?{maxWidth:C}:void 0,e[14]=d,e[15]=C,e[16]=j):j=e[16],e[17]!==a?(H=Te(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=H):H=e[18],e[19]!==o||e[20]!==$||e[21]!==j||e[22]!==H?(Y=h.jsx(XF,{children:h.jsx(Qs,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:qC,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:j,className:H})}),e[19]=o,e[20]=$,e[21]=j,e[22]=H,e[23]=Y):Y=e[23];const Z=L&&"group-focus-within:block";let G,re,ne,te,q;return e[24]!==Z?(G=Te("p-0 w-full min-w-80 max-w-80vw hidden",Z),e[24]=Z,e[25]=G):G=e[25],e[26]!==L||e[27]!==G?(re=h.jsx(oa,{side:"bottom",className:G,portal:!1,children:L}),e[26]=L,e[27]=G,e[28]=re):re=e[28],e[29]!==Y||e[30]!==re?(ne=h.jsxs(am,{children:[Y,re]}),e[29]=Y,e[30]=re,e[31]=ne):ne=e[31],e[32]!==I||e[33]!==ne?(te=h.jsx(fc,{onFocus:N,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:ne}),e[32]=I,e[33]=ne,e[34]=te):te=e[34],e[35]!==p||e[36]!==te?(q=h.jsx(mc,{children:h.jsx(Bi,{open:p,modal:!1,children:te})}),e[35]=p,e[36]=te,e[37]=q):q=e[37],q};function qC(t){t.key==="Escape"&&t.currentTarget.blur()}function GC(t){return JSON.stringify(t)}const fd=Ot(void 0),Rg=Ot(t=>{const e=t(fd);return function(n,o,r){if(!r)return!1;const{cellIds:i,cellData:s}=n,a=i.inOrderIds.map(u=>s[u]),l=a.map(u=>u.code),c=a.map(u=>u.config),d=a.map(u=>u.name);return!(J3(l,r.codes)&&J3(d,r.names)&&pc(c,r.configs)&&pc(o.selectedLayout,r.layout.selectedLayout)&&pc(o.layoutData,r.layout.layoutData))}(t(Js),t(nS),e)}),YC=t=>{const e=X.c(35),n=lc(),o=()=>{na(new Blob([i()],{type:"text/plain"}),`${t.proposedName}.json`)};let r;e[0]!==n?(r=()=>{const N=co(),E=bm(N);return JSON.stringify({filename:n,cells:E.map(KC)},null,2)},e[0]=n,e[1]=r):r=e[1];const i=Qe(r);let s,a,l,c,d,u,f,m,_,g,p,b,x,y,v,S,k;return e[2]!==o||e[3]!==t?(s=N=>{N.preventDefault(),o(),t.closeModal()},e[2]=o,e[3]=t,e[4]=s):s=e[4],e[5]!==t?(a=N=>{N.key==="Escape"&&t.closeModal()},e[5]=t,e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(ir,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[7]=l):l=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(c={wordBreak:"break-word"},e[8]=c):c=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("p",{children:"This app has unsaved changes. To recover:"}),u={paddingBottom:"10px"},e[9]=d,e[10]=u):(d=e[9],u=e[10]),e[11]!==t.proposedName?(f=h.jsxs("li",{style:u,children:['Click the "Download" button. This will download a file called\xA0',h.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[11]=t.proposedName,e[12]=f):f=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(m={paddingBottom:"10px"},e[13]=m):m=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(_={display:"block",padding:"10px"},e[14]=_):_=e[14],e[15]!==t.proposedName?(g=h.jsxs("code",{style:_,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=g):g=e[16],e[17]!==t.proposedName?(p=h.jsxs("code",{children:[t.proposedName,".py"]}),e[17]=t.proposedName,e[18]=p):p=e[18],e[19]!==g||e[20]!==p?(b=h.jsxs("li",{style:m,children:["In your terminal, type",g,"to overwrite ",p," with the recovered changes."]}),e[19]=g,e[20]=p,e[21]=b):b=e[21],e[22]!==b||e[23]!==f?(x=h.jsx(Di,{className:"markdown break-words",style:c,children:h.jsxs("div",{className:"prose dark:prose-invert",children:[d,h.jsxs("ol",{children:[f,b]})]})}),e[22]=b,e[23]=f,e[24]=x):x=e[24],e[25]!==t.closeModal?(y=h.jsx(De,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[25]=t.closeModal,e[26]=y):y=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(De,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[27]=v):v=e[27],e[28]!==y?(S=h.jsxs(ea,{children:[y,v]}),e[28]=y,e[29]=S):S=e[29],e[30]!==s||e[31]!==x||e[32]!==S||e[33]!==a?(k=h.jsx(rr,{className:"w-fit",children:h.jsxs("form",{onSubmit:s,onKeyDown:a,children:[l,x,S]})}),e[30]=s,e[31]=x,e[32]=S,e[33]=a,e[34]=k):k=e[34],k},JC=t=>{const e=X.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:i}=zn();let s;e[0]!==n?(s=n===null?"app":n.slice(0,-3),e[0]=n,e[1]=s):s=e[1];const a=s;let l;e[2]!==i||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(h.jsx(YC,{proposedName:a,closeModal:i}))},e[2]=i,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;Yt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=hn("global.save"),e[7]=d):d=e[7];const u=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Sa,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==u?(m=h.jsx(Me,{content:d,children:h.jsx(xn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:u,children:f})}),e[9]=c,e[10]=u,e[11]=m):m=e[11],m};function KC(t){return{name:t.name,code:t.code}}const md=5e3;async function XC(){await tz({download:!1})}async function ZC(){await ez({download:!1,includeCode:!0,files:Z4.INSTANCE.filenames()})}async function QC(){await QF({download:!1})}const eN=t=>{const e=X.c(15),{kioskMode:n}=t,o=lc(),r=We(Rg),i=We(Ro).state===Qt.CLOSED,{saveOrNameNotebook:s,saveIfNotebookIsPersistent:a}=Pg();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=X.c(14),x=We(Z3),y=gc(),[v]=yn(Ro),S=We(Rg);let k,N;if(b[0]!==y){const R=bm(y);k=R.map(iN),N=R.map(rN),b[0]=y,b[1]=k,b[2]=N}else k=b[1],N=b[2];const E=N;let I;b[3]!==y?(I=X3(y),b[3]=y,b[4]=I):I=b[4];const T=I;let M;b[5]!==x||b[6]!==E||b[7]!==k||b[8]!==T||b[9]!==v||b[10]!==S||b[11]!==p.kioskMode||b[12]!==p.onSave?(M={onSave:p.onSave,needsSave:S,codes:k,cellConfigs:T,cellNames:E,connStatus:v,config:x,kioskMode:p.kioskMode},b[5]=x,b[6]=E,b[7]=k,b[8]=T,b[9]=v,b[10]=S,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=M):M=b[13],function(R){const B=X.c(21),{codes:O,cellConfigs:z,config:F,connStatus:V,cellNames:L,needsSave:C,kioskMode:$,onSave:j}=R,H=A.useRef(null);let Y;B[0]!==O?(Y=O.join(":"),B[0]=O,B[1]=Y):Y=B[1];const Z=Y;let G;B[2]!==z?(G=z.map(GC).join(":"),B[2]=z,B[3]=G):G=B[3];const re=G;let ne;B[4]!==L?(ne=L.join(":"),B[4]=L,B[5]=ne):ne=B[5];const te=ne;let q,Q;B[6]!==F||B[7]!==V.state||B[8]!==$||B[9]!==C||B[10]!==j?(q=()=>{if(!$)return F.autosave==="after_delay"&&(H.current!==null&&clearTimeout(H.current),C&&V.state===Qt.OPEN&&(H.current=setTimeout(j,F.autosave_delay))),()=>{H.current!==null&&clearTimeout(H.current)}},B[6]=F,B[7]=V.state,B[8]=$,B[9]=C,B[10]=j,B[11]=q):q=B[11],B[12]!==re||B[13]!==te||B[14]!==Z||B[15]!==F||B[16]!==V.state||B[17]!==$||B[18]!==C||B[19]!==j?(Q=[Z,re,te,F,V.state,j,$,C],B[12]=re,B[13]=te,B[14]=Z,B[15]=F,B[16]=V.state,B[17]=$,B[18]=C,B[19]=j,B[20]=Q):Q=B[20],A.useEffect(q,Q)}(M)}(l),function(){const p=X.c(6),b=We(ZF),{state:x}=We(Ro),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),S=b.auto_download.includes("ipynb"),k=!y||x!==Qt.OPEN,N=!v||x!==Qt.OPEN,E=!S||x!==Qt.OPEN;let I,T,M;p[0]!==k?(I={delayMs:md,whenVisible:!0,disabled:k},p[0]=k,p[1]=I):I=p[1],zc(QC,I),p[2]!==N?(T={delayMs:md,whenVisible:!0,disabled:N},p[2]=N,p[3]=T):T=p[3],zc(ZC,T),p[4]!==E?(M={delayMs:md,whenVisible:!0,disabled:E},p[4]=E,p[5]=M):M=p[5],zc(XC,M)}(),e[3]!==r?(c=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=c):c=e[4],tm(window,"beforeunload",c),e[5]!==s?(d=p=>{p.preventDefault(),p.stopPropagation(),s()},e[5]=s,e[6]=d):d=e[6];const u=d;if(Yt("global.save",s),i){let p;return e[7]!==o||e[8]!==r?(p=h.jsx(JC,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=hn("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Sa,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==u||e[13]!==m?(g=h.jsx(Me,{content:f,children:h.jsx(xn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:u,children:_})}),e[12]=u,e[13]=m,e[14]=g):g=e[14],g};function Pg(){const t=X.c(19),{openModal:e,closeModal:n,openAlert:o}=zn(),r=$t(fd),i=K3(),s=nz();let a;t[0]!==o||t[1]!==r||t[2]!==s?(a=(p,b)=>{const x=co(),y=bm(x),v=y.map(oN),S=y.map(nN),k=y.map(tN),N=X3(x),E=s.get(Ro),I=s.get(Z3),T=s.get(nS);s.get(Ai)||S.length!==0&&(E.state===Qt.OPEN?(mt.log("saving to ",p),oz({cellIds:v,codes:S,names:k,filename:p,configs:N,layout:GV(),persist:!0}).then(()=>{b&&I.format_on_save&&Q3(),r({names:k,codes:S,configs:N,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=s,t[3]=a):a=t[3];const l=Qe(a);let c;t[4]!==l||t[5]!==s?(c=p=>{const b=p!==void 0&&p,x=s.get(e4),y=s.get(Ro);Lg(x)&&y.state===Qt.OPEN&&l(x,b)},t[4]=l,t[5]=s,t[6]=c):c=t[6];const d=Qe(c);let u;t[7]!==l||t[8]!==i?(u=p=>{i(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=i,t[9]=u):u=t[9];const f=u;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==d||t[14]!==s?(m=()=>{const p=s.get(e4),b=s.get(Ro);d(!0),Lg(p)||b.state===Qt.CLOSED||e(h.jsx(sN,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=d,t[14]=s,t[15]=m):m=t[15];const _=Qe(m);let g;return t[16]!==d||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:d},t[16]=d,t[17]=_,t[18]=g):g=t[18],g}function tN(t){return t.name}function nN(t){return t.code}function oN(t){return t.id}function Lg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function rN(t){return t.name}function iN(t){return t.code}const sN=t=>{const e=X.c(17),{onClose:n,onSave:o}=t,[r,i]=A.useState();let s;e[0]!==n||e[1]!==o?(s=p=>{i(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=s):s=e[2];const a=s;let l,c,d,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(ir,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Nr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=h.jsxs("div",{className:"flex flex-col",children:[c,h.jsx(Dg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(u=h.jsx(De,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=u):u=e[8];const f=!r;let m,_,g;return e[9]!==f?(m=h.jsx(De,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==u||e[12]!==m?(_=h.jsxs(ea,{children:[u,m]}),e[11]=u,e[12]=m,e[13]=_):_=e[13],e[14]!==d||e[15]!==_?(g=h.jsxs(rr,{children:[l,d,_]}),e[14]=d,e[15]=_,e[16]=g):g=e[16],g},aN=t=>{const e=X.c(40),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:i,closed:s,running:a,appConfig:l}=t,c=l.width,d=We(V3),u=We(rz),{undoDeleteCell:f}=zt();let m,_,g=null;if(!s&&d){let O,z;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(Qc,{size:16,strokeWidth:1.5}),e[0]=O):O=e[0],e[1]!==f?(z=h.jsx(Me,{content:"Undo cell deletion",children:h.jsx(xn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:O})}),e[1]=f,e[2]=z):z=e[2],g=z}e[3]!==n?(m=!n&&h.jsx(FC,{}),e[3]=n,e[4]=m):m=e[4],e[5]!==s||e[6]!==n?(_=!s&&h.jsxs("div",{className:dN,children:[n&&h.jsx(fS,{}),h.jsx(EC,{}),h.jsx(MV,{}),h.jsx(OV,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),e[5]=s,e[6]=n,e[7]=_):_=e[7];const p=c==="compact"&&"xl:flex-row items-end";let b,x,y,v,S,k,N,E,I,T,M,R,B;return e[8]!==p?(b=Te(uN,p),e[8]=p,e[9]=b):b=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(ns,{children:h.jsx(eN,{kioskMode:!1})}),e[10]=x):x=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=hn("global.hideCode"),e[11]=y):y=e[11],e[12]!==n?(v=n?h.jsx($3,{strokeWidth:1.5,size:18}):h.jsx(Gc,{strokeWidth:1.5,size:18}),e[12]=n,e[13]=v):v=e[13],e[14]!==o||e[15]!==v?(S=h.jsx(Me,{content:y,children:h.jsx(xn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:v})}),e[14]=o,e[15]=v,e[16]=S):S=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx($C,{}),k=h.jsx(DV,{}),N=h.jsx("div",{}),e[17]=k,e[18]=N,e[19]=E):(k=e[17],N=e[18],E=e[19]),e[20]!==s||e[21]!==r||e[22]!==a?(I=!s&&h.jsx(cN,{running:a,onInterrupt:r}),e[20]=s,e[21]=r,e[22]=a,e[23]=I):I=e[23],e[24]!==s||e[25]!==u||e[26]!==i?(T=!s&&h.jsx(lN,{needsRun:u,onRun:i}),e[24]=s,e[25]=u,e[26]=i,e[27]=T):T=e[27],e[28]!==I||e[29]!==T||e[30]!==g?(M=h.jsx(ns,{children:h.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,I,T]})}),e[28]=I,e[29]=T,e[30]=g,e[31]=M):M=e[31],e[32]!==M||e[33]!==b||e[34]!==S?(R=h.jsxs("div",{className:b,children:[x,S,E,k,N,M]}),e[32]=M,e[33]=b,e[34]=S,e[35]=R):R=e[35],e[36]!==m||e[37]!==R||e[38]!==_?(B=h.jsxs(h.Fragment,{children:[m,_,R]}),e[36]=m,e[37]=R,e[38]=_,e[39]=B):B=e[39],B},lN=t=>{const e=X.c(5),{needsRun:n,onRun:o}=t;if(n){let i,s,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=hn("global.runStale"),e[0]=i):i=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Ki,{strokeWidth:1.5,size:16}),e[1]=s):s=e[1],e[2]!==o?(a=h.jsx(Me,{content:i,children:h.jsx(xn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:s})}),e[2]=o,e[3]=a):a=e[3],a}let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Me,{content:"Nothing to run",children:h.jsx(xn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:h.jsx(Ki,{strokeWidth:1.5,size:16})})}),e[4]=r):r=e[4],r},cN=t=>{const e=X.c(8),{running:n,onInterrupt:o}=t,r=Og(n);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=hn("global.interrupt"),e[0]=i):i=e[0];const s=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==s?(a=Te(s),e[1]=s,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:jn.NOOP;let d,u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Jf,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(u=h.jsx(Me,{content:i,children:h.jsx(xn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=u):u=e[7],u},dN="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",uN="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",hN=t=>{const e=X.c(7),{filename:n}=t,o=K3();let r;e[0]!==n?(r=n?Bn.basename(n):"untitled marimo app",e[0]=n,e[1]=r):r=e[1];const i=n===null?"missing-filename":"filename";let s;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==i?(s=h.jsx(Dg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:i}),e[2]=n,e[3]=o,e[4]=r,e[5]=i,e[6]=s):s=e[6],s},fN=iz(sz,400),mN=(t,e)=>{ut.get(Ai)||t.isEmpty()||e.isEmpty()||pc(t.inOrderIds,e.inOrderIds)||fN({cell_ids:t.inOrderIds})};function pN(t){return[Kn.of([{key:"Escape",preventDefault:!1,run:AC},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:lz},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Ig}]),az(),PC,Da,LC]}const zr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},os=Ui.define({combine:t=>_c(t,{onError:console.error,inputDebounceTime:300,keymaps:zr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),fr=Gt.define(),mr=Un.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(fr))return n.value;return t}}),rs=Gt.define(),is=Gt.define(),Fg=Un.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(rs)&&(n={...n,inputValue:o.value}),o.is(is)&&(n={...n,shouldFocus:o.value});return n}}),Ra=Gt.define(),ss=Un.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(Ra))return n.value;return t}}),Br=Gt.define(),zg=Un.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Br))return n.value;return t}}),Bg=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),i=o.lineAt(n.to);if(e.sliceDoc(r.from,i.to).trim().length<1)return!1;const s=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(i.number,o.lines));return t.dispatch({effects:[fr.of({show:!0,lineFrom:s,lineTo:a}),is.of(!0),rs.of("")],selection:Ir.cursor(r.from)}),!0},Ug=t=>!!t.state.field(ss)&&(t.dispatch({effects:[Ra.of(null),fr.of({show:!1,lineFrom:0,lineTo:0}),is.of(!1),rs.of(""),Br.of(!1)]}),!0),Vg=t=>{const e=t.state.field(ss);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[Ra.of(null),fr.of({show:!1,lineFrom:0,lineTo:0}),is.of(!1),rs.of(""),Br.of(!1)]}),!0)},gN=st.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),_N="\u2318",bN="\u229E Win",yN="Ctrl";function pd(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?_N:navigator.platform.startsWith("Win")?bN:yN).replace("-"," ").toUpperCase()}function sn(t,e){const n=document.createElement(t);return n.className=e,n}function xN(t){var r,i;const e=t.state.facet(os),n={...zr,...e.keymaps},o=sn("div","cm-ai-tooltip").appendChild(sn("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${pd(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",s=>{s.stopPropagation()}),(i=o.querySelector("span"))==null||i.addEventListener("click",s=>{s.preventDefault(),Bg(t)}),o}const wN=Ui.define({combine:t=>_c(t,{render:xN})}),vN=Lo.fromClass((u3=class{constructor(t){ee(this,"view");ee(this,"suppress");ee(this,"dom");ee(this,"mousedown",()=>{this.suppress=!0});ee(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});m3(this,Jl,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=i.width-r.width,l=Math.min(o.left,a);let c=o.top-r.height;c=s?Math.max(s.y,c):c,this.dom.style.left=`${l}px`,this.dom.style.top=`${c}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(wN);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){t.state.field(mr).show?this.dom.style.display="none":t.requestMeasure({read:f3(this,Jl)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Jl=new WeakMap,u3)),kN=st.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class SN extends Vi{constructor(n){super();ee(this,"oldCode");this.oldCode=n}toDOM(n){const o=sn("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=sn("div","cm-old-code cm-line");r.textContent=this.oldCode;const i=sn("div","cm-floating-buttons"),s=n.state.facet(os),a={...zr,...s.keymaps},l=sn("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${pd(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),Ug(n)});const c=sn("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${pd(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),Vg(n)}),i.append(l,c),o.append(r,i),o}updateDOM(n,o){return!0}}class CN extends Vi{constructor(n){super();ee(this,"complete");ee(this,"abortController",null);ee(this,"dom",null);ee(this,"input",null);ee(this,"loadingContainer",null);ee(this,"helpInfo",null);ee(this,"inputContainer",null);ee(this,"form",null);ee(this,"view",null);ee(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});ee(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[fr.of({show:!1,lineFrom:0,lineTo:0}),Br.of(!1)]}),n.focus())});ee(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(os);n==null||n.stopPropagation();const i=o.state.field(mr),{input:s}=this;if(!s)return;const a=s.value.trim();if(!i.show||!a)return;const l=o.state.doc.line(i.lineFrom),c=o.state.doc.line(i.lineTo),d=l.from,u=c.to,f=o.state.sliceDoc(d,u),m=o.state.sliceDoc(0,d),_=o.state.sliceDoc(u);this.abortController=new AbortController,o.dispatch({effects:Br.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:a,selection:f,codeBefore:m,codeAfter:_,editorView:o,signal:this.abortController.signal});if(!o.state.field(mr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:u,insert:p},effects:[fr.of({show:!1,lineFrom:0,lineTo:0}),Ra.of({from:d,to:d+p.length,oldCode:f,newCode:p}),Br.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(g=r.onError)==null||g.call(r,p)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(Fg),r=n.state.field(zg),i=sn("div","cm-ai-input-container");this.inputContainer=i,this.dom=i;const s=sn("form","cm-ai-input-form");this.form=s,s.setAttribute("role","search"),s.setAttribute("aria-label","AI editing instructions"),s.addEventListener("submit",p=>p.preventDefault());const a=sn("input","cm-ai-input");this.input=a,s.append(a),a.placeholder="Editing instructions...",a.setAttribute("aria-label","AI editing instructions"),a.setAttribute("autocomplete","off"),a.setAttribute("spellcheck","true"),a.value=o.inputValue;const l=sn("div","cm-ai-loading-container");this.loadingContainer=l;const c=sn("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=sn("button","cm-ai-cancel-button");d.textContent="Cancel",d.setAttribute("aria-label","Cancel code generation"),d.addEventListener("click",this.onCancel),l.append(d,c);const u=sn("div","cm-ai-help-info");this.helpInfo=u;const f=u.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const m=sn("button","cm-ai-generate-button");function _(p){u.replaceChildren(p?m:f)}m.textContent="\u23CE Generate",m.setAttribute("aria-label","Generate code"),m.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{a.value=o.inputValue,a.focus(),n.dispatch({effects:is.of(!1)})}),_(a.value),a.addEventListener("input",function(){n.dispatch({effects:rs.of(a.value)});const p=a.value.trim();p!==g&&(g=p,_(p))}),a.addEventListener("keydown",this.onKeyDown);let g="";return i}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function NN(t){if(!t.prompt)throw new Error("prompt function is required");return[os.of(t),mr,Fg,ss,zg,[vN,kN],gN,Kn.of([{key:zr.showInput,run:Bg}]),sr.highest([Kn.of([{key:zr.acceptEdit,run:Ug},{key:zr.rejectEdit,run:Vg}])]),jN,EN,IN,AN]}const jN=st.updateListener.of(t=>{const e=t.state.field(mr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((i,s,a,l)=>{const c=t.state.doc.lineAt(i).number;if(c<n){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;n+=d,o+=d,r=!0}else if(c<=o){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;o+=d,r=!0}}),r&&t.view.dispatch({effects:[fr.of({show:!0,lineFrom:n,lineTo:o})]})}),EN=st.decorations.of(t=>{const e=t.state.field(ss);return e?dt.set([dt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):dt.none}),IN=st.decorations.compute([mr],t=>{const e=t.field(mr),n=t.facet(os),o=[];if(e.show){const r=e.lineFrom,i=e.lineTo;for(let s=r;s<=i;s++){const a=t.doc.line(s).from;o.push(dt.line({class:"cm-ai-selection"}).range(a)),s===r&&o.push(dt.widget({widget:new CN(n.prompt),side:-1}).range(a))}}return dt.set(o)}),AN=Un.define({create:t=>dt.none,update(t,e){const n=e.state.field(ss);return n?dt.set([dt.widget({widget:new SN(n.oldCode),block:!0}).range(n.from)]):dt.none},provide:t=>st.decorations.from(t)}),Pa=Un.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(La));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),La=Gt.define();class TN extends Vi{constructor(n){super();ee(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
91
- `).length-1}}class MN{constructor(e){ee(this,"cache",new Map);ee(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const ON=(t,e)=>Lo.fromClass(class{constructor(){ee(this,"abortController",null);ee(this,"cache");this.cache=new MN(e.cacheTimeout??1e3)}async update(n){var s,a,l,c,d;if(!n.docChanged||((a=(s=e.events)==null?void 0:s.beforeSuggestionFetch)==null?void 0:a.call(s,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),i=this.cache.get(r);if(i)n.view.dispatch({effects:La.of({text:i,doc:o})});else try{const u=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((d=(c=e.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:d.call(c,n.view,u))===!1)return;this.cache.set(r,u),n.view.dispatch({effects:La.of({text:u,doc:o})})}catch(u){u instanceof Error&&u.name!=="AbortError"&&console.error("Suggestion fetch error:",u)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),DN=Lo.fromClass(class{constructor(){ee(this,"decorations");this.decorations=dt.none}update(t){var n;const e=(n=t.state.field(Pa))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const i=o.state.selection.main.head,s=[],a=dt.widget({widget:new TN(r),side:1});return s.push(a.range(i)),dt.set(s)}(t.view,e):dt.none}},{decorations:t=>t.decorations});function RN(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Ir.cursor(n+e.length)};const i=o-n;return!r.empty||i&&t.sliceDoc(r.from-i,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-i,to:r.from,insert:e},range:Ir.cursor(r.from-i+e.length)}}),userEvent:"input.complete"}}const PN=Kn.of([{key:"Tab",run:t=>{var o,r,i;const e=(o=t.state.field(Pa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(gd);return t.dispatch({...RN(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(i=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||i.call(r,t,e),!0}},{key:"Escape",run:t=>{var o,r,i;const e=(o=t.state.field(Pa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(gd);return t.dispatch({effects:La.of({text:null,doc:t.state.doc})}),(i=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||i.call(r,t,e),!0}}]),gd=Ui.define({combine:t=>t.at(-1)});function $g(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,i,s){let a=()=>{};return(...l)=>(a(),new Promise((c,d)=>{const u=setTimeout(()=>c(r(...l)),i);a=()=>{clearTimeout(u),s!==void 0&&d(s)}}))}(t.fetchFn,e);return[Pa,gd.of(t),ON(o,t),DN,n?PN:[]]}const _d=Gt.define(),bd=Gt.define(),yd=Gt.define();function Ct(t,e){if(!t)throw new Error(e)}function Fa(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function xd(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function Hg(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const Wg=Symbol("@bufbuild/protobuf/enum-type");function LN(t){const e=t[Wg];return Ct(e,"missing enum type on enum object"),e}function qg(t,e,n,o){t[Wg]=Gg(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function Gg(t,e,n){const o=Object.create(null),r=Object.create(null),i=[];for(const s of e){const a=Yg(s);i.push(a),o[s.name]=a,r[s.no]=a}return{typeName:t,values:i,findName:s=>o[s],findNumber:s=>r[s]}}function FN(t,e,n){const o={};for(const r of e){const i=Yg(r);o[i.localName]=i.no,o[i.no]=i.localName}return qg(o,t,e),o}function Yg(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Rt{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,i=r.makeReadOptions(n);return r.readMessage(o,e,i,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function zN(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function wd(t,e,n){for(let i=0;i<28;i+=7){const s=t>>>i,a=!(!(s>>>7)&&e==0),l=255&(a?128|s:s);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let i=3;i<31;i+=7){const s=e>>>i,a=!!(s>>>7),l=255&(a?128|s:s);if(n.push(l),!a)return}n.push(e>>>31&1)}}const za=4294967296;function Jg(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function i(s,a){const l=Number(t.slice(s,a));r*=n,o=o*n+l,o>=za&&(r+=o/za|0,o%=za)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?Xg(o,r):vd(o,r)}function Kg(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(za*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,i=n+8147497*o,s=2*o;const a=1e7;return r>=a&&(i+=Math.floor(r/a),r%=a),i>=a&&(s+=Math.floor(i/a),i%=a),s.toString()+Zg(i)+Zg(r)}function vd(t,e){return{lo:0|t,hi:0|e}}function Xg(t,e){return e=~e,t?t=1+~t:e+=1,vd(t,e)}const Zg=t=>{const e=String(t);return"0000000".slice(e.length)+e};function Qg(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function BN(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var UN={};const kt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||UN.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),i=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>s||l<i)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>Ct(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>Ct(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),Jg(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),Jg(o)),dec:(o,r)=>function(i,s){let a=vd(i,s);const l=2147483648&a.hi;l&&(a=Xg(a.lo,a.hi));const c=Kg(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>Kg(o,r)}}();var fe,Vo,It;function $o(t,e,n){if(e===n)return!0;if(t==fe.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==n}return!1}function Ur(t,e){switch(t){case fe.BOOL:return!1;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==0?kt.zero:"0";case fe.DOUBLE:case fe.FLOAT:return 0;case fe.BYTES:return new Uint8Array(0);case fe.STRING:return"";default:return 0}}function e1(t,e){switch(t){case fe.BOOL:return e===!1;case fe.STRING:return e==="";case fe.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(fe||(fe={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(Vo||(Vo={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(It||(It={}));class VN{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(xd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Fa(e),Qg(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Hg(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){xd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Fa(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Fa(e),Qg(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=kt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=kt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=kt.enc(e);return wd(n.lo,n.hi,this.buf),this}sint64(e){let n=kt.enc(e),o=n.hi>>31;return wd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=kt.uEnc(e);return wd(n.lo,n.hi,this.buf),this}}class $N{constructor(e,n){this.varint64=zN,this.uint32=BN,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case It.Varint:for(;128&this.buf[this.pos++];);break;case It.Bit64:this.pos+=4;case It.Bit32:this.pos+=4;break;case It.LengthDelimited:let r=this.uint32();this.pos+=r;break;case It.StartGroup:for(;;){const[i,s]=this.tag();if(s===It.EndGroup){if(n!==void 0&&i!==n)throw new Error("invalid end group tag");break}this.skip(s,i)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return kt.dec(...this.varint64())}uint64(){return kt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,kt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return kt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return kt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function t1(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return Ur(r.T,r.L);case"message":const i=r.T,s=new i;return i.fieldWrapper?i.fieldWrapper.unwrapField(s):s;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ba=[];for(let t=0;t<mo.length;t++)Ba[mo[t].charCodeAt(0)]=t;Ba[45]=mo.indexOf("+"),Ba[95]=mo.indexOf("/");const Ua={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,i=0,s=0;for(let a=0;a<t.length;a++){if(n=Ba[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":i=0;case`
92
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=n,i=1;break;case 1:o[r++]=s<<2|(48&n)>>4,s=n,i=2;break;case 2:o[r++]=(15&s)<<4|(60&n)>>2,s=n,i=3;break;case 3:o[r++]=(3&s)<<6|n,i=0}}if(i==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let i=0;i<t.length;i++)switch(e=t[i],o){case 0:n+=mo[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=mo[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=mo[r|e>>6],n+=mo[63&e],o=0}return o&&(n+=mo[r],n+="=",o==1&&(n+="=")),n}};function HN(t,e,n){o1(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[i,s]=t1(e);for(const a of r)e.runtime.bin.readField(i,o.readerFactory(a.data),e.field,a.wireType,o);return s()}function WN(t,e,n,o){o1(e,t);const r=e.runtime.bin.makeReadOptions(o),i=e.runtime.bin.makeWriteOptions(o);if(n1(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of c)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const s=i.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,s,i);const l=r.readerFactory(s.finish());for(;l.pos<l.len;){const[c,d]=l.tag(),u=l.skip(d,c);t.getType().runtime.bin.onUnknownField(t,c,d,u)}}function n1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function o1(t,e){Ct(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function r1(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!e1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function i1(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?Ur(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function pr(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Rt.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function s1(t,e){return pr(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}fe.DOUBLE,fe.FLOAT,fe.INT64,fe.UINT64,fe.INT32,fe.UINT32,fe.BOOL,fe.STRING,fe.BYTES;const a1={ignoreUnknownFields:!1},l1={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function qN(t){return t?Object.assign(Object.assign({},a1),t):a1}function GN(t){return t?Object.assign(Object.assign({},l1),t):l1}const Va=Symbol(),$a=Symbol();function Qn(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function c1(t,e,n,o,r){let i=n.localName;if(n.repeated){if(Ct(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Qn(e)}`);const s=t[i];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Qn(a)}`);switch(n.kind){case"message":s.push(n.T.fromJson(a,o));break;case"enum":const l=kd(n.T,a,o.ignoreUnknownFields,!0);l!==$a&&s.push(l);break;case"scalar":try{s.push(as(n.T,a,n.L,!0))}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Qn(a)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Qn(e)}`);const s=t[i];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=YN(n.K,a)}catch(d){let u=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Qn(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}switch(n.V.kind){case"message":s[c]=n.V.T.fromJson(l,o);break;case"enum":const d=kd(n.V.T,l,o.ignoreUnknownFields,!0);d!==$a&&(s[c]=d);break;case"scalar":try{s[c]=as(n.V.T,l,Vo.BIGINT,!0)}catch(u){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Qn(e)}`;throw u instanceof Error&&u.message.length>0&&(f+=`: ${u.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:i},i="value"),n.kind){case"message":const s=n.T;if(e===null&&s.typeName!="google.protobuf.Value")return;let a=t[i];pr(a)?a.fromJson(e,o):(t[i]=a=s.fromJson(e,o),s.fieldWrapper&&!n.oneof&&(t[i]=s.fieldWrapper.unwrapField(a)));break;case"enum":const l=kd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Va:i1(n,t);break;case $a:break;default:t[i]=l}break;case"scalar":try{const c=as(n.T,e,n.L,!1);c===Va?i1(n,t):t[i]=c}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Qn(e)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}function YN(t,e){if(t===fe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return as(t,e,Vo.BIGINT,!0).toString()}function as(t,e,n,o){if(e===null)return o?Ur(t,n):Va;switch(t){case fe.DOUBLE:case fe.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==fe.FLOAT&&Hg(r),r;case fe.INT32:case fe.FIXED32:case fe.SFIXED32:case fe.SINT32:case fe.UINT32:let i;if(typeof e=="number"?i=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(i=Number(e)),i===void 0)break;return t==fe.UINT32||t==fe.FIXED32?xd(i):Fa(i),i;case fe.INT64:case fe.SFIXED64:case fe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const s=kt.parse(e);return n?s.toString():s;case fe.FIXED64:case fe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=kt.uParse(e);return n?a.toString():a;case fe.BOOL:if(typeof e!="boolean")break;return e;case fe.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case fe.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Ua.dec(e)}throw new Error}function kd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Va;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return $a}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${Qn(e)}`)}function JN(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function d1(t,e,n){if(t.kind=="map"){Ct(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[s,a]of r)o[s.toString()]=Ha(t.V.T,a);break;case"message":for(const[s,a]of r)o[s.toString()]=a.toJson(n);break;case"enum":const i=t.V.T;for(const[s,a]of r)o[s.toString()]=Sd(i,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){Ct(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(Ha(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Sd(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return Ha(t.T,e);case"enum":return Sd(t.T,e,n.enumAsInteger);case"message":return s1(t.T,e).toJson(n)}}function Sd(t,e,n){var o;if(Ct(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function Ha(t,e){switch(t){case fe.INT32:case fe.SFIXED32:case fe.SINT32:case fe.FIXED32:case fe.UINT32:return Ct(typeof e=="number"),e;case fe.FLOAT:case fe.DOUBLE:return Ct(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case fe.STRING:return Ct(typeof e=="string"),e;case fe.BOOL:return Ct(typeof e=="boolean"),e;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return Ct(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case fe.BYTES:return Ct(e instanceof Uint8Array),Ua.enc(e)}}const Vr=Symbol("@bufbuild/protobuf/unknown-fields"),u1={readUnknownFields:!0,readerFactory:t=>new $N(t)},h1={writeUnknownFields:!0,writerFactory:()=>new VN};function KN(t){return t?Object.assign(Object.assign({},u1),t):u1}function XN(t){return t?Object.assign(Object.assign({},h1),t):h1}function f1(t,e,n,o,r){let{repeated:i,localName:s}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=s&&delete t.value,t.case=s,s="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?fe.INT32:n.T;let l=qa;if(n.kind=="scalar"&&n.L>0&&(l=ZN),i){let f=t[s];if(o==It.LengthDelimited&&a!=fe.STRING&&a!=fe.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,a))}else f.push(l(e,a))}else t[s]=l(e,a);break;case"message":const c=n.T;i?t[s].push(Wa(e,new c,r,n)):pr(t[s])?Wa(e,t[s],r,n):(t[s]=Wa(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[s]=c.fieldWrapper.unwrapField(t[s])));break;case"map":let[d,u]=function(f,m,_){const g=m.uint32(),p=m.pos+g;let b,x;for(;m.pos<p;){const[y]=m.tag();switch(y){case 1:b=qa(m,f.K);break;case 2:switch(f.V.kind){case"scalar":x=qa(m,f.V.T);break;case"enum":x=m.int32();break;case"message":x=Wa(m,new f.V.T,_,void 0)}}}if(b===void 0&&(b=Ur(f.K,Vo.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),x===void 0)switch(f.V.kind){case"scalar":x=Ur(f.V.T,Vo.BIGINT);break;case"enum":x=f.V.T.values[0].no;break;case"message":x=new f.V.T}return[b,x]}(n,e,r);t[s][d]=u}}function Wa(t,e,n,o){const r=e.getType().runtime.bin,i=o==null?void 0:o.delimited;return r.readMessage(e,t,i?o.no:t.uint32(),n,i),e}function ZN(t,e){const n=qa(t,e);return typeof n=="bigint"?n.toString():n}function qa(t,e){switch(e){case fe.STRING:return t.string();case fe.BOOL:return t.bool();case fe.DOUBLE:return t.double();case fe.FLOAT:return t.float();case fe.INT32:return t.int32();case fe.INT64:return t.int64();case fe.UINT64:return t.uint64();case fe.FIXED64:return t.fixed64();case fe.BYTES:return t.bytes();case fe.FIXED32:return t.fixed32();case fe.SFIXED32:return t.sfixed32();case fe.SFIXED64:return t.sfixed64();case fe.SINT64:return t.sint64();case fe.UINT32:return t.uint32();case fe.SINT32:return t.sint32()}}function m1(t,e,n,o){Ct(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let i=t.kind=="enum"?fe.INT32:t.T;if(r)if(Ct(Array.isArray(e)),t.packed)(function(s,a,l,c){if(!c.length)return;s.tag(l,It.LengthDelimited).fork();let[,d]=g1(a);for(let u=0;u<c.length;u++)s[d](c[u]);s.join()})(n,i,t.no,e);else for(const s of e)ls(n,i,t.no,s);else ls(n,i,t.no,e);break;case"message":if(r){Ct(Array.isArray(e));for(const s of e)p1(n,o,t,s)}else p1(n,o,t,e);break;case"map":Ct(typeof e=="object"&&e!=null);for(const[s,a]of Object.entries(e))QN(n,o,t,s,a)}}function QN(t,e,n,o,r){t.tag(n.no,It.LengthDelimited),t.fork();let i=o;switch(n.K){case fe.INT32:case fe.FIXED32:case fe.UINT32:case fe.SFIXED32:case fe.SINT32:i=Number.parseInt(o);break;case fe.BOOL:Ct(o=="true"||o=="false"),i=o=="true"}switch(ls(t,n.K,1,i),n.V.kind){case"scalar":ls(t,n.V.T,2,r);break;case"enum":ls(t,fe.INT32,2,r);break;case"message":Ct(r!==void 0),t.tag(2,It.LengthDelimited).bytes(r.toBinary(e))}t.join()}function p1(t,e,n,o){const r=s1(n.T,o);n.delimited?t.tag(n.no,It.StartGroup).raw(r.toBinary(e)).tag(n.no,It.EndGroup):t.tag(n.no,It.LengthDelimited).bytes(r.toBinary(e))}function ls(t,e,n,o){Ct(o!==void 0);let[r,i]=g1(e);t.tag(n,r)[i](o)}function g1(t){let e=It.Varint;switch(t){case fe.BYTES:case fe.STRING:e=It.LengthDelimited;break;case fe.DOUBLE:case fe.FIXED64:case fe.SFIXED64:e=It.Bit64;break;case fe.FIXED32:case fe.SFIXED32:case fe.FLOAT:e=It.Bit32}return[e,fe[t].toLowerCase()]}function Ga(t){if(t===void 0)return t;if(pr(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function cs(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class ej{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function _1(t,e){const n=b1(t);return e?n:ij(rj(n))}const tj=b1;function b1(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const nj=new Set(["constructor","toString","toJSON","valueOf"]),oj=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),y1=t=>`${t}$`,rj=t=>oj.has(t)?y1(t):t,ij=t=>nj.has(t)?y1(t):t;class sj{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=_1(e,!1)}addField(e){Ct(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const we=(x1=t=>new ej(t,e=>function(n){var o,r,i,s,a,l;const c=[];let d;for(const u of typeof n=="function"?n():n){const f=u;if(f.localName=_1(u.name,u.oneof!==void 0),f.jsonName=(o=u.jsonName)!==null&&o!==void 0?o:tj(u.name),f.repeated=(r=u.repeated)!==null&&r!==void 0&&r,u.kind=="scalar"&&(f.L=(i=u.L)!==null&&i!==void 0?i:Vo.BIGINT),f.delimited=(s=u.delimited)!==null&&s!==void 0&&s,f.req=(a=u.req)!==null&&a!==void 0&&a,f.opt=(l=u.opt)!==null&&l!==void 0&&l,u.packed===void 0&&(f.packed=u.kind=="enum"||u.kind=="scalar"&&u.T!=fe.BYTES&&u.T!=fe.STRING),u.oneof!==void 0){const m=typeof u.oneof=="string"?u.oneof:u.oneof.name;d&&d.name==m||(d=new sj(m)),f.oneof=d,d.addField(f)}c.push(f)}return c}(e)),w1=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Ur(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:qN,makeWriteOptions:GN,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${Qn(e)}`);o=o??new t;const r=new Map,i=n.typeRegistry;for(const[s,a]of Object.entries(e)){const l=t.fields.findJsonName(s);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${s}"`);r.set(l.oneof,s)}c1(o,a,l,n,t)}else{let c=!1;if(i!=null&&i.findExtension&&s.startsWith("[")&&s.endsWith("]")){const d=i.findExtension(s.substring(1,s.length-1));if(d&&d.extendee.typeName==t.typeName){c=!0;const[u,f]=t1(d);c1(u,a,d.field,n,d),WN(o,d,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${s}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!r1(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!JN(r))continue}const s=d1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);s!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=s)}const i=e.typeRegistry;if(i!=null&&i.findExtensionFor)for(const s of n.runtime.bin.listUnknownFields(t)){const a=i.findExtensionFor(n.typeName,s.no);if(a&&n1(t,a)){const l=HN(t,a,e),c=d1(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(i){const s=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=i instanceof Error?i.message:String(i);throw new Error(s+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>as(t,e,n??Vo.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||e1(t,e)?Ha(t,e):void 0},debug:Qn},bin:{makeReadOptions:KN,makeWriteOptions:XN,listUnknownFields(t){var e;return(e=t[Vr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Vr]},writeUnknownFields(t,e){const n=t[Vr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Vr])||(r[Vr]=[]),r[Vr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const i=t.getType(),s=r?e.len:e.pos+n;let a,l;for(;e.pos<s&&([a,l]=e.tag(),r!==!0||l!=It.EndGroup);){const c=i.fields.find(a);if(c)f1(t,e,c,l,o);else{const d=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,d)}}if(r&&(l!=It.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:f1,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(r1(r,t))m1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&m1(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:qg,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,i=e,s=t;if(s[r]!=null)switch(o.kind){case"oneof":const a=s[r].case;if(a===void 0)continue;const l=o.findField(a);let c=s[r].value;l&&l.kind=="message"&&!pr(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===fe.BYTES&&(c=cs(c)),i[r]={case:a,value:c};break;case"scalar":case"enum":let d=s[r];o.T===fe.BYTES&&(d=o.repeated?d.map(cs):cs(d)),i[r]=d;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===fe.BYTES)for(const[m,_]of Object.entries(s[r]))i[r][m]=cs(_);else Object.assign(i[r],s[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(s[r])){let _=s[r][m];f.fieldWrapper||(_=new f(_)),i[r][m]=_}}break;case"message":const u=o.T;if(o.repeated)i[r]=s[r].map(f=>pr(f,u)?f:new u(f));else{const f=s[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?i[r]=cs(f):i[r]=f:i[r]=pr(f,u)?f:new u(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],i=n[o.localName];if(o.repeated){if(r.length!==i.length)return!1;switch(o.kind){case"message":return r.every((s,a)=>o.T.equals(s,i[a]));case"scalar":return r.every((s,a)=>$o(o.T,s,i[a]));case"enum":return r.every((s,a)=>$o(fe.INT32,s,i[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":return o.T.equals(r,i);case"enum":return $o(fe.INT32,r,i);case"scalar":return $o(o.T,r,i);case"oneof":if(r.case!==i.case)return!1;const s=o.findField(r.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(r.value,i.value);case"enum":return $o(fe.INT32,r.value,i.value);case"scalar":return $o(s.T,r.value,i.value)}throw new Error(`oneof cannot contain ${s.kind}`);case"map":const a=Object.keys(r).concat(Object.keys(i));switch(o.V.kind){case"message":const l=o.V.T;return a.every(d=>l.equals(r[d],i[d]));case"enum":return a.every(d=>$o(fe.INT32,r[d],i[d]));case"scalar":const c=o.V.T;return a.every(d=>$o(c,r[d],i[d]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const i=t[r.localName];let s;if(r.repeated)s=i.map(Ga);else if(r.kind=="map"){s=o[r.localName];for(const[a,l]of Object.entries(i))s[a]=Ga(l)}else s=r.kind=="oneof"?r.findField(i.case)?{case:i.case,value:Ga(i.value)}:{case:void 0}:Ga(i);o[r.localName]=s}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:x1,initFields:w1}),makeMessageType(t,e,n){return function(o,r,i,s){var a;const l=(a=s==null?void 0:s.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(d){o.util.initFields(this),o.util.initPartial(d,this)}}[l];return Object.setPrototypeOf(c.prototype,new Rt),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(i),fromBinary:(d,u)=>new c().fromBinary(d,u),fromJson:(d,u)=>new c().fromJson(d,u),fromJsonString:(d,u)=>new c().fromJsonString(d,u),equals:(d,u)=>o.util.equals(c,d,u)}),c}(this,t,e,n)},makeEnum:FN,makeEnumType:Gg,getEnumType:LN,makeExtension(t,e,n){return function(o,r,i,s){let a;return{typeName:r,extendee:i,get field(){if(!a){const l=typeof s=="function"?s():s;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var x1,w1,In,Cd,Ya,ds,Ja,us,Ho;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(In||(In={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(Cd||(Cd={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Ya||(Ya={})),we.util.setEnumType(Ya,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(ds||(ds={})),we.util.setEnumType(ds,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(Ja||(Ja={})),we.util.setEnumType(Ja,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(us||(us={})),we.util.setEnumType(us,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(Ho||(Ho={})),we.util.setEnumType(Ho,"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 _o=class _o extends Rt{constructor(n){super();ee(this,"completionId","");ee(this,"text","");ee(this,"prefix","");ee(this,"stop","");ee(this,"score",0);ee(this,"tokens",[]);ee(this,"decodedTokens",[]);ee(this,"probabilities",[]);ee(this,"adjustedProbabilities",[]);ee(this,"generatedLength",kt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new _o().fromBinary(n,o)}static fromJson(n,o){return new _o().fromJson(n,o)}static fromJsonString(n,o){return new _o().fromJsonString(n,o)}static equals(n,o){return we.util.equals(_o,n,o)}};ee(_o,"runtime",we),ee(_o,"typeName","exa.codeium_common_pb.Completion"),ee(_o,"fields",we.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 Nd=_o;const bo=class bo extends Rt{constructor(n){super();ee(this,"ideName","");ee(this,"ideVersion","");ee(this,"extensionName","");ee(this,"extensionVersion","");ee(this,"apiKey","");ee(this,"locale","");ee(this,"sessionId","");ee(this,"requestId",kt.zero);ee(this,"userAgent","");ee(this,"url","");ee(this,"authSource",ds.CODEIUM);we.util.initPartial(n,this)}static fromBinary(n,o){return new bo().fromBinary(n,o)}static fromJson(n,o){return new bo().fromJson(n,o)}static fromJsonString(n,o){return new bo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(bo,n,o)}};ee(bo,"runtime",we),ee(bo,"typeName","exa.codeium_common_pb.Metadata"),ee(bo,"fields",we.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:we.getEnumType(ds)}]));let Ka=bo;const yo=class yo extends Rt{constructor(n){super();ee(this,"tabSize",kt.zero);ee(this,"insertSpaces",!1);we.util.initPartial(n,this)}static fromBinary(n,o){return new yo().fromBinary(n,o)}static fromJson(n,o){return new yo().fromJson(n,o)}static fromJsonString(n,o){return new yo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(yo,n,o)}};ee(yo,"runtime",we),ee(yo,"typeName","exa.codeium_common_pb.EditorOptions"),ee(yo,"fields",we.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let jd=yo;we.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:we.getEnumType(Ja)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class aj extends Vi{constructor(n,o){super();ee(this,"index");ee(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Xa=Ui.define({combine:t=>_c(t,{language:Ho.TYPESCRIPT,timeout:150,widgetClass:aj,alwaysOn:!0},{})}),v1=Ui.define({combine:t=>_c(t,{override:()=>[]},{})}),lj=dt.mark({class:"cm-ghostText"}),gr=Un.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Xa);for(const r of e.effects){if(r.is(_d)){const{changeSpecs:i,index:s}=r.value,a=i[s].map(c=>lj.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:s,decorations:dt.set([...a,...l!==void 0&&i.length>1&&n.widgetClass?[dt.widget({widget:new n.widgetClass(s,i.length),side:1}).range(l)]:[]]),changeSpecs:i,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(bd)||r.is(yd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>st.decorations.from(t,e=>(e==null?void 0:e.decorations)||dt.none)}),$r=ym.define(),Za=ym.define();var _t;function Ed(t){const e=_t[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let Qa;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(_t||(_t={}));class Jt extends Error{constructor(e,n=_t.Unknown,o,r,i){super(function(s,a){return s.length?`[${Ed(a)}] ${s}`:`[${Ed(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=i}static from(e,n=_t.Unknown){return e instanceof Jt?e:e instanceof Error?e.name=="AbortError"?new Jt(e.message,_t.Canceled):new Jt(e.message,n,void 0,void 0,e):new Jt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Jt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const i=n.findMessage(r.type);if(i)try{o.push(i.fromBinary(r.value))}catch{}}return o}}var cj=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(i){return new Promise(function(s,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(s,a,(i=t[r](i)).done,i.value)})}}},hs=function(t){return this instanceof hs?(this.v=t,this):new hs(t)},dj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),i=[];return o={},s("next"),s("throw"),s("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function s(u,f){r[u]&&(o[u]=function(m){return new Promise(function(_,g){i.push([u,m,_,g])>1||a(u,m)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(m=r[u](f)).value instanceof hs?Promise.resolve(m.value.v).then(l,c):d(i[0][2],m)}catch(_){d(i[0][3],_)}var m}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),i.shift(),i.length&&a(i[0][0],i[0][1])}},uj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,i){e[r]=t[r]?function(s){return(n=!n)?{value:hs(t[r](s)),done:!1}:i?i(s):s}:i}},k1=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(i){return new Promise(function(s,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(s,a,(i=t[r](i)).done,i.value)})}}},Hr=function(t){return this instanceof Hr?(this.v=t,this):new Hr(t)},hj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,i){e[r]=t[r]?function(s){return(n=!n)?{value:Hr(t[r](s)),done:!1}:i?i(s):s}:i}},fj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),i=[];return o={},s("next"),s("throw"),s("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function s(u,f){r[u]&&(o[u]=function(m){return new Promise(function(_,g){i.push([u,m,_,g])>1||a(u,m)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(m=r[u](f)).value instanceof Hr?Promise.resolve(m.value.v).then(l,c):d(i[0][2],m)}catch(_){d(i[0][3],_)}var m}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),i.shift(),i.length&&a(i[0][0],i[0][1])}};function S1(t,e){const n=function(){var o,r;return fj(this,arguments,function*(){const i=yield Hr(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,i.header),yield Hr(yield*hj(k1(i.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,i.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function C1(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function N1(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function j1(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function E1(t,e){return e instanceof t?e:new t(e)}function mj(t,e){function n(o){return o.done===!0?o:{done:o.done,value:E1(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=i=>o.throw(i).then(n)),o.return!==void 0&&(r.return=i=>o.return(i).then(n)),r}}}function I1(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function A1(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function T1(t,e,n,o){const r=e?M1(t.I,o):O1(t.I,n);return{parse:(e?M1(t.O,o):O1(t.O,n)).parse,serialize:r.serialize}}function M1(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Jt(`parse binary: ${r}`,_t.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Jt(`serialize binary: ${r}`,_t.Internal)}}}}function O1(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,i=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,s=A1(e);return{parse(a){try{const l=i.decode(a);return t.fromJsonString(l,s)}catch(l){throw Jt.from(l,_t.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(s);return r.encode(l)}catch(l){throw Jt.from(l,_t.Internal)}}}}const pj=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function D1(t,e,n){if(e&&new Headers(e).forEach((s,a)=>n.metadata.append(a,s)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;const o=function(s){if(!Qa){Qa={};for(const a of Object.values(_t))typeof a!="string"&&(Qa[Ed(a)]=a)}return Qa[s]}(t.code);if(o===void 0)throw n;const r=t.message;if(r!=null&&typeof r!="string")throw n;const i=new Jt(r??"",o,e);if("details"in t&&Array.isArray(t.details))for(const s of t.details){if(s===null||typeof s!="object"||Array.isArray(s)||typeof s.type!="string"||typeof s.value!="string"||"debug"in s&&typeof s.debug!="object")throw n;try{i.details.push({type:s.type,value:Ua.dec(s.value),debug:s.debug})}catch{throw n}}return i}function gj(t){const e=new Jt("invalid end stream",_t.InvalidArgument);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,i]of Object.entries(n.metadata)){if(!Array.isArray(i)||i.some(s=>typeof s!="string"))throw e;for(const s of i)o.append(r,s)}}return{metadata:o,error:"error"in n?D1(n.error,o,e):void 0}}const Id="Content-Type",_j="Content-Length",R1="Content-Encoding",bj="Accept-Encoding",P1="Connect-Protocol-Version";function L1(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.set(r.substring(8),o):e.set(r,o)}),[e,n]}function F1(t,e,n,o,r){const i=new Headers(o??{});return n!==void 0&&i.set("Connect-Timeout-Ms",`${n}`),i.set(Id,t==In.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),i.set(P1,"1"),i}function z1(t,e,n){const o=function(r){const i=r==null?void 0:r.match(pj);if(i)return{stream:!!i[1],binary:!!i[3]}}(n.get("Content-Type"));if(e!==200){const r=new Jt(`HTTP ${e}`,function(i){switch(i){case 400:return _t.InvalidArgument;case 401:return _t.Unauthenticated;case 403:return _t.PermissionDenied;case 404:return _t.Unimplemented;case 408:return _t.DeadlineExceeded;case 409:return _t.Aborted;case 412:return _t.FailedPrecondition;case 413:case 431:return _t.ResourceExhausted;case 415:return _t.Internal;case 429:case 502:case 503:case 504:return _t.Unavailable;default:return _t.Unknown}}(e),n);if(t==In.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const yj="application/";function xj(t,e,n){let o="?connect=v1";const r=t.header.get(Id);(r==null?void 0:r.indexOf(yj))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const i=t.header.get(R1);i!==null&&i!=="identity"&&(o+="&compression="+encodeURIComponent(i),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?Ua.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const s=t.url+o,a=new Headers(t.header);return[P1,Id,_j,R1,bj].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:s,header:a})}function B1(t){const{signal:e,cleanup:n}=function(r){const i=new AbortController,s=()=>{i.abort(new Jt("the operation timed out",_t.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?s():a=setTimeout(s,r)),{signal:i.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const i=new AbortController,s=r.filter(l=>l!==void 0).concat(i.signal);for(const l of s){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){i.signal.aborted||i.abort(C1(this));for(const l of s)l.removeEventListener("abort",a)}return i}(t.signal,e);return[o.signal,function(r){const i=Jt.from(e.aborted?C1(e):r);return o.abort(i),n(),Promise.reject(i)},function(){n(),o.abort()}]}var fs,Ad,ms;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(fs||(fs={})),we.util.setEnumType(fs,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(Ad||(Ad={})),we.util.setEnumType(Ad,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(ms||(ms={})),we.util.setEnumType(ms,"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 xo=class xo extends Rt{constructor(n){super();ee(this,"threshold",0);we.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(xo,n,o)}};ee(xo,"runtime",we),ee(xo,"typeName","exa.language_server_pb.MultilineConfig"),ee(xo,"fields",we.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Td=xo;const wo=class wo extends Rt{constructor(n){super();ee(this,"metadata");ee(this,"document");ee(this,"editorOptions");ee(this,"otherDocuments",[]);ee(this,"experimentConfig");ee(this,"modelName","");ee(this,"multilineConfig");we.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(wo,n,o)}};ee(wo,"runtime",we),ee(wo,"typeName","exa.language_server_pb.GetCompletionsRequest"),ee(wo,"fields",we.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ka},{no:2,name:"document",kind:"message",T:el},{no:3,name:"editor_options",kind:"message",T:jd},{no:5,name:"other_documents",kind:"message",T:el,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Fd},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Td}]));let Md=wo;const vo=class vo extends Rt{constructor(n){super();ee(this,"state");ee(this,"completionItems",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(vo,n,o)}};ee(vo,"runtime",we),ee(vo,"typeName","exa.language_server_pb.GetCompletionsResponse"),ee(vo,"fields",we.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:zd},{no:2,name:"completion_items",kind:"message",T:$d,repeated:!0}]));let Od=vo;const ko=class ko extends Rt{constructor(n){super();ee(this,"metadata");ee(this,"completionId","");we.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return we.util.equals(ko,n,o)}};ee(ko,"runtime",we),ee(ko,"typeName","exa.language_server_pb.AcceptCompletionRequest"),ee(ko,"fields",we.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ka},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Dd=ko;const So=class So extends Rt{constructor(e){super(),we.util.initPartial(e,this)}static fromBinary(e,n){return new So().fromBinary(e,n)}static fromJson(e,n){return new So().fromJson(e,n)}static fromJsonString(e,n){return new So().fromJsonString(e,n)}static equals(e,n){return we.util.equals(So,e,n)}};ee(So,"runtime",we),ee(So,"typeName","exa.language_server_pb.AcceptCompletionResponse"),ee(So,"fields",we.util.newFieldList(()=>[]));let Rd=So;const Co=class Co extends Rt{constructor(e){super(),we.util.initPartial(e,this)}static fromBinary(e,n){return new Co().fromBinary(e,n)}static fromJson(e,n){return new Co().fromJson(e,n)}static fromJsonString(e,n){return new Co().fromJsonString(e,n)}static equals(e,n){return we.util.equals(Co,e,n)}};ee(Co,"runtime",we),ee(Co,"typeName","exa.language_server_pb.GetAuthTokenRequest"),ee(Co,"fields",we.util.newFieldList(()=>[]));let Pd=Co;const No=class No extends Rt{constructor(n){super();ee(this,"authToken","");ee(this,"uuid","");we.util.initPartial(n,this)}static fromBinary(n,o){return new No().fromBinary(n,o)}static fromJson(n,o){return new No().fromJson(n,o)}static fromJsonString(n,o){return new No().fromJsonString(n,o)}static equals(n,o){return we.util.equals(No,n,o)}};ee(No,"runtime",we),ee(No,"typeName","exa.language_server_pb.GetAuthTokenResponse"),ee(No,"fields",we.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Ld=No;const jo=class jo extends Rt{constructor(n){super();ee(this,"row",kt.zero);ee(this,"col",kt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new jo().fromBinary(n,o)}static fromJson(n,o){return new jo().fromJson(n,o)}static fromJsonString(n,o){return new jo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(jo,n,o)}};ee(jo,"runtime",we),ee(jo,"typeName","exa.language_server_pb.DocumentPosition"),ee(jo,"fields",we.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let ps=jo;const Eo=class Eo extends Rt{constructor(n){super();ee(this,"absolutePath","");ee(this,"relativePath","");ee(this,"text","");ee(this,"editorLanguage","");ee(this,"language",Ho.UNSPECIFIED);ee(this,"cursorOffset",kt.zero);ee(this,"cursorPosition");ee(this,"lineEnding","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Eo().fromBinary(n,o)}static fromJson(n,o){return new Eo().fromJson(n,o)}static fromJsonString(n,o){return new Eo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Eo,n,o)}};ee(Eo,"runtime",we),ee(Eo,"typeName","exa.language_server_pb.Document"),ee(Eo,"fields",we.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:we.getEnumType(Ho)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:ps},{no:7,name:"line_ending",kind:"scalar",T:9}]));let el=Eo;const Io=class Io extends Rt{constructor(n){super();ee(this,"forceEnableExperiments",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new Io().fromBinary(n,o)}static fromJson(n,o){return new Io().fromJson(n,o)}static fromJsonString(n,o){return new Io().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Io,n,o)}};ee(Io,"runtime",we),ee(Io,"typeName","exa.language_server_pb.ExperimentConfig"),ee(Io,"fields",we.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:we.getEnumType(Ya),repeated:!0}]));let Fd=Io;const Ao=class Ao extends Rt{constructor(n){super();ee(this,"state",fs.UNSPECIFIED);ee(this,"message","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Ao().fromBinary(n,o)}static fromJson(n,o){return new Ao().fromJson(n,o)}static fromJsonString(n,o){return new Ao().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Ao,n,o)}};ee(Ao,"runtime",we),ee(Ao,"typeName","exa.language_server_pb.State"),ee(Ao,"fields",we.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:we.getEnumType(fs)},{no:2,name:"message",kind:"scalar",T:9}]));let zd=Ao;const To=class To extends Rt{constructor(n){super();ee(this,"startOffset",kt.zero);ee(this,"endOffset",kt.zero);ee(this,"startPosition");ee(this,"endPosition");we.util.initPartial(n,this)}static fromBinary(n,o){return new To().fromBinary(n,o)}static fromJson(n,o){return new To().fromJson(n,o)}static fromJsonString(n,o){return new To().fromJsonString(n,o)}static equals(n,o){return we.util.equals(To,n,o)}};ee(To,"runtime",we),ee(To,"typeName","exa.language_server_pb.Range"),ee(To,"fields",we.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:ps},{no:4,name:"end_position",kind:"message",T:ps}]));let Bd=To;const Mo=class Mo extends Rt{constructor(n){super();ee(this,"text","");ee(this,"deltaCursorOffset",kt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new Mo().fromBinary(n,o)}static fromJson(n,o){return new Mo().fromJson(n,o)}static fromJsonString(n,o){return new Mo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Mo,n,o)}};ee(Mo,"runtime",we),ee(Mo,"typeName","exa.language_server_pb.Suffix"),ee(Mo,"fields",we.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let Ud=Mo;const Oo=class Oo extends Rt{constructor(n){super();ee(this,"text","");ee(this,"offset",kt.zero);ee(this,"type",ms.UNSPECIFIED);ee(this,"prefix","");ee(this,"line",kt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new Oo().fromBinary(n,o)}static fromJson(n,o){return new Oo().fromJson(n,o)}static fromJsonString(n,o){return new Oo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Oo,n,o)}};ee(Oo,"runtime",we),ee(Oo,"typeName","exa.language_server_pb.CompletionPart"),ee(Oo,"fields",we.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:we.getEnumType(ms)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let Vd=Oo;const Do=class Do extends Rt{constructor(n){super();ee(this,"completion");ee(this,"suffix");ee(this,"range");ee(this,"source",us.UNSPECIFIED);ee(this,"completionParts",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new Do().fromBinary(n,o)}static fromJson(n,o){return new Do().fromJson(n,o)}static fromJsonString(n,o){return new Do().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Do,n,o)}};ee(Do,"runtime",we),ee(Do,"typeName","exa.language_server_pb.CompletionItem"),ee(Do,"fields",we.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Nd},{no:5,name:"suffix",kind:"message",T:Ud},{no:2,name:"range",kind:"message",T:Bd},{no:3,name:"source",kind:"enum",T:we.getEnumType(us)},{no:8,name:"completion_parts",kind:"message",T:Vd,repeated:!0}]));let $d=Do;const wj={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Md,O:Od,kind:In.Unary},acceptCompletion:{name:"AcceptCompletion",I:Dd,O:Rd,kind:In.Unary},getAuthToken:{name:"GetAuthToken",I:Pd,O:Ld,kind:In.Unary}}};var gs=function(t){return this instanceof gs?(this.v=t,this):new gs(t)},vj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),i=[];return o={},s("next"),s("throw"),s("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function s(u,f){r[u]&&(o[u]=function(m){return new Promise(function(_,g){i.push([u,m,_,g])>1||a(u,m)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(m=r[u](f)).value instanceof gs?Promise.resolve(m.value.v).then(l,c):d(i[0][2],m)}catch(_){d(i[0][3],_)}var m}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),i.shift(),i.length&&a(i[0][0],i[0][1])}};const kj=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,i,s,a,l,c){var d;const{serialize:u,parse:f}=T1(r,n,t.jsonOptions,t.binaryOptions);return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await function(m){const _=I1(m.next,m.interceptors),[g,p,b]=B1(m);return _(Object.assign(Object.assign({},m.req),{message:E1(m.req.method.I,m.req.message),signal:g})).then(x=>(b(),x),p)}({interceptors:t.interceptors,signal:i,timeoutMs:s,req:{stream:!1,service:o,method:r,url:j1(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:F1(r.kind,n,s,a),contextValues:c??N1(),message:l},next:async m=>{var _;let g=null;t.useHttpGet===!0&&r.idempotency===Cd.NoSideEffects?m=xj(m,u(m.message),n):g=u(m.message);const p=(_=t.fetch)!==null&&_!==void 0?_:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:g})),{isUnaryError:x,unaryError:y}=z1(r.kind,b.status,b.headers);if(x)throw D1(await b.json(),function(...k){const N=new Headers;for(const E of k)E.forEach((I,T)=>{N.append(T,I)});return N}(...L1(b.headers)),y);const[v,S]=L1(b.headers);return{stream:!1,service:o,method:r,header:v,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),A1(t.jsonOptions)),trailer:S}}})},async stream(o,r,i,s,a,l,c){var d;const{serialize:u,parse:f}=T1(r,n,t.jsonOptions,t.binaryOptions);function m(g,p,b){return vj(this,arguments,function*(){const x=function(v){let S,k=new Uint8Array(0);function N(E){const I=new Uint8Array(k.length+E.length);I.set(k),I.set(E,k.length),k=I}return new ReadableStream({start(){S=v.getReader()},async pull(E){let I;for(;;){if(I===void 0&&k.byteLength>=5){let R=0;for(let B=1;B<5;B++)R=(R<<8)+k[B];I={flags:k[0],length:R}}if(I!==void 0&&k.byteLength>=I.length+5)break;const M=await S.read();if(M.done)break;N(M.value)}if(I===void 0)return k.byteLength==0?void E.close():void E.error(new Jt("premature end of stream",_t.DataLoss));const T=k.subarray(5,5+I.length);k=k.subarray(5+I.length),E.enqueue({flags:I.flags,data:T})}})}(g).getReader();let y=!1;for(;;){const v=yield gs(x.read());if(v.done)break;const{flags:S,data:k}=v.value;if(2&~S)yield yield gs(f(k));else{y=!0;const N=gj(k);if(N.error){const E=N.error;throw b.forEach((I,T)=>{E.metadata.append(T,I)}),E}N.metadata.forEach((E,I)=>p.set(I,E))}}if(!y)throw"missing EndStreamResponse"})}async function _(g){if(r.kind!=In.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await g[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,x){const y=new Uint8Array(x.length+5);y.set(x,5);const v=new DataView(y.buffer,y.byteOffset,y.byteLength);return v.setUint8(0,b),v.setUint32(1,x.length),y}(0,u(p.value))}return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await function(g){const p=I1(g.next,g.interceptors),[b,x,y]=B1(g),v=Object.assign(Object.assign({},g.req),{message:mj(g.req.method.I,g.req.message),signal:b});let S=!1;return b.addEventListener("abort",function(){var k,N;const E=g.req.message[Symbol.asyncIterator]();S||(k=E.throw)===null||k===void 0||k.call(E,this.reason).catch(()=>{}),(N=E.return)===null||N===void 0||N.call(E).catch(()=>{})}),p(v).then(k=>Object.assign(Object.assign({},k),{message:{[Symbol.asyncIterator](){const N=k.message[Symbol.asyncIterator]();return{next:()=>N.next().then(E=>(E.done==1&&(S=!0,y()),E),x)}}}}),x)}({interceptors:t.interceptors,timeoutMs:s,signal:i,req:{stream:!0,service:o,method:r,url:j1(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:F1(r.kind,n,s,a),contextValues:c??N1(),message:l},next:async g=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,x=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await _(g.message)}));if(z1(r.kind,x.status,x.headers),x.body===null)throw"missing response body";const y=new Headers;return Object.assign(Object.assign({},g),{header:x.headers,trailer:y,message:m(x.body,y,x.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),Sj=function(t,e){return function(n,o){const r={};for(const[i,s]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},s),{localName:i,service:n}));a!=null&&(r[i]=a)}return r}(t,n=>{switch(n.kind){case In.Unary:return function(o,r,i){return async function(s,a){var l,c;const d=await o.unary(r,i,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,s,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,d.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,d.trailer),d.message}}(e,t,n);case In.ServerStreaming:return function(o,r,i){return function(s,a){return S1(o.stream(r,i,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return dj(this,arguments,function*(){yield hs(yield*uj(cj(l)))})}([s]),a==null?void 0:a.contextValues),a)}}(e,t,n);case In.ClientStreaming:return function(o,r,i){return async function(s,a){var l,c,d,u,f,m;const _=await o.stream(r,i,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,s,a==null?void 0:a.contextValues);let g;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,_.header);try{for(var p,b=!0,x=k1(_.message);!(l=(p=await x.next()).done);b=!0)u=p.value,b=!1,g=u}catch(y){c={error:y}}finally{try{b||l||!(d=x.return)||await d.call(x)}finally{if(c)throw c.error}}if(!g)throw new Jt("protocol error: missing response message",_t.Internal);return(m=a==null?void 0:a.onTrailer)===null||m===void 0||m.call(a,_.trailer),g}}(e,t,n);case In.BiDiStreaming:return function(o,r,i){return function(s,a){return S1(o.stream(r,i,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,s,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}(wj,kj);let tl;try{tl=crypto.randomUUID()}catch{tl="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function Cj(t,e){const n=t.state.facet(Xa),{override:o}=t.state.facet(v1),r=await o(),i=t.state,s=i.selection.main.head,a=i.doc.toString();try{const l=await async function({text:_,cursorOffset:g,config:p,otherDocuments:b}){return await Sj.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:tl,authSource:p.authSource},document:{text:_,cursorOffset:BigInt(g),language:p.language,editorLanguage:"typescript",lineEnding:`
93
- `},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${tl}`}})}({text:a,cursorOffset:s,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&s!==e||ra(t.state)==="active"||!t.hasFocus)return;const c=l.completionItems.map(_=>{let g=0;return _.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),x=p.type===2?`
94
- ${p.text}`:p.text,y={absoluteStartPos:g+b,absoluteEndPos:g+b+x.length,from:b,to:b,insert:x};return g+=x.length,y})}),d=0,u=c.at(d);if(!u)return;const f=ia.of(u,i.doc.length),m=f.invert(i.doc);t.dispatch({changes:f,effects:_d.of({index:d,reverseChangeSet:m,changeSpecs:c}),annotations:[Za.of(null),$r.of(null),sa.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function Nj(){let t=null,e=0;return st.updateListener.of(n=>{const o=n.view.state.facet(Xa);if(!o.alwaysOn||!function(i){return i.docChanged&&!i.transactions.some(s=>s.effects.some(a=>a.is(bd)||a.is(yd)))}(n)||(t&&clearTimeout(t),function(i){if(!i.view.hasFocus||i.state.field(gr)||ra(i.state)==="active")return!0;for(const s of i.transactions)if(s.annotation($r)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new cz(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await Cj(n.view,e)},o.timeout),e=r)})}function U1(t){var r;const e=t.state.field(gr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:bd.of(null),annotations:[Za.of(null),$r.of(null),sa.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((i,s,a,l)=>{o=l}),t.dispatch({changes:n,selection:Ir.cursor(o),annotations:[$r.of(null),sa.addToHistory.of(!0)]}),!0}const V1=t=>{const{state:e}=t,n=e.field(gr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,i=o.at(r);if(!i)return!1;const s=n.reverseChangeSet.apply(e.doc),a=ia.of(n.reverseChangeSet,e.doc.length).compose(ia.of(i,s.length)),l=ia.of(i,s.length).invert(s);return t.dispatch({changes:a,effects:_d.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Za.of(null),$r.of(null),sa.addToHistory.of(!1)]}),!0};function Hd(t){const e=t.state.field(gr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:yd.of(null),annotations:[Za.of(null),$r.of(null),sa.addToHistory.of(!1)]}),!1)}function jj(){return st.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(gr)&&(o==="Tab"?U1(n):Hd(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(V1(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const i=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,s=o.state.field(gr);return!(i===void 0||!s)&&((l=s.decorations)==null||l.between(i,i,()=>{r=!0}),r)}(e)?U1(e):Hd(e)}})}const Ej=new xm,$1={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},Ij=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Xa.of(n),gr,sr.highest(Kn.of([{key:"Ctrl-]",run:V1}])),sr.highest(st.updateListener.of(o=>{o.focusChanged&&Hd(o.view)})),sr.high(jj()),Nj()]}({apiKey:t.codeium_api_key,language:Ho.PYTHON}),v1.of({override:async()=>[{text:bc(""),language:Ho.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push($g({...$1,fetchFn:async n=>{if(!PV()||n.doc.length===0)return"";await new Promise(s=>setTimeout(s,20));const o=n.doc.toString(),r=function(s,a){const l=s.doc.toString(),c=a.split(`
95
- `).length-l.split(`
96
- `).length,d=function(u,f){const m=u.lineAt(f);return{line:m.number-1,character:f-m.from}}(s.doc,s.selection.main.head);return d.line+=c,{doc:{source:a,tabSize:s.tabSize,indentSize:1,insertSpaces:!0,path:qm,version:"replace_me",uri:`file://${qm}`,relativePath:qm,languageId:LV,position:d}}}(n,bc(o)),i=function(s,a,l){if(s.completions.length===0)return"";const{displayText:c,position:d}=s.completions[0],u=d.character-a.character,f=u<0?c.slice(-u):c,m=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let _=0;_<f.length;_++){const g=f.slice(_);if(m.startsWith(g))return f.slice(0,_)}return f}(await W4().getCompletion(r),r.doc.position,n);return i&&mt.debug("Copilot suggestion:",i),i}})),t.copilot==="custom"&&e.push($g({...$1,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const i=n.field(yc).type;let s=await xc.post("/ai/inline_completion",{prefix:o,suffix:r,language:i});return o&&s.startsWith(o)&&(s=s.slice(o.length)),r&&s.endsWith(r)&&(s=s.slice(0,-r.length)),s}})),[...e,Ej.of(RV())]},Aj=dt.mark({class:"underline"}),H1=Gt.define(),W1=Gt.define(),Tj=Un.define({create:()=>dt.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(H1)?n=t.update({add:[Aj.range(o.value.from,o.value.to)]}):o.is(W1)&&(n=dt.none);return n},provide:t=>st.decorations.from(t)});class Mj{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const i=dz(this.view.state).cursorAt(r);if(i.name==="VariableName"){const{from:s,to:a}=i;if(this.hoveredRange&&this.hoveredRange.from===s&&this.hoveredRange.to===a)return;this.clearUnderline(),this.hoveredRange={from:s,to:a,position:r},this.view.dispatch({effects:H1.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:W1.of(null)}),this.hoveredRange=null)}}const Ht=({variant:t,settings:e,styles:n})=>{const o=st.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=hz.define(n);return[o,t4(r)]};Ht({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:D.comment,color:"#404080"},{tag:[D.string,D.regexp],color:"#999999"},{tag:D.number,color:"#7090B0"},{tag:[D.bool,D.null],color:"#8080A0"},{tag:[D.punctuation,D.derefOperator],color:"#805080"},{tag:D.keyword,color:"#60B0FF"},{tag:D.definitionKeyword,color:"#B0FFF0"},{tag:D.moduleKeyword,color:"#60B0FF"},{tag:D.operator,color:"#A0A0FF"},{tag:[D.variableName,D.self],color:"#008080"},{tag:D.operatorKeyword,color:"#A0A0FF"},{tag:D.controlKeyword,color:"#80A0FF"},{tag:D.className,color:"#70E080"},{tag:[D.function(D.propertyName),D.propertyName],color:"#50A0A0"},{tag:D.tagName,color:"#009090"},{tag:D.modifier,color:"#B0FFF0"},{tag:[D.squareBracket,D.attributeName],color:"#D0D0FF"}]}),Ht({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:D.comment,color:"#787b8099"},{tag:D.string,color:"#86b300"},{tag:D.regexp,color:"#4cbf99"},{tag:[D.number,D.bool,D.null],color:"#ffaa33"},{tag:D.variableName,color:"#5c6166"},{tag:[D.definitionKeyword,D.modifier],color:"#fa8d3e"},{tag:[D.keyword,D.special(D.brace)],color:"#fa8d3e"},{tag:D.operator,color:"#ed9366"},{tag:D.separator,color:"#5c6166b3"},{tag:D.punctuation,color:"#5c6166"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#f2ae49"},{tag:[D.className,D.definition(D.typeName)],color:"#22a4e6"},{tag:[D.tagName,D.typeName,D.self,D.labelName],color:"#55b4d4"},{tag:D.angleBracket,color:"#55b4d480"},{tag:D.attributeName,color:"#f2ae49"}]}),Ht({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:D.comment,color:"#6E6E6E"},{tag:[D.string,D.regexp,D.special(D.brace)],color:"#5C81B3"},{tag:D.number,color:"#C1E1B8"},{tag:D.bool,color:"#53667D"},{tag:[D.definitionKeyword,D.modifier,D.function(D.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[D.keyword,D.moduleKeyword,D.operatorKeyword,D.operator],color:"#697A8E",fontWeight:"bold"},{tag:[D.variableName,D.attributeName],color:"#708E67"},{tag:[D.function(D.variableName),D.definition(D.propertyName),D.derefOperator],color:"#fff"},{tag:D.tagName,color:"#A3D295"}]}),Ht({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:D.comment,color:"#666666"},{tag:[D.string,D.special(D.brace)],color:"#54BE0D"},{tag:D.regexp,color:"#E9C062"},{tag:D.number,color:"#CF6A4C"},{tag:[D.keyword,D.operator],color:"#5EA6EA"},{tag:D.variableName,color:"#7587A6"},{tag:[D.definitionKeyword,D.modifier],color:"#F9EE98"},{tag:[D.propertyName,D.function(D.variableName)],color:"#937121"},{tag:[D.typeName,D.angleBracket,D.tagName],color:"#9B859D"}]}),Ht({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:D.comment,color:"#6B4E32"},{tag:[D.keyword,D.operator,D.derefOperator],color:"#EF5D32"},{tag:D.className,color:"#EFAC32",fontWeight:"bold"},{tag:[D.typeName,D.propertyName,D.function(D.variableName),D.definition(D.variableName)],color:"#EFAC32"},{tag:D.definition(D.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:D.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[D.number,D.bool],color:"#6C99BB"},{tag:[D.variableName,D.self],color:"#7DAF9C"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#D9D762"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#EFCB43"}]}),Ht({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:D.comment,color:"#404040"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#00D8FF"},{tag:D.number,color:"#E62286"},{tag:[D.variableName,D.attributeName,D.self],color:"#E62286",fontWeight:"bold"},{tag:D.function(D.variableName),color:"#fff",fontWeight:"bold"}]}),Ht({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:D.comment,color:"#BCC8BA"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#5D90CD"},{tag:[D.number,D.bool,D.null],color:"#46A609"},{tag:D.keyword,color:"#AF956F"},{tag:[D.definitionKeyword,D.modifier],color:"#C52727"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#606060"},{tag:D.self,color:"#000"}]}),Ht({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:D.comment,color:"#0088FF"},{tag:D.string,color:"#3AD900"},{tag:D.regexp,color:"#80FFC2"},{tag:[D.number,D.bool,D.null],color:"#FF628C"},{tag:[D.definitionKeyword,D.modifier],color:"#FFEE80"},{tag:D.variableName,color:"#CCCCCC"},{tag:D.self,color:"#FF80E1"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.definition(D.typeName),D.labelName],color:"#FFDD00"},{tag:[D.keyword,D.operator],color:"#FF9D00"},{tag:[D.propertyName,D.typeName],color:"#80FFBB"},{tag:D.special(D.brace),color:"#EDEF7D"},{tag:D.attributeName,color:"#9EFFFF"},{tag:D.derefOperator,color:"#fff"}]}),Ht({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:D.comment,color:"#AEAEAE"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#8DFF8E"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.function(D.definition(D.variableName)),D.definition(D.typeName)],color:"#A3EBFF"},{tag:[D.number,D.bool,D.null],color:"#62E9BD"},{tag:[D.keyword,D.operator],color:"#2BF1DC"},{tag:[D.definitionKeyword,D.modifier],color:"#F8FBB1"},{tag:[D.variableName,D.self],color:"#B683CA"},{tag:[D.angleBracket,D.tagName,D.typeName,D.propertyName],color:"#60A4F1"},{tag:D.derefOperator,color:"#E0E0E0"},{tag:D.attributeName,color:"#7BACCA"}]}),Ht({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:D.comment,color:"#6272a4"},{tag:[D.string,D.special(D.brace)],color:"#f1fa8c"},{tag:[D.number,D.self,D.bool,D.null],color:"#bd93f9"},{tag:[D.keyword,D.operator],color:"#ff79c6"},{tag:[D.definitionKeyword,D.typeName],color:"#8be9fd"},{tag:D.definition(D.typeName),color:"#f8f8f2"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.attributeName],color:"#50fa7b"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:D.comment,color:"#AAAAAA"},{tag:[D.keyword,D.operator,D.typeName,D.tagName,D.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[D.attributeName,D.definition(D.propertyName)],color:"#4F9FD0"},{tag:[D.className,D.string,D.special(D.brace)],color:"#CF4F5F"},{tag:D.number,color:"#CF4F5F",fontWeight:"bold"},{tag:D.variableName,fontWeight:"bold"}]}),Ht({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:D.comment,color:"#9995b7"},{tag:D.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#ff5792"},{tag:[D.className,D.tagName,D.definition(D.typeName)],color:"#0094f0"},{tag:[D.number,D.bool,D.null,D.special(D.brace)],color:"#5842ff"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#0095a8"},{tag:D.typeName,color:"#b3694d"},{tag:[D.propertyName,D.variableName],color:"#fa8900"},{tag:D.operator,color:"#ff5792"},{tag:D.self,color:"#e64100"},{tag:[D.string,D.regexp],color:"#00b368"},{tag:[D.paren,D.bracket],color:"#0431fa"},{tag:D.labelName,color:"#00bdd6"},{tag:D.attributeName,color:"#e64100"},{tag:D.angleBracket,color:"#9995b7"}]}),Ht({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:D.comment,color:"#9893a5"},{tag:[D.bool,D.null],color:"#286983"},{tag:D.number,color:"#d7827e"},{tag:D.className,color:"#d7827e"},{tag:[D.angleBracket,D.tagName,D.typeName],color:"#56949f"},{tag:D.attributeName,color:"#907aa9"},{tag:D.punctuation,color:"#797593"},{tag:[D.keyword,D.modifier],color:"#286983"},{tag:[D.string,D.regexp],color:"#ea9d34"},{tag:D.variableName,color:"#d7827e"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:D.comment,color:"#CFCFCF"},{tag:[D.number,D.bool,D.null],color:"#E66C29"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.labelName,D.definition(D.typeName)],color:"#2EB43B"},{tag:D.keyword,color:"#D8B229"},{tag:D.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#925A47"},{tag:D.string,color:"#704D3D"},{tag:D.typeName,color:"#2F8996"},{tag:[D.variableName,D.propertyName],color:"#77ACB0"},{tag:D.self,color:"#77ACB0",fontWeight:"bold"},{tag:D.regexp,color:"#E3965E"},{tag:[D.tagName,D.angleBracket],color:"#BAA827"},{tag:D.attributeName,color:"#B06520"},{tag:D.derefOperator,color:"#000"}]}),Ht({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:D.comment,color:"#93A1A1"},{tag:D.string,color:"#2AA198"},{tag:D.regexp,color:"#D30102"},{tag:D.number,color:"#D33682"},{tag:D.variableName,color:"#268BD2"},{tag:[D.keyword,D.operator,D.punctuation],color:"#859900"},{tag:[D.definitionKeyword,D.modifier],color:"#073642",fontWeight:"bold"},{tag:[D.className,D.self,D.definition(D.propertyName)],color:"#268BD2"},{tag:D.function(D.variableName),color:"#268BD2"},{tag:[D.bool,D.null],color:"#B58900"},{tag:D.tagName,color:"#268BD2",fontWeight:"bold"},{tag:D.angleBracket,color:"#93A1A1"},{tag:D.attributeName,color:"#93A1A1"},{tag:D.typeName,color:"#859900"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:D.comment,color:"#8E908C"},{tag:[D.variableName,D.self,D.propertyName,D.attributeName,D.regexp],color:"#C82829"},{tag:[D.number,D.bool,D.null],color:"#F5871F"},{tag:[D.className,D.typeName,D.definition(D.typeName)],color:"#C99E00"},{tag:[D.string,D.special(D.brace)],color:"#718C00"},{tag:D.operator,color:"#3E999F"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#4271AE"},{tag:D.keyword,color:"#8959A8"},{tag:D.derefOperator,color:"#4D4D4C"}]});const Oj=Ht({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#708090"},{tag:D.variableName,color:"#000000"},{tag:[D.string,D.special(D.brace)],color:"#a11"},{tag:D.number,color:"#164"},{tag:D.bool,color:"#219"},{tag:D.null,color:"#219"},{tag:D.keyword,color:"#708",fontWeight:500},{tag:D.className,color:"#00f"},{tag:D.definition(D.typeName),color:"#00f"},{tag:D.typeName,color:"#085"},{tag:D.angleBracket,color:"#000000"},{tag:D.tagName,color:"#170"},{tag:D.attributeName,color:"#00c"},{tag:D.operator,color:"#a2f",fontWeight:500},{tag:[D.function(D.variableName)],color:"#00c"},{tag:[D.propertyName],color:"#05a"}]}),Dj=Ht({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#5c6370"},{tag:D.variableName,color:"#abb2bf"},{tag:[D.string,D.special(D.brace)],color:"#98c379"},{tag:D.number,color:"#d19a66"},{tag:D.bool,color:"#d19a66"},{tag:D.null,color:"#d19a66"},{tag:D.keyword,color:"#c678dd",fontWeight:500},{tag:D.className,color:"#61afef"},{tag:D.definition(D.typeName),color:"#61afef"},{tag:D.typeName,color:"#56b6c2"},{tag:D.angleBracket,color:"#abb2bf"},{tag:D.tagName,color:"#e06c75"},{tag:D.attributeName,color:"#d19a66"},{tag:D.operator,color:"#56b6c2",fontWeight:500},{tag:[D.function(D.variableName)],color:"#61afef"},{tag:[D.propertyName],color:"#e5c07b"}]}),q1="packages-install-input",Rj=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Wd;function Pj(){const t=async r=>{const i=ut.get(n4),s={...i,runtime:{...i.runtime,auto_reload:r}};await Oi({config:s}).then(()=>ut.set(n4,s))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(q1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{ut.set(wm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{ut.set(wm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{ut.set(wm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:h.jsx(h.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:h.jsxs(h.Fragment,{children:["Shell commands are not directly supported.",h.jsx("br",{}),"Use ",h.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...Rj.map(r=>({match:r,onMatch:()=>{},title:h.jsx(vm,{className:"inline",children:r}),description:h.jsxs(h.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",h.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return st.updateListener.of(r=>{if(r.docChanged){const i=r.state.selection.main,s=r.state.doc,a=s.lineAt(i.head),l=s.sliceString(a.from,i.anchor).trim(),c=o.get(l);c&&(c.onMatch(),Wd?Wd.upsert({title:c.title,description:c.description}):Wd=lt({title:c.title,description:c.description}))}})}function Lj(){return[st.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(i){if(!i.includes("@app.cell"))return[];const s=[],a=i.split(`
97
- `);let l=[],c=!1,d=0,u=!1,f=!1,m=0;const _=/\(/g,g=/\)/g,p=new Set(["@"]);function b(y){return(y.match(_)||[]).length-(y.match(g)||[]).length}function x(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(y=>y.trim()!=="")&&s.push(function(y){const v=y.split(`
98
- `);if(v.length===0)return"";const S=v.filter(E=>E.trim().length>0);if(S.length===0)return"";const k=/^\s*/,N=Math.min(...S.map(E=>{var I;return((I=E.match(k))==null?void 0:I[0].length)??Number.POSITIVE_INFINITY}));return N===0?y.trim():v.map(E=>E.slice(N)).join(`
99
- `).trim()}(l.join(`
100
- `))),l=[]}}for(const y of a){const v=y.trim();(v||c)&&(v.startsWith("@app.cell")?(x(),c=!0,d=1):d>0?(v.startsWith("def")&&v.includes("(")&&!v.includes("):")&&(u=!0,m=b(v)),d--):u?(m+=b(v),m===0&&(u=!1)):c&&(p.has(v[0])||v.startsWith("if __name__")?(x(),c=v.startsWith("@")):v.startsWith("return")?v.includes("(")&&!v.endsWith(")")&&(f=!0,m=b(v)):f?(m+=b(v),m===0&&(f=!1)):l.push(y)))}return x(),s}(n);return o.length===0?!1:(e.state.facet(pz).createManyBelow(o),!0)}})]}function Fj(){const t=o4.filter(e=>e.key!=="Escape");return sr.highest(Kn.of([...t,{key:"Escape",run:e=>(Qf(e),!1)}]))}function G1(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const zj=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:i,completionConfig:s,lspConfig:a,diagnosticsConfig:l}=t,c=G1(t);return[FV(n,o),[st.domEventHandlers({drop:(u,f)=>{var g,p;const m=(g=u.dataTransfer)==null?void 0:g.files[0];if(m!=null&&m.type.startsWith("text/"))return u.preventDefault(),fz(f,m),!0;if(m!=null&&m.type.startsWith("image/"))return u.preventDefault(),mz(f,m),!0;const _=(p=u.dataTransfer)==null?void 0:p.getData("text/plain");if(_){u.preventDefault();const b=f.posAtCoords({x:u.clientX,y:u.clientY});return b!==null&&f.dispatch({changes:{from:b,to:b,insert:_},scrollIntoView:!0}),!0}return!1},dragover:u=>{u.preventDefault()}})],Lj(),Pj(),gz(s,o,c,a,l),_z(e,o,i),Bj(t),[Tj,(d=(u,f)=>{uz(u,f)},Lo.define(u=>new Mj(u,d))),st.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?bz():[],r&&Ei("inline_ai_tooltip")?NN({prompt:u=>async function(f){var x,y;const m=`
101
- ${f.codeBefore}
102
- <rewrite_this>
103
- ${f.selection}
104
- </rewrite_this>
105
- ${f.codeAfter}
106
- `.trim(),_=await fetch(km("api/ai/completion").toString(),{method:"POST",headers:xc.headers(),body:JSON.stringify({prompt:f.prompt,code:m,selectedText:f.selection,includeOtherCode:"",language:f.language})}),g=((x=f.selection.match(/^\s*/))==null?void 0:x[0])||"",p=(y=_.body)==null?void 0:y.getReader();if(!p)throw new Error("Failed to get response reader");let b="";for(;;){const{done:v,value:S}=await p.read();if(v)break;b+=new TextDecoder().decode(S)}return b.startsWith(g)||(b=g+b),b}({prompt:u.prompt,selection:u.selection,codeBefore:u.codeBefore,codeAfter:u.codeAfter,language:v3(u.editorView)})}):[]];var d},Bj=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:i,diagnosticsConfig:s}=t,a=G1(t);return[st.lineWrapping,yz(),xz(),wz(),vz(),kz(),Sz(),Cz(),Nz({position:"fixed",parent:document.querySelector("#App")??void 0}),jz(),e==="dark"?Dj:Oj,Ez(i),Ij(o),Iz(),Az(),Fj(),sr.high(Kn.of(Pz)),Tz(),Mz(),Oz.of(" "),t4(Lz,{fallback:!0}),Kn.of(Fz),Dz({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...i,diagnostics:s}}),Rz.of(zz()),aa.allowMultipleSelections.of(!0),pN(n),Kn.of([{key:"Tab",run:l=>Bz(l)||(c=>{const{from:d,to:u}=c.state.selection.main;if(d!==u)return!1;const f=c.state.doc.lineAt(u);return f.text.slice(0,u-f.from).trim()!==""&&Hz(c)})(l)||Uz(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ra(l.state)!==null&&(r4(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ra(l.state)!==null&&(r4(!1)(l),!0),preventDefault:!0}]),Kn.of([...Vz,$z])]};function Y1(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}var qd="ContextMenu",[Uj,b$]=s4(qd,[i4]),an=i4(),[Vj,J1]=Uj(qd),K1=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:i=!0}=t,[s,a]=A.useState(!1),l=an(e),c=ar(o),d=A.useCallback(u=>{a(u),c(u)},[c]);return h.jsx(Vj,{scope:e,open:s,onOpenChange:d,modal:i,children:h.jsx(rB,{...l,dir:r,open:s,onOpenChange:d,modal:i,children:n})})};K1.displayName=qd;var X1="ContextMenuTrigger",Z1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,i=J1(X1,n),s=an(n),a=A.useRef({x:0,y:0}),l=A.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=A.useRef(0),d=A.useCallback(()=>window.clearTimeout(c.current),[]),u=f=>{a.current={x:f.clientX,y:f.clientY},i.onOpenChange(!0)};return A.useEffect(()=>d,[d]),A.useEffect(()=>{o&&d()},[o,d]),h.jsxs(h.Fragment,{children:[h.jsx(Gz,{...s,virtualRef:l}),h.jsx($i.span,{"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Vn(t.onContextMenu,f=>{d(),u(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Vn(t.onPointerDown,nl(f=>{d(),c.current=window.setTimeout(()=>u(f),700)})),onPointerMove:o?t.onPointerMove:Vn(t.onPointerMove,nl(d)),onPointerCancel:o?t.onPointerCancel:Vn(t.onPointerCancel,nl(d)),onPointerUp:o?t.onPointerUp:Vn(t.onPointerUp,nl(d))})]})});Z1.displayName=X1;var Q1=t=>{const{__scopeContextMenu:e,...n}=t,o=an(e);return h.jsx(iB,{...o,...n})};Q1.displayName="ContextMenuPortal";var e_="ContextMenuContent",t_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=J1(e_,n),i=an(n),s=A.useRef(!1);return h.jsx(Yz,{...i,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&s.current&&a.preventDefault(),s.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(s.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});t_.displayName=e_,A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Jz,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var n_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Kz,{...r,...o,ref:e})});n_.displayName="ContextMenuLabel";var o_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(qz,{...r,...o,ref:e})});o_.displayName="ContextMenuItem";var r_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Xz,{...r,...o,ref:e})});r_.displayName="ContextMenuCheckboxItem",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Zz,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var i_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Qz,{...r,...o,ref:e})});i_.displayName="ContextMenuRadioItem";var s_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(eB,{...r,...o,ref:e})});s_.displayName="ContextMenuItemIndicator";var a_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(Wz,{...r,...o,ref:e})});a_.displayName="ContextMenuSeparator",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(tB,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var l_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(nB,{...r,...o,ref:e})});l_.displayName="ContextMenuSubTrigger";var c_=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=an(n);return h.jsx(oB,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function nl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}c_.displayName="ContextMenuSubContent";var d_=t_,u_=n_,h_=o_,f_=r_,m_=i_,p_=s_,g_=a_,__=l_,b_=c_;const y_=K1,x_=Z1,$j=lB(Q1);A.forwardRef((t,e)=>{const n=X.c(14);let o,r,i,s,a,l,c;return n[0]!==t?({className:r,inset:i,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i,n[4]=s):(o=n[1],r=n[2],i=n[3],s=n[4]),n[5]!==r||n[6]!==i?(a=cB({className:r,inset:i}),n[5]=r,n[6]=i,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(hB,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==s||n[11]!==e||n[12]!==a?(c=h.jsxs(__,{ref:e,className:a,...s,children:[o,l]}),n[9]=o,n[10]=s,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=__.displayName;const w_="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";A.forwardRef((t,e)=>{const n=X.c(9);let o,r,i,s;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(i=Te(a4({subcontent:!0}),w_,o),n[3]=o,n[4]=i):i=n[4],n[5]!==r||n[6]!==e||n[7]!==i?(s=h.jsx(b_,{ref:e,className:i,...r}),n[5]=r,n[6]=e,n[7]=i,n[8]=s):s=n[8],s}).displayName=b_.displayName;const Gd=A.forwardRef((t,e)=>{const n=X.c(15);let o,r,i;n[0]!==t?({className:o,scrollable:i,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]);const s=i===void 0||i;let a;n[4]!==o||n[5]!==s?(a=Te(a4(),w_,s&&"overflow-auto",o),n[4]=o,n[5]=s,n[6]=a):a=n[6];const l=s?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=h.jsx($j,{children:h.jsx(dB,{children:h.jsx(d_,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});Gd.displayName=d_.displayName;const _s=A.forwardRef((t,e)=>{const n=X.c(13);let o,r,i,s,a,l;return n[0]!==t?({className:o,inset:r,variant:s,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i,n[4]=s):(o=n[1],r=n[2],i=n[3],s=n[4]),n[5]!==o||n[6]!==r||n[7]!==s?(a=aB({className:o,inset:r,variant:s}),n[5]=o,n[6]=r,n[7]=s,n[8]=a):a=n[8],n[9]!==i||n[10]!==e||n[11]!==a?(l=h.jsx(h_,{ref:e,className:a,...i}),n[9]=i,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});_s.displayName=h_.displayName,A.forwardRef((t,e)=>{const n=X.c(15);let o,r,i,s,a,l,c,d;return n[0]!==t?({className:i,children:r,checked:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i,n[4]=s):(o=n[1],r=n[2],i=n[3],s=n[4]),n[5]!==i?(a=wc({className:i}),n[5]=i,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=wc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("span",{className:l,children:h.jsx(p_,{children:h.jsx(fB,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==s||n[12]!==e||n[13]!==a?(d=h.jsxs(f_,{ref:e,className:a,checked:o,...s,children:[c,r]}),n[9]=o,n[10]=r,n[11]=s,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=f_.displayName,A.forwardRef((t,e)=>{const n=X.c(13);let o,r,i,s,a,l,c;return n[0]!==t?({className:r,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]),n[4]!==r?(s=wc({className:r}),n[4]=r,n[5]=s):s=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=wc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{className:a,children:h.jsx(p_,{children:h.jsx(mB,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==i||n[10]!==e||n[11]!==s?(c=h.jsxs(m_,{ref:e,className:s,...i,children:[l,o]}),n[8]=o,n[9]=i,n[10]=e,n[11]=s,n[12]=c):c=n[12],c}).displayName=m_.displayName,A.forwardRef((t,e)=>{const n=X.c(11);let o,r,i,s,a;return n[0]!==t?({className:o,inset:r,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]),n[4]!==o||n[5]!==r?(s=uB({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=s):s=n[6],n[7]!==i||n[8]!==e||n[9]!==s?(a=h.jsx(u_,{ref:e,className:s,...i}),n[7]=i,n[8]=e,n[9]=s,n[10]=a):a=n[10],a}).displayName=u_.displayName;const v_=A.forwardRef((t,e)=>{const n=X.c(9);let o,r,i,s;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(i=Te(sB({className:o})),n[3]=o,n[4]=i):i=n[4],n[5]!==r||n[6]!==e||n[7]!==i?(s=h.jsx(g_,{ref:e,className:i,...r}),n[5]=r,n[6]=e,n[7]=i,n[8]=s):s=n[8],s});v_.displayName=g_.displayName;const k_=t=>{const e=X.c(14),{appClosed:n,onClick:o,tooltipContent:r}=t;let i;e[0]!==o?(i=()=>o==null?void 0:o({code:""}),e[0]=o,e[1]=i):i=e[1];const s=n&&" inactive-button";let a,l,c,d,u;return e[2]!==s?(a=Te("shoulder-button hover-action",s),e[2]=s,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Ar,{strokeWidth:1.8}),e[4]=l):l=e[4],e[5]!==i||e[6]!==a?(c=h.jsx(xn,{onClick:i,className:a,onMouseDown:un.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),e[5]=i,e[6]=a,e[7]=c):c=e[7],e[8]!==c||e[9]!==r?(d=h.jsx(Me,{content:r,usePortal:!1,children:c}),e[8]=c,e[9]=r,e[10]=d):d=e[10],e[11]!==o||e[12]!==d?(u=h.jsx(Hj,{onClick:o,children:d}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u},Hj=t=>{const e=X.c(24),{children:n,onClick:o}=t;if(!o)return n;let r,i,s,a,l,c,d,u,f,m,_,g;return e[0]!==n?(r=h.jsx(x_,{children:n}),e[0]=n,e[1]=r):r=e[1],e[2]!==o?(i=p=>{p.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(Fc,{})}),e[4]=s):s=e[4],e[5]!==i?(a=h.jsxs(_s,{onSelect:i,children:[s,"Python cell"]},"python"),e[5]=i,e[6]=a):a=e[6],e[7]!==o?(l=p=>{p.stopPropagation(),o({code:new ta().defaultCode})},e[7]=o,e[8]=l):l=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(Lc,{})}),e[9]=c):c=e[9],e[10]!==l?(d=h.jsxs(_s,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),e[10]=l,e[11]=d):d=e[11],e[12]!==o?(u=p=>{p.stopPropagation(),o({code:new vc().getDefaultCode()})},e[12]=o,e[13]=u):u=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(or,{size:13,strokeWidth:1.5})}),e[14]=f):f=e[14],e[15]!==u?(m=h.jsxs(_s,{onSelect:u,children:[f,"SQL cell"]},"sql"),e[15]=u,e[16]=m):m=e[16],e[17]!==a||e[18]!==d||e[19]!==m?(_=h.jsxs(Gd,{children:[a,d,m]}),e[17]=a,e[18]=d,e[19]=m,e[20]=_):_=e[20],e[21]!==r||e[22]!==_?(g=h.jsxs(y_,{children:[r,_]}),e[21]=r,e[22]=_,e[23]=g):g=e[23],g},Wj=pB("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"}}),bs=t=>{const e=X.c(21);let n,o,r,i,s;e[0]!==t?({children:n,tooltip:i,disabled:r,variant:s,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(n=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const a=r!==void 0&&r;let l,c,d;e[6]!==a||e[7]!==o?(l=f=>{var m;a||((m=o.onClick)==null||m.call(o,f))},e[6]=a,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==s?(c=Te(Wj({variant:s}),o.className),e[9]=o.className,e[10]=s,e[11]=c):c=e[11],e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==l||e[16]!==c?(d=h.jsx("button",{disabled:a,...o,onClick:l,onMouseDown:un.preventFocus,className:c,children:n}),e[12]=n,e[13]=a,e[14]=o,e[15]=l,e[16]=c,e[17]=d):d=e[17];const u=d;if(i){let f;return e[18]!==u||e[19]!==i?(f=h.jsx(Me,{content:i,side:"top",delayDuration:200,usePortal:!1,children:u}),e[18]=u,e[19]=i,e[20]=f):f=e[20],f}return u},qj=t=>{const e=X.c(5),{children:n,className:o}=t;let r,i;return e[0]!==o?(r=Te("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(i=h.jsx(lS,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i},Gj=t=>{const e=X.c(22),{onClick:n,appClosed:o,needsRun:r,status:i,config:s,edited:a}=t,l=i==="disabled-transitively",c=i==="running"||i==="queued",d=o||c||!s.disabled&&l&&!a;let u;e[0]!==o||e[1]!==d||e[2]!==c||e[3]!==r?(u=function(p,b,x,y){return p?"disabled":b&&!x?"stale":x||y?"disabled":"green"}(o,r,c,d),e[0]=o,e[1]=d,e[2]=c,e[3]=r,e[4]=u):u=e[4];const f=u;if(s.disabled){let p,b;return e[5]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(_p,{}),e[5]=p):p=e[5],e[6]!==d||e[7]!==n||e[8]!==f?(b=h.jsx(bs,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[6]=d,e[7]=n,e[8]=f,e[9]=b):b=e[9],b}if(!s.disabled&&l&&!a){let p,b;return e[10]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Ki,{strokeWidth:1.2}),e[10]=p):p=e[10],e[11]!==d||e[12]!==n||e[13]!==f?(b=h.jsx(bs,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[11]=d,e[12]=n,e[13]=f,e[14]=b):b=e[14],b}let m,_,g;if(o)m="App disconnected";else if(i==="queued")m="This cell is already queued to run";else if(i==="running")m="This cell is already running.";else{let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p=hn("cell.run"),e[15]=p):p=e[15],m=p}return e[16]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Ki,{strokeWidth:1.2}),e[16]=_):_=e[16],e[17]!==d||e[18]!==n||e[19]!==m||e[20]!==f?(g=h.jsx(bs,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[17]=d,e[18]=n,e[19]=m,e[20]=f,e[21]=g):g=e[21],g},S_=t=>{const e=X.c(10),{status:n,appClosed:o,onClick:r}=t;let i;i=o?"App disconnected":n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";const s=i,a=(o||n==="running"||n==="queued")&&"inactive-button";let l,c,d,u,f;return e[0]!==a?(l=Te("hover:bg-transparent text-destructive/60 hover:text-destructive",a),e[0]=a,e[1]=l):l=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=h.jsx(rm,{size:14}),e[2]=c,e[3]=d):(c=e[2],d=e[3]),e[4]!==r||e[5]!==l?(u=h.jsx(De,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:un.preventFocus,className:l,style:c,children:d}),e[4]=r,e[5]=l,e[6]=u):u=e[6],e[7]!==u||e[8]!==i?(f=h.jsx(Me,{content:s,usePortal:!1,children:u}),e[7]=u,e[8]=i,e[9]=f):f=e[9],f};let C_,N_,j_,E_;C_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),N_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),j_=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:i,edited:s,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=t;if(!n)return null;const f=c??d;let m;e[0]!==f?(m=f?h.jsx(E_,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const _=m;if(r&&o==="running")return mt.error("CellStatusComponent: disabled and running"),null;if(r&&i){let g,p,b,x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(es,{children:[h.jsx(Xi,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(kc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(x=h.jsx(Me,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=x):x=e[7],x}if(r){let g,p,b,x;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:h.jsx(Xi,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(x=h.jsx(Me,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=x):x=e[13],x}if(!i&&o==="disabled-transitively"){let g,p,b,x;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:h.jsxs(es,{layerTop:!0,children:[h.jsx(Ca,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(Xi,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(x=h.jsx(Me,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=x):x=e[19],x}if(i&&o==="disabled-transitively"){let g,p,b,x;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(es,{children:[h.jsx(kc,{className:"h-5 w-5",strokeWidth:1}),h.jsx(Xi,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(x=h.jsx(Me,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=x):x=e[25],x}if(o==="running"){let g,p,b,x,y;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=p):p=e[28],e[29]!==c?(b=Sm.fromSeconds(c)||Sm.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(x=h.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:h.jsx(Yj,{startTime:b})}),e[31]=b,e[32]=x):x=e[32],e[33]!==p||e[34]!==x?(y=h.jsx(Me,{content:p,usePortal:!0,children:x}),e[33]=p,e[34]=x,e[35]=y):y=e[35],y}if(o==="queued"){let g,p,b,x;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(p=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:h.jsx(oS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(x=h.jsx(Me,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=x):x=e[41],x}if(s||a||i||u){let g;e[42]!==l?(g=ya(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?h.jsx(Bc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const x=b;let y,v,S,k,N,E="";if(u)y="This cell has not yet been run";else if(a){let I;y="This cell was interrupted when it was last run",e[47]!==x?(I=h.jsxs("span",{children:["This cell ran for ",x," before being interrupted"]}),e[47]=x,e[48]=I):I=e[48],E=I}else if(s){let I;y="This cell has been modified since it was last run",e[49]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[49]=x,e[50]=I):I=e[50],E=I}else{let I;y="This cell has not been run with the latest inputs",e[51]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[51]=x,e[52]=I):I=e[52],E=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:h.jsx(kc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==y?(S=h.jsx(Me,{content:y,usePortal:!0,children:v}),e[54]=y,e[55]=S):S=e[55],e[56]!==l||e[57]!==p||e[58]!==_||e[59]!==E?(k=l&&h.jsx(Me,{content:h.jsxs("div",{className:"flex flex-col gap-1",children:[E,_]}),usePortal:!0,children:h.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:h.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=_,e[59]=E,e[60]=k):k=e[60],e[61]!==S||e[62]!==k?(N=h.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[S,k]}),e[61]=S,e[62]=k,e[63]=N):N=e[63],N}if(l!==null){let g;e[64]!==l?(g=ya(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?h.jsx(Bc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const x=b;let y,v,S,k;return e[69]!==x?(y=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[69]=x,e[70]=y):y=e[70],e[71]!==_||e[72]!==y?(v=h.jsxs("div",{className:"flex flex-col gap-1",children:[y,_]}),e[71]=_,e[72]=y,e[73]=v):v=e[73],e[74]!==p?(S=h.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:h.jsx("span",{children:p})}),e[74]=p,e[75]=S):S=e[75],e[76]!==v||e[77]!==S?(k=h.jsx(Me,{content:v,usePortal:!0,children:S}),e[76]=v,e[77]=S,e[78]=k):k=e[78],k}return null},Bc=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=h.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},E_=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,i,s,a,l,c,d,u;if(e[0]!==n){const f=new Date(n),m=new Date,_=f.toDateString()===m.toDateString()?C_:N_;s="Ran at",a=" ",l=h.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",i=hS(f),e[0]=n,e[1]=o,e[2]=r,e[3]=i,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],i=e[3],s=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==i?(d=h.jsxs("span",{className:o,children:[r,i," ago)"]}),e[8]=o,e[9]=r,e[10]=i,e[11]=d):d=e[11],e[12]!==s||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(u=h.jsxs("span",{children:[s,a,l,c,d]}),e[12]=s,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=u):u=e[17],u},ya=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const Yj=t=>{const e=X.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(s){const a=A.useRef(s),[l,c]=A.useState(s);return A.useEffect(()=>{const d=setInterval(()=>{c(Sm.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,i;return e[2]!==o?(r=ya(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(i=h.jsx("span",{children:r}),e[4]=r,e[5]=i):i=e[5],i},Jj={display:"none"};function Kj(t){let{id:e,value:n}=t;return K.createElement("div",{id:e,style:Jj},n)}function Xj(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return K.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const I_=A.createContext(null),Zj={draggable:`
107
- To pick up a draggable item, press the space bar.
108
- While dragging, use the arrow keys to move the item.
109
- Press space again to drop the item in its new position, or press escape to cancel.
110
- `},Qj={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function eE(t){let{announcements:e=Qj,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=Zj}=t;const{announce:i,announcement:s}=function(){const[u,f]=A.useState("");return{announce:A.useCallback(m=>{m!=null&&f(m)},[]),announcement:u}}(),a=la("DndLiveRegion"),[l,c]=A.useState(!1);if(A.useEffect(()=>{c(!0)},[]),function(u){const f=A.useContext(I_);A.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(u)},[u,f])}(A.useMemo(()=>({onDragStart(u){let{active:f}=u;i(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:m}=u;e.onDragMove&&i(e.onDragMove({active:f,over:m}))},onDragOver(u){let{active:f,over:m}=u;i(e.onDragOver({active:f,over:m}))},onDragEnd(u){let{active:f,over:m}=u;i(e.onDragEnd({active:f,over:m}))},onDragCancel(u){let{active:f,over:m}=u;i(e.onDragCancel({active:f,over:m}))}}),[i,e])),!l)return null;const d=K.createElement(K.Fragment,null,K.createElement(Kj,{id:o,value:r.draggable}),K.createElement(Xj,{id:a,announcement:s}));return n?ua.createPortal(d,n):d}var Ut;function ol(){}function A_(t,e){return A.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ut||(Ut={}));const $n=Object.freeze({x:0,y:0});function Yd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Jd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function tE(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function Kd(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function Xd(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function T_(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const Zd=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=T_(e,e.left,e.top),i=[];for(const s of o){const{id:a}=s,l=n.get(a);if(l){const c=Yd(T_(l),r);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(Jd)};function nE(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),s=r-o,a=i-n;if(o<r&&n<i){const l=e.width*e.height,c=t.width*t.height,d=s*a;return Number((d/(l+c-d)).toFixed(4))}return 0}const M_=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const i of o){const{id:s}=i,a=n.get(s);if(a){const l=nE(a,e);l>0&&r.push({id:s,data:{droppableContainer:i,value:l}})}}return r.sort(tE)};function oE(t,e){const{top:n,left:o,bottom:r,right:i}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=i}function O_(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:$n}function rE(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((i,s)=>({...i,top:i.top+t*s.y,bottom:i.bottom+t*s.y,left:i.left+t*s.x,right:i.right+t*s.x}),{...e})}}const iE=rE(1),sE={ignoreTransform:!1};function Wr(t,e){e===void 0&&(e=sE);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Fo(t).getComputedStyle(t);c&&(n=function(u,f,m){const _=function(N){if(N.startsWith("matrix3d(")){const E=N.slice(9,-1).split(/, /);return{x:+E[12],y:+E[13],scaleX:+E[0],scaleY:+E[5]}}if(N.startsWith("matrix(")){const E=N.slice(7,-1).split(/, /);return{x:+E[4],y:+E[5],scaleX:+E[0],scaleY:+E[3]}}return null}(f);if(!_)return u;const{scaleX:g,scaleY:p,x:b,y:x}=_,y=u.left-b-(1-g)*parseFloat(m),v=u.top-x-(1-p)*parseFloat(m.slice(m.indexOf(" ")+1)),S=g?u.width/g:u.width,k=p?u.height/p:u.height;return{width:S,height:k,top:v,right:y+S,bottom:v+k,left:y}}(n,c,d))}const{top:o,left:r,width:i,height:s,bottom:a,right:l}=n;return{top:o,left:r,width:i,height:s,bottom:a,right:l}}function D_(t){return Wr(t,{ignoreTransform:!0})}function rl(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(c4(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Cc(r)||gB(r)||n.includes(r))return n;const i=Fo(t).getComputedStyle(r);return r!==t&&function(s,a){a===void 0&&(a=Fo(s).getComputedStyle(s));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const d=a[c];return typeof d=="string"&&l.test(d)})}(r,i)&&n.push(r),function(s,a){return a===void 0&&(a=Fo(s).getComputedStyle(s)),a.position==="fixed"}(r,i)?n:o(r.parentNode)}(t):n}function R_(t){const[e]=rl(t,1);return e??null}function Qd(t){return jm&&t?Em(t)?t:yB(t)?c4(t)||t===Hi(t).scrollingElement?window:Cc(t)?t:null:null:null}function P_(t){return Em(t)?t.scrollX:t.scrollLeft}function L_(t){return Em(t)?t.scrollY:t.scrollTop}function eu(t){return{x:P_(t),y:L_(t)}}var Wt;function F_(t){return!(!jm||!t)&&t===document.scrollingElement}function z_(t){const e={x:0,y:0},n=F_(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Wt||(Wt={}));const aE={x:.2,y:.2};function lE(t,e,n,o,r){let{top:i,left:s,right:a,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=aE);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=z_(t),m={x:0,y:0},_={x:0,y:0},g=e.height*r.y,p=e.width*r.x;return!c&&i<=e.top+g?(m.y=Wt.Backward,_.y=o*Math.abs((e.top+g-i)/g)):!d&&l>=e.bottom-g&&(m.y=Wt.Forward,_.y=o*Math.abs((e.bottom-g-l)/g)),!f&&a>=e.right-p?(m.x=Wt.Forward,_.x=o*Math.abs((e.right-p-a)/p)):!u&&s<=e.left+p&&(m.x=Wt.Backward,_.x=o*Math.abs((e.left+p-s)/p)),{direction:m,speed:_}}function cE(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function B_(t){return t.reduce((e,n)=>Wi(e,eu(n)),$n)}const dE=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+P_(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+L_(n),0)}]];class tu{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=rl(n),r=B_(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,s,a]of dE)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(o),d=r[i]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ys{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function nu(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var An,ct;function U_(t){t.preventDefault()}function uE(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(An||(An={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(ct||(ct={}));const V_={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},hE=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case ct.Right:return{...n,x:n.x+25};case ct.Left:return{...n,x:n.x-25};case ct.Down:return{...n,y:n.y+25};case ct.Up:return{...n,y:n.y-25}}};class ou{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new ys(Hi(n)),this.windowListeners=new ys(Fo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(An.Resize,this.handleCancel),this.windowListeners.add(An.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(An.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,i){if(i===void 0&&(i=Wr),!r)return;const{top:s,left:a,bottom:l,right:c}=i(r);R_(r)&&(l<=0||c<=0||s>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n($n)}handleKeyDown(e){if(Cm(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:i=V_,coordinateGetter:s=hE,scrollBehavior:a="smooth"}=r,{code:l}=e;if(i.end.includes(l))return void this.handleEnd(e);if(i.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=o.current,d=c?{x:c.left,y:c.top}:$n;this.referenceCoordinates||(this.referenceCoordinates=d);const u=s(e,{active:n,context:o.current,currentCoordinates:d});if(u){const f=da(u,d),m={x:0,y:0},{scrollableAncestors:_}=o.current;for(const g of _){const p=e.code,{isTop:b,isRight:x,isLeft:y,isBottom:v,maxScroll:S,minScroll:k}=z_(g),N=cE(g),E={x:Math.min(p===ct.Right?N.right-N.width/2:N.right,Math.max(p===ct.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(p===ct.Down?N.bottom-N.height/2:N.bottom,Math.max(p===ct.Down?N.top:N.top+N.height/2,u.y))},I=p===ct.Right&&!x||p===ct.Left&&!y,T=p===ct.Down&&!v||p===ct.Up&&!b;if(I&&E.x!==u.x){const M=g.scrollLeft+f.x,R=p===ct.Right&&M<=S.x||p===ct.Left&&M>=k.x;if(R&&!f.y)return void g.scrollTo({left:M,behavior:a});m.x=R?g.scrollLeft-M:p===ct.Right?g.scrollLeft-S.x:g.scrollLeft-k.x,m.x&&g.scrollBy({left:-m.x,behavior:a});break}if(T&&E.y!==u.y){const M=g.scrollTop+f.y,R=p===ct.Down&&M<=S.y||p===ct.Up&&M>=k.y;if(R&&!f.x)return void g.scrollTo({top:M,behavior:a});m.y=R?g.scrollTop-M:p===ct.Down?g.scrollTop-S.y:g.scrollTop-k.y,m.y&&g.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(e,Wi(da(u,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function $_(t){return!!(t&&"distance"in t)}function H_(t){return!!(t&&"delay"in t)}ou.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=V_,onActivation:r}=e,{active:i}=n;const{code:s}=t.nativeEvent;if(o.start.includes(s)){const a=i.activatorNode.current;return(!a||t.target===a)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class ru{constructor(e,n,o){var r;o===void 0&&(o=function(a){const{EventTarget:l}=Fo(a);return a instanceof l?a:Hi(a)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:s}=i;this.props=e,this.events=n,this.document=Hi(s),this.documentListeners=new ys(this.document),this.listeners=new ys(o),this.windowListeners=new ys(Fo(s)),this.initialCoordinates=(r=Nm(i))!=null?r:$n,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(An.Resize,this.handleCancel),this.windowListeners.add(An.DragStart,U_),this.windowListeners.add(An.VisibilityChange,this.handleCancel),this.windowListeners.add(An.ContextMenu,U_),this.documentListeners.add(An.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(H_(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if($_(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(An.Click,uE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(An.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!r)return;const l=(n=Nm(e))!=null?n:$n,c=da(r,l);if(!o&&a){if($_(a)){if(a.tolerance!=null&&nu(c,a.tolerance))return this.handleCancel();if(nu(c,a.distance))return this.handleStart()}return H_(a)&&nu(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),s(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ct.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const fE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class iu extends ru{constructor(e){const{event:n}=e,o=Hi(n.target);super(e,fE,o)}}iu.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const mE={move:{name:"mousemove"},end:{name:"mouseup"}};var su;(function(t){t[t.RightClick=2]="RightClick"})(su||(su={})),(class extends ru{constructor(t){super(t,mE,Hi(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==su.RightClick&&(o==null||o({event:n}),!0)}}];const au={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var xs,il;function pE(t){let{acceleration:e,activator:n=xs.Pointer,canScroll:o,draggingRect:r,enabled:i,interval:s=5,order:a=il.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const m=function(k){let{delta:N,disabled:E}=k;const I=Nc(N);return ha(T=>{if(E||!I||!T)return gE;const M={x:Math.sign(N.x-I.x),y:Math.sign(N.y-I.y)};return{x:{[Wt.Backward]:T.x[Wt.Backward]||M.x===-1,[Wt.Forward]:T.x[Wt.Forward]||M.x===1},y:{[Wt.Backward]:T.y[Wt.Backward]||M.y===-1,[Wt.Forward]:T.y[Wt.Forward]||M.y===1}}},[E,N,I])}({delta:u,disabled:!i}),[_,g]=_B(),p=A.useRef({x:0,y:0}),b=A.useRef({x:0,y:0}),x=A.useMemo(()=>{switch(n){case xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case xs.DraggableRect:return r}},[n,r,l]),y=A.useRef(null),v=A.useCallback(()=>{const k=y.current;if(!k)return;const N=p.current.x*b.current.x,E=p.current.y*b.current.y;k.scrollBy(N,E)},[]),S=A.useMemo(()=>a===il.TreeOrder?[...c].reverse():c,[a,c]);A.useEffect(()=>{if(i&&c.length&&x){for(const k of S){if((o==null?void 0:o(k))===!1)continue;const N=c.indexOf(k),E=d[N];if(!E)continue;const{direction:I,speed:T}=lE(k,E,x,e,f);for(const M of["x","y"])m[M][I[M]]||(T[M]=0,I[M]=0);if(T.x>0||T.y>0)return g(),y.current=k,_(v,s),p.current=T,void(b.current=I)}p.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,v,o,g,i,s,JSON.stringify(x),JSON.stringify(m),_,c,S,d,JSON.stringify(f)])}(class extends ru{constructor(t){super(t,au)}static setup(){return window.addEventListener(au.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(au.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(xs||(xs={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(il||(il={}));const gE={x:{[Wt.Backward]:!1,[Wt.Forward]:!1},y:{[Wt.Backward]:!1,[Wt.Forward]:!1}};var ws,lu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ws||(ws={})),function(t){t.Optimized="optimized"}(lu||(lu={}));const W_=new Map;function q_(t,e){return ha(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function sl(t){let{callback:e,disabled:n}=t;const o=l4(e),r=A.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:i}=window;return new i(o)},[n]);return A.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function _E(t){return new tu(Wr(t),t)}function G_(t,e,n){e===void 0&&(e=_E);const[o,r]=A.useState(null);function i(){r(l=>{if(!t)return null;var c;if(t.isConnected===!1)return(c=l??n)!=null?c:null;const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const s=function(l){let{callback:c,disabled:d}=l;const u=l4(c),f=A.useMemo(()=>{if(d||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:m}=window;return new m(u)},[u,d]);return A.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){i();break}}}}),a=sl({callback:i});return lr(()=>{i(),t?(a==null||a.observe(t),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[t]),o}const Y_=[];function J_(t,e){e===void 0&&(e=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},e),A.useEffect(()=>{const o=t!==$n;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?da(t,n.current):$n}function K_(t){return A.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const X_=[];function bE(t){let{measure:e}=t;const[n,o]=A.useState(null),r=A.useCallback(c=>{for(const{target:d}of c)if(Cc(d)){o(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),i=sl({callback:r}),s=A.useCallback(c=>{const d=function(u){if(!u)return null;if(u.children.length>1)return u;const f=u.children[0];return Cc(f)?f:u}(c);i==null||i.disconnect(),d&&(i==null||i.observe(d)),o(d?e(d):null)},[e,i]),[a,l]=Sc(s);return A.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const yE=[{sensor:iu,options:{}},{sensor:ou,options:{}}],xE={current:{}},al={draggable:{measure:D_},droppable:{measure:D_,strategy:ws.WhileDragging,frequency:lu.Optimized},dragOverlay:{measure:Wr}};class vs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const wE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ol},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:al,measureDroppableContainers:ol,windowRect:null,measuringScheduled:!1},vE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ol,draggableNodes:new Map,over:null,measureDroppableContainers:ol},ll=A.createContext(vE),Z_=A.createContext(wE);function kE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vs}}}function SE(t,e){switch(e.type){case Ut.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ut.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Ut.DragEnd:case Ut.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ut.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new vs(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case Ut.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,i=t.droppable.containers.get(n);if(!i||o!==i.key)return t;const s=new vs(t.droppable.containers);return s.set(n,{...i,disabled:r}),{...t,droppable:{...t.droppable,containers:s}}}case Ut.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const i=new vs(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function CE(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=A.useContext(ll),i=Nc(o),s=Nc(n==null?void 0:n.id);return A.useEffect(()=>{if(!e&&!o&&i&&s!=null){if(!Cm(i)||document.activeElement===i.target)return;const a=r.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=bB(d);if(u){u.focus();break}}})}},[o,e,r,s,i]),null}const Q_=A.createContext({...$n,scaleX:1,scaleY:1});var Wo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Wo||(Wo={}));const NE=A.memo(function(t){var e,n,o,r;let{id:i,accessibility:s,autoScroll:a=!0,children:l,sensors:c=yE,collisionDetection:d=M_,measuring:u,modifiers:f,...m}=t;const _=A.useReducer(SE,void 0,kE),[g,p]=_,[b,x]=function(){const[ae]=A.useState(()=>new Set),Se=A.useCallback(Ce=>(ae.add(Ce),()=>ae.delete(Ce)),[ae]);return[A.useCallback(Ce=>{let{type:Be,event:He}=Ce;ae.forEach(Re=>{var Ge;return(Ge=Re[Be])==null?void 0:Ge.call(Re,He)})},[ae]),Se]}(),[y,v]=A.useState(Wo.Uninitialized),S=y===Wo.Initialized,{draggable:{active:k,nodes:N,translate:E},droppable:{containers:I}}=g,T=k!=null?N.get(k):null,M=A.useRef({initial:null,translated:null}),R=A.useMemo(()=>{var ae;return k!=null?{id:k,data:(ae=T==null?void 0:T.data)!=null?ae:xE,rect:M}:null},[k,T]),B=A.useRef(null),[O,z]=A.useState(null),[F,V]=A.useState(null),L=ca(m,Object.values(m)),C=la("DndDescribedBy",i),$=A.useMemo(()=>I.getEnabled(),[I]),j=(H=u,A.useMemo(()=>({draggable:{...al.draggable,...H==null?void 0:H.draggable},droppable:{...al.droppable,...H==null?void 0:H.droppable},dragOverlay:{...al.dragOverlay,...H==null?void 0:H.dragOverlay}}),[H==null?void 0:H.draggable,H==null?void 0:H.droppable,H==null?void 0:H.dragOverlay]));var H;const{droppableRects:Y,measureDroppableContainers:Z,measuringScheduled:G}=function(ae,Se){let{dragging:Ce,dependencies:Be,config:He}=Se;const[Re,Ge]=A.useState(null),{frequency:ot,measure:Ye,strategy:rt}=He,gt=A.useRef(ae),xt=function(){switch(rt){case ws.Always:return!1;case ws.BeforeDragging:return Ce;default:return!Ce}}(),Mt=ca(xt),wt=A.useCallback(function(dn){dn===void 0&&(dn=[]),Mt.current||Ge(on=>on===null?dn:on.concat(dn.filter(Zt=>!on.includes(Zt))))},[Mt]),Vt=A.useRef(null),Sn=ha(dn=>{if(xt&&!Ce)return W_;if(!dn||dn===W_||gt.current!==ae||Re!=null){const on=new Map;for(let Zt of ae){if(!Zt)continue;if(Re&&Re.length>0&&!Re.includes(Zt.id)&&Zt.rect.current){on.set(Zt.id,Zt.rect.current);continue}const Wn=Zt.node.current,lo=Wn?new tu(Ye(Wn),Wn):null;Zt.rect.current=lo,lo&&on.set(Zt.id,lo)}return on}return dn},[ae,Re,Ce,xt,Ye]);return A.useEffect(()=>{gt.current=ae},[ae]),A.useEffect(()=>{xt||wt()},[Ce,xt]),A.useEffect(()=>{Re&&Re.length>0&&Ge(null)},[JSON.stringify(Re)]),A.useEffect(()=>{xt||typeof ot!="number"||Vt.current!==null||(Vt.current=setTimeout(()=>{wt(),Vt.current=null},ot))},[ot,xt,wt,...Be]),{droppableRects:Sn,measureDroppableContainers:wt,measuringScheduled:Re!=null}}($,{dragging:S,dependencies:[E.x,E.y],config:j.droppable}),re=function(ae,Se){const Ce=Se!=null?ae.get(Se):void 0,Be=Ce?Ce.node.current:null;return ha(He=>{var Re;return Se==null?null:(Re=Be??He)!=null?Re:null},[Be,Se])}(N,k),ne=A.useMemo(()=>F?Nm(F):null,[F]),te=function(){const ae=(O==null?void 0:O.autoScrollEnabled)===!1,Se=typeof a=="object"?a.enabled===!1:a===!1,Ce=S&&!ae&&!Se;return typeof a=="object"?{...a,enabled:Ce}:{enabled:Ce}}(),q=function(ae,Se){return q_(ae,Se)}(re,j.draggable.measure);(function(ae){let{activeNode:Se,measure:Ce,initialRect:Be,config:He=!0}=ae;const Re=A.useRef(!1),{x:Ge,y:ot}=typeof He=="boolean"?{x:He,y:He}:He;lr(()=>{if(!Ge&&!ot||!Se)return void(Re.current=!1);if(Re.current||!Be)return;const Ye=Se==null?void 0:Se.node.current;if(!Ye||Ye.isConnected===!1)return;const rt=O_(Ce(Ye),Be);if(Ge||(rt.x=0),ot||(rt.y=0),Re.current=!0,Math.abs(rt.x)>0||Math.abs(rt.y)>0){const gt=R_(Ye);gt&&gt.scrollBy({top:rt.y,left:rt.x})}},[Se,Ge,ot,Be,Ce])})({activeNode:k!=null?N.get(k):null,config:te.layoutShiftCompensation,initialRect:q,measure:j.draggable.measure});const Q=G_(re,j.draggable.measure,q),ie=G_(re?re.parentElement:null),ue=A.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=I.getNodeFor((e=ue.current.over)==null?void 0:e.id),_e=bE({measure:j.dragOverlay.measure}),ce=(n=_e.nodeRef.current)!=null?n:re,Ne=S?(o=_e.rect)!=null?o:Q:null,je=!!(_e.nodeRef.current&&_e.rect),de=O_(Ee=je?null:Q,q_(Ee));var Ee;const ge=K_(ce?Fo(ce):null),Oe=function(ae){const Se=A.useRef(ae),Ce=ha(Be=>ae?Be&&Be!==Y_&&ae&&Se.current&&ae.parentNode===Se.current.parentNode?Be:rl(ae):Y_,[ae]);return A.useEffect(()=>{Se.current=ae},[ae]),Ce}(S?le??re:null),Fe=function(ae,Se){Se===void 0&&(Se=Wr);const[Ce]=ae,Be=K_(Ce?Fo(Ce):null),[He,Re]=A.useState(X_);function Ge(){Re(()=>ae.length?ae.map(Ye=>F_(Ye)?Be:new tu(Se(Ye),Ye)):X_)}const ot=sl({callback:Ge});return lr(()=>{ot==null||ot.disconnect(),Ge(),ae.forEach(Ye=>ot==null?void 0:ot.observe(Ye))},[ae]),He}(Oe),$e=function(ae,Se){let{transform:Ce,...Be}=Se;return ae!=null&&ae.length?ae.reduce((He,Re)=>Re({transform:He,...Be}),Ce):Ce}(f,{transform:{x:E.x-de.x,y:E.y-de.y,scaleX:1,scaleY:1},activatorEvent:F,active:R,activeNodeRect:Q,containerNodeRect:ie,draggingNodeRect:Ne,over:ue.current.over,overlayNodeRect:_e.rect,scrollableAncestors:Oe,scrollableAncestorRects:Fe,windowRect:ge}),Xe=ne?Wi(ne,E):null,Le=function(ae){const[Se,Ce]=A.useState(null),Be=A.useRef(ae),He=A.useCallback(Re=>{const Ge=Qd(Re.target);Ge&&Ce(ot=>ot?(ot.set(Ge,eu(Ge)),new Map(ot)):null)},[]);return A.useEffect(()=>{const Re=Be.current;if(ae!==Re){Ge(Re);const ot=ae.map(Ye=>{const rt=Qd(Ye);return rt?(rt.addEventListener("scroll",He,{passive:!0}),[rt,eu(rt)]):null}).filter(Ye=>Ye!=null);Ce(ot.length?new Map(ot):null),Be.current=ae}return()=>{Ge(ae),Ge(Re)};function Ge(ot){ot.forEach(Ye=>{const rt=Qd(Ye);rt==null||rt.removeEventListener("scroll",He)})}},[He,ae]),A.useMemo(()=>ae.length?Se?Array.from(Se.values()).reduce((Re,Ge)=>Wi(Re,Ge),$n):B_(ae):$n,[ae,Se])}(Oe),et=J_(Le),nt=J_(Le,[Q]),it=Wi($e,et),oe=Ne?iE(Ne,$e):null,ve=R&&oe?d({active:R,collisionRect:oe,droppableRects:Y,droppableContainers:$,pointerCoordinates:Xe}):null,Ie=Xd(ve,"id"),[ze,J]=A.useState(null),me=function(ae,Se,Ce){return{...ae,scaleX:Se&&Ce?Se.width/Ce.width:1,scaleY:Se&&Ce?Se.height/Ce.height:1}}(je?$e:Wi($e,nt),(r=ze==null?void 0:ze.rect)!=null?r:null,Q),pe=A.useRef(null),he=A.useCallback((ae,Se)=>{let{sensor:Ce,options:Be}=Se;if(B.current==null)return;const He=N.get(B.current);if(!He)return;const Re=ae.nativeEvent,Ge=new Ce({active:B.current,activeNode:He,event:Re,options:Be,context:ue,onAbort(Ye){if(!N.get(Ye))return;const{onDragAbort:rt}=L.current,gt={id:Ye};rt==null||rt(gt),b({type:"onDragAbort",event:gt})},onPending(Ye,rt,gt,xt){if(!N.get(Ye))return;const{onDragPending:Mt}=L.current,wt={id:Ye,constraint:rt,initialCoordinates:gt,offset:xt};Mt==null||Mt(wt),b({type:"onDragPending",event:wt})},onStart(Ye){const rt=B.current;if(rt==null)return;const gt=N.get(rt);if(!gt)return;const{onDragStart:xt}=L.current,Mt={activatorEvent:Re,active:{id:rt,data:gt.data,rect:M}};ua.unstable_batchedUpdates(()=>{xt==null||xt(Mt),v(Wo.Initializing),p({type:Ut.DragStart,initialCoordinates:Ye,active:rt}),b({type:"onDragStart",event:Mt}),z(pe.current),V(Re)})},onMove(Ye){p({type:Ut.DragMove,coordinates:Ye})},onEnd:ot(Ut.DragEnd),onCancel:ot(Ut.DragCancel)});function ot(Ye){return async function(){const{active:rt,collisions:gt,over:xt,scrollAdjustedTranslate:Mt}=ue.current;let wt=null;if(rt&&Mt){const{cancelDrop:Vt}=L.current;wt={activatorEvent:Re,active:rt,collisions:gt,delta:Mt,over:xt},Ye===Ut.DragEnd&&typeof Vt=="function"&&await Promise.resolve(Vt(wt))&&(Ye=Ut.DragCancel)}B.current=null,ua.unstable_batchedUpdates(()=>{p({type:Ye}),v(Wo.Uninitialized),J(null),z(null),V(null),pe.current=null;const Vt=Ye===Ut.DragEnd?"onDragEnd":"onDragCancel";if(wt){const Sn=L.current[Vt];Sn==null||Sn(wt),b({type:Vt,event:wt})}})}}pe.current=Ge},[N]),ke=A.useCallback((ae,Se)=>(Ce,Be)=>{const He=Ce.nativeEvent,Re=N.get(Be);if(B.current!==null||!Re||He.dndKit||He.defaultPrevented)return;const Ge={active:Re};ae(Ce,Se.options,Ge)===!0&&(He.dndKit={capturedBy:Se.sensor},B.current=Be,he(Ce,Se))},[N,he]),xe=function(ae,Se){return A.useMemo(()=>ae.reduce((Ce,Be)=>{const{sensor:He}=Be;return[...Ce,...He.activators.map(Re=>({eventName:Re.eventName,handler:Se(Re.handler,Be)}))]},[]),[ae,Se])}(c,ke);(function(ae){A.useEffect(()=>{if(!jm)return;const Se=ae.map(Ce=>{let{sensor:Be}=Ce;return Be.setup==null?void 0:Be.setup()});return()=>{for(const Ce of Se)Ce==null||Ce()}},ae.map(Se=>{let{sensor:Ce}=Se;return Ce}))})(c),lr(()=>{Q&&y===Wo.Initializing&&v(Wo.Initialized)},[Q,y]),A.useEffect(()=>{const{onDragMove:ae}=L.current,{active:Se,activatorEvent:Ce,collisions:Be,over:He}=ue.current;if(!Se||!Ce)return;const Re={active:Se,activatorEvent:Ce,collisions:Be,delta:{x:it.x,y:it.y},over:He};ua.unstable_batchedUpdates(()=>{ae==null||ae(Re),b({type:"onDragMove",event:Re})})},[it.x,it.y]),A.useEffect(()=>{const{active:ae,activatorEvent:Se,collisions:Ce,droppableContainers:Be,scrollAdjustedTranslate:He}=ue.current;if(!ae||B.current==null||!Se||!He)return;const{onDragOver:Re}=L.current,Ge=Be.get(Ie),ot=Ge&&Ge.rect.current?{id:Ge.id,rect:Ge.rect.current,data:Ge.data,disabled:Ge.disabled}:null,Ye={active:ae,activatorEvent:Se,collisions:Ce,delta:{x:He.x,y:He.y},over:ot};ua.unstable_batchedUpdates(()=>{J(ot),Re==null||Re(Ye),b({type:"onDragOver",event:Ye})})},[Ie]),lr(()=>{ue.current={activatorEvent:F,active:R,activeNode:re,collisionRect:oe,collisions:ve,droppableRects:Y,draggableNodes:N,draggingNode:ce,draggingNodeRect:Ne,droppableContainers:I,over:ze,scrollableAncestors:Oe,scrollAdjustedTranslate:it},M.current={initial:Ne,translated:oe}},[R,re,ve,oe,N,ce,Ne,Y,I,ze,Oe,it]),pE({...te,delta:E,draggingRect:oe,pointerCoordinates:Xe,scrollableAncestors:Oe,scrollableAncestorRects:Fe});const Ue=A.useMemo(()=>({active:R,activeNode:re,activeNodeRect:Q,activatorEvent:F,collisions:ve,containerNodeRect:ie,dragOverlay:_e,draggableNodes:N,droppableContainers:I,droppableRects:Y,over:ze,measureDroppableContainers:Z,scrollableAncestors:Oe,scrollableAncestorRects:Fe,measuringConfiguration:j,measuringScheduled:G,windowRect:ge}),[R,re,Q,F,ve,ie,_e,N,I,Y,ze,Z,Oe,Fe,j,G,ge]),Ze=A.useMemo(()=>({activatorEvent:F,activators:xe,active:R,activeNodeRect:Q,ariaDescribedById:{draggable:C},dispatch:p,draggableNodes:N,over:ze,measureDroppableContainers:Z}),[F,xe,R,Q,p,C,N,ze,Z]);return K.createElement(I_.Provider,{value:x},K.createElement(ll.Provider,{value:Ze},K.createElement(Z_.Provider,{value:Ue},K.createElement(Q_.Provider,{value:me},l)),K.createElement(CE,{disabled:(s==null?void 0:s.restoreFocus)===!1})),K.createElement(eE,{...s,hiddenTextDescribedById:C}))}),jE=A.createContext(null),e0="button";function EE(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const i=la("Draggable"),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=A.useContext(ll),{role:m=e0,roleDescription:_="draggable",tabIndex:g=0}=r??{},p=(l==null?void 0:l.id)===e,b=A.useContext(p?Q_:jE),[x,y]=Sc(),[v,S]=Sc(),k=function(E,I){return A.useMemo(()=>E.reduce((T,M)=>{let{eventName:R,handler:B}=M;return T[R]=O=>{B(O,I)},T},{}),[E,I])}(s,e),N=ca(n);return lr(()=>(u.set(e,{id:e,key:i,node:x,activatorNode:v,data:N}),()=>{const E=u.get(e);E&&E.key===i&&u.delete(e)}),[u,e]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:A.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!p||m!==e0)||void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[o,m,g,p,_,d.draggable]),isDragging:p,listeners:o?void 0:k,node:x,over:f,setNodeRef:y,setActivatorNodeRef:S,transform:b}}const IE={timeout:25};function t0(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function AE(t,e){return t.reduce((n,o,r)=>{const i=e.get(o);return i&&(n[r]=i),n},Array(t.length))}function cl(t){return t!==null&&t>=0}const dl={scaleX:1,scaleY:1},TE=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:i,index:s}=t;const a=(e=n[r])!=null?e:o;if(!a)return null;const l=function(c,d,u){const f=c[d],m=c[d-1],_=c[d+1];return!f||!m&&!_?0:u<d?m?f.left-(m.left+m.width):_.left-(f.left+f.width):_?_.left-(f.left+f.width):f.left-(m.left+m.width)}(n,s,r);if(s===r){const c=n[i];return c?{x:r<i?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...dl}:null}return s>r&&s<=i?{x:-a.width-l,y:0,...dl}:s<r&&s>=i?{x:a.width+l,y:0,...dl}:{x:0,y:0,...dl}},n0=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const i=t0(e,o,n),s=e[r],a=i[r];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},ul={scaleX:1,scaleY:1},ME=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:i,overIndex:s}=t;const a=(e=i[n])!=null?e:o;if(!a)return null;if(r===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...ul}:null}const l=function(c,d,u){const f=c[d],m=c[d-1],_=c[d+1];return f?u<d?m?f.top-(m.top+m.height):_?_.top-(f.top+f.height):0:_?_.top-(f.top+f.height):m?f.top-(m.top+m.height):0:0}(i,r,n);return r>n&&r<=s?{x:0,y:-a.height-l,...ul}:r<n&&r>=s?{x:0,y:a.height+l,...ul}:{x:0,y:0,...ul}},o0="Sortable",r0=K.createContext({activeIndex:-1,containerId:o0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:n0,disabled:{draggable:!1,droppable:!1}});function i0(t){let{children:e,id:n,items:o,strategy:r=n0,disabled:i=!1}=t;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=A.useContext(Z_),u=la(o0,n),f=a.rect!==null,m=A.useMemo(()=>o.map(k=>typeof k=="object"&&"id"in k?k.id:k),[o]),_=s!=null,g=s?m.indexOf(s.id):-1,p=c?m.indexOf(c.id):-1,b=A.useRef(m),x=!function(k,N){if(k===N)return!0;if(k.length!==N.length)return!1;for(let E=0;E<k.length;E++)if(k[E]!==N[E])return!1;return!0}(m,b.current),y=p!==-1&&g===-1||x,v=function(k){return typeof k=="boolean"?{draggable:k,droppable:k}:k}(i);lr(()=>{x&&_&&d(m)},[x,m,_,d]),A.useEffect(()=>{b.current=m},[m]);const S=A.useMemo(()=>({activeIndex:g,containerId:u,disabled:v,disableTransforms:y,items:m,overIndex:p,useDragOverlay:f,sortedRects:AE(m,l),strategy:r}),[g,u,v.draggable,v.droppable,y,m,p,l,f,r]);return K.createElement(r0.Provider,{value:S},e)}const OE=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return t0(n,o,r).indexOf(e)},DE=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=t;return!(!c||!o)&&(a===i||r!==s)&&(!!n||s!==r&&e===l)},RE={duration:200,easing:"ease"},s0="transform",PE=jc.Transition.toString({property:s0,duration:0,easing:"linear"}),LE={roleDescription:"sortable"};function a0(t){let{animateLayoutChanges:e=DE,attributes:n,disabled:o,data:r,getNewIndex:i=OE,id:s,strategy:a,resizeObserverConfig:l,transition:c=RE}=t;const{items:d,containerId:u,activeIndex:f,disabled:m,disableTransforms:_,sortedRects:g,overIndex:p,useDragOverlay:b,strategy:x}=A.useContext(r0),y=function(le,_e){var ce,Ne;return typeof le=="boolean"?{draggable:le,droppable:!1}:{draggable:(ce=le==null?void 0:le.draggable)!=null?ce:_e.draggable,droppable:(Ne=le==null?void 0:le.droppable)!=null?Ne:_e.droppable}}(o,m),v=d.indexOf(s),S=A.useMemo(()=>({sortable:{containerId:u,index:v,items:d},...r}),[u,r,v,d]),k=A.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:N,node:E,isOver:I,setNodeRef:T}=function(le){let{data:_e,disabled:ce=!1,id:Ne,resizeObserverConfig:je}=le;const de=la("Droppable"),{active:Ee,dispatch:ge,over:Oe,measureDroppableContainers:Fe}=A.useContext(ll),$e=A.useRef({disabled:ce}),Xe=A.useRef(!1),Le=A.useRef(null),et=A.useRef(null),{disabled:nt,updateMeasurementsFor:it,timeout:oe}={...IE,...je},ve=ca(it??Ne),Ie=sl({callback:A.useCallback(()=>{Xe.current?(et.current!=null&&clearTimeout(et.current),et.current=setTimeout(()=>{Fe(Array.isArray(ve.current)?ve.current:[ve.current]),et.current=null},oe)):Xe.current=!0},[oe]),disabled:nt||!Ee}),ze=A.useCallback((he,ke)=>{Ie&&(ke&&(Ie.unobserve(ke),Xe.current=!1),he&&Ie.observe(he))},[Ie]),[J,me]=Sc(ze),pe=ca(_e);return A.useEffect(()=>{Ie&&J.current&&(Ie.disconnect(),Xe.current=!1,Ie.observe(J.current))},[J,Ie]),A.useEffect(()=>(ge({type:Ut.RegisterDroppable,element:{id:Ne,key:de,disabled:ce,node:J,rect:Le,data:pe}}),()=>ge({type:Ut.UnregisterDroppable,key:de,id:Ne})),[Ne]),A.useEffect(()=>{ce!==$e.current.disabled&&(ge({type:Ut.SetDroppableDisabled,id:Ne,key:de,disabled:ce}),$e.current.disabled=ce)},[Ne,de,ce,ge]),{active:Ee,rect:Le,isOver:(Oe==null?void 0:Oe.id)===Ne,node:J,over:Oe,setNodeRef:me}}({id:s,data:S,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:M,activatorEvent:R,activeNodeRect:B,attributes:O,setNodeRef:z,listeners:F,isDragging:V,over:L,setActivatorNodeRef:C,transform:$}=EE({id:s,data:S,attributes:{...LE,...n},disabled:y.draggable}),j=xB(T,z),H=!!M,Y=H&&!_&&cl(f)&&cl(p),Z=!b&&V,G=Z&&Y?$:null,re=Y?G??(a??x)({rects:g,activeNodeRect:B,activeIndex:f,overIndex:p,index:v}):null,ne=cl(f)&&cl(p)?i({id:s,items:d,activeIndex:f,overIndex:p}):v,te=M==null?void 0:M.id,q=A.useRef({activeId:te,items:d,newIndex:ne,containerId:u}),Q=d!==q.current.items,ie=e({active:M,containerId:u,isDragging:V,isSorting:H,id:s,index:v,items:d,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:c,wasDragging:q.current.activeId!=null}),ue=function(le){let{disabled:_e,index:ce,node:Ne,rect:je}=le;const[de,Ee]=A.useState(null),ge=A.useRef(ce);return lr(()=>{if(!_e&&ce!==ge.current&&Ne.current){const Oe=je.current;if(Oe){const Fe=Wr(Ne.current,{ignoreTransform:!0}),$e={x:Oe.left-Fe.left,y:Oe.top-Fe.top,scaleX:Oe.width/Fe.width,scaleY:Oe.height/Fe.height};($e.x||$e.y)&&Ee($e)}}ce!==ge.current&&(ge.current=ce)},[_e,ce,Ne,je]),A.useEffect(()=>{de&&Ee(null)},[de]),de}({disabled:!ie,index:v,node:E,rect:N});return A.useEffect(()=>{H&&q.current.newIndex!==ne&&(q.current.newIndex=ne),u!==q.current.containerId&&(q.current.containerId=u),d!==q.current.items&&(q.current.items=d)},[H,ne,u,d]),A.useEffect(()=>{if(te===q.current.activeId)return;if(te!=null&&q.current.activeId==null)return void(q.current.activeId=te);const le=setTimeout(()=>{q.current.activeId=te},50);return()=>clearTimeout(le)},[te]),{active:M,activeIndex:f,attributes:O,data:S,rect:N,index:v,newIndex:ne,items:d,isOver:I,isSorting:H,isDragging:V,listeners:F,node:E,overIndex:p,over:L,setNodeRef:j,setActivatorNodeRef:C,setDroppableNodeRef:T,setDraggableNodeRef:z,transform:ue??re,transition:function(){if(ue||Q&&q.current.newIndex===v)return PE;if(!(Z&&!Cm(R)||!c)&&(H||ie))return jc.Transition.toString({...c,property:s0})}()}}function hl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const FE=[ct.Down,ct.Right,ct.Up,ct.Left],zE=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:i,over:s,scrollableAncestors:a}}=e;if(FE.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];i.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=r.get(u.id);if(f)switch(t.code){case ct.Down:o.top<f.top&&l.push(u);break;case ct.Up:o.top>f.top&&l.push(u);break;case ct.Left:o.left>f.left&&l.push(u);break;case ct.Right:o.left<f.left&&l.push(u)}});const c=(u=>{let{collisionRect:f,droppableRects:m,droppableContainers:_}=u;const g=Kd(f),p=[];for(const b of _){const{id:x}=b,y=m.get(x);if(y){const v=Kd(y),S=g.reduce((N,E,I)=>N+Yd(v[I],E),0),k=Number((S/4).toFixed(4));p.push({id:x,data:{droppableContainer:b,value:k}})}}return p.sort(Jd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let d=Xd(c,"id");if(d===(s==null?void 0:s.id)&&c.length>1&&(d=c[1].id),d!=null){const u=i.get(n.id),f=i.get(d),m=f?r.get(f.id):null,_=f==null?void 0:f.node.current;if(_&&m&&u&&f){const g=rl(_).some((v,S)=>a[S]!==v),p=l0(u,f),b=function(v,S){return!hl(v)||!hl(S)||!l0(v,S)?!1:v.data.current.sortable.index<S.data.current.sortable.index}(u,f),x=g||!p?{x:0,y:0}:{x:b?o.width-m.width:0,y:b?o.height-m.height:0},y={x:m.left,y:m.top};return x.x&&x.y?y:da(y,x)}}}};function l0(t,e){return!(!hl(t)||!hl(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}function fl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}const c0=K.createContext(null),d0=A.memo(()=>A.useContext(c0));d0.displayName="DragHandle";const u0=K.forwardRef((t,e)=>{const n=X.c(21);let o,r,i,s,a;n[0]!==t?({cellId:r,canMoveX:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]),n[4]!==r?(s=r.toString(),n[4]=r,n[5]=s):s=n[5],n[6]!==s?(a={id:s},n[6]=s,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:m}=a0(a);let _;n[8]!==u?(_=function(x){return!x||x.x===0&&x.y===0&&x.scaleX===1&&x.scaleY===1}(u)?null:u,n[8]=u,n[9]=_):_=n[9];const g=_,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==i||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==p?(b=h.jsx(h0,{ref:e,cellId:r,canMoveX:o,...i,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=i,n[16]=e,n[17]=d,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});u0.displayName="SortableCell";const h0=K.forwardRef((t,e)=>{const n=X.c(37);let o,r,i,s,a,l,c,d,u,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:M,attributes:R,listeners:B,setNodeRef:O,transform:z,transition:F,isDragging:V,...L}=t;r=T,i=M,o=R,a=B,c=O,d=z,u=F,s=V,l=L,n[0]=t,n[1]=o,n[2]=r,n[3]=i,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=u}else o=n[1],r=n[2],i=n[3],s=n[4],a=n[5],l=n[6],c=n[7],d=n[8],u=n[9];n[10]!==r||n[11]!==d?(f=d?jc.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=s?2:void 0;let _;n[13]!==f||n[14]!==m||n[15]!==u?(_={transform:f,transition:u,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=u,n[16]=_):_=n[16];const g=_;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(gp,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=h.jsx("div",{...o,...a,onMouseDown:un.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const x=b,y=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{fl(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const S=y&&"is-moving";let k,N,E;return n[24]!==l.className||n[25]!==S?(k=Te(l.className,S,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=S,n[26]=k):k=n[26],n[27]!==i||n[28]!==x?(N=h.jsx(c0.Provider,{value:x,children:i}),n[27]=i,n[28]=x,n[29]=N):N=n[29],n[30]!==s||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==k||n[35]!==N?(E=h.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":s,className:k,style:g,children:N}),n[30]=s,n[31]=l,n[32]=g,n[33]=v,n[34]=k,n[35]=N,n[36]=E):E=n[36],E});h0.displayName="SortableCellInternal";const f0=K.memo(K.forwardRef((t,e)=>{const n=X.c(34);let o,r,i;n[0]!==t?({children:o,showTooltip:i,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]);const s=i===void 0||i,[a,l]=A.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=id(c),u=wB();let f,m,_,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(BE)}),n[6]=f):f=n[6],A.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Qs,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(oc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let E;n[11]!==d.length?(E=(I,T)=>h.jsxs(A.Fragment,{children:[h.jsx(sm,{children:I.map(M=>{let R=h.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),h.jsx("div",{className:"flex-1",children:M.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&d4(M.hotkey),M.rightElement]})]});return M.tooltip&&(R=h.jsx(Me,{content:M.tooltip,delayDuration:100,children:R})),h.jsx(fo,{className:Te(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:R},M.label)})},T),T<d.length-1&&h.jsx(T3,{})]},T),n[11]=d.length,n[12]=E):E=n[12],g=d.map(E),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(p=h.jsxs(fc,{children:[m,h.jsxs(Im,{children:[_,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==u||n[16]!==p?(b=h.jsx(oa,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...u,children:p}),n[15]=u,n[16]=p,n[17]=b):b=n[17];const x=b;if(!s){let E,I;return n[18]!==o?(E=h.jsx(fa,{asChild:!0,children:o}),n[18]=o,n[19]=E):E=n[19],n[20]!==x||n[21]!==a||n[22]!==E?(I=h.jsxs(Bi,{open:a,onOpenChange:l,children:[E,x]}),n[20]=x,n[21]=a,n[22]=E,n[23]=I):I=n[23],I}let y;n[24]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(vB,{tabIndex:-1,children:hn("cell.cellActions")}),n[24]=y):y=n[24];const v=!a&&y;let S,k,N;return n[25]!==o?(S=h.jsx(kB,{children:h.jsx(fa,{className:"flex",children:o})}),n[25]=o,n[26]=S):S=n[26],n[27]!==v||n[28]!==S?(k=h.jsxs(SB,{delayDuration:200,disableHoverableContent:!0,children:[v,S]}),n[27]=v,n[28]=S,n[29]=k):k=n[29],n[30]!==x||n[31]!==a||n[32]!==k?(N=h.jsxs(Bi,{open:a,onOpenChange:l,children:[k,x]}),n[30]=x,n[31]=a,n[32]=k,n[33]=N):N=n[33],N})),m0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,i;e[0]!==o?(i=function(l){return Ot(c=>Zp(l,c(Js)))}(o),e[0]=o,e[1]=i):i=e[1],r=i;const s=We(r);if(!s)return null;let a;return e[2]!==n||e[3]!==s?(a=h.jsx(f0,{showTooltip:!1,...s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a});function BE(t){return!t}m0.displayName="ConnectionCellActionsDropdown";const p0=t=>{const e=X.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const i=id(r),[s,a]=K.useState(),l=!!s;let c,d,u,f,m,_,g,p,b,x;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Ri,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var S;if((S=window.getSelection())==null?void 0:S.toString())return void document.execCommand("copy");const v=document.getElementById(y3.create(o.cellId));v?await bn(v.textContent??""):mt.warn("cell-context-menu: output not found")},e[6]=o,e[7]=d):d=e[7],e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==o||e[12]!==l||e[13]!==d){const y=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!s,icon:h.jsx(Kc,{size:13,strokeWidth:1.5}),handle:UE},{label:"Paste",hidden:!!s,icon:h.jsx(ap,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:k}=o,N=k();if(N)try{const E=await navigator.clipboard.readText();if(E){const{from:I,to:T}=N.state.selection.main,M=N.state.update({changes:{from:I,to:T,insert:E}});N.dispatch(M)}}catch(E){const I=E;mt.error("Failed to paste from clipboard",I),CB({command:"paste"})}}},{label:"Copy image",hidden:!s,icon:h.jsx(Vc,{size:13,strokeWidth:1.5}),handle:async()=>{if(s){const k=await fetch(s.src),N=await k.blob(),E=new ClipboardItem({[N.type]:N});await navigator.clipboard.write([E]).then(VE).catch($E)}}},{icon:h.jsx(Jm,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!s,handle:()=>{if(s){const k=document.createElement("a");k.download="image.png",k.href=s.src,k.click()}}},{label:"Go to Definition",icon:h.jsx(jB,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:k}=o,N=k();N&&NB(N)}}],v=[y,...i];let S;f=y_,e[20]===Symbol.for("react.memo_cache_sentinel")?(S=k=>{k.target instanceof HTMLImageElement?a(k.target):a(void 0)},e[20]=S):S=e[20],e[21]!==n?(p=h.jsx(x_,{onContextMenu:S,asChild:!0,children:n}),e[21]=n,e[22]=p):p=e[22],u=Gd,m="w-[300px]",_=!0,g=v.map((k,N)=>h.jsxs(A.Fragment,{children:[k.map(HE),N<v.length-1&&h.jsx(v_,{})]},N)),e[8]=i,e[9]=n,e[10]=s,e[11]=o,e[12]=l,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=_,e[18]=g,e[19]=p}else u=e[14],f=e[15],m=e[16],_=e[17],g=e[18],p=e[19];return e[23]!==u||e[24]!==m||e[25]!==_||e[26]!==g?(b=h.jsx(u,{className:m,scrollable:_,children:g}),e[23]=u,e[24]=m,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==p||e[30]!==b?(x=h.jsxs(f,{children:[p,b]}),e[28]=f,e[29]=p,e[30]=b,e[31]=x):x=e[31],x};function UE(){document.execCommand("cut")}function VE(){lt({title:"Copied image to clipboard"})}function $E(t){lt({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),mt.error("Failed to copy image to clipboard",t)}function HE(t){if(t.hidden)return null;let e=h.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),h.jsx("div",{className:"flex-1",children:t.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&d4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=h.jsx(Me,{delayDuration:100,content:t.tooltip,children:e})),h.jsx(_s,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const WE=t=>{const e=X.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:i}=t;let s,a;e[0]!==o?(a=new ta().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],s=a;const l=s;let c,d;e[2]!==o?(d=new vc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const u=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(or,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==i||e[8]!==u?(m=h.jsx(cu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:i}),e[5]=r,e[6]=n,e[7]=i,e[8]=u,e[9]=m):m=e[9];const _=l&&r==="python";let g,p,b,x,y;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Lc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==i||e[14]!==_?(p=h.jsx(cu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:i}),e[11]=r,e[12]=n,e[13]=i,e[14]=_,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Fc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(x=h.jsx(cu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:jn.NOOP}),e[17]=r,e[18]=n,e[19]=x):x=e[19],e[20]!==p||e[21]!==x||e[22]!==m?(y=h.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,x]}),e[20]=p,e[21]=x,e[22]=m,e[23]=y):y=e[23],y},cu=t=>{const e=X.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:i,toType:s,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==s?(c=()=>{n&&(Sr(n,s),l())},e[0]=n,e[1]=l,e[2]=s,e[3]=c):c=e[3];const d=c;if(!r||o===s)return null;const u=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==i?(f=h.jsx(De,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:i}),e[4]=d,e[5]=i,e[6]=f):f=e[6],e[7]!==u||e[8]!==f?(m=h.jsx(Me,{content:u,children:f}),e[7]=u,e[8]=f,e[9]=m):m=e[9],m};var g0={modified:{doc:""},original:{doc:""}},_0=A.createContext(g0);function qE(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var du=()=>A.useContext(_0),GE=t=>{var{children:e,theme:n}=t,[o,r]=A.useReducer(qE,jt({},g0,{theme:n}));return A.useEffect(()=>r({theme:n}),[n]),h.jsx(_0.Provider,{value:jt({},o,{dispatch:r}),children:e})},YE=["extensions","value","selection","onChange"],b0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,i=ma(t,YE),{theme:s,dispatch:a}=du(),l=qi(jt({},i,{theme:s}));return A.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:i,extension:[e]}}),[t]),null};b0.displayName="CodeMirrorMerge.Original";var JE=["extensions","value","selection","onChange"],y0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,i=ma(t,JE),{theme:s,dispatch:a}=du(),l=qi(jt({},i,{theme:s}));return A.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:i,extension:[e]}})},[t]),null};y0.displayName="CodeMirrorMerge.Modified";class At{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new At(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function _r(t,e,n,o,r,i){if(t==o)return[];let s=fu(t,e,n,o,r,i),a=mu(t,e+s,n,o,r+s,i),l=(n-=a)-(e+=s),c=(i-=a)-(r+=s);if(!l||!c)return[new At(e,n,r,i)];if(l>c){let u=t.slice(e,n).indexOf(o.slice(r,i));if(u>-1)return[new At(e,e+u,r,r),new At(e+u+c,n,i,i)]}else if(c>l){let u=o.slice(r,i).indexOf(t.slice(e,n));if(u>-1)return[new At(e,e,r,r+u),new At(n,n,r+u+l,i)]}if(l==1||c==1)return[new At(e,n,r,i)];let d=v0(t,e,n,o,r,i);if(d){let[u,f,m]=d;return _r(t,e,u,o,r,f).concat(_r(t,u+m,n,o,f+m,i))}return function(u,f,m,_,g,p){let b=m-f,x=p-g;if(ks<1e9&&Math.min(b,x)>16*ks)return Math.min(b,x)>64*ks?[new At(f,m,g,p)]:k0(u,f,m,_,g,p);let y=Math.ceil((b+x)/2);uu.reset(y),hu.reset(y);let v=(E,I)=>u.charCodeAt(f+E)==_.charCodeAt(g+I),S=(E,I)=>u.charCodeAt(m-E-1)==_.charCodeAt(p-I-1),k=(b-x)%2!=0?hu:null,N=k?null:uu;for(let E=0;E<y;E++){if(E>ks)return k0(u,f,m,_,g,p);let I=uu.advance(E,b,x,y,k,!1,v)||hu.advance(E,b,x,y,N,!0,S);if(I)return KE(u,f,m,f+I[0],_,g,p,g+I[1])}return[new At(f,m,g,p)]}(t,e,n,o,r,i)}let ks=1e9;class x0{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,i,s,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=d-l;for(;d<n&&u<o&&a(d,u);)d++,u++;if(this.vec[c]=d,d>n)this.end+=2;else if(u>o)this.start+=2;else if(i){let f=r+(n-o)-l;if(f>=0&&f<this.len&&i.vec[f]!=-1){if(s){let m=i.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-i.vec[f])return[d,u]}}}return null}}const uu=new x0,hu=new x0;function KE(t,e,n,o,r,i,s,a){let l=!1;return qr(t,o)||++o!=n||(l=!0),qr(r,a)||++a!=s||(l=!0),l?[new At(e,n,i,s)]:_r(t,e,o,r,i,a).concat(_r(t,o,n,r,a,s))}function w0(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function fu(t,e,n,o,r,i){if(e==n||e==i||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let s=w0(n-e,i-r);for(let a=e,l=r;;){let c=a+s,d=l+s;if(c>n||d>i||t.slice(a,c)!=o.slice(l,d)){if(s==1)return a-e-(qr(t,a)?0:1);s>>=1}else{if(c==n||d==i)return c-e;a=c,l=d}}}function mu(t,e,n,o,r,i){if(e==n||r==i||t.charCodeAt(n-1)!=o.charCodeAt(i-1))return 0;let s=w0(n-e,i-r);for(let a=n,l=i;;){let c=a-s,d=l-s;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(s==1)return n-a-(qr(t,a)?0:1);s>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function pu(t,e,n,o,r,i,s,a){let l=o.slice(r,i),c=null;for(;;){if(c||s<a)return c;for(let d=e+s;;){qr(t,d)||d++;let u=d+s;if(qr(t,u)||(u+=u==d+1?1:-1),u>=n)break;let f=t.slice(d,u),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let _=fu(t,u,n,o,r+m+f.length,i),g=mu(t,e,d,o,r,r+m),p=f.length+_+g;(!c||c[2]<p)&&(c=[d-g,r+m-g,p])}d=u}if(a<0)return c;s>>=1}}function v0(t,e,n,o,r,i){let s=n-e,a=i-r;if(s<a){let l=v0(o,r,i,t,e,n);return l&&[l[1],l[0],l[2]]}return s<4||2*a<s?null:pu(t,e,n,o,r,i,Math.floor(s/4),-1)}function k0(t,e,n,o,r,i){let s,a=n-e,l=i-r;if(a<l){let f=pu(o,r,i,t,e,n,Math.floor(a/6),50);s=f&&[f[1],f[0],f[2]]}else s=pu(t,e,n,o,r,i,Math.floor(l/6),50);if(!s)return[new At(e,n,r,i)];let[c,d,u]=s;return _r(t,e,c,o,r,d).concat(_r(t,c+u,n,o,d+u,i))}function S0(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new At(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let br;try{br=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function C0(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function N0(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?C0(n)?1:0:br?A0(n)&&e!=t.length-1?br.test(t.slice(e,e+2))?2:0:br.test(String.fromCharCode(n))?1:0:0}function j0(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?C0(n)?1:0:br?T0(n)&&e!=1?br.test(t.slice(e-2,e))?2:0:br.test(String.fromCharCode(n))?1:0:0}function E0(t,e,n){if(e==t.length||!j0(t,e))return e;for(let o=e,r=e+n;;){let i=N0(t,o);if(!i)return o;if(o+=i,o>r)return e}}function I0(t,e,n){if(!e||!N0(t,e))return e;for(let o=e,r=e-n;;){let i=j0(t,o);if(!i)return o;if(o-=i,o<r)return e}}function XE(t,e,n){for(let o=e,r=e-n;;){let i=o?t.charCodeAt(o-1):10;if(i==10)return o;if(o--,o<r||i!=32&&i!=9)return e}}const A0=t=>t>=55296&&t<=56319,T0=t=>t>=56320&&t<=57343;function qr(t,e){return!e||e==t.length||!A0(t.charCodeAt(e-1))||!T0(t.charCodeAt(e))}function ZE(t,e,n){var o;return ks=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,i,s){for(;;){S0(s,1);let a=!1;for(let l=0;l<s.length;l++){let c,d,u=s[l];(c=fu(r,u.fromA,u.toA,i,u.fromB,u.toB))&&(u=s[l]=new At(u.fromA+c,u.toA,u.fromB+c,u.toB)),(d=mu(r,u.fromA,u.toA,i,u.fromB,u.toB))&&(u=s[l]=new At(u.fromA,u.toA-d,u.fromB,u.toB-d));let f=u.toA-u.fromA,m=u.toB-u.fromB;if(f&&m)continue;let _=u.fromA-(l?s[l-1].toA:0),g=(l<s.length-1?s[l+1].fromA:r.length)-u.toA;if(!_||!g)continue;let p=f?r.slice(u.fromA,u.toA):i.slice(u.fromB,u.toB);_<=p.length&&r.slice(u.fromA-_,u.fromA)==p.slice(p.length-_)?(s[l]=new At(u.fromA-_,u.toA-_,u.fromB-_,u.toB-_),a=!0):g<=p.length&&r.slice(u.toA,u.toA+g)==p.slice(0,g)&&(s[l]=new At(u.fromA+g,u.toA+g,u.fromB+g,u.toB+g),a=!0)}if(!a)break}return s}(t,e,_r(t,0,t.length,e,0,e.length))}function M0(t,e,n){return function(o,r,i){for(let s=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let u=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-s,m=u-l.toA,_=I0(r,l.fromA,Math.min(f,5)),g=E0(r,l.toA,Math.min(m,5)),p=l.fromA-_,b=g-l.toA;if(!c||!d){let x,y,v=Math.max(c,d),[S,k,N]=c?[r,l.fromA,l.toA]:[i,l.fromB,l.toB];p&&b?(v>p&&r.slice(_,l.fromA)==S.slice(N-p,N)?(l=o[a]=new At(_,_+c,l.fromB-p,l.toB-p),_=l.fromA,g=E0(r,l.toA,Math.min(u-l.toA,5))):v>b&&r.slice(l.toA,g)==S.slice(k,k+b)&&(l=o[a]=new At(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=I0(r,l.fromA,Math.min(l.fromA-s,5))),p=l.fromA-_,b=g-l.toA):p||b||!(y=l.fromA-(x=XE(r,l.fromA,f)))||r.slice(x,l.fromA)!=S.slice(N-y,N)||(l=o[a]=new At(x,x+c,l.fromB-y,l.toB-y))}(p||b)&&(l=o[a]=new At(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b)),s=l.toA}}return S0(o,3),o}(ZE(t,e,n),t,e)}const eo=Ui.define({combine:t=>t[0]}),gu=Gt.define(),Gr=Un.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(gu)&&(t=n.value);return t}});class Yr{constructor(e,n,o,r,i){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=i}offset(e,n){return e||n?new Yr(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return R0(M0(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,i){return F0(L0(e,r,!0,o.length),e,n,o,i)}static updateB(e,n,o,r,i){return F0(L0(e,r,!1,n.length),e,n,o,i)}}function O0(t,e,n,o){let r=n.lineAt(t),i=o.lineAt(e);return r.to==t&&i.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,i.from]}function D0(t,e,n,o){let r=n.lineAt(t),i=o.lineAt(e);return r.from==t&&i.from==e?[t,e]:[r.to+1,i.to+1]}function R0(t,e,n,o,r){let i=[];for(let s=0;s<t.length;s++){let a=t[s],[l,c]=O0(a.fromA+o,a.fromB+r,e,n),[d,u]=D0(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;s<t.length-1;){let m=t[s+1],[_,g]=O0(m.fromA+o,m.fromB+r,e,n);if(_>d+1&&g>u+1)break;f.push(m.offset(-l+o,-c+r)),[d,u]=D0(m.toA+o,m.toB+r,e,n),s++}i.push(new Yr(f,l,Math.max(l,d),c,Math.max(c,u)))}return i}const ml=1e3;function P0(t,e,n,o){let r=0,i=t.length;for(;;){if(r==i){let d=0,u=0;r&&({toA:d,toB:u}=t[r-1]);let f=e-(n?d:u);return[d+f,u+f]}let s=r+i>>1,a=t[s],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)i=s;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=s+1}}}function L0(t,e,n,o){let r=[];return e.iterChangedRanges((i,s,a,l)=>{let c=0,d=n?e.length:o,u=0,f=n?o:e.length;i>ml&&([c,u]=P0(t,i-ml,n,!0)),s<e.length-ml&&([d,f]=P0(t,s+ml,n,!1));let m,_=l-a-(s-i),[g,p]=n?[_,0]:[0,_];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:u,toB:f,diffA:g,diffB:p})}),r}function F0(t,e,n,o,r){if(!t.length)return e;let i=0,s=0,a=0,l=[];for(let c of t){let d=c.fromA+s,u=c.toA+s+c.diffA,f=c.fromB+a,m=c.toB+a+c.diffB;for(;i<e.length;){let _=e[i];if(_.toA+s<=d&&_.toB+a<=f)l.push(_.offset(s,a));else if(_.fromA+s>u)break;i++}for(let _ of R0(M0(n.sliceString(d,u),o.sliceString(f,m),r),n,o,d,f))l.push(_);for(s+=c.diffA,a+=c.diffB;i<e.length;){let _=e[i];if(_.fromA>u+s&&_.fromB>m+a)break;i++}}for(;i<e.length;)l.push(e[i++].offset(s,a));return l}const z0=Lo.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=V0(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Gr,!1)!=n.field(Gr,!1))||function(o,r){return o.facet(eo)!=r.facet(eo)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=V0(t.view))}},{decorations:t=>t.deco}),pl=sr.low(IB({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(z0))===null||e===void 0?void 0:e.gutter)||Am.empty}})),B0=dt.line({class:"cm-changedLine"}),QE=dt.mark({class:"cm-changedText"}),e5=dt.mark({tagName:"ins",class:"cm-insertedLine"}),t5=dt.mark({tagName:"del",class:"cm-deletedLine"}),U0=new class extends AB{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function n5(t,e,n,o,r,i){let s=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(s!=a){r.add(s,s,B0),r.add(s,a,n?t5:e5),i&&i.add(s,s,U0);for(let c=e.iterRange(s,a-1),d=s;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,B0),i&&i.add(d,d,U0);continue}let u=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=s+(n?f.fromA:f.fromB),_=s+(n?f.toA:f.toB),g=Math.max(d,m),p=Math.min(u,_);if(g<p&&r.add(g,p,QE),!(_<u))break;l++}d=u}}}function V0(t){let e=t.state.field(Gr),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(eo),i=n=="a",s=new zi,a=r?new zi:null,{from:l,to:c}=t.viewport;for(let d of e){if((i?d.fromA:d.fromB)>=c)break;(i?d.toA:d.toB)>l&&n5(d,t.state.doc,i,o,s,a)}return{deco:s.finish(),gutter:a&&a.finish()}}class gl extends Vi{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 _l=Gt.define({map:(t,e)=>t.map(e)}),Ss=Un.define({create:()=>dt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(_l))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),_u=.01,bu=Gt.define({map:(t,e)=>e.mapPos(t)});class o5 extends Vi{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:bu.of(r)});let{side:i,sibling:s}=e.state.facet(eo);s&&s().dispatch({effects:bu.of(r5(r,e.state.field(Gr),i=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function r5(t,e,n){let o=0,r=0;for(let i=0;;i++){let s=i<e.length?e[i]:null;if(!s||(n?s.fromA:s.fromB)>=t)return r+(t-o);[o,r]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const i5=Un.define({create:t=>dt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(bu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function $0({margin:t=3,minSize:e=4}){return i5.init(n=>function(o,r,i){let s=new zi,a=o.facet(eo).side=="a",l=o.field(Gr),c=1;for(let d=0;;d++){let u=d<l.length?l[d]:null,f=d?c+r:1,m=u?o.doc.lineAt(a?u.fromA:u.fromB).number-1-r:o.doc.lines,_=m-f+1;if(_>=i&&s.add(o.doc.line(f).from,o.doc.line(m).to,dt.replace({widget:new o5(_),block:!0})),!u)break;c=o.doc.lineAt(Math.min(o.doc.length,a?u.toA:u.toB)).number}return s.finish()}(n,t,e))}const s5=st.styleModule.of(new EB({".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"}})),a5=st.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer"},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"}}),H0=new xm,bl=new xm;class W0{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[sr.low(z0),a5,s5,Ss,st.updateListener.of(u=>{this.measuring<0&&(u.heightChanged||u.viewportChanged)&&!u.transactions.some(f=>f.effects.some(m=>m.is(_l)))&&this.measure()})],o=[eo.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(pl);let r=aa.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),bl.of(o),n]}),i=[eo.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(pl);let s=aa.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),bl.of(i),n]});this.chunks=Yr.build(r.doc,s.doc,this.diffConf);let a=[Gr.init(()=>this.chunks),H0.of(e.collapseUnchanged?$0(e.collapseUnchanged):[])];r=r.update({effects:Gt.appendConfig.of(a)}).state,s=s.update({effects:Gt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new st({state:r,parent:c,root:e.root,dispatchTransactions:u=>this.dispatch(u,this.a)}),this.b=new st({state:s,parent:d,root:e.root,dispatchTransactions:u=>this.dispatch(u,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((s,a)=>s.compose(a.changes),ia.empty(e[0].startState.doc.length));this.chunks=n==this.a?Yr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Yr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:gu.of(this.chunks)})]);let i=n==this.a?this.b:this.a;i.update([i.state.update({effects:gu.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let i=e.orientation!="b-a";if(i!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,a=this.b.dom.parentNode;s.remove(),a.remove(),this.editorDOM.insertBefore(i?s:a,this.editorDOM.firstChild),this.editorDOM.appendChild(i?a:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let i=!!this.revertDOM,s=this.revertToA,a=this.renderRevert;"revertControls"in e&&(i=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(i,s,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let i=[],s=[];if(n||o){let a=this.a.state.facet(eo),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;i.push(bl.reconfigure([eo.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?pl:[]])),s.push(bl.reconfigure([eo.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?pl:[]]))}if(r){let a=H0.reconfigure(e.collapseUnchanged?$0(e.collapseUnchanged):[]);i.push(a),s.push(a)}this.a.dispatch({effects:i}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new zi,i=new zi,s=e.state.field(Ss).iter(),a=n.state.field(Ss).iter(),l=0,c=0,d=0,u=0;for(let g=0;;g++){let p=g<o.length?o[g]:null;if(l<(p?p.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+u);b<-.01?(d-=b,r.add(l,l,dt.widget({widget:new gl(-b),block:!0,side:-1}))):b>_u&&(u+=b,i.add(c,c,dt.widget({widget:new gl(b),block:!0,side:-1})))}if(!p)break;for(l=p.toA,c=p.toB;s.value&&s.from<l;)d-=s.value.spec.widget.height,s.next();for(;a.value&&a.from<c;)u-=a.value.spec.widget.height,a.next()}for(;s.value;)d-=s.value.spec.widget.height,s.next();for(;a.value;)u-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+u);f<_u?r.add(e.state.doc.length,e.state.doc.length,dt.widget({widget:new gl(-f),block:!0,side:1})):f>_u&&i.add(n.state.doc.length,n.state.doc.length,dt.widget({widget:new gl(f),block:!0,side:1}));let m=r.finish(),_=i.finish();Am.eq([m],[e.state.field(Ss)])||e.dispatch({effects:_l.of(m)}),Am.eq([_],[n.state.field(Ss)])||n.dispatch({effects:_l.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let s=this.chunks[i];if(s.fromA>o.to||s.fromB>r.to)break;if(s.fromA<o.from||s.fromB<r.from)continue;let a=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<i;)n=q0(n);n&&n.dataset.chunk==String(i)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,i),n)}for(;n;)n=q0(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,i,s,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(s,Math.max(s,a-1));s!=a&&c<=i.state.doc.length&&(d+=r.state.lineBreak),i.dispatch({changes:{from:l,to:Math.min(i.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function q0(t){let e=t.nextSibling;return t.remove(),e}var l5=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],c5=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],G0=K.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:i,highlightChanges:s,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:u}=t,f=ma(t,l5),m=du(),{modified:_,modifiedExtension:g,original:p,originalExtension:b,theme:x,dispatch:y}=m,v=ma(m,c5),S=A.useRef(null),k=A.useRef(),N={orientation:r,revertControls:i,highlightChanges:s,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:u};A.useImperativeHandle(e,()=>({container:S.current,view:k.current,modified:_,original:p,config:jt({a:p,b:_,parent:S.current},N)}),[S,k,_,p,N]);var E=st.updateListener.of(T=>{if(T.docChanged&&typeof(b==null?void 0:b.onChange)=="function"){var M=T.state.doc.toString();b==null||b.onChange(M,T)}}),I=st.updateListener.of(T=>{if(T.docChanged&&typeof(g==null?void 0:g.onChange)=="function"){var M=T.state.doc.toString();g==null||g.onChange(M,T)}});return A.useEffect(()=>{!k.current&&S.current&&b&&g&&(k.current=new W0(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...qi(jt({},b==null?void 0:b.option,{theme:x})),E]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...qi(jt({},g==null?void 0:g.option,{theme:x})),I]}),parent:S.current},N)),y({view:k.current}))},[k,S,b,g]),A.useEffect(()=>{if(p&&p.doc&&k.current){var T,M,R=(T=k.current)==null?void 0:T.a.state.doc.toString();R!==p.doc&&((M=k.current)==null||M.a.dispatch({changes:{from:0,to:R.length,insert:p.doc||""}}))}if(_&&_.doc&&k.current){var B,O,z=(B=k.current)==null?void 0:B.b.state.doc.toString();z!==_.doc&&((O=k.current)==null||O.b.dispatch({changes:{from:0,to:z.length,insert:_.doc||""}}))}if(c&&k.current){var F=k.current.a.state.selection.ranges[0].from,V=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new W0(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...qi(jt({},b==null?void 0:b.option,{theme:x}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...qi(jt({},g==null?void 0:g.option,{theme:x}))]}),parent:S.current},N)),F&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:F,head:F}})),V&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:V,head:V}}))}},[k,x,S.current,p,_,b,g,c]),A.useEffect(()=>()=>k.current&&k.current.destroy(),[]),A.useEffect(()=>{if(k.current){var T={};v.orientation!==r&&(T.orientation=r),v.revertControls!==i&&(T.revertControls=i),v.highlightChanges!==s&&(T.highlightChanges=s),v.gutter!==a&&(T.gutter=a),v.collapseUnchanged!==l&&(T.collapseUnchanged=l),v.renderRevertControl!==d&&(T.collapseUnchanged=l),Object.keys(T).length&&y&&k.current&&(k.current.reconfigure(jt({},T)),y(jt({},T)))}},[y,k,r,i,s,a,l,d]),h.jsx("div",jt({ref:S,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});G0.displayName="CodeMirrorMerge.Internal";var d5=["theme"],Jr=K.forwardRef((t,e)=>{var{theme:n}=t,o=ma(t,d5);return h.jsx(GE,{theme:n,children:h.jsx(G0,jt({},o,{ref:e}))})});Jr.Original=b0,Jr.Modified=y0,Jr.displayName="CodeMirrorMerge";const u5=Jr.Original,h5=Jr.Modified,Y0=[MB(),st.lineWrapping],f5=t=>{const e=X.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:i,currentCode:s,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];const[f,m]=A.useState(u),[_,g]=yn(bS),{completion:p,input:b,stop:x,isLoading:y,setCompletion:v,setInput:S,handleSubmit:k}=TB({api:km("api/ai/completion").toString(),headers:xc.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?bc(s):"",code:s,language:i},onError:m5,onFinish:(Y,Z)=>{N(Z.trimEnd())}}),N=v,E=K.useRef(null);let I,T,M,R;e[1]!==c?(I=()=>{const Y=E.current;c&&Y&&(requestAnimationFrame(()=>{var Z;(Z=Y.view)==null||Z.focus()}),OB(E.current.view))},T=[c],e[1]=c,e[2]=I,e[3]=T):(I=e[2],T=e[3]),A.useEffect(I,T),e[4]!==c||e[5]!==r||e[6]!==S?(M=()=>{c&&S(r||"")},R=[c,r,S],e[4]=c,e[5]=r,e[6]=S,e[7]=M,e[8]=R):(M=e[7],R=e[8]),A.useEffect(M,R);const{theme:B}=ho();let O;e[9]!==n?(O=Te("flex flex-col w-full rounded-[inherit] overflow-hidden",n),e[9]=n,e[10]=O):O=e[10];const z=c&&"max-h-[400px] min-h-11 visible",F=!c&&"max-h-0 min-h-0 invisible";let V,L,C,$;e[11]!==z||e[12]!==F?(V=Te("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300 overflow-hidden",z,F),e[11]=z,e[12]=F,e[13]=V):V=e[13],e[14]!==l||e[15]!==p||e[16]!==a||e[17]!==c||e[18]!==k||e[19]!==_||e[20]!==b||e[21]!==y||e[22]!==N||e[23]!==g||e[24]!==S||e[25]!==x||e[26]!==B?(L=c&&h.jsxs(h.Fragment,{children:[h.jsx(Ks,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),h.jsx(Ec,{inputRef:E,theme:B,onClose:()=>{a(),N("")},value:b,onChange:Y=>{S(Y),m(h4({input:Y}))},onSubmit:()=>{y||k()}}),y&&h.jsxs(De,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[h.jsx(Ic,{className:"animate-spin mr-1",size:14}),"Stop"]}),!y&&p&&h.jsx(De,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:y,onClick:()=>{l(p),N("")},children:h.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),h.jsx("div",{className:"h-full w-px bg-border mx-2"}),h.jsx(Me,{content:"Include code from other cells",children:h.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[h.jsx(f4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:Y=>g(!!Y)}),h.jsx(Nr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),h.jsx(De,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:y,onClick:()=>{x(),a(),N("")},children:h.jsx(Jn,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=p,e[16]=a,e[17]=c,e[18]=k,e[19]=_,e[20]=b,e[21]=y,e[22]=N,e[23]=g,e[24]=S,e[25]=x,e[26]=B,e[27]=L):L=e[27],e[28]!==V||e[29]!==L?(C=h.jsx("div",{className:V,children:L}),e[28]=V,e[29]=L,e[30]=C):C=e[30],e[31]!==p||e[32]!==s||e[33]!==c||e[34]!==o||e[35]!==B?($=p&&c&&h.jsxs(Jr,{className:"cm",theme:B,children:[h.jsx(u5,{onChange:o,value:s,extensions:Y0}),h.jsx(h5,{value:p,editable:!1,readOnly:!0,extensions:Y0})]}),e[31]=p,e[32]=s,e[33]=c,e[34]=o,e[35]=B,e[36]=$):$=e[36];const j=(!p||!c)&&d;let H;return e[37]!==C||e[38]!==$||e[39]!==j||e[40]!==O?(H=h.jsxs("div",{className:O,children:[C,$,j]}),e[37]=C,e[38]=$,e[39]=j,e[40]=O,e[41]=H):H=e[41],H};function m5(t){lt({title:"Completion failed",description:u4(t)})}const p5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function yu(t){w=t}const St=new Array(128).fill(void 0);function be(t){return St[t]}St.push(void 0,null,!0,!1);let qe=0,yl=null;function Kr(){return yl!==null&&yl.byteLength!==0||(yl=new Uint8Array(w.memory.buffer)),yl}let xl=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const g5=typeof xl.encodeInto=="function"?function(t,e){return xl.encodeInto(t,e)}:function(t,e){const n=xl.encode(t);return e.set(n),{read:t.length,written:n.length}};function ft(t,e,n){if(n===void 0){const a=xl.encode(t),l=e(a.length,1)>>>0;return Kr().subarray(l,l+a.length).set(a),qe=a.length,l}let o=t.length,r=e(o,1)>>>0;const i=Kr();let s=0;for(;s<o;s++){const a=t.charCodeAt(s);if(a>127)break;i[r+s]=a}if(s!==o){s!==0&&(t=t.slice(s)),r=n(r,o,o=s+3*t.length,1)>>>0;const a=Kr().subarray(r+s,r+o);s+=g5(t,a).written,r=n(r,o,s,1)>>>0}return qe=s,r}let Xr=null;function P(){return(Xr===null||Xr.buffer.detached===!0||Xr.buffer.detached===void 0&&Xr.buffer!==w.memory.buffer)&&(Xr=new DataView(w.memory.buffer)),Xr}let Cs=St.length;function se(t){Cs===St.length&&St.push(St.length+1);const e=Cs;return Cs=St[e],St[e]=t,e}function Kt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(se(n))}}let J0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function Tt(t,e){return t>>>=0,J0.decode(Kr().subarray(t,t+e))}function W(t){const e=be(t);return function(n){n<132||(St[n]=Cs,Cs=n)}(t),e}function Tn(t){return t==null}J0.decode();const K0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function X0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},i=(...s)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...s)}finally{--r.cnt==0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),K0.unregister(r)):r.a=a}};return i.original=r,K0.register(i,r,r),i}function xu(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let i="[";r>0&&(i+=xu(t[0]));for(let s=1;s<r;s++)i+=", "+xu(t[s]);return i+="]",i}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
111
- ${t.stack}`:o}function to(t,e){return t>>>=0,Kr().subarray(t/1,t/1+e)}function qo(t,e){const n=e(1*t.length,1)>>>0;return Kr().set(t,n/1),qe=t.length,n}function Mn(t,e){t>>>=0;const n=P(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(W(n.getUint32(r,!0)));return o}function wn(t,e){const n=e(4*t.length,4)>>>0,o=P();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,se(t[r]),!0);return qe=t.length,n}let Xt=128;function pn(t){if(Xt==1)throw new Error("out of js stack");return St[--Xt]=t,Xt}function Zr(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function _5(t,e,n){w.__wbindgen_export_5(t,e,se(n))}function b5(t,e){w.__wbindgen_export_6(t,e)}const Z0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class Q0{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Z0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(se(e),n);return this.__wbg_ptr=o>>>0,Z0.register(this,this.__wbg_ptr,this),this}encode(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encode(i,this.__wbg_ptr,se(e));var n=P().getInt32(i+0,!0),o=P().getInt32(i+4,!0),r=to(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(e,w.__wbindgen_export_0),s=qe;w.awarenesswasm_apply(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,se(e))}peer(){return W(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return W(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return W(w.awarenesswasm_getState(this.__wbg_ptr,se(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getFloat64(r+8,!0);return n===0?void 0:o}finally{w.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return w.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}peers(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_peers(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const eb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class Qr{static __wrap(e){e>>>=0;const n=Object.create(Qr.prototype);return n.__wbg_ptr=e,eb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,eb.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_changemodifier_free(e,0)}setMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return Qr.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return Qr.__wrap(n)}}const tb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class po{static __wrap(e){e>>>=0;const n=Object.create(po.prototype);return n.__wbg_ptr=e,tb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,tb.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return W(w.cursor_containerId(this.__wbg_ptr))}pos(){return W(w.cursor_pos(this.__wbg_ptr))}side(){return W(w.cursor_side(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.cursor_encode(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(e,w.__wbindgen_export_0),s=qe;w.cursor_decode(r,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return po.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return W(w.cursor_kind(this.__wbg_ptr))}}const nb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class Ns{static __wrap(e){e>>>=0;const n=Object.create(Ns.prototype);return n.__wbg_ptr=e,wu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,wu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorocounter_free(e,0)}constructor(){const e=w.lorocounter_new();return this.__wbg_ptr=e>>>0,wu.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorocounter_kind(this.__wbg_ptr))}get id(){return W(w.lorocounter_id(this.__wbg_ptr))}increment(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_increment(o,this.__wbg_ptr,e);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_decrement(o,this.__wbg_ptr,e);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get value(){return w.lorocounter_value(this.__wbg_ptr)}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class go{static __wrap(e){e>>>=0;const n=Object.create(go.prototype);return n.__wbg_ptr=e,vu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,vu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorodoc_free(e,0)}constructor(){const e=w.lorodoc_new();return this.__wbg_ptr=e>>>0,vu.register(this,this.__wbg_ptr,this),this}setDetachedEditing(e){w.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}isDetachedEditingEnabled(){return w.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}setRecordTimestamp(e){w.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}setChangeMergeInterval(e){w.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}configTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configTextStyle(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}configDefaultTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configDefaultTextStyle(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}static fromSnapshot(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(e,w.__wbindgen_export_0),s=qe;w.lorodoc_fromSnapshot(r,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return go.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}attach(){w.lorodoc_attach(this.__wbg_ptr)}isDetached(){return w.lorodoc_isDetached(this.__wbg_ptr)!==0}detach(){w.lorodoc_detach(this.__wbg_ptr)}fork(){const e=w.lorodoc_fork(this.__wbg_ptr);return go.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_forkAt(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return go.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_checkoutToLatest(n,this.__wbg_ptr);var e=P().getInt32(n+0,!0);if(P().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,i,s,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_findIdSpansBetween(i,this.__wbg_ptr,s,a,l,c);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_checkout(o,this.__wbg_ptr,r,i);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get peerId(){const e=w.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}get peerIdStr(){return W(w.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setPeerId(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}commit(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_commit(o,this.__wbg_ptr,Tn(e)?0:se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return w.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}getText(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getText(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return yr.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return ei.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return js.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return Es.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return Ns.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return Is.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,se(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.lorodoc_setNextCommitOrigin(this.__wbg_ptr,n,o)}setNextCommitTimestamp(e){w.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setNextCommitOptions(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setNextCommitOptions(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return W(w.lorodoc_getDeepValueWithID(this.__wbg_ptr))}getPathToContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getPathToContainer(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorodoc_JSONPath(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return On.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return On.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return W(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return On.__wrap(e)}frontiers(){return W(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return W(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return n}finally{w.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_cmpFrontiers(i,this.__wbg_ptr,s,a,l,c);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportSnapshot(){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportSnapshot(i,this.__wbg_ptr);var e=P().getInt32(i+0,!0),n=P().getInt32(i+4,!0),o=P().getInt32(i+8,!0);if(P().getInt32(i+12,!0))throw W(o);var r=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportFrom(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportFrom(s,this.__wbg_ptr,se(e));var n=P().getInt32(s+0,!0),o=P().getInt32(s+4,!0),r=P().getInt32(s+8,!0);if(P().getInt32(s+12,!0))throw W(r);var i=to(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}export(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_export(s,this.__wbg_ptr,se(e));var n=P().getInt32(s+0,!0),o=P().getInt32(s+4,!0),r=P().getInt32(s+8,!0);if(P().getInt32(s+12,!0))throw W(r);var i=to(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonUpdates(s,this.__wbg_ptr,se(e),se(n),Tn(o)?16777215:o?1:0);var r=P().getInt32(s+0,!0),i=P().getInt32(s+4,!0);if(P().getInt32(s+8,!0))throw W(i);return W(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importJsonUpdates(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importJsonUpdates(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}import(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(e,w.__wbindgen_export_0),s=qe;w.lorodoc_import(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getShallowValue(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_toJSON(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return W(w.lorodoc_subscribe(this.__wbg_ptr,se(e)))}subscribeLocalUpdates(e){return W(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,se(e)))}debugHistory(){w.lorodoc_debugHistory(this.__wbg_ptr)}changeCount(){return w.lorodoc_changeCount(this.__wbg_ptr)>>>0}opCount(){return w.lorodoc_opCount(this.__wbg_ptr)>>>0}getAllChanges(){return W(w.lorodoc_getAllChanges(this.__wbg_ptr))}getChangeAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangeAt(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=qe;w.lorodoc_getChangeAtLamport(i,this.__wbg_ptr,s,a,n);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getOpsInChange(s,this.__wbg_ptr,se(e));var n=P().getInt32(s+0,!0),o=P().getInt32(s+4,!0),r=P().getInt32(s+8,!0);if(P().getInt32(s+12,!0))throw W(r);var i=Mn(n,o).slice();return w.__wbindgen_export_3(n,4*o,4),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}frontiersToVV(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return On.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);Zr(e,On),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);Zr(e,po),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,n){try{const a=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangedContainersIn(a,this.__wbg_ptr,se(e),n);var o=P().getInt32(a+0,!0),r=P().getInt32(a+4,!0),i=P().getInt32(a+8,!0);if(P().getInt32(a+12,!0))throw W(i);var s=Mn(o,r).slice();return w.__wbindgen_export_3(o,4*r,4),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_revertTo(o,this.__wbg_ptr,r,i);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDiff(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_applyDiff(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16),a=wn(e,w.__wbindgen_export_0),l=qe,c=wn(n,w.__wbindgen_export_0),d=qe;w.lorodoc_diff(s,this.__wbg_ptr,a,l,c,d,Tn(o)?16777215:o?1:0);var r=P().getInt32(s+0,!0),i=P().getInt32(s+4,!0);if(P().getInt32(s+8,!0))throw W(i);return W(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getUncommittedOpsAsJson(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getUncommittedOpsAsJson(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return W(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,se(e)))}subscribePreCommit(e){return W(w.lorodoc_subscribePreCommit(this.__wbg_ptr,se(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setHideEmptyRootContainers(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setHideEmptyRootContainers(o,this.__wbg_ptr,e);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class js{static __wrap(e){e>>>=0;const n=Object.create(js.prototype);return n.__wbg_ptr=e,ku.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ku.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorolist_free(e,0)}constructor(){const e=w.lorolist_new();return this.__wbg_ptr=e>>>0,ku.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorolist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insert(r,this.__wbg_ptr,e,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_delete(r,this.__wbg_ptr,e,n);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.lorolist_get(this.__wbg_ptr,e))}get id(){return W(w.lorolist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_toArray(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(w.lorolist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insertContainer(i,this.__wbg_ptr,e,se(n));var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pushContainer(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return W(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:po.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pop(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_clear(n,this.__wbg_ptr);var e=P().getInt32(n+0,!0);if(P().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return W(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.lorolist_getShallowValue(this.__wbg_ptr))}}const Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromap_free(t>>>0,1));class ei{static __wrap(e){e>>>=0;const n=Object.create(ei.prototype);return n.__wbg_ptr=e,Su.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Su.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromap_free(e,0)}constructor(){const e=w.loromap_new();return this.__wbg_ptr=e>>>0,Su.register(this,this.__wbg_ptr,this),this}kind(){return W(w.loromap_kind(this.__wbg_ptr))}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.loromap_set(r,this.__wbg_ptr,i,s,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=qe;w.loromap_delete(o,this.__wbg_ptr,r,i);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.loromap_get(this.__wbg_ptr,n,o))}getOrCreateContainer(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=qe;w.loromap_getOrCreateContainer(i,this.__wbg_ptr,s,a,se(n));var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}keys(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_keys(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}values(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_values(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}entries(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_entries(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return W(w.loromap_id(this.__wbg_ptr))}toJSON(){return W(w.loromap_toJSON(this.__wbg_ptr))}setContainer(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=qe;w.loromap_setContainer(i,this.__wbg_ptr,s,a,se(n));var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return W(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.loromap_getAttached(this.__wbg_ptr))}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_clear(n,this.__wbg_ptr);var e=P().getInt32(n+0,!0);if(P().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromap_getShallowValue(this.__wbg_ptr))}}const Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class Es{static __wrap(e){e>>>=0;const n=Object.create(Es.prototype);return n.__wbg_ptr=e,Cu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromovablelist_free(e,0)}constructor(){const e=w.loromovablelist_new();return this.__wbg_ptr=e>>>0,Cu.register(this,this.__wbg_ptr,this),this}kind(){return W(w.loromovablelist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insert(r,this.__wbg_ptr,e,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_delete(r,this.__wbg_ptr,e,n);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return W(w.loromovablelist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_toArray(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(w.loromovablelist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insertContainer(i,this.__wbg_ptr,e,se(n));var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pushContainer(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return W(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:po.__wrap(o)}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_move(r,this.__wbg_ptr,e,n);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_set(r,this.__wbg_ptr,e,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_setContainer(i,this.__wbg_ptr,e,se(n));var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_push(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pop(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_clear(n,this.__wbg_ptr);var e=P().getInt32(n+0,!0);if(P().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return W(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return W(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return W(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotext_free(t>>>0,1));class yr{static __wrap(e){e>>>=0;const n=Object.create(yr.prototype);return n.__wbg_ptr=e,Nu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotext_free(e,0)}constructor(){const e=w.lorotext_new();return this.__wbg_ptr=e>>>0,Nu.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorotext_kind(this.__wbg_ptr))}iter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_iter(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}update(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorotext_update(r,this.__wbg_ptr,i,s,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorotext_updateByLine(r,this.__wbg_ptr,i,s,se(n));var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorotext_insert(r,this.__wbg_ptr,e,i,s);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const u=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(u,this.__wbg_ptr,e,n);var i=P().getInt32(u+0,!0),s=P().getInt32(u+4,!0),a=P().getInt32(u+8,!0),l=P().getInt32(u+12,!0),c=i,d=s;if(l)throw c=0,d=0,W(a);return o=c,r=d,Tt(c,d)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(o,r,1)}}charAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_charAt(r,this.__wbg_ptr,e);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return String.fromCodePoint(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}splice(e,n,o){let r,i;try{const f=w.__wbindgen_add_to_stack_pointer(-16),m=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=qe;w.lorotext_splice(f,this.__wbg_ptr,e,n,m,_);var s=P().getInt32(f+0,!0),a=P().getInt32(f+4,!0),l=P().getInt32(f+8,!0),c=P().getInt32(f+12,!0),d=s,u=a;if(c)throw d=0,u=0,W(l);return r=d,i=u,Tt(d,u)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(r,i,1)}}insertUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,i,s);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_delete(r,this.__wbg_ptr,e,n);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}deleteUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_deleteUtf8(r,this.__wbg_ptr,e,n);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}mark(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),a=qe;w.lorotext_mark(i,this.__wbg_ptr,se(e),s,a,se(o));var r=P().getInt32(i+0,!0);if(P().getInt32(i+4,!0))throw W(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}unmark(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.lorotext_unmark(r,this.__wbg_ptr,se(e),i,s);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,n;try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_toString(i,this.__wbg_ptr);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return W(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return W(w.lorotext_id(this.__wbg_ptr))}get length(){return w.lorotext_length(this.__wbg_ptr)>>>0}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDelta(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_applyDelta(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:po.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=qe;w.lorotext_push(o,this.__wbg_ptr,r,i);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return W(w.lorotext_getEditorOf(this.__wbg_ptr,e))}isDeleted(){return w.lorotext_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){let e,n;try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_getShallowValue(i,this.__wbg_ptr);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return W(w.lorotext_toJSON(this.__wbg_ptr))}}const ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class Is{static __wrap(e){e>>>=0;const n=Object.create(Is.prototype);return n.__wbg_ptr=e,ju.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ju.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,ju.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorotree_kind(this.__wbg_ptr))}createNode(e,n){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_createNode(i,this.__wbg_ptr,pn(e),Tn(n)?4294967297:n>>>0);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);if(P().getInt32(i+8,!0))throw W(r);return no.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}move(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(i,this.__wbg_ptr,pn(e),pn(n),Tn(o)?4294967297:o>>>0);var r=P().getInt32(i+0,!0);if(P().getInt32(i+4,!0))throw W(r)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0,St[Xt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,pn(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,pn(e));return n===0?void 0:no.__wrap(n)}finally{St[Xt++]=void 0}}get id(){return W(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,pn(e))!==0}finally{St[Xt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,pn(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_getNodes(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(w.lorotree_toJSON(this.__wbg_ptr))}nodes(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_nodes(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}roots(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_roots(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=Mn(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_subscribe(r,this.__wbg_ptr,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorotree_getAttached(this.__wbg_ptr))}enableFractionalIndex(e){w.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){w.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return w.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}isDeleted(){return w.lorotree_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.lorotree_getShallowValue(this.__wbg_ptr))}}const ob=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class no{static __wrap(e){e>>>=0;const n=Object.create(no.prototype);return n.__wbg_ptr=e,ob.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ob.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,n;try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode___getClassname(i,this.__wbg_ptr);var o=P().getInt32(i+0,!0),r=P().getInt32(i+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return W(w.lorotreenode_id(this.__wbg_ptr))}createNode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_createNode(r,this.__wbg_ptr,Tn(e)?4294967297:e>>>0);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return no.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_move(r,this.__wbg_ptr,pn(e),Tn(n)?4294967297:n>>>0);var o=P().getInt32(r+0,!0);if(P().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16),St[Xt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);Zr(e,no),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);Zr(e,no),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}index(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_index(o,this.__wbg_ptr);var e=P().getFloat64(o+0,!0),n=P().getInt32(o+8,!0);if(P().getInt32(o+12,!0))throw W(n);return e===4294967297?void 0:e}finally{w.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_fractionalIndex(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get data(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_data(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return ei.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_toJSON(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_parent(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return e===0?void 0:no.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return W(w.lorotreenode_children(this.__wbg_ptr))}isDeleted(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_isDeleted(o,this.__wbg_ptr);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return W(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return W(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return W(w.lorotreenode_creator(this.__wbg_ptr))}}const rb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class On{static __wrap(e){e>>>=0;const n=Object.create(On.prototype);return n.__wbg_ptr=e,Eu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return this.__wbg_ptr=n>>>0,Eu.register(this,this.__wbg_ptr,this),this}finally{w.__wbindgen_add_to_stack_pointer(16)}}static parseJSON(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_parseJSON(r,se(e));var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return On.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(w.versionvector_toJSON(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_encode(r,this.__wbg_ptr);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(e,w.__wbindgen_export_0),s=qe;w.versionvector_decode(r,i,s);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return On.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_get(r,this.__wbg_ptr,se(e));var n=P().getFloat64(r+0,!0),o=P().getInt32(r+8,!0);if(P().getInt32(r+12,!0))throw W(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){Zr(e,On);const n=w.versionvector_compare(this.__wbg_ptr,e.__wbg_ptr);return n===4294967297?void 0:n}setEnd(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setEnd(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLast(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setLast(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}remove(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_remove(o,this.__wbg_ptr,se(e));var n=P().getInt32(o+0,!0);if(P().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function ib(t,e){const n=ft(String(be(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;P().setInt32(t+4,o,!0),P().setInt32(t+0,n,!0)}function sb(){return Kt(function(t,e,n){return se(Reflect.apply(be(t),be(e),be(n)))},arguments)}function ab(t){return se(be(t).buffer)}function lb(){return Kt(function(t,e){return se(be(t).call(be(e)))},arguments)}function cb(){return Kt(function(t,e,n){return se(be(t).call(be(e),be(n)))},arguments)}function db(){return Kt(function(t,e,n,o,r){return se(be(t).call(be(e),be(n),be(o),be(r)))},arguments)}function ub(){return Kt(function(t,e,n,o){return se(be(t).call(be(e),be(n),be(o)))},arguments)}function hb(t){return se(Qr.__wrap(t))}function fb(t){return se(be(t).crypto)}function mb(t){return se(po.__wrap(t))}function pb(t){return be(t).done}function gb(t){return se(be(t).entries())}function _b(t){return se(Object.entries(be(t)))}function bb(t,e){let n,o;try{n=t,o=e,console.error(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function yb(t,e){console.error(Tt(t,e))}function xb(t){return se(Array.from(be(t)))}function wb(){return Kt(function(t,e){be(t).getRandomValues(be(e))},arguments)}function vb(t,e){return se(be(t)[e>>>0])}function kb(){return Kt(function(t,e){return se(Reflect.get(be(t),be(e)))},arguments)}function Sb(t,e){return be(t)[e>>>0]}function Cb(t,e){return se(be(t)[be(e)])}function Nb(){return Kt(function(){return se(globalThis.globalThis)},arguments)}function jb(){return Kt(function(){return se(global.global)},arguments)}function Eb(t){let e;try{e=be(t)instanceof ArrayBuffer}catch{e=!1}return e}function Ib(t){let e;try{e=be(t)instanceof Map}catch{e=!1}return e}function Ab(t){let e;try{e=be(t)instanceof Object}catch{e=!1}return e}function Tb(t){let e;try{e=be(t)instanceof Uint8Array}catch{e=!1}return e}function Mb(t){return Array.isArray(be(t))}function Ob(t){return Number.isSafeInteger(be(t))}function Db(){return se(Symbol.iterator)}function Rb(t){return be(t).length}function Pb(t){return be(t).length}function Lb(t,e,n,o,r,i,s,a){let l,c;try{l=t,c=e,console.log(Tt(t,e),Tt(n,o),Tt(r,i),Tt(s,a))}finally{w.__wbindgen_export_3(l,c,1)}}function Fb(t,e){console.log(Tt(t,e))}function zb(t,e){let n,o;try{n=t,o=e,console.log(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function Bb(t){return se(Ns.__wrap(t))}function Ub(t){return se(js.__wrap(t))}function Vb(t){return se(ei.__wrap(t))}function $b(t){return se(Es.__wrap(t))}function Hb(t){return se(yr.__wrap(t))}function Wb(t){return se(Is.__wrap(t))}function qb(t){return se(no.__wrap(t))}function Gb(t,e){performance.mark(Tt(t,e))}function Yb(){return Kt(function(t,e,n,o){let r,i,s,a;try{r=t,i=e,s=n,a=o,performance.measure(Tt(t,e),Tt(n,o))}finally{w.__wbindgen_export_3(r,i,1),w.__wbindgen_export_3(s,a,1)}},arguments)}function Jb(t){return se(be(t).msCrypto)}function Kb(){return se(new Map)}function Xb(t){return se(new Uint8Array(be(t)))}function Zb(){return se(new Object)}function Qb(){return se(new Error)}function ey(){return se(new Array)}function ty(t,e){return se(new Function(Tt(t,e)))}function ny(t,e,n){return se(new Uint8Array(be(t),e>>>0,n>>>0))}function oy(t){return se(new Uint8Array(t>>>0))}function ry(t){return se(new Array(t>>>0))}function iy(t){return se(be(t).next)}function sy(){return Kt(function(t){return se(be(t).next())},arguments)}function ay(t){return se(be(t).node)}function ly(){return Date.now()}function cy(){return Kt(function(t){return se(Reflect.ownKeys(be(t)))},arguments)}function dy(t){return se(be(t).process)}function uy(t,e){return be(t).push(be(e))}function hy(){return Kt(function(t,e){be(t).randomFillSync(W(e))},arguments)}function fy(){return Kt(function(){return se(module.require)},arguments)}function my(t){return se(Promise.resolve(be(t)))}function py(){return Kt(function(){return se(self.self)},arguments)}function gy(){return Kt(function(t,e,n){return Reflect.set(be(t),be(e),be(n))},arguments)}function _y(t,e,n){return se(be(t).set(be(e),be(n)))}function by(t,e,n){be(t)[W(e)]=W(n)}function yy(t,e,n){be(t).set(be(e),n>>>0)}function xy(t,e,n){be(t)[e>>>0]=W(n)}function wy(t,e,n){be(t)[e>>>0]=n}function vy(t,e){const n=ft(be(e).stack,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;P().setInt32(t+4,o,!0),P().setInt32(t+0,n,!0)}function ky(t,e,n){return se(be(t).subarray(e>>>0,n>>>0))}function Sy(t,e){return se(be(t).then(be(e)))}function Cy(t){return se(be(t).value)}function Ny(t){return se(be(t).versions)}function jy(t){return se(On.__wrap(t))}function Ey(){return Kt(function(){return se(window.window)},arguments)}function Iy(t){return+be(t)}function Ay(t){return se(t)}function Ty(t){return se(BigInt.asUintN(64,t))}function My(t,e){const n=be(e),o=typeof n=="bigint"?n:void 0;P().setBigInt64(t+8,Tn(o)?BigInt(0):o,!0),P().setInt32(t+0,!Tn(o),!0)}function Oy(t){const e=be(t);return typeof e=="boolean"?e?1:0:2}function Dy(t){const e=W(t).original;return e.cnt--==1?(e.a=0,!0):!1}function Ry(t,e,n){return se(X0(t,e,10,_5))}function Py(t,e,n){return se(X0(t,e,8,b5))}function Ly(t,e){const n=ft(xu(be(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;P().setInt32(t+4,o,!0),P().setInt32(t+0,n,!0)}function Fy(t,e){return se(new Error(Tt(t,e)))}function zy(t,e){return be(t)in be(e)}function By(t){return Array.isArray(be(t))}function Uy(t){return typeof be(t)=="bigint"}function Vy(t){return!be(t)}function $y(t){return typeof be(t)=="function"}function Hy(t){return be(t)===null}function Wy(t){const e=be(t);return typeof e=="object"&&e!==null}function qy(t){return typeof be(t)=="string"}function Gy(t){return be(t)===void 0}function Yy(t,e){return be(t)===be(e)}function Jy(t,e){return be(t)==be(e)}function Ky(){return se(w.memory)}function Xy(t,e){const n=be(e),o=typeof n=="number"?n:void 0;P().setFloat64(t+8,Tn(o)?0:o,!0),P().setInt32(t+0,!Tn(o),!0)}function Zy(t){return se(t)}function Qy(t){return se(be(t))}function ex(t){W(t)}function tx(t){throw W(t)}function nx(t,e){const n=be(e),o=typeof n=="string"?n:void 0;var r=Tn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),i=qe;P().setInt32(t+4,i,!0),P().setInt32(t+0,r,!0)}function ox(t,e){return se(Tt(t,e))}function rx(t,e){throw new Error(Tt(t,e))}function ix(t){return se(typeof be(t))}const y5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:Q0,ChangeModifier:Qr,Cursor:po,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,nb.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_ephemeralstorewasm_free(t,0)}constructor(t){const e=w.ephemeralstorewasm_new(t);return this.__wbg_ptr=e>>>0,nb.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,se(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;return W(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return W(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return W(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,se(t)))}subscribe(t){return W(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,se(t)))}encode(t){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,i,s);var e=P().getInt32(r+0,!0),n=P().getInt32(r+4,!0),o=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_encodeAll(o,this.__wbg_ptr);var t=P().getInt32(o+0,!0),e=P().getInt32(o+4,!0),n=to(t,e).slice();return w.__wbindgen_export_3(t,1*e,1),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(t){const e=qo(t,w.__wbindgen_export_0),n=qe;w.ephemeralstorewasm_apply(this.__wbg_ptr,e,n)}removeOutdated(){w.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}isEmpty(){return w.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}keys(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_keys(o,this.__wbg_ptr);var t=P().getInt32(o+0,!0),e=P().getInt32(o+4,!0),n=Mn(t,e).slice();return w.__wbindgen_export_3(t,4*e,4),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}},LORO_VERSION:function(){let t,e;try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.LORO_VERSION(r);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);return t=n,e=o,Tt(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:Ns,LoroDoc:go,LoroList:js,LoroMap:ei,LoroMovableList:Es,LoroText:yr,LoroTree:Is,LoroTreeNode:no,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rb.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){Zr(t,go);const n=w.undomanager_new(t.__wbg_ptr,se(e));return this.__wbg_ptr=n>>>0,rb.register(this,this.__wbg_ptr,this),this}undo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_undo(n,this.__wbg_ptr);var t=P().getInt32(n+0,!0),e=P().getInt32(n+4,!0);if(P().getInt32(n+8,!0))throw W(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}redo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_redo(n,this.__wbg_ptr);var t=P().getInt32(n+0,!0),e=P().getInt32(n+4,!0);if(P().getInt32(n+8,!0))throw W(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}canUndo(){return w.undomanager_canUndo(this.__wbg_ptr)!==0}canRedo(){return w.undomanager_canRedo(this.__wbg_ptr)!==0}setMaxUndoSteps(t){w.undomanager_setMaxUndoSteps(this.__wbg_ptr,t)}setMergeInterval(t){w.undomanager_setMergeInterval(this.__wbg_ptr,t)}addExcludeOriginPrefix(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,se(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,se(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:On,__wbg_String_8f0eb39a4a4c2f66:ib,__wbg_apply_9bb7fe8fff013a3f:sb,__wbg_buffer_ef9774282e5dab94:ab,__wbg_call_0ad083564791763a:lb,__wbg_call_a34b6b4765f27be0:cb,__wbg_call_d00953b926be4879:db,__wbg_call_efe5a4db7065d1a2:ub,__wbg_changemodifier_new:hb,__wbg_crypto_ed58b8e10a292839:fb,__wbg_cursor_new:mb,__wbg_done_f4c254830a095eaf:pb,__wbg_entries_4dce6361e3ba6fbc:gb,__wbg_entries_83beb641792ccb9c:_b,__wbg_error_7534b8e9a36f1ab4:bb,__wbg_error_9912f7d6d7835a4b:yb,__wbg_from_3aa0fcaa8eef0104:xb,__wbg_getRandomValues_bcb4912f16000dc4:wb,__wbg_get_0c3cc364764a0b98:vb,__wbg_get_b996a12be035ef4f:kb,__wbg_getindex_a471648b3037c750:Sb,__wbg_getwithrefkey_1dc361bd10053bfe:Cb,__wbg_globalThis_6b4d52a0b6aaeaea:Nb,__wbg_global_49324ce12193de77:jb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Eb,__wbg_instanceof_Map_0f3f3653f757ced1:Ib,__wbg_instanceof_Object_9108547bac1f91b1:Ab,__wbg_instanceof_Uint8Array_db97368f94b1373f:Tb,__wbg_isArray_8738f1062fa88586:Mb,__wbg_isSafeInteger_a1b3e0811faecf2f:Ob,__wbg_iterator_c0c688f37fa815e6:Db,__wbg_length_12246a78d2f65d3a:Rb,__wbg_length_c24da17096edfe57:Pb,__wbg_log_0cc1b7768397bcfe:Lb,__wbg_log_0fd6c49475c7bece:Fb,__wbg_log_cb9e190acc5753fb:zb,__wbg_lorocounter_new:Bb,__wbg_lorolist_new:Ub,__wbg_loromap_new:Vb,__wbg_loromovablelist_new:$b,__wbg_lorotext_new:Hb,__wbg_lorotree_new:Wb,__wbg_lorotreenode_new:qb,__wbg_mark_7438147ce31e9d4b:Gb,__wbg_measure_fb7825c11612c823:Yb,__wbg_msCrypto_0a36e2ec3a343d26:Jb,__wbg_new_518e2184725aa711:Kb,__wbg_new_59845962d1127937:Xb,__wbg_new_67abf4a77618ee3e:Zb,__wbg_new_8a6f238a6ece86ea:Qb,__wbg_new_e2d07398d7689006:ey,__wbg_newnoargs_a136448eeb7d48ac:ty,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ny,__wbg_newwithlength_4c216eaaf23f2f9a:oy,__wbg_newwithlength_88b49de1eb24d63e:ry,__wbg_next_928df8c15fc0c9b0:iy,__wbg_next_9dc0926f351c7090:sy,__wbg_node_02999533c4ea02e3:ay,__wbg_now_3e8577e703add0ba:ly,__wbg_ownKeys_b16312a839a4152c:cy,__wbg_process_5c1d670bc53614b8:dy,__wbg_push_e7d7247e69dad3ee:uy,__wbg_randomFillSync_ab2cfe79ebbf2740:hy,__wbg_require_79b1e9274cde3c87:fy,__wbg_resolve_267ff08e7e1d2ce4:my,__wbg_self_cca3ca60d61220f4:py,__wbg_set_1b50d2de855a9d50:gy,__wbg_set_393f510a6b7e9da5:_y,__wbg_set_3f1d0b984ed272ed:by,__wbg_set_5deee49b10b2b780:yy,__wbg_set_93ba9407b5476ec6:xy,__wbg_set_wasm:yu,__wbg_setindex_e0b7b31bfc87ba3f:wy,__wbg_stack_0ed75d68575b0f3c:vy,__wbg_subarray_2dc34705c0dc7cdb:ky,__wbg_then_84907e7a6730461e:Sy,__wbg_value_51f8a88d4a1805fb:Cy,__wbg_versions_c71aa1626a93e0a1:Ny,__wbg_versionvector_new:jy,__wbg_window_2aba046d3fc4ad7c:Ey,__wbindgen_as_number:Iy,__wbindgen_bigint_from_i64:Ay,__wbindgen_bigint_from_u64:Ty,__wbindgen_bigint_get_as_i64:My,__wbindgen_boolean_get:Oy,__wbindgen_cb_drop:Dy,__wbindgen_closure_wrapper483:Ry,__wbindgen_closure_wrapper486:Py,__wbindgen_debug_string:Ly,__wbindgen_error_new:Fy,__wbindgen_in:zy,__wbindgen_is_array:By,__wbindgen_is_bigint:Uy,__wbindgen_is_falsy:Vy,__wbindgen_is_function:$y,__wbindgen_is_null:Hy,__wbindgen_is_object:Wy,__wbindgen_is_string:qy,__wbindgen_is_undefined:Gy,__wbindgen_jsval_eq:Yy,__wbindgen_jsval_loose_eq:Jy,__wbindgen_memory:Ky,__wbindgen_number_get:Xy,__wbindgen_number_new:Zy,__wbindgen_object_clone_ref:Qy,__wbindgen_object_drop_ref:ex,__wbindgen_rethrow:tx,__wbindgen_string_get:nx,__wbindgen_string_new:ox,__wbindgen_throw:rx,__wbindgen_typeof:ix,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=qo(t,w.__wbindgen_export_0),i=qe;w.decodeFrontiers(o,r,i);var e=P().getInt32(o+0,!0),n=P().getInt32(o+4,!0);if(P().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}},decodeImportBlobMeta:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),i=qo(t,w.__wbindgen_export_0),s=qe;w.decodeImportBlobMeta(r,i,s,e);var n=P().getInt32(r+0,!0),o=P().getInt32(r+4,!0);if(P().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const i=w.__wbindgen_add_to_stack_pointer(-16),s=wn(t,w.__wbindgen_export_0),a=qe;w.encodeFrontiers(i,s,a);var e=P().getInt32(i+0,!0),n=P().getInt32(i+4,!0),o=P().getInt32(i+8,!0);if(P().getInt32(i+12,!0))throw W(o);var r=to(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}},run:function(){w.run()},setDebug:function(){w.setDebug()}},Symbol.toStringTag,{value:"Module"}));URL=globalThis.URL;const U=await(async(t={},e)=>{let n;if(e.startsWith("data:")){const o=e.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(o,"base64");else{if(typeof atob!="function")throw new Error("Cannot decode base64-encoded data URL");{const i=atob(o);r=new Uint8Array(i.length);for(let s=0;s<i.length;s++)r[s]=i.charCodeAt(s)}}n=await WebAssembly.instantiate(r,t)}else{const o=await fetch(e),r=o.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))n=await WebAssembly.instantiateStreaming(o,t);else{const i=await o.arrayBuffer();n=await WebAssembly.instantiate(i,t)}}return n.instance.exports})({"./loro_wasm_bg.js":{__wbindgen_object_drop_ref:ex,__wbg_lorotree_new:Wb,__wbg_lorocounter_new:Bb,__wbg_loromovablelist_new:$b,__wbg_lorotreenode_new:qb,__wbg_cursor_new:mb,__wbg_lorolist_new:Ub,__wbg_lorotext_new:Hb,__wbg_loromap_new:Vb,__wbg_versionvector_new:jy,__wbg_changemodifier_new:hb,__wbindgen_is_function:$y,__wbindgen_string_new:ox,__wbindgen_boolean_get:Oy,__wbindgen_error_new:Fy,__wbindgen_object_clone_ref:Qy,__wbindgen_string_get:nx,__wbindgen_is_undefined:Gy,__wbindgen_in:zy,__wbindgen_is_bigint:Uy,__wbindgen_number_get:Xy,__wbindgen_bigint_from_i64:Ay,__wbindgen_jsval_eq:Yy,__wbindgen_is_object:Wy,__wbindgen_bigint_from_u64:Ty,__wbindgen_cb_drop:Dy,__wbindgen_as_number:Iy,__wbindgen_is_string:qy,__wbindgen_is_null:Hy,__wbindgen_number_new:Zy,__wbindgen_is_array:By,__wbindgen_typeof:ix,__wbg_error_9912f7d6d7835a4b:yb,__wbg_log_0fd6c49475c7bece:Fb,__wbindgen_is_falsy:Vy,__wbindgen_jsval_loose_eq:Jy,__wbg_String_8f0eb39a4a4c2f66:ib,__wbg_getwithrefkey_1dc361bd10053bfe:Cb,__wbg_set_3f1d0b984ed272ed:by,__wbg_log_cb9e190acc5753fb:zb,__wbg_log_0cc1b7768397bcfe:Lb,__wbg_mark_7438147ce31e9d4b:Gb,__wbg_measure_fb7825c11612c823:Yb,__wbg_new_8a6f238a6ece86ea:Qb,__wbg_stack_0ed75d68575b0f3c:vy,__wbg_error_7534b8e9a36f1ab4:bb,__wbg_now_3e8577e703add0ba:ly,__wbg_crypto_ed58b8e10a292839:fb,__wbg_process_5c1d670bc53614b8:dy,__wbg_versions_c71aa1626a93e0a1:Ny,__wbg_node_02999533c4ea02e3:ay,__wbg_require_79b1e9274cde3c87:fy,__wbg_msCrypto_0a36e2ec3a343d26:Jb,__wbg_randomFillSync_ab2cfe79ebbf2740:hy,__wbg_getRandomValues_bcb4912f16000dc4:wb,__wbg_self_cca3ca60d61220f4:py,__wbg_window_2aba046d3fc4ad7c:Ey,__wbg_globalThis_6b4d52a0b6aaeaea:Nb,__wbg_global_49324ce12193de77:jb,__wbg_newnoargs_a136448eeb7d48ac:ty,__wbg_call_0ad083564791763a:lb,__wbg_get_0c3cc364764a0b98:vb,__wbg_length_12246a78d2f65d3a:Rb,__wbg_new_e2d07398d7689006:ey,__wbg_new_518e2184725aa711:Kb,__wbg_next_928df8c15fc0c9b0:iy,__wbg_next_9dc0926f351c7090:sy,__wbg_done_f4c254830a095eaf:pb,__wbg_value_51f8a88d4a1805fb:Cy,__wbg_iterator_c0c688f37fa815e6:Db,__wbg_get_b996a12be035ef4f:kb,__wbg_new_67abf4a77618ee3e:Zb,__wbg_newwithlength_88b49de1eb24d63e:ry,__wbg_set_93ba9407b5476ec6:xy,__wbg_from_3aa0fcaa8eef0104:xb,__wbg_isArray_8738f1062fa88586:Mb,__wbg_push_e7d7247e69dad3ee:uy,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Eb,__wbg_call_a34b6b4765f27be0:cb,__wbg_call_efe5a4db7065d1a2:ub,__wbg_call_d00953b926be4879:db,__wbg_instanceof_Map_0f3f3653f757ced1:Ib,__wbg_set_393f510a6b7e9da5:_y,__wbg_entries_4dce6361e3ba6fbc:gb,__wbg_isSafeInteger_a1b3e0811faecf2f:Ob,__wbg_instanceof_Object_9108547bac1f91b1:Ab,__wbg_entries_83beb641792ccb9c:_b,__wbg_apply_9bb7fe8fff013a3f:sb,__wbg_ownKeys_b16312a839a4152c:cy,__wbg_set_1b50d2de855a9d50:gy,__wbg_buffer_ef9774282e5dab94:ab,__wbg_resolve_267ff08e7e1d2ce4:my,__wbg_then_84907e7a6730461e:Sy,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ny,__wbg_new_59845962d1127937:Xb,__wbg_set_5deee49b10b2b780:yy,__wbg_length_c24da17096edfe57:Pb,__wbg_instanceof_Uint8Array_db97368f94b1373f:Tb,__wbg_newwithlength_4c216eaaf23f2f9a:oy,__wbg_subarray_2dc34705c0dc7cdb:ky,__wbg_getindex_a471648b3037c750:Sb,__wbg_setindex_e0b7b31bfc87ba3f:wy,__wbindgen_bigint_get_as_i64:My,__wbindgen_debug_string:Ly,__wbindgen_throw:rx,__wbindgen_rethrow:tx,__wbindgen_memory:Ky,__wbindgen_closure_wrapper483:Ry,__wbindgen_closure_wrapper486:Py}},p5),x5=U.memory,w5=U.__wbg_lorocounter_free,v5=U.lorocounter_new,k5=U.lorocounter_kind,S5=U.lorocounter_id,C5=U.lorocounter_increment,N5=U.lorocounter_decrement,j5=U.lorocounter_value,E5=U.lorocounter_subscribe,I5=U.lorocounter_parent,A5=U.lorocounter_isAttached,T5=U.lorocounter_getAttached,M5=U.lorocounter_getShallowValue,O5=U.__wbg_awarenesswasm_free,D5=U.awarenesswasm_new,R5=U.awarenesswasm_encode,P5=U.awarenesswasm_encodeAll,L5=U.awarenesswasm_apply,F5=U.awarenesswasm_setLocalState,z5=U.awarenesswasm_peer,B5=U.awarenesswasm_getAllStates,U5=U.awarenesswasm_getState,V5=U.awarenesswasm_getTimestamp,$5=U.awarenesswasm_removeOutdated,H5=U.awarenesswasm_length,W5=U.awarenesswasm_isEmpty,q5=U.awarenesswasm_peers,G5=U.__wbg_ephemeralstorewasm_free,Y5=U.ephemeralstorewasm_new,J5=U.ephemeralstorewasm_set,K5=U.ephemeralstorewasm_delete,X5=U.ephemeralstorewasm_get,Z5=U.ephemeralstorewasm_getAllStates,Q5=U.ephemeralstorewasm_subscribeLocalUpdates,e6=U.ephemeralstorewasm_subscribe,t6=U.ephemeralstorewasm_encode,n6=U.ephemeralstorewasm_encodeAll,o6=U.ephemeralstorewasm_apply,r6=U.ephemeralstorewasm_removeOutdated,i6=U.ephemeralstorewasm_isEmpty,s6=U.ephemeralstorewasm_keys,a6=U.LORO_VERSION,l6=U.run,c6=U.encodeFrontiers,d6=U.decodeFrontiers,u6=U.setDebug,h6=U.__wbg_lorodoc_free,f6=U.lorodoc_new,m6=U.lorodoc_setDetachedEditing,p6=U.lorodoc_isDetachedEditingEnabled,g6=U.lorodoc_setRecordTimestamp,_6=U.lorodoc_setChangeMergeInterval,b6=U.lorodoc_configTextStyle,y6=U.lorodoc_configDefaultTextStyle,x6=U.lorodoc_fromSnapshot,w6=U.lorodoc_attach,v6=U.lorodoc_isDetached,k6=U.lorodoc_detach,S6=U.lorodoc_fork,C6=U.lorodoc_forkAt,N6=U.lorodoc_checkoutToLatest,j6=U.lorodoc_travelChangeAncestors,E6=U.lorodoc_findIdSpansBetween,I6=U.lorodoc_checkout,A6=U.lorodoc_peerId,T6=U.lorodoc_peerIdStr,M6=U.lorodoc_setPeerId,O6=U.lorodoc_commit,D6=U.lorodoc_getPendingTxnLength,R6=U.lorodoc_getText,P6=U.lorodoc_getMap,L6=U.lorodoc_getList,F6=U.lorodoc_getMovableList,z6=U.lorodoc_getCounter,B6=U.lorodoc_getTree,U6=U.lorodoc_hasContainer,V6=U.lorodoc_getContainerById,$6=U.lorodoc_setNextCommitMessage,H6=U.lorodoc_setNextCommitOrigin,W6=U.lorodoc_setNextCommitTimestamp,q6=U.lorodoc_setNextCommitOptions,G6=U.lorodoc_clearNextCommitOptions,Y6=U.lorodoc_getDeepValueWithID,J6=U.lorodoc_getPathToContainer,K6=U.lorodoc_JSONPath,X6=U.lorodoc_version,Z6=U.lorodoc_shallowSinceVV,Q6=U.lorodoc_isShallow,eI=U.lorodoc_shallowSinceFrontiers,tI=U.lorodoc_oplogVersion,nI=U.lorodoc_frontiers,oI=U.lorodoc_oplogFrontiers,rI=U.lorodoc_cmpWithFrontiers,iI=U.lorodoc_cmpFrontiers,sI=U.lorodoc_exportSnapshot,aI=U.lorodoc_exportFrom,lI=U.lorodoc_export,cI=U.lorodoc_exportJsonUpdates,dI=U.lorodoc_exportJsonInIdSpan,uI=U.lorodoc_importJsonUpdates,hI=U.lorodoc_import,fI=U.lorodoc_importBatch,mI=U.lorodoc_getShallowValue,pI=U.lorodoc_toJSON,gI=U.lorodoc_subscribe,_I=U.lorodoc_subscribeLocalUpdates,bI=U.lorodoc_debugHistory,yI=U.lorodoc_changeCount,xI=U.lorodoc_opCount,wI=U.lorodoc_getAllChanges,vI=U.lorodoc_getChangeAt,kI=U.lorodoc_getChangeAtLamport,SI=U.lorodoc_getOpsInChange,CI=U.lorodoc_frontiersToVV,NI=U.lorodoc_vvToFrontiers,jI=U.lorodoc_getByPath,EI=U.lorodoc_getCursorPos,II=U.lorodoc_getChangedContainersIn,AI=U.lorodoc_revertTo,TI=U.lorodoc_applyDiff,MI=U.lorodoc_diff,OI=U.lorodoc_getUncommittedOpsAsJson,DI=U.lorodoc_subscribeFirstCommitFromPeer,RI=U.lorodoc_subscribePreCommit,PI=U.lorodoc_deleteRootContainer,LI=U.lorodoc_setHideEmptyRootContainers,FI=U.__wbg_lorotext_free,zI=U.lorotext_new,BI=U.lorotext_kind,UI=U.lorotext_iter,VI=U.lorotext_update,$I=U.lorotext_updateByLine,HI=U.lorotext_insert,WI=U.lorotext_slice,qI=U.lorotext_charAt,GI=U.lorotext_splice,YI=U.lorotext_insertUtf8,JI=U.lorotext_delete,KI=U.lorotext_deleteUtf8,XI=U.lorotext_mark,ZI=U.lorotext_unmark,QI=U.lorotext_toString,e8=U.lorotext_toDelta,t8=U.lorotext_id,n8=U.lorotext_length,o8=U.lorotext_subscribe,r8=U.lorotext_applyDelta,i8=U.lorotext_parent,s8=U.lorotext_isAttached,a8=U.lorotext_getAttached,l8=U.lorotext_getCursor,c8=U.lorotext_push,d8=U.lorotext_getEditorOf,u8=U.lorotext_isDeleted,h8=U.lorotext_getShallowValue,f8=U.lorotext_toJSON,m8=U.__wbg_loromap_free,p8=U.loromap_new,g8=U.loromap_kind,_8=U.loromap_set,b8=U.loromap_delete,y8=U.loromap_get,x8=U.loromap_getOrCreateContainer,w8=U.loromap_keys,v8=U.loromap_values,k8=U.loromap_entries,S8=U.loromap_id,C8=U.loromap_toJSON,N8=U.loromap_setContainer,j8=U.loromap_subscribe,E8=U.loromap_size,I8=U.loromap_parent,A8=U.loromap_isAttached,T8=U.loromap_getAttached,M8=U.loromap_clear,O8=U.loromap_getLastEditor,D8=U.loromap_isDeleted,R8=U.loromap_getShallowValue,P8=U.__wbg_lorolist_free,L8=U.lorolist_new,F8=U.lorolist_kind,z8=U.lorolist_insert,B8=U.lorolist_delete,U8=U.lorolist_get,V8=U.lorolist_id,$8=U.lorolist_toArray,H8=U.lorolist_toJSON,W8=U.lorolist_insertContainer,q8=U.lorolist_pushContainer,G8=U.lorolist_subscribe,Y8=U.lorolist_length,J8=U.lorolist_parent,K8=U.lorolist_isAttached,X8=U.lorolist_getAttached,Z8=U.lorolist_getCursor,Q8=U.lorolist_push,eA=U.lorolist_pop,tA=U.lorolist_clear,nA=U.lorolist_getIdAt,oA=U.lorolist_isDeleted,rA=U.lorolist_getShallowValue,iA=U.loromovablelist_new,sA=U.loromovablelist_kind,aA=U.loromovablelist_insert,lA=U.loromovablelist_delete,cA=U.loromovablelist_get,dA=U.loromovablelist_id,uA=U.loromovablelist_toArray,hA=U.loromovablelist_toJSON,fA=U.loromovablelist_insertContainer,mA=U.loromovablelist_pushContainer,pA=U.loromovablelist_subscribe,gA=U.loromovablelist_length,_A=U.loromovablelist_parent,bA=U.loromovablelist_isAttached,yA=U.loromovablelist_getAttached,xA=U.loromovablelist_getCursor,wA=U.loromovablelist_move,vA=U.loromovablelist_set,kA=U.loromovablelist_setContainer,SA=U.loromovablelist_push,CA=U.loromovablelist_pop,NA=U.loromovablelist_clear,jA=U.loromovablelist_getCreatorAt,EA=U.loromovablelist_getLastMoverAt,IA=U.loromovablelist_getLastEditorAt,AA=U.loromovablelist_isDeleted,TA=U.loromovablelist_getShallowValue,MA=U.__wbg_lorotree_free,OA=U.lorotreenode___getClassname,DA=U.__wbg_lorotreenode_free,RA=U.lorotreenode_id,PA=U.lorotreenode_createNode,LA=U.lorotreenode_move,FA=U.lorotreenode_moveAfter,zA=U.lorotreenode_moveBefore,BA=U.lorotreenode_index,UA=U.lorotreenode_fractionalIndex,VA=U.lorotreenode_data,$A=U.lorotreenode_toJSON,HA=U.lorotreenode_parent,WA=U.lorotreenode_children,qA=U.lorotreenode_isDeleted,GA=U.lorotreenode_getLastMoveId,YA=U.lorotreenode_creationId,JA=U.lorotreenode_creator,KA=U.lorotree_new,XA=U.lorotree_kind,ZA=U.lorotree_createNode,QA=U.lorotree_move,eT=U.lorotree_delete,tT=U.lorotree_getNodeByID,nT=U.lorotree_id,oT=U.lorotree_has,rT=U.lorotree_isNodeDeleted,iT=U.lorotree_toArray,sT=U.lorotree_getNodes,aT=U.lorotree_toJSON,lT=U.lorotree_nodes,cT=U.lorotree_roots,dT=U.lorotree_subscribe,uT=U.lorotree_parent,hT=U.lorotree_isAttached,fT=U.lorotree_getAttached,mT=U.lorotree_enableFractionalIndex,pT=U.lorotree_disableFractionalIndex,gT=U.lorotree_isFractionalIndexEnabled,_T=U.lorotree_isDeleted,bT=U.lorotree_getShallowValue,yT=U.__wbg_cursor_free,xT=U.cursor_containerId,wT=U.cursor_pos,vT=U.cursor_side,kT=U.cursor_encode,ST=U.cursor_decode,CT=U.cursor_kind,NT=U.__wbg_undomanager_free,jT=U.undomanager_new,ET=U.undomanager_undo,IT=U.undomanager_redo,AT=U.undomanager_canUndo,TT=U.undomanager_canRedo,MT=U.undomanager_setMaxUndoSteps,OT=U.undomanager_setMergeInterval,DT=U.undomanager_addExcludeOriginPrefix,RT=U.undomanager_setOnPush,PT=U.undomanager_setOnPop,LT=U.undomanager_clear,FT=U.__wbg_versionvector_free,zT=U.versionvector_new,BT=U.versionvector_parseJSON,UT=U.versionvector_toJSON,VT=U.versionvector_encode,$T=U.versionvector_decode,HT=U.versionvector_get,WT=U.versionvector_compare,qT=U.versionvector_setEnd,GT=U.versionvector_setLast,YT=U.versionvector_remove,JT=U.versionvector_length,KT=U.decodeImportBlobMeta,XT=U.__wbg_changemodifier_free,ZT=U.changemodifier_setMessage,QT=U.changemodifier_setTimestamp,e7=U.lorodoc_importUpdateBatch,t7=U.__wbg_loromovablelist_free,n7=U.__wbindgen_export_0,o7=U.__wbindgen_export_1,r7=U.__wbindgen_export_2,i7=U.__wbindgen_export_3,s7=U.__wbindgen_export_4,a7=U.__wbindgen_add_to_stack_pointer,l7=U.__wbindgen_export_5,c7=U.__wbindgen_export_6,Iu=U.__wbindgen_start,sx=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:a6,__wbg_awarenesswasm_free:O5,__wbg_changemodifier_free:XT,__wbg_cursor_free:yT,__wbg_ephemeralstorewasm_free:G5,__wbg_lorocounter_free:w5,__wbg_lorodoc_free:h6,__wbg_lorolist_free:P8,__wbg_loromap_free:m8,__wbg_loromovablelist_free:t7,__wbg_lorotext_free:FI,__wbg_lorotree_free:MA,__wbg_lorotreenode_free:DA,__wbg_undomanager_free:NT,__wbg_versionvector_free:FT,__wbindgen_add_to_stack_pointer:a7,__wbindgen_export_0:n7,__wbindgen_export_1:o7,__wbindgen_export_2:r7,__wbindgen_export_3:i7,__wbindgen_export_4:s7,__wbindgen_export_5:l7,__wbindgen_export_6:c7,__wbindgen_start:Iu,awarenesswasm_apply:L5,awarenesswasm_encode:R5,awarenesswasm_encodeAll:P5,awarenesswasm_getAllStates:B5,awarenesswasm_getState:U5,awarenesswasm_getTimestamp:V5,awarenesswasm_isEmpty:W5,awarenesswasm_length:H5,awarenesswasm_new:D5,awarenesswasm_peer:z5,awarenesswasm_peers:q5,awarenesswasm_removeOutdated:$5,awarenesswasm_setLocalState:F5,changemodifier_setMessage:ZT,changemodifier_setTimestamp:QT,cursor_containerId:xT,cursor_decode:ST,cursor_encode:kT,cursor_kind:CT,cursor_pos:wT,cursor_side:vT,decodeFrontiers:d6,decodeImportBlobMeta:KT,encodeFrontiers:c6,ephemeralstorewasm_apply:o6,ephemeralstorewasm_delete:K5,ephemeralstorewasm_encode:t6,ephemeralstorewasm_encodeAll:n6,ephemeralstorewasm_get:X5,ephemeralstorewasm_getAllStates:Z5,ephemeralstorewasm_isEmpty:i6,ephemeralstorewasm_keys:s6,ephemeralstorewasm_new:Y5,ephemeralstorewasm_removeOutdated:r6,ephemeralstorewasm_set:J5,ephemeralstorewasm_subscribe:e6,ephemeralstorewasm_subscribeLocalUpdates:Q5,lorocounter_decrement:N5,lorocounter_getAttached:T5,lorocounter_getShallowValue:M5,lorocounter_id:S5,lorocounter_increment:C5,lorocounter_isAttached:A5,lorocounter_kind:k5,lorocounter_new:v5,lorocounter_parent:I5,lorocounter_subscribe:E5,lorocounter_value:j5,lorodoc_JSONPath:K6,lorodoc_applyDiff:TI,lorodoc_attach:w6,lorodoc_changeCount:yI,lorodoc_checkout:I6,lorodoc_checkoutToLatest:N6,lorodoc_clearNextCommitOptions:G6,lorodoc_cmpFrontiers:iI,lorodoc_cmpWithFrontiers:rI,lorodoc_commit:O6,lorodoc_configDefaultTextStyle:y6,lorodoc_configTextStyle:b6,lorodoc_debugHistory:bI,lorodoc_deleteRootContainer:PI,lorodoc_detach:k6,lorodoc_diff:MI,lorodoc_export:lI,lorodoc_exportFrom:aI,lorodoc_exportJsonInIdSpan:dI,lorodoc_exportJsonUpdates:cI,lorodoc_exportSnapshot:sI,lorodoc_findIdSpansBetween:E6,lorodoc_fork:S6,lorodoc_forkAt:C6,lorodoc_fromSnapshot:x6,lorodoc_frontiers:nI,lorodoc_frontiersToVV:CI,lorodoc_getAllChanges:wI,lorodoc_getByPath:jI,lorodoc_getChangeAt:vI,lorodoc_getChangeAtLamport:kI,lorodoc_getChangedContainersIn:II,lorodoc_getContainerById:V6,lorodoc_getCounter:z6,lorodoc_getCursorPos:EI,lorodoc_getDeepValueWithID:Y6,lorodoc_getList:L6,lorodoc_getMap:P6,lorodoc_getMovableList:F6,lorodoc_getOpsInChange:SI,lorodoc_getPathToContainer:J6,lorodoc_getPendingTxnLength:D6,lorodoc_getShallowValue:mI,lorodoc_getText:R6,lorodoc_getTree:B6,lorodoc_getUncommittedOpsAsJson:OI,lorodoc_hasContainer:U6,lorodoc_import:hI,lorodoc_importBatch:fI,lorodoc_importJsonUpdates:uI,lorodoc_importUpdateBatch:e7,lorodoc_isDetached:v6,lorodoc_isDetachedEditingEnabled:p6,lorodoc_isShallow:Q6,lorodoc_new:f6,lorodoc_opCount:xI,lorodoc_oplogFrontiers:oI,lorodoc_oplogVersion:tI,lorodoc_peerId:A6,lorodoc_peerIdStr:T6,lorodoc_revertTo:AI,lorodoc_setChangeMergeInterval:_6,lorodoc_setDetachedEditing:m6,lorodoc_setHideEmptyRootContainers:LI,lorodoc_setNextCommitMessage:$6,lorodoc_setNextCommitOptions:q6,lorodoc_setNextCommitOrigin:H6,lorodoc_setNextCommitTimestamp:W6,lorodoc_setPeerId:M6,lorodoc_setRecordTimestamp:g6,lorodoc_shallowSinceFrontiers:eI,lorodoc_shallowSinceVV:Z6,lorodoc_subscribe:gI,lorodoc_subscribeFirstCommitFromPeer:DI,lorodoc_subscribeLocalUpdates:_I,lorodoc_subscribePreCommit:RI,lorodoc_toJSON:pI,lorodoc_travelChangeAncestors:j6,lorodoc_version:X6,lorodoc_vvToFrontiers:NI,lorolist_clear:tA,lorolist_delete:B8,lorolist_get:U8,lorolist_getAttached:X8,lorolist_getCursor:Z8,lorolist_getIdAt:nA,lorolist_getShallowValue:rA,lorolist_id:V8,lorolist_insert:z8,lorolist_insertContainer:W8,lorolist_isAttached:K8,lorolist_isDeleted:oA,lorolist_kind:F8,lorolist_length:Y8,lorolist_new:L8,lorolist_parent:J8,lorolist_pop:eA,lorolist_push:Q8,lorolist_pushContainer:q8,lorolist_subscribe:G8,lorolist_toArray:$8,lorolist_toJSON:H8,loromap_clear:M8,loromap_delete:b8,loromap_entries:k8,loromap_get:y8,loromap_getAttached:T8,loromap_getLastEditor:O8,loromap_getOrCreateContainer:x8,loromap_getShallowValue:R8,loromap_id:S8,loromap_isAttached:A8,loromap_isDeleted:D8,loromap_keys:w8,loromap_kind:g8,loromap_new:p8,loromap_parent:I8,loromap_set:_8,loromap_setContainer:N8,loromap_size:E8,loromap_subscribe:j8,loromap_toJSON:C8,loromap_values:v8,loromovablelist_clear:NA,loromovablelist_delete:lA,loromovablelist_get:cA,loromovablelist_getAttached:yA,loromovablelist_getCreatorAt:jA,loromovablelist_getCursor:xA,loromovablelist_getLastEditorAt:IA,loromovablelist_getLastMoverAt:EA,loromovablelist_getShallowValue:TA,loromovablelist_id:dA,loromovablelist_insert:aA,loromovablelist_insertContainer:fA,loromovablelist_isAttached:bA,loromovablelist_isDeleted:AA,loromovablelist_kind:sA,loromovablelist_length:gA,loromovablelist_move:wA,loromovablelist_new:iA,loromovablelist_parent:_A,loromovablelist_pop:CA,loromovablelist_push:SA,loromovablelist_pushContainer:mA,loromovablelist_set:vA,loromovablelist_setContainer:kA,loromovablelist_subscribe:pA,loromovablelist_toArray:uA,loromovablelist_toJSON:hA,lorotext_applyDelta:r8,lorotext_charAt:qI,lorotext_delete:JI,lorotext_deleteUtf8:KI,lorotext_getAttached:a8,lorotext_getCursor:l8,lorotext_getEditorOf:d8,lorotext_getShallowValue:h8,lorotext_id:t8,lorotext_insert:HI,lorotext_insertUtf8:YI,lorotext_isAttached:s8,lorotext_isDeleted:u8,lorotext_iter:UI,lorotext_kind:BI,lorotext_length:n8,lorotext_mark:XI,lorotext_new:zI,lorotext_parent:i8,lorotext_push:c8,lorotext_slice:WI,lorotext_splice:GI,lorotext_subscribe:o8,lorotext_toDelta:e8,lorotext_toJSON:f8,lorotext_toString:QI,lorotext_unmark:ZI,lorotext_update:VI,lorotext_updateByLine:$I,lorotree_createNode:ZA,lorotree_delete:eT,lorotree_disableFractionalIndex:pT,lorotree_enableFractionalIndex:mT,lorotree_getAttached:fT,lorotree_getNodeByID:tT,lorotree_getNodes:sT,lorotree_getShallowValue:bT,lorotree_has:oT,lorotree_id:nT,lorotree_isAttached:hT,lorotree_isDeleted:_T,lorotree_isFractionalIndexEnabled:gT,lorotree_isNodeDeleted:rT,lorotree_kind:XA,lorotree_move:QA,lorotree_new:KA,lorotree_nodes:lT,lorotree_parent:uT,lorotree_roots:cT,lorotree_subscribe:dT,lorotree_toArray:iT,lorotree_toJSON:aT,lorotreenode___getClassname:OA,lorotreenode_children:WA,lorotreenode_createNode:PA,lorotreenode_creationId:YA,lorotreenode_creator:JA,lorotreenode_data:VA,lorotreenode_fractionalIndex:UA,lorotreenode_getLastMoveId:GA,lorotreenode_id:RA,lorotreenode_index:BA,lorotreenode_isDeleted:qA,lorotreenode_move:LA,lorotreenode_moveAfter:FA,lorotreenode_moveBefore:zA,lorotreenode_parent:HA,lorotreenode_toJSON:$A,memory:x5,run:l6,setDebug:u6,undomanager_addExcludeOriginPrefix:DT,undomanager_canRedo:TT,undomanager_canUndo:AT,undomanager_clear:LT,undomanager_new:jT,undomanager_redo:IT,undomanager_setMaxUndoSteps:MT,undomanager_setMergeInterval:OT,undomanager_setOnPop:PT,undomanager_setOnPush:RT,undomanager_undo:ET,versionvector_compare:WT,versionvector_decode:$T,versionvector_encode:VT,versionvector_get:HT,versionvector_length:JT,versionvector_new:zT,versionvector_parseJSON:BT,versionvector_remove:YT,versionvector_setEnd:qT,versionvector_setLast:GT,versionvector_toJSON:UT},Symbol.toStringTag,{value:"Module"}));if(Iu)yu(sx),Iu();else{const t=await Ac(()=>Promise.resolve().then(()=>sx),void 0,import.meta.url);yu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":y5}).exports)}const d7=["Map","Text","List","Tree","MovableList","Counter"];function ax(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&d7.includes(t.kind())}go.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(s,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(s,c);if(d===c){const u=c.getShallowValue();return typeof u=="object"?r(u):u}if(ax(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(s,a);if(ax(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=s=>{if(Array.isArray(s))return s.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(s)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},i=n.getShallowValue();return r(i)};const u7=(t,e,n)=>Lo.define(o=>new h7(o,t,e,n)),wl=ym.define();class h7{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=i=>{if(i.by!=="local")if(i.by!=="checkout"){if(i.by==="import"){const s=[];let a=0;for(const{diff:l,path:c}of i.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const u of d)u.insert?s.push({from:a,to:a,insert:u.insert}):u.delete?(s.push({from:a,to:a+u.delete}),a+=u.delete):u.retain!=null&&(a+=u.retain);s.length>0&&(mt.debug("[rtc] Received text changes",s),this.view.dispatch({changes:s,annotations:[wl.of(this)]}))}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[wl.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const i=this.view.state.doc.toString(),s=this.getTextFromDoc(this.doc);i!==s.toString()&&(mt.debug("[rtc] initializing text",s.toString()),e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:s.toString()}]}))})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(wl)===this||e.transactions[0].annotation(wl)==="undo"))return;let n=0;e.changes.iterChanges((o,r,i,s,a)=>{const l=a.sliceString(0,a.length,`
112
- `);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const As=Ot(void 0),ln=new go,lx=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new Q0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(ln.peerIdStr),Au=LB(()=>{mt.debug("[rtc] creating websocket");const t=FB(m4()).replace("/ws","/ws_sync"),e=new YV(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await zB(),e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer();ln.import(new Uint8Array(r)),mt.debug("[rtc] imported doc change. new doc:",ln.toJSON()),ut.get(As)!==ln&&ut.set(As,ln)}),e.addEventListener("open",()=>{mt.debug("[rtc] websocket open")}),e.addEventListener("close",n=>{mt.warn("[rtc] websocket close",n),ut.get(As)===ln&&ut.set(As,void 0)}),e});function Tu(t,e,n=""){if(qn())return{extension:[],code:n};const o=ln.getByPath(`codes/${t}`)!==void 0,r=ln.getMap("codes").getOrCreateContainer(t,new yr);return o||(mt.warn("[rtc] initializing code for new cell",n),r.insert(0,n)),{code:n.toString(),extension:[f7(t),m7(t),u7(ln,["codes",t],()=>r)]}}function f7(t){const e=n=>{const o=ln.getByPath(`languages/${t}`);if(!o)return;const r=n.state.field(yc).type,i=o.toString();if(i!==r){mt.debug(`[rtc] Received language change: ${r} -> ${i}`);const s=RB[i]();Sr(n,s.type,{keepCodeAsIs:!0})}};return Lo.define(n=>{Promise.resolve().then(()=>e(n));const o=ln.subscribe(()=>{e(n)});return{destroy(){o()}}})}function m7(t){return st.updateListener.of(e=>{const n=ln.getMap("languages").getOrCreateContainer(t,new yr);if(!n.toString()){const o=Tm(e.state).type;return Sr(e.view,o),mt.debug("[rtc] no language, setting default to",o),n.delete(0,n.length),n.insert(0,o),void ln.commit()}for(const o of e.transactions)for(const r of o.effects)r.is(DB)&&n.toString()!==r.value.type&&(mt.debug(`[rtc] Setting language: ${n} -> ${r.value.type}`),n.delete(0,n.length),n.insert(0,r.value.type),ln.commit())})}Ei("rtc_v2")&&PB==="edit"&&Au(),ln.subscribeLocalUpdates(t=>{mt.debug("[rtc] local update, sending to server"),Au().send(t)}),lx.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(mt.debug("[rtc] awareness changes",n),Au().send(lx.encode(n)))});const cx=({theme:t,showPlaceholder:e,allowFocus:n,id:o,config:r,code:i,status:s,serializedEditorState:a,setEditorView:l,runCell:c,userConfig:d,editorViewRef:u,editorViewParentRef:f,hidden:m,hasOutput:_,temporarilyShowCode:g,languageAdapter:p,setLanguageAdapter:b,showLanguageToggles:x=!0})=>{var re;const[y,v]=yn(Ea),S=function(){const ne=X.c(2),te=$t(Ia);let q;return ne[0]!==te?(q=Q=>{uo!==Q&&te(Q)},ne[0]=te,ne[1]=q):q=ne[1],q}(),k=rd(),{saveOrNameNotebook:N}=Pg(),E=s==="running"||s==="queued",I=zt(),T=Xp(),M=p==="markdown",R=Qe(()=>!E&&(k({cellId:o}),!0)),B=Qe(()=>!E&&(c(),!0)),O=Qe(()=>{const ne=!r.hide_code;return Cr({configs:{[o]:{hide_code:ne}}}),I.updateCellConfig({cellId:o,config:{hide_code:ne}}),ne}),z=We(Ii),F=Qe(()=>{Bo(z,I.createNewCell)}),V=BB(d),L=A.useMemo(()=>{const ne=zj({cellId:o,showPlaceholder:e,enableAI:V,cellActions:{...I,afterToggleMarkdown:F,onRun:B,deleteCell:R,saveNotebook:N,createManyBelow:te=>{for(const q of[...te].reverse())I.createNewCell({code:q,before:!1,cellId:o,skipIfCodeExists:!0})},splitCell:T,toggleHideCode:O,aiCellCompletion:()=>{let te=!1;return v(q=>(q==null?void 0:q.cellId)===o?(te=!0,null):{cellId:o}),te}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new p4(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics});return ne.push(Lo.define(te=>{const q=te.state.field(yc);return b(q.type),{update(Q){const ie=Q.state.field(yc);b(ie.type)}}}),st.updateListener.of(te=>{te.selectionSet&&te.state.selection.ranges.some(q=>q.from!==q.to)&&g({focus:!1})})),ne},[o,d.keymap,d.completion,d.language_servers,d.diagnostics,V,t,e,I,T,O,R,B,v,F,b,g,N]),C=Ei("rtc_v2"),$=Qe(()=>{if(C){const te=Tu(o,0,i);L.push(te.extension),i=te.code}const ne=new st({state:aa.create({doc:i,extensions:L})});l(ne),C||Sr(ne,Tm(ne.state).type)}),j=Qe(()=>{if(Er(u.current!==null,"Editor view is not initialized"),C){const ne=Tu(o);L.push(ne.extension)}u.current.dispatch({effects:[Gt.reconfigure.of([L]),UB(u.current,d.completion,new p4(d.keymap.overrides??{}),{...d.language_servers,diagnostics:d.diagnostics})]})}),H=Qe(()=>{if(Er(a,"Editor view is not initialized"),C){const te=Tu(o,0,i);L.push(te.extension),i=te.code}const ne=new st({state:aa.fromJSON(a,{doc:i,extensions:L},{history:VB})});C||Sr(ne,Tm(ne.state).type),l(ne),I.clearSerializedEditorState({cellId:o})});A.useEffect(()=>{a===null?u.current===null?$():j():H(),u.current!==null&&f&&f.current!==null&&f.current.replaceChildren(u.current.dom)},[$,j,H,u,f,a,L]);const Y=u.current===null||a!==null;A.useEffect(()=>{const ne=ut.get(Js).scrollKey!==null;Y&&n&&!ne&&requestAnimationFrame(()=>{var te,q;(te=u.current)==null||te.focus(),(q=u.current)==null||q.dom.scrollIntoView({behavior:"smooth",block:"nearest"})})},[Y,n,u]),A.useEffect(()=>{const ne=u.current;return()=>{ne==null||ne.destroy()}},[u]);const Z=m&&!M||m&&M&&!_;let G="";return M&&m&&_?G="h-0 overflow-hidden":m&&(G="opacity-20 h-8 overflow-hidden"),h.jsx(f5,{enabled:(y==null?void 0:y.cellId)===o,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((re=u.current)==null?void 0:re.state.doc.toString())??i,currentLanguageAdapter:p,declineChange:Qe(()=>{var ne;v(null),(ne=u.current)==null||ne.focus()}),onChange:Qe(ne=>{var te;(te=u.current)==null||te.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}})}),acceptChange:Qe(ne=>{var te,q;(te=u.current)==null||te.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}}),(q=u.current)==null||q.focus(),v(null)}),children:h.jsxs("div",{className:"relative w-full",onFocus:()=>S(o),children:[Z&&h.jsx(g4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:g}),h.jsx(dx,{className:G,editorView:u.current,ref:f}),!m&&x&&h.jsx("div",{className:"absolute top-1 right-5",children:h.jsx(WE,{code:i,editorView:u.current,currentLanguageAdapter:p,onAfterToggle:F})})]})})},dx=K.forwardRef((t,e)=>{const n=X.c(10),{className:o,editorView:r}=t,i=A.useRef(null);let s,a,l,c,d;return n[0]!==r?(s=()=>{r!==null&&i.current!==null&&i.current.children.length===0&&i.current.append(r.dom)},a=[r,i],n[0]=r,n[1]=s,n[2]=a):(s=n[1],a=n[2]),A.useEffect(s,a),n[3]!==o?(l=Te("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=u=>{e?fl(e,i)(u):fl(i)(u)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=h.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});dx.displayName="CellCodeMirrorEditor";const Mu=Ei("rtc_v2")?function(t){const e=n=>{const o=X.c(5),r=We(Ro),[i,s]=yn(As);if(r.state===Qt.CONNECTING||i===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==s?(c=h.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:h.jsxs($B,{milliseconds:1e3,fallback:null,children:[l,h.jsx(De,{variant:"link",onClick:()=>{s("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=s,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=h.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(A.memo(cx)):A.memo(cx),p7=t=>{const e=X.c(10);let n,o,r,i;return e[0]!==t.left?(n=h.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=h.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=h.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(i=h.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=i):i=e[9],i},g7=t=>{const e=X.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,i;return e[0]!==t.isCollapsed?(o=h.jsx(_7,{isCollapsed:t.isCollapsed}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=h.jsx(Me,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(i=h.jsx(De,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=i):i=e[7],i},_7=t=>{const e=X.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?h.jsx(Zs,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(Xs,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},ux=A.memo(t=>{const e=X.c(24),{onClick:n,count:o,cellId:r}=t,i=gc();let s;e[0]!==r||e[1]!==i?(s=HB(i,r),e[0]=r,e[1]=i,e[2]=s):s=e[2];const a=s;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Te("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(WB,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let u,f,m,_,g,p,b;return e[5]!==o||e[6]!==d?(u=h.jsxs(h.Fragment,{children:[c,h.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=u):u=e[7],e[8]!==a.errored?(f=a.errored&&h.jsx(Me,{content:"Has errors",delayDuration:100,children:h.jsx(jp,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&h.jsx(Me,{content:"Has stale cells",delayDuration:100,children:h.jsx(_4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&h.jsx(Me,{content:"Running",delayDuration:100,children:h.jsx(Ic,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==m||e[16]!==_?(g=h.jsxs(h.Fragment,{children:[f,m,_]}),e[14]=f,e[15]=m,e[16]=_,e[17]=g):g=e[17],e[18]!==u||e[19]!==g?(p=h.jsx(p7,{center:u,right:g}),e[18]=u,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=h.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});ux.displayName="CollapsedCellBanner";const b7=t=>{const e=X.c(6),{appClosed:n,status:o}=t,r=Og(o==="running");let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=hn("global.interrupt"),e[0]=i):i=e[0];const s=n||!r,a=r?Mm:jn.NOOP,l=r?"stale":"disabled";let c,d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Jf,{strokeWidth:1.5}),e[1]=c):c=e[1],e[2]!==s||e[3]!==a||e[4]!==l?(d=h.jsx(bs,{tooltip:i,disabled:s,onClick:a,variant:l,"data-testid":"run-button",children:c}),e[2]=s,e[3]=a,e[4]=l,e[5]=d):d=e[5],d},y7={width:void 0,height:void 0};function hx(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function fx(t,e){const n=X.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||Qf(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Qe(o);let i;n[3]!==t.current||n[4]!==e?(i=l=>{if(t.current===document.activeElement&&e.current!==null&&ra(e.current.state)==="active"){for(const c of o4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=i):i=n[5];const s=Qe(i);let a;return n[6]!==r||n[7]!==s?(a={closeCompletionHandler:r,resumeCompletionHandler:s},n[6]=r,n[7]=s,n[8]=a):a=n[8],a}function mx(t,e,n,o,r,i,s,a,l){const c=X.c(51);let d,u,f,m,_,g,p,b,x,y,v,S,k,N,E,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},u=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=u):(d=c[3],u=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),m=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=m,c[9]=_,c[10]=g):(f=c[7],m=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(p=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=p,c[15]=b):(p=c[14],b=c[15]),c[16]!==o||c[17]!==i||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==s?(x=()=>{var M,R,B;const T=!i.hide_code;Cr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((M=s.current)==null||M.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(B=s.current)==null||B.focus()},c[16]=o,c[17]=i,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=s,c[21]=x):x=c[21],c[22]!==o||c[23]!==e?(k=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),y=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),S=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=y,c[25]=v,c[26]=S,c[27]=k):(y=c[24],v=c[25],S=c[26],k=c[27]),c[28]!==e||c[29]!==s||c[30]!==a?(N=()=>{let T;T=!1,a(M=>(M==null?void 0:M.cellId)===e?(T=!0,null):{cellId:e}),T&&Y1(s).focus()},c[28]=e,c[29]=s,c[30]=a,c[31]=N):N=c[31],c[32]!==l?(E=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=E):E=c[33],c[34]!==n||c[35]!==d||c[36]!==u||c[37]!==y||c[38]!==v||c[39]!==S||c[40]!==N||c[41]!==E||c[42]!==f||c[43]!==m||c[44]!==_||c[45]!==g||c[46]!==p||c[47]!==b||c[48]!==x||c[49]!==k?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":u,"cell.createAbove":f,"cell.createBelow":m,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":p,"cell.moveRight":b,"cell.hideCode":x,"cell.focusDown":k,"cell.focusUp":y,"cell.sendToBottom":v,"cell.sendToTop":S,"cell.aiCompletion":N,"cell.cellActions":E},c[34]=n,c[35]=d,c[36]=u,c[37]=y,c[38]=v,c[39]=S,c[40]=N,c[41]=E,c[42]=f,c[43]=m,c[44]=_,c[45]=g,c[46]=p,c[47]=b,c[48]=x,c[49]=k,c[50]=I):I=c[50],zV(t,I)}function px(t,e,n,o,r,i){const s=X.c(16);let a,l,c,d,u;s[0]!==n||s[1]!==e?(a=f=>(!f||!un.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!un.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),s[0]=n,s[1]=e,s[2]=a,s[3]=l):(a=s[2],l=s[3]),s[4]!==o?(c=()=>(o(),!1),s[4]=o,s[5]=c):c=s[5],s[6]!==n||s[7]!==e||s[8]!==i||s[9]!==r.keymap.preset?(d=r.keymap.preset!=="vim"||i?{}:{j:f=>(!f||!un.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!un.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},s[6]=n,s[7]=e,s[8]=i,s[9]=r.keymap.preset,s[10]=d):d=s[10],s[11]!==a||s[12]!==l||s[13]!==c||s[14]!==d?(u={ArrowDown:a,ArrowUp:l,Enter:c,...d},s[11]=a,s[12]=l,s[13]=c,s[14]=d,s[15]=u):u=s[15],BV(t,u)}const gx=A.forwardRef((t,e)=>{const n=X.c(14),{id:o,output:r,interrupted:i,errored:s,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let u;n[0]===Symbol.for("react.memo_cache_sentinel")?(u=Om("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=u):u=n[0];const f=u;let m;n[1]!==o?(m=Pi.create(o),n[1]=o,n[2]=m):m=n[2];const _=m,g=x4(r==null?void 0:r.mimetype);if(s||i||a||g)return null;let p,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(p=h.jsx(Tc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:d}),n[3]=o,n[4]=r,n[5]=d,n[6]=c,n[7]=p):p=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==p?(b=h.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:p}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=p,n[13]=b):b=n[13],b});gx.displayName="ReadonlyCellComponent";const x7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:i,consoleOutputs:s,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:m,stopped:_,staleInputs:g,serializedEditorState:p,serialization:b,debuggerActive:x,appClosed:y,canDelete:v,actions:S,deleteCell:k,userConfig:N,outline:E,isCollapsed:I,collapseCount:T,config:M,canMoveX:R,name:B,editorView:O,setEditorView:z,outputStale:F})=>{const V=A.useRef(null),L=A.useRef(null),C=A.useRef(null),$=A.useRef(null),j=$t(Ea),H=ed(o),[Y,Z]=A.useState(),G=M.disabled||a==="disabled-transitively",re=w4({executionTime:d,status:a,errored:m,interrupted:f,stopped:_}),ne=u||f||g&&!G,te=b4(a),q=(a==="queued"||u||g)&&!f,Q=A.useCallback(()=>O.current,[O]),{closeCompletionHandler:ie,resumeCompletionHandler:ue}=fx(V,O),{isCellCodeShown:le,isMarkdown:_e,isMarkdownCodeHidden:ce,temporarilyShowCode:Ne,showHiddenMarkdownCode:je}=function(me,pe,he,ke){const xe=X.c(13),[Ue,Ze]=A.useState(!1),ae=!me.hide_code||Ue,Se=pe==="markdown",Ce=Se&&!ae;let Be;xe[0]!==he||xe[1]!==ke||xe[2]!==ae?(Be=Ye=>{var Mt,wt;if(ae)return;const rt=(Ye==null?void 0:Ye.focus)??!0;Ze(!0),rt&&((Mt=he.current)==null||Mt.focus());const gt=(wt=ke.current)==null?void 0:wt.parentElement;if(!gt)return void mt.error("Cell: No parent element found for editor view");const xt=()=>{requestAnimationFrame(()=>{var Vt;gt.contains(document.activeElement)||(Ze(!1),(Vt=he.current)==null||Vt.dom.blur(),gt.removeEventListener("focusout",xt))})};gt.addEventListener("focusout",xt)},xe[0]=he,xe[1]=ke,xe[2]=ae,xe[3]=Be):Be=xe[3];const He=Qe(Be);let Re;xe[4]!==Ce||xe[5]!==He?(Re=()=>{Ce&&He({focus:!0})},xe[4]=Ce,xe[5]=He,xe[6]=Re):Re=xe[6];const Ge=Qe(Re);let ot;return xe[7]!==ae||xe[8]!==Se||xe[9]!==Ce||xe[10]!==Ge||xe[11]!==He?(ot={isCellCodeShown:ae,isMarkdown:Se,isMarkdownCodeHidden:Ce,temporarilyShowCode:He,showHiddenMarkdownCode:Ge},xe[7]=ae,xe[8]=Se,xe[9]=Ce,xe[10]=Ge,xe[11]=He,xe[12]=ot):ot=xe[12],ot}(M,Y,O,C);mx(V,o,H,S,R,M,O,j,L),px(V,o,S,je,N,le);const de=GB(E),Ee=!y4(i),ge=s.length>0,Oe=N.display.cell_output,Fe=Ee&&Oe==="above",$e=Ee&&Oe==="below",[Xe,Le]=A.useState(!1),[et,nt]=A.useState(!1);(function(me){const{ref:pe,box:he="content-box",skip:ke}=me,xe=A.useRef({...y7}),Ue=A.useRef(void 0);Ue.current=me.onResize,A.useEffect(()=>{if(!pe.current||ke||typeof window>"u"||!("ResizeObserver"in window))return;const Ze=new ResizeObserver(([ae])=>{const Se=he==="border-box"?"borderBoxSize":he==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ce=hx(ae,Se,"inlineSize"),Be=hx(ae,Se,"blockSize");if(xe.current.width!==Ce||xe.current.height!==Be){const He={width:Ce,height:Be};xe.current.width=Ce,xe.current.height=Be,Ue.current&&Ue.current(He)}});return Ze.observe(pe.current,{box:he}),()=>{Ze.disconnect()}},[he,pe,ke])})({ref:$,skip:!_e,onResize:me=>{const pe=me.height&&me.height<68,he=ce&&(pe||Oe==="below");Le(he),de&&he?nt(!0):et&&nt(!1)}});const it=me=>h.jsx(g4,{tooltip:"Edit markdown",className:Te("z-20 relative",me),onClick:Ne}),oe=Ee&&h.jsxs("div",{className:"relative",onDoubleClick:je,children:[h.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:h.jsx(g7,{isCollapsed:I,onClick:()=>{I?S.expandCell({cellId:o}):S.collapseCell({cellId:o})},canCollapse:de})}),ce&&$e&&it("top-3"),h.jsx(Tc,{allowExpand:!0,forceExpand:ce,output:i,className:"output-area",cellId:o,stale:F,loading:te}),ce&&Fe&&it("bottom-3")]}),ve=Om("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":m,stopped:_,disabled:M.disabled,stale:a==="disabled-transitively",borderless:ce&&Ee}),Ie=Pi.create(o),ze=Qe(me=>{j({cellId:o,initialPrompt:me.prompt})}),J=!(!b||b.toLowerCase()!=="valid");return h.jsx(Dm,{children:h.jsx(p0,{cellId:o,config:M,status:a,getEditorView:Q,hasOutput:Ee,hasConsoleOutput:ge,name:B,children:h.jsxs(u0,{tabIndex:-1,ref:V,"data-status":a,onBlur:ie,onKeyDown:ue,cellId:o,canMoveX:R,title:M.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[h.jsxs("div",{className:ve,id:Ie,ref:$,"data-cell-id":o,"data-cell-name":B,children:[Oe==="above"&&oe,h.jsxs("div",{className:Te("tray"),"data-hidden":ce,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(bx,{edited:u,appClosed:y,status:a,cellConfig:M,needsRun:ne,hasOutput:Ee,hasConsoleOutput:ge,cellActionDropdownRef:L,cellId:o,name:B,getEditorView:Q,onRun:H})}),h.jsx(w7,{cellId:o,className:Te(ce&&Fe&&"-top-7",ce&&$e&&"-bottom-8",ce&&et&&"-left-[3.8rem]"),appClosed:y,actions:S}),h.jsx(Mu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:M,status:a,serializedEditorState:p,runCell:H,setEditorView:z,userConfig:N,editorViewRef:O,editorViewParentRef:C,hidden:!le,hasOutput:Ee,temporarilyShowCode:Ne,languageAdapter:Y,setLanguageAdapter:Z}),h.jsx(_x,{className:Te(ce&&Oe==="below"&&"top-14"),edited:u,status:a,isCellStatusInline:Xe,uninstantiated:re,disabled:M.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:v&&le&&h.jsx(S_,{appClosed:y,status:a,onClick:()=>{te||y||k({cellId:o})}})})]}),Oe==="below"&&oe,b&&h.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",children:[J&&h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),h.jsx(Me,{content:h.jsx("span",{className:"max-w-16 text-xs",children:J?"This function or class can be imported into other Python notebooks or modules.":h.jsxs(h.Fragment,{children:["This definition can't be reused in other Python modules:",h.jsx("br",{}),h.jsx("br",{}),h.jsx("pre",{children:b}),h.jsx("br",{}),"Click this icon to learn more."]})}),children:J&&h.jsx(rc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||h.jsx(Rm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),h.jsx(Km,{consoleOutputs:s,stale:q,cellName:b?"_":B,onRefactorWithAI:ze,onClear:()=>{S.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(me,pe)=>{S.setStdinResponse({cellId:o,response:me,outputIndex:pe}),v4({text:me})},cellId:o,debuggerActive:x})]}),I&&h.jsx(ux,{onClick:()=>S.expandCell({cellId:o}),count:T,cellId:o})]})})})},_x=t=>{const e=X.c(19),{className:n,disabled:o,edited:r,interrupted:i,isCellStatusInline:s,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:u,uninstantiated:f}=t,m=o!==void 0&&o;let _;e[0]!==m||e[1]!==r||e[2]!==i||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==u||e[8]!==f?(_=h.jsx(j_,{status:u,staleInputs:d,interrupted:i,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=i,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=u,e[8]=f,e[9]=_):_=e[9];const g=_;let p;e[10]!==n?(p=Te("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!s&&g;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(d0,{}),e[12]=x):x=e[12];const y=s&&g;let v,S;return e[13]!==y?(v=h.jsxs("div",{className:"flex gap-2 items-end",children:[x,y]}),e[13]=y,e[14]=v):v=e[14],e[15]!==p||e[16]!==b||e[17]!==v?(S=h.jsxs("div",{className:p,children:[b,v]}),e[15]=p,e[16]=b,e[17]=v,e[18]=S):S=e[18],S},w7=t=>{const e=X.c(21),{className:n,appClosed:o,actions:r,cellId:i}=t;let s;e[0]!==r||e[1]!==i?(s=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:i,before:!1,...v})},e[0]=r,e[1]=i,e[2]=s):s=e[2];const a=Qe(s);let l;e[3]!==r||e[4]!==i?(l=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:i,before:!0,...v})},e[3]=r,e[4]=i,e[5]=l):l=e[5];const c=Qe(l);let d,u;e[6]!==n?(d=Te("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=hn("cell.createAbove"),e[8]=u):u=e[8];const f=o?void 0:c;let m,_,g;e[9]!==o||e[10]!==f?(m=h.jsx(k_,{tooltipContent:u,appClosed:o,onClick:f}),e[9]=o,e[10]=f,e[11]=m):m=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"flex-1"}),e[12]=_):_=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(g=hn("cell.createBelow"),e[13]=g):g=e[13];const p=o?void 0:a;let b,x;return e[14]!==o||e[15]!==p?(b=h.jsx(k_,{tooltipContent:g,appClosed:o,onClick:p}),e[14]=o,e[15]=p,e[16]=b):b=e[16],e[17]!==d||e[18]!==m||e[19]!==b?(x=h.jsxs("div",{className:d,children:[m,_,b]}),e[17]=d,e[18]=m,e[19]=b,e[20]=x):x=e[20],x},bx=t=>{const e=X.c(27),{edited:n,appClosed:o,status:r,cellConfig:i,needsRun:s,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:u,getEditorView:f,name:m,includeCellActions:_}=t,g=_===void 0||_,p=!s&&"hover-action";let b;e[0]!==p?(b=Te(p),e[0]=p,e[1]=b):b=e[1];const x=o?jn.NOOP:c;let y,v,S,k;return e[2]!==o||e[3]!==i||e[4]!==n||e[5]!==s||e[6]!==r||e[7]!==x?(y=h.jsx(Gj,{edited:n,onClick:x,appClosed:o,status:r,config:i,needsRun:s}),e[2]=o,e[3]=i,e[4]=n,e[5]=s,e[6]=r,e[7]=x,e[8]=y):y=e[8],e[9]!==o||e[10]!==r?(v=h.jsx(b7,{status:r,appClosed:o}),e[9]=o,e[10]=r,e[11]=v):v=e[11],e[12]!==d||e[13]!==i||e[14]!==u||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==m||e[20]!==r?(S=g&&h.jsx(f0,{ref:d,cellId:u,status:r,getEditorView:f,name:m,config:i,hasOutput:a,hasConsoleOutput:l,children:h.jsx(bs,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:h.jsx(oS,{strokeWidth:1.5})})}),e[12]=d,e[13]=i,e[14]=u,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=m,e[20]=r,e[21]=S):S=e[21],e[22]!==b||e[23]!==y||e[24]!==v||e[25]!==S?(k=h.jsxs(qj,{className:b,children:[y,v,S]}),e[22]=b,e[23]=y,e[24]=v,e[25]=S,e[26]=k):k=e[26],k},v7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:i,consoleOutputs:s,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:m,stopped:_,staleInputs:g,serializedEditorState:p,debuggerActive:b,appClosed:x,canDelete:y,actions:v,deleteCell:S,userConfig:k,config:N,canMoveX:E,name:I,editorView:T,setEditorView:M})=>{const R=A.useRef(null),B=A.useRef(null),O=A.useRef(null),z=$t(Ea),F=ed(o),V=N.disabled||a==="disabled-transitively",L=w4({executionTime:d,status:a,errored:m,interrupted:f,stopped:_}),C=u||f||g&&!V,$=a==="running"||a==="queued",j=(a==="queued"||u||g)&&!f,H=A.useCallback(()=>T.current,[T]),{closeCompletionHandler:Y,resumeCompletionHandler:Z}=fx(R,T);mx(R,o,F,v,E,N,T,z,B),px(R,o,v,jn.NOOP,k,!0);const G=!y4(i),re=s.length>0,ne=x4(i==null?void 0:i.mimetype),te=Om("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":C,"has-error":m,stopped:_}),q=Pi.create(o),Q=Qe(ie=>{z({cellId:o,initialPrompt:ie.prompt})});return h.jsx(Dm,{children:h.jsx(p0,{cellId:o,config:N,status:a,getEditorView:H,hasOutput:G,hasConsoleOutput:re,name:I,children:h.jsxs("div",{className:te,"data-status":a,id:q,ref:R,onBlur:Y,onKeyDown:Z,title:N.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":o,"data-cell-name":I,"data-setup-cell":!0,children:[h.jsxs("div",{className:Te("tray"),"data-hidden":!1,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(bx,{edited:u,appClosed:x,status:a,cellConfig:N,needsRun:C,hasOutput:G,hasConsoleOutput:re,cellActionDropdownRef:B,cellId:o,name:I,getEditorView:H,onRun:F,includeCellActions:!1})}),h.jsx(Mu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:N,status:a,serializedEditorState:p,runCell:F,setEditorView:M,userConfig:k,editorViewRef:T,editorViewParentRef:O,hidden:!1,hasOutput:G,temporarilyShowCode:jn.NOOP,languageAdapter:"python",setLanguageAdapter:jn.NOOP,showLanguageToggles:!1}),h.jsx(_x,{edited:u,status:a,isCellStatusInline:!1,uninstantiated:L,disabled:N.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:y&&h.jsx(S_,{appClosed:x,status:a,onClick:()=>{$||x||S({cellId:o})}})})]}),h.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),h.jsx(Me,{content:h.jsxs("span",{className:"max-w-16",children:["This ",h.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",h.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:h.jsx(Rm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&h.jsx(Tc,{allowExpand:!0,forceExpand:!0,output:i,className:"output-area",cellId:o,stale:!1,loading:$}),h.jsx(Km,{consoleOutputs:s,stale:j,cellName:"_",onRefactorWithAI:Q,onClear:()=>{v.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(ie,ue)=>{v.setStdinResponse({cellId:o,response:ie,outputIndex:ue}),v4({text:ie})},cellId:o,debuggerActive:b})]})})})},yx=A.memo(A.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:i,staleInputs:s,edited:a,id:l,mode:c}=t;mt.debug("Rendering Cell",l);const d=A.useRef(null);A.useImperativeHandle(e,()=>({get editorView(){return Y1(d)}}),[d]);const u=qB({status:n,output:o,runStartTimestamp:r,interrupted:i,staleInputs:s},a),f=b4(n);return l===zo?h.jsx(v7,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:u}):c==="edit"?h.jsx(x7,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:u}):h.jsx(gx,{...t,outputStale:u,outputLoading:f})})),k7=t=>{const e=X.c(10),{width:n}=t,{banners:o}=JV(),{removeBanner:r}=KV();if(o.length===0)return null;const i=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let s,a,l;if(e[0]!==i?(s=Te("flex flex-col gap-4 mb-5 print:hidden",i),e[0]=i,e[1]=s):s=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>h.jsxs(Pm,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[h.jsxs("div",{className:"flex justify-between",children:[h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(YB,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),h.jsx(De,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:h.jsx(Jn,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"flex justify-between items-end",children:[h.jsx("span",{children:Lm({html:d.description})}),d.action==="restart"&&h.jsx(S7,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==s||e[8]!==a?(l=h.jsx("div",{className:s,children:a}),e[7]=s,e[8]=a,e[9]=l):l=e[9],l},S7=()=>{const t=X.c(3),e=eg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Op,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=h.jsxs(De,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},C7=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,i=s=>{const a=s.match(r);if(!a)return null;const[,l,c,d,u]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:u||""}};try{const s=i(n),a=i(o);return s&&a?s.major!==a.major?s.major-a.major:s.minor!==a.minor?s.minor-a.minor:s.patch!==a.patch?s.patch-a.patch:s.preRelease===""&&a.preRelease!==""?1:s.preRelease!==""&&a.preRelease===""?-1:s.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),N7=()=>{const t=X.c(66),{packageAlert:e}=XV(),{clearPackageAlert:n}=ZV(),[o]=Mi();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[i,s]=A.useState(r);if(e===null)return null;const a=o.package_management.manager!=="pixi";if(QV(e)){let l,c,d,u,f,m,_,g,p,b;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(Yc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[1]=l):l=t[1],t[2]!==n||t[3]!==e.id?(c=()=>n(e.id),t[2]=n,t[3]=e.id,t[4]=c):c=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Jn,{className:"w-5 h-5"}),t[5]=d):d=t[5],t[6]!==c?(u=h.jsxs("div",{className:"flex justify-between",children:[l,h.jsx(De,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:c,children:d})]}),t[6]=c,t[7]=u):u=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("p",{children:"The following packages were not found:"}),t[8]=f):f=t[8],t[9]!==i||t[10]!==a||t[11]!==e.packages){let x;t[13]!==i||t[14]!==a?(x=(y,v)=>h.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[h.jsx(ga,{size:"1rem"}),y,a&&h.jsx(A7,{value:i[y]??"latest",onChange:S=>s(k=>({...k,[y]:S})),packageName:y})]},v),t[13]=i,t[14]=a,t[15]=x):x=t[15],m=e.packages.map(x),t[9]=i,t[10]=a,t[11]=e.packages,t[12]=m}else m=t[12];return t[16]!==m?(_=h.jsxs("div",{children:[f,h.jsx("ul",{className:"list-disc ml-4 mt-1",children:m})]}),t[16]=m,t[17]=_):_=t[17],t[18]!==n||t[19]!==i||t[20]!==e.id||t[21]!==e.isolated||t[22]!==e.packages||t[23]!==o.package_management.manager?(g=h.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?h.jsxs(h.Fragment,{children:[h.jsx(E7,{manager:o.package_management.manager,packages:e.packages,versions:i,clearPackageAlert:()=>n(e.id)}),!qn()&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"px-2 text-sm",children:"with"})," ",h.jsx(I7,{})]})]}):h.jsxs("p",{children:["If you set up a"," ",h.jsx(mm,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[18]=n,t[19]=i,t[20]=e.id,t[21]=e.isolated,t[22]=e.packages,t[23]=o.package_management.manager,t[24]=g):g=t[24],t[25]!==_||t[26]!==g?(p=h.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[_,g]}),t[25]=_,t[26]=g,t[27]=p):p=t[27],t[28]!==u||t[29]!==p?(b=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pm,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[u,p]})}),t[28]=u,t[29]=p,t[30]=b):b=t[30],b}if(e$(e)){let l;t[31]!==e.packages?(l=function(M){const R=new Set(Object.values(M)),B=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:h.jsx(wa,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:h.jsx(Ep,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:h.jsx(Yc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[31]=e.packages,t[32]=l):l=t[32];const{status:c,title:d,titleIcon:u,description:f}=l;c==="installed"&&setTimeout(()=>n(e.id),1e4);const m=c==="failed"?"danger":"info";let _,g,p,b,x;t[33]!==d||t[34]!==u?(_=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u,d]}),t[33]=d,t[34]=u,t[35]=_):_=t[35],t[36]!==n||t[37]!==e.id?(g=()=>n(e.id),t[36]=n,t[37]=e.id,t[38]=g):g=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Jn,{className:"w-5 h-5"}),t[39]=p):p=t[39],t[40]!==g?(b=h.jsx(De,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:g,children:p}),t[40]=g,t[41]=b):b=t[41],t[42]!==_||t[43]!==b?(x=h.jsxs("div",{className:"flex justify-between",children:[_,b]}),t[42]=_,t[43]=b,t[44]=x):x=t[44];const y=c==="installed"&&"text-accent-foreground";let v,S,k,N,E,I,T;if(t[45]!==y?(v=Te("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",y),t[45]=y,t[46]=v):v=t[46],t[47]!==f?(S=h.jsx("p",{children:f}),t[47]=f,t[48]=S):S=t[48],t[49]!==e.packages||t[50]!==c){let M;t[52]!==c?(M=(R,B)=>{const[O,z]=R;return h.jsxs("li",{className:Te("flex items-center gap-1 font-mono text-sm",z==="installing"&&"font-semibold",z==="failed"&&"text-destructive",z==="installed"&&"text-accent-foreground",z==="installed"&&c==="failed"&&"text-muted-foreground"),children:[h.jsx(j7,{status:z}),O]},B)},t[52]=c,t[53]=M):M=t[53],k=Object.entries(e.packages).map(M),t[49]=e.packages,t[50]=c,t[51]=k}else k=t[51];return t[54]!==k?(N=h.jsx("ul",{className:"list-disc ml-4 mt-1",children:k}),t[54]=k,t[55]=N):N=t[55],t[56]!==S||t[57]!==N?(E=h.jsxs("div",{children:[S,N]}),t[56]=S,t[57]=N,t[58]=E):E=t[58],t[59]!==E||t[60]!==v?(I=h.jsx("div",{className:v,children:E}),t[59]=E,t[60]=v,t[61]=I):I=t[61],t[62]!==I||t[63]!==m||t[64]!==x?(T=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pm,{kind:m,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[x,I]})}),t[62]=I,t[63]=m,t[64]=x,t[65]=T):T=t[65],T}return Ql(e),null},j7=t=>{const e=X.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ga,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(wa,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(dc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(Jn,{size:"1rem"}),e[3]=o):o=e[3],o}default:return Ql(n),null}},E7=t=>{const e=X.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:i}=t;let s,a,l,c;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r?(s=async()=>{i();const d={...r};for(const u of o)d[u]=d[u]??"";await ZB({manager:n,versions:d}).catch(T7)},e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(wa,{className:"w-4 h-4 mr-2"}),l=h.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==s?(c=h.jsxs(De,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:s,children:[a,l]}),e[7]=s,e[8]=c):c=e[8],c},I7=()=>{const t=X.c(16),[e,n]=Mi();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=z3(JB),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const i=B3(r);let s;t[3]!==n?(s=async f=>{await Oi({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=s):s=t[4];const a=s;let l,c,d,u;return t[5]!==i||t[6]!==a?(l=i.handleSubmit(a),t[5]=i,t[6]=a,t[7]=l):l=t[7],t[8]!==i.control?(c=h.jsx("div",{className:"flex flex-col gap-3",children:h.jsx(R3,{control:i.control,name:"package_management.manager",render:O7})}),t[8]=i.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(d=h.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=d):d=t[12],t[13]!==i||t[14]!==d?(u=h.jsx(KB,{...i,children:d}),t[13]=i,t[14]=d,t[15]=u):u=t[15],u},A7=t=>{const e=X.c(21),{value:n,onChange:o,packageName:r}=t;let i,s;e[0]!==r?(i=async()=>{const g=await fetch(`https://pypi.org/pypi/${function(b){return b.replaceAll(/\[.*]/g,"").trim()}(r)}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)}),p=await g.json();return["latest",...Object.keys(p.releases).sort(C7).slice(0,100)]},s=[r],e[0]=r,e[1]=i,e[2]=s):(i=e[1],s=e[2]);const{data:a,loading:l,error:c}=Yn(i,s);let d;e[3]!==a?(d=a===void 0?[]:a,e[3]=a,e[4]=d):d=e[4];const u=d;if(c){let g,p,b;return e[5]!==o?(g=x=>o(x.target.value),e[5]=o,e[6]=g):g=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx("option",{value:"latest",children:"latest"}),e[7]=p):p=e[7],e[8]!==g||e[9]!==n?(b=h.jsx(Me,{content:"Failed to fetch package versions",children:h.jsx(Fm,{value:n,onChange:g,disabled:!0,className:"inline-flex ml-2",children:p})}),e[8]=g,e[9]=n,e[10]=b):b=e[10],b}let f,m,_;return e[11]!==o?(f=g=>o(g.target.value),e[11]=o,e[12]=f):f=e[12],e[13]!==u||e[14]!==l?(m=l?h.jsx("option",{value:"latest",children:"latest"}):u.map(D7),e[13]=u,e[14]=l,e[15]=m):m=e[15],e[16]!==l||e[17]!==f||e[18]!==m||e[19]!==n?(_=h.jsx(Fm,{value:n,onChange:f,disabled:l,className:"inline-flex ml-2",children:m}),e[16]=l,e[17]=f,e[18]=m,e[19]=n,e[20]=_):_=e[20],_};function T7(t){mt.error(t)}function M7(t){return h.jsx("option",{value:t,children:t},t)}function O7(t){const{field:e}=t;return h.jsxs(P3,{children:[h.jsx(L3,{children:h.jsx(Fm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:XB.map(M7)})}),h.jsx(F3,{})]})}function D7(t){return h.jsx("option",{value:t,children:t},t)}const R7=t=>{let{transform:e}=t;return{...e,x:0}},P7={threshold:{x:0,y:.1}},L7=K.memo(t=>{const e=X.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:i,moveColumn:s,compactColumns:a}=zt(),[l,c]=A.useState(null),[d,u]=A.useState(null),[f]=A3();let m;e:{if(f.width==="columns"){m=zm.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[R7],e[0]=O):O=e[0],m=O}const _=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:zE},e[2]=p):p=e[2];const b=function(){for(var O=arguments.length,z=new Array(O),F=0;F<O;F++)z[F]=arguments[F];return A.useMemo(()=>[...z].filter(V=>V!=null),[...z])}(A_(iu,g),A_(ou,p));let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=O=>{c(O.active.id);const z=co();u(z.cellIds)},e[3]=x):x=e[3];const y=Qe(x);let v;e[4]!==d?(v=()=>{c(null),u(null)},e[4]=d,e[5]=v):v=e[5];const S=Qe(v);let k;e[6]!==l?(k=O=>{const z=O.droppableContainers.filter(F7);if(l&&ti(l))return Zd({...O,droppableContainers:z});const F=(j=>{let{droppableContainers:H,droppableRects:Y,pointerCoordinates:Z}=j;if(!Z)return[];const G=[];for(const re of H){const{id:ne}=re,te=Y.get(ne);if(te&&oE(Z,te)){const q=Kd(te).reduce((ie,ue)=>ie+Yd(Z,ue),0),Q=Number((q/4).toFixed(4));G.push({id:ne,data:{droppableContainer:re,value:Q}})}}return G.sort(Jd)})({...O,droppableContainers:z}),V=Xd(F.length>0?F:M_({...O,droppableContainers:z}),"id");if(!V)return[];Er(ti(V),`Expected column id. Got: ${V}`);const L=co().cellIds.get(V);if(Er(L,`Expected column. Got: ${V}`),L&&L.topLevelIds.length===0)return[{id:V}];const C=new Set(L.topLevelIds),$=Zd({...O,droppableContainers:O.droppableContainers.filter(j=>j.id!==V&&C.has(j.id))});if($.length>0){const j=$[0].id;return Er(Ou(j),`Expected cell id. Got: ${j}`),[{id:j}]}return[]},e[6]=l,e[7]=k):k=e[7];const N=k;let E;e[8]!==r||e[9]!==i||e[10]!==s?(E=O=>{const{active:z,over:F}=O,V=F==null?void 0:F.id;if(V!=null&&z.id!==V){if(Ou(z.id)){if(ti(V))return void i({cellId:z.id,columnId:V});if(Ou(V))return void r({cellId:z.id,overCellId:V})}ti(z.id)&&ti(V)&&s({column:z.id,overColumn:V})}},e[8]=r,e[9]=i,e[10]=s,e[11]=E):E=e[11];const I=Qe(E);let T;e[12]!==a?(T=O=>{const{active:z,over:F}=O;F!==null&&z.id!==F.id&&a()},e[12]=a,e[13]=T):T=e[13];const M=Qe(T),R=o?N:Zd;let B;return e[14]!==n||e[15]!==S||e[16]!==M||e[17]!==I||e[18]!==y||e[19]!==_||e[20]!==b||e[21]!==R?(B=h.jsx(NE,{autoScroll:P7,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:M,onDragStart:y,onDragCancel:S,onDragOver:I,children:n}),e[14]=n,e[15]=S,e[16]=M,e[17]=I,e[18]=y,e[19]=_,e[20]=b,e[21]=R,e[22]=B):B=e[22],B});function Ou(t){return typeof t=="string"&&!t.startsWith("tree_")}function ti(t){return typeof t=="string"&&t.startsWith("tree_")}function F7(t){return ti(t.id)}const xx=K.forwardRef((t,e)=>{const n=X.c(62);let o,r,i,s,a,l;n[0]!==t?({columnId:s,canDelete:o,canMoveLeft:r,canMoveRight:i,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i,n[4]=s,n[5]=a):(o=n[1],r=n[2],i=n[3],s=n[4],a=n[5]),n[6]!==s?(l={id:s},n[6]=s,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:u,transform:f,transition:m,isDragging:_,isOver:g}=a0(l);let p;n[8]!==f?(p=f?jc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=_?2:void 0;let x;n[10]!==p||n[11]!==b||n[12]!==m?(x={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=x):x=n[13];const y=x,{deleteColumn:v,moveColumn:S,addColumn:k}=zt();let N;n[14]===Symbol.for("react.memo_cache_sentinel")?(N=Te("h-full hover:bg-muted rounded-none"),n[14]=N):N=n[14];const E=N,I=B7;let T;n[15]!==s||n[16]!==S?(T=()=>S({column:s,overColumn:"_left_"}),n[15]=s,n[16]=S,n[17]=T):T=n[17];const M=!r;let R,B,O;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=h.jsx(I3,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==T||n[20]!==M?(B=h.jsx(Me,{content:"Move column left",side:"top",delayDuration:300,children:h.jsx(De,{variant:"text",size:"sm",className:E,onClick:T,disabled:M,children:R})}),n[19]=T,n[20]=M,n[21]=B):B=n[21],n[22]!==s||n[23]!==S?(O=()=>S({column:s,overColumn:"_right_"}),n[22]=s,n[23]=S,n[24]=O):O=n[24];const z=!i;let F,V,L,C,$,j,H,Y;n[25]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(Zs,{className:"size-4"}),n[25]=F):F=n[25],n[26]!==O||n[27]!==z?(V=h.jsx(Me,{content:"Move column right",side:"top",delayDuration:300,children:h.jsx(De,{variant:"text",size:"sm",className:E,onClick:O,disabled:z,children:F})}),n[26]=O,n[27]=z,n[28]=V):V=n[28],n[29]!==c||n[30]!==d?(L=h.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]=L):L=n[31],n[32]!==o||n[33]!==s||n[34]!==v?(C=o&&h.jsx(Me,{content:"Delete column",side:"top",delayDuration:300,children:h.jsx(De,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>v({columnId:s}),children:h.jsx(Jn,{className:"size-4"})})}),n[32]=o,n[33]=s,n[34]=v,n[35]=C):C=n[35],n[36]!==k||n[37]!==s?($=()=>{k({columnId:s}),requestAnimationFrame(I)},n[36]=k,n[37]=s,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(Ar,{className:"size-4"}),n[39]=j):j=n[39],n[40]!==$?(H=h.jsx(Me,{content:"Add column",side:"top",delayDuration:300,children:h.jsx(De,{variant:"text",size:"sm",className:E,onClick:$,children:j})}),n[40]=$,n[41]=H):H=n[41],n[42]!==V||n[43]!==L||n[44]!==C||n[45]!==H||n[46]!==B?(Y=h.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:[B,V,L,C,H]}),n[42]=V,n[43]=L,n[44]=C,n[45]=H,n[46]=B,n[47]=Y):Y=n[47];const Z=Y;let G;n[48]!==e||n[49]!==u?(G=ie=>{fl(e,u)(ie)},n[48]=e,n[49]=u,n[50]=G):G=n[50];const re=_?"":a.className,ne=_?"z-20":"z-1 hover:z-10 focus-within:z-10",te=g&&"bg-accent/20";let q,Q;return n[51]!==re||n[52]!==ne||n[53]!==te?(q=Te(re,ne,te),n[51]=re,n[52]=ne,n[53]=te,n[54]=q):q=n[54],n[55]!==Z||n[56]!==_||n[57]!==a||n[58]!==y||n[59]!==G||n[60]!==q?(Q=h.jsxs("div",{tabIndex:-1,ref:G,...a,style:y,"data-is-dragging":_,className:q,children:[Z,a.children]}),n[55]=Z,n[56]=_,n[57]=a,n[58]=y,n[59]=G,n[60]=q,n[61]=Q):Q=n[61],Q});xx.displayName="SortableColumn";const z7=A.memo(xx);function B7(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:U7,saveColumnWidth:V7}=QB,wx=A.memo(t=>{const e=X.c(14),n=A.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?h.jsx($7,{startingWidth:U7(t.index),onResize:s=>{V7(t.index,s)},children:t.children}):h.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let s;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(s=h.jsxs(z7,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=s):s=e[10],s}let i;return e[11]!==r||e[12]!==t.footer?(i=h.jsxs(h.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=i):i=e[13],i});wx.displayName="Column";const $7=t=>{const e=X.c(15),{startingWidth:n,onResize:o,children:r}=t;let i;e[0]!==o||e[1]!==n?(i={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=i):i=e[2];const{resizableDivRef:s,handleRefs:a,style:l}=eU(i),c=H7;let d,u,f,m;return e[3]!==a.left?(d=c(a.left,!1),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==s||e[7]!==l?(u=h.jsx("div",{ref:s,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=s,e[7]=l,e[8]=u):u=e[8],e[9]!==a.right?(f=c(a.right,!0),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==u||e[13]!==f?(m=h.jsxs("div",{className:"flex flex-row",children:[d,u,f]}),e[11]=d,e[12]=u,e[13]=f,e[14]=m):m=e[14],m};function H7(t,e){const n=e?"group-hover":"hover";return h.jsx("div",{ref:t,className:`w-1 cursor-col-resize transition-colors duration-200 z-10
113
- relative before:content-[''] before:absolute before:inset-y-0 before:-left-[4px] before:right-[-4px] before:w-[11px] before:z-[-1]
114
- ${n}/column:bg-[var(--slate-3)] dark:${n}/column:bg-[var(--slate-5)]
115
- ${n}/column:hover:bg-primary/60 dark:${n}/column:hover:bg-primary/60`})}const W7=t=>{const e=X.c(8),n=We(tU),o=t.appConfig.width==="columns";let r,i,s;return e[0]!==t?(r=h.jsx(q7,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(i=h.jsx(i0,{id:"column-container",items:n,strategy:TE,children:r}),e[2]=n,e[3]=r,e[4]=i):i=e[4],e[5]!==o||e[6]!==i?(s=h.jsx(L7,{multiColumn:o,children:i}),e[5]=o,e[6]=i,e[7]=s):s=e[7],s},q7=t=>{const e=X.c(47),{mode:n,userConfig:o,appConfig:r,connStatus:i}=t,s=gc(),a=zt(),{theme:l}=ho(),{toggleSidebarPanel:c}=Li(),{invisible:d}=t$(s.cellIds.idLength,n);Yt("global.focusTop",a.focusTopCell),Yt("global.focusBottom",a.focusBottomCell),Yt("global.toggleSidebar",c),Yt("global.foldCode",a.foldAll),Yt("global.unfoldCode",a.unfoldAll),Yt("global.formatAll",J7),Yt("cell.hideCode",jn.NOOP),Yt("cell.format",jn.NOOP);const u=rd(),f=a.scrollToTarget;let m,_,g,p,b,x,y,v,S,k,N,E,I,T;if(e[0]!==s.scrollKey||e[1]!==f?(m=()=>{s.scrollKey!==null&&f()},e[0]=s.scrollKey,e[1]=f,e[2]=m):m=e[2],e[3]!==s.cellIds||e[4]!==s.scrollKey||e[5]!==f?(_=[s.cellIds,s.scrollKey,f],e[3]=s.cellIds,e[4]=s.scrollKey,e[5]=f,e[6]=_):_=e[6],A.useEffect(m,_),e[7]!==a||e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==n||e[12]!==s||e[13]!==u||e[14]!==l||e[15]!==o){const M=s.cellIds.getColumns();let R;e[25]!==s.cellIds?(R=s.cellIds.hasOnlyOneId(),e[25]=s.cellIds,e[26]=R):R=e[26];const B=R;let O;e[27]!==s.cellIds.inOrderIds?(O=s.cellIds.inOrderIds.includes(zo),e[27]=s.cellIds.inOrderIds,e[28]=O):O=e[28];const z=O;g=n$,y="pb-[40vh]",v=d,S=r,k="pr-4",e[29]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(N7,{}),e[29]=N):N=e[29],e[30]!==r.width?(p=h.jsx(k7,{width:r.width}),e[30]=r.width,e[31]=p):p=e[31];const F=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[32]!==F?(b=Te(F),e[32]=F,e[33]=b):b=e[33],x=M.map((V,L)=>h.jsx(G7,{column:V,index:L,columnsLength:M.length,appConfig:r,notebook:s,mode:n,userConfig:o,connStatus:i,actions:a,theme:l,hasOnlyOneCell:B,invisible:d,hasSetupCell:z,onDeleteCell:u},V.id)),e[7]=a,e[8]=r,e[9]=i,e[10]=d,e[11]=n,e[12]=s,e[13]=u,e[14]=l,e[15]=o,e[16]=g,e[17]=p,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=S,e[23]=k,e[24]=N}else g=e[16],p=e[17],b=e[18],x=e[19],y=e[20],v=e[21],S=e[22],k=e[23],N=e[24];return e[34]!==b||e[35]!==x?(E=h.jsx("div",{className:b,children:x}),e[34]=b,e[35]=x,e[36]=E):E=e[36],e[37]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsx(o$,{}),e[37]=I):I=e[37],e[38]!==g||e[39]!==p||e[40]!==E||e[41]!==y||e[42]!==v||e[43]!==S||e[44]!==k||e[45]!==N?(T=h.jsxs(g,{className:y,invisible:v,appConfig:S,innerClassName:k,children:[N,p,E,I]}),e[38]=g,e[39]=p,e[40]=E,e[41]=y,e[42]=v,e[43]=S,e[44]=k,e[45]=N,e[46]=T):T=e[46],T},G7=t=>{const e=X.c(42),{column:n,index:o,columnsLength:r,appConfig:i,notebook:s,mode:a,userConfig:l,connStatus:c,actions:d,theme:u,hasOnlyOneCell:f,invisible:m,hasSetupCell:_,onDeleteCell:g}=t,p=c.state!==Qt.OPEN,b=n.id,x=o>0,y=o<r-1,v=i.width,S=r>1,k=n.id,N=i.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let E,I;e[0]!==N?(E=Te(N),e[0]=N,e[1]=E):E=e[1],e[2]!==n.id||e[3]!==E?(I=h.jsx(Y7,{columnId:k,className:E}),e[2]=n.id,e[3]=E,e[4]=I):I=e[4];const T=`column-${o+1}`,M=n.topLevelIds;let R,B,O,z;return e[5]!==d||e[6]!==p||e[7]!==_||e[8]!==o||e[9]!==m||e[10]!==a||e[11]!==s||e[12]!==g||e[13]!==u||e[14]!==l?(R=o===0&&_&&h.jsx(yx,{theme:u,showPlaceholder:!1,allowFocus:!m,...s.cellData[zo],...s.cellRuntime[zo],...d,runElapsedTimeMs:s.cellRuntime[zo].runElapsedTimeMs??s.cellData[zo].lastExecutionTime,canDelete:!0,mode:a,appClosed:p,ref:s.cellHandles[zo],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:d,deleteCell:g},zo),e[5]=d,e[6]=p,e[7]=_,e[8]=o,e[9]=m,e[10]=a,e[11]=s,e[12]=g,e[13]=u,e[14]=l,e[15]=R):R=e[15],e[16]!==d||e[17]!==p||e[18]!==i.width||e[19]!==n||e[20]!==f||e[21]!==m||e[22]!==a||e[23]!==s||e[24]!==g||e[25]!==u||e[26]!==l?(B=n.topLevelIds.map(F=>{if(F===zo)return null;const V=s.cellData[F],L=s.cellRuntime[F];return h.jsx(yx,{theme:u,showPlaceholder:f,allowFocus:!m,...V,...L,runElapsedTimeMs:L.runElapsedTimeMs??V.lastExecutionTime,canDelete:!f,mode:a,appClosed:p,ref:s.cellHandles[F],userConfig:l,config:V.config,name:V.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:i.width==="columns",actions:d,deleteCell:g},V.id.toString())}),e[16]=d,e[17]=p,e[18]=i.width,e[19]=n,e[20]=f,e[21]=m,e[22]=a,e[23]=s,e[24]=g,e[25]=u,e[26]=l,e[27]=B):B=e[27],e[28]!==n.topLevelIds||e[29]!==T||e[30]!==R||e[31]!==B?(O=h.jsxs(i0,{id:T,items:M,strategy:ME,children:[R,B]}),e[28]=n.topLevelIds,e[29]=T,e[30]=R,e[31]=B,e[32]=O):O=e[32],e[33]!==i.width||e[34]!==n.id||e[35]!==o||e[36]!==O||e[37]!==x||e[38]!==y||e[39]!==S||e[40]!==I?(z=h.jsx(wx,{columnId:b,index:o,canMoveLeft:x,canMoveRight:y,width:v,canDelete:S,footer:I,children:O}),e[33]=i.width,e[34]=n.id,e[35]=o,e[36]=O,e[37]=x,e[38]=y,e[39]=S,e[40]=I,e[41]=z):z=e[41],z},Y7=t=>{const e=X.c(17),{columnId:n,className:o}=t,{createNewCell:r}=zt(),i=We(Ii),[s,a]=nU(!1),l=We(tc);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Te("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let u;e[1]!==l||e[2]!==i||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a.toggle?(u=()=>s?h.jsx(oU,{onClose:a.toggle}):h.jsxs(h.Fragment,{children:[h.jsxs(De,{className:d,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[h.jsx(Pp,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),h.jsxs(De,{className:d,variant:"text",size:"sm",onClick:()=>{Bo(i,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ta().defaultCode})},children:[h.jsx(zp,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),h.jsxs(De,{className:d,variant:"text",size:"sm",onClick:()=>{Bo(i,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new vc().getDefaultCode()})},children:[h.jsx(or,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),h.jsx(Me,{content:l?null:h.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:h.jsxs(De,{className:d,variant:"text",size:"sm",disabled:!l,onClick:a.toggle,children:[h.jsx(Ks,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=i,e[3]=n,e[4]=r,e[5]=s,e[6]=a.toggle,e[7]=u):u=e[7];const f=u,m=!s&&"w-fit",_=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==_?(g=Te("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,_,o),e[8]=o,e[9]=m,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==g||e[15]!==p?(b=h.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:h.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function J7(){Q3()}const vx=t=>{const e=X.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,i=r!==void 0&&r;rU(k4,mN);const{setCells:s,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=zt(),d=We(um),u=We(iU),f=We(sU),m=lc(),_=$t(fd),g=d.mode==="edit",p=d.mode==="present",b=We(aU);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],A.useEffect(X7,x);const y=n.runtime.auto_instantiate;let v,S,k;e[1]!==s||e[2]!==_?(v=(ie,ue)=>{s(ie);const le=ie.map(Z7),_e=ie.map(Q7),ce=ie.map(eM);_({names:le,codes:_e,configs:ce,layout:ue})},e[1]=s,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(S=m4(),e[4]=S):S=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(k={autoInstantiate:y,setCells:v,sessionId:S},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=k):k=e[7];const{connection:N}=r$(k);let E,I;e[8]!==o.app_title||e[9]!==m?(E=()=>{document.title=o.app_title||Bn.basename(m??"")||"Untitled Notebook"},I=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=E,e[11]=I):(E=e[10],I=e[11]),A.useEffect(E,I);const T=Nc(o.width);let M,R;e[12]!==o.width||e[13]!==a||e[14]!==T?(M=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=M):M=e[15],e[16]!==o.width||e[17]!==a||e[18]!==u||e[19]!==T?(R=[o.width,T,a,u],e[16]=o.width,e[17]=a,e[18]=u,e[19]=T,e[20]=R):R=e[20],A.useEffect(M,R);const B=function(){const ie=X.c(2),ue=td();let le;return ie[0]!==ue?(le=()=>ue(iF(co())),ie[0]=ue,ie[1]=le):le=ie[1],Qe(le)}(),O=Jp(),z=tg();let F,V,L,C,$,j;e[21]!==B?(F=()=>{B()},e[21]=B,e[22]=F):F=e[22],Yt("global.runStale",F),Yt("global.interrupt",tM),e[23]!==z?(V=()=>{z()},e[23]=z,e[24]=V):V=e[24],Yt("global.hideCode",V),e[25]!==O?(L=()=>{O()},e[25]=O,e[26]=L):L=e[26],Yt("global.runAll",L),e[27]!==l?(C=()=>{l()},e[27]=l,e[28]=C):C=e[28],Yt("global.collapseAllSections",C),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],Yt("global.expandAllSections",$),e[31]!==o||e[32]!==N||e[33]!==n||e[34]!==d.mode?(j=h.jsx(W7,{connStatus:N,mode:d.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=N,e[33]=n,e[34]=d.mode,e[35]=j):j=e[35];const H=j,Y=o.width;let Z,G,re,ne,te,q,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=Te("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=Z):Z=e[36],e[37]!==m||e[38]!==g?(G=g&&h.jsx("div",{className:"flex items-center justify-center container",children:h.jsx(hN,{filename:m})}),e[37]=m,e[38]=g,e[39]=G):G=e[39],e[40]!==N||e[41]!==G?(re=h.jsx(s$,{connection:N,className:Z,children:G}),e[40]=N,e[41]=G,e[42]=re):re=e[42],e[43]!==o||e[44]!==H||e[45]!==f||e[46]!==d.mode?(ne=f&&h.jsx(i$,{appConfig:o,mode:d.mode,children:H}),e[43]=o,e[44]=H,e[45]=f,e[46]=d.mode,e[47]=ne):ne=e[47],e[48]!==o.width||e[49]!==N||e[50]!==b||e[51]!==re||e[52]!==ne?(te=h.jsxs(a$,{connection:N,isRunning:b,width:Y,children:[re,ne]}),e[48]=o.width,e[49]=N,e[50]=b,e[51]=re,e[52]=ne,e[53]=te):te=e[53],e[54]!==o||e[55]!==N||e[56]!==i||e[57]!==p||e[58]!==b||e[59]!==B||e[60]!==z?(q=!i&&h.jsx(Mc,{children:h.jsx(aN,{presenting:p,onTogglePresenting:z,onInterrupt:Mm,onRun:B,closed:N.state===Qt.CLOSED,running:b,appConfig:o})}),e[54]=o,e[55]=N,e[56]=i,e[57]=p,e[58]=b,e[59]=B,e[60]=z,e[61]=q):q=e[61],e[62]!==te||e[63]!==q?(Q=h.jsxs(h.Fragment,{children:[te,q]}),e[62]=te,e[63]=q,e[64]=Q):Q=e[64],Q};function K7(){rS.INSTANCE.stop()}function X7(){return rS.INSTANCE.start(lU),K7}function Z7(t){return t.name}function Q7(t){return t.code}function eM(t){return t.config}function tM(){Mm()}const nM=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},Go=t=>{const e=X.c(17);let n,o,r,i,s;e[0]!==t?({children:n,tooltip:s,selected:i,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(n=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const a=!i&&"hover:bg-[var(--sage-3)]",l=i&&"bg-[var(--sage-4)]";let c,d;e[6]!==o||e[7]!==a||e[8]!==l?(c=Te("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13];const u=d;if(s){let f;return e[14]!==u||e[15]!==s?(f=h.jsx(Me,{content:s,side:"top",delayDuration:200,children:u}),e[14]=u,e[15]=s,e[16]=f):f=e[16],f}return u},oM=()=>{var d;const t=X.c(14),e=We(S4),n=We(tc),o=((d=e==null?void 0:e.open_ai)==null?void 0:d.model)||"gpt-4-turbo",{handleClick:r}=_a();if(!n){let u,f,m;return t[0]!==r?(u=()=>r("ai"),t[0]=r,t[1]=u):u=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Ks,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==u?(m=h.jsx(Go,{tooltip:"Assist is disabled",selected:!1,onClick:u,children:f}),t[3]=u,t[4]=m):m=t[4],m}let i,s,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("b",{children:"Assist model:"}),t[5]=i):i=t[5],t[6]!==o?(s=h.jsxs(h.Fragment,{children:[i," ",o]}),t[6]=o,t[7]=s):s=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Ks,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==s||t[12]!==a?(c=h.jsx(Go,{tooltip:s,onClick:a,selected:!1,children:l}),t[11]=s,t[12]=a,t[13]=c):c=t[13],c},rM=Ot(t=>t(cU).completion.copilot),iM=()=>{const t=X.c(1);if(We(rM)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(sM,{}),t[0]=e):e=t[0],e}return null},sM=()=>{const t=We(q4),e=We(UV)!==null,{handleClick:n}=_a(),o=()=>n("ai"),r=t?"Ready":"Not connected",i=$t(q4),s=$t(VV);return C4(()=>{const a=W4();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw mt.error("Copilot#checkConnection: Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;i(c),s(c?"signedIn":"signedOut")}catch(c){if(!l)return;mt.warn("Copilot#checkConnection: Connection failed",c),i(!1),s("connectionError"),lt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:h.jsx(De,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),h.jsx(Go,{tooltip:h.jsxs(h.Fragment,{children:[h.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,children:h.jsx("span",{children:e?h.jsx(Xn,{className:"h-4 w-4"}):h.jsx(nM,{className:Te("h-4 w-4",!t&&"opacity-60")})})})},aM=t=>{const e=X.c(21),[n,o]=A.useState(0),r=We(Ro);let i,s,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>o(hM),s={delayMs:1e4,whenVisible:!0},e[0]=i,e[1]=s):(i=e[0],s=e[1]),zc(i,s),e[2]!==r.state?(a=async()=>qn()||r.state!==Qt.OPEN?null:dU(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Yn(a,l);let d,u,f,m,_,g;return e[7]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&h.jsx(uM,{gpus:c.gpu}),e[7]=c,e[8]=d):d=e[8],e[9]!==c?(u=c&&h.jsx(cM,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=u):u=e[10],e[11]!==c?(f=c&&h.jsx(dM,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsxs("div",{className:"flex items-center",children:[h.jsx(oM,{}),h.jsx(iM,{})]}),e[13]=m):m=e[13],e[14]!==r.state?(_=h.jsx(lM,{connection:r.state}),e[14]=r.state,e[15]=_):_=e[15],e[16]!==d||e[17]!==u||e[18]!==f||e[19]!==_?(g=h.jsxs("div",{className:"flex gap-2 items-center",children:[d,u,f,m,_]}),e[16]=d,e[17]=u,e[18]=f,e[19]=_,e[20]=g):g=e[20],g},lM=t=>{const e=X.c(18),{connection:n}=t;let o,r,i,s,a,l,c;return e[0]!==n?(o=Yf(n.toLowerCase()),e[0]=n,e[1]=o):o=e[1],e[2]!==n?(r=n===Qt.OPEN&&h.jsx(ep,{className:"w-4 h-4"}),e[2]=n,e[3]=r):r=e[3],e[4]!==n?(i=n===Qt.CLOSED&&h.jsx(Gm,{className:"w-4 h-4"}),e[4]=n,e[5]=i):i=e[5],e[6]!==n?(s=n===Qt.CONNECTING&&h.jsx(Xn,{size:"small"}),e[6]=n,e[7]=s):s=e[7],e[8]!==n?(a=n===Qt.CLOSING&&h.jsx(Xn,{className:"text-destructive",size:"small"}),e[8]=n,e[9]=a):a=e[9],e[10]!==r||e[11]!==i||e[12]!==s||e[13]!==a?(l=h.jsxs("div",{children:[r,i,s,a]}),e[10]=r,e[11]=i,e[12]=s,e[13]=a,e[14]=l):l=e[14],e[15]!==o||e[16]!==l?(c=h.jsx(Me,{delayDuration:200,content:o,children:l}),e[15]=o,e[16]=l,e[17]=c):c=e[17],c},cM=t=>{const e=X.c(25),{memory:n,kernel:o,server:r}=t,{percent:i,total:s,available:a}=n;let l;e[0]!==i?(l=Math.round(i),e[0]=i,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const u=s-a;let f,m,_,g,p,b,x,y,v;return e[3]!==u?(f=Ru(u),e[3]=u,e[4]=f):f=e[4],e[5]!==s?(m=Ru(s),e[5]=s,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(_=h.jsxs("span",{children:[d," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"marimo server:"})," ",vl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"kernel:"})," ",vl(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==_||e[16]!==g||e[17]!==p?(b=h.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,p]}),e[15]=_,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(Sp,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==c?(y=h.jsxs("div",{className:"flex items-center gap-1",children:[x,h.jsx(Du,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=h.jsx(Me,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},dM=t=>{const e=X.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const i=r;let s,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("b",{children:"CPU:"}),e[2]=s):s=e[2],e[3]!==i?(a=h.jsxs("span",{children:[s," ",i,"%"]}),e[3]=i,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx($V,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==i?(c=h.jsxs("div",{className:"flex items-center gap-1",children:[l,h.jsx(Du,{percent:i,colorClassName:"bg-primary"})]}),e[6]=i,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=h.jsx(Me,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},uM=t=>{const e=X.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(fM,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let i,s,a,l,c;return e[2]!==n?(i=n.map(mM),e[2]=n,e[3]=i):i=e[3],e[4]!==i?(s=h.jsx("div",{className:"flex flex-col gap-1",children:i}),e[4]=i,e[5]=s):s=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Np,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=h.jsxs("div",{className:"flex items-center gap-1",children:[a,h.jsx(Du,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==s||e[10]!==l?(c=h.jsx(Me,{delayDuration:200,content:s,children:l}),e[9]=s,e[10]=l,e[11]=c):c=e[11],c},Du=t=>{const e=X.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Te("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const i=`${n}%`;let s,a;return e[2]!==i?(s={width:i},e[2]=i,e[3]=s):s=e[3],e[4]!==r||e[5]!==s?(a=h.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:h.jsx("div",{className:r,style:s})}),e[4]=r,e[5]=s,e[6]=a):a=e[6],a};function vl(t){return t>1073741824?`${Ru(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Ru(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function hM(t){return t+1}function fM(t,e){return t+e.memory.percent}function mM(t){return h.jsxs("span",{children:[h.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",vl(t.memory.used)," / ",vl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const kx=t=>We(uU)[t.capability]?t.children:null,pM=()=>{const t=X.c(56),{selectedPanel:e,isTerminalOpen:n}=cc(),{toggleApplication:o,toggleTerminal:r}=Li(),[i,s]=Mi(),a=We(hU),l=gM,c=ad.find(_M);let d;Er(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],Yt("global.toggleTerminal",d);const u=Go,f=c.tooltip,m=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let p,b,x,y,v;t[2]!==a?(p=h.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=p):p=t[3],t[4]!==u||t[5]!==c||t[6]!==m||t[7]!==_||t[8]!==g||t[9]!==p?(b=h.jsxs(u,{tooltip:f,selected:m,onClick:_,children:[g,p]}),t[4]=u,t[5]=c,t[6]=m,t[7]=_,t[8]=g,t[9]=p,t[10]=b):b=t[10],t[11]!==r?(x=()=>r(),t[11]=r,t[12]=x):x=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Vp,{className:"h-5 w-5"}),t[13]=y):y=t[13],t[14]!==n||t[15]!==x?(v=h.jsx(kx,{capability:"terminal",children:h.jsx(Go,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),t[14]=n,t[15]=x,t[16]=v):v=t[16];const S=i.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let k,N,E;t[17]!==i||t[18]!==s?(k=async()=>{const G={...i,runtime:{...i.runtime,auto_instantiate:!i.runtime.auto_instantiate}};await Oi({config:G}).then(()=>s(G))},t[17]=i,t[18]=s,t[19]=k):k=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("span",{children:"on startup: "}),t[20]=N):N=t[20],t[21]!==i.runtime.auto_instantiate?(E=i.runtime.auto_instantiate?h.jsx(hr,{size:14}):h.jsx(ur,{size:14}),t[21]=i.runtime.auto_instantiate,t[22]=E):E=t[22];const I=i.runtime.auto_instantiate?"autorun":"lazy";let T,M,R,B;t[23]!==I?(T=h.jsx("span",{children:I}),t[23]=I,t[24]=T):T=t[24],t[25]!==E||t[26]!==T?(M=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[N,E,T]}),t[25]=E,t[26]=T,t[27]=M):M=t[27],t[28]!==S||t[29]!==k||t[30]!==M?(R=h.jsx(Go,{tooltip:S,selected:!1,onClick:k,children:M}),t[28]=S,t[29]=k,t[30]=M,t[31]=R):R=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=B):B=t[32];const O=i.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,F,V,L,C,$,j,H,Y,Z;return t[33]!==i||t[34]!==s?(z=async()=>{const G={...i,runtime:{...i.runtime,on_cell_change:i.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await Oi({config:G}).then(()=>s(G))},t[33]=i,t[34]=s,t[35]=z):z=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx("span",{children:"on cell change: "}),t[36]=F):F=t[36],t[37]!==i.runtime.on_cell_change?(V=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[F,i.runtime.on_cell_change==="autorun"?h.jsx(hr,{size:14}):h.jsx(ur,{size:14}),h.jsx("span",{children:i.runtime.on_cell_change})]}),t[37]=i.runtime.on_cell_change,t[38]=V):V=t[38],t[39]!==O||t[40]!==z||t[41]!==V?(L=h.jsx(Go,{tooltip:O,selected:!1,onClick:z,children:V}),t[39]=O,t[40]=z,t[41]=V,t[42]=L):L=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=C):C=t[43],t[44]!==i||t[45]!==s?($=!qn()&&h.jsx(Go,{tooltip:null,selected:!1,children:h.jsxs(ic,{children:[h.jsxs(sc,{className:"font-prose text-sm flex items-center gap-1",children:[h.jsx("span",{children:"on module change: "}),i.runtime.auto_reload==="off"&&h.jsx(Gm,{size:14}),i.runtime.auto_reload==="lazy"&&h.jsx(ur,{size:14}),i.runtime.auto_reload==="autorun"&&h.jsx(hr,{size:14}),h.jsx("span",{children:i.runtime.auto_reload}),h.jsx(Xs,{size:14})]}),h.jsx(ac,{children:["off","lazy","autorun"].map(G=>h.jsxs(rn,{onClick:async()=>{const re={...i,runtime:{...i.runtime,auto_reload:G}};await Oi({config:re}).then(()=>s(re))},children:[G==="off"&&h.jsx(Gm,{size:14,className:"mr-2 text-muted-foreground"}),G==="lazy"&&h.jsx(ur,{size:14,className:"mr-2 text-muted-foreground"}),G==="autorun"&&h.jsx(hr,{size:14,className:"mr-2 text-muted-foreground"}),G]},G))})]})}),t[44]=i,t[45]=s,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx("div",{className:"mx-auto"}),t[47]=j):j=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(H=h.jsx(WC,{children:h.jsx(Me,{content:h.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:h.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),Y=h.jsx(aM,{}),t[48]=H,t[49]=Y):(H=t[48],Y=t[49]),t[50]!==v||t[51]!==R||t[52]!==L||t[53]!==$||t[54]!==b?(Z=h.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:[b,v,R,B,L,C,$,j,H,Y]}),t[50]=v,t[51]=R,t[52]=L,t[53]=$,t[54]=b,t[55]=Z):Z=t[55],Z};function gM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Te("h-5 w-5",e)})}function _M(t){return t.type==="errors"}const bM=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=zn();let i,s;return e[0]!==r||e[1]!==o?(i=()=>o(h.jsx(yM,{onClose:r})),e[0]=r,e[1]=o,e[2]=i):i=e[2],e[3]!==n||e[4]!==i?(s=h.jsx(N4,{onClick:i,children:n}),e[3]=n,e[4]=i,e[5]=s):s=e[5],s},yM=t=>{const e=X.c(9),{onClose:n}=t;let o,r,i,s,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const u=new FormData(d.target),f=u.get("rating"),m=u.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),lt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(ir,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsxs("li",{className:"my-0",children:["Take our"," ",h.jsx("a",{href:Gn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("li",{className:"my-0",children:["File a"," ",h.jsx("a",{href:Gn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Ti,{children:[r,h.jsxs(Di,{children:[i,h.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[s,a,h.jsxs("li",{className:"my-0",children:["Chat with us on"," ",h.jsx("a",{href:Gn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=h.jsx(rr,{className:"w-fit",children:h.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},xM=()=>{const t=X.c(10),{selectedPanel:e}=cc(),{toggleApplication:n}=Li(),o=vM;let r,i,s,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",i=ad.filter(kM).map(d=>h.jsx(Sx,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(bM,{children:h.jsx(Sx,{tooltip:"Send feedback!",selected:!1,children:h.jsx(Cp,{className:"h-5 w-5"})})}),a=h.jsx("div",{className:"flex-1"}),l=h.jsx(wM,{}),t[4]=s,t[5]=a,t[6]=l):(s=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==i?(c=h.jsxs("div",{className:r,children:[i,s,a,l]}),t[7]=r,t[8]=i,t[9]=c):c=t[9],c},wM=()=>{const t=X.c(7),e=We(fU);let n,o,r;return t[0]!==e?(n=e>0?h.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=h.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(SM)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=h.jsx(Me,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Sx=t=>{const e=X.c(17);let n,o,r,i,s;e[0]!==t?({children:n,tooltip:s,selected:i,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(n=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const a=!i&&"hover:bg-[var(--sage-3)]",l=i&&"bg-[var(--sage-4)]";let c,d,u;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Te("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==s?(u=h.jsx(Me,{content:s,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=s,e[16]=u):u=e[16],u};function vM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Te("h-5 w-5",e)})}function kM(t){return!t.hidden&&t.position==="sidebar"}function SM(t,e){return h.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}Ae.record(Ae.tuple([Ae.number(),Ae.number()]));let Pu=null,Cx;En=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:i}=t;let s,a,l,c,d,u;return e[0]!==r?(s=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=s):s=e[1],e[2]!==n?(a=h.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(l=h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[s,a]}),e[4]=s,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=h.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==i?(d=i&&h.jsx("div",{className:"mt-2",children:i}),e[9]=i,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(u=h.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=u):u=e[14],u},Cx=()=>{const t=X.c(5),e=mU();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(En,{title:"No errors!",icon:h.jsx(Ap,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(CM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function CM(t){return h.jsxs("div",{children:[h.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:h.jsx(pU,{cellId:t.cellId})}),h.jsx("div",{className:"px-2",children:h.jsx(gU,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const NM=()=>{const t=X.c(6),{items:e}=We(_U);let n,o;t[0]!==e?(o=l$(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:i}=c$(r);if(e.length===0){let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(En,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:h.jsx(Xc,{})}),t[2]=a):a=t[2],a}let s;return t[3]!==i||t[4]!==e?(s=h.jsx(d$,{items:e,activeHeaderId:i}),t[3]=i,t[4]=e,t[5]=s):s=t[5],s};function cn(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=cn(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:jM}=K,{useSyncExternalStoreWithSelector:EM}=bU,IM=t=>t;function Nx(t,e=IM,n){const o=EM(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return jM(o),o}const jx=(t,e)=>{const n=yU(t),o=(r,i=e)=>Nx(n,r,i);return Object.assign(o,n),o};function tn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function oo(t,e){if(t=function(i){let s;for(;s=i.sourceEvent;)i=s;return i}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const AM={passive:!1},Ts={capture:!0,passive:!1};function Lu(t){t.stopImmediatePropagation()}function ni(t){t.preventDefault(),t.stopImmediatePropagation()}function Ex(t){var e=t.document.documentElement,n=Zn(t).on("dragstart.drag",ni,Ts);"onselectstart"in e?n.on("selectstart.drag",ni,Ts):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ix(t,e){var n=t.document.documentElement,o=Zn(t).on("dragstart.drag",null);e&&(o.on("click.drag",ni,Ts),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 kl=t=>()=>t;function Fu(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function TM(t){return!t.ctrlKey&&!t.button}function MM(){return this.parentNode}function OM(t,e){return e??{x:t.x,y:t.y}}function DM(){return navigator.maxTouchPoints||"ontouchstart"in this}Fu.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Sl=t=>()=>t;function RM(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function zu(t){t.stopImmediatePropagation()}function Ms(t){t.preventDefault(),t.stopImmediatePropagation()}function PM(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function LM(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ax(){return this.__zoom||dr}function FM(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function zM(){return navigator.maxTouchPoints||"ontouchstart"in this}function BM(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}const Cl=A.createContext(null),UM=Cl.Provider,VM=t=>`Node type "${t}" not found. Using fallback type "default".`,$M=()=>"The React Flow parent container needs a width and a height to render the graph.",HM=()=>"Only child nodes can use a parent extent.",WM=t=>`Marker type "${t}" doesn't exist.`,qM=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,GM=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",YM=t=>`Edge type "${t}" not found. Using fallback type "default".`,JM=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,Tx="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function pt(t,e){const n=A.useContext(Cl);if(n===null)throw new Error(Tx);return Nx(n,t,e)}const qt=()=>{const t=A.useContext(Cl);if(t===null)throw new Error(Tx);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},KM=t=>t.userSelectionActive?"none":"all";function Nl({position:t,children:e,className:n,style:o,...r}){const i=pt(KM),s=`${t}`.split("-");return K.createElement("div",{className:cn(["react-flow__panel",n,...s]),style:{...o,pointerEvents:i},...r},e)}function XM({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Nl,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var ZM=A.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const u=A.useRef(null),[f,m]=A.useState({x:0,y:0,width:0,height:0}),_=cn(["react-flow__edge-textwrapper",c]);return A.useEffect(()=>{if(u.current){const g=u.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:u,style:o},n),l):null});const Bu=t=>({width:t.offsetWidth,height:t.offsetHeight}),oi=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Uu=(t={x:0,y:0},e)=>({x:oi(t.x,e[0][0],e[1][0]),y:oi(t.y,e[0][1],e[1][1])}),Mx=(t,e,n)=>t<e?oi(Math.abs(t-e),1,50)/50:t>n?-oi(Math.abs(t-n),1,50)/50:0,Ox=(t,e)=>[20*Mx(t.x,35,e.width-35),20*Mx(t.y,35,e.height-35)],Dx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Vu=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Rx=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),$u=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},Dn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),Px=["Enter"," ","Escape"];function Hu(t){var o,r;const e=(i=>"nativeEvent"in i)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Lx=t=>"clientX"in t,Yo=(t,e)=>{var i,s;const n=Lx(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},jl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Os=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:f}),m&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Dn(n)&&Dn(o)?K.createElement(ZM,{x:n,y:o,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Ds(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(i=>i.id===t);r&&n(o,{...r})}}function Fx({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2;return[i,o<e?o+s:o-s,r,s]}function zx({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*t+.375*r+.375*s+.125*n,c=.125*e+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var xr,Bx,Jo,Wu,Rs,Ux,Ko,Ps,ri,Vx,Ve,El;function $x({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Ve.Left||t===Ve.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Hx({sourceX:t,sourceY:e,sourcePosition:n=Ve.Bottom,targetX:o,targetY:r,targetPosition:i=Ve.Top}){const[s,a]=$x({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=$x({pos:i,x1:o,y1:r,x2:t,y2:e}),[d,u,f,m]=zx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,m]}Os.displayName="BaseEdge",(Bx=xr||(xr={})).Strict="strict",Bx.Loose="loose",(Wu=Jo||(Jo={})).Free="free",Wu.Vertical="vertical",Wu.Horizontal="horizontal",(Ux=Rs||(Rs={})).Partial="partial",Ux.Full="full",(Ps=Ko||(Ko={})).Bezier="default",Ps.Straight="straight",Ps.Step="step",Ps.SmoothStep="smoothstep",Ps.SimpleBezier="simplebezier",(Vx=ri||(ri={})).Arrow="arrow",Vx.ArrowClosed="arrowclosed",(El=Ve||(Ve={})).Left="left",El.Top="top",El.Right="right",El.Bottom="bottom";const qu=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ve.Bottom,targetPosition:i=Ve.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,x]=Hx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:i});return K.createElement(Os,{path:p,labelX:b,labelY:x,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});qu.displayName="SimpleBezierEdge";const Wx={[Ve.Left]:{x:-1,y:0},[Ve.Right]:{x:1,y:0},[Ve.Top]:{x:0,y:-1},[Ve.Bottom]:{x:0,y:1}},qx=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function QM({source:t,sourcePosition:e=Ve.Bottom,target:n,targetPosition:o=Ve.Top,center:r,offset:i}){const s=Wx[e],a=Wx[o],l={x:t.x+s.x*i,y:t.y+s.y*i},c={x:n.x+a.x*i,y:n.y+a.y*i},d=(({source:k,sourcePosition:N=Ve.Bottom,target:E})=>N===Ve.Left||N===Ve.Right?k.x<E.x?{x:1,y:0}:{x:-1,y:0}:k.y<E.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),u=d.x!==0?"x":"y",f=d[u];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[x,y,v,S]=Fx({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(s[u]*a[u]==-1){m=r.x??x,_=r.y??y;const k=[{x:m,y:l.y},{x:m,y:c.y}],N=[{x:l.x,y:_},{x:c.x,y:_}];g=s[u]===f?u==="x"?k:N:u==="x"?N:k}else{const k=[{x:l.x,y:c.y}],N=[{x:c.x,y:l.y}];if(g=u==="x"?s.x===f?N:k:s.y===f?k:N,e===o){const T=Math.abs(t[u]-n[u]);if(T<=i){const M=Math.min(i-1,i-T);s[u]===f?p[u]=(l[u]>t[u]?-1:1)*M:b[u]=(c[u]>n[u]?-1:1)*M}}if(e!==o){const T=u==="x"?"y":"x",M=s[u]===a[T],R=l[T]>c[T],B=l[T]<c[T];(s[u]===1&&(!M&&R||M&&B)||s[u]!==1&&(!M&&B||M&&R))&&(g=u==="x"?k:N)}const E={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(E.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(E.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(E.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(E.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,v,S]}function Gu({sourceX:t,sourceY:e,sourcePosition:n=Ve.Bottom,targetX:o,targetY:r,targetPosition:i=Ve.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20}){const[d,u,f,m,_]=QM({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c});return[d.reduce((g,p,b)=>{let x="";return x=b>0&&b<d.length-1?function(y,v,S,k){const N=Math.min(qx(y,v)/2,qx(v,S)/2,k),{x:E,y:I}=v;if(y.x===E&&E===S.x||y.y===I&&I===S.y)return`L${E} ${I}`;if(y.y===I)return`L ${E+N*(y.x<S.x?-1:1)},${I}Q ${E},${I} ${E},${I+N*(y.y<S.y?1:-1)}`;const T=y.x<S.x?1:-1;return`L ${E},${I+N*(y.y<S.y?-1:1)}Q ${E},${I} ${E+N*T},${I}`}(d[b-1],p,d[b+1],s):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=x},""),u,f,m,_]}const Il=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:u=Ve.Bottom,targetPosition:f=Ve.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=Gu({sourceX:t,sourceY:e,sourcePosition:u,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Os,{path:b,labelX:x,labelY:y,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:_,interactionWidth:p})});Il.displayName="SmoothStepEdge";const Yu=A.memo(t=>{var e;return K.createElement(Il,{...t,pathOptions:A.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Yu.displayName="StepEdge";const Ju=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[S,k,N,E]=Fx({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,S,k,N,E]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Os,{path:_,labelX:g,labelY:p,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:m})});function Al(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Gx({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Ve.Left:return[e-Al(e-o,i),n];case Ve.Right:return[e+Al(o-e,i),n];case Ve.Top:return[e,n-Al(n-r,i)];case Ve.Bottom:return[e,n+Al(r-n,i)]}}function Yx({sourceX:t,sourceY:e,sourcePosition:n=Ve.Bottom,targetX:o,targetY:r,targetPosition:i=Ve.Top,curvature:s=.25}){const[a,l]=Gx({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[c,d]=Gx({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[u,f,m,_]=zx({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,u,f,m,_]}Ju.displayName="StraightEdge";const Tl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ve.Bottom,targetPosition:i=Ve.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=Yx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:i,curvature:g==null?void 0:g.curvature});return K.createElement(Os,{path:b,labelX:x,labelY:y,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Tl.displayName="BezierEdge";const Ku=A.createContext(null),eO=Ku.Provider;Ku.Consumer;const tO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Xu=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Zu=({x:t,y:e},[n,o,r],i,[s,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return i?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},Jx=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),ii=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},Qu=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:i,y:s}=ii(r,e).positionAbsolute;return a=o,l=Vu({x:i,y:s,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:i,y2:s})=>({x:o,y:r,width:i-o,height:s-r}))(n)},Kx=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:u,height:f,selectable:m=!0,hidden:_=!1}=d;if(s&&!m||_)return!1;const{positionAbsolute:g}=ii(d,a),p={x:g.x,y:g.y,width:u||0,height:f||0},b=$u(l,p);(u===void 0||f===void 0||u===null||f===null||i&&b>0||b>=(u||0)*(f||0)||d.dragging)&&c.push(d)}),c},Xx=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},Zx=(t,e,n,o,r,i=.1)=>{const s=e/(t.width*(1+i)),a=n/(t.height*(1+i)),l=Math.min(s,a),c=oi(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},wr=(t,e=0)=>t.transition().duration(e);function Qx(t,e,n,o){return(e[n]||[]).reduce((r,i)=>{var s,a;return`${t.id}-${i.id}-${n}`!==o&&r.push({id:i.id||null,type:n,nodeId:t.id,x:(((s=t.positionAbsolute)==null?void 0:s.x)??0)+i.x+i.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+i.y+i.height/2}),r},[])}const nO={source:null,target:null,sourceHandle:null,targetHandle:null},ew=()=>({handleDomNode:null,isValid:!1,connection:nO,endHandle:null});function tw(t,e,n,o,r,i,s){const a=r==="target",l=s.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...ew(),handleDomNode:l};if(l){const d=eh(void 0,l),u=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?u:n,sourceHandle:a?f:o,target:a?n:u,targetHandle:a?o:f};c.connection=g,m&&_&&(e===xr.Strict?a&&d==="source"||!a&&d==="target":u!==n||f!==o)&&(c.endHandle={nodeId:u,handleId:f,type:d},c.isValid=i(g))}return c}function eh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function th(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function oO(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function nw({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:i,setState:s,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=Dx(t.target),{connectionMode:u,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:x}=i();let y,v=0;const{x:S,y:k}=Yo(t),N=d==null?void 0:d.elementFromPoint(S,k),E=eh(l,N),I=f==null?void 0:f.getBoundingClientRect();if(!I||!E)return;let T,M=Yo(t,I),R=!1,B=null,O=!1,z=null;const F=function({nodes:$,nodeId:j,handleId:H,handleType:Y}){return $.reduce((Z,G)=>{if(G[Nt]){const{handleBounds:re}=G[Nt];let ne=[],te=[];re&&(ne=Qx(G,re,"source",`${j}-${H}-${Y}`),te=Qx(G,re,"target",`${j}-${H}-${Y}`)),Z.push(...ne,...te)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:E}),V=()=>{if(!m)return;const[$,j]=Ox(M,I);p({x:$,y:j}),v=requestAnimationFrame(V)};function L($){const{transform:j}=i();M=Yo($,I);const{handle:H,validHandleResult:Y}=function(Z,G,re,ne,te,q){const{x:Q,y:ie}=Yo(Z),ue=G.elementsFromPoint(Q,ie).find(je=>je.classList.contains("react-flow__handle"));if(ue){const je=ue.getAttribute("data-nodeid");if(je){const de=eh(void 0,ue),Ee=ue.getAttribute("data-handleid"),ge=q({nodeId:je,id:Ee,type:de});if(ge){const Oe=te.find(Fe=>Fe.nodeId===je&&Fe.type===de&&Fe.id===Ee);return{handle:{id:Ee,type:de,nodeId:je,x:(Oe==null?void 0:Oe.x)||re.x,y:(Oe==null?void 0:Oe.y)||re.y},validHandleResult:ge}}}}let le=[],_e=1/0;if(te.forEach(je=>{const de=Math.sqrt((je.x-re.x)**2+(je.y-re.y)**2);if(de<=ne){const Ee=q(je);de<=_e&&(de<_e?le=[{handle:je,validHandleResult:Ee}]:de===_e&&le.push({handle:je,validHandleResult:Ee}),_e=de)}}),!le.length)return{handle:null,validHandleResult:ew()};if(le.length===1)return le[0];const ce=le.some(({validHandleResult:je})=>je.isValid),Ne=le.some(({handle:je})=>je.type==="target");return le.find(({handle:je,validHandleResult:de})=>Ne?je.type==="target":!ce||de.isValid)||le[0]}($,d,Zu(M,j,!1,[1,1]),_,F,Z=>tw(Z,u,n,e,r?"target":"source",a,d));if(y=H,R||(V(),R=!0),z=Y.handleDomNode,B=Y.connection,O=Y.isValid,s({connectionPosition:y&&O?Jx({x:y.x,y:y.y},j):M,connectionStatus:oO(!!y,O),connectionEndHandle:Y.endHandle}),!y&&!O&&!z)return th(T);B.source!==B.target&&z&&(th(T),T=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",O),z.classList.toggle("react-flow__handle-valid",O))}function C($){var j,H;(y||z)&&B&&O&&(o==null||o(B)),(H=(j=i()).onConnectEnd)==null||H.call(j,$),l&&(c==null||c($)),th(T),x(),cancelAnimationFrame(v),R=!1,O=!1,B=null,z=null,d.removeEventListener("mousemove",L),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",L),d.removeEventListener("touchend",C)}s({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:E,connectionStartHandle:{nodeId:n,handleId:e,type:E},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:E}),d.addEventListener("mousemove",L),d.addEventListener("mouseup",C),d.addEventListener("touchmove",L),d.addEventListener("touchend",C)}const ow=()=>!0,rO=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),rw=A.forwardRef(({type:t="source",position:e=Ve.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},m)=>{var E,I;const _=s||null,g=t==="target",p=qt(),b=A.useContext(Ku),{connectOnClick:x,noPanClassName:y}=pt(rO,tn),{connecting:v,clickConnecting:S}=pt(((T,M,R)=>B=>{const{connectionStartHandle:O,connectionEndHandle:z,connectionClickStartHandle:F}=B;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===M&&(O==null?void 0:O.type)===R||(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===M&&(z==null?void 0:z.type)===R,clickConnecting:(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===R}})(b,_,t),tn);b||((I=(E=p.getState()).onError)==null||I.call(E,"010",GM()));const k=T=>{const{defaultEdgeOptions:M,onConnect:R,hasDefaultEdges:B}=p.getState(),O={...M,...T};if(B){const{edges:z,setEdges:F}=p.getState();F(((V,L)=>{if(!V.source||!V.target)return L;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:tO(V)},(($,j)=>j.some(H=>!(H.source!==$.source||H.target!==$.target||H.sourceHandle!==$.sourceHandle&&(H.sourceHandle||$.sourceHandle)||H.targetHandle!==$.targetHandle&&(H.targetHandle||$.targetHandle))))(C,L)?L:L.concat(C)})(O,z))}R==null||R(O),a==null||a(O)},N=T=>{if(!b)return;const M=Lx(T);r&&(M&&T.button===0||!M)&&nw({event:T,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||ow}),M?d==null||d(T):u==null||u(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:cn(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:i,connecting:S,connectionindicator:o&&(r&&!v||i&&v)}]),onMouseDown:N,onTouchStart:N,onClick:x?T=>{const{onClickConnectStart:M,onClickConnectEnd:R,connectionClickStartHandle:B,connectionMode:O,isValidConnection:z}=p.getState();if(!b||!B&&!r)return;if(!B)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const F=Dx(T.target),V=n||z||ow,{connection:L,isValid:C}=tw({nodeId:b,id:_,type:t},O,B.nodeId,B.handleId||null,B.type,V,F);C&&k(L),R==null||R(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});rw.displayName="Handle";var Xo=A.memo(rw);const iw=({data:t,isConnectable:e,targetPosition:n=Ve.Top,sourcePosition:o=Ve.Bottom})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:o,isConnectable:e}));iw.displayName="DefaultNode";var nh=A.memo(iw);const sw=({data:t,isConnectable:e,sourcePosition:n=Ve.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:n,isConnectable:e}));sw.displayName="InputNode";var aw=A.memo(sw);const lw=({data:t,isConnectable:e,targetPosition:n=Ve.Top})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);lw.displayName="OutputNode";var cw=A.memo(lw);const oh=()=>null;oh.displayName="GroupNode";const iO=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Ml=t=>t.id;function sO(t,e){return tn(t.selectedNodes.map(Ml),e.selectedNodes.map(Ml))&&tn(t.selectedEdges.map(Ml),e.selectedEdges.map(Ml))}const dw=A.memo(({onSelectionChange:t})=>{const e=qt(),{selectedNodes:n,selectedEdges:o}=pt(iO,sO);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(i=>i(r))},[n,o,t]),null});dw.displayName="SelectionListener";const aO=t=>!!t.onSelectionChange;function lO({onSelectionChange:t}){const e=pt(aO);return t||e?K.createElement(dw,{onSelectionChange:t}):null}const cO=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function si(t,e){A.useEffect(()=>{t!==void 0&&e(t)},[t])}function at(t,e,n){A.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const dO=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:i,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:u,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:S,snapGrid:k,snapToGrid:N,translateExtent:E,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:R,onNodesDelete:B,onEdgesDelete:O,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:V,onSelectionDrag:L,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:j,nodeOrigin:H,rfId:Y,autoPanOnConnect:Z,autoPanOnNodeDrag:G,onError:re,connectionRadius:ne,isValidConnection:te,nodeDragThreshold:q})=>{const{setNodes:Q,setEdges:ie,setDefaultNodesAndEdges:ue,setMinZoom:le,setMaxZoom:_e,setTranslateExtent:ce,setNodeExtent:Ne,reset:je}=pt(cO,tn),de=qt();return A.useEffect(()=>{const Ee=o==null?void 0:o.map(ge=>({...ge,...T}));return ue(n,Ee),()=>{je()}},[]),at("defaultEdgeOptions",T,de.setState),at("connectionMode",S,de.setState),at("onConnect",r,de.setState),at("onConnectStart",i,de.setState),at("onConnectEnd",s,de.setState),at("onClickConnectStart",a,de.setState),at("onClickConnectEnd",l,de.setState),at("nodesDraggable",c,de.setState),at("nodesConnectable",d,de.setState),at("nodesFocusable",u,de.setState),at("edgesFocusable",f,de.setState),at("edgesUpdatable",m,de.setState),at("elementsSelectable",v,de.setState),at("elevateNodesOnSelect",_,de.setState),at("snapToGrid",N,de.setState),at("snapGrid",k,de.setState),at("onNodesChange",x,de.setState),at("onEdgesChange",y,de.setState),at("connectOnClick",I,de.setState),at("fitViewOnInit",M,de.setState),at("fitViewOnInitOptions",R,de.setState),at("onNodesDelete",B,de.setState),at("onEdgesDelete",O,de.setState),at("onNodeDrag",z,de.setState),at("onNodeDragStart",F,de.setState),at("onNodeDragStop",V,de.setState),at("onSelectionDrag",L,de.setState),at("onSelectionDragStart",C,de.setState),at("onSelectionDragStop",$,de.setState),at("noPanClassName",j,de.setState),at("nodeOrigin",H,de.setState),at("rfId",Y,de.setState),at("autoPanOnConnect",Z,de.setState),at("autoPanOnNodeDrag",G,de.setState),at("onError",re,de.setState),at("connectionRadius",ne,de.setState),at("isValidConnection",te,de.setState),at("nodeDragThreshold",q,de.setState),si(t,Q),si(e,ie),si(g,le),si(p,_e),si(E,ce),si(b,Ne),null},uw={display:"none"},uO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hw="react-flow__node-desc",fw="react-flow__edge-desc",hO=t=>t.ariaLiveMessage;function fO({rfId:t}){const e=pt(hO);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:uO},e)}function mO({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${hw}-${t}`,style:uw},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${fw}-${t}`,style:uw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(fO,{rfId:t}))}var Ls=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=A.useState(!1),r=A.useRef(!1),i=A.useRef(new Set([])),[s,a]=A.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,u)=>d.concat(...u),[]);return[l,c]}return[[],[]]},[t]);return A.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Hu(m))return!1;const _=pw(m.code,a);i.current.add(m[_]),mw(s,i.current,!1)&&(m.preventDefault(),o(!0))},u=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Hu(m))return!1;const _=pw(m.code,a);mw(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(m[_]),m.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f)}}},[t,o]),n};function mw(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function pw(t,e){return e.includes(t)?"code":"key"}function gw(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const i=e.get(r),s=ii(i,o);return gw(i,e,{x:(n.x??0)+s.x,y:(n.y??0)+s.y,z:(((a=i[Nt])==null?void 0:a.z)??0)>(n.z??0)?((l=i[Nt])==null?void 0:l.z)??0:n.z??0},o)}function _w(t,e,n){t.forEach(o=>{var i;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:s,y:a,z:l}=gw(o,t,{...o.position,z:((i=o[Nt])==null?void 0:i.z)??0},e);o.positionAbsolute={x:s,y:a},o[Nt].z=l,n!=null&&n[o.id]&&(o[Nt].isParent=!0)}})}function rh(t,e,n,o){const r=new Map,i={},s=o?1e3:0;return t.forEach(a=>{var m;const l=(Dn(a.zIndex)?a.zIndex:0)+(a.selected?s:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},u=a.parentNode||a.parentId;u&&(i[u]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,Nt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[Nt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),_w(r,n,i),r}function bw(t,e={}){const{getNodes:n,width:o,height:r,minZoom:i,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(x=>x.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=Qu(m,u),{x:p,y:b,zoom:x}=Zx(g,o,r,e.minZoom??i,e.maxZoom??s,e.padding??.1),y=dr.translate(p,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(wr(l,e.duration),y):a.transform(l,y),!0}}return!1}function pO(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[Nt]:o[Nt],selected:n.selected})}),new Map(e)}function gO(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Ol({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:i,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:pO(t,r)}),s==null||s(t)),e!=null&&e.length&&(c&&o({edges:gO(e,i)}),a==null||a(e))}const ai=()=>{},_O={zoomIn:ai,zoomOut:ai,zoomTo:ai,getZoom:()=>1,setViewport:ai,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ai,fitBounds:ai,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},bO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Fs(){const t=(()=>{const g=qt(),{d3Zoom:p,d3Selection:b}=pt(bO,tn);return A.useMemo(()=>b&&p?{zoomIn:y=>p.scaleBy(wr(b,y==null?void 0:y.duration),1.2),zoomOut:y=>p.scaleBy(wr(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>p.scaleTo(wr(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[S,k,N]=g.getState().transform,E=dr.translate(y.x??S,y.y??k).scale(y.zoom??N);p.transform(wr(b,v==null?void 0:v.duration),E)},getViewport:()=>{const[y,v,S]=g.getState().transform;return{x:y,y:v,zoom:S}},fitView:y=>bw(g.getState,y),setCenter:(y,v,S)=>{const{width:k,height:N,maxZoom:E}=g.getState(),I=(S==null?void 0:S.zoom)!==void 0?S.zoom:E,T=k/2-y*I,M=N/2-v*I,R=dr.translate(T,M).scale(I);p.transform(wr(b,S==null?void 0:S.duration),R)},fitBounds:(y,v)=>{const{width:S,height:k,minZoom:N,maxZoom:E}=g.getState(),{x:I,y:T,zoom:M}=Zx(y,S,k,N,E,(v==null?void 0:v.padding)??.1),R=dr.translate(I,T).scale(M);p.transform(wr(b,v==null?void 0:v.duration),R)},project:y=>{const{transform:v,snapToGrid:S,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Zu(y,v,S,k)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:S,snapGrid:k,domNode:N}=g.getState();if(!N)return y;const{x:E,y:I}=N.getBoundingClientRect(),T={x:y.x-E,y:y.y-I};return Zu(T,v,S,k)},flowToScreenPosition:y=>{const{transform:v,domNode:S}=g.getState();if(!S)return y;const{x:k,y:N}=S.getBoundingClientRect(),E=Jx(y,v);return{x:E.x+k,y:E.y+N}},viewportInitialized:!0}:_O,[p,b])})(),e=qt(),n=A.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=A.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=A.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),i=A.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),s=A.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=p(),S=typeof g=="function"?g(v):g;if(x)b(S);else if(y){const k=S.length===0?v.map(N=>({type:"remove",id:N.id})):S.map(N=>({item:N,type:"reset"}));y(k)}},[]),a=A.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(p):g;x?b(v):y&&y(v.length===0?p.map(S=>({type:"remove",id:S.id})):v.map(S=>({item:S,type:"reset"})))},[]),l=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...p]);else if(v){const S=p.map(k=>({item:k,type:"add"}));v(S)}},[]),c=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...p]):v&&v(p.map(S=>({item:S,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x,y,zoom:v}}},[]),u=A.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:k,onEdgesDelete:N,onNodesChange:E,onEdgesChange:I}=e.getState(),T=(g||[]).map(z=>z.id),M=(p||[]).map(z=>z.id),R=x().reduce((z,F)=>{const V=F.parentNode||F.parentId,L=!T.includes(F.id)&&V&&z.find(C=>C.id===V);return(typeof F.deletable!="boolean"||F.deletable)&&(T.includes(F.id)||L)&&z.push(F),z},[]),B=y.filter(z=>typeof z.deletable!="boolean"||z.deletable),O=B.filter(z=>M.includes(z.id));if(R||O){const z=Xx(R,B),F=[...O,...z],V=F.reduce((L,C)=>(L.includes(C.id)||L.push(C.id),L),[]);(S||v)&&(S&&e.setState({edges:y.filter(L=>!V.includes(L.id))}),v&&(R.forEach(L=>{b.delete(L.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(N==null||N(F),I&&I(V.map(L=>({id:L,type:"remove"})))),R.length>0&&(k==null||k(R),E)&&E(R.map(L=>({id:L.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const p=Dn((b=g).width)&&Dn(b.height)&&Dn(b.x)&&Dn(b.y);var b;const x=p?null:e.getState().nodeInternals.get(g.id);return!p&&!x?[null,null,p]:[p?g:Rx(x),x,p]},[]),m=A.useCallback((g,p=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(S=>{if(!(v||S.id!==y.id&&S.positionAbsolute))return!1;const k=Rx(S),N=$u(k,x);return p&&N>0||N>=x.width*x.height}):[]},[]),_=A.useCallback((g,p,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=$u(x,p);return b&&y>0||y>=x.width*x.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:i,setNodes:s,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:u,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,i,s,a,l,c,d,u,m,_])}const yO={actInsideInputWithModifier:!1},ih={position:"absolute",width:"100%",height:"100%",top:0,left:0},Dl=t=>({x:t.x,y:t.y,zoom:t.k}),li=(t,e)=>t.target.closest(`.${e}`),yw=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),xw=t=>{const e=t.ctrlKey&&jl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},xO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),wO=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Jo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:u=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const S=A.useRef(),k=qt(),N=A.useRef(!1),E=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:R,d3ZoomHandler:B,userSelectionActive:O}=pt(xO,tn),z=Ls(p),F=A.useRef(0),V=A.useRef(!1),L=A.useRef();return function(C){const $=qt();A.useEffect(()=>{let j;const H=()=>{var Z,G;if(!C.current)return;const Y=Bu(C.current);Y.height!==0&&Y.width!==0||((G=(Z=$.getState()).onError)==null||G.call(Z,"004",$M())),$.setState({width:Y.width||500,height:Y.height||500})};return H(),window.addEventListener("resize",H),C.current&&(j=new ResizeObserver(()=>H()),j.observe(C.current)),()=>{window.removeEventListener("resize",H),j&&C.current&&j.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var G,re,ne,te=PM,q=LM,Q=BM,ie=FM,ue=zM,le=[0,1/0],_e=[[-1/0,-1/0],[1/0,1/0]],ce=250,Ne=g$,je=iS("start","zoom","end"),de=0,Ee=10;function ge(J){J.property("__zoom",Ax).on("wheel.zoom",nt,{passive:!1}).on("mousedown.zoom",it).on("dblclick.zoom",oe).filter(ue).on("touchstart.zoom",ve).on("touchmove.zoom",Ie).on("touchend.zoom touchcancel.zoom",ze).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Oe(J,me){return(me=Math.max(le[0],Math.min(le[1],me)))===J.k?J:new Xm(me,J.x,J.y)}function Fe(J,me,pe){var he=me[0]-pe[0]*J.k,ke=me[1]-pe[1]*J.k;return he===J.x&&ke===J.y?J:new Xm(J.k,he,ke)}function $e(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Xe(J,me,pe,he){J.on("start.zoom",function(){Le(this,arguments).event(he).start()}).on("interrupt.zoom end.zoom",function(){Le(this,arguments).event(he).end()}).tween("zoom",function(){var ke=this,xe=arguments,Ue=Le(ke,xe).event(he),Ze=q.apply(ke,xe),ae=pe==null?$e(Ze):typeof pe=="function"?pe.apply(ke,xe):pe,Se=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ce=ke.__zoom,Be=typeof me=="function"?me.apply(ke,xe):me,He=Ne(Ce.invert(ae).concat(Se/Ce.k),Be.invert(ae).concat(Se/Be.k));return function(Re){if(Re===1)Re=Be;else{var Ge=He(Re),ot=Se/Ge[2];Re=new Xm(ot,ae[0]-Ge[0]*ot,ae[1]-Ge[1]*ot)}Ue.zoom(null,Re)}})}function Le(J,me,pe){return!pe&&J.__zooming||new et(J,me)}function et(J,me){this.that=J,this.args=me,this.active=0,this.sourceEvent=null,this.extent=q.apply(J,me),this.taps=0}function nt(J,...me){if(te.apply(this,arguments)){var pe=Le(this,me).event(J),he=this.__zoom,ke=Math.max(le[0],Math.min(le[1],he.k*Math.pow(2,ie.apply(this,arguments)))),xe=oo(J);if(pe.wheel)pe.mouse[0][0]===xe[0]&&pe.mouse[0][1]===xe[1]||(pe.mouse[1]=he.invert(pe.mouse[0]=xe)),clearTimeout(pe.wheel);else{if(he.k===ke)return;pe.mouse=[xe,he.invert(xe)],Zm(this),pe.start()}Ms(J),pe.wheel=setTimeout(function(){pe.wheel=null,pe.end()},150),pe.zoom("mouse",Q(Fe(Oe(he,ke),pe.mouse[0],pe.mouse[1]),pe.extent,_e))}}function it(J,...me){if(!ne&&te.apply(this,arguments)){var pe=J.currentTarget,he=Le(this,me,!0).event(J),ke=Zn(J.view).on("mousemove.zoom",function(ae){if(Ms(ae),!he.moved){var Se=ae.clientX-Ue,Ce=ae.clientY-Ze;he.moved=Se*Se+Ce*Ce>de}he.event(ae).zoom("mouse",Q(Fe(he.that.__zoom,he.mouse[0]=oo(ae,pe),he.mouse[1]),he.extent,_e))},!0).on("mouseup.zoom",function(ae){ke.on("mousemove.zoom mouseup.zoom",null),Ix(ae.view,he.moved),Ms(ae),he.event(ae).end()},!0),xe=oo(J,pe),Ue=J.clientX,Ze=J.clientY;Ex(J.view),zu(J),he.mouse=[xe,this.__zoom.invert(xe)],Zm(this),he.start()}}function oe(J,...me){if(te.apply(this,arguments)){var pe=this.__zoom,he=oo(J.changedTouches?J.changedTouches[0]:J,this),ke=pe.invert(he),xe=pe.k*(J.shiftKey?.5:2),Ue=Q(Fe(Oe(pe,xe),he,ke),q.apply(this,me),_e);Ms(J),ce>0?Zn(this).transition().duration(ce).call(Xe,Ue,he,J):Zn(this).call(ge.transform,Ue,he,J)}}function ve(J,...me){if(te.apply(this,arguments)){var pe,he,ke,xe,Ue=J.touches,Ze=Ue.length,ae=Le(this,me,J.changedTouches.length===Ze).event(J);for(zu(J),he=0;he<Ze;++he)xe=[xe=oo(ke=Ue[he],this),this.__zoom.invert(xe),ke.identifier],ae.touch0?ae.touch1||ae.touch0[2]===xe[2]||(ae.touch1=xe,ae.taps=0):(ae.touch0=xe,pe=!0,ae.taps=1+!!G);G&&(G=clearTimeout(G)),pe&&(ae.taps<2&&(re=xe[0],G=setTimeout(function(){G=null},500)),Zm(this),ae.start())}}function Ie(J,...me){if(this.__zooming){var pe,he,ke,xe,Ue=Le(this,me).event(J),Ze=J.changedTouches,ae=Ze.length;for(Ms(J),pe=0;pe<ae;++pe)ke=oo(he=Ze[pe],this),Ue.touch0&&Ue.touch0[2]===he.identifier?Ue.touch0[0]=ke:Ue.touch1&&Ue.touch1[2]===he.identifier&&(Ue.touch1[0]=ke);if(he=Ue.that.__zoom,Ue.touch1){var Se=Ue.touch0[0],Ce=Ue.touch0[1],Be=Ue.touch1[0],He=Ue.touch1[1],Re=(Re=Be[0]-Se[0])*Re+(Re=Be[1]-Se[1])*Re,Ge=(Ge=He[0]-Ce[0])*Ge+(Ge=He[1]-Ce[1])*Ge;he=Oe(he,Math.sqrt(Re/Ge)),ke=[(Se[0]+Be[0])/2,(Se[1]+Be[1])/2],xe=[(Ce[0]+He[0])/2,(Ce[1]+He[1])/2]}else{if(!Ue.touch0)return;ke=Ue.touch0[0],xe=Ue.touch0[1]}Ue.zoom("touch",Q(Fe(he,ke,xe),Ue.extent,_e))}}function ze(J,...me){if(this.__zooming){var pe,he,ke=Le(this,me).event(J),xe=J.changedTouches,Ue=xe.length;for(zu(J),ne&&clearTimeout(ne),ne=setTimeout(function(){ne=null},500),pe=0;pe<Ue;++pe)he=xe[pe],ke.touch0&&ke.touch0[2]===he.identifier?delete ke.touch0:ke.touch1&&ke.touch1[2]===he.identifier&&delete ke.touch1;if(ke.touch1&&!ke.touch0&&(ke.touch0=ke.touch1,delete ke.touch1),ke.touch0)ke.touch0[1]=this.__zoom.invert(ke.touch0[0]);else if(ke.end(),ke.taps===2&&(he=oo(he,this),Math.hypot(re[0]-he[0],re[1]-he[1])<Ee)){var Ze=Zn(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return ge.transform=function(J,me,pe,he){var ke=J.selection?J.selection():J;ke.property("__zoom",Ax),J!==ke?Xe(J,me,pe,he):ke.interrupt().each(function(){Le(this,arguments).event(he).start().zoom(null,typeof me=="function"?me.apply(this,arguments):me).end()})},ge.scaleBy=function(J,me,pe,he){ge.scaleTo(J,function(){return this.__zoom.k*(typeof me=="function"?me.apply(this,arguments):me)},pe,he)},ge.scaleTo=function(J,me,pe,he){ge.transform(J,function(){var ke=q.apply(this,arguments),xe=this.__zoom,Ue=pe==null?$e(ke):typeof pe=="function"?pe.apply(this,arguments):pe,Ze=xe.invert(Ue),ae=typeof me=="function"?me.apply(this,arguments):me;return Q(Fe(Oe(xe,ae),Ue,Ze),ke,_e)},pe,he)},ge.translateBy=function(J,me,pe,he){ge.transform(J,function(){return Q(this.__zoom.translate(typeof me=="function"?me.apply(this,arguments):me,typeof pe=="function"?pe.apply(this,arguments):pe),q.apply(this,arguments),_e)},null,he)},ge.translateTo=function(J,me,pe,he,ke){ge.transform(J,function(){var xe=q.apply(this,arguments),Ue=this.__zoom,Ze=he==null?$e(xe):typeof he=="function"?he.apply(this,arguments):he;return Q(dr.translate(Ze[0],Ze[1]).scale(Ue.k).translate(typeof me=="function"?-me.apply(this,arguments):-me,typeof pe=="function"?-pe.apply(this,arguments):-pe),xe,_e)},he,ke)},et.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active==1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,me){return this.mouse&&J!=="mouse"&&(this.mouse[1]=me.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=me.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=me.invert(this.touch1[0])),this.that.__zoom=me,this.emit("zoom"),this},end:function(){return--this.active==0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var me=Zn(this.that).datum();je.call(J,this.that,new RM(J,{sourceEvent:this.sourceEvent,target:ge,transform:this.that.__zoom,dispatch:je}),me)}},ge.wheelDelta=function(J){return arguments.length?(ie=typeof J=="function"?J:Sl(+J),ge):ie},ge.filter=function(J){return arguments.length?(te=typeof J=="function"?J:Sl(!!J),ge):te},ge.touchable=function(J){return arguments.length?(ue=typeof J=="function"?J:Sl(!!J),ge):ue},ge.extent=function(J){return arguments.length?(q=typeof J=="function"?J:Sl([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),ge):q},ge.scaleExtent=function(J){return arguments.length?(le[0]=+J[0],le[1]=+J[1],ge):[le[0],le[1]]},ge.translateExtent=function(J){return arguments.length?(_e[0][0]=+J[0][0],_e[1][0]=+J[1][0],_e[0][1]=+J[0][1],_e[1][1]=+J[1][1],ge):[[_e[0][0],_e[0][1]],[_e[1][0],_e[1][1]]]},ge.constrain=function(J){return arguments.length?(Q=J,ge):Q},ge.duration=function(J){return arguments.length?(ce=+J,ge):ce},ge.interpolate=function(J){return arguments.length?(Ne=J,ge):Ne},ge.on=function(){var J=je.on.apply(je,arguments);return J===je?ge:J},ge.clickDistance=function(J){return arguments.length?(de=(J=+J)*J,ge):Math.sqrt(de)},ge.tapDistance=function(J){return arguments.length?(Ee=+J,ge):Ee},ge}().scaleExtent([_,g]).translateExtent(m),j=Zn(I.current).call($),H=dr.translate(f.x,f.y).scale(oi(f.zoom,_,g)),Y=[[0,0],[C.width,C.height]],Z=$.constrain()(H,Y,m);$.transform(j,Z),$.wheelDelta(xw),k.setState({d3Zoom:$,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{R&&M&&(!s||z||O?B!==void 0&&R.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||li(C,y))return null;C.preventDefault(),B.call(this,C,$)},{passive:!1}):R.on("wheel.zoom",C=>{if(li(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(C.ctrlKey&&i){const te=oo(C),q=xw(C),Q=$*Math.pow(2,q);return void M.scaleTo(R,Q,te,C)}const j=C.deltaMode===1?20:1;let H=l===Jo.Vertical?0:C.deltaX*j,Y=l===Jo.Horizontal?0:C.deltaY*j;!jl()&&C.shiftKey&&l!==Jo.Vertical&&(H=C.deltaY*j,Y=0),M.translateBy(R,-H/$*a,-Y/$*a,{internal:!0});const Z=Dl(R.property("__zoom")),{onViewportChangeStart:G,onViewportChange:re,onViewportChangeEnd:ne}=k.getState();clearTimeout(L.current),V.current||(V.current=!0,e==null||e(C,Z),G==null||G(Z)),V.current&&(t==null||t(C,Z),re==null||re(Z),L.current=setTimeout(()=>{n==null||n(C,Z),ne==null||ne(Z),V.current=!1},150))},{passive:!1}))},[O,s,l,R,M,B,z,i,b,y,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var H,Y;if(!C.sourceEvent||C.sourceEvent.internal)return null;F.current=(H=C.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:$}=k.getState(),j=Dl(C.transform);N.current=!0,T.current=j,((Y=C.sourceEvent)==null?void 0:Y.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(j),e==null||e(C.sourceEvent,j)})},[M,e]),A.useEffect(()=>{M&&(O&&!N.current?M.on("zoom",null):O||M.on("zoom",C=>{var j;const{onViewportChange:$}=k.getState();if(k.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),E.current=!(!o||!yw(u,F.current??0)),(t||$)&&!((j=C.sourceEvent)!=null&&j.internal)){const H=Dl(C.transform);$==null||$(H),t==null||t(C.sourceEvent,H)}}))},[O,M,t,u,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(N.current=!1,k.setState({paneDragging:!1}),o&&yw(u,F.current??0)&&!E.current&&o(C.sourceEvent),E.current=!1,(n||$)&&(j=T.current,H=C.transform,j.x!==H.x||j.y!==H.y||j.zoom!==H.k)){const Y=Dl(C.transform);T.current=Y,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(Y),n==null||n(C.sourceEvent,Y)},s?150:0)}var j,H})},[M,s,u,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=z||r,j=i&&C.ctrlKey;if((u===!0||Array.isArray(u)&&u.includes(1))&&C.button===1&&C.type==="mousedown"&&(li(C,"react-flow__node")||li(C,"react-flow__edge")))return!0;if(!(u||$||s||c||i)||O||!c&&C.type==="dblclick"||li(C,y)&&C.type==="wheel"||li(C,v)&&(C.type!=="wheel"||s&&C.type==="wheel"&&!z)||!i&&C.ctrlKey&&C.type==="wheel"||!$&&!s&&!j&&C.type==="wheel"||!u&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(u)&&!u.includes(C.button)&&C.type==="mousedown")return!1;const H=Array.isArray(u)&&u.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&H})},[O,M,r,i,s,c,u,d,z]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:ih},x)},vO=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function kO(){const{userSelectionActive:t,userSelectionRect:e}=pt(vO,tn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function ww(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,i=e.position.y+e.height-o.height;if(r>0||i>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),i>0&&(o.style.height+=i),e.position.x<0){const s=Math.abs(e.position.x);o.position.x=o.position.x-s,o.style.width+=s,e.position.x=0}if(e.position.y<0){const s=Math.abs(e.position.y);o.position.y=o.position.y-s,o.style.height+=s,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function vw(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const i=t.filter(a=>a.id===r.id);if(i.length===0)return o.push(r),o;const s={...r};for(const a of i)if(a)switch(a.type){case"select":s.selected=a.selected;break;case"position":a.position!==void 0&&(s.position=a.position),a.positionAbsolute!==void 0&&(s.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(s.dragging=a.dragging),s.expandParent&&ww(o,s);break;case"dimensions":a.dimensions!==void 0&&(s.width=a.dimensions.width,s.height=a.dimensions.height),a.updateStyle!==void 0&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&ww(o,s);break;case"remove":return o}return o.push(s),o},n)}function kw(t,e){return vw(t,e)}const Zo=(t,e)=>({id:t,type:"select",selected:e});function ci(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Zo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Zo(o.id,!1))),n},[])}const sh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},SO=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Sw=A.memo(({isSelecting:t,selectionMode:e=Rs.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:u})=>{const f=A.useRef(null),m=qt(),_=A.useRef(0),g=A.useRef(0),p=A.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=pt(SO,tn),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},S=E=>{i==null||i(E),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=a?E=>a(E):void 0,N=x&&(t||b);return K.createElement("div",{className:cn(["react-flow__pane",{dragging:y,selection:t}]),onClick:N?void 0:sh(S,f),onContextMenu:sh(E=>{Array.isArray(n)&&(n!=null&&n.includes(2))?E.preventDefault():s==null||s(E)},f),onWheel:sh(k,f),onMouseEnter:N?void 0:l,onMouseDown:N?E=>{const{resetSelectedElements:I,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||E.button!==0||E.target!==f.current||!p.current)return;const{x:M,y:R}=Yo(E,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:M,startY:R,x:M,y:R}}),o==null||o(E)}:void 0,onMouseMove:N?E=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:R,onNodesChange:B,onEdgesChange:O,nodeOrigin:z,getNodes:F}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Yo(E,p.current),L=I.startX??0,C=I.startY??0,$={...I,x:V.x<L?V.x:L,y:V.y<C?V.y:C,width:Math.abs(V.x-L),height:Math.abs(V.y-C)},j=F(),H=Kx(T,$,R,e===Rs.Partial,!0,z),Y=Xx(H,M).map(G=>G.id),Z=H.map(G=>G.id);if(_.current!==Z.length){_.current=Z.length;const G=ci(j,Z);G.length&&(B==null||B(G))}if(g.current!==Y.length){g.current=Y.length;const G=ci(M,Y);G.length&&(O==null||O(G))}m.setState({userSelectionRect:$})}:c,onMouseUp:N?E=>{if(E.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&E.target===f.current&&(S==null||S(E)),m.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(E)}:void 0,onMouseLeave:N?E=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(E)),v()}:d,ref:f,style:ih},u,K.createElement(kO,null))});function Cw(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Cw(o,e))}function Nw(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function CO(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Cw(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var i,s;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=r.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((s=r.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function jw(t,e,n,o,r=[0,0],i){const s=function(u,f){return f&&f!=="parent"?[f[0],[f[1][0]-(u.width||0),f[1][1]-(u.height||0)]]:f}(t,t.extent||o);let a=s;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const u=n.get(l),{x:f,y:m}=ii(u,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const u=n.get(l),{x:f,y:m}=ii(u,r).positionAbsolute;a=u&&Dn(f)&&Dn(m)&&Dn(u.width)&&Dn(u.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+u.width-t.width+t.width*r[0],m+u.height-t.height+t.height*r[1]]]:a}else i==null||i("005",HM()),a=s;let c={x:0,y:0};if(l){const u=n.get(l);c=ii(u,r).positionAbsolute}const d=a&&a!=="parent"?Uu(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function ah({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}Sw.displayName="Pane";const Ew=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const i=Array.from(r),s=e.getBoundingClientRect(),a=s.width*o[0],l=s.height*o[1];return i.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-s.left-a)/n,y:(d.top-s.top-l)/n,...Bu(c)}})};function zs(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function lh({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",JM(t))}function ch(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Iw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,selectNodesOnDrag:s}){const a=qt(),[l,c]=A.useState(!1),d=A.useRef([]),u=A.useRef({x:null,y:null}),f=A.useRef(0),m=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),p=A.useRef(!1),b=A.useRef(!1),x=A.useRef(!1),y=function(){const v=qt();return A.useCallback(({sourceEvent:k})=>{const{transform:N,snapGrid:E,snapToGrid:I}=v.getState(),T=k.touches?k.touches[0].clientX:k.clientX,M=k.touches?k.touches[0].clientY:k.clientY,R={x:(T-N[0])/N[2],y:(M-N[1])/N[2]};return{xSnapped:I?E[0]*Math.round(R.x/E[0]):R.x,ySnapped:I?E[1]*Math.round(R.y/E[1]):R.y,...R}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=Zn(t.current),S=({x:E,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:R,updateNodePositions:B,nodeExtent:O,snapGrid:z,snapToGrid:F,nodeOrigin:V,onError:L}=a.getState();u.current={x:E,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const H=Qu(d.current,V);$=Vu(H)}if(d.current=d.current.map(H=>{const Y={x:E-H.distance.x,y:I-H.distance.y};F&&(Y.x=z[0]*Math.round(Y.x/z[0]),Y.y=z[1]*Math.round(Y.y/z[1]));const Z=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!H.extent&&(Z[0][0]=H.positionAbsolute.x-$.x+O[0][0],Z[1][0]=H.positionAbsolute.x+(H.width??0)-$.x2+O[1][0],Z[0][1]=H.positionAbsolute.y-$.y+O[0][1],Z[1][1]=H.positionAbsolute.y+(H.height??0)-$.y2+O[1][1]);const G=jw(H,Y,T,Z,V,L);return C=C||H.position.x!==G.position.x||H.position.y!==G.position.y,H.position=G.position,H.positionAbsolute=G.positionAbsolute,H}),!C)return;B(d.current,!0,!0),c(!0);const j=r?M:ch(R);if(j&&g.current){const[H,Y]=ah({nodeId:r,dragItems:d.current,nodeInternals:T});j(g.current,H,Y)}},k=()=>{if(!m.current)return;const[E,I]=Ox(_.current,m.current);if(E!==0||I!==0){const{transform:T,panBy:M}=a.getState();u.current.x=(u.current.x??0)-E/T[2],u.current.y=(u.current.y??0)-I/T[2],M({x:E,y:I})&&S(u.current)}f.current=requestAnimationFrame(k)},N=E=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:R,onNodeDragStart:B,onSelectionDragStart:O}=a.getState();b.current=!0;const z=r?B:ch(O);s&&i||T||!r||(V=I.get(r))!=null&&V.selected||R(),r&&i&&s&&lh({id:r,store:a,nodeRef:t});const F=y(E);if(u.current=F,d.current=CO(I,M,F,r),z&&d.current){const[L,C]=ah({nodeId:r,dragItems:d.current,nodeInternals:I});z(E.sourceEvent,L,C)}};if(!e){const E=function(){var I,T,M,R,B=TM,O=MM,z=OM,F=DM,V={},L=iS("start","drag","end"),C=0,$=0;function j(q){q.on("mousedown.drag",H).filter(F).on("touchstart.drag",G).on("touchmove.drag",re,AM).on("touchend.drag touchcancel.drag",ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function H(q,Q){if(!R&&B.call(this,q,Q)){var ie=te(this,O.call(this,q,Q),q,Q,"mouse");ie&&(Zn(q.view).on("mousemove.drag",Y,Ts).on("mouseup.drag",Z,Ts),Ex(q.view),Lu(q),M=!1,I=q.clientX,T=q.clientY,ie("start",q))}}function Y(q){if(ni(q),!M){var Q=q.clientX-I,ie=q.clientY-T;M=Q*Q+ie*ie>$}V.mouse("drag",q)}function Z(q){Zn(q.view).on("mousemove.drag mouseup.drag",null),Ix(q.view,M),ni(q),V.mouse("end",q)}function G(q,Q){if(B.call(this,q,Q)){var ie,ue,le=q.changedTouches,_e=O.call(this,q,Q),ce=le.length;for(ie=0;ie<ce;++ie)(ue=te(this,_e,q,Q,le[ie].identifier,le[ie]))&&(Lu(q),ue("start",q,le[ie]))}}function re(q){var Q,ie,ue=q.changedTouches,le=ue.length;for(Q=0;Q<le;++Q)(ie=V[ue[Q].identifier])&&(ni(q),ie("drag",q,ue[Q]))}function ne(q){var Q,ie,ue=q.changedTouches,le=ue.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),Q=0;Q<le;++Q)(ie=V[ue[Q].identifier])&&(Lu(q),ie("end",q,ue[Q]))}function te(q,Q,ie,ue,le,_e){var ce,Ne,je,de=L.copy(),Ee=oo(_e||ie,Q);if((je=z.call(q,new Fu("beforestart",{sourceEvent:ie,target:j,identifier:le,active:C,x:Ee[0],y:Ee[1],dx:0,dy:0,dispatch:de}),ue))!=null)return ce=je.x-Ee[0]||0,Ne=je.y-Ee[1]||0,function ge(Oe,Fe,$e){var Xe,Le=Ee;switch(Oe){case"start":V[le]=ge,Xe=C++;break;case"end":delete V[le],--C;case"drag":Ee=oo($e||Fe,Q),Xe=C}de.call(Oe,q,new Fu(Oe,{sourceEvent:Fe,subject:je,target:j,identifier:le,active:Xe,x:Ee[0]+ce,y:Ee[1]+Ne,dx:Ee[0]-Le[0],dy:Ee[1]-Le[1],dispatch:de}),ue)}}return j.filter=function(q){return arguments.length?(B=typeof q=="function"?q:kl(!!q),j):B},j.container=function(q){return arguments.length?(O=typeof q=="function"?q:kl(q),j):O},j.subject=function(q){return arguments.length?(z=typeof q=="function"?q:kl(q),j):z},j.touchable=function(q){return arguments.length?(F=typeof q=="function"?q:kl(!!q),j):F},j.on=function(){var q=L.on.apply(L,arguments);return q===L?j:q},j.clickDistance=function(q){return arguments.length?($=(q=+q)*q,j):Math.sqrt($)},j}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&N(I),x.current=!1;const R=y(I);u.current=R,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Yo(I.sourceEvent,m.current)}).on("drag",I=>{var B,O;const T=y(I),{autoPanOnNodeDrag:M,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!p.current&&b.current&&M&&(p.current=!0,k()),!b.current){const z=T.xSnapped-(((B=u==null?void 0:u.current)==null?void 0:B.x)??0),F=T.ySnapped-(((O=u==null?void 0:u.current)==null?void 0:O.y)??0);Math.sqrt(z*z+F*F)>R&&N(I)}(u.current.x!==T.xSnapped||u.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Yo(I.sourceEvent,m.current),S(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:R,onSelectionDragStop:B}=a.getState(),O=r?R:ch(B);if(T(d.current,!1,!1),O){const[z,F]=ah({nodeId:r,dragItems:d.current,nodeInternals:M});O(I.sourceEvent,z,F)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!Nw(T,`.${n}`,t))&&(!o||Nw(T,o,t))});return v.call(E),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,i,a,r,s,y]),l}function Aw(){const t=qt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:i,getNodes:s,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),u=s().filter(x=>x.selected&&(x.draggable||d&&x.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=u.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+p};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:S}=jw(x,y,o,r,void 0,c);x.position=S,x.positionAbsolute=v}return x});i(b,!0,!1)},[])}const di={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Bs=t=>{const e=({id:n,type:o,data:r,xPos:i,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:u,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:S,selectNodesOnDrag:k,sourcePosition:N,targetPosition:E,hidden:I,resizeObserver:T,dragHandle:M,zIndex:R,isParent:B,noDragClassName:O,noPanClassName:z,initialized:F,disableKeyboardA11y:V,ariaLabel:L,rfId:C,hasHandleBounds:$})=>{const j=qt(),H=A.useRef(null),Y=A.useRef(null),Z=A.useRef(N),G=A.useRef(E),re=A.useRef(o),ne=y||x||d||u||f||m,te=Aw(),q=zs(n,j.getState,u),Q=zs(n,j.getState,f),ie=zs(n,j.getState,m),ue=zs(n,j.getState,_),le=zs(n,j.getState,g);A.useEffect(()=>()=>{Y.current&&(T==null||T.unobserve(Y.current),Y.current=null)},[]),A.useEffect(()=>{if(H.current&&!I){const ce=H.current;F&&$&&Y.current===ce||(Y.current&&(T==null||T.unobserve(Y.current)),T==null||T.observe(ce),Y.current=ce)}},[I,F,$]),A.useEffect(()=>{const ce=re.current!==o,Ne=Z.current!==N,je=G.current!==E;H.current&&(ce||Ne||je)&&(ce&&(re.current=o),Ne&&(Z.current=N),je&&(G.current=E),j.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,o,N,E]);const _e=Iw({nodeRef:H,disabled:I||!x,noDragClassName:O,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:cn(["react-flow__node",`react-flow__node-${o}`,{[z]:x},b,{selected:c,selectable:y,parent:B,dragging:_e}]),ref:H,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:ne?"all":"none",visibility:F?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:q,onMouseMove:Q,onMouseLeave:ie,onContextMenu:ue,onClick:ce=>{const{nodeDragThreshold:Ne}=j.getState();if(y&&(!k||!x||Ne>0)&&lh({id:n,store:j,nodeRef:H}),d){const je=j.getState().nodeInternals.get(n);je&&d(ce,{...je})}},onDoubleClick:le,onKeyDown:S?ce=>{if(!Hu(ce)&&!V)if(Px.includes(ce.key)&&y){const Ne=ce.key==="Escape";lh({id:n,store:j,unselect:Ne,nodeRef:H})}else x&&c&&Object.prototype.hasOwnProperty.call(di,ce.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${ce.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),te({x:di[ce.key].x,y:di[ce.key].y,isShiftPressed:ce.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":V?void 0:`${hw}-${C}`,"aria-label":L},K.createElement(eO,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:i,yPos:s,selected:c,isConnectable:v,sourcePosition:N,targetPosition:E,dragging:_e,dragHandle:M,zIndex:R})))};return e.displayName="NodeWrapper",A.memo(e)};const NO=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Qu(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var jO=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=qt(),{width:r,height:i,x:s,y:a,transformString:l,userSelectionActive:c}=pt(NO,tn),d=Aw(),u=A.useRef(null);if(A.useEffect(()=>{var m;n||((m=u.current)==null||m.focus({preventScroll:!0}))},[n]),Iw({nodeRef:u}),c||!r||!i)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return K.createElement("div",{className:cn(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(di,m.key)&&d({x:di[m.key].x,y:di[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:i,top:a,left:s}}))});const EO=t=>t.nodesSelectionActive,Tw=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:k,panOnScrollSpeed:N,panOnScrollMode:E,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:R,minZoom:B,maxZoom:O,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:V,noPanClassName:L,disableKeyboardA11y:C})=>{const $=pt(EO),j=Ls(u),H=Ls(b),Y=H||T,Z=H||k,G=j||f&&Y!==!0;return(({deleteKeyCode:re,multiSelectionKeyCode:ne})=>{const te=qt(),{deleteElements:q}=Fs(),Q=Ls(re,yO),ie=Ls(ne);A.useEffect(()=>{if(Q){const{edges:ue,getNodes:le}=te.getState(),_e=le().filter(Ne=>Ne.selected),ce=ue.filter(Ne=>Ne.selected);q({nodes:_e,edges:ce}),te.setState({nodesSelectionActive:!1})}},[Q]),A.useEffect(()=>{te.setState({multiSelectionActive:ie})},[ie])})({deleteKeyCode:a,multiSelectionKeyCode:p}),K.createElement(wO,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:Z,panOnScrollSpeed:N,panOnScrollMode:E,zoomOnDoubleClick:I,panOnDrag:!j&&Y,defaultViewport:M,translateExtent:R,minZoom:B,maxZoom:O,zoomActivationKeyCode:x,preventScrolling:z,noWheelClassName:V,noPanClassName:L},K.createElement(Sw,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Y,isSelecting:!!G,selectionMode:m},t,$&&K.createElement(jO,{onSelectionContextMenu:F,noPanClassName:L,disableKeyboardA11y:C})))};Tw.displayName="FlowRenderer";var IO=A.memo(Tw);function AO(t){return{input:Bs(t.input||aw),default:Bs(t.default||nh),output:Bs(t.output||cw),group:Bs(t.group||oh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Bs(t[n]||nh),e),{})}}const TO=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Mw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:i,onError:s}=pt(TO,tn),a=(l=t.onlyRenderVisibleElements,pt(A.useCallback(u=>l?Kx(u.nodeInternals,{x:0,y:0,width:u.width,height:u.height},u.transform,!0):u.getNodes(),[l])));var l;const c=A.useRef(),d=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));i(m)});return c.current=u,u},[]);return A.useEffect(()=>()=>{var u;(u=c==null?void 0:c.current)==null||u.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:ih},a.map(u=>{var k,N,E;let f=u.type||"default";t.nodeTypes[f]||(s==null||s("003",VM(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(u.draggable||e&&u.draggable===void 0),g=!!(u.selectable||r&&u.selectable===void 0),p=!!(u.connectable||n&&u.connectable===void 0),b=!!(u.focusable||o&&u.focusable===void 0),x=t.nodeExtent?Uu(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,S=(({x:I,y:T,width:M,height:R,origin:B})=>M&&R?B[0]<0||B[1]<0||B[0]>1||B[1]>1?{x:I,y:T}:{x:I-M*B[0],y:T-R*B[1]}:{x:I,y:T})({x:y,y:v,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return K.createElement(m,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||Ve.Bottom,targetPosition:u.targetPosition||Ve.Top,hidden:u.hidden,xPos:y,yPos:v,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:u.dragHandle,zIndex:((k=u[Nt])==null?void 0:k.z)??0,isParent:!!((N=u[Nt])!=null&&N.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((E=u[Nt])!=null&&E.handleBounds)})}))};Mw.displayName="NodeRenderer";var MO=A.memo(Mw);const OO=(t,e,n)=>n===Ve.Left?t-e:n===Ve.Right?t+e:t,DO=(t,e,n)=>n===Ve.Top?t-e:n===Ve.Bottom?t+e:t,Ow="react-flow__edgeupdater",Dw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:cn([Ow,`${Ow}-${a}`]),cx:OO(e,o,t),cy:DO(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),RO=()=>!0;var ui=t=>{const e=({id:n,className:o,type:r,data:i,onClick:s,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:x,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:N,targetPosition:E,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:R,onContextMenu:B,onMouseEnter:O,onMouseMove:z,onMouseLeave:F,reconnectRadius:V,onReconnect:L,onReconnectStart:C,onReconnectEnd:$,markerEnd:j,markerStart:H,rfId:Y,ariaLabel:Z,isFocusable:G,isReconnectable:re,pathOptions:ne,interactionWidth:te,disableKeyboardA11y:q})=>{const Q=A.useRef(null),[ie,ue]=A.useState(!1),[le,_e]=A.useState(!1),ce=qt(),Ne=A.useMemo(()=>`url('#${Xu(H,Y)}')`,[H,Y]),je=A.useMemo(()=>`url('#${Xu(j,Y)}')`,[j,Y]);if(T)return null;const de=Ds(n,ce.getState,a),Ee=Ds(n,ce.getState,B),ge=Ds(n,ce.getState,O),Oe=Ds(n,ce.getState,z),Fe=Ds(n,ce.getState,F),$e=(nt,it)=>{if(nt.button!==0)return;const{edges:oe,isValidConnection:ve}=ce.getState(),Ie=it?x:b,ze=(it?R:M)||null,J=it?"target":"source",me=ve||RO,pe=it,he=oe.find(ke=>ke.id===n);_e(!0),C==null||C(nt,he,J),nw({event:nt,handleId:ze,nodeId:Ie,onConnect:ke=>L==null?void 0:L(he,ke),isTarget:pe,getState:ce.getState,setState:ce.setState,isValidConnection:me,edgeUpdaterType:J,onReconnectEnd:ke=>{_e(!1),$==null||$(ke,he,J)}})},Xe=()=>ue(!0),Le=()=>ue(!1),et=!I&&!s;return K.createElement("g",{className:cn(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:et,updating:ie}]),onClick:nt=>{var J;const{edges:it,addSelectedEdges:oe,unselectNodesAndEdges:ve,multiSelectionActive:Ie}=ce.getState(),ze=it.find(me=>me.id===n);ze&&(I&&(ce.setState({nodesSelectionActive:!1}),ze.selected&&Ie?(ve({nodes:[],edges:[ze]}),(J=Q.current)==null||J.blur()):oe([n])),s&&s(nt,ze))},onDoubleClick:de,onContextMenu:Ee,onMouseEnter:ge,onMouseMove:Oe,onMouseLeave:Fe,onKeyDown:G?nt=>{var it;if(!q&&Px.includes(nt.key)&&I){const{unselectNodesAndEdges:oe,addSelectedEdges:ve,edges:Ie}=ce.getState();nt.key==="Escape"?((it=Q.current)==null||it.blur(),oe({edges:[Ie.find(ze=>ze.id===n)]})):ve([n])}}:void 0,tabIndex:G?0:void 0,role:G?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Z===null?void 0:Z||`Edge from ${b} to ${x}`,"aria-describedby":G?`${fw}-${Y}`:void 0,ref:Q},!le&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:i,style:p,sourceX:y,sourceY:v,targetX:S,targetY:k,sourcePosition:N,targetPosition:E,sourceHandleId:M,targetHandleId:R,markerStart:Ne,markerEnd:je,pathOptions:ne,interactionWidth:te}),re&&K.createElement(K.Fragment,null,(re==="source"||re===!0)&&K.createElement(Dw,{position:N,centerX:y,centerY:v,radius:V,onMouseDown:nt=>$e(nt,!0),onMouseEnter:Xe,onMouseOut:Le,type:"source"}),(re==="target"||re===!0)&&K.createElement(Dw,{position:E,centerX:S,centerY:k,radius:V,onMouseDown:nt=>$e(nt,!1),onMouseEnter:Xe,onMouseOut:Le,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function PO(t){return{default:ui(t.default||Tl),straight:ui(t.bezier||Ju),step:ui(t.step||Yu),smoothstep:ui(t.step||Il),simplebezier:ui(t.simplebezier||qu),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ui(t[n]||Tl),e),{})}}function Rw(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,i=(n==null?void 0:n.width)||e.width,s=(n==null?void 0:n.height)||e.height;switch(t){case Ve.Top:return{x:o+i/2,y:r};case Ve.Right:return{x:o+i,y:r+s/2};case Ve.Bottom:return{x:o+i/2,y:r+s};case Ve.Left:return{x:o,y:r+s/2}}}function Pw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function Lw(t){var o,r,i,s,a;const e=((o=t==null?void 0:t[Nt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)!==void 0;return[{x:((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const LO=[{level:0,isMaxLevel:!0,edges:[]}];function FO(t,e,n){return function(o,r,i=!1){let s=-1;const a=o.reduce((c,d)=>{var m,_;const u=Dn(d.zIndex);let f=u?d.zIndex:0;if(i){const g=r.get(d.target),p=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),x=Math.max(((m=p==null?void 0:p[Nt])==null?void 0:m.z)||0,((_=g==null?void 0:g[Nt])==null?void 0:_.z)||0,1e3);f=(u?d.zIndex:0)+(b?x:0)}return c[f]?c[f].push(d):c[f]=[d],s=f>s?f:s,c},{}),l=Object.entries(a).map(([c,d])=>{const u=+c;return{edges:d,level:u,isMaxLevel:u===s}});return l.length===0?LO:l}(pt(A.useCallback(o=>t?o.edges.filter(r=>{const i=e.get(r.source),s=e.get(r.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:u,targetHeight:f,width:m,height:_,transform:g}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+u),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Vu({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),y=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(x*y)>0}({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:s.width,targetHeight:s.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const Fw={[ri.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[ri.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},zO=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=function(c){const d=qt();return A.useMemo(()=>{var u,f;return Object.prototype.hasOwnProperty.call(Fw,c)?Fw[c]:((f=(u=d.getState()).onError)==null||f.call(u,"009",WM(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:s})):null},zw=({defaultColor:t,rfId:e})=>{const n=pt(A.useCallback((({defaultColor:o,rfId:r})=>i=>{const s=[];return i.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Xu(c,r);s.includes(d)||(a.push({id:d,color:c.color||o,...c}),s.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((i,s)=>i.id!==r[s].id)));return K.createElement("defs",null,n.map(o=>K.createElement(zO,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};zw.displayName="MarkerDefinitions";var BO=A.memo(zw);const UO=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),Bw=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:S,height:k,connectionMode:N,nodeInternals:E,onError:I}=pt(UO,tn),T=FO(e,E,n);return S?K.createElement(K.Fragment,null,T.map(({level:M,edges:R,isMaxLevel:B})=>K.createElement("svg",{key:M,style:{zIndex:M},width:S,height:k,className:"react-flow__edges react-flow__container"},B&&K.createElement(BO,{defaultColor:t,rfId:o}),K.createElement("g",null,R.map(O=>{const[z,F,V]=Lw(E.get(O.source)),[L,C,$]=Lw(E.get(O.target));if(!V||!$)return null;let j=O.type||"default";r[j]||(I==null||I("011",YM(j)),j="default");const H=r[j]||r.default,Y=N===xr.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=Pw(F.source,O.sourceHandle),G=Pw(Y,O.targetHandle),re=(Z==null?void 0:Z.position)||Ve.Bottom,ne=(G==null?void 0:G.position)||Ve.Top,te=!!(O.focusable||x&&O.focusable===void 0),q=O.reconnectable||O.updatable,Q=f!==void 0&&(q||y&&q===void 0);if(!Z||!G)return I==null||I("008",qM(Z,O)),null;const{sourceX:ie,sourceY:ue,targetX:le,targetY:_e}=((ce,Ne,je,de,Ee,ge)=>{const Oe=Rw(je,ce,Ne),Fe=Rw(ge,de,Ee);return{sourceX:Oe.x,sourceY:Oe.y,targetX:Fe.x,targetY:Fe.y}})(z,Z,re,L,G,ne);return K.createElement(H,{key:O.id,id:O.id,className:cn([O.className,i]),type:j,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ie,sourceY:ue,targetX:le,targetY:_e,sourcePosition:re,targetPosition:ne,elementsSelectable:v,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:te,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};Bw.displayName="EdgeRenderer";var VO=A.memo(Bw);const $O=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function HO({children:t}){const e=pt($O);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const WO={[Ve.Left]:Ve.Right,[Ve.Right]:Ve.Left,[Ve.Top]:Ve.Bottom,[Ve.Bottom]:Ve.Top},Uw=({nodeId:t,handleType:e,style:n,type:o=Ko.Bezier,CustomComponent:r,connectionStatus:i})=>{var k,N,E;const{fromNode:s,handleId:a,toX:l,toY:c,connectionMode:d}=pt(A.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),tn),u=(k=s==null?void 0:s[Nt])==null?void 0:k.handleBounds;let f=u==null?void 0:u[e];if(d===xr.Loose&&(f=f||(u==null?void 0:u[e==="source"?"target":"source"])),!s||!f)return null;const m=a?f.find(I=>I.id===a):f[0],_=m?m.x+m.width/2:(s.width??0)/2,g=m?m.y+m.height/2:s.height??0,p=(((N=s.positionAbsolute)==null?void 0:N.x)??0)+_,b=(((E=s.positionAbsolute)==null?void 0:E.y)??0)+g,x=m==null?void 0:m.position,y=x?WO[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:s,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:i});let v="";const S={sourceX:p,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===Ko.Bezier?[v]=Yx(S):o===Ko.Step?[v]=Gu({...S,borderRadius:0}):o===Ko.SmoothStep?[v]=Gu(S):o===Ko.SimpleBezier?[v]=Hx(S):v=`M${p},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};Uw.displayName="ConnectionLine";const qO=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function GO({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:i,nodesConnectable:s,width:a,height:l,connectionStatus:c}=pt(qO,tn);return r&&i&&a&&s?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:cn(["react-flow__connection",c])},K.createElement(Uw,{nodeId:r,handleType:i,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function Vw(t,e){return A.useRef(null),qt(),A.useMemo(()=>e(t),[t])}const $w=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:i,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:k,selectionMode:N,multiSelectionKeyCode:E,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:B,selectNodesOnDrag:O,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:L,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:j,zoomOnPinch:H,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:G,zoomOnDoubleClick:re,panOnDrag:ne,onPaneClick:te,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:ie,onPaneScroll:ue,onPaneContextMenu:le,onEdgeContextMenu:_e,onEdgeMouseEnter:ce,onEdgeMouseMove:Ne,onEdgeMouseLeave:je,onReconnect:de,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:Oe,noDragClassName:Fe,noWheelClassName:$e,noPanClassName:Xe,elevateEdgesOnSelect:Le,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:oe})=>{const ve=Vw(t,AO),Ie=Vw(e,PO);return function(ze){const J=Fs(),me=A.useRef(!1);A.useEffect(()=>{!me.current&&J.viewportInitialized&&ze&&(setTimeout(()=>ze(J),1),me.current=!0)},[ze,J.viewportInitialized])}(i),K.createElement(IO,{onPaneClick:te,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:ie,onPaneContextMenu:le,onPaneScroll:ue,deleteKeyCode:M,selectionKeyCode:S,selectionOnDrag:k,selectionMode:N,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:E,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:B,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:j,zoomOnPinch:H,zoomOnDoubleClick:re,panOnScroll:Y,panOnScrollSpeed:Z,panOnScrollMode:G,panOnDrag:ne,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:L,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:Fe,noWheelClassName:$e,noPanClassName:Xe,disableKeyboardA11y:et},K.createElement(HO,null,K.createElement(VO,{edgeTypes:Ie,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:_e,onEdgeMouseEnter:ce,onEdgeMouseMove:Ne,onEdgeMouseLeave:je,onReconnect:de,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:Oe,defaultMarkerColor:$,noPanClassName:Xe,elevateEdgesOnSelect:!!Le,disableKeyboardA11y:et,rfId:oe},K.createElement(GO,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(MO,{nodeTypes:ve,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:R,noPanClassName:Xe,noDragClassName:Fe,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:oe})))};$w.displayName="GraphView";var YO=A.memo($w);const dh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo={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:dh,nodeExtent:dh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:xr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},JO=()=>((t,e)=>t?jx(t,e):jx)((t,e)=>({...Qo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:i}=e();t({nodeInternals:rh(n,o,r,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,i=o!==void 0,s=r?rh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:s,edges:i?o:[],hasDefaultNodes:r,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:void 0}});else if(b){const x=Bu(p.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:Ew(".source",p.nodeElement,f,c),target:Ew(".target",p.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);_w(r,c);const _=s||i&&!s&&bw(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:i}=e(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});i(s)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:i,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(i){const c=rh(kw(n,a()),r,s,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:i}=e();let s,a=null;o?s=n.map(l=>Zo(l,!0)):(s=ci(i(),n),a=ci(r,[])),Ol({changedNodes:s,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:i}=e();let s,a=null;o?s=n.map(l=>Zo(l,!0)):(s=ci(r,n),a=ci(i(),[])),Ol({changedNodes:a,changedEdges:s,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:i}=e(),s=o||r;Ol({changedNodes:(n||i()).map(a=>(a.selected=!1,Zo(a.id,!1))),changedEdges:s.map(a=>Zo(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Ol({changedNodes:o().filter(r=>r.selected).map(r=>Zo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Zo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Uu(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:i,d3Zoom:s,d3Selection:a,translateExtent:l}=e();if(!s||!a||!n.x&&!n.y)return!1;const c=dr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,i]],u=s==null?void 0:s.constrain()(c,d,l);return s.transform(a,u),o[0]!==u.x||o[1]!==u.y||o[2]!==u.k},cancelConnection:()=>t({connectionNodeId:Qo.connectionNodeId,connectionHandleId:Qo.connectionHandleId,connectionHandleType:Qo.connectionHandleType,connectionStatus:Qo.connectionStatus,connectionStartHandle:Qo.connectionStartHandle,connectionEndHandle:Qo.connectionEndHandle}),reset:()=>t({...Qo})}),Object.is),uh=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=JO()),K.createElement(UM,{value:e.current},t)};uh.displayName="ReactFlowProvider";const Hw=({children:t})=>A.useContext(Cl)?K.createElement(K.Fragment,null,t):K.createElement(uh,null,t);Hw.displayName="ReactFlowWrapper";const KO={input:aw,default:nh,output:cw,group:oh},XO={default:Tl,straight:Ju,step:Yu,smoothstep:Il,simplebezier:qu},ZO=[0,0],QO=[15,15],e9={x:0,y:0,zoom:1},t9={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},hh=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i=KO,edgeTypes:s=XO,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:R,onSelectionDragStart:B,onSelectionDrag:O,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:L,connectionMode:C=xr.Strict,connectionLineType:$=Ko.Bezier,connectionLineStyle:j,connectionLineComponent:H,connectionLineContainerStyle:Y,deleteKeyCode:Z="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:re=!1,selectionMode:ne=Rs.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:q=jl()?"Meta":"Control",zoomActivationKeyCode:Q=jl()?"Meta":"Control",snapToGrid:ie=!1,snapGrid:ue=QO,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:_e=!0,nodesDraggable:ce,nodesConnectable:Ne,nodesFocusable:je,nodeOrigin:de=ZO,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:Oe,defaultViewport:Fe=e9,minZoom:$e=.5,maxZoom:Xe=2,translateExtent:Le=dh,preventScrolling:et=!0,nodeExtent:nt,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:oe=!0,zoomOnPinch:ve=!0,panOnScroll:Ie=!1,panOnScrollSpeed:ze=.5,panOnScrollMode:J=Jo.Free,zoomOnDoubleClick:me=!0,panOnDrag:pe=!0,onPaneClick:he,onPaneMouseEnter:ke,onPaneMouseMove:xe,onPaneMouseLeave:Ue,onPaneScroll:Ze,onPaneContextMenu:ae,children:Se,onEdgeContextMenu:Ce,onEdgeDoubleClick:Be,onEdgeMouseEnter:He,onEdgeMouseMove:Re,onEdgeMouseLeave:Ge,onEdgeUpdate:ot,onEdgeUpdateStart:Ye,onEdgeUpdateEnd:rt,onReconnect:gt,onReconnectStart:xt,onReconnectEnd:Mt,reconnectRadius:wt=10,edgeUpdaterRadius:Vt=10,onNodesChange:Sn,onEdgesChange:dn,noDragClassName:on="nodrag",noWheelClassName:Zt="nowheel",noPanClassName:Wn="nopan",fitView:lo=!1,fitViewOptions:yi,connectOnClick:xi=!0,attributionPosition:wi,proOptions:vi,defaultEdgeOptions:ki,elevateNodesOnSelect:nr=!0,elevateEdgesOnSelect:Si=!1,disableKeyboardA11y:Ci=!1,autoPanOnConnect:Ni=!0,autoPanOnNodeDrag:Ft=!0,connectionRadius:vt=20,isValidConnection:Cn,onError:Nn,style:ji,id:Kl,nodeDragThreshold:Vf,...$f},Xl)=>{const Hf=Kl||"1";return K.createElement("div",{...$f,style:{...ji,...t9},ref:Xl,className:cn(["react-flow",r]),"data-testid":"rf__wrapper",id:Kl},K.createElement(Hw,null,K.createElement(YO,{onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:s,connectionLineType:$,connectionLineStyle:j,connectionLineComponent:H,connectionLineContainerStyle:Y,selectionKeyCode:G,selectionOnDrag:re,selectionMode:ne,deleteKeyCode:Z,multiSelectionKeyCode:q,panActivationKeyCode:te,zoomActivationKeyCode:Q,onlyRenderVisibleElements:le,selectNodesOnDrag:_e,defaultViewport:Fe,translateExtent:Le,minZoom:$e,maxZoom:Xe,preventScrolling:et,zoomOnScroll:oe,zoomOnPinch:ve,zoomOnDoubleClick:me,panOnScroll:Ie,panOnScrollSpeed:ze,panOnScrollMode:J,panOnDrag:pe,onPaneClick:he,onPaneMouseEnter:ke,onPaneMouseMove:xe,onPaneMouseLeave:Ue,onPaneScroll:Ze,onPaneContextMenu:ae,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:L,onEdgeContextMenu:Ce,onEdgeDoubleClick:Be,onEdgeMouseEnter:He,onEdgeMouseMove:Re,onEdgeMouseLeave:Ge,onReconnect:gt??ot,onReconnectStart:xt??Ye,onReconnectEnd:Mt??rt,reconnectRadius:wt??Vt,defaultMarkerColor:it,noDragClassName:on,noWheelClassName:Zt,noPanClassName:Wn,elevateEdgesOnSelect:Si,rfId:Hf,disableKeyboardA11y:Ci,nodeOrigin:de,nodeExtent:nt}),K.createElement(dO,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:ce,nodesConnectable:Ne,nodesFocusable:je,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:Oe,elevateNodesOnSelect:nr,minZoom:$e,maxZoom:Xe,nodeExtent:nt,onNodesChange:Sn,onEdgesChange:dn,snapToGrid:ie,snapGrid:ue,connectionMode:C,translateExtent:Le,connectOnClick:xi,defaultEdgeOptions:ki,fitView:lo,fitViewOptions:yi,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:I,onSelectionDrag:O,onSelectionDragStart:B,onSelectionDragStop:z,noPanClassName:Wn,nodeOrigin:de,rfId:Hf,autoPanOnConnect:Ni,autoPanOnNodeDrag:Ft,onError:Nn,connectionRadius:vt,isValidConnection:Cn,nodeDragThreshold:Vf}),K.createElement(lO,{onSelectionChange:R}),Se,K.createElement(XM,{proOptions:vi,position:wi}),K.createElement(mO,{rfId:Hf,disableKeyboardA11y:Ci})))});function Ww(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(i=>o(s=>t(i,s)),[]);return[n,o,r]}}hh.displayName="ReactFlow";const qw=Ww(kw),Gw=Ww(function(t,e){return vw(t,e)});function n9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function o9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function r9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.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 i9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.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 s9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.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 hi=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:cn(["react-flow__controls-button",e]),...n},t);hi.displayName="ControlButton";const a9=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),Yw=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left"})=>{const f=qt(),[m,_]=A.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=pt(a9,tn),{zoomIn:x,zoomOut:y,fitView:v}=Fs();return A.useEffect(()=>{_(!0)},[]),m?K.createElement(Nl,{className:cn(["react-flow__controls",c]),position:u,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(hi,{onClick:()=>{x(),i==null||i()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(n9,null)),K.createElement(hi,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},K.createElement(o9,null))),n&&K.createElement(hi,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(r9,null)),o&&K.createElement(hi,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(s9,null):K.createElement(i9,null)),d):null};Yw.displayName="Controls";var Rn,l9=A.memo(Yw);function c9({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function d9({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Rn||(Rn={}));const u9={[Rn.Dots]:"#91919a",[Rn.Lines]:"#eee",[Rn.Cross]:"#e2e2e2"},h9={[Rn.Dots]:1,[Rn.Lines]:1,[Rn.Cross]:6},f9=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Jw({id:t,variant:e=Rn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=2,color:s,style:a,className:l}){const c=A.useRef(null),{transform:d,patternId:u}=pt(f9,tn),f=s||u9[e],m=o||h9[e],_=e===Rn.Dots,g=e===Rn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],x=m*d[2],y=g?[x,x]:b,v=_?[x/i,x/i]:[y[0]/i,y[1]/i];return K.createElement("svg",{className:cn(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:u+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?K.createElement(d9,{color:f,radius:x/i}):K.createElement(c9,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${u+t})`}))}Jw.displayName="Background";var m9=A.memo(Jw);function fh(t){return Math.min(11*t+35,200)}const Kw=K.createContext("LR"),Xw=A.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=We(n.atom),i=Oc().inOrderIds.indexOf(r.id),s=o?"var(--gray-9)":"var(--gray-3)",a=pt(p9),l=A.useContext(Kw);let c,d,u,f,m;if(e[0]!==r.code||e[1]!==s||e[2]!==l||e[3]!==o){const M=r.code.split(`
116
- `).length,R=l==="LR"?Ve.Left:Ve.Top;let B;e[8]!==s?(B={background:s},e[8]=s,e[9]=B):B=e[9],e[10]!==R||e[11]!==B?(u=h.jsx(Xo,{type:"target",id:"inputs",position:R,style:B}),e[10]=R,e[11]=B,e[12]=u):u=e[12];const O=l==="LR"?Ve.Left:Ve.Top;let z;e[13]!==s?(z={background:s},e[13]=s,e[14]=z):z=e[14],e[15]!==O||e[16]!==z?(f=h.jsx(Xo,{type:"source",id:"inputs",position:O,style:z}),e[15]=O,e[16]=z,e[17]=f):f=e[17];const F=o&&"border-primary";e[18]!==F?(d=Te("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",F),e[18]=F,e[19]=d):d=e[19],c=fh(M),e[0]=r.code,e[1]=s,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=u,e[7]=f}else c=e[4],d=e[5],u=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(g={height:c,width:m},e[23]=c,e[24]=m,e[25]=g):g=e[25];const p=xU(r.name,i);let b,x,y;e[26]!==p?(b=h.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(x=h.jsx(u$,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==x?(y=h.jsxs("div",{className:d,style:g,children:[b,x]}),e[30]=d,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?Ve.Right:Ve.Bottom;let S,k;e[35]!==s?(S={background:s},e[35]=s,e[36]=S):S=e[36],e[37]!==v||e[38]!==S?(k=h.jsx(Xo,{type:"source",id:"outputs",position:v,style:S}),e[37]=v,e[38]=S,e[39]=k):k=e[39];const N=l==="LR"?Ve.Right:Ve.Bottom;let E,I,T;return e[40]!==s?(E={background:s},e[40]=s,e[41]=E):E=e[41],e[42]!==N||e[43]!==E?(I=h.jsx(Xo,{type:"target",id:"outputs",position:N,style:E}),e[42]=N,e[43]=E,e[44]=I):I=e[44],e[45]!==y||e[46]!==k||e[47]!==I||e[48]!==u||e[49]!==f?(T=h.jsxs("div",{children:[u,f,y,k,I]}),e[45]=y,e[46]=k,e[47]=I,e[48]=u,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));Xw.displayName="CustomNode";const Zw={custom:Xw};function p9(t){const{width:e}=t;return e}const Qw=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:i}=t,s=Oc();let a,l,c,d;if(e[0]!==o||e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{let u;e[8]!==s?(u=(_,g)=>s.inOrderIds.indexOf(_)-s.inOrderIds.indexOf(g),e[8]=s,e[9]=u):u=e[9];const f=[...o].sort(u);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==i?(m=(_,g)=>h.jsxs("span",{className:"truncate",children:[h.jsx(cr,{variant:"focus",cellId:_,skipScroll:i,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=i,e[14]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&h.jsxs(Bi,{children:[h.jsx(fa,{asChild:!0,children:h.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),h.jsx(oa,{className:"w-auto",children:h.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>h.jsx(cr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=s,e[2]=n,e[3]=r,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=h.jsxs(h.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},mh=t=>{const e=X.c(15);let n,o,r,i;e[0]!==t?({name:o,declaredBy:n,onClick:r,...i}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=i):(n=e[1],o=e[2],r=e[3],i=e[4]);const s=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await bn(o),lt({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==s||e[10]!==a?(l=h.jsx(j4,{title:o,variant:s,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=s,e[10]=a,e[11]=l):l=e[11],e[12]!==i||e[13]!==l?(c=h.jsx("div",{className:"max-w-[130px]",...i,children:l}),e[12]=i,e[13]=l,e[14]=c):c=e[14],c},ph=A.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:i}=t;let s;e[0]!==i||e[1]!==r?(s=(O,z)=>{i({...r,[O]:z})},e[0]=i,e[1]=r,e[2]=s):s=e[2];const a=s;let l,c,d,u,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(fa,{asChild:!0,children:h.jsx(De,{variant:"text",size:"xs",children:h.jsx(H3,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(u=h.jsx(f4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Nr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==u?(m=h.jsxs(Bi,{children:[l,h.jsxs(oa,{className:"w-auto p-2 text-muted-foreground",children:[c,h.jsxs("div",{className:"flex items-center gap-2",children:[u,f]})]})]}),e[11]=u,e[12]=m):m=e[12];const _=m,g=o==="_minimap_";let p,b,x;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Dp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(x=h.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=x):x=e[18];const y=o==="TB";let v,S,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(ka,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==y||e[23]!==v?(k=h.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[S,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=k):k=e[24];const N=o==="LR";let E,I,T,M;e[25]!==n?(E=()=>n("LR"),e[25]=n,e[26]=E):E=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsx(ka,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==N||e[29]!==E?(T=h.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:E,children:[I," ","Horizontal Tree"]}),e[28]=N,e[29]=E,e[30]=T):T=e[30],e[31]!==x||e[32]!==k||e[33]!==T?(M=h.jsxs("div",{className:"flex gap-2",children:[x,k,T]}),e[31]=x,e[32]=k,e[33]=T,e[34]=M):M=e[34];const R=o!=="_minimap_"&&_;let B;return e[35]!==M||e[36]!==R?(B=h.jsxs(Nl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,R]}),e[35]=M,e[36]=R,e[37]=B):B=e[37],B});ph.displayName="GraphToolbar";const Rl=A.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const i=g9;let s;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(s=()=>{if(n.type==="node"){const d=Object.values(o).filter(m=>m.usedBy.includes(n.id)),u=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,_)=>h.jsxs(h.Fragment,{children:[m.length===0&&h.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),h.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>h.jsxs(K.Fragment,{children:[h.jsx(mh,{declaredBy:g.declaredBy,name:g.name}),h.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,h.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),h.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:h.jsx(Qw,{skipScroll:!0,onClick:()=>i(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(rc,{className:"w-5 h-5"}),h.jsx(cr,{cellId:n.id}),h.jsx("div",{className:"flex-1"}),h.jsx(m0,{cellId:n.id,children:h.jsx(De,{variant:"ghost",size:"icon",children:h.jsx(Hc,{className:"w-4 h-4"})})}),h.jsx(De,{variant:"text",size:"icon",onClick:()=>{r()},children:h.jsx(Jn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(fn,{className:"w-4 h-4"}),"Outputs"]}),f(u,"out")]}),h.jsx("hr",{className:"border-divider my-3"}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(np,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(u=>u.declaredBy.includes(n.source)&&u.usedBy.includes(n.target));return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(Ca,{className:"w-4 h-4"}),h.jsx(cr,{cellId:n.source}),h.jsx(Uc,{className:"w-4 h-4"}),h.jsx(cr,{cellId:n.target})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(u=>h.jsxs(K.Fragment,{children:[h.jsx(mh,{declaredBy:u.declaredBy,name:u.name,onClick:()=>{i(u.declaredBy[0],u.name)}}),h.jsx("div",{className:"truncate text-foreground/60 font-mono",children:u.dataType}),h.jsx("div",{className:"truncate col-span-2",title:u.value??"",children:u.value})]},u.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=s):s=e[6];const a=s;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=h.jsx(Nl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:h.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function g9(t,e){const n=ec(t);n&&Bm(n,e)}function ev(){const t=X.c(7),e=Fs(),n=pt(b9),o=pt(_9);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const i=wU(r,100);let s,a;t[2]!==i||t[3]!==o||t[4]!==n?(s=()=>{n&&o&&i()},a=[n,o,i],t[2]=i,t[3]=o,t[4]=n,t[5]=s,t[6]=a):(s=t[5],a=t[6]),A.useEffect(s,a)}function _9(t){const{height:e}=t;return e}function b9(t){const{width:e}=t;return e}Rl.displayName="GraphSelectionPanel";const tv=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:ri.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:fh(ut.get(e).code.trim().split(`
117
- `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const i=[],s=[];for(const[l,c]of zm.zip(t,e)){const d=this.createNode(l,c,r);i.push(d),r=d.position.y+(d.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:d}=l;for(const u of c)for(const f of d){const m=`${u}-${f}`;a.has(m)||(a.add(m),s.push(this.createEdge(u,f,"inputs"),this.createEdge(u,f,"outputs")))}}return{nodes:i,edges:s}}},y9=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:i}=t;let s;e[0]!==r||e[1]!==n||e[2]!==o?(s=tv.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=s):s=e[3];const{nodes:a,edges:l}=s;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[d,u]=Gw(c),[f,m]=qw(a),[_,g]=A.useState(),[p,b]=A.useState(),x=A.useRef(!1);ev();const y=pt(x9);let v;e[5]!==u||e[6]!==m?(v=C=>{m(C.nodes),u([])},e[5]=u,e[6]=m,e[7]=v):v=e[7];const S=Qe(v);let k,N,E,I;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(k=()=>{x.current?S(tv.createElements(n,r,o,!1)):x.current=!0},N=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=k,e[13]=N):(k=e[12],N=e[13]),A.useEffect(k,N),e[14]!==l||e[15]!==_||e[16]!==u?(E=()=>{if(_){const C=l.filter($=>{const{source:j,target:H,data:Y}=$;return j===_&&Y.direction==="outputs"||H===_&&Y.direction==="inputs"});u(C)}},I=[_,u,l],e[14]=l,e[15]=_,e[16]=u,e[17]=E,e[18]=I):(E=e[17],I=e[18]),A.useEffect(E,I);const T=function(C,$){const j=X.c(17);let H,Y;if(j[0]!==$||j[1]!==C){let Q;j[3]!==$?(Q=(ie,ue)=>{const{position:le}=ue;return Math.min(ie,le.y-$/2-10)},j[3]=$,j[4]=Q):Q=j[4],Y=C.reduce(Q,Number.POSITIVE_INFINITY),j[0]=$,j[1]=C,j[2]=Y}else Y=j[2];const Z=Y;let G;if(j[5]!==$||j[6]!==C){let Q;j[8]!==$?(Q=(ie,ue)=>{const{position:le}=ue;return Math.max(ie,le.y+$/2+10)},j[8]=$,j[9]=Q):Q=j[9],G=C.reduce(Q,Number.NEGATIVE_INFINITY),j[5]=$,j[6]=C,j[7]=G}else G=j[7];const re=G;let ne,te,q;return j[10]!==Z?(ne=[Number.NEGATIVE_INFINITY,Z],j[10]=Z,j[11]=ne):ne=j[11],j[12]!==re?(te=[Number.POSITIVE_INFINITY,re],j[12]=re,j[13]=te):te=j[13],j[14]!==ne||j[15]!==te?(q=[ne,te],j[14]=ne,j[15]=te,j[16]=q):q=j[16],H=q,H}(f,y);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const R=M;let B;e[20]!==d||e[21]!==p||e[22]!==_||e[23]!==o?(B=()=>p?h.jsx(Rl,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:R,variables:o,edges:d}):_?h.jsx(Rl,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:R}):null,e[20]=d,e[21]=p,e[22]=_,e[23]=o,e[24]=B):B=e[24];const O=B;let z,F,V,L;return e[25]!==u?(z=(C,$)=>{const j=$.id;g(j),b(void 0),u([])},e[25]=u,e[26]=z):z=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(C,$)=>{b($)},e[27]=F):F=e[27],e[28]!==O?(V=O(),e[28]=O,e[29]=V):V=e[29],e[30]!==i||e[31]!==d||e[32]!==f||e[33]!==z||e[34]!==V||e[35]!==T?(L=h.jsxs(hh,{nodes:f,edges:d,nodeTypes:Zw,translateExtent:T,onNodeClick:z,onNodeDoubleClick:w9,onEdgeClick:F,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Jo.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:[V,i]}),e[30]=i,e[31]=d,e[32]=f,e[33]=z,e[34]=V,e[35]=T,e[36]=L):L=e[36],L};function x9(t){const{height:e}=t;return e}function w9(t,e){E4(e.id,"focus")}var gh,nv,ov,rv,iv,sv,_h,av,bh,lv,yh,cv,xh,dv,wh,uv,vh,hv,kh,fv,Sh,mv,Ch,pv,Nh,gv,jh,_v,Eh,bv,Ih,yv,Ah,xv,wv,vv,kv,Sv,Cv,Nv,Th,jv,Mh,Ev,Oh,Iv,Dh,Av,Rh,Tv,Ph,Mv,Lh,Ov,Fh,Dv,zh,Rv,Bh,Pv,Uh,Lv,Vh,Fv,$h,zv,Hh,Bv,Uv,Vv,$v,Hv,Wv,qv,Wh,Gv,qh,Yv,Jv,Kv,Gh,Xv,Yh,Zv,Jh,Qv,Kh,e2,Xh,t2,n2,o2,r2,i2;function Zh(){if(nv)return gh;nv=1;var t="\0";function e(i,s){i[s]?i[s]++:i[s]=1}function n(i,s){--i[s]||delete i[s]}function o(i,s,a,l){var c=""+s,d=""+a;if(!i&&c>d){var u=c;c=d,d=u}return c+""+d+""+(l===void 0?"\0":l)}function r(i,s){return o(i,s.v,s.w,s.name)}return gh=class{constructor(i){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(this,"_children");i&&(this._isDirected=!Object.hasOwn(i,"directed")||i.directed,this._isMultigraph=!!Object.hasOwn(i,"multigraph")&&i.multigraph,this._isCompound=!!Object.hasOwn(i,"compound")&&i.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(i){return this._label=i,this}graph(){return this._label}setDefaultNodeLabel(i){return this._defaultNodeLabelFn=i,typeof i!="function"&&(this._defaultNodeLabelFn=()=>i),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var i=this;return this.nodes().filter(s=>Object.keys(i._in[s]).length===0)}sinks(){var i=this;return this.nodes().filter(s=>Object.keys(i._out[s]).length===0)}setNodes(i,s){var a=arguments,l=this;return i.forEach(function(c){a.length>1?l.setNode(c,s):l.setNode(c)}),this}setNode(i,s){return Object.hasOwn(this._nodes,i)?(arguments.length>1&&(this._nodes[i]=s),this):(this._nodes[i]=arguments.length>1?s:this._defaultNodeLabelFn(i),this._isCompound&&(this._parent[i]=t,this._children[i]={},this._children[t][i]=!0),this._in[i]={},this._preds[i]={},this._out[i]={},this._sucs[i]={},++this._nodeCount,this)}node(i){return this._nodes[i]}hasNode(i){return Object.hasOwn(this._nodes,i)}removeNode(i){var s=this;if(Object.hasOwn(this._nodes,i)){var a=l=>s.removeEdge(s._edgeObjs[l]);delete this._nodes[i],this._isCompound&&(this._removeFromParentsChildList(i),delete this._parent[i],this.children(i).forEach(function(l){s.setParent(l)}),delete this._children[i]),Object.keys(this._in[i]).forEach(a),delete this._in[i],delete this._preds[i],Object.keys(this._out[i]).forEach(a),delete this._out[i],delete this._sucs[i],--this._nodeCount}return this}setParent(i,s){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(s===void 0)s=t;else{for(var a=s+="";a!==void 0;a=this.parent(a))if(a===i)throw new Error("Setting "+s+" as parent of "+i+" would create a cycle");this.setNode(s)}return this.setNode(i),this._removeFromParentsChildList(i),this._parent[i]=s,this._children[s][i]=!0,this}_removeFromParentsChildList(i){delete this._children[this._parent[i]][i]}parent(i){if(this._isCompound){var s=this._parent[i];if(s!==t)return s}}children(i=t){if(this._isCompound){var s=this._children[i];if(s)return Object.keys(s)}else{if(i===t)return this.nodes();if(this.hasNode(i))return[]}}predecessors(i){var s=this._preds[i];if(s)return Object.keys(s)}successors(i){var s=this._sucs[i];if(s)return Object.keys(s)}neighbors(i){var s=this.predecessors(i);if(s){const l=new Set(s);for(var a of this.successors(i))l.add(a);return Array.from(l.values())}}isLeaf(i){return(this.isDirected()?this.successors(i):this.neighbors(i)).length===0}filterNodes(i){var s=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});s.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,u]){i(d)&&s.setNode(d,u)}),Object.values(this._edgeObjs).forEach(function(d){s.hasNode(d.v)&&s.hasNode(d.w)&&s.setEdge(d,a.edge(d))});var l={};function c(d){var u=a.parent(d);return u===void 0||s.hasNode(u)?(l[d]=u,u):u in l?l[u]:c(u)}return this._isCompound&&s.nodes().forEach(d=>s.setParent(d,c(d))),s}setDefaultEdgeLabel(i){return this._defaultEdgeLabelFn=i,typeof i!="function"&&(this._defaultEdgeLabelFn=()=>i),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(i,s){var a=this,l=arguments;return i.reduce(function(c,d){return l.length>1?a.setEdge(c,d,s):a.setEdge(c,d),d}),this}setEdge(){var i,s,a,l,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(i=d.v,s=d.w,a=d.name,arguments.length===2&&(l=arguments[1],c=!0)):(i=d,s=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),i=""+i,s=""+s,a!==void 0&&(a=""+a);var u=o(this._isDirected,i,s,a);if(Object.hasOwn(this._edgeLabels,u))return c&&(this._edgeLabels[u]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(i),this.setNode(s),this._edgeLabels[u]=c?l:this._defaultEdgeLabelFn(i,s,a);var f=function(m,_,g,p){var b=""+_,x=""+g;if(!m&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return p&&(v.name=p),v}(this._isDirected,i,s,a);return i=f.v,s=f.w,Object.freeze(f),this._edgeObjs[u]=f,e(this._preds[s],i),e(this._sucs[i],s),this._in[s][u]=f,this._out[i][u]=f,this._edgeCount++,this}edge(i,s,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,i,s,a);return this._edgeLabels[l]}edgeAsObj(){const i=this.edge(...arguments);return typeof i!="object"?{label:i}:i}hasEdge(i,s,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,i,s,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(i,s,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,i,s,a),c=this._edgeObjs[l];return c&&(i=c.v,s=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[s],i),n(this._sucs[i],s),delete this._in[s][l],delete this._out[i][l],this._edgeCount--),this}inEdges(i,s){var a=this._in[i];if(a){var l=Object.values(a);return s?l.filter(c=>c.v===s):l}}outEdges(i,s){var a=this._out[i];if(a){var l=Object.values(a);return s?l.filter(c=>c.w===s):l}}nodeEdges(i,s){var a=this.inEdges(i,s);if(a)return a.concat(this.outEdges(i,s))}},gh}function v9(){return sv?iv:(sv=1,iv={Graph:Zh(),version:rv?ov:(rv=1,ov="2.2.4")})}function k9(){if(av)return _h;av=1;var t=Zh();function e(o){return o.nodes().map(function(r){var i=o.node(r),s=o.parent(r),a={v:r};return i!==void 0&&(a.value=i),s!==void 0&&(a.parent=s),a})}function n(o){return o.edges().map(function(r){var i=o.edge(r),s={v:r.v,w:r.w};return r.name!==void 0&&(s.name=r.name),i!==void 0&&(s.value=i),s})}return _h={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(i){r.setNode(i.v,i.value),i.parent&&r.setParent(i.v,i.parent)}),o.edges.forEach(function(i){r.setEdge({v:i.v,w:i.w,name:i.name},i.value)}),r}},_h}function S9(){return lv||(lv=1,bh=function(t){var e,n={},o=[];function r(i){Object.hasOwn(n,i)||(n[i]=!0,e.push(i),t.successors(i).forEach(r),t.predecessors(i).forEach(r))}return t.nodes().forEach(function(i){e=[],r(i),e.length&&o.push(e)}),o}),bh}function s2(){return cv?yh:(cv=1,yh=class{constructor(){ee(this,"_arr",[]);ee(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],i=n[e];n[t]=i,n[e]=r,o[i.key]=t,o[r.key]=e}},yh)}function a2(){if(dv)return xh;dv=1;var t=s2();xh=function(n,o,r,i){return function(s,a,l,c){var d,u,f={},m=new t,_=function(g){var p=g.v!==d?g.v:g.w,b=f[p],x=l(g),y=u.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=d,m.decrease(p,y))};for(s.nodes().forEach(function(g){var p=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(d=m.removeMin(),(u=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(_);return f}(n,String(o),r||e,i||function(s){return n.outEdges(s)})};var e=()=>1;return xh}function C9(){if(uv)return wh;uv=1;var t=a2();return wh=function(e,n,o){return e.nodes().reduce(function(r,i){return r[i]=t(e,i,n,o),r},{})},wh}function l2(){return hv||(hv=1,vh=function(t){var e=0,n=[],o={},r=[];function i(s){var a=o[s]={onStack:!0,lowlink:e,index:e++};if(n.push(s),t.successors(s).forEach(function(d){Object.hasOwn(o,d)?o[d].onStack&&(a.lowlink=Math.min(a.lowlink,o[d].index)):(i(d),a.lowlink=Math.min(a.lowlink,o[d].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(s!==l);r.push(c)}}return t.nodes().forEach(function(s){Object.hasOwn(o,s)||i(s)}),r}),vh}function N9(){if(fv)return kh;fv=1;var t=l2();return kh=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},kh}function j9(){if(mv)return Sh;mv=1,Sh=function(e,n,o){return function(r,i,s){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(d){c!==d&&(a[c][d]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(d){var u=d.v===c?d.w:d.v,f=i(d);a[c][u]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(u){var f=a[u];l.forEach(function(m){var _=f[c],g=d[m],p=f[m],b=_.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Sh}function c2(){if(pv)return Ch;function t(n){var o={},r={},i=[];if(n.sinks().forEach(function s(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(s),delete r[a],i.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return i}pv=1;class e extends Error{constructor(){super(...arguments)}}return Ch=t,t.CycleException=e,Ch}function E9(){if(gv)return Nh;gv=1;var t=c2();return Nh=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Nh}function d2(){if(_v)return jh;function t(o,r,i,s){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?s.push(l[0]):Object.hasOwn(i,l[0])||(i[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,i,s){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(i,l)||(i[l]=!0,s.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var i=o.length;i--;)r(o[i],i,o);return o}return _v=1,jh=function(o,r,i){Array.isArray(r)||(r=[r]);var s=o.isDirected()?d=>o.successors(d):d=>o.neighbors(d),a=i==="post"?t:e,l=[],c={};return r.forEach(d=>{if(!o.hasNode(d))throw new Error("Graph does not have node: "+d);a(d,s,c,l)}),l},jh}function I9(){if(bv)return Eh;bv=1;var t=d2();return Eh=function(e,n){return t(e,n,"post")},Eh}function A9(){if(yv)return Ih;yv=1;var t=d2();return Ih=function(e,n){return t(e,n,"pre")},Ih}function T9(){if(xv)return Ah;xv=1;var t=Zh(),e=s2();return Ah=function(n,o){var r,i=new t,s={},a=new e;function l(d){var u=d.v===r?d.w:d.v,f=a.priority(u);if(f!==void 0){var m=o(d);m<f&&(s[u]=r,a.decrease(u,m))}}if(n.nodeCount()===0)return i;n.nodes().forEach(function(d){a.add(d,Number.POSITIVE_INFINITY),i.setNode(d)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(s,r))i.setEdge(r,s[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return i},Ah}function Hn(){if(Sv)return kv;Sv=1;var t=v9();return kv={Graph:t.Graph,json:k9(),alg:vv?wv:(vv=1,wv={components:S9(),dijkstra:a2(),dijkstraAll:C9(),findCycles:N9(),floydWarshall:j9(),isAcyclic:E9(),postorder:I9(),preorder:A9(),prim:T9(),tarjan:l2(),topsort:c2()}),version:t.version}}function M9(){if(jv)return Th;jv=1;let t=Hn().Graph,e=function(){if(Nv)return Cv;function i(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function s(a,l){if(a!=="_next"&&a!=="_prev")return l}return Nv=1,Cv=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return i(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&i(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,s)),c=c._prev;return"["+a.join(", ")+"]"}}}();Th=function(i,s){if(i.nodeCount()<=1)return[];let a=function(l,c){let d=new t,u=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=d.edge(g.v,g.w)||0,b=c(g),x=p+b;d.setEdge(g.v,g.w,x),f=Math.max(f,d.node(g.v).out+=b),u=Math.max(u,d.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+u+3).map(()=>new e),_=u+1;return d.nodes().forEach(g=>{r(m,_,d.node(g))}),{graph:d,buckets:m,zeroIdx:_}}(i,s||n);return function(l,c,d){let u,f=[],m=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;u=_.dequeue();)o(l,c,d,u);for(;u=m.dequeue();)o(l,c,d,u);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(u=c[g].dequeue(),u){f=f.concat(o(l,c,d,u,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>i.outEdges(l.v,l.w))};let n=()=>1;function o(i,s,a,l,c){let d=c?[]:void 0;return i.inEdges(l.v).forEach(u=>{let f=i.edge(u),m=i.node(u.v);c&&d.push({v:u.v,w:u.w}),m.out-=f,r(s,a,m)}),i.outEdges(l.v).forEach(u=>{let f=i.edge(u),m=u.w,_=i.node(m);_.in-=f,r(s,a,_)}),i.removeNode(l.v),d}function r(i,s,a){a.out?a.in?i[a.out-a.in+s].enqueue(a):i[i.length-1].enqueue(a):i[0].enqueue(a)}return Th}function Pt(){if(Ev)return Mh;Ev=1;let t=Hn().Graph;function e(c,d,u,f){let m;do m=s(f);while(c.hasNode(m));return u.dummy=d,c.setNode(m,u),m}Mh={addBorderNode:function(c,d,u,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=u,m.order=f),e(c,"border",m,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(u=>{c.children(u).length||d.setNode(u,c.node(u))}),c.edges().forEach(u=>{d.setEdge(u,c.edge(u))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(u=>{let f=c.node(u),m=f.rank;m!==void 0&&(d[m][f.order]=u)}),d},intersectRect:function(c,d){let u,f,m=c.x,_=c.y,g=d.x-m,p=d.y-_,b=c.width/2,x=c.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*x?(p<0&&(x=-x),u=x*g/p,f=x):(g<0&&(b=-b),u=b,f=b*p/g),{x:m+u,y:_+f}},mapValues:function(c,d){let u=d;return typeof d=="string"&&(u=f=>f[d]),Object.entries(c).reduce((f,[m,_])=>(f[m]=u(_,m),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let m=c.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),u=o(Math.min,d);c.nodes().forEach(f=>{let m=c.node(f);Object.hasOwn(m,"rank")&&(m.rank-=u)})},notime:function(c,d){return d()},partition:function(c,d){let u={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?u.lhs.push(f):u.rhs.push(f)}),u},pick:function(c,d){const u={};for(const f of d)c[f]!==void 0&&(u[f]=c[f]);return u},predecessorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.inEdges(u).forEach(m=>{f[m.v]=(f[m.v]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),u=o(Math.min,d),f=[];c.nodes().forEach(g=>{let p=c.node(g).rank-u;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!=0?--m:g!==void 0&&m&&g.forEach(b=>c.node(b).rank+=m)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(u=>d.setNode(u,c.node(u))),c.edges().forEach(u=>{let f=d.edge(u.v,u.w)||{weight:0,minlen:1},m=c.edge(u);d.setEdge(u.v,u.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.outEdges(u).forEach(m=>{f[m.w]=(f[m.w]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},time:function(c,d){let u=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-u)+"ms")}},uniqueId:s,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const u=function(f,m=n){const _=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);_.push(p)}return _}(d);return c.apply(null,u.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(u=>{let f=c.node(u).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,d)}let i=0;function s(c){var d=++i;return toString(c)+d}function a(c,d,u=1){d==null&&(d=c,c=0);let f=_=>_<d;u<0&&(f=_=>d<_);const m=[];for(let _=c;f(_);_+=u)m.push(_);return m}function l(c,d){return c.reduce((u,f,m)=>(u[f]=d[m],u),{})}return Mh}function O9(){if(Iv)return Oh;Iv=1;let t=M9(),e=Pt().uniqueId;return Oh={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return i=>r.edge(i).weight}(n)):function(r){let i=[],s={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,s[c]=!0,r.outEdges(c).forEach(d=>{Object.hasOwn(s,d.w)?i.push(d):l(d.w)}),delete s[c])}return r.nodes().forEach(l),i}(n)).forEach(r=>{let i=n.edge(r);n.removeEdge(r),i.forwardName=r.name,i.reversed=!0,n.setEdge(r.w,r.v,i,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let i=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,i)}})}},Oh}function D9(){if(Av)return Dh;Av=1;let t=Pt();return Dh={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let i,s,a,l=r.v,c=o.node(l).rank,d=r.w,u=o.node(d).rank,f=r.name,m=o.edge(r),_=m.labelRank;if(u!==c+1){for(o.removeEdge(r),a=0,++c;c<u;++a,++c)m.points=[],s={width:0,height:0,edgeLabel:m,edgeObj:r,rank:c},i=t.addDummyNode(o,"edge",s,"_d"),c===_&&(s.width=m.width,s.height=m.height,s.dummy="edge-label",s.labelpos=m.labelpos),o.setEdge(l,i,{weight:m.weight},f),a===0&&o.graph().dummyChains.push(i),l=i;o.setEdge(l,d,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),i=r.edgeLabel;for(e.setEdge(r.edgeObj,i);r.dummy;)o=e.successors(n)[0],e.removeNode(n),i.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),n=o,r=e.node(n)})}},Dh}function Pl(){if(Tv)return Rh;Tv=1;const{applyWithChunking:t}=Pt();return Rh={longestPath:function(e){var n={};e.sources().forEach(function o(r){var i=e.node(r);if(Object.hasOwn(n,r))return i.rank;n[r]=!0;let s=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},Rh}function u2(){if(Mv)return Ph;Mv=1;var t=Hn().Graph,e=Pl().slack;function n(i,s){return i.nodes().forEach(function a(l){s.nodeEdges(l).forEach(c=>{var d=c.v,u=l===d?c.w:d;i.hasNode(u)||e(s,c)||(i.setNode(u,{}),i.setEdge(l,u,{}),a(u))})}),i.nodeCount()}function o(i,s){return s.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return i.hasNode(l.v)!==i.hasNode(l.w)&&(c=e(s,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(i,s,a){i.nodes().forEach(l=>s.node(l).rank+=a)}return Ph=function(i){var s,a,l=new t({directed:!1}),c=i.nodes()[0],d=i.nodeCount();for(l.setNode(c,{});n(l,i)<d;)s=o(l,i),a=l.hasNode(s.v)?e(i,s):-e(i,s),r(l,i,a);return l},Ph}function R9(){if(Ov)return Lh;Ov=1;var t=u2(),e=Pl().slack,n=Pl().longestPath,o=Hn().alg.preorder,r=Hn().alg.postorder,i=Pt().simplify;function s(g){g=i(g),n(g);var p,b=t(g);for(c(b),a(b,g);p=u(b);)m(b,g,p,f(b,g,p))}function a(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,S){var k=y.node(S),N=k.parent;y.edge(S,N).cutvalue=l(y,v,S)}(g,p,x))}function l(g,p,b){var x=g.node(b).parent,y=!0,v=p.edge(b,x),S=0;return v||(y=!1,v=p.edge(x,b)),S=v.weight,p.nodeEdges(b).forEach(k=>{var N,E,I=k.v===b,T=I?k.w:k.v;if(T!==x){var M=I===y,R=p.edge(k).weight;if(S+=M?R:-R,N=b,E=T,g.hasEdge(N,E)){var B=g.edge(b,T).cutvalue;S+=M?-B:B}}}),S}function c(g,p){arguments.length<2&&(p=g.nodes()[0]),d(g,{},1,p)}function d(g,p,b,x,y){var v=b,S=g.node(x);return p[x]=!0,g.neighbors(x).forEach(k=>{Object.hasOwn(p,k)||(b=d(g,p,b,k,x))}),S.low=v,S.lim=b++,y?S.parent=y:delete S.parent,b}function u(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var x=b.v,y=b.w;p.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),S=g.node(y),k=v,N=!1;v.lim>S.lim&&(k=S,N=!0);var E=p.edges().filter(I=>N===_(g,g.node(I.v),k)&&N!==_(g,g.node(I.w),k));return E.reduce((I,T)=>e(p,T)<e(p,I)?T:I)}function m(g,p,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),c(g),a(g,p),function(S,k){var N=S.nodes().find(I=>!k.node(I).parent),E=o(S,N);(E=E.slice(1)).forEach(I=>{var T=S.node(I).parent,M=k.edge(I,T),R=!1;M||(M=k.edge(T,I),R=!0),k.node(I).rank=k.node(T).rank+(R?M.minlen:-M.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Lh=s,s.initLowLimValues=c,s.initCutValues=a,s.calcCutValue=l,s.leaveEdge=u,s.enterEdge=f,s.exchangeEdges=m,Lh}function P9(){if(Dv)return Fh;Dv=1;var t=Pl().longestPath,e=u2(),n=R9();Fh=function(i){switch(i.graph().ranker){case"network-simplex":default:r(i);break;case"tight-tree":(function(s){t(s),e(s)})(i);break;case"longest-path":o(i)}};var o=t;function r(i){n(i)}return Fh}function L9(){return Rv||(Rv=1,zh=function(t){let e=function(n){let o={},r=0;function i(s){let a=r;n.children(s).forEach(i),o[s]={low:a,lim:r++}}return n.children().forEach(i),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,i=function(u,f,m,_){let g,p,b=[],x=[],y=Math.min(f[m].low,f[_].low),v=Math.max(f[m].lim,f[_].lim);g=m;do g=u.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(p=g,g=_;(g=u.parent(g))!==p;)x.push(g);return{path:b.concat(x.reverse()),lca:p}}(t,e,r.v,r.w),s=i.path,a=i.lca,l=0,c=s[l],d=!0;for(;n!==r.w;){if(o=t.node(n),d){for(;(c=s[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(d=!1)}if(!d){for(;l<s.length-1&&t.node(c=s[l+1]).minRank<=o.rank;)l++;c=s[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),zh}function F9(){if(Pv)return Bh;Pv=1;let t=Pt();function e(n,o,r,i,s,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let d=t.addBorderNode(n,"_bt"),u=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(u,l),f.borderBottom=u,c.forEach(m=>{e(n,o,r,i,s,a,m);let _=n.node(m),g=_.borderTop?_.borderTop:m,p=_.borderBottom?_.borderBottom:m,b=_.borderTop?i:2*i,x=g!==p?1:s-a[l]+1;n.setEdge(d,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(p,u,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:s+a[l]})}return Bh={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function u(f,m){var _=c.children(f);_&&_.length&&_.forEach(g=>u(g,m+1)),d[f]=m}return c.children().forEach(f=>u(f,1)),d}(n),i=Object.values(r),s=t.applyWithChunking(Math.max,i)-1,a=2*s+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((d,u)=>d+c.edge(u).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,s,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Bh}function z9(){if(Fv)return Vh;function t(r){r.nodes().forEach(i=>e(r.node(i))),r.edges().forEach(i=>e(r.edge(i)))}function e(r){let i=r.width;r.width=r.height,r.height=i}function n(r){r.y=-r.y}function o(r){let i=r.x;r.x=r.y,r.y=i}return Fv=1,Vh={adjust:function(r){let i=r.graph().rankdir.toLowerCase();i!=="lr"&&i!=="rl"||t(r)},undo:function(r){let i=r.graph().rankdir.toLowerCase();i!=="bt"&&i!=="rl"||function(s){s.nodes().forEach(a=>n(s.node(a))),s.edges().forEach(a=>{let l=s.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),i!=="lr"&&i!=="rl"||(function(s){s.nodes().forEach(a=>o(s.node(a))),s.edges().forEach(a=>{let l=s.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Vh}function B9(){if(Hv)return $v;Hv=1;let t=Pt();return $v=function(e,n){let o={};return e.forEach((r,i)=>{let s=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i};r.barycenter!==void 0&&(s.barycenter=r.barycenter,s.weight=r.weight)}),n.edges().forEach(r=>{let i=o[r.v],s=o[r.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(o[r.w]))}),function(r){let i=[];function s(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(d,u){let f=0,m=0;d.weight&&(f+=d.barycenter*d.weight,m+=d.weight),u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),d.vs=u.vs.concat(d.vs),d.barycenter=f/m,d.weight=m,d.i=Math.min(u.i,d.i),u.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree==0&&r.push(c)}}for(;r.length;){let l=r.pop();i.push(l),l.in.reverse().forEach(s(l)),l.out.forEach(a(l))}return i.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function U9(){if(Gv)return Wh;Gv=1;let t=(Vv||(Vv=1,Uv=function(o,r=[]){return r.map(i=>{let s=o.inEdges(i);if(s.length){let a=s.reduce((l,c)=>{let d=o.edge(c),u=o.node(c.v);return{sum:l.sum+d.weight*u.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:i,barycenter:a.sum/a.weight,weight:a.weight}}return{v:i}})}),Uv),e=B9(),n=function(){if(qv)return Wv;qv=1;let o=Pt();function r(i,s,a){let l;for(;s.length&&(l=s[s.length-1]).i<=a;)s.pop(),i.push(l.vs),a++;return a}return Wv=function(i,s){let a=o.partition(i,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,c=a.rhs.sort((p,b)=>b.i-p.i),d=[],u=0,f=0,m=0;var _;l.sort((_=!!s,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:_?b.i-p.i:p.i-b.i)),m=r(d,c,m),l.forEach(p=>{m+=p.vs.length,d.push(p.vs),u+=p.barycenter*p.weight,f+=p.weight,m=r(d,c,m)});let g={vs:d.flat(!0)};return f&&(g.barycenter=u/f,g.weight=f),g}}();return Wh=function o(r,i,s,a){let l=r.children(i),c=r.node(i),d=c?c.borderLeft:void 0,u=c?c.borderRight:void 0,f={};d&&(l=l.filter(p=>p!==d&&p!==u));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let y=o(r,p.v,s,a);f[p.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(m,s);(function(p,b){p.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,u].flat(!0),r.predecessors(d).length)){let p=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(u)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Wh}function V9(){if(Yv)return qh;Yv=1;let t=Hn().Graph,e=Pt();return qh=function(n,o,r){let i=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),s=new t({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(s.setNode(a),s.setParent(a,c||i),n[r](a).forEach(d=>{let u=d.v===a?d.w:d.v,f=s.edge(u,a),m=f!==void 0?f.weight:0;s.setEdge(u,a,{weight:n.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),s},qh}function $9(){if(Xv)return Gh;Xv=1;let t=function(){if(zv)return $h;zv=1;let d=Pt();return $h=function(u){let f={},m=u.nodes().filter(x=>!u.children(x).length),_=m.map(x=>u.node(x).rank),g=d.applyWithChunking(Math.max,_),p=d.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=u.node(x);p[y.rank].push(x),u.successors(x).forEach(b)}return m.sort((x,y)=>u.node(x).rank-u.node(y).rank).forEach(b),p},$h}(),e=function(){if(Bv)return Hh;Bv=1;let d=Pt().zipObject;function u(f,m,_){let g=d(_,_.map((S,k)=>k)),p=m.flatMap(S=>f.outEdges(S).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,N)=>k.pos-N.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return p.forEach(S=>{let k=S.pos+b;y[k]+=S.weight;let N=0;for(;k>0;)k%2&&(N+=y[k+1]),k=k-1>>1,y[k]+=S.weight;v+=S.weight*N}),v}return Hh=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=u(f,m[g-1],m[g]);return _},Hh}(),n=U9(),o=V9(),r=(Kv||(Kv=1,Jv=function(d,u,f){let m,_={};f.forEach(g=>{let p,b,x=d.parent(g);for(;x;){if(p=d.parent(x),p?(b=_[p],_[p]=x):(b=m,m=x),b&&b!==x)return void u.setEdge(b,x);x=p}})}),Jv),i=Hn().Graph,s=Pt();function a(d,u,f){return u.map(function(m){return o(d,m,f)})}function l(d,u){let f=new i;d.forEach(function(m){let _=m.graph().root,g=n(m,_,f,u);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function c(d,u){Object.values(u).forEach(f=>f.forEach((m,_)=>d.node(m).order=_))}return Gh=function d(u,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(u,d);let m=s.maxRank(u),_=a(u,s.range(1,m+1),"inEdges"),g=a(u,s.range(m-1,-1,-1),"outEdges"),p=t(u);if(c(u,p),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),p=s.buildLayerMatrix(u);let S=e(u,p);S<x&&(v=0,b=Object.assign({},p),x=S)}c(u,b)},Gh}function H9(){if(Zv)return Yh;Zv=1;let t=Hn().Graph,e=Pt();function n(u,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,S)=>{let k=function(E,I){if(E.node(I).dummy)return E.predecessors(I).find(T=>E.node(T).dummy)}(u,v),N=k?u.node(k).order:x;(k||v===y)&&(g.slice(b,S+1).forEach(E=>{u.predecessors(E).forEach(I=>{let T=u.node(I),M=T.order;!(M<p||N<M)||T.dummy&&u.node(E).dummy||r(m,I,E)})}),b=S+1,p=N)}),g}),m}function o(u,f){let m={};function _(g,p,b,x,y){let v;e.range(p,b).forEach(S=>{v=g[S],u.node(v).dummy&&u.predecessors(v).forEach(k=>{let N=u.node(k);N.dummy&&(N.order<x||N.order>y)&&r(m,k,v)})})}return f.length&&f.reduce(function(g,p){let b,x=-1,y=0;return p.forEach((v,S)=>{if(u.node(v).dummy==="border"){let k=u.predecessors(v);k.length&&(b=u.node(k[0]).order,_(p,y,S,x,b),y=S,x=b)}_(p,y,p.length,b,g.length)}),p}),m}function r(u,f,m){if(f>m){let g=f;f=m,m=g}let _=u[f];_||(u[f]=_={}),_[m]=!0}function i(u,f,m){if(f>m){let _=f;f=m,m=_}return!!u[f]&&Object.hasOwn(u[f],m)}function s(u,f,m,_){let g={},p={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,p[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let S=_(v);if(S.length){S=S.sort((N,E)=>b[N]-b[E]);let k=(S.length-1)/2;for(let N=Math.floor(k),E=Math.ceil(k);N<=E;++N){let I=S[N];p[v]===v&&y<b[I]&&!i(m,v,I)&&(p[I]=v,p[v]=g[v]=g[I],y=b[I])}}})}),{root:g,align:p}}function a(u,f,m,_,g){let p={},b=function(v,S,k,N){let E=new t,I=v.graph(),T=function(M,R,B){return(O,z,F)=>{let V,L=O.node(z),C=O.node(F),$=0;if($+=L.width/2,Object.hasOwn(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":V=-L.width/2;break;case"r":V=L.width/2}if(V&&($+=B?V:-V),V=0,$+=(L.dummy?R:M)/2,$+=(C.dummy?R:M)/2,$+=C.width/2,Object.hasOwn(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":V=C.width/2;break;case"r":V=-C.width/2}return V&&($+=B?V:-V),V=0,$}}(I.nodesep,I.edgesep,N);return S.forEach(M=>{let R;M.forEach(B=>{let O=k[B];if(E.setNode(O),R){var z=k[R],F=E.edge(z,O);E.setEdge(z,O,Math.max(T(v,B,R),F||0))}R=B})}),E}(u,f,m,g),x=g?"borderLeft":"borderRight";function y(v,S){let k=b.nodes(),N=k.pop(),E={};for(;N;)E[N]?v(N):(E[N]=!0,k.push(N),k=k.concat(S(N))),N=k.pop()}return y(function(v){p[v]=b.inEdges(v).reduce((S,k)=>Math.max(S,p[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),y(function(v){let S=b.outEdges(v).reduce((N,E)=>Math.min(N,p[E.w]-b.edge(E)),Number.POSITIVE_INFINITY),k=u.node(v);S!==Number.POSITIVE_INFINITY&&k.borderType!==x&&(p[v]=Math.max(p[v],S))},b.successors.bind(b)),Object.keys(_).forEach(v=>p[v]=p[m[v]]),p}function l(u,f){return Object.values(f).reduce((m,_)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(S,k){return S.node(k).width}(u,x)/2;g=Math.max(y+v,g),p=Math.min(y-v,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(u,f){let m=Object.values(f),_=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let x=p+b,y=u[x];if(y===f)return;let v=Object.values(y),S=_-e.applyWithChunking(Math.min,v);b!=="l"&&(S=g-e.applyWithChunking(Math.max,v)),S&&(u[x]=e.mapValues(y,k=>k+S))})})}function d(u,f){return e.mapValues(u.ul,(m,_)=>{if(f)return u[f.toLowerCase()][_];{let g=Object.values(u).map(p=>p[_]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return Yh={positionX:function(u){let f,m=e.buildLayerMatrix(u),_=Object.assign(n(u,m),o(u,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(k=>Object.values(k).reverse()));let y=(b==="u"?u.predecessors:u.successors).bind(u),v=s(u,f,_,y),S=a(u,f,v.root,v.align,x==="r");x==="r"&&(S=e.mapValues(S,k=>-k)),g[b+x]=S})});let p=l(u,g);return c(g,p),d(g,u.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:i,verticalAlignment:s,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Yh}function W9(){if(Qv)return Jh;Qv=1;let t=Pt(),e=H9().positionX;return Jh=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),i=o.graph().ranksep,s=0;r.forEach(a=>{const l=a.reduce((c,d)=>{const u=o.node(d).height;return c>u?c:u},0);a.forEach(c=>o.node(c).y=s+l/2),s+=l+i})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Jh}function q9(){if(e2)return Kh;e2=1;let t=O9(),e=D9(),n=P9(),o=Pt().normalizeRanks,r=L9(),i=Pt().removeEmptyRanks,s=F9(),a=function(){if(Lv)return Uh;Lv=1;let N=Pt();function E(I,T,M,R,B,O){let z={width:0,height:0,rank:O,borderType:T},F=B[T][O-1],V=N.addDummyNode(I,"border",z,M);B[T][O]=V,I.setParent(V,R),F&&I.setEdge(F,V,{weight:1})}return Uh=function(I){I.children().forEach(function T(M){let R=I.children(M),B=I.node(M);if(R.length&&R.forEach(T),Object.hasOwn(B,"minRank")){B.borderLeft=[],B.borderRight=[];for(let O=B.minRank,z=B.maxRank+1;O<z;++O)E(I,"borderLeft","_bl",M,B,O),E(I,"borderRight","_br",M,B,O)}})},Uh}(),l=z9(),c=$9(),d=W9(),u=Pt(),f=Hn().Graph;Kh=function(N,E){let I=E&&E.debugTiming?u.time:u.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(M){let R=new f({multigraph:!0,compound:!0}),B=k(M.graph());return R.setGraph(Object.assign({},_,S(B,m),u.pick(B,g))),M.nodes().forEach(O=>{const z=S(k(M.node(O)),p);Object.keys(b).forEach(F=>{z[F]===void 0&&(z[F]=b[F])}),R.setNode(O,z),R.setParent(O,M.parent(O))}),M.edges().forEach(O=>{let z=k(M.edge(O));R.setEdge(O,Object.assign({},y,S(z,x),u.pick(z,v)))}),R}(N));I(" runLayout",()=>function(M,R,B){R(" makeSpaceForEdgeLabels",()=>function(O){let z=O.graph();z.ranksep/=2,O.edges().forEach(F=>{let V=O.edge(F);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}(M)),R(" removeSelfEdges",()=>function(O){O.edges().forEach(z=>{if(z.v===z.w){var F=O.node(z.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:z,label:O.edge(z)}),O.removeEdge(z)}})}(M)),R(" acyclic",()=>t.run(M)),R(" nestingGraph.run",()=>s.run(M)),R(" rank",()=>n(u.asNonCompoundGraph(M))),R(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(F.width&&F.height){let V=O.node(z.v),L={rank:(O.node(z.w).rank-V.rank)/2+V.rank,e:z};u.addDummyNode(O,"edge-proxy",L,"_ep")}})}(M)),R(" removeEmptyRanks",()=>i(M)),R(" nestingGraph.cleanup",()=>s.cleanup(M)),R(" normalizeRanks",()=>o(M)),R(" assignRankMinMax",()=>function(O){let z=0;O.nodes().forEach(F=>{let V=O.node(F);V.borderTop&&(V.minRank=O.node(V.borderTop).rank,V.maxRank=O.node(V.borderBottom).rank,z=Math.max(z,V.maxRank))}),O.graph().maxRank=z}(M)),R(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(z=>{let F=O.node(z);F.dummy==="edge-proxy"&&(O.edge(F.e).labelRank=F.rank,O.removeNode(z))})}(M)),R(" normalize.run",()=>e.run(M)),R(" parentDummyChains",()=>r(M)),R(" addBorderSegments",()=>a(M)),R(" order",()=>c(M,B)),R(" insertSelfEdges",()=>function(O){var z=u.buildLayerMatrix(O);z.forEach(F=>{var V=0;F.forEach((L,C)=>{var $=O.node(L);$.order=C+V,($.selfEdges||[]).forEach(j=>{u.addDummyNode(O,"selfedge",{width:j.label.width,height:j.label.height,rank:$.rank,order:C+ ++V,e:j.e,label:j.label},"_se")}),delete $.selfEdges})})}(M)),R(" adjustCoordinateSystem",()=>l.adjust(M)),R(" position",()=>d(M)),R(" positionSelfEdges",()=>function(O){O.nodes().forEach(z=>{var F=O.node(z);if(F.dummy==="selfedge"){var V=O.node(F.e.v),L=V.x+V.width/2,C=V.y,$=F.x-L,j=V.height/2;O.setEdge(F.e,F.label),O.removeNode(z),F.label.points=[{x:L+2*$/3,y:C-j},{x:L+5*$/6,y:C-j},{x:L+$,y:C},{x:L+5*$/6,y:C+j},{x:L+2*$/3,y:C+j}],F.label.x=F.x,F.label.y=F.y}})}(M)),R(" removeBorderNodes",()=>function(O){O.nodes().forEach(z=>{if(O.children(z).length){let F=O.node(z),V=O.node(F.borderTop),L=O.node(F.borderBottom),C=O.node(F.borderLeft[F.borderLeft.length-1]),$=O.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs($.x-C.x),F.height=Math.abs(L.y-V.y),F.x=C.x+F.width/2,F.y=V.y+F.height/2}}),O.nodes().forEach(z=>{O.node(z).dummy==="border"&&O.removeNode(z)})}(M)),R(" normalize.undo",()=>e.undo(M)),R(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(Object.hasOwn(F,"x"))switch(F.labelpos!=="l"&&F.labelpos!=="r"||(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset}})}(M)),R(" undoCoordinateSystem",()=>l.undo(M)),R(" translateGraph",()=>function(O){let z=Number.POSITIVE_INFINITY,F=0,V=Number.POSITIVE_INFINITY,L=0,C=O.graph(),$=C.marginx||0,j=C.marginy||0;function H(Y){let Z=Y.x,G=Y.y,re=Y.width,ne=Y.height;z=Math.min(z,Z-re/2),F=Math.max(F,Z+re/2),V=Math.min(V,G-ne/2),L=Math.max(L,G+ne/2)}O.nodes().forEach(Y=>H(O.node(Y))),O.edges().forEach(Y=>{let Z=O.edge(Y);Object.hasOwn(Z,"x")&&H(Z)}),z-=$,V-=j,O.nodes().forEach(Y=>{let Z=O.node(Y);Z.x-=z,Z.y-=V}),O.edges().forEach(Y=>{let Z=O.edge(Y);Z.points.forEach(G=>{G.x-=z,G.y-=V}),Object.hasOwn(Z,"x")&&(Z.x-=z),Object.hasOwn(Z,"y")&&(Z.y-=V)}),C.width=F-z+$,C.height=L-V+j}(M)),R(" assignNodeIntersects",()=>function(O){O.edges().forEach(z=>{let F,V,L=O.edge(z),C=O.node(z.v),$=O.node(z.w);L.points?(F=L.points[0],V=L.points[L.points.length-1]):(L.points=[],F=$,V=C),L.points.unshift(u.intersectRect(C,F)),L.points.push(u.intersectRect($,V))})}(M)),R(" reversePoints",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);F.reversed&&F.points.reverse()})}(M)),R(" acyclic.undo",()=>t.undo(M))}(T,I,E)),I(" updateInputGraph",()=>function(M,R){M.nodes().forEach(B=>{let O=M.node(B),z=R.node(B);O&&(O.x=z.x,O.y=z.y,O.rank=z.rank,R.children(B).length&&(O.width=z.width,O.height=z.height))}),M.edges().forEach(B=>{let O=M.edge(B),z=R.edge(B);O.points=z.points,Object.hasOwn(z,"x")&&(O.x=z.x,O.y=z.y)}),M.graph().width=R.graph().width,M.graph().height=R.graph().height}(N,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function S(N,E){return u.mapValues(u.pick(N,E),Number)}function k(N){var E={};return N&&Object.entries(N).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),E[I]=T}),E}return Kh}function G9(){if(t2)return Xh;t2=1;let t=Pt(),e=Hn().Graph;return Xh={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(i=>{r.setNode(i,{label:i}),r.setParent(i,"layer"+n.node(i).rank)}),n.edges().forEach(i=>r.setEdge(i.v,i.w,{},i.name)),o.forEach((i,s)=>{let a="layer"+s;r.setNode(a,{rank:"same"}),i.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},Xh}var h2=i2?r2:(i2=1,r2={graphlib:Hn(),layout:q9(),debug:G9(),util:{time:Pt().time,notime:Pt().notime},version:o2?n2:(o2=1,n2="1.1.4")});const Us=new h2.graphlib.Graph().setDefaultEdgeLabel(()=>({})),f2=(t,e,n)=>(Us.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Us.setEdge(o.source,o.target)),t.forEach(o=>Us.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),h2.layout(Us),{nodes:t.map(o=>{const{x:r,y:i}=Us.node(o.id);return{...o,position:{x:r,y:i}}}),edges:e}),m2=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:ri.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:fh(ut.get(e).code.trim().split(`
118
- `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],i=[],s=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const u of c)for(const f of d){const m=`${u}-${f}`;a.has(m)||(a.add(m),s.add(u),s.add(f),i.push(this.createEdge(u,f)))}}for(const[l,c]of zm.zip(t,e)){o||r.push(this.createNode(l,c));const d=s.has(l),u=ut.get(c).code.trim().startsWith("mo.md");!d&&u||r.push(this.createNode(l,c))}return{nodes:r,edges:i}}},Y9=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:i,layoutDirection:s,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==s||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let C=m2.createElements(n,r,o,a.hidePureMarkdown);return C=f2(C.nodes,C.edges,{direction:s}),C},e[0]=r,e[1]=n,e[2]=s,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=A.useState(l),[d,u,f]=qw(c.nodes),[m,_,g]=Gw(c.edges),p=Fs();let b;e[6]!==s||e[7]!==_||e[8]!==u?(b=C=>{const $=f2(C.nodes,C.edges,{direction:s});u($.nodes),_($.edges)},e[6]=s,e[7]=_,e[8]=u,e[9]=b):b=e[9];const x=Qe(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(m2.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),A.useEffect(y,v);const[S,k]=A.useState();let N;ev(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{k(void 0)},e[17]=N):N=e[17];const E=N;let I,T,M,R,B,O,z,F,V,L;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{k({type:"node",id:$.id})},M=(C,$)=>{const{source:j,target:H}=$;k({type:"edge",source:j,target:H})},e[18]=I,e[19]=T,e[20]=M):(I=e[18],T=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=h.jsx(m9,{color:"#ccc",variant:Rn.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(B=()=>{const C=ut.get(Ia);if(C){const $=d.find(j=>j.id===C);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:C}))}},e[22]=p,e[23]=d,e[24]=B):B=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(kp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==B?(z=h.jsx(l9,{position:"bottom-right",showInteractive:!1,children:h.jsx(Me,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:h.jsx(hi,{onMouseDown:un.preventFocus,onClick:B,children:O})})}),e[26]=B,e[27]=z):z=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(F=h.jsx(Rl,{selection:S,variables:o,edges:m,onClearSelection:E}),e[28]=m,e[29]=S,e[30]=o,e[31]=F):F=e[31],e[32]!==i||e[33]!==m||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==z||e[38]!==F?(V=h.jsxs(hh,{nodes:d,edges:m,nodeTypes:Zw,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:J9,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,z,F,i]}),e[32]=i,e[33]=m,e[34]=d,e[35]=g,e[36]=f,e[37]=z,e[38]=F,e[39]=V):V=e[39],e[40]!==s||e[41]!==V?(L=h.jsx(Kw.Provider,{value:s,children:V}),e[40]=s,e[41]=V,e[42]=L):L=e[42],L};function J9(t,e){E4(e.id,"focus")}const K9=Ot("_minimap_"),X9=Ot({hidePureMarkdown:!0}),Z9=t=>{const e=X.c(11),[n,o]=yn(K9),[r,i]=yn(X9);let s;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==i||e[4]!==r?(s=()=>n==="_minimap_"?h.jsx(y9,{...t,children:h.jsx(ph,{settings:r,onSettingsChange:i,view:n,onChange:o})}):h.jsx(Y9,{...t,settings:r,layoutDirection:n,children:h.jsx(ph,{settings:r,onSettingsChange:i,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=i,e[4]=r,e[5]=s):s=e[5];const a=s;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=h.jsx(uh,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},Q9=()=>{const t=X.c(5),e=I4(),n=Oc(),[o]=vU();let r,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Te("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(i=h.jsx("div",{className:r,children:h.jsx(Z9,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=i):i=t[4],i},p2="name",g2="type-value",Qh="defs-refs",eD=[{id:p2,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Hm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsx(mh,{name:e,declaredBy:n})}},{id:g2,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Hm,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Type"}),h.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsxs("div",{className:"max-w-[150px]",children:[h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Qh,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>h.jsx(Hm,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Declared By"}),h.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=i=>{const s=ec(i);s&&Bm(s,o)};return h.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[h.jsx("span",{title:"Declared by",children:h.jsx(Fp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?h.jsx(cr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):h.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((i,s)=>h.jsxs("span",{className:"flex",children:[h.jsx(cr,{variant:"focus",cellId:i,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(i)},i),s<e.length-1&&", "]},i))})]}),h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[h.jsx("span",{title:"Used by",children:h.jsx(Ca,{className:"w-3.5 h-3.5 text-muted-foreground"})}),h.jsx(Qw,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],_2=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[i,s]=K.useState(""),a=kU(),l=A.useMemo(()=>{const u=f=>{const m=a[f];return EU(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(u),usedByNames:f.usedBy.map(u)}))},[n,a,e]),c=A.useMemo(()=>{const u=new Map;return e.forEach((f,m)=>u.set(f,m)),function(f,m,_){m||(m={id:Qh,desc:!1});let g=[];switch(m.id){case p2:g=ba(f,p=>p.name);break;case g2:g=ba(f,p=>p.dataType);break;case Qh:g=ba(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],u)},[l,o,e]),d=SU({data:c,columns:eD,getCoreRowModel:jU(),onGlobalFilterChange:s,getFilteredRowModel:NU(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:u=>u.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:CU(),state:{sorting:o,globalFilter:i}});return h.jsxs(h.Fragment,{children:[h.jsx(A4,{className:"w-full",placeholder:"Search",value:i,onChange:u=>s(u.target.value)}),h.jsxs(Um,{className:Te("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[h.jsx(Vm,{children:h.jsx(Gi,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(u=>h.jsx(Tr,{className:"sticky top-0 bg-background border-b",children:T4(u.column.columnDef.header,u.getContext())},u.id))})}),h.jsx($m,{children:d.getRowModel().rows.map(u=>h.jsx(Gi,{className:"hover:bg-accent",children:u.getVisibleCells().map(f=>h.jsx(Mr,{className:"border-b",children:T4(f.column.columnDef.cell,f.getContext())},f.id))},u.id))})]})]})});_2.displayName="VariableTable";let b2,y2,x2;b2=()=>{const t=X.c(4),e=I4(),n=Oc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(En,{title:"No variables",description:"Global variables will appear here.",icon:h.jsx(rc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=h.jsx(_2,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},Qm=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Te("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=h.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},y2=()=>{const t=X.c(9),e=IU(),{clearLogs:n}=zt();if(e.length===0){let s,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=s):s=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(En,{title:"No logs",description:h.jsxs("span",{children:[s," and"," ",h.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:h.jsx(dm,{})}),t[1]=a):a=t[1],a}let o,r,i;return t[2]!==n?(o=h.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:h.jsx(Qm,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=h.jsx("div",{className:"overflow-auto flex-1",children:h.jsx(x2,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(i=h.jsxs(h.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=i):i=t[8],i},x2=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,i,s,a,l;return e[0]!==o?(r=Te("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i={whiteSpace:"pre-wrap"},e[2]=i):i=e[2],e[3]!==n?(s=n.map(oD),e[3]=n,e[4]=s):s=e[4],e[5]!==s?(a=h.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:h.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:i,children:s})}),e[5]=s,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=h.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function tD(t){const e=AU(t.timestamp),n=nD[t.level],o=t.level.toUpperCase();return h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),h.jsx("span",{className:Te("flex-shrink-0",n),children:o}),h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",h.jsx(cr,{cellId:t.cellId}),")"]}),t.message]})}const nD={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function oD(t,e){return h.jsxs("div",{className:"contents group",children:[h.jsx("span",{className:Te("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),h.jsx("span",{className:Te("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:tD(t)})]},e)}const rD=()=>{const t=X.c(5),{documentation:e}=We(TU);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(En,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:h.jsx(Zc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Lm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o};function w2(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}tp=function(t){t===void 0&&(t={});var e=t.onResize,n=A.useRef(void 0);n.current=e;var o=t.round||Math.round,r=A.useRef(),i=A.useState({width:void 0,height:void 0}),s=i[0],a=i[1],l=A.useRef(!1);A.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=A.useRef({width:void 0,height:void 0}),d=function(u,f){var m=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){p()});var p=A.useCallback(function(){var b=g.current,x=_.current,y=b||(x?x instanceof Element?x:x.current:null);m.current&&m.current.element===y&&m.current.subscriber===u||(m.current&&m.current.cleanup&&m.current.cleanup(),m.current={element:y,subscriber:u,cleanup:y?u(y):void 0})},[u]);return A.useEffect(function(){return function(){m.current&&m.current.cleanup&&(m.current.cleanup(),m.current=null)}},[]),A.useCallback(function(b){g.current=b,p()},[p])}(A.useCallback(function(u){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var m=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=w2(m,_,"inlineSize"),p=w2(m,_,"blockSize"),b=g?o(g):void 0,x=p?o(p):void 0;if(c.current.width!==b||c.current.height!==x){var y={width:b,height:x};c.current.width=b,c.current.height=x,n.current?n.current(y):l.current||a(y)}})}),r.current.instance.observe(u,{box:t.box}),function(){r.current&&r.current.instance.unobserve(u)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:s.width,height:s.height}},[d,s.width,s.height])};const ef=new Map,iD=({file:t,onOpenNotebook:e})=>{const{theme:n}=ho(),o=We(im),[r,i]=A.useState(""),{data:s,loading:a,error:l,setData:c}=Yn(async()=>{const g=await M4({path:t.path}),p=g.contents||"";return i(ef.get(t.path)||p),g},[t.path]),d=async()=>{r!==(s==null?void 0:s.contents)&&await FU({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>p?{...p,contents:r}:void 0),i(r))})},u=A.useRef(r);if(u.current=r,A.useEffect(()=>()=>{if(!(s!=null&&s.contents))return;const g=u.current;g===s.contents?ef.delete(t.path):ef.set(t.path,g)},[t.path,s==null?void 0:s.contents]),l)return h.jsx(Yi,{error:l});if(a||!s)return null;const f=s.mimeType||"text/plain",m=f in tf;if(!s.contents&&!m)return h.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[h.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),h.jsx("div",{children:s.file.name}),h.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),h.jsx("div",{children:f})]});const _=h.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!qn()&&h.jsx(Me,{content:"Open notebook",children:h.jsx(xn,{size:"small",onClick:g=>e(g),children:h.jsx(uc,{})})}),h.jsx(Me,{content:"Download",children:h.jsx(xn,{size:"small",onClick:()=>{if(v2(f)){const g=PU(s.contents,f);LU(g,s.file.name)}else na(new Blob([s.contents||r],{type:f}),s.file.name)},children:h.jsx(pm,{})})}),!v2(f)&&h.jsxs(h.Fragment,{children:[h.jsx(Me,{content:"Copy contents to clipboard",children:h.jsx(xn,{size:"small",onClick:async()=>{await bn(r)},children:h.jsx(Ri,{})})}),h.jsx(Me,{content:hn("global.save"),children:h.jsx(xn,{size:"small",color:r===s.contents?void 0:"green",onClick:d,disabled:r===s.contents,children:h.jsx(Sa,{})})})]})]});return f.startsWith("image/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(MU,{base64:s.contents,mime:f})})]}):f==="text/csv"&&s.contents?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(OU,{contents:s.contents})})]}):f.startsWith("audio/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(DU,{base64:s.contents,mime:f})})]}):f.startsWith("video/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(RU,{base64:s.contents,mime:f})})]}):h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(pa,{theme:n==="dark"?"dark":"light",language:tf[f]||tf.default,className:"border-b",extensions:[st.lineWrapping,Kn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==s.contents&&(d(),!0)}])],value:r,onChange:i})})]})},v2=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/"),tf={"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"},k2=Ot(new class{constructor(t){this.callbacks=t,this.delegate=new Ym([]),this.rootPath="",this.onChange=jn.NOOP,this.path=new hm("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Ym(n.files),this.rootPath=n.root,this.path=hm.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:u4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var i;return(i=this.delegate.find(r))==null?void 0:i.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,i]of n.entries()){const s=o[r];i===this.rootPath?this.delegate=new Ym(s.files):this.delegate.update({id:i,changes:{children:s.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=function(o){return o.endsWith("/")?o:`${o}/`}(this.rootPath);return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(lt({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const i=this.delegate.find(r);if(!i)return Promise.resolve();const s=this.path.join(n,this.path.basename(i.data.path));return this.delegate.update({id:r,changes:{path:s}}),this.callbacks.renameFileOrFolder({path:i.data.path,newPath:s}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:Y3,createFileOrFolder:O4,deleteFileOrFolder:BU,renameFileOrFolder:zU})),sD=Ot({});function aD(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var i;e((i=r.target)==null?void 0:i.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function S2(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:hD,onDropRejected:cD,onDrop:lD,...o},e[2]=o,e[3]=r):r=e[3],UU(r)}async function lD(t){for(const e of t){const n=(await aD(e)).split(",")[1];await O4({path:"",type:"file",name:e.name,contents:n})}await async function(){await ut.get(k2).refreshAll([])}()}function cD(t){lt({title:"File upload failed",description:h.jsx("div",{className:"flex flex-col gap-1",children:t.map(dD)}),variant:"danger"})}function dD(t){return h.jsxs("div",{children:[t.file.name," (",t.errors.map(uD).join(", "),")"]},t.file.name)}function uD(t){return t.message}function hD(t){mt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}const C2=K.createContext(null),fD=t=>{const e=X.c(60),{height:n}=t,o=A.useRef(null),[r]=yn(k2);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[0]=i):i=e[0];const[s,a]=A.useState(i),[l,c]=A.useState(null),{openPrompt:d}=zn(),[u,f]=yn(sD);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{loading:g,error:p}=Yn(m,_);let b;e[4]!==u||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(u).filter(C=>u[C]))},e[4]=u,e[5]=r,e[6]=b):b=e[6];const x=Qe(b);let y;e[7]!==d||e[8]!==r?(y=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=y):y=e[9];const v=Qe(y);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const k=Qe(S);let N;e[13]!==f?(N=()=>{var C;(C=o.current)==null||C.closeAll(),f({})},e[13]=f,e[14]=N):N=e[14];const E=Qe(N);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Xn,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(p){let C;return e[16]!==p?(C=h.jsx(Yi,{error:p}),e[16]=p,e[17]=C):C=e[17],C}if(l){let C,$,j,H,Y,Z;return e[18]===Symbol.for("react.memo_cache_sentinel")?(C=()=>c(null),e[18]=C):C=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(De,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:h.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=h.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,h.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(H=G=>N2(G,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=H):H=e[24],e[25]!==l||e[26]!==H?(Y=h.jsx(A.Suspense,{children:h.jsx(iD,{onOpenNotebook:H,file:l})}),e[25]=l,e[26]=H,e[27]=Y):Y=e[27],e[28]!==j||e[29]!==Y?(Z=h.jsxs(h.Fragment,{children:[j,Y]}),e[28]=j,e[29]=Y,e[30]=Z):Z=e[30],Z}let I;e[31]!==E||e[32]!==k||e[33]!==v||e[34]!==x||e[35]!==r?(I=h.jsx(pD,{onRefresh:x,onCreateFile:k,onCreateFolder:v,onCollapseAll:E,tree:r}),e[31]=E,e[32]=k,e[33]=v,e[34]=x,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,R,B,O,z,F,V,L;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const j of $)await r.delete(j)},R=async C=>{const{id:$,name:j}=C;await r.rename($,j)},B=async C=>{const{dragIds:$,parentId:j}=C;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=B):(M=e[38],R=e[39],B=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=O):O=e[41],e[42]!==u||e[43]!==f||e[44]!==r?(z=async C=>{if(await r.expand(C)){const $=u[C]??!1;f({...u,[C]:!$})}},e[42]=u,e[43]=f,e[44]=r,e[45]=z):z=e[45],e[46]!==s||e[47]!==u||e[48]!==M||e[49]!==R||e[50]!==B||e[51]!==z||e[52]!==T?(F=h.jsx(HV,{width:"100%",ref:o,height:T,className:"h-full",data:s,initialOpenState:u,openByDefault:!1,renderCursor:xD,disableDrop:wD,onDelete:M,onRename:R,onMove:B,onSelect:O,onToggle:z,padding:15,rowHeight:30,indent:mD,overscanCount:1e3,disableMultiSelection:!0,children:bD}),e[46]=s,e[47]=u,e[48]=M,e[49]=R,e[50]=B,e[51]=z,e[52]=T,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(V=h.jsx(C2.Provider,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(L=h.jsxs(h.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=L):L=e[59],L},mD=15,pD=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:i}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];const{getRootProps:a,getInputProps:l}=S2(s);let c,d,u,f,m,_,g,p,b,x,y,v,S,k,N;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(va,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=h.jsx(Me,{content:"Add file",children:h.jsx(De,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(Wc,{size:16}),e[4]=u):u=e[4],e[5]!==r?(f=h.jsx(Me,{content:"Add folder",children:h.jsx(De,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=VU({variant:"text",size:"xs"}),g=h.jsx($U,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=h.jsx(Me,{content:"Upload file",children:h.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=h.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(_4,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=h.jsx(Me,{content:"Refresh",children:h.jsx(De,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(cp,{size:16}),e[20]=S):S=e[20],e[21]!==i?(k=h.jsx(Me,{content:"Collapse all folders",children:h.jsx(De,{"data-testid":"file-explorer-collapse-button",onClick:i,variant:"text",size:"xs",children:S})}),e[21]=i,e[22]=k):k=e[22],e[23]!==x||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==p?(N=h.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,p,x,v,k]}),e[23]=x,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=p,e[29]=N):N=e[29],N},gD=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,i,s;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(i=n.data.isMarimoFile&&!qn()&&h.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",h.jsx(uc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=i):i=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==i?(s=h.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,i]}),e[5]=n.data.name,e[6]=r,e[7]=i,e[8]=s):s=e[8],s},_D=t=>{const e=X.c(10),{node:n}=t,o=A.useRef(null);let r,i,s,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},i=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=i):(r=e[1],i=e[2]),A.useEffect(r,i),e[3]!==n?(s=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=s,e[5]=a):(s=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==s||e[8]!==a?(l=h.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:vD,onBlur:s,onKeyDown:a}),e[6]=n.data.name,e[7]=s,e[8]=a,e[9]=l):l=e[9],l},bD=t=>{const e=X.c(53),{node:n,style:o,dragHandle:r}=t;let i;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(i=n.data.isDirectory?"directory":q3(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=i):i=e[2];const s=i,a=G3[s],{openConfirm:l,openPrompt:c}=zn(),d=A.useContext(C2);let u;e[3]!==n.data.path||e[4]!==d?(u=async F=>{N2(F,d?d.relativeFromRoot(n.data.path):n.data.path)},e[3]=n.data.path,e[4]=d,e[5]=u):u=e[5];const f=u;let m;e[6]!==n.data.name||e[7]!==n.id||e[8]!==n.tree||e[9]!==l?(m=async F=>{F.stopPropagation(),F.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:h.jsx(O3,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[6]=n.data.name,e[7]=n.id,e[8]=n.tree,e[9]=l,e[10]=m):m=e[10];const _=m;let g;e[11]!==n||e[12]!==c||e[13]!==d?(g=async()=>{n.open(),c({title:"Folder name",onConfirm:async F=>{d==null||d.createFolder(F,n.id)}})},e[11]=n,e[12]=c,e[13]=d,e[14]=g):g=e[14];const p=Qe(g);let b;e[15]!==n||e[16]!==c||e[17]!==d?(b=async()=>{n.open(),c({title:"File name",onConfirm:async F=>{d==null||d.createFile(F,n.id)}})},e[15]=n,e[16]=c,e[17]=d,e[18]=b):b=e[18];const x=Qe(b);let y;e[19]!==s||e[20]!==x||e[21]!==p||e[22]!==_||e[23]!==f||e[24]!==n||e[25]!==d?(y=()=>{const F={size:14,strokeWidth:1.5,className:"mr-2"};return h.jsxs(ac,{align:"end",className:"no-print w-[220px]",onClick:kD,onCloseAutoFocus:SD,children:[!n.data.isDirectory&&h.jsxs(rn,{onSelect:()=>n.select(),children:[h.jsx(Hp,{...F}),"Open file"]}),!n.data.isDirectory&&!qn()&&h.jsxs(rn,{onSelect:()=>{HU({path:n.data.path})},children:[h.jsx(uc,{...F}),"Open file in external editor"]}),n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(rn,{onSelect:()=>x(),children:[h.jsx(va,{...F}),"Create file"]}),h.jsxs(rn,{onSelect:()=>p(),children:[h.jsx(Wc,{...F}),"Create folder"]}),h.jsx(Po,{})]}),h.jsxs(rn,{onSelect:()=>n.edit(),children:[h.jsx(Tp,{...F}),"Rename"]}),h.jsxs(rn,{onSelect:async()=>{await bn(n.data.path),lt({title:"Copied to clipboard"})},children:[h.jsx(Ri,{...F}),"Copy path"]}),d&&h.jsxs(rn,{onSelect:async()=>{await bn(d.relativeFromRoot(n.data.path)),lt({title:"Copied to clipboard"})},children:[h.jsx(Ri,{...F}),"Copy relative path"]}),h.jsxs(rn,{onSelect:async()=>{lt({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:V}=n.data,L=qU[s](V);await bn(L)},children:[h.jsx(WU,{...F}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!qn()&&h.jsxs(h.Fragment,{children:[h.jsx(Po,{}),h.jsxs(rn,{onSelect:f,children:[h.jsx(Bp,{...F}),"Open notebook"]})]}),h.jsx(Po,{}),!n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(rn,{onSelect:async()=>{const V=(await M4({path:n.data.path})).contents||"";na(new Blob([V]),n.data.name)},children:[h.jsx(pm,{...F}),"Download"]}),h.jsx(Po,{})]}),h.jsxs(rn,{onSelect:_,variant:"danger",children:[h.jsx(rm,{...F}),"Delete"]})]})},e[19]=s,e[20]=x,e[21]=p,e[22]=_,e[23]=f,e[24]=n,e[25]=d,e[26]=y):y=e[26];const v=y;let S,k,N;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=Te("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[27]=S):S=e[27],e[28]!==n?(k=F=>{F.stopPropagation(),n.data.isDirectory&&n.toggle()},N=h.jsx(yD,{node:n}),e[28]=n,e[29]=k,e[30]=N):(k=e[29],N=e[30]);const E=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let I,T,M,R,B,O,z;return e[31]!==E?(I=Te("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",E),e[31]=E,e[32]=I):I=e[32],e[33]!==a||e[34]!==n.data.isMarimoFile?(T=n.data.isMarimoFile?h.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):h.jsx(a,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),e[33]=a,e[34]=n.data.isMarimoFile,e[35]=T):T=e[35],e[36]!==f||e[37]!==n?(M=n.isEditing?h.jsx(_D,{node:n}):h.jsx(gD,{node:n,onOpenMarimoFile:f}),e[36]=f,e[37]=n,e[38]=M):M=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(R=h.jsx(sc,{asChild:!0,tabIndex:-1,onClick:CD,children:h.jsx(De,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:h.jsx(Hc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),e[39]=R):R=e[39],e[40]!==v?(B=h.jsxs(ic,{modal:!1,children:[R,v()]}),e[40]=v,e[41]=B):B=e[41],e[42]!==I||e[43]!==T||e[44]!==M||e[45]!==B?(O=h.jsxs("span",{className:I,children:[T,M,B]}),e[42]=I,e[43]=T,e[44]=M,e[45]=B,e[46]=O):O=e[46],e[47]!==r||e[48]!==o||e[49]!==O||e[50]!==k||e[51]!==N?(z=h.jsxs("div",{style:o,ref:r,className:S,draggable:!0,onClick:k,children:[N,O]}),e[47]=r,e[48]=o,e[49]=O,e[50]=k,e[51]=N,e[52]=z):z=e[52],z},yD=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?h.jsx(Xs,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(Zs,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function N2(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function xD(){return null}function wD(t){const{parentNode:e}=t;return!e.data.isDirectory}function vD(t){return t.stopPropagation()}function kD(t){return t.stopPropagation()}function SD(t){return t.preventDefault()}function CD(t){return t.stopPropagation()}const ND=()=>{const t=X.c(20),{ref:e,height:n}=tp(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:i,getInputProps:s,isDragActive:a}=S2(r);let l,c,d,u,f,m,_,g;return t[1]!==i?(l=i(),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Te("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==s?(d=s(),t[4]=s,t[5]=d):d=t[5],t[6]!==d?(u=h.jsx("input",{...d}),t[6]=d,t[7]=u):u=t[7],t[8]!==a?(f=a&&h.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=h.jsx(fD,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=h.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==_?(g=h.jsxs("div",{...l,className:c,children:[u,f,_]}),t[15]=l,t[16]=u,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},jD=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=zn();let i,s;return e[0]!==r||e[1]!==o?(i=()=>o(h.jsx(ID,{onClose:r})),e[0]=r,e[1]=o,e[2]=i):i=e[2],e[3]!==n||e[4]!==i?(s=h.jsx(N4,{onClick:i,children:n}),e[3]=n,e[4]=i,e[5]=s):s=e[5],s},ED=[st.lineWrapping],ID=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:i}=ho();let s,a,l,c,d,u;e[0]!==n?(s=async y=>{y.preventDefault();const v=new FormData(y.target),S=v.get("title"),k=v.get("description"),N=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:k,code:N})}),n(),lt({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(ir,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Ti,{children:[a,h.jsxs(Di,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",h.jsx("a",{href:Gn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(jr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=h.jsx(GU,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(u=h.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=u):u=e[7];const f=i==="dark"?"dark":"light";let m,_,g,p,b,x;return e[8]!==o||e[9]!==f?(m=h.jsx(pa,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:ED,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==u||e[12]!==m?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,u,m]}),e[11]=u,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=h.jsx(De,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(De,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=h.jsxs(ea,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==s||e[20]!==b||e[21]!==_?(x=h.jsx(rr,{className:"w-fit",children:h.jsxs("form",{onSubmit:s,children:[l,_,b]})}),e[19]=s,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},AD=[st.lineWrapping],TD=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:i,loading:s}=Yn(DD,o);if(i){let b;return t[1]!==i?(b=h.jsx(Yi,{error:i}),t[1]=i,t[2]=b):b=t[2],b}if(s||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Xn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,u,f,m,_,g,p;return t[4]!==a?(l=Te("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qs,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs("div",{className:"flex items-center w-full",children:[c,h.jsx(jD,{children:h.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Ar,{className:"h-4 w-4"})})})]}),u=h.jsx(oc,{children:"No results"}),t[7]=d,t[8]=u):(d=t[7],u=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=h.jsx(OD,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=h.jsxs(fc,{className:l,children:[d,u,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=h.jsx(A.Suspense,{children:h.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?h.jsx(MD,{snippet:e},e.title):h.jsx(En,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=h.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},MD=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=ho(),{createNewCell:r}=zt(),i=Or();let s;e[0]!==r||e[1]!==i||e[2]!==n.sections?(s=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:i??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=i,e[2]=n.sections,e[3]=s):s=e[3];const a=s;let l;e[4]!==r||e[5]!==i?(l=p=>{r({code:p,before:!1,cellId:i??"__end__"})},e[4]=r,e[5]=i,e[6]=l):l=e[6];const c=l;let d,u,f,m,_,g;if(e[7]!==n.title?(d=h.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(Zi,{className:"ml-2 h-4 w-4"}),e[9]=u):u=e[9],e[10]!==a?(f=h.jsx("div",{className:"flex justify-end",children:h.jsx(ns,{children:h.jsxs(De,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",u]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:x,html:y,id:v}=b;return y?h.jsx("div",{children:Lm({html:y})},`${n.title}-${v}`):x?h.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[h.jsx(ns,{children:h.jsx(Me,{content:"Insert snippet",children:h.jsx(De,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(x)},children:h.jsx(Zi,{className:"h-5 w-5"})})})}),h.jsx(pa,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:AD,value:x,readOnly:!0},`${n.title}-${v}`)]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=h.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=h.jsxs(h.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},OD=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,i;if(e[0]!==o||e[1]!==n){let s;e[3]!==o?(s=a=>h.jsx(fo,{className:"rounded-none",onSelect:()=>o(a),children:h.jsx("div",{className:"flex flex-row gap-2 items-center",children:h.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=s):s=e[4],r=n.map(s),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(i=h.jsx(Im,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=i):i=e[6],i};function DD(){return YU()}const RD=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const u=ut.get(nm)[d];if(u)return u.declaredBy[0]}(n);if(!l)return;const c=ec(l);c&&Bm(c,n)},e[0]=n,e[1]=r):r=e[1];const i=r;let s,a;return e[2]!==o?(s=Te("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=s):s=e[3],e[4]!==i||e[5]!==s||e[6]!==n?(a=h.jsx("button",{type:"button",onClick:i,className:s,children:n}),e[4]=i,e[5]=s,e[6]=n,e[7]=a):a=e[7],a},j2=t=>{const e=X.c(4),{isExpanded:n}=t,o=n&&"rotate-90";let r,i;return e[0]!==o?(r=Te("h-3 w-3 transition-transform",o),e[0]=o,e[1]=r):r=e[1],e[2]!==r?(i=h.jsx(Zs,{className:r}),e[2]=r,e[3]=i):i=e[3],i},E2=t=>{const e=X.c(2),{children:n}=t;let o;return e[0]!==n?(o=h.jsx("div",{className:"flex gap-1 items-center font-bold px-2 py-1.5 text-muted-foreground bg-[var(--slate-2)] text-sm",children:n}),e[0]=n,e[1]=o):o=e[1],o},nf=t=>{const e=X.c(5),{content:n,className:o}=t;let r,i;return e[0]!==o?(r=Te("text-sm text-muted-foreground py-1",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(i=h.jsx("div",{className:r,children:n}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i},I2=t=>{const e=X.c(3),{error:n}=t;let o,r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(Jn,{className:"h-4 w-4"}),e[0]=o):o=e[0],e[1]!==n.message?(r=h.jsxs("div",{className:"pl-12 text-sm bg-red-50 dark:bg-red-900 text-red-600 dark:text-red-50 flex items-center gap-2 p-2 h-8",children:[o,n.message]}),e[1]=n.message,e[2]=r):r=e[2],r},A2=t=>{const e=X.c(3),{message:n}=t;let o,r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(Ic,{className:"h-4 w-4 animate-spin"}),e[0]=o):o=e[0],e[1]!==n?(r=h.jsxs("div",{className:"pl-12 text-sm bg-blue-50 dark:bg-[var(--accent)] text-blue-500 dark:text-blue-50 flex items-center gap-2 p-2 h-8",children:[o,n]}),e[1]=n,e[2]=r):r=e[2],r},of=Ot(null),PD=t=>{const e=X.c(9),{packages:n}=t,o=Li(),r=$t(of);if(!n||n.length===0)return null;let i;e[0]!==o||e[1]!==n||e[2]!==r?(i=()=>{const c=n.join(", ");r(c),o.toggleApplication("packages")},e[0]=o,e[1]=n,e[2]=r,e[3]=i):i=e[3];const s=i;let a,l;return e[4]!==n?(a=n.join(", "),e[4]=n,e[5]=a):a=e[5],e[6]!==s||e[7]!==a?(l=h.jsxs(De,{variant:"outline",size:"xs",onClick:s,className:"ml-2",children:["Install ",a]}),e[6]=s,e[7]=a,e[8]=l):l=e[8],l},LD=Ot(t=>{const e=t(JU),n=t(nm),o=t(k4);return ba(e,r=>{if(!r.variable_name)return-1;const i=Object.values(n).find(a=>a.name===r.variable_name);if(!i)return 0;const s=o.inOrderIds.indexOf(i.declaredBy[0]);return s===-1?0:s})}),FD=Ot(t=>{const e=new Map(t(KU));for(const n of D4){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ba([...e.values()],n=>D4.has(n.name)?1:0)}),zD=()=>{const t=X.c(32),[e,n]=K.useState(""),o=$t(R4),r=We(LD),i=We(FD);if(r.length===0&&i.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(En,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:h.jsx(Ng,{children:h.jsxs(De,{variant:"outline",size:"sm",children:["Add database or catalog",h.jsx(Ar,{className:"h-4 w-4 ml-2"})]})}),icon:h.jsx(or,{})}),t[0]=b):b=t[0],b}const s=!!e.trim();let a,l,c,d,u,f,m,_,g,p;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=h.jsx(Qs,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==s?(c=s&&h.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:h.jsx(Jn,{className:"h-4 w-4"})}),t[6]=s,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Ng,{children:h.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Ar,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(u=h.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=u):u=t[11],t[12]!==i||t[13]!==s||t[14]!==e){let b;t[16]!==s||t[17]!==e?(b=x=>h.jsx(BD,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>h.jsx(UD,{engineName:x.name,database:y,hasSearch:s,children:h.jsx(VD,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:s,searchValue:e})},y.name))},x.name),t[16]=s,t[17]=e,t[18]=b):b=t[18],f=i.map(b),t[12]=i,t[13]=s,t[14]=e,t[15]=f}else f=t[15];return t[19]!==i.length||t[20]!==r.length?(m=i.length>0&&r.length>0&&h.jsxs(E2,{children:[h.jsx(Fc,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:"Python"})]}),t[19]=i.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&h.jsx(T2,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=h.jsxs(Im,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==u||t[30]!==g?(p=h.jsxs(fc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[u,g]}),t[29]=u,t[30]=g,t[31]=p):p=t[31],p},BD=t=>{var v;const e=X.c(24),{connection:n,children:o,hasChildren:r}=t,i=n.databases.length===0||!((v=n.databases[0])!=null&&v.engine),s=i?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await ZU({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let u,f,m;e[2]!==n.dialect?(u=h.jsx(U3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),f=XU(n.dialect),e[2]=n.dialect,e[3]=u,e[4]=f):(u=e[3],f=e[4]),e[5]!==f?(m=h.jsx("span",{children:f}),e[5]=f,e[6]=m):m=e[6];const _=s;let g,p,b,x,y;return e[7]!==_?(g=h.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.jsx(RD,{variableName:_}),")"]}),e[7]=_,e[8]=g):g=e[8],e[9]!==d||e[10]!==i||e[11]!==a?(p=!i&&h.jsx(Me,{content:"Refresh connection",children:h.jsx(De,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:h.jsx(kc,{className:Te("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[9]=d,e[10]=i,e[11]=a,e[12]=p):p=e[12],e[13]!==u||e[14]!==m||e[15]!==g||e[16]!==p?(b=h.jsxs(E2,{children:[u,m,g,p]}),e[13]=u,e[14]=m,e[15]=g,e[16]=p,e[17]=b):b=e[17],e[18]!==o||e[19]!==r?(x=r?o:h.jsx(nf,{content:"No databases available",className:"pl-2"}),e[18]=o,e[19]=r,e[20]=x):x=e[20],e[21]!==b||e[22]!==x?(y=h.jsxs(h.Fragment,{children:[b,x]}),e[21]=b,e[22]=x,e[23]=y):y=e[23],y},UD=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:i}=t,[s,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u,f;e[0]!==n?(d=()=>{a(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),K.useEffect(d,u),e[3]!==s||e[4]!==l?(f=()=>{a(!s),c(!l)},e[3]=s,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==s?(_=h.jsx(j2,{isExpanded:s}),e[6]=s,e[7]=_):_=e[7];const g=l&&s?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Te("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=h.jsx(or,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&s&&"font-semibold";let y,v,S,k;e[12]!==x?(y=Te(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?h.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(S=h.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(k=h.jsxs(fo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=k):k=e[24];const N=s&&i;let E;return e[25]!==k||e[26]!==N?(E=h.jsxs(h.Fragment,{children:[k,N]}),e[25]=k,e[26]=N,e[27]=E):E=e[27],E},VD=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:i,databaseName:s,hasSearch:a,searchValue:l}=t;if(n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(nf,{content:"No schemas available",className:"pl-6"}),e[0]=u):u=e[0],u}let c,d;if(e[1]!==s||e[2]!==r||e[3]!==o||e[4]!==i||e[5]!==a||e[6]!==n||e[7]!==l){let u;e[9]!==l?(u=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=u):u=e[10];const f=n.filter(u);let m;e[11]!==s||e[12]!==r||e[13]!==o||e[14]!==i||e[15]!==a||e[16]!==l?(m=_=>h.jsx($D,{databaseName:s,schema:_,hasSearch:a,children:h.jsx(T2,{tables:_.tables,searchValue:l,sqlTableContext:{engine:i,database:s,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=s,e[12]=r,e[13]=o,e[14]=i,e[15]=a,e[16]=l,e[17]=m):m=e[17],c=f.map(m),e[1]=s,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=h.jsx(h.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},$D=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:i}=t,[s,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let u,f,m,_;if(e[0]!==i?(u=()=>{a(i)},f=[i],e[0]=i,e[1]=u,e[2]=f):(u=e[1],f=e[2]),K.useEffect(u,f),L4(o.name))return r;e[3]!==s||e[4]!==l?(m=()=>{a(!s),c(!l)},e[3]=s,e[4]=l,e[5]=m):m=e[5],e[6]!==s?(_=h.jsx(j2,{isExpanded:s}),e[6]=s,e[7]=_):_=e[7];const g=l&&s&&"text-foreground";let p,b;e[8]!==g?(p=Te("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=h.jsx(rV,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&s&&"font-semibold";let y,v,S;e[12]!==x?(y=Te(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=h.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==d?(S=h.jsxs(fo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=d,e[22]=S):S=e[22];const k=s&&r;let N;return e[23]!==S||e[24]!==k?(N=h.jsxs(h.Fragment,{children:[S,k]}),e[23]=S,e[24]=k,e[25]=N):N=e[25],N},T2=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:i}=P4(),[s,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u;e[0]!==i||e[1]!==o||e[2]!==n.length||e[3]!==s?(d=async()=>{if(n.length===0&&o&&!s){a(!0),c(!0);const{engine:p,database:b,schema:x}=o,y=await h$.request({engine:p,database:b,schema:x});if(!(y!=null&&y.tables))throw c(!1),new Error("No tables available");i({tables:y.tables,sqlTableContext:o}),c(!1)}},e[0]=i,e[1]=o,e[2]=n.length,e[3]=s,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==s?(u=[n.length,o,s],e[5]=o,e[6]=n.length,e[7]=s,e[8]=u):u=e[8];const{loading:f,error:m}=Yn(d,u);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(A2,{message:"Loading tables..."}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=h.jsx(I2,{error:m}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(nf,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let x;e[19]!==r||e[20]!==o?(x=y=>h.jsx(HD,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=h.jsx(h.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},HD=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:i}=P4(),[s,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let u,f;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(u=async()=>{if(s&&!d&&o&&!l){c(!0);const{engine:G,database:re,schema:ne}=o,te=await f$.request({engine:G,database:re,schema:ne,tableName:n.name});if(!(te!=null&&te.table))throw new Error("No table details available");i({table:te.table,sqlTableContext:o})}},e[0]=i,e[1]=s,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=u):u=e[6],e[7]!==s||e[8]!==d?(f=[s,d],e[7]=s,e[8]=d,e[9]=f):f=e[9];const{loading:m,error:_}=Yn(u,f),g=We(Ii),p=Or(),{createNewCell:b}=zt();let x;e[10]!==g||e[11]!==b||e[12]!==p||e[13]!==o||e[14]!==n?(x=()=>{Bo(g,b,p),b({code:(()=>{if(n.source_type==="catalog"){const G=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${G}")`}if(o)return Dc(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Dc(n,"*",o);default:return Ql(n.source_type),""}})(),before:!1,cellId:p??"__end__"})},e[10]=g,e[11]=b,e[12]=p,e[13]=o,e[14]=n,e[15]=x):x=e[15];const y=x;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const G=[];return n.num_rows!=null&&G.push(`${n.num_rows} rows`),n.num_columns!=null&&G.push(`${n.num_columns} columns`),G.length===0?null:h.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:h.jsx("span",{className:"text-xs text-muted-foreground",children:G.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const S=v;let k;e[19]!==_||e[20]!==m||e[21]!==o||e[22]!==n?(k=()=>m?h.jsx(A2,{message:"Loading columns..."}):_?h.jsx(I2,{error:_}):n.columns.map(G=>h.jsx(WD,{table:n,column:G,sqlTableContext:o},G.name)),e[19]=_,e[20]=m,e[21]=o,e[22]=n,e[23]=k):k=e[23];const N=k;let E;e[24]!==s||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(E=()=>{if(n.source_type==="local")return;const G=n.type==="table"?QU:N3;return h.jsx(G,{className:"h-3 w-3",strokeWidth:s||r?2.5:void 0})},e[24]=s,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=E):E=e[28];const I=E,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(L4(o.schema)?"pl-9":"pl-12"),R=(s||r)&&"font-semibold";let B,O,z,F,V,L,C,$,j,H,Y,Z;return e[29]!==M||e[30]!==R?(B=Te("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=B):B=e[31],e[32]!==s?(O=()=>a(!s),e[32]=s,e[33]=O):O=e[33],e[34]!==I?(z=I(),e[34]=I,e[35]=z):z=e[35],e[36]!==n.name?(F=h.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=F):F=e[37],e[38]!==z||e[39]!==F?(V=h.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,F]}),e[38]=z,e[39]=F,e[40]=V):V=e[40],e[41]!==S?(L=S(),e[41]=S,e[42]=L):L=e[42],e[43]!==y?(C=un.stopPropagation(()=>y()),e[43]=y,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(Qi,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(j=h.jsx(Me,{content:"Add table to notebook",delayDuration:400,children:h.jsx(De,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=j):j=e[47],e[48]!==s||e[49]!==O||e[50]!==V||e[51]!==L||e[52]!==j||e[53]!==B||e[54]!==T?(H=h.jsxs(fo,{className:B,value:T,"aria-selected":s,forceMount:!0,onSelect:O,children:[V,L,j]}),e[48]=s,e[49]=O,e[50]=V,e[51]=L,e[52]=j,e[53]=B,e[54]=T,e[55]=H):H=e[55],e[56]!==s||e[57]!==N?(Y=s&&N(),e[56]=s,e[57]=N,e[58]=Y):Y=e[58],e[59]!==H||e[60]!==Y?(Z=h.jsxs(h.Fragment,{children:[H,Y]}),e[59]=H,e[60]=Y,e[61]=Z):Z=e[61],Z},WD=t=>{var H,Y;const e=X.c(52),{table:n,column:o,sqlTableContext:r}=t,[i,s]=K.useState(!1),a=We(R4),l=$t(eV);let c,d;e[0]!==a?(c=()=>{a&&s(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),K.useEffect(c,d),l(i?Z=>new Set([...Z,`${n.name}:${o.name}`]):Z=>(Z.delete(`${n.name}:${o.name}`),new Set(Z)));const u=tV[o.type],f=We(Ii),m=Or(),{createNewCell:_}=zt(),{columnsPreviews:g}=nV();let p;e[3]!==o.name||e[4]!==n.primary_keys?(p=((H=n.primary_keys)==null?void 0:H.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=p):p=e[5];const b=p;let x;e[6]!==o.name||e[7]!==n.indexes?(x=((Y=n.indexes)==null?void 0:Y.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=x):x=e[8];const y=x;let v;e[9]!==f||e[10]!==_||e[11]!==m?(v=Z=>{Z.includes("alt")&&function(G,re,ne){Kp("altair","alt",te=>{const q=C3.create();re({cellId:ne??"__end__",before:!1,code:te,lastCodeRun:G?te:void 0,newCellId:q,autoFocus:!1}),G&&em({cellIds:[q],codes:[te]})})}(f,_,m),_({code:Z,before:!1,cellId:m??"__end__"})},e[9]=f,e[10]=_,e[11]=m,e[12]=v):v=e[12];const S=v,k=YD,N=`${n.name}.${o.name}`,E=`${n.name}.${o.name}`;let I;e[13]!==i?(I=()=>s(!i),e[13]=i,e[14]=I):I=e[14];const T=r?"pl-14":"pl-7";let M,R,B,O,z,F,V,L,C,$,j;return e[15]!==T?(M=Te("flex flex-row gap-2 items-center flex-1",T),e[15]=T,e[16]=M):M=e[16],e[17]!==u?(R=h.jsx(u,{className:"flex-shrink-0 h-3 w-3",strokeWidth:1.5}),e[17]=u,e[18]=R):R=e[18],e[19]!==o.name?(B=h.jsx("span",{children:o.name}),e[19]=o.name,e[20]=B):B=e[20],e[21]!==b?(O=b&&k({tooltipContent:"Primary key",content:"PK"}),e[21]=b,e[22]=O):O=e[22],e[23]!==y?(z=y&&k({tooltipContent:"Indexed",content:"IDX"}),e[23]=y,e[24]=z):z=e[24],e[25]!==M||e[26]!==R||e[27]!==B||e[28]!==O||e[29]!==z?(F=h.jsxs("div",{className:M,children:[R,B,O,z]}),e[25]=M,e[26]=R,e[27]=B,e[28]=O,e[29]=z,e[30]=F):F=e[30],e[31]!==o.name?(V=h.jsx(Me,{content:"Copy column name",delayDuration:400,children:h.jsx(De,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:h.jsx(Wm,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[31]=o.name,e[32]=V):V=e[32],e[33]!==o.external_type?(L=h.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[33]=o.external_type,e[34]=L):L=e[34],e[35]!==F||e[36]!==V||e[37]!==L||e[38]!==N||e[39]!==E||e[40]!==I?(C=h.jsxs(fo,{className:"rounded-none py-1 group cursor-pointer",value:E,onSelect:I,children:[F,V,L]},N),e[35]=F,e[36]=V,e[37]=L,e[38]=N,e[39]=E,e[40]=I,e[41]=C):C=e[41],e[42]!==o||e[43]!==g||e[44]!==S||e[45]!==i||e[46]!==r||e[47]!==n?($=i&&h.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:h.jsx(mc,{children:h.jsx(GD,{table:n,column:o,onAddColumnChart:S,preview:g.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[42]=o,e[43]=g,e[44]=S,e[45]=i,e[46]=r,e[47]=n,e[48]=$):$=e[48],e[49]!==C||e[50]!==$?(j=h.jsxs(h.Fragment,{children:[C,$]}),e[49]=C,e[50]=$,e[51]=j):j=e[51],j},qD=K.lazy(()=>Ac(()=>import("./index-f2YtY2NK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(t=>({default:t.VegaLite}))),GD=t=>{const e=X.c(50),{table:n,column:o,preview:r,onAddColumnChart:i,sqlTableContext:s}=t,{theme:a}=ho();let l,c;if(e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==n.name||e[4]!==n.source||e[5]!==n.source_type?(l=()=>{r||iV({source:n.source,tableName:n.name,columnName:o.name,sourceType:n.source_type,fullyQualifiedTableName:s?`${s.database}.${s.schema}.${n.name}`:n.name})},e[0]=o,e[1]=r,e[2]=s,e[3]=n.name,e[4]=n.source,e[5]=n.source_type,e[6]=l):l=e[6],C4(l),n.source_type==="connection"){const N=o.name,E=o.external_type;let I,T,M,R;return e[7]!==o.name||e[8]!==i||e[9]!==s||e[10]!==n?(I=un.stopPropagation(()=>{i(Dc(n,o.name,s))}),e[7]=o.name,e[8]=i,e[9]=s,e[10]=n,e[11]=I):I=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(Qi,{className:"h-3 w-3 mr-1"}),e[12]=T):T=e[12],e[13]!==I?(M=h.jsxs(De,{variant:"outline",size:"xs",onClick:I,children:[T," Add SQL cell"]}),e[13]=I,e[14]=M):M=e[14],e[15]!==o.external_type||e[16]!==o.name||e[17]!==M?(R=h.jsxs("span",{className:"text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7",children:[N," (",E,")",M]}),e[15]=o.external_type,e[16]=o.name,e[17]=M,e[18]=R):R=e[18],R}if(n.source_type==="catalog"){let N;return e[19]!==o.external_type||e[20]!==o.name?(N=h.jsxs("span",{className:"text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7",children:[o.name," (",o.external_type,")"]}),e[19]=o.external_type,e[20]=o.name,e[21]=N):N=e[21],N}if(!r){let N;return e[22]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading..."}),e[22]=N):N=e[22],N}e[23]!==r.error||e[24]!==r.missing_packages?(c=r.error&&h.jsxs("div",{className:"text-xs text-muted-foreground p-2 border border-muted rounded flex items-center",children:[h.jsx("span",{children:r.error}),r.missing_packages&&h.jsx(PD,{packages:r.missing_packages})]}),e[23]=r.error,e[24]=r.missing_packages,e[25]=c):c=e[25];const d=c;let u;e[26]!==r.summary?(u=r.summary&&h.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(JD)}),e[26]=r.summary,e[27]=u):u=e[27];const f=u,m=KD;let _;e[28]!==r.chart_spec||e[29]!==a?(_=r.chart_spec&&h.jsx(qD,{spec:m(JSON.parse(r.chart_spec)),width:"container",height:100,actions:!1,theme:a==="dark"?"dark":"vox"}),e[28]=r.chart_spec,e[29]=a,e[30]=_):_=e[30];const g=_;let p;e[31]!==i||e[32]!==r.chart_code||e[33]!==n.source_type?(p=r.chart_code&&n.source_type==="local"&&h.jsx(Me,{content:"Add chart to notebook",delayDuration:400,children:h.jsx(De,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:un.stopPropagation(()=>i(r.chart_code||"")),children:h.jsx(Qi,{className:"h-3 w-3"})})}),e[31]=i,e[32]=r.chart_code,e[33]=n.source_type,e[34]=p):p=e[34];const b=p;let x;e[35]!==o||e[36]!==i||e[37]!==s||e[38]!==n?(x=n.source_type==="duckdb"&&h.jsx(Me,{content:"Add SQL cell",delayDuration:400,children:h.jsx(De,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:un.stopPropagation(()=>{i(Dc(n,o.name,s))}),children:h.jsx(Qi,{className:"h-3 w-3"})})}),e[35]=o,e[36]=i,e[37]=s,e[38]=n,e[39]=x):x=e[39];const y=x;let v;e[40]!==r.chart_max_rows_errors?(v=r.chart_max_rows_errors&&h.jsx("span",{className:"text-xs text-muted-foreground",children:"Too many rows to render the chart."}),e[40]=r.chart_max_rows_errors,e[41]=v):v=e[41];const S=v;if(!(d||f||g||S)){let N;return e[42]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("span",{className:"text-xs text-muted-foreground",children:"No data"}),e[42]=N):N=e[42],N}let k;return e[43]!==b||e[44]!==y||e[45]!==g||e[46]!==S||e[47]!==d||e[48]!==f?(k=h.jsxs("div",{className:"flex flex-col gap-2 relative",children:[d,b,y,S,g,f]}),e[43]=b,e[44]=y,e[45]=g,e[46]=S,e[47]=d,e[48]=f,e[49]=k):k=e[49],k};function YD(t){const{tooltipContent:e,content:n}=t;return h.jsx(Me,{content:e,delayDuration:100,children:h.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}function JD(t){const[e,n]=t;return n==null?null:h.jsxs("div",{className:"flex items-center gap-1 group",children:[h.jsx(Wm,{className:"h-3 w-3 invisible group-hover:visible",value:String(n)}),h.jsx("span",{className:"text-xs min-w-[60px] uppercase",children:e}),h.jsx("span",{className:"text-xs font-bold text-muted-foreground tracking-wide",children:oV(n)})]},e)}function KD(t){return{...t,config:{...t.config,background:"transparent"}}}const XD=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(zD,{}),t[0]=e):e=t[0],e},ZD=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,i]=K.useState(!1);let s,a;return e[0]!==r||e[1]!==n?(s=()=>{n&&!r&&i(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=s,e[3]=a):(s=e[2],a=e[3]),K.useEffect(s,a),r?o:null},rf=sV("marimo:scratchpadHistory:v1",[]),QD=Ot(!1),eR=Ot(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(rf),r=[n,...o.filter(i=>i!==n)].slice(0,15);e(rf,r)}),tR={hide_code:!1,disabled:!1},nR=()=>{const t=X.c(69),e=gc(),[n]=Mi(),{theme:o}=ho(),r=A.useRef(null),i=Or(),{createNewCell:s,updateCellCode:a}=zt(),l=e.cellRuntime[uo],c=l==null?void 0:l.output,d=l==null?void 0:l.status,u=l==null?void 0:l.consoleOutputs,f=e.cellData[uo],m=(f==null?void 0:f.code)??"",_=$t(eR),[g,p]=yn(QD),b=We(rf);let x;t[0]!==_||t[1]!==m?(x=()=>{F4({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=x):x=t[2];const y=Qe(x);let v;t[3]!==m||t[4]!==s||t[5]!==i?(v=()=>{m.trim()&&s({code:m,before:!1,cellId:i??"__end__"})},t[3]=m,t[4]=s,t[5]=i,t[6]=v):v=t[6];const S=Qe(v);let k;t[7]!==a?(k=()=>{a({cellId:uo,code:"",formattingChange:!1}),F4({code:""});const de=r.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const N=Qe(k);let E;t[9]!==p||t[10]!==a?(E=de=>{p(!1),a({cellId:uo,code:de,formattingChange:!1});const Ee=r.current;Ee&&Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:de}})},t[9]=p,t[10]=a,t[11]=E):E=t[11];const I=Qe(E),[T,M]=A.useState();let R;t[12]!==m||t[13]!==u||t[14]!==y||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:h.jsx(Mu,{theme:o,allowFocus:!1,showPlaceholder:!1,id:uo,code:m,config:tR,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:de=>{r.current=de},hidden:!1,temporarilyShowCode:jn.NOOP,languageAdapter:T,setLanguageAdapter:M})}),h.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:h.jsx(Tc,{allowExpand:!1,output:c,className:"output-area",cellId:uo,stale:!1,loading:!1})}),h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:h.jsx(Km,{consoleOutputs:u,className:"overflow-auto",stale:!1,cellName:aV,onSubmitDebugger:jn.NOOP,cellId:uo,debuggerActive:!1})})]}),t[12]=m,t[13]=u,t[14]=y,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const B=R;let O;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?h.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:h.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((de,Ee)=>h.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(de),children:h.jsx(pa,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:de.trim(),editable:!1,readOnly:!0})},Ee))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const z=O;let F,V,L,C,$,j,H,Y,Z,G,re;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=Pi.create(uo),V=h.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=V):(F=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(L=hn("cell.run"),t[27]=L):L=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Ki,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==y||t[30]!==g?($=h.jsx(Me,{content:L,children:h.jsx(De,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(up,{size:16}),t[32]=j):j=t[32],t[33]!==N||t[34]!==g?(H=h.jsx(Me,{content:"Clear code and outputs",children:h.jsx(De,{disabled:g,size:"xs",variant:"text",onClick:N,children:j})}),t[33]=N,t[34]=g,t[35]=H):H=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsx(Zi,{size:16}),t[36]=Y):Y=t[36],t[37]!==S||t[38]!==g?(Z=h.jsx(ns,{children:h.jsx(Me,{content:"Insert code",children:h.jsx(De,{disabled:g,size:"xs",variant:"text",onClick:S,children:Y})})}),t[37]=S,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(G=(d==="running"||d==="queued")&&h.jsx(Xn,{className:"inline",size:"small"}),t[40]=d,t[41]=G):G=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(re=h.jsx("div",{className:"flex-1"}),t[42]=re):re=t[42];const ne=g&&"bg-[var(--sky-3)] rounded-none";let te,q;t[43]!==ne?(te=Te(ne),t[43]=ne,t[44]=te):te=t[44],t[45]!==g||t[46]!==p?(q=()=>p(!g),t[45]=g,t[46]=p,t[47]=q):q=t[47];const Q=b.length===0;let ie,ue,le,_e,ce,Ne,je;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ie=h.jsx(bp,{size:16}),t[48]=ie):ie=t[48],t[49]!==te||t[50]!==q||t[51]!==Q?(ue=h.jsx(Me,{content:"Toggle history",children:h.jsx(De,{size:"xs",variant:"text",className:te,onClick:q,disabled:Q,children:ie})}),t[49]=te,t[50]=q,t[51]=Q,t[52]=ue):ue=t[52],t[53]!==$||t[54]!==H||t[55]!==Z||t[56]!==G||t[57]!==ue?(le=h.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,H,Z,G,re,ue]}),t[53]=$,t[54]=H,t[55]=Z,t[56]=G,t[57]=ue,t[58]=le):le=t[58],t[59]!==B?(_e=B(),t[59]=B,t[60]=_e):_e=t[60],t[61]!==z?(ce=z(),t[61]=z,t[62]=ce):ce=t[62],t[63]!==_e||t[64]!==ce?(Ne=h.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[_e,ce]}),t[63]=_e,t[64]=ce,t[65]=Ne):Ne=t[65],t[66]!==le||t[67]!==Ne?(je=h.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[V,le,Ne]}),t[66]=le,t[67]=Ne,t[68]=je):je=t[68],je},oR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(nR,{}),t[0]=e):e=t[0],e},rR=()=>{const t=X.c(16),[e]=Mi(),n=e.package_management.manager;let o;t[0]!==n?(o=[n],t[0]=n,t[1]=o):o=t[1];const{data:r,loading:i,error:s,reload:a}=Yn(lR,o);if(i&&!r){let m;return t[2]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Xn,{size:"medium",centered:!0}),t[2]=m):m=t[2],m}if(s){let m;return t[3]!==s?(m=h.jsx(Yi,{error:s}),t[3]=s,t[4]=m):m=t[4],m}let l;t[5]!==(r==null?void 0:r.packages)?(l=(r==null?void 0:r.packages)||[],t[5]=r==null?void 0:r.packages,t[6]=l):l=t[6];const c=l;let d,u,f;return t[7]!==n||t[8]!==a?(d=h.jsx(iR,{packageManager:n,onSuccess:a}),t[7]=n,t[8]=a,t[9]=d):d=t[9],t[10]!==c||t[11]!==a?(u=h.jsx(sR,{packages:c,onSuccess:a}),t[10]=c,t[11]=a,t[12]=u):u=t[12],t[13]!==d||t[14]!==u?(f=h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),t[13]=d,t[14]=u,t[15]=f):f=t[15],f},iR=({onSuccess:t,packageManager:e})=>{const[n,o]=K.useState(""),[r,i]=K.useState(!1),{handleClick:s}=_a(),a=We(of),l=$t(of);K.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{i(!0);const d=await cV({package:n});d.success?(t(),lt({title:"Package added",description:h.jsxs("span",{children:["The package ",h.jsx(vm,{className:"inline",children:n})," and its dependencies has been added to your environment."]})})):lt({title:"Failed to add package",description:d.error,variant:"danger"})}finally{o(""),i(!1)}};return h.jsxs("div",{className:"flex items-center w-full border-b",children:[h.jsx(A4,{placeholder:`Install packages with ${e}...`,id:q1,icon:r?h.jsx(Xn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):h.jsx(Me,{content:"Change package manager",children:h.jsx(ga,{onClick:()=>s("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),rootClassName:"flex-1 border-none",value:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),c())},onChange:d=>o(d.target.value)}),h.jsx(Me,{delayDuration:300,side:"left",align:"start",content:h.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:",h.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",h.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",h.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",h.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",h.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",h.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:h.jsx(Rm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),h.jsx("button",{type:"button",className:Te("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:c,disabled:!n,children:"Add"})]})},sR=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(En,{title:"No packages",description:"No packages are installed in this environment.",icon:h.jsx(ga,{})}),e[0]=a):a=e[0],a}let r,i,s;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Vm,{children:h.jsxs(Gi,{children:[h.jsx(Tr,{children:"Name"}),h.jsx(Tr,{children:"Version"}),h.jsx(Tr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>h.jsxs(Gi,{className:"group",onClick:async()=>{await bn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[h.jsx(Mr,{children:l.name}),h.jsx(Mr,{children:l.version}),h.jsx(Mr,{children:h.jsx(aR,{packageName:l.name,onSuccess:n})})]},l.name),e[5]=n,e[6]=a):a=e[6],i=o.map(a),e[2]=n,e[3]=o,e[4]=i}else i=e[4];return e[7]!==i?(s=h.jsxs(Um,{className:"overflow-auto flex-1",children:[r,h.jsx($m,{children:i})]}),e[7]=i,e[8]=s):s=e[8],s},aR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return n?h.jsx(Xn,{size:"small",className:"float-right mr-2 h-4 w-4 shrink-0 opacity-50"}):h.jsx("button",{type:"button",className:Te("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible"),onClick:un.stopPropagation(async()=>{try{o(!0);const r=await dV({package:t});r.success?(e(),lt({title:"Package removed",description:h.jsxs("span",{children:["The package ",h.jsx(vm,{className:"inline",children:t})," has been removed from your environment."]})})):lt({title:"Failed to add package",description:r.error,variant:"danger"})}finally{o(!1)}}),children:"Remove"})};function lR(){return lV()}var sf="ScrollArea",[M2,y$]=s4(sf),[cR,Pn]=M2(sf),O2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:i=600,...s}=t,[a,l]=A.useState(null),[c,d]=A.useState(null),[u,f]=A.useState(null),[m,_]=A.useState(null),[g,p]=A.useState(null),[b,x]=A.useState(0),[y,v]=A.useState(0),[S,k]=A.useState(!1),[N,E]=A.useState(!1),I=Ji(e,M=>l(M)),T=uV(r);return h.jsx(cR,{scope:n,type:o,dir:T,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:d,content:u,onContentChange:f,scrollbarX:m,onScrollbarXChange:_,scrollbarXEnabled:S,onScrollbarXEnabledChange:k,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:x,onCornerHeightChange:v,children:h.jsx($i.div,{dir:T,...s,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});O2.displayName=sf;var D2="ScrollAreaViewport",R2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...i}=t,s=Pn(D2,n),a=A.useRef(null),l=Ji(e,a,s.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx($i.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});R2.displayName=D2;var ro="ScrollAreaScrollbar",af=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(ro,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=r,a=t.orientation==="horizontal";return A.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),r.type==="hover"?h.jsx(dR,{...o,ref:e,forceMount:n}):r.type==="scroll"?h.jsx(uR,{...o,ref:e,forceMount:n}):r.type==="auto"?h.jsx(P2,{...o,ref:e,forceMount:n}):r.type==="always"?h.jsx(lf,{...o,ref:e}):null});af.displayName=ro;var dR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(ro,t.__scopeScrollArea),[i,s]=A.useState(!1);return A.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},d=()=>{l=window.setTimeout(()=>s(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),h.jsx(Rc,{present:n||i,children:h.jsx(P2,{"data-state":i?"visible":"hidden",...o,ref:e})})}),uR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(ro,t.__scopeScrollArea),i=t.orientation==="horizontal",s=Bl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return A.useReducer((u,f)=>d[u][f]??u,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),A.useEffect(()=>{const c=r.viewport,d=i?"scrollLeft":"scrollTop";if(c){let u=c[d];const f=()=>{const m=c[d];u!==m&&(l("SCROLL"),s()),u=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,i,l,s]),h.jsx(Rc,{present:n||a!=="hidden",children:h.jsx(lf,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Vn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Vn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),P2=A.forwardRef((t,e)=>{const n=Pn(ro,t.__scopeScrollArea),{forceMount:o,...r}=t,[i,s]=A.useState(!1),a=t.orientation==="horizontal",l=Bl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:d)}},10);return fi(n.viewport,l),fi(n.content,l),h.jsx(Rc,{present:o||i,children:h.jsx(lf,{"data-state":i?"visible":"hidden",...r,ref:e})})}),lf=A.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Pn(ro,t.__scopeScrollArea),i=A.useRef(null),s=A.useRef(0),[a,l]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=U2(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function u(f,m){return function(_,g,p,b="ltr"){const x=zl(p),y=x/2,v=g||y,S=x-v,k=p.scrollbar.paddingStart+v,N=p.scrollbar.size-p.scrollbar.paddingEnd-S,E=p.content-p.viewport,I=b==="ltr"?[0,E]:[-1*E,0];return $2([k,N],I)(_)}(f,s.current,a,m)}return n==="horizontal"?h.jsx(hR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&i.current){const f=V2(r.viewport.scrollLeft,a,r.dir);i.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=u(f,r.dir))}}):n==="vertical"?h.jsx(fR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&i.current){const f=V2(r.viewport.scrollTop,a);i.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=u(f))}}):null}),hR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,i=Pn(ro,t.__scopeScrollArea),[s,a]=A.useState(),l=A.useRef(null),c=Ji(e,l,i.onScrollbarXChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(F2,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":zl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,u)=>{if(i.viewport){const f=i.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),H2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Fl(s.paddingLeft),paddingEnd:Fl(s.paddingRight)}})}})}),fR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,i=Pn(ro,t.__scopeScrollArea),[s,a]=A.useState(),l=A.useRef(null),c=Ji(e,l,i.onScrollbarYChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(F2,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":zl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,u)=>{if(i.viewport){const f=i.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),H2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Fl(s.paddingTop),paddingEnd:Fl(s.paddingBottom)}})}})}),[mR,L2]=M2(ro),F2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:u,...f}=t,m=Pn(ro,n),[_,g]=A.useState(null),p=Ji(e,I=>g(I)),b=A.useRef(null),x=A.useRef(""),y=m.viewport,v=o.content-o.viewport,S=ar(d),k=ar(l),N=Bl(u,10);function E(I){if(b.current){const T=I.clientX-b.current.left,M=I.clientY-b.current.top;c({x:T,y:M})}}return A.useEffect(()=>{const I=T=>{const M=T.target;(_==null?void 0:_.contains(M))&&S(T,v)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,_,v,S]),A.useEffect(k,[o,k]),fi(_,N),fi(m.content,N),h.jsx(mR,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:ar(i),onThumbPointerUp:ar(s),onThumbPositionChange:k,onThumbPointerDown:ar(a),children:h.jsx($i.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Vn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),E(I))}),onPointerMove:Vn(t.onPointerMove,E),onPointerUp:Vn(t.onPointerUp,I=>{const T=I.target;T.hasPointerCapture(I.pointerId)&&T.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=x.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),Ll="ScrollAreaThumb",z2=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=L2(Ll,t.__scopeScrollArea);return h.jsx(Rc,{present:n||r.hasThumb,children:h.jsx(pR,{ref:e,...o})})}),pR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,i=Pn(Ll,n),s=L2(Ll,n),{onThumbPositionChange:a}=s,l=Ji(e,u=>s.onThumbChange(u)),c=A.useRef(void 0),d=Bl(()=>{c.current&&(c.current(),c.current=void 0)},100);return A.useEffect(()=>{const u=i.viewport;if(u){const f=()=>{if(d(),!c.current){const m=_R(u,a);c.current=m,a()}};return a(),u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[i.viewport,d,a]),h.jsx($i.div,{"data-state":s.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Vn(t.onPointerDownCapture,u=>{const f=u.target.getBoundingClientRect(),m=u.clientX-f.left,_=u.clientY-f.top;s.onThumbPointerDown({x:m,y:_})}),onPointerUp:Vn(t.onPointerUp,s.onThumbPointerUp)})});z2.displayName=Ll;var cf="ScrollAreaCorner",B2=A.forwardRef((t,e)=>{const n=Pn(cf,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?h.jsx(gR,{...t,ref:e}):null});B2.displayName=cf;var gR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Pn(cf,n),[i,s]=A.useState(0),[a,l]=A.useState(0),c=!!(i&&a);return fi(r.scrollbarX,()=>{var u;const d=((u=r.scrollbarX)==null?void 0:u.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),fi(r.scrollbarY,()=>{var u;const d=((u=r.scrollbarY)==null?void 0:u.offsetWidth)||0;r.onCornerWidthChange(d),s(d)}),c?h.jsx($i.div,{...o,ref:e,style:{width:i,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Fl(t){return t?parseInt(t,10):0}function U2(t,e){const n=t/e;return isNaN(n)?0:n}function zl(t){const e=U2(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function V2(t,e,n="ltr"){const o=zl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-r,s=e.content-e.viewport,a=i-o,l=fV(t,n==="ltr"?[0,s]:[-1*s,0]);return $2([0,s],[0,a])(l)}function $2(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function H2(t,e){return t>0&&t<e}var _R=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const i={left:t.scrollLeft,top:t.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&e(),n=i,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Bl(t,e){const n=ar(t),o=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(o.current),[]),A.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function fi(t,e){const n=ar(e);hV(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var W2=O2,bR=R2,yR=B2;const q2=A.forwardRef((t,e)=>{const n=X.c(15);let o,r,i,s,a,l,c,d;return n[0]!==t?({className:r,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]),n[4]!==r?(s=Te("relative overflow-hidden",r),n[4]=r,n[5]=s):s=n[5],n[6]!==o?(a=h.jsx(bR,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(G2,{}),c=h.jsx(yR,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==i||n[11]!==e||n[12]!==s||n[13]!==a?(d=h.jsxs(W2,{ref:e,className:s,...i,children:[a,l,c]}),n[10]=i,n[11]=e,n[12]=s,n[13]=a,n[14]=d):d=n[14],d});q2.displayName=W2.displayName;const G2=A.forwardRef((t,e)=>{const n=X.c(14);let o,r,i;n[0]!==t?({className:o,orientation:i,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=i):(o=n[1],r=n[2],i=n[3]);const s=i===void 0?"vertical":i,a=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,u;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Te("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(z2,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==s||n[10]!==r||n[11]!==e||n[12]!==c?(u=h.jsx(af,{ref:e,orientation:s,className:c,...r,children:d}),n[9]=s,n[10]=r,n[11]=e,n[12]=c,n[13]=u):u=n[13],u});G2.displayName=af.displayName;const xR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vR={};function Y2(t,e){return(vR.jsx?wR:xR).test(t)}const kR=/[ \t\n\f\r]/g;function J2(t){return t.replace(kR,"")===""}class Vs{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function K2(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Vs(n,o,e)}function df(t){return t.toLowerCase()}Vs.prototype.property={},Vs.prototype.normal={},Vs.prototype.space=null;class Ln{constructor(e,n){this.property=e,this.attribute=n}}Ln.prototype.space=null,Ln.prototype.boolean=!1,Ln.prototype.booleanish=!1,Ln.prototype.overloadedBoolean=!1,Ln.prototype.number=!1,Ln.prototype.commaSeparated=!1,Ln.prototype.spaceSeparated=!1,Ln.prototype.commaOrSpaceSeparated=!1,Ln.prototype.mustUseProperty=!1,Ln.prototype.defined=!1;let SR=0;const tt=vr(),Lt=vr(),X2=vr(),ye=vr(),bt=vr(),mi=vr(),vn=vr();function vr(){return 2**++SR}const uf=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:Lt,commaOrSpaceSeparated:vn,commaSeparated:mi,number:ye,overloadedBoolean:X2,spaceSeparated:bt},Symbol.toStringTag,{value:"Module"})),hf=Object.keys(uf);class ff extends Ln{constructor(e,n,o,r){let i=-1;if(super(e,n),Z2(this,"space",r),typeof o=="number")for(;++i<hf.length;){const s=hf[i];Z2(this,hf[i],(o&uf[s])===uf[s])}}}function Z2(t,e,n){n&&(t[e]=n)}ff.prototype.defined=!0;const CR={}.hasOwnProperty;function pi(t){const e={},n={};let o;for(o in t.properties)if(CR.call(t.properties,o)){const r=t.properties[o],i=new ff(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(i.mustUseProperty=!0),e[o]=i,n[df(o)]=o,n[df(i.attribute)]=o}return new Vs(e,n,t.space)}const Q2=pi({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),ek=pi({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function tk(t,e){return e in t?t[e]:e}function nk(t,e){return tk(t,e.toLowerCase())}const ok=pi({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:nk,properties:{xmlns:null,xmlnsXLink:null}}),rk=pi({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Lt,ariaAutoComplete:null,ariaBusy:Lt,ariaChecked:Lt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:bt,ariaCurrent:null,ariaDescribedBy:bt,ariaDetails:null,ariaDisabled:Lt,ariaDropEffect:bt,ariaErrorMessage:null,ariaExpanded:Lt,ariaFlowTo:bt,ariaGrabbed:Lt,ariaHasPopup:null,ariaHidden:Lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bt,ariaLevel:ye,ariaLive:null,ariaModal:Lt,ariaMultiLine:Lt,ariaMultiSelectable:Lt,ariaOrientation:null,ariaOwns:bt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Lt,ariaReadOnly:Lt,ariaRelevant:null,ariaRequired:Lt,ariaRoleDescription:bt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Lt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null}}),NR=pi({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:nk,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:mi,acceptCharset:bt,accessKey:bt,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:bt,autoFocus:tt,autoPlay:tt,blocking:bt,capture:null,charSet:null,checked:tt,cite:null,className:bt,cols:ye,colSpan:null,content:null,contentEditable:Lt,controls:tt,controlsList:bt,coords:ye|mi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:X2,draggable:Lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:bt,height:ye,hidden:tt,high:ye,href:null,hrefLang:null,htmlFor:bt,httpEquiv:bt,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:bt,itemRef:bt,itemScope:tt,itemType:bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,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:tt,optimum:ye,pattern:null,ping:bt,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:bt,required:tt,reversed:tt,rows:ye,rowSpan:ye,sandbox:bt,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:Lt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Lt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:ye,security:null,unselectable:null}}),jR=pi({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:tk,properties:{about:vn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:bt,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:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,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:mi,g2:mi,glyphName:mi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,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:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vn,rev:vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vn,requiredFeatures:vn,requiredFonts:vn,requiredFormats:vn,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),ER=/^data[-\w.:]+$/i,ik=/-[a-z]/g,IR=/[A-Z]/g;function AR(t){return"-"+t.toLowerCase()}function TR(t){return t.charAt(1).toUpperCase()}const MR={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"},OR=K2([ek,Q2,ok,rk,NR],"html"),mf=K2([ek,Q2,ok,rk,jR],"svg"),sk=z4(mV()),DR=sk.default||sk,ak=lk("end"),pf=lk("start");function lk(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function $s(t){return t&&typeof t=="object"?"position"in t||"type"in t?ck(t.position):"start"in t||"end"in t?ck(t):"line"in t||"column"in t?gf(t):"":""}function gf(t){return dk(t&&t.line)+":"+dk(t&&t.column)}function ck(t){return gf(t&&t.start)+"-"+gf(t&&t.end)}function dk(t){return t&&typeof t=="number"?t:1}class nn extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",i={},s=!1;if(n&&(i="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!i.cause&&e&&(s=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?i.ruleId=o:(i.source=o.slice(0,l),i.ruleId=o.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=$s(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}nn.prototype.file="",nn.prototype.name="",nn.prototype.reason="",nn.prototype.message="",nn.prototype.stack="",nn.prototype.column=void 0,nn.prototype.line=void 0,nn.prototype.ancestors=void 0,nn.prototype.cause=void 0,nn.prototype.fatal=void 0,nn.prototype.place=void 0,nn.prototype.ruleId=void 0,nn.prototype.source=void 0;const _f={}.hasOwnProperty,RR=new Map,PR=/[A-Z]/g,LR=/-([a-z])/g,FR=new Set(["table","tbody","thead","tfoot","tr"]),zR=new Set(["td","th"]),uk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BR(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(s,a){return l;function l(c,d,u,f){const m=Array.isArray(u.children),_=pf(c);return a(d,u,f,m,{columnNumber:_?_.column-1:void 0,fileName:s,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(s,a,l){return c;function c(d,u,f,m){const _=Array.isArray(f.children)?l:a;return m?_(u,f,m):_(u,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?mf:OR,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=hk(r,t,void 0);return i&&typeof i!="string"?i:r.create(t,r.Fragment,{children:i||void 0},void 0)}function hk(t,e,n){return e.type==="element"?function(o,r,i){const s=o.schema;let a=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=mf,o.schema=a),o.ancestors.push(r);const l=mk(o,r.tagName,!1),c=function(u,f){const m={};let _,g;for(g in f.properties)if(g!=="children"&&_f.call(f.properties,g)){const p=UR(u,g,f.properties[g]);if(p){const[b,x]=p;u.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&zR.has(f.tagName)?_=x:m[b]=x}}return _&&((m.style||(m.style={}))[u.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),m}(o,r);let d=yf(o,r);return FR.has(r.tagName)&&(d=d.filter(function(u){return typeof u!="string"||!(typeof(f=u)=="object"?f.type==="text"&&J2(f.value):J2(f));var f})),fk(o,c,l,r),bf(c,d),o.ancestors.pop(),o.schema=s,o.create(r,l,c,i)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const i=r.data.estree.body[0];return i.type,o.evaluater.evaluateExpression(i.expression)}Hs(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,i){const s=o.schema;let a=s;r.name==="svg"&&s.space==="html"&&(a=mf,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:mk(o,r.name,!0),c=function(u,f){const m={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&u.evaluater){const g=_.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,u.evaluater.evaluateExpression(b.argument))}else Hs(u,f.position);else{const g=_.name;let p;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&u.evaluater){const b=_.value.data.estree.body[0];b.type,p=u.evaluater.evaluateExpression(b.expression)}else Hs(u,f.position);else p=_.value===null||_.value;m[g]=p}return m}(o,r),d=yf(o,r);return fk(o,c,l,r),bf(c,d),o.ancestors.pop(),o.schema=s,o.create(r,l,c,i)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);Hs(o,r.position)}(t,e):e.type==="root"?function(o,r,i){const s={};return bf(s,yf(o,r)),o.create(r,o.Fragment,s,i)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function fk(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function bf(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function yf(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:RR;for(;++o<e.children.length;){const i=e.children[o];let s;if(t.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=r.get(l)||0;s=l+"-"+c,r.set(l,c+1)}}const a=hk(t,i,s);a!==void 0&&n.push(a)}return n}function UR(t,e,n){const o=function(r,i){const s=df(i);let a=i,l=Ln;if(s in r.normal)return r.property[r.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&ER.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(ik,TR);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!ik.test(c)){let d=c.replace(IR,AR);d.charAt(0)!=="-"&&(d="-"+d),i="data"+d}}l=ff}return new l(a,i)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const i={};return(r[r.length-1]===""?[...r,""]:r).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(i,s){const a={};try{DR(s,l)}catch(c){if(!i.ignoreInvalidStyle){const d=c,u=new nn("Cannot parse `style` attribute",{ancestors:i.ancestors,cause:d,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=i.filePath||void 0,u.url=uk+"#cannot-parse-style-attribute",u}}return a;function l(c,d){let u=c;u.slice(0,2)!=="--"&&(u.slice(0,4)==="-ms-"&&(u="ms-"+u.slice(4)),u=u.replace(LR,$R)),a[u]=d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(i){const s={};let a;for(a in i)_f.call(i,a)&&(s[VR(a)]=i[a]);return s}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?MR[o.property]||o.property:o.attribute,n]}}function mk(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let i,s=-1;for(;++s<r.length;){const a=Y2(r[s])?{type:"Identifier",name:r[s]}:{type:"Literal",value:r[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}o=i}else o=Y2(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return _f.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);Hs(t)}function Hs(t,e){const n=new nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=uk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function VR(t){let e=t.replace(PR,HR);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function $R(t,e){return e.toUpperCase()}function HR(t){return"-"+t.toLowerCase()}const xf={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"]},Ul={};function pk(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return gk(t.children,e,n)}return Array.isArray(t)?gk(t,e,n):""}function gk(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=pk(t[r],e,n);return o.join("")}const _k=document.createElement("i");function wf(t){const e="&"+t+";";_k.innerHTML=e;const n=_k.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function io(t,e,n,o){const r=t.length;let i,s=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)i=Array.from(o),i.unshift(e,n),t.splice(...i);else for(n&&t.splice(e,n);s<o.length;)i=o.slice(s,s+1e4),i.unshift(e,0),t.splice(...i),s+=1e4,e+=1e4}function Fn(t,e){return t.length>0?(io(t,t.length,0,e),t):e}const bk={}.hasOwnProperty;function WR(t,e){let n;for(n in e){const o=(bk.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let i;if(r)for(i in r){bk.call(o,i)||(o[i]=[]);const s=r[i];qR(o[i],Array.isArray(s)?s:s?[s]:[])}}}function qR(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);io(t,0,0,o)}function yk(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function gi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const so=er(/[A-Za-z]/),kn=er(/[\dA-Za-z]/),GR=er(/[#-'*+\--9=?A-Z^-~]/);function vf(t){return t!==null&&(t<32||t===127)}const kf=er(/\d/),YR=er(/[\dA-Fa-f]/),JR=er(/[!-/:-@[-`{-~]/);function Ke(t){return t!==null&&t<-2}function gn(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const KR=er(new RegExp("\\p{P}|\\p{S}","u")),XR=er(/\s/);function er(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function _i(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const i=t.charCodeAt(n);let s="";if(i===37&&kn(t.charCodeAt(n+1))&&kn(t.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),r=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(e.push(t.slice(o,n),encodeURIComponent(s)),o=n+r+1,s=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function yt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let i=0;return function(a){return ht(a)?(t.enter(n),s(a)):e(a)};function s(a){return ht(a)&&i++<r?(t.consume(a),s):(t.exit(n),e(a))}}const ZR={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(i){return i===null?void t.consume(i):(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),yt(t,e,"linePrefix"))},function(i){return t.enter("paragraph"),o(i)});let n;return e;function o(i){const s=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=s),n=s,r(i)}function r(i){return i===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(i)):Ke(i)?(t.consume(i),t.exit("chunkText"),o):(t.consume(i),r)}}},QR={tokenize:function(t){const e=this,n=[];let o,r,i,s=0;return a;function a(y){if(s<n.length){const v=n[s];return e.containerState=v[1],t.attempt(v[0].continuation,l,c)(y)}return c(y)}function l(y){if(s++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let S,k=v;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){S=e.events[k][1].end;break}b(s);let N=v;for(;N<e.events.length;)e.events[N][1].end={...S},N++;return io(e.events,k+1,0,e.events.slice(v)),e.events.length=N,c(y)}return a(y)}function c(y){if(s===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(xk,d,u)(y)}function d(y){return o&&x(),b(s),f(y)}function u(y){return e.parser.lazy[e.now().line]=s!==n.length,i=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(xk,m,_)(y)}function m(y){return s++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Ke(y)?(t.consume(y),p(t.exit("chunkFlow")),s=0,e.interrupt=void 0,a):(t.consume(y),g)}function p(y,v){const S=e.sliceStream(y);if(v&&S.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(S),e.parser.lazy[y.start.line]){let k=o.events.length;for(;k--;)if(o.events[k][1].start.offset<i&&(!o.events[k][1].end||o.events[k][1].end.offset>i))return;const N=e.events.length;let E,I,T=N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(E){I=e.events[T][1].end;break}E=!0}for(b(s),k=N;k<e.events.length;)e.events[k][1].end={...I},k++;io(e.events,T+1,0,e.events.slice(N)),e.events.length=k}}function b(y){let v=n.length;for(;v-- >y;){const S=n[v];e.containerState=S[1],S[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},xk={tokenize:function(t,e,n){return yt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function wk(t){return t===null||gn(t)||XR(t)?1:KR(t)?2:void 0}function Sf(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const i=t[r].resolveAll;i&&!o.includes(i)&&(e=i(e,n),o.push(i))}return e}const Cf={name:"attention",resolveAll:function(t,e){let n,o,r,i,s,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const u={...t[n][1].end},f={...t[d][1].start};vk(u,-a),vk(f,a),i={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...t[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...i.start},end:{...s.end}},t[n][1].end={...i.start},t[d][1].start={...s.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Fn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Fn(l,[["enter",o,e],["enter",i,e],["exit",i,e],["enter",r,e]]),l=Fn(l,Sf(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=Fn(l,[["exit",r,e],["enter",s,e],["exit",s,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=Fn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,io(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=wk(o);let i;return function(a){return i=a,t.enter("attentionSequence"),s(a)};function s(a){if(a===i)return t.consume(a),s;const l=t.exit("attentionSequence"),c=wk(a),d=!c||c===2&&r||n.includes(a),u=!r||r===2&&c||n.includes(o);return l._open=!!(i===42?d:d&&(r||!u)),l._close=!!(i===42?u:u&&(c||!d)),e(a)}}};function vk(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const eP={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return so(f)?(t.consume(f),i):f===64?n(f):l(f)}function i(f){return f===43||f===45||f===46||kn(f)?(o=1,s(f)):l(f)}function s(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||kn(f))&&o++<32?(t.consume(f),s):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||vf(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):GR(f)?(t.consume(f),l):n(f)}function c(f){return kn(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):u(f)}function u(f){if((f===45||kn(f))&&o++<63){const m=f===45?u:d;return t.consume(f),m}return n(f)}}},Vl={partial:!0,tokenize:function(t,e,n){return function(r){return ht(r)?yt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ke(r)?e(r):n(r)}}},kk={continuation:{tokenize:function(t,e,n){const o=this;return function(i){return ht(i)?yt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):r(i)};function r(i){return t.attempt(kk,e,n)(i)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(i){if(i===62){const s=o.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(i),t.exit("blockQuoteMarker"),r}return n(i)};function r(i){return ht(i)?(t.enter("blockQuotePrefixWhitespace"),t.consume(i),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(i))}}},Sk={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return JR(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ck={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,i,s=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,i=kn,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,i=YR,c):(t.enter("characterReferenceValue"),r=7,i=kf,c(d))}function c(d){if(d===59&&s){const u=t.exit("characterReferenceValue");return i!==kn||wf(o.sliceSerialize(u))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return i(d)&&s++<r?(t.consume(d),c):n(d)}}},Nk={partial:!0,tokenize:function(t,e,n){const o=this;return function(i){return i===null?n(i):(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r)};function r(i){return o.parser.lazy[o.now().line]?n(i):e(i)}}},jk={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,S){let k=0;return N;function N(R){return y.enter("lineEnding"),y.consume(R),y.exit("lineEnding"),E}function E(R){return y.enter("codeFencedFence"),ht(R)?yt(y,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):I(R)}function I(R){return R===i?(y.enter("codeFencedFenceSequence"),T(R)):S(R)}function T(R){return R===i?(k++,y.consume(R),T):k>=a?(y.exit("codeFencedFenceSequence"),ht(R)?yt(y,M,"whitespace")(R):M(R)):S(R)}function M(R){return R===null||Ke(R)?(y.exit("codeFencedFence"),v(R)):S(R)}}};let i,s=0,a=0;return function(y){return function(v){const S=o.events[o.events.length-1];return s=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,i=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===i?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ht(y)?yt(t,c,"whitespace")(y):c(y))}function c(y){return y===null||Ke(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Nk,m,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(y)):ht(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),yt(t,u,"whitespace")(y)):y===96&&y===i?n(y):(t.consume(y),d)}function u(y){return y===null||Ke(y)?c(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(y)):y===96&&y===i?n(y):(t.consume(y),f)}function m(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return s>0&&ht(y)?yt(t,p,"linePrefix",s+1)(y):p(y)}function p(y){return y===null||Ke(y)?t.check(Nk,m,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Ke(y)?(t.exit("codeFlowValue"),p(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},Nf={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),yt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?i(l):n(l)}function i(l){return l===null?a(l):Ke(l)?t.attempt(tP,i,a)(l):(t.enter("codeFlowValue"),s(l))}function s(l){return l===null||Ke(l)?(t.exit("codeFlowValue"),i(l)):(t.consume(l),s)}function a(l){return t.exit("codeIndented"),e(l)}}},tP={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(s){return o.parser.lazy[o.now().line]?n(s):Ke(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):yt(t,i,"linePrefix",5)(s)}function i(s){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):Ke(s)?r(s):n(s)}}},nP={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,i=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),s(d)};function s(d){return d===96?(t.consume(d),i++,s):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Ke(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Ke(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class oP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Ws(this.left,o),i.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),Ws(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ws(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Ws(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ws(this.left,n.reverse())}}}function Ws(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Ek(t){const e={};let n,o,r,i,s,a,l,c=-1;const d=new oP(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,rP(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(i=d.get(r),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank");)i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},s=d.slice(o,c),s.unshift(n),d.splice(o,c-o+1,s))}}return io(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function rP(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const i=[],s=n._tokenizer||o.parser[n.contentType](n.start),a=s.events,l=[],c={};let d,u,f=-1,m=n,_=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);i.push(r),m._tokenizer||(d=o.sliceStream(m),m.next||d.push(null),u&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),u=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),x=i.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const iP={resolve:function(t){return Ek(t),t},tokenize:function(t,e){let n;return function(s){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(s)};function o(s){return s===null?r(s):Ke(s)?t.check(sP,i,r)(s):(t.consume(s),o)}function r(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function i(s){return t.consume(s),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},sP={partial:!0,tokenize:function(t,e,n){const o=this;return function(i){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),yt(t,r,"linePrefix")};function r(i){if(i===null||Ke(i))return n(i);const s=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(i):t.interrupt(o.parser.constructs.flow,n,e)(i)}}};function Ik(t,e,n,o,r,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(i),t.consume(p),t.exit(i),u):p===null||p===32||p===41||vf(p)?n(p):(t.enter(o),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(p))};function u(p){return p===62?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),u(p)):p===null||p===60||Ke(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function _(p){return d||p!==null&&p!==41&&!gn(p)?d<c&&p===40?(t.consume(p),d++,_):p===41?(t.consume(p),d--,_):p===null||p===32||p===40||vf(p)?n(p):(t.consume(p),p===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),_):_(p)}}function Ak(t,e,n,o,r,i){const s=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(i),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(t.exit(i),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ke(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ke(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ht(f)),f===92?u:d)}function u(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function Tk(t,e,n,o,r,i){let s;return function(u){return u===34||u===39||u===40?(t.enter(o),t.enter(r),t.consume(u),t.exit(r),s=u===40?41:u,a):n(u)};function a(u){return u===s?(t.enter(r),t.consume(u),t.exit(r),t.exit(o),e):(t.enter(i),l(u))}function l(u){return u===s?(t.exit(i),a(s)):u===null?n(u):Ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),yt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(u))}function c(u){return u===s||u===null||Ke(u)?(t.exit("chunkString"),l(u)):(t.consume(u),u===92?d:c)}function d(u){return u===s||u===92?(t.consume(u),c):c(u)}}function qs(t,e){let n;return function o(r){return Ke(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ht(r)?yt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const aP={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(u){return t.enter("definition"),function(f){return Ak.call(o,t,i,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(u)};function i(u){return r=gi(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),u===58?(t.enter("definitionMarker"),t.consume(u),t.exit("definitionMarker"),s):n(u)}function s(u){return gn(u)?qs(t,a)(u):a(u)}function a(u){return Ik(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(u)}function l(u){return t.attempt(lP,c,c)(u)}function c(u){return ht(u)?yt(t,d,"whitespace")(u):d(u)}function d(u){return u===null||Ke(u)?(t.exit("definition"),o.parser.defined.push(r),e(u)):n(u)}}},lP={partial:!0,tokenize:function(t,e,n){return function(s){return gn(s)?qs(t,o)(s):n(s)};function o(s){return Tk(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function r(s){return ht(s)?yt(t,i,"whitespace")(s):i(s)}function i(s){return s===null||Ke(s)?e(s):n(s)}}},cP={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ke(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},dP={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,i=3;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(n={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},o={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},io(t,i,r-i+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||gn(l)?(t.exit("atxHeadingSequence"),i(l)):n(l)}function i(l){return l===35?(t.enter("atxHeadingSequence"),s(l)):l===null||Ke(l)?(t.exit("atxHeading"),e(l)):ht(l)?yt(t,i,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function s(l){return l===35?(t.consume(l),s):(t.exit("atxHeadingSequence"),i(l))}function a(l){return l===null||l===35||gn(l)?(t.exit("atxHeadingText"),i(l)):(t.consume(l),a)}}},uP=["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"],Mk=["pre","script","style","textarea"],hP={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,i,s,a,l;return function(j){return function(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),c}(j)};function c(j){return j===33?(t.consume(j),d):j===47?(t.consume(j),i=!0,m):j===63?(t.consume(j),r=3,o.interrupt?e:L):so(j)?(t.consume(j),s=String.fromCharCode(j),_):n(j)}function d(j){return j===45?(t.consume(j),r=2,u):j===91?(t.consume(j),r=5,a=0,f):so(j)?(t.consume(j),r=4,o.interrupt?e:L):n(j)}function u(j){return j===45?(t.consume(j),o.interrupt?e:L):n(j)}function f(j){return j==="CDATA[".charCodeAt(a++)?(t.consume(j),a===6?o.interrupt?e:T:f):n(j)}function m(j){return so(j)?(t.consume(j),s=String.fromCharCode(j),_):n(j)}function _(j){if(j===null||j===47||j===62||gn(j)){const H=j===47,Y=s.toLowerCase();return H||i||!Mk.includes(Y)?uP.includes(s.toLowerCase())?(r=6,H?(t.consume(j),g):o.interrupt?e(j):T(j)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(j):i?p(j):b(j)):(r=1,o.interrupt?e(j):T(j))}return j===45||kn(j)?(t.consume(j),s+=String.fromCharCode(j),_):n(j)}function g(j){return j===62?(t.consume(j),o.interrupt?e:T):n(j)}function p(j){return ht(j)?(t.consume(j),p):E(j)}function b(j){return j===47?(t.consume(j),E):j===58||j===95||so(j)?(t.consume(j),x):ht(j)?(t.consume(j),b):E(j)}function x(j){return j===45||j===46||j===58||j===95||kn(j)?(t.consume(j),x):y(j)}function y(j){return j===61?(t.consume(j),v):ht(j)?(t.consume(j),y):b(j)}function v(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),l=j,S):ht(j)?(t.consume(j),v):k(j)}function S(j){return j===l?(t.consume(j),l=null,N):j===null||Ke(j)?n(j):(t.consume(j),S)}function k(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||gn(j)?y(j):(t.consume(j),k)}function N(j){return j===47||j===62||ht(j)?b(j):n(j)}function E(j){return j===62?(t.consume(j),I):n(j)}function I(j){return j===null||Ke(j)?T(j):ht(j)?(t.consume(j),I):n(j)}function T(j){return j===45&&r===2?(t.consume(j),O):j===60&&r===1?(t.consume(j),z):j===62&&r===4?(t.consume(j),C):j===63&&r===3?(t.consume(j),L):j===93&&r===5?(t.consume(j),V):!Ke(j)||r!==6&&r!==7?j===null||Ke(j)?(t.exit("htmlFlowData"),M(j)):(t.consume(j),T):(t.exit("htmlFlowData"),t.check(fP,$,M)(j))}function M(j){return t.check(mP,R,$)(j)}function R(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),B}function B(j){return j===null||Ke(j)?M(j):(t.enter("htmlFlowData"),T(j))}function O(j){return j===45?(t.consume(j),L):T(j)}function z(j){return j===47?(t.consume(j),s="",F):T(j)}function F(j){if(j===62){const H=s.toLowerCase();return Mk.includes(H)?(t.consume(j),C):T(j)}return so(j)&&s.length<8?(t.consume(j),s+=String.fromCharCode(j),F):T(j)}function V(j){return j===93?(t.consume(j),L):T(j)}function L(j){return j===62?(t.consume(j),C):j===45&&r===2?(t.consume(j),L):T(j)}function C(j){return j===null||Ke(j)?(t.exit("htmlFlowData"),$(j)):(t.consume(j),C)}function $(j){return t.exit("htmlFlow"),e(j)}}},fP={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Vl,e,n)}}},mP={partial:!0,tokenize:function(t,e,n){const o=this;return function(i){return Ke(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):n(i)};function r(i){return o.parser.lazy[o.now().line]?n(i):e(i)}}},pP={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,i,s;return function(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),a};function a(C){return C===33?(t.consume(C),l):C===47?(t.consume(C),v):C===63?(t.consume(C),x):so(C)?(t.consume(C),N):n(C)}function l(C){return C===45?(t.consume(C),c):C===91?(t.consume(C),i=0,m):so(C)?(t.consume(C),b):n(C)}function c(C){return C===45?(t.consume(C),f):n(C)}function d(C){return C===null?n(C):C===45?(t.consume(C),u):Ke(C)?(s=d,F(C)):(t.consume(C),d)}function u(C){return C===45?(t.consume(C),f):d(C)}function f(C){return C===62?z(C):C===45?u(C):d(C)}function m(C){return C==="CDATA[".charCodeAt(i++)?(t.consume(C),i===6?_:m):n(C)}function _(C){return C===null?n(C):C===93?(t.consume(C),g):Ke(C)?(s=_,F(C)):(t.consume(C),_)}function g(C){return C===93?(t.consume(C),p):_(C)}function p(C){return C===62?z(C):C===93?(t.consume(C),p):_(C)}function b(C){return C===null||C===62?z(C):Ke(C)?(s=b,F(C)):(t.consume(C),b)}function x(C){return C===null?n(C):C===63?(t.consume(C),y):Ke(C)?(s=x,F(C)):(t.consume(C),x)}function y(C){return C===62?z(C):x(C)}function v(C){return so(C)?(t.consume(C),S):n(C)}function S(C){return C===45||kn(C)?(t.consume(C),S):k(C)}function k(C){return Ke(C)?(s=k,F(C)):ht(C)?(t.consume(C),k):z(C)}function N(C){return C===45||kn(C)?(t.consume(C),N):C===47||C===62||gn(C)?E(C):n(C)}function E(C){return C===47?(t.consume(C),z):C===58||C===95||so(C)?(t.consume(C),I):Ke(C)?(s=E,F(C)):ht(C)?(t.consume(C),E):z(C)}function I(C){return C===45||C===46||C===58||C===95||kn(C)?(t.consume(C),I):T(C)}function T(C){return C===61?(t.consume(C),M):Ke(C)?(s=T,F(C)):ht(C)?(t.consume(C),T):E(C)}function M(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),r=C,R):Ke(C)?(s=M,F(C)):ht(C)?(t.consume(C),M):(t.consume(C),B)}function R(C){return C===r?(t.consume(C),r=void 0,O):C===null?n(C):Ke(C)?(s=R,F(C)):(t.consume(C),R)}function B(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||gn(C)?E(C):(t.consume(C),B)}function O(C){return C===47||C===62||gn(C)?E(C):n(C)}function z(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function F(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),V}function V(C){return ht(C)?yt(t,L,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):L(C)}function L(C){return t.enter("htmlTextData"),s(C)}}},jf={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&io(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,i,s=t.length,a=0;for(;s--;)if(n=t[s][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[s][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[s][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=s,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=s);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return i=[["enter",l,e],["enter",c,e]],i=Fn(i,t.slice(o+1,o+a+3)),i=Fn(i,[["enter",d,e]]),i=Fn(i,Sf(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),i=Fn(i,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),i=Fn(i,t.slice(r+1)),i=Fn(i,[["exit",l,e]]),io(t,o,t.length,i),t},tokenize:function(t,e,n){const o=this;let r,i,s=o.events.length;for(;s--;)if((o.events[s][1].type==="labelImage"||o.events[s][1].type==="labelLink")&&!o.events[s][1]._balanced){r=o.events[s][1];break}return function(u){return r?r._inactive?d(u):(i=o.parser.defined.includes(gi(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelEnd"),a):n(u)};function a(u){return u===40?t.attempt(gP,c,i?c:d)(u):u===91?t.attempt(_P,c,i?l:d)(u):i?c(u):d(u)}function l(u){return t.attempt(bP,c,d)(u)}function c(u){return e(u)}function d(u){return r._balanced=!0,n(u)}}},gP={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return gn(d)?qs(t,r)(d):r(d)}function r(d){return d===41?c(d):Ik(t,i,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function i(d){return gn(d)?qs(t,a)(d):c(d)}function s(d){return n(d)}function a(d){return d===34||d===39||d===40?Tk(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return gn(d)?qs(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},_P={tokenize:function(t,e,n){const o=this;return function(s){return Ak.call(o,t,r,i,"reference","referenceMarker","referenceString")(s)};function r(s){return o.parser.defined.includes(gi(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(s):n(s)}function i(s){return n(s)}}},bP={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},yP={name:"labelStartImage",resolveAll:jf.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),r};function r(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),i):n(s)}function i(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},xP={name:"labelStartLink",resolveAll:jf.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelLink"),r};function r(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},Ef={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),yt(t,e,"linePrefix")}}},$l={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,i(l)}(a)};function i(a){return a===o?(t.enter("thematicBreakSequence"),s(a)):r>=3&&(a===null||Ke(a))?(t.exit("thematicBreak"),e(a)):n(a)}function s(a){return a===o?(t.consume(a),r++,s):(t.exit("thematicBreakSequence"),ht(a)?yt(t,i,"whitespace")(a):i(a))}}},_n={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(Vl,r,i);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,yt(t,e,"listItemIndent",o.containerState.size+1)(a)}function i(a){return o.containerState.furtherBlankLines||!ht(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,s(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(vP,e,s)(a))}function s(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,yt(t,t.attempt(_n,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,s=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:kf(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check($l,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return kf(f)&&++s<10?(t.consume(f),a):(!o.interrupt||s<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(Vl,o.interrupt?n:c,t.attempt(wP,u,d))}function c(f){return o.containerState.initialBlankLine=!0,i++,u(f)}function d(f){return ht(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),u):n(f)}function u(f){return o.containerState.size=i+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},wP={partial:!0,tokenize:function(t,e,n){const o=this;return yt(t,function(r){const i=o.events[o.events.length-1];return!ht(r)&&i&&i[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},vP={partial:!0,tokenize:function(t,e,n){const o=this;return yt(t,function(r){const i=o.events[o.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Ok={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,i=t.length;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){n=i;break}t[i][1].type==="paragraph"&&(o=i)}else t[i][1].type==="content"&&t.splice(i,1),r||t[i][1].type!=="definition"||(r=i);const s={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",s,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=s,t.push(["exit",s,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),i(d)}(a)):n(a)};function i(a){return a===r?(t.consume(a),i):(t.exit("setextHeadingLineSequence"),ht(a)?yt(t,s,"lineSuffix")(a):s(a))}function s(a){return a===null||Ke(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},kP={tokenize:function(t){const e=this,n=t.attempt(Vl,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,yt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(iP,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},SP={resolveAll:Rk()},CP=Dk("string"),NP=Dk("text");function Dk(t){return{resolveAll:Rk(t==="text"?jP:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,i,s);return i;function i(c){return l(c)?r(c):s(c)}function s(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let u=-1;if(d)for(;++u<d.length;){const f=d[u];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Rk(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function jP(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let i,s=r.length,a=-1,l=0;for(;s--;){const c=r[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)i=!0,l++;else if(c!==-1){s++;break}}if(l){const c={type:n===t.length||i||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:o.start._bufferIndex+a,_index:o.start._index+s,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const EP={42:_n,43:_n,45:_n,48:_n,49:_n,50:_n,51:_n,52:_n,53:_n,54:_n,55:_n,56:_n,57:_n,62:kk},IP={91:aP},AP={[-2]:Nf,[-1]:Nf,32:Nf},TP={35:dP,42:$l,45:[Ok,$l],60:hP,61:Ok,95:$l,96:jk,126:jk},MP={38:Ck,92:Sk},OP={[-5]:Ef,[-4]:Ef,[-3]:Ef,33:yP,38:Ck,42:Cf,60:[eP,pP],91:xP,92:[cP,Sk],93:jf,95:Cf,96:nP},DP={null:[Cf,SP]},RP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:IP,disable:{null:[]},document:EP,flow:TP,flowInitial:AP,insideSpan:DP,string:MP,text:OP},Symbol.toStringTag,{value:"Module"}));function PP(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let s=[],a=[];const l={attempt:p(function(y,v){b(y,v.from)}),check:p(g),consume:function(y){Ke(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===s[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=y},enter:function(y,v){const S=v||{};return S.type=y,S.start=f(),c.events.push(["enter",S,c]),a.push(S),S},exit:function(y){const v=a.pop();return v.end=f(),c.events.push(["exit",v,c]),v},interrupt:p(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(S,k){let N=-1;const E=[];let I;for(;++N<S.length;){const T=S[N];let M;if(typeof T=="string")M=T;else switch(T){case-5:M="\r";break;case-4:M=`
119
- `;break;case-3:M=`\r
120
- `;break;case-2:M=k?" ":" ";break;case-1:if(!k&&I)continue;M=" ";break;default:M=String.fromCharCode(T)}I=T===-2,E.push(M)}return E.join("")}(u(y),v)},sliceStream:u,write:function(y){return s=Fn(s,y),m(),s[s.length-1]!==null?[]:(b(e,0),c.events=Sf(i,c.events,c),c.events)}};let d=e.tokenize.call(c,l);return e.resolveAll&&i.push(e),c;function u(y){return function(v,S){const k=S.start._index,N=S.start._bufferIndex,E=S.end._index,I=S.end._bufferIndex;let T;if(k===E)T=[v[k].slice(N,I)];else{if(T=v.slice(k,E),N>-1){const M=T[0];typeof M=="string"?T[0]=M.slice(N):T.shift()}I>0&&T.push(v[E].slice(0,I))}return T}(s,y)}function f(){const{_bufferIndex:y,_index:v,line:S,column:k,offset:N}=o;return{_bufferIndex:y,_index:v,line:S,column:k,offset:N}}function m(){let y;for(;o._index<s.length;){const v=s[o._index];if(typeof v=="string")for(y=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===y&&o._bufferIndex<v.length;)_(v.charCodeAt(o._bufferIndex));else _(v)}}function _(y){d=d(y)}function g(y,v){v.restore()}function p(y,v){return function(S,k,N){let E,I,T,M;return Array.isArray(S)?R(S):"tokenize"in S?R([S]):function(F){return V;function V(L){const C=L!==null&&F[L],$=L!==null&&F.null;return R([...Array.isArray(C)?C:C?[C]:[],...Array.isArray($)?$:$?[$]:[]])(L)}}(S);function R(F){return E=F,I=0,F.length===0?N:B(F[I])}function B(F){return function(V){return M=function(){const L=f(),C=c.previous,$=c.currentConstruct,j=c.events.length,H=Array.from(a);return{from:j,restore:Y};function Y(){o=L,c.previous=C,c.currentConstruct=$,c.events.length=j,a=H,x()}}(),T=F,F.partial||(c.currentConstruct=F),F.name&&c.parser.constructs.disable.null.includes(F.name)?z():F.tokenize.call(v?Object.assign(Object.create(c),v):c,l,O,z)(V)}}function O(F){return y(T,M),k}function z(F){return M.restore(),++I<E.length?B(E[I]):N}}}function b(y,v){y.resolveAll&&!i.includes(y)&&i.push(y),y.resolve&&io(c.events,v,c.events.length-v,y.resolve(c.events.slice(v),c)),y.resolveTo&&(c.events=y.resolveTo(c.events,c))}function x(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function LP(t){const e=function(r){const i={};let s=-1;for(;++s<r.length;)WR(i,r[s]);return i}([RP,...(t||{}).extensions||[]]),n={constructs:e,content:o(ZR),defined:[],document:o(QR),flow:o(kP),lazy:{},string:o(CP),text:o(NP)};return n;function o(r){return function(i){return PP(n,r,i)}}}const Pk=/[\0\t\n\r]/g,FP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zP(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return yk(n.slice(r?2:1),r?16:10)}return wf(n)||t}const Lk={}.hasOwnProperty;function BP(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Fe),autolinkProtocol:R,autolinkEmail:R,atxHeading:l(de),blockQuote:l(le),characterEscape:R,characterReference:R,codeFenced:l(_e),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(_e,c),codeText:l(ce,c),codeTextData:R,data:R,codeFlowValue:R,definition:l(Ne),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(je),hardBreakEscape:l(Ee),hardBreakTrailing:l(Ee),htmlFlow:l(ge,c),htmlFlowData:R,htmlText:l(ge,c),htmlTextData:R,image:l(Oe),label:c,link:l(Fe),listItem:l(Xe),listItemValue:g,listOrdered:l($e,_),listUnordered:l($e),paragraph:l(Le),reference:re,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(de),strong:l(et),thematicBreak:l(it)},exit:{atxHeading:u(),atxHeadingSequence:E,autolink:u(),autolinkEmail:ue,autolinkProtocol:ie,blockQuote:u(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:q,characterReference:Q,codeFenced:u(y),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:B,codeIndented:u(v),codeText:u(L),codeTextData:B,data:B,definition:u(),definitionDestinationString:N,definitionLabelString:S,definitionTitleString:k,emphasis:u(),hardBreakEscape:u(z),hardBreakTrailing:u(z),htmlFlow:u(F),htmlFlowData:B,htmlText:u(V),htmlTextData:B,image:u($),label:H,labelText:j,lineEnding:O,link:u(C),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:Y,resourceTitleString:Z,resource:G,setextHeading:u(M),setextHeadingLineSequence:T,setextHeadingText:I,strong:u(),thematicBreak:u()}};Fk(r,(o||{}).mdastExtensions||[]);const i={};return s;function s(oe){let ve={type:"root",children:[]};const Ie={stack:[ve],tokenStack:[],config:r,enter:d,exit:f,buffer:c,resume:m,data:i},ze=[];let J=-1;for(;++J<oe.length;)(oe[J][1].type==="listOrdered"||oe[J][1].type==="listUnordered")&&(oe[J][0]==="enter"?ze.push(J):J=a(oe,ze.pop(),J));for(J=-1;++J<oe.length;){const me=r[oe[J][0]];Lk.call(me,oe[J][1].type)&&me[oe[J][1].type].call(Object.assign({sliceSerialize:oe[J][2].sliceSerialize},Ie),oe[J][1])}if(Ie.tokenStack.length>0){const me=Ie.tokenStack[Ie.tokenStack.length-1];(me[1]||zk).call(Ie,void 0,me[0])}for(ve.position={start:tr(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:tr(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)ve=r.transforms[J](ve)||ve;return ve}function a(oe,ve,Ie){let ze,J,me,pe,he=ve-1,ke=-1,xe=!1;for(;++he<=Ie;){const Ue=oe[he];switch(Ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Ue[0]==="enter"?ke++:ke--,pe=void 0;break;case"lineEndingBlank":Ue[0]==="enter"&&(!ze||pe||ke||me||(me=he),pe=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pe=void 0}if(!ke&&Ue[0]==="enter"&&Ue[1].type==="listItemPrefix"||ke===-1&&Ue[0]==="exit"&&(Ue[1].type==="listUnordered"||Ue[1].type==="listOrdered")){if(ze){let Ze=he;for(J=void 0;Ze--;){const ae=oe[Ze];if(ae[1].type==="lineEnding"||ae[1].type==="lineEndingBlank"){if(ae[0]==="exit")continue;J&&(oe[J][1].type="lineEndingBlank",xe=!0),ae[1].type="lineEnding",J=Ze}else if(ae[1].type!=="linePrefix"&&ae[1].type!=="blockQuotePrefix"&&ae[1].type!=="blockQuotePrefixWhitespace"&&ae[1].type!=="blockQuoteMarker"&&ae[1].type!=="listItemIndent")break}me&&(!J||me<J)&&(ze._spread=!0),ze.end=Object.assign({},J?oe[J][1].start:Ue[1].end),oe.splice(J||he,0,["exit",ze,Ue[2]]),he++,Ie++}if(Ue[1].type==="listItemPrefix"){const Ze={type:"listItem",_spread:!1,start:Object.assign({},Ue[1].start),end:void 0};ze=Ze,oe.splice(he,0,["enter",Ze,Ue[2]]),he++,Ie++,me=void 0,pe=!0}}}return oe[ve][1]._spread=xe,Ie}function l(oe,ve){return Ie;function Ie(ze){d.call(this,oe(ze),ze),ve&&ve.call(this,ze)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(oe,ve,Ie){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ve,Ie||void 0]),oe.position={start:tr(ve.start),end:void 0}}function u(oe){return ve;function ve(Ie){oe&&oe.call(this,Ie),f.call(this,Ie)}}function f(oe,ve){const Ie=this.stack.pop(),ze=this.tokenStack.pop();if(!ze)throw new Error("Cannot close `"+oe.type+"` ("+$s({start:oe.start,end:oe.end})+"): it\u2019s not open");ze[0].type!==oe.type&&(ve?ve.call(this,oe,ze[0]):(ze[1]||zk).call(this,oe,ze[0])),Ie.position.end=tr(oe.end)}function m(){return function(oe){return pk(oe,typeof Ul.includeImageAlt!="boolean"||Ul.includeImageAlt,typeof Ul.includeHtml!="boolean"||Ul.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(oe){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0)}function p(){const oe=this.resume();this.stack[this.stack.length-1].lang=oe}function b(){const oe=this.resume();this.stack[this.stack.length-1].meta=oe}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const oe=this.resume();this.stack[this.stack.length-1].value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const oe=this.resume();this.stack[this.stack.length-1].value=oe.replace(/(\r?\n|\r)$/g,"")}function S(oe){const ve=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=ve,Ie.identifier=gi(this.sliceSerialize(oe)).toLowerCase()}function k(){const oe=this.resume();this.stack[this.stack.length-1].title=oe}function N(){const oe=this.resume();this.stack[this.stack.length-1].url=oe}function E(oe){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Ie=this.sliceSerialize(oe).length;ve.depth=Ie}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function T(oe){this.stack[this.stack.length-1].depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function R(oe){const ve=this.stack[this.stack.length-1].children;let Ie=ve[ve.length-1];Ie&&Ie.type==="text"||(Ie=nt(),Ie.position={start:tr(oe.start),end:void 0},ve.push(Ie)),this.stack.push(Ie)}function B(oe){const ve=this.stack.pop();ve.value+=this.sliceSerialize(oe),ve.position.end=tr(oe.end)}function O(oe){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ve.children[ve.children.length-1].position.end=tr(oe.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ve.type)&&(R.call(this,oe),B.call(this,oe))}function z(){this.data.atHardBreak=!0}function F(){const oe=this.resume();this.stack[this.stack.length-1].value=oe}function V(){const oe=this.resume();this.stack[this.stack.length-1].value=oe}function L(){const oe=this.resume();this.stack[this.stack.length-1].value=oe}function C(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function $(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function j(oe){const ve=this.sliceSerialize(oe),Ie=this.stack[this.stack.length-2];Ie.label=function(ze){return ze.replace(FP,zP)}(ve),Ie.identifier=gi(ve).toLowerCase()}function H(){const oe=this.stack[this.stack.length-1],ve=this.resume(),Ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ie.type==="link"){const ze=oe.children;Ie.children=ze}else Ie.alt=ve}function Y(){const oe=this.resume();this.stack[this.stack.length-1].url=oe}function Z(){const oe=this.resume();this.stack[this.stack.length-1].title=oe}function G(){this.data.inReference=void 0}function re(){this.data.referenceType="collapsed"}function ne(oe){const ve=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=ve,Ie.identifier=gi(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function te(oe){this.data.characterReferenceType=oe.type}function q(oe){const ve=this.sliceSerialize(oe),Ie=this.data.characterReferenceType;let ze;Ie?(ze=yk(ve,Ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=wf(ve),this.stack[this.stack.length-1].value+=ze}function Q(oe){this.stack.pop().position.end=tr(oe.end)}function ie(oe){B.call(this,oe),this.stack[this.stack.length-1].url=this.sliceSerialize(oe)}function ue(oe){B.call(this,oe),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(oe)}function le(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function je(){return{type:"emphasis",children:[]}}function de(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function ge(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Fe(){return{type:"link",title:null,url:"",children:[]}}function $e(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Xe(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function Le(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function nt(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Ek(o););return o}(LP(n).document().write(function(){let o,r=1,i="",s=!0;return function(a,l,c){const d=[];let u,f,m,_,g;for(a=i+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,i="",s&&(a.charCodeAt(0)===65279&&m++,s=void 0);m<a.length;){if(Pk.lastIndex=m,u=Pk.exec(a),_=u&&u.index!==void 0?u.index:a.length,g=a.charCodeAt(_),!u){i=a.slice(m);break}if(g===10&&m===_&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),m<_&&(d.push(a.slice(m,_)),r+=_-m),g){case 0:d.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),d.push(-2);r++<f;)d.push(-1);break;case 10:d.push(-4),r=1;break;default:o=!0,r=1}m=_+1}return c&&(o&&d.push(-5),i&&d.push(i),d.push(null)),d}}()(t,e,!0))))}function tr(t){return{line:t.line,column:t.column,offset:t.offset}}function Fk(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?Fk(t,o):UP(t,o)}}function UP(t,e){let n;for(n in e)if(Lk.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function zk(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+$s({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+$s({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+$s({start:e.start,end:e.end})+") is still open")}function VP(t){const e=this;e.parser=function(n){return BP(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Bk(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const s=r[r.length-1];return s&&s.type==="text"?s.value+=o:r.push({type:"text",value:o}),r}function Uk(t){const e=t.spread;return e??t.children.length>1}function $P(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const i=[];for(;o;)i.push(Vk(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return i.push(Vk(e.slice(r),r>0,!1)),i.join("")}function Vk(t,e,n){let o=0,r=t.length;if(e){let i=t.codePointAt(o);for(;i===9||i===32;)o++,i=t.codePointAt(o)}if(n){let i=t.codePointAt(r-1);for(;i===9||i===32;)r--,i=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const HP={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
121
- `}]},code:function(t,e){const n=e.value?e.value+`
122
- `:"",o={};e.lang&&(o.className=["language-"+e.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r},delete:function(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},emphasis:function(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},footnoteReference:function(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(e.identifier).toUpperCase(),r=_i(o.toLowerCase()),i=t.footnoteOrder.indexOf(o);let s,a=t.footnoteCounts.get(o);a===void 0?(a=0,t.footnoteOrder.push(o),s=t.footnoteOrder.length):s=i+1,a+=1,t.footnoteCounts.set(o,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)},heading:function(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},html:function(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}},imageReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Bk(t,e);const r={src:_i(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const i={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,i),t.applyData(e,i)},image:function(t,e){const n={src:_i(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,o),t.applyData(e,o)},inlineCode:function(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,o),t.applyData(e,o)},linkReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Bk(t,e);const r={href:_i(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const i={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)},link:function(t,e){const n={href:_i(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)},listItem:function(t,e,n){const o=t.all(e),r=n?function(d){let u=!1;if(d.type==="list"){u=d.spread||!1;const f=d.children;let m=-1;for(;!u&&++m<f.length;)u=Uk(f[m])}return u}(n):Uk(e),i={},s=[];if(typeof e.checked=="boolean"){const d=o[0];let u;d&&d.type==="element"&&d.tagName==="p"?u=d:(u={type:"element",tagName:"p",properties:{},children:[]},o.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<o.length;){const d=o[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
123
- `}),d.type!=="element"||d.tagName!=="p"||r?s.push(d):s.push(...d.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
124
- `});const c={type:"element",tagName:"li",properties:i,children:s};return t.patch(e,c),t.applyData(e,c)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const s=o[r];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,i),t.applyData(e,i)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],s),r.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=pf(e.children[1]),l=ak(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),r.push(s)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,s=i?i.length:e.children.length;let a=-1;const l=[];for(;++a<s;){const d=e.children[a],u={},f=i?i[a]:void 0;f&&(u.align=f);let m={type:"element",tagName:r,properties:u,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),l.push(m)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,c),t.applyData(e,c)},text:function(t,e){const n={type:"text",value:$P(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:Hl,yaml:Hl,definition:Hl,footnoteDefinition:Hl};function Hl(){}const $k=typeof self=="object"?self:globalThis,Hk=t=>((e,n)=>{const o=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=n[i];switch(s){case 0:case-1:return o(a,i);case 1:{const l=o([],i);for(const c of a)l.push(r(c));return l}case 2:{const l=o({},i);for(const[c,d]of a)l[r(c)]=r(d);return l}case 3:return o(new Date(a),i);case 4:{const{source:l,flags:c}=a;return o(new RegExp(l,c),i)}case 5:{const l=o(new Map,i);for(const[c,d]of a)l.set(r(c),r(d));return l}case 6:{const l=o(new Set,i);for(const c of a)l.add(r(c));return l}case 7:{const{name:l,message:c}=a;return o(new $k[l](c),i)}case 8:return o(BigInt(a),i);case"BigInt":return o(Object(BigInt(a)),i)}return o(new $k[s](a),i)};return r})(new Map,t)(0),bi="",{toString:WP}={},{keys:qP}=Object,Gs=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=WP.call(t).slice(8,-1);switch(n){case"Array":return[1,bi];case"Object":return[2,bi];case"Date":return[3,bi];case"RegExp":return[4,bi];case"Map":return[5,bi];case"Set":return[6,bi]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Wl=([t,e])=>t===0&&(e==="function"||e==="symbol"),Wk=(t,{json:e,lossy:n}={})=>{const o=[];return((r,i,s,a)=>{const l=(d,u)=>{const f=a.push(d)-1;return s.set(u,f),f},c=d=>{if(s.has(d))return s.get(d);let[u,f]=Gs(d);switch(u){case 0:{let _=d;switch(f){case"bigint":u=8,_=d.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);_=null;break;case"undefined":return l([-1],d)}return l([u,_],d)}case 1:{if(f)return l([f,[...d]],d);const _=[],g=l([u,_],d);for(const p of d)_.push(c(p));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,d.toString()],d);case"Boolean":case"Number":case"String":return l([f,d.valueOf()],d)}if(i&&"toJSON"in d)return c(d.toJSON());const _=[],g=l([u,_],d);for(const p of qP(d))!r&&Wl(Gs(d[p]))||_.push([c(p),c(d[p])]);return g}case 3:return l([u,d.toISOString()],d);case 4:{const{source:_,flags:g}=d;return l([u,{source:_,flags:g}],d)}case 5:{const _=[],g=l([u,_],d);for(const[p,b]of d)(r||!Wl(Gs(p))&&!Wl(Gs(b)))&&_.push([c(p),c(b)]);return g}case 6:{const _=[],g=l([u,_],d);for(const p of d)!r&&Wl(Gs(p))||_.push(c(p));return g}}const{message:m}=d;return l([u,{name:f,message:m}],d)};return c})(!(e||n),!!e,new Map,o)(t),o},ql=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Hk(Wk(t,e)):structuredClone(t):(t,e)=>Hk(Wk(t,e));function GP(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function YP(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const qk=function(t){if(t==null)return JP;if(typeof t=="function")return Gl(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=qk(e[o]);return Gl(r);function r(...i){let s=-1;for(;++s<n.length;)if(n[s].apply(this,i))return!0;return!1}}(t):function(e){const n=e;return Gl(o);function o(r){const i=r;let s;for(s in e)if(i[s]!==n[s])return!1;return!0}}(t);if(typeof t=="string")return function(e){return Gl(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function Gl(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function JP(){return!0}const Gk=[],KP=!0,Yk=!1;function XP(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const i=qk(r),s=o?-1:1;(function a(l,c,d){const u=l&&typeof l=="object"?l:{};if(typeof u.type=="string"){const m=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(m?"<"+m+">":"")+")"})}return f;function f(){let m,_,g,p=Gk;if((!e||i(l,c,d[d.length-1]||void 0))&&(p=function(b){return Array.isArray(b)?b:typeof b=="number"?[KP,b]:b==null?Gk:[b]}(n(l,d)),p[0]===Yk))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!=="skip")for(_=(o?b.children.length:-1)+s,g=d.concat(b);_>-1&&_<b.children.length;){const x=b.children[_];if(m=a(x,_,g)(),m[0]===Yk)return m;_=typeof m[1]=="number"?m[1]:_+s}}return p}})(t,void 0,[])()}function Jk(t,e,n,o){let r,i,s;typeof e=="function"?(i=void 0,s=e,r=n):(i=e,s=n,r=o),XP(t,i,function(a,l){const c=l[l.length-1],d=c?c.children.indexOf(a):void 0;return s(a,d,c)},r)}const If={}.hasOwnProperty,ZP={};function QP(t,e){t.position&&(e.position=function(n){const o=pf(n),r=ak(n);if(o&&r)return{start:o,end:r}}(t))}function eL(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,i=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&i&&Object.assign(n.properties,ql(i)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function tL(t,e){const n=e.data||{},o=!("value"in e)||If.call(n,"hProperties")||If.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function nL(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
125
- `});++o<t.length;)o&&n.push({type:"text",value:`
126
- `}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
127
- `}),n}function Kk(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Xk(t,e){const n=function(s,a){const l=a||ZP,c=new Map,d=new Map,u=new Map,f={...HP,...l.handlers},m={all:function(_){const g=[];if("children"in _){const p=_.children;let b=-1;for(;++b<p.length;){const x=m.one(p[b],_);if(x){if(b&&p[b-1].type==="break"&&(Array.isArray(x)||x.type!=="text"||(x.value=Kk(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=Kk(y.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g},applyData:eL,definitionById:c,footnoteById:d,footnoteCounts:u,footnoteOrder:[],handlers:f,one:function(_,g){const p=_.type,b=m.handlers[p];if(If.call(m.handlers,p)&&b)return b(m,_,g);if(m.options.passThrough&&m.options.passThrough.includes(p)){if("children"in _){const{children:x,...y}=_,v=ql(y);return v.children=m.all(_),v}return ql(_)}return(m.options.unknownHandler||tL)(m,_,g)},options:l,patch:QP,wrap:nL};return Jk(s,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const g=_.type==="definition"?c:d,p=String(_.identifier).toUpperCase();g.has(p)||g.set(p,_)}}),m}(t,e),o=n.one(t,void 0),r=function(s){const a=typeof s.options.clobberPrefix=="string"?s.options.clobberPrefix:"user-content-",l=s.options.footnoteBackContent||GP,c=s.options.footnoteBackLabel||YP,d=s.options.footnoteLabel||"Footnotes",u=s.options.footnoteLabelTagName||"h2",f=s.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let _=-1;for(;++_<s.footnoteOrder.length;){const g=s.footnoteById.get(s.footnoteOrder[_]);if(!g)continue;const p=s.all(g),b=String(g.identifier).toUpperCase(),x=_i(b.toLowerCase());let y=0;const v=[],S=s.footnoteCounts.get(b);for(;S!==void 0&&++y<=S;){v.length>0&&v.push({type:"text",value:" "});let E=typeof l=="string"?l:l(_,y);typeof E=="string"&&(E={type:"text",value:E}),v.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof c=="string"?c:c(_,y),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const E=k.children[k.children.length-1];E&&E.type==="text"?E.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...v)}else p.push(...v);const N={type:"element",tagName:"li",properties:{id:a+"fn-"+x},children:s.wrap(p,!0)};s.patch(g,N),m.push(N)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...ql(f),id:"footnote-label"},children:[{type:"text",value:d}]},{type:"text",value:`
128
- `},{type:"element",tagName:"ol",properties:{},children:s.wrap(m,!0)},{type:"text",value:`
129
- `}]}}(n),i=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
130
- `},r),i}function oL(t,e){return t&&"run"in t?async function(n,o){const r=Xk(n,{file:o,...e});await t.run(r,o)}:function(n,o){return Xk(n,{file:o,...t||e})}}function Zk(t){if(t)throw t}var Af,Qk,rL=function(){if(Qk)return Af;Qk=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},i=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var c,d=t.call(l,"constructor"),u=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!d&&!u)return!1;for(c in l);return c===void 0||t.call(l,c)},s=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},a=function(l,c){if(c==="__proto__"){if(!t.call(l,c))return;if(o)return o(l,c).value}return l[c]};return Af=function l(){var c,d,u,f,m,_,g=arguments[0],p=1,b=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},p=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});p<b;++p)if((c=arguments[p])!=null)for(d in c)u=a(g,d),g!==(f=a(c,d))&&(x&&f&&(i(f)||(m=r(f)))?(m?(m=!1,_=u&&r(u)?u:[]):_=u&&i(u)?u:{},s(g,{name:d,newValue:l(x,_,f)})):f!==void 0&&s(g,{name:d,newValue:f}));return g},Af}();const Tf=z4(rL);function Mf(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function iL(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function i(s,...a){const l=t[++o];let c=-1;if(s)r(s);else{for(;++c<n.length;)a[c]!==null&&a[c]!==void 0||(a[c]=n[c]);n=a,l?function(d,u){let f;return m;function m(...p){const b=d.length>p.length;let x;b&&p.push(_);try{x=d.apply(this,p)}catch(y){if(b&&f)throw y;return _(y)}b||(x&&x.then&&typeof x.then=="function"?x.then(g,_):x instanceof Error?_(x):g(x))}function _(p,...b){f||(f=!0,u(p,...b))}function g(p){_(null,p)}}(l,i)(...a):r(null,...a)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const ao={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ys(t);let n,o=0,r=-1,i=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(n){o=i+1;break}}else r<0&&(n=!0,r=i+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(n){o=i+1;break}}else s<0&&(n=!0,s=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return o===r?r=s:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(Ys(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){Ys(t);let e,n=t.length,o=-1,r=0,i=-1,s=0;for(;n--;){const a=t.codePointAt(n);if(a!==47)o<0&&(e=!0,o=n+1),a===46?i<0?i=n:s!==1&&(s=1):i>-1&&(s=-1);else if(e){r=n+1;break}}return i<0||o<0||s===0||s===1&&i===o-1&&i===r+1?"":t.slice(i,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)Ys(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){Ys(o);const r=o.codePointAt(0)===47;let i=function(s,a){let l,c,d="",u=0,f=-1,m=0,_=-1;for(;++_<=s.length;){if(_<s.length)l=s.codePointAt(_);else{if(l===47)break;l=47}if(l===47){if(!(f===_-1||m===1))if(f!==_-1&&m===2){if(d.length<2||u!==2||d.codePointAt(d.length-1)!==46||d.codePointAt(d.length-2)!==46){if(d.length>2){if(c=d.lastIndexOf("/"),c!==d.length-1){c<0?(d="",u=0):(d=d.slice(0,c),u=d.length-1-d.lastIndexOf("/")),f=_,m=0;continue}}else if(d.length>0){d="",u=0,f=_,m=0;continue}}a&&(d=d.length>0?d+"/..":"..",u=2)}else d.length>0?d+="/"+s.slice(f+1,_):d=s.slice(f+1,_),u=_-f-1;f=_,m=0}else l===46&&m>-1?m++:m=-1}return d}(o,!r);return i.length!==0||r||(i="."),i.length>0&&o.codePointAt(o.length-1)===47&&(i+="/"),r?"/"+i:i}(e)},sep:"/"};function Ys(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const sL={cwd:function(){return"/"}};function Of(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function aL(t){if(typeof t=="string")t=new URL(t);else if(!Of(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}(t)}const Df=["history","path","basename","stem","extname","dirname"];class e3{constructor(e){let n;n=e?Of(e)?{path:e}:typeof e=="string"||function(i){return!!(i&&typeof i=="object"&&"byteLength"in i&&"byteOffset"in i)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":sL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<Df.length;){const i=Df[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}for(o in n)Df.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ao.basename(this.path):void 0}set basename(e){Pf(e,"basename"),Rf(e,"basename"),this.path=ao.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ao.dirname(this.path):void 0}set dirname(e){t3(this.basename,"dirname"),this.path=ao.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ao.extname(this.path):void 0}set extname(e){if(Rf(e,"extname"),t3(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ao.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Of(e)&&(e=aL(e)),Pf(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ao.basename(this.path,this.extname):void 0}set stem(e){Pf(e,"stem"),Rf(e,"stem"),this.path=ao.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new nn(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Rf(t,e){if(t&&t.includes(ao.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ao.sep+"`")}function Pf(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function t3(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const lL=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},cL={}.hasOwnProperty;class Lf extends lL{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=iL()}copy(){const e=new Lf;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(Tf(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Bf("data",this.frozen),this.namespace[e]=n,this):cL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bf("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Yl(e),o=this.parser||this.Parser;return Ff("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),Ff("process",this.parser||this.Parser),zf("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,s){const a=Yl(e),l=o.parse(a);function c(d,u){d||!u?s(d):i?i(u):n(void 0,u)}o.run(l,a,function(d,u,f){if(d||!u||!f)return c(d);const m=u,_=o.stringify(m,f);var g;typeof(g=_)=="string"||function(p){return!!(p&&typeof p=="object"&&"byteLength"in p&&"byteOffset"in p)}(g)?f.value=_:f.result=_,c(d,f)})}}processSync(e){let n,o=!1;return this.freeze(),Ff("processSync",this.parser||this.Parser),zf("processSync",this.compiler||this.Compiler),this.process(e,function(r,i){o=!0,Zk(r),n=i}),o3("processSync","process",o),n}run(e,n,o){n3(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?i(void 0,o):new Promise(i);function i(s,a){const l=Yl(n);r.run(e,l,function(c,d,u){const f=d||e;c?a(c):s?s(f):o(void 0,f,u)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(i,s){Zk(i),o=s,r=!0}),o3("runSync","run",r),o}stringify(e,n){this.freeze();const o=Yl(n),r=this.compiler||this.Compiler;return zf("stringify",r),n3(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(Bf("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):s(e)}return this;function i(c){if(typeof c=="function")l(c,[]);else{if(typeof c!="object")throw new TypeError("Expected usable value, not `"+c+"`");if(Array.isArray(c)){const[d,...u]=c;l(d,u)}else s(c)}}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=Tf(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null){if(!Array.isArray(c))throw new TypeError("Expected a list of plugins, not `"+c+"`");for(;++d<c.length;)i(c[d])}}function l(c,d){let u=-1,f=-1;for(;++u<o.length;)if(o[u][0]===c){f=u;break}if(f===-1)o.push([c,...d]);else if(d.length>0){let[m,..._]=d;const g=o[f][1];Mf(g)&&Mf(m)&&(m=Tf(!0,g,m)),o[f]=[c,m,..._]}}}}const dL=new Lf().freeze();function Ff(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function zf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bf(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function n3(t){if(!Mf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function o3(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Yl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new e3(t)}const r3=[],i3={allowDangerousHtml:!0},uL=/^(https?|ircs?|mailto|xmpp)$/i,hL=[{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 fL(t){const e=function(o){const r=o.rehypePlugins||r3,i=o.remarkPlugins||r3,s=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...i3}:i3;return dL().use(VP).use(i).use(oL,s).use(r)}(t),n=function(o){const r=o.children||"",i=new e3;return typeof r=="string"&&(i.value=r),i}(t);return function(o,r){const i=r.allowedElements,s=r.allowElement,a=r.components,l=r.disallowedElements,c=r.skipHtml,d=r.unwrapDisallowed,u=r.urlTransform||mL;for(const m of hL)Object.hasOwn(r,m.from)&&(m.from,m.to&&m.to,m.id);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),Jk(o,f),BR(o,{Fragment:h.Fragment,components:a,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(m,_,g){if(m.type==="raw"&&g&&typeof _=="number")return c?g.children.splice(_,1):g.children[_]={type:"text",value:m.value},_;if(m.type==="element"){let p;for(p in xf)if(Object.hasOwn(xf,p)&&Object.hasOwn(m.properties,p)){const b=m.properties[p],x=xf[p];(x===null||x.includes(m.tagName))&&(m.properties[p]=u(String(b||""),p,m))}}if(m.type==="element"){let p=i?!i.includes(m.tagName):!!l&&l.includes(m.tagName);if(!p&&s&&typeof _=="number"&&(p=!s(m,_,g)),p&&g&&typeof _=="number")return d&&m.children?g.children.splice(_,1,...m.children):g.children.splice(_,1),_}}}(e.runSync(e.parse(n),n),t)}function mL(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||uL.test(t.slice(0,e))?t:""}const pL=[st.lineWrapping],gL=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),_L=t=>{const e=X.c(26),{code:n,language:o}=t,{theme:r}=ho(),{createNewCell:i}=zt(),s=Or(),a=We(Ii),[l,c]=A.useState(n);let d,u,f;e[0]!==n?(d=()=>{c(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==a||e[4]!==i||e[5]!==o||e[6]!==s||e[7]!==l?(f=()=>{const E=function(I,T){return I?I==="python"?{language:I,code:T}:I==="sql"?{language:"python",code:vc.fromQuery(T)}:I==="markdown"?{language:"python",code:ta.fromMarkdown(T)}:I==="shell"||I==="bash"?{language:"python",code:`import subprocess
131
- subprocess.run("${T}")`}:{language:"python",code:`_${I} = """
132
- ${T}
133
- """`}:{language:"python",code:T}}(o,l);o==="sql"&&Bo(a,i,s),i({code:E.code,before:!1,cellId:s??"__end__"})},e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=l,e[8]=f):f=e[8];const m=f;let _;e[9]!==l?(_=async()=>{await bn(l)},e[9]=l,e[10]=_):_=e[10];const g=_,p=r==="dark"?"dark":"light",b=o&&gL.has(o)?o:void 0;let x,y,v,S,k,N;return e[11]!==p||e[12]!==b||e[13]!==l?(x=h.jsx(pa,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:pL,value:l,onChange:c}),e[11]=p,e[12]=b,e[13]=l,e[14]=x):x=e[14],e[15]!==g?(y=h.jsx(bL,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(Zi,{className:"ml-2 h-4 w-4"}),e[17]=v):v=e[17],e[18]!==m?(S=h.jsxs(De,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",v]}),e[18]=m,e[19]=S):S=e[19],e[20]!==S||e[21]!==y?(k=h.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[y,S]}),e[20]=S,e[21]=y,e[22]=k):k=e[22],e[23]!==k||e[24]!==x?(N=h.jsxs("div",{className:"relative",children:[x,k]}),e[23]=k,e[24]=x,e[25]=N):N=e[25],N},bL=t=>{const e=X.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,i]=A.useState(!1);let s,a,l;e[3]!==r?(s=()=>{r&&setTimeout(()=>i(!1),1e3)},a=[r],e[3]=r,e[4]=s,e[5]=a):(s=e[4],a=e[5]),A.useEffect(s,a),e[6]!==n?(l=u=>{n==null||n(u),i(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=h.jsx(De,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},yL={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),h.jsx(_L,{code:t.trim(),language:n})]}):h.jsx("code",{className:e,children:t})}},s3=A.memo(t=>{const e=X.c(2),{content:n}=t;let o;return e[0]!==n?(o=h.jsx(fL,{components:yL,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);s3.displayName="MemoizedMarkdownBlock";const a3=A.memo(({content:t})=>{const e=A.useMemo(()=>{return n=t,pV.lexer(n).map(o=>o.raw);var n},[t]);return h.jsx(h.Fragment,{children:e.map((n,o)=>h.jsx(s3,{content:n},`markdown-block-${o}`))})});a3.displayName="MarkdownRenderer";const Uf=(t,e,n,o)=>e?{...t,chats:t.chats.map(r=>r.id===e?{...r,messages:[...r.messages,{role:n,content:o,timestamp:Date.now()}],updatedAt:Date.now()}:r)}:t,xL=t=>{var v;const e=X.c(29),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:i,setMessages:s}=t,a=We(S4),{handleClick:l}=_a(),c=((v=a==null?void 0:a.open_ai)==null?void 0:v.model)||"gpt-4-turbo";let d,u,f,m,_,g,p,b,x,y;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Ar,{className:"h-4 w-4"}),e[0]=d):d=e[0],e[1]!==n?(u=h.jsx(Me,{content:"New chat",children:h.jsx(De,{variant:"text",size:"icon",onClick:n,children:d})}),e[1]=n,e[2]=u):u=e[2],e[3]!==l?(f=()=>l("ai"),e[3]=l,e[4]=f):f=e[4],e[5]!==c||e[6]!==f?(m=h.jsx(De,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:f,children:c}),e[5]=c,e[6]=f,e[7]=m):m=e[7],e[8]!==u||e[9]!==m?(_=h.jsxs("div",{className:"flex items-center gap-2",children:[u,m]}),e[8]=u,e[9]=m,e[10]=_):_=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Me,{content:"Previous chats",children:h.jsx(fa,{asChild:!0,children:h.jsx(De,{variant:"text",size:"icon",children:h.jsx(bV,{className:"h-4 w-4"})})})}),e[11]=g):g=e[11],e[12]!==i.length?(p=i.length===0&&h.jsx(En,{title:"No chats yet",description:"Start a new chat to get started",icon:h.jsx(cm,{})}),e[12]=i.length,e[13]=p):p=e[13],e[14]!==o||e[15]!==i||e[16]!==r||e[17]!==s){let S;e[19]!==o||e[20]!==r||e[21]!==s?(S=k=>h.jsxs("div",{className:Te("p-3 rounded-md cursor-pointer hover:bg-accent",k.id===o&&"bg-accent"),onClick:()=>{r(k.id),s(k.messages.map(kL))},children:[h.jsx("div",{className:"font-medium",children:k.title}),h.jsx("div",{className:"text-sm text-muted-foreground",children:yV(k.updatedAt)})]},k.id),e[19]=o,e[20]=r,e[21]=s,e[22]=S):S=e[22],b=i.map(S),e[14]=o,e[15]=i,e[16]=r,e[17]=s,e[18]=b}else b=e[18];return e[23]!==p||e[24]!==b?(x=h.jsxs(Bi,{children:[g,h.jsx(oa,{className:"w-[520px] p-0",align:"start",side:"right",children:h.jsx(q2,{className:"h-[500px] p-4",children:h.jsxs("div",{className:"space-y-4",children:[p,b]})})})]}),e[23]=p,e[24]=b,e[25]=x):x=e[25],e[26]!==_||e[27]!==x?(y=h.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[_,x]}),e[26]=_,e[27]=x,e[28]=y):y=e[28],y},l3=A.memo(t=>{const e=X.c(14),{message:n,index:o,theme:r,onEdit:i,setChatState:s,chatState:a}=t,l=n.role==="user"?"justify-end":"justify-start";let c,d,u;return e[0]!==l?(c=Te("flex group relative",l),e[0]=l,e[1]=c):c=e[1],e[2]!==a||e[3]!==o||e[4]!==n.content||e[5]!==n.id||e[6]!==n.role||e[7]!==i||e[8]!==s||e[9]!==r?(d=n.role==="user"?h.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:h.jsx(Ec,{value:n.content,theme:r,placeholder:"Type your message...",onChange:SL,onSubmit:(f,m)=>{m.trim()&&(i(o,m),a.activeChatId&&s(_=>Uf(_,a.activeChatId,"user",m)))},onClose:CL},n.id)}):h.jsxs("div",{className:"w-[95%]",children:[h.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx(Wm,{className:"h-3 w-3",value:n.content})}),h.jsx(a3,{content:n.content})]}),e[2]=a,e[3]=o,e[4]=n.content,e[5]=n.id,e[6]=n.role,e[7]=i,e[8]=s,e[9]=r,e[10]=d):d=e[10],e[11]!==c||e[12]!==d?(u=h.jsx("div",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=u):u=e[13],u});l3.displayName="ChatMessage";const c3=A.memo(t=>{var c,d;const e=X.c(8),{input:n,setInput:o,onSubmit:r,theme:i,inputRef:s}=t;let a,l;return e[0]!==((c=s.current)==null?void 0:c.editor)?(a=()=>{var u,f;return(f=(u=s.current)==null?void 0:u.editor)==null?void 0:f.blur()},e[0]=(d=s.current)==null?void 0:d.editor,e[1]=a):a=e[1],e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==i?(l=h.jsx("div",{className:"px-2 py-3 border-t relative flex-shrink-0 min-h-[80px]",children:h.jsx(Ec,{value:n,onChange:o,onSubmit:r,onClose:a,theme:i,placeholder:"Type your message..."})}),e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=i,e[7]=l):l=e[7],l});c3.displayName="ChatInput";const wL=()=>{const t=X.c(6),e=We(tc),{handleClick:n}=_a();if(!e){let r,i,s;return t[0]!==n?(r=h.jsx(De,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(cm,{}),t[2]=i):i=t[2],t[3]!==r?(s=h.jsx(En,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:i}),t[3]=r,t[4]=s):s=t[4],s}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(vL,{}),t[5]=o):o=t[5],o},vL=()=>{const t=X.c(70),[e,n]=yn(nd),[o,r]=yn(yS),[i,s]=A.useState(""),a=A.useRef(null),l=A.useRef(null),c=A.useRef(null),{theme:d}=ho();let u,f,m;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=km("api/ai/chat").toString(),f=xc.headers(),t[0]=u,t[1]=f):(u=t[0],f=t[1]),t[2]!==e.activeChatId||t[3]!==n?(m={keepLastMessageOnError:!0,experimental_throttle:100,api:u,headers:f,experimental_prepareRequestBody:jL,streamProtocol:"text",onFinish:ie=>{e.activeChatId?n(ue=>Uf(ue,ue.activeChatId,"assistant",ie.content)):mt.warn("No active chat")},onError:EL,onResponse:IL},t[2]=e.activeChatId,t[3]=n,t[4]=m):m=t[4];const{messages:_,input:g,setInput:p,setMessages:b,append:x,handleSubmit:y,error:v,isLoading:S,reload:k}=gV(m);let N;t[5]!==x||t[6]!==n||t[7]!==p||t[8]!==b?(N=ie=>{const ue={id:_V(),title:`${ie.slice(0,30)}...`,messages:[{role:"user",content:ie,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()};n(le=>({chats:[...le.chats,ue],activeChatId:ue.id})),b([]),p(""),x({role:"user",content:ie})},t[5]=x,t[6]=n,t[7]=p,t[8]=b,t[9]=N):N=t[9];const E=N;let I;t[10]!==r||t[11]!==p||t[12]!==b?(I=()=>{r(null),b([]),p(""),s("")},t[10]=r,t[11]=p,t[12]=b,t[13]=I):I=t[13];const T=I;let M;t[14]!==x||t[15]!==b?(M=(ie,ue)=>{b(le=>le.slice(0,ie)),x({role:"user",content:ue})},t[14]=x,t[15]=b,t[16]=M):M=t[16];const R=M;let B;t[17]!==e.activeChatId||t[18]!==y||t[19]!==n?(B=(ie,ue)=>{ue.trim()&&(y(ie),e.activeChatId&&n(le=>Uf(le,e.activeChatId,"user",ue)))},t[17]=e.activeChatId,t[18]=y,t[19]=n,t[20]=B):B=t[20];const O=B;let z;t[21]!==k?(z=()=>{k()},t[21]=k,t[22]=z):z=t[22];const F=z;let V;t[23]!==E||t[24]!==i?(V=()=>{i.trim()&&E(i.trim())},t[23]=E,t[24]=i,t[25]=V):V=t[25];const L=V;let C;t[26]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{var ie,ue;return(ue=(ie=a.current)==null?void 0:ie.editor)==null?void 0:ue.blur()},t[26]=C):C=t[26];const $=C,j=o==null?void 0:o.id;let H,Y,Z,G,re,ne,te,q,Q;if(t[27]!==e.chats||t[28]!==T||t[29]!==r||t[30]!==b||t[31]!==j?(H=h.jsx(Dm,{children:h.jsx(xL,{onNewChat:T,activeChatId:j,setActiveChat:r,chats:e.chats,setMessages:b})}),t[27]=e.chats,t[28]=T,t[29]=r,t[30]=b,t[31]=j,t[32]=H):H=t[32],t[33]!==L||t[34]!==_||t[35]!==i||t[36]!==d?(Y=(!_||_.length===0)&&h.jsx("div",{className:"flex rounded-md border px-1 bg-background",children:h.jsx(Ec,{value:i,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:d,onClose:$,onChange:s,onSubmit:L},"new-thread-input")}),t[33]=L,t[34]=_,t[35]=i,t[36]=d,t[37]=Y):Y=t[37],t[38]!==e||t[39]!==R||t[40]!==_||t[41]!==n||t[42]!==d){let ie;t[44]!==e||t[45]!==R||t[46]!==n||t[47]!==d?(ie=(ue,le)=>h.jsx(l3,{message:ue,index:le,theme:d,onEdit:R,setChatState:n,chatState:e},le),t[44]=e,t[45]=R,t[46]=n,t[47]=d,t[48]=ie):ie=t[48],Z=_.map(ie),t[38]=e,t[39]=R,t[40]=_,t[41]=n,t[42]=d,t[43]=Z}else Z=t[43];return t[49]!==S?(G=S&&h.jsx("div",{className:"flex justify-center py-4",children:h.jsx(Ic,{className:"h-4 w-4 animate-spin"})}),t[49]=S,t[50]=G):G=t[50],t[51]!==v||t[52]!==F?(re=v&&h.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[h.jsx(Yi,{error:v}),h.jsx(De,{variant:"outline",size:"sm",onClick:F,children:"Retry"})]}),t[51]=v,t[52]=F,t[53]=re):re=t[53],t[54]===Symbol.for("react.memo_cache_sentinel")?(ne=h.jsx("div",{ref:c}),t[54]=ne):ne=t[54],t[55]!==Y||t[56]!==Z||t[57]!==G||t[58]!==re?(te=h.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",children:[Y,Z,G,re,ne]}),t[55]=Y,t[56]=Z,t[57]=G,t[58]=re,t[59]=te):te=t[59],t[60]!==O||t[61]!==g||t[62]!==_||t[63]!==p||t[64]!==d?(q=_&&_.length>0&&h.jsx(c3,{input:g,setInput:p,onSubmit:O,theme:d,inputRef:l}),t[60]=O,t[61]=g,t[62]=_,t[63]=p,t[64]=d,t[65]=q):q=t[65],t[66]!==H||t[67]!==te||t[68]!==q?(Q=h.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[H,te,q]}),t[66]=H,t[67]=te,t[68]=q,t[69]=Q):Q=t[69],Q};function kL(t){const{role:e,content:n,timestamp:o}=t;return{role:e,content:n,id:o.toString()}}function SL(){}function CL(){}function NL(t){return t.content}function jL(t){return{...t,...h4({input:t.messages.map(NL).join(`
134
- `)}),includeOtherCode:bc("")}}function EL(t){mt.error("An error occurred:",t)}function IL(t){mt.debug("Received HTTP response from server:",t)}const AL=K.lazy(()=>Ac(()=>import("./tracing-gp4drB6-.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([16,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,15,118,119,120,121,122,123,124]),import.meta.url).then(t=>({default:t.Tracing}))),TL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(K.Suspense,{fallback:h.jsx(ML,{}),children:h.jsx(AL,{})}),t[0]=e):e=t[0],e},ML=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:h.jsx(Xn,{})}),t[0]=e):e=t[0],e},OL=()=>{const t=X.c(25),{openModal:e,closeModal:n}=zn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,loading:i,error:s,reload:a}=Yn(RL,o);let l;t[1]!==r?(l=r===void 0?[]:r,t[1]=r,t[2]=l):l=t[2];const c=l;let d;t[3]!==c?(d=c.filter(PL).map(LL),t[3]=c,t[4]=d):d=t[4];const u=d;if(i&&c.length===0){let y;return t[5]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Xn,{size:"medium",centered:!0}),t[5]=y):y=t[5],y}if(s){let y;return t[6]!==s?(y=h.jsx(Yi,{error:s}),t[6]=s,t[7]=y):y=t[7],y}if(c.length===0){let y;return t[8]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(En,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:h.jsx(qc,{})}),t[8]=y):y=t[8],y}let f,m,_,g,p,b,x;return t[9]!==n||t[10]!==e||t[11]!==u||t[12]!==a?(f=()=>e(h.jsx(vg,{providerNames:u,onSuccess:()=>{a(),n()},onClose:n})),t[9]=n,t[10]=e,t[11]=u,t[12]=a,t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Ar,{className:"h-4 w-4"}),t[14]=m):m=t[14],t[15]!==f?(_=h.jsx("div",{className:"flex justify-end h-8 border-b",children:h.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:f,children:m})}),t[15]=f,t[16]=_):_=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Vm,{children:h.jsxs(Gi,{children:[h.jsx(Tr,{children:"Environment Variable"}),h.jsx(Tr,{children:"Source"}),h.jsx(Tr,{})]})}),t[17]=g):g=t[17],t[18]!==c?(p=c.map(FL),t[18]=c,t[19]=p):p=t[19],t[20]!==p?(b=h.jsxs(Um,{className:"overflow-auto flex-1 mb-16",children:[g,h.jsx($m,{children:p})]}),t[20]=p,t[21]=b):b=t[21],t[22]!==_||t[23]!==b?(x=h.jsxs("div",{className:"flex flex-col h-full",children:[_,b]}),t[22]=_,t[23]=b,t[24]=x):x=t[24],x},DL=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[i,s]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),s(!0),setTimeout(()=>s(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==i?(c=i?h.jsx(dc,{className:"w-3 h-3 text-green-700 rounded"}):h.jsx(Ri,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=i,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=h.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function RL(){return wg((await Q4.request({})).secrets)}function PL(t){return t.provider!=="env"}function LL(t){return t.name}function FL(t){return t.keys.map(e=>h.jsxs(Gi,{className:"group",children:[h.jsx(Mr,{children:e}),h.jsx(Mr,{children:t.provider!=="env"&&h.jsx(j4,{variant:"outline",className:"select-none",children:t.name})}),h.jsx(Mr,{children:h.jsx(DL,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await bn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Te("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const zL=K.lazy(()=>Ac(()=>import("./terminal-BvrOH4Uo.js"),__vite__mapDeps([125,2,3,126]),import.meta.url)),BL=t=>{const e=X.c(120),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:i}=cc(),{setIsSidebarOpen:s,setIsTerminalOpen:a}=Li(),l=K.useRef(null),c=K.useRef(null);let d,u,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const he=l.current.isCollapsed();o&&he&&l.current.expand(),o||he||l.current.collapse(),requestAnimationFrame(VL)},u=[o],e[0]=o,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==r?(f=()=>{if(!c.current)return;const he=c.current.isCollapsed();r&&he&&c.current.expand(),r||he||c.current.collapse(),requestAnimationFrame(HL)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),A.useEffect(f,m),e[6]!==n?(_=h.jsx(Pc,{id:"app",className:"relative h-full",children:h.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Te("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=h.jsx(B4,{onDragging:U4,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let S,k;e[12]!==v?(S=Te("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=S):S=e[13],e[14]!==S?(k=h.jsx(B4,{onDragging:U4,className:S}),e[14]=S,e[15]=k):k=e[15];const N=k;let E,I,T,M,R,B,O,z,F,V,L,C,$,j,H,Y,Z,G,re,ne,te;e[16]!==i?(E=h.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:i}),e[16]=i,e[17]=E):E=e[17],e[18]!==s?(I=()=>s(!1),e[18]=s,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(Jn,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=h.jsx(De,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=M):M=e[22],e[23]!==E||e[24]!==M?(R=h.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[E,M]}),e[23]=E,e[24]=M,e[25]=R):R=e[25],e[26]!==i?(B=i==="files"&&h.jsx(ND,{}),e[26]=i,e[27]=B):B=e[27],e[28]!==i?(O=i==="errors"&&h.jsx(Cx,{}),e[28]=i,e[29]=O):O=e[29],e[30]!==i?(z=i==="variables"&&h.jsx(b2,{}),e[30]=i,e[31]=z):z=e[31],e[32]!==i?(F=i==="dependencies"&&h.jsx(Q9,{}),e[32]=i,e[33]=F):F=e[33],e[34]!==i?(V=i==="packages"&&h.jsx(rR,{}),e[34]=i,e[35]=V):V=e[35],e[36]!==i?(L=i==="outline"&&h.jsx(NM,{}),e[36]=i,e[37]=L):L=e[37],e[38]!==i?(C=i==="datasources"&&h.jsx(XD,{}),e[38]=i,e[39]=C):C=e[39],e[40]!==i?($=i==="documentation"&&h.jsx(rD,{}),e[40]=i,e[41]=$):$=e[41],e[42]!==i?(j=i==="snippets"&&h.jsx(TD,{}),e[42]=i,e[43]=j):j=e[43],e[44]!==i?(H=i==="scratchpad"&&h.jsx(oR,{}),e[44]=i,e[45]=H):H=e[45],e[46]!==i?(Y=i==="chat"&&h.jsx(wL,{}),e[46]=i,e[47]=Y):Y=e[47],e[48]!==i?(Z=i==="logs"&&h.jsx(y2,{}),e[48]=i,e[49]=Z):Z=e[49],e[50]!==i?(G=i==="tracing"&&h.jsx(TL,{}),e[50]=i,e[51]=G):G=e[51],e[52]!==i?(re=i==="secrets"&&h.jsx(OL,{}),e[52]=i,e[53]=re):re=e[53],e[54]!==B||e[55]!==O||e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==L||e[60]!==C||e[61]!==$||e[62]!==j||e[63]!==H||e[64]!==Y||e[65]!==Z||e[66]!==G||e[67]!==re?(ne=h.jsx(A.Suspense,{children:h.jsxs(Mc,{children:[B,O,z,F,V,L,C,$,j,H,Y,Z,G,re]})}),e[54]=B,e[55]=O,e[56]=z,e[57]=F,e[58]=V,e[59]=L,e[60]=C,e[61]=$,e[62]=j,e[63]=H,e[64]=Y,e[65]=Z,e[66]=G,e[67]=re,e[68]=ne):ne=e[68],e[69]!==R||e[70]!==ne?(te=h.jsx(mc,{children:h.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,ne]})}),e[69]=R,e[70]=ne,e[71]=te):te=e[71];const q=te,Q=o&&"border-r border-l border-[var(--slate-7)]";let ie,ue,le,_e,ce,Ne;e[72]!==Q?(ie=Te("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ie):ie=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(ue=(he,ke)=>{var xe;ke===0&&he===10&&((xe=l.current)==null||xe.resize(30))},e[74]=ue):ue=e[74],e[75]!==s?(le=()=>s(!1),_e=()=>s(!0),e[75]=s,e[76]=le,e[77]=_e):(le=e[76],_e=e[77]),e[78]!==q||e[79]!==y?(ce=h.jsxs("span",{className:"flex flex-row h-full",children:[q," ",y]}),e[78]=q,e[79]=y,e[80]=ce):ce=e[80],e[81]!==ie||e[82]!==le||e[83]!==_e||e[84]!==ce?(Ne=h.jsx(Pc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ie,minSize:10,defaultSize:0,maxSize:75,onResize:ue,onCollapse:le,onExpand:_e,children:ce},"helper"),e[81]=ie,e[82]=le,e[83]=_e,e[84]=ce,e[85]=Ne):Ne=e[85];const je=Ne,de=r&&"border-[var(--slate-7)]";let Ee,ge,Oe,Fe,$e,Xe,Le,et;e[86]!==de?(Ee=Te("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",de),e[86]=de,e[87]=Ee):Ee=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(ge=(he,ke)=>{var xe;ke===0&&he===10&&((xe=c.current)==null||xe.resize(30))},e[88]=ge):ge=e[88],e[89]!==a?(Oe=()=>a(!1),Fe=()=>a(!0),e[89]=a,e[90]=Oe,e[91]=Fe):(Oe=e[90],Fe=e[91]),e[92]!==a?($e=()=>a(!1),e[92]=a,e[93]=$e):$e=e[93],e[94]!==r||e[95]!==$e?(Xe=h.jsx(zL,{visible:r,onClose:$e}),e[94]=r,e[95]=$e,e[96]=Xe):Xe=e[96],e[97]!==r||e[98]!==Xe?(Le=h.jsx(ZD,{isOpen:r,children:Xe}),e[97]=r,e[98]=Xe,e[99]=Le):Le=e[99],e[100]!==Ee||e[101]!==Oe||e[102]!==Fe||e[103]!==Le||e[104]!==N?(et=h.jsxs(Pc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Ee,minSize:10,defaultSize:0,maxSize:75,onResize:ge,onCollapse:Oe,onExpand:Fe,children:[N,Le]},"terminal"),e[100]=Ee,e[101]=Oe,e[102]=Fe,e[103]=Le,e[104]=N,e[105]=et):et=e[105];const nt=et;let it,oe,ve,Ie,ze,J,me,pe;return e[106]===Symbol.for("react.memo_cache_sentinel")?(it={getItem:he=>Pu||(Pu??null),setItem(he,ke){Pu=ke||null}},e[106]=it):it=e[106],e[107]===Symbol.for("react.memo_cache_sentinel")?(oe=h.jsx(Mc,{children:h.jsx(xM,{})}),e[107]=oe):oe=e[107],e[108]!==nt?(ve=h.jsx(kx,{capability:"terminal",children:nt}),e[108]=nt,e[109]=ve):ve=e[109],e[110]!==g||e[111]!==ve?(Ie=h.jsx(Pc,{children:h.jsxs(V4,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,ve]})}),e[110]=g,e[111]=ve,e[112]=Ie):Ie=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(ze=h.jsx(xV,{}),e[113]=ze):ze=e[113],e[114]!==je||e[115]!==Ie?(J=h.jsxs(V4,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:it,children:[oe,je,Ie,ze]}),e[114]=je,e[115]=Ie,e[116]=J):J=e[116],e[117]===Symbol.for("react.memo_cache_sentinel")?(me=h.jsx(mc,{children:h.jsx(Mc,{children:h.jsx(pM,{})})}),e[117]=me):me=e[117],e[118]!==J?(pe=h.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:[J,me]}),e[118]=J,e[119]=pe):pe=e[119],pe};function UL(){window.dispatchEvent(new Event("resize"))}function VL(){requestAnimationFrame(UL)}function $L(){window.dispatchEvent(new Event("resize"))}function HL(){requestAnimationFrame($L)}let d3;d3=new URL(window.location.href).searchParams.get(wV.showChrome)==="false",sS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(d3){let i,s,a;return e[0]!==t?(i=h.jsx(vx,{hideControls:!0,...t}),e[0]=t,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Qp,{}),e[2]=s):s=e[2],e[3]!==i?(a=h.jsxs(h.Fragment,{children:[i,s]}),e[3]=i,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=h.jsx(vx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(Qp,{}),e[7]=o):o=e[7],e[8]!==n?(r=h.jsxs(BL,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Qm as C,Bc as E,En as P,_$ as __tla,ep as a,sS as e,ya as f,tp as u};