@marimo-team/frontend 0.14.18-dev0 → 0.14.18-dev2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-lbQxd8jz.js → ConnectedDataExplorerComponent-BT0xl502.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-BJeoNaPX.js → ImageComparisonComponent-CyD_BM3x.js} +1 -1
- package/dist/assets/{VegaLite-CTkLkkZP.js → VegaLite-hnjov9BB.js} +1 -1
- package/dist/assets/{_baseEach-Z8e7apxp.js → _baseEach-C_3O_UIK.js} +1 -1
- package/dist/assets/_baseMap-ejDdVnUU.js +1 -0
- package/dist/assets/{_baseUniq-BdtmJOZM.js → _baseUniq-G59-tGC4.js} +1 -1
- package/dist/assets/{_createAggregator-DvN_9uLC.js → _createAggregator-CYM_3WAb.js} +1 -1
- package/dist/assets/{any-language-editor-CGtu0DAR.js → any-language-editor-B_KRwSpy.js} +1 -1
- package/dist/assets/{architectureDiagram-SUXI7LT5-DTlATSwP.js → architectureDiagram-SUXI7LT5-Cp-u2npp.js} +1 -1
- package/dist/assets/{blockDiagram-6J76NXCF-BgUE0IVr.js → blockDiagram-6J76NXCF-B1eF_YTU.js} +1 -1
- package/dist/assets/{c4Diagram-6F6E4RAY-pb246yfI.js → c4Diagram-6F6E4RAY-D3Co9dhJ.js} +1 -1
- package/dist/assets/channel-PLmZB-8M.js +1 -0
- package/dist/assets/{chunk-353BL4L5-ChOGU7Et.js → chunk-353BL4L5-BNPOylnE.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-BBtNpYqQ.js → chunk-67H74DCK-6tJ94Bg0.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-BQMbP_Vt.js → chunk-AACKK3MU-46UGfeGc.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-e-cjn3-W.js → chunk-BFAMUDN2-CNdKrd4t.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-D1ADxOOn.js → chunk-E2GYISFI-0jprAmfg.js} +1 -1
- package/dist/assets/{chunk-OW32GOEJ-9lctnMIz.js → chunk-OW32GOEJ-Dq-4mco2.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-ErUT6F4L.js → chunk-SKB7J2MH-BFb7Z7j2.js} +1 -1
- package/dist/assets/{chunk-SZ463SBG-yMNaAUAq.js → chunk-SZ463SBG-BEsy1Bnk.js} +1 -1
- package/dist/assets/{circle-play-DZltiUnT.js → circle-play-chxJxn_k.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-Bl6D-lo6.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-Bl6D-lo6.js +1 -0
- package/dist/assets/clone-BllYssjv.js +1 -0
- package/dist/assets/{compile-BnHv8iHN.js → compile-CrDOzGvF.js} +1 -1
- package/dist/assets/{dagre-JOIXM2OF-l1r1BJ0F.js → dagre-JOIXM2OF-CgxEy6Ti.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-Ba_kq_S3.js → data-grid-overlay-editor-Bt-ru6j6.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-BUzIkwrO.js → diagram-5UYTHUR4-Cv4YqP4A.js} +1 -1
- package/dist/assets/{diagram-VMROVX33-D7iI3hZW.js → diagram-VMROVX33-UJqJ2Qh7.js} +1 -1
- package/dist/assets/{diagram-ZTM2IBQH-Tlys7Qa7.js → diagram-ZTM2IBQH-wfhUdi9M.js} +1 -1
- package/dist/assets/edit-page-Bh3hotqJ.js +163 -0
- package/dist/assets/{erDiagram-3M52JZNH-D-LB2D6A.js → erDiagram-3M52JZNH-Bt4OzYYB.js} +1 -1
- package/dist/assets/{flowDiagram-KYDEHFYC-zfLOC9xq.js → flowDiagram-KYDEHFYC-BE_JMKNj.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-D9CUdOwx.js → ganttDiagram-EK5VF46D-DEt-Ih6b.js} +1 -1
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-D-XNvTd9.js → gitGraphDiagram-GW3U2K7C-CGO98bua.js} +1 -1
- package/dist/assets/{glide-data-editor-Iz1f1NOi.js → glide-data-editor-Btj-XKB9.js} +4 -4
- package/dist/assets/{graph-Chedk9vv.js → graph-DeU2Xth1.js} +1 -1
- package/dist/assets/{home-page-CBaSMfGu.js → home-page-IxuRGcj-.js} +1 -1
- package/dist/assets/{index-COKnXZm2.js → index-54cg5P1s.js} +1 -1
- package/dist/assets/{index-P2Ifc_U7.js → index-B464Wlvo.js} +1 -1
- package/dist/assets/{index-D7DYgZ9E.js → index-B72QAiSc.js} +1 -1
- package/dist/assets/{index-CPVCa2dz.js → index-B7daay03.js} +11 -11
- package/dist/assets/{index-CdPZmS8N.js → index-BU4GASnK.js} +1 -1
- package/dist/assets/{index-BYoIq3fA.js → index-BYPCZUa6.js} +1 -1
- package/dist/assets/{index-C7oqh1GT.js → index-CRkNsusV.js} +1 -1
- package/dist/assets/{index-B_2y4SIt.js → index-CVNzfFlx.js} +1 -1
- package/dist/assets/{index-CIooWgUc.js → index-D4QA5nNz.js} +1 -1
- package/dist/assets/{index-CBjJLxgV.js → index-DEVD2idU.js} +1 -1
- package/dist/assets/{index-CkVqTmEZ.js → index-DFLmyJLh.js} +1 -1
- package/dist/assets/{index-DnIAY6gI.js → index-DRnyprVw.js} +1 -1
- package/dist/assets/{index-DfeBSlHy.js → index-DbFWJ4Qa.js} +1 -1
- package/dist/assets/{index-D6KtMooK.js → index-Dniw7sSM.js} +1 -1
- package/dist/assets/{index-DFrRn7CA.js → index-Dql2NySh.js} +1 -1
- package/dist/assets/{index-Bz7AXBQe.js → index-_jAr8NM_.js} +1 -1
- package/dist/assets/{index-x6nviym0.js → index-g62sB8uq.js} +1 -1
- package/dist/assets/{index-8S_1Bwak.js → index-heFumldU.js} +1 -1
- package/dist/assets/{index-DWnLMMAM.js → index-vGk4nE_d.js} +1 -1
- package/dist/assets/infoDiagram-LHK5PUON-sVWflOQg.js +2 -0
- package/dist/assets/{journeyDiagram-EWQZEKCU-86jmDxYR.js → journeyDiagram-EWQZEKCU-DzQqkIOA.js} +1 -1
- package/dist/assets/{kanban-definition-ZSS6B67P-CcV25jlk.js → kanban-definition-ZSS6B67P-Cv0lpMrD.js} +1 -1
- package/dist/assets/{layout-CFbJTwF1.js → layout-CO5ebI-Y.js} +1 -1
- package/dist/assets/{linear-BtOHrJPM.js → linear-CvcTdG5r.js} +1 -1
- package/dist/assets/{links-BOMsu5GD.js → links-DAdFQ7bg.js} +1 -1
- package/dist/assets/{mermaid-Bo_iqjdJ.js → mermaid-CymwcI3a.js} +4 -4
- package/dist/assets/{min-C9AfBTFv.js → min-CTcwszLX.js} +1 -1
- package/dist/assets/{mindmap-definition-6CBA2TL7-CtNvR4hi.js → mindmap-definition-6CBA2TL7-B0mxrKt3.js} +1 -1
- package/dist/assets/{number-overlay-editor-BBgpgzMw.js → number-overlay-editor-CJPAXVuf.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-jmTd3pkw.js → pieDiagram-NIOCPIFQ-C-2hdQUk.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-C1AhHMJ4.js → quadrantDiagram-2OG54O6I-CL2YGs4R.js} +1 -1
- package/dist/assets/{react-plotly-CmEOpLH4.js → react-plotly-BsLWiFjm.js} +1 -1
- package/dist/assets/{requirementDiagram-QOLK2EJ7-cHmpzUIu.js → requirementDiagram-QOLK2EJ7-DQ4L9v8q.js} +1 -1
- package/dist/assets/{run-page-Dvdm4kWL.js → run-page-Bx99bWZ3.js} +1 -1
- package/dist/assets/{sankeyDiagram-4UZDY2LN-C9gKD1CM.js → sankeyDiagram-4UZDY2LN-BCeK9LuM.js} +1 -1
- package/dist/assets/{sequenceDiagram-SKLFT4DO-DzrJkOMo.js → sequenceDiagram-SKLFT4DO-2hUcwiWi.js} +1 -1
- package/dist/assets/{slides-component-CK0heWx4.js → slides-component-C4hf0v_2.js} +1 -1
- package/dist/assets/{sortBy-CADHTxpN.js → sortBy-DSGu1kis.js} +1 -1
- package/dist/assets/{stateDiagram-MI5ZYTHO-D7eKWYt_.js → stateDiagram-MI5ZYTHO-B-C8-fsa.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-Bv5ynAxn.js +1 -0
- package/dist/assets/{storage-BnZ6tGDt.js → storage-CssK1tjQ.js} +3 -3
- package/dist/assets/{terminal-BertI5HS.js → terminal-BHiJua_p.js} +1 -1
- package/dist/assets/{time-DYoBYo9P.js → time-Dq0rcdwf.js} +1 -1
- package/dist/assets/{timeline-definition-MYPXXCX6-BQkC8vYS.js → timeline-definition-MYPXXCX6-BwdXyFVw.js} +1 -1
- package/dist/assets/{tracing-Ci_pZpdF.js → tracing-erwDcbAl.js} +2 -2
- package/dist/assets/{trash-tg_SetZb.js → trash-DEAtdWrd.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-DDj8-IIS.js → treemap-75Q7IDZK-BoFrERFR.js} +1 -1
- package/dist/assets/{vega-component-C6Rt6Z9w.js → vega-component-XnrlJ16r.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-CgHaR4ZP.js → xychartDiagram-H2YORKM3-BRGXUZ-C.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -1
- package/dist/assets/_baseMap-BRZYvb4q.js +0 -1
- package/dist/assets/channel-zR7-RW0y.js +0 -1
- package/dist/assets/classDiagram-M3E45YP4-Cy0TkS9q.js +0 -1
- package/dist/assets/classDiagram-v2-YAWTLIQI-Cy0TkS9q.js +0 -1
- package/dist/assets/clone-ENI3TzRj.js +0 -1
- package/dist/assets/edit-page-BA6CA_l4.js +0 -148
- package/dist/assets/infoDiagram-LHK5PUON-DpVArEui.js +0 -2
- package/dist/assets/stateDiagram-v2-5AN5P6BG-CrZHhHaw.js +0 -1
@@ -1,148 +0,0 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-Ci_pZpdF.js","./index-CPVCa2dz.js","./index-BlxPam9h.css","./compile-BnHv8iHN.js","./time-DYoBYo9P.js","./timer-BwIYMJWC.js","./linear-BtOHrJPM.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-BnZ6tGDt.js","./index-DWnLMMAM.js","./index-CdPZmS8N.js","./index-DfeBSlHy.js","./index-DnIAY6gI.js","./index-CIooWgUc.js","./index-Bz7AXBQe.js","./index-CBjJLxgV.js","./index-C7oqh1GT.js","./index-x6nviym0.js","./index-B_2y4SIt.js","./index-CkVqTmEZ.js","./index-D7DYgZ9E.js","./index-D6KtMooK.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-tg_SetZb.js","./storage-B6yZpgAI.css","./links-BOMsu5GD.js","./index-P2Ifc_U7.js","./links-Dn1Stwqz.css","./circle-play-DZltiUnT.js","./_createAggregator-DvN_9uLC.js","./_baseEach-Z8e7apxp.js","./loro_wasm_bg-C3hKWL9L.js","./transform-B8bpuzxV.js","./sortBy-CADHTxpN.js","./_baseMap-BRZYvb4q.js","./terminal-BertI5HS.js","./terminal-B3isKKSk.css"])))=>i.map(i=>d[i]);
|
2
|
-
var RM=Object.defineProperty;var uk=Tt=>{throw TypeError(Tt)};var LM=(Tt,wt,Qt)=>wt in Tt?RM(Tt,wt,{enumerable:!0,configurable:!0,writable:!0,value:Qt}):Tt[wt]=Qt;var Z=(Tt,wt,Qt)=>LM(Tt,typeof wt!="symbol"?wt+"":wt,Qt),FM=(Tt,wt,Qt)=>wt.has(Tt)||uk("Cannot "+Qt);var hk=(Tt,wt,Qt)=>(FM(Tt,wt,"read from private field"),Qt?Qt.call(Tt):wt.get(Tt)),fk=(Tt,wt,Qt)=>wt.has(Tt)?uk("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(Tt):wt.set(Tt,Qt);import{c as Ee,is as dr,it as zM,iu as zf,iv as BM,iw as UM,ix as mk,iy as pk,iz as Ul,U as T,iA as $M,iB as VM,iC as gk,iD as HM,dH as WM,dK as qM,b as q,dF as Bf,a as H,T as et,ac as Je,j as c,a1 as Pn,a9 as $o,a8 as os,aa as rs,bn as Vo,a6 as ve,ab as on,iE as Ca,a7 as Ho,aS as Rn,ad as Na,at as Ne,ao as jt,dY as Uf,eM as Ea,iF as GM,aN as Le,S as it,iG as YM,e_ as gn,iH as xk,iI as bk,iJ as $l,iK as yk,L as ft,dx as Vl,aX as Wo,iL as Hl,aZ as $f,ag as Zt,iM as KM,aw as _a,iN as XM,iO as vk,eZ as wk,al as yt,b4 as kk,iP as jk,cA as Wl,iQ as JM,dP as Qe,iR as ql,dW as En,iS as Ia,V as Se,b9 as _n,iT as Gl,iU as Yl,eP as ss,iV as ZM,iW as Aa,iX as Sk,eX as Ck,iY as Vf,iZ as Hf,ep as Wf,i_ as Kn,i$ as ur,aV as Kl,j0 as QM,j1 as Xl,j2 as Jl,au as jo,ed as Nk,av as Ta,j3 as e9,j4 as Zl,bp as hr,eQ as fr,ft as Ek,bd as Ot,j5 as t9,j6 as n9,ga as Ql,aP as ec,j7 as qf,j8 as o9,j9 as _k,ja as Gf,jb as r9,jc as Yf,jd as Xn,je as Ik,gc as Kf,jf as Ma,jg as tc,eu as ut,ew as as,jh as pt,ji as ze,jj as at,jk as Xf,jl as s9,jm as Jf,jn as gt,jo as Ak,dr as Oa,dm as Da,dn as Pa,dp as Ra,dl as is,fG as Zf,b3 as Ln,aJ as In,fw as Tk,fy as Mk,fz as a9,fE as i9,fA as Ok,jp as Dk,ar as xe,eo as l9,b1 as So,a$ as Co,b2 as No,a_ as It,eY as rn,jq as Pk,fC as Rk,jr as c9,js as d9,fu as Lk,fv as Fk,jt as ls,dq as zk,ju as Bk,jv as u9,jw as h9,a5 as f9,a4 as m9,jx as Qf,du as p9,dw as em,fh as nc,jy as oc,jz as rc,bs as xn,eT as La,fe as sn,bi as Uk,dZ as zt,ej as g9,a2 as tm,jA as Fa,jB as sc,jC as x9,jD as b9,jE as $k,a3 as y9,ae as za,eJ as Vk,jF as Wt,aW as v9,af as nm,gf as Hk,eq as ac,jG as w9,gz as om,bh as ic,bk as k9,jH as j9,jI as Wk,gJ as S9,gH as C9,gK as N9,gL as E9,jJ as rm,ds as Fn,jK as _9,jL as lc,jM as cs,q as Jn,o as We,fX as zn,jN as bn,jO as nt,jP as ds,jQ as At,gb as Dt,jR as sm,et as yn,jS as I9,jT as am,bf as qk,bg as Gk,jU as A9,gB as us,jV as cc,bc as dc,gC as mr,e$ as im,jW as T9,jX as Yk,jY as Ba,jZ as Kk,j_ as lm,j$ as Xk,k0 as Jk,k1 as Zk,k2 as Qk,f0 as cm,k3 as M9,k4 as Zn,k5 as uc,k6 as e3,dt as t3,k7 as hc,gw as dm,k8 as Ua,k9 as $a,ka as Va,kb as fc,kc as qo,kd as n3,ke as Eo,kf as hs,kg as um,kh as Ha,ki as fs,kj as hm,kk as fm,kl as o3,km as mc,kn as O9,ay as Wa,ko as qa,kp as D9,dV as pc,kq as P9,kr as mm,ks as R9,kt as L9,ku as gc,e2 as F9,kv as pr,kw as xc,kx as ms,fW as An,g4 as _o,fS as r3,cl as s3,ky as pm,fF as a3,eI as i3,kz as l3,kA as Ga,kB as c3,kC as bc,kD as gm,kE as ps,kF as Ya,kG as Ka,kH as z9,fO as yc,kI as xm,kJ as vc,ei as B9,fP as U9,kK as $9,kL as V9,kM as H9,kN as W9,u as q9,kO as G9,kP as Y9,kQ as K9,f_ as X9,kR as J9,kS as d3,t as L,kT as Z9,kU as Q9,kV as eO,kW as tO,kX as nO,kY as oO,kZ as rO,k_ as sO,k$ as aO,l0 as iO,l1 as lO,l2 as cO,l3 as dO,l4 as uO,l5 as hO,l6 as fO,l7 as mO,l8 as pO,l9 as gO,la as xO,lb as bO,lc as yO,ld as Xa,le as vO,lf as wO,lg as kO,lh as jO,li as SO,lj as CO,lk as NO,ll as EO,lm as bm,ln as wc,lo as u3,lp as _O,lq as IO,lr as h3,ls as AO,lt as gs,lu as Tn,lv as TO,lw as MO,lx as OO,ly as DO,lz as PO,lA as RO,lB as LO,lC as FO,lD as zO,lE as BO,lF as Go,lG as UO,lH as $O,lI as VO,lJ as HO,d$ as WO,lK as qO,lL as f3,e3 as GO,lM as kc,lN as YO,lO as KO,lP as XO,lQ as JO,gM as Yo,lR as jc,lS as ZO,lT as QO,lU as m3,lV as ym,gA as xs,lW as eD,lX as tD,lY as nD,lZ as Ja,l_ as Za,eW as vm,l$ as oD,g3 as rD,bm as sD,an as wm,m0 as p3,m1 as aD,m2 as iD,m3 as km,m4 as jm,m5 as lD,m6 as g3,m7 as x3,m8 as Sc,fR as cD,Y as b3,dN as dD,m9 as y3,fr as vt,ma as Qa,mb as bs,mc as uD,md as hD,me as fD,mf as mD,ck as Sm,mg as pD,am as Ko,be as v3,mh as gD,mi as xD,mj as bD,mk as Cc,ml as w3,dL as Nc,bo as k3,ev as yD,mm as j3,mn as S3,mo as C3,mp as vD,mq as N3,mr as E3,ms as ei,mt as wD,mu as _3,mv as kD,mw as jD,mx as I3,Z as Ec,my as SD,bq as A3,mz as CD,as as Io,mA as ND,mB as ti,mC as ED,mD as T3,eV as M3,fI as _c,mE as Cm,aU as Nm,en as Ic,em as Em,mF as _D,eS as O3,mG as ID,mH as D3,fq as AD,mI as TD,gr as MD,fx as OD,fB as _m,gu as DD,bl as ni,mJ as P3,mK as Im,mL as PD,mM as RD,mN as LD,_ as vn,er as FD,mO as zD,mP as BD,mQ as R3,fj as Am,dz as L3,mR as UD,aq as gr,mS as $D,mT as VD,mU as HD,aO as WD,mV as qD,mW as GD,mX as YD,W as KD,mY as Ac,ff as XD,mZ as F3,fM as JD,gj as ZD,m_ as QD,m$ as z3,n0 as eP,n1 as ys,n2 as tP,n3 as Tc,n4 as nP,n5 as oP,n6 as rP,z as B3,gF as sP,n7 as oi,n8 as U3,n9 as $3,na as V3,nb as H3,nc as aP,C as W3,nd as iP,ne as lP,nf as cP,E as xr,f5 as q3,bb as dP,b8 as uP,ng as hP,nh as fP,ni as mP,dC as G3,nj as Tm,nk as pP,dX as Y3,nl as gP,nm as Mm,nn as xP,no as bP,np as yP,nq as K3,nr as X3,ns as J3,fd as Z3,nt as vP,nu as wP,nv as Q3,nw as ej,nx as Mc,ny as tj,nz as nj,nA as oj,nB as kP,nC as jP,nD as rj,nE as SP,nF as CP,nG as NP,nH as EP,nI as _P,nJ as IP,dU as AP,nK as TP,nL as MP,nM as OP,nN as DP,nO as PP,nP as RP,nQ as LP,nR as FP,nS as zP,nT as BP,nU as UP,fU as $P,nV as VP,nW as HP,nX as sj,nY as WP,ax as qP,nZ as GP,ap as YP,eL as KP,n_ as XP,gm as Om,gk as vs,gn as br,gl as yr,go as Dm,gp as Pm,n$ as aj,o0 as ij,o1 as lj,o2 as Xo,gt as JP,o3 as ZP,o4 as QP,o5 as eR,o6 as tR,o7 as nR,o8 as cj,eA as oR,o9 as Rm,oa as rR,ah as Oc,ob as dj,oc as uj,aj as hj,ai as sR,dT as aR,__tla as iR}from"./index-CPVCa2dz.js";import{b as ws,A as lR,L as fj,g as cR,G as dR,o as mj,s as uR,k as hR,B as pj,a as fR,M as mR,Y as pR,c as an,u as ri,C as gR,S as xR,K as bR,d as yR,i as vR,e as gj,f as wR,h as kR,j as si,P as ai,l as xj,m as jR,n as SR,p as CR,D as ks,q as NR,r as bj,t as Lm,T as ER}from"./links-BOMsu5GD.js";import{V as yj,d as vr,I as Fm,N as vj,S as wj,e as kj,f as jj,L as Sj,g as Cj,F as Nj,M as _R,l as Ej,h as IR,E as Dc,i as AR,j as zm,k as Bm,n as TR,o as MR,p as OR,q as DR,s as PR,t as RR,v as LR,w as FR,u as zR,C as BR,R as _j,A as UR,a as $R,T as VR,x as HR,y as WR,m as qR,z as GR,B as YR,O as KR,c as XR,P as JR,__tla as ZR}from"./storage-BnZ6tGDt.js";import{c as QR}from"./_createAggregator-DvN_9uLC.js";import{_ as Ij,a as Aj,i as eL,w as tL,L as Tj,A as nL,C as Mj,b as Um,c as Oj,__tla as oL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Bn,i as Jo,T as $m,a as Vm}from"./transform-B8bpuzxV.js";import{g as Dj}from"./timer-BwIYMJWC.js";import{i as rL}from"./zoom-COrs4lFh.js";import{s as ii}from"./sortBy-CADHTxpN.js";let Hm,Pc,ln,Rc,Pj,js,sL=Promise.all([(()=>{try{return iR}catch{}})(),(()=>{try{return ZR}catch{}})(),(()=>{try{return oL}catch{}})()]).then(async()=>{var Bl,lk;var Tt=QR(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,Qt,Wm,Lc,Ss,wr,Fc,zc,qm,Gm,li,Bc,Ym,ci,Km,Uc,Xm,Jm,$c,Zm,Qm,ep,di,tp,Vc,np,op,rp,sp,ap,ip,Hc,lp,Wc,qc,cp,dp,up,hp,fp,mp,ui,pp,gp,Gc,xp,bp,yp,Yc,vp,wp,kp,hi,Kc,Xc,jp,Sp,Cp,Np,Ep,_p,Ip,Ap,Tp,Jc,Zc,Mp,Op,Dp,fi,cn,dn;wt=Ee("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Qt=Ee("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"}]]),Wm=Ee("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"}]]),Lc=Ee("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ss=Ee("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),wr=Ee("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"}]]),Fc=Ee("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),zc=Ee("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Rc=Ee("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),qm=Ee("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Gm=Ee("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),li=Ee("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Bc=Ee("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"}]]),Ym=Ee("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"}]]),ci=Ee("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"}]]),Km=Ee("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Uc=Ee("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"}]]),Xm=Ee("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"}]]),Jm=Ee("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"}]]),$c=Ee("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"}]]),Zm=Ee("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Qm=Ee("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),ep=Ee("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"}]]),di=Ee("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"}]]),tp=Ee("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"}]]),Vc=Ee("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"}]]),np=Ee("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"}]]),op=Ee("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"}]]),rp=Ee("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"}]]),sp=Ee("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"}]]),ap=Ee("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"}]]),ip=Ee("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"}]]),Hc=Ee("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"}]]),lp=Ee("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"}]]),Wc=Ee("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"}]]),qc=Ee("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),cp=Ee("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"}]]),dp=Ee("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"}]]),up=Ee("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),hp=Ee("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"}]]),fp=Ee("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),mp=Ee("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"}]]),ui=Ee("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"}]]),pp=Ee("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"}]]),gp=Ee("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"}]]),Gc=Ee("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"}]]),xp=Ee("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),bp=Ee("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"}]]),yp=Ee("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"}]]),Yc=Ee("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"}]]),vp=Ee("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"}]]),wp=Ee("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),kp=Ee("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"}]]),hi=Ee("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=Ee("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=Ee("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),jp=Ee("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"}]]),Sp=Ee("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Cp=Ee("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"}]]),Np=Ee("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"}]]),Ep=Ee("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),_p=Ee("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"}]]),Ip=Ee("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"}]]),Ap=Ee("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"}]]),Tp=Ee("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"}]]),Jc=Ee("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"}]]),Zc=Ee("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"}]]),Mp=Ee("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Op=Ee("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"}]]),Dp=Ee("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"}]]),fi=Ee("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"}]]),cn=Ee("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"}]]),dn=Ee("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function mi(t,e){const n=+dr(t)-+dr(e);return n<0?-1:n>0?1:n}function Rj(t,e){const n=dr(t,e==null?void 0:e.in);return+function(o,r){const s=dr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=dr(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function Lj(t,e,n){const[o,r,s]=zf(n==null?void 0:n.in,t,t,e),a=mi(r,s),i=Math.abs(function(u,h,f){const[m,x]=zf(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=mi(r,s)===-a;Rj(o)&&i===1&&mi(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function Fj(t,e,n){const o=function(r,s){return+dr(r)-+dr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function zj(t,e){return function(n,o,r){const s=BM(),a=(r==null?void 0:r.locale)??s.locale??UM,i=mi(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=zf(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=Fj(u,d),f=(mk(u)-mk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<pk){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<Ul){const g=Math.round(m/pk);return a.formatDistance("xDays",g,l)}if(m<2*Ul)return x=Math.round(m/Ul),a.formatDistance("aboutXMonths",x,l);if(x=Lj(u,d),x<12){const g=Math.round(m/Ul);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return zM(n,Date.now())}(t),e)}const Bj=T.createContext({}),Uj=T.forwardRef(function(t,e){[t,e]=WM(t,e,Bj);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=T.useState(!1);$M(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=VM(),m=f==="rtl"&&d==="horizontal";let x=HM(a);const g=T.useRef(null);return{toolbarProps:{...gk(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=qM({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=gk(t);return delete r.id,q.createElement("div",{...Bf(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),pi="https://static.marimo.app",$j=t=>{const e=H.c(25),{onClose:n}=t,[o,r]=T.useState(""),{exportAsHTML:s}=et();let a;a=Math.random().toString(36).slice(2,6);const i=`${o}-${a}`,l=`${pi}/static/${i}`;let d,u,h,f,m,x,g,p,b,y,v;return e[0]!==s||e[1]!==n||e[2]!==i?(d=async w=>{w.preventDefault(),n();const S=await s({download:!1,includeCode:!0,files:yj.INSTANCE.filenames()}),j=Je({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${pi}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,path:i})}).catch(()=>{j.dismiss(),Je({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:Pn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),j.dismiss(),Je({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=s,e[1]=n,e[2]=i,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx($o,{children:"Share static notebook"}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsxs(os,{children:[u,c.jsxs(rs,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:pi,target:"_blank",children:pi}),"."]})]}),e[5]=h):h=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{const S=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(S)},e[6]=f):f=e[6],e[7]!==o?(m=c.jsx(Vo,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:f,required:!0,autoComplete:"off"}),e[7]=o,e[8]=m):m=e[8],e[9]!==l?(x=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Vj,{text:l}),c.jsx("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=x):x=e[10],e[11]!==m||e[12]!==x?(g=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[m,x]}),e[11]=m,e[12]=x,e[13]=g):g=e[13],e[14]!==n?(p=c.jsx(ve,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=p):p=e[15],e[16]!==l?(b=c.jsx(ve,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await on(l)},children:"Create"}),e[16]=l,e[17]=b):b=e[17],e[18]!==b||e[19]!==p?(y=c.jsxs(Ca,{children:[p,b]}),e[18]=b,e[19]=p,e[20]=y):y=e[20],e[21]!==y||e[22]!==d||e[23]!==g?(v=c.jsx(Ho,{className:"w-fit",children:c.jsxs("form",{onSubmit:d,children:[h,g,y]})}),e[21]=y,e[22]=d,e[23]=g,e[24]=v):v=e[24],v},Vj=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=Rn.stopPropagation(async d=>{d.preventDefault(),await on(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Na,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ve,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(Ne,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Pp(){const t=H.c(2),e=jt(Uf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=Ea.parse(a.parentNode.id);break}}e(a=>({mode:GM(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Ea.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Qc(t){const e=H.c(3),n=Cs();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Le(o)}function Rp(){const t=H.c(2),e=Cs();let n;return t[0]!==e?(n=()=>e(xk(gn())),t[0]=e,t[1]=n):n=t[1],Le(n)}function Cs(){const t=H.c(3),{prepareForRun:e}=it(),{sendRun:n}=et();let o;return t[0]!==e||t[1]!==n?(o=async r=>{var l,d;if(r.length===0)return;const{cellHandles:s,cellData:a}=gn(),i=[];for(const u of r){const h=s[u],f=(l=h==null?void 0:h.current)==null?void 0:l.editorView;let m;f?(bk(f)!=="markdown"&&$l(f),m=yk(f)):m=((d=a[u])==null?void 0:d.code)||"",i.push(m),e({cellId:u})}await n({cellIds:r,codes:i}).catch(Hj)},t[0]=e,t[1]=n,t[2]=o):o=t[2],Le(o)}function Hj(t){ft.error(t)}const ed=[{type:"files",Icon:np,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Vl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:Wo,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ui,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ws,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Xc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Hl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Jc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:$f,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:lR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Cp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:ip,tooltip:"Secrets",hidden:Zt(),position:"sidebar"},{type:"scratchpad",Icon:KM,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:_a,tooltip:"View errors",position:"footer"}];function Wj(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new XM(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=T.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Lp(t){return t.dropdown!==void 0}function gi(t,e=""){return t.flatMap(n=>n.label?Lp(n)?gi(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Ns=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=q.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},Es=yt(null),qj=yt(!1),td=kk("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),Gj=yt(t=>{const e=t(td);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(td,o=>({...o,activeChatId:n}))});function Fp(t){return t!==jk&&!!(t&&t.trim().length>0)}const xi=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},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],Wl(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(JM,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ve,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function _s(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=it(),{sendDeleteCell:o}=et();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=s=>{var d;if(Qe.get(ql))return;const{cellId:a}=s,i=Qe.get(En),l=(((d=i.cellData[a])==null?void 0:d.code)??"").trim()==="";if(e({cellId:a}),o({cellId:a}).catch(()=>{n()}),!l){const{dismiss:u}=Je({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(xi,{"data-testid":"undo-delete-button",onClick:()=>{n(),h()}})}),h=u}},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Le(r)}function Is(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=it(),{sendDeleteCell:o}=et();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=async s=>{if(Qe.get(ql))return;const{cellIds:a}=s;for(const d of a)await o({cellId:d}).then(()=>{e({cellId:d})});const{dismiss:i}=Je({title:"Cells deleted",action:c.jsx(xi,{"data-testid":"undo-delete-button",onClick:()=>{for(const d of a)n();l()}})}),l=i},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Le(r)}function zp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=it();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ia(r.cellId);if(!s)return;const a=yk(s);e(r);const{dismiss:i}=Je({title:"Cell split",action:c.jsx(xi,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],Le(o)}function nd(t){const e=H.c(51),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=it(),h=zp(),f=Qc(n==null?void 0:n.cellId),m=!Se(ql),x=_s(),{openModal:g}=_n(),p=jt(Es),b=Se(Gl),y=Se(Yl),v=Se(ss),w=Se(ZM),{saveCellConfig:S}=et();if(!n||v){let U;return e[0]===Symbol.for("react.memo_cache_sentinel")?(U=[],e[0]=U):U=e[0],U}const{cellId:j,config:C,getEditorView:_,name:E,hasOutput:M,hasConsoleOutput:I,status:D}=n;let F;e[1]!==j||e[2]!==C.disabled||e[3]!==S||e[4]!==r?(F=async()=>{const U={disabled:!C.disabled};await S({configs:{[j]:U}}),r({cellId:j,config:U})},e[1]=j,e[2]=C.disabled,e[3]=S,e[4]=r,e[5]=F):F=e[5];const O=F;let P;e[6]!==j||e[7]!==C.hide_code||e[8]!==_||e[9]!==S||e[10]!==r?(P=async()=>{const U={hide_code:!C.hide_code};await S({configs:{[j]:U}}),r({cellId:j,config:U});const $=_();$&&(U.hide_code?$.contentDOM.blur():$.focus())},e[6]=j,e[7]=C.hide_code,e[8]=_,e[9]=S,e[10]=r,e[11]=P):P=e[11];const R=P;let z,N,k,B,A;return e[12]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(Tp,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12],e[13]!==j||e[14]!==E||e[15]!==g||e[16]!==s?(N=()=>{g(c.jsxs(Ho,{children:[c.jsx(os,{children:c.jsx($o,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(hr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(vj,{placeholder:"cell name",value:E,onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),U.stopPropagation(),g(null))},onChange:U=>s({cellId:j,name:U})})]})]}))},e[13]=j,e[14]=E,e[15]=g,e[16]=s,e[17]=N):N=e[17],e[18]!==j||e[19]!==s?(k=U=>s({cellId:j,name:U}),e[18]=j,e[19]=s,e[20]=k):k=e[20],e[21]!==E||e[22]!==k?(B=c.jsx(vj,{placeholder:"cell name",value:E,onChange:k}),e[21]=E,e[22]=k,e[23]=B):B=e[23],e[24]!==d||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==m||e[29]!==j||e[30]!==u||e[31]!==C.disabled||e[32]!==C.hide_code||e[33]!==o||e[34]!==x||e[35]!==_||e[36]!==I||e[37]!==M||e[38]!==a||e[39]!==E||e[40]!==f||e[41]!==l||e[42]!==i||e[43]!==p||e[44]!==h||e[45]!==D||e[46]!==N||e[47]!==B||e[48]!==O||e[49]!==R?(A=[[{icon:z,label:"Name",disableClick:!0,handle:Jj,handleHeadless:N,rightElement:B},{icon:c.jsx(vr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:D==="running"||D==="queued"||D==="disabled-transitively"||C.disabled,handle:()=>f()},{icon:c.jsx(Aa,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(U=>(U==null?void 0:U.cellId)===j?null:{cellId:j})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Kc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:j})},{icon:c.jsx(Fm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!M,handle:()=>function(U){const $=document.getElementById(vk.create(U));$&&($.classList.add("printing-output"),wk($,"result.png").finally(()=>{$.classList.remove("printing-output")}))}(j)},{icon:c.jsx(Ck,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const U=_();U&&Sk({[j]:U})}},{icon:C.hide_code?c.jsx(Vf,{size:13,strokeWidth:1.5}):c.jsx(Hf,{size:13,strokeWidth:1.5}),label:C.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:C.disabled?c.jsx(cn,{size:13,strokeWidth:1.5}):c.jsx(dn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(Wf,{"data-testid":"cell-disable-switch",checked:!C.disabled,size:"sm",onCheckedChange:O}),handle:O},{icon:c.jsx(_a,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(M||I),handle:()=>{u({cellId:j})}}],[{icon:c.jsx(Kl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const U=_();U&&(Kn({autoInstantiate:y,createNewCell:o}),ur(U,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(Wo,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const U=_();U&&(Kn({autoInstantiate:y,createNewCell:o}),ur(U,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Xl,{}),label:"Toggle as Python",handle:()=>{const U=_();U&&(Kn({autoInstantiate:y,createNewCell:o}),QM(U,"python",{force:!0}))}}],[{icon:c.jsxs(Ns,{children:[c.jsx(li,{size:13,strokeWidth:1.5}),c.jsx(Jl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:j,before:!0})},{icon:c.jsxs(Ns,{children:[c.jsx(li,{size:13,strokeWidth:1.5}),c.jsx(jo,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:j,before:!1})},{icon:c.jsx(Jl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:j,before:!0})},{icon:c.jsx(jo,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:j,before:!1})},{icon:c.jsx(Nk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:j,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:j,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(zc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:j,scroll:!1})},{icon:c.jsx(Fc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:j,scroll:!1})},{icon:c.jsx(e9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:j})}],[{icon:c.jsx(fj,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Fp(E),tooltip:Fp(E)?void 0:"Only named cells can be linked to",handle:async()=>{await on(function(U){const $=new URL(window.location.href);return $.hash=`scrollTo=${encodeURIComponent(U)}`,$.toString()}(E)),Je({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(Zl,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:j})}}]].map(Kj).filter(Yj),e[24]=d,e[25]=b,e[26]=w,e[27]=y,e[28]=m,e[29]=j,e[30]=u,e[31]=C.disabled,e[32]=C.hide_code,e[33]=o,e[34]=x,e[35]=_,e[36]=I,e[37]=M,e[38]=a,e[39]=E,e[40]=f,e[41]=l,e[42]=i,e[43]=p,e[44]=h,e[45]=D,e[46]=N,e[47]=B,e[48]=O,e[49]=R,e[50]=A):A=e[50],A}function Yj(t){return t.length>0}function Kj(t){return t.filter(Xj)}function Xj(t){return!t.hidden}function Jj(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function Zj(t){return!t.hidden}const od=yt(!1),Bp=()=>{const t=H.c(37),[e,n]=Ot(od),o=t9(),r=Se(n9),s=Se(Ql);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=nd(a).flat();i=gi(i);const l=function(){const N=H.c(75),[k,B]=fr(),[A,U]=Ek(),{saveAppConfig:$,saveUserConfig:X}=et();let Y;N[0]!==X||N[1]!==B?(Y=async re=>{await X({config:re}).then(()=>{B(re)})},N[0]=X,N[1]=B,N[2]=Y):Y=N[2];const G=Y;let W;N[3]!==$||N[4]!==U?(W=async re=>{await $({config:re}).then(()=>{U(re)})},N[3]=$,N[4]=U,N[5]=W):W=N[5];const J=W;let V;if(N[6]!==A||N[7]!==k||N[8]!==J||N[9]!==G){let re,ne,ae,se,ie;N[11]!==A?(re=He=>He!==A.width,N[11]=A,N[12]=re):re=N[12],N[13]!==A||N[14]!==J?(ne=He=>({label:`App config > Set width=${He}`,handle:()=>{J({...A,width:He})}}),N[13]=A,N[14]=J,N[15]=ne):ne=N[15],N[16]!==k||N[17]!==G?(ae={label:"Config > Set theme: dark",handle:()=>{G({...k,display:{...k.display,theme:"dark"}})}},N[16]=k,N[17]=G,N[18]=ae):ae=N[18],N[19]!==k||N[20]!==G?(se={label:"Config > Set theme: light",handle:()=>{G({...k,display:{...k.display,theme:"light"}})}},N[19]=k,N[20]=G,N[21]=se):se=N[21],N[22]!==k||N[23]!==G?(ie={label:"Config > Set theme: system",handle:()=>{G({...k,display:{...k.display,theme:"system"}})}},N[22]=k,N[23]=G,N[24]=ie):ie=N[24];const ge=k.keymap.preset==="vim";let oe,ue;N[25]!==k||N[26]!==G?(oe=()=>{G({...k,keymap:{...k.keymap,preset:"vim"}})},N[25]=k,N[26]=G,N[27]=oe):oe=N[27],N[28]!==ge||N[29]!==oe?(ue={label:"Config > Switch keymap to VIM",hidden:ge,handle:oe},N[28]=ge,N[29]=oe,N[30]=ue):ue=N[30];const de=k.keymap.preset==="default";let Ce,Te,Fe;N[31]!==k||N[32]!==G?(Ce=()=>{G({...k,keymap:{...k.keymap,preset:"default"}})},N[31]=k,N[32]=G,N[33]=Ce):Ce=N[33],N[34]!==de||N[35]!==Ce?(Te={label:"Config > Switch keymap to default (current: VIM)",hidden:de,handle:Ce},N[34]=de,N[35]=Ce,N[36]=Te):Te=N[36],N[37]!==k||N[38]!==G?(Fe=()=>{G({...k,completion:{...k.completion,copilot:!1}})},N[37]=k,N[38]=G,N[39]=Fe):Fe=N[39];const _e=k.completion.copilot!=="github";let ke,Ye;N[40]!==Fe||N[41]!==_e?(ke={label:"Config > Disable GitHub Copilot",handle:Fe,hidden:_e},N[40]=Fe,N[41]=_e,N[42]=ke):ke=N[42],N[43]!==k||N[44]!==G?(Ye=()=>{G({...k,completion:{...k.completion,copilot:"github"}})},N[43]=k,N[44]=G,N[45]=Ye):Ye=N[45];const Ve=k.completion.copilot==="github";let Ke;N[46]!==Ye||N[47]!==Ve?(Ke={label:"Config > Enable GitHub Copilot",handle:Ye,hidden:Ve},N[46]=Ye,N[47]=Ve,N[48]=Ke):Ke=N[48];const ee=!k.display.reference_highlighting;let ye,we,Ie,K;N[49]!==k||N[50]!==G?(ye=()=>{G({...k,display:{...k.display,reference_highlighting:!1}})},N[49]=k,N[50]=G,N[51]=ye):ye=N[51],N[52]!==ee||N[53]!==ye?(we={label:"Config > Disable reference highlighting",hidden:ee,handle:ye},N[52]=ee,N[53]=ye,N[54]=we):we=N[54],N[55]!==k||N[56]!==G?(Ie=()=>{G({...k,display:{...k.display,reference_highlighting:!0}})},N[55]=k,N[56]=G,N[57]=Ie):Ie=N[57],N[58]!==k.display.reference_highlighting||N[59]!==Ie?(K={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:Ie},N[58]=k.display.reference_highlighting,N[59]=Ie,N[60]=K):K=N[60];const me=k.display.cell_output==="above";let pe,he;N[61]!==k||N[62]!==G?(pe=()=>{G({...k,display:{...k.display,cell_output:"above"}})},N[61]=k,N[62]=G,N[63]=pe):pe=N[63],N[64]!==me||N[65]!==pe?(he={label:"Config > Set cell output area: above",hidden:me,handle:pe},N[64]=me,N[65]=pe,N[66]=he):he=N[66];const je=k.display.cell_output==="below";let Pe,Re;N[67]!==k||N[68]!==G?(Pe=()=>{G({...k,display:{...k.display,cell_output:"below"}})},N[67]=k,N[68]=G,N[69]=Pe):Pe=N[69],N[70]!==je||N[71]!==Pe?(Re={label:"Config > Set cell output area: below",hidden:je,handle:Pe},N[70]=je,N[71]=Pe,N[72]=Re):Re=N[72],V=[...cR().filter(re).map(ne),ae,se,ie,ue,Te,ke,Ke,we,K,he,Re],N[6]=A,N[7]=k,N[8]=J,N[9]=G,N[10]=V}else V=N[10];const Q=V;let te;return N[73]!==Q?(te=Q.filter(Zj),N[73]=Q,N[74]=te):te=N[74],te}();let d=gg();d=[...gi(d),...gi(l)];const u=d.filter(Qj),h=ec.keyBy(u,eS),{recentCommands:f,addRecentCommand:m}=Wj();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=N=>{Yf(s.getHotkey("global.commandPalette").key)(N)&&(N.preventDefault(),n(tS))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Wl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(N,k)=>{const B=o[N];if(!B)return null;const A=s.getHotkey(N);return c.jsxs(Xn,{disabled:k.disabled,onSelect:()=>{m(N),n(!1),requestAnimationFrame(()=>{B()})},value:A.name,children:[c.jsxs("span",{children:[A.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Ik,{children:c.jsx(Kf,{shortcut:A.key})})]},N)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=N=>{const{label:k,handle:B,props:A,hotkey:U}=N,$=A===void 0?{}:A;return c.jsxs(Xn,{disabled:$.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,$.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",$.tooltip,")"]})]}),U&&c.jsx(Ik,{children:c.jsx(Kf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=r9;let j;t[16]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx(Ma,{placeholder:"Type to search..."}),t[16]=j):j=t[16];const C=Gf;let _;t[17]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(tc,{children:"No results found."}),t[17]=_):_=t[17];const E=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(qf,{heading:"Recently Used",children:f.map(N=>{const k=h[N];return o9(N)?y(N,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!Lp(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(_k,{})]}),M=qf,I=s.iterate().map(N=>{if(g.has(N))return null;const k=h[N];return y(N,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),D=u.map(N=>g.has(N.label)?null:w({label:N.label,handle:N.handleHeadless||N.handle,props:{disabled:N.disabled,tooltip:N.tooltip}}));let F;t[18]!==g||t[19]!==w?(F=N=>g.has(N.label)?null:w({label:`Cell > ${N.label}`,handle:N.handleHeadless||N.handle,props:{disabled:N.disabled,tooltip:N.tooltip}}),t[18]=g,t[19]=w,t[20]=F):F=t[20];const O=i.map(F);let P,R,z;return t[21]!==M||t[22]!==D||t[23]!==O||t[24]!==I?(P=c.jsxs(M,{heading:"Commands",children:[I,D,O]}),t[21]=M,t[22]=D,t[23]=O,t[24]=I,t[25]=P):P=t[25],t[26]!==C||t[27]!==P||t[28]!==_||t[29]!==E?(R=c.jsxs(C,{children:[_,E,P]}),t[26]=C,t[27]=P,t[28]=_,t[29]=E,t[30]=R):R=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==R||t[35]!==j?(z=c.jsxs(S,{open:e,onOpenChange:n,children:[j,R]}),t[31]=S,t[32]=e,t[33]=n,t[34]=R,t[35]=j,t[36]=z):z=t[36],z};function Qj(t){return!t.hotkey}function eS(t){return t.label}function tS(t){return!t}function Zo(){return at().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Up(){return at().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function bi(){return at().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function $p(){return at().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function Qo(){return at().nonempty().describe(ze.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Qn(){return at().describe(ze.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function er(){return at().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function tr(t){const e=s9.string().describe(ze.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Vp(){return as().default(!1).describe(ze.of({label:"Read Only"}))}const Hp=ut({type:pt("postgres"),host:Qo(),port:tr(5432).optional(),database:Qn(),username:er(),password:Zo(),ssl:as().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Wp=ut({type:pt("mysql"),host:Qo(),port:tr(3306),database:Qn(),username:er(),password:Zo(),ssl:as().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),qp=ut({type:pt("sqlite"),database:Qn().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),Gp=ut({type:pt("duckdb"),database:Qn().describe(ze.of({label:"Database Path"})),read_only:Vp()}).describe(ze.of({direction:"two-columns"})),Yp=ut({type:pt("motherduck"),database:Qn().default("my_db").describe(ze.of({label:"Database Name"})),token:Up()}).describe(ze.of({direction:"two-columns"})),Kp=ut({type:pt("snowflake"),account:at().nonempty().describe(ze.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:at().optional().describe(ze.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Qn(),schema:at().optional().describe(ze.of({label:"Schema",optionRegex:".*snowflake.*"})),username:er(),password:Zo(),role:at().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),Xp=ut({type:pt("bigquery"),project:at().nonempty().describe(ze.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:at().nonempty().describe(ze.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:at().describe(ze.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(ze.of({direction:"two-columns"})),Jp=ut({type:pt("clickhouse_connect"),host:Qo(),port:tr(8123).optional(),username:er(),password:Zo(),secure:as().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),Zp=ut({type:pt("timeplus"),host:Qo().default("localhost"),port:tr(8123).optional(),username:er().default("default"),password:Zo().default("")}).describe(ze.of({direction:"two-columns"})),Qp=ut({type:pt("chdb"),database:Qn().describe(ze.of({label:"Database Path"})),read_only:Vp()}).describe(ze.of({direction:"two-columns"})),eg=ut({type:pt("trino"),host:Qo(),port:tr(8080),database:Qn(),schema:at().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:er(),password:Zo(),async_support:as().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),tg=ut({type:pt("iceberg"),name:at().describe(ze.of({label:"Catalog Name"})),catalog:Xf("type",[ut({type:pt("REST"),warehouse:bi(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Up()}),ut({type:pt("SQL"),warehouse:bi(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ut({type:pt("Hive"),warehouse:bi(),uri:$p()}),ut({type:pt("Glue"),warehouse:bi(),uri:$p()}),ut({type:pt("DynamoDB"),"dynamodb.profile-name":at().optional().describe(ze.of({label:"Profile Name"})),"dynamodb.region":at().optional().describe(ze.of({label:"Region"})),"dynamodb.access-key-id":at().optional().describe(ze.of({label:"Access Key ID"})),"dynamodb.secret-access-key":at().optional().describe(ze.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":at().optional().describe(ze.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(ze.of({special:"tabs"}))}),ng=ut({type:pt("datafusion"),sessionContext:as().optional().describe(ze.of({label:"Use Session Context"}))}),og=ut({type:pt("pyspark"),host:Qo().optional(),port:tr().optional()}),rg=ut({type:pt("redshift"),host:Qo(),port:tr(5439),connectionType:Xf("type",[ut({type:pt("IAM credentials"),region:at().describe(ze.of({label:"Region"})),aws_access_key_id:at().nonempty().describe(ze.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:at().nonempty().describe(ze.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:at().optional().describe(ze.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ut({type:pt("DB credentials"),user:er(),password:Zo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Qn()}).describe(ze.of({direction:"two-columns"})),nS=Xf("type",[Hp,Wp,qp,Gp,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg,ng,og,rg]),rd="env:";function yi(t){return typeof t=="string"&&t.startsWith(rd)}function sd(t){return`${rd}${t}`}const sg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class qt{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 oS{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),yi(n)){const r=n.replace(rd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?kr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return kr(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 yi(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 rS extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database);return gt(`
|
4
|
-
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
|
5
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
6
|
-
`)}}class sS extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),a=this.secrets.printInFString("port",this.connection.port);return gt(`
|
7
|
-
DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${a}/${o}"
|
8
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
9
|
-
`)}}class aS extends qt{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 gt(`
|
10
|
-
${n}
|
11
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
12
|
-
`)}}class iS extends qt{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 gt(`
|
13
|
-
engine = ${this.orm}.create_engine(
|
14
|
-
URL(
|
15
|
-
${vi(n,o=>` ${o}`)},
|
16
|
-
)
|
17
|
-
)
|
18
|
-
`)}}class lS extends qt{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return gt(`
|
19
|
-
credentials = json.loads("""${this.connection.credentials_json}""")
|
20
|
-
engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
|
21
|
-
`)}}class cS extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return gt(`
|
22
|
-
DATABASE_URL = "${e}"
|
23
|
-
engine = ${this.orm}.connect(DATABASE_URL, read_only=${kr(this.connection.read_only)})
|
24
|
-
`)}}class dS extends qt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return gt(`
|
25
|
-
conn = duckdb.connect("md:${e}")
|
26
|
-
`);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return gt(`
|
27
|
-
conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
|
28
|
-
`)}}class uS extends qt{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 gt(`
|
29
|
-
engine = ${this.orm}.get_client(
|
30
|
-
${vi(n,o=>` ${o}`)},
|
31
|
-
)
|
32
|
-
`)}}class hS extends qt{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 gt(`
|
33
|
-
DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
|
34
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
35
|
-
`)}}class fS extends qt{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return gt(`
|
36
|
-
engine = ${this.orm}.connect(${e}, read_only=${kr(this.connection.read_only)})
|
37
|
-
`)}}class mS extends qt{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database),i=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return gt(`
|
38
|
-
engine = ${this.orm}.create_engine(f"${e}://${o}:${i}@${r}:${s}/${a}${n}")
|
39
|
-
`)}}class pS extends qt{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:Jf(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([a,i])=>i!=null&&i!==""&&a!=="type"));for(const[a,i]of Object.entries(e))yi(i)?e[a]=this.secrets.print(a,i):typeof i=="string"&&(e[a]=`"${i}"`);const n=(o=e,r=a=>` ${a}`,Object.entries(o).filter(([,a])=>a!=null&&a!=="").map(([a,i])=>{const l=`"${a}"`;return r(typeof i=="boolean"?`${l}: ${kr(i)}`:`${l}: ${i}`)}).join(`,
|
40
|
-
`));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return gt(`
|
41
|
-
catalog = RestCatalog(
|
42
|
-
${s},
|
43
|
-
**{
|
44
|
-
${n}
|
45
|
-
},
|
46
|
-
)
|
47
|
-
`);case"SQL":return gt(`
|
48
|
-
catalog = SqlCatalog(
|
49
|
-
${s},
|
50
|
-
**{
|
51
|
-
${n}
|
52
|
-
},
|
53
|
-
)
|
54
|
-
`);case"Hive":return gt(`
|
55
|
-
catalog = HiveCatalog(
|
56
|
-
${s},
|
57
|
-
**{
|
58
|
-
${n}
|
59
|
-
},
|
60
|
-
)
|
61
|
-
`);case"Glue":return gt(`
|
62
|
-
catalog = GlueCatalog(
|
63
|
-
${s},
|
64
|
-
**{
|
65
|
-
${n}
|
66
|
-
},
|
67
|
-
)
|
68
|
-
`);case"DynamoDB":return gt(`
|
69
|
-
catalog = DynamoDBCatalog(
|
70
|
-
${s},
|
71
|
-
**{
|
72
|
-
${n}
|
73
|
-
},
|
74
|
-
)
|
75
|
-
`);default:Jf(this.connection.catalog)}}}class gS extends qt{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?gt(`
|
76
|
-
ctx = SessionContext()
|
77
|
-
# Sample table
|
78
|
-
_ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
|
79
|
-
|
80
|
-
con = ibis.datafusion.connect(ctx)
|
81
|
-
`):gt(`
|
82
|
-
con = ibis.datafusion.connect()
|
83
|
-
`)}}class xS extends qt{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 gt(`
|
84
|
-
session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
|
85
|
-
con = ibis.pyspark.connect(session)
|
86
|
-
`)}return gt(`
|
87
|
-
con = ibis.pyspark.connect()
|
88
|
-
`)}}class bS extends qt{generateImports(){return["import redshift_connector"]}generateConnectionCode(){const e=this.secrets.print("host",this.connection.host),n=this.secrets.print("port",this.connection.port),o=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){const i=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),l=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),d=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0,u={iam:!0,host:e,port:n,region:`"${this.connection.connectionType.region}"`,database:o,access_key_id:i,secret_access_key:l,...d&&{session_token:d}};return gt(`
|
89
|
-
con = redshift_connector.connect(
|
90
|
-
${vi(u,h=>` ${h}`)},
|
91
|
-
)
|
92
|
-
`)}const r=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,s=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0,a={host:e,port:n,database:o,...r&&{user:r},...s&&{password:s}};return gt(`
|
93
|
-
con = redshift_connector.connect(
|
94
|
-
${vi(a,i=>` ${i}`)},
|
95
|
-
)
|
96
|
-
`)}}class yS{constructor(){this.secrets=new oS}createGenerator(e,n){switch(e.type){case"postgres":return new rS(e,n,this.secrets);case"mysql":return new sS(e,n,this.secrets);case"sqlite":return new aS(e,n,this.secrets);case"snowflake":return new iS(e,n,this.secrets);case"bigquery":return new lS(e,n,this.secrets);case"duckdb":return new cS(e,n,this.secrets);case"motherduck":return new dS(e,n,this.secrets);case"clickhouse_connect":return new uS(e,n,this.secrets);case"timeplus":return new hS(e,n,this.secrets);case"chdb":return new fS(e,n,this.secrets);case"trino":return new mS(e,n,this.secrets);case"iceberg":return new pS(e,n,this.secrets);case"datafusion":return new gS(e,n,this.secrets);case"pyspark":return new xS(e,n,this.secrets);case"redshift":return new bS(e,n,this.secrets);default:Jf(e)}}}function kr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function vi(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${kr(o)}`:`${n}=${o}`)).join(`,
|
97
|
-
`)}function ag(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const ig=t=>{const e=H.c(43),{providerNames:n,onClose:o,onSuccess:r}=t,{writeSecret:s}=et(),[a,i]=q.useState(""),[l,d]=q.useState(""),[u,h]=q.useState(n[0]);let f;e[0]!==a||e[1]!==u||e[2]!==r||e[3]!==l||e[4]!==s?(f=async N=>{if(N.preventDefault(),u)if(a&&l&&u)try{await s({key:a,value:l,provider:"dotenv",name:u}),Je({title:"Secret created",description:"The secret has been created successfully."}),r(a)}catch{Je({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else Je({title:"Error",description:"Please fill in all fields.",variant:"danger"});else Je({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=a,e[1]=u,e[2]=r,e[3]=l,e[4]=s,e[5]=f):f=e[5];const m=f;let x,g,p,b,y,v,w,S,j,C,_,E,M,I,D,F;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsxs(os,{children:[c.jsx($o,{children:"Add Secret"}),c.jsx(rs,{children:"Add a new secret to your environment variables."})]}),e[6]=x):x=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(hr,{htmlFor:"key",children:"Key"}),e[7]=g):g=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{i(N.target.value.replaceAll(/\W/g,"_"))},e[8]=p):p=e[8],e[9]!==a?(b=c.jsxs("div",{className:"grid gap-2",children:[g,c.jsx(Vo,{id:"key",value:a,onChange:p,placeholder:"MY_SECRET_KEY",required:!0})]}),e[9]=a,e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(hr,{htmlFor:"value",children:"Value"}),e[11]=y):y=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(v=N=>d(N.target.value),e[12]=v):v=e[12],e[13]!==l?(w=c.jsx(Vo,{id:"value",type:"text",value:l,onChange:v,required:!0,autoComplete:"off"}),e[13]=l,e[14]=w):w=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(S=window.location.href.startsWith("http://")&&c.jsx(Ak,{children:"Note: You are sending this key over http."}),e[15]=S):S=e[15],e[16]!==w?(j=c.jsxs("div",{className:"grid gap-2",children:[y,w,S]}),e[16]=w,e[17]=j):j=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(hr,{htmlFor:"location",children:"Location"}),e[18]=C):C=e[18],e[19]!==n.length?(_=n.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[19]=n.length,e[20]=_):_=e[20],e[21]!==u||e[22]!==n?(E=n.length>0&&c.jsxs(Oa,{value:u,onValueChange:N=>h(N),children:[c.jsx(Da,{children:c.jsx(Pa,{placeholder:"Select a provider"})}),c.jsx(Ra,{children:n.map(vS)})]}),e[21]=u,e[22]=n,e[23]=E):E=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsxs(Ak,{children:["You can configure the location by setting the"," ",c.jsx(Zf,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[24]=M):M=e[24],e[25]!==_||e[26]!==E?(I=c.jsxs("div",{className:"grid gap-2",children:[C,_,E,M]}),e[25]=_,e[26]=E,e[27]=I):I=e[27],e[28]!==j||e[29]!==I||e[30]!==b?(D=c.jsxs("div",{className:"grid gap-4 py-4",children:[b,j,I]}),e[28]=j,e[29]=I,e[30]=b,e[31]=D):D=e[31],e[32]!==o?(F=c.jsx(ve,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[32]=o,e[33]=F):F=e[33];const O=!a||!l||!u;let P,R,z;return e[34]!==O?(P=c.jsx(ve,{type:"submit",disabled:O,children:"Add Secret"}),e[34]=O,e[35]=P):P=e[35],e[36]!==F||e[37]!==P?(R=c.jsxs(Ca,{children:[F,P]}),e[36]=F,e[37]=P,e[38]=R):R=e[38],e[39]!==m||e[40]!==D||e[41]!==R?(z=c.jsx(Ho,{children:c.jsxs("form",{onSubmit:m,children:[x,D,R]})}),e[39]=m,e[40]=D,e[41]=R,e[42]=z):z=e[42],z};function vS(t){return c.jsx(is,{value:t,children:t},t)}const lg=T.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Ln.NOOP}),wS=t=>{const e=H.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:a,refetch:i}=In(CS,o);let l,d,u,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(d=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=d):d=e[4],e[5]!==a||e[6]!==s||e[7]!==i||e[8]!==l||e[9]!==d?(u={secretKeys:l,providerNames:d,loading:s,error:a,refreshSecrets:i},e[5]=a,e[6]=s,e[7]=i,e[8]=l,e[9]=d,e[10]=u):u=e[10],e[11]!==n||e[12]!==u?(h=c.jsx(lg,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function kS(t){return t.provider!=="env"}function jS(t){return t.name}function SS(t){return t.keys}async function CS(){const t=await wj.request({}),e=ag(t.secrets).filter(kS).map(jS);return{secretKeys:t.secrets.flatMap(SS).sort(),providerNames:e}}const cg=[{name:"PostgreSQL",schema:Hp,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:Wp,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:qp,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:Gp,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Yp,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:Kp,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Jp,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Zp,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:Xp,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:Qp,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:eg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:ng,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:og,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:rg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],dg=[{name:"Iceberg",schema:tg,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],NS=t=>{const e=H.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:x,logo:g}=h;return c.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-sm-solid hover:shadow-md-solid",style:{backgroundColor:x},onClick:()=>n(m),children:[c.jsx(Bk,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),c.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,i,l,d,u;return e[2]!==r?(s=cg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(a=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",c.jsx("hr",{className:"flex-1"})]}),e[6]=i):i=e[6],e[7]!==r?(l=dg.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=d):d=e[10],e[11]!==a||e[12]!==d?(u=c.jsxs(c.Fragment,{children:[a,i,d]}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u},ES=[{isMatch:t=>{if(t instanceof Dk||t instanceof c9){const{optionRegex:e}=ze.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=T.use(lg),{openModal:a,closeModal:i}=_n(),{label:l,description:d,optionRegex:u=""}=ze.parse(t._def.description||""),[h,f]=Tt(o,m=>new RegExp(u,"i").test(m));return c.jsx(Tk,{control:e.control,name:n,render:({field:m})=>c.jsxs(Mk,{children:[c.jsx(a9,{children:l}),c.jsx(i9,{children:d}),c.jsx(Ok,{children:c.jsxs("div",{className:"flex gap-2",children:[t instanceof Dk?c.jsx(Vo,{...m,value:m.value,onChange:m.onChange,className:xe("flex-1")}):c.jsx(l9,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),c.jsxs(So,{children:[c.jsx(Co,{asChild:!0,children:c.jsx(ve,{variant:"outline",size:"icon",className:xe(yi(m.value)&&"bg-accent"),children:c.jsx(Hc,{className:"h-3 w-3"})})}),c.jsxs(No,{align:"end",className:"max-h-60 overflow-y-auto",children:[c.jsxs(It,{onSelect:()=>{a(c.jsx(ig,{providerNames:r,onSuccess:x=>{s(),m.onChange(sd(x)),i()},onClose:i}))},children:[c.jsx(li,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsx(Pk,{children:"Recommended"})]}),h.map(x=>c.jsx(It,{onSelect:()=>m.onChange(sd(x)),children:x},x)),f.length>0&&c.jsx(rn,{}),f.map(x=>c.jsx(It,{onSelect:()=>m.onChange(sd(x)),children:x},x))]})]})]})}),c.jsx(Rk,{})]})})}}],_S=t=>{var B;const e=H.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,a,i;e[0]!==n?(s=d9(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(a=Lk(n),e[2]=n,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(i={defaultValues:s,resolver:a,reValidateMode:"onChange"},e[4]=s,e[5]=a,e[6]=i):i=e[6];const l=Fk(i),d=(B=[...cg,...dg].find(A=>A.schema===n))==null?void 0:B.connectionLibraries,[u,h]=T.useState((d==null?void 0:d.preferred)??"sqlalchemy"),{createNewCell:f}=it(),m=ls();let x;e[7]!==f||e[8]!==m?(x=A=>{f({code:A,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=x):x=e[9];const g=x;let p;e[10]!==g||e[11]!==o||e[12]!==u?(p=A=>{g(function(U,$){if(!($ in sg))throw new Error(`Unsupported library: ${$}`);nS.parse(U);const X=new yS,Y=X.createGenerator(U,$),G=Y.generateConnectionCode(),W=X.secrets,J=[...new Set([...W.imports,...Y.imports])].sort();J.push("");const V=W.formatSecrets();return V&&J.push(V),J.push(G.trim()),J.join(`
|
98
|
-
`)}(A,u)),o()},e[10]=g,e[11]=o,e[12]=u,e[13]=p):p=e[13];const b=p;let y;e[14]!==l||e[15]!==b?(y=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=y):y=e[16];let v,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(u9,{}),e[17]=v):v=e[17],e[18]!==l||e[19]!==n?(w=c.jsx(wS,{children:c.jsx(h9,{schema:n,form:l,renderers:ES,children:v})}),e[18]=l,e[19]=n,e[20]=w):w=e[20];let S;e[21]!==r?(S=c.jsx(ve,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=S):S=e[22];const j=!l.formState.isValid;let C,_;e[23]!==j?(C=c.jsx(ve,{type:"submit",disabled:j,children:"Add"}),e[23]=j,e[24]=C):C=e[24],e[25]!==S||e[26]!==C?(_=c.jsxs("div",{className:"flex gap-2",children:[S,C]}),e[25]=S,e[26]=C,e[27]=_):_=e[27];const E=Oa;let M,I;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=A=>h(A),e[28]=M):M=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[c.jsx(Da,{children:c.jsx(Pa,{placeholder:"Select a library"})}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=I):I=e[29];const D=Ra,F=zk,O=d==null?void 0:d.libraries.map(AS);let P,R,z,N,k;return e[30]!==F||e[31]!==O?(P=c.jsx(F,{children:O}),e[30]=F,e[31]=O,e[32]=P):P=e[32],e[33]!==D||e[34]!==P?(R=c.jsx(D,{children:P}),e[33]=D,e[34]=P,e[35]=R):R=e[35],e[36]!==E||e[37]!==u||e[38]!==M||e[39]!==I||e[40]!==R?(z=c.jsx("div",{children:c.jsxs(E,{value:u,onValueChange:M,children:[I,R]})}),e[36]=E,e[37]=u,e[38]=M,e[39]=I,e[40]=R,e[41]=z):z=e[41],e[42]!==_||e[43]!==z?(N=c.jsxs("div",{className:"flex gap-2 justify-between",children:[_,z]}),e[42]=_,e[43]=z,e[44]=N):N=e[44],e[45]!==N||e[46]!==y||e[47]!==w?(k=c.jsxs("form",{onSubmit:y,className:"space-y-4",children:[w,N]}),e[45]=N,e[46]=y,e[47]=w,e[48]=k):k=e[48],k},IS=t=>{const e=H.c(5),{onSubmit:n}=t,[o,r]=T.useState(null);if(!o){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(NS,{onSelect:r}),e[0]=i):i=e[0],i}let s,a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(a=c.jsx(_S,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a},ug=t=>{const e=H.c(6),{children:n}=t,[o,r]=T.useState(!1);let s,a,i;return e[0]!==n?(s=c.jsx(f9,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(hg,{onClose:()=>r(!1)}),e[2]=a):a=e[2],e[3]!==o||e[4]!==s?(i=c.jsxs(m9,{open:o,onOpenChange:r,children:[s,a]}),e[3]=o,e[4]=s,e[5]=i):i=e[5],i},hg=t=>{const e=H.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx($o,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsxs(os,{className:"mb-4",children:[o,c.jsxs(rs,{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"," ",c.jsx(Zf,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=c.jsxs(Ho,{className:"max-h-[75vh] overflow-y-auto",children:[r,c.jsx(IS,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function AS(t){return c.jsx(is,{value:t,children:sg[t]},t)}const TS=()=>{const t=H.c(7),{selectedLayout:e}=kj(),{setLayoutView:n}=jj();if(Zt()&&!Qf("wasm_layouts"))return null;let o,r,s,a;return t[0]!==n?(o=i=>n(i),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Da,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:c.jsx(Pa,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Ra,{children:c.jsxs(zk,{children:[c.jsx(p9,{children:"View as"}),Sj.map(OS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(a=c.jsxs(Oa,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=a):a=t[6],a};function MS(t){const e=fg(t);return c.jsx(e,{className:"h-4 w-4"})}function fg(t){switch(t){case"vertical":return cp;case"grid":return dR;case"slides":return Yc;default:return nc(t),oc}}function mg(t){return em(t)}function OS(t){return c.jsx(is,{value:t,children:c.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[MS(t),c.jsx("span",{children:mg(t)})]})},t)}const DS=()=>{const{updateCellConfig:t}=it(),{saveCellConfig:e}=et();return T.useCallback(async()=>{const n=new La,o=gn(),r=o.cellIds.inOrderIds,s={};for(const i of r){if(o.cellData[i]===void 0)continue;const{code:l,config:d}=o.cellData[i];d.hide_code||n.isSupported(l)&&(s[i]={hide_code:!0})}const a=ec.entries(s);if(a.length!==0){await e({configs:s});for(const[i,l]of a)t({cellId:i,config:l})}},[t])};function pg(){const t=H.c(4),{openConfirm:e}=_n(),n=jt(sn),{sendRestart:o}=et();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=()=>{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:c.jsx(Uk,{onClick:async()=>{n({state:zt.CLOSING}),await o(),g9()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],r}const As=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function gg(){var X,Y;const t=H.c(39),e=tm(),{openModal:n,closeModal:o}=_n(),{toggleApplication:r}=Fa(),{selectedPanel:s}=sc(),[a]=Ot(Uf),i=Se(ss),l=DS(),[d]=fr(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:x,expandAllCells:g}=it(),p=pg(),b=Rp(),y=function(G){const W=H.c(5),{openPrompt:J,closeModal:V}=_n(),{sendCopy:Q}=et();let te;return W[0]!==V||W[1]!==J||W[2]!==Q||W[3]!==G?(te=()=>{if(!G)return null;const re=rc.guessDeliminator(G),ne=xn.basename(G);J({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ne}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:ae=>{const se=re.join(xn.dirname(G),ae);Q({source:G,destination:se}).then(()=>{V(),Je({title:"Notebook copied",description:"A copy of the notebook has been created."}),mj(se)})}})},W[0]=V,W[1]=J,W[2]=Q,W[3]=G,W[4]=te):te=W[4],te}(e),v=jt(od),w=jt(uR),S=jt(hR),{exportAsMarkdown:j,readCode:C,saveCellConfig:_}=et(),E=Se(x9),M=Se(b9),I=Se($k),{selectedLayout:D}=kj(),{setLayoutView:F}=jj(),O=Pp(),P=((X=d.sharing)==null?void 0:X.html)??!0,R=((Y=d.sharing)==null?void 0:Y.wasm)??!0,z=eC;let N;t[0]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(jp,{size:14,strokeWidth:1.5}),t[0]=N):N=t[0];const k=!P&&!R;let B;t[1]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(j9,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1];const A=!P;let U,$;return t[2]!==o||t[3]!==n?(U=async()=>{n(c.jsx($j,{onClose:o}))},t[2]=o,t[3]=n,t[4]=U):U=t[4],t[5]!==I||t[6]!==f||t[7]!==o||t[8]!==x||t[9]!==y||t[10]!==g||t[11]!==j||t[12]!==e||t[13]!==E||t[14]!==M||t[15]!==l||t[16]!==i||t[17]!==n||t[18]!==C||t[19]!==p||t[20]!==b||t[21]!==_||t[22]!==D||t[23]!==s||t[24]!==v||t[25]!==S||t[26]!==F||t[27]!==w||t[28]!==R||t[29]!==k||t[30]!==A||t[31]!==U||t[32]!==r||t[33]!==O||t[34]!==h||t[35]!==u||t[36]!==m||t[37]!==a.mode?($=[{icon:N,label:"Share",handle:As,hidden:k,dropdown:[{icon:B,label:"Publish HTML to web",hidden:A,handle:U},{icon:c.jsx(fj,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{const W=await C(),J=y9({code:W.contents});await on(J),Je({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:c.jsx(nm,{size:14,strokeWidth:1.5}),label:"Download",handle:As,dropdown:[{icon:c.jsx(Nj,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await Cj({filename:e,includeCode:!0}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(Nj,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await Cj({filename:e,includeCode:!1}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(Kl,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const W=await j({download:!1});za(new Blob([W],{type:"text/plain"}),Vk.toMarkdown(document.title))}},{icon:c.jsx(Km,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const W=await C();za(new Blob([W.contents],{type:"text/plain"}),Vk.toPY(document.title))}},{divider:!0,icon:c.jsx(Fm,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",Wt("global.hideCode",!1)]}),handle:QS},{icon:c.jsx(v9,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",Wt("global.hideCode",!1)]}),handle:JS}]},{divider:!0,icon:c.jsx(xp,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:As,dropdown:ed.flatMap(W=>{const{type:J,Icon:V,hidden:Q}=W;return Q?[]:{label:em(J),rightElement:z(s===J),icon:c.jsx(V,{size:14,strokeWidth:1.5}),handle:()=>r(J)}})},{icon:c.jsx(Yc,{size:14,strokeWidth:1.5}),label:"Present as",handle:As,dropdown:[{icon:a.mode==="present"?c.jsx(Hk,{size:14,strokeWidth:1.5}):c.jsx(Wc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{O()}},...Sj.map((W,J)=>{const V=fg(W);return{divider:J===0,label:mg(W),icon:c.jsx(V,{size:14,strokeWidth:1.5}),rightElement:c.jsx("div",{className:"w-8 flex justify-end",children:D===W&&c.jsx(ac,{size:14})}),handle:()=>{F(W),a.mode==="edit"&&O()}}})]},{icon:c.jsx(tp,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||Zt(),handle:y},{icon:c.jsx(Bc,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const W=await C();await on(W.contents),Je({title:"Copied",description:"Code copied to clipboard."})}},{icon:c.jsx(dn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!E||i,handle:async()=>{const W=gn(),J=w9(W),V=ec.fromEntries(J.map(XS));await _({configs:V});for(const Q of J)u({cellId:Q,config:{disabled:!1}})}},{icon:c.jsx(cn,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!M||i,handle:async()=>{const W=gn(),J=xk(W),V=ec.fromEntries(J.map(KS));await _({configs:V});for(const Q of J)u({cellId:Q,config:{disabled:!0}})}},{icon:c.jsx(Hf,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:c.jsx(Gm,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x},{icon:c.jsx(qm,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:g},{icon:c.jsx(Jm,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:c.jsx(_a,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:c.jsx(Qm,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:c.jsx(Zc,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!I||i,handle:()=>{h()}},{icon:c.jsx(Wo,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(c.jsx(hg,{onClose:o}))}},{divider:!0,icon:c.jsx(Uc,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(YS)},{icon:c.jsx(om,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>w(GS)},{icon:c.jsx(lp,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>S(qS)},{icon:c.jsx(pj,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:WS},{icon:c.jsx(ic,{size:14,strokeWidth:1.5}),label:"Resources",handle:As,dropdown:[{icon:c.jsx(pj,{size:14,strokeWidth:1.5}),label:"Documentation",handle:HS},{icon:c.jsx(fR,{size:14,strokeWidth:1.5}),label:"GitHub",handle:VS},{icon:c.jsx(mR,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:$S},{icon:c.jsx(pR,{size:14,strokeWidth:1.5}),label:"YouTube",handle:US},{icon:c.jsx($f,{size:14,strokeWidth:1.5}),label:"Changelog",handle:BS}]},{divider:!0,icon:c.jsx(ap,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:zS},{icon:c.jsx(di,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:FS},{icon:c.jsx(Ip,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(LS).map(PS),t[5]=I,t[6]=f,t[7]=o,t[8]=x,t[9]=y,t[10]=g,t[11]=j,t[12]=e,t[13]=E,t[14]=M,t[15]=l,t[16]=i,t[17]=n,t[18]=C,t[19]=p,t[20]=b,t[21]=_,t[22]=D,t[23]=s,t[24]=v,t[25]=S,t[26]=F,t[27]=w,t[28]=R,t[29]=k,t[30]=A,t[31]=U,t[32]=r,t[33]=O,t[34]=h,t[35]=u,t[36]=m,t[37]=a.mode,t[38]=$):$=t[38],$}function PS(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(RS)}:t}function RS(t){return!t.hidden}function LS(t){return!t.hidden}function FS(){const t=k9();window.open(t,"_blank")}function zS(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function BS(){window.open(Pn.releasesPage,"_blank")}function US(){window.open(Pn.youtube,"_blank")}function $S(){window.open(Pn.discordLink,"_blank")}function VS(){window.open(Pn.githubPage,"_blank")}function HS(){window.open(Pn.docsPage,"_blank")}function WS(){window.open(Pn.docsPage,"_blank")}function qS(t){return!t}function GS(t){return!t}function YS(t){return!t}function KS(t){return[t,{disabled:!0}]}function XS(t){return[t,{disabled:!1}]}async function JS(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(ZS,0),setTimeout(()=>window.dispatchEvent(e),0)}function ZS(){return window.print()}async function QS(){const t=document.getElementById("App");t&&await wk(t,document.title)}function eC(t){return c.jsx("div",{className:"w-8 flex justify-end",children:t&&c.jsx(ac,{size:14})})}const tC=t=>{const e=H.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,a=gg();let i,l,d;e[0]!==s?(i=c.jsx("div",{children:s}),e[0]=s,e[1]=i):i=e[1],e[2]!==r?(l=!r&&c.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[c.jsx("span",{children:"Open command palette"}),Wt("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==i||e[5]!==l?(d=c.jsxs("div",{className:"flex flex-col gap-2",children:[i,l]}),e[4]=i,e[5]=l,e[6]=d):d=e[6];const u=d,h=r?"disabled":"hint-green";let f,m,x;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(_R,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==u?(m=c.jsx(Ne,{content:u,children:f}),e[8]=u,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(x=c.jsx(an,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=x):x=e[13];const g=x,p=nC;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=E=>{const M=c.jsx(It,{variant:E.variant,disabled:E.disabled,onSelect:I=>E.handle(I),"data-testid":`notebook-menu-dropdown-${E.label}`,children:p(E)},E.label);return E.tooltip?c.jsx(Ne,{content:E.tooltip,side:"left",delayDuration:100,children:c.jsx("span",{children:M})},E.label):M},e[14]=b):b=e[14];const y=b;let v,w,S,j,C,_;if(e[15]!==g||e[16]!==r?(v=c.jsx(Co,{asChild:!0,disabled:r,children:g}),e[15]=g,e[16]=r,e[17]=v):v=e[17],e[18]!==a){let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=M=>M.hidden?null:M.dropdown?c.jsxs(S9,{children:[c.jsx(C9,{"data-testid":`notebook-menu-dropdown-${M.label}`,children:p(M)}),c.jsx(N9,{children:c.jsx(E9,{children:M.dropdown.map(I=>c.jsxs(q.Fragment,{children:[I.divider&&c.jsx(rn,{}),y(I)]},I.label))})})]},M.label):c.jsxs(q.Fragment,{children:[M.divider&&c.jsx(rn,{}),y(M)]},M.label),e[20]=E):E=e[20],w=a.map(E),e[18]=a,e[19]=w}else w=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(rn,{}),e[21]=S):S=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:c.jsxs("span",{children:["Version: ",Wk()]})}),e[22]=j):j=e[22],e[23]!==w?(C=c.jsxs(No,{align:"end",className:"no-print w-[240px]",children:[w,S,j]}),e[23]=w,e[24]=C):C=e[24],e[25]!==v||e[26]!==C?(_=c.jsxs(So,{modal:!1,children:[v,C]}),e[25]=v,e[26]=C,e[27]=_):_=e[27],_};function nC(t){return c.jsxs(c.Fragment,{children:[t.icon&&c.jsx("span",{className:"flex-0 mr-2",children:t.icon}),c.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&c.jsx(rm,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function ad(t){return Fn("create"in t,'Expected query to have a "create" method'),t}const Ut=_9({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 xg(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?(Qe.set(Ut,{type:"setFind",find:n}),Qe.set(Ut,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):Qe.set(Ut,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return Qe.get(Ut).isOpen?(Qe.set(Ut,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{Qe.set(Ut,{type:"setIsOpen",isOpen:!0})}),!0):(Qe.set(Ut,{type:"setIsOpen",isOpen:!0}),!0)}function oC(){return!!Qe.get(Ut).isOpen&&(Qe.set(Ut,{type:"setIsOpen",isOpen:!1}),!0)}function wi(t){return()=>{const e=Qe.get(Ut),n=new lc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:ad(n).create(),search:n})}}const bg=t=>wi(({query:e})=>{const n=cs(),o=Qe.get(Ut).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const a=[...n,...n].slice(s);for(const i of a){const l=t==="next"?e.nextMatch(i.state,0,r??0):e.prevMatch(i.state,r??i.state.doc.length,i.state.doc.length);if(!l){r=null,i.dispatch({selection:Jn.single(0)});continue}const d=Jn.single(l.from,l.to);return i.dispatch({selection:d,effects:[We.scrollIntoView(d.main,{y:"center"})],userEvent:"select.search"}),Qe.set(Ut,{type:"setCurrentView",view:i,range:{from:l.from,to:l.to}}),l}return!1}),id=bg("next"),yg=bg("prev"),rC=wi(({query:t})=>{var o;const e=cs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(i=>{const{from:l,to:d}=i;return{from:l,to:d,insert:t.getReplacement(i)}});if(!s||s.length===0)continue;const a=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),sC=wi(({query:t})=>{const e=cs(),n=Qe.get(Ut).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const a of s){const i=t.nextMatch(a.state,0,o??0);if(!i){o=null,a.dispatch({selection:Jn.single(0)});continue}const l=a.state.toText(t.getReplacement(i));return a.dispatch({changes:[{from:i.from,to:i.to,insert:l}],userEvent:"input.replace"}),id()}return!1}),aC=wi(({query:t})=>{const e=cs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const a of s){const{from:i,to:l}=a,d=o.get(r)||new Map;d.set(`${i}:${l}`,n++),o.set(r,d)}}return{count:n,position:o}}),ld=At.define();function vg(){const t=cs();for(const e of t)e.state.readOnly||e.dispatch({effects:ld.of(new lc({search:""}))})}const ki=bn.define({create(){const t=Qe.get(Ut);return ad(new lc({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(ld)&&(t=ad(n.value).create());return t}}),iC=nt.mark({class:"cm-searchMatch"}),lC=nt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cC=zn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(ki))}update(t){const e=t.state.field(ki);(e!==t.startState.field(ki)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return nt.none;const{view:e}=this,n=new ds,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:a}=o[s];const{from:i}=o[s];for(;s<r-1&&a>o[s+1].from-500;)a=o[++s].to;t.highlight(e.state,i,a,(l,d)=>{const u=e.state.selection.ranges.some(h=>h.from===l&&h.to===d);n.add(l,d,u?lC:iC)})}return n.finish()}},{decorations:t=>t.decorations}),dC=We.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"}}),uC=()=>{var _e;const t=H.c(102),[e,n]=T.useState(!1),[o,r]=Ot(Ut),[s,a]=T.useState(),i=T.useRef(null),l=Se(Ql);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&xg(),t[0]=e,t[1]=o.isOpen,t[2]=d):d=t[2],Dt("cell.findAndReplace",d),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const ke=aC();a(ke===!1?void 0:ke)},t[3]=u):u=t[3];const h=u;let f,m,x,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&i.current&&(i.current.focus(),i.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),T.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(x=()=>{if(o.isOpen){if(o.findText==="")return a(void 0),void vg();h(),function(){const ke=Qe.get(Ut),Ye=cs();for(const Ve of Ye)Ve.state.readOnly||Ve.dispatch({effects:ld.of(new lc({search:ke.findText,caseSensitive:ke.caseSensitive,regexp:ke.regexp,replace:ke.replaceText,wholeWord:ke.wholeWord}))})}()}else vg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=x):x=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],T.useEffect(x,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(_e=s.position.get(p.view))==null?void 0:_e.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const y=b;let v,w,S,j,C,_,E,M,I,D,F;t[19]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!0),t[19]=v):v=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(w=()=>n(!1),t[20]=w):w=t[20],t[21]!==r?(S=ke=>{ke.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=S):S=t[22],t[23]!==r?(j=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=j):j=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(yn,{className:"w-4 h-4"}),t[25]=C):C=t[25],t[26]!==j?(_=c.jsx("div",{className:"absolute top-0 right-0",children:c.jsx(ve,{"data-testid":"close-find-replace-button",onClick:j,size:"xs",variant:"text",children:C})}),t[26]=j,t[27]=_):_=t[27],t[28]!==r?(E=ke=>{r({type:"setFind",find:ke.target.value})},t[28]=r,t[29]=E):E=t[29],t[30]!==o.findText||t[31]!==E?(M=c.jsx(Vo,{ref:i,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:fC,onChange:E}),t[30]=o.findText,t[31]=E,t[32]=M):M=t[32],t[33]!==r?(I=ke=>{r({type:"setReplace",replace:ke.target.value})},t[33]=r,t[34]=I):I=t[34],t[35]!==o.replaceText||t[36]!==I?(D=c.jsx(Vo,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:I}),t[35]=o.replaceText,t[36]=I,t[37]=D):D=t[37],t[38]!==M||t[39]!==D?(F=c.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[M,D]}),t[38]=M,t[39]=D,t[40]=F):F=t[40];const O=o.caseSensitive?"on":"off";let P,R,z;t[41]!==r?(P=ke=>r({type:"setCaseSensitive",caseSensitive:ke}),t[41]=r,t[42]=P):P=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(I9,{className:"w-4 h-4"}),t[43]=R):R=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==P?(z=c.jsx(Ne,{content:"Case Sensitive",children:c.jsx(sm,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:P,children:R})}),t[44]=o.caseSensitive,t[45]=O,t[46]=P,t[47]=z):z=t[47];const N=o.wholeWord?"on":"off";let k,B,A;t[48]!==r?(k=ke=>r({type:"setWholeWord",wholeWord:ke}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(Dp,{className:"w-4 h-4"}),t[50]=B):B=t[50],t[51]!==o.wholeWord||t[52]!==N||t[53]!==k?(A=c.jsx(Ne,{content:"Match Whole Word",children:c.jsx(sm,{size:"sm",pressed:o.wholeWord,"data-state":N,onPressedChange:k,children:B})}),t[51]=o.wholeWord,t[52]=N,t[53]=k,t[54]=A):A=t[54];const U=o.regexp?"on":"off";let $,X,Y,G,W;t[55]!==r?($=ke=>r({type:"setRegex",regexp:ke}),t[55]=r,t[56]=$):$=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(X=c.jsx(vp,{className:"w-4 h-4"}),t[57]=X):X=t[57],t[58]!==o.regexp||t[59]!==U||t[60]!==$?(Y=c.jsx(Ne,{content:"Use Regular Expression",children:c.jsx(sm,{size:"sm",pressed:o.regexp,"data-state":U,onPressedChange:$,children:X})}),t[58]=o.regexp,t[59]=U,t[60]=$,t[61]=Y):Y=t[61],t[62]!==z||t[63]!==A||t[64]!==Y?(G=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[z,A,Y]}),t[62]=z,t[63]=A,t[64]=Y,t[65]=G):G=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(W=()=>{sC()&&h()},t[66]=W):W=t[66];const J=o.findText==="";let V,Q;t[67]!==J?(V=c.jsx(ve,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:W,disabled:J,children:"Replace Next"}),t[67]=J,t[68]=V):V=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const ke=rC();if(!ke)return;h();const{dismiss:Ye}=Je({title:"Replaced all occurrences",action:c.jsx(xi,{"data-testid":"undo-replace-all-button",onClick:()=>{ke(),Ve()}})}),Ve=Ye},t[69]=Q):Q=t[69];const te=o.findText==="";let re,ne,ae,se,ie,ge,oe,ue,de,Ce,Te,Fe;return t[70]!==te?(re=c.jsx(ve,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:te,children:"Replace All"}),t[70]=te,t[71]=re):re=t[71],t[72]!==V||t[73]!==re?(ne=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[V,re]}),t[72]=V,t[73]=re,t[74]=ne):ne=t[74],t[75]!==G||t[76]!==ne?(ae=c.jsxs("div",{className:"flex flex-col gap-2",children:[G,ne]}),t[75]=G,t[76]=ne,t[77]=ae):ae=t[77],t[78]!==F||t[79]!==ae?(se=c.jsxs("div",{className:"flex items-center gap-3",children:[F,ae]}),t[78]=F,t[79]=ae,t[80]=se):se=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ie=c.jsx(Ne,{content:"Find Previous",children:c.jsx(ve,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:mC,children:c.jsx(wt,{className:"w-4 h-4"})})}),t[81]=ie):ie=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(ge=c.jsx(Ne,{content:"Find Next",children:c.jsx(ve,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:pC,children:c.jsx(Lc,{className:"w-4 h-4"})})}),t[82]=ge):ge=t[82],t[83]!==y||t[84]!==s?(oe=s!=null&&y==null&&c.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=oe):oe=t[85],t[86]!==y||t[87]!==s?(ue=s!=null&&y!=null&&c.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=ue):ue=t[88],t[89]!==oe||t[90]!==ue?(de=c.jsxs("div",{className:"flex items-center gap-2",children:[ie,ge,oe,ue]}),t[89]=oe,t[90]=ue,t[91]=de):de=t[91],t[92]!==l?(Ce=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Ce):Ce=t[93],t[94]!==Ce.key?(Te=c.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",c.jsx(Kf,{shortcut:Ce.key})," ","again to open the native browser search."]}),t[94]=Ce.key,t[95]=Te):Te=t[95],t[96]!==_||t[97]!==se||t[98]!==de||t[99]!==Te||t[100]!==S?(Fe=c.jsx(am,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{onFocus:v,onClick:hC,onBlur:w,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-(--sage-1) p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:S,children:[_,se,de,Te]})}),t[96]=_,t[97]=se,t[98]=de,t[99]=Te,t[100]=S,t[101]=Fe):Fe=t[101],Fe};function hC(t){t.stopPropagation(),t.preventDefault()}function fC(t){t.key==="Enter"&&(t.shiftKey?yg():id())}function mC(){return yg()}function pC(){return id()}const wg=t=>{const e=H.c(41),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:a,className:i}=t,l=n!==void 0&&n,d=r===void 0?null:r,u=s!==void 0&&s,{sendListFiles:h}=et(),[f,m]=T.useState(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[g,p]=T.useState(x),[b,y]=T.useState(!1),v=T.useRef(null),w=T.useRef(!1);let S,j,C;e[1]!==d?(S=()=>{m(d)},j=[d],e[1]=d,e[2]=S,e[3]=j):(S=e[2],j=e[3]),T.useEffect(S,j),e[4]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{y(!0)},e[4]=C):C=e[4];const _=C;let E;e[5]!==d||e[6]!==l?(E=te=>{var re;(re=te.relatedTarget)!=null&&re.closest(".filename-input")||(y(!1),l&&m(d))},e[5]=d,e[6]=l,e[7]=E):E=e[7];const M=E;let I;e[8]!==f?(I=xn.dirname(f||""),e[8]=f,e[9]=I):I=e[9];const D=I,F=xn.basename(f||""),O=g.filter(te=>xn.basename(te.path).startsWith(F));let P,R;e[10]!==D||e[11]!==b||e[12]!==h?(P=async()=>{if(!b)return void p([]);const te=await h({path:D});p(te.files)},e[10]=D,e[11]=b,e[12]=h,e[13]=P):P=e[13],e[14]!==D||e[15]!==b?(R=[D,b],e[14]=D,e[15]=b,e[16]=R):R=e[16];const{isPending:z}=In(P,R),N=function(te,re,ne){if(te&&!te.endsWith("/")&&((Qf("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(xn.extension(te))||(te=te.endsWith(".")?`${te}py`:te.endsWith(".p")?`${te}y`:`${te}.py`),!re.some(ae=>ae.path===te||xn.basename(ae.path)===te)&&!(ne&&(ne===te||xn.basename(ne)===te))))return te}(f,g,d),k=(N||O.length>0)&&c.jsxs(Gf,{className:"font-mono",children:[!z&&c.jsx(tc,{children:"No files"}),N&&c.jsxs(Xn,{variant:"success",className:"py-2 px-3",onSelect:()=>{var te;N&&(w.current=!0,a(N),(te=v.current)==null||te.blur())},children:[c.jsx(ep,{className:"w-4 h-4 mr-2"})," ",c.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",c.jsx("span",{className:"font-medium text-sm",children:xn.basename(N)})]})]},"_rename_"),O.map(te=>{const re=te.isDirectory?"directory":qk(te.path),ne=Gk[re];return c.jsxs(Xn,{variant:te.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{te.isDirectory?m(`${te.path}/`):m(te.path)},children:[c.jsx(ne,{className:"w-4 h-4 mr-2"})," ",xn.basename(te.path)]},te.path)})]}),B=10*Math.max(20,(f==null?void 0:f.length)||(o==null?void 0:o.length)||0),A=b?f||"":d||"";let U,$,X;e[17]!==u||e[18]!==B?(U=u?{maxWidth:B}:void 0,e[17]=u,e[18]=B,e[19]=U):U=e[19],e[20]!==i?($=xe(i,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[20]=i,e[21]=$):$=e[21],e[22]!==o||e[23]!==A||e[24]!==U||e[25]!==$?(X=c.jsx(A9,{children:c.jsx(Ma,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:A,onKeyDown:gC,icon:null,ref:v,onValueChange:m,placeholder:o,autoComplete:"off",style:U,className:$})}),e[22]=o,e[23]=A,e[24]=U,e[25]=$,e[26]=X):X=e[26];const Y=k&&"group-focus-within:block";let G,W,J,V,Q;return e[27]!==Y?(G=xe("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[27]=Y,e[28]=G):G=e[28],e[29]!==k||e[30]!==G?(W=c.jsx(us,{side:"bottom",className:G,portal:!1,children:k}),e[29]=k,e[30]=G,e[31]=W):W=e[31],e[32]!==X||e[33]!==W?(J=c.jsxs(Gf,{children:[X,W]}),e[32]=X,e[33]=W,e[34]=J):J=e[34],e[35]!==M||e[36]!==J?(V=c.jsx(cc,{onFocus:_,onBlur:M,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:J}),e[35]=M,e[36]=J,e[37]=V):V=e[37],e[38]!==b||e[39]!==V?(Q=c.jsx(dc,{children:c.jsx(mr,{open:b,modal:!1,children:V})}),e[38]=b,e[39]=V,e[40]=Q):Q=e[40],Q};function gC(t){t.key==="Escape"&&t.currentTarget.blur()}const xC=t=>{const e=H.c(33),n=()=>{za(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=Le(vC);let r,s,a,i,l,d,u,h,f,m,x,g,p,b,y,v,w;return e[0]!==n||e[1]!==t?(r=S=>{S.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=S=>{S.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx($o,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i={wordBreak:"break-word"},e[6]=i):i=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("p",{children:"This app has unsaved changes. To recover:"}),d={paddingBottom:"10px"},e[7]=l,e[8]=d):(l=e[7],d=e[8]),e[9]!==t.proposedName?(u=c.jsxs("li",{style:d,children:['Click the "Download" button. This will download a file called\xA0',c.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=c.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(x=c.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=x):x=e[16],e[17]!==x||e[18]!==m?(g=c.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",x," with the recovered changes."]}),e[17]=x,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==u?(p=c.jsx(rs,{className:"markdown break-words",style:i,children:c.jsxs("div",{className:"prose dark:prose-invert",children:[l,c.jsxs("ol",{children:[u,g]})]})}),e[20]=g,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=c.jsx(ve,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(ve,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==b?(v=c.jsxs(Ca,{children:[b,y]}),e[26]=b,e[27]=v):v=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==v?(w=c.jsx(Ho,{className:"w-fit",children:c.jsxs("form",{onSubmit:r,onKeyDown:s,children:[a,p,v]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=v,e[32]=w):w=e[32],w},bC=t=>{const e=H.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=_n();let a;e[0]!==n?(a=n===null?"app":xn.basename(n).split(".")[0],e[0]=n,e[1]=a):a=e[1];const i=a;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==i?(l=()=>{o&&r(c.jsx(xC,{proposedName:i,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=i,e[6]=l):l=e[6];const d=l;let u;Dt("global.save",d),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=Wt("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(hi,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==d||e[10]!==h?(m=c.jsx(Ne,{content:u,children:c.jsx(an,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m};function yC(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function vC(){const t=gn(),e=im(t),n={version:"1",metadata:{marimo_version:Wk()},cells:e.map(yC)};return JSON.stringify(n,null,2)}const cd=5e3,dd=yt(void 0),kg=yt(t=>{const e=t(dd);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:a}=n,i=s.inOrderIds.map(h=>a[h]),l=i.map(h=>h.code),d=i.map(h=>h.config),u=i.map(h=>h.name);return!(Yk(l,r.codes)&&Yk(u,r.names)&&Ba(d,r.configs)&&Ba(o.selectedLayout,r.layout.selectedLayout)&&Ba(o.layoutData,r.layout.layoutData))}({state:t(En),layout:t(Ej),lastSavedNotebook:e})});function wC(t){return JSON.stringify(t)}const kC=t=>{const e=H.c(15),{kioskMode:n}=t,o=tm(),r=Se(kg),s=Se(sn).state===zt.CLOSED,{saveOrNameNotebook:a,saveIfNotebookIsPersistent:i}=ud();let l,d,u;e[0]!==n||e[1]!==i?(l={onSave:i,kioskMode:n},e[0]=n,e[1]=i,e[2]=l):l=e[2],function(p){const b=H.c(14),y=Se(Jk),v=cm(),[w]=Ot(sn),S=Se(kg);let j,C;if(b[0]!==v){const D=im(v);j=D.map(EC),C=D.map(NC),b[0]=v,b[1]=j,b[2]=C}else j=b[1],C=b[2];const _=C;let E;b[3]!==v?(E=Xk(v),b[3]=v,b[4]=E):E=b[4];const M=E;let I;b[5]!==y||b[6]!==_||b[7]!==j||b[8]!==M||b[9]!==w||b[10]!==S||b[11]!==p.kioskMode||b[12]!==p.onSave?(I={onSave:p.onSave,needsSave:S,codes:j,cellConfigs:M,cellNames:_,connStatus:w,config:y,kioskMode:p.kioskMode},b[5]=y,b[6]=_,b[7]=j,b[8]=M,b[9]=w,b[10]=S,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=I):I=b[13],function(D){const F=H.c(21),{codes:O,cellConfigs:P,config:R,connStatus:z,cellNames:N,needsSave:k,kioskMode:B,onSave:A}=D,U=T.useRef(null);let $;F[0]!==O?($=O.join(":"),F[0]=O,F[1]=$):$=F[1];const X=$;let Y;F[2]!==P?(Y=P.map(wC).join(":"),F[2]=P,F[3]=Y):Y=F[3];const G=Y;let W;F[4]!==N?(W=N.join(":"),F[4]=N,F[5]=W):W=F[5];const J=W;let V,Q;F[6]!==R||F[7]!==z.state||F[8]!==B||F[9]!==k||F[10]!==A?(V=()=>{if(!B)return R.autosave==="after_delay"&&(U.current!==null&&clearTimeout(U.current),k&&z.state===zt.OPEN&&(U.current=setTimeout(A,R.autosave_delay))),()=>{U.current!==null&&clearTimeout(U.current)}},F[6]=R,F[7]=z.state,F[8]=B,F[9]=k,F[10]=A,F[11]=V):V=F[11],F[12]!==G||F[13]!==J||F[14]!==X||F[15]!==R||F[16]!==z.state||F[17]!==B||F[18]!==k||F[19]!==A?(Q=[X,G,J,R,z.state,A,B,k],F[12]=G,F[13]=J,F[14]=X,F[15]=R,F[16]=z.state,F[17]=B,F[18]=k,F[19]=A,F[20]=Q):Q=F[20],T.useEffect(V,Q)}(I)}(l),function(){const p=H.c(12),b=Se(T9),{state:y}=Se(sn),v=b.auto_download.includes("markdown"),w=b.auto_download.includes("html"),S=b.auto_download.includes("ipynb"),j=!v||y!==zt.OPEN,C=!w||y!==zt.OPEN,_=!S||y!==zt.OPEN,{autoExportAsHTML:E,autoExportAsIPYNB:M,autoExportAsMarkdown:I}=et();let D,F,O,P,R,z;p[0]!==I?(D=async()=>{await I({download:!1})},p[0]=I,p[1]=D):D=p[1],p[2]!==j?(F={delayMs:cd,whenVisible:!0,disabled:j},p[2]=j,p[3]=F):F=p[3],ri(D,F),p[4]!==E?(O=async()=>{await E({download:!1,includeCode:!0,files:yj.INSTANCE.filenames()})},p[4]=E,p[5]=O):O=p[5],p[6]!==C?(P={delayMs:cd,whenVisible:!0,disabled:C},p[6]=C,p[7]=P):P=p[7],ri(O,P),p[8]!==M?(R=async()=>{await M({download:!1})},p[8]=M,p[9]=R):R=p[9],p[10]!==_?(z={delayMs:cd,whenVisible:!0,disabled:_},p[10]=_,p[11]=z):z=p[11],ri(R,z)}(),e[3]!==r?(d=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]=d):d=e[4],Wl(window,"beforeunload",d),e[5]!==a?(u=p=>{p.preventDefault(),p.stopPropagation(),a()},e[5]=a,e[6]=u):u=e[6];const h=u;if(Dt("global.save",a),s){let p;return e[7]!==o||e[8]!==r?(p=c.jsx(bC,{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=Wt("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let x,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(hi,{strokeWidth:1.5,size:18}),e[11]=x):x=e[11],e[12]!==h||e[13]!==m?(g=c.jsx(Ne,{content:f,children:c.jsx(an,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:x})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function ud(){const t=H.c(20),{sendSave:e}=et(),{openModal:n,closeModal:o,openAlert:r}=_n(),s=jt(dd),a=Kk(),i=lm();let l;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==i?(l=(b,y)=>{const v=gn(),w=im(v),S=w.map(CC),j=w.map(SC),C=w.map(jC),_=Xk(v),E=i.get(sn),M=i.get(Jk),I=i.get(Ej);i.get(ss)||j.length!==0&&(E.state===zt.OPEN?(ft.log("saving to ",b),e({cellIds:S,codes:j,names:C,filename:b,configs:_,layout:IR(),persist:!0}).then(()=>{y&&M.format_on_save&&Zk(),s({names:C,codes:j,configs:_,layout:I})})):r("Failed to save notebook: not connected to a kernel."))},t[0]=r,t[1]=e,t[2]=s,t[3]=i,t[4]=l):l=t[4];const d=Le(l);let u;t[5]!==d||t[6]!==i?(u=b=>{const y=b!==void 0&&b,v=i.get(Qk),w=i.get(sn);jg(v)&&w.state===zt.OPEN&&d(v,y)},t[5]=d,t[6]=i,t[7]=u):u=t[7];const h=Le(u);let f;t[8]!==d||t[9]!==a?(f=b=>{a(b).then(y=>{y!==null&&d(y,!0)})},t[8]=d,t[9]=a,t[10]=f):f=t[10];const m=f;let x;t[11]!==o||t[12]!==m||t[13]!==n||t[14]!==h||t[15]!==i?(x=()=>{const b=i.get(Qk),y=i.get(sn);h(!0),jg(b)||y.state===zt.CLOSED||n(c.jsx(_C,{onClose:o,onSave:m}))},t[11]=o,t[12]=m,t[13]=n,t[14]=h,t[15]=i,t[16]=x):x=t[16];const g=Le(x);let p;return t[17]!==h||t[18]!==g?(p={saveOrNameNotebook:g,saveIfNotebookIsPersistent:h},t[17]=h,t[18]=g,t[19]=p):p=t[19],p}function jC(t){return t.name}function SC(t){return t.code}function CC(t){return t.id}function jg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function NC(t){return t.name}function EC(t){return t.code}const _C=t=>{const e=H.c(17),{onClose:n,onSave:o}=t,[r,s]=T.useState();let a;e[0]!==n||e[1]!==o?(a=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=a):a=e[2];const i=a;let l,d,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx($o,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(hr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=d):d=e[4],e[5]!==i?(u=c.jsxs("div",{className:"flex flex-col",children:[d,c.jsx(wg,{onNameChange:i,placeholderText:"filename",className:"missing-filename"})]}),e[5]=i,e[6]=u):u=e[6],e[7]!==n?(h=c.jsx(ve,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,x,g;return e[9]!==f?(m=c.jsx(ve,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs(Ca,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==u||e[15]!==x?(g=c.jsxs(Ho,{children:[l,u,x]}),e[14]=u,e[15]=x,e[16]=g):g=e[16],g};function Sg(t){const e=H.c(3),[n,o]=T.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const a=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(a)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),T.useEffect(r,s),t&&n}const Ts=t=>{const{children:e}=t;return Se(ss)?null:e},IC=t=>{const{children:e}=t;return Se(ss)?e:null},AC=()=>{const t=H.c(6),e=jt(od);let n;t[0]!==e?(n=()=>e(TC),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=Wt("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Uc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(a=c.jsx(Ne,{content:r,children:c.jsx(an,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=a):a=t[5],a};function TC(t){return!t}const MC=t=>{const e=H.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:a,running:i,appConfig:l}=t,d=l.width,u=Se($k),h=Se(M9),{undoDeleteCell:f}=it(),m=a===zt.CLOSED;let x,g=null;if(!m&&u){let k,B;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Zc,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?(B=c.jsx(Ne,{content:"Undo cell deletion",children:c.jsx(an,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=B):B=e[2],g=B}e[3]!==a?(x=Zn(a),e[3]=a,e[4]=x):x=e[4];const p=x;let b;e[5]!==a||e[6]!==p?(b=p?uc(a):void 0,e[5]=a,e[6]=p,e[7]=b):b=e[7];const y=b;let v,w;e[8]!==n?(v=!n&&c.jsx(uC,{}),e[8]=n,e[9]=v):v=e[9],e[10]!==m||e[11]!==y||e[12]!==p||e[13]!==n?(w=!m&&c.jsxs("div",{className:PC,children:[n&&c.jsx(TS,{}),c.jsx(tC,{disabled:p,tooltip:y}),c.jsx(gR,{disabled:p,tooltip:y}),c.jsx(xR,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=m,e[11]=y,e[12]=p,e[13]=n,e[14]=w):w=e[14];const S=d==="compact"&&"xl:flex-row items-end";let j,C,_,E,M,I,D,F,O,P,R,z,N;return e[15]!==S?(j=xe(RC,S),e[15]=S,e[16]=j):j=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ts,{children:c.jsx(kC,{kioskMode:!1})}),e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(_=Wt("global.hideCode"),e[18]=_):_=e[18],e[19]!==n?(E=n?c.jsx(Hk,{strokeWidth:1.5,size:18}):c.jsx(Wc,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=E):E=e[20],e[21]!==o||e[22]!==E?(M=c.jsx(Ne,{content:_,children:c.jsx(an,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:E})}),e[21]=o,e[22]=E,e[23]=M):M=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(AC,{}),D=c.jsx(bR,{}),F=c.jsx("div",{}),e[24]=I,e[25]=D,e[26]=F):(I=e[24],D=e[25],F=e[26]),e[27]!==m||e[28]!==r||e[29]!==i?(O=!m&&c.jsx(DC,{running:i,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=i,e[30]=O):O=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(P=!m&&c.jsx(OC,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=P):P=e[34],e[35]!==O||e[36]!==P||e[37]!==g?(R=c.jsx(Ts,{children:c.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,O,P]})}),e[35]=O,e[36]=P,e[37]=g,e[38]=R):R=e[38],e[39]!==M||e[40]!==R||e[41]!==j?(z=c.jsxs("div",{className:j,children:[C,M,I,D,F,R]}),e[39]=M,e[40]=R,e[41]=j,e[42]=z):z=e[42],e[43]!==z||e[44]!==v||e[45]!==w?(N=c.jsxs(c.Fragment,{children:[v,w,z]}),e[43]=z,e[44]=v,e[45]=w,e[46]=N):N=e[46],N},OC=t=>{const e=H.c(8),{needsRun:n,onRun:o}=t,r=Se(e3);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Wt("global.runStale"),e[0]=l):l=e[0];const d=r?o:void 0,u=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(vr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==d||e[3]!==u?(f=c.jsx(Ne,{content:l,children:c.jsx(an,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:d,disabled:u,children:h})}),e[2]=d,e[3]=u,e[4]=f):f=e[4],f}const s=!r;let a,i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(vr,{strokeWidth:1.5,size:16}),e[5]=a):a=e[5],e[6]!==s?(i=c.jsx(Ne,{content:"Nothing to run",children:c.jsx(an,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:a})}),e[6]=s,e[7]=i):i=e[7],i},DC=t=>{const e=H.c(8),{running:n,onInterrupt:o}=t,r=Sg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Wt("global.interrupt"),e[0]=s):s=e[0];const a=!r&&"inactive-button active:shadow-xs-solid";let i;e[1]!==a?(i=xe(a),e[1]=a,e[2]=i):i=e[2];const l=r?"yellow":"disabled",d=r?o:Ln.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(oc,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==i||e[5]!==l||e[6]!==d?(h=c.jsx(Ne,{content:s,children:c.jsx(an,{className:i,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:d,children:u})}),e[4]=i,e[5]=l,e[6]=d,e[7]=h):h=e[7],h},PC="absolute top-3 right-5 m-0 flex items-center gap-2 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",RC="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",LC=t=>{const e=H.c(7),{filename:n}=t,o=Kk();let r;e[0]!==n?(r=n?xn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let a;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(a=c.jsx(wg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=a):a=e[6],a},hd=()=>({entries:new Map}),{valueAtom:Cg,useActions:Ng}=t3(hd,{submit:(t,e)=>{const{cellIds:n,deleteCell:o,deleteManyCells:r,store:s}=e,a=s.get(En),i=s.get(hc),l=new Set(a.cellIds.inOrderIds.filter(h=>a.cellData[h].code.trim()==="")),d=new Map;for(const h of n){if(l.has(h)){d.set(h,{cellId:h,type:"simple"});continue}const f=a.cellRuntime[h],m=new Map;for(const g of Object.values(i)){const p=g.declaredBy.includes(h),b=g.usedBy.some(y=>!l.has(y));p&&b&&m.set(g.name,g.usedBy)}let x;f!=null&&f.runElapsedTimeMs&&f.runElapsedTimeMs>2e3&&(x=f.runElapsedTimeMs),m.size===0&&x===void 0?d.set(h,{cellId:h,type:"simple"}):d.set(h,{cellId:h,type:"expensive",executionDurationMs:x,defs:m})}const u=[...d.values()].every(h=>h.type==="simple");return d.size>0&&u?(d.size===1?o({cellId:[...d.values()][0].cellId}):r({cellIds:[...d.values()].map(h=>h.cellId)}),hd()):{...t,entries:d}},clear:()=>hd()});function Ms(){const t=lm(),{submit:e,clear:n}=Ng(),{entries:o}=Se(Cg),r=_s(),s=Is();return T.useMemo(()=>({submit:a=>{e({cellIds:a,deleteCell:r,deleteManyCells:s,store:t})},clear:n,get idle(){return o.size===0},get shouldConfirmDelete(){return o.size>1}}),[t,e,n,o,r,s])}function FC(t){return t.cellId}function Eg(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:fd,useActions:zC}=t3(Eg,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),a=r.indexOfOrThrow(n),[i,l]=s<a?[s,a]:[a,s],d=r.slice(i,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(d)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:Eg()});function ji(){return zC()}const BC=t=>{const e=H.c(14),{actions:n,cellIds:o,disabled:r}=t;let s,a,i,l,d;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Dc,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(a=c.jsx(Co,{asChild:!0,children:c.jsx(ve,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",disabled:r,children:s})}),e[1]=r,e[2]=a):a=e[2],e[3]!==n||e[4]!==o){let u;e[6]!==n.length||e[7]!==o?(u=(h,f)=>{const m=h.map(x=>c.jsx(It,{onSelect:()=>x.handle(o),className:"flex items-center gap-2",children:c.jsxs("div",{className:"flex items-center flex-1",children:[x.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:x.icon}),c.jsx("div",{className:"flex-1",children:x.label}),x.hotkey&&c.jsx(rm,{shortcut:x.hotkey,className:"ml-4"})]})},x.label));return c.jsxs(q.Fragment,{children:[m,f<n.length-1&&c.jsx(rn,{})]},f)},e[6]=n.length,e[7]=o,e[8]=u):u=e[8],i=n.flatMap(u),e[3]=n,e[4]=o,e[5]=i}else i=e[5];return e[9]!==i?(l=c.jsx(No,{align:"start","data-keep-cell-selection":!0,children:i}),e[9]=i,e[10]=l):l=e[10],e[11]!==a||e[12]!==l?(d=c.jsxs(So,{children:[a,l]}),e[11]=a,e[12]=l,e[13]=d):d=e[13],d};function UC(t){return t.length>0}function $C(t){return t.filter(VC)}function VC(t){return!t.hidden}function HC(t){return t.length>0}function WC(t){return t.filter(qC)}function qC(t){return!t.hidden}function GC(t){const e={};t.forEach(n=>{const o=Ia(n);o&&(e[n]=o)}),Sk(e)}const YC=()=>{const t=H.c(4),e=Se(fd);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=c.jsxs(c.Fragment,{children:[c.jsx(XC,{cellIds:o}),c.jsx(KC,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},md=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},KC=t=>{const e=H.c(12),{cellIds:n}=t,o=Ms(),r=Is(),s=ji();if(!o.shouldConfirmDelete)return null;let a,i,l,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(dm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[0]=a):a=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[c.jsx("p",{className:"text-(--amber-11) font-medium",children:"Some cells in selection may contain expensive operations."}),c.jsx("p",{className:"text-(--amber-11) mt-1",children:"Are you sure you want to delete?"})]}),e[1]=i):i=e[1],e[2]!==o?(l=c.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.clear(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),e[2]=o,e[3]=l):l=e[3],e[4]!==n||e[5]!==r||e[6]!==o||e[7]!==s?(d=c.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>{r({cellIds:n}),o.clear(),s.clear()},className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"}),e[4]=n,e[5]=r,e[6]=o,e[7]=s,e[8]=d):d=e[8],e[9]!==l||e[10]!==d?(u=c.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"mx-20",children:c.jsx("div",{className:"bg-(--amber-2) border border-(--amber-6) rounded-lg shadow-lg mt-14 px-4 py-3 animate-in slide-in-from-top-2 duration-200",children:c.jsxs("div",{className:"flex items-start gap-3",children:[a,c.jsxs("div",{className:"flex-1",children:[i,c.jsx(am,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:JC,children:[l,d]})})]})]})})})}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u},XC=t=>{const e=H.c(23),{cellIds:n}=t,o=ji(),r=Ms(),{actions:s,moreActions:a}=function(p){const b=H.c(31),{updateCellConfig:y,moveCell:v,clearCellOutput:w,sendToTop:S,sendToBottom:j}=it(),C=Is(),_=Se(ql),E=ji(),M=Cs(),I=Ms(),D=Se(Ua),{saveCellConfig:F}=et(),O=p.length,P=!_||O<p.length;let R;b[0]!==C||b[1]!==I||b[2]!==E||b[3]!==D?(R=re=>{I.idle&&D.keymap.destructive_delete?I.submit(re):(C({cellIds:re}),I.clear(),E.clear())},b[0]=C,b[1]=I,b[2]=E,b[3]=D,b[4]=R):R=b[4];const z=Le(R);let N;b[5]!==v?(N=(re,ne)=>{if(ne==="down"){const ae=re[re.length-1];if(Qe.get(En).cellIds.findWithId(ae).last()===ae)return}if(ne==="up"){const ae=re[0];if(Qe.get(En).cellIds.findWithId(ae).first()===ae)return}(ne==="up"?re:[...re].reverse()).forEach(ae=>{v({cellId:ae,before:ne==="up"})})},b[5]=v,b[6]=N):N=b[6];const k=Le(N);let B;b[7]!==S?(B=re=>{[...re].reverse().forEach(ne=>{S({cellId:ne})})},b[7]=S,b[8]=B):B=b[8];const A=Le(B);let U;b[9]!==j?(U=re=>{re.forEach(ne=>{j({cellId:ne})})},b[9]=j,b[10]=U):U=b[10];const $=Le(U),X=Le(GC);let Y;b[11]!==w?(Y=re=>{re.forEach(ne=>{w({cellId:ne})})},b[11]=w,b[12]=Y):Y=b[12];const G=Le(Y);let W;b[13]!==F||b[14]!==y?(W=async(re,ne,ae)=>{const se={};re.forEach(ie=>{se[ie]={[ne]:ae}}),await F({configs:se}),re.forEach(ie=>{y({cellId:ie,config:se[ie]})})},b[13]=F,b[14]=y,b[15]=W):W=b[15];const J=Le(W);let V,Q,te;if(b[16]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(vr,{size:13,strokeWidth:1.5}),b[16]=V):V=b[16],b[17]!==M?(Q=re=>M(re),b[17]=M,b[18]=Q):Q=b[18],b[19]!==P||b[20]!==G||b[21]!==z||b[22]!==X||b[23]!==k||b[24]!==$||b[25]!==A||b[26]!==Q||b[27]!==J){const re=[[{icon:V,label:"Run cells",handle:Q,hotkey:"cell.run"}],[{icon:c.jsx(Jl,{size:13,strokeWidth:1.5}),label:"Move up",handle:ie=>k(ie,"up"),hotkey:"cell.moveUp"},{icon:c.jsx(jo,{size:13,strokeWidth:1.5}),label:"Move down",handle:ie=>k(ie,"down"),hotkey:"cell.moveDown"}],[{icon:c.jsx(Zl,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!P,handle:z}]],ne=[[{icon:c.jsx(Ck,{size:13,strokeWidth:1.5}),label:"Format cells",handle:X,hotkey:"cell.format"},{icon:c.jsx(_a,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:G}],[{icon:c.jsx(Hf,{size:13,strokeWidth:1.5}),label:"Hide code",handle:ie=>J(ie,"hide_code",!0),hotkey:"cell.hideCode"},{icon:c.jsx(Vf,{size:13,strokeWidth:1.5}),label:"Show code",handle:ie=>J(ie,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:c.jsx(Jl,{size:13,strokeWidth:1.5}),label:"Move up",handle:ie=>k(ie,"up"),hotkey:"cell.moveUp"},{icon:c.jsx(jo,{size:13,strokeWidth:1.5}),label:"Move down",handle:ie=>k(ie,"down"),hotkey:"cell.moveDown"},{icon:c.jsx(zc,{size:13,strokeWidth:1.5}),label:"Send to top",handle:A,hotkey:"cell.sendToTop"},{icon:c.jsx(Fc,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:$,hotkey:"cell.sendToBottom"}],[{icon:c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:ie=>J(ie,"disabled",!0)},{icon:c.jsx(dn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:ie=>J(ie,"disabled",!1)}]],ae=re.map(WC);let se;b[29]!==ae?(se=ae.filter(HC),b[29]=ae,b[30]=se):se=b[30],te={actions:se,moreActions:ne.map($C).filter(UC)},b[19]=P,b[20]=G,b[21]=z,b[22]=X,b[23]=k,b[24]=$,b[25]=A,b[26]=Q,b[27]=J,b[28]=te}else te=b[28];return te}(n),i=n.length;let l;e[0]!==r||e[1]!==o?(l=p=>{(p.target instanceof HTMLElement||p.target instanceof SVGElement)&&p.target.closest("[data-keep-cell-selection]")!==null||p.target instanceof HTMLHtmlElement||(r.clear(),o.clear())},e[0]=r,e[1]=o,e[2]=l):l=e[2],Wl(window,"mousedown",l);const d=!r.idle;let u,h,f,m,x,g;if(e[3]!==i?(u=c.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 shrink-0",children:[i," cells selected"]}),e[3]=i,e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(md,{}),e[5]=h):h=e[5],e[6]!==s||e[7]!==n||e[8]!==d){let p;e[10]!==s.length||e[11]!==n||e[12]!==d?(p=(b,y)=>c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.map(v=>c.jsxs(ve,{variant:v.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>v.handle(n),className:"h-8 px-2 gap-1 shrink-0 flex items-center",title:v.label,disabled:d&&v.label!=="Delete cells",children:[v.icon,c.jsx("span",{className:"text-xs",children:v.label}),v.hotkey&&c.jsx("div",{className:"ml-1 border bg-muted rounded-md px-1",children:c.jsx(rm,{shortcut:v.hotkey})})]},v.label)),y<s.length-1&&c.jsx(md,{})]},y),e[10]=s.length,e[11]=n,e[12]=d,e[13]=p):p=e[13],f=s.map(p),e[6]=s,e[7]=n,e[8]=d,e[9]=f}else f=e[9];return e[14]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(md,{}),e[14]=m):m=e[14],e[15]!==n||e[16]!==d||e[17]!==a?(x=c.jsx(BC,{actions:a,cellIds:n,disabled:d}),e[15]=n,e[16]=d,e[17]=a,e[18]=x):x=e[18],e[19]!==u||e[20]!==f||e[21]!==x?(g=c.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 border border-(--slate-7) rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:c.jsxs("div",{className:"flex items-center gap-1",children:[u,h,f,m,x]})})}),e[19]=u,e[20]=f,e[21]=x,e[22]=g):g=e[22],g};function JC(t){t.stopPropagation()}const ZC={display:"none"};function QC(t){let{id:e,value:n}=t;return q.createElement("div",{id:e,style:ZC},n)}function eN(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return q.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 _g=T.createContext(null),tN={draggable:`
|
99
|
-
To pick up a draggable item, press the space bar.
|
100
|
-
While dragging, use the arrow keys to move the item.
|
101
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
102
|
-
`},nN={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 oN(t){let{announcements:e=nN,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=tN}=t;const{announce:s,announcement:a}=function(){const[h,f]=T.useState("");return{announce:T.useCallback(m=>{m!=null&&f(m)},[]),announcement:h}}(),i=$a("DndLiveRegion"),[l,d]=T.useState(!1);if(T.useEffect(()=>{d(!0)},[]),function(h){const f=T.useContext(_g);T.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(h)},[h,f])}(T.useMemo(()=>({onDragStart(h){let{active:f}=h;s(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:m}=h;e.onDragMove&&s(e.onDragMove({active:f,over:m}))},onDragOver(h){let{active:f,over:m}=h;s(e.onDragOver({active:f,over:m}))},onDragEnd(h){let{active:f,over:m}=h;s(e.onDragEnd({active:f,over:m}))},onDragCancel(h){let{active:f,over:m}=h;s(e.onDragCancel({active:f,over:m}))}}),[s,e])),!l)return null;const u=q.createElement(q.Fragment,null,q.createElement(QC,{id:o,value:r.draggable}),q.createElement(eN,{id:i,announcement:a}));return n?Wa.createPortal(u,n):u}var Mt;function Si(){}function Ig(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Mt||(Mt={}));const Mn=Object.freeze({x:0,y:0});function pd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function gd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function rN(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function xd(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 bd(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function Ag(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 yd=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=Ag(e,e.left,e.top),s=[];for(const a of o){const{id:i}=a,l=n.get(i);if(l){const d=pd(Ag(l),r);s.push({id:i,data:{droppableContainer:a,value:d}})}}return s.sort(gd)};function sN(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),a=r-o,i=s-n;if(o<r&&n<s){const l=e.width*e.height,d=t.width*t.height,u=a*i;return Number((u/(l+d-u)).toFixed(4))}return 0}const Tg=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:a}=s,i=n.get(a);if(i){const l=sN(i,e);l>0&&r.push({id:a,data:{droppableContainer:s,value:l}})}}return r.sort(rN)};function aN(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function Mg(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Mn}function iN(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,a)=>({...s,top:s.top+t*a.y,bottom:s.bottom+t*a.y,left:s.left+t*a.x,right:s.right+t*a.x}),{...e})}}const lN=iN(1),cN={ignoreTransform:!1};function jr(t,e){e===void 0&&(e=cN);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=Eo(t).getComputedStyle(t);d&&(n=function(h,f,m){const x=function(C){if(C.startsWith("matrix3d(")){const _=C.slice(9,-1).split(/, /);return{x:+_[12],y:+_[13],scaleX:+_[0],scaleY:+_[5]}}if(C.startsWith("matrix(")){const _=C.slice(7,-1).split(/, /);return{x:+_[4],y:+_[5],scaleX:+_[0],scaleY:+_[3]}}return null}(f);if(!x)return h;const{scaleX:g,scaleY:p,x:b,y}=x,v=h.left-b-(1-g)*parseFloat(m),w=h.top-y-(1-p)*parseFloat(m.slice(m.indexOf(" ")+1)),S=g?h.width/g:h.width,j=p?h.height/p:h.height;return{width:S,height:j,top:w,right:v+S,bottom:w+j,left:v}}(n,d,u))}const{top:o,left:r,width:s,height:a,bottom:i,right:l}=n;return{top:o,left:r,width:s,height:a,bottom:i,right:l}}function Og(t){return jr(t,{ignoreTransform:!0})}function Ci(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(o3(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!mc(r)||O9(r)||n.includes(r))return n;const s=Eo(t).getComputedStyle(r);return r!==t&&function(a,i){i===void 0&&(i=Eo(a).getComputedStyle(a));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(d=>{const u=i[d];return typeof u=="string"&&l.test(u)})}(r,s)&&n.push(r),function(a,i){return i===void 0&&(i=Eo(a).getComputedStyle(a)),i.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function Dg(t){const[e]=Ci(t,1);return e??null}function vd(t){return fm&&t?mm(t)?t:R9(t)?o3(t)||t===hs(t).scrollingElement?window:mc(t)?t:null:null:null}function Pg(t){return mm(t)?t.scrollX:t.scrollLeft}function Rg(t){return mm(t)?t.scrollY:t.scrollTop}function wd(t){return{x:Pg(t),y:Rg(t)}}var Pt;function Lg(t){return!(!fm||!t)&&t===document.scrollingElement}function Fg(t){const e={x:0,y:0},n=Lg(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"})(Pt||(Pt={}));const dN={x:.2,y:.2};function uN(t,e,n,o,r){let{top:s,left:a,right:i,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=dN);const{isTop:d,isBottom:u,isLeft:h,isRight:f}=Fg(t),m={x:0,y:0},x={x:0,y:0},g=e.height*r.y,p=e.width*r.x;return!d&&s<=e.top+g?(m.y=Pt.Backward,x.y=o*Math.abs((e.top+g-s)/g)):!u&&l>=e.bottom-g&&(m.y=Pt.Forward,x.y=o*Math.abs((e.bottom-g-l)/g)),!f&&i>=e.right-p?(m.x=Pt.Forward,x.x=o*Math.abs((e.right-p-i)/p)):!h&&a<=e.left+p&&(m.x=Pt.Backward,x.x=o*Math.abs((e.left+p-a)/p)),{direction:m,speed:x}}function hN(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 zg(t){return t.reduce((e,n)=>fs(e,wd(n)),Mn)}const fN=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+Pg(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+Rg(n),0)}]];class kd{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=Ci(n),r=zg(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,i]of fN)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=i(o),u=r[s]-d;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Os{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 jd(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 wn,tt;function Bg(t){t.preventDefault()}function mN(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"})(wn||(wn={})),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"}(tt||(tt={}));const Ug={start:[tt.Space,tt.Enter],cancel:[tt.Esc],end:[tt.Space,tt.Enter,tt.Tab]},pN=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case tt.Right:return{...n,x:n.x+25};case tt.Left:return{...n,x:n.x-25};case tt.Down:return{...n,y:n.y+25};case tt.Up:return{...n,y:n.y-25}}};class Sd{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 Os(hs(n)),this.windowListeners=new Os(Eo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(wn.Resize,this.handleCancel),this.windowListeners.add(wn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(wn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=jr),!r)return;const{top:a,left:i,bottom:l,right:d}=s(r);Dg(r)&&(l<=0||d<=0||a>=window.innerHeight||i>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(Mn)}handleKeyDown(e){if(um(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Ug,coordinateGetter:a=pN,scrollBehavior:i="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:d}=o.current,u=d?{x:d.left,y:d.top}:Mn;this.referenceCoordinates||(this.referenceCoordinates=u);const h=a(e,{active:n,context:o.current,currentCoordinates:u});if(h){const f=Ha(h,u),m={x:0,y:0},{scrollableAncestors:x}=o.current;for(const g of x){const p=e.code,{isTop:b,isRight:y,isLeft:v,isBottom:w,maxScroll:S,minScroll:j}=Fg(g),C=hN(g),_={x:Math.min(p===tt.Right?C.right-C.width/2:C.right,Math.max(p===tt.Right?C.left:C.left+C.width/2,h.x)),y:Math.min(p===tt.Down?C.bottom-C.height/2:C.bottom,Math.max(p===tt.Down?C.top:C.top+C.height/2,h.y))},E=p===tt.Right&&!y||p===tt.Left&&!v,M=p===tt.Down&&!w||p===tt.Up&&!b;if(E&&_.x!==h.x){const I=g.scrollLeft+f.x,D=p===tt.Right&&I<=S.x||p===tt.Left&&I>=j.x;if(D&&!f.y)return void g.scrollTo({left:I,behavior:i});m.x=D?g.scrollLeft-I:p===tt.Right?g.scrollLeft-S.x:g.scrollLeft-j.x,m.x&&g.scrollBy({left:-m.x,behavior:i});break}if(M&&_.y!==h.y){const I=g.scrollTop+f.y,D=p===tt.Down&&I<=S.y||p===tt.Up&&I>=j.y;if(D&&!f.x)return void g.scrollTo({top:I,behavior:i});m.y=D?g.scrollTop-I:p===tt.Down?g.scrollTop-S.y:g.scrollTop-j.y,m.y&&g.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(e,fs(Ha(h,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function $g(t){return!!(t&&"distance"in t)}function Vg(t){return!!(t&&"delay"in t)}Sd.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=Ug,onActivation:r}=e,{active:s}=n;const{code:a}=t.nativeEvent;if(o.start.includes(a)){const i=s.activatorNode.current;return(!i||t.target===i)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class Cd{constructor(e,n,o){var r;o===void 0&&(o=function(i){const{EventTarget:l}=Eo(i);return i instanceof l?i:hs(i)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:a}=s;this.props=e,this.events=n,this.document=hs(a),this.documentListeners=new Os(this.document),this.listeners=new Os(o),this.windowListeners=new Os(Eo(a)),this.initialCoordinates=(r=hm(s))!=null?r:Mn,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(wn.Resize,this.handleCancel),this.windowListeners.add(wn.DragStart,Bg),this.windowListeners.add(wn.VisibilityChange,this.handleCancel),this.windowListeners.add(wn.ContextMenu,Bg),this.documentListeners.add(wn.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vg(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if($g(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(wn.Click,mN,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(wn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:a,options:{activationConstraint:i}}=s;if(!r)return;const l=(n=hm(e))!=null?n:Mn,d=Ha(r,l);if(!o&&i){if($g(i)){if(i.tolerance!=null&&jd(d,i.tolerance))return this.handleCancel();if(jd(d,i.distance))return this.handleStart()}return Vg(i)&&jd(d,i.tolerance)?this.handleCancel():void this.handlePending(i,d)}e.cancelable&&e.preventDefault(),a(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===tt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const gN={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Nd extends Cd{constructor(e){const{event:n}=e,o=hs(n.target);super(e,gN,o)}}Nd.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 xN={move:{name:"mousemove"},end:{name:"mouseup"}};var Ed;(function(t){t[t.RightClick=2]="RightClick"})(Ed||(Ed={})),(class extends Cd{constructor(t){super(t,xN,hs(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==Ed.RightClick&&(o==null||o({event:n}),!0)}}];const _d={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Ds,Ni;function bN(t){let{acceleration:e,activator:n=Ds.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:a=5,order:i=Ni.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:f}=t;const m=function(j){let{delta:C,disabled:_}=j;const E=pc(C);return qa(M=>{if(_||!E||!M)return yN;const I={x:Math.sign(C.x-E.x),y:Math.sign(C.y-E.y)};return{x:{[Pt.Backward]:M.x[Pt.Backward]||I.x===-1,[Pt.Forward]:M.x[Pt.Forward]||I.x===1},y:{[Pt.Backward]:M.y[Pt.Backward]||I.y===-1,[Pt.Forward]:M.y[Pt.Forward]||I.y===1}}},[_,C,E])}({delta:h,disabled:!s}),[x,g]=D9(),p=T.useRef({x:0,y:0}),b=T.useRef({x:0,y:0}),y=T.useMemo(()=>{switch(n){case Ds.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ds.DraggableRect:return r}},[n,r,l]),v=T.useRef(null),w=T.useCallback(()=>{const j=v.current;if(!j)return;const C=p.current.x*b.current.x,_=p.current.y*b.current.y;j.scrollBy(C,_)},[]),S=T.useMemo(()=>i===Ni.TreeOrder?[...d].reverse():d,[i,d]);T.useEffect(()=>{if(s&&d.length&&y){for(const j of S){if((o==null?void 0:o(j))===!1)continue;const C=d.indexOf(j),_=u[C];if(!_)continue;const{direction:E,speed:M}=uN(j,_,y,e,f);for(const I of["x","y"])m[I][E[I]]||(M[I]=0,E[I]=0);if(M.x>0||M.y>0)return g(),v.current=j,x(w,a),p.current=M,void(b.current=E)}p.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,w,o,g,s,a,JSON.stringify(y),JSON.stringify(m),x,d,S,u,JSON.stringify(f)])}(class extends Cd{constructor(t){super(t,_d)}static setup(){return window.addEventListener(_d.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_d.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"}(Ds||(Ds={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(Ni||(Ni={}));const yN={x:{[Pt.Backward]:!1,[Pt.Forward]:!1},y:{[Pt.Backward]:!1,[Pt.Forward]:!1}};var Ps,Id;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ps||(Ps={})),function(t){t.Optimized="optimized"}(Id||(Id={}));const Hg=new Map;function Wg(t,e){return qa(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Ei(t){let{callback:e,disabled:n}=t;const o=n3(e),r=T.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return T.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function vN(t){return new kd(jr(t),t)}function qg(t,e,n){e===void 0&&(e=vN);const[o,r]=T.useState(null);function s(){r(l=>{if(!t)return null;var d;if(t.isConnected===!1)return(d=l??n)!=null?d:null;const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const a=function(l){let{callback:d,disabled:u}=l;const h=n3(d),f=T.useMemo(()=>{if(u||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:m}=window;return new m(h)},[h,u]);return T.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const d of l){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),i=Ei({callback:s});return qo(()=>{s(),t?(i==null||i.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),a==null||a.disconnect())},[t]),o}const Gg=[];function Yg(t,e){e===void 0&&(e=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},e),T.useEffect(()=>{const o=t!==Mn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?Ha(t,n.current):Mn}function Kg(t){return T.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const Xg=[];function wN(t){let{measure:e}=t;const[n,o]=T.useState(null),r=T.useCallback(d=>{for(const{target:u}of d)if(mc(u)){o(h=>{const f=e(u);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),s=Ei({callback:r}),a=T.useCallback(d=>{const u=function(h){if(!h)return null;if(h.children.length>1)return h;const f=h.children[0];return mc(f)?f:h}(d);s==null||s.disconnect(),u&&(s==null||s.observe(u)),o(u?e(u):null)},[e,s]),[i,l]=fc(a);return T.useMemo(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}const kN=[{sensor:Nd,options:{}},{sensor:Sd,options:{}}],jN={current:{}},_i={draggable:{measure:Og},droppable:{measure:Og,strategy:Ps.WhileDragging,frequency:Id.Optimized},dragOverlay:{measure:jr}};class Rs 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 SN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Si},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_i,measureDroppableContainers:Si,windowRect:null,measuringScheduled:!1},CN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Si,draggableNodes:new Map,over:null,measureDroppableContainers:Si},Ii=T.createContext(CN),Jg=T.createContext(SN);function NN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rs}}}function EN(t,e){switch(e.type){case Mt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Mt.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 Mt.DragEnd:case Mt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Mt.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new Rs(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case Mt.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const a=new Rs(t.droppable.containers);return a.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:a}}}case Mt.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new Rs(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function _N(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=T.useContext(Ii),s=pc(o),a=pc(n==null?void 0:n.id);return T.useEffect(()=>{if(!e&&!o&&s&&a!=null){if(!um(s)||document.activeElement===s.target)return;const i=r.get(a);if(!i)return;const{activatorNode:l,node:d}=i;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[l.current,d.current]){if(!u)continue;const h=P9(u);if(h){h.focus();break}}})}},[o,e,r,a,s]),null}const Zg=T.createContext({...Mn,scaleX:1,scaleY:1});var Ao;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Ao||(Ao={}));const IN=T.memo(function(t){var e,n,o,r;let{id:s,accessibility:a,autoScroll:i=!0,children:l,sensors:d=kN,collisionDetection:u=Tg,measuring:h,modifiers:f,...m}=t;const x=T.useReducer(EN,void 0,NN),[g,p]=x,[b,y]=function(){const[le]=T.useState(()=>new Set),Ae=T.useCallback(Me=>(le.add(Me),()=>le.delete(Me)),[le]);return[T.useCallback(Me=>{let{type:Be,event:qe}=Me;le.forEach(De=>{var $e;return($e=De[Be])==null?void 0:$e.call(De,qe)})},[le]),Ae]}(),[v,w]=T.useState(Ao.Uninitialized),S=v===Ao.Initialized,{draggable:{active:j,nodes:C,translate:_},droppable:{containers:E}}=g,M=j!=null?C.get(j):null,I=T.useRef({initial:null,translated:null}),D=T.useMemo(()=>{var le;return j!=null?{id:j,data:(le=M==null?void 0:M.data)!=null?le:jN,rect:I}:null},[j,M]),F=T.useRef(null),[O,P]=T.useState(null),[R,z]=T.useState(null),N=Va(m,Object.values(m)),k=$a("DndDescribedBy",s),B=T.useMemo(()=>E.getEnabled(),[E]),A=(U=h,T.useMemo(()=>({draggable:{..._i.draggable,...U==null?void 0:U.draggable},droppable:{..._i.droppable,...U==null?void 0:U.droppable},dragOverlay:{..._i.dragOverlay,...U==null?void 0:U.dragOverlay}}),[U==null?void 0:U.draggable,U==null?void 0:U.droppable,U==null?void 0:U.dragOverlay]));var U;const{droppableRects:$,measureDroppableContainers:X,measuringScheduled:Y}=function(le,Ae){let{dragging:Me,dependencies:Be,config:qe}=Ae;const[De,$e]=T.useState(null),{frequency:ot,measure:Xe,strategy:st}=qe,Bt=T.useRef(le),Ht=function(){switch(st){case Ps.Always:return!1;case Ps.BeforeDragging:return Me;default:return!Me}}(),pn=Va(Ht),Jt=T.useCallback(function(Yn){Yn===void 0&&(Yn=[]),pn.current||$e(ko=>ko===null?Yn:ko.concat(Yn.filter(Nn=>!ko.includes(Nn))))},[pn]),Dn=T.useRef(null),ts=qa(Yn=>{if(Ht&&!Me)return Hg;if(!Yn||Yn===Hg||Bt.current!==le||De!=null){const ko=new Map;for(let Nn of le){if(!Nn)continue;if(De&&De.length>0&&!De.includes(Nn.id)&&Nn.rect.current){ko.set(Nn.id,Nn.rect.current);continue}const ns=Nn.node.current,Sa=ns?new kd(Xe(ns),ns):null;Nn.rect.current=Sa,Sa&&ko.set(Nn.id,Sa)}return ko}return Yn},[le,De,Me,Ht,Xe]);return T.useEffect(()=>{Bt.current=le},[le]),T.useEffect(()=>{Ht||Jt()},[Me,Ht]),T.useEffect(()=>{De&&De.length>0&&$e(null)},[JSON.stringify(De)]),T.useEffect(()=>{Ht||typeof ot!="number"||Dn.current!==null||(Dn.current=setTimeout(()=>{Jt(),Dn.current=null},ot))},[ot,Ht,Jt,...Be]),{droppableRects:ts,measureDroppableContainers:Jt,measuringScheduled:De!=null}}(B,{dragging:S,dependencies:[_.x,_.y],config:A.droppable}),G=function(le,Ae){const Me=Ae!=null?le.get(Ae):void 0,Be=Me?Me.node.current:null;return qa(qe=>{var De;return Ae==null?null:(De=Be??qe)!=null?De:null},[Be,Ae])}(C,j),W=T.useMemo(()=>R?hm(R):null,[R]),J=function(){const le=(O==null?void 0:O.autoScrollEnabled)===!1,Ae=typeof i=="object"?i.enabled===!1:i===!1,Me=S&&!le&&!Ae;return typeof i=="object"?{...i,enabled:Me}:{enabled:Me}}(),V=function(le,Ae){return Wg(le,Ae)}(G,A.draggable.measure);(function(le){let{activeNode:Ae,measure:Me,initialRect:Be,config:qe=!0}=le;const De=T.useRef(!1),{x:$e,y:ot}=typeof qe=="boolean"?{x:qe,y:qe}:qe;qo(()=>{if(!$e&&!ot||!Ae)return void(De.current=!1);if(De.current||!Be)return;const Xe=Ae==null?void 0:Ae.node.current;if(!Xe||Xe.isConnected===!1)return;const st=Mg(Me(Xe),Be);if($e||(st.x=0),ot||(st.y=0),De.current=!0,Math.abs(st.x)>0||Math.abs(st.y)>0){const Bt=Dg(Xe);Bt&&Bt.scrollBy({top:st.y,left:st.x})}},[Ae,$e,ot,Be,Me])})({activeNode:j!=null?C.get(j):null,config:J.layoutShiftCompensation,initialRect:V,measure:A.draggable.measure});const Q=qg(G,A.draggable.measure,V),te=qg(G?G.parentElement:null),re=T.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=E.getNodeFor((e=re.current.over)==null?void 0:e.id),ae=wN({measure:A.dragOverlay.measure}),se=(n=ae.nodeRef.current)!=null?n:G,ie=S?(o=ae.rect)!=null?o:Q:null,ge=!!(ae.nodeRef.current&&ae.rect),oe=Mg(ue=ge?null:Q,Wg(ue));var ue;const de=Kg(se?Eo(se):null),Ce=function(le){const Ae=T.useRef(le),Me=qa(Be=>le?Be&&Be!==Gg&&le&&Ae.current&&le.parentNode===Ae.current.parentNode?Be:Ci(le):Gg,[le]);return T.useEffect(()=>{Ae.current=le},[le]),Me}(S?ne??G:null),Te=function(le,Ae){Ae===void 0&&(Ae=jr);const[Me]=le,Be=Kg(Me?Eo(Me):null),[qe,De]=T.useState(Xg);function $e(){De(()=>le.length?le.map(Xe=>Lg(Xe)?Be:new kd(Ae(Xe),Xe)):Xg)}const ot=Ei({callback:$e});return qo(()=>{ot==null||ot.disconnect(),$e(),le.forEach(Xe=>ot==null?void 0:ot.observe(Xe))},[le]),qe}(Ce),Fe=function(le,Ae){let{transform:Me,...Be}=Ae;return le!=null&&le.length?le.reduce((qe,De)=>De({transform:qe,...Be}),Me):Me}(f,{transform:{x:_.x-oe.x,y:_.y-oe.y,scaleX:1,scaleY:1},activatorEvent:R,active:D,activeNodeRect:Q,containerNodeRect:te,draggingNodeRect:ie,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Ce,scrollableAncestorRects:Te,windowRect:de}),_e=W?fs(W,_):null,ke=function(le){const[Ae,Me]=T.useState(null),Be=T.useRef(le),qe=T.useCallback(De=>{const $e=vd(De.target);$e&&Me(ot=>ot?(ot.set($e,wd($e)),new Map(ot)):null)},[]);return T.useEffect(()=>{const De=Be.current;if(le!==De){$e(De);const ot=le.map(Xe=>{const st=vd(Xe);return st?(st.addEventListener("scroll",qe,{passive:!0}),[st,wd(st)]):null}).filter(Xe=>Xe!=null);Me(ot.length?new Map(ot):null),Be.current=le}return()=>{$e(le),$e(De)};function $e(ot){ot.forEach(Xe=>{const st=vd(Xe);st==null||st.removeEventListener("scroll",qe)})}},[qe,le]),T.useMemo(()=>le.length?Ae?Array.from(Ae.values()).reduce((De,$e)=>fs(De,$e),Mn):zg(le):Mn,[le,Ae])}(Ce),Ye=Yg(ke),Ve=Yg(ke,[Q]),Ke=fs(Fe,Ye),ee=ie?lN(ie,Fe):null,ye=D&&ee?u({active:D,collisionRect:ee,droppableRects:$,droppableContainers:B,pointerCoordinates:_e}):null,we=bd(ye,"id"),[Ie,K]=T.useState(null),me=function(le,Ae,Me){return{...le,scaleX:Ae&&Me?Ae.width/Me.width:1,scaleY:Ae&&Me?Ae.height/Me.height:1}}(ge?Fe:fs(Fe,Ve),(r=Ie==null?void 0:Ie.rect)!=null?r:null,Q),pe=T.useRef(null),he=T.useCallback((le,Ae)=>{let{sensor:Me,options:Be}=Ae;if(F.current==null)return;const qe=C.get(F.current);if(!qe)return;const De=le.nativeEvent,$e=new Me({active:F.current,activeNode:qe,event:De,options:Be,context:re,onAbort(Xe){if(!C.get(Xe))return;const{onDragAbort:st}=N.current,Bt={id:Xe};st==null||st(Bt),b({type:"onDragAbort",event:Bt})},onPending(Xe,st,Bt,Ht){if(!C.get(Xe))return;const{onDragPending:pn}=N.current,Jt={id:Xe,constraint:st,initialCoordinates:Bt,offset:Ht};pn==null||pn(Jt),b({type:"onDragPending",event:Jt})},onStart(Xe){const st=F.current;if(st==null)return;const Bt=C.get(st);if(!Bt)return;const{onDragStart:Ht}=N.current,pn={activatorEvent:De,active:{id:st,data:Bt.data,rect:I}};Wa.unstable_batchedUpdates(()=>{Ht==null||Ht(pn),w(Ao.Initializing),p({type:Mt.DragStart,initialCoordinates:Xe,active:st}),b({type:"onDragStart",event:pn}),P(pe.current),z(De)})},onMove(Xe){p({type:Mt.DragMove,coordinates:Xe})},onEnd:ot(Mt.DragEnd),onCancel:ot(Mt.DragCancel)});function ot(Xe){return async function(){const{active:st,collisions:Bt,over:Ht,scrollAdjustedTranslate:pn}=re.current;let Jt=null;if(st&&pn){const{cancelDrop:Dn}=N.current;Jt={activatorEvent:De,active:st,collisions:Bt,delta:pn,over:Ht},Xe===Mt.DragEnd&&typeof Dn=="function"&&await Promise.resolve(Dn(Jt))&&(Xe=Mt.DragCancel)}F.current=null,Wa.unstable_batchedUpdates(()=>{p({type:Xe}),w(Ao.Uninitialized),K(null),P(null),z(null),pe.current=null;const Dn=Xe===Mt.DragEnd?"onDragEnd":"onDragCancel";if(Jt){const ts=N.current[Dn];ts==null||ts(Jt),b({type:Dn,event:Jt})}})}}pe.current=$e},[C]),je=T.useCallback((le,Ae)=>(Me,Be)=>{const qe=Me.nativeEvent,De=C.get(Be);if(F.current!==null||!De||qe.dndKit||qe.defaultPrevented)return;const $e={active:De};le(Me,Ae.options,$e)===!0&&(qe.dndKit={capturedBy:Ae.sensor},F.current=Be,he(Me,Ae))},[C,he]),Pe=function(le,Ae){return T.useMemo(()=>le.reduce((Me,Be)=>{const{sensor:qe}=Be;return[...Me,...qe.activators.map(De=>({eventName:De.eventName,handler:Ae(De.handler,Be)}))]},[]),[le,Ae])}(d,je);(function(le){T.useEffect(()=>{if(!fm)return;const Ae=le.map(Me=>{let{sensor:Be}=Me;return Be.setup==null?void 0:Be.setup()});return()=>{for(const Me of Ae)Me==null||Me()}},le.map(Ae=>{let{sensor:Me}=Ae;return Me}))})(d),qo(()=>{Q&&v===Ao.Initializing&&w(Ao.Initialized)},[Q,v]),T.useEffect(()=>{const{onDragMove:le}=N.current,{active:Ae,activatorEvent:Me,collisions:Be,over:qe}=re.current;if(!Ae||!Me)return;const De={active:Ae,activatorEvent:Me,collisions:Be,delta:{x:Ke.x,y:Ke.y},over:qe};Wa.unstable_batchedUpdates(()=>{le==null||le(De),b({type:"onDragMove",event:De})})},[Ke.x,Ke.y]),T.useEffect(()=>{const{active:le,activatorEvent:Ae,collisions:Me,droppableContainers:Be,scrollAdjustedTranslate:qe}=re.current;if(!le||F.current==null||!Ae||!qe)return;const{onDragOver:De}=N.current,$e=Be.get(we),ot=$e&&$e.rect.current?{id:$e.id,rect:$e.rect.current,data:$e.data,disabled:$e.disabled}:null,Xe={active:le,activatorEvent:Ae,collisions:Me,delta:{x:qe.x,y:qe.y},over:ot};Wa.unstable_batchedUpdates(()=>{K(ot),De==null||De(Xe),b({type:"onDragOver",event:Xe})})},[we]),qo(()=>{re.current={activatorEvent:R,active:D,activeNode:G,collisionRect:ee,collisions:ye,droppableRects:$,draggableNodes:C,draggingNode:se,draggingNodeRect:ie,droppableContainers:E,over:Ie,scrollableAncestors:Ce,scrollAdjustedTranslate:Ke},I.current={initial:ie,translated:ee}},[D,G,ye,ee,C,se,ie,$,E,Ie,Ce,Ke]),bN({...J,delta:_,draggingRect:ee,pointerCoordinates:_e,scrollableAncestors:Ce,scrollableAncestorRects:Te});const Re=T.useMemo(()=>({active:D,activeNode:G,activeNodeRect:Q,activatorEvent:R,collisions:ye,containerNodeRect:te,dragOverlay:ae,draggableNodes:C,droppableContainers:E,droppableRects:$,over:Ie,measureDroppableContainers:X,scrollableAncestors:Ce,scrollableAncestorRects:Te,measuringConfiguration:A,measuringScheduled:Y,windowRect:de}),[D,G,Q,R,ye,te,ae,C,E,$,Ie,X,Ce,Te,A,Y,de]),He=T.useMemo(()=>({activatorEvent:R,activators:Pe,active:D,activeNodeRect:Q,ariaDescribedById:{draggable:k},dispatch:p,draggableNodes:C,over:Ie,measureDroppableContainers:X}),[R,Pe,D,Q,p,k,C,Ie,X]);return q.createElement(_g.Provider,{value:y},q.createElement(Ii.Provider,{value:He},q.createElement(Jg.Provider,{value:Re},q.createElement(Zg.Provider,{value:me},l)),q.createElement(_N,{disabled:(a==null?void 0:a.restoreFocus)===!1})),q.createElement(oN,{...a,hiddenTextDescribedById:k}))}),AN=T.createContext(null),Qg="button";function TN(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=$a("Draggable"),{activators:a,activatorEvent:i,active:l,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:f}=T.useContext(Ii),{role:m=Qg,roleDescription:x="draggable",tabIndex:g=0}=r??{},p=(l==null?void 0:l.id)===e,b=T.useContext(p?Zg:AN),[y,v]=fc(),[w,S]=fc(),j=function(_,E){return T.useMemo(()=>_.reduce((M,I)=>{let{eventName:D,handler:F}=I;return M[D]=O=>{F(O,E)},M},{}),[_,E])}(a,e),C=Va(n);return qo(()=>(h.set(e,{id:e,key:s,node:y,activatorNode:w,data:C}),()=>{const _=h.get(e);_&&_.key===s&&h.delete(e)}),[h,e]),{active:l,activatorEvent:i,activeNodeRect:d,attributes:T.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!p||m!==Qg)||void 0,"aria-roledescription":x,"aria-describedby":u.draggable}),[o,m,g,p,x,u.draggable]),isDragging:p,listeners:o?void 0:j,node:y,over:f,setNodeRef:v,setActivatorNodeRef:S,transform:b}}const MN={timeout:25};function e1(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function ON(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function Ai(t){return t!==null&&t>=0}const Ti={scaleX:1,scaleY:1},DN=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:a}=t;const i=(e=n[r])!=null?e:o;if(!i)return null;const l=function(d,u,h){const f=d[u],m=d[u-1],x=d[u+1];return!f||!m&&!x?0:h<u?m?f.left-(m.left+m.width):x.left-(f.left+f.width):x?x.left-(f.left+f.width):f.left-(m.left+m.width)}(n,a,r);if(a===r){const d=n[s];return d?{x:r<s?d.left+d.width-(i.left+i.width):d.left-i.left,y:0,...Ti}:null}return a>r&&a<=s?{x:-i.width-l,y:0,...Ti}:a<r&&a>=s?{x:i.width+l,y:0,...Ti}:{x:0,y:0,...Ti}},t1=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=e1(e,o,n),a=e[r],i=s[r];return i&&a?{x:i.left-a.left,y:i.top-a.top,scaleX:i.width/a.width,scaleY:i.height/a.height}:null},Mi={scaleX:1,scaleY:1},PN=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:a}=t;const i=(e=s[n])!=null?e:o;if(!i)return null;if(r===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(i.top+i.height):d.top-i.top,...Mi}:null}const l=function(d,u,h){const f=d[u],m=d[u-1],x=d[u+1];return f?h<u?m?f.top-(m.top+m.height):x?x.top-(f.top+f.height):0:x?x.top-(f.top+f.height):m?f.top-(m.top+m.height):0:0}(s,r,n);return r>n&&r<=a?{x:0,y:-i.height-l,...Mi}:r<n&&r>=a?{x:0,y:i.height+l,...Mi}:{x:0,y:0,...Mi}},n1="Sortable",o1=q.createContext({activeIndex:-1,containerId:n1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:t1,disabled:{draggable:!1,droppable:!1}});function r1(t){let{children:e,id:n,items:o,strategy:r=t1,disabled:s=!1}=t;const{active:a,dragOverlay:i,droppableRects:l,over:d,measureDroppableContainers:u}=T.useContext(Jg),h=$a(n1,n),f=i.rect!==null,m=T.useMemo(()=>o.map(j=>typeof j=="object"&&"id"in j?j.id:j),[o]),x=a!=null,g=a?m.indexOf(a.id):-1,p=d?m.indexOf(d.id):-1,b=T.useRef(m),y=!function(j,C){if(j===C)return!0;if(j.length!==C.length)return!1;for(let _=0;_<j.length;_++)if(j[_]!==C[_])return!1;return!0}(m,b.current),v=p!==-1&&g===-1||y,w=function(j){return typeof j=="boolean"?{draggable:j,droppable:j}:j}(s);qo(()=>{y&&x&&u(m)},[y,m,x,u]),T.useEffect(()=>{b.current=m},[m]);const S=T.useMemo(()=>({activeIndex:g,containerId:h,disabled:w,disableTransforms:v,items:m,overIndex:p,useDragOverlay:f,sortedRects:ON(m,l),strategy:r}),[g,h,w.draggable,w.droppable,v,m,p,l,f,r]);return q.createElement(o1.Provider,{value:S},e)}const RN=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return e1(n,o,r).indexOf(e)},LN=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:a,previousItems:i,previousContainerId:l,transition:d}=t;return!(!d||!o)&&(i===s||r!==a)&&(!!n||a!==r&&e===l)},FN={duration:200,easing:"ease"},s1="transform",zN=gc.Transition.toString({property:s1,duration:0,easing:"linear"}),BN={roleDescription:"sortable"};function a1(t){let{animateLayoutChanges:e=LN,attributes:n,disabled:o,data:r,getNewIndex:s=RN,id:a,strategy:i,resizeObserverConfig:l,transition:d=FN}=t;const{items:u,containerId:h,activeIndex:f,disabled:m,disableTransforms:x,sortedRects:g,overIndex:p,useDragOverlay:b,strategy:y}=T.useContext(o1),v=function(ne,ae){var se,ie;return typeof ne=="boolean"?{draggable:ne,droppable:!1}:{draggable:(se=ne==null?void 0:ne.draggable)!=null?se:ae.draggable,droppable:(ie=ne==null?void 0:ne.droppable)!=null?ie:ae.droppable}}(o,m),w=u.indexOf(a),S=T.useMemo(()=>({sortable:{containerId:h,index:w,items:u},...r}),[h,r,w,u]),j=T.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:C,node:_,isOver:E,setNodeRef:M}=function(ne){let{data:ae,disabled:se=!1,id:ie,resizeObserverConfig:ge}=ne;const oe=$a("Droppable"),{active:ue,dispatch:de,over:Ce,measureDroppableContainers:Te}=T.useContext(Ii),Fe=T.useRef({disabled:se}),_e=T.useRef(!1),ke=T.useRef(null),Ye=T.useRef(null),{disabled:Ve,updateMeasurementsFor:Ke,timeout:ee}={...MN,...ge},ye=Va(Ke??ie),we=Ei({callback:T.useCallback(()=>{_e.current?(Ye.current!=null&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{Te(Array.isArray(ye.current)?ye.current:[ye.current]),Ye.current=null},ee)):_e.current=!0},[ee]),disabled:Ve||!ue}),Ie=T.useCallback((he,je)=>{we&&(je&&(we.unobserve(je),_e.current=!1),he&&we.observe(he))},[we]),[K,me]=fc(Ie),pe=Va(ae);return T.useEffect(()=>{we&&K.current&&(we.disconnect(),_e.current=!1,we.observe(K.current))},[K,we]),T.useEffect(()=>(de({type:Mt.RegisterDroppable,element:{id:ie,key:oe,disabled:se,node:K,rect:ke,data:pe}}),()=>de({type:Mt.UnregisterDroppable,key:oe,id:ie})),[ie]),T.useEffect(()=>{se!==Fe.current.disabled&&(de({type:Mt.SetDroppableDisabled,id:ie,key:oe,disabled:se}),Fe.current.disabled=se)},[ie,oe,se,de]),{active:ue,rect:ke,isOver:(Ce==null?void 0:Ce.id)===ie,node:K,over:Ce,setNodeRef:me}}({id:a,data:S,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...l}}),{active:I,activatorEvent:D,activeNodeRect:F,attributes:O,setNodeRef:P,listeners:R,isDragging:z,over:N,setActivatorNodeRef:k,transform:B}=TN({id:a,data:S,attributes:{...BN,...n},disabled:v.draggable}),A=L9(M,P),U=!!I,$=U&&!x&&Ai(f)&&Ai(p),X=!b&&z,Y=X&&$?B:null,G=$?Y??(i??y)({rects:g,activeNodeRect:F,activeIndex:f,overIndex:p,index:w}):null,W=Ai(f)&&Ai(p)?s({id:a,items:u,activeIndex:f,overIndex:p}):w,J=I==null?void 0:I.id,V=T.useRef({activeId:J,items:u,newIndex:W,containerId:h}),Q=u!==V.current.items,te=e({active:I,containerId:h,isDragging:z,isSorting:U,id:a,index:w,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),re=function(ne){let{disabled:ae,index:se,node:ie,rect:ge}=ne;const[oe,ue]=T.useState(null),de=T.useRef(se);return qo(()=>{if(!ae&&se!==de.current&&ie.current){const Ce=ge.current;if(Ce){const Te=jr(ie.current,{ignoreTransform:!0}),Fe={x:Ce.left-Te.left,y:Ce.top-Te.top,scaleX:Ce.width/Te.width,scaleY:Ce.height/Te.height};(Fe.x||Fe.y)&&ue(Fe)}}se!==de.current&&(de.current=se)},[ae,se,ie,ge]),T.useEffect(()=>{oe&&ue(null)},[oe]),oe}({disabled:!te,index:w,node:_,rect:C});return T.useEffect(()=>{U&&V.current.newIndex!==W&&(V.current.newIndex=W),h!==V.current.containerId&&(V.current.containerId=h),u!==V.current.items&&(V.current.items=u)},[U,W,h,u]),T.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null)return void(V.current.activeId=J);const ne=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(ne)},[J]),{active:I,activeIndex:f,attributes:O,data:S,rect:C,index:w,newIndex:W,items:u,isOver:E,isSorting:U,isDragging:z,listeners:R,node:_,overIndex:p,over:N,setNodeRef:A,setActivatorNodeRef:k,setDroppableNodeRef:M,setDraggableNodeRef:P,transform:re??G,transition:function(){if(re||Q&&V.current.newIndex===w)return zN;if(!(X&&!um(D)||!d)&&(U||te))return gc.Transition.toString({...d,property:s1})}()}}function Oi(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 UN=[tt.Down,tt.Right,tt.Up,tt.Left],$N=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:a,scrollableAncestors:i}}=e;if(UN.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=r.get(h.id);if(f)switch(t.code){case tt.Down:o.top<f.top&&l.push(h);break;case tt.Up:o.top>f.top&&l.push(h);break;case tt.Left:o.left>f.left&&l.push(h);break;case tt.Right:o.left<f.left&&l.push(h)}});const d=(h=>{let{collisionRect:f,droppableRects:m,droppableContainers:x}=h;const g=xd(f),p=[];for(const b of x){const{id:y}=b,v=m.get(y);if(v){const w=xd(v),S=g.reduce((C,_,E)=>C+pd(w[E],_),0),j=Number((S/4).toFixed(4));p.push({id:y,data:{droppableContainer:b,value:j}})}}return p.sort(gd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let u=bd(d,"id");if(u===(a==null?void 0:a.id)&&d.length>1&&(u=d[1].id),u!=null){const h=s.get(n.id),f=s.get(u),m=f?r.get(f.id):null,x=f==null?void 0:f.node.current;if(x&&m&&h&&f){const g=Ci(x).some((w,S)=>i[S]!==w),p=i1(h,f),b=function(w,S){return!Oi(w)||!Oi(S)||!i1(w,S)?!1:w.data.current.sortable.index<S.data.current.sortable.index}(h,f),y=g||!p?{x:0,y:0}:{x:b?o.width-m.width:0,y:b?o.height-m.height:0},v={x:m.left,y:m.top};return y.x&&y.y?v:Ha(v,y)}}}};function i1(t,e){return!(!Oi(t)||!Oi(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const VN=F9("rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden 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-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)",green:"hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-(--red-3) hover:text-(--red-11)"}},defaultVariants:{variant:"default"}}),Ls=t=>{const e=H.c(21);let n,o,r,s,a;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:a,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a):(n=e[1],o=e[2],r=e[3],s=e[4],a=e[5]);const i=r!==void 0&&r;let l,d,u;e[6]!==i||e[7]!==o?(l=f=>{var m;i||((m=o.onClick)==null||m.call(o,f))},e[6]=i,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==a?(d=xe(VN({variant:a}),o.className),e[9]=o.className,e[10]=a,e[11]=d):d=e[11],e[12]!==n||e[13]!==i||e[14]!==o||e[15]!==l||e[16]!==d?(u=c.jsx("button",{disabled:i,...o,onClick:l,onMouseDown:Rn.preventFocus,className:d,children:n}),e[12]=n,e[13]=i,e[14]=o,e[15]=l,e[16]=d,e[17]=u):u=e[17];const h=u;if(s){let f;return e[18]!==h||e[19]!==s?(f=c.jsx(Ne,{content:s,side:"top",delayDuration:200,usePortal:!1,children:h}),e[18]=h,e[19]=s,e[20]=f):f=e[20],f}return h},HN=t=>{const e=H.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=xe("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(Uj,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},WN=t=>{const e=H.c(9),{connectionState:n,status:o}=t,{sendInterrupt:r}=et(),s=Sg(o==="running");let a,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=Wt("global.interrupt"),e[0]=a):a=e[0],e[1]!==n||e[2]!==s?(i=Zn(n)||!s,e[1]=n,e[2]=s,e[3]=i):i=e[3];const l=s?r:Ln.NOOP,d=s?"stale":"disabled";let u,h;return e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(oc,{strokeWidth:1.5}),e[4]=u):u=e[4],e[5]!==i||e[6]!==l||e[7]!==d?(h=c.jsx(Ls,{tooltip:a,disabled:i,onClick:l,variant:d,"data-testid":"run-button",children:u}),e[5]=i,e[6]=l,e[7]=d,e[8]=h):h=e[8],h},Sr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},Fs=pr.define({combine:t=>xc(t,{onError:console.error,inputDebounceTime:300,keymaps:Sr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),nr=At.define(),or=bn.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(nr))return n.value;return t}}),zs=At.define(),Bs=At.define(),l1=bn.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(zs)&&(n={...n,inputValue:o.value}),o.is(Bs)&&(n={...n,shouldFocus:o.value});return n}}),Di=At.define(),Us=bn.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(Di))return n.value;return t}}),Cr=At.define(),c1=bn.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Cr))return n.value;return t}}),d1=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const a=Math.max(1,Math.min(r.number,o.lines)),i=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[nr.of({show:!0,lineFrom:a,lineTo:i}),Bs.of(!0),zs.of("")],selection:Jn.cursor(r.from)}),!0},u1=t=>!!t.state.field(Us)&&(t.dispatch({effects:[Di.of(null),nr.of({show:!1,lineFrom:0,lineTo:0}),Bs.of(!1),zs.of(""),Cr.of(!1)]}),!0),h1=t=>{const e=t.state.field(Us);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[Di.of(null),nr.of({show:!1,lineFrom:0,lineTo:0}),Bs.of(!1),zs.of(""),Cr.of(!1)]}),!0)},qN=We.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),GN="\u2318",YN="\u229E Win",KN="Ctrl";function Ad(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?GN:navigator.platform.startsWith("Win")?YN:KN).replace("-"," ").toUpperCase()}function Gt(t,e){const n=document.createElement(t);return n.className=e,n}function XN(t){var r,s;const e=t.state.facet(Fs),n={...Sr,...e.keymaps},o=Gt("div","cm-ai-tooltip").appendChild(Gt("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${Ad(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",a=>{a.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",a=>{a.preventDefault(),d1(t)}),o}const JN=pr.define({combine:t=>xc(t,{render:XN})}),ZN=zn.fromClass((lk=class{constructor(t){Z(this,"view");Z(this,"suppress");Z(this,"dom");Z(this,"mousedown",()=>{this.suppress=!0});Z(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});fk(this,Bl,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),a=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),i=s.width-r.width,l=Math.min(o.left,i);let d=o.top-r.height;d=a?Math.max(a.y,d):d,this.dom.style.left=`${l}px`,this.dom.style.top=`${d}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(JN);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(or).show?this.dom.style.display="none":t.requestMeasure({read:hk(this,Bl)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Bl=new WeakMap,lk)),QN=We.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class e4 extends ms{constructor(n){super();Z(this,"oldCode");this.oldCode=n}toDOM(n){const o=Gt("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=Gt("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=Gt("div","cm-floating-buttons"),a=n.state.facet(Fs),i={...Sr,...a.keymaps},l=Gt("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${Ad(i.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),u1(n)});const d=Gt("button","cm-floating-button cm-floating-reject");return d.innerHTML=`<span class="hotkey">${Ad(i.rejectEdit)}</span> Reject`,d.setAttribute("aria-label","Reject changes"),d.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),h1(n)}),s.append(l,d),o.append(r,s),o}updateDOM(n,o){return!0}}class t4 extends ms{constructor(n){super();Z(this,"complete");Z(this,"abortController",null);Z(this,"dom",null);Z(this,"input",null);Z(this,"loadingContainer",null);Z(this,"helpInfo",null);Z(this,"inputContainer",null);Z(this,"form",null);Z(this,"view",null);Z(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});Z(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[nr.of({show:!1,lineFrom:0,lineTo:0}),Cr.of(!1)]}),n.focus())});Z(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(Fs);n==null||n.stopPropagation();const s=o.state.field(or),{input:a}=this;if(!a)return;const i=a.value.trim();if(!s.show||!i)return;const l=o.state.doc.line(s.lineFrom),d=o.state.doc.line(s.lineTo),u=l.from,h=d.to,f=o.state.sliceDoc(u,h),m=o.state.sliceDoc(0,u),x=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:Cr.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:i,selection:f,codeBefore:m,codeAfter:x,editorView:o,signal:this.abortController.signal});if(!o.state.field(or).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:u,to:h,insert:p},effects:[nr.of({show:!1,lineFrom:0,lineTo:0}),Di.of({from:u,to:u+p.length,oldCode:f,newCode:p}),Cr.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(l1),r=n.state.field(c1),s=Gt("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const a=Gt("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",p=>p.preventDefault());const i=Gt("input","cm-ai-input");this.input=i,a.append(i),i.placeholder="Editing instructions...",i.setAttribute("aria-label","AI editing instructions"),i.setAttribute("autocomplete","off"),i.setAttribute("spellcheck","true"),i.value=o.inputValue;const l=Gt("div","cm-ai-loading-container");this.loadingContainer=l;const d=Gt("div","cm-ai-loading-indicator");d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),d.textContent="Generating";const u=Gt("button","cm-ai-cancel-button");u.textContent="Cancel",u.setAttribute("aria-label","Cancel code generation"),u.addEventListener("click",this.onCancel),l.append(u,d);const h=Gt("div","cm-ai-help-info");this.helpInfo=h;const f=h.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const m=Gt("button","cm-ai-generate-button");function x(p){h.replaceChildren(p?m:f)}m.textContent="\u23CE Generate",m.setAttribute("aria-label","Generate code"),m.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{i.value=o.inputValue,i.focus(),n.dispatch({effects:Bs.of(!1)})}),x(i.value),i.addEventListener("input",function(){n.dispatch({effects:zs.of(i.value)});const p=i.value.trim();p!==g&&(g=p,x(p))}),i.addEventListener("keydown",this.onKeyDown);let g="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function n4(t){if(!t.prompt)throw new Error("prompt function is required");return[Fs.of(t),or,l1,Us,c1,[ZN,QN],qN,An.of([{key:Sr.showInput,run:d1}]),_o.highest([An.of([{key:Sr.acceptEdit,run:u1},{key:Sr.rejectEdit,run:h1}])]),o4,r4,s4,a4]}const o4=We.updateListener.of(t=>{const e=t.state.field(or);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,a,i,l)=>{const d=t.state.doc.lineAt(s).number;if(d<n){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(i).number;n+=u,o+=u,r=!0}else if(d<=o){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(i).number;o+=u,r=!0}}),r&&t.view.dispatch({effects:[nr.of({show:!0,lineFrom:n,lineTo:o})]})}),r4=We.decorations.of(t=>{const e=t.state.field(Us);return e?nt.set([nt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):nt.none}),s4=We.decorations.compute([or],t=>{const e=t.field(or),n=t.facet(Fs),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let a=r;a<=s;a++){const i=t.doc.line(a).from;o.push(nt.line({class:"cm-ai-selection"}).range(i)),a===r&&o.push(nt.widget({widget:new t4(n.prompt),side:-1}).range(i))}}return nt.set(o)}),a4=bn.define({create:t=>nt.none,update(t,e){const n=e.state.field(Us);return n?nt.set([nt.widget({widget:new e4(n.oldCode),block:!0}).range(n.from)]):nt.none},provide:t=>We.decorations.from(t)}),Pi=bn.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(Ri));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),Ri=At.define();class i4 extends ms{constructor(n){super();Z(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
|
103
|
-
`).length-1}}class l4{constructor(e){Z(this,"cache",new Map);Z(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const c4=(t,e)=>zn.fromClass(class{constructor(){Z(this,"abortController",null);Z(this,"cache");this.cache=new l4(e.cacheTimeout??1e3)}async update(n){var a,i,l,d,u;if(!n.docChanged||((i=(a=e.events)==null?void 0:a.beforeSuggestionFetch)==null?void 0:i.call(a,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:Ri.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((u=(d=e.events)==null?void 0:d.shouldShowSuggestion)==null?void 0:u.call(d,n.view,h))===!1)return;this.cache.set(r,h),n.view.dispatch({effects:Ri.of({text:h,doc:o})})}catch(h){h instanceof Error&&h.name!=="AbortError"&&console.error("Suggestion fetch error:",h)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),d4=zn.fromClass(class{constructor(){Z(this,"decorations");this.decorations=nt.none}update(t){var n;const e=(n=t.state.field(Pi))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,a=[],i=nt.widget({widget:new i4(r),side:1});return a.push(i.range(s)),nt.set(a)}(t.view,e):nt.none}},{decorations:t=>t.decorations});function u4(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Jn.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:Jn.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const f1=t=>{var o,r,s;const e=(o=t.state.field(Pi))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Td);return t.dispatch({effects:Ri.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},h4=An.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(Pi))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Td);return t.dispatch({...u4(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:f1}]),Td=pr.define({combine:t=>t.at(-1)});function m1(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,a){let i=()=>{};return(...l)=>(i(),new Promise((d,u)=>{const h=setTimeout(()=>d(r(...l)),s);i=()=>{clearTimeout(h),a!==void 0&&u(a)}}))}(t.fetchFn,e);return[Pi,Td.of(t),c4(o,t),d4,n?h4:[]]}const p1="packages-install-input",f4=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Md;function m4(){const t=async r=>{const s=Qe.get(Ua),{saveUserConfig:a}=i3(),i={...s,runtime:{...s.runtime,auto_reload:r}};await a({config:i}).then(()=>Qe.set(Ua,i))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(p1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{Qe.set(pm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{Qe.set(pm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{Qe.set(pm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:c.jsxs(c.Fragment,{children:["The package manager sidebar has been opened.",c.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:c.jsxs(c.Fragment,{children:["Module reload mode set to ",c.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:c.jsxs(c.Fragment,{children:["Module reload mode set to ",c.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:c.jsx(c.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:c.jsxs(c.Fragment,{children:["Shell commands are not directly supported.",c.jsx("br",{}),"Use ",c.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...f4.map(r=>({match:r,onMatch:()=>{},title:c.jsx(a3,{className:"inline",children:r}),description:c.jsxs(c.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",c.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 We.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,a=r.state.doc,i=a.lineAt(s.head),l=a.sliceString(i.from,s.anchor).trim(),d=o.get(l);d&&(d.onMatch(),Md?Md.upsert({title:d.title,description:d.description}):Md=Je({title:d.title,description:d.description}))}})}const p4=new Set(["Escape","Alt-`"]);function g4(){const t=l3.filter(e=>!p4.has(e.key));return _o.highest(An.of([...t,{key:"Escape",run:e=>{const n=$l(e);return!Ga(e)&&n}},{key:"Ctrl-y",run:e=>!!Ga(e)&&c3(e)},{key:"Ctrl-n",run:e=>!!Ga(e)&&bc(!0)(e)},{key:"Ctrl-p",run:e=>!!Ga(e)&&bc(!1)(e)}]))}const Od=At.define(),Dd=At.define(),Pd=At.define();function xt(t,e){if(!t)throw new Error(e)}function Li(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 Rd(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 g1(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 x1=Symbol("@bufbuild/protobuf/enum-type");function x4(t){const e=t[x1];return xt(e,"missing enum type on enum object"),e}function b1(t,e,n,o){t[x1]=y1(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function y1(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const a of e){const i=v1(a);s.push(i),o[a.name]=i,r[a.no]=i}return{typeName:t,values:s,findName:a=>o[a],findNumber:a=>r[a]}}function b4(t,e,n){const o={};for(const r of e){const s=v1(r);o[s.localName]=s.no,o[s.no]=s.localName}return b1(o,t,e),o}function v1(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class St{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function y4(){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 Ld(t,e,n){for(let s=0;s<28;s+=7){const a=t>>>s,i=!(!(a>>>7)&&e==0),l=255&(i?128|a:a);if(n.push(l),!i)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const a=e>>>s,i=!!(a>>>7),l=255&(i?128|a:a);if(n.push(l),!i)return}n.push(e>>>31&1)}}const Fi=4294967296;function w1(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(a,i){const l=Number(t.slice(a,i));r*=n,o=o*n+l,o>=Fi&&(r+=o/Fi|0,o%=Fi)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?j1(o,r):Fd(o,r)}function k1(t,e){if({lo:t,hi:e}=function(l,d){return{lo:l>>>0,hi:d>>>0}}(t,e),e<=2097151)return String(Fi*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,a=2*o;const i=1e7;return r>=i&&(s+=Math.floor(r/i),r%=i),s>=i&&(a+=Math.floor(s/i),s%=i),a.toString()+S1(s)+S1(r)}function Fd(t,e){return{lo:0|t,hi:0|e}}function j1(t,e){return e=~e,t?t=1+~t:e+=1,Fd(t,e)}const S1=t=>{const e=String(t);return"0000000".slice(e.length)+e};function C1(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 v4(){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 w4={};const mt=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"||w4.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){const l=typeof i=="bigint"?i:BigInt(i);if(l>r||l<o)throw new Error(`int64 invalid: ${i}`);return l},uParse(i){const l=typeof i=="bigint"?i:BigInt(i);if(l>a||l<s)throw new Error(`uint64 invalid: ${i}`);return l},enc(i){return t.setBigInt64(0,this.parse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(i){return t.setBigInt64(0,this.uParse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(i,l)=>(t.setInt32(0,i,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(i,l)=>(t.setInt32(0,i,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>xt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>xt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),w1(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),w1(o)),dec:(o,r)=>function(s,a){let i=Fd(s,a);const l=2147483648&i.hi;l&&(i=j1(i.lo,i.hi));const d=k1(i.lo,i.hi);return l?"-"+d:d}(o,r),uDec:(o,r)=>k1(o,r)}}();var ce,To,kt;function Mo(t,e,n){if(e===n)return!0;if(t==ce.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 ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return e==n}return!1}function Nr(t,e){switch(t){case ce.BOOL:return!1;case ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return e==0?mt.zero:"0";case ce.DOUBLE:case ce.FLOAT:return 0;case ce.BYTES:return new Uint8Array(0);case ce.STRING:return"";default:return 0}}function N1(t,e){switch(t){case ce.BOOL:return e===!1;case ce.STRING:return e==="";case ce.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"})(ce||(ce={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(To||(To={})),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"}(kt||(kt={}));class k4{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(Rd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Li(e),C1(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){g1(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){Rd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Li(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Li(e),C1(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=mt.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=mt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=mt.enc(e);return Ld(n.lo,n.hi,this.buf),this}sint64(e){let n=mt.enc(e),o=n.hi>>31;return Ld(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=mt.uEnc(e);return Ld(n.lo,n.hi,this.buf),this}}class j4{constructor(e,n){this.varint64=y4,this.uint32=v4,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 kt.Varint:for(;128&this.buf[this.pos++];);break;case kt.Bit64:this.pos+=4;case kt.Bit32:this.pos+=4;break;case kt.LengthDelimited:let r=this.uint32();this.pos+=r;break;case kt.StartGroup:for(;;){const[s,a]=this.tag();if(a===kt.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return mt.dec(...this.varint64())}uint64(){return mt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,mt.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 mt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return mt.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 E1(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 Nr(r.T,r.L);case"message":const s=r.T,a=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(a):a;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),zi=[];for(let t=0;t<eo.length;t++)zi[eo[t].charCodeAt(0)]=t;zi[45]=eo.indexOf("+"),zi[95]=eo.indexOf("/");const Bi={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,a=0;for(let i=0;i<t.length;i++){if(n=zi[t.charCodeAt(i)],n===void 0)switch(t[i]){case"=":s=0;case`
|
104
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:a=n,s=1;break;case 1:o[r++]=a<<2|(48&n)>>4,a=n,s=2;break;case 2:o[r++]=(15&a)<<4|(60&n)>>2,a=n,s=3;break;case 3:o[r++]=(3&a)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=eo[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=eo[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=eo[r|e>>6],n+=eo[63&e],o=0}return o&&(n+=eo[r],n+="=",o==1&&(n+="=")),n}};function S4(t,e,n){I1(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(i,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let d=i.length-1;d>=0;--d)if(i[d].no==l.no)return[i[d]];return[]}return i.filter(d=>d.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,a]=E1(e);for(const i of r)e.runtime.bin.readField(s,o.readerFactory(i.data),e.field,i.wireType,o);return a()}function C4(t,e,n,o){I1(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(_1(t,e)){const d=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of d)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const a=s.writerFactory();let i=e.field;i.opt||i.repeated||i.kind!="enum"&&i.kind!="scalar"||(i=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(i,n,a,s);const l=r.readerFactory(a.finish());for(;l.pos<l.len;){const[d,u]=l.tag(),h=l.skip(u,d);t.getType().runtime.bin.onUnknownField(t,d,u,h)}}function _1(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 I1(t,e){xt(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function A1(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:!N1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function T1(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?Nr(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function to(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(St.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 M1(t,e){return to(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}ce.DOUBLE,ce.FLOAT,ce.INT64,ce.UINT64,ce.INT32,ce.UINT32,ce.BOOL,ce.STRING,ce.BYTES;const O1={ignoreUnknownFields:!1},D1={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function N4(t){return t?Object.assign(Object.assign({},O1),t):O1}function E4(t){return t?Object.assign(Object.assign({},D1),t):D1}const Ui=Symbol(),$i=Symbol();function Un(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 P1(t,e,n,o,r){let s=n.localName;if(n.repeated){if(xt(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Un(e)}`);const a=t[s];for(const i of e){if(i===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Un(i)}`);switch(n.kind){case"message":a.push(n.T.fromJson(i,o));break;case"enum":const l=zd(n.T,i,o.ignoreUnknownFields,!0);l!==$i&&a.push(l);break;case"scalar":try{a.push($s(n.T,i,n.L,!0))}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Un(i)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}}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: ${Un(e)}`);const a=t[s];for(const[i,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let d;try{d=_4(n.K,i)}catch(u){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Un(e)}`;throw u instanceof Error&&u.message.length>0&&(h+=`: ${u.message}`),new Error(h)}switch(n.V.kind){case"message":a[d]=n.V.T.fromJson(l,o);break;case"enum":const u=zd(n.V.T,l,o.ignoreUnknownFields,!0);u!==$i&&(a[d]=u);break;case"scalar":try{a[d]=$s(n.V.T,l,To.BIGINT,!0)}catch(h){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Un(e)}`;throw h instanceof Error&&h.message.length>0&&(f+=`: ${h.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const a=n.T;if(e===null&&a.typeName!="google.protobuf.Value")return;let i=t[s];to(i)?i.fromJson(e,o):(t[s]=i=a.fromJson(e,o),a.fieldWrapper&&!n.oneof&&(t[s]=a.fieldWrapper.unwrapField(i)));break;case"enum":const l=zd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Ui:T1(n,t);break;case $i:break;default:t[s]=l}break;case"scalar":try{const d=$s(n.T,e,n.L,!1);d===Ui?T1(n,t):t[s]=d}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Un(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}function _4(t,e){if(t===ce.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return $s(t,e,To.BIGINT,!0).toString()}function $s(t,e,n,o){if(e===null)return o?Nr(t,n):Ui;switch(t){case ce.DOUBLE:case ce.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==ce.FLOAT&&g1(r),r;case ce.INT32:case ce.FIXED32:case ce.SFIXED32:case ce.SINT32:case ce.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==ce.UINT32||t==ce.FIXED32?Rd(s):Li(s),s;case ce.INT64:case ce.SFIXED64:case ce.SINT64:if(typeof e!="number"&&typeof e!="string")break;const a=mt.parse(e);return n?a.toString():a;case ce.FIXED64:case ce.UINT64:if(typeof e!="number"&&typeof e!="string")break;const i=mt.uParse(e);return n?i.toString():i;case ce.BOOL:if(typeof e!="boolean")break;return e;case ce.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case ce.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Bi.dec(e)}throw new Error}function zd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Ui;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 $i}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${Un(e)}`)}function I4(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function R1(t,e,n){if(t.kind=="map"){xt(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[a,i]of r)o[a.toString()]=Vi(t.V.T,i);break;case"message":for(const[a,i]of r)o[a.toString()]=i.toJson(n);break;case"enum":const s=t.V.T;for(const[a,i]of r)o[a.toString()]=Bd(s,i,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){xt(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(Vi(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Bd(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 Vi(t.T,e);case"enum":return Bd(t.T,e,n.enumAsInteger);case"message":return M1(t.T,e).toJson(n)}}function Bd(t,e,n){var o;if(xt(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 Vi(t,e){switch(t){case ce.INT32:case ce.SFIXED32:case ce.SINT32:case ce.FIXED32:case ce.UINT32:return xt(typeof e=="number"),e;case ce.FLOAT:case ce.DOUBLE:return xt(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case ce.STRING:return xt(typeof e=="string"),e;case ce.BOOL:return xt(typeof e=="boolean"),e;case ce.UINT64:case ce.FIXED64:case ce.INT64:case ce.SFIXED64:case ce.SINT64:return xt(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case ce.BYTES:return xt(e instanceof Uint8Array),Bi.enc(e)}}const Er=Symbol("@bufbuild/protobuf/unknown-fields"),L1={readUnknownFields:!0,readerFactory:t=>new j4(t)},F1={writeUnknownFields:!0,writerFactory:()=>new k4};function A4(t){return t?Object.assign(Object.assign({},L1),t):L1}function T4(t){return t?Object.assign(Object.assign({},F1),t):F1}function z1(t,e,n,o,r){let{repeated:s,localName:a}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=a&&delete t.value,t.case=a,a="value"),n.kind){case"scalar":case"enum":const i=n.kind=="enum"?ce.INT32:n.T;let l=Wi;if(n.kind=="scalar"&&n.L>0&&(l=M4),s){let f=t[a];if(o==kt.LengthDelimited&&i!=ce.STRING&&i!=ce.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,i))}else f.push(l(e,i))}else t[a]=l(e,i);break;case"message":const d=n.T;s?t[a].push(Hi(e,new d,r,n)):to(t[a])?Hi(e,t[a],r,n):(t[a]=Hi(e,new d,r,n),!d.fieldWrapper||n.oneof||n.repeated||(t[a]=d.fieldWrapper.unwrapField(t[a])));break;case"map":let[u,h]=function(f,m,x){const g=m.uint32(),p=m.pos+g;let b,y;for(;m.pos<p;){const[v]=m.tag();switch(v){case 1:b=Wi(m,f.K);break;case 2:switch(f.V.kind){case"scalar":y=Wi(m,f.V.T);break;case"enum":y=m.int32();break;case"message":y=Hi(m,new f.V.T,x,void 0)}}}if(b===void 0&&(b=Nr(f.K,To.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),y===void 0)switch(f.V.kind){case"scalar":y=Nr(f.V.T,To.BIGINT);break;case"enum":y=f.V.T.values[0].no;break;case"message":y=new f.V.T}return[b,y]}(n,e,r);t[a][u]=h}}function Hi(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function M4(t,e){const n=Wi(t,e);return typeof n=="bigint"?n.toString():n}function Wi(t,e){switch(e){case ce.STRING:return t.string();case ce.BOOL:return t.bool();case ce.DOUBLE:return t.double();case ce.FLOAT:return t.float();case ce.INT32:return t.int32();case ce.INT64:return t.int64();case ce.UINT64:return t.uint64();case ce.FIXED64:return t.fixed64();case ce.BYTES:return t.bytes();case ce.FIXED32:return t.fixed32();case ce.SFIXED32:return t.sfixed32();case ce.SFIXED64:return t.sfixed64();case ce.SINT64:return t.sint64();case ce.UINT32:return t.uint32();case ce.SINT32:return t.sint32()}}function B1(t,e,n,o){xt(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?ce.INT32:t.T;if(r)if(xt(Array.isArray(e)),t.packed)(function(a,i,l,d){if(!d.length)return;a.tag(l,kt.LengthDelimited).fork();let[,u]=$1(i);for(let h=0;h<d.length;h++)a[u](d[h]);a.join()})(n,s,t.no,e);else for(const a of e)Vs(n,s,t.no,a);else Vs(n,s,t.no,e);break;case"message":if(r){xt(Array.isArray(e));for(const a of e)U1(n,o,t,a)}else U1(n,o,t,e);break;case"map":xt(typeof e=="object"&&e!=null);for(const[a,i]of Object.entries(e))O4(n,o,t,a,i)}}function O4(t,e,n,o,r){t.tag(n.no,kt.LengthDelimited),t.fork();let s=o;switch(n.K){case ce.INT32:case ce.FIXED32:case ce.UINT32:case ce.SFIXED32:case ce.SINT32:s=Number.parseInt(o);break;case ce.BOOL:xt(o=="true"||o=="false"),s=o=="true"}switch(Vs(t,n.K,1,s),n.V.kind){case"scalar":Vs(t,n.V.T,2,r);break;case"enum":Vs(t,ce.INT32,2,r);break;case"message":xt(r!==void 0),t.tag(2,kt.LengthDelimited).bytes(r.toBinary(e))}t.join()}function U1(t,e,n,o){const r=M1(n.T,o);n.delimited?t.tag(n.no,kt.StartGroup).raw(r.toBinary(e)).tag(n.no,kt.EndGroup):t.tag(n.no,kt.LengthDelimited).bytes(r.toBinary(e))}function Vs(t,e,n,o){xt(o!==void 0);let[r,s]=$1(e);t.tag(n,r)[s](o)}function $1(t){let e=kt.Varint;switch(t){case ce.BYTES:case ce.STRING:e=kt.LengthDelimited;break;case ce.DOUBLE:case ce.FIXED64:case ce.SFIXED64:e=kt.Bit64;break;case ce.FIXED32:case ce.SFIXED32:case ce.FLOAT:e=kt.Bit32}return[e,ce[t].toLowerCase()]}function qi(t){if(t===void 0)return t;if(to(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Hs(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class D4{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 V1(t,e){const n=H1(t);return e?n:z4(F4(n))}const P4=H1;function H1(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 R4=new Set(["constructor","toString","toJSON","valueOf"]),L4=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),W1=t=>`${t}$`,F4=t=>L4.has(t)?W1(t):t,z4=t=>R4.has(t)?W1(t):t;class B4{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=V1(e,!1)}addField(e){xt(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 be=(q1=t=>new D4(t,e=>function(n){var o,r,s,a,i,l;const d=[];let u;for(const h of typeof n=="function"?n():n){const f=h;if(f.localName=V1(h.name,h.oneof!==void 0),f.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:P4(h.name),f.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(f.L=(s=h.L)!==null&&s!==void 0?s:To.BIGINT),f.delimited=(a=h.delimited)!==null&&a!==void 0&&a,f.req=(i=h.req)!==null&&i!==void 0&&i,f.opt=(l=h.opt)!==null&&l!==void 0&&l,h.packed===void 0&&(f.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=ce.BYTES&&h.T!=ce.STRING),h.oneof!==void 0){const m=typeof h.oneof=="string"?h.oneof:h.oneof.name;u&&u.name==m||(u=new B4(m)),f.oneof=u,u.addField(f)}d.push(f)}return d}(e)),G1=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]=Nr(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:N4,makeWriteOptions:E4,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${Un(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[a,i]of Object.entries(e)){const l=t.fields.findJsonName(a);if(l){if(l.oneof){if(i===null&&l.kind=="scalar")continue;const d=r.get(l.oneof);if(d!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${d}", "${a}"`);r.set(l.oneof,a)}P1(o,i,l,n,t)}else{let d=!1;if(s!=null&&s.findExtension&&a.startsWith("[")&&a.endsWith("]")){const u=s.findExtension(a.substring(1,a.length-1));if(u&&u.extendee.typeName==t.typeName){d=!0;const[h,f]=E1(u);P1(h,i,u.field,n,u),C4(o,u,f(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${a}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!A1(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!I4(r))continue}const a=R1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);a!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const a of n.runtime.bin.listUnknownFields(t)){const i=s.findExtensionFor(n.typeName,a.no);if(i&&_1(t,i)){const l=S4(t,i,e),d=R1(i.field,l,e);d!==void 0&&(o[i.field.jsonName]=d)}}}catch(s){const a=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,i=s instanceof Error?s.message:String(s);throw new Error(a+(i.length>0?`: ${i}`:""))}return o},readScalar:(t,e,n)=>$s(t,e,n??To.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||N1(t,e)?Vi(t,e):void 0},debug:Un},bin:{makeReadOptions:A4,makeWriteOptions:T4,listUnknownFields(t){var e;return(e=t[Er])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Er]},writeUnknownFields(t,e){const n=t[Er];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[Er])||(r[Er]=[]),r[Er].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),a=r?e.len:e.pos+n;let i,l;for(;e.pos<a&&([i,l]=e.tag(),r!==!0||l!=kt.EndGroup);){const d=s.fields.find(i);if(!d){const u=e.skip(l,i);o.readUnknownFields&&this.onUnknownField(t,i,l,u);continue}z1(t,e,d,l,o)}if(r&&(l!=kt.EndGroup||i!==n))throw new Error("invalid end group tag")},readField:z1,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(A1(r,t))B1(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&&B1(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:b1,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,a=t;if(a[r]!=null)switch(o.kind){case"oneof":const i=a[r].case;if(i===void 0)continue;const l=o.findField(i);let d=a[r].value;l&&l.kind=="message"&&!to(d,l.T)?d=new l.T(d):l&&l.kind==="scalar"&&l.T===ce.BYTES&&(d=Hs(d)),s[r]={case:i,value:d};break;case"scalar":case"enum":let u=a[r];o.T===ce.BYTES&&(u=o.repeated?u.map(Hs):Hs(u)),s[r]=u;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===ce.BYTES)for(const[m,x]of Object.entries(a[r]))s[r][m]=Hs(x);else Object.assign(s[r],a[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(a[r])){let x=a[r][m];f.fieldWrapper||(x=new f(x)),s[r][m]=x}}break;case"message":const h=o.T;if(o.repeated)s[r]=a[r].map(f=>to(f,h)?f:new h(f));else{const f=a[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=Hs(f):s[r]=f:s[r]=to(f,h)?f:new h(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((a,i)=>o.T.equals(a,s[i]));case"scalar":return r.every((a,i)=>Mo(o.T,a,s[i]));case"enum":return r.every((a,i)=>Mo(ce.INT32,a,s[i]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":let a=r,i=s;return o.T.fieldWrapper&&(a===void 0||to(a)||(a=o.T.fieldWrapper.wrapField(a)),i===void 0||to(i)||(i=o.T.fieldWrapper.wrapField(i))),o.T.equals(a,i);case"enum":return Mo(ce.INT32,r,s);case"scalar":return Mo(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const l=o.findField(r.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(r.value,s.value);case"enum":return Mo(ce.INT32,r.value,s.value);case"scalar":return Mo(l.T,r.value,s.value)}throw new Error(`oneof cannot contain ${l.kind}`);case"map":const d=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const u=o.V.T;return d.every(f=>u.equals(r[f],s[f]));case"enum":return d.every(f=>Mo(ce.INT32,r[f],s[f]));case"scalar":const h=o.V.T;return d.every(f=>Mo(h,r[f],s[f]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let a;if(r.repeated)a=s.map(qi);else if(r.kind=="map"){a=o[r.localName];for(const[i,l]of Object.entries(s))a[i]=qi(l)}else a=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:qi(s.value)}:{case:void 0}:qi(s);o[r.localName]=a}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:q1,initFields:G1}),makeMessageType(t,e,n){return function(o,r,s,a){var i;const l=(i=a==null?void 0:a.localName)!==null&&i!==void 0?i:r.substring(r.lastIndexOf(".")+1),d={[l]:function(u){o.util.initFields(this),o.util.initPartial(u,this)}}[l];return Object.setPrototypeOf(d.prototype,new St),Object.assign(d,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(u,h)=>new d().fromBinary(u,h),fromJson:(u,h)=>new d().fromJson(u,h),fromJsonString:(u,h)=>new d().fromJsonString(u,h),equals:(u,h)=>o.util.equals(d,u,h)}),d}(this,t,e,n)},makeEnum:b4,makeEnumType:y1,getEnumType:x4,makeExtension(t,e,n){return function(o,r,s,a){let i;return{typeName:r,extendee:s,get field(){if(!i){const l=typeof a=="function"?a():a;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,i=o.util.newFieldList([l]).list()[0]}return i},runtime:o}}(this,t,e,n)}});var q1,G1,un,Ud,Gi,Ws,Yi,qs,Oo;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(un||(un={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(Ud||(Ud={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Gi||(Gi={})),be.util.setEnumType(Gi,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(Ws||(Ws={})),be.util.setEnumType(Ws,"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"}(Yi||(Yi={})),be.util.setEnumType(Yi,"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"}(qs||(qs={})),be.util.setEnumType(qs,"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"}(Oo||(Oo={})),be.util.setEnumType(Oo,"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 oo=class oo extends St{constructor(n){super();Z(this,"completionId","");Z(this,"text","");Z(this,"prefix","");Z(this,"stop","");Z(this,"score",0);Z(this,"tokens",[]);Z(this,"decodedTokens",[]);Z(this,"probabilities",[]);Z(this,"adjustedProbabilities",[]);Z(this,"generatedLength",mt.zero);be.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 be.util.equals(oo,n,o)}};Z(oo,"runtime",be),Z(oo,"typeName","exa.codeium_common_pb.Completion"),Z(oo,"fields",be.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 $d=oo;const ro=class ro extends St{constructor(n){super();Z(this,"ideName","");Z(this,"ideVersion","");Z(this,"extensionName","");Z(this,"extensionVersion","");Z(this,"apiKey","");Z(this,"locale","");Z(this,"sessionId","");Z(this,"requestId",mt.zero);Z(this,"userAgent","");Z(this,"url","");Z(this,"authSource",Ws.CODEIUM);be.util.initPartial(n,this)}static fromBinary(n,o){return new ro().fromBinary(n,o)}static fromJson(n,o){return new ro().fromJson(n,o)}static fromJsonString(n,o){return new ro().fromJsonString(n,o)}static equals(n,o){return be.util.equals(ro,n,o)}};Z(ro,"runtime",be),Z(ro,"typeName","exa.codeium_common_pb.Metadata"),Z(ro,"fields",be.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:be.getEnumType(Ws)}]));let Ki=ro;const so=class so extends St{constructor(n){super();Z(this,"tabSize",mt.zero);Z(this,"insertSpaces",!1);be.util.initPartial(n,this)}static fromBinary(n,o){return new so().fromBinary(n,o)}static fromJson(n,o){return new so().fromJson(n,o)}static fromJsonString(n,o){return new so().fromJsonString(n,o)}static equals(n,o){return be.util.equals(so,n,o)}};Z(so,"runtime",be),Z(so,"typeName","exa.codeium_common_pb.EditorOptions"),Z(so,"fields",be.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Vd=so;be.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:be.getEnumType(Yi)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class U4 extends ms{constructor(n,o){super();Z(this,"index");Z(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 Xi=pr.define({combine:t=>xc(t,{language:Oo.TYPESCRIPT,timeout:150,widgetClass:U4,alwaysOn:!0},{})}),Y1=pr.define({combine:t=>xc(t,{override:()=>[]},{})}),$4=nt.mark({class:"cm-ghostText"}),rr=bn.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Xi);for(const r of e.effects){if(r.is(Od)){const{changeSpecs:s,index:a}=r.value,i=s[a].map(d=>$4.range(d.absoluteStartPos,d.absoluteEndPos)),l=(o=i.at(-1))==null?void 0:o.to;return{index:a,decorations:nt.set([...i,...l!==void 0&&s.length>1&&n.widgetClass?[nt.widget({widget:new n.widgetClass(a,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Dd)||r.is(Pd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>We.decorations.from(t,e=>(e==null?void 0:e.decorations)||nt.none)}),_r=gm.define(),Ji=gm.define();var ht;function Hd(t){const e=ht[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let Zi;(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"})(ht||(ht={}));class Ct extends Error{constructor(e,n=ht.Unknown,o,r,s){super(function(a,i){return a.length?`[${Hd(i)}] ${a}`:`[${Hd(i)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=ht.Unknown){return e instanceof Ct?e:e instanceof Error?e.name=="AbortError"?new Ct(e.message,ht.Canceled):new Ct(e.message,n,void 0,void 0,e):new Ct(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Ct.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var V4=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(a,i){(function(l,d,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},d)})(a,i,(s=t[r](s)).done,s.value)})}}},Gs=function(t){return this instanceof Gs?(this.v=t,this):new Gs(t)},H4=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Gs?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}},W4=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:Gs(t[r](a)),done:!1}:s?s(a):a}:s}},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(s){return new Promise(function(a,i){(function(l,d,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},d)})(a,i,(s=t[r](s)).done,s.value)})}}},Ir=function(t){return this instanceof Ir?(this.v=t,this):new Ir(t)},q4=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:Ir(t[r](a)),done:!1}:s?s(a):a}:s}},G4=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Ir?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}};function Y4(t,e){return function(n,o){const r={};for(const[s,a]of Object.entries(n.methods)){const i=o(Object.assign(Object.assign({},a),{localName:s,service:n}));i!=null&&(r[s]=i)}return r}(t,n=>{switch(n.kind){case un.Unary:return function(o,r,s){return async function(a,i){var l,d;const u=await o.unary(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues);return(l=i==null?void 0:i.onHeader)===null||l===void 0||l.call(i,u.header),(d=i==null?void 0:i.onTrailer)===null||d===void 0||d.call(i,u.trailer),u.message}}(e,t,n);case un.ServerStreaming:return function(o,r,s){return function(a,i){return X1(o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,function(l){return H4(this,arguments,function*(){yield Gs(yield*W4(V4(l)))})}([a]),i==null?void 0:i.contextValues),i)}}(e,t,n);case un.ClientStreaming:return function(o,r,s){return async function(a,i){var l,d,u,h,f,m;const x=await o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues);let g;(f=i==null?void 0:i.onHeader)===null||f===void 0||f.call(i,x.header);let p=0;try{for(var b,y=!0,v=K1(x.message);!(l=(b=await v.next()).done);y=!0)h=b.value,y=!1,g=h,p++}catch(w){d={error:w}}finally{try{y||l||!(u=v.return)||await u.call(v)}finally{if(d)throw d.error}}if(!g)throw new Ct("protocol error: missing response message",ht.Unimplemented);if(p>1)throw new Ct("protocol error: received extra messages for client streaming method",ht.Unimplemented);return(m=i==null?void 0:i.onTrailer)===null||m===void 0||m.call(i,x.trailer),g}}(e,t,n);case un.BiDiStreaming:return function(o,r,s){return function(a,i){return X1(o.stream(r,s,i==null?void 0:i.signal,i==null?void 0:i.timeoutMs,i==null?void 0:i.headers,a,i==null?void 0:i.contextValues),i)}}(e,t,n);default:return null}})}function X1(t,e){const n=function(){return G4(this,arguments,function*(){var o,r;const s=yield Ir(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield Ir(yield*q4(K1(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function J1(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 Z1(){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 Q1(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 e0(t,e){return e instanceof t?e:new t(e)}function K4(t,e){function n(o){return o.done===!0?o:{done:o.done,value:e0(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function t0(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 n0(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function o0(t,e,n,o){const r=e?r0(t.I,o):s0(t.I,n);return{parse:(e?r0(t.O,o):s0(t.O,n)).parse,serialize:r.serialize}}function r0(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Ct(`parse binary: ${r}`,ht.Internal)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Ct(`serialize binary: ${r}`,ht.Internal)}}}}function s0(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,a=n0(e);return{parse(i){try{const l=s.decode(i);return t.fromJsonString(l,a)}catch(l){throw Ct.from(l,ht.InvalidArgument)}},serialize(i){try{const l=i.toJsonString(a);return r.encode(l)}catch(l){throw Ct.from(l,ht.Internal)}}}}const X4=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function a0(t,e,n){var o;if(e&&new Headers(e).forEach((i,l)=>n.metadata.append(l,i)),typeof t!="object"||t==null||Array.isArray(t))throw n;let r=n.code;"code"in t&&typeof t.code=="string"&&(r=(o=function(i){if(!Zi){Zi={};for(const l of Object.values(ht))typeof l!="string"&&(Zi[Hd(l)]=l)}return Zi[i]}(t.code))!==null&&o!==void 0?o:r);const s=t.message;if(s!=null&&typeof s!="string")throw n;const a=new Ct(s??"",r,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string")throw n;try{a.details.push({type:i.type,value:Bi.dec(i.value),debug:i.debug})}catch{throw n}}return a}function J4(t){const e=new Ct("invalid end stream",ht.Unknown);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(a=>typeof a!="string"))throw e;for(const a of s)o.append(r,a)}}return{metadata:o,error:"error"in n&&n.error!=null?a0(n.error,o,e):void 0}}const Qi="Content-Type",Z4="Content-Length",i0="Content-Encoding",Q4="Accept-Encoding",l0="Connect-Protocol-Version";function c0(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.append(r.substring(8),o):e.append(r,o)}),[e,n]}function d0(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Qi,t==un.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(l0,"1"),s}function u0(t,e,n,o){const r=o.get(Qi),s=function(l){const d=l==null?void 0:l.match(X4);if(d)return{stream:!!d[1],binary:!!d[3]}}(r);if(n!==200){const l=new Ct(`HTTP ${n}`,function(d){switch(d){case 400:return ht.Internal;case 401:return ht.Unauthenticated;case 403:return ht.PermissionDenied;case 404:return ht.Unimplemented;case 429:case 502:case 503:case 504:return ht.Unavailable;default:return ht.Unknown}}(n),o);if(t==un.Unary&&s&&!s.binary)return{isUnaryError:!0,unaryError:l};throw l}const a=e,i=t!==un.Unary;if((s==null?void 0:s.binary)!==a||s.stream!==i)throw new Ct(`unsupported content type ${r}`,s===void 0?ht.Unknown:ht.Internal,o);return{isUnaryError:!1}}const eE="application/";function tE(t,e,n){let o="?connect=v1";const r=t.header.get(Qi);(r==null?void 0:r.indexOf(eE))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(i0);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,d){return d?Bi.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const a=t.url+o,i=new Headers(t.header);return[l0,Qi,Z4,i0,Q4].forEach(l=>i.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:a,header:i})}function h0(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,a=()=>{s.abort(new Ct("the operation timed out",ht.DeadlineExceeded))};let i;return r!==void 0&&(r<=0?a():i=setTimeout(a,r)),{signal:s.signal,cleanup:()=>clearTimeout(i)}}(t.timeoutMs),o=function(...r){const s=new AbortController,a=r.filter(l=>l!==void 0).concat(s.signal);for(const l of a){if(l.aborted){i.apply(l);break}l.addEventListener("abort",i)}function i(){s.signal.aborted||s.abort(J1(this));for(const l of a)l.removeEventListener("abort",i)}return s}(t.signal,e);return[o.signal,function(r){const s=Ct.from(e.aborted?J1(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var Ys,Wd,Ks;(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"})(Ys||(Ys={})),be.util.setEnumType(Ys,"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"}(Wd||(Wd={})),be.util.setEnumType(Wd,"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"}(Ks||(Ks={})),be.util.setEnumType(Ks,"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 ao=class ao extends St{constructor(n){super();Z(this,"threshold",0);be.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 be.util.equals(ao,n,o)}};Z(ao,"runtime",be),Z(ao,"typeName","exa.language_server_pb.MultilineConfig"),Z(ao,"fields",be.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let qd=ao;const io=class io extends St{constructor(n){super();Z(this,"metadata");Z(this,"document");Z(this,"editorOptions");Z(this,"otherDocuments",[]);Z(this,"experimentConfig");Z(this,"modelName","");Z(this,"multilineConfig");be.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 be.util.equals(io,n,o)}};Z(io,"runtime",be),Z(io,"typeName","exa.language_server_pb.GetCompletionsRequest"),Z(io,"fields",be.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ki},{no:2,name:"document",kind:"message",T:el},{no:3,name:"editor_options",kind:"message",T:Vd},{no:5,name:"other_documents",kind:"message",T:el,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Qd},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:qd}]));let Gd=io;const lo=class lo extends St{constructor(n){super();Z(this,"state");Z(this,"completionItems",[]);be.util.initPartial(n,this)}static fromBinary(n,o){return new lo().fromBinary(n,o)}static fromJson(n,o){return new lo().fromJson(n,o)}static fromJsonString(n,o){return new lo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(lo,n,o)}};Z(lo,"runtime",be),Z(lo,"typeName","exa.language_server_pb.GetCompletionsResponse"),Z(lo,"fields",be.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:eu},{no:2,name:"completion_items",kind:"message",T:ru,repeated:!0}]));let Yd=lo;const co=class co extends St{constructor(n){super();Z(this,"metadata");Z(this,"completionId","");be.util.initPartial(n,this)}static fromBinary(n,o){return new co().fromBinary(n,o)}static fromJson(n,o){return new co().fromJson(n,o)}static fromJsonString(n,o){return new co().fromJsonString(n,o)}static equals(n,o){return be.util.equals(co,n,o)}};Z(co,"runtime",be),Z(co,"typeName","exa.language_server_pb.AcceptCompletionRequest"),Z(co,"fields",be.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ki},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Kd=co;const uo=class uo extends St{constructor(e){super(),be.util.initPartial(e,this)}static fromBinary(e,n){return new uo().fromBinary(e,n)}static fromJson(e,n){return new uo().fromJson(e,n)}static fromJsonString(e,n){return new uo().fromJsonString(e,n)}static equals(e,n){return be.util.equals(uo,e,n)}};Z(uo,"runtime",be),Z(uo,"typeName","exa.language_server_pb.AcceptCompletionResponse"),Z(uo,"fields",be.util.newFieldList(()=>[]));let Xd=uo;const ho=class ho extends St{constructor(e){super(),be.util.initPartial(e,this)}static fromBinary(e,n){return new ho().fromBinary(e,n)}static fromJson(e,n){return new ho().fromJson(e,n)}static fromJsonString(e,n){return new ho().fromJsonString(e,n)}static equals(e,n){return be.util.equals(ho,e,n)}};Z(ho,"runtime",be),Z(ho,"typeName","exa.language_server_pb.GetAuthTokenRequest"),Z(ho,"fields",be.util.newFieldList(()=>[]));let Jd=ho;const fo=class fo extends St{constructor(n){super();Z(this,"authToken","");Z(this,"uuid","");be.util.initPartial(n,this)}static fromBinary(n,o){return new fo().fromBinary(n,o)}static fromJson(n,o){return new fo().fromJson(n,o)}static fromJsonString(n,o){return new fo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(fo,n,o)}};Z(fo,"runtime",be),Z(fo,"typeName","exa.language_server_pb.GetAuthTokenResponse"),Z(fo,"fields",be.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Zd=fo;const mo=class mo extends St{constructor(n){super();Z(this,"row",mt.zero);Z(this,"col",mt.zero);be.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 be.util.equals(mo,n,o)}};Z(mo,"runtime",be),Z(mo,"typeName","exa.language_server_pb.DocumentPosition"),Z(mo,"fields",be.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let Xs=mo;const po=class po extends St{constructor(n){super();Z(this,"absolutePath","");Z(this,"relativePath","");Z(this,"text","");Z(this,"editorLanguage","");Z(this,"language",Oo.UNSPECIFIED);Z(this,"cursorOffset",mt.zero);Z(this,"cursorPosition");Z(this,"lineEnding","");be.util.initPartial(n,this)}static fromBinary(n,o){return new po().fromBinary(n,o)}static fromJson(n,o){return new po().fromJson(n,o)}static fromJsonString(n,o){return new po().fromJsonString(n,o)}static equals(n,o){return be.util.equals(po,n,o)}};Z(po,"runtime",be),Z(po,"typeName","exa.language_server_pb.Document"),Z(po,"fields",be.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:be.getEnumType(Oo)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:Xs},{no:7,name:"line_ending",kind:"scalar",T:9}]));let el=po;const go=class go extends St{constructor(n){super();Z(this,"forceEnableExperiments",[]);be.util.initPartial(n,this)}static fromBinary(n,o){return new go().fromBinary(n,o)}static fromJson(n,o){return new go().fromJson(n,o)}static fromJsonString(n,o){return new go().fromJsonString(n,o)}static equals(n,o){return be.util.equals(go,n,o)}};Z(go,"runtime",be),Z(go,"typeName","exa.language_server_pb.ExperimentConfig"),Z(go,"fields",be.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:be.getEnumType(Gi),repeated:!0}]));let Qd=go;const xo=class xo extends St{constructor(n){super();Z(this,"state",Ys.UNSPECIFIED);Z(this,"message","");be.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 be.util.equals(xo,n,o)}};Z(xo,"runtime",be),Z(xo,"typeName","exa.language_server_pb.State"),Z(xo,"fields",be.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:be.getEnumType(Ys)},{no:2,name:"message",kind:"scalar",T:9}]));let eu=xo;const bo=class bo extends St{constructor(n){super();Z(this,"startOffset",mt.zero);Z(this,"endOffset",mt.zero);Z(this,"startPosition");Z(this,"endPosition");be.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 be.util.equals(bo,n,o)}};Z(bo,"runtime",be),Z(bo,"typeName","exa.language_server_pb.Range"),Z(bo,"fields",be.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:Xs},{no:4,name:"end_position",kind:"message",T:Xs}]));let tu=bo;const yo=class yo extends St{constructor(n){super();Z(this,"text","");Z(this,"deltaCursorOffset",mt.zero);be.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 be.util.equals(yo,n,o)}};Z(yo,"runtime",be),Z(yo,"typeName","exa.language_server_pb.Suffix"),Z(yo,"fields",be.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let nu=yo;const vo=class vo extends St{constructor(n){super();Z(this,"text","");Z(this,"offset",mt.zero);Z(this,"type",Ks.UNSPECIFIED);Z(this,"prefix","");Z(this,"line",mt.zero);be.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 be.util.equals(vo,n,o)}};Z(vo,"runtime",be),Z(vo,"typeName","exa.language_server_pb.CompletionPart"),Z(vo,"fields",be.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:be.getEnumType(Ks)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let ou=vo;const wo=class wo extends St{constructor(n){super();Z(this,"completion");Z(this,"suffix");Z(this,"range");Z(this,"source",qs.UNSPECIFIED);Z(this,"completionParts",[]);be.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 be.util.equals(wo,n,o)}};Z(wo,"runtime",be),Z(wo,"typeName","exa.language_server_pb.CompletionItem"),Z(wo,"fields",be.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:$d},{no:5,name:"suffix",kind:"message",T:nu},{no:2,name:"range",kind:"message",T:tu},{no:3,name:"source",kind:"enum",T:be.getEnumType(qs)},{no:8,name:"completion_parts",kind:"message",T:ou,repeated:!0}]));let ru=wo;const nE={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Gd,O:Yd,kind:un.Unary},acceptCompletion:{name:"AcceptCompletion",I:Kd,O:Xd,kind:un.Unary},getAuthToken:{name:"GetAuthToken",I:Jd,O:Zd,kind:un.Unary}}};var Js=function(t){return this instanceof Js?(this.v=t,this):new Js(t)},oE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(f){return Promise.resolve(f).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,f){r[h]&&(o[h]=function(m){return new Promise(function(x,g){s.push([h,m,x,g])>1||i(h,m)})},f&&(o[h]=f(o[h])))}function i(h,f){try{(m=r[h](f)).value instanceof Js?Promise.resolve(m.value.v).then(l,d):u(s[0][2],m)}catch(x){u(s[0][3],x)}var m}function l(h){i("next",h)}function d(h){i("throw",h)}function u(h,f){h(f),s.shift(),s.length&&i(s[0][0],s[0][1])}};const rE=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,a,i,l,d){var u;const{serialize:h,parse:f}=o0(r,n,t.jsonOptions,t.binaryOptions);return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await function(m){const x=t0(m.next,m.interceptors),[g,p,b]=h0(m);return x(Object.assign(Object.assign({},m.req),{message:e0(m.req.method.I,m.req.message),signal:g})).then(y=>(b(),y),p)}({interceptors:t.interceptors,signal:s,timeoutMs:a,req:{stream:!1,service:o,method:r,url:Q1(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:d0(r.kind,n,a,i),contextValues:d??Z1(),message:l},next:async m=>{var x;let g=null;t.useHttpGet===!0&&r.idempotency===Ud.NoSideEffects?m=tE(m,h(m.message),n):g=h(m.message);const p=(x=t.fetch)!==null&&x!==void 0?x:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:g})),{isUnaryError:y,unaryError:v}=u0(r.kind,n,b.status,b.headers);if(y)throw a0(await b.json(),function(...j){const C=new Headers;for(const _ of j)_.forEach((E,M)=>{C.append(M,E)});return C}(...c0(b.headers)),v);const[w,S]=c0(b.headers);return{stream:!1,service:o,method:r,header:w,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),n0(t.jsonOptions)),trailer:S}}})},async stream(o,r,s,a,i,l,d){var u;const{serialize:h,parse:f}=o0(r,n,t.jsonOptions,t.binaryOptions);function m(g,p,b,y){return oE(this,arguments,function*(){const v=function(S){let j,C=new Uint8Array(0);function _(E){const M=new Uint8Array(C.length+E.length);M.set(C),M.set(E,C.length),C=M}return new ReadableStream({start(){j=S.getReader()},async pull(E){let M;for(;;){if(M===void 0&&C.byteLength>=5){let F=0;for(let O=1;O<5;O++)F=(F<<8)+C[O];M={flags:C[0],length:F}}if(M!==void 0&&C.byteLength>=M.length+5)break;const D=await j.read();if(D.done)break;_(D.value)}if(M===void 0)return C.byteLength==0?void E.close():void E.error(new Ct("premature end of stream",ht.DataLoss));const I=C.subarray(5,5+M.length);C=C.subarray(5+M.length),E.enqueue({flags:M.flags,data:I})}})}(g).getReader();let w=!1;for(;;){const S=yield Js(v.read());if(S.done)break;const{flags:j,data:C}=S.value;if(!(1&~j))throw new Ct("protocol error: received unsupported compressed output",ht.Internal);if(!(2&~j)){w=!0;const _=J4(C);if(_.error){const E=_.error;throw b.forEach((M,I)=>{E.metadata.append(I,M)}),E}_.metadata.forEach((E,M)=>p.set(M,E));continue}yield yield Js(f(C))}if("throwIfAborted"in y&&y.throwIfAborted(),!w)throw"missing EndStreamResponse"})}async function x(g){if(r.kind!=un.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await g[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,y){const v=new Uint8Array(y.length+5);v.set(y,5);const w=new DataView(v.buffer,v.byteOffset,v.byteLength);return w.setUint8(0,b),w.setUint32(1,y.length),v}(0,h(p.value))}return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await function(g){const p=t0(g.next,g.interceptors),[b,y,v]=h0(g),w=Object.assign(Object.assign({},g.req),{message:K4(g.req.method.I,g.req.message),signal:b});let S=!1;return b.addEventListener("abort",function(){var j,C;const _=g.req.message[Symbol.asyncIterator]();S||(j=_.throw)===null||j===void 0||j.call(_,this.reason).catch(()=>{}),(C=_.return)===null||C===void 0||C.call(_).catch(()=>{})}),p(w).then(j=>Object.assign(Object.assign({},j),{message:{[Symbol.asyncIterator](){const C=j.message[Symbol.asyncIterator]();return{next:()=>C.next().then(_=>(_.done==1&&(S=!0,v()),_),y)}}}}),y)}({interceptors:t.interceptors,timeoutMs:a,signal:s,req:{stream:!0,service:o,method:r,url:Q1(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:d0(r.kind,n,a,i),contextValues:d??Z1(),message:l},next:async g=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,y=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await x(g.message)}));if(u0(r.kind,n,y.status,y.headers),y.body===null)throw"missing response body";const v=new Headers;return Object.assign(Object.assign({},g),{header:y.headers,trailer:v,message:m(y.body,v,y.headers,g.signal)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),sE=function(t,e){return Y4(t,e)}(nE,rE);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 aE(t,e){const n=t.state.facet(Xi),{override:o}=t.state.facet(Y1),r=await o(),s=t.state,a=s.selection.main.head,i=s.doc.toString();try{const l=await async function({text:x,cursorOffset:g,config:p,otherDocuments:b}){return await sE.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:x,cursorOffset:BigInt(g),language:p.language,editorLanguage:"typescript",lineEnding:`
|
105
|
-
`},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${tl}`}})}({text:i,cursorOffset:a,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&a!==e||ps(t.state)==="active"||!t.hasFocus)return;const d=l.completionItems.map(x=>{let g=0;return x.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),y=p.type===2?`
|
106
|
-
${p.text}`:p.text,v={absoluteStartPos:g+b,absoluteEndPos:g+b+y.length,from:b,to:b,insert:y};return g+=y.length,v})}),u=0,h=d.at(u);if(!h)return;const f=Ya.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:Od.of({index:u,reverseChangeSet:m,changeSpecs:d}),annotations:[Ji.of(null),_r.of(null),Ka.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(d=>setTimeout(d,300))}}function iE(){let t=null,e=0;return We.updateListener.of(n=>{const o=n.view.state.facet(Xi);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(a=>a.effects.some(i=>i.is(Dd)||i.is(Pd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(rr)||ps(s.state)==="active")return!0;for(const a of s.transactions)if(a.annotation(_r)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new z9(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await aE(n.view,e)},o.timeout),e=r)})}function f0(t){var r;const e=t.state.field(rr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Dd.of(null),annotations:[Ji.of(null),_r.of(null),Ka.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,a,i,l)=>{o=l}),t.dispatch({changes:n,selection:Jn.cursor(o),annotations:[_r.of(null),Ka.addToHistory.of(!0)]}),!0}const m0=t=>{const{state:e}=t,n=e.field(rr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const a=n.reverseChangeSet.apply(e.doc),i=Ya.of(n.reverseChangeSet,e.doc.length).compose(Ya.of(s,a.length)),l=Ya.of(s,a.length).invert(a);return t.dispatch({changes:i,effects:Od.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Ji.of(null),_r.of(null),Ka.addToHistory.of(!1)]}),!0};function su(t){const e=t.state.field(rr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Pd.of(null),annotations:[Ji.of(null),_r.of(null),Ka.addToHistory.of(!1)]}),!1)}function lE(){return We.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(rr)&&(o==="Tab"?f0(n):su(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(m0(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var i,l;let r=!1;const s=(i=o.state.selection.asSingle().ranges.at(0))==null?void 0:i.head,a=o.state.field(rr);return!(s===void 0||!a)&&((l=a.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?f0(e):su(e)}})}const cE=new xm,au=ft.get("@github/copilot-language-server"),p0={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},dE=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Xi.of(n),rr,_o.highest(An.of([{key:"Ctrl-]",run:m0}])),_o.highest(We.updateListener.of(o=>{o.focusChanged&&su(o.view)})),_o.high(lE()),iE()]}({apiKey:t.codeium_api_key,language:Oo.PYTHON}),Y1.of({override:async()=>[{text:yc(""),language:Oo.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(m1({...p0,fetchFn:async n=>{if(!vR()||n.doc.length===0)return"";await new Promise(a=>setTimeout(a,20));const o=n.doc.toString(),r=function(a,i){const l=a.doc.toString(),d=i.split(`
|
107
|
-
`).length-l.split(`
|
108
|
-
`).length,u=function(h,f){const m=h.lineAt(f);return{line:m.number-1,character:f-m.from}}(a.doc,a.selection.main.head);return u.line+=d,{textDocument:{uri:`file://${wR}`,version:"replace_me"},position:u,context:{triggerKind:U9.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:a.tabSize,insertSpaces:!0}}}(n,yc(o));return function(a,i,l){if(!a)return au.debug("No response from copilot"),"";const d=Array.isArray(a)?a[0]:a.items[0];if(!d)return au.debug("No response from copilot"),"";const{insertText:u,range:h}=d,f=String(u);if(!h)return au.error("No range from copilot"),f;const m=h.start.character-i.character,x=m<0?f.slice(-m):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let p=0;p<x.length;p++){const b=x.slice(p);if(g.startsWith(b))return x.slice(0,p)}return x}(await gj().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(m1({...p0,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(vc).type;let a=await B9.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&a.startsWith(o)&&(a=a.slice(o.length)),r&&a.endsWith(r)&&(a=a.slice(0,-r.length)),a}})),[...e,_o.highest(An.of([{key:"Escape",run:n=>{const o=f1(n);return!Ga(n)&&o}}])),cE.of(yR())]};function uE(t){return[An.of([{key:"Escape",preventDefault:!1,run:oC},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:V9},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:xg}]),$9(),cC,ki,dC]}const hE=nt.mark({class:"underline"}),g0=At.define(),x0=At.define(),b0=At.define(),fE=bn.define({create:()=>nt.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(g0)?n=t.update({add:[hE.range(o.value.from,o.value.to)]}):o.is(x0)?n=t.update({add:[H9.range(o.value.from,o.value.to)]}):o.is(b0)&&(n=nt.none);return n},provide:t=>We.decorations.from(t)});class mE{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(W9,!1),a=s==null?void 0:s.ranges.find(l=>r>=l.from&&r<=l.to);if(a){const{from:l,to:d}=a;return this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===d?void 0:(this.clearUnderline(),this.hoveredRange={from:l,to:d,position:r},void this.view.dispatch({effects:x0.of(this.hoveredRange)}))}const i=q9(this.view.state).cursorAt(r);if(i.name==="VariableName"){const{from:l,to:d}=i;if(this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===d)return;this.clearUnderline(),this.hoveredRange={from:l,to:d,position:r},this.view.dispatch({effects:g0.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:b0.of(null)}),this.hoveredRange=null)}}function pE(){return[We.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const a=[],i=s.split(`
|
109
|
-
`);let l=[],d=!1,u=0,h=!1,f=!1,m=0;const x=/\(/g,g=/\)/g,p=new Set(["@"]);function b(v){return(v.match(x)||[]).length-(v.match(g)||[]).length}function y(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(v=>v.trim()!=="")&&a.push(function(v){const w=v.split(`
|
110
|
-
`);if(w.length===0)return"";const S=w.filter(_=>_.trim().length>0);if(S.length===0)return"";const j=/^\s*/,C=Math.min(...S.map(_=>{var E;return((E=_.match(j))==null?void 0:E[0].length)??Number.POSITIVE_INFINITY}));return C===0?v.trim():w.map(_=>_.slice(C)).join(`
|
111
|
-
`).trim()}(l.join(`
|
112
|
-
`))),l=[]}}for(const v of i){const w=v.trim();(w||d)&&(w.startsWith("@app.cell")?(y(),d=!0,u=1):u>0?(w.startsWith("def")&&w.includes("(")&&!w.includes("):")&&(h=!0,m=b(w)),u--):h?(m+=b(w),m===0&&(h=!1)):d&&(p.has(w[0])||w.startsWith("if __name__")?(y(),d=w.startsWith("@")):w.startsWith("return")?w.includes("(")&&!w.endsWith(")")&&(f=!0,m=b(w)):f?(m+=b(w),m===0&&(f=!1)):l.push(v)))}return y(),a}(n);return o.length===0?!1:(e.state.facet(X9).createManyBelow(o),!0)}})]}const Rt=({variant:t,settings:e,styles:n})=>{const o=We.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=J9.define(n);return[o,d3(r)]};Rt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:L.comment,color:"#404080"},{tag:[L.string,L.regexp],color:"#999999"},{tag:L.number,color:"#7090B0"},{tag:[L.bool,L.null],color:"#8080A0"},{tag:[L.punctuation,L.derefOperator],color:"#805080"},{tag:L.keyword,color:"#60B0FF"},{tag:L.definitionKeyword,color:"#B0FFF0"},{tag:L.moduleKeyword,color:"#60B0FF"},{tag:L.operator,color:"#A0A0FF"},{tag:[L.variableName,L.self],color:"#008080"},{tag:L.operatorKeyword,color:"#A0A0FF"},{tag:L.controlKeyword,color:"#80A0FF"},{tag:L.className,color:"#70E080"},{tag:[L.function(L.propertyName),L.propertyName],color:"#50A0A0"},{tag:L.tagName,color:"#009090"},{tag:L.modifier,color:"#B0FFF0"},{tag:[L.squareBracket,L.attributeName],color:"#D0D0FF"}]}),Rt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:L.comment,color:"#787b8099"},{tag:L.string,color:"#86b300"},{tag:L.regexp,color:"#4cbf99"},{tag:[L.number,L.bool,L.null],color:"#ffaa33"},{tag:L.variableName,color:"#5c6166"},{tag:[L.definitionKeyword,L.modifier],color:"#fa8d3e"},{tag:[L.keyword,L.special(L.brace)],color:"#fa8d3e"},{tag:L.operator,color:"#ed9366"},{tag:L.separator,color:"#5c6166b3"},{tag:L.punctuation,color:"#5c6166"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#f2ae49"},{tag:[L.className,L.definition(L.typeName)],color:"#22a4e6"},{tag:[L.tagName,L.typeName,L.self,L.labelName],color:"#55b4d4"},{tag:L.angleBracket,color:"#55b4d480"},{tag:L.attributeName,color:"#f2ae49"}]}),Rt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:L.comment,color:"#6E6E6E"},{tag:[L.string,L.regexp,L.special(L.brace)],color:"#5C81B3"},{tag:L.number,color:"#C1E1B8"},{tag:L.bool,color:"#53667D"},{tag:[L.definitionKeyword,L.modifier,L.function(L.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[L.keyword,L.moduleKeyword,L.operatorKeyword,L.operator],color:"#697A8E",fontWeight:"bold"},{tag:[L.variableName,L.attributeName],color:"#708E67"},{tag:[L.function(L.variableName),L.definition(L.propertyName),L.derefOperator],color:"#fff"},{tag:L.tagName,color:"#A3D295"}]}),Rt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:L.comment,color:"#666666"},{tag:[L.string,L.special(L.brace)],color:"#54BE0D"},{tag:L.regexp,color:"#E9C062"},{tag:L.number,color:"#CF6A4C"},{tag:[L.keyword,L.operator],color:"#5EA6EA"},{tag:L.variableName,color:"#7587A6"},{tag:[L.definitionKeyword,L.modifier],color:"#F9EE98"},{tag:[L.propertyName,L.function(L.variableName)],color:"#937121"},{tag:[L.typeName,L.angleBracket,L.tagName],color:"#9B859D"}]}),Rt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:L.comment,color:"#6B4E32"},{tag:[L.keyword,L.operator,L.derefOperator],color:"#EF5D32"},{tag:L.className,color:"#EFAC32",fontWeight:"bold"},{tag:[L.typeName,L.propertyName,L.function(L.variableName),L.definition(L.variableName)],color:"#EFAC32"},{tag:L.definition(L.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:L.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[L.number,L.bool],color:"#6C99BB"},{tag:[L.variableName,L.self],color:"#7DAF9C"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#D9D762"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#EFCB43"}]}),Rt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:L.comment,color:"#404040"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#00D8FF"},{tag:L.number,color:"#E62286"},{tag:[L.variableName,L.attributeName,L.self],color:"#E62286",fontWeight:"bold"},{tag:L.function(L.variableName),color:"#fff",fontWeight:"bold"}]}),Rt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:L.comment,color:"#BCC8BA"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#5D90CD"},{tag:[L.number,L.bool,L.null],color:"#46A609"},{tag:L.keyword,color:"#AF956F"},{tag:[L.definitionKeyword,L.modifier],color:"#C52727"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#606060"},{tag:L.self,color:"#000"}]}),Rt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:L.comment,color:"#0088FF"},{tag:L.string,color:"#3AD900"},{tag:L.regexp,color:"#80FFC2"},{tag:[L.number,L.bool,L.null],color:"#FF628C"},{tag:[L.definitionKeyword,L.modifier],color:"#FFEE80"},{tag:L.variableName,color:"#CCCCCC"},{tag:L.self,color:"#FF80E1"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.definition(L.typeName),L.labelName],color:"#FFDD00"},{tag:[L.keyword,L.operator],color:"#FF9D00"},{tag:[L.propertyName,L.typeName],color:"#80FFBB"},{tag:L.special(L.brace),color:"#EDEF7D"},{tag:L.attributeName,color:"#9EFFFF"},{tag:L.derefOperator,color:"#fff"}]}),Rt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:L.comment,color:"#AEAEAE"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#8DFF8E"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.function(L.definition(L.variableName)),L.definition(L.typeName)],color:"#A3EBFF"},{tag:[L.number,L.bool,L.null],color:"#62E9BD"},{tag:[L.keyword,L.operator],color:"#2BF1DC"},{tag:[L.definitionKeyword,L.modifier],color:"#F8FBB1"},{tag:[L.variableName,L.self],color:"#B683CA"},{tag:[L.angleBracket,L.tagName,L.typeName,L.propertyName],color:"#60A4F1"},{tag:L.derefOperator,color:"#E0E0E0"},{tag:L.attributeName,color:"#7BACCA"}]}),Rt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:L.comment,color:"#6272a4"},{tag:[L.string,L.special(L.brace)],color:"#f1fa8c"},{tag:[L.number,L.self,L.bool,L.null],color:"#bd93f9"},{tag:[L.keyword,L.operator],color:"#ff79c6"},{tag:[L.definitionKeyword,L.typeName],color:"#8be9fd"},{tag:L.definition(L.typeName),color:"#f8f8f2"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.attributeName],color:"#50fa7b"}]}),Rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:L.comment,color:"#AAAAAA"},{tag:[L.keyword,L.operator,L.typeName,L.tagName,L.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[L.attributeName,L.definition(L.propertyName)],color:"#4F9FD0"},{tag:[L.className,L.string,L.special(L.brace)],color:"#CF4F5F"},{tag:L.number,color:"#CF4F5F",fontWeight:"bold"},{tag:L.variableName,fontWeight:"bold"}]}),Rt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:L.comment,color:"#9995b7"},{tag:L.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#ff5792"},{tag:[L.className,L.tagName,L.definition(L.typeName)],color:"#0094f0"},{tag:[L.number,L.bool,L.null,L.special(L.brace)],color:"#5842ff"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#0095a8"},{tag:L.typeName,color:"#b3694d"},{tag:[L.propertyName,L.variableName],color:"#fa8900"},{tag:L.operator,color:"#ff5792"},{tag:L.self,color:"#e64100"},{tag:[L.string,L.regexp],color:"#00b368"},{tag:[L.paren,L.bracket],color:"#0431fa"},{tag:L.labelName,color:"#00bdd6"},{tag:L.attributeName,color:"#e64100"},{tag:L.angleBracket,color:"#9995b7"}]}),Rt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:L.comment,color:"#9893a5"},{tag:[L.bool,L.null],color:"#286983"},{tag:L.number,color:"#d7827e"},{tag:L.className,color:"#d7827e"},{tag:[L.angleBracket,L.tagName,L.typeName],color:"#56949f"},{tag:L.attributeName,color:"#907aa9"},{tag:L.punctuation,color:"#797593"},{tag:[L.keyword,L.modifier],color:"#286983"},{tag:[L.string,L.regexp],color:"#ea9d34"},{tag:L.variableName,color:"#d7827e"}]}),Rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:L.comment,color:"#CFCFCF"},{tag:[L.number,L.bool,L.null],color:"#E66C29"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.labelName,L.definition(L.typeName)],color:"#2EB43B"},{tag:L.keyword,color:"#D8B229"},{tag:L.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#925A47"},{tag:L.string,color:"#704D3D"},{tag:L.typeName,color:"#2F8996"},{tag:[L.variableName,L.propertyName],color:"#77ACB0"},{tag:L.self,color:"#77ACB0",fontWeight:"bold"},{tag:L.regexp,color:"#E3965E"},{tag:[L.tagName,L.angleBracket],color:"#BAA827"},{tag:L.attributeName,color:"#B06520"},{tag:L.derefOperator,color:"#000"}]}),Rt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:L.comment,color:"#93A1A1"},{tag:L.string,color:"#2AA198"},{tag:L.regexp,color:"#D30102"},{tag:L.number,color:"#D33682"},{tag:L.variableName,color:"#268BD2"},{tag:[L.keyword,L.operator,L.punctuation],color:"#859900"},{tag:[L.definitionKeyword,L.modifier],color:"#073642",fontWeight:"bold"},{tag:[L.className,L.self,L.definition(L.propertyName)],color:"#268BD2"},{tag:L.function(L.variableName),color:"#268BD2"},{tag:[L.bool,L.null],color:"#B58900"},{tag:L.tagName,color:"#268BD2",fontWeight:"bold"},{tag:L.angleBracket,color:"#93A1A1"},{tag:L.attributeName,color:"#93A1A1"},{tag:L.typeName,color:"#859900"}]}),Rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:L.comment,color:"#8E908C"},{tag:[L.variableName,L.self,L.propertyName,L.attributeName,L.regexp],color:"#C82829"},{tag:[L.number,L.bool,L.null],color:"#F5871F"},{tag:[L.className,L.typeName,L.definition(L.typeName)],color:"#C99E00"},{tag:[L.string,L.special(L.brace)],color:"#718C00"},{tag:L.operator,color:"#3E999F"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#4271AE"},{tag:L.keyword,color:"#8959A8"},{tag:L.derefOperator,color:"#4D4D4C"}]});const gE=[Rt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#5c6370"},{tag:L.variableName,color:"#abb2bf"},{tag:[L.string,L.special(L.brace)],color:"#98c379"},{tag:L.number,color:"#d19a66"},{tag:L.bool,color:"#d19a66"},{tag:L.null,color:"#d19a66"},{tag:L.keyword,color:"#c678dd",fontWeight:500},{tag:L.className,color:"#61afef"},{tag:L.definition(L.typeName),color:"#61afef"},{tag:L.typeName,color:"#56b6c2"},{tag:L.angleBracket,color:"#abb2bf"},{tag:L.tagName,color:"#e06c75"},{tag:L.attributeName,color:"#d19a66"},{tag:L.operator,color:"#56b6c2",fontWeight:500},{tag:[L.function(L.variableName)],color:"#61afef"},{tag:[L.propertyName],color:"#e5c07b"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],xE=[Rt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#708090"},{tag:L.variableName,color:"#000000"},{tag:[L.string,L.special(L.brace)],color:"#a11"},{tag:L.number,color:"#164"},{tag:L.bool,color:"#219"},{tag:L.null,color:"#219"},{tag:L.keyword,color:"#708",fontWeight:500},{tag:L.className,color:"#00f"},{tag:L.definition(L.typeName),color:"#00f"},{tag:L.typeName,color:"#085"},{tag:L.angleBracket,color:"#000000"},{tag:L.tagName,color:"#170"},{tag:L.attributeName,color:"#00c"},{tag:L.operator,color:"#a2f",fontWeight:500},{tag:[L.function(L.variableName)],color:"#00c"},{tag:[L.propertyName],color:"#05a"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function y0(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const bE=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:a,lspConfig:i,diagnosticsConfig:l,displayConfig:d}=t,u=y0(t);return[kR(n,o),[We.domEventHandlers({drop:(f,m)=>{var p,b;const x=(p=f.dataTransfer)==null?void 0:p.files[0];if(x!=null&&x.type.startsWith("text/"))return f.preventDefault(),Y9(m,x),!0;if(x!=null&&x.type.startsWith("image/"))return f.preventDefault(),K9(m,x),!0;const g=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(g){f.preventDefault();const y=m.posAtCoords({x:f.clientX,y:f.clientY});return y!==null&&m.dispatch({changes:{from:y,to:y,insert:g},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],pE(),m4(),Z9({completionConfig:a,hotkeys:o,placeholderType:u,lspConfig:i,diagnosticsConfig:l}),Q9({cellId:e,hotkeys:o,cellActions:s}),yE(t),[fE,(h=(f,m)=>{G9(f,m)},zn.define(f=>new mE(f,h))),We.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?eO():[],r&&Qf("inline_ai_tooltip")?n4({prompt:f=>async function(m){var w,S;const x=`
|
113
|
-
${m.codeBefore}
|
114
|
-
<rewrite_this>
|
115
|
-
${m.selection}
|
116
|
-
</rewrite_this>
|
117
|
-
${m.codeAfter}
|
118
|
-
`.trim(),g=r3();await s3();const p=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:m.prompt,code:x,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((w=m.selection.match(/^\s*/))==null?void 0:w[0])||"",y=(S=p.body)==null?void 0:S.getReader();if(!y)throw new Error("Failed to get response reader");let v="";for(;;){const{done:j,value:C}=await y.read();if(j)break;v+=new TextDecoder().decode(C)}return v.startsWith(b)||(v=b+v),v}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:bk(f.editorView)})}):[],tO(Qe),nO(e,d.reference_highlighting??!1)];var h},yE=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:a}=t,i=y0(t);return[We.lineWrapping,oO(),rO(),sO(),aO(),iO(),lO(),cO(),dO({position:"fixed",parent:document.querySelector("#App")??void 0}),uO(),e==="dark"?gE:xE,hO(s),dE(o),fO(),mO(),g4(),_o.high(An.of(vO)),pO(),gO(),xO.of(" "),d3(wO,{fallback:!0}),An.of(kO),bO({placeholderType:i,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:a}}),yO.of(jO()),Xa.allowMultipleSelections.of(!0),uE(n),An.of([{key:"Tab",run:l=>c3(l)||(d=>{const{from:u,to:h}=d.state.selection.main;if(u!==h)return!1;const f=d.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&EO(d)})(l)||SO(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ps(l.state)!==null&&(bc(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ps(l.state)!==null&&(bc(!1)(l),!0),preventDefault:!0}]),An.of([...CO,NO])]},vE={width:void 0,height:void 0};function v0(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}let w0,k0,j0,S0;w0=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),k0=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),j0=t=>{const e=H.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:a,interrupted:i,elapsedTime:l,runStartTimestamp:d,lastRunStartTimestamp:u,uninstantiated:h}=t;if(!n)return null;const f=d??u;let m;e[0]!==f?(m=f?c.jsx(S0,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const x=m;if(r&&o==="running")return ft.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[3]=x,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:c.jsxs(Ns,{children:[c.jsx(Ss,{className:"h-5 w-5",strokeWidth:1.5}),c.jsx(wc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=c.jsx(Ne,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let g,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[9]=x,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:c.jsx(Ss,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=c.jsx(Ne,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[15]=x,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:c.jsxs(Ns,{layerTop:!0,children:[c.jsx(fi,{className:"h-5 w-5",strokeWidth:1.5}),c.jsx(Ss,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=c.jsx(Ne,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=c.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]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[21]=x,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:c.jsxs(Ns,{children:[c.jsx(wc,{className:"h-5 w-5",strokeWidth:1}),c.jsx(Ss,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=c.jsx(Ne,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let g,p,b,y,v;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[27]=x,e[28]=p):p=e[28],e[29]!==d?(b=bm.fromSeconds(d)||bm.now(),e[29]=d,e[30]=b):b=e[30],e[31]!==b?(y=c.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:c.jsx(wE,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(v=c.jsx(Ne,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=v):v=e[35],v}if(o==="queued"){let g,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==x?(p=c.jsxs("div",{className:"flex flex-col gap-1",children:[g,x]}),e[37]=x,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:c.jsx(Dc,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=c.jsx(Ne,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(a||i||s||h){let g;e[42]!==l?(g=js(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?c.jsx(Pc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let v,w,S,j,C,_="";if(h)v="This cell has not yet been run";else if(i){let E;v="This cell was interrupted when it was last run",e[47]!==y?(E=c.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=E):E=e[48],_=E}else if(a){let E;v="This cell has been modified since it was last run",e[49]!==y?(E=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=E):E=e[50],_=E}else{let E;v="This cell has not been run with the latest inputs",e[51]!==y?(E=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=E):E=e[52],_=E}return e[53]===Symbol.for("react.memo_cache_sentinel")?(w=c.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:c.jsx(wc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=w):w=e[53],e[54]!==v?(S=c.jsx(Ne,{content:v,usePortal:!0,children:w}),e[54]=v,e[55]=S):S=e[55],e[56]!==l||e[57]!==p||e[58]!==x||e[59]!==_?(j=l&&c.jsx(Ne,{content:c.jsxs("div",{className:"flex flex-col gap-1",children:[_,x]}),usePortal:!0,children:c.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:c.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=x,e[59]=_,e[60]=j):j=e[60],e[61]!==S||e[62]!==j?(C=c.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[S,j]}),e[61]=S,e[62]=j,e[63]=C):C=e[63],C}if(l!==null){let g;e[64]!==l?(g=js(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?c.jsx(Pc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let v,w,S,j;return e[69]!==y?(v=c.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=v):v=e[70],e[71]!==x||e[72]!==v?(w=c.jsxs("div",{className:"flex flex-col gap-1",children:[v,x]}),e[71]=x,e[72]=v,e[73]=w):w=e[73],e[74]!==p?(S=c.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:c.jsx("span",{children:p})}),e[74]=p,e[75]=S):S=e[75],e[76]!==w||e[77]!==S?(j=c.jsx(Ne,{content:w,usePortal:!0,children:S}),e[76]=w,e[77]=S,e[78]=j):j=e[78],j}return null},Pc=t=>{const e=H.c(2);let n;return e[0]!==t.elapsedTime?(n=c.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},S0=t=>{const e=H.c(18),n=1e3*t.lastRanTime;let o,r,s,a,i,l,d,u,h;if(e[0]!==n){const f=new Date(n),m=new Date,x=f.toDateString()===m.toDateString()?w0:k0;a="Ran at",i=" ",l=c.jsx("strong",{className:"tracking-wide font-semibold",children:x.format(f)}),d=" ",o="text-muted-foreground",r="(",s=zj(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a,e[5]=i,e[6]=l,e[7]=d}else o=e[1],r=e[2],s=e[3],a=e[4],i=e[5],l=e[6],d=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(u=c.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=u):u=e[11],e[12]!==a||e[13]!==i||e[14]!==l||e[15]!==d||e[16]!==u?(h=c.jsxs("span",{children:[a,i,l,d,u]}),e[12]=a,e[13]=i,e[14]=l,e[15]=d,e[16]=u,e[17]=h):h=e[17],h},js=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 wE=t=>{const e=H.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(a){const i=T.useRef(a),[l,d]=T.useState(a);return T.useEffect(()=>{const u=setInterval(()=>{d(bm.now().toMilliseconds())},17);return()=>clearInterval(u)},[]),l-i.current}(n);let r,s;return e[2]!==o?(r=js(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=c.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var iu="ContextMenu",[kE,aL]=h3(iu,[u3]),Yt=u3(),[jE,C0]=kE(iu),N0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[a,i]=T.useState(!1),l=Yt(e),d=Go(o),u=T.useCallback(h=>{i(h),d(h)},[d]);return c.jsx(jE,{scope:e,open:a,onOpenChange:u,modal:s,children:c.jsx(UO,{...l,dir:r,open:a,onOpenChange:u,modal:s,children:n})})};N0.displayName=iu;var E0="ContextMenuTrigger",_0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=C0(E0,n),a=Yt(n),i=T.useRef({x:0,y:0}),l=T.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...i.current})}),d=T.useRef(0),u=T.useCallback(()=>window.clearTimeout(d.current),[]),h=f=>{i.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return T.useEffect(()=>u,[u]),T.useEffect(()=>{o&&u()},[o,u]),c.jsxs(c.Fragment,{children:[c.jsx(AO,{...a,virtualRef:l}),c.jsx(gs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Tn(t.onContextMenu,f=>{u(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Tn(t.onPointerDown,nl(f=>{u(),d.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Tn(t.onPointerMove,nl(u)),onPointerCancel:o?t.onPointerCancel:Tn(t.onPointerCancel,nl(u)),onPointerUp:o?t.onPointerUp:Tn(t.onPointerUp,nl(u))})]})});_0.displayName=E0;var I0=t=>{const{__scopeContextMenu:e,...n}=t,o=Yt(e);return c.jsx($O,{...o,...n})};I0.displayName="ContextMenuPortal";var A0="ContextMenuContent",T0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=C0(A0,n),s=Yt(n),a=T.useRef(!1);return c.jsx(TO,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:i=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,i),!i.defaultPrevented&&a.current&&i.preventDefault(),a.current=!1},onInteractOutside:i=>{var l;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||r.modal||(a.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)"}})});T0.displayName=A0,T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(MO,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var M0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(OO,{...r,...o,ref:e})});M0.displayName="ContextMenuLabel";var O0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(IO,{...r,...o,ref:e})});O0.displayName="ContextMenuItem";var D0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(DO,{...r,...o,ref:e})});D0.displayName="ContextMenuCheckboxItem",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(PO,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var P0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(RO,{...r,...o,ref:e})});P0.displayName="ContextMenuRadioItem";var R0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(LO,{...r,...o,ref:e})});R0.displayName="ContextMenuItemIndicator";var L0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(_O,{...r,...o,ref:e})});L0.displayName="ContextMenuSeparator",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(FO,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var F0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(zO,{...r,...o,ref:e})});F0.displayName="ContextMenuSubTrigger";var z0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Yt(n);return c.jsx(BO,{...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}z0.displayName="ContextMenuSubContent";var B0=T0,U0=M0,$0=O0,V0=D0,H0=P0,W0=R0,q0=L0,G0=F0,Y0=z0;const K0=N0,X0=_0,SE=WO(I0);T.forwardRef((t,e)=>{const n=H.c(14);let o,r,s,a,i,l,d;return n[0]!==t?({className:r,inset:s,children:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==r||n[6]!==s?(i=qO({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(KO,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==a||n[11]!==e||n[12]!==i?(d=c.jsxs(G0,{ref:e,className:i,...a,children:[o,l]}),n[9]=o,n[10]=a,n[11]=e,n[12]=i,n[13]=d):d=n[13],d}).displayName=G0.displayName;const J0="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";T.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(f3({subcontent:!0}),J0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=c.jsx(Y0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a}).displayName=Y0.displayName;const lu=T.forwardRef((t,e)=>{const n=H.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s;let i;n[4]!==o||n[5]!==a?(i=xe(f3(),J0,a&&"overflow-auto",o),n[4]=o,n[5]=a,n[6]=i):i=n[6];const l=a?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let d,u;return n[7]!==r.style||n[8]!==l?(d={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=d):d=n[9],n[10]!==r||n[11]!==e||n[12]!==i||n[13]!==d?(u=c.jsx(SE,{children:c.jsx(GO,{children:c.jsx(B0,{ref:e,className:i,style:d,...r})})}),n[10]=r,n[11]=e,n[12]=i,n[13]=d,n[14]=u):u=n[14],u});lu.displayName=B0.displayName;const Zs=T.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,a,i,l;return n[0]!==t?({className:o,inset:r,variant:a,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(i=HO({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=i):i=n[8],n[9]!==s||n[10]!==e||n[11]!==i?(l=c.jsx($0,{ref:e,className:i,...s}),n[9]=s,n[10]=e,n[11]=i,n[12]=l):l=n[12],l});Zs.displayName=$0.displayName,T.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,a,i,l,d,u;return n[0]!==t?({className:s,children:r,checked:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==s?(i=kc({className:s}),n[5]=s,n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=kc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("span",{className:l,children:c.jsx(W0,{children:c.jsx(XO,{className:"h-4 w-4"})})}),n[8]=d):d=n[8],n[9]!==o||n[10]!==r||n[11]!==a||n[12]!==e||n[13]!==i?(u=c.jsxs(V0,{ref:e,className:i,checked:o,...a,children:[d,r]}),n[9]=o,n[10]=r,n[11]=a,n[12]=e,n[13]=i,n[14]=u):u=n[14],u}).displayName=V0.displayName,T.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,a,i,l,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=kc({className:r}),n[4]=r,n[5]=a):a=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(i=kc(),n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("span",{className:i,children:c.jsx(W0,{children:c.jsx(JO,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==a?(d=c.jsxs(H0,{ref:e,className:a,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=a,n[12]=d):d=n[12],d}).displayName=H0.displayName,T.forwardRef((t,e)=>{const n=H.c(11);let o,r,s,a,i;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(a=YO({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=a):a=n[6],n[7]!==s||n[8]!==e||n[9]!==a?(i=c.jsx(U0,{ref:e,className:a,...s}),n[7]=s,n[8]=e,n[9]=a,n[10]=i):i=n[10],i}).displayName=U0.displayName;const Z0=T.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(VO({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=c.jsx(q0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a});Z0.displayName=q0.displayName;const Q0=t=>{const e=H.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=uc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const a=s;let i;e[3]!==a||e[4]!==n?(i=Zn(n)?a:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("div",{children:a}),c.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=a,e[4]=n,e[5]=i):i=e[5];const l=i;let d,u,h,f,m,x;return e[6]!==o?(d=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=d):d=e[7],e[8]!==n?(u=xe("shoulder-button hover-action",Zn(n)&&" inactive-button"),e[8]=n,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Yo,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==d||e[12]!==u?(f=c.jsx(an,{onClick:d,className:u,onMouseDown:Rn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=d,e[12]=u,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(m=c.jsx(Ne,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=m):m=e[16],e[17]!==o||e[18]!==m?(x=c.jsx(CE,{onClick:o,children:m}),e[17]=o,e[18]=m,e[19]=x):x=e[19],x},CE=t=>{const e=H.c(26),{children:n,onClick:o}=t,{createNewCell:r}=it();if(!o)return n;let s,a,i,l,d,u,h,f,m,x,g,p;return e[0]!==n?(s=c.jsx(X0,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(a=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx(Xl,{})}),e[4]=i):i=e[4],e[5]!==a?(l=c.jsxs(Zs,{onSelect:a,children:[i,"Python cell"]},"python"),e[5]=a,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(d=b=>{b.stopPropagation(),Kn({autoInstantiate:!0,createNewCell:r}),o({code:new La().defaultCode,hideCode:!0})},e[7]=r,e[8]=o,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx(Kl,{})}),e[10]=u):u=e[10],e[11]!==d?(h=c.jsxs(Zs,{onSelect:d,children:[u,"Markdown cell"]},"markdown"),e[11]=d,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),Kn({autoInstantiate:!0,createNewCell:r}),o({code:new jc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx("div",{className:"mr-3 text-muted-foreground",children:c.jsx(Wo,{size:13,strokeWidth:1.5})}),e[16]=m):m=e[16],e[17]!==f?(x=c.jsxs(Zs,{onSelect:f,children:[m,"SQL cell"]},"sql"),e[17]=f,e[18]=x):x=e[18],e[19]!==l||e[20]!==h||e[21]!==x?(g=c.jsxs(lu,{children:[l,h,x]}),e[19]=l,e[20]=h,e[21]=x,e[22]=g):g=e[22],e[23]!==s||e[24]!==g?(p=c.jsxs(K0,{children:[s,g]}),e[23]=s,e[24]=g,e[25]=p):p=e[25],p},ex=q.memo(q.forwardRef((t,e)=>{const n=H.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s,[i,l]=T.useState(!1);let d;n[4]!==r?(d={cell:r},n[4]=r,n[5]=d):d=n[5];const u=nd(d),h=QO();let f,m,x,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(NE)}),n[6]=f):f=n[6],T.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Ma,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(tc,{children:"No results"}),n[8]=x):x=n[8],n[9]!==u){let _;n[11]!==u.length?(_=(E,M)=>c.jsxs(T.Fragment,{children:[c.jsx(qf,{children:E.map(I=>{let D=c.jsxs("div",{className:"flex items-center flex-1",children:[I.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:I.icon}),c.jsx("div",{className:"flex-1",children:I.label}),c.jsxs("div",{className:"shrink-0 text-sm",children:[I.hotkey&&m3(I.hotkey),I.rightElement]})]});return I.tooltip&&(D=c.jsx(Ne,{content:I.tooltip,delayDuration:100,children:D})),c.jsx(Xn,{className:xe(I.disabled&&"opacity-50!"),onSelect:()=>{I.disableClick||I.disabled||(I.handle(),l(!1))},variant:I.variant,children:D},I.label)})},M),M<u.length-1&&c.jsx(_k,{})]},M),n[11]=u.length,n[12]=_):_=n[12],g=u.map(_),n[9]=u,n[10]=g}else g=n[10];n[13]!==g?(p=c.jsxs(cc,{children:[m,c.jsxs(ym,{children:[x,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=c.jsx(us,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!a){let _,E;return n[18]!==o?(_=c.jsx(xs,{asChild:!0,children:o}),n[18]=o,n[19]=_):_=n[19],n[20]!==y||n[21]!==i||n[22]!==_?(E=c.jsxs(mr,{open:i,onOpenChange:l,children:[_,y]}),n[20]=y,n[21]=i,n[22]=_,n[23]=E):E=n[23],E}let v;n[24]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(eD,{tabIndex:-1,children:Wt("cell.cellActions")}),n[24]=v):v=n[24];const w=!i&&v;let S,j,C;return n[25]!==o?(S=c.jsx(tD,{children:c.jsx(xs,{className:"flex",children:o})}),n[25]=o,n[26]=S):S=n[26],n[27]!==w||n[28]!==S?(j=c.jsxs(nD,{delayDuration:200,disableHoverableContent:!0,children:[w,S]}),n[27]=w,n[28]=S,n[29]=j):j=n[29],n[30]!==y||n[31]!==i||n[32]!==j?(C=c.jsxs(mr,{open:i,onOpenChange:l,children:[j,y]}),n[30]=y,n[31]=i,n[32]=j,n[33]=C):C=n[33],C})),tx=q.memo(t=>{const e=H.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=ZO(o),e[0]=o,e[1]=s):s=e[1],r=s;const a=Se(r);if(!a)return null;let i;return e[2]!==n||e[3]!==a?(i=c.jsx(ex,{showTooltip:!1,...a,children:n}),e[2]=n,e[3]=a,e[4]=i):i=e[4],i});function NE(t){return!t}tx.displayName="ConnectionCellActionsDropdown";const nx=t=>{const e=H.c(35),{children:n,cellId:o,getEditorView:r}=t,s=Ja(o),a=Za(o),i=!vm(a.output),l=a.consoleOutputs.length>0;let d;e[0]!==s.config||e[1]!==s.name||e[2]!==o||e[3]!==a.status||e[4]!==r||e[5]!==i||e[6]!==l?(d={cell:{cellId:o,name:s.name,config:s.config,status:a.status,hasOutput:i,hasConsoleOutput:l,getEditorView:r}},e[0]=s.config,e[1]=s.name,e[2]=o,e[3]=a.status,e[4]=r,e[5]=i,e[6]=l,e[7]=d):d=e[7];const u=nd(d),[h,f]=q.useState(),m=!!h;let x,g,p,b,y,v,w,S,j,C;if(e[8]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(Na,{size:13,strokeWidth:1.5}),e[8]=x):x=e[8],e[9]!==o?(g=async()=>{var M;if((M=window.getSelection())==null?void 0:M.toString())return void document.execCommand("copy");const E=document.getElementById(vk.create(o));E?await on(E.textContent??""):ft.warn("cell-context-menu: output not found")},e[9]=o,e[10]=g):g=e[10],e[11]!==u||e[12]!==n||e[13]!==r||e[14]!==h||e[15]!==m||e[16]!==g){const _=[{label:"Copy",hidden:m,icon:x,handle:g},{label:"Cut",hidden:!!h,icon:c.jsx(Kc,{size:13,strokeWidth:1.5}),handle:EE},{label:"Paste",hidden:!!h,icon:c.jsx(Ym,{size:13,strokeWidth:1.5}),handle:async()=>{const I=r();if(I)try{const D=await navigator.clipboard.readText();if(D){const{from:F,to:O}=I.state.selection.main,P=I.state.update({changes:{from:F,to:O,insert:D}});I.dispatch(P)}}catch(D){const F=D;ft.error("Failed to paste from clipboard",F),oD({command:"paste"})}}},{label:"Copy image",hidden:!h,icon:c.jsx(Bc,{size:13,strokeWidth:1.5}),handle:async()=>{if(h){const I=await fetch(h.src),D=await I.blob(),F=new ClipboardItem({[D.type]:D});await navigator.clipboard.write([F]).then(_E).catch(IE)}}},{icon:c.jsx(Fm,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!h,handle:()=>{if(h){const I=document.createElement("a");I.download="image.png",I.href=h.src,I.click()}}},{label:"Go to Definition",icon:c.jsx(sD,{size:13,strokeWidth:1.5}),handle:()=>{const I=r();I&&rD(I)}}],E=[_,...u];let M;b=K0,e[23]===Symbol.for("react.memo_cache_sentinel")?(M=I=>{I.target instanceof HTMLImageElement?f(I.target):f(void 0)},e[23]=M):M=e[23],e[24]!==n?(y=c.jsx(X0,{onContextMenu:M,asChild:!0,children:n}),e[24]=n,e[25]=y):y=e[25],p=lu,v="w-[300px]",w=!0,S=E.map((I,D)=>c.jsxs(T.Fragment,{children:[I.map(AE),D<E.length-1&&c.jsx(Z0,{})]},D)),e[11]=u,e[12]=n,e[13]=r,e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b,e[19]=y,e[20]=v,e[21]=w,e[22]=S}else p=e[17],b=e[18],y=e[19],v=e[20],w=e[21],S=e[22];return e[26]!==p||e[27]!==v||e[28]!==w||e[29]!==S?(j=c.jsx(p,{className:v,scrollable:w,children:S}),e[26]=p,e[27]=v,e[28]=w,e[29]=S,e[30]=j):j=e[30],e[31]!==b||e[32]!==y||e[33]!==j?(C=c.jsxs(b,{children:[y,j]}),e[31]=b,e[32]=y,e[33]=j,e[34]=C):C=e[34],C};function EE(){document.execCommand("cut")}function _E(){Je({title:"Copied image to clipboard"})}function IE(t){Je({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),ft.error("Failed to copy image to clipboard",t)}function AE(t){if(t.hidden)return null;let e=c.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&c.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),c.jsx("div",{className:"flex-1",children:t.label}),c.jsxs("div",{className:"shrink-0 text-sm",children:[t.hotkey&&m3(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=c.jsx(Ne,{delayDuration:100,content:t.tooltip,children:e})),c.jsx(Zs,{className:t.disabled?"opacity-50!":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}if(Ij)Aj(tL),Ij();else{const t=await wm(()=>import("./loro_wasm_bg-C3hKWL9L.js").then(async e=>(await e.__tla,e)).then(e=>e.w),[],import.meta.url);Aj(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":eL}).exports)}const TE=["Map","Text","List","Tree","MovableList","Counter"];function ox(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&TE.includes(t.kind())}Tj.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(a,i)=>{if(typeof i=="string"&&i.startsWith("cid:")&&!e.has(i)){e.add(i);const d=n.getContainerById(i);if(d==null)throw new Error(`ContainerID not found: ${i}`);const u=t(a,d);if(u===d){const h=d.getShallowValue();return typeof h=="object"?r(h):h}if(ox(u))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof u=="object"&&u!=null?r(u):u}if(typeof i=="object"&&i!=null)return r(i);const l=t(a,i);if(ox(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=a=>{if(Array.isArray(a))return a.map((l,d)=>o(d,l)).filter(l=>l!==void 0);const i={};for(const[l,d]of Object.entries(a)){const u=o(l,d);u!==void 0&&(i[l]=u)}return i},s=n.getShallowValue();return r(s)};const ME=We.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),Qs=At.define(),cu=bn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Qs))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),rx=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Qs));return t.docChanged||t.viewportChanged||e.length>0};class ol{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=ol.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const a=e.scrollDOM.getBoundingClientRect(),i=(e.textDirection===iD.LTR?a.left:a.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=a.top-e.scrollDOM.scrollTop;return[new ol(s.left-i,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const OE=(t,e,n,o)=>{const r=[],{updated:s,added:a}=n;for(const i of[...s,...a]){const l=sx(t,e,i,o);l&&r.push(l)}return r},sx=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Qs.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Mj.decode(r.cursor.anchor),a=t.getCursorPos(s).offset;let i=a;if(r.cursor.head){const l=Mj.decode(r.cursor.head);i=t.getCursorPos(l).offset}return Qs.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:a,head:i},user:r.user})};class DE{constructor(e,n,o,r,s,a,i){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=a,this.getUserId=i,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const d=[];for(const u of this.awareness.peers()){const h=sx(this.doc,this.awareness,u,this.scopeId);h&&d.push(h)}this.view.dispatch({effects:d})}else l.by==="checkout"&&this.view.dispatch({effects:[Qs.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=RE({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:n.anchor,head:n.head});this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class PE{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(a,i)=>{i!=="local"&&this.view.dispatch({effects:OE(this.doc,this.awareness,a,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const RE=({doc:t,getTextFromDoc:e,anchor:n,head:o})=>{var a,i;n===o&&(o=void 0);const r=(a=e(t).getCursor(n))==null?void 0:a.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(i=e(t).getCursor(o))==null?void 0:i.encode()),{anchor:r,head:s}},rl=["bg-(--amber-6)","bg-(--blue-6)","bg-(--crimson-6)","bg-(--cyan-6)","bg-(--grass-6)","bg-(--gray-6)","bg-(--green-6)","bg-(--lime-6)","bg-(--orange-6)","bg-(--purple-6)","bg-(--red-6)","bg-(--sage-6)","bg-(--sky-6)","bg-(--slate-6)"],LE=(t,e,n)=>zn.define(o=>new FE(o,t,e,n)),Ar=gm.define();class FE{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const a=[];let i=0;for(const{diff:l,path:d}of s.events){if(d.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const u=l.diff;for(const h of u)h.insert?a.push({from:i,to:i,insert:h.insert}):h.delete?(a.push({from:i,to:i+h.delete}),i+=h.delete):h.retain!=null&&(i+=h.retain);a.length>0&&this.view.dispatch({changes:a,annotations:[Ar.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Ar.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),a=this.getTextFromDoc(this.doc);s!==a.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:a.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Ar)===this||e.transactions[0].annotation(Ar)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,a,i)=>{const l=i.sliceString(0,i.length,`
|
119
|
-
`);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 Kt=ft.get("rtc"),ax=Kt.get("awareness").disabled(),du="awareness:",Tr=yt(void 0),Lt=new Tj,sl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new nL(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))}}(Lt.peerIdStr),uu=cD(()=>{Kt.debug("creating websocket");const t=r3().getWsSyncURL(b3()).toString(),e=new AR(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await s3(),dD()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(a,i){return new TextDecoder().decode(a.slice(0,i.length))===i}(s,du)){const a=function(i,l){return i.slice(l.length)}(s,du);return sl.apply(a),void ax.debug("applied awareness update")}Lt.import(s),Kt.debug("imported doc change. new doc:",Lt.toJSON()),Qe.get(Tr)!==Lt&&Qe.set(Tr,Lt)}),e.addEventListener("open",()=>{Kt.debug("websocket open")}),e.addEventListener("close",n=>{Kt.warn("websocket close",n),Qe.get(Tr)===Lt&&Qe.set(Tr,void 0)}),e});function hu(t,e,n=""){if(Zt())return{extension:[],code:n};const o=Lt.getByPath(`codes/${t}`)!==void 0,r=Lt.getMap("codes").getOrCreateContainer(t,new Um);o||(Kt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return Qe.get(y3)||"Anonymous"},get colorClassName(){return(a=>{if(typeof a=="string"){let i=0;for(let l=0;l<a.length;l++)i=(i<<5)-i+a.charCodeAt(l),i=Math.trunc(i);return rl[Math.abs(i)%rl.length]}return rl[a%rl.length]})(this.name)}};return{code:n.toString(),extension:[zE(t),BE(t),UE(Lt,sl,s,()=>r,t),LE(Lt,["codes",t],()=>r)]}}function zE(t){const e=(o,r)=>{const s=o.state.field(vc).type,a=r.toString();a&&a!==s&&(Kt.debug(`[incoming] setting language type: ${s} -> ${a}`),ur(o,{language:a,keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(jm),a=r.toJSON();Ba(s,a)||o.dispatch({effects:[g3.of(a)],annotations:[Ar.of(!0)]})};return zn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Lt.getByPath(`languages/${t}`);if(!s)return void Kt.error("no language container found for cell",t);Fn(s instanceof Um,"language type is not a LoroText");const a=Lt.getByPath(`language_metadata/${t}`);a?(Fn(a instanceof Oj,"language metadata is not a LoroMap"),e(o,s),n(o,a),r=Lt.subscribe(i=>{if(i.origin==="local")return;const l=i.events.some(u=>u.target===s.id),d=i.events.some(u=>u.target===a.id);l&&e(o,s),d&&n(o,a)})):Kt.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function BE(t){const e=Lt.getMap("languages").getOrCreateContainer(t,new Um),n=Lt.getMap("language_metadata").getOrCreateContainer(t,new Oj);return We.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const a=km(o.state).type;ur(o.view,{language:a}),Kt.debug("no initial language, setting default to",a),e.delete(0,e.length),e.insert(0,a),Kt.debug("no initial language metadata, setting default to",o.state.field(jm));const i=o.state.field(jm);for(const l of Object.keys(i))n.set(l,i[l]);return void Lt.commit()}let s=!1;for(const a of o.transactions)if(!a.annotation(Ar)){for(const i of a.effects)if(i.is(lD)&&e.toString()!==i.value.type&&(Kt.debug(`[outgoing] language change: ${e} -> ${i.value.type}`),e.delete(0,e.length),e.insert(0,i.value.type),s=!0),i.is(g3)||i.is(x3)){const l=i.value;i.is(x3)?(Kt.debug("[outgoing] setting language metadata: ",l),n.clear()):Kt.debug("[outgoing] updating language metadata: ",l);for(const d of Object.keys(l))n.set(d,l[d]);s=!0}}s&&Lt.commit()})}function UE(t,e,n,o,r,s){const a=`loro:cell:${r}`;return[cu,p3({above:!0,class:"loro-cursor-layer",update:rx,markers:i=>{const{remoteCursors:l,isCheckout:d}=i.state.field(cu);return d?[]:[...l.values()].flatMap(u=>{var f,m;const h=Jn.cursor(u.cursor.anchor);return ol.createCursor(i,h,((f=u.user)==null?void 0:f.name)||"unknown",((m=u.user)==null?void 0:m.colorClassName)||"")})}}),p3({above:!1,class:"loro-selection-layer",update:rx,markers:i=>{const{remoteCursors:l,isCheckout:d}=i.state.field(cu);return d?[]:[...l.entries()].filter(([,u])=>u.cursor.head!==void 0&&u.cursor.anchor!==u.cursor.head).flatMap(([,u])=>{var f;const h=Jn.range(u.cursor.anchor,u.cursor.head);return aD.forRange(i,`loro-selection ${((f=u.user)==null?void 0:f.colorClassName)||""}`,h)})}}),zn.define(i=>new DE(i,t,n,e,o,a,s)),zn.define(i=>new PE(i,t,e,a)),ME]}function al(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Sc()&&uu(),Lt.subscribeLocalUpdates(t=>{Kt.debug("local update, sending to server"),uu().send(t)}),sl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(ax.debug("awareness changes",n),uu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(du,sl.encode(n))))});var ix={modified:{doc:""},original:{doc:""}},lx=T.createContext(ix);function $E(t,e){return vt({},t,e,{modified:vt({},t.modified,e.modified),original:vt({},t.original,e.original)})}var fu=()=>T.useContext(lx),VE=t=>{var{children:e,theme:n}=t,[o,r]=T.useReducer($E,vt({},ix,{theme:n}));return T.useEffect(()=>r({theme:n}),[n]),c.jsx(lx.Provider,{value:vt({},o,{dispatch:r}),children:e})},HE=["extensions","value","selection","onChange"],cx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Qa(t,HE),{theme:a,dispatch:i}=fu(),l=bs(vt({},s,{theme:a}));return T.useEffect(()=>i({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};cx.displayName="CodeMirrorMerge.Original";var WE=["extensions","value","selection","onChange"],dx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Qa(t,WE),{theme:a,dispatch:i}=fu(),l=bs(vt({},s,{theme:a}));return T.useEffect(()=>{i({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};dx.displayName="CodeMirrorMerge.Modified";class Nt{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n=e){return new Nt(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function sr(t,e,n,o,r,s){if(t==o)return[];let a=xu(t,e,n,o,r,s),i=bu(t,e+a,n,o,r+a,s),l=(n-=i)-(e+=a),d=(s-=i)-(r+=a);if(!l||!d)return[new Nt(e,n,r,s)];if(l>d){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Nt(e,e+h,r,r),new Nt(e+h+d,n,s,s)]}else if(d>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Nt(e,e,r,r+h),new Nt(n,n,r+h+l,s)]}if(l==1||d==1)return[new Nt(e,n,r,s)];let u=fx(t,e,n,o,r,s);if(u){let[h,f,m]=u;return sr(t,e,h,o,r,f).concat(sr(t,h+m,n,o,f+m,s))}return function(h,f,m,x,g,p){let b=m-f,y=p-g;if(ea<1e9&&Math.min(b,y)>16*ea||ta>0&&Date.now()>ta)return Math.min(b,y)>64*ea?[new Nt(f,m,g,p)]:mx(h,f,m,x,g,p);let v=Math.ceil((b+y)/2);pu.reset(v),gu.reset(v);let w=(_,E)=>h.charCodeAt(f+_)==x.charCodeAt(g+E),S=(_,E)=>h.charCodeAt(m-_-1)==x.charCodeAt(p-E-1),j=(b-y)%2!=0?gu:null,C=j?null:pu;for(let _=0;_<v;_++){if(_>ea||ta>0&&!(63&_)&&Date.now()>ta)return mx(h,f,m,x,g,p);let E=pu.advance(_,b,y,v,j,!1,w)||gu.advance(_,b,y,v,C,!0,S);if(E)return qE(h,f,m,f+E[0],x,g,p,g+E[1])}return[new Nt(f,m,g,p)]}(t,e,n,o,r,s)}let ea=1e9,ta=0,mu=!1;class ux{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,a,i){for(let l=-e+this.start;l<=e-this.end;l+=2){let d=r+l,u=l==-e||l!=e&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,h=u-l;for(;u<n&&h<o&&i(u,h);)u++,h++;if(this.vec[d]=u,u>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(a){let m=s.vec[f];if(m>=n-u)return[m,r+m-f]}else if(u>=n-s.vec[f])return[u,h]}}}return null}}const pu=new ux,gu=new ux;function qE(t,e,n,o,r,s,a,i){let l=!1;return Mr(t,o)||++o!=n||(l=!0),Mr(r,i)||++i!=a||(l=!0),l?[new Nt(e,n,s,a)]:sr(t,e,o,r,s,i).concat(sr(t,o,n,r,i,a))}function hx(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function xu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let a=hx(n-e,s-r);for(let i=e,l=r;;){let d=i+a,u=l+a;if(d>n||u>s||t.slice(i,d)!=o.slice(l,u)){if(a==1)return i-e-(Mr(t,i)?0:1);a>>=1}else{if(d==n||u==s)return d-e;i=d,l=u}}}function bu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let a=hx(n-e,s-r);for(let i=n,l=s;;){let d=i-a,u=l-a;if(d<e||u<r||t.slice(d,i)!=o.slice(u,l)){if(a==1)return n-i-(Mr(t,i)?0:1);a>>=1}else{if(d==e||u==r)return n-d;i=d,l=u}}}function yu(t,e,n,o,r,s,a,i){let l=o.slice(r,s),d=null;for(;;){if(d||a<i)return d;for(let u=e+a;;){Mr(t,u)||u++;let h=u+a;if(Mr(t,h)||(h+=h==u+1?1:-1),h>=n)break;let f=t.slice(u,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let x=xu(t,h,n,o,r+m+f.length,s),g=bu(t,e,u,o,r,r+m),p=f.length+x+g;(!d||d[2]<p)&&(d=[u-g,r+m-g,p])}u=h}if(i<0)return d;a>>=1}}function fx(t,e,n,o,r,s){let a=n-e,i=s-r;if(a<i){let l=fx(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return a<4||2*i<a?null:yu(t,e,n,o,r,s,Math.floor(a/4),-1)}function mx(t,e,n,o,r,s){mu=!0;let a,i=n-e,l=s-r;if(i<l){let f=yu(o,r,s,t,e,n,Math.floor(i/6),50);a=f&&[f[1],f[0],f[2]]}else a=yu(t,e,n,o,r,s,Math.floor(l/6),50);if(!a)return[new Nt(e,n,r,s)];let[d,u,h]=a;return sr(t,e,d,o,r,u).concat(sr(t,d+h,n,o,u+h,s))}function px(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 Nt(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let ar;try{ar=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function gx(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function xx(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?gx(n)?1:0:ar?Sx(n)&&e!=t.length-1?ar.test(t.slice(e,e+2))?2:0:ar.test(String.fromCharCode(n))?1:0:0}function bx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?gx(n)?1:0:ar?Cx(n)&&e!=1?ar.test(t.slice(e-2,e))?2:0:ar.test(String.fromCharCode(n))?1:0:0}const yx=8;function vx(t,e,n){if(e==t.length||!bx(t,e))return e;for(let o=e,r=e+n,s=0;s<yx;s++){let a=xx(t,o);if(!a||o+a>r)return o;o+=a}return e}function wx(t,e,n){if(!e||!xx(t,e))return e;for(let o=e,r=e-n,s=0;s<yx;s++){let a=bx(t,o);if(!a||o-a<r)return o;o-=a}return e}function kx(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function jx(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Sx=t=>t>=55296&&t<=56319,Cx=t=>t>=56320&&t<=57343;function Mr(t,e){return!e||e==t.length||!Sx(t.charCodeAt(e-1))||!Cx(t.charCodeAt(e))}function GE(t,e,n){var o;return ea=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,ta=n!=null&&n.timeout?Date.now()+n.timeout:0,mu=!1,function(r,s,a){for(;;){px(a,1);let i=!1;for(let l=0;l<a.length;l++){let d,u,h=a[l];(d=xu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[l]=new Nt(h.fromA+d,h.toA,h.fromB+d,h.toB)),(u=bu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[l]=new Nt(h.fromA,h.toA-u,h.fromB,h.toB-u));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let x=h.fromA-(l?a[l-1].toA:0),g=(l<a.length-1?a[l+1].fromA:r.length)-h.toA;if(!x||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);x<=p.length&&r.slice(h.fromA-x,h.fromA)==p.slice(p.length-x)?(a[l]=new Nt(h.fromA-x,h.toA-x,h.fromB-x,h.toB-x),i=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(a[l]=new Nt(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),i=!0)}if(!i)break}return a}(t,e,sr(t,0,t.length,e,0,e.length))}function Nx(){return!mu}function Ex(t,e,n){return function(o,r,s){for(let a=0,i=0;i<o.length;i++){let l=o[i],d=l.toA-l.fromA,u=l.toB-l.fromB;if(d&&u||d>3||u>3){let h=i==o.length-1?r.length:o[i+1].fromA,f=l.fromA-a,m=h-l.toA,x=wx(r,l.fromA,f),g=vx(r,l.toA,m),p=l.fromA-x,b=g-l.toA;if((!d||!u)&&p&&b){let y=Math.max(d,u),[v,w,S]=d?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];y>p&&r.slice(x,l.fromA)==v.slice(S-p,S)?(l=o[i]=new Nt(x,x+d,l.fromB-p,l.toB-p),x=l.fromA,g=vx(r,l.toA,h-l.toA)):y>b&&r.slice(l.toA,g)==v.slice(w,w+b)&&(l=o[i]=new Nt(g-d,g,l.fromB+b,l.toB+b),g=l.toA,x=wx(r,l.fromA,l.fromA-a)),p=l.fromA-x,b=g-l.toA}if(p||b)l=o[i]=new Nt(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b);else if(d){if(!u){let y,v=jx(r,l.fromA,l.toA),w=v<0?-1:kx(r,l.toA,l.fromA);v>-1&&(y=v-l.fromA)<=m&&r.slice(l.fromA,v)==r.slice(l.toA,l.toA+y)?l=o[i]=l.offset(y):w>-1&&(y=l.toA-w)<=f&&r.slice(l.fromA-y,l.fromA)==r.slice(w,l.toA)&&(l=o[i]=l.offset(-y))}}else{let y,v=jx(s,l.fromB,l.toB),w=v<0?-1:kx(s,l.toB,l.fromB);v>-1&&(y=v-l.fromB)<=m&&s.slice(l.fromB,v)==s.slice(l.toB,l.toB+y)?l=o[i]=l.offset(y):w>-1&&(y=l.toB-w)<=f&&s.slice(l.fromB-y,l.fromB)==s.slice(w,l.toB)&&(l=o[i]=l.offset(-y))}}a=l.toA}return px(o,3),o}(GE(t,e,n),t,e)}const $n=pr.define({combine:t=>t[0]}),vu=At.define(),YE=pr.define(),Or=bn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(vu)&&(t=n.value);for(let n of e.state.facet(YE))t=n(t,e);return t}});class Dr{constructor(e,n,o,r,s,a=!0){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s,this.precise=a}offset(e,n){return e||n?new Dr(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):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 Ax(Ex(e.toString(),n.toString(),o),e,n,0,0,Nx())}static updateA(e,n,o,r,s){return Ox(Mx(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return Ox(Mx(e,r,!1,n.length),e,n,o,s)}}function _x(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function Ix(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function Ax(t,e,n,o,r,s){let a=[];for(let i=0;i<t.length;i++){let l=t[i],[d,u]=_x(l.fromA+o,l.fromB+r,e,n),[h,f]=Ix(l.toA+o,l.toB+r,e,n),m=[l.offset(-d+o,-u+r)];for(;i<t.length-1;){let x=t[i+1],[g,p]=_x(x.fromA+o,x.fromB+r,e,n);if(g>h+1&&p>f+1)break;m.push(x.offset(-d+o,-u+r)),[h,f]=Ix(x.toA+o,x.toB+r,e,n),i++}a.push(new Dr(m,d,Math.max(d,h),u,Math.max(u,f),s))}return a}const il=1e3;function Tx(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let u=0,h=0;r&&({toA:u,toB:h}=t[r-1]);let f=e-(n?u:h);return[u+f,h+f]}let a=r+s>>1,i=t[a],[l,d]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(l>e)s=a;else{if(!(d<=e))return o?[i.fromA,i.fromB]:[i.toA,i.toB];r=a+1}}}function Mx(t,e,n,o){let r=[];return e.iterChangedRanges((s,a,i,l)=>{let d=0,u=n?e.length:o,h=0,f=n?o:e.length;s>il&&([d,h]=Tx(t,s-il,n,!0)),a<e.length-il&&([u,f]=Tx(t,a+il,n,!1));let m,x=l-i-(a-s),[g,p]=n?[x,0]:[0,x];r.length&&(m=r[r.length-1]).toA>=d?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:d,toA:u,fromB:h,toB:f,diffA:g,diffB:p})}),r}function Ox(t,e,n,o,r){if(!t.length)return e;let s=[];for(let a=0,i=0,l=0,d=0;;a++){let u=a==t.length?null:t[a],h=u?u.fromA+i:n.length,f=u?u.fromB+l:o.length;for(;d<e.length;){let p=e[d];if(p.toA+i>h||p.toB+l>f)break;s.push(p.offset(i,l)),d++}if(!u)break;let m=u.toA+i+u.diffA,x=u.toB+l+u.diffB,g=Ex(n.sliceString(h,m),o.sliceString(f,x),r);for(let p of Ax(g,n,o,h,f,Nx()))s.push(p);for(i+=u.diffA,l+=u.diffB;d<e.length;){let p=e[d];if(p.fromA+i>m&&p.fromB+l>x)break;d++}}return s}const KE={scanLimit:500},Dx=zn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Lx(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Or,!1)!=n.field(Or,!1))||function(o,r){return o.facet($n)!=r.facet($n)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Lx(t.view))}},{decorations:t=>t.deco}),ll=_o.low(hD({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Dx))===null||e===void 0?void 0:e.gutter)||fD.empty}})),Px=nt.line({class:"cm-changedLine"}),XE=nt.mark({class:"cm-changedText"}),JE=nt.mark({tagName:"ins",class:"cm-insertedLine"}),ZE=nt.mark({tagName:"del",class:"cm-deletedLine"}),Rx=new class extends mD{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function QE(t,e,n,o,r,s){let a=n?t.fromA:t.fromB,i=n?t.toA:t.toB,l=0;if(a!=i){r.add(a,a,Px),r.add(a,i,n?ZE:JE),s&&s.add(a,a,Rx);for(let d=e.iterRange(a,i-1),u=a;!d.next().done;){if(d.lineBreak){u++,r.add(u,u,Px),s&&s.add(u,u,Rx);continue}let h=u+d.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=a+(n?f.fromA:f.fromB),x=a+(n?f.toA:f.toB),g=Math.max(u,m),p=Math.min(h,x);if(g<p&&r.add(g,p,XE),!(x<h))break;l++}u=h}}}function Lx(t){let e=t.state.field(Or),{side:n,highlightChanges:o,markGutter:r,overrideChunk:s}=t.state.facet($n),a=n=="a",i=new ds,l=r?new ds:null,{from:d,to:u}=t.viewport;for(let h of e){if((a?h.fromA:h.fromB)>=u)break;(a?h.toA:h.toB)>d&&(s&&s(t.state,h,i,l)||QE(h,t.state.doc,a,o,i,l))}return{deco:i.finish(),gutter:l&&l.finish()}}class cl extends ms{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 dl=At.define({map:(t,e)=>t.map(e)}),na=bn.define({create:()=>nt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(dl))return n.value;return t.map(e.changes)},provide:t=>We.decorations.from(t)}),wu=.01;function Fx(t,e){if(t.size!=e.size)return!1;let n=t.iter(),o=e.iter();for(;n.value;){if(n.from!=o.from||Math.abs(n.value.spec.widget.height-o.value.spec.widget.height)>1)return!1;n.next(),o.next()}return!0}const ku=At.define({map:(t,e)=>e.mapPos(t)});class e5 extends ms{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=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:ku.of(r)});let{side:s,sibling:a}=e.state.facet($n);a&&a().dispatch({effects:ku.of(t5(r,e.state.field(Or),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function t5(t,e,n){let o=0,r=0;for(let s=0;;s++){let a=s<e.length?e[s]:null;if(!a||(n?a.fromA:a.fromB)>=t)return r+(t-o);[o,r]=n?[a.toA,a.toB]:[a.toB,a.toA]}}const n5=bn.define({create:t=>nt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(ku)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>We.decorations.from(t)});function zx({margin:t=3,minSize:e=4}){return n5.init(n=>function(o,r,s){let a=new ds,i=o.facet($n).side=="a",l=o.field(Or),d=1;for(let u=0;;u++){let h=u<l.length?l[u]:null,f=u?d+r:1,m=h?o.doc.lineAt(i?h.fromA:h.fromB).number-1-r:o.doc.lines,x=m-f+1;if(x>=s&&a.add(o.doc.line(f).from,o.doc.line(m).to,nt.replace({widget:new e5(x),block:!0})),!h)break;d=o.doc.lineAt(Math.min(o.doc.length,i?h.toA:h.toB)).number}return a.finish()}(n,t,e))}const o5=We.styleModule.of(new uD({".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"}})),r5=We.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, .cm-inlineChangedLine":{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(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{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","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&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"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Bx=new xm,ul=new xm;class Ux{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||KE;let n=[_o.low(Dx),r5,o5,na,We.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(dl)))&&this.measure()})],o=[$n.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(ll);let r=Xa.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],We.editorAttributes.of({class:"cm-merge-a"}),ul.of(o),n]}),s=[$n.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(ll);let a=Xa.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],We.editorAttributes.of({class:"cm-merge-b"}),ul.of(s),n]});this.chunks=Dr.build(r.doc,a.doc,this.diffConf);let i=[Or.init(()=>this.chunks),Bx.of(e.collapseUnchanged?zx(e.collapseUnchanged):[])];r=r.update({effects:At.appendConfig.of(i)}).state,a=a.update({effects:At.appendConfig.of(i)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",d=document.createElement("div");d.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?d:u),this.editorDOM.appendChild(l=="a-b"?u:d),this.a=new We({state:r,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new We({state:a,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((a,i)=>a.compose(i.changes),Ya.empty(e[0].startState.doc.length));this.chunks=n==this.a?Dr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Dr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:vu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:vu.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,i=this.b.dom.parentNode;a.remove(),i.remove(),this.editorDOM.insertBefore(s?a:i,this.editorDOM.firstChild),this.editorDOM.appendChild(s?i:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,i=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(i=e.renderRevertControl),this.setupRevertControls(s,a,i)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],a=[];if(n||o){let i=this.a.state.facet($n),l=o?e.gutter!==!1:i.markGutter,d=n?e.highlightChanges!==!1:i.highlightChanges;s.push(ul.reconfigure([$n.of({side:"a",sibling:()=>this.b,highlightChanges:d,markGutter:l}),l?ll:[]])),a.push(ul.reconfigure([$n.of({side:"b",sibling:()=>this.a,highlightChanges:d,markGutter:l}),l?ll:[]]))}if(r){let i=Bx.reconfigure(e.collapseUnchanged?zx(e.collapseUnchanged):[]);s.push(i),a.push(i)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}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 ds,s=new ds,a=e.state.field(na).iter(),i=n.state.field(na).iter(),l=0,d=0,u=0,h=0,f=e.viewport,m=n.viewport;for(let b=0;;b++){let y=b<o.length?o[b]:null,v=y?y.fromA:e.state.doc.length,w=y?y.fromB:n.state.doc.length;if(l<v){let S=e.lineBlockAt(l).top+u-(n.lineBlockAt(d).top+h);S<-.01?(u-=S,r.add(l,l,nt.widget({widget:new cl(-S),block:!0,side:-1}))):S>wu&&(h+=S,s.add(d,d,nt.widget({widget:new cl(S),block:!0,side:-1})))}if(v>l+1e3&&l<f.from&&v>f.from&&d<m.from&&w>m.from){let S=Math.min(f.from-l,m.from-d);l+=S,d+=S,b--}else{if(!y)break;l=y.toA,d=y.toB}for(;a.value&&a.from<l;)u-=a.value.spec.widget.height,a.next();for(;i.value&&i.from<d;)h-=i.value.spec.widget.height,i.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;i.value;)h-=i.value.spec.widget.height,i.next();let x=e.contentHeight+u-(n.contentHeight+h);x<wu?r.add(e.state.doc.length,e.state.doc.length,nt.widget({widget:new cl(-x),block:!0,side:1})):x>wu&&s.add(n.state.doc.length,n.state.doc.length,nt.widget({widget:new cl(x),block:!0,side:1}));let g=r.finish(),p=s.finish();Fx(g,e.state.field(na))||e.dispatch({effects:dl.of(g)}),Fx(p,n.state.field(na))||n.dispatch({effects:dl.of(p)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let a=this.chunks[s];if(a.fromA>o.to||a.fromB>r.to)break;if(a.fromA<o.from||a.fromB<r.from)continue;let i=this.a.lineBlockAt(a.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=$x(n);n&&n.dataset.chunk==String(s)?(n.style.top!=i&&(n.style.top=i),n=n.nextSibling):e.insertBefore(this.renderRevertButton(i,s),n)}for(;n;)n=$x(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,a,i,l,d]=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],u=r.state.sliceDoc(a,Math.max(a,i-1));a!=i&&d<=s.state.doc.length&&(u+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,d),insert:u},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 $x(t){let e=t.nextSibling;return t.remove(),e}var s5=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],a5=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Vx=q.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:a,gutter:i,collapseUnchanged:l,destroyRerender:d=!0,renderRevertControl:u,diffConfig:h,root:f}=t,m=Qa(t,s5),x=fu(),{modified:g,modifiedExtension:p,original:b,originalExtension:y,theme:v,dispatch:w}=x,S=Qa(x,a5),j=T.useRef(null),C=T.useRef(),_={orientation:r,revertControls:s,highlightChanges:a,gutter:i,collapseUnchanged:l,renderRevertControl:u,diffConfig:h,root:f};T.useImperativeHandle(e,()=>({container:j.current,view:C.current,modified:g,original:b,config:vt({a:b,b:g,parent:j.current},_)}),[j,C,g,b,_]);var E=We.updateListener.of(I=>{if(I.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var D=I.state.doc.toString();y==null||y.onChange(D,I)}}),M=We.updateListener.of(I=>{if(I.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var D=I.state.doc.toString();p==null||p.onChange(D,I)}});return T.useEffect(()=>{!C.current&&j.current&&y&&p&&(C.current=new Ux(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...bs(vt({},y==null?void 0:y.option,{theme:v})),E]}),b:vt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...bs(vt({},p==null?void 0:p.option,{theme:v})),M]}),parent:j.current},_)),w({view:C.current}))},[C,j,y,p]),T.useEffect(()=>{if(b&&b.doc&&C.current){var I,D,F=(I=C.current)==null?void 0:I.a.state.doc.toString();F!==b.doc&&((D=C.current)==null||D.a.dispatch({changes:{from:0,to:F.length,insert:b.doc||""}}))}if(g&&g.doc&&C.current){var O,P,R=(O=C.current)==null?void 0:O.b.state.doc.toString();R!==g.doc&&((P=C.current)==null||P.b.dispatch({changes:{from:0,to:R.length,insert:g.doc||""}}))}if(d&&C.current){var z=C.current.a.state.selection.ranges[0].from,N=C.current.b.state.selection.ranges[0].from;C.current.destroy(),C.current=new Ux(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...bs(vt({},y==null?void 0:y.option,{theme:v}))]}),b:vt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...bs(vt({},p==null?void 0:p.option,{theme:v}))]}),parent:j.current},_)),z&&(C.current.a.focus(),C.current.a.dispatch({selection:{anchor:z,head:z}})),N&&(C.current.b.focus(),C.current.b.dispatch({selection:{anchor:N,head:N}}))}},[C,v,j.current,b,g,y,p,d]),T.useEffect(()=>()=>C.current&&C.current.destroy(),[]),T.useEffect(()=>{if(C.current){var I={};S.orientation!==r&&(I.orientation=r),S.revertControls!==s&&(I.revertControls=s),S.highlightChanges!==a&&(I.highlightChanges=a),S.gutter!==i&&(I.gutter=i),S.collapseUnchanged!==l&&(I.collapseUnchanged=l),S.renderRevertControl!==u&&(I.collapseUnchanged=l),Object.keys(I).length&&w&&C.current&&(C.current.reconfigure(vt({},I)),w(vt({},I)))}},[w,C,r,s,a,i,l,u]),c.jsx("div",vt({ref:j,className:"cm-merge-theme"+(n?" "+n:"")},m,{children:o}))});Vx.displayName="CodeMirrorMerge.Internal";var i5=["theme"],Pr=q.forwardRef((t,e)=>{var{theme:n}=t,o=Qa(t,i5);return c.jsx(VE,{theme:n,children:c.jsx(Vx,vt({},o,{ref:e}))})});Pr.Original=cx,Pr.Modified=dx,Pr.displayName="CodeMirrorMerge";const l5=Pr.Original,c5=Pr.Modified,Hx=[gD(),We.lineWrapping],d5=t=>{const e=H.c(44),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:a,declineChange:i,acceptChange:l,enabled:d,children:u}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=T.useState(h),[x,g]=Ot(qj),p=Sm(),{completion:b,input:y,stop:v,isLoading:w,setCompletion:S,setInput:j,handleSubmit:C}=pD({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:x?yc(a):"",code:a,language:s},onError:u5,onFinish:(G,W)=>{_(W.trimEnd())}}),_=S,E=q.useRef(null);let M;e[1]!==b?(M=b.trimEnd(),e[1]=b,e[2]=M):M=e[2];const I=M;let D,F,O,P;e[3]!==d?(D=()=>{var G;d&&(xD(()=>{const W=E.current;return!!(W!=null&&W.view)&&(W.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),bD((G=E.current)==null?void 0:G.view))},F=[d],e[3]=d,e[4]=D,e[5]=F):(D=e[4],F=e[5]),T.useEffect(D,F),e[6]!==d||e[7]!==r||e[8]!==j?(O=()=>{d&&j(r||"")},P=[d,r,j],e[6]=d,e[7]=r,e[8]=j,e[9]=O,e[10]=P):(O=e[9],P=e[10]),T.useEffect(O,P);const{theme:R}=Ko();let z;e[11]!==n?(z=xe("flex flex-col w-full rounded-[inherit]",n),e[11]=n,e[12]=z):z=e[12];const N=d&&"max-h-[400px] min-h-11 visible",k=!d&&"max-h-0 min-h-0 invisible";let B,A,U,$;e[13]!==k||e[14]!==N?(B=xe("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",N,k),e[13]=k,e[14]=N,e[15]=B):B=e[15],e[16]!==l||e[17]!==I||e[18]!==i||e[19]!==d||e[20]!==C||e[21]!==x||e[22]!==y||e[23]!==w||e[24]!==_||e[25]!==g||e[26]!==j||e[27]!==v||e[28]!==R?(A=d&&c.jsxs(c.Fragment,{children:[c.jsx(Aa,{className:"text-(--blue-10) shrink-0",size:16}),c.jsx(Cc,{inputRef:E,theme:R,onClose:()=>{i(),_("")},value:y,onChange:G=>{j(G),m(w3({input:G}))},onSubmit:()=>{w||C()}}),w&&c.jsxs(ve,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:v,children:[c.jsx(Nc,{className:"animate-spin mr-1",size:14}),"Stop"]}),!w&&I&&c.jsx(ve,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:w,onClick:()=>{l(I),_("")},children:c.jsx("span",{className:"text-(--grass-11) opacity-100",children:"Accept"})}),c.jsx("div",{className:"h-full w-px bg-border mx-2"}),c.jsx(Ne,{content:"Include code from other cells",children:c.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[c.jsx(k3,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:x,onCheckedChange:G=>g(!!G)}),c.jsx(hr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),c.jsx(ve,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:w,onClick:()=>{v(),i(),_("")},children:c.jsx(yn,{className:"text-(--red-10)",size:16})})]}),e[16]=l,e[17]=I,e[18]=i,e[19]=d,e[20]=C,e[21]=x,e[22]=y,e[23]=w,e[24]=_,e[25]=g,e[26]=j,e[27]=v,e[28]=R,e[29]=A):A=e[29],e[30]!==B||e[31]!==A?(U=c.jsx("div",{className:B,children:A}),e[30]=B,e[31]=A,e[32]=U):U=e[32],e[33]!==I||e[34]!==a||e[35]!==d||e[36]!==o||e[37]!==R?($=I&&d&&c.jsxs(Pr,{className:"cm",theme:R,children:[c.jsx(l5,{onChange:o,value:a,extensions:Hx}),c.jsx(c5,{value:I,editable:!1,readOnly:!0,extensions:Hx})]}),e[33]=I,e[34]=a,e[35]=d,e[36]=o,e[37]=R,e[38]=$):$=e[38];const X=(!I||!d)&&u;let Y;return e[39]!==U||e[40]!==$||e[41]!==X||e[42]!==z?(Y=c.jsxs("div",{className:z,children:[U,$,X]}),e[39]=U,e[40]=$,e[41]=X,e[42]=z,e[43]=Y):Y=e[43],Y};function u5(t){Je({title:"Completion failed",description:v3(t)})}const ju="web application/x-marimo-cell",h5=ut({cells:yD(ut({code:at()})),version:pt("1.0")}),Wx=t=>{const e=t===1?"Cell":`${t} cells`;Je({title:`${e} copied`,description:`${e} ${t===1?"has":"have"} been copied to clipboard.`})},f5=()=>{Je({title:"Copy failed",description:"Failed to copy cells to clipboard.",variant:"danger"})},m5=()=>{Je({title:"Nothing to paste",description:"No cell or text found in clipboard.",variant:"danger"})},p5=()=>{Je({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})};class g5{constructor(){this.items={}}add(e,n){return ClipboardItem.supports(e)?typeof n=="string"?(this.items[e]=new Blob([n],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(n)],{type:e}),this):(ft.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}}const oa=yt(!1),ra=new WeakMap;function qx(t){return{handle:e=>t(e),bulkHandle:e=>{let n=!0;try{for(const o of e)n=n&&t(o);return n}catch{return!1}}}}function no(t){return{handle:e=>t([e]),bulkHandle:e=>t(e)}}function Gx(t,e){const n=H.c(30),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:a}=ud(),{saveCellConfig:i}=et(),l=jt(Es),d=it(),u=lm(),h=jt(oa),f=Cs(),m=Se(j3),{copyCells:x,pasteAtCell:g}=function(){const O=it(),P=Le(async z=>{const N=gn(),k=z.map(B=>N.cellData[B]).filter(Boolean);if(k.length!==0)try{const B={cells:k.map($=>({code:$.code})),version:"1.0"},A=k.map($=>$.code).join(`
|
120
|
-
|
121
|
-
`),U=new g5().add(ju,B).add("text/plain",A).build();await navigator.clipboard.write([U]),Wx(k.length)}catch(B){ft.error("Failed to copy cells to clipboard",B);try{const A=k.map(U=>U.code).join(`
|
122
|
-
|
123
|
-
`);await navigator.clipboard.writeText(A),Wx(k.length)}catch{f5()}}}),R=Le(async(z,N)=>{const{before:k=!1}=N??{};try{const B=await navigator.clipboard.read();for(const U of B)if(U.types.includes(ju)){const $=await U.getType(ju),X=await $.text();try{const Y=h5.parse(JSON.parse(X));if(Y.cells.length===0)break;const G=z,W=Y.cells.reverse();for(const J of W)O.createNewCell({cellId:G,before:k,code:J.code,autoFocus:!0});return}catch(Y){ft.warn("Failed to parse clipboard cell data",Y)}}const A=await navigator.clipboard.readText();A.trim()?O.createNewCell({cellId:z,before:k,code:A,autoFocus:!0}):m5()}catch(B){ft.error("Failed to paste from clipboard",B),p5()}});return{copyCells:P,pasteAtCell:R}}(),p=ji(),b=function(O){const P=H.c(2);let R,z;return P[0]!==O?(z=yt(N=>N(fd).selected.has(O)),P[0]=O,P[1]=z):z=P[1],R=z,Se(R)}(t),y=Ms(),v=Is(),w=Se(Ua);let S;n[0]!==y||n[1]!==p?(S={clear:()=>{y.clear(),p.clear()},extend:O=>{y.clear(),p.extend(O)},select:O=>{y.clear(),p.select(O)}},n[0]=y,n[1]=p,n[2]=S):S=n[2];const j=S,C=Se(Ql);let _;n[3]!==C?(_=(O,P)=>Yf(C.getHotkey(O).key)(P.nativeEvent||P),n[3]=C,n[4]=_):_=n[4];const E=_,M=function(O){const P=H.c(11),R=C3(),z=it(),N=jt(oa);let k,B,A;P[0]!==O||P[1]!==R?(k=()=>{R.focusCell({cellId:O})},P[0]=O,P[1]=R,P[2]=k):k=P[2],P[3]!==z||P[4]!==O||P[5]!==R||P[6]!==N?(B=()=>{N(!1),z.markTouched({cellId:O}),R.blurCell()},P[3]=z,P[4]=O,P[5]=R,P[6]=N,P[7]=B):B=P[7],P[8]!==k||P[9]!==B?(A={onFocusWithin:k,onBlurWithin:B},P[8]=k,P[9]=B,P[10]=A):A=P[10];const{focusWithinProps:U}=vD(A);return U}(t);let I;n[5]!==d||n[6]!==o||n[7]!==s||n[8]!==t||n[9]!==x||n[10]!==v||n[11]!==r||n[12]!==b||n[13]!==E||n[14]!==m||n[15]!==g||n[16]!==y||n[17]!==f||n[18]!==i||n[19]!==a||n[20]!==j||n[21]!==l||n[22]!==h||n[23]!==u||n[24]!==w?(I={onKeyDown:O=>{if(Rn.fromInput(O))return void O.continuePropagation();const P={"Mod+ArrowUp":()=>(d.focusTopCell(),j.clear(),!0),"Mod+ArrowDown":()=>(d.focusBottomCell(),j.clear(),!0),ArrowUp:()=>(d.focusCell({cellId:t,where:"before"}),j.clear(),!0),ArrowDown:()=>(d.focusCell({cellId:t,where:"after"}),j.clear(),!0),ArrowLeft:()=>{if(o){const N=u.get(En),k=N.cellIds.findWithId(t),B=N.cellIds.indexOf(k),A=N.cellIds.at(B-1);if(A&&A.length>0){const U=Yx(t,A);return d.focusCell({cellId:U,where:"exact"}),j.clear(),!0}}return!1},ArrowRight:()=>{if(o){const N=u.get(En),k=N.cellIds.findWithId(t),B=N.cellIds.indexOf(k),A=N.cellIds.at(B+1);if(A&&A.length>0){const U=Yx(t,A);return d.focusCell({cellId:U,where:"exact"}),j.clear(),!0}}return!1},"Shift+ArrowUp":()=>{const N=u.get(ei);j.extend({cellId:t,allCellIds:N});const k=N.findWithId(t).before(t);return k&&j.extend({cellId:k,allCellIds:N}),d.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const N=u.get(ei);j.extend({cellId:t,allCellIds:N});const k=N.findWithId(t).after(t);return k&&j.extend({cellId:k,allCellIds:N}),d.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!b&&(j.clear(),!0),Enter:()=>(h(!0),E3(u,t),j.clear(),!0),s:()=>(a(),!0)};for(const[N,k]of Object.entries(P))if(Yf(N)(O)&&k())return void O.preventDefault();const R={"cell.run":no(N=>(f(N),!0)),"cell.runAndNewBelow":no(N=>{f(N);const k=N[N.length-1];return d.moveToNextCell({cellId:k,before:!1}),!0}),"cell.runAndNewAbove":no(N=>{f(N);const k=N[0];return d.moveToNextCell({cellId:k,before:!0}),!0}),"cell.createAbove":N=>(d.createNewCell({cellId:N,before:!0}),!0),"cell.createBelow":N=>(d.createNewCell({cellId:N,before:!1}),!0),"cell.moveUp":no(N=>{const k=N[0];return u.get(En).cellIds.findWithId(k).first()!==k&&(N.forEach(B=>{d.moveCell({cellId:B,before:!0})}),!0)}),"cell.moveDown":no(N=>{const k=N[N.length-1];return u.get(En).cellIds.findWithId(k).last()!==k&&([...N].reverse().forEach(B=>{d.moveCell({cellId:B,before:!1})}),!0)}),"cell.moveLeft":qx(N=>!!o&&(d.moveCell({cellId:N,direction:"left"}),!0)),"cell.moveRight":qx(N=>!!o&&(d.moveCell({cellId:N,direction:"right"}),!0)),"cell.hideCode":no(N=>{var B;const k=!N.map(A=>{var $;return(($=u.get(En).cellData[A])==null?void 0:$.config)||null}).every(x5);i({configs:Object.fromEntries(N.map(A=>[A,{hide_code:k}]))});for(const A of N)d.updateCellConfig({cellId:A,config:{hide_code:k}});if(N.length===1){const A=N[0];d.focusCell({cellId:A,where:"after"}),k?((B=r.current)==null||B.contentDOM.blur(),N3(A)):E3(u,A)}return!0}),"cell.focusDown":N=>(d.focusCell({cellId:N,where:"after"}),!0),"cell.focusUp":N=>(d.focusCell({cellId:N,where:"before"}),!0),"cell.sendToBottom":no(N=>(N.forEach(k=>{d.sendToBottom({cellId:k})}),!0)),"cell.sendToTop":no(N=>([...N].reverse().forEach(k=>{d.sendToTop({cellId:k})}),!0)),"cell.aiCompletion":N=>{var B;let k=!1;return l(A=>(A==null?void 0:A.cellId)===N?(k=!0,null):{cellId:N}),k&&((B=r.current)==null||B.focus()),!0},"cell.cellActions":()=>{var N;return(N=s.current)==null||N.toggle(),!0},"command.copyCell":no(N=>(x(N),!0)),"command.pasteCell":N=>(g(N),!0),"command.createCellBefore":N=>!Rn.hasModifier(O)&&(d.createNewCell({cellId:N,before:!0,autoFocus:!0}),!0),"command.createCellAfter":N=>!Rn.hasModifier(O)&&(d.createNewCell({cellId:N,before:!1,autoFocus:!0}),!0),"cell.delete":()=>{if(!w.keymap.destructive_delete)return!1;const N=z.size>=2?[...z]:[t],k=u.get(En);return!N.some(B=>{const{status:A}=k.cellRuntime[B];return A==="running"||A==="queued"})&&(y.idle?(y.submit(N),!0):(v({cellIds:N}),y.clear(),!0))}},z=function(N){return N.get(fd).selected}(u);if(m==="vim"&&function(N,k){const B=function(Y){if(Y.ctrlKey||Y.metaKey||Y.altKey)return"";const G=Y.key.toLowerCase();return Y.shiftKey?`shift+${G}`:G}(N),A=N.target;if(!B||!A)return!1;const U=ra.get(A);let $=B;U!=null&&U.timeout&&clearTimeout(U.timeout),U&&($=`${U.sequence} ${B}`);const X=k[$];if(X)return ra.delete(A),X();if(!U){const Y=k[B];if(Y)return Y()}if(Object.keys(k).some(Y=>Y.startsWith(`${$} `))){const Y=window.setTimeout(()=>{ra.delete(A)},500);return ra.set(A,{sequence:$,timeout:Y}),!0}return ra.delete(A),!1}(O.nativeEvent||O,{j:P.ArrowDown,k:P.ArrowUp,h:P.ArrowLeft,l:P.ArrowRight,i:P.Enter,"shift+j":P["Shift+ArrowDown"],"shift+k":P["Shift+ArrowUp"],"g g":P["Mod+ArrowUp"],"shift+g":P["Mod+ArrowDown"],"d d":()=>R["cell.delete"](),"y y":()=>(x(z.size>=2?[...z]:[t]),!0),p:()=>(g(t,{before:!1}),!0),"shift+p":()=>(g(t,{before:!0}),!0),o:()=>(d.createNewCell({cellId:t,before:!1,autoFocus:!0}),!0),"shift+o":()=>(d.createNewCell({cellId:t,before:!0,autoFocus:!0}),!0),u:()=>(d.undoDeleteCell(),!0)}))O.preventDefault();else{for(const[N,k]of Object.entries(R))if(E(N,O)){if(k instanceof Function){if(k(t))return void O.preventDefault()}else if(z.size>=2?k.bulkHandle([...z]):k.handle(t))return void O.preventDefault();return}O.continuePropagation()}}},n[5]=d,n[6]=o,n[7]=s,n[8]=t,n[9]=x,n[10]=v,n[11]=r,n[12]=b,n[13]=E,n[14]=m,n[15]=g,n[16]=y,n[17]=f,n[18]=i,n[19]=a,n[20]=j,n[21]=l,n[22]=h,n[23]=u,n[24]=w,n[25]=I):I=n[25];const{keyboardProps:D}=S3(I);let F;return n[26]!==M||n[27]!==b||n[28]!==D?(F=Bf(M,D,{"data-selected":b,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1"}),n[26]=M,n[27]=b,n[28]=D,n[29]=F):F=n[29],F}function x5(t){return t==null?void 0:t.hide_code}function Yx(t,e){const n=document.getElementById(Ea.create(t));if(!n)return e.first();const o=n.getBoundingClientRect();for(const r of e.topLevelIds){const s=document.getElementById(Ea.create(r));if(s){const a=s.getBoundingClientRect();if(o.top<=a.bottom&&o.bottom>=a.top)return r}}return e.last()}const b5=t=>{const e=H.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let a,i;e[0]!==o?(i=new La().isSupported(o)||o.trim()==="",e[0]=o,e[1]=i):i=e[1],a=i;const l=a;let d,u;e[2]!==o?(u=new jc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=u):u=e[3],d=u;const h=d&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Wo,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=c.jsx(Su,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const x=l&&r==="python";let g,p,b,y,v;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(Kl,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==x?(p=c.jsx(Su,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:x,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=x,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Xl,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=c.jsx(Su,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:Ln.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(v=c.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=v):v=e[23],v},Su=t=>{const e=H.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:a,displayName:i,onAfterToggle:l}=t;let d;e[0]!==n||e[1]!==l||e[2]!==a?(d=()=>{n&&(ur(n,{language:a}),l())},e[0]=n,e[1]=l,e[2]=a,e[3]=d):d=e[3];const u=d;if(!r||o===a)return null;const h=`View as ${i}`;let f,m;return e[4]!==u||e[5]!==s?(f=c.jsx(ve,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:u,children:s}),e[4]=u,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=c.jsx(Ne,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},Kx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:a,setEditorView:i,runCell:l,userConfig:d,editorViewRef:u,editorViewParentRef:h,hidden:f,hasOutput:m,showHiddenCode:x,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var G;const[y,v]=Ot(Es),w=_s(),{saveOrNameNotebook:S}=ud(),j=Ms(),{saveCellConfig:C}=et(),_=s==="running"||s==="queued",E=it(),M=zp(),I=g==="markdown",D=Le(()=>!_&&(j.idle&&d.keymap.destructive_delete?(j.submit([n]),!0):(w({cellId:n}),!0))),F=Le(()=>!_&&(l(),!0)),O=Le(()=>{const W=!o.hide_code;return C({configs:{[n]:{hide_code:W}}}),E.updateCellConfig({cellId:n,config:{hide_code:W}}),W}),P=Se(Yl),R=Le(()=>{Kn({autoInstantiate:P,createNewCell:E.createNewCell})}),z=wD(d),N=T.useMemo(()=>{const W=bE({cellId:n,showPlaceholder:e,enableAI:z,cellActions:{...E,afterToggleMarkdown:R,onRun:F,deleteCell:D,saveNotebook:S,createManyBelow:J=>{for(const V of[...J].reverse())E.createNewCell({code:V,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:M,toggleHideCode:O,aiCellCompletion:()=>{let J=!1;return v(V=>(V==null?void 0:V.cellId)===n?(J=!0,null):{cellId:n}),J}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new _3(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics,displayConfig:d.display});return W.push(zn.define(J=>{const V=J.state.field(vc);return p(V.type),{update(Q){const te=Q.state.field(vc);p(te.type)}}}),We.updateListener.of(J=>{J.selectionSet&&J.state.selection.ranges.some(V=>V.from!==V.to)&&x({focus:!1})}),We.domEventHandlers({focus:()=>{x({focus:!1})}})),W},[n,d.keymap,d.completion,d.language_servers,d.display,d.diagnostics,z,t,e,E,M,O,D,F,v,R,p,x,S]),k=Sc(),B=Le(()=>{if(k){const J=hu(n,0,r);N.push(J.extension),r=J.code}const W=new We({state:Xa.create({doc:r,extensions:N})});i(W),k||ur(W,{language:km(W.state).type})}),A=Le(()=>{if(Fn(u.current!==null,"Editor view is not initialized"),k){const W=hu(n);N.push(W.extension)}u.current.dispatch({effects:[At.reconfigure.of([N]),kD(u.current,{completionConfig:d.completion,hotkeysProvider:new _3(d.keymap.overrides??{}),lspConfig:{...d.language_servers,diagnostics:d.diagnostics}})]})}),U=Le(()=>{if(Fn(a,"Editor view is not initialized"),k){const J=hu(n,0,r);N.push(J.extension),r=J.code}const W=new We({state:Xa.fromJSON(a,{doc:r,extensions:N},{history:jD})});k||ur(W,{language:km(W.state).type}),i(W),E.clearSerializedEditorState({cellId:n})});T.useEffect(()=>{a===null?u.current===null?B():A():U(),u.current!==null&&h&&h.current!==null&&h.current.replaceChildren(u.current.dom)},[B,A,U,u,h,a,N]),T.useEffect(()=>{const W=u.current;return()=>{W==null||W.destroy()}},[u]);const $=function(W,J){const V=H.c(9),Q=jt(oa),te=Se(j3);let re;V[0]!==W||V[1]!==Q?(re=()=>{Q(!1),N3(W)},V[0]=W,V[1]=Q,V[2]=re):re=V[2];const ne=re;let ae;V[3]!==J||V[4]!==ne?(ae=()=>{if(!J.current)return void ne();const oe=J.current,ue=oe.state;ue.selection.main.from===ue.selection.main.to?ps(ue)!==null?$l(oe):ne():oe.dispatch({selection:Jn.single(ue.selection.main.from)})},V[3]=J,V[4]=ne,V[5]=ae):ae=V[5];const se=ae;let ie;V[6]!==se||V[7]!==te?(ie={onKeyDown:oe=>{te==="vim"?oe.key==="Escape"&&(oe.ctrlKey||oe.metaKey)&&se():oe.key==="Escape"&&se(),oe.continuePropagation()}},V[6]=se,V[7]=te,V[8]=ie):ie=V[8];const{keyboardProps:ge}=S3(ie);return ge}(n,u),X=f&&!I||f&&I&&!m;let Y="";return I&&f&&m?Y="h-0 overflow-hidden":f&&(Y="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden"),c.jsx(d5,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((G=u.current)==null?void 0:G.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:Le(()=>{var W;v(null),(W=u.current)==null||W.focus()}),onChange:Le(W=>{var J;(J=u.current)==null||J.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:W}})}),acceptChange:Le(W=>{var J,V;(J=u.current)==null||J.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:W}}),(V=u.current)==null||V.focus(),v(null)}),children:c.jsxs("div",{className:"relative w-full",...$,children:[X&&c.jsx(I3,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:x}),c.jsx(Xx,{className:Y,editorView:u.current,ref:h}),!f&&b&&c.jsx("div",{className:"absolute top-1 right-5",children:c.jsx(b5,{code:r,editorView:u.current,currentLanguageAdapter:g,onAfterToggle:R})})]})})},Xx=q.forwardRef((t,e)=>{const n=H.c(10),{className:o,editorView:r}=t,s=T.useRef(null);let a,i,l,d,u;return n[0]!==r?(a=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},i=[r,s],n[0]=r,n[1]=a,n[2]=i):(a=n[1],i=n[2]),T.useEffect(a,i),n[3]!==o?(l=xe("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(d=h=>{e?al(e,s)(h):al(s)(h)},n[5]=e,n[6]=d):d=n[6],n[7]!==l||n[8]!==d?(u=c.jsx("div",{className:l,ref:d,"data-testid":"cell-editor"}),n[7]=l,n[8]=d,n[9]=u):u=n[9],u});Xx.displayName="CellCodeMirrorEditor";const Cu=Sc()?function(t){const e=n=>{const o=H.c(5),r=Se(sn),[s,a]=Ot(Tr);if(r.state===zt.CONNECTING||s===void 0){let l,d;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==a?(d=c.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:c.jsxs(Ec,{milliseconds:1e3,fallback:null,children:[l,c.jsx(ve,{variant:"link",onClick:()=>{a("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=a,o[2]=d):d=o[2],d}let i;return o[3]!==n?(i=c.jsx(t,{...n}),o[3]=n,o[4]=i):i=o[4],i};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(T.memo(Kx)):T.memo(Kx),y5=t=>{const e=H.c(10);let n,o,r,s;return e[0]!==t.left?(n=c.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=c.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=c.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=c.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},v5=t=>{const e=H.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=c.jsx("span",{children:c.jsx(w5,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=c.jsx(Ne,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=c.jsx(ve,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},w5=t=>{const e=H.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?c.jsx(Ta,{className:"w-5 h-5 shrink-0"}):c.jsx(jo,{className:"w-5 h-5 shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},Jx=T.memo(t=>{const e=H.c(24),{onClick:n,count:o,cellId:r}=t,s=cm();let a;e[0]!==r||e[1]!==s?(a=SD(s,r),e[0]=r,e[1]=s,e[2]=a):a=e[2];const i=a;let l,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=xe("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")?(d=c.jsx(CD,{className:"w-4 h-4 shrink-0"}),e[4]=d):d=e[4];const u=o===1?"cell":"cells";let h,f,m,x,g,p,b;return e[5]!==o||e[6]!==u?(h=c.jsxs(c.Fragment,{children:[d,c.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",u," collapsed"]})]}),e[5]=o,e[6]=u,e[7]=h):h=e[7],e[8]!==i.errored?(f=i.errored&&c.jsx(Ne,{content:"Has errors",delayDuration:100,children:c.jsx(pp,{className:"w-4 h-4 shrink-0 text-destructive"})}),e[8]=i.errored,e[9]=f):f=e[9],e[10]!==i.stale?(m=i.stale&&c.jsx(Ne,{content:"Has stale cells",delayDuration:100,children:c.jsx(A3,{className:"w-4 h-4 shrink-0 text-(--yellow-11)"})}),e[10]=i.stale,e[11]=m):m=e[11],e[12]!==i.runningOrQueued?(x=i.runningOrQueued&&c.jsx(Ne,{content:"Running",delayDuration:100,children:c.jsx(Nc,{className:"w-4 h-4 shrink-0 animate-spin"})}),e[12]=i.runningOrQueued,e[13]=x):x=e[13],e[14]!==f||e[15]!==m||e[16]!==x?(g=c.jsxs(c.Fragment,{children:[f,m,x]}),e[14]=f,e[15]=m,e[16]=x,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=c.jsx(y5,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=c.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});Jx.displayName="CollapsedCellBanner";const Zx=t=>{const e=H.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let a,i,l,d,u,h,f,m,x,g,p,b,y,v;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const w=Zn(o);let S;if(w){let j;e[14]!==o?(j=uc(o),e[14]=o,e[15]=j):j=e[15],S=j}else S=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";i=Ne,x=S,g=!1,a=ve,l="ghost",d="icon",u=r,h="delete-button",f=Rn.preventFocus,m=xe("hover:bg-transparent text-destructive/60 hover:text-destructive",(w||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=i,e[6]=l,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=x,e[13]=g}else a=e[4],i=e[5],l=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],x=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=c.jsx(Zl,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==a||e[19]!==l||e[20]!==d||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==m?(y=c.jsx(a,{variant:l,size:d,onClick:u,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=a,e[19]=l,e[20]=d,e[21]=u,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==i||e[27]!==y||e[28]!==x||e[29]!==g?(v=c.jsx(i,{content:x,usePortal:g,children:y}),e[26]=i,e[27]=y,e[28]=x,e[29]=g,e[30]=v):v=e[30],v},k5=t=>{const e=H.c(22),{cellId:n}=t,o=function(b){const y=H.c(16),v=Se(Cg),w=Ng(),S=Is();let j;y[0]!==b||y[1]!==v.entries?(j=v.entries.get(b),y[0]=b,y[1]=v.entries,y[2]=j):j=y[2];const C=j;if(!C){let I;return y[3]===Symbol.for("react.memo_cache_sentinel")?(I={isPending:!1},y[3]=I):I=y[3],I}if(v.entries.size!==1){let I;return y[4]!==C?(I={isPending:!0,shouldConfirmDelete:!1,...C},y[4]=C,y[5]=I):I=y[5],I}let _,E,M;return y[6]!==w||y[7]!==S||y[8]!==v.entries?(_=()=>{S({cellIds:[...v.entries.values()].map(FC)}),w.clear()},y[6]=w,y[7]=S,y[8]=v.entries,y[9]=_):_=y[9],y[10]!==w?(E=()=>w.clear(),y[10]=w,y[11]=E):E=y[11],y[12]!==C||y[13]!==_||y[14]!==E?(M={isPending:!0,...C,shouldConfirmDelete:!0,confirm:_,cancel:E},y[12]=C,y[13]=_,y[14]=E,y[15]=M):M=y[15],M}(n);if(!o.isPending)return null;if(o.type==="simple"){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=xe("px-3 py-1.5","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[0]=b):b=e[0];const y=`pending-delete-${n}`;let v,w;return e[1]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(dm,{className:"w-3 h-3 text-(--amber-11) shrink-0"}),c.jsx("span",{className:"text-(--amber-11) text-xs",children:"Pending deletion"})]}),e[1]=v):v=e[1],e[2]!==y?(w=c.jsx("div",{className:b,"data-testid":y,children:v}),e[2]=y,e[3]=w):w=e[3],w}const r=o.executionDurationMs!==void 0,s=o.defs.size>0,a=js(o.executionDurationMs??0);let i,l="Pending deletion";r&&s?l=`This cell took ${a} to run and contains variables referenced by other cells.`:r?l=`This cell took ${a} to run.`:s&&(l="This cell contains variables referenced by other cells."),e[4]===Symbol.for("react.memo_cache_sentinel")?(i=xe("px-4 py-3","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[4]=i):i=e[4];const d=`pending-delete-${n}`;let u,h,f,m,x,g,p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(dm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[5]=u):u=e[5],e[6]!==l?(h=c.jsx("p",{className:"text-(--amber-11) font-medium",children:l}),e[6]=l,e[7]=h):h=e[7],e[8]!==s||e[9]!==o.defs?(f=s&&[...o.defs.entries()].map(S5),e[8]=s,e[9]=o.defs,e[10]=f):f=e[10],e[11]!==h||e[12]!==f?(m=c.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],e[14]!==o?(x=o.shouldConfirmDelete&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-(--amber-11) mt-2 mb-3",children:"Are you sure you want to delete?"}),c.jsx(am,{autoFocus:!0,children:c.jsxs("div",{className:"flex items-center gap-2",onKeyDown:C5,children:[c.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),c.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>o.confirm(),className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"})]})})]}),e[14]=o,e[15]=x):x=e[15],e[16]!==m||e[17]!==x?(g=c.jsxs("div",{className:"flex items-start gap-3",children:[u,c.jsxs("div",{className:"flex-1",children:[m,x]})]}),e[16]=m,e[17]=x,e[18]=g):g=e[18],e[19]!==d||e[20]!==g?(p=c.jsx("div",{className:i,"data-testid":d,children:g}),e[19]=d,e[20]=g,e[21]=p):p=e[21],p};function j5(t){return c.jsx("li",{className:"my-0.5 ml-8 text-(--amber-11)/60",children:c.jsx(Io,{cellId:t})},t)}function S5(t){const[e,n]=t;return c.jsxs("div",{children:[c.jsxs("p",{className:"text-(--amber-11) mt-2",children:["'",c.jsx("span",{className:"font-mono",children:e}),"' is referenced by:"]}),c.jsx("ul",{className:"list-disc",children:n.map(j5)})]},e)}function C5(t){t.stopPropagation()}const N5=t=>{const e=H.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:a,edited:i}=t,l=s==="disabled-transitively",d=s==="running"||s==="queued";let u,h;e[0]!==l||e[1]!==a.disabled||e[2]!==o||e[3]!==i||e[4]!==d||e[5]!==r?(u=Zn(o)||d||!a.disabled&&l&&!i,h=function({connectionState:p,needsRun:b,loading:y,inactive:v}){return Zn(p)?"disabled":b&&!y?"stale":y||v?"disabled":"green"}({connectionState:o,needsRun:r,loading:d,inactive:u}),e[0]=l,e[1]=a.disabled,e[2]=o,e[3]=i,e[4]=d,e[5]=r,e[6]=u,e[7]=h):(u=e[6],h=e[7]);const f=h;if(a.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(rp,{}),e[8]=p):p=e[8],e[9]!==u||e[10]!==n||e[11]!==f?(b=c.jsx(Ls,{tooltip:"Add code to notebook",disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=u,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!a.disabled&&l&&!i){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(vr,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==u||e[15]!==n||e[16]!==f?(b=c.jsx(Ls,{disabled:u,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=u,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,x,g;if(Zn(o)){let p;e[18]!==o?(p=uc(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=Wt("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(vr,{strokeWidth:1.2}),e[21]=x):x=e[21],e[22]!==u||e[23]!==n||e[24]!==m||e[25]!==f?(g=c.jsx(Ls,{tooltip:m,disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:x}),e[22]=u,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},Qx=q.createContext(null),eb=T.memo(()=>T.use(Qx));eb.displayName="DragHandle";const tb=q.forwardRef((t,e)=>{const n=H.c(21);let o,r,s,a,i;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=r.toString(),n[4]=r,n[5]=a):a=n[5],n[6]!==a?(i={id:a},n[6]=a,n[7]=i):i=n[7];const{attributes:l,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:m}=a1(i);let x;n[8]!==h?(x=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=x):x=n[9];const g=x,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==d||n[15]!==s||n[16]!==e||n[17]!==u||n[18]!==g||n[19]!==p?(b=c.jsx(nb,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:d,setNodeRef:u,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=d,n[15]=s,n[16]=e,n[17]=u,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});tb.displayName="SortableCell";const nb=q.forwardRef((t,e)=>{const n=H.c(37);let o,r,s,a,i,l,d,u,h,f;if(n[0]!==t){const{cellId:E,canMoveX:M,children:I,attributes:D,listeners:F,setNodeRef:O,transform:P,transition:R,isDragging:z,...N}=t;r=M,s=I,o=D,i=F,d=O,u=P,h=R,a=z,l=N,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i,n[6]=l,n[7]=d,n[8]=u,n[9]=h}else o=n[1],r=n[2],s=n[3],a=n[4],i=n[5],l=n[6],d=n[7],u=n[8],h=n[9];n[10]!==r||n[11]!==u?(f=u?gc.Transform.toString({x:r?u.x:0,y:u.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=u,n[12]=f):f=n[12];const m=a?2:void 0;let x;n[13]!==f||n[14]!==m||n[15]!==h?(x={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=x):x=n[16];const g=x;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(op,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==i?(b=c.jsx("div",{...o,...i,onMouseDown:Rn.preventFocus,"data-testid":"drag-button",className:"py-px 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]=i,n[20]=b):b=n[20];const y=b,v=!!u;let w;n[21]!==e||n[22]!==d?(w=E=>{al(e,d)(E)},n[21]=e,n[22]=d,n[23]=w):w=n[23];const S=v&&"is-moving";let j,C,_;return n[24]!==l.className||n[25]!==S?(j=xe(l.className,S,"outline-hidden rounded-lg"),n[24]=l.className,n[25]=S,n[26]=j):j=n[26],n[27]!==s||n[28]!==y?(C=c.jsx(Qx.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=C):C=n[29],n[30]!==a||n[31]!==l||n[32]!==g||n[33]!==w||n[34]!==j||n[35]!==C?(_=c.jsx("div",{tabIndex:-1,ref:w,...l,"data-is-dragging":a,className:j,style:g,children:C}),n[30]=a,n[31]=l,n[32]=g,n[33]=w,n[34]=j,n[35]=C,n[36]=_):_=n[36],_});function ob(t,e){const n=H.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||$l(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Le(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ps(e.current.state)==="active"){for(const d of l3)if(l.key===d.key&&d.run){d.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const a=Le(s);let i;return n[6]!==r||n[7]!==a?(i={closeCompletionHandler:r,resumeCompletionHandler:a},n[6]=r,n[7]=a,n[8]=i):i=n[8],i}function rb(t){const e=H.c(15),{cellId:n,cellConfig:o,languageAdapter:r,editorView:s}=t,[a,i]=Ot(oa);let l,d;e[0]!==n?(d=ID(n),e[0]=n,e[1]=d):d=e[1],l=d;const u=Se(l),h=!o.hide_code||a||u,f=r==="markdown",m=f&&!h;let x;e[2]!==s||e[3]!==h||e[4]!==i?(x=v=>{var S;if(h)return;const w=(v==null?void 0:v.focus)??!0;i(!0),w&&((S=s.current)==null||S.focus())},e[2]=s,e[3]=h,e[4]=i,e[5]=x):x=e[5];const g=Le(x);let p;e[6]!==m||e[7]!==g?(p=()=>{m&&g({focus:!0})},e[6]=m,e[7]=g,e[8]=p):p=e[8];const b=Le(p);let y;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==g||e[13]!==b?(y={isCellCodeShown:h,isMarkdown:f,isMarkdownCodeHidden:m,showHiddenCode:g,showHiddenCodeIfMarkdown:b},e[9]=h,e[10]=f,e[11]=m,e[12]=g,e[13]=b,e[14]=y):y=e[14],y}nb.displayName="SortableCellInternal";const sb=T.forwardRef((t,e)=>{var g;const n=H.c(18),{cellId:o}=t,r=Ja(o),s=Za(o);let a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a=_c("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=a):a=n[0];const i=a,l=M3((g=s.output)==null?void 0:g.mimetype);if(s.errored||s.interrupted||s.stopped||l)return null;let d;n[1]!==r.name||n[2]!==o?(d=zm(o,r.name),n[1]=r.name,n[2]=o,n[3]=d):d=n[3];const u=s.output;let h,f,m,x;return n[4]!==r.edited||n[5]!==s?(h=O3(s,r.edited),n[4]=r.edited,n[5]=s,n[6]=h):h=n[6],n[7]!==s.status?(f=Em(s.status),n[7]=s.status,n[8]=f):f=n[8],n[9]!==o||n[10]!==s.output||n[11]!==h||n[12]!==f?(m=c.jsx(Ic,{allowExpand:!1,forceExpand:!0,className:"output-area",cellId:o,output:u,stale:h,loading:f}),n[9]=o,n[10]=s.output,n[11]=h,n[12]=f,n[13]=m):m=n[13],n[14]!==e||n[15]!==d||n[16]!==m?(x=c.jsx("div",{tabIndex:-1,ref:e,className:i,...d,children:m}),n[14]=e,n[15]=d,n[16]=m,n[17]=x):x=n[17],x});sb.displayName="ReadonlyCellComponent";const E5=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,isCollapsed:s,collapseCount:a,canMoveX:i,editorView:l,setEditorView:d})=>{var ge;const u=T.useRef(null),h=Ja(n),f=Za(n),m=T.useRef(null),x=T.useRef(null),g=T.useRef(null),p=it(),b=Se(sn),y=jt(Es),v=_s(),w=Qc(n),{sendStdin:S}=et(),[j,C]=T.useState(),_=h.config.disabled||f.status==="disabled-transitively",E=T3({executionTime:f.runElapsedTimeMs??h.lastExecutionTime,status:f.status,errored:f.errored,interrupted:f.interrupted,stopped:f.stopped}),M=h.edited||f.interrupted||f.staleInputs&&!_,I=Em(f.status),D=(f.status==="queued"||h.edited||f.staleInputs)&&!f.interrupted,F=T.useCallback(()=>l.current,[l]),{closeCompletionHandler:O,resumeCompletionHandler:P}=ob(u,l),{isCellCodeShown:R,isMarkdown:z,isMarkdownCodeHidden:N,showHiddenCode:k,showHiddenCodeIfMarkdown:B}=rb({cellId:n,cellConfig:h.config,languageAdapter:j,editorView:l}),A=Gx(n,{canMoveX:i,editorView:l,cellActionDropdownRef:m}),U=_D(f.outline),$=!vm(f.output),X=f.consoleOutputs.length>0,Y=r.display.cell_output,G=$&&Y==="above",W=$&&Y==="below",[J,V]=T.useState(!1),[Q,te]=T.useState(!1);(function(oe){const{ref:ue,box:de="content-box",skip:Ce}=oe,Te=T.useRef({...vE}),Fe=T.useRef(void 0);Fe.current=oe.onResize,T.useEffect(()=>{if(!ue.current||Ce||typeof window>"u"||!("ResizeObserver"in window))return;const _e=new ResizeObserver(([ke])=>{const Ye=de==="border-box"?"borderBoxSize":de==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ve=v0(ke,Ye,"inlineSize"),Ke=v0(ke,Ye,"blockSize");if(Te.current.width!==Ve||Te.current.height!==Ke){const ee={width:Ve,height:Ke};Te.current.width=Ve,Te.current.height=Ke,Fe.current&&Fe.current(ee)}});return _e.observe(ue.current,{box:de}),()=>{_e.disconnect()}},[de,ue,Ce])})({ref:g,skip:!z,onResize:oe=>{const ue=oe.height&&oe.height<68,de=N&&(ue||Y==="below");V(de),U&&de?te(!0):Q&&te(!1)}});const re=oe=>c.jsx(I3,{tooltip:"Edit markdown",className:xe("z-20 relative",oe),onClick:k}),ne=$&&c.jsxs("div",{className:"relative",onDoubleClick:B,children:[c.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:c.jsx(v5,{isCollapsed:s,onClick:()=>{s?p.expandCell({cellId:n}):p.collapseCell({cellId:n})},canCollapse:U})}),N&&W&&re("top-3"),c.jsx(Ic,{allowExpand:!0,forceExpand:N,className:"output-area",cellId:n,output:f.output,stale:O3(f,h.edited),loading:Em(f.status)}),N&&G&&re("bottom-3")]}),ae=_c("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":M,"has-error":f.errored,stopped:f.stopped,disabled:h.config.disabled,stale:f.status==="disabled-transitively",borderless:N&&$&&!A["data-selected"]}),se=Le(oe=>{y({cellId:n,initialPrompt:oe.prompt})}),ie=((ge=f.serialization)==null?void 0:ge.toLowerCase())==="valid";return c.jsx(Cm,{children:c.jsx(nx,{cellId:n,getEditorView:F,children:c.jsxs(tb,{tabIndex:-1,ref:u,"data-status":f.status,onBlur:O,onKeyDown:P,cellId:n,canMoveX:i,title:h.config.disabled?"This cell is disabled":f.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[c.jsxs("div",{tabIndex:-1,...A,className:xe(ae,A.className,"focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0"),ref:g,...zm(n,h.name),children:[Y==="above"&&ne,c.jsxs("div",{className:xe("tray"),"data-hidden":N,children:[c.jsx("div",{className:"absolute right-2 -top-4 z-10",children:c.jsx(Eu,{edited:h.edited,status:f.status,cellConfig:h.config,needsRun:M,hasOutput:$,hasConsoleOutput:X,cellActionDropdownRef:m,cellId:n,name:h.name,getEditorView:F,onRun:w})}),c.jsx(ab,{cellId:n,className:xe(N&&G&&"-top-7",N&&W&&"-bottom-8",N&&Q&&"-left-[3.8rem]"),actions:p}),c.jsx(Cu,{theme:t,showPlaceholder:e,id:n,code:h.code,config:h.config,status:f.status,serializedEditorState:h.serializedEditorState,runCell:w,setEditorView:d,userConfig:r,editorViewRef:l,editorViewParentRef:x,hidden:!R,hasOutput:$,showHiddenCode:k,languageAdapter:j,setLanguageAdapter:C}),c.jsx(Nu,{className:xe(N&&Y==="below"&&"top-14"),edited:h.edited,status:f.status,isCellStatusInline:J,uninstantiated:E,disabled:h.config.disabled,runElapsedTimeMs:f.runElapsedTimeMs,runStartTimestamp:f.runStartTimestamp,lastRunStartTimestamp:f.lastRunStartTimestamp,staleInputs:f.staleInputs,interrupted:f.interrupted}),c.jsx("div",{className:"shoulder-bottom hover-action",children:o&&R&&c.jsx(Zx,{status:f.status,connectionState:b.state,onClick:()=>{I||Zn(b.state)||v({cellId:n})}})})]}),Y==="below"&&ne,f.serialization&&c.jsxs("div",{className:"py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",children:[ie&&c.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline text-muted-foreground text-xs font-bold",rel:"noopener",children:"reusable"}),c.jsx(Ne,{content:c.jsx("span",{className:"max-w-16 text-xs",children:ie?"This function or class can be imported into other Python notebooks or modules.":c.jsxs(c.Fragment,{children:["This definition can't be reused in other Python modules:",c.jsx("br",{}),c.jsx("br",{}),c.jsx("pre",{children:f.serialization}),c.jsx("br",{}),"Click this icon to learn more."]})}),children:ie?c.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:c.jsx(Vl,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})}):c.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:c.jsx(Nm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})})]}),c.jsx(Bm,{consoleOutputs:f.consoleOutputs,stale:D,cellName:f.serialization?"_":h.name,onRefactorWithAI:se,onClear:()=>{p.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(oe,ue)=>{p.setStdinResponse({cellId:n,response:oe,outputIndex:ue}),S({text:oe})},cellId:n,debuggerActive:f.debuggerActive}),c.jsx(k5,{cellId:n})]}),s&&c.jsx(Jx,{onClick:()=>p.expandCell({cellId:n}),count:a,cellId:n})]})})})},Nu=T.memo(t=>{const e=H.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:a,lastRunStartTimestamp:i,runElapsedTimeMs:l,runStartTimestamp:d,staleInputs:u,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let x;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l||e[5]!==d||e[6]!==u||e[7]!==h||e[8]!==f?(x=c.jsx(j0,{status:h,staleInputs:u,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:d,uninstantiated:f,lastRunStartTimestamp:i}),e[0]=m,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=x):x=e[9];const g=x;let p;e[10]!==n?(p=xe("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!a&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(eb,{}),e[12]=y):y=e[12];const v=a&&g;let w,S;return e[13]!==v?(w=c.jsxs("div",{className:"flex gap-2 items-end",children:[y,v]}),e[13]=v,e[14]=w):w=e[14],e[15]!==p||e[16]!==b||e[17]!==w?(S=c.jsxs("div",{className:p,children:[b,w]}),e[15]=p,e[16]=b,e[17]=w,e[18]=S):S=e[18],S});Nu.displayName="CellRightSideActions";const ab=T.memo(t=>{const e=H.c(21),n=Se(sn),{className:o,actions:r,cellId:s}=t;let a;e[0]!==r||e[1]!==s?(a=w=>{const S=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!1,...S})},e[0]=r,e[1]=s,e[2]=a):a=e[2];const i=Le(a);let l;e[3]!==r||e[4]!==s?(l=w=>{const S=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!0,...S})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const d=Le(l),u=D3(n.state);let h,f;e[6]!==o?(h=xe("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",o),e[6]=o,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=Wt("cell.createAbove"),e[8]=f):f=e[8];const m=u?d:void 0;let x,g,p;e[9]!==n.state||e[10]!==m?(x=c.jsx(Q0,{tooltipContent:f,connectionState:n.state,onClick:m}),e[9]=n.state,e[10]=m,e[11]=x):x=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=Wt("cell.createBelow"),e[13]=p):p=e[13];const b=u?i:void 0;let y,v;return e[14]!==n.state||e[15]!==b?(y=c.jsx(Q0,{tooltipContent:p,connectionState:n.state,onClick:b}),e[14]=n.state,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==x||e[19]!==y?(v=c.jsxs("div",{className:h,children:[x,g,y]}),e[17]=h,e[18]=x,e[19]=y,e[20]=v):v=e[20],v});ab.displayName="CellLeftSideActions";const Eu=T.memo(t=>{const e=H.c(27),{edited:n,status:o,cellConfig:r,needsRun:s,hasOutput:a,hasConsoleOutput:i,onRun:l,cellActionDropdownRef:d,cellId:u,getEditorView:h,name:f,includeCellActions:m}=t,x=m===void 0||m,g=Se(sn),p=D3(g.state),b=!s&&"hover-action";let y;e[0]!==b?(y=xe(b),e[0]=b,e[1]=y):y=e[1];const v=p?l:Ln.NOOP;let w,S,j,C;return e[2]!==r||e[3]!==g.state||e[4]!==n||e[5]!==s||e[6]!==o||e[7]!==v?(w=c.jsx(N5,{edited:n,onClick:v,connectionState:g.state,status:o,config:r,needsRun:s}),e[2]=r,e[3]=g.state,e[4]=n,e[5]=s,e[6]=o,e[7]=v,e[8]=w):w=e[8],e[9]!==g.state||e[10]!==o?(S=c.jsx(WN,{status:o,connectionState:g.state}),e[9]=g.state,e[10]=o,e[11]=S):S=e[11],e[12]!==d||e[13]!==r||e[14]!==u||e[15]!==h||e[16]!==i||e[17]!==a||e[18]!==x||e[19]!==f||e[20]!==o?(j=x&&c.jsx(ex,{ref:d,cellId:u,status:o,getEditorView:h,name:f,config:r,hasOutput:a,hasConsoleOutput:i,children:c.jsx(Ls,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:c.jsx(Dc,{strokeWidth:1.5})})}),e[12]=d,e[13]=r,e[14]=u,e[15]=h,e[16]=i,e[17]=a,e[18]=x,e[19]=f,e[20]=o,e[21]=j):j=e[21],e[22]!==y||e[23]!==w||e[24]!==S||e[25]!==j?(C=c.jsxs(HN,{className:y,children:[w,S,j]}),e[22]=y,e[23]=w,e[24]=S,e[25]=j,e[26]=C):C=e[26],C});Eu.displayName="CellToolbar";const _5=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,canMoveX:s,editorView:a,setEditorView:i})=>{var k;const l=T.useRef(null),d=Ja(n),u=Za(n),h=T.useRef(null),f=T.useRef(null),m=Se(sn),x=it(),g=et(),p=_s(),b=jt(Es),y=Qc(n),v=d.config.disabled||u.status==="disabled-transitively",w=T3({executionTime:u.runElapsedTimeMs??d.lastExecutionTime,status:u.status,errored:u.errored,interrupted:u.interrupted,stopped:u.stopped}),S=d.edited||u.interrupted||u.staleInputs&&!v,j=u.status==="running"||u.status==="queued",C=(u.status==="queued"||d.edited||u.staleInputs)&&!u.interrupted,_=T.useCallback(()=>a.current,[a]),{isCellCodeShown:E,showHiddenCode:M}=rb({cellId:n,cellConfig:d.config,languageAdapter:"python",editorView:a}),{closeCompletionHandler:I,resumeCompletionHandler:D}=ob(l,a),F=Gx(n,{canMoveX:s,editorView:a,cellActionDropdownRef:h}),O=!vm(u.output),P=u.consoleOutputs.length>0,R=M3((k=u.output)==null?void 0:k.mimetype),z=_c("marimo-cell","hover-actions-parent z-10 border shadow-sm","border-(--blue-5)! rounded-sm!",{"needs-run":S,"has-error":u.errored,stopped:u.stopped}),N=Le(B=>{b({cellId:n,initialPrompt:B.prompt})});return c.jsx(Cm,{children:c.jsx(nx,{cellId:n,getEditorView:_,children:c.jsxs("div",{"data-status":u.status,ref:l,...Bf(F,{className:z,onBlur:I,onKeyDown:D}),...zm(n,d.name),title:d.config.disabled?"This cell is disabled":u.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-setup-cell":!0,children:[c.jsxs("div",{className:xe("tray"),"data-hidden":!E,children:[c.jsx("div",{className:"absolute right-2 -top-4 z-10",children:c.jsx(Eu,{edited:d.edited,status:u.status,cellConfig:d.config,needsRun:S,hasOutput:O,hasConsoleOutput:P,cellActionDropdownRef:h,cellId:n,name:d.name,getEditorView:_,onRun:y,includeCellActions:!0})}),c.jsx(Cu,{theme:t,showPlaceholder:e,id:n,code:d.code,config:d.config,status:u.status,serializedEditorState:d.serializedEditorState,runCell:y,setEditorView:i,userConfig:r,editorViewRef:a,editorViewParentRef:f,hidden:!E,hasOutput:O,showHiddenCode:M,languageAdapter:"python",setLanguageAdapter:Ln.NOOP,showLanguageToggles:!1}),c.jsx(Nu,{edited:d.edited,status:u.status,isCellStatusInline:!1,uninstantiated:w,disabled:d.config.disabled,runElapsedTimeMs:u.runElapsedTimeMs,runStartTimestamp:u.runStartTimestamp,lastRunStartTimestamp:u.lastRunStartTimestamp,staleInputs:u.staleInputs,interrupted:u.interrupted}),c.jsx("div",{className:"shoulder-bottom hover-action",children:o&&c.jsx(Zx,{connectionState:m.state,status:u.status,onClick:()=>{j||Zn(m.state)||p({cellId:n})}})})]}),c.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[c.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),c.jsx(Ne,{content:c.jsxs("span",{className:"max-w-16",children:["This ",c.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",c.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:c.jsx(Nm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),R&&c.jsx(Ic,{allowExpand:!0,forceExpand:!0,className:"output-area",cellId:n,output:u.output,stale:!1,loading:j}),c.jsx(Bm,{consoleOutputs:u.consoleOutputs,stale:C,cellName:"_",onRefactorWithAI:N,onClear:()=>{x.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(B,A)=>{x.setStdinResponse({cellId:n,response:B,outputIndex:A}),g.sendStdin({text:B})},cellId:n,debuggerActive:u.debuggerActive})]})})})},ib=T.memo(t=>{const{cellId:e,mode:n}=t,o=ND(e);ft.debug("Rendering Cell",e);const r=T.useRef(null);return T.useImperativeHandle(o,()=>({get editorView(){return function(s){const a=s.current;if(a===null)throw new ReferenceError("Attempting to dereference null object.");return a}(r)},get editorViewOrNull(){return r.current}}),[r]),e===ti?c.jsx(_5,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):n==="edit"?c.jsx(ED,{atoms:[oa],children:c.jsx(E5,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}})}):c.jsx(sb,{cellId:e})}),I5=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=a=>{const i=a.match(r);if(!i)return null;const[,l,d,u,h]=i;return{major:Number.parseInt(l,10),minor:Number.parseInt(d,10),patch:Number.parseInt(u,10),preRelease:h||""}};try{const a=s(n),i=s(o);return a&&i?a.major!==i.major?a.major-i.major:a.minor!==i.minor?a.minor-i.minor:a.patch!==i.patch?a.patch-i.patch:a.preRelease===""&&i.preRelease!==""?1:a.preRelease!==""&&i.preRelease===""?-1:a.preRelease.localeCompare(i.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),lb=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),A5=ut({info:ut({provides_extra:at().array().nullable()}),releases:AD(at(),TD())});function cb(t){const e=H.c(5);let n;e[0]!==t?(n=function(a){return a.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const a=lb.get(o);if(a)return a;const i=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);const l=A5.transform(T5).parse(await i.json());return lb.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),In(r,s)}function T5(t){return{versions:Object.keys(t.releases).toSorted(I5),extras:t.info.provides_extra??[]}}function db(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const M5=()=>{const t=H.c(70),{packageAlert:e}=TR(),{clearPackageAlert:n}=MR(),[o]=fr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,a]=T.useState(r);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={},t[1]=i):i=t[1];const[l,d]=T.useState(i);if(e===null)return null;const u=o.package_management.manager!=="pixi";if(OR(e)){let h,f,m,x,g,p,b,y,v,w;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(Gc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(yn,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(x=c.jsxs("div",{className:"flex justify-between",children:[h,c.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=x):x=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==u||t[12]!==e.packages||t[13]!==l){let S;t[15]!==s||t[16]!==u||t[17]!==l?(S=(j,C)=>{const _=db(j),E=l[j]||_.extras;return c.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[c.jsx(ws,{size:"1rem"}),c.jsx(R5,{packageName:_.name,selectedExtras:E,onExtrasChange:M=>d(I=>({...I,[j]:M}))}),u&&c.jsx(L5,{value:s[j]??"latest",onChange:M=>a(I=>({...I,[j]:M})),packageName:_.name})]},C)},t[15]=s,t[16]=u,t[17]=l,t[18]=S):S=t[18],p=e.packages.map(S),t[10]=s,t[11]=u,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=c.jsxs("div",{children:[g,c.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=c.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?c.jsxs(c.Fragment,{children:[c.jsx(D5,{manager:o.package_management.manager,packages:e.packages.map(S=>{const j=db(S),C=l[S]||j.extras;return function(_,E){return E.length===0?_:`${_}[${E.join(",")}]`}(j.name,C)}),versions:s,clearPackageAlert:()=>n(e.id)}),!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"px-2 text-sm",children:"with"})," ",c.jsx(P5,{})]})]}):c.jsxs("p",{children:["If you set up a"," ",c.jsx(Zf,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(v=c.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=v):v=t[31],t[32]!==v||t[33]!==x?(w=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:c.jsxs(ni,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[x,v]})}),t[32]=v,t[33]=x,t[34]=w):w=t[34],w}if(DR(e)){let h;t[35]!==e.packages?(h=function(O){const P=new Set(Object.values(O)),R=P.has("queued")||P.has("installing")?"installing":P.has("failed")?"failed":"installed";return R==="installing"?{status:"installing",title:"Installing packages",titleIcon:c.jsx(ci,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:R==="installed"?{status:"installed",title:"All packages installed!",titleIcon:c.jsx(gp,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:c.jsx(Gc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:x,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,v,w,S;t[37]!==m||t[38]!==x?(b=c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[x,m]}),t[37]=m,t[38]=x,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(yn,{className:"w-5 h-5"}),t[43]=v):v=t[43],t[44]!==y?(w=c.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:v}),t[44]=y,t[45]=w):w=t[45],t[46]!==b||t[47]!==w?(S=c.jsxs("div",{className:"flex justify-between",children:[b,w]}),t[46]=b,t[47]=w,t[48]=S):S=t[48];const j=f==="installed"&&"text-accent-foreground";let C,_,E,M,I,D,F;if(t[49]!==j?(C=xe("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",j),t[49]=j,t[50]=C):C=t[50],t[51]!==g?(_=c.jsx("p",{children:g}),t[51]=g,t[52]=_):_=t[52],t[53]!==e.packages||t[54]!==f){let O;t[56]!==f?(O=(P,R)=>{const[z,N]=P;return c.jsxs("li",{className:xe("flex items-center gap-1 font-mono text-sm",N==="installing"&&"font-semibold",N==="failed"&&"text-destructive",N==="installed"&&"text-accent-foreground",N==="installed"&&f==="failed"&&"text-muted-foreground"),children:[c.jsx(O5,{status:N}),z]},R)},t[56]=f,t[57]=O):O=t[57],E=Object.entries(e.packages).map(O),t[53]=e.packages,t[54]=f,t[55]=E}else E=t[55];return t[58]!==E?(M=c.jsx("ul",{className:"list-disc ml-4 mt-1",children:E}),t[58]=E,t[59]=M):M=t[59],t[60]!==_||t[61]!==M?(I=c.jsxs("div",{children:[_,M]}),t[60]=_,t[61]=M,t[62]=I):I=t[62],t[63]!==C||t[64]!==I?(D=c.jsx("div",{className:C,children:I}),t[63]=C,t[64]=I,t[65]=D):D=t[65],t[66]!==D||t[67]!==p||t[68]!==S?(F=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:c.jsxs(ni,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[S,D]})}),t[66]=D,t[67]=p,t[68]=S,t[69]=F):F=t[69],F}return nc(e),null},O5=t=>{const e=H.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ws,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ci,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ac,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(yn,{size:"1rem"}),e[3]=o):o=e[3],o}default:return nc(n),null}},D5=t=>{const e=H.c(10),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t,{sendInstallMissingPackages:a}=et();let i,l,d,u;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==a||e[4]!==r?(i=async()=>{s();const h={...r};for(const f of o)h[f]=h[f]??"";await a({manager:n,versions:h}).catch(F5)},e[0]=s,e[1]=n,e[2]=o,e[3]=a,e[4]=r,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ci,{className:"w-4 h-4 mr-2"}),d=c.jsx("span",{className:"font-semibold",children:"Install"}),e[6]=l,e[7]=d):(l=e[6],d=e[7]),e[8]!==i?(u=c.jsxs(ve,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[l,d]}),e[8]=i,e[9]=u):u=e[9],u},P5=()=>{const t=H.c(17),[e,n]=fr(),{saveUserConfig:o}=et();let r,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Lk(MD),t[0]=r):r=t[0],t[1]!==e?(s={resolver:r,defaultValues:e},t[1]=e,t[2]=s):s=t[2];const a=Fk(s);let i;t[3]!==o||t[4]!==n?(i=async m=>{await o({config:m}).then(()=>{n(m)})},t[3]=o,t[4]=n,t[5]=i):i=t[5];const l=i;let d,u,h,f;return t[6]!==a||t[7]!==l?(d=a.handleSubmit(l),t[6]=a,t[7]=l,t[8]=d):d=t[8],t[9]!==a.control?(u=c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(Tk,{control:a.control,name:"package_management.manager",render:B5})}),t[9]=a.control,t[10]=u):u=t[10],t[11]!==d||t[12]!==u?(h=c.jsx("form",{onChange:d,className:"flex flex-col gap-5",children:u}),t[11]=d,t[12]=u,t[13]=h):h=t[13],t[14]!==a||t[15]!==h?(f=c.jsx(OD,{...a,children:h}),t[14]=a,t[15]=h,t[16]=f):f=t[16],f},R5=t=>{const e=H.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,a]=T.useState(!1),{isPending:i,error:l,data:d}=cb(n);let u;e[0]!==r||e[1]!==o?(u=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=u):u=e[2];const h=u,f=!i&&!l;let m,x;if(e[3]!==(d==null?void 0:d.extras)?(m=(d==null?void 0:d.extras)??[],e[3]=d==null?void 0:d.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(U5);let p;e[12]!==n?(p=c.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],x=c.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?c.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[c.jsx("span",{className:"shrink-0",children:"["}),c.jsxs(So,{open:s&&f,onOpenChange:b=>{f&&a(b)},children:[c.jsx(Co,{asChild:!0,children:c.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),c.jsxs(No,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&c.jsx("div",{className:"p-2 bg-popover border-b border-border",children:c.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>c.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,c.jsx(yn,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),c.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>c.jsx(P3,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:$5,children:b},b))})]})]}),c.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?c.jsxs(So,{open:s&&f,onOpenChange:b=>{f&&a(b)},children:[c.jsx(Co,{asChild:!0,children:c.jsx("button",{disabled:!f,className:xe("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:c.jsx(Yo,{className:"w-3 h-3 shrink-0"})})}),c.jsxs(No,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[c.jsx("div",{className:"p-2 bg-popover border-b border-border",children:c.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),c.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>c.jsx(P3,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:V5,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=x}else x=e[11];return x},L5=t=>{const e=H.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:a,data:i}=cb(r);if(s){let h,f,m;return e[0]!==o?(h=x=>o(x.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=c.jsx(Ne,{content:"Failed to fetch package versions",children:c.jsx(_m,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,d,u;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==a||e[9]!==i?(d=a?c.jsx("option",{value:"latest",children:"latest"}):["latest",...i.versions.slice(0,100)].map(H5),e[8]=a,e[9]=i,e[10]=d):d=e[10],e[11]!==a||e[12]!==l||e[13]!==d||e[14]!==n?(u=c.jsx(_m,{value:n,onChange:l,disabled:a,className:"inline-flex ml-2 w-24 text-ellipsis",children:d}),e[11]=a,e[12]=l,e[13]=d,e[14]=n,e[15]=u):u=e[15],u};function F5(t){ft.error(t)}function z5(t){return c.jsx("option",{value:t,children:t},t)}function B5(t){const{field:e}=t;return c.jsxs(Mk,{children:[c.jsx(Ok,{children:c.jsx(_m,{"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:DD.map(z5)})}),c.jsx(Rk,{})]})}function U5(t){return!/^(dev|test|testing)$/i.test(t)}function $5(t){return t.preventDefault()}function V5(t){return t.preventDefault()}function H5(t){return c.jsx("option",{value:t,children:t},t)}const W5=t=>{let{transform:e}=t;return{...e,x:0}},q5={threshold:{x:0,y:.1}},G5=q.memo(t=>{const e=H.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:a,compactColumns:i}=it(),[l,d]=T.useState(null),[u,h]=T.useState(null),[f]=Ek();let m;e:{if(f.width==="columns"){m=Im.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[W5],e[0]=O):O=e[0],m=O}const x=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:$N},e[2]=p):p=e[2];const b=function(){for(var O=arguments.length,P=new Array(O),R=0;R<O;R++)P[R]=arguments[R];return T.useMemo(()=>[...P].filter(z=>z!=null),[...P])}(Ig(Nd,g),Ig(Sd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=O=>{d(O.active.id);const P=gn();h(P.cellIds)},e[3]=y):y=e[3];const v=Le(y);let w;e[4]!==u?(w=()=>{d(null),h(null)},e[4]=u,e[5]=w):w=e[5];const S=Le(w);let j;e[6]!==l?(j=O=>{const P=O.droppableContainers.filter(Y5);if(l&&Rr(l))return yd({...O,droppableContainers:P});const R=(A=>{let{droppableContainers:U,droppableRects:$,pointerCoordinates:X}=A;if(!X)return[];const Y=[];for(const G of U){const{id:W}=G,J=$.get(W);if(J&&aN(X,J)){const V=xd(J).reduce((te,re)=>te+pd(X,re),0),Q=Number((V/4).toFixed(4));Y.push({id:W,data:{droppableContainer:G,value:Q}})}}return Y.sort(gd)})({...O,droppableContainers:P}),z=bd(R.length>0?R:Tg({...O,droppableContainers:P}),"id");if(!z)return[];Fn(Rr(z),`Expected column id. Got: ${z}`);const N=gn().cellIds.get(z);if(Fn(N,`Expected column. Got: ${z}`),N&&N.topLevelIds.length===0)return[{id:z}];const k=new Set(N.topLevelIds),B=yd({...O,droppableContainers:O.droppableContainers.filter(A=>A.id!==z&&k.has(A.id))});if(B.length>0){const A=B[0].id;return Fn(_u(A),`Expected cell id. Got: ${A}`),[{id:A}]}return[]},e[6]=l,e[7]=j):j=e[7];const C=j;let _;e[8]!==r||e[9]!==s||e[10]!==a?(_=O=>{const{active:P,over:R}=O,z=R==null?void 0:R.id;if(z!=null&&P.id!==z){if(_u(P.id)){if(Rr(z))return void s({cellId:P.id,columnId:z});if(_u(z))return void r({cellId:P.id,overCellId:z})}Rr(P.id)&&Rr(z)&&a({column:P.id,overColumn:z})}},e[8]=r,e[9]=s,e[10]=a,e[11]=_):_=e[11];const E=Le(_);let M;e[12]!==i?(M=O=>{const{active:P,over:R}=O;R!==null&&P.id!==R.id&&i()},e[12]=i,e[13]=M):M=e[13];const I=Le(M),D=o?C:yd;let F;return e[14]!==n||e[15]!==S||e[16]!==I||e[17]!==E||e[18]!==v||e[19]!==x||e[20]!==b||e[21]!==D?(F=c.jsx(IN,{autoScroll:q5,sensors:b,collisionDetection:D,modifiers:x,onDragEnd:I,onDragStart:v,onDragCancel:S,onDragOver:E,children:n}),e[14]=n,e[15]=S,e[16]=I,e[17]=E,e[18]=v,e[19]=x,e[20]=b,e[21]=D,e[22]=F):F=e[22],F});function _u(t){return typeof t=="string"&&!t.startsWith("tree_")}function Rr(t){return typeof t=="string"&&t.startsWith("tree_")}function Y5(t){return Rr(t.id)}const K5=t=>{const e=H.c(13),{className:n,size:o,gap:r,durationMs:s}=t,a=o===void 0?8:o,i=r===void 0?"gap-1":r,l=s===void 0?1200:s,d=`${l}ms`;let u;e[0]!==d?(u={animationDuration:d},e[0]=d,e[1]=u):u=e[1];const h=u;let f,m,x,g;return e[2]!==n||e[3]!==i?(f=_c("flex",i,n),e[2]=n,e[3]=i,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==a?(x=m.map(p=>c.jsx(PD,{width:a,height:a,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=a,e[9]=x):x=e[9],e[10]!==f||e[11]!==x?(g=c.jsx("div",{className:f,"aria-label":"Loading",children:x}),e[10]=f,e[11]=x,e[12]=g):g=e[12],g},ub=t=>{const e=H.c(11),{title:n,children:o,show:r,delayMs:s,kind:a}=t,i=s===void 0?2e3:s,l=a===void 0?"info":a;if(!r)return null;let d,u,h;e[0]!==n?(d=n&&c.jsx("div",{className:"flex justify-between",children:c.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:n})}),e[0]=n,e[1]=d):d=e[1],e[2]!==o?(u=c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:o})}),e[2]=o,e[3]=u):u=e[3],e[4]!==l||e[5]!==d||e[6]!==u?(h=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:c.jsxs(ni,{kind:l,className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[d,u]})}),e[4]=l,e[5]=d,e[6]=u,e[7]=h):h=e[7];const f=h;let m;return e[8]!==f||e[9]!==i?(m=c.jsx(Ec,{milliseconds:i,children:f}),e[8]=f,e[9]=i,e[10]=m):m=e[10],m},X5=()=>{const t=H.c(3),e=Se(RD),n=Se(LD);let o;return t[0]!==n||t[1]!==e?(o=e&&c.jsxs(c.Fragment,{children:[c.jsx(Ec,{milliseconds:1e3,children:c.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-200 ",children:c.jsx(Ne,{content:"Connecting to a marimo runtime",children:c.jsx("div",{className:"flex items-center",children:c.jsx(K5,{size:5,className:"text-yellow-500"})})})})}),c.jsx(ub,{show:e,delayMs:5e3,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(vn,{className:"h-4 w-4"}),c.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&c.jsx(ub,{show:n,kind:"danger",children:c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("p",{children:"Failed to connect."})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o},hb=q.forwardRef((t,e)=>{const n=H.c(71);let o,r,s,a,i,l,d;n[0]!==t?({columnId:a,canDelete:o,canMoveLeft:r,canMoveRight:s,footer:i,...l}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i,n[6]=l):(o=n[1],r=n[2],s=n[3],a=n[4],i=n[5],l=n[6]),n[7]!==a?(d={id:a},n[7]=a,n[8]=d):d=n[8];const{attributes:u,listeners:h,setNodeRef:f,transform:m,transition:x,isDragging:g,isOver:p}=a1(d);let b;n[9]!==m?(b=m?gc.Transform.toString({x:m.x,y:0,scaleX:1,scaleY:1}):void 0,n[9]=m,n[10]=b):b=n[10];const y=g?2:void 0;let v;n[11]!==b||n[12]!==y||n[13]!==x?(v={transform:b,transition:x,zIndex:y,position:"relative","--gutter-width":"50px"},n[11]=b,n[12]=y,n[13]=x,n[14]=v):v=n[14];const w=v,{deleteColumn:S,moveColumn:j,addColumn:C}=it(),_=Z5;let E;n[15]!==a||n[16]!==j?(E=()=>j({column:a,overColumn:"_left_"}),n[15]=a,n[16]=j,n[17]=E):E=n[17];const M=!r;let I,D,F;n[18]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(Nk,{className:"size-4"}),n[18]=I):I=n[18],n[19]!==E||n[20]!==M?(D=c.jsx(Ne,{content:"Move column left",side:"top",delayDuration:300,children:c.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:E,disabled:M,children:I})}),n[19]=E,n[20]=M,n[21]=D):D=n[21],n[22]!==a||n[23]!==j?(F=()=>j({column:a,overColumn:"_right_"}),n[22]=a,n[23]=j,n[24]=F):F=n[24];const O=!s;let P,R,z,N,k,B;n[25]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(Ta,{className:"size-4"}),n[25]=P):P=n[25],n[26]!==O||n[27]!==F?(R=c.jsx(Ne,{content:"Move column right",side:"top",delayDuration:300,children:c.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:F,disabled:O,children:P})}),n[26]=O,n[27]=F,n[28]=R):R=n[28],n[29]===Symbol.for("react.memo_cache_sentinel")?(z=c.jsx(FD,{className:"size-4 opacity-0 group-hover:opacity-50 transition-opacity duration-200"}),n[29]=z):z=n[29],n[30]!==u||n[31]!==h?(N=c.jsx("div",{className:"flex gap-2 h-full grow cursor-grab active:cursor-grabbing items-center justify-center","data-testid":"column-drag-spacer",...u,...h,children:z}),n[30]=u,n[31]=h,n[32]=N):N=n[32],n[33]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Co,{asChild:!0,children:c.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",children:c.jsx(Dc,{className:"size-4"})})}),n[33]=k):k=n[33],n[34]!==a||n[35]!==S?(B=()=>S({columnId:a}),n[34]=a,n[35]=S,n[36]=B):B=n[36];const A=!o;let U,$,X,Y,G,W;n[37]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(yn,{className:"mr-2 size-4"}),n[37]=U):U=n[37],n[38]!==B||n[39]!==A?($=c.jsxs(So,{children:[k,c.jsx(No,{align:"end",children:c.jsxs(It,{onClick:B,disabled:A,children:[U,"Delete column"]})})]}),n[38]=B,n[39]=A,n[40]=$):$=n[40],n[41]!==C||n[42]!==a?(X=()=>{C({columnId:a}),requestAnimationFrame(_)},n[41]=C,n[42]=a,n[43]=X):X=n[43],n[44]===Symbol.for("react.memo_cache_sentinel")?(Y=c.jsx(Yo,{className:"size-4"}),n[44]=Y):Y=n[44],n[45]!==X?(G=c.jsx(Ne,{content:"Add column",side:"top",delayDuration:300,children:c.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:X,children:Y})}),n[45]=X,n[46]=G):G=n[46],n[47]!==R||n[48]!==N||n[49]!==$||n[50]!==G||n[51]!==D?(W=c.jsxs("div",{className:"px-2 pt-3 pb-0 group flex items-center rounded-t-lg overflow-hidden",children:[D,R,N,$,G]}),n[47]=R,n[48]=N,n[49]=$,n[50]=G,n[51]=D,n[52]=W):W=n[52];const J=W;let V;n[53]!==e||n[54]!==f?(V=ie=>{al(e,f)(ie)},n[53]=e,n[54]=f,n[55]=V):V=n[55];const Q=g?"":l.className,te=g?"z-20":"z-1 hover:z-10 focus-within:z-10",re=p&&"bg-accent/20";let ne,ae,se;return n[56]!==Q||n[57]!==te||n[58]!==re?(ne=xe(Q,te,re),n[56]=Q,n[57]=te,n[58]=re,n[59]=ne):ne=n[59],n[60]!==J||n[61]!==l.children?(ae=c.jsxs("div",{className:"bg-(--slate-1) rounded-lg",children:[J,l.children]}),n[60]=J,n[61]=l.children,n[62]=ae):ae=n[62],n[63]!==i||n[64]!==g||n[65]!==l||n[66]!==w||n[67]!==V||n[68]!==ne||n[69]!==ae?(se=c.jsxs("div",{tabIndex:-1,ref:V,...l,style:w,"data-is-dragging":g,className:ne,children:[ae,i]}),n[63]=i,n[64]=g,n[65]=l,n[66]=w,n[67]=V,n[68]=ne,n[69]=ae,n[70]=se):se=n[70],se});hb.displayName="SortableColumn";const J5=T.memo(hb);function Z5(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:Q5,saveColumnWidth:e_}=zD,fb=T.memo(t=>{const e=H.c(20),n=T.useRef(null);if(t.width==="columns"){const s=t.canDelete,a=t.columnId,i=t.canMoveLeft,l=t.canMoveRight,d=t.footer;let u,h,f,m;return e[0]!==t.index?(u=Q5(t.index),e[0]=t.index,e[1]=u):u=e[1],e[2]!==t.index?(h=x=>{e_(t.index,x)},e[2]=t.index,e[3]=h):h=e[3],e[4]!==t.children||e[5]!==u||e[6]!==h?(f=c.jsx(t_,{startingWidth:u,onResize:h,children:t.children}),e[4]=t.children,e[5]=u,e[6]=h,e[7]=f):f=e[7],e[8]!==t.canDelete||e[9]!==t.canMoveLeft||e[10]!==t.canMoveRight||e[11]!==t.columnId||e[12]!==t.footer||e[13]!==f?(m=c.jsx(J5,{tabIndex:-1,ref:n,canDelete:s,columnId:a,canMoveLeft:i,canMoveRight:l,className:"group/column",footer:d,children:f}),e[8]=t.canDelete,e[9]=t.canMoveLeft,e[10]=t.canMoveRight,e[11]=t.columnId,e[12]=t.footer,e[13]=f,e[14]=m):m=e[14],m}let o,r;return e[15]!==t.children?(o=c.jsx("div",{"data-testid":"cell-column",className:"flex flex-col gap-5",children:t.children}),e[15]=t.children,e[16]=o):o=e[16],e[17]!==t.footer||e[18]!==o?(r=c.jsxs(c.Fragment,{children:[o,t.footer]}),e[17]=t.footer,e[18]=o,e[19]=r):r=e[19],r});fb.displayName="Column";const t_=t=>{const e=H.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:a,handleRefs:i,style:l}=BD(s),d=n_;let u,h,f,m;return e[3]!==i.left?(u=d(i.left),e[3]=i.left,e[4]=u):u=e[4],e[5]!==r||e[6]!==a||e[7]!==l?(h=c.jsx("div",{ref:a,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 pt-3 pb-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=a,e[7]=l,e[8]=h):h=e[8],e[9]!==i.right?(f=d(i.right),e[9]=i.right,e[10]=f):f=e[10],e[11]!==u||e[12]!==h||e[13]!==f?(m=c.jsxs("div",{className:"flex flex-row",children:[u,h,f]}),e[11]=u,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function n_(t){return c.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-100
|
124
|
-
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
125
|
-
before:right-[-3px] before:w-[9px] before:z-[-1]
|
126
|
-
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
127
|
-
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const o_=t=>{const e=H.c(10),{width:n}=t,{banners:o}=PR(),{removeBanner:r}=RR();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let a,i,l;if(e[0]!==s?(a=xe("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=a):a=e[1],e[2]!==o||e[3]!==r){let d;e[5]!==r?(d=u=>c.jsxs(ni,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(R3,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),c.jsx(ve,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:c.jsx(yn,{className:"w-5 h-5"})})]}),c.jsxs("div",{className:"flex justify-between items-end",children:[c.jsx("span",{children:Am({html:u.description})}),u.action==="restart"&&c.jsx(r_,{})]})]},u.id),e[5]=r,e[6]=d):d=e[6],i=o.map(d),e[2]=o,e[3]=r,e[4]=i}else i=e[4];return e[7]!==a||e[8]!==i?(l=c.jsx("div",{className:a,children:i}),e[7]=a,e[8]=i,e[9]=l):l=e[9],l},r_=()=>{const t=H.c(3),e=pg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(wp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=c.jsxs(ve,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},s_=yt(t=>{const e=t(En);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),a_=()=>{const t=H.c(3),e=i_;if(!Se(s_))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("div",{className:"flex justify-between",children:c.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(a3,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:c.jsxs(ni,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:c.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",c.jsx(ve,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=c.jsx(Ec,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function i_(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):ft.error("No element with data-stdin-blocking found")}function l_(){const t=setTimeout(c_,100);return()=>clearTimeout(t)}function c_(){requestAnimationFrame(d_)}function d_(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(pb)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),pb=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=gn(),a=n.dataset.cellId;if(!a)return void ft.error(`Missing cellId for cell with name ${e}`);const i=(r=(o=s[a])==null?void 0:o.current)==null?void 0:r.editorView;i&&i.focus()}}else ft.warn(`Cannot focus cell with name ${e} because it was not found`),mb()})(t);else try{mb()}catch(e){const n=e;ft.warn("Error focusing first editor",n)}}function mb(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=gn();for(const s of t.iterateTopLevelIds){const a=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=a==null?void 0:a.current)!=null&&r.editorView))return void a.current.editorView.focus()}}let pb=!1;const u_=t=>{const e=H.c(8),n=Se(UD),o=t.appConfig.width==="columns";let r,s,a;return e[0]!==t?(r=c.jsx(h_,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(r1,{id:"column-container",items:n,strategy:DN,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(a=c.jsx(G5,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=a):a=e[7],a},h_=t=>{const e=H.c(26),{mode:n,userConfig:o,appConfig:r}=t,s=it(),{theme:a}=Ko(),{toggleSidebarPanel:i}=Fa();L3(l_),Dt("global.focusTop",s.focusTopCell),Dt("global.focusBottom",s.focusBottomCell),Dt("global.toggleSidebar",i),Dt("global.foldCode",s.foldAll),Dt("global.unfoldCode",s.unfoldAll),Dt("global.formatAll",p_),Dt("cell.hideCode",Ln.NOOP),Dt("cell.format",Ln.NOOP);const l=gr(),d=$D(),u=l.getColumnIds(),h=s.scrollToTarget;let f,m;e[0]!==d||e[1]!==h?(f=()=>{d!==null&&h()},e[0]=d,e[1]=h,e[2]=f):f=e[2],e[3]!==l||e[4]!==d||e[5]!==h?(m=[l,d,h],e[3]=l,e[4]=d,e[5]=h,e[6]=m):m=e[6],T.useEffect(f,m);const x=LR;let g,p,b,y;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(M5,{}),p=c.jsx(a_,{}),b=c.jsx(X5,{}),e[7]=g,e[8]=p,e[9]=b):(g=e[7],p=e[8],b=e[9]),e[10]!==r.width?(y=c.jsx(o_,{width:r.width}),e[10]=r.width,e[11]=y):y=e[11];const v=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";let w;e[12]!==v?(w=xe(v),e[12]=v,e[13]=w):w=e[13];const S=u.map((E,M)=>c.jsx(f_,{columnId:E,index:M,columnsLength:u.length,appConfig:r,mode:n,userConfig:o,theme:a},E));let j,C,_;return e[14]!==w||e[15]!==S?(j=c.jsx("div",{className:w,children:S}),e[14]=w,e[15]=S,e[16]=j):j=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(FR,{}),e[17]=C):C=e[17],e[18]!==x||e[19]!==r||e[20]!==j||e[21]!==g||e[22]!==p||e[23]!==b||e[24]!==y?(_=c.jsxs(x,{className:"pb-[40vh]",invisible:!1,appConfig:r,innerClassName:"pr-4",children:[g,p,b,y,j,C]}),e[18]=x,e[19]=r,e[20]=j,e[21]=g,e[22]=p,e[23]=b,e[24]=y,e[25]=_):_=e[25],_},f_=t=>{const e=H.c(54),{columnId:n,index:o,columnsLength:r,appConfig:s,mode:a,userConfig:i,theme:l}=t,d=gr();let u,h,f,m,x,g,p,b,y,v,w,S,j,C,_,E;if(e[0]!==s.width||e[1]!==d||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==l||e[7]!==i){const M=d.get(n);let I;Fn(M,`Expected column for: ${n}`),e[22]!==d?(I=d.hasOnlyOneId(),e[22]=d,e[23]=I):I=e[23];const D=I;let F;e[24]!==d.inOrderIds?(F=d.inOrderIds.includes(ti),e[24]=d.inOrderIds,e[25]=F):F=e[25];const O=F;h=fb,w=n,S=o,j=o>0,C=o<r-1,m=s.width,x=r>1;const P=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let R;e[26]!==P?(R=xe(P),e[26]=P,e[27]=R):R=e[27],e[28]!==n||e[29]!==R?(g=c.jsx(m_,{columnId:n,className:R}),e[28]=n,e[29]=R,e[30]=g):g=e[30],u=r1,f=`column-${o+1}`,p=M.topLevelIds,b=PN,e[31]!==O||e[32]!==o||e[33]!==a||e[34]!==l||e[35]!==i?(y=o===0&&O&&c.jsx(ib,{cellId:ti,theme:l,showPlaceholder:!1,canDelete:!0,mode:a,userConfig:i,isCollapsed:!1,collapseCount:0,canMoveX:!1},ti),e[31]=O,e[32]=o,e[33]=a,e[34]=l,e[35]=i,e[36]=y):y=e[36],v=M.topLevelIds.map(z=>z===ti?null:c.jsx(ib,{cellId:z,theme:l,showPlaceholder:D,canDelete:!D,mode:a,userConfig:i,isCollapsed:M.isCollapsed(z),collapseCount:M.getCount(z),canMoveX:s.width==="columns"},z)),e[0]=s.width,e[1]=d,e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=l,e[7]=i,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=x,e[13]=g,e[14]=p,e[15]=b,e[16]=y,e[17]=v,e[18]=w,e[19]=S,e[20]=j,e[21]=C}else u=e[8],h=e[9],f=e[10],m=e[11],x=e[12],g=e[13],p=e[14],b=e[15],y=e[16],v=e[17],w=e[18],S=e[19],j=e[20],C=e[21];return e[37]!==u||e[38]!==f||e[39]!==p||e[40]!==b||e[41]!==y||e[42]!==v?(_=c.jsxs(u,{id:f,items:p,strategy:b,children:[y,v]}),e[37]=u,e[38]=f,e[39]=p,e[40]=b,e[41]=y,e[42]=v,e[43]=_):_=e[43],e[44]!==h||e[45]!==m||e[46]!==x||e[47]!==g||e[48]!==_||e[49]!==w||e[50]!==S||e[51]!==j||e[52]!==C?(E=c.jsx(h,{columnId:w,index:S,canMoveLeft:j,canMoveRight:C,width:m,canDelete:x,footer:g,children:_}),e[44]=h,e[45]=m,e[46]=x,e[47]=g,e[48]=_,e[49]=w,e[50]=S,e[51]=j,e[52]=C,e[53]=E):E=e[53],E},m_=t=>{const e=H.c(17),{columnId:n,className:o}=t,{createNewCell:r}=it(),[s,a]=VD(!1),i=Se(Gl),l=Se(e3);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=xe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=d):d=e[0];const u=d;let h;e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==a.toggle||e[6]!==l?(h=()=>s?c.jsx(HD,{onClose:a.toggle}):c.jsxs(c.Fragment,{children:[c.jsxs(ve,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[c.jsx(Sp,{className:"mr-2 size-4 shrink-0"}),"Python"]}),c.jsxs(ve,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{Kn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new La().defaultCode,hideCode:!0})},children:[c.jsx(Ep,{className:"mr-2 size-4 shrink-0"}),"Markdown"]}),c.jsxs(ve,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{Kn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new jc().defaultCode})},children:[c.jsx(Wo,{className:"mr-2 size-4 shrink-0"}),"SQL"]}),c.jsx(Ne,{content:i?null:c.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:c.jsxs(ve,{className:u,variant:"text",size:"sm",disabled:!i||!l,onClick:a.toggle,children:[c.jsx(Aa,{className:"mr-2 size-4 shrink-0"}),"Generate with AI"]})})]}),e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",x=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-(--blue-3)";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==x?(g=xe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,x,o),e[8]=o,e[9]=m,e[10]=x,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=c.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:c.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function p_(){Zk()}const g_=WD(t=>{i3().syncCellIds(t)},400),x_=(t,e)=>{Qe.get(ss)||t.isEmpty()||e.isEmpty()||Ba(t.inOrderIds,e.inOrderIds)||g_({cell_ids:t.inOrderIds})},gb=t=>{const e=H.c(70),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;qD(ei,x_);const{setCells:a,mergeAllColumns:i,collapseAllCells:l,expandAllCells:d}=it(),u=Se(Uf),h=Se(GD),f=Se(YD),m=tm(),x=jt(dd),{sendComponentValues:g,sendInterrupt:p}=et(),b=u.mode==="edit",y=u.mode==="present",v=Se(KD);let w,S;e[0]!==g?(w=()=>(_j.INSTANCE.start(g),b_),e[0]=g,e[1]=w):w=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(S=[],e[2]=S):S=e[2],T.useEffect(w,S);const j=n.runtime.auto_instantiate;let C,_,E;e[3]!==a||e[4]!==x?(C=(ie,ge)=>{a(ie);const oe=ie.map(y_),ue=ie.map(v_),de=ie.map(w_);x({names:oe,codes:ue,configs:de,layout:ge})},e[3]=a,e[4]=x,e[5]=C):C=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=b3(),e[6]=_):_=e[6],e[7]!==C||e[8]!==n.runtime.auto_instantiate?(E={autoInstantiate:j,setCells:C,sessionId:_},e[7]=C,e[8]=n.runtime.auto_instantiate,e[9]=E):E=e[9];const{connection:M}=zR(E);let I,D;e[10]!==o.app_title||e[11]!==m?(I=()=>{document.title=o.app_title||xn.basename(m??"")||"Untitled Notebook"},D=[o.app_title,m],e[10]=o.app_title,e[11]=m,e[12]=I,e[13]=D):(I=e[12],D=e[13]),T.useEffect(I,D);const F=pc(o.width);let O,P;e[14]!==o.width||e[15]!==i||e[16]!==F?(O=()=>{F==="columns"&&o.width!=="columns"&&i()},e[14]=o.width,e[15]=i,e[16]=F,e[17]=O):O=e[17],e[18]!==o.width||e[19]!==i||e[20]!==h||e[21]!==F?(P=[o.width,F,i,h],e[18]=o.width,e[19]=i,e[20]=h,e[21]=F,e[22]=P):P=e[22],T.useEffect(O,P);const R=function(){const ie=H.c(2),ge=Cs();let oe;return ie[0]!==ge?(oe=()=>ge(YM(gn())),ie[0]=ge,ie[1]=oe):oe=ie[1],Le(oe)}(),z=Rp(),N=Pp();let k,B,A,U,$,X,Y;e[23]!==R?(k=()=>{R()},e[23]=R,e[24]=k):k=e[24],Dt("global.runStale",k),e[25]!==p?(B=()=>{p()},e[25]=p,e[26]=B):B=e[26],Dt("global.interrupt",B),e[27]!==N?(A=()=>{N()},e[27]=N,e[28]=A):A=e[28],Dt("global.hideCode",A),e[29]!==z?(U=()=>{z()},e[29]=z,e[30]=U):U=e[30],Dt("global.runAll",U),e[31]!==l?($=()=>{l()},e[31]=l,e[32]=$):$=e[32],Dt("global.collapseAllSections",$),e[33]!==d?(X=()=>{d()},e[33]=d,e[34]=X):X=e[34],Dt("global.expandAllSections",X),e[35]!==o||e[36]!==n||e[37]!==u.mode?(Y=c.jsx(u_,{mode:u.mode,userConfig:n,appConfig:o}),e[35]=o,e[36]=n,e[37]=u.mode,e[38]=Y):Y=e[38];const G=Y,W=o.width;let J,V,Q,te,re,ne,ae,se;return e[39]===Symbol.for("react.memo_cache_sentinel")?(J=xe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[39]=J):J=e[39],e[40]!==m||e[41]!==b?(V=b&&c.jsx("div",{className:"flex items-center justify-center container",children:c.jsx(LC,{filename:m})}),e[40]=m,e[41]=b,e[42]=V):V=e[42],e[43]!==M||e[44]!==V?(Q=c.jsx(UR,{connection:M,className:J,children:V}),e[43]=M,e[44]=V,e[45]=Q):Q=e[45],e[46]!==o||e[47]!==G||e[48]!==f||e[49]!==u.mode?(te=f&&c.jsx(BR,{appConfig:o,mode:u.mode,children:G}),e[46]=o,e[47]=G,e[48]=f,e[49]=u.mode,e[50]=te):te=e[50],e[51]!==o.width||e[52]!==M||e[53]!==v||e[54]!==Q||e[55]!==te?(re=c.jsxs($R,{connection:M,isRunning:v,width:W,children:[Q,te]}),e[51]=o.width,e[52]=M,e[53]=v,e[54]=Q,e[55]=te,e[56]=re):re=e[56],e[57]===Symbol.for("react.memo_cache_sentinel")?(ne=c.jsx(YC,{}),e[57]=ne):ne=e[57],e[58]!==o||e[59]!==M||e[60]!==s||e[61]!==y||e[62]!==v||e[63]!==R||e[64]!==p||e[65]!==N?(ae=!s&&c.jsx(Ac,{children:c.jsx(MC,{presenting:y,onTogglePresenting:N,onInterrupt:p,onRun:R,connectionState:M.state,running:v,appConfig:o})}),e[58]=o,e[59]=M,e[60]=s,e[61]=y,e[62]=v,e[63]=R,e[64]=p,e[65]=N,e[66]=ae):ae=e[66],e[67]!==re||e[68]!==ae?(se=c.jsxs(c.Fragment,{children:[re,ne,ae]}),e[67]=re,e[68]=ae,e[69]=se):se=e[69],se};function b_(){_j.INSTANCE.stop()}function y_(t){return t.name}function v_(t){return t.code}function w_(t){return t.config}const xb=t=>Se(XD)[t.capability]?t.children:null,hn=T.forwardRef((t,e)=>{const n=H.c(18);let o,r,s,a,i;n[0]!==t?({children:o,tooltip:i,selected:a,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=i):(o=n[1],r=n[2],s=n[3],a=n[4],i=n[5]);const l=!a&&"hover:bg-(--sage-3)",d=a&&"bg-(--sage-4)";let u,h;n[6]!==r||n[7]!==l||n[8]!==d?(u=xe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,d,r),n[6]=r,n[7]=l,n[8]=d,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=c.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const f=h;if(i){let m;return n[15]!==f||n[16]!==i?(m=c.jsx(Ne,{content:i,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=i,n[17]=m):m=n[17],m}return f});hn.displayName="FooterItem";const k_=()=>{var u;const t=H.c(14),e=Se(F3),n=Se(Gl),o=((u=e==null?void 0:e.open_ai)==null?void 0:u.model)||"gpt-4-turbo",{handleClick:r}=si();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Aa,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=c.jsx(hn,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,a,i,l,d;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(a=c.jsxs(c.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=a):a=t[7],t[8]!==r?(i=()=>r("ai"),t[8]=r,t[9]=i):i=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Aa,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==a||t[12]!==i?(d=c.jsx(hn,{tooltip:a,onClick:i,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=a,t[12]=i,t[13]=d):d=t[13],d},j_=()=>{const t=H.c(26),e=Se(sn).state,n=Sm();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===zt.OPEN){if(Zt())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(w){const S=w;return{isHealthy:!1,lastChecked:new Date,error:S instanceof Error?S.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:a,data:i,refetch:l}=In(o,r),d=e===zt.OPEN?3e4:null;let u,h;t[4]!==d?(u={delayMs:d,whenVisible:!0},t[4]=d,t[5]=u):u=t[5],ri(l,u),t[6]!==e||t[7]!==i||t[8]!==a?(h=()=>[em(e.toLowerCase()),i!=null&&i.lastChecked?i.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",a?`Error: ${a}`:""].filter(Boolean).join(`
|
128
|
-
`),t[6]=e,t[7]=i,t[8]=a,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(i==null?void 0:i.isHealthy)||t[12]!==(i==null?void 0:i.lastChecked)||t[13]!==s?(m=()=>s||e===zt.CONNECTING?c.jsx(vn,{size:"small"}):e===zt.CLOSING?c.jsx(vn,{className:"text-destructive",size:"small"}):e===zt.OPEN?i!=null&&i.isHealthy?c.jsx(Rc,{className:"w-4 h-4 text-(--green-9)"}):i!=null&&i.lastChecked?c.jsx(R3,{className:"w-4 h-4 text-(--yellow-9)"}):c.jsx(Rc,{className:"w-4 h-4"}):c.jsx(ai,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=i==null?void 0:i.isHealthy,t[12]=i==null?void 0:i.lastChecked,t[13]=s,t[14]=m):m=t[14];const x=m,g=f();let p,b,y,v;return t[15]!==e?(p=e===zt.OPEN&&c.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=c.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==x?(y=x(),t[20]=x,t[21]=y):y=t[21],t[22]!==l||t[23]!==b||t[24]!==y?(v=c.jsx(hn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:y}),t[22]=l,t[23]=b,t[24]=y,t[25]=v):v=t[25],v},S_=t=>{const e=H.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=c.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},C_=yt(t=>t(JD).completion.copilot),N_=()=>{const t=H.c(1);if(Se(C_)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(E_,{}),t[0]=e):e=t[0],e}return null},bb=ft.get("[copilot-status-bar]"),E_=()=>{const t=Se(xj),e=Se(jR)!==null,{handleClick:n}=si(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=jt(xj),a=jt(SR);return L3(()=>{const i=gj();let l=!0;return(async()=>{try{if(await i.initializePromise.catch(u=>{throw bb.error("Failed to initialize",u),i.close(),u}),!l)return;const d=await i.signedIn();if(!l)return;s(d),a(d?"signedIn":"signedOut")}catch(d){if(!l)return;bb.warn("Connection failed",d),s(!1),a("connectionError"),Je({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:c.jsx(ve,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),c.jsx(hn,{tooltip:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:c.jsx("span",{children:e?c.jsx(vn,{className:"h-4 w-4"}):c.jsx(S_,{className:xe("h-4 w-4",!t&&"opacity-60")})})})},__=()=>{const t=H.c(18),[e,n]=T.useState(0),o=Se(sn),{getUsageStats:r}=et();let s,a,i,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>n(M_),a={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=a):(s=t[0],a=t[1]),ri(s,a),t[2]!==o.state||t[3]!==r?(i=async()=>Zt()||o.state!==zt.OPEN?null:r(),t[2]=o.state,t[3]=r,t[4]=i):i=t[4],t[5]!==o.state||t[6]!==e?(l=[e,o.state],t[5]=o.state,t[6]=e,t[7]=l):l=t[7];const{data:d}=In(i,l);let u,h,f,m;return t[8]!==d?(u=(d==null?void 0:d.gpu)&&d.gpu.length>0&&c.jsx(T_,{gpus:d.gpu}),t[8]=d,t[9]=u):u=t[9],t[10]!==d?(h=d&&c.jsx(I_,{memory:d.memory,kernel:d.kernel,server:d.server}),t[10]=d,t[11]=h):h=t[11],t[12]!==d?(f=d&&c.jsx(A_,{cpu:d.cpu}),t[12]=d,t[13]=f):f=t[13],t[14]!==u||t[15]!==h||t[16]!==f?(m=c.jsxs("div",{className:"flex gap-2 items-center px-1",children:[u,h,f]}),t[14]=u,t[15]=h,t[16]=f,t[17]=m):m=t[17],m},I_=t=>{const e=H.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:a,available:i}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const d=l;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("b",{children:"computer memory:"}),e[2]=u):u=e[2];const h=a-i;let f,m,x,g,p,b,y,v,w;return e[3]!==h?(f=Au(h),e[3]=h,e[4]=f):f=e[4],e[5]!==a?(m=Au(a),e[5]=a,e[6]=m):m=e[6],e[7]!==d||e[8]!==f||e[9]!==m?(x=c.jsxs("span",{children:[u," ",f," / ",m," GB (",d,"%)"]}),e[7]=d,e[8]=f,e[9]=m,e[10]=x):x=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"marimo server:"})," ",hl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"kernel:"})," ",hl(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==x||e[16]!==g||e[17]!==p?(b=c.jsxs("div",{className:"flex flex-col gap-1",children:[x,g,p]}),e[15]=x,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(hp,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==d?(v=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,c.jsx(Iu,{percent:d,colorClassName:"bg-primary"})]}),e[20]=d,e[21]=v):v=e[21],e[22]!==v||e[23]!==b?(w=c.jsx(Ne,{delayDuration:200,content:b,children:v}),e[22]=v,e[23]=b,e[24]=w):w=e[24],w},A_=t=>{const e=H.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let a,i,l,d,u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("b",{children:"CPU:"}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs("span",{children:[a," ",s,"%"]}),e[3]=s,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(CR,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(d=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,c.jsx(Iu,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=d):d=e[7],e[8]!==i||e[9]!==d?(u=c.jsx(Ne,{delayDuration:200,content:i,children:d}),e[8]=i,e[9]=d,e[10]=u):u=e[10],u},T_=t=>{const e=H.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(O_,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,i,l,d;return e[2]!==n?(s=n.map(D_),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(a=c.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(mp,{className:"w-4 h-4"}),e[6]=i):i=e[6],e[7]!==r?(l=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[i,c.jsx(Iu,{percent:r,colorClassName:"bg-(--grass-9)"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(d=c.jsx(Ne,{delayDuration:200,content:a,children:l}),e[9]=a,e[10]=l,e[11]=d):d=e[11],d},Iu=t=>{const e=H.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=xe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let a,i;return e[2]!==s?(a={width:s},e[2]=s,e[3]=a):a=e[3],e[4]!==r||e[5]!==a?(i=c.jsx("div",{className:"h-3 w-20 bg-(--slate-4) rounded-lg overflow-hidden border",children:c.jsx("div",{className:r,style:a})}),e[4]=r,e[5]=a,e[6]=i):i=e[6],i};function hl(t){return t>1073741824?`${Au(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Au(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function M_(t){return t+1}function O_(t,e){return t+e.memory.percent}function D_(t){return c.jsxs("span",{children:[c.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",hl(t.memory.used)," / ",hl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const yb=yt(!1);function Tu(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Tu(r,e,n))o.add(s)}return o}const P_=yt(t=>{const e=t(ei),n=t(hc);return function(o,r){var i,l,d;const s=new Map;for(const u of o)s.set(u,{variables:new Set,parents:new Set,children:new Set});for(const u of Object.values(r))if(u.dataType!=="module")for(const h of u.declaredBy){(i=s.get(h))==null||i.variables.add(u.name);for(const f of u.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(d=s.get(h))==null||d.children.add(f))}const a={};for(const[u,h]of s.entries())a[u]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Tu(u,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Tu(u,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return a}(e.inOrderIds,n)});function R_(t,e){return e?t.usedBy.includes(e.id)||t.declaredBy.includes(e.id)?!0:t.declaredBy.some(n=>e.graph.parents.has(n))?t.usedBy.some(n=>e.graph.parents.has(n)):!!t.declaredBy.some(n=>e.graph.children.has(n)):!1}const L_=()=>{const t=H.c(6),[e,n]=Ot(yb);let o,r,s;return t[0]!==n?(o=()=>n(F_),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(up,{className:"h-4 w-4"}),t[2]=r):r=t[2],t[3]!==e||t[4]!==o?(s=c.jsx(hn,{tooltip:"Toggle Minimap",selected:e,onClick:o,"data-testid":"footer-minimap",children:r}),t[3]=e,t[4]=o,t[5]=s):s=t[5],s};function F_(t){return!t}const z_=()=>{const t=H.c(13),e=Se(Tr),[n,o]=Ot(y3),[r,s]=T.useState(!1);if(!Sc()||e==="disabled")return null;const a=e?"Real-time collaboration active":"Connecting to real-time collaboration";let i,l,d,u,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Mp,{className:"w-4 h-4"}),t[0]=i):i=t[0],t[1]!==a?(l=c.jsx(xs,{asChild:!0,children:c.jsx(hn,{tooltip:a,selected:!1,"data-testid":"footer-rtc-status",children:i})}),t[1]=a,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"font-medium leading-none",children:"Username"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=d):d=t[3],t[4]!==o?(u=m=>o(m.target.value),t[4]=o,t[5]=u):u=t[5],t[6]!==u||t[7]!==n?(h=c.jsx(us,{className:"w-80",children:c.jsxs("div",{className:"space-y-4",children:[d,c.jsx(Vo,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:u,placeholder:"Enter your username"})]})}),t[6]=u,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=c.jsxs(mr,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},B_=t=>{const e=H.c(104),{className:n}=t,{saveUserConfig:o}=et(),[r,s]=ZD(),a=fr()[0],[i,l]=T.useState(!1);let d,u,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const _e=window.matchMedia("(min-width: 768px)"),ke=()=>{_e.matches&&l(!1)};return _e.addEventListener("change",ke),()=>_e.removeEventListener("change",ke)},u=[],e[0]=d,e[1]=u):(d=e[0],u=e[1]),T.useEffect(d,u),e[2]!==a||e[3]!==o||e[4]!==s?(h=async _e=>{const ke={...a,runtime:{...a.runtime,auto_instantiate:_e}};await o({config:ke}).then(()=>s(ke))},e[2]=a,e[3]=o,e[4]=s,e[5]=h):h=e[5];const f=h;let m;e[6]!==o||e[7]!==s||e[8]!==r?(m=async _e=>{const ke={...r,runtime:{...r.runtime,on_cell_change:_e?"autorun":"lazy"}};await o({config:ke}).then(()=>s(ke))},e[6]=o,e[7]=s,e[8]=r,e[9]=m):m=e[9];const x=m;let g;e[10]!==o||e[11]!==s||e[12]!==r?(g=async _e=>{const ke={...r,runtime:{...r.runtime,auto_reload:_e}};await o({config:ke}).then(()=>s(ke))},e[10]=o,e[11]=s,e[12]=r,e[13]=g):g=e[13];const p=g;let b;e[14]!==a.runtime.auto_instantiate||e[15]!==a.runtime.auto_reload||e[16]!==a.runtime.on_cell_change?(b=!a.runtime.auto_instantiate&&a.runtime.on_cell_change==="lazy"&&(Zt()||a.runtime.auto_reload!=="autorun"),e[14]=a.runtime.auto_instantiate,e[15]=a.runtime.auto_reload,e[16]=a.runtime.on_cell_change,e[17]=b):b=e[17];const y=b;let v;e[18]!==n?(v=xe("flex items-center",n),e[18]=n,e[19]=v):v=e[19];const w=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let S,j,C;e[20]!==a.runtime.auto_instantiate||e[21]!==f?(S=()=>f(!a.runtime.auto_instantiate),e[20]=a.runtime.auto_instantiate,e[21]=f,e[22]=S):S=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx("span",{children:"on startup: "}),e[23]=j):j=e[23],e[24]!==a.runtime.auto_instantiate?(C=a.runtime.auto_instantiate?c.jsx(dn,{size:14}):c.jsx(cn,{size:14}),e[24]=a.runtime.auto_instantiate,e[25]=C):C=e[25];const _=a.runtime.auto_instantiate?"autorun":"lazy";let E,M,I,D;e[26]!==_?(E=c.jsx("span",{children:_}),e[26]=_,e[27]=E):E=e[27],e[28]!==C||e[29]!==E?(M=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[j,C,E]}),e[28]=C,e[29]=E,e[30]=M):M=e[30],e[31]!==M||e[32]!==w||e[33]!==S?(I=c.jsx(ks,{name:"runtime.auto_instantiate",children:c.jsx(hn,{tooltip:w,selected:!1,onClick:S,"data-testid":"footer-autorun-startup",children:M})}),e[31]=M,e[32]=w,e[33]=S,e[34]=I):I=e[34],e[35]===Symbol.for("react.memo_cache_sentinel")?(D=c.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[35]=D):D=e[35];const F=a.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let O,P,R,z,N,k,B,A,U,$,X,Y,G;e[36]!==a.runtime.on_cell_change||e[37]!==x?(O=()=>x(a.runtime.on_cell_change!=="autorun"),e[36]=a.runtime.on_cell_change,e[37]=x,e[38]=O):O=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx("span",{children:"on cell change: "}),e[39]=P):P=e[39],e[40]!==a.runtime.on_cell_change?(R=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[P,a.runtime.on_cell_change==="autorun"?c.jsx(dn,{size:14}):c.jsx(cn,{size:14}),c.jsx("span",{children:a.runtime.on_cell_change})]}),e[40]=a.runtime.on_cell_change,e[41]=R):R=e[41],e[42]!==F||e[43]!==O||e[44]!==R?(z=c.jsx(ks,{name:"runtime.on_cell_change",children:c.jsx(hn,{tooltip:F,selected:!1,onClick:O,"data-testid":"footer-autorun-cell-change",children:R})}),e[42]=F,e[43]=O,e[44]=R,e[45]=z):z=e[45],e[46]!==a.runtime.auto_reload||e[47]!==p?(N=!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-r border-border h-6 mx-1"}),c.jsx(ks,{name:"runtime.auto_reload",children:c.jsx(hn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:c.jsxs(So,{children:[c.jsxs(Co,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[c.jsx("span",{children:"on module change: "}),a.runtime.auto_reload==="off"&&c.jsx(ai,{size:14}),a.runtime.auto_reload==="lazy"&&c.jsx(cn,{size:14}),a.runtime.auto_reload==="autorun"&&c.jsx(dn,{size:14}),c.jsx("span",{children:a.runtime.auto_reload}),c.jsx(jo,{size:14})]}),c.jsx(No,{children:["off","lazy","autorun"].map(_e=>c.jsxs(It,{onClick:()=>p(_e),children:[_e==="off"&&c.jsx(ai,{size:14,className:"mr-2 text-muted-foreground"}),_e==="lazy"&&c.jsx(cn,{size:14,className:"mr-2 text-muted-foreground"}),_e==="autorun"&&c.jsx(dn,{size:14,className:"mr-2 text-muted-foreground"}),_e]},_e))})]})})})]}),e[46]=a.runtime.auto_reload,e[47]=p,e[48]=N):N=e[48],e[49]!==I||e[50]!==z||e[51]!==N?(k=c.jsxs("div",{className:"hidden md:flex md:items-center",children:[I,D,z,N]}),e[49]=I,e[50]=z,e[51]=N,e[52]=k):k=e[52],e[53]!==y?(B=y?c.jsx(cn,{size:16,className:"text-muted-foreground"}):c.jsx(dn,{size:16,className:"text-amber-500"}),e[53]=y,e[54]=B):B=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(jo,{size:14}),e[55]=A):A=e[55],e[56]!==B?(U=c.jsx(Co,{asChild:!0,children:c.jsx(hn,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:c.jsxs("div",{className:"flex items-center gap-1",children:[B,A]})})}),e[56]=B,e[57]=U):U=e[57],e[58]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(Pk,{children:"Runtime reactivity"}),X=c.jsx(rn,{}),e[58]=$,e[59]=X):($=e[58],X=e[59]),e[60]!==a.runtime.auto_instantiate?(Y=a.runtime.auto_instantiate?c.jsx(dn,{size:14,className:"text-amber-500"}):c.jsx(cn,{size:14,className:"text-muted-foreground"}),e[60]=a.runtime.auto_instantiate,e[61]=Y):Y=e[61],e[62]===Symbol.for("react.memo_cache_sentinel")?(G=c.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[62]=G):G=e[62];const W=a.runtime.auto_instantiate?"autorun":"lazy";let J,V,Q,te,re,ne,ae,se,ie;e[63]!==W?(J=c.jsxs("div",{children:[G,c.jsx("div",{className:"text-xs text-muted-foreground",children:W})]}),e[63]=W,e[64]=J):J=e[64],e[65]!==Y||e[66]!==J?(V=c.jsxs("div",{className:"flex items-center space-x-2",children:[Y,J]}),e[65]=Y,e[66]=J,e[67]=V):V=e[67],e[68]!==a.runtime.auto_instantiate||e[69]!==f?(Q=c.jsx(Wf,{checked:a.runtime.auto_instantiate,onCheckedChange:f,size:"sm"}),e[68]=a.runtime.auto_instantiate,e[69]=f,e[70]=Q):Q=e[70],e[71]!==V||e[72]!==Q?(te=c.jsx(ks,{name:"runtime.auto_instantiate",children:c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[V,Q]})}),e[71]=V,e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(re=c.jsx(rn,{}),e[74]=re):re=e[74],e[75]!==a.runtime.on_cell_change?(ne=a.runtime.on_cell_change==="autorun"?c.jsx(dn,{size:14,className:"text-amber-500"}):c.jsx(cn,{size:14,className:"text-muted-foreground"}),e[75]=a.runtime.on_cell_change,e[76]=ne):ne=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(ae=c.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[77]=ae):ae=e[77],e[78]!==a.runtime.on_cell_change?(se=c.jsxs("div",{children:[ae,c.jsx("div",{className:"text-xs text-muted-foreground",children:a.runtime.on_cell_change})]}),e[78]=a.runtime.on_cell_change,e[79]=se):se=e[79],e[80]!==ne||e[81]!==se?(ie=c.jsxs("div",{className:"flex items-center space-x-2",children:[ne,se]}),e[80]=ne,e[81]=se,e[82]=ie):ie=e[82];const ge=a.runtime.on_cell_change==="autorun";let oe,ue,de,Ce,Te,Fe;return e[83]!==x||e[84]!==ge?(oe=c.jsx(Wf,{checked:ge,onCheckedChange:x,size:"sm"}),e[83]=x,e[84]=ge,e[85]=oe):oe=e[85],e[86]!==ie||e[87]!==oe?(ue=c.jsx(ks,{name:"runtime.on_cell_change",children:c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ie,oe]})}),e[86]=ie,e[87]=oe,e[88]=ue):ue=e[88],e[89]!==a.runtime.auto_reload||e[90]!==p?(de=!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsx(ks,{name:"runtime.auto_reload",children:c.jsxs("div",{className:"px-2 py-1",children:[c.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.runtime.auto_reload==="off"&&c.jsx(ai,{size:14,className:"text-muted-foreground"}),a.runtime.auto_reload==="lazy"&&c.jsx(cn,{size:14,className:"text-muted-foreground"}),a.runtime.auto_reload==="autorun"&&c.jsx(dn,{size:14,className:"text-amber-500"}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"On module change"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:a.runtime.auto_reload})]})]}),c.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(_e=>c.jsxs("button",{onClick:()=>p(_e),className:xe("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",_e===a.runtime.auto_reload&&"bg-accent"),children:[_e==="off"&&c.jsx(ai,{size:12,className:"mr-2"}),_e==="lazy"&&c.jsx(cn,{size:12,className:"mr-2"}),_e==="autorun"&&c.jsx(dn,{size:12,className:"mr-2"}),c.jsx("span",{className:"capitalize",children:_e}),_e===a.runtime.auto_reload&&c.jsx("span",{className:"ml-auto",children:"\u2713"})]},_e))})]})})]}),e[89]=a.runtime.auto_reload,e[90]=p,e[91]=de):de=e[91],e[92]!==te||e[93]!==ue||e[94]!==de?(Ce=c.jsxs(No,{align:"start",className:"w-64",children:[$,X,te,re,ue,de]}),e[92]=te,e[93]=ue,e[94]=de,e[95]=Ce):Ce=e[95],e[96]!==i||e[97]!==U||e[98]!==Ce?(Te=c.jsx("div",{className:"flex md:hidden",children:c.jsxs(So,{open:i,onOpenChange:l,children:[U,Ce]})}),e[96]=i,e[97]=U,e[98]=Ce,e[99]=Te):Te=e[99],e[100]!==k||e[101]!==Te||e[102]!==v?(Fe=c.jsxs("div",{className:v,children:[k,Te]}),e[100]=k,e[101]=Te,e[102]=v,e[103]=Fe):Fe=e[103],Fe},U_=()=>{const t=H.c(24),{selectedPanel:e,isTerminalOpen:n}=sc(),{toggleApplication:o,toggleTerminal:r}=Fa(),s=Se(QD),a=$_,i=ed.find(V_);let l;Fn(i,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Dt("global.toggleTerminal",l);const d=hn,u=i.tooltip,h=e===i.type,f=()=>o(i.type),m=a(i,s>0?"text-destructive":"");let x,g,p,b,y,v,w,S,j,C;return t[2]!==s?(x=c.jsx("span",{className:"ml-1 font-mono mt-0.5",children:s}),t[2]=s,t[3]=x):x=t[3],t[4]!==d||t[5]!==i||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==x?(g=c.jsxs(d,{tooltip:u,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,x]}),t[4]=d,t[5]=i,t[6]=h,t[7]=f,t[8]=m,t[9]=x,t[10]=g):g=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Ap,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(y=c.jsx(xb,{capability:"terminal",children:c.jsx(hn,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(B_,{}),w=c.jsx("div",{className:"mx-auto"}),t[17]=v,t[18]=w):(v=t[17],w=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(IC,{children:c.jsx(Ne,{content:c.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:c.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=S):S=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{className:"flex items-center shrink-0 min-w-0",children:[c.jsx(__,{}),c.jsx(L_,{}),c.jsx(k_,{}),c.jsx(N_,{}),c.jsx(z_,{}),c.jsx(j_,{})]}),t[20]=j):j=t[20],t[21]!==y||t[22]!==g?(C=c.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin",children:[g,y,v,w,S,j]}),t[21]=y,t[22]=g,t[23]=C):C=t[23],C};function $_(t,e){const{Icon:n}=t;return c.jsx(n,{className:xe("h-5 w-5",e)})}function V_(t){return t.type==="errors"}const H_=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=_n();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(W_,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(z3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},W_=t=>{const e=H.c(9),{onClose:n}=t;let o,r,s,a,i,l,d;return e[0]!==n?(o=async u=>{u.preventDefault();const h=new FormData(u.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),Je({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=c.jsx($o,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsxs("li",{className:"my-0",children:["Take our"," ",c.jsx("a",{href:Pn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("li",{className:"my-0",children:["File a"," ",c.jsx("a",{href:Pn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(os,{children:[r,c.jsxs(rs,{children:[s,c.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[a,i,c.jsxs("li",{className:"my-0",children:["Chat with us on"," ",c.jsx("a",{href:Pn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),c.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(d=c.jsx(Ho,{className:"w-fit",children:c.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=d):d=e[8],d},q_=()=>{const t=H.c(10),{selectedPanel:e}=sc(),{toggleApplication:n}=Fa(),o=Y_;let r,s,a,i,l,d;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=ed.filter(K_).map(u=>c.jsx(vb,{tooltip:u.tooltip,selected:e===u.type,onClick:()=>n(u.type),children:o(u)},u.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(H_,{children:c.jsx(vb,{tooltip:"Send feedback!",selected:!1,children:c.jsx(fp,{className:"h-5 w-5"})})}),i=c.jsx("div",{className:"flex-1"}),l=c.jsx(G_,{}),t[4]=a,t[5]=i,t[6]=l):(a=t[4],i=t[5],l=t[6]),t[7]!==r||t[8]!==s?(d=c.jsxs("div",{className:r,children:[s,a,i,l]}),t[7]=r,t[8]=s,t[9]=d):d=t[9],d},G_=()=>{const t=H.c(7),e=Se(eP);let n,o,r;return t[0]!==e?(n=e>0?c.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=c.jsx("div",{className:"flex flex-col-reverse gap-px overflow-hidden",children:Array.from({length:e}).map(X_)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=c.jsx(Ne,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},vb=t=>{const e=H.c(17);let n,o,r,s,a;e[0]!==t?({children:n,tooltip:a,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a):(n=e[1],o=e[2],r=e[3],s=e[4],a=e[5]);const i=!s&&"hover:bg-(--sage-3)",l=s&&"bg-(--sage-4)";let d,u,h;return e[6]!==o||e[7]!==i||e[8]!==l?(d=xe("flex items-center p-2 text-sm mx-px shadow-inset font-mono cursor-pointer rounded",i,l,o),e[6]=o,e[7]=i,e[8]=l,e[9]=d):d=e[9],e[10]!==n||e[11]!==r||e[12]!==d?(u=c.jsx("button",{className:d,...r,children:n}),e[10]=n,e[11]=r,e[12]=d,e[13]=u):u=e[13],e[14]!==u||e[15]!==a?(h=c.jsx(Ne,{content:a,side:"right",delayDuration:200,children:u}),e[14]=u,e[15]=a,e[16]=h):h=e[16],h};function Y_(t,e){const{Icon:n}=t;return c.jsx(n,{className:xe("h-5 w-5",e)})}function K_(t){return!t.hidden&&t.position==="sidebar"}function X_(t,e){return c.jsx("div",{className:"shrink-0 h-1 w-2 bg-(--grass-6) border border-(--grass-7)"},e.toString())}var Mu="ScrollArea",[wb,iL]=h3(Mu),[J_,kn]=wb(Mu),kb=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...a}=t,[i,l]=T.useState(null),[d,u]=T.useState(null),[h,f]=T.useState(null),[m,x]=T.useState(null),[g,p]=T.useState(null),[b,y]=T.useState(0),[v,w]=T.useState(0),[S,j]=T.useState(!1),[C,_]=T.useState(!1),E=ys(e,I=>l(I)),M=tP(r);return c.jsx(J_,{scope:n,type:o,dir:M,scrollHideDelay:s,scrollArea:i,viewport:d,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:x,scrollbarXEnabled:S,onScrollbarXEnabledChange:j,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:C,onScrollbarYEnabledChange:_,onCornerWidthChange:y,onCornerHeightChange:w,children:c.jsx(gs.div,{dir:M,...a,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...t.style}})})});kb.displayName=Mu;var jb="ScrollAreaViewport",Sb=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,a=kn(jb,n),i=T.useRef(null),l=ys(e,i,a.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(gs.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Sb.displayName=jb;var Vn="ScrollAreaScrollbar",Ou=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=kn(Vn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=r,i=t.orientation==="horizontal";return T.useEffect(()=>(i?s(!0):a(!0),()=>{i?s(!1):a(!1)}),[i,s,a]),r.type==="hover"?c.jsx(Z_,{...o,ref:e,forceMount:n}):r.type==="scroll"?c.jsx(Q_,{...o,ref:e,forceMount:n}):r.type==="auto"?c.jsx(Cb,{...o,ref:e,forceMount:n}):r.type==="always"?c.jsx(Du,{...o,ref:e}):null});Ou.displayName=Vn;var Z_=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=kn(Vn,t.__scopeScrollArea),[s,a]=T.useState(!1);return T.useEffect(()=>{const i=r.scrollArea;let l=0;if(i){const d=()=>{window.clearTimeout(l),a(!0)},u=()=>{l=window.setTimeout(()=>a(!1),r.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),c.jsx(Tc,{present:n||s,children:c.jsx(Cb,{"data-state":s?"visible":"hidden",...o,ref:e})})}),Q_=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=kn(Vn,t.__scopeScrollArea),s=t.orientation==="horizontal",a=gl(()=>l("SCROLL_END"),100),[i,l]=function(d,u){return T.useReducer((h,f)=>u[h][f]??h,d)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return T.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,r.scrollHideDelay,l]),T.useEffect(()=>{const d=r.viewport,u=s?"scrollLeft":"scrollTop";if(d){let h=d[u];const f=()=>{const m=d[u];h!==m&&(l("SCROLL"),a()),h=m};return d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[r.viewport,s,l,a]),c.jsx(Tc,{present:n||i!=="hidden",children:c.jsx(Du,{"data-state":i==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Tn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Tn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Cb=T.forwardRef((t,e)=>{const n=kn(Vn,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,a]=T.useState(!1),i=t.orientation==="horizontal",l=gl(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;a(i?d:u)}},10);return Lr(n.viewport,l),Lr(n.content,l),c.jsx(Tc,{present:o||s,children:c.jsx(Du,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Du=T.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=kn(Vn,t.__scopeScrollArea),s=T.useRef(null),a=T.useRef(0),[i,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Ab(i.viewport,i.content),u={...o,sizes:i,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function h(f,m){return function(x,g,p,b="ltr"){const y=pl(p),v=y/2,w=g||v,S=y-w,j=p.scrollbar.paddingStart+w,C=p.scrollbar.size-p.scrollbar.paddingEnd-S,_=p.content-p.viewport,E=b==="ltr"?[0,_]:[-1*_,0];return Mb([j,C],E)(x)}(f,a.current,i,m)}return n==="horizontal"?c.jsx(e6,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Tb(r.viewport.scrollLeft,i,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?c.jsx(t6,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Tb(r.viewport.scrollTop,i);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),e6=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=kn(Vn,t.__scopeScrollArea),[a,i]=T.useState(),l=T.useRef(null),d=ys(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(Eb,{"data-orientation":"horizontal",...r,ref:d,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":pl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),Ob(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ml(a.paddingLeft),paddingEnd:ml(a.paddingRight)}})}})}),t6=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=kn(Vn,t.__scopeScrollArea),[a,i]=T.useState(),l=T.useRef(null),d=ys(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(Eb,{"data-orientation":"vertical",...r,ref:d,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":pl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),Ob(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ml(a.paddingTop),paddingEnd:ml(a.paddingBottom)}})}})}),[n6,Nb]=wb(Vn),Eb=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:i,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:u,onResize:h,...f}=t,m=kn(Vn,n),[x,g]=T.useState(null),p=ys(e,E=>g(E)),b=T.useRef(null),y=T.useRef(""),v=m.viewport,w=o.content-o.viewport,S=Go(u),j=Go(l),C=gl(h,10);function _(E){if(b.current){const M=E.clientX-b.current.left,I=E.clientY-b.current.top;d({x:M,y:I})}}return T.useEffect(()=>{const E=M=>{const I=M.target;(x==null?void 0:x.contains(I))&&S(M,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[v,x,w,S]),T.useEffect(j,[o,j]),Lr(x,C),Lr(m.content,C),c.jsx(n6,{scope:n,scrollbar:x,hasThumb:r,onThumbChange:Go(s),onThumbPointerUp:Go(a),onThumbPositionChange:j,onThumbPointerDown:Go(i),children:c.jsx(gs.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Tn(t.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=x.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),_(E))}),onPointerMove:Tn(t.onPointerMove,_),onPointerUp:Tn(t.onPointerUp,E=>{const M=E.target;M.hasPointerCapture(E.pointerId)&&M.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),fl="ScrollAreaThumb",_b=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Nb(fl,t.__scopeScrollArea);return c.jsx(Tc,{present:n||r.hasThumb,children:c.jsx(o6,{ref:e,...o})})}),o6=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=kn(fl,n),a=Nb(fl,n),{onThumbPositionChange:i}=a,l=ys(e,h=>a.onThumbChange(h)),d=T.useRef(void 0),u=gl(()=>{d.current&&(d.current(),d.current=void 0)},100);return T.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(u(),!d.current){const m=s6(h,i);d.current=m,i()}};return i(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,u,i]),c.jsx(gs.div,{"data-state":a.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Tn(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,x=h.clientY-f.top;a.onThumbPointerDown({x:m,y:x})}),onPointerUp:Tn(t.onPointerUp,a.onThumbPointerUp)})});_b.displayName=fl;var Pu="ScrollAreaCorner",Ib=T.forwardRef((t,e)=>{const n=kn(Pu,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?c.jsx(r6,{...t,ref:e}):null});Ib.displayName=Pu;var r6=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=kn(Pu,n),[s,a]=T.useState(0),[i,l]=T.useState(0),d=!!(s&&i);return Lr(r.scrollbarX,()=>{var h;const u=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(u),l(u)}),Lr(r.scrollbarY,()=>{var h;const u=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(u),a(u)}),d?c.jsx(gs.div,{...o,ref:e,style:{width:s,height:i,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ml(t){return t?parseInt(t,10):0}function Ab(t,e){const n=t/e;return isNaN(n)?0:n}function pl(t){const e=Ab(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function Tb(t,e,n="ltr"){const o=pl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,i=s-o,l=oP(t,n==="ltr"?[0,a]:[-1*a,0]);return Mb([0,a],[0,i])(l)}function Mb(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 Ob(t,e){return t>0&&t<e}var s6=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},a=n.left!==s.left,i=n.top!==s.top;(a||i)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function gl(t,e){const n=Go(t),o=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(o.current),[]),T.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function Lr(t,e){const n=Go(e);nP(()=>{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 Db=kb,a6=Sb,i6=Ib;const Pb=T.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,a,i,l,d,u;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=xe("relative overflow-hidden",r),n[4]=r,n[5]=a):a=n[5],n[6]!==o?(i=c.jsx(a6,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Rb,{}),d=c.jsx(i6,{}),n[8]=l,n[9]=d):(l=n[8],d=n[9]),n[10]!==s||n[11]!==e||n[12]!==a||n[13]!==i?(u=c.jsxs(Db,{ref:e,className:a,...s,children:[i,l,d]}),n[10]=s,n[11]=e,n[12]=a,n[13]=i,n[14]=u):u=n[14],u});Pb.displayName=Db.displayName;const Rb=T.forwardRef((t,e)=>{const n=H.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0?"vertical":s,i=a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",l=a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px";let d,u,h;return n[4]!==o||n[5]!==i||n[6]!==l?(d=xe("flex touch-none select-none transition-colors",i,l,o),n[4]=o,n[5]=i,n[6]=l,n[7]=d):d=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(_b,{className:"relative flex-1 rounded-full bg-border"}),n[8]=u):u=n[8],n[9]!==a||n[10]!==r||n[11]!==e||n[12]!==d?(h=c.jsx(Ou,{ref:e,orientation:a,className:d,...r,children:u}),n[9]=a,n[10]=r,n[11]=e,n[12]=d,n[13]=h):h=n[13],h});Rb.displayName=Ou.displayName;let Ru;Ru=(t,e,n,o,r,s)=>{if(!e)return ft.warn("No active chat"),t;const a=t.chats.findIndex(h=>h.id===e);if(a===-1)return ft.warn("No active chat"),t;const i=t.chats[a],l=i.messages.findIndex(h=>h.id===n),d=[...t.chats],u=Date.now();if(l===-1)d[a]={...i,messages:[...i.messages,{id:n,role:o,content:r,timestamp:u,parts:s}],updatedAt:u};else{const h=[...i.messages];h[l]={...h[l],content:r,parts:s},d[a]={...i,messages:h,updatedAt:u}}return{...t,chats:d}},ln=t=>{const e=H.c(15),{title:n,description:o,icon:r,action:s}=t;let a,i,l,d,u,h;return e[0]!==r?(a=r&&q.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=a):a=e[1],e[2]!==n?(i=c.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=i):i=e[3],e[4]!==a||e[5]!==i?(l=c.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,i]}),e[4]=a,e[5]=i,e[6]=l):l=e[6],e[7]!==o?(d=c.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=d):d=e[8],e[9]!==s?(u=s&&c.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=u):u=e[10],e[11]!==l||e[12]!==d||e[13]!==u?(h=c.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,d,u]}),e[11]=l,e[12]=d,e[13]=u,e[14]=h):h=e[14],h};function lL(){}function cL(){}const l6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,d6={};function Lb(t,e){return(d6.jsx?c6:l6).test(t)}const u6=/[ \t\n\f\r]/g;function Fb(t){return t.replace(u6,"")===""}class sa{constructor(e,n,o){this.normal=n,this.property=e,o&&(this.space=o)}}function zb(t,e){const n={},o={};for(const r of t)Object.assign(n,r.property),Object.assign(o,r.normal);return new sa(n,o,e)}function Lu(t){return t.toLowerCase()}sa.prototype.normal={},sa.prototype.property={},sa.prototype.space=void 0;class en{constructor(e,n){this.attribute=n,this.property=e}}en.prototype.attribute="",en.prototype.booleanish=!1,en.prototype.boolean=!1,en.prototype.commaOrSpaceSeparated=!1,en.prototype.commaSeparated=!1,en.prototype.defined=!1,en.prototype.mustUseProperty=!1,en.prototype.number=!1,en.prototype.overloadedBoolean=!1,en.prototype.property="",en.prototype.spaceSeparated=!1,en.prototype.space=void 0;let h6=0;const Ge=ir(),Et=ir(),Fu=ir(),fe=ir(),ct=ir(),Fr=ir(),fn=ir();function ir(){return 2**++h6}const zu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:Et,commaOrSpaceSeparated:fn,commaSeparated:Fr,number:fe,overloadedBoolean:Fu,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),Bu=Object.keys(zu);class Uu extends en{constructor(e,n,o,r){let s=-1;if(super(e,n),Bb(this,"space",r),typeof o=="number")for(;++s<Bu.length;){const a=Bu[s];Bb(this,Bu[s],(o&zu[a])===zu[a])}}}function Bb(t,e,n){n&&(t[e]=n)}function zr(t){const e={},n={};for(const[o,r]of Object.entries(t.properties)){const s=new Uu(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[Lu(o)]=o,n[Lu(s.attribute)]=o}return new sa(e,n,t.space)}Uu.prototype.defined=!0;const Ub=zr({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:fe,ariaColIndex:fe,ariaColSpan:fe,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:ct,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:fe,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:fe,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:ct,ariaRowCount:fe,ariaRowIndex:fe,ariaRowSpan:fe,ariaSelected:Et,ariaSetSize:fe,ariaSort:null,ariaValueMax:fe,ariaValueMin:fe,ariaValueNow:fe,ariaValueText:null,role:null},transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase()});function $b(t,e){return e in t?t[e]:e}function Vb(t,e){return $b(t,e.toLowerCase())}const f6=zr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Fr,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:ct,autoFocus:Ge,autoPlay:Ge,blocking:ct,capture:null,charSet:null,checked:Ge,cite:null,className:ct,cols:fe,colSpan:null,content:null,contentEditable:Et,controls:Ge,controlsList:ct,coords:fe|Fr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Fu,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:ct,height:fe,hidden:Fu,high:fe,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:ct,itemRef:ct,itemScope:Ge,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:fe,manifest:null,max:null,maxLength:fe,media:null,method:null,min:null,minLength:fe,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,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:Ge,optimum:fe,pattern:null,ping:ct,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:ct,required:Ge,reversed:Ge,rows:fe,rowSpan:fe,sandbox:ct,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:fe,sizes:null,slot:null,span:fe,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:fe,step:null,style:null,tabIndex:fe,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:Et,width:fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:fe,borderColor:null,bottomMargin:fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:fe,leftMargin:fe,link:null,longDesc:null,lowSrc:null,marginHeight:fe,marginWidth:fe,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:fe,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:fe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:fe,security:null,unselectable:null},space:"html",transform:Vb}),m6=zr({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"},properties:{about:fn,accentHeight:fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:fe,amplitude:fe,arabicForm:null,ascent:fe,attributeName:null,attributeType:null,azimuth:fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:fe,by:null,calcMode:null,capHeight:fe,className:ct,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:fe,diffuseConstant:fe,direction:null,display:null,dur:null,divisor:fe,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:fe,enableBackground:null,end:null,event:null,exponent:fe,externalResourcesRequired:null,fill:null,fillOpacity:fe,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:Fr,g2:Fr,glyphName:Fr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:fe,horizOriginX:fe,horizOriginY:fe,id:null,ideographic:fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:fe,k:fe,k1:fe,k2:fe,k3:fe,k4:fe,kernelMatrix:fn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:fe,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:fe,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:fe,overlineThickness:fe,paintOrder:null,panose1:null,path:null,pathLength:fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:fe,pointsAtY:fe,pointsAtZ:fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fn,rev:fn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fn,requiredFeatures:fn,requiredFonts:fn,requiredFormats:fn,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:fe,specularExponent:fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:fe,strikethroughThickness:fe,string:null,stroke:null,strokeDashArray:fn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:fe,strokeOpacity:fe,strokeWidth:null,style:null,surfaceScale:fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fn,tabIndex:fe,tableValues:null,target:null,targetX:fe,targetY:fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:fe,underlineThickness:fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:fe,values:null,vAlphabetic:fe,vMathematical:fe,vectorEffect:null,vHanging:fe,vIdeographic:fe,version:null,vertAdvY:fe,vertOriginX:fe,vertOriginY:fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$b}),Hb=zr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase()}),Wb=zr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Vb}),qb=zr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase()}),p6={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"},g6=/[A-Z]/g,Gb=/-[a-z]/g,x6=/^data[-\w.:]+$/i;function b6(t){return"-"+t.toLowerCase()}function y6(t){return t.charAt(1).toUpperCase()}const v6=zb([Ub,f6,Hb,Wb,qb],"html"),$u=zb([Ub,m6,Hb,Wb,qb],"svg");var Yb,Br={},Kb,xl,Xb,aa={};function w6(){if(Kb)return aa;Kb=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,s=function(i,l){return l.toUpperCase()},a=function(i,l){return"".concat(l,"-")};return aa.camelCase=function(i,l){return l===void 0&&(l={}),function(d){return!d||n.test(d)||t.test(d)}(i)?i:(i=i.toLowerCase(),(i=l.reactCompat?i.replace(r,a):i.replace(o,a)).replace(e,s))},aa}var k6=function(){if(Xb)return xl;Xb=1;var t=(xl&&xl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}})(function(){if(Yb)return Br;Yb=1;var o=Br&&Br.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Br,"__esModule",{value:!0}),Br.default=function(s,a){var i=null;if(!s||typeof s!="string")return i;var l=(0,r.default)(s),d=typeof a=="function";return l.forEach(function(u){if(u.type==="declaration"){var h=u.property,f=u.value;d?a(h,f,u):f&&((i=i||{})[h]=f)}}),i};var r=o(rP());return Br}()),e=w6();function n(o,r){var s={};return o&&typeof o=="string"&&(0,t.default)(o,function(a,i){a&&i&&(s[(0,e.camelCase)(a,r)]=i)}),s}return n.default=n,xl=n}();const j6=B3(k6),Jb=Zb("end"),Vu=Zb("start");function Zb(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 ia(t){return t&&typeof t=="object"?"position"in t||"type"in t?Qb(t.position):"start"in t||"end"in t?Qb(t):"line"in t||"column"in t?Hu(t):"":""}function Hu(t){return ey(t&&t.line)+":"+ey(t&&t.column)}function Qb(t){return Hu(t&&t.start)+"-"+Hu(t&&t.end)}function ey(t){return t&&typeof t=="number"?t:1}class $t extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},a=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(a=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const i=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=i?i.line:void 0,this.name=ia(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}$t.prototype.file="",$t.prototype.name="",$t.prototype.reason="",$t.prototype.message="",$t.prototype.stack="",$t.prototype.column=void 0,$t.prototype.line=void 0,$t.prototype.ancestors=void 0,$t.prototype.cause=void 0,$t.prototype.fatal=void 0,$t.prototype.place=void 0,$t.prototype.ruleId=void 0,$t.prototype.source=void 0;const Wu={}.hasOwnProperty,S6=new Map,C6=/[A-Z]/g,N6=new Set(["table","tbody","thead","tfoot","tr"]),E6=new Set(["td","th"]),ty="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _6(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(a,i){return l;function l(d,u,h,f){const m=Array.isArray(h.children),x=Vu(d);return i(u,h,f,m,{columnNumber:x?x.column-1:void 0,fileName:a,lineNumber:x?x.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(a,i,l){return d;function d(u,h,f,m){const x=Array.isArray(f.children)?l:i;return m?x(h,f,m):x(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?$u:v6,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=ny(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function ny(t,e,n){return e.type==="element"?function(o,r,s){const a=o.schema;let i=a;r.tagName.toLowerCase()==="svg"&&a.space==="html"&&(i=$u,o.schema=i),o.ancestors.push(r);const l=ry(o,r.tagName,!1),d=function(h,f){const m={};let x,g;for(g in f.properties)if(g!=="children"&&Wu.call(f.properties,g)){const p=I6(h,g,f.properties[g]);if(p){const[b,y]=p;h.tableCellAlignToStyle&&b==="align"&&typeof y=="string"&&E6.has(f.tagName)?x=y:m[b]=y}}return x&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=x),m}(o,r);let u=Gu(o,r);return N6.has(r.tagName)&&(u=u.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&Fb(f.value):Fb(f));var f})),oy(o,d,l,r),qu(d,u),o.ancestors.pop(),o.schema=a,o.create(r,l,d,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}la(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const a=o.schema;let i=a;r.name==="svg"&&a.space==="html"&&(i=$u,o.schema=i),o.ancestors.push(r);const l=r.name===null?o.Fragment:ry(o,r.name,!0),d=function(h,f){const m={};for(const x of f.attributes)if(x.type==="mdxJsxExpressionAttribute")if(x.data&&x.data.estree&&h.evaluater){const g=x.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else la(h,f.position);else{const g=x.name;let p;if(x.value&&typeof x.value=="object")if(x.value.data&&x.value.data.estree&&h.evaluater){const b=x.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else la(h,f.position);else p=x.value===null||x.value;m[g]=p}return m}(o,r),u=Gu(o,r);return oy(o,d,l,r),qu(d,u),o.ancestors.pop(),o.schema=a,o.create(r,l,d,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);la(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const a={};return qu(a,Gu(o,r)),o.create(r,o.Fragment,a,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function oy(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function qu(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Gu(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:S6;for(;++o<e.children.length;){const s=e.children[o];let a;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const d=r.get(l)||0;a=l+"-"+d,r.set(l,d+1)}}const i=ny(t,s,a);i!==void 0&&n.push(i)}return n}function I6(t,e,n){const o=function(r,s){const a=Lu(s);let i=s,l=en;if(a in r.normal)return r.property[r.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&x6.test(s)){if(s.charAt(4)==="-"){const d=s.slice(5).replace(Gb,y6);i="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=s.slice(4);if(!Gb.test(d)){let u=d.replace(g6,b6);u.charAt(0)!=="-"&&(u="-"+u),s="data"+u}}l=Uu}return new l(i,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,a){try{return j6(a,{reactCompat:!0})}catch(i){if(s.ignoreInvalidStyle)return{};const l=i,d=new $t("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw d.file=s.filePath||void 0,d.url=ty+"#cannot-parse-style-attribute",d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const a={};let i;for(i in s)Wu.call(s,i)&&(a[A6(i)]=s[i]);return a}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?p6[o.property]||o.property:o.attribute,n]}}function ry(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,a=-1;for(;++a<r.length;){const i=Lb(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};s=s?{type:"MemberExpression",object:s,property:i,computed:!!(a&&i.type==="Literal"),optional:!1}:i}o=s}else o=Lb(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 Wu.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);la(t)}function la(t,e){const n=new $t("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=ty+"#cannot-handle-mdx-estrees-without-createevaluater",n}function A6(t){let e=t.replace(C6,T6);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function T6(t){return"-"+t.toLowerCase()}const Yu={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"]},bl={};function sy(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 ay(t.children,e,n)}return Array.isArray(t)?ay(t,e,n):""}function ay(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=sy(t[r],e,n);return o.join("")}const iy=document.createElement("i");function Ku(t){const e="&"+t+";";iy.innerHTML=e;const n=iy.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function Hn(t,e,n,o){const r=t.length;let s,a=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);a<o.length;)s=o.slice(a,a+1e4),s.unshift(e,0),t.splice(...s),a+=1e4,e+=1e4}function jn(t,e){return t.length>0?(Hn(t,t.length,0,e),t):e}const ly={}.hasOwnProperty;function M6(t,e){let n;for(n in e){const o=(ly.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){ly.call(o,s)||(o[s]=[]);const a=r[s];O6(o[s],Array.isArray(a)?a:a?[a]:[])}}}function O6(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);Hn(t,0,0,o)}function cy(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 Ur(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wn=Do(/[A-Za-z]/),mn=Do(/[\dA-Za-z]/),D6=Do(/[#-'*+\--9=?A-Z^-~]/);function Xu(t){return t!==null&&(t<32||t===127)}const Ju=Do(/\d/),P6=Do(/[\dA-Fa-f]/),R6=Do(/[!-/:-@[-`{-~]/);function Ue(t){return t!==null&&t<-2}function tn(t){return t!==null&&(t<0||t===32)}function rt(t){return t===-2||t===-1||t===32}const L6=Do(new RegExp("\\p{P}|\\p{S}","u")),F6=Do(/\s/);function Do(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function $r(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&mn(t.charCodeAt(n+1))&&mn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const i=t.charCodeAt(n+1);s<56320&&i>56319&&i<57344?(a=String.fromCharCode(s,i),r=1):a="\uFFFD"}else a=String.fromCharCode(s);a&&(e.push(t.slice(o,n),encodeURIComponent(a)),o=n+r+1,a=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function dt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(i){return rt(i)?(t.enter(n),a(i)):e(i)};function a(i){return rt(i)&&s++<r?(t.consume(i),a):(t.exit(n),e(i))}}const z6={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),dt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const a=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ue(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},B6={tokenize:function(t){const e=this,n=[];let o,r,s,a=0;return i;function i(v){if(a<n.length){const w=n[a];return e.containerState=w[1],t.attempt(w[0].continuation,l,d)(v)}return d(v)}function l(v){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&y();const w=e.events.length;let S,j=w;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){S=e.events[j][1].end;break}b(a);let C=w;for(;C<e.events.length;)e.events[C][1].end={...S},C++;return Hn(e.events,j+1,0,e.events.slice(w)),e.events.length=C,d(v)}return i(v)}function d(v){if(a===n.length){if(!o)return f(v);if(o.currentConstruct&&o.currentConstruct.concrete)return x(v);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(dy,u,h)(v)}function u(v){return o&&y(),b(a),f(v)}function h(v){return e.parser.lazy[e.now().line]=a!==n.length,s=e.now().offset,x(v)}function f(v){return e.containerState={},t.attempt(dy,m,x)(v)}function m(v){return a++,n.push([e.currentConstruct,e.containerState]),f(v)}function x(v){return v===null?(o&&y(),b(0),void t.consume(v)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(v))}function g(v){return v===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(v)):Ue(v)?(t.consume(v),p(t.exit("chunkFlow")),a=0,e.interrupt=void 0,i):(t.consume(v),g)}function p(v,w){const S=e.sliceStream(v);if(w&&S.push(null),v.previous=r,r&&(r.next=v),r=v,o.defineSkip(v.start),o.write(S),e.parser.lazy[v.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<s&&(!o.events[j][1].end||o.events[j][1].end.offset>s))return;const C=e.events.length;let _,E,M=C;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(_){E=e.events[M][1].end;break}_=!0}for(b(a),j=C;j<e.events.length;)e.events[j][1].end={...E},j++;Hn(e.events,M+1,0,e.events.slice(C)),e.events.length=j}}function b(v){let w=n.length;for(;w-- >v;){const S=n[w];e.containerState=S[1],S[0].exit.call(e,t)}n.length=v}function y(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},dy={tokenize:function(t,e,n){return dt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function uy(t){return t===null||tn(t)||F6(t)?1:L6(t)?2:void 0}function Zu(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const Qu={name:"attention",resolveAll:function(t,e){let n,o,r,s,a,i,l,d,u=-1;for(;++u<t.length;)if(t[u][0]==="enter"&&t[u][1].type==="attentionSequence"&&t[u][1]._close){for(n=u;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[u][1]).charCodeAt(0)){if((t[n][1]._close||t[u][1]._open)&&(t[u][1].end.offset-t[u][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[u][1].end.offset-t[u][1].start.offset)%3))continue;i=t[n][1].end.offset-t[n][1].start.offset>1&&t[u][1].end.offset-t[u][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[u][1].start};hy(h,-i),hy(f,i),s={type:i>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},a={type:i>1?"strongSequence":"emphasisSequence",start:{...t[u][1].start},end:f},r={type:i>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[u][1].start}},o={type:i>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[n][1].end={...s.start},t[u][1].start={...a.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=jn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=jn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=jn(l,Zu(e.parser.constructs.insideSpan.null,t.slice(n+1,u),e)),l=jn(l,[["exit",r,e],["enter",a,e],["exit",a,e],["exit",o,e]]),t[u][1].end.offset-t[u][1].start.offset?(d=2,l=jn(l,[["enter",t[u][1],e],["exit",t[u][1],e]])):d=0,Hn(t,n-1,u-n+3,l),u=n+l.length-d-2;break}}for(u=-1;++u<t.length;)t[u][1].type==="attentionSequence"&&(t[u][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=uy(o);let s;return function(i){return s=i,t.enter("attentionSequence"),a(i)};function a(i){if(i===s)return t.consume(i),a;const l=t.exit("attentionSequence"),d=uy(i),u=!d||d===2&&r||n.includes(i),h=!r||r===2&&d||n.includes(o);return l._open=!!(s===42?u:u&&(r||!h)),l._close=!!(s===42?h:h&&(d||!u)),e(i)}}};function hy(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const U6={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 Wn(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||mn(f)?(o=1,a(f)):l(f)}function a(f){return f===58?(t.consume(f),o=0,i):(f===43||f===45||f===46||mn(f))&&o++<32?(t.consume(f),a):(o=0,l(f))}function i(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||Xu(f)?n(f):(t.consume(f),i)}function l(f){return f===64?(t.consume(f),d):D6(f)?(t.consume(f),l):n(f)}function d(f){return mn(f)?u(f):n(f)}function u(f){return f===46?(t.consume(f),o=0,d):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||mn(f))&&o++<63){const m=f===45?h:u;return t.consume(f),m}return n(f)}}},yl={partial:!0,tokenize:function(t,e,n){return function(r){return rt(r)?dt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ue(r)?e(r):n(r)}}},fy={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return rt(s)?dt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(fy,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const a=o.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return rt(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},my={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 R6(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},py={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,a=0;return function(u){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),i};function i(u){return u===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(u),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=mn,d(u))}function l(u){return u===88||u===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(u),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=P6,d):(t.enter("characterReferenceValue"),r=7,s=Ju,d(u))}function d(u){if(u===59&&a){const h=t.exit("characterReferenceValue");return s!==mn||Ku(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(u)}return s(u)&&a++<r?(t.consume(u),d):n(u)}}},gy={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},xy={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(v,w,S){let j=0;return C;function C(D){return v.enter("lineEnding"),v.consume(D),v.exit("lineEnding"),_}function _(D){return v.enter("codeFencedFence"),rt(D)?dt(v,E,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===s?(v.enter("codeFencedFenceSequence"),M(D)):S(D)}function M(D){return D===s?(j++,v.consume(D),M):j>=i?(v.exit("codeFencedFenceSequence"),rt(D)?dt(v,I,"whitespace")(D):I(D)):S(D)}function I(D){return D===null||Ue(D)?(v.exit("codeFencedFence"),w(D)):S(D)}}};let s,a=0,i=0;return function(v){return function(w){const S=o.events[o.events.length-1];return a=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,s=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(w)}(v)};function l(v){return v===s?(i++,t.consume(v),l):i<3?n(v):(t.exit("codeFencedFenceSequence"),rt(v)?dt(t,d,"whitespace")(v):d(v))}function d(v){return v===null||Ue(v)?(t.exit("codeFencedFence"),o.interrupt?e(v):t.check(gy,m,y)(v)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),u(v))}function u(v){return v===null||Ue(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(v)):rt(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),dt(t,h,"whitespace")(v)):v===96&&v===s?n(v):(t.consume(v),u)}function h(v){return v===null||Ue(v)?d(v):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||Ue(v)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(v)):v===96&&v===s?n(v):(t.consume(v),f)}function m(v){return t.attempt(r,y,x)(v)}function x(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g}function g(v){return a>0&&rt(v)?dt(t,p,"linePrefix",a+1)(v):p(v)}function p(v){return v===null||Ue(v)?t.check(gy,m,y)(v):(t.enter("codeFlowValue"),b(v))}function b(v){return v===null||Ue(v)?(t.exit("codeFlowValue"),p(v)):(t.consume(v),b)}function y(v){return t.exit("codeFenced"),e(v)}}},eh={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),dt(t,r,"linePrefix",5)(l)};function r(l){const d=o.events[o.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?i(l):Ue(l)?t.attempt($6,s,i)(l):(t.enter("codeFlowValue"),a(l))}function a(l){return l===null||Ue(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),a)}function i(l){return t.exit("codeIndented"),e(l)}}},$6={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(a){return o.parser.lazy[o.now().line]?n(a):Ue(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),r):dt(t,s,"linePrefix",5)(a)}function s(a){const i=o.events[o.events.length-1];return i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(a):Ue(a)?r(a):n(a)}}},V6={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(u){return t.enter("codeText"),t.enter("codeTextSequence"),a(u)};function a(u){return u===96?(t.consume(u),s++,a):(t.exit("codeTextSequence"),i(u))}function i(u){return u===null?n(u):u===32?(t.enter("space"),t.consume(u),t.exit("space"),i):u===96?(r=t.enter("codeTextSequence"),o=0,d(u)):Ue(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),i):(t.enter("codeTextData"),l(u))}function l(u){return u===null||u===32||u===96||Ue(u)?(t.exit("codeTextData"),i(u)):(t.consume(u),l)}function d(u){return u===96?(t.consume(u),o++,d):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(u)):(r.type="codeTextData",l(u))}}};class H6{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&ca(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),ca(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ca(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);ca(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ca(this.left,n.reverse())}}}function ca(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 by(t){const e={};let n,o,r,s,a,i,l,d=-1;const u=new H6(t);for(;++d<u.length;){for(;d in e;)d=e[d];if(n=u.get(d),d&&n[1].type==="chunkFlow"&&u.get(d-1)[1].type==="listItemPrefix"&&(i=n[1]._tokenizer.events,r=0,r<i.length&&i[r][1].type==="lineEndingBlank"&&(r+=2),r<i.length&&i[r][1].type==="content"))for(;++r<i.length&&i[r][1].type!=="content";)i[r][1].type==="chunkText"&&(i[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,W6(u,d)),d=e[d],l=!0);else if(n[1]._container){for(r=d,o=void 0;r--;)if(s=u.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);else if(s[1].type!=="linePrefix"&&s[1].type!=="listItemIndent")break;o&&(n[1].end={...u.get(o)[1].start},a=u.slice(o,d),a.unshift(n),u.splice(o,d-o+1,a))}}return Hn(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function W6(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[];let a=n._tokenizer;a||(a=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const i=a.events,l=[],d={};let u,h,f=-1,m=n,x=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),h&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<i.length;)i[f][0]==="exit"&&i[f-1][0]==="enter"&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=i.slice(p[f],p[f+1]),y=s.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)d[x+l[f][0]]=x+l[f][1],x+=l[f][1]-l[f][0]-1;return d}const q6={resolve:function(t){return by(t),t},tokenize:function(t,e){let n;return function(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(a)};function o(a){return a===null?r(a):Ue(a)?t.check(G6,s,r)(a):(t.consume(a),o)}function r(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function s(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},G6={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),dt(t,r,"linePrefix")};function r(s){if(s===null||Ue(s))return n(s);const a=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function yy(t,e,n,o,r,s,a,i,l){const d=l||Number.POSITIVE_INFINITY;let u=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||Xu(p)?n(p):(t.enter(o),t.enter(a),t.enter(i),t.enter("chunkString",{contentType:"string"}),x(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(i),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(i),h(p)):p===null||p===60||Ue(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 x(p){return u||p!==null&&p!==41&&!tn(p)?u<d&&p===40?(t.consume(p),u++,x):p===41?(t.consume(p),u--,x):p===null||p===32||p===40||Xu(p)?n(p):(t.consume(p),p===92?g:x):(t.exit("chunkString"),t.exit(i),t.exit(a),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),x):x(p)}}function vy(t,e,n,o,r,s){const a=this;let i,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),d};function d(f){return l>999||f===null||f===91||f===93&&!i||f===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ue(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||Ue(f)||l++>999?(t.exit("chunkString"),d(f)):(t.consume(f),i||(i=!rt(f)),f===92?h:u)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,u):u(f)}}function wy(t,e,n,o,r,s){let a;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),a=h===40?41:h,i):n(h)};function i(h){return h===a?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===a?(t.exit(s),i(a)):h===null?n(h):Ue(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),dt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Ue(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?u:d)}function u(h){return h===a||h===92?(t.consume(h),d):d(h)}}function da(t,e){let n;return function o(r){return Ue(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):rt(r)?dt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const Y6={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return vy.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=Ur(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),a):n(h)}function a(h){return tn(h)?da(t,i)(h):i(h)}function i(h){return yy(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(K6,d,d)(h)}function d(h){return rt(h)?dt(t,u,"whitespace")(h):u(h)}function u(h){return h===null||Ue(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},K6={partial:!0,tokenize:function(t,e,n){return function(a){return tn(a)?da(t,o)(a):n(a)};function o(a){return wy(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function r(a){return rt(a)?dt(t,s,"whitespace")(a):s(a)}function s(a){return a===null||Ue(a)?e(a):n(a)}}},X6={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ue(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},J6={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},Hn(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(d){return t.enter("atxHeadingSequence"),r(d)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||tn(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),a(l)):l===null||Ue(l)?(t.exit("atxHeading"),e(l)):rt(l)?dt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),i(l))}function a(l){return l===35?(t.consume(l),a):(t.exit("atxHeadingSequence"),s(l))}function i(l){return l===null||l===35||tn(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),i)}}},Z6=["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"],ky=["pre","script","style","textarea"],Q6={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,a,i,l;return function(A){return function(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),d}(A)};function d(A){return A===33?(t.consume(A),u):A===47?(t.consume(A),s=!0,m):A===63?(t.consume(A),r=3,o.interrupt?e:N):Wn(A)?(t.consume(A),a=String.fromCharCode(A),x):n(A)}function u(A){return A===45?(t.consume(A),r=2,h):A===91?(t.consume(A),r=5,i=0,f):Wn(A)?(t.consume(A),r=4,o.interrupt?e:N):n(A)}function h(A){return A===45?(t.consume(A),o.interrupt?e:N):n(A)}function f(A){return A==="CDATA[".charCodeAt(i++)?(t.consume(A),i===6?o.interrupt?e:M:f):n(A)}function m(A){return Wn(A)?(t.consume(A),a=String.fromCharCode(A),x):n(A)}function x(A){if(A===null||A===47||A===62||tn(A)){const U=A===47,$=a.toLowerCase();return U||s||!ky.includes($)?Z6.includes(a.toLowerCase())?(r=6,U?(t.consume(A),g):o.interrupt?e(A):M(A)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(A):s?p(A):b(A)):(r=1,o.interrupt?e(A):M(A))}return A===45||mn(A)?(t.consume(A),a+=String.fromCharCode(A),x):n(A)}function g(A){return A===62?(t.consume(A),o.interrupt?e:M):n(A)}function p(A){return rt(A)?(t.consume(A),p):_(A)}function b(A){return A===47?(t.consume(A),_):A===58||A===95||Wn(A)?(t.consume(A),y):rt(A)?(t.consume(A),b):_(A)}function y(A){return A===45||A===46||A===58||A===95||mn(A)?(t.consume(A),y):v(A)}function v(A){return A===61?(t.consume(A),w):rt(A)?(t.consume(A),v):b(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),l=A,S):rt(A)?(t.consume(A),w):j(A)}function S(A){return A===l?(t.consume(A),l=null,C):A===null||Ue(A)?n(A):(t.consume(A),S)}function j(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||tn(A)?v(A):(t.consume(A),j)}function C(A){return A===47||A===62||rt(A)?b(A):n(A)}function _(A){return A===62?(t.consume(A),E):n(A)}function E(A){return A===null||Ue(A)?M(A):rt(A)?(t.consume(A),E):n(A)}function M(A){return A===45&&r===2?(t.consume(A),O):A===60&&r===1?(t.consume(A),P):A===62&&r===4?(t.consume(A),k):A===63&&r===3?(t.consume(A),N):A===93&&r===5?(t.consume(A),z):!Ue(A)||r!==6&&r!==7?A===null||Ue(A)?(t.exit("htmlFlowData"),I(A)):(t.consume(A),M):(t.exit("htmlFlowData"),t.check(eI,B,I)(A))}function I(A){return t.check(tI,D,B)(A)}function D(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),F}function F(A){return A===null||Ue(A)?I(A):(t.enter("htmlFlowData"),M(A))}function O(A){return A===45?(t.consume(A),N):M(A)}function P(A){return A===47?(t.consume(A),a="",R):M(A)}function R(A){if(A===62){const U=a.toLowerCase();return ky.includes(U)?(t.consume(A),k):M(A)}return Wn(A)&&a.length<8?(t.consume(A),a+=String.fromCharCode(A),R):M(A)}function z(A){return A===93?(t.consume(A),N):M(A)}function N(A){return A===62?(t.consume(A),k):A===45&&r===2?(t.consume(A),N):M(A)}function k(A){return A===null||Ue(A)?(t.exit("htmlFlowData"),B(A)):(t.consume(A),k)}function B(A){return t.exit("htmlFlow"),e(A)}}},eI={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(yl,e,n)}}},tI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ue(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},nI={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,a;return function(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),i};function i(k){return k===33?(t.consume(k),l):k===47?(t.consume(k),w):k===63?(t.consume(k),y):Wn(k)?(t.consume(k),C):n(k)}function l(k){return k===45?(t.consume(k),d):k===91?(t.consume(k),s=0,m):Wn(k)?(t.consume(k),b):n(k)}function d(k){return k===45?(t.consume(k),f):n(k)}function u(k){return k===null?n(k):k===45?(t.consume(k),h):Ue(k)?(a=u,R(k)):(t.consume(k),u)}function h(k){return k===45?(t.consume(k),f):u(k)}function f(k){return k===62?P(k):k===45?h(k):u(k)}function m(k){return k==="CDATA[".charCodeAt(s++)?(t.consume(k),s===6?x:m):n(k)}function x(k){return k===null?n(k):k===93?(t.consume(k),g):Ue(k)?(a=x,R(k)):(t.consume(k),x)}function g(k){return k===93?(t.consume(k),p):x(k)}function p(k){return k===62?P(k):k===93?(t.consume(k),p):x(k)}function b(k){return k===null||k===62?P(k):Ue(k)?(a=b,R(k)):(t.consume(k),b)}function y(k){return k===null?n(k):k===63?(t.consume(k),v):Ue(k)?(a=y,R(k)):(t.consume(k),y)}function v(k){return k===62?P(k):y(k)}function w(k){return Wn(k)?(t.consume(k),S):n(k)}function S(k){return k===45||mn(k)?(t.consume(k),S):j(k)}function j(k){return Ue(k)?(a=j,R(k)):rt(k)?(t.consume(k),j):P(k)}function C(k){return k===45||mn(k)?(t.consume(k),C):k===47||k===62||tn(k)?_(k):n(k)}function _(k){return k===47?(t.consume(k),P):k===58||k===95||Wn(k)?(t.consume(k),E):Ue(k)?(a=_,R(k)):rt(k)?(t.consume(k),_):P(k)}function E(k){return k===45||k===46||k===58||k===95||mn(k)?(t.consume(k),E):M(k)}function M(k){return k===61?(t.consume(k),I):Ue(k)?(a=M,R(k)):rt(k)?(t.consume(k),M):_(k)}function I(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),r=k,D):Ue(k)?(a=I,R(k)):rt(k)?(t.consume(k),I):(t.consume(k),F)}function D(k){return k===r?(t.consume(k),r=void 0,O):k===null?n(k):Ue(k)?(a=D,R(k)):(t.consume(k),D)}function F(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||tn(k)?_(k):(t.consume(k),F)}function O(k){return k===47||k===62||tn(k)?_(k):n(k)}function P(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function R(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),z}function z(k){return rt(k)?dt(t,N,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):N(k)}function N(k){return t.enter("htmlTextData"),a(k)}}},th={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&&Hn(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,a=t.length,i=0;for(;a--;)if(n=t[a][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[a][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[a][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=a,n.type!=="labelLink")){i=2;break}}else n.type==="labelEnd"&&(r=a);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},u={type:"labelText",start:{...t[o+i+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",d,e]],s=jn(s,t.slice(o+1,o+i+3)),s=jn(s,[["enter",u,e]]),s=jn(s,Zu(e.parser.constructs.insideSpan.null,t.slice(o+i+4,r-3),e)),s=jn(s,[["exit",u,e],t[r-2],t[r-1],["exit",d,e]]),s=jn(s,t.slice(r+1)),s=jn(s,[["exit",l,e]]),Hn(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,a=o.events.length;for(;a--;)if((o.events[a][1].type==="labelImage"||o.events[a][1].type==="labelLink")&&!o.events[a][1]._balanced){r=o.events[a][1];break}return function(h){return r?r._inactive?u(h):(s=o.parser.defined.includes(Ur(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),i):n(h)};function i(h){return h===40?t.attempt(oI,d,s?d:u)(h):h===91?t.attempt(rI,d,s?l:u)(h):s?d(h):u(h)}function l(h){return t.attempt(sI,d,u)(h)}function d(h){return e(h)}function u(h){return r._balanced=!0,n(h)}}},oI={tokenize:function(t,e,n){return function(u){return t.enter("resource"),t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),o};function o(u){return tn(u)?da(t,r)(u):r(u)}function r(u){return u===41?d(u):yy(t,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function s(u){return tn(u)?da(t,i)(u):d(u)}function a(u){return n(u)}function i(u){return u===34||u===39||u===40?wy(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function l(u){return tn(u)?da(t,d)(u):d(u)}function d(u){return u===41?(t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),t.exit("resource"),e):n(u)}}},rI={tokenize:function(t,e,n){const o=this;return function(a){return vy.call(o,t,r,s,"reference","referenceMarker","referenceString")(a)};function r(a){return o.parser.defined.includes(Ur(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function s(a){return n(a)}}},sI={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)}}},aI={name:"labelStartImage",resolveAll:th.resolveAll,tokenize:function(t,e,n){const o=this;return function(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),r};function r(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(a):e(a)}}},iI={name:"labelStartLink",resolveAll:th.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},nh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),dt(t,e,"linePrefix")}}},vl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(i){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(i)};function s(i){return i===o?(t.enter("thematicBreakSequence"),a(i)):r>=3&&(i===null||Ue(i))?(t.exit("thematicBreak"),e(i)):n(i)}function a(i){return i===o?(t.consume(i),r++,a):(t.exit("thematicBreakSequence"),rt(i)?dt(t,s,"whitespace")(i):s(i))}}},nn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(yl,r,s);function r(i){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,dt(t,e,"listItemIndent",o.containerState.size+1)(i)}function s(i){return o.containerState.furtherBlankLines||!rt(i)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,a(i)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(cI,e,a)(i))}function a(i){return o.containerState._closeFlow=!0,o.interrupt=void 0,dt(t,t.attempt(nn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,a=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:Ju(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(vl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),i(f)}return n(f)};function i(f){return Ju(f)&&++a<10?(t.consume(f),i):(!o.interrupt||a<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(yl,o.interrupt?n:d,t.attempt(lI,h,u))}function d(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function u(f){return rt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},lI={partial:!0,tokenize:function(t,e,n){const o=this;return dt(t,function(r){const s=o.events[o.events.length-1];return!rt(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},cI={partial:!0,tokenize:function(t,e,n){const o=this;return dt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},jy={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const a={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",a,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=a,t.push(["exit",a,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(i){let l,d=o.events.length;for(;d--;)if(o.events[d][1].type!=="lineEnding"&&o.events[d][1].type!=="linePrefix"&&o.events[d][1].type!=="content"){l=o.events[d][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=i,function(u){return t.enter("setextHeadingLineSequence"),s(u)}(i)):n(i)};function s(i){return i===r?(t.consume(i),s):(t.exit("setextHeadingLineSequence"),rt(i)?dt(t,a,"lineSuffix")(i):a(i))}function a(i){return i===null||Ue(i)?(t.exit("setextHeadingLine"),e(i)):n(i)}}},dI={tokenize:function(t){const e=this,n=t.attempt(yl,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,dt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(q6,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)}}},uI={resolveAll:Cy()},hI=Sy("string"),fI=Sy("text");function Sy(t){return{resolveAll:Cy(t==="text"?mI:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,a);return s;function s(d){return l(d)?r(d):a(d)}function a(d){if(d!==null)return e.enter("data"),e.consume(d),i;e.consume(d)}function i(d){return l(d)?(e.exit("data"),r(d)):(e.consume(d),i)}function l(d){if(d===null)return!0;const u=o[d];let h=-1;if(u)for(;++h<u.length;){const f=u[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Cy(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 mI(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,a=r.length,i=-1,l=0;for(;a--;){const d=r[a];if(typeof d=="string"){for(i=d.length;d.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(d===-2)s=!0,l++;else if(d!==-1){a++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?i:o.start._bufferIndex+i,_index:o.start._index+a,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...d.start},o.start.offset===o.end.offset?Object.assign(o,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const pI={42:nn,43:nn,45:nn,48:nn,49:nn,50:nn,51:nn,52:nn,53:nn,54:nn,55:nn,56:nn,57:nn,62:fy},gI={91:Y6},xI={[-2]:eh,[-1]:eh,32:eh},bI={35:J6,42:vl,45:[jy,vl],60:Q6,61:jy,95:vl,96:xy,126:xy},yI={38:py,92:my},vI={[-5]:nh,[-4]:nh,[-3]:nh,33:aI,38:py,42:Qu,60:[U6,nI],91:iI,92:[X6,my],93:th,95:Qu,96:V6},wI={null:[Qu,uI]},kI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:gI,disable:{null:[]},document:pI,flow:bI,flowInitial:xI,insideSpan:wI,string:yI,text:vI},Symbol.toStringTag,{value:"Module"}));function jI(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let a=[],i=[];const l={attempt:p(function(v,w){b(v,w.from)}),check:p(g),consume:function(v){Ue(v)?(o.line++,o.column=1,o.offset+=v===-3?2:1,y()):v!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===a[o._index].length&&(o._bufferIndex=-1,o._index++)),d.previous=v},enter:function(v,w){const S=w||{};return S.type=v,S.start=f(),d.events.push(["enter",S,d]),i.push(S),S},exit:function(v){const w=i.pop();return w.end=f(),d.events.push(["exit",w,d]),w},interrupt:p(g,{interrupt:!0})},d={code:null,containerState:{},defineSkip:function(v){r[v.line]=v.column,y()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(v,w){return function(S,j){let C=-1;const _=[];let E;for(;++C<S.length;){const M=S[C];let I;if(typeof M=="string")I=M;else switch(M){case-5:I="\r";break;case-4:I=`
|
129
|
-
`;break;case-3:I=`\r
|
130
|
-
`;break;case-2:I=j?" ":" ";break;case-1:if(!j&&E)continue;I=" ";break;default:I=String.fromCharCode(M)}E=M===-2,_.push(I)}return _.join("")}(h(v),w)},sliceStream:h,write:function(v){return a=jn(a,v),m(),a[a.length-1]!==null?[]:(b(e,0),d.events=Zu(s,d.events,d),d.events)}};let u=e.tokenize.call(d,l);return e.resolveAll&&s.push(e),d;function h(v){return function(w,S){const j=S.start._index,C=S.start._bufferIndex,_=S.end._index,E=S.end._bufferIndex;let M;if(j===_)M=[w[j].slice(C,E)];else{if(M=w.slice(j,_),C>-1){const I=M[0];typeof I=="string"?M[0]=I.slice(C):M.shift()}E>0&&M.push(w[_].slice(0,E))}return M}(a,v)}function f(){const{_bufferIndex:v,_index:w,line:S,column:j,offset:C}=o;return{_bufferIndex:v,_index:w,line:S,column:j,offset:C}}function m(){let v;for(;o._index<a.length;){const w=a[o._index];if(typeof w=="string")for(v=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===v&&o._bufferIndex<w.length;)x(w.charCodeAt(o._bufferIndex));else x(w)}}function x(v){u=u(v)}function g(v,w){w.restore()}function p(v,w){return function(S,j,C){let _,E,M,I;return Array.isArray(S)?D(S):"tokenize"in S?D([S]):function(R){return z;function z(N){const k=N!==null&&R[N],B=N!==null&&R.null;return D([...Array.isArray(k)?k:k?[k]:[],...Array.isArray(B)?B:B?[B]:[]])(N)}}(S);function D(R){return _=R,E=0,R.length===0?C:F(R[E])}function F(R){return function(z){return I=function(){const N=f(),k=d.previous,B=d.currentConstruct,A=d.events.length,U=Array.from(i);return{from:A,restore:$};function $(){o=N,d.previous=k,d.currentConstruct=B,d.events.length=A,i=U,y()}}(),M=R,R.partial||(d.currentConstruct=R),R.name&&d.parser.constructs.disable.null.includes(R.name)?P():R.tokenize.call(w?Object.assign(Object.create(d),w):d,l,O,P)(z)}}function O(R){return v(M,I),j}function P(R){return I.restore(),++E<_.length?F(_[E]):C}}}function b(v,w){v.resolveAll&&!s.includes(v)&&s.push(v),v.resolve&&Hn(d.events,w,d.events.length-w,v.resolve(d.events.slice(w),d)),v.resolveTo&&(d.events=v.resolveTo(d.events,d))}function y(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function SI(t){const e=function(r){const s={};let a=-1;for(;++a<r.length;)M6(s,r[a]);return s}([kI,...(t||{}).extensions||[]]),n={constructs:e,content:o(z6),defined:[],document:o(B6),flow:o(dI),lazy:{},string:o(hI),text:o(fI)};return n;function o(r){return function(s){return jI(n,r,s)}}}const Ny=/[\0\t\n\r]/g,CI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NI(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return cy(n.slice(r?2:1),r?16:10)}return Ku(n)||t}const Ey={}.hasOwnProperty;function EI(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(Te),autolinkProtocol:D,autolinkEmail:D,atxHeading:l(oe),blockQuote:l(ne),characterEscape:D,characterReference:D,codeFenced:l(ae),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:l(ae,d),codeText:l(se,d),codeTextData:D,data:D,codeFlowValue:D,definition:l(ie),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:l(ge),hardBreakEscape:l(ue),hardBreakTrailing:l(ue),htmlFlow:l(de,d),htmlFlowData:D,htmlText:l(de,d),htmlTextData:D,image:l(Ce),label:d,link:l(Te),listItem:l(_e),listItemValue:g,listOrdered:l(Fe,x),listUnordered:l(Fe),paragraph:l(ke),reference:G,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:l(oe),strong:l(Ye),thematicBreak:l(Ke)},exit:{atxHeading:h(),atxHeadingSequence:_,autolink:h(),autolinkEmail:re,autolinkProtocol:te,blockQuote:h(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:V,characterReference:Q,codeFenced:h(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:F,codeIndented:h(w),codeText:h(N),codeTextData:F,data:F,definition:h(),definitionDestinationString:C,definitionLabelString:S,definitionTitleString:j,emphasis:h(),hardBreakEscape:h(P),hardBreakTrailing:h(P),htmlFlow:h(R),htmlFlowData:F,htmlText:h(z),htmlTextData:F,image:h(B),label:U,labelText:A,lineEnding:O,link:h(k),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:W,resourceDestinationString:$,resourceTitleString:X,resource:Y,setextHeading:h(I),setextHeadingLineSequence:M,setextHeadingText:E,strong:h(),thematicBreak:h()}};_y(r,(o||{}).mdastExtensions||[]);const s={};return a;function a(ee){let ye={type:"root",children:[]};const we={stack:[ye],tokenStack:[],config:r,enter:u,exit:f,buffer:d,resume:m,data:s},Ie=[];let K=-1;for(;++K<ee.length;)(ee[K][1].type==="listOrdered"||ee[K][1].type==="listUnordered")&&(ee[K][0]==="enter"?Ie.push(K):K=i(ee,Ie.pop(),K));for(K=-1;++K<ee.length;){const me=r[ee[K][0]];Ey.call(me,ee[K][1].type)&&me[ee[K][1].type].call(Object.assign({sliceSerialize:ee[K][2].sliceSerialize},we),ee[K][1])}if(we.tokenStack.length>0){const me=we.tokenStack[we.tokenStack.length-1];(me[1]||Iy).call(we,void 0,me[0])}for(ye.position={start:Po(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Po(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<r.transforms.length;)ye=r.transforms[K](ye)||ye;return ye}function i(ee,ye,we){let Ie,K,me,pe,he=ye-1,je=-1,Pe=!1;for(;++he<=we;){const Re=ee[he];switch(Re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Re[0]==="enter"?je++:je--,pe=void 0;break;case"lineEndingBlank":Re[0]==="enter"&&(!Ie||pe||je||me||(me=he),pe=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pe=void 0}if(!je&&Re[0]==="enter"&&Re[1].type==="listItemPrefix"||je===-1&&Re[0]==="exit"&&(Re[1].type==="listUnordered"||Re[1].type==="listOrdered")){if(Ie){let He=he;for(K=void 0;He--;){const le=ee[He];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;K&&(ee[K][1].type="lineEndingBlank",Pe=!0),le[1].type="lineEnding",K=He}else if(le[1].type!=="linePrefix"&&le[1].type!=="blockQuotePrefix"&&le[1].type!=="blockQuotePrefixWhitespace"&&le[1].type!=="blockQuoteMarker"&&le[1].type!=="listItemIndent")break}me&&(!K||me<K)&&(Ie._spread=!0),Ie.end=Object.assign({},K?ee[K][1].start:Re[1].end),ee.splice(K||he,0,["exit",Ie,Re[2]]),he++,we++}if(Re[1].type==="listItemPrefix"){const He={type:"listItem",_spread:!1,start:Object.assign({},Re[1].start),end:void 0};Ie=He,ee.splice(he,0,["enter",He,Re[2]]),he++,we++,me=void 0,pe=!0}}}return ee[ye][1]._spread=Pe,we}function l(ee,ye){return we;function we(Ie){u.call(this,ee(Ie),Ie),ye&&ye.call(this,Ie)}}function d(){this.stack.push({type:"fragment",children:[]})}function u(ee,ye,we){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([ye,we||void 0]),ee.position={start:Po(ye.start),end:void 0}}function h(ee){return ye;function ye(we){ee&&ee.call(this,we),f.call(this,we)}}function f(ee,ye){const we=this.stack.pop(),Ie=this.tokenStack.pop();if(!Ie)throw new Error("Cannot close `"+ee.type+"` ("+ia({start:ee.start,end:ee.end})+"): it\u2019s not open");Ie[0].type!==ee.type&&(ye?ye.call(this,ee,Ie[0]):(Ie[1]||Iy).call(this,ee,Ie[0])),we.position.end=Po(ee.end)}function m(){return function(ee){return sy(ee,typeof bl.includeImageAlt!="boolean"||bl.includeImageAlt,typeof bl.includeHtml!="boolean"||bl.includeHtml)}(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function g(ee){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0)}function p(){const ee=this.resume();this.stack[this.stack.length-1].lang=ee}function b(){const ee=this.resume();this.stack[this.stack.length-1].meta=ee}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ee=this.resume();this.stack[this.stack.length-1].value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ee=this.resume();this.stack[this.stack.length-1].value=ee.replace(/(\r?\n|\r)$/g,"")}function S(ee){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Ur(this.sliceSerialize(ee)).toLowerCase()}function j(){const ee=this.resume();this.stack[this.stack.length-1].title=ee}function C(){const ee=this.resume();this.stack[this.stack.length-1].url=ee}function _(ee){const ye=this.stack[this.stack.length-1];if(!ye.depth){const we=this.sliceSerialize(ee).length;ye.depth=we}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function M(ee){this.stack[this.stack.length-1].depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function D(ee){const ye=this.stack[this.stack.length-1].children;let we=ye[ye.length-1];we&&we.type==="text"||(we=Ve(),we.position={start:Po(ee.start),end:void 0},ye.push(we)),this.stack.push(we)}function F(ee){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ee),ye.position.end=Po(ee.end)}function O(ee){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ye.children[ye.children.length-1].position.end=Po(ee.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ye.type)&&(D.call(this,ee),F.call(this,ee))}function P(){this.data.atHardBreak=!0}function R(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function z(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function N(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function k(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ye,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function B(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ye,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function A(ee){const ye=this.sliceSerialize(ee),we=this.stack[this.stack.length-2];we.label=function(Ie){return Ie.replace(CI,NI)}(ye),we.identifier=Ur(ye).toLowerCase()}function U(){const ee=this.stack[this.stack.length-1],ye=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Ie=ee.children;we.children=Ie}else we.alt=ye}function $(){const ee=this.resume();this.stack[this.stack.length-1].url=ee}function X(){const ee=this.resume();this.stack[this.stack.length-1].title=ee}function Y(){this.data.inReference=void 0}function G(){this.data.referenceType="collapsed"}function W(ee){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Ur(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function J(ee){this.data.characterReferenceType=ee.type}function V(ee){const ye=this.sliceSerialize(ee),we=this.data.characterReferenceType;let Ie;we?(Ie=cy(ye,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=Ku(ye),this.stack[this.stack.length-1].value+=Ie}function Q(ee){this.stack.pop().position.end=Po(ee.end)}function te(ee){F.call(this,ee),this.stack[this.stack.length-1].url=this.sliceSerialize(ee)}function re(ee){F.call(this,ee),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(ee)}function ne(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function se(){return{type:"inlineCode",value:""}}function ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function ue(){return{type:"break"}}function de(){return{type:"html",value:""}}function Ce(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function Fe(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function _e(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function ke(){return{type:"paragraph",children:[]}}function Ye(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function Ke(){return{type:"thematicBreak"}}}(n)(function(o){for(;!by(o););return o}(SI(n).document().write(function(){let o,r=1,s="",a=!0;return function(i,l,d){const u=[];let h,f,m,x,g;for(i=s+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),m=0,s="",a&&(i.charCodeAt(0)===65279&&m++,a=void 0);m<i.length;){if(Ny.lastIndex=m,h=Ny.exec(i),x=h&&h.index!==void 0?h.index:i.length,g=i.charCodeAt(x),!h){s=i.slice(m);break}if(g===10&&m===x&&o)u.push(-3),o=void 0;else switch(o&&(u.push(-5),o=void 0),m<x&&(u.push(i.slice(m,x)),r+=x-m),g){case 0:u.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),u.push(-2);r++<f;)u.push(-1);break;case 10:u.push(-4),r=1;break;default:o=!0,r=1}m=x+1}return d&&(o&&u.push(-5),s&&u.push(s),u.push(null)),u}}()(t,e,!0))))}function Po(t){return{line:t.line,column:t.column,offset:t.offset}}function _y(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?_y(t,o):_I(t,o)}}function _I(t,e){let n;for(n in e)if(Ey.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 Iy(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ia({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ia({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ia({start:e.start,end:e.end})+") is still open")}function II(t){const e=this;e.parser=function(n){return EI(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Ay(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const a=r[r.length-1];return a&&a.type==="text"?a.value+=o:r.push({type:"text",value:o}),r}function Ty(t){const e=t.spread;return e??t.children.length>1}function AI(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(My(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(My(e.slice(r),r>0,!1)),s.join("")}function My(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const TI={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:`
|
131
|
-
`}]},code:function(t,e){const n=e.value?e.value+`
|
132
|
-
`:"",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=$r(o.toLowerCase()),s=t.footnoteOrder.indexOf(o);let a,i=t.footnoteCounts.get(o);i===void 0?(i=0,t.footnoteOrder.push(o),a=t.footnoteOrder.length):a=s+1,i+=1,t.footnoteCounts.set(o,i);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const d={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,d),t.applyData(e,d)},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 Ay(t,e);const r={src:$r(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,s),t.applyData(e,s)},image:function(t,e){const n={src:$r(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 Ay(t,e);const r={href:$r(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)},link:function(t,e){const n={href:$r(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(u){let h=!1;if(u.type==="list"){h=u.spread||!1;const f=u.children;let m=-1;for(;!h&&++m<f.length;)h=Ty(f[m])}return h}(n):Ty(e),s={},a=[];if(typeof e.checked=="boolean"){const u=o[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},o.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let i=-1;for(;++i<o.length;){const u=o[i];(r||i!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
|
133
|
-
`}),u.type!=="element"||u.tagName!=="p"||r?a.push(u):a.push(...u.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
|
134
|
-
`});const d={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,d),t.applyData(e,d)},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 a=o[r];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],a),r.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},i=Vu(e.children[1]),l=Jb(e.children[e.children.length-1]);i&&l&&(a.position={start:i,end:l}),r.push(a)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let i=-1;const l=[];for(;++i<a;){const u=e.children[i],h={},f=s?s[i]:void 0;f&&(h.align=f);let m={type:"element",tagName:r,properties:h,children:[]};u&&(m.children=t.all(u),t.patch(u,m),m=t.applyData(u,m)),l.push(m)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,d),t.applyData(e,d)},text:function(t,e){const n={type:"text",value:AI(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:wl,yaml:wl,definition:wl,footnoteDefinition:wl};function wl(){}const Oy=typeof self=="object"?self:globalThis,Dy=t=>((e,n)=>{const o=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,i]=n[s];switch(a){case 0:case-1:return o(i,s);case 1:{const l=o([],s);for(const d of i)l.push(r(d));return l}case 2:{const l=o({},s);for(const[d,u]of i)l[r(d)]=r(u);return l}case 3:return o(new Date(i),s);case 4:{const{source:l,flags:d}=i;return o(new RegExp(l,d),s)}case 5:{const l=o(new Map,s);for(const[d,u]of i)l.set(r(d),r(u));return l}case 6:{const l=o(new Set,s);for(const d of i)l.add(r(d));return l}case 7:{const{name:l,message:d}=i;return o(new Oy[l](d),s)}case 8:return o(BigInt(i),s);case"BigInt":return o(Object(BigInt(i)),s);case"ArrayBuffer":return o(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return o(new DataView(l),i)}}return o(new Oy[a](i),s)};return r})(new Map,t)(0),Vr="",{toString:MI}={},{keys:OI}=Object,ua=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=MI.call(t).slice(8,-1);switch(n){case"Array":return[1,Vr];case"Object":return[2,Vr];case"Date":return[3,Vr];case"RegExp":return[4,Vr];case"Map":return[5,Vr];case"Set":return[6,Vr];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},kl=([t,e])=>t===0&&(e==="function"||e==="symbol"),Py=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,a,i)=>{const l=(u,h)=>{const f=i.push(u)-1;return a.set(h,f),f},d=u=>{if(a.has(u))return a.get(u);let[h,f]=ua(u);switch(h){case 0:{let x=u;switch(f){case"bigint":h=8,x=u.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);x=null;break;case"undefined":return l([-1],u)}return l([h,x],u)}case 1:{if(f){let p=u;return f==="DataView"?p=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(p=new Uint8Array(u)),l([f,[...p]],u)}const x=[],g=l([h,x],u);for(const p of u)x.push(d(p));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,u.toString()],u);case"Boolean":case"Number":case"String":return l([f,u.valueOf()],u)}if(s&&"toJSON"in u)return d(u.toJSON());const x=[],g=l([h,x],u);for(const p of OI(u))!r&&kl(ua(u[p]))||x.push([d(p),d(u[p])]);return g}case 3:return l([h,u.toISOString()],u);case 4:{const{source:x,flags:g}=u;return l([h,{source:x,flags:g}],u)}case 5:{const x=[],g=l([h,x],u);for(const[p,b]of u)(r||!kl(ua(p))&&!kl(ua(b)))&&x.push([d(p),d(b)]);return g}case 6:{const x=[],g=l([h,x],u);for(const p of u)!r&&kl(ua(p))||x.push(d(p));return g}}const{message:m}=u;return l([h,{name:f,message:m}],u)};return d})(!(e||n),!!e,new Map,o)(t),o},jl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Dy(Py(t,e)):structuredClone(t):(t,e)=>Dy(Py(t,e));function DI(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 PI(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const Ry=function(t){if(t==null)return RI;if(typeof t=="function")return Sl(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=Ry(e[o]);return Sl(r);function r(...s){let a=-1;for(;++a<n.length;)if(n[a].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return Sl(o);function o(r){const s=r;let a;for(a in e)if(s[a]!==n[a])return!1;return!0}}(t);if(typeof t=="string")return function(e){return Sl(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function Sl(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 RI(){return!0}const Ly=[],LI=!0,Fy=!1;function FI(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=Ry(r),a=o?-1:1;(function i(l,d,u){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(m?"<"+m+">":"")+")"})}return f;function f(){let m,x,g,p=Ly;if((!e||s(l,d,u[u.length-1]||void 0))&&(p=function(b){return Array.isArray(b)?b:typeof b=="number"?[LI,b]:b==null?Ly:[b]}(n(l,u)),p[0]===Fy))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!=="skip")for(x=(o?b.children.length:-1)+a,g=u.concat(b);x>-1&&x<b.children.length;){const y=b.children[x];if(m=i(y,x,g)(),m[0]===Fy)return m;x=typeof m[1]=="number"?m[1]:x+a}}return p}})(t,void 0,[])()}function zy(t,e,n,o){let r,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,r=n):(s=e,a=n,r=o),FI(t,s,function(i,l){const d=l[l.length-1],u=d?d.children.indexOf(i):void 0;return a(i,u,d)},r)}const oh={}.hasOwnProperty,zI={};function BI(t,e){t.position&&(e.position=function(n){const o=Vu(n),r=Jb(n);if(o&&r)return{start:o,end:r}}(t))}function UI(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,jl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function $I(t,e){const n=e.data||{},o=!("value"in e)||oh.call(n,"hProperties")||oh.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 VI(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
|
135
|
-
`});++o<t.length;)o&&n.push({type:"text",value:`
|
136
|
-
`}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
|
137
|
-
`}),n}function By(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Uy(t,e){const n=function(a,i){const l=i||zI,d=new Map,u=new Map,h=new Map,f={...TI,...l.handlers},m={all:function(x){const g=[];if("children"in x){const p=x.children;let b=-1;for(;++b<p.length;){const y=m.one(p[b],x);if(y){if(b&&p[b-1].type==="break"&&(Array.isArray(y)||y.type!=="text"||(y.value=By(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=By(v.value))}Array.isArray(y)?g.push(...y):g.push(y)}}}return g},applyData:UI,definitionById:d,footnoteById:u,footnoteCounts:h,footnoteOrder:[],handlers:f,one:function(x,g){const p=x.type,b=m.handlers[p];if(oh.call(m.handlers,p)&&b)return b(m,x,g);if(m.options.passThrough&&m.options.passThrough.includes(p)){if("children"in x){const{children:y,...v}=x,w=jl(v);return w.children=m.all(x),w}return jl(x)}return(m.options.unknownHandler||$I)(m,x,g)},options:l,patch:BI,wrap:VI};return zy(a,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const g=x.type==="definition"?d:u,p=String(x.identifier).toUpperCase();g.has(p)||g.set(p,x)}}),m}(t,e),o=n.one(t,void 0),r=function(a){const i=typeof a.options.clobberPrefix=="string"?a.options.clobberPrefix:"user-content-",l=a.options.footnoteBackContent||DI,d=a.options.footnoteBackLabel||PI,u=a.options.footnoteLabel||"Footnotes",h=a.options.footnoteLabelTagName||"h2",f=a.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<a.footnoteOrder.length;){const g=a.footnoteById.get(a.footnoteOrder[x]);if(!g)continue;const p=a.all(g),b=String(g.identifier).toUpperCase(),y=$r(b.toLowerCase());let v=0;const w=[],S=a.footnoteCounts.get(b);for(;S!==void 0&&++v<=S;){w.length>0&&w.push({type:"text",value:" "});let _=typeof l=="string"?l:l(x,v);typeof _=="string"&&(_={type:"text",value:_}),w.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof d=="string"?d:d(x,v),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const j=p[p.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const _=j.children[j.children.length-1];_&&_.type==="text"?_.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...w)}else p.push(...w);const C={type:"element",tagName:"li",properties:{id:i+"fn-"+y},children:a.wrap(p,!0)};a.patch(g,C),m.push(C)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:h,properties:{...jl(f),id:"footnote-label"},children:[{type:"text",value:u}]},{type:"text",value:`
|
138
|
-
`},{type:"element",tagName:"ol",properties:{},children:a.wrap(m,!0)},{type:"text",value:`
|
139
|
-
`}]}}(n),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&s.children.push({type:"text",value:`
|
140
|
-
`},r),s}function HI(t,e){return t&&"run"in t?async function(n,o){const r=Uy(n,{file:o,...e});await t.run(r,o)}:function(n,o){return Uy(n,{file:o,...t||e})}}function $y(t){if(t)throw t}var rh,Vy,WI=function(){if(Vy)return rh;Vy=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var d,u=t.call(l,"constructor"),h=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!u&&!h)return!1;for(d in l);return d===void 0||t.call(l,d)},a=function(l,d){n&&d.name==="__proto__"?n(l,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):l[d.name]=d.newValue},i=function(l,d){if(d==="__proto__"){if(!t.call(l,d))return;if(o)return o(l,d).value}return l[d]};return rh=function l(){var d,u,h,f,m,x,g=arguments[0],p=1,b=arguments.length,y=!1;for(typeof g=="boolean"&&(y=g,g=arguments[1]||{},p=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});p<b;++p)if((d=arguments[p])!=null)for(u in d)h=i(g,u),g!==(f=i(d,u))&&(y&&f&&(s(f)||(m=r(f)))?(m?(m=!1,x=h&&r(h)?h:[]):x=h&&s(h)?h:{},a(g,{name:u,newValue:l(y,x,f)})):f!==void 0&&a(g,{name:u,newValue:f}));return g},rh}();const sh=B3(WI);function ah(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function qI(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(a,...i){const l=t[++o];let d=-1;if(a)r(a);else{for(;++d<n.length;)i[d]!==null&&i[d]!==void 0||(i[d]=n[d]);n=i,l?function(u,h){let f;return m;function m(...p){const b=u.length>p.length;let y;b&&p.push(x);try{y=u.apply(this,p)}catch(v){if(b&&f)throw v;return x(v)}b||(y&&y.then&&typeof y.then=="function"?y.then(g,x):y instanceof Error?x(y):g(y))}function x(p,...b){f||(f=!0,h(p,...b))}function g(p){x(null,p)}}(l,s)(...i):r(null,...i)}})(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 qn={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ha(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let a=-1,i=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else a<0&&(n=!0,a=s+1),i>-1&&(t.codePointAt(s)===e.codePointAt(i--)?i<0&&(r=s):(i=-1,r=a));return o===r?r=a:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(ha(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){ha(t);let e,n=t.length,o=-1,r=0,s=-1,a=0;for(;n--;){const i=t.codePointAt(n);if(i!==47)o<0&&(e=!0,o=n+1),i===46?s<0?s=n:a!==1&&(a=1):s>-1&&(a=-1);else if(e){r=n+1;break}}return s<0||o<0||a===0||a===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)ha(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){ha(o);const r=o.codePointAt(0)===47;let s=function(a,i){let l,d,u="",h=0,f=-1,m=0,x=-1;for(;++x<=a.length;){if(x<a.length)l=a.codePointAt(x);else{if(l===47)break;l=47}if(l===47){if(!(f===x-1||m===1))if(f!==x-1&&m===2){if(u.length<2||h!==2||u.codePointAt(u.length-1)!==46||u.codePointAt(u.length-2)!==46){if(u.length>2){if(d=u.lastIndexOf("/"),d!==u.length-1){d<0?(u="",h=0):(u=u.slice(0,d),h=u.length-1-u.lastIndexOf("/")),f=x,m=0;continue}}else if(u.length>0){u="",h=0,f=x,m=0;continue}}i&&(u=u.length>0?u+"/..":"..",h=2)}else u.length>0?u+="/"+a.slice(f+1,x):u=a.slice(f+1,x),h=x-f-1;f=x,m=0}else l===46&&m>-1?m++:m=-1}return u}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function ha(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const GI={cwd:function(){return"/"}};function ih(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function YI(t){if(typeof t=="string")t=new URL(t);else if(!ih(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const lh=["history","path","basename","stem","extname","dirname"];class Hy{constructor(e){let n;n=e?ih(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":GI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<lh.length;){const s=lh[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)lh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?qn.basename(this.path):void 0}set basename(e){dh(e,"basename"),ch(e,"basename"),this.path=qn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?qn.dirname(this.path):void 0}set dirname(e){Wy(this.basename,"dirname"),this.path=qn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?qn.extname(this.path):void 0}set extname(e){if(ch(e,"extname"),Wy(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=qn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ih(e)&&(e=YI(e)),dh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?qn.basename(this.path,this.extname):void 0}set stem(e){dh(e,"stem"),ch(e,"stem"),this.path=qn.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 $t(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 ch(t,e){if(t&&t.includes(qn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+qn.sep+"`")}function dh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Wy(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const KI=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},XI={}.hasOwnProperty;class uh extends KI{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=qI()}copy(){const e=new uh;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(sh(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(mh("data",this.frozen),this.namespace[e]=n,this):XI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(mh("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=Cl(e),o=this.parser||this.Parser;return hh("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),hh("process",this.parser||this.Parser),fh("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,a){const i=Cl(e),l=o.parse(i);function d(u,h){u||!h?a(u):s?s(h):n(void 0,h)}o.run(l,i,function(u,h,f){if(u||!h||!f)return d(u);const m=h,x=o.stringify(m,f);var g;typeof(g=x)=="string"||function(p){return!!(p&&typeof p=="object"&&"byteLength"in p&&"byteOffset"in p)}(g)?f.value=x:f.result=x,d(u,f)})}}processSync(e){let n,o=!1;return this.freeze(),hh("processSync",this.parser||this.Parser),fh("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,$y(r),n=s}),Gy("processSync","process",o),n}run(e,n,o){qy(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(a,i){const l=Cl(n);r.run(e,l,function(d,u,h){const f=u||e;d?i(d):a?a(f):o(void 0,f,h)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,a){$y(s),o=a,r=!0}),Gy("runSync","run",r),o}stringify(e,n){this.freeze();const o=Cl(n),r=this.compiler||this.Compiler;return fh("stringify",r),qy(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(mh("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)?i(e):a(e)}return this;function s(d){if(typeof d=="function")l(d,[]);else{if(typeof d!="object")throw new TypeError("Expected usable value, not `"+d+"`");if(Array.isArray(d)){const[u,...h]=d;l(u,h)}else a(d)}}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(d.plugins),d.settings&&(r.settings=sh(!0,r.settings,d.settings))}function i(d){let u=-1;if(d!=null){if(!Array.isArray(d))throw new TypeError("Expected a list of plugins, not `"+d+"`");for(;++u<d.length;)s(d[u])}}function l(d,u){let h=-1,f=-1;for(;++h<o.length;)if(o[h][0]===d){f=h;break}if(f===-1)o.push([d,...u]);else if(u.length>0){let[m,...x]=u;const g=o[f][1];ah(g)&&ah(m)&&(m=sh(!0,g,m)),o[f]=[d,m,...x]}}}}const JI=new uh().freeze();function hh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function fh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function mh(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 qy(t){if(!ah(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Gy(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Cl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new Hy(t)}const Yy=[],Ky={allowDangerousHtml:!0},ZI=/^(https?|ircs?|mailto|xmpp)$/i,QI=[{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 e8(t){const e=function(o){const r=o.rehypePlugins||Yy,s=o.remarkPlugins||Yy,a=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...Ky}:Ky;return JI().use(II).use(s).use(HI,a).use(r)}(t),n=function(o){const r=o.children||"",s=new Hy;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,a=r.allowElement,i=r.components,l=r.disallowedElements,d=r.skipHtml,u=r.unwrapDisallowed,h=r.urlTransform||t8;for(const m of QI)Object.hasOwn(r,m.from)&&(m.from,m.to&&m.to,m.id,void 0);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),zy(o,f),_6(o,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function f(m,x,g){if(m.type==="raw"&&g&&typeof x=="number")return d?g.children.splice(x,1):g.children[x]={type:"text",value:m.value},x;if(m.type==="element"){let p;for(p in Yu)if(Object.hasOwn(Yu,p)&&Object.hasOwn(m.properties,p)){const b=m.properties[p],y=Yu[p];(y===null||y.includes(m.tagName))&&(m.properties[p]=h(String(b||""),p,m))}}if(m.type==="element"){let p=s?!s.includes(m.tagName):!!l&&l.includes(m.tagName);if(!p&&a&&typeof x=="number"&&(p=!a(m,x,g)),p&&g&&typeof x=="number")return u&&m.children?g.children.splice(x,1,...m.children):g.children.splice(x,1),x}}}(e.runSync(e.parse(n),n),t)}function t8(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||ZI.test(t.slice(0,e))?t:""}const n8=[We.lineWrapping],o8=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),r8=t=>{const e=H.c(26),{code:n,language:o}=t,{theme:r}=Ko(),{createNewCell:s}=it(),a=ls(),i=Se(Yl),[l,d]=T.useState(n);let u,h,f;e[0]!==n?(u=()=>{d(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),T.useEffect(u,h),e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==a||e[7]!==l?(f=()=>{const _=function(E,M){return E?E==="python"?{language:E,code:M}:E==="sql"?{language:"python",code:jc.fromQuery(M)}:E==="markdown"?{language:"python",code:La.fromMarkdown(M)}:E==="shell"||E==="bash"?{language:"python",code:`import subprocess
|
141
|
-
subprocess.run("${M}")`}:{language:"python",code:`_${E} = """
|
142
|
-
${M}
|
143
|
-
"""`}:{language:"python",code:M}}(o,l);o==="sql"&&Kn({autoInstantiate:i,createNewCell:s,fromCellId:a}),s({code:_.code,before:!1,cellId:a??"__end__"})},e[3]=i,e[4]=s,e[5]=o,e[6]=a,e[7]=l,e[8]=f):f=e[8];const m=f;let x;e[9]!==l?(x=async()=>{await on(l)},e[9]=l,e[10]=x):x=e[10];const g=x,p=r==="dark"?"dark":"light",b=o&&o8.has(o)?o:void 0;let y,v,w,S,j,C;return e[11]!==p||e[12]!==b||e[13]!==l?(y=c.jsx(T.Suspense,{children:c.jsx(oi,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:n8,value:l,onChange:d})}),e[11]=p,e[12]=b,e[13]=l,e[14]=y):y=e[14],e[15]!==g?(v=c.jsx(s8,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=v):v=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(w=c.jsx(wr,{className:"ml-2 h-4 w-4"}),e[17]=w):w=e[17],e[18]!==m?(S=c.jsxs(ve,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",w]}),e[18]=m,e[19]=S):S=e[19],e[20]!==S||e[21]!==v?(j=c.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[v,S]}),e[20]=S,e[21]=v,e[22]=j):j=e[22],e[23]!==j||e[24]!==y?(C=c.jsxs("div",{className:"relative",children:[y,j]}),e[23]=j,e[24]=y,e[25]=C):C=e[25],C},s8=t=>{const e=H.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=T.useState(!1);let a,i,l;e[3]!==r?(a=()=>{r&&setTimeout(()=>s(!1),1e3)},i=[r],e[3]=r,e[4]=a,e[5]=i):(a=e[4],i=e[5]),T.useEffect(a,i),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const d=r?"Copied":"Copy";let u;return e[8]!==o||e[9]!==l||e[10]!==d?(u=c.jsx(ve,{...o,onClick:l,children:d}),e[8]=o,e[9]=l,e[10]=d,e[11]=u):u=e[11],u},a8={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),c.jsx(r8,{code:t.trim(),language:n})]}):c.jsx("code",{className:e,children:t})}},Xy=T.memo(t=>{const e=H.c(2),{content:n}=t;let o;return e[0]!==n?(o=c.jsx(e8,{components:a8,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);Xy.displayName="MemoizedMarkdownBlock";const ph=T.memo(({content:t})=>{const e=T.useMemo(()=>{return n=t,sP.lexer(n).map(o=>o.raw);var n},[t]);return c.jsx(c.Fragment,{children:e.map((n,o)=>c.jsx(Xy,{content:n},`markdown-block-${o}`))})});ph.displayName="MarkdownRenderer";const i8=t=>{const e=H.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,a=r!==void 0&&r,i=a?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Hl,{className:"h-3 w-3"}),e[0]=l):l=e[0];const d=a?"Thinking":"View reasoning";let u,h,f,m;return e[1]!==n.length||e[2]!==d?(u=c.jsx(U3,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:c.jsxs("span",{className:"flex items-center gap-2",children:[l,d," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=d,e[3]=u):u=e[3],e[4]!==n?(h=c.jsx($3,{className:"pb-2 px-2",children:c.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:c.jsx("div",{className:"pr-6",children:c.jsx(ph,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==u||e[7]!==h?(f=c.jsxs(V3,{value:"reasoning",className:"border-0",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==i||e[11]!==f?(m=c.jsx(H3,{type:"single",collapsible:!0,className:"w-full mb-2",value:i,children:f},s),e[9]=s,e[10]=i,e[11]=f,e[12]=m):m=e[12],m},l8=t=>{const e=H.c(32),{toolName:n,result:o,error:r,index:s,state:a}=t,i=s===void 0?0:s,l=a==="result"&&(o||r),d=r?"error":l?"success":"loading";let u;e[0]!==d?(u=()=>{switch(d){case"loading":return c.jsx(Nc,{className:"h-3 w-3 animate-spin"});case"error":return c.jsx(_a,{className:"h-3 w-3 text-destructive"});case"success":return c.jsx(NR,{className:"h-3 w-3 text-green-600"});default:return c.jsx(aP,{className:"h-3 w-3"})}},e[0]=d,e[1]=u):u=e[1];const h=u;let f;e[2]!==r||e[3]!==l||e[4]!==d?(f=()=>d==="loading"?"Running: ":r?"Failed: ":l?"Done: ":"Tool call",e[2]=r,e[3]=l,e[4]=d,e[5]=f):f=e[5];const m=f,x=`tool-${i}`,g=d==="error"&&"text-destructive/80",p=d==="success"&&"text-green-600/80";let b,y;e[6]!==g||e[7]!==p?(b=xe("h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",g,p),e[6]=g,e[7]=p,e[8]=b):b=e[8],e[9]!==h?(y=h(),e[9]=h,e[10]=y):y=e[10];const v=m();let w,S,j,C,_,E,M;return e[11]!==n?(w=c.jsx("code",{className:"font-mono text-xs",children:n}),e[11]=n,e[12]=w):w=e[12],e[13]!==w||e[14]!==y||e[15]!==v?(S=c.jsxs("span",{className:"flex items-center gap-1",children:[y,v,":"," ",w]}),e[13]=w,e[14]=y,e[15]=v,e[16]=S):S=e[16],e[17]!==S||e[18]!==b?(j=c.jsx(U3,{className:b,children:S}),e[17]=S,e[18]=b,e[19]=j):j=e[19],e[20]!==r||e[21]!==l||e[22]!==o?(C=l&&c.jsxs("div",{className:"space-y-3",children:[o&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:"Result:"}),c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}),r&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error:"}),c.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-sm text-destructive",children:r})]})]}),e[20]=r,e[21]=l,e[22]=o,e[23]=C):C=e[23],e[24]!==C?(_=c.jsx($3,{className:"pb-2 px-2",children:C}),e[24]=C,e[25]=_):_=e[25],e[26]!==j||e[27]!==_?(E=c.jsxs(V3,{value:"tool-call",className:"border-0",children:[j,_]}),e[26]=j,e[27]=_,e[28]=E):E=e[28],e[29]!==E||e[30]!==x?(M=c.jsx(H3,{type:"single",collapsible:!0,className:"w-full my-4",children:E},x),e[29]=E,e[30]=x,e[31]=M):M=e[31],M},c8=t=>{const e=H.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:a}=si();let i,l,d,u,h,f,m,x,g,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Yo,{className:"h-4 w-4"}),e[0]=i):i=e[0],e[1]!==n?(l=c.jsx(Ne,{content:"New chat",children:c.jsx(ve,{variant:"text",size:"icon",onClick:n,children:i})}),e[1]=n,e[2]=l):l=e[2],e[3]!==a?(d=()=>a("ai"),e[3]=a,e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(om,{className:"h-4 w-4"}),e[5]=u):u=e[5],e[6]!==d?(h=c.jsx(Ne,{content:"AI Settings",children:c.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:d,children:u})}),e[6]=d,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ne,{content:"Previous chats",children:c.jsx(xs,{asChild:!0,children:c.jsx(ve,{variant:"text",size:"icon",children:c.jsx(dP,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&c.jsx(ln,{title:"No chats yet",description:"Start a new chat to get started",icon:c.jsx(Hl,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let y;e[15]!==o||e[16]!==r?(y=v=>c.jsxs("button",{className:xe("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",v.id===o&&"bg-accent"),onClick:()=>{r(v.id)},type:"button",children:[c.jsx("div",{className:"font-medium",children:v.title}),c.jsx("div",{className:"text-sm text-muted-foreground",children:uP(v.updatedAt)})]},v.id),e[15]=o,e[16]=r,e[17]=y):y=e[17],x=s.map(y),e[11]=o,e[12]=s,e[13]=r,e[14]=x}else x=e[14];return e[18]!==m||e[19]!==x?(g=c.jsxs(mr,{children:[f,c.jsx(us,{className:"w-[520px] p-0",align:"start",side:"right",children:c.jsx(Pb,{className:"h-[500px] p-4",children:c.jsxs("div",{className:"space-y-4",children:[m,x]})})})]}),e[18]=m,e[19]=x,e[20]=g):g=e[20],e[21]!==h||e[22]!==g?(p=c.jsxs("div",{className:"flex items-center gap-2",children:[h,g]}),e[21]=h,e[22]=g,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=c.jsxs("div",{className:"flex border-b px-2 py-1 justify-between shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},Jy=T.memo(t=>{var f;const e=H.c(15),{message:n,index:o,theme:r,onEdit:s,isStreamingReasoning:a,totalMessages:i}=t,l=n.role==="user"?"justify-end":"justify-start";let d,u,h;return e[0]!==l?(d=xe("flex group relative",l),e[0]=l,e[1]=d):d=e[1],e[2]!==o||e[3]!==a||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==s||e[9]!==r||e[10]!==i?(u=n.role==="user"?c.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:c.jsx(Cc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:h8,onSubmit:(m,x)=>{x.trim()&&s(o,x)},onClose:f8},n.id)}):c.jsxs("div",{className:"w-[95%] break-words",children:[c.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(W3,{className:"h-3 w-3",value:n.content})}),(f=n.parts)==null?void 0:f.map((m,x)=>{var g;switch(m.type){case"text":return c.jsx(ph,{content:m.text},x);case"reasoning":return c.jsx(i8,{reasoning:m.reasoning,index:x,isStreaming:o===i-1&&a&&x===(((g=n.parts)==null?void 0:g.length)||0)-1},x);case"tool-invocation":return c.jsx(l8,{index:x,toolName:m.toolInvocation.toolName,result:m.toolInvocation.state==="result"?m.toolInvocation.result:null,state:m.toolInvocation.state},x);default:return null}})]}),e[2]=o,e[3]=a,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=s,e[9]=r,e[10]=i,e[11]=u):u=e[11],e[12]!==d||e[13]!==u?(h=c.jsx("div",{className:d,children:u}),e[12]=d,e[13]=u,e[14]=h):h=e[14],h});Jy.displayName="ChatMessage";const gh=T.memo(t=>{var O;const e=H.c(33),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,a=Se(F3),[i,l]=Ot(Ua),d=(a==null?void 0:a.mode)||"manual",u=((O=a==null?void 0:a.open_ai)==null?void 0:O.model)||"o4-mini",{saveUserConfig:h}=et();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[{value:"ask",label:"Ask",subtitle:"Read-only tools"},{value:"manual",label:"Manual",subtitle:"No tools"}],e[0]=f):f=e[0];const m=f;let x,g,p,b,y,v,w,S,j,C,_;if(e[1]!==h||e[2]!==l||e[3]!==i){x=async R=>{const z={...i,ai:{...i.ai,mode:R}};P(z)},g=async R=>{var N;const z={...i,ai:{...i.ai,open_ai:{...(N=i.ai)==null?void 0:N.open_ai,model:R}}};P(z)};const P=async R=>{await h({config:R}).then(()=>{l(R)})};e[1]=h,e[2]=l,e[3]=i,e[4]=x,e[5]=g}else x=e[4],g=e[5];e[6]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Da,{className:"h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1",children:c.jsx(Pa,{placeholder:"manual"})}),e[6]=p):p=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Ra,{children:m.map(m8)}),e[7]=b):b=e[7],e[8]!==d||e[9]!==x?(y=c.jsx(iP,{feature:"mcp_docs",children:c.jsxs(Oa,{value:d,onValueChange:x,children:[p,b]})}),e[8]=d,e[9]=x,e[10]=y):y=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(Da,{className:"h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1",children:c.jsx(Pa,{placeholder:"Model"})}),e[11]=v):v=e[11],e[12]!==u?(w=!bj.includes(u)&&c.jsx(is,{value:u,className:"text-sm",children:u},u),e[12]=u,e[13]=w):w=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(S=bj.map(p8),e[14]=S):S=e[14],e[15]!==w?(j=c.jsxs(Ra,{children:[w,S]}),e[15]=w,e[16]=j):j=e[16],e[17]!==u||e[18]!==g||e[19]!==j?(C=c.jsxs(Oa,{value:u,onValueChange:g,children:[v,j]}),e[17]=u,e[18]=g,e[19]=j,e[20]=C):C=e[20],e[21]!==y||e[22]!==C?(_=c.jsxs("div",{className:"flex items-center gap-2",children:[y,C]}),e[21]=y,e[22]=C,e[23]=_):_=e[23];const E=r?s:o,M=!r&&!n.trim();let I,D,F;return e[24]!==r?(I=r?c.jsx(oc,{className:"h-3 w-3 fill-current"}):c.jsx(lP,{className:"h-3 w-3"}),e[24]=r,e[25]=I):I=e[25],e[26]!==E||e[27]!==M||e[28]!==I?(D=c.jsx(ve,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:E,disabled:M,children:I}),e[26]=E,e[27]=M,e[28]=I,e[29]=D):D=e[29],e[30]!==_||e[31]!==D?(F=c.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[_,D]}),e[30]=_,e[31]=D,e[32]=F):F=e[32],F});gh.displayName="ChatInputFooter";const Zy=T.memo(t=>{var g,p;const e=H.c(19),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:a,isLoading:i,onStop:l}=t;let d;e[0]!==n||e[1]!==r?(d=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=d):d=e[2];const u=d;let h,f,m,x;return e[3]!==((g=a.current)==null?void 0:g.editor)?(h=()=>{var b,y;return(y=(b=a.current)==null?void 0:b.editor)==null?void 0:y.blur()},e[3]=(p=a.current)==null?void 0:p.editor,e[4]=h):h=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==h||e[9]!==s?(f=c.jsx("div",{className:"px-2 py-3 flex-1",children:c.jsx(Cc,{value:n,onChange:o,onSubmit:r,onClose:h,theme:s,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=h,e[9]=s,e[10]=f):f=e[10],e[11]!==u||e[12]!==n||e[13]!==i||e[14]!==l?(m=c.jsx(gh,{input:n,onSendClick:u,isLoading:i,onStop:l}),e[11]=u,e[12]=n,e[13]=i,e[14]=l,e[15]=m):m=e[15],e[16]!==f||e[17]!==m?(x=c.jsxs("div",{className:"border-t relative shrink-0 min-h-[80px] flex flex-col",children:[f,m]}),e[16]=f,e[17]=m,e[18]=x):x=e[18],x});Zy.displayName="ChatInput";const d8=()=>{const t=H.c(6),e=Se(Gl),{handleClick:n}=si();if(!e){let r,s,a;return t[0]!==n?(r=c.jsx(ve,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(Hl,{}),t[2]=s):s=t[2],t[3]!==r?(a=c.jsx(ln,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=a):a=t[4],a}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(u8,{}),t[5]=o):o=t[5],o},u8=()=>{const[t,e]=Ot(td),[n,o]=Ot(Gj),[r,s]=T.useState(""),a=T.useRef(null),i=T.useRef(null),l=T.useRef(null),d=T.useRef(null),{theme:u}=Ko(),h=Sm(),{invokeAiTool:f}=et(),{messages:m,input:x,setInput:g,setMessages:p,append:b,handleSubmit:y,error:v,status:w,reload:S,stop:j}=cP({id:n==null?void 0:n.id,maxSteps:10,initialMessages:(n==null?void 0:n.messages)||[],keepLastMessageOnError:!0,api:h.getAiURL("chat").toString(),headers:h.headers(),experimental_prepareRequestBody:I=>({...I,...w3({input:I.messages.map(D=>D.content).join(`
|
144
|
-
`)}),includeOtherCode:yc("")}),onFinish:I=>{e(D=>Ru(D,D.activeChatId,I.id,"assistant",I.content,I.parts))},onToolCall:async({toolCall:I})=>{try{const D=await f({toolName:I.toolName,arguments:I.args});return D.result||D.error}catch(D){return ft.error("Tool call failed:",D),`Error: ${D instanceof Error?D.message:String(D)}`}},onError:I=>{ft.error("An error occurred:",I)},onResponse:I=>{ft.debug("Received HTTP response from server:",I)}}),C=w==="submitted"||w==="streaming";T.useEffect(()=>{if(!t.activeChatId||m.length===0)return;const I=m[m.length-1];if((I==null?void 0:I.role)!=="user")return;const D=t.chats.find(P=>P.id===t.activeChatId);if(!D)return;const F=new Set(D.messages.map(P=>P.id)),O=m.filter(P=>P.role==="user"&&!F.has(P.id));O.length>0&&e(P=>{let R=P;for(const z of O)R=Ru(R,P.activeChatId,z.id,"user",z.content);return R})},[m,t.activeChatId,t.chats,e]);const _=C&&m.length>0&&(I=>{if(I.length===0)return!1;const D=I.at(-1);if(!D||D.role!=="assistant"||!D.parts)return!1;const F=D.parts;return F.length===0?!1:F[F.length-1].type==="reasoning"})(m);T.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const I=l.current;I.scrollTop=I.scrollHeight}})},[t.activeChatId]);const E=(I,D)=>{p(F=>F.slice(0,I)),t.activeChatId&&e(F=>({...F,chats:F.chats.map(O=>O.id===t.activeChatId?{...O,messages:O.messages.slice(0,I),updatedAt:Date.now()}:O)})),b({role:"user",content:D})},M=()=>{r.trim()&&(I=>{const D=Date.now(),F={id:q3(),title:I.length>50?`${I.slice(0,50)}...`:I,messages:[],createdAt:D,updatedAt:D};e(P=>({...P,chats:[...P.chats,F],activeChatId:F.id}));const O=q3();b({id:O,role:"user",content:I}),g("")})(r.trim())};return c.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[c.jsx(Cm,{children:c.jsx(c8,{onNewChat:()=>{o(null),g(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((I,D)=>D.updatedAt-I.updatedAt)})}),c.jsxs("div",{className:"flex-1 px-3 bg-(--slate-1) gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!m||m.length===0)&&c.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[c.jsx("div",{className:"px-1",children:c.jsx(Cc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var I,D;return(D=(I=a.current)==null?void 0:I.editor)==null?void 0:D.blur()},onChange:s,onSubmit:M},"new-thread-input")}),c.jsx(gh,{input:r,onSendClick:M,isLoading:C,onStop:j})]}),m.map((I,D)=>c.jsx(Jy,{message:I,index:D,theme:u,onEdit:E,setChatState:e,chatState:t,isStreamingReasoning:_,totalMessages:m.length},D)),C&&c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(Nc,{className:"h-4 w-4 animate-spin"})}),v&&c.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[c.jsx(xr,{error:v}),c.jsx(ve,{variant:"outline",size:"sm",onClick:()=>{S()},children:"Retry"})]}),c.jsx("div",{ref:d})]}),C&&c.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:c.jsx(ve,{variant:"linkDestructive",size:"sm",onClick:j,children:"Stop"})}),m&&m.length>0&&c.jsx(Zy,{input:x,setInput:g,onSubmit:(I,D)=>{D.trim()&&y(I)},theme:u,inputRef:i,isLoading:C,onStop:j})]})};function h8(){}function f8(){}function m8(t){return c.jsx(is,{value:t.value,className:"text-xs",subtitle:c.jsx("div",{className:"text-muted-foreground text-xs pl-2",children:t.subtitle}),children:t.label},t.value)}function p8(t){return c.jsx(is,{value:t,className:"text-sm",children:t},t)}function Xt(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=Xt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:g8}=q,{useSyncExternalStoreWithSelector:x8}=hP,b8=t=>t;function Qy(t,e=b8,n){const o=x8(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return g8(o),o}const ev=(t,e)=>{const n=fP(t),o=(r,s=e)=>Qy(n,r,s);return Object.assign(o,n),o};function Vt(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 Gn(t,e){if(t=function(s){let a;for(;a=s.sourceEvent;)s=a;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const y8={passive:!1},fa={capture:!0,passive:!1};function xh(t){t.stopImmediatePropagation()}function Hr(t){t.preventDefault(),t.stopImmediatePropagation()}function tv(t){var e=t.document.documentElement,n=Bn(t).on("dragstart.drag",Hr,fa);"onselectstart"in e?n.on("selectstart.drag",Hr,fa):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function nv(t,e){var n=t.document.documentElement,o=Bn(t).on("dragstart.drag",null);e&&(o.on("click.drag",Hr,fa),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 Nl=t=>()=>t;function bh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:a,y:i,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function v8(t){return!t.ctrlKey&&!t.button}function w8(){return this.parentNode}function k8(t,e){return e??{x:t.x,y:t.y}}function j8(){return navigator.maxTouchPoints||"ontouchstart"in this}bh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const El=t=>()=>t;function S8(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 yh(t){t.stopImmediatePropagation()}function ma(t){t.preventDefault(),t.stopImmediatePropagation()}function C8(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function N8(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function ov(){return this.__zoom||Jo}function E8(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function _8(){return navigator.maxTouchPoints||"ontouchstart"in this}function I8(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}const _l=T.createContext(null),A8=_l.Provider,T8=t=>`Node type "${t}" not found. Using fallback type "default".`,M8=()=>"The React Flow parent container needs a width and a height to render the graph.",O8=()=>"Only child nodes can use a parent extent.",D8=t=>`Marker type "${t}" doesn't exist.`,P8=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,R8=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",L8=t=>`Edge type "${t}" not found. Using fallback type "default".`,F8=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.`,rv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function lt(t,e){const n=T.useContext(_l);if(n===null)throw new Error(rv);return Qy(n,t,e)}const Ft=()=>{const t=T.useContext(_l);if(t===null)throw new Error(rv);return T.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},z8=t=>t.userSelectionActive?"none":"all";function Il({position:t,children:e,className:n,style:o,...r}){const s=lt(z8),a=`${t}`.split("-");return q.createElement("div",{className:Xt(["react-flow__panel",n,...a]),style:{...o,pointerEvents:s},...r},e)}function B8({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:q.createElement(Il,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},q.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var U8=T.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:a=[2,4],labelBgBorderRadius:i=2,children:l,className:d,...u})=>{const h=T.useRef(null),[f,m]=T.useState({x:0,y:0,width:0,height:0}),x=Xt(["react-flow__edge-textwrapper",d]);return T.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?q.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:x,visibility:f.width?"visible":"hidden",...u},r&&q.createElement("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:i,ry:i}),q.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const vh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Wr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),wh=(t={x:0,y:0},e)=>({x:Wr(t.x,e[0][0],e[1][0]),y:Wr(t.y,e[0][1],e[1][1])}),sv=(t,e,n)=>t<e?Wr(Math.abs(t-e),1,50)/50:t>n?-Wr(Math.abs(t-n),1,50)/50:0,av=(t,e)=>[20*sv(t.x,35,e.width-35),20*sv(t.y,35,e.height-35)],iv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},kh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),lv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),jh=(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)},Sn=t=>!isNaN(t)&&isFinite(t),bt=Symbol.for("internals"),cv=["Enter"," ","Escape"];function Sh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const dv=t=>"clientX"in t,Ro=(t,e)=>{var s,a;const n=dv(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Al=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},pa=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>q.createElement(q.Fragment,null,q.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&q.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Sn(n)&&Sn(o)?q.createElement(U8,{x:n,y:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d}):null);function ga(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function uv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,r,a]}function hv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:i}){const l=.125*t+.375*r+.375*a+.125*n,d=.125*e+.375*s+.375*i+.125*o;return[l,d,Math.abs(l-t),Math.abs(d-e)]}var lr,fv,Lo,Ch,xa,mv,Fo,ba,qr,pv,Oe,Tl;function gv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Oe.Left||t===Oe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function xv({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top}){const[a,i]=gv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,d]=gv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=hv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${i} ${l},${d} ${o},${r}`,u,h,f,m]}pa.displayName="BaseEdge",(fv=lr||(lr={})).Strict="strict",fv.Loose="loose",(Ch=Lo||(Lo={})).Free="free",Ch.Vertical="vertical",Ch.Horizontal="horizontal",(mv=xa||(xa={})).Partial="partial",mv.Full="full",(ba=Fo||(Fo={})).Bezier="default",ba.Straight="straight",ba.Step="step",ba.SmoothStep="smoothstep",ba.SimpleBezier="simplebezier",(pv=qr||(qr={})).Arrow="arrow",pv.ArrowClosed="arrowclosed",(Tl=Oe||(Oe={})).Left="left",Tl.Top="top",Tl.Right="right",Tl.Bottom="bottom";const Nh=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})=>{const[p,b,y]=xv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return q.createElement(pa,{path:p,labelX:b,labelY:y,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})});Nh.displayName="SimpleBezierEdge";const bv={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},yv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function $8({source:t,sourcePosition:e=Oe.Bottom,target:n,targetPosition:o=Oe.Top,center:r,offset:s}){const a=bv[e],i=bv[o],l={x:t.x+a.x*s,y:t.y+a.y*s},d={x:n.x+i.x*s,y:n.y+i.y*s},u=(({source:j,sourcePosition:C=Oe.Bottom,target:_})=>C===Oe.Left||C===Oe.Right?j.x<_.x?{x:1,y:0}:{x:-1,y:0}:j.y<_.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let m,x,g=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,S]=uv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*i[h]===-1){m=r.x??y,x=r.y??v;const j=[{x:m,y:l.y},{x:m,y:d.y}],C=[{x:l.x,y:x},{x:d.x,y:x}];g=a[h]===f?h==="x"?j:C:h==="x"?C:j}else{const j=[{x:l.x,y:d.y}],C=[{x:d.x,y:l.y}];if(g=h==="x"?a.x===f?C:j:a.y===f?j:C,e===o){const M=Math.abs(t[h]-n[h]);if(M<=s){const I=Math.min(s-1,s-M);a[h]===f?p[h]=(l[h]>t[h]?-1:1)*I:b[h]=(d[h]>n[h]?-1:1)*I}}if(e!==o){const M=h==="x"?"y":"x",I=a[h]===i[M],D=l[M]>d[M],F=l[M]<d[M];(a[h]===1&&(!I&&D||I&&F)||a[h]!==1&&(!I&&F||I&&D))&&(g=h==="x"?j:C)}const _={x:l.x+p.x,y:l.y+p.y},E={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(_.x-g[0].x),Math.abs(E.x-g[0].x))>=Math.max(Math.abs(_.y-g[0].y),Math.abs(E.y-g[0].y))?(m=(_.x+E.x)/2,x=g[0].y):(m=g[0].x,x=(_.y+E.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:d.x+b.x,y:d.y+b.y},n],m,x,w,S]}function Eh({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,borderRadius:a=5,centerX:i,centerY:l,offset:d=20}){const[u,h,f,m,x]=$8({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:i,y:l},offset:d});return[u.reduce((g,p,b)=>{let y="";return y=b>0&&b<u.length-1?function(v,w,S,j){const C=Math.min(yv(v,w)/2,yv(w,S)/2,j),{x:_,y:E}=w;if(v.x===_&&_===S.x||v.y===E&&E===S.y)return`L${_} ${E}`;if(v.y===E)return`L ${_+C*(v.x<S.x?-1:1)},${E}Q ${_},${E} ${_},${E+C*(v.y<S.y?1:-1)}`;const M=v.x<S.x?1:-1;return`L ${_},${E+C*(v.y<S.y?-1:1)}Q ${_},${E} ${_+C*M},${E}`}(u[b-1],p,u[b+1],a):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,x]}const Ml=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,sourcePosition:h=Oe.Bottom,targetPosition:f=Oe.Top,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=Eh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return q.createElement(pa,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:m,markerStart:x,interactionWidth:p})});Ml.displayName="SmoothStepEdge";const _h=T.memo(t=>{var e;return q.createElement(Ml,{...t,pathOptions:T.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});_h.displayName="StepEdge";const Ih=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[x,g,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[S,j,C,_]=uv({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,S,j,C,_]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return q.createElement(pa,{path:x,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function Ol(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function vv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Oe.Left:return[e-Ol(e-o,s),n];case Oe.Right:return[e+Ol(o-e,s),n];case Oe.Top:return[e,n-Ol(n-r,s)];case Oe.Bottom:return[e,n+Ol(r-n,s)]}}function wv({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,curvature:a=.25}){const[i,l]=vv({pos:n,x1:t,y1:e,x2:o,y2:r,c:a}),[d,u]=vv({pos:s,x1:o,y1:r,x2:t,y2:e,c:a}),[h,f,m,x]=hv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${i},${l} ${d},${u} ${o},${r}`,h,f,m,x]}Ih.displayName="StraightEdge";const Dl=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=wv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return q.createElement(pa,{path:b,labelX:y,labelY:v,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:p})});Dl.displayName="BezierEdge";const Ah=T.createContext(null),V8=Ah.Provider;Ah.Consumer;const H8=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Th=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Mh=({x:t,y:e},[n,o,r],s,[a,i])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:a*Math.round(l.x/a),y:i*Math.round(l.y/i)}:l},kv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Gr=(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}},Oh=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:a}=Gr(r,e).positionAbsolute;return i=o,l=kh({x:s,y:a,width:r.width||0,height:r.height||0}),{x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x2,l.x2),y2:Math.max(i.y2,l.y2)};var i,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:a})=>({x:o,y:r,width:s-o,height:a-r}))(n)},jv=(t,e,[n,o,r]=[0,0,1],s=!1,a=!1,i=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},d=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:x=!1}=u;if(a&&!m||x)return!1;const{positionAbsolute:g}=Gr(u,i),p={x:g.x,y:g.y,width:h||0,height:f||0},b=jh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&d.push(u)}),d},Sv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},Cv=(t,e,n,o,r,s=.1)=>{const a=e/(t.width*(1+s)),i=n/(t.height*(1+s)),l=Math.min(a,i),d=Wr(l,o,r);return{x:e/2-(t.x+t.width/2)*d,y:n/2-(t.y+t.height/2)*d,zoom:d}},cr=(t,e=0)=>t.transition().duration(e);function Nv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var a,i;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((a=t.positionAbsolute)==null?void 0:a.x)??0)+s.x+s.width/2,y:(((i=t.positionAbsolute)==null?void 0:i.y)??0)+s.y+s.height/2}),r},[])}const W8={source:null,target:null,sourceHandle:null,targetHandle:null},Ev=()=>({handleDomNode:null,isValid:!1,connection:W8,endHandle:null});function _v(t,e,n,o,r,s,a){const i=r==="target",l=a.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),d={...Ev(),handleDomNode:l};if(l){const u=Dh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),x=l.classList.contains("connectableend"),g={source:i?h:n,sourceHandle:i?f:o,target:i?n:h,targetHandle:i?o:f};d.connection=g,m&&x&&(e===lr.Strict?i&&u==="source"||!i&&u==="target":h!==n||f!==o)&&(d.endHandle={nodeId:h,handleId:f,type:u},d.isValid=s(g))}return d}function Dh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Ph(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function q8(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Iv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:a,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:d}){const u=iv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:x,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:S,y:j}=Ro(t),C=u==null?void 0:u.elementFromPoint(S,j),_=Dh(l,C),E=f==null?void 0:f.getBoundingClientRect();if(!E||!_)return;let M,I=Ro(t,E),D=!1,F=null,O=!1,P=null;const R=function({nodes:B,nodeId:A,handleId:U,handleType:$}){return B.reduce((X,Y)=>{if(Y[bt]){const{handleBounds:G}=Y[bt];let W=[],J=[];G&&(W=Nv(Y,G,"source",`${A}-${U}-${$}`),J=Nv(Y,G,"target",`${A}-${U}-${$}`)),X.push(...W,...J)}return X},[])}({nodes:b(),nodeId:n,handleId:e,handleType:_}),z=()=>{if(!m)return;const[B,A]=av(I,E);p({x:B,y:A}),w=requestAnimationFrame(z)};function N(B){const{transform:A}=s();I=Ro(B,E);const{handle:U,validHandleResult:$}=function(X,Y,G,W,J,V){const{x:Q,y:te}=Ro(X),re=Y.elementsFromPoint(Q,te).find(ge=>ge.classList.contains("react-flow__handle"));if(re){const ge=re.getAttribute("data-nodeid");if(ge){const oe=Dh(void 0,re),ue=re.getAttribute("data-handleid"),de=V({nodeId:ge,id:ue,type:oe});if(de){const Ce=J.find(Te=>Te.nodeId===ge&&Te.type===oe&&Te.id===ue);return{handle:{id:ue,type:oe,nodeId:ge,x:(Ce==null?void 0:Ce.x)||G.x,y:(Ce==null?void 0:Ce.y)||G.y},validHandleResult:de}}}}let ne=[],ae=1/0;if(J.forEach(ge=>{const oe=Math.sqrt((ge.x-G.x)**2+(ge.y-G.y)**2);if(oe<=W){const ue=V(ge);oe<=ae&&(oe<ae?ne=[{handle:ge,validHandleResult:ue}]:oe===ae&&ne.push({handle:ge,validHandleResult:ue}),ae=oe)}}),!ne.length)return{handle:null,validHandleResult:Ev()};if(ne.length===1)return ne[0];const se=ne.some(({validHandleResult:ge})=>ge.isValid),ie=ne.some(({handle:ge})=>ge.type==="target");return ne.find(({handle:ge,validHandleResult:oe})=>ie?ge.type==="target":!se||oe.isValid)||ne[0]}(B,u,Mh(I,A,!1,[1,1]),x,R,X=>_v(X,h,n,e,r?"target":"source",i,u));if(v=U,D||(z(),D=!0),P=$.handleDomNode,F=$.connection,O=$.isValid,a({connectionPosition:v&&O?kv({x:v.x,y:v.y},A):I,connectionStatus:q8(!!v,O),connectionEndHandle:$.endHandle}),!v&&!O&&!P)return Ph(M);F.source!==F.target&&P&&(Ph(M),M=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",O),P.classList.toggle("react-flow__handle-valid",O))}function k(B){var A,U;(v||P)&&F&&O&&(o==null||o(F)),(U=(A=s()).onConnectEnd)==null||U.call(A,B),l&&(d==null||d(B)),Ph(M),y(),cancelAnimationFrame(w),D=!1,O=!1,F=null,P=null,u.removeEventListener("mousemove",N),u.removeEventListener("mouseup",k),u.removeEventListener("touchmove",N),u.removeEventListener("touchend",k)}a({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:_,connectionStartHandle:{nodeId:n,handleId:e,type:_},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:_}),u.addEventListener("mousemove",N),u.addEventListener("mouseup",k),u.addEventListener("touchmove",N),u.addEventListener("touchend",k)}const Av=()=>!0,G8=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Tv=T.forwardRef(({type:t="source",position:e=Oe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:i,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},m)=>{var _,E;const x=a||null,g=t==="target",p=Ft(),b=T.useContext(Ah),{connectOnClick:y,noPanClassName:v}=lt(G8,Vt),{connecting:w,clickConnecting:S}=lt(((M,I,D)=>F=>{const{connectionStartHandle:O,connectionEndHandle:P,connectionClickStartHandle:R}=F;return{connecting:(O==null?void 0:O.nodeId)===M&&(O==null?void 0:O.handleId)===I&&(O==null?void 0:O.type)===D||(P==null?void 0:P.nodeId)===M&&(P==null?void 0:P.handleId)===I&&(P==null?void 0:P.type)===D,clickConnecting:(R==null?void 0:R.nodeId)===M&&(R==null?void 0:R.handleId)===I&&(R==null?void 0:R.type)===D}})(b,x,t),Vt);b||((E=(_=p.getState()).onError)==null||E.call(_,"010",R8()));const j=M=>{const{defaultEdgeOptions:I,onConnect:D,hasDefaultEdges:F}=p.getState(),O={...I,...M};if(F){const{edges:P,setEdges:R}=p.getState();R(((z,N)=>{if(!z.source||!z.target)return N;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(z)?{...z}:{...z,id:H8(z)},((B,A)=>A.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,N)?N:N.concat(k)})(O,P))}D==null||D(O),i==null||i(O)},C=M=>{if(!b)return;const I=dv(M);r&&(I&&M.button===0||!I)&&Iv({event:M,handleId:x,nodeId:b,onConnect:j,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||Av}),I?u==null||u(M):h==null||h(M)};return q.createElement("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${x}-${t}`,className:Xt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,d,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:C,onTouchStart:C,onClick:y?M=>{const{onClickConnectStart:I,onClickConnectEnd:D,connectionClickStartHandle:F,connectionMode:O,isValidConnection:P}=p.getState();if(!b||!F&&!r)return;if(!F)return I==null||I(M,{nodeId:b,handleId:x,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:x}});const R=iv(M.target),z=n||P||Av,{connection:N,isValid:k}=_v({nodeId:b,id:x,type:t},O,F.nodeId,F.handleId||null,F.type,z,R);k&&j(N),D==null||D(M),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});Tv.displayName="Handle";var zo=T.memo(Tv);const Mv=({data:t,isConnectable:e,targetPosition:n=Oe.Top,sourcePosition:o=Oe.Bottom})=>q.createElement(q.Fragment,null,q.createElement(zo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,q.createElement(zo,{type:"source",position:o,isConnectable:e}));Mv.displayName="DefaultNode";var Rh=T.memo(Mv);const Ov=({data:t,isConnectable:e,sourcePosition:n=Oe.Bottom})=>q.createElement(q.Fragment,null,t==null?void 0:t.label,q.createElement(zo,{type:"source",position:n,isConnectable:e}));Ov.displayName="InputNode";var Dv=T.memo(Ov);const Pv=({data:t,isConnectable:e,targetPosition:n=Oe.Top})=>q.createElement(q.Fragment,null,q.createElement(zo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Pv.displayName="OutputNode";var Rv=T.memo(Pv);const Lh=()=>null;Lh.displayName="GroupNode";const Y8=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Pl=t=>t.id;function K8(t,e){return Vt(t.selectedNodes.map(Pl),e.selectedNodes.map(Pl))&&Vt(t.selectedEdges.map(Pl),e.selectedEdges.map(Pl))}const Lv=T.memo(({onSelectionChange:t})=>{const e=Ft(),{selectedNodes:n,selectedEdges:o}=lt(Y8,K8);return T.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});Lv.displayName="SelectionListener";const X8=t=>!!t.onSelectionChange;function J8({onSelectionChange:t}){const e=lt(X8);return t||e?q.createElement(Lv,{onSelectionChange:t}):null}const Z8=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 Yr(t,e){T.useEffect(()=>{t!==void 0&&e(t)},[t])}function Ze(t,e,n){T.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const Q8=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:a,onClickConnectStart:i,onClickConnectEnd:l,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:x,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:S,snapGrid:j,snapToGrid:C,translateExtent:_,connectOnClick:E,defaultEdgeOptions:M,fitView:I,fitViewOptions:D,onNodesDelete:F,onEdgesDelete:O,onNodeDrag:P,onNodeDragStart:R,onNodeDragStop:z,onSelectionDrag:N,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:A,nodeOrigin:U,rfId:$,autoPanOnConnect:X,autoPanOnNodeDrag:Y,onError:G,connectionRadius:W,isValidConnection:J,nodeDragThreshold:V})=>{const{setNodes:Q,setEdges:te,setDefaultNodesAndEdges:re,setMinZoom:ne,setMaxZoom:ae,setTranslateExtent:se,setNodeExtent:ie,reset:ge}=lt(Z8,Vt),oe=Ft();return T.useEffect(()=>{const ue=o==null?void 0:o.map(de=>({...de,...M}));return re(n,ue),()=>{ge()}},[]),Ze("defaultEdgeOptions",M,oe.setState),Ze("connectionMode",S,oe.setState),Ze("onConnect",r,oe.setState),Ze("onConnectStart",s,oe.setState),Ze("onConnectEnd",a,oe.setState),Ze("onClickConnectStart",i,oe.setState),Ze("onClickConnectEnd",l,oe.setState),Ze("nodesDraggable",d,oe.setState),Ze("nodesConnectable",u,oe.setState),Ze("nodesFocusable",h,oe.setState),Ze("edgesFocusable",f,oe.setState),Ze("edgesUpdatable",m,oe.setState),Ze("elementsSelectable",w,oe.setState),Ze("elevateNodesOnSelect",x,oe.setState),Ze("snapToGrid",C,oe.setState),Ze("snapGrid",j,oe.setState),Ze("onNodesChange",y,oe.setState),Ze("onEdgesChange",v,oe.setState),Ze("connectOnClick",E,oe.setState),Ze("fitViewOnInit",I,oe.setState),Ze("fitViewOnInitOptions",D,oe.setState),Ze("onNodesDelete",F,oe.setState),Ze("onEdgesDelete",O,oe.setState),Ze("onNodeDrag",P,oe.setState),Ze("onNodeDragStart",R,oe.setState),Ze("onNodeDragStop",z,oe.setState),Ze("onSelectionDrag",N,oe.setState),Ze("onSelectionDragStart",k,oe.setState),Ze("onSelectionDragStop",B,oe.setState),Ze("noPanClassName",A,oe.setState),Ze("nodeOrigin",U,oe.setState),Ze("rfId",$,oe.setState),Ze("autoPanOnConnect",X,oe.setState),Ze("autoPanOnNodeDrag",Y,oe.setState),Ze("onError",G,oe.setState),Ze("connectionRadius",W,oe.setState),Ze("isValidConnection",J,oe.setState),Ze("nodeDragThreshold",V,oe.setState),Yr(t,Q),Yr(e,te),Yr(g,ne),Yr(p,ae),Yr(_,se),Yr(b,ie),null},Fv={display:"none"},eA={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zv="react-flow__node-desc",Bv="react-flow__edge-desc",tA=t=>t.ariaLiveMessage;function nA({rfId:t}){const e=lt(tA);return q.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:eA},e)}function oA({rfId:t,disableKeyboardA11y:e}){return q.createElement(q.Fragment,null,q.createElement("div",{id:`${zv}-${t}`,style:Fv},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),q.createElement("div",{id:`${Bv}-${t}`,style:Fv},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&q.createElement(nA,{rfId:t}))}var ya=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=T.useState(!1),r=T.useRef(!1),s=T.useRef(new Set([])),[a,i]=T.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),d=l.reduce((u,h)=>u.concat(...h),[]);return[l,d]}return[[],[]]},[t]);return T.useEffect(()=>{const l=typeof document<"u"?document:null,d=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Sh(m))return!1;const x=$v(m.code,i);s.current.add(m[x]),Uv(a,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Sh(m))return!1;const x=$v(m.code,i);Uv(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[x]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",u),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{d==null||d.removeEventListener("keydown",u),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function Uv(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function $v(t,e){return e.includes(t)?"code":"key"}function Vv(t,e,n,o){var i,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),a=Gr(s,o);return Vv(s,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(((i=s[bt])==null?void 0:i.z)??0)>(n.z??0)?((l=s[bt])==null?void 0:l.z)??0:n.z??0},o)}function Hv(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:a,y:i,z:l}=Vv(o,t,{...o.position,z:((s=o[bt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:a,y:i},o[bt].z=l,n!=null&&n[o.id]&&(o[bt].isParent=!0)}})}function Fh(t,e,n,o){const r=new Map,s={},a=o?1e3:0;return t.forEach(i=>{var m;const l=(Sn(i.zIndex)?i.zIndex:0)+(i.selected?a:0),d=e.get(i.id),u={...i,positionAbsolute:{x:i.position.x,y:i.position.y}},h=i.parentNode||i.parentId;h&&(s[h]=!0);const f=(d==null?void 0:d.type)&&(d==null?void 0:d.type)!==i.type;Object.defineProperty(u,bt,{enumerable:!1,value:{handleBounds:f||(m=d==null?void 0:d[bt])==null?void 0:m.handleBounds,z:l}}),r.set(i.id,u)}),Hv(r,n,s),r}function Wv(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:a,d3Zoom:i,d3Selection:l,fitViewOnInitDone:d,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!d&&u;if(i&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===g.id):p}),x=m.every(g=>g.width&&g.height);if(m.length>0&&x){const g=Oh(m,h),{x:p,y:b,zoom:y}=Cv(g,o,r,e.minZoom??s,e.maxZoom??a,e.padding??.1),v=Jo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?i.transform(cr(l,e.duration),v):i.transform(l,v),!0}}return!1}function rA(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[bt]:o[bt],selected:n.selected})}),new Map(e)}function sA(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Rl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:a,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:d}=n();t!=null&&t.length&&(l&&o({nodeInternals:rA(t,r)}),a==null||a(t)),e!=null&&e.length&&(d&&o({edges:sA(e,s)}),i==null||i(e))}const Kr=()=>{},aA={zoomIn:Kr,zoomOut:Kr,zoomTo:Kr,getZoom:()=>1,setViewport:Kr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Kr,fitBounds:Kr,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},iA=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function va(){const t=(()=>{const g=Ft(),{d3Zoom:p,d3Selection:b}=lt(iA,Vt);return T.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(cr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(cr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(cr(b,w==null?void 0:w.duration),v),getZoom:()=>g.getState().transform[2],setViewport:(v,w)=>{const[S,j,C]=g.getState().transform,_=Jo.translate(v.x??S,v.y??j).scale(v.zoom??C);p.transform(cr(b,w==null?void 0:w.duration),_)},getViewport:()=>{const[v,w,S]=g.getState().transform;return{x:v,y:w,zoom:S}},fitView:v=>Wv(g.getState,v),setCenter:(v,w,S)=>{const{width:j,height:C,maxZoom:_}=g.getState(),E=(S==null?void 0:S.zoom)!==void 0?S.zoom:_,M=j/2-v*E,I=C/2-w*E,D=Jo.translate(M,I).scale(E);p.transform(cr(b,S==null?void 0:S.duration),D)},fitBounds:(v,w)=>{const{width:S,height:j,minZoom:C,maxZoom:_}=g.getState(),{x:E,y:M,zoom:I}=Cv(v,S,j,C,_,(w==null?void 0:w.padding)??.1),D=Jo.translate(E,M).scale(I);p.transform(cr(b,w==null?void 0:w.duration),D)},project:v=>{const{transform:w,snapToGrid:S,snapGrid:j}=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"),Mh(v,w,S,j)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:S,snapGrid:j,domNode:C}=g.getState();if(!C)return v;const{x:_,y:E}=C.getBoundingClientRect(),M={x:v.x-_,y:v.y-E};return Mh(M,w,S,j)},flowToScreenPosition:v=>{const{transform:w,domNode:S}=g.getState();if(!S)return v;const{x:j,y:C}=S.getBoundingClientRect(),_=kv(v,w);return{x:_.x+j,y:_.y+C}},viewportInitialized:!0}:aA,[p,b])})(),e=Ft(),n=T.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=T.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=T.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=T.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),a=T.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),S=typeof g=="function"?g(w):g;if(y)b(S);else if(v){const j=S.length===0?w.map(C=>({type:"remove",id:C.id})):S.map(C=>({item:C,type:"reset"}));v(j)}},[]),i=T.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof g=="function"?g(p):g;y?b(w):v&&v(w.length===0?p.map(S=>({type:"remove",id:S.id})):w.map(S=>({item:S,type:"reset"})))},[]),l=T.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const S=p.map(j=>({item:j,type:"add"}));w(S)}},[]),d=T.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(S=>({item:S,type:"add"})))},[]),u=T.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:v,zoom:w}}},[]),h=T.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:S,onNodesDelete:j,onEdgesDelete:C,onNodesChange:_,onEdgesChange:E}=e.getState(),M=(g||[]).map(P=>P.id),I=(p||[]).map(P=>P.id),D=y().reduce((P,R)=>{const z=R.parentNode||R.parentId,N=!M.includes(R.id)&&z&&P.find(k=>k.id===z);return(typeof R.deletable!="boolean"||R.deletable)&&(M.includes(R.id)||N)&&P.push(R),P},[]),F=v.filter(P=>typeof P.deletable!="boolean"||P.deletable),O=F.filter(P=>I.includes(P.id));if(D||O){const P=Sv(D,F),R=[...O,...P],z=R.reduce((N,k)=>(N.includes(k.id)||N.push(k.id),N),[]);(S||w)&&(S&&e.setState({edges:v.filter(N=>!z.includes(N.id))}),w&&(D.forEach(N=>{b.delete(N.id)}),e.setState({nodeInternals:new Map(b)}))),z.length>0&&(C==null||C(R),E&&E(z.map(N=>({id:N,type:"remove"})))),D.length>0&&(j==null||j(D),_)&&_(D.map(N=>({id:N.id,type:"remove"})))}},[]),f=T.useCallback(g=>{const p=Sn((b=g).width)&&Sn(b.height)&&Sn(b.x)&&Sn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:lv(y),y,p]},[]),m=T.useCallback((g,p=!0,b)=>{const[y,v,w]=f(g);return y?(b||e.getState().getNodes()).filter(S=>{if(!(w||S.id!==v.id&&S.positionAbsolute))return!1;const j=lv(S),C=jh(j,y);return p&&C>0||C>=y.width*y.height}):[]},[]),x=T.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const v=jh(y,p);return b&&v>0||v>=y.width*y.height},[]);return T.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:a,setEdges:i,addNodes:l,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:x}),[t,n,o,r,s,a,i,l,d,u,h,m,x])}const lA={actInsideInputWithModifier:!1},zh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ll=t=>({x:t.x,y:t.y,zoom:t.k}),Xr=(t,e)=>t.target.closest(`.${e}`),qv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Gv=t=>{const e=t.ctrlKey&&Al()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},cA=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),dA=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:a=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Lo.Free,zoomOnDoubleClick:d=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:x,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const S=T.useRef(),j=Ft(),C=T.useRef(!1),_=T.useRef(!1),E=T.useRef(null),M=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:F,userSelectionActive:O}=lt(cA,Vt),P=ya(p),R=T.useRef(0),z=T.useRef(!1),N=T.useRef();return function(k){const B=Ft();T.useEffect(()=>{let A;const U=()=>{var X,Y;if(!k.current)return;const $=vh(k.current);$.height!==0&&$.width!==0||((Y=(X=B.getState()).onError)==null||Y.call(X,"004",M8())),B.setState({width:$.width||500,height:$.height||500})};return U(),window.addEventListener("resize",U),k.current&&(A=new ResizeObserver(()=>U()),A.observe(k.current)),()=>{window.removeEventListener("resize",U),A&&k.current&&A.unobserve(k.current)}},[])}(E),T.useEffect(()=>{if(E.current){const k=E.current.getBoundingClientRect(),B=function(){var Y,G,W,J=C8,V=N8,Q=I8,te=E8,re=_8,ne=[0,1/0],ae=[[-1/0,-1/0],[1/0,1/0]],se=250,ie=rL,ge=Dj("start","zoom","end"),oe=0,ue=10;function de(K){K.property("__zoom",ov).on("wheel.zoom",Ve,{passive:!1}).on("mousedown.zoom",Ke).on("dblclick.zoom",ee).filter(re).on("touchstart.zoom",ye).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Ie).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Ce(K,me){return(me=Math.max(ne[0],Math.min(ne[1],me)))===K.k?K:new $m(me,K.x,K.y)}function Te(K,me,pe){var he=me[0]-pe[0]*K.k,je=me[1]-pe[1]*K.k;return he===K.x&&je===K.y?K:new $m(K.k,he,je)}function Fe(K){return[(+K[0][0]+ +K[1][0])/2,(+K[0][1]+ +K[1][1])/2]}function _e(K,me,pe,he){K.on("start.zoom",function(){ke(this,arguments).event(he).start()}).on("interrupt.zoom end.zoom",function(){ke(this,arguments).event(he).end()}).tween("zoom",function(){var je=this,Pe=arguments,Re=ke(je,Pe).event(he),He=V.apply(je,Pe),le=pe==null?Fe(He):typeof pe=="function"?pe.apply(je,Pe):pe,Ae=Math.max(He[1][0]-He[0][0],He[1][1]-He[0][1]),Me=je.__zoom,Be=typeof me=="function"?me.apply(je,Pe):me,qe=ie(Me.invert(le).concat(Ae/Me.k),Be.invert(le).concat(Ae/Be.k));return function(De){if(De===1)De=Be;else{var $e=qe(De),ot=Ae/$e[2];De=new $m(ot,le[0]-$e[0]*ot,le[1]-$e[1]*ot)}Re.zoom(null,De)}})}function ke(K,me,pe){return!pe&&K.__zooming||new Ye(K,me)}function Ye(K,me){this.that=K,this.args=me,this.active=0,this.sourceEvent=null,this.extent=V.apply(K,me),this.taps=0}function Ve(K,...me){if(J.apply(this,arguments)){var pe=ke(this,me).event(K),he=this.__zoom,je=Math.max(ne[0],Math.min(ne[1],he.k*Math.pow(2,te.apply(this,arguments)))),Pe=Gn(K);if(pe.wheel)pe.mouse[0][0]===Pe[0]&&pe.mouse[0][1]===Pe[1]||(pe.mouse[1]=he.invert(pe.mouse[0]=Pe)),clearTimeout(pe.wheel);else{if(he.k===je)return;pe.mouse=[Pe,he.invert(Pe)],Vm(this),pe.start()}ma(K),pe.wheel=setTimeout(function(){pe.wheel=null,pe.end()},150),pe.zoom("mouse",Q(Te(Ce(he,je),pe.mouse[0],pe.mouse[1]),pe.extent,ae))}}function Ke(K,...me){if(!W&&J.apply(this,arguments)){var pe=K.currentTarget,he=ke(this,me,!0).event(K),je=Bn(K.view).on("mousemove.zoom",function(le){if(ma(le),!he.moved){var Ae=le.clientX-Re,Me=le.clientY-He;he.moved=Ae*Ae+Me*Me>oe}he.event(le).zoom("mouse",Q(Te(he.that.__zoom,he.mouse[0]=Gn(le,pe),he.mouse[1]),he.extent,ae))},!0).on("mouseup.zoom",function(le){je.on("mousemove.zoom mouseup.zoom",null),nv(le.view,he.moved),ma(le),he.event(le).end()},!0),Pe=Gn(K,pe),Re=K.clientX,He=K.clientY;tv(K.view),yh(K),he.mouse=[Pe,this.__zoom.invert(Pe)],Vm(this),he.start()}}function ee(K,...me){if(J.apply(this,arguments)){var pe=this.__zoom,he=Gn(K.changedTouches?K.changedTouches[0]:K,this),je=pe.invert(he),Pe=pe.k*(K.shiftKey?.5:2),Re=Q(Te(Ce(pe,Pe),he,je),V.apply(this,me),ae);ma(K),se>0?Bn(this).transition().duration(se).call(_e,Re,he,K):Bn(this).call(de.transform,Re,he,K)}}function ye(K,...me){if(J.apply(this,arguments)){var pe,he,je,Pe,Re=K.touches,He=Re.length,le=ke(this,me,K.changedTouches.length===He).event(K);for(yh(K),he=0;he<He;++he)Pe=[Pe=Gn(je=Re[he],this),this.__zoom.invert(Pe),je.identifier],le.touch0?le.touch1||le.touch0[2]===Pe[2]||(le.touch1=Pe,le.taps=0):(le.touch0=Pe,pe=!0,le.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),pe&&(le.taps<2&&(G=Pe[0],Y=setTimeout(function(){Y=null},500)),Vm(this),le.start())}}function we(K,...me){if(this.__zooming){var pe,he,je,Pe,Re=ke(this,me).event(K),He=K.changedTouches,le=He.length;for(ma(K),pe=0;pe<le;++pe)je=Gn(he=He[pe],this),Re.touch0&&Re.touch0[2]===he.identifier?Re.touch0[0]=je:Re.touch1&&Re.touch1[2]===he.identifier&&(Re.touch1[0]=je);if(he=Re.that.__zoom,Re.touch1){var Ae=Re.touch0[0],Me=Re.touch0[1],Be=Re.touch1[0],qe=Re.touch1[1],De=(De=Be[0]-Ae[0])*De+(De=Be[1]-Ae[1])*De,$e=($e=qe[0]-Me[0])*$e+($e=qe[1]-Me[1])*$e;he=Ce(he,Math.sqrt(De/$e)),je=[(Ae[0]+Be[0])/2,(Ae[1]+Be[1])/2],Pe=[(Me[0]+qe[0])/2,(Me[1]+qe[1])/2]}else{if(!Re.touch0)return;je=Re.touch0[0],Pe=Re.touch0[1]}Re.zoom("touch",Q(Te(he,je,Pe),Re.extent,ae))}}function Ie(K,...me){if(this.__zooming){var pe,he,je=ke(this,me).event(K),Pe=K.changedTouches,Re=Pe.length;for(yh(K),W&&clearTimeout(W),W=setTimeout(function(){W=null},500),pe=0;pe<Re;++pe)he=Pe[pe],je.touch0&&je.touch0[2]===he.identifier?delete je.touch0:je.touch1&&je.touch1[2]===he.identifier&&delete je.touch1;if(je.touch1&&!je.touch0&&(je.touch0=je.touch1,delete je.touch1),je.touch0)je.touch0[1]=this.__zoom.invert(je.touch0[0]);else if(je.end(),je.taps===2&&(he=Gn(he,this),Math.hypot(G[0]-he[0],G[1]-he[1])<ue)){var He=Bn(this).on("dblclick.zoom");He&&He.apply(this,arguments)}}}return de.transform=function(K,me,pe,he){var je=K.selection?K.selection():K;je.property("__zoom",ov),K!==je?_e(K,me,pe,he):je.interrupt().each(function(){ke(this,arguments).event(he).start().zoom(null,typeof me=="function"?me.apply(this,arguments):me).end()})},de.scaleBy=function(K,me,pe,he){de.scaleTo(K,function(){return this.__zoom.k*(typeof me=="function"?me.apply(this,arguments):me)},pe,he)},de.scaleTo=function(K,me,pe,he){de.transform(K,function(){var je=V.apply(this,arguments),Pe=this.__zoom,Re=pe==null?Fe(je):typeof pe=="function"?pe.apply(this,arguments):pe,He=Pe.invert(Re),le=typeof me=="function"?me.apply(this,arguments):me;return Q(Te(Ce(Pe,le),Re,He),je,ae)},pe,he)},de.translateBy=function(K,me,pe,he){de.transform(K,function(){return Q(this.__zoom.translate(typeof me=="function"?me.apply(this,arguments):me,typeof pe=="function"?pe.apply(this,arguments):pe),V.apply(this,arguments),ae)},null,he)},de.translateTo=function(K,me,pe,he,je){de.transform(K,function(){var Pe=V.apply(this,arguments),Re=this.__zoom,He=he==null?Fe(Pe):typeof he=="function"?he.apply(this,arguments):he;return Q(Jo.translate(He[0],He[1]).scale(Re.k).translate(typeof me=="function"?-me.apply(this,arguments):-me,typeof pe=="function"?-pe.apply(this,arguments):-pe),Pe,ae)},he,je)},Ye.prototype={event:function(K){return K&&(this.sourceEvent=K),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(K,me){return this.mouse&&K!=="mouse"&&(this.mouse[1]=me.invert(this.mouse[0])),this.touch0&&K!=="touch"&&(this.touch0[1]=me.invert(this.touch0[0])),this.touch1&&K!=="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(K){var me=Bn(this.that).datum();ge.call(K,this.that,new S8(K,{sourceEvent:this.sourceEvent,target:de,transform:this.that.__zoom,dispatch:ge}),me)}},de.wheelDelta=function(K){return arguments.length?(te=typeof K=="function"?K:El(+K),de):te},de.filter=function(K){return arguments.length?(J=typeof K=="function"?K:El(!!K),de):J},de.touchable=function(K){return arguments.length?(re=typeof K=="function"?K:El(!!K),de):re},de.extent=function(K){return arguments.length?(V=typeof K=="function"?K:El([[+K[0][0],+K[0][1]],[+K[1][0],+K[1][1]]]),de):V},de.scaleExtent=function(K){return arguments.length?(ne[0]=+K[0],ne[1]=+K[1],de):[ne[0],ne[1]]},de.translateExtent=function(K){return arguments.length?(ae[0][0]=+K[0][0],ae[1][0]=+K[1][0],ae[0][1]=+K[0][1],ae[1][1]=+K[1][1],de):[[ae[0][0],ae[0][1]],[ae[1][0],ae[1][1]]]},de.constrain=function(K){return arguments.length?(Q=K,de):Q},de.duration=function(K){return arguments.length?(se=+K,de):se},de.interpolate=function(K){return arguments.length?(ie=K,de):ie},de.on=function(){var K=ge.on.apply(ge,arguments);return K===ge?de:K},de.clickDistance=function(K){return arguments.length?(oe=(K=+K)*K,de):Math.sqrt(oe)},de.tapDistance=function(K){return arguments.length?(ue=+K,de):ue},de}().scaleExtent([x,g]).translateExtent(m),A=Bn(E.current).call(B),U=Jo.translate(f.x,f.y).scale(Wr(f.zoom,x,g)),$=[[0,0],[k.width,k.height]],X=B.constrain()(U,$,m);B.transform(A,X),B.wheelDelta(Gv),j.setState({d3Zoom:B,d3Selection:A,d3ZoomHandler:A.on("wheel.zoom"),transform:[X.x,X.y,X.k],domNode:E.current.closest(".react-flow")})}},[]),T.useEffect(()=>{D&&I&&(!a||P||O?F!==void 0&&D.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||Xr(k,v))return null;k.preventDefault(),F.call(this,k,B)},{passive:!1}):D.on("wheel.zoom",k=>{if(Xr(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(k.ctrlKey&&s){const J=Gn(k),V=Gv(k),Q=B*Math.pow(2,V);return void I.scaleTo(D,Q,J,k)}const A=k.deltaMode===1?20:1;let U=l===Lo.Vertical?0:k.deltaX*A,$=l===Lo.Horizontal?0:k.deltaY*A;!Al()&&k.shiftKey&&l!==Lo.Vertical&&(U=k.deltaY*A,$=0),I.translateBy(D,-U/B*i,-$/B*i,{internal:!0});const X=Ll(D.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:G,onViewportChangeEnd:W}=j.getState();clearTimeout(N.current),z.current||(z.current=!0,e==null||e(k,X),Y==null||Y(X)),z.current&&(t==null||t(k,X),G==null||G(X),N.current=setTimeout(()=>{n==null||n(k,X),W==null||W(X),z.current=!1},150))},{passive:!1}))},[O,a,l,D,I,F,P,s,b,v,e,t,n]),T.useEffect(()=>{I&&I.on("start",k=>{var U,$;if(!k.sourceEvent||k.sourceEvent.internal)return null;R.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=j.getState(),A=Ll(k.transform);C.current=!0,M.current=A,(($=k.sourceEvent)==null?void 0:$.type)==="mousedown"&&j.setState({paneDragging:!0}),B==null||B(A),e==null||e(k.sourceEvent,A)})},[I,e]),T.useEffect(()=>{I&&(O&&!C.current?I.on("zoom",null):O||I.on("zoom",k=>{var A;const{onViewportChange:B}=j.getState();if(j.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),_.current=!(!o||!qv(h,R.current??0)),(t||B)&&!((A=k.sourceEvent)!=null&&A.internal)){const U=Ll(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[O,I,t,h,o]),T.useEffect(()=>{I&&I.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=j.getState();if(C.current=!1,j.setState({paneDragging:!1}),o&&qv(h,R.current??0)&&!_.current&&o(k.sourceEvent),_.current=!1,(n||B)&&(A=M.current,U=k.transform,A.x!==U.x||A.y!==U.y||A.zoom!==U.k)){const $=Ll(k.transform);M.current=$,clearTimeout(S.current),S.current=setTimeout(()=>{B==null||B($),n==null||n(k.sourceEvent,$)},a?150:0)}var A,U})},[I,a,h,n,o]),T.useEffect(()=>{I&&I.filter(k=>{const B=P||r,A=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(Xr(k,"react-flow__node")||Xr(k,"react-flow__edge")))return!0;if(!(h||B||a||d||s)||O||!d&&k.type==="dblclick"||Xr(k,v)&&k.type==="wheel"||Xr(k,w)&&(k.type!=="wheel"||a&&k.type==="wheel"&&!P)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!a&&!A&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[O,I,r,s,a,d,h,u,P]),q.createElement("div",{className:"react-flow__renderer",ref:E,style:zh},y)},uA=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function hA(){const{userSelectionActive:t,userSelectionRect:e}=lt(uA,Vt);return t&&e?q.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Yv(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const a=Math.abs(e.position.x);o.position.x=o.position.x-a,o.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);o.position.y=o.position.y-a,o.style.height+=a,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Kv(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(i=>i.id===r.id);if(s.length===0)return o.push(r),o;const a={...r};for(const i of s)if(i)switch(i.type){case"select":a.selected=i.selected;break;case"position":i.position!==void 0&&(a.position=i.position),i.positionAbsolute!==void 0&&(a.positionAbsolute=i.positionAbsolute),i.dragging!==void 0&&(a.dragging=i.dragging),a.expandParent&&Yv(o,a);break;case"dimensions":i.dimensions!==void 0&&(a.width=i.dimensions.width,a.height=i.dimensions.height),i.updateStyle!==void 0&&(a.style={...a.style||{},...i.dimensions}),typeof i.resizing=="boolean"&&(a.resizing=i.resizing),a.expandParent&&Yv(o,a);break;case"remove":return o}return o.push(a),o},n)}function Xv(t,e){return Kv(t,e)}const Bo=(t,e)=>({id:t,type:"select",selected:e});function Jr(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Bo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Bo(o.id,!1))),n},[])}const Bh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},fA=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Jv=T.memo(({isSelecting:t,selectionMode:e=xa.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:a,onPaneScroll:i,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:u,children:h})=>{const f=T.useRef(null),m=Ft(),x=T.useRef(0),g=T.useRef(0),p=T.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=lt(fA,Vt),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,g.current=0},S=_=>{s==null||s(_),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},j=i?_=>i(_):void 0,C=y&&(t||b);return q.createElement("div",{className:Xt(["react-flow__pane",{dragging:v,selection:t}]),onClick:C?void 0:Bh(S,f),onContextMenu:Bh(_=>{Array.isArray(n)&&(n!=null&&n.includes(2))?_.preventDefault():a==null||a(_)},f),onWheel:Bh(j,f),onMouseEnter:C?void 0:l,onMouseDown:C?_=>{const{resetSelectedElements:E,domNode:M}=m.getState();if(p.current=M==null?void 0:M.getBoundingClientRect(),!y||!t||_.button!==0||_.target!==f.current||!p.current)return;const{x:I,y:D}=Ro(_,p.current);E(),m.setState({userSelectionRect:{width:0,height:0,startX:I,startY:D,x:I,y:D}}),o==null||o(_)}:void 0,onMouseMove:C?_=>{const{userSelectionRect:E,nodeInternals:M,edges:I,transform:D,onNodesChange:F,onEdgesChange:O,nodeOrigin:P,getNodes:R}=m.getState();if(!t||!p.current||!E)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=Ro(_,p.current),N=E.startX??0,k=E.startY??0,B={...E,x:z.x<N?z.x:N,y:z.y<k?z.y:k,width:Math.abs(z.x-N),height:Math.abs(z.y-k)},A=R(),U=jv(M,B,D,e===xa.Partial,!0,P),$=Sv(U,I).map(Y=>Y.id),X=U.map(Y=>Y.id);if(x.current!==X.length){x.current=X.length;const Y=Jr(A,X);Y.length&&(F==null||F(Y))}if(g.current!==$.length){g.current=$.length;const Y=Jr(I,$);Y.length&&(O==null||O(Y))}m.setState({userSelectionRect:B})}:d,onMouseUp:C?_=>{if(_.button!==0)return;const{userSelectionRect:E}=m.getState();!b&&E&&_.target===f.current&&(S==null||S(_)),m.setState({nodesSelectionActive:x.current>0}),w(),r==null||r(_)}:void 0,onMouseLeave:C?_=>{b&&(m.setState({nodesSelectionActive:x.current>0}),r==null||r(_)),w()}:u,ref:f,style:zh},h,q.createElement(hA,null))});function Zv(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Zv(o,e))}function Qv(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 mA(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Zv(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,a;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((a=r.positionAbsolute)==null?void 0:a.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 e2(t,e,n,o,r=[0,0],s){const a=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let i=a;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Gr(h,r).positionAbsolute;i=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Gr(h,r).positionAbsolute;i=h&&Sn(f)&&Sn(m)&&Sn(h.width)&&Sn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:i}else s==null||s("005",O8()),i=a;let d={x:0,y:0};if(l){const h=n.get(l);d=Gr(h,r).positionAbsolute}const u=i&&i!=="parent"?wh(e,i):e;return{position:{x:u.x-d.x,y:u.y-d.y},positionAbsolute:u}}function Uh({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]}Jv.displayName="Pane";const t2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),a=e.getBoundingClientRect(),i=a.width*o[0],l=a.height*o[1];return s.map(d=>{const u=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(u.left-a.left-i)/n,y:(u.top-a.top-l)/n,...vh(d)}})};function wa(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function $h({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeInternals:i,onError:l}=e.getState(),d=i.get(t);d?(e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",F8(t))}function Vh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function n2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:a}){const i=Ft(),[l,d]=T.useState(!1),u=T.useRef([]),h=T.useRef({x:null,y:null}),f=T.useRef(0),m=T.useRef(null),x=T.useRef({x:0,y:0}),g=T.useRef(null),p=T.useRef(!1),b=T.useRef(!1),y=T.useRef(!1),v=function(){const w=Ft();return T.useCallback(({sourceEvent:j})=>{const{transform:C,snapGrid:_,snapToGrid:E}=w.getState(),M=j.touches?j.touches[0].clientX:j.clientX,I=j.touches?j.touches[0].clientY:j.clientY,D={x:(M-C[0])/C[2],y:(I-C[1])/C[2]};return{xSnapped:E?_[0]*Math.round(D.x/_[0]):D.x,ySnapped:E?_[1]*Math.round(D.y/_[1]):D.y,...D}},[])}();return T.useEffect(()=>{if(t!=null&&t.current){const w=Bn(t.current),S=({x:_,y:E})=>{const{nodeInternals:M,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:F,nodeExtent:O,snapGrid:P,snapToGrid:R,nodeOrigin:z,onError:N}=i.getState();h.current={x:_,y:E};let k=!1,B={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&O){const U=Oh(u.current,z);B=kh(U)}if(u.current=u.current.map(U=>{const $={x:_-U.distance.x,y:E-U.distance.y};R&&($.x=P[0]*Math.round($.x/P[0]),$.y=P[1]*Math.round($.y/P[1]));const X=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];u.current.length>1&&O&&!U.extent&&(X[0][0]=U.positionAbsolute.x-B.x+O[0][0],X[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+O[1][0],X[0][1]=U.positionAbsolute.y-B.y+O[0][1],X[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+O[1][1]);const Y=e2(U,$,M,X,z,N);return k=k||U.position.x!==Y.position.x||U.position.y!==Y.position.y,U.position=Y.position,U.positionAbsolute=Y.positionAbsolute,U}),!k)return;F(u.current,!0,!0),d(!0);const A=r?I:Vh(D);if(A&&g.current){const[U,$]=Uh({nodeId:r,dragItems:u.current,nodeInternals:M});A(g.current,U,$)}},j=()=>{if(!m.current)return;const[_,E]=av(x.current,m.current);if(_!==0||E!==0){const{transform:M,panBy:I}=i.getState();h.current.x=(h.current.x??0)-_/M[2],h.current.y=(h.current.y??0)-E/M[2],I({x:_,y:E})&&S(h.current)}f.current=requestAnimationFrame(j)},C=_=>{var z;const{nodeInternals:E,multiSelectionActive:M,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:F,onSelectionDragStart:O}=i.getState();b.current=!0;const P=r?F:Vh(O);a&&s||M||!r||(z=E.get(r))!=null&&z.selected||D(),r&&s&&a&&$h({id:r,store:i,nodeRef:t});const R=v(_);if(h.current=R,u.current=mA(E,I,R,r),P&&u.current){const[N,k]=Uh({nodeId:r,dragItems:u.current,nodeInternals:E});P(_.sourceEvent,N,k)}};if(!e){const _=function(){var E,M,I,D,F=v8,O=w8,P=k8,R=j8,z={},N=Dj("start","drag","end"),k=0,B=0;function A(V){V.on("mousedown.drag",U).filter(R).on("touchstart.drag",Y).on("touchmove.drag",G,y8).on("touchend.drag touchcancel.drag",W).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(V,Q){if(!D&&F.call(this,V,Q)){var te=J(this,O.call(this,V,Q),V,Q,"mouse");te&&(Bn(V.view).on("mousemove.drag",$,fa).on("mouseup.drag",X,fa),tv(V.view),xh(V),I=!1,E=V.clientX,M=V.clientY,te("start",V))}}function $(V){if(Hr(V),!I){var Q=V.clientX-E,te=V.clientY-M;I=Q*Q+te*te>B}z.mouse("drag",V)}function X(V){Bn(V.view).on("mousemove.drag mouseup.drag",null),nv(V.view,I),Hr(V),z.mouse("end",V)}function Y(V,Q){if(F.call(this,V,Q)){var te,re,ne=V.changedTouches,ae=O.call(this,V,Q),se=ne.length;for(te=0;te<se;++te)(re=J(this,ae,V,Q,ne[te].identifier,ne[te]))&&(xh(V),re("start",V,ne[te]))}}function G(V){var Q,te,re=V.changedTouches,ne=re.length;for(Q=0;Q<ne;++Q)(te=z[re[Q].identifier])&&(Hr(V),te("drag",V,re[Q]))}function W(V){var Q,te,re=V.changedTouches,ne=re.length;for(D&&clearTimeout(D),D=setTimeout(function(){D=null},500),Q=0;Q<ne;++Q)(te=z[re[Q].identifier])&&(xh(V),te("end",V,re[Q]))}function J(V,Q,te,re,ne,ae){var se,ie,ge,oe=N.copy(),ue=Gn(ae||te,Q);if((ge=P.call(V,new bh("beforestart",{sourceEvent:te,target:A,identifier:ne,active:k,x:ue[0],y:ue[1],dx:0,dy:0,dispatch:oe}),re))!=null)return se=ge.x-ue[0]||0,ie=ge.y-ue[1]||0,function de(Ce,Te,Fe){var _e,ke=ue;switch(Ce){case"start":z[ne]=de,_e=k++;break;case"end":delete z[ne],--k;case"drag":ue=Gn(Fe||Te,Q),_e=k}oe.call(Ce,V,new bh(Ce,{sourceEvent:Te,subject:ge,target:A,identifier:ne,active:_e,x:ue[0]+se,y:ue[1]+ie,dx:ue[0]-ke[0],dy:ue[1]-ke[1],dispatch:oe}),re)}}return A.filter=function(V){return arguments.length?(F=typeof V=="function"?V:Nl(!!V),A):F},A.container=function(V){return arguments.length?(O=typeof V=="function"?V:Nl(V),A):O},A.subject=function(V){return arguments.length?(P=typeof V=="function"?V:Nl(V),A):P},A.touchable=function(V){return arguments.length?(R=typeof V=="function"?V:Nl(!!V),A):R},A.on=function(){var V=N.on.apply(N,arguments);return V===N?A:V},A.clickDistance=function(V){return arguments.length?(B=(V=+V)*V,A):Math.sqrt(B)},A}().on("start",E=>{const{domNode:M,nodeDragThreshold:I}=i.getState();I===0&&C(E),y.current=!1;const D=v(E);h.current=D,m.current=(M==null?void 0:M.getBoundingClientRect())||null,x.current=Ro(E.sourceEvent,m.current)}).on("drag",E=>{var F,O;const M=v(E),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=i.getState();if(E.sourceEvent.type==="touchmove"&&E.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&I&&(p.current=!0,j()),!b.current){const P=M.xSnapped-(((F=h==null?void 0:h.current)==null?void 0:F.x)??0),R=M.ySnapped-(((O=h==null?void 0:h.current)==null?void 0:O.y)??0);Math.sqrt(P*P+R*R)>D&&C(E)}(h.current.x!==M.xSnapped||h.current.y!==M.ySnapped)&&u.current&&b.current&&(g.current=E.sourceEvent,x.current=Ro(E.sourceEvent,m.current),S(M))}}).on("end",E=>{if(b.current&&!y.current&&(d(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:M,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:F}=i.getState(),O=r?D:Vh(F);if(M(u.current,!1,!1),O){const[P,R]=Uh({nodeId:r,dragItems:u.current,nodeInternals:I});O(E.sourceEvent,P,R)}}}).filter(E=>{const M=E.target;return!E.button&&(!n||!Qv(M,`.${n}`,t))&&(!o||Qv(M,o,t))});return w.call(_),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,i,r,a,v]),l}function o2(){const t=Ft();return T.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:a,snapToGrid:i,snapGrid:l,onError:d,nodesDraggable:u}=t.getState(),h=a().filter(y=>y.selected&&(y.draggable||u&&y.draggable===void 0)),f=i?l[0]:5,m=i?l[1]:5,x=n.isShiftPressed?4:1,g=n.x*f*x,p=n.y*m*x,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};i&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:S}=e2(y,v,o,r,void 0,d);y.position=S,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const Zr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ka=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:a,xPosOrigin:i,yPosOrigin:l,selected:d,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:x,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:S,selectNodesOnDrag:j,sourcePosition:C,targetPosition:_,hidden:E,resizeObserver:M,dragHandle:I,zIndex:D,isParent:F,noDragClassName:O,noPanClassName:P,initialized:R,disableKeyboardA11y:z,ariaLabel:N,rfId:k,hasHandleBounds:B})=>{const A=Ft(),U=T.useRef(null),$=T.useRef(null),X=T.useRef(C),Y=T.useRef(_),G=T.useRef(o),W=v||y||u||h||f||m,J=o2(),V=wa(n,A.getState,h),Q=wa(n,A.getState,f),te=wa(n,A.getState,m),re=wa(n,A.getState,x),ne=wa(n,A.getState,g);T.useEffect(()=>()=>{$.current&&(M==null||M.unobserve($.current),$.current=null)},[]),T.useEffect(()=>{if(U.current&&!E){const se=U.current;R&&B&&$.current===se||($.current&&(M==null||M.unobserve($.current)),M==null||M.observe(se),$.current=se)}},[E,R,B]),T.useEffect(()=>{const se=G.current!==o,ie=X.current!==C,ge=Y.current!==_;U.current&&(se||ie||ge)&&(se&&(G.current=o),ie&&(X.current=C),ge&&(Y.current=_),A.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,C,_]);const ae=n2({nodeRef:U,disabled:E||!y,noDragClassName:O,handleSelector:I,nodeId:n,isSelectable:v,selectNodesOnDrag:j});return E?null:q.createElement("div",{className:Xt(["react-flow__node",`react-flow__node-${o}`,{[P]:y},b,{selected:d,selectable:v,parent:F,dragging:ae}]),ref:U,style:{zIndex:D,transform:`translate(${i}px,${l}px)`,pointerEvents:W?"all":"none",visibility:R?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:V,onMouseMove:Q,onMouseLeave:te,onContextMenu:re,onClick:se=>{const{nodeDragThreshold:ie}=A.getState();if(v&&(!j||!y||ie>0)&&$h({id:n,store:A,nodeRef:U}),u){const ge=A.getState().nodeInternals.get(n);ge&&u(se,{...ge})}},onDoubleClick:ne,onKeyDown:S?se=>{if(!Sh(se)&&!z)if(cv.includes(se.key)&&v){const ie=se.key==="Escape";$h({id:n,store:A,unselect:ie,nodeRef:U})}else y&&d&&Object.prototype.hasOwnProperty.call(Zr,se.key)&&(A.setState({ariaLiveMessage:`Moved selected node ${se.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~a}`}),J({x:Zr[se.key].x,y:Zr[se.key].y,isShiftPressed:se.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":z?void 0:`${zv}-${k}`,"aria-label":N},q.createElement(V8,{value:n},q.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:a,selected:d,isConnectable:w,sourcePosition:C,targetPosition:_,dragging:ae,dragHandle:I,zIndex:D})))};return e.displayName="NodeWrapper",T.memo(e)};const pA=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Oh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var gA=T.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Ft(),{width:r,height:s,x:a,y:i,transformString:l,userSelectionActive:d}=lt(pA,Vt),u=o2(),h=T.useRef(null);if(T.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),n2({nodeRef:h}),d||!r||!s)return null;const f=t?m=>{const x=o.getState().getNodes().filter(g=>g.selected);t(m,x)}:void 0;return q.createElement("div",{className:Xt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},q.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(Zr,m.key)&&u({x:Zr[m.key].x,y:Zr[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:i,left:a}}))});const xA=t=>t.nodesSelectionActive,r2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,deleteKeyCode:i,onMove:l,onMoveStart:d,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:x,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:j,panOnScrollSpeed:C,panOnScrollMode:_,zoomOnDoubleClick:E,panOnDrag:M,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,preventScrolling:P,onSelectionContextMenu:R,noWheelClassName:z,noPanClassName:N,disableKeyboardA11y:k})=>{const B=lt(xA),A=ya(h),U=ya(b),$=U||M,X=U||j,Y=A||f&&$!==!0;return(({deleteKeyCode:G,multiSelectionKeyCode:W})=>{const J=Ft(),{deleteElements:V}=va(),Q=ya(G,lA),te=ya(W);T.useEffect(()=>{if(Q){const{edges:re,getNodes:ne}=J.getState(),ae=ne().filter(ie=>ie.selected),se=re.filter(ie=>ie.selected);V({nodes:ae,edges:se}),J.setState({nodesSelectionActive:!1})}},[Q]),T.useEffect(()=>{J.setState({multiSelectionActive:te})},[te])})({deleteKeyCode:i,multiSelectionKeyCode:p}),q.createElement(dA,{onMove:l,onMoveStart:d,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:X,panOnScrollSpeed:C,panOnScrollMode:_,zoomOnDoubleClick:E,panOnDrag:!A&&$,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:z,noPanClassName:N},q.createElement(Jv,{onSelectionStart:x,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:$,isSelecting:!!Y,selectionMode:m},t,B&&q.createElement(gA,{onSelectionContextMenu:R,noPanClassName:N,disableKeyboardA11y:k})))};r2.displayName="FlowRenderer";var bA=T.memo(r2);function yA(t){return{input:ka(t.input||Dv),default:ka(t.default||Rh),output:ka(t.output||Rv),group:ka(t.group||Lh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=ka(t[n]||Rh),e),{})}}const vA=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),s2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:a}=lt(vA,Vt),i=(l=t.onlyRenderVisibleElements,lt(T.useCallback(h=>l?jv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const d=T.useRef(),u=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));s(m)});return d.current=h,h},[]);return T.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),q.createElement("div",{className:"react-flow__nodes",style:zh},i.map(h=>{var j,C,_;let f=h.type||"default";t.nodeTypes[f]||(a==null||a("003",T8(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,x=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?wh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,S=(({x:E,y:M,width:I,height:D,origin:F})=>I&&D?F[0]<0||F[1]<0||F[0]>1||F[1]>1?{x:E,y:M}:{x:E-I*F[0],y:M-D*F[1]}:{x:E,y:M})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return q.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((j=h[bt])==null?void 0:j.z)??0,isParent:!!((C=h[bt])!=null&&C.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((_=h[bt])!=null&&_.handleBounds)})}))};s2.displayName="NodeRenderer";var wA=T.memo(s2);const kA=(t,e,n)=>n===Oe.Left?t-e:n===Oe.Right?t+e:t,jA=(t,e,n)=>n===Oe.Top?t-e:n===Oe.Bottom?t+e:t,a2="react-flow__edgeupdater",i2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:i})=>q.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Xt([a2,`${a2}-${i}`]),cx:kA(e,o,t),cy:jA(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),SA=()=>!0;var Qr=t=>{const e=({id:n,className:o,type:r,data:s,onClick:a,onEdgeDoubleClick:i,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:S,targetY:j,sourcePosition:C,targetPosition:_,elementsSelectable:E,hidden:M,sourceHandleId:I,targetHandleId:D,onContextMenu:F,onMouseEnter:O,onMouseMove:P,onMouseLeave:R,reconnectRadius:z,onReconnect:N,onReconnectStart:k,onReconnectEnd:B,markerEnd:A,markerStart:U,rfId:$,ariaLabel:X,isFocusable:Y,isReconnectable:G,pathOptions:W,interactionWidth:J,disableKeyboardA11y:V})=>{const Q=T.useRef(null),[te,re]=T.useState(!1),[ne,ae]=T.useState(!1),se=Ft(),ie=T.useMemo(()=>`url('#${Th(U,$)}')`,[U,$]),ge=T.useMemo(()=>`url('#${Th(A,$)}')`,[A,$]);if(M)return null;const oe=ga(n,se.getState,i),ue=ga(n,se.getState,F),de=ga(n,se.getState,O),Ce=ga(n,se.getState,P),Te=ga(n,se.getState,R),Fe=(Ve,Ke)=>{if(Ve.button!==0)return;const{edges:ee,isValidConnection:ye}=se.getState(),we=Ke?y:b,Ie=(Ke?D:I)||null,K=Ke?"target":"source",me=ye||SA,pe=Ke,he=ee.find(je=>je.id===n);ae(!0),k==null||k(Ve,he,K),Iv({event:Ve,handleId:Ie,nodeId:we,onConnect:je=>N==null?void 0:N(he,je),isTarget:pe,getState:se.getState,setState:se.setState,isValidConnection:me,edgeUpdaterType:K,onReconnectEnd:je=>{ae(!1),B==null||B(je,he,K)}})},_e=()=>re(!0),ke=()=>re(!1),Ye=!E&&!a;return q.createElement("g",{className:Xt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:d,inactive:Ye,updating:te}]),onClick:Ve=>{var K;const{edges:Ke,addSelectedEdges:ee,unselectNodesAndEdges:ye,multiSelectionActive:we}=se.getState(),Ie=Ke.find(me=>me.id===n);Ie&&(E&&(se.setState({nodesSelectionActive:!1}),Ie.selected&&we?(ye({nodes:[],edges:[Ie]}),(K=Q.current)==null||K.blur()):ee([n])),a&&a(Ve,Ie))},onDoubleClick:oe,onContextMenu:ue,onMouseEnter:de,onMouseMove:Ce,onMouseLeave:Te,onKeyDown:Y?Ve=>{var Ke;if(!V&&cv.includes(Ve.key)&&E){const{unselectNodesAndEdges:ee,addSelectedEdges:ye,edges:we}=se.getState();Ve.key==="Escape"?((Ke=Q.current)==null||Ke.blur(),ee({edges:[we.find(Ie=>Ie.id===n)]})):ye([n])}}:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":X===null?void 0:X||`Edge from ${b} to ${y}`,"aria-describedby":Y?`${Bv}-${$}`:void 0,ref:Q},!ne&&q.createElement(t,{id:n,source:b,target:y,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,data:s,style:p,sourceX:v,sourceY:w,targetX:S,targetY:j,sourcePosition:C,targetPosition:_,sourceHandleId:I,targetHandleId:D,markerStart:ie,markerEnd:ge,pathOptions:W,interactionWidth:J}),G&&q.createElement(q.Fragment,null,(G==="source"||G===!0)&&q.createElement(i2,{position:C,centerX:v,centerY:w,radius:z,onMouseDown:Ve=>Fe(Ve,!0),onMouseEnter:_e,onMouseOut:ke,type:"source"}),(G==="target"||G===!0)&&q.createElement(i2,{position:_,centerX:S,centerY:j,radius:z,onMouseDown:Ve=>Fe(Ve,!1),onMouseEnter:_e,onMouseOut:ke,type:"target"})))};return e.displayName="EdgeWrapper",T.memo(e)};function CA(t){return{default:Qr(t.default||Dl),straight:Qr(t.bezier||Ih),step:Qr(t.step||_h),smoothstep:Qr(t.step||Ml),simplebezier:Qr(t.simplebezier||Nh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=Qr(t[n]||Dl),e),{})}}function l2(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,a=(n==null?void 0:n.height)||e.height;switch(t){case Oe.Top:return{x:o+s/2,y:r};case Oe.Right:return{x:o+s,y:r+a/2};case Oe.Bottom:return{x:o+s/2,y:r+a};case Oe.Left:return{x:o,y:r+a/2}}}function c2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function d2(t){var o,r,s,a,i;const e=((o=t==null?void 0:t[bt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.x)||0,y:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const NA=[{level:0,isMaxLevel:!0,edges:[]}];function EA(t,e,n){return function(o,r,s=!1){let a=-1;const i=o.reduce((d,u)=>{var m,x;const h=Sn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[bt])==null?void 0:m.z)||0,((x=g==null?void 0:g[bt])==null?void 0:x.z)||0,1e3);f=(h?u.zIndex:0)+(b?y:0)}return d[f]?d[f].push(u):d[f]=[u],a=f>a?f:a,d},{}),l=Object.entries(i).map(([d,u])=>{const h=+d;return{edges:u,level:h,isMaxLevel:h===a}});return l.length===0?NA:l}(lt(T.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),a=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&function({sourcePos:i,targetPos:l,sourceWidth:d,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:x,transform:g}){const p={x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x+d,l.x+h),y2:Math.max(i.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=kh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:x/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const u2={[qr.Arrow]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[qr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},_A=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:i="auto-start-reverse"})=>{const l=function(d){const u=Ft();return T.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(u2,d)?u2[d]:((f=(h=u.getState()).onError)==null||f.call(h,"009",D8(d)),null)},[d])}(e);return l?q.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:i,refX:"0",refY:"0"},q.createElement(l,{color:n,strokeWidth:a})):null},h2=({defaultColor:t,rfId:e})=>{const n=lt(T.useCallback((({defaultColor:o,rfId:r})=>s=>{const a=[];return s.edges.reduce((i,l)=>([l.markerStart,l.markerEnd].forEach(d=>{if(d&&typeof d=="object"){const u=Th(d,r);a.includes(u)||(i.push({id:u,color:d.color||o,...d}),a.push(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,a)=>s.id!==r[a].id)));return q.createElement("defs",null,n.map(o=>q.createElement(_A,{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})))};h2.displayName="MarkerDefinitions";var IA=T.memo(h2);const AA=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}),f2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:a,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:S,height:j,connectionMode:C,nodeInternals:_,onError:E}=lt(AA,Vt),M=EA(e,_,n);return S?q.createElement(q.Fragment,null,M.map(({level:I,edges:D,isMaxLevel:F})=>q.createElement("svg",{key:I,style:{zIndex:I},width:S,height:j,className:"react-flow__edges react-flow__container"},F&&q.createElement(IA,{defaultColor:t,rfId:o}),q.createElement("g",null,D.map(O=>{const[P,R,z]=d2(_.get(O.source)),[N,k,B]=d2(_.get(O.target));if(!z||!B)return null;let A=O.type||"default";r[A]||(E==null||E("011",L8(A)),A="default");const U=r[A]||r.default,$=C===lr.Strict?k.target:(k.target??[]).concat(k.source??[]),X=c2(R.source,O.sourceHandle),Y=c2($,O.targetHandle),G=(X==null?void 0:X.position)||Oe.Bottom,W=(Y==null?void 0:Y.position)||Oe.Top,J=!!(O.focusable||y&&O.focusable===void 0),V=O.reconnectable||O.updatable,Q=f!==void 0&&(V||v&&V===void 0);if(!X||!Y)return E==null||E("008",P8(X,O)),null;const{sourceX:te,sourceY:re,targetX:ne,targetY:ae}=((se,ie,ge,oe,ue,de)=>{const Ce=l2(ge,se,ie),Te=l2(de,oe,ue);return{sourceX:Ce.x,sourceY:Ce.y,targetX:Te.x,targetY:Te.y}})(P,X,G,N,Y,W);return q.createElement(U,{key:O.id,id:O.id,className:Xt([O.className,s]),type:A,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:te,sourceY:re,targetX:ne,targetY:ae,sourcePosition:G,targetPosition:W,elementsSelectable:w,onContextMenu:a,onMouseEnter:i,onMouseMove:l,onMouseLeave:d,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:J,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};f2.displayName="EdgeRenderer";var TA=T.memo(f2);const MA=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function OA({children:t}){const e=lt(MA);return q.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const DA={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},m2=({nodeId:t,handleType:e,style:n,type:o=Fo.Bezier,CustomComponent:r,connectionStatus:s})=>{var j,C,_;const{fromNode:a,handleId:i,toX:l,toY:d,connectionMode:u}=lt(T.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),Vt),h=(j=a==null?void 0:a[bt])==null?void 0:j.handleBounds;let f=h==null?void 0:h[e];if(u===lr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!a||!f)return null;const m=i?f.find(E=>E.id===i):f[0],x=m?m.x+m.width/2:(a.width??0)/2,g=m?m.y+m.height/2:a.height??0,p=(((C=a.positionAbsolute)==null?void 0:C.x)??0)+x,b=(((_=a.positionAbsolute)==null?void 0:_.y)??0)+g,y=m==null?void 0:m.position,v=y?DA[y]:null;if(!y||!v)return null;if(r)return q.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:a,fromHandle:m,fromX:p,fromY:b,toX:l,toY:d,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:d,targetPosition:v};return o===Fo.Bezier?[w]=wv(S):o===Fo.Step?[w]=Eh({...S,borderRadius:0}):o===Fo.SmoothStep?[w]=Eh(S):o===Fo.SimpleBezier?[w]=xv(S):w=`M${p},${b} ${l},${d}`,q.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};m2.displayName="ConnectionLine";const PA=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function RA({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:a,width:i,height:l,connectionStatus:d}=lt(PA,Vt);return r&&s&&i&&a?q.createElement("svg",{style:t,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},q.createElement("g",{className:Xt(["react-flow__connection",d])},q.createElement(m2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:d}))):null}function p2(t,e){return T.useRef(null),Ft(),T.useMemo(()=>e(t),[t])}const g2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:a,onEdgeClick:i,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:x,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:S,selectionOnDrag:j,selectionMode:C,multiSelectionKeyCode:_,panActivationKeyCode:E,zoomActivationKeyCode:M,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:F,selectNodesOnDrag:O,defaultViewport:P,translateExtent:R,minZoom:z,maxZoom:N,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:A,zoomOnPinch:U,panOnScroll:$,panOnScrollSpeed:X,panOnScrollMode:Y,zoomOnDoubleClick:G,panOnDrag:W,onPaneClick:J,onPaneMouseEnter:V,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneScroll:re,onPaneContextMenu:ne,onEdgeContextMenu:ae,onEdgeMouseEnter:se,onEdgeMouseMove:ie,onEdgeMouseLeave:ge,onReconnect:oe,onReconnectStart:ue,onReconnectEnd:de,reconnectRadius:Ce,noDragClassName:Te,noWheelClassName:Fe,noPanClassName:_e,elevateEdgesOnSelect:ke,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})=>{const ye=p2(t,yA),we=p2(e,CA);return function(Ie){const K=va(),me=T.useRef(!1);T.useEffect(()=>{!me.current&&K.viewportInitialized&&Ie&&(setTimeout(()=>Ie(K),1),me.current=!0)},[Ie,K.viewportInitialized])}(s),q.createElement(bA,{onPaneClick:J,onPaneMouseEnter:V,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneContextMenu:ne,onPaneScroll:re,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:j,selectionMode:C,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:_,panActivationKeyCode:E,zoomActivationKeyCode:M,elementsSelectable:F,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:A,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:$,panOnScrollSpeed:X,panOnScrollMode:Y,panOnDrag:W,defaultViewport:P,translateExtent:R,minZoom:z,maxZoom:N,onSelectionContextMenu:x,preventScrolling:k,noDragClassName:Te,noWheelClassName:Fe,noPanClassName:_e,disableKeyboardA11y:Ye},q.createElement(OA,null,q.createElement(TA,{edgeTypes:we,onEdgeClick:i,onEdgeDoubleClick:d,onlyRenderVisibleElements:D,onEdgeContextMenu:ae,onEdgeMouseEnter:se,onEdgeMouseMove:ie,onEdgeMouseLeave:ge,onReconnect:oe,onReconnectStart:ue,onReconnectEnd:de,reconnectRadius:Ce,defaultMarkerColor:B,noPanClassName:_e,elevateEdgesOnSelect:!!ke,disableKeyboardA11y:Ye,rfId:ee},q.createElement(RA,{style:y,type:b,component:v,containerStyle:w})),q.createElement("div",{className:"react-flow__edgelabel-renderer"}),q.createElement(wA,{nodeTypes:ye,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:D,noPanClassName:_e,noDragClassName:Te,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})))};g2.displayName="GraphView";var LA=T.memo(g2);const Hh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Uo={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:Hh,nodeExtent:Hh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:lr.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},FA=()=>((t,e)=>t?ev(t,e):ev)((t,e)=>({...Uo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:Fh(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,a=r?Fh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:a,fitViewOnInitOptions:i,domNode:l,nodeOrigin:d}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[bt]:{...b[bt],handleBounds:void 0}});else if(b){const y=vh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[bt]:{...b[bt],handleBounds:{source:t2(".source",p.nodeElement,f,d),target:t2(".target",p.nodeElement,f,d)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);Hv(r,d);const x=a||s&&!a&&Wv(e,{initial:!0,...i});t({nodeInternals:new Map(r),fitViewOnInitDone:x}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),a=n.map(i=>{const l={id:i.id,type:"position",dragging:r};return o&&(l.positionAbsolute=i.positionAbsolute,l.position=i.position),l});s(a)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:a,getNodes:i,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const d=Fh(Xv(n,i()),r,a,l);t({nodeInternals:d})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Bo(l,!0)):(a=Jr(s(),n),i=Jr(r,[])),Rl({changedNodes:a,changedEdges:i,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>Bo(l,!0)):(a=Jr(r,n),i=Jr(s(),[])),Rl({changedNodes:i,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),a=o||r;Rl({changedNodes:(n||s()).map(i=>(i.selected=!1,Bo(i.id,!1))),changedEdges:a.map(i=>Bo(i.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();Rl({changedNodes:o().filter(r=>r.selected).map(r=>Bo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Bo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=wh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:a,d3Selection:i,translateExtent:l}=e();if(!a||!i||!n.x&&!n.y)return!1;const d=Jo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=a==null?void 0:a.constrain()(d,u,l);return a.transform(i,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Uo.connectionNodeId,connectionHandleId:Uo.connectionHandleId,connectionHandleType:Uo.connectionHandleType,connectionStatus:Uo.connectionStatus,connectionStartHandle:Uo.connectionStartHandle,connectionEndHandle:Uo.connectionEndHandle}),reset:()=>t({...Uo})}),Object.is),Wh=({children:t})=>{const e=T.useRef(null);return e.current||(e.current=FA()),q.createElement(A8,{value:e.current},t)};Wh.displayName="ReactFlowProvider";const x2=({children:t})=>T.useContext(_l)?q.createElement(q.Fragment,null,t):q.createElement(Wh,null,t);x2.displayName="ReactFlowWrapper";const zA={input:Dv,default:Rh,output:Rv,group:Lh},BA={default:Dl,straight:Ih,step:_h,smoothstep:Ml,simplebezier:Nh},UA=[0,0],$A=[15,15],VA={x:0,y:0,zoom:1},HA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},qh=T.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=zA,edgeTypes:a=BA,onNodeClick:i,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:j,onNodeDragStart:C,onNodeDrag:_,onNodeDragStop:E,onNodesDelete:M,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:F,onSelectionDrag:O,onSelectionDragStop:P,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:N,connectionMode:k=lr.Strict,connectionLineType:B=Fo.Bezier,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:$,deleteKeyCode:X="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:G=!1,selectionMode:W=xa.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:V=Al()?"Meta":"Control",zoomActivationKeyCode:Q=Al()?"Meta":"Control",snapToGrid:te=!1,snapGrid:re=$A,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ae=!0,nodesDraggable:se,nodesConnectable:ie,nodesFocusable:ge,nodeOrigin:oe=UA,edgesFocusable:ue,edgesUpdatable:de,elementsSelectable:Ce,defaultViewport:Te=VA,minZoom:Fe=.5,maxZoom:_e=2,translateExtent:ke=Hh,preventScrolling:Ye=!0,nodeExtent:Ve,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:ee=!0,zoomOnPinch:ye=!0,panOnScroll:we=!1,panOnScrollSpeed:Ie=.5,panOnScrollMode:K=Lo.Free,zoomOnDoubleClick:me=!0,panOnDrag:pe=!0,onPaneClick:he,onPaneMouseEnter:je,onPaneMouseMove:Pe,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,children:Ae,onEdgeContextMenu:Me,onEdgeDoubleClick:Be,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onEdgeUpdate:ot,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:st,onReconnect:Bt,onReconnectStart:Ht,onReconnectEnd:pn,reconnectRadius:Jt=10,edgeUpdaterRadius:Dn=10,onNodesChange:ts,onEdgesChange:Yn,noDragClassName:ko="nodrag",noWheelClassName:Nn="nowheel",noPanClassName:ns="nopan",fitView:Sa=!1,fitViewOptions:vM,connectOnClick:wM=!0,attributionPosition:kM,proOptions:jM,defaultEdgeOptions:SM,elevateNodesOnSelect:CM=!0,elevateEdgesOnSelect:NM=!1,disableKeyboardA11y:ck=!1,autoPanOnConnect:EM=!0,autoPanOnNodeDrag:_M=!0,connectionRadius:IM=20,isValidConnection:AM,onError:TM,style:MM,id:dk,nodeDragThreshold:OM,...DM},PM)=>{const Ff=dk||"1";return q.createElement("div",{...DM,style:{...MM,...HA},ref:PM,className:Xt(["react-flow",r]),"data-testid":"rf__wrapper",id:dk},q.createElement(x2,null,q.createElement(LA,{onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:j,nodeTypes:s,edgeTypes:a,connectionLineType:B,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:$,selectionKeyCode:Y,selectionOnDrag:G,selectionMode:W,deleteKeyCode:X,multiSelectionKeyCode:V,panActivationKeyCode:J,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ne,selectNodesOnDrag:ae,defaultViewport:Te,translateExtent:ke,minZoom:Fe,maxZoom:_e,preventScrolling:Ye,zoomOnScroll:ee,zoomOnPinch:ye,zoomOnDoubleClick:me,panOnScroll:we,panOnScrollSpeed:Ie,panOnScrollMode:K,panOnDrag:pe,onPaneClick:he,onPaneMouseEnter:je,onPaneMouseMove:Pe,onPaneMouseLeave:Re,onPaneScroll:He,onPaneContextMenu:le,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:N,onEdgeContextMenu:Me,onEdgeDoubleClick:Be,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onReconnect:Bt??ot,onReconnectStart:Ht??Xe,onReconnectEnd:pn??st,reconnectRadius:Jt??Dn,defaultMarkerColor:Ke,noDragClassName:ko,noWheelClassName:Nn,noPanClassName:ns,elevateEdgesOnSelect:NM,rfId:Ff,disableKeyboardA11y:ck,nodeOrigin:oe,nodeExtent:Ve}),q.createElement(Q8,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:se,nodesConnectable:ie,nodesFocusable:ge,edgesFocusable:ue,edgesUpdatable:de,elementsSelectable:Ce,elevateNodesOnSelect:CM,minZoom:Fe,maxZoom:_e,nodeExtent:Ve,onNodesChange:ts,onEdgesChange:Yn,snapToGrid:te,snapGrid:re,connectionMode:k,translateExtent:ke,connectOnClick:wM,defaultEdgeOptions:SM,fitView:Sa,fitViewOptions:vM,onNodesDelete:M,onEdgesDelete:I,onNodeDragStart:C,onNodeDrag:_,onNodeDragStop:E,onSelectionDrag:O,onSelectionDragStart:F,onSelectionDragStop:P,noPanClassName:ns,nodeOrigin:oe,rfId:Ff,autoPanOnConnect:EM,autoPanOnNodeDrag:_M,onError:TM,connectionRadius:IM,isValidConnection:AM,nodeDragThreshold:OM}),q.createElement(J8,{onSelectionChange:D}),Ae,q.createElement(B8,{proOptions:jM,position:kM}),q.createElement(oA,{rfId:Ff,disableKeyboardA11y:ck})))});function b2(t){return e=>{const[n,o]=T.useState(e),r=T.useCallback(s=>o(a=>t(s,a)),[]);return[n,o,r]}}qh.displayName="ReactFlow";const y2=b2(Xv),v2=b2(function(t,e){return Kv(t,e)});function WA(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},q.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function qA(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},q.createElement("path",{d:"M0 0h32v4.2H0z"}))}function GA(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},q.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function YA(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function KA(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const es=({children:t,className:e,...n})=>q.createElement("button",{type:"button",className:Xt(["react-flow__controls-button",e]),...n},t);es.displayName="ControlButton";const XA=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),w2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:i,onInteractiveChange:l,className:d,children:u,position:h="bottom-left"})=>{const f=Ft(),[m,x]=T.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=lt(XA,Vt),{zoomIn:y,zoomOut:v,fitView:w}=va();return T.useEffect(()=>{x(!0)},[]),m?q.createElement(Il,{className:Xt(["react-flow__controls",d]),position:h,style:t,"data-testid":"rf__controls"},e&&q.createElement(q.Fragment,null,q.createElement(es,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},q.createElement(WA,null)),q.createElement(es,{onClick:()=>{v(),a==null||a()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},q.createElement(qA,null))),n&&q.createElement(es,{className:"react-flow__controls-fitview",onClick:()=>{w(r),i==null||i()},title:"fit view","aria-label":"fit view"},q.createElement(GA,null)),o&&q.createElement(es,{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?q.createElement(KA,null):q.createElement(YA,null)),u):null};w2.displayName="Controls";var Cn,JA=T.memo(w2);function ZA({color:t,dimensions:e,lineWidth:n}){return q.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function QA({color:t,radius:e}){return q.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Cn||(Cn={}));const eT={[Cn.Dots]:"#91919a",[Cn.Lines]:"#eee",[Cn.Cross]:"#e2e2e2"},tT={[Cn.Dots]:1,[Cn.Lines]:1,[Cn.Cross]:6},nT=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function k2({id:t,variant:e=Cn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:a,style:i,className:l}){const d=T.useRef(null),{transform:u,patternId:h}=lt(nT,Vt),f=a||eT[e],m=o||tT[e],x=e===Cn.Dots,g=e===Cn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],y=m*u[2],v=g?[y,y]:b,w=x?[y/s,y/s]:[v[0]/s,v[1]/s];return q.createElement("svg",{className:Xt(["react-flow__background",l]),style:{...i,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},q.createElement("pattern",{id:h+t,x:u[0]%b[0],y:u[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},x?q.createElement(QA,{color:f,radius:y/s}):q.createElement(ZA,{dimensions:v,color:f,lineWidth:r})),q.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}k2.displayName="Background";var oT=T.memo(k2);function Gh(t){return Math.min(11*t+35,200)}const j2=q.createContext("LR"),S2=T.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Se(n.atom),s=gr().inOrderIds.indexOf(r.id),a=o?"var(--gray-9)":"var(--gray-3)",i=lt(rT),l=T.use(j2);let d,u,h,f,m;if(e[0]!==r.code||e[1]!==a||e[2]!==l||e[3]!==o){const I=r.code.split(`
|
145
|
-
`).length,D=l==="LR"?Oe.Left:Oe.Top;let F;e[8]!==a?(F={background:a},e[8]=a,e[9]=F):F=e[9],e[10]!==D||e[11]!==F?(h=c.jsx(zo,{type:"target",id:"inputs",position:D,style:F}),e[10]=D,e[11]=F,e[12]=h):h=e[12];const O=l==="LR"?Oe.Left:Oe.Top;let P;e[13]!==a?(P={background:a},e[13]=a,e[14]=P):P=e[14],e[15]!==O||e[16]!==P?(f=c.jsx(zo,{type:"source",id:"inputs",position:O,style:P}),e[15]=O,e[16]=P,e[17]=f):f=e[17];const R=o&&"border-primary";e[18]!==R?(u=xe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",R),e[18]=R,e[19]=u):u=e[19],d=Gh(I),e[0]=r.code,e[1]=a,e[2]=l,e[3]=o,e[4]=d,e[5]=u,e[6]=h,e[7]=f}else d=e[4],u=e[5],h=e[6],f=e[7];var x;let g;e[20]!==n.forceWidth||e[21]!==i?(m=n.forceWidth||(x=i,Math.min(Math.max(x-100,100),400)),e[20]=n.forceWidth,e[21]=i,e[22]=m):m=e[22],e[23]!==d||e[24]!==m?(g={height:d,width:m},e[23]=d,e[24]=m,e[25]=g):g=e[25];const p=mP(r.name,s);let b,y,v;e[26]!==p?(b=c.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=c.jsx(VR,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==y?(v=c.jsxs("div",{className:u,style:g,children:[b,y]}),e[30]=u,e[31]=g,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Oe.Right:Oe.Bottom;let S,j;e[35]!==a?(S={background:a},e[35]=a,e[36]=S):S=e[36],e[37]!==w||e[38]!==S?(j=c.jsx(zo,{type:"source",id:"outputs",position:w,style:S}),e[37]=w,e[38]=S,e[39]=j):j=e[39];const C=l==="LR"?Oe.Right:Oe.Bottom;let _,E,M;return e[40]!==a?(_={background:a},e[40]=a,e[41]=_):_=e[41],e[42]!==C||e[43]!==_?(E=c.jsx(zo,{type:"target",id:"outputs",position:C,style:_}),e[42]=C,e[43]=_,e[44]=E):E=e[44],e[45]!==v||e[46]!==j||e[47]!==E||e[48]!==h||e[49]!==f?(M=c.jsxs("div",{children:[h,f,v,j,E]}),e[45]=v,e[46]=j,e[47]=E,e[48]=h,e[49]=f,e[50]=M):M=e[50],M},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));S2.displayName="CustomNode";const C2={custom:S2};function rT(t){const{width:e}=t;return e}const N2=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,a=gr();let i,l,d,u;if(e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==a?(h=(x,g)=>a.inOrderIds.indexOf(x)-a.inOrderIds.indexOf(g),e[8]=a,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=x):x=e[10],d=x;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(x,g)=>c.jsxs("span",{className:"truncate",children:[c.jsx(Io,{variant:"focus",cellId:x,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x),g<o.length-1&&", "]},x),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],i=f.slice(0,n).map(m),l=o.length>n&&c.jsxs(mr,{children:[c.jsx(xs,{asChild:!0,children:c.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),c.jsx(us,{className:"w-auto",children:c.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(x=>c.jsx(Io,{variant:"focus",cellId:x,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x))})})]})}e[0]=o,e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=d}else i=e[5],l=e[6],d=e[7];return d!==Symbol.for("react.early_return_sentinel")?d:(e[15]!==i||e[16]!==l?(u=c.jsxs(c.Fragment,{children:[i,l]}),e[15]=i,e[16]=l,e[17]=u):u=e[17],u)},Yh=t=>{const e=H.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const a=n.length>1?"destructive":"outline";let i,l,d;return e[5]!==o||e[6]!==r?(i=async u=>{r?r(u):(await on(o),Je({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=i):i=e[7],e[8]!==o||e[9]!==a||e[10]!==i?(l=c.jsx(G3,{title:o,variant:a,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:o}),e[8]=o,e[9]=a,e[10]=i,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(d=c.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=d):d=e[14],d},Kh=T.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let a;e[0]!==s||e[1]!==r?(a=(O,P)=>{s({...r,[O]:P})},e[0]=s,e[1]=r,e[2]=a):a=e[2];const i=a;let l,d,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(xs,{asChild:!0,children:c.jsx(ve,{variant:"text",size:"xs",children:c.jsx(om,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=d):d=e[4],e[5]!==i?(u=O=>i("hidePureMarkdown",!!O),e[5]=i,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=c.jsx(k3,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(hr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=c.jsxs(mr,{children:[l,c.jsxs(us,{className:"w-auto p-2 text-muted-foreground",children:[d,c.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const x=m,g=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(kp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,S,j;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(ui,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==v||e[23]!==w?(j=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[S,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=j):j=e[24];const C=o==="LR";let _,E,M,I;e[25]!==n?(_=()=>n("LR"),e[25]=n,e[26]=_):_=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(ui,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=E):E=e[27],e[28]!==C||e[29]!==_?(M=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":C,size:"xs",onClick:_,children:[E," ","Horizontal Tree"]}),e[28]=C,e[29]=_,e[30]=M):M=e[30],e[31]!==y||e[32]!==j||e[33]!==M?(I=c.jsxs("div",{className:"flex gap-2",children:[y,j,M]}),e[31]=y,e[32]=j,e[33]=M,e[34]=I):I=e[34];const D=o!=="_minimap_"&&x;let F;return e[35]!==I||e[36]!==D?(F=c.jsxs(Il,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,D]}),e[35]=I,e[36]=D,e[37]=F):F=e[37],F});Kh.displayName="GraphToolbar";const Fl=T.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=sT;let a;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(a=()=>{if(n.type==="node"){const u=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,x)=>c.jsxs(c.Fragment,{children:[m.length===0&&c.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),c.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>c.jsxs(q.Fragment,{children:[c.jsx(Yh,{declaredBy:g.declaredBy,name:g.name}),c.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,c.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),c.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:c.jsx(N2,{skipScroll:!0,onClick:()=>s(x==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(Vl,{className:"w-5 h-5"}),c.jsx(Io,{cellId:n.id}),c.jsx("div",{className:"flex-1"}),c.jsx(tx,{cellId:n.id,children:c.jsx(ve,{variant:"ghost",size:"icon",children:c.jsx($c,{className:"w-4 h-4"})})}),c.jsx(ve,{variant:"text",size:"icon",onClick:()=>{r()},children:c.jsx(yn,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Wm,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),c.jsx("hr",{className:"border-divider my-3"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Qt,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(fi,{className:"w-4 h-4"}),c.jsx(Io,{cellId:n.source}),c.jsx(Lc,{className:"w-4 h-4"}),c.jsx(Io,{cellId:n.target})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>c.jsxs(q.Fragment,{children:[c.jsx(Yh,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),c.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),c.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=a):a=e[6];const i=a;let l,d;return e[7]!==i?(l=i(),e[7]=i,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx(Il,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:c.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-(--slate-1) text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=d):d=e[10],d});function sT(t,e){const n=Ia(t);n&&Tm(n,e)}function E2(){const t=H.c(7),e=va(),n=lt(iT),o=lt(aT);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=pP(r,100);let a,i;t[2]!==s||t[3]!==o||t[4]!==n?(a=()=>{n&&o&&s()},i=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=a,t[6]=i):(a=t[5],i=t[6]),T.useEffect(a,i)}function aT(t){const{height:e}=t;return e}function iT(t){const{width:e}=t;return e}Fl.displayName="GraphSelectionPanel";const _2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:qr.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:Gh(Qe.get(e).code.trim().split(`
|
146
|
-
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],a=[];for(const[l,d]of Im.zip(t,e)){const u=this.createNode(l,d,r);s.push(u),r=u.position.y+(u.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:a}}},lT=t=>{const e=H.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let a;e[0]!==r||e[1]!==n||e[2]!==o?(a=_2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=a):a=e[3];const{nodes:i,edges:l}=a;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[4]=d):d=e[4];const[u,h]=v2(d),[f,m]=y2(i),[x,g]=T.useState(),[p,b]=T.useState(),y=T.useRef(!1);E2();const v=lt(cT);let w;e[5]!==h||e[6]!==m?(w=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=w):w=e[7];const S=Le(w);let j,C,_,E;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(j=()=>{y.current?S(_2.createElements(n,r,o,!1)):y.current=!0},C=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=j,e[13]=C):(j=e[12],C=e[13]),T.useEffect(j,C),e[14]!==l||e[15]!==x||e[16]!==h?(_=()=>{if(x){const k=l.filter(B=>{const{source:A,target:U,data:$}=B;return A===x&&$.direction==="outputs"||U===x&&$.direction==="inputs"});h(k)}},E=[x,h,l],e[14]=l,e[15]=x,e[16]=h,e[17]=_,e[18]=E):(_=e[17],E=e[18]),T.useEffect(_,E);const M=function(k,B){const A=H.c(17);let U,$;if(A[0]!==B||A[1]!==k){let Q;A[3]!==B?(Q=(te,re)=>{const{position:ne}=re;return Math.min(te,ne.y-B/2-10)},A[3]=B,A[4]=Q):Q=A[4],$=k.reduce(Q,Number.POSITIVE_INFINITY),A[0]=B,A[1]=k,A[2]=$}else $=A[2];const X=$;let Y;if(A[5]!==B||A[6]!==k){let Q;A[8]!==B?(Q=(te,re)=>{const{position:ne}=re;return Math.max(te,ne.y+B/2+10)},A[8]=B,A[9]=Q):Q=A[9],Y=k.reduce(Q,Number.NEGATIVE_INFINITY),A[5]=B,A[6]=k,A[7]=Y}else Y=A[7];const G=Y;let W,J,V;return A[10]!==X?(W=[Number.NEGATIVE_INFINITY,X],A[10]=X,A[11]=W):W=A[11],A[12]!==G?(J=[Number.POSITIVE_INFINITY,G],A[12]=G,A[13]=J):J=A[13],A[14]!==W||A[15]!==J?(V=[W,J],A[14]=W,A[15]=J,A[16]=V):V=A[16],U=V,U}(f,v);let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{g(void 0),b(void 0)},e[19]=I):I=e[19];const D=I;let F;e[20]!==u||e[21]!==p||e[22]!==x||e[23]!==o?(F=()=>p?c.jsx(Fl,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:D,variables:o,edges:u}):x?c.jsx(Fl,{selection:{type:"node",id:x},variables:o,edges:u,onClearSelection:D}):null,e[20]=u,e[21]=p,e[22]=x,e[23]=o,e[24]=F):F=e[24];const O=F;let P,R,z,N;return e[25]!==h?(P=(k,B)=>{const A=B.id;g(A),b(void 0),h([])},e[25]=h,e[26]=P):P=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(R=(k,B)=>{b(B)},e[27]=R):R=e[27],e[28]!==O?(z=O(),e[28]=O,e[29]=z):z=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==P||e[34]!==z||e[35]!==M?(N=c.jsxs(qh,{nodes:f,edges:u,nodeTypes:C2,translateExtent:M,onNodeClick:P,onNodeDoubleClick:dT,onEdgeClick:R,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Lo.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[z,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=P,e[34]=z,e[35]=M,e[36]=N):N=e[36],N};function cT(t){const{height:e}=t;return e}function dT(t,e){Y3(e.id,"focus")}var Xh,I2,A2,T2,M2,O2,Jh,D2,Zh,P2,Qh,R2,ef,L2,tf,F2,nf,z2,of,B2,rf,U2,sf,$2,af,V2,lf,H2,cf,W2,df,q2,uf,G2,Y2,K2,X2,J2,Z2,Q2,hf,ew,ff,tw,mf,nw,pf,ow,gf,rw,xf,sw,bf,aw,yf,iw,vf,lw,wf,cw,kf,dw,jf,uw,Sf,hw,Cf,fw,mw,pw,gw,xw,bw,yw,Nf,vw,Ef,ww,kw,jw,_f,Sw,If,Cw,Af,Nw,Tf,Ew,Mf,_w,Iw,Aw,Tw,Mw;function Of(){if(I2)return Xh;I2=1;var t="\0";function e(s,a){s[a]?s[a]++:s[a]=1}function n(s,a){--s[a]||delete s[a]}function o(s,a,i,l){var d=""+a,u=""+i;if(!s&&d>u){var h=d;d=u,u=h}return d+""+u+""+(l===void 0?"\0":l)}function r(s,a){return o(s,a.v,a.w,a.name)}return Xh=class{constructor(s){Z(this,"_isDirected",!0);Z(this,"_isMultigraph",!1);Z(this,"_isCompound",!1);Z(this,"_label");Z(this,"_defaultNodeLabelFn",()=>{});Z(this,"_defaultEdgeLabelFn",()=>{});Z(this,"_nodes",{});Z(this,"_in",{});Z(this,"_preds",{});Z(this,"_out",{});Z(this,"_sucs",{});Z(this,"_edgeObjs",{});Z(this,"_edgeLabels",{});Z(this,"_nodeCount",0);Z(this,"_edgeCount",0);Z(this,"_parent");Z(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(a=>Object.keys(s._in[a]).length===0)}sinks(){var s=this;return this.nodes().filter(a=>Object.keys(s._out[a]).length===0)}setNodes(s,a){var i=arguments,l=this;return s.forEach(function(d){i.length>1?l.setNode(d,a):l.setNode(d)}),this}setNode(s,a){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=a),this):(this._nodes[s]=arguments.length>1?a:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var a=this;if(Object.hasOwn(this._nodes,s)){var i=l=>a.removeEdge(a._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){a.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(i),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(i),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,a){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(a===void 0)a=t;else{for(var i=a+="";i!==void 0;i=this.parent(i))if(i===s)throw new Error("Setting "+a+" as parent of "+s+" would create a cycle");this.setNode(a)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=a,this._children[a][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var a=this._parent[s];if(a!==t)return a}}children(s=t){if(this._isCompound){var a=this._children[s];if(a)return Object.keys(a)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var a=this._preds[s];if(a)return Object.keys(a)}successors(s){var a=this._sucs[s];if(a)return Object.keys(a)}neighbors(s){var a=this.predecessors(s);if(a){const l=new Set(a);for(var i of this.successors(s))l.add(i);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var a=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});a.setGraph(this.graph());var i=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&a.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){a.hasNode(u.v)&&a.hasNode(u.w)&&a.setEdge(u,i.edge(u))});var l={};function d(u){var h=i.parent(u);return h===void 0||a.hasNode(h)?(l[u]=h,h):h in l?l[h]:d(h)}return this._isCompound&&a.nodes().forEach(u=>a.setParent(u,d(u))),a}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,a){var i=this,l=arguments;return s.reduce(function(d,u){return l.length>1?i.setEdge(d,u,a):i.setEdge(d,u),u}),this}setEdge(){var s,a,i,l,d=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,a=u.w,i=u.name,arguments.length===2&&(l=arguments[1],d=!0)):(s=u,a=arguments[1],i=arguments[3],arguments.length>2&&(l=arguments[2],d=!0)),s=""+s,a=""+a,i!==void 0&&(i=""+i);var h=o(this._isDirected,s,a,i);if(Object.hasOwn(this._edgeLabels,h))return d&&(this._edgeLabels[h]=l),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?l:this._defaultEdgeLabelFn(s,a,i);var f=function(m,x,g,p){var b=""+x,y=""+g;if(!m&&b>y){var v=b;b=y,y=v}var w={v:b,w:y};return p&&(w.name=p),w}(this._isDirected,s,a,i);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[a],s),e(this._sucs[s],a),this._in[a][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i),d=this._edgeObjs[l];return d&&(s=d.v,a=d.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[a],s),n(this._sucs[s],a),delete this._in[a][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,a){var i=this._in[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.v===a):l}}outEdges(s,a){var i=this._out[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.w===a):l}}nodeEdges(s,a){var i=this.inEdges(s,a);if(i)return i.concat(this.outEdges(s,a))}},Xh}function uT(){return O2?M2:(O2=1,M2={Graph:Of(),version:T2?A2:(T2=1,A2="2.2.4")})}function hT(){if(D2)return Jh;D2=1;var t=Of();function e(o){return o.nodes().map(function(r){var s=o.node(r),a=o.parent(r),i={v:r};return s!==void 0&&(i.value=s),a!==void 0&&(i.parent=a),i})}function n(o){return o.edges().map(function(r){var s=o.edge(r),a={v:r.v,w:r.w};return r.name!==void 0&&(a.name=r.name),s!==void 0&&(a.value=s),a})}return Jh={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},Jh}function fT(){return P2||(P2=1,Zh=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),Zh}function Ow(){return R2?Qh:(R2=1,Qh=class{constructor(){Z(this,"_arr",[]);Z(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},Qh)}function Dw(){if(L2)return ef;L2=1;var t=Ow();ef=function(n,o,r,s){return function(a,i,l,d){var u,h,f={},m=new t,x=function(g){var p=g.v!==u?g.v:g.w,b=f[p],y=l(g),v=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);v<b.distance&&(b.distance=v,b.predecessor=u,m.decrease(p,v))};for(a.nodes().forEach(function(g){var p=g===i?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)d(u).forEach(x);return f}(n,String(o),r||e,s||function(a){return n.outEdges(a)})};var e=()=>1;return ef}function mT(){if(F2)return tf;F2=1;var t=Dw();return tf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},tf}function Pw(){return z2||(z2=1,nf=function(t){var e=0,n=[],o={},r=[];function s(a){var i=o[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(i.lowlink=Math.min(i.lowlink,o[u].index)):(s(u),i.lowlink=Math.min(i.lowlink,o[u].lowlink))}),i.lowlink===i.index){var l,d=[];do l=n.pop(),o[l].onStack=!1,d.push(l);while(a!==l);r.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(o,a)||s(a)}),r}),nf}function pT(){if(B2)return of;B2=1;var t=Pw();return of=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},of}function gT(){if(U2)return rf;U2=1,rf=function(e,n,o){return function(r,s,a){var i={},l=r.nodes();return l.forEach(function(d){i[d]={},i[d][d]={distance:0},l.forEach(function(u){d!==u&&(i[d][u]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(u){var h=u.v===d?u.w:u.v,f=s(u);i[d][h]={distance:f,predecessor:d}})}),l.forEach(function(d){var u=i[d];l.forEach(function(h){var f=i[h];l.forEach(function(m){var x=f[d],g=u[m],p=f[m],b=x.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),i}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return rf}function Rw(){if($2)return sf;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new e;Object.hasOwn(o,i)||(r[i]=!0,o[i]=!0,n.predecessors(i).forEach(a),delete r[i],s.push(i))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}$2=1;class e extends Error{constructor(){super(...arguments)}}return sf=t,t.CycleException=e,sf}function xT(){if(V2)return af;V2=1;var t=Rw();return af=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},af}function Lw(){if(H2)return lf;function t(o,r,s,a){for(var i=[[o,!1]];i.length>0;){var l=i.pop();l[1]?a.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,i.push([l[0],!0]),n(r(l[0]),d=>i.push([d,!1])))}}function e(o,r,s,a){for(var i=[o];i.length>0;){var l=i.pop();Object.hasOwn(s,l)||(s[l]=!0,a.push(l),n(r(l),d=>i.push(d)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return H2=1,lf=function(o,r,s){Array.isArray(r)||(r=[r]);var a=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),i=s==="post"?t:e,l=[],d={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);i(u,a,d,l)}),l},lf}function bT(){if(W2)return cf;W2=1;var t=Lw();return cf=function(e,n){return t(e,n,"post")},cf}function yT(){if(q2)return df;q2=1;var t=Lw();return df=function(e,n){return t(e,n,"pre")},df}function vT(){if(G2)return uf;G2=1;var t=Of(),e=Ow();return uf=function(n,o){var r,s=new t,a={},i=new e;function l(u){var h=u.v===r?u.w:u.v,f=i.priority(h);if(f!==void 0){var m=o(u);m<f&&(a[h]=r,i.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){i.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),i.decrease(n.nodes()[0],0);for(var d=!1;i.size()>0;){if(r=i.removeMin(),Object.hasOwn(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+n);d=!0}n.nodeEdges(r).forEach(l)}return s},uf}function On(){if(J2)return X2;J2=1;var t=uT();return X2={Graph:t.Graph,json:hT(),alg:K2?Y2:(K2=1,Y2={components:fT(),dijkstra:Dw(),dijkstraAll:mT(),findCycles:pT(),floydWarshall:gT(),isAcyclic:xT(),postorder:bT(),preorder:yT(),prim:vT(),tarjan:Pw(),topsort:Rw()}),version:t.version}}function wT(){if(ew)return hf;ew=1;let t=On().Graph,e=function(){if(Q2)return Z2;function s(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function a(i,l){if(i!=="_next"&&i!=="_prev")return l}return Q2=1,Z2=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,l=i._prev;if(l!==i)return s(l),l}enqueue(i){let l=this._sentinel;i._prev&&i._next&&s(i),i._next=l._next,l._next._prev=i,l._next=i,i._prev=l}toString(){let i=[],l=this._sentinel,d=l._prev;for(;d!==l;)i.push(JSON.stringify(d,a)),d=d._prev;return"["+i.join(", ")+"]"}}}();hf=function(s,a){if(s.nodeCount()<=1)return[];let i=function(l,d){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=d(g),y=p+b;u.setEdge(g.v,g.w,y),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),x=h+1;return u.nodes().forEach(g=>{r(m,x,u.node(g))}),{graph:u,buckets:m,zeroIdx:x}}(s,a||n);return function(l,d,u){let h,f=[],m=d[d.length-1],x=d[0];for(;l.nodeCount();){for(;h=x.dequeue();)o(l,d,u,h);for(;h=m.dequeue();)o(l,d,u,h);if(l.nodeCount()){for(let g=d.length-2;g>0;--g)if(h=d[g].dequeue(),h){f=f.concat(o(l,d,u,h,!0));break}}}return f}(i.graph,i.buckets,i.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,a,i,l,d){let u=d?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);d&&u.push({v:h.v,w:h.w}),m.out-=f,r(a,i,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,x=s.node(m);x.in-=f,r(a,i,x)}),s.removeNode(l.v),u}function r(s,a,i){i.out?i.in?s[i.out-i.in+a].enqueue(i):s[s.length-1].enqueue(i):s[0].enqueue(i)}return hf}function _t(){if(tw)return ff;tw=1;let t=On().Graph;function e(d,u,h,f){for(var m=f;d.hasNode(m);)m=a(f);return h.dummy=u,d.setNode(m,h),m}ff={addBorderNode:function(d,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(d,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(d){let u=new t({multigraph:d.isMultigraph()}).setGraph(d.graph());return d.nodes().forEach(h=>{d.children(h).length||u.setNode(h,d.node(h))}),d.edges().forEach(h=>{u.setEdge(h,d.edge(h))}),u},buildLayerMatrix:function(d){let u=i(r(d)+1).map(()=>[]);return d.nodes().forEach(h=>{let f=d.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(d,u){let h,f,m=d.x,x=d.y,g=u.x-m,p=u.y-x,b=d.width/2,y=d.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:x+f}},mapValues:function(d,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(d).reduce((f,[m,x])=>(f[m]=h(x,m),f),{})},maxRank:r,normalizeRanks:function(d){let u=d.nodes().map(f=>{let m=d.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);d.nodes().forEach(f=>{let m=d.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(d,u){return u()},partition:function(d,u){let h={lhs:[],rhs:[]};return d.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(d,u){const h={};for(const f of u)d[f]!==void 0&&(h[f]=d[f]);return h},predecessorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},range:i,removeEmptyRanks:function(d){let u=d.nodes().map(g=>d.node(g).rank),h=o(Math.min,u),f=[];d.nodes().forEach(g=>{let p=d.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,x=d.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%x!==0?--m:g!==void 0&&m&&g.forEach(b=>d.node(b).rank+=m)})},simplify:function(d){let u=new t().setGraph(d.graph());return d.nodes().forEach(h=>u.setNode(h,d.node(h))),d.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=d.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},time:function(d,u){let h=Date.now();try{return u()}finally{console.log(d+" time: "+(Date.now()-h)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(d,u){if(u.length>n){const h=function(f,m=n){const x=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);x.push(p)}return x}(u);return d.apply(null,h.map(f=>d.apply(null,f)))}return d.apply(null,u)}function r(d){const u=d.nodes().map(h=>{let f=d.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function a(d){return d+""+ ++s}function i(d,u,h=1){u==null&&(u=d,d=0);let f=x=>x<u;h<0&&(f=x=>u<x);const m=[];for(let x=d;f(x);x+=h)m.push(x);return m}function l(d,u){return d.reduce((h,f,m)=>(h[f]=u[m],h),{})}return ff}function kT(){if(nw)return mf;nw=1;let t=wT(),e=_t().uniqueId;return mf={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],a={},i={};function l(d){Object.hasOwn(i,d)||(i[d]=!0,a[d]=!0,r.outEdges(d).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):l(u.w)}),delete a[d])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},mf}function jT(){if(ow)return pf;ow=1;let t=_t();return pf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,a,i,l=r.v,d=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),x=m.labelRank;if(h!==d+1){for(o.removeEdge(r),i=0,++d;d<h;++i,++d)m.points=[],a={width:0,height:0,edgeLabel:m,edgeObj:r,rank:d},s=t.addDummyNode(o,"edge",a,"_d"),d===x&&(a.width=m.width,a.height=m.height,a.dummy="edge-label",a.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),i===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},pf}function zl(){if(rw)return gf;rw=1;const{applyWithChunking:t}=_t();return gf={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let a=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var i=t(Math.min,a);return i===Number.POSITIVE_INFINITY&&(i=0),s.rank=i})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},gf}function Fw(){if(sw)return xf;sw=1;var t=On().Graph,e=zl().slack;function n(s,a){return s.nodes().forEach(function i(l){a.nodeEdges(l).forEach(d=>{var u=d.v,h=l===u?d.w:u;s.hasNode(h)||e(a,d)||(s.setNode(h,{}),s.setEdge(l,h,{}),i(h))})}),s.nodeCount()}function o(s,a){return a.edges().reduce((i,l)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(d=e(a,l)),d<i[0]?[d,l]:i},[Number.POSITIVE_INFINITY,null])[1]}function r(s,a,i){s.nodes().forEach(l=>a.node(l).rank+=i)}return xf=function(s){var a,i,l=new t({directed:!1}),d=s.nodes()[0],u=s.nodeCount();for(l.setNode(d,{});n(l,s)<u;)a=o(l,s),i=l.hasNode(a.v)?e(s,a):-e(s,a),r(l,s,i);return l},xf}function ST(){if(aw)return bf;aw=1;var t=Fw(),e=zl().slack,n=zl().longestPath,o=On().alg.preorder,r=On().alg.postorder,s=_t().simplify;function a(g){g=s(g),n(g);var p,b=t(g);for(d(b),i(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function i(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(v,w,S){var j=v.node(S),C=j.parent;v.edge(S,C).cutvalue=l(v,w,S)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,v=!0,w=p.edge(b,y),S=0;return w||(v=!1,w=p.edge(y,b)),S=w.weight,p.nodeEdges(b).forEach(j=>{var C,_,E=j.v===b,M=E?j.w:j.v;if(M!==y){var I=E===v,D=p.edge(j).weight;if(S+=I?D:-D,C=b,_=M,g.hasEdge(C,_)){var F=g.edge(b,M).cutvalue;S+=I?-F:F}}}),S}function d(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,y,v){var w=b,S=g.node(y);return p[y]=!0,g.neighbors(y).forEach(j=>{Object.hasOwn(p,j)||(b=u(g,p,b,j,y))}),S.low=w,S.lim=b++,v?S.parent=v:delete S.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,v=b.w;p.hasEdge(y,v)||(y=b.w,v=b.v);var w=g.node(y),S=g.node(v),j=w,C=!1;w.lim>S.lim&&(j=S,C=!0);var _=p.edges().filter(E=>C===x(g,g.node(E.v),j)&&C!==x(g,g.node(E.w),j));return _.reduce((E,M)=>e(p,M)<e(p,E)?M:E)}function m(g,p,b,y){var v=b.v,w=b.w;g.removeEdge(v,w),g.setEdge(y.v,y.w,{}),d(g),i(g,p),function(S,j){var C=S.nodes().find(E=>!j.node(E).parent),_=o(S,C);(_=_.slice(1)).forEach(E=>{var M=S.node(E).parent,I=j.edge(E,M),D=!1;I||(I=j.edge(M,E),D=!0),j.node(E).rank=j.node(M).rank+(D?I.minlen:-I.minlen)})}(g,p)}function x(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return bf=a,a.initLowLimValues=d,a.initCutValues=i,a.calcCutValue=l,a.leaveEdge=h,a.enterEdge=f,a.exchangeEdges=m,bf}function CT(){if(iw)return yf;iw=1;var t=zl().longestPath,e=Fw(),n=ST();yf=function(s){var a=s.graph().ranker;if(a instanceof Function)return a(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return yf}function NT(){return lw||(lw=1,vf=function(t){let e=function(n){let o={},r=0;function s(a){let i=r;n.children(a).forEach(s),o[a]={low:i,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,x){let g,p,b=[],y=[],v=Math.min(f[m].low,f[x].low),w=Math.max(f[m].lim,f[x].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>v||w>f[g].lim));for(p=g,g=x;(g=h.parent(g))!==p;)y.push(g);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),a=s.path,i=s.lca,l=0,d=a[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(d=a[l])!==i&&t.node(d).maxRank<o.rank;)l++;d===i&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(d=a[l+1]).minRank<=o.rank;)l++;d=a[l]}t.setParent(n,d),n=t.successors(n)[0]}})}),vf}function ET(){if(cw)return wf;cw=1;let t=_t();function e(n,o,r,s,a,i,l){let d=n.children(l);if(!d.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,d.forEach(m=>{e(n,o,r,s,a,i,m);let x=n.node(m),g=x.borderTop?x.borderTop:m,p=x.borderBottom?x.borderBottom:m,b=x.borderTop?s:2*s,y=g!==p?1:a-i[l]+1;n.setEdge(u,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+i[l]})}return wf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(d){var u={};function h(f,m){var x=d.children(f);x&&x.length&&x.forEach(g=>h(g,m+1)),u[f]=m}return d.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),a=t.applyWithChunking(Math.max,s)-1,i=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(d=>n.edge(d).minlen*=i);let l=function(d){return d.edges().reduce((u,h)=>u+d.edge(h).weight,0)}(n)+1;n.children().forEach(d=>e(n,o,i,l,a,r,d)),n.graph().nodeRankFactor=i},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},wf}function _T(){if(uw)return jf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return uw=1,jf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(a){a.nodes().forEach(i=>n(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(a){a.nodes().forEach(i=>o(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},jf}function IT(){if(xw)return gw;xw=1;let t=_t();return gw=function(e,n){let o={};return e.forEach((r,s)=>{let a=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],a=o[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function a(l){return d=>{d.merged||(d.barycenter===void 0||l.barycenter===void 0||d.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,d)}}function i(l){return d=>{d.in.push(l),--d.indegree===0&&r.push(d)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(a(l)),l.out.forEach(i(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function AT(){if(vw)return Nf;vw=1;let t=(pw||(pw=1,mw=function(o,r=[]){return r.map(s=>{let a=o.inEdges(s);if(a.length){let i=a.reduce((l,d)=>{let u=o.edge(d),h=o.node(d.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:i.sum/i.weight,weight:i.weight}}return{v:s}})}),mw),e=IT(),n=function(){if(yw)return bw;yw=1;let o=_t();function r(s,a,i){let l;for(;a.length&&(l=a[a.length-1]).i<=i;)a.pop(),s.push(l.vs),i++;return i}return bw=function(s,a){let i=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=i.lhs,d=i.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var x;l.sort((x=!!a,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:x?b.i-p.i:p.i-b.i)),m=r(u,d,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,d,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Nf=function o(r,s,a,i){let l=r.children(s),d=r.node(s),u=d?d.borderLeft:void 0,h=d?d.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let v=o(r,p.v,a,i);f[p.v]=v,Object.hasOwn(v,"barycenter")&&(y=v,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let x=e(m,a);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(v=>b[v]?b[v].vs:v)})})(x,f);let g=n(x,i);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Nf}function TT(){if(ww)return Ef;ww=1;let t=On().Graph,e=_t();return Ef=function(n,o,r){let s=function(i){for(var l;i.hasNode(l=e.uniqueId("_root")););return l}(n),a=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(i=>n.node(i));return n.nodes().forEach(i=>{let l=n.node(i),d=n.parent(i);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(a.setNode(i),a.setParent(i,d||s),n[r](i).forEach(u=>{let h=u.v===i?u.w:u.v,f=a.edge(h,i),m=f!==void 0?f.weight:0;a.setEdge(h,i,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&a.setNode(i,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),a},Ef}function MT(){if(Sw)return _f;Sw=1;let t=function(){if(hw)return Sf;hw=1;let u=_t();return Sf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),x=m.map(y=>h.node(y).rank),g=u.applyWithChunking(Math.max,x),p=u.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let v=h.node(y);p[v.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,v)=>h.node(y).rank-h.node(v).rank).forEach(b),p},Sf}(),e=function(){if(fw)return Cf;fw=1;let u=_t().zipObject;function h(f,m,x){let g=u(x,x.map((S,j)=>j)),p=m.flatMap(S=>f.outEdges(S).map(j=>({pos:g[j.w],weight:f.edge(j).weight})).sort((j,C)=>j.pos-C.pos)),b=1;for(;b<x.length;)b<<=1;let y=2*b-1;b-=1;let v=new Array(y).fill(0),w=0;return p.forEach(S=>{let j=S.pos+b;v[j]+=S.weight;let C=0;for(;j>0;)j%2&&(C+=v[j+1]),j=j-1>>1,v[j]+=S.weight;w+=S.weight*C}),w}return Cf=function(f,m){let x=0;for(let g=1;g<m.length;++g)x+=h(f,m[g-1],m[g]);return x},Cf}(),n=AT(),o=TT(),r=(jw||(jw=1,kw=function(u,h,f){let m,x={};f.forEach(g=>{let p,b,y=u.parent(g);for(;y;){if(p=u.parent(y),p?(b=x[p],x[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),kw),s=On().Graph,a=_t();function i(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let x=m.graph().root,g=n(m,x,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function d(u,h){Object.values(h).forEach(f=>f.forEach((m,x)=>u.node(m).order=x))}return _f=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=a.maxRank(h),x=i(h,a.range(1,m+1),"inEdges"),g=i(h,a.range(m-1,-1,-1),"outEdges"),p=t(h);if(d(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let v=0,w=0;w<4;++v,++w){l(v%2?x:g,v%4>=2),p=a.buildLayerMatrix(h);let S=e(h,p);S<y&&(w=0,b=Object.assign({},p),y=S)}d(h,b)},_f}function OT(){if(Cw)return If;Cw=1;let t=On().Graph,e=_t();function n(h,f){let m={};return f.length&&f.reduce(function(x,g){let p=0,b=0,y=x.length,v=g[g.length-1];return g.forEach((w,S)=>{let j=function(_,E){if(_.node(E).dummy)return _.predecessors(E).find(M=>_.node(M).dummy)}(h,w),C=j?h.node(j).order:y;(j||w===v)&&(g.slice(b,S+1).forEach(_=>{h.predecessors(_).forEach(E=>{let M=h.node(E),I=M.order;!(I<p||C<I)||M.dummy&&h.node(_).dummy||r(m,E,_)})}),b=S+1,p=C)}),g}),m}function o(h,f){let m={};function x(g,p,b,y,v){let w;e.range(p,b).forEach(S=>{w=g[S],h.node(w).dummy&&h.predecessors(w).forEach(j=>{let C=h.node(j);C.dummy&&(C.order<y||C.order>v)&&r(m,j,w)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,v=0;return p.forEach((w,S)=>{if(h.node(w).dummy==="border"){let j=h.predecessors(w);j.length&&(b=h.node(j[0]).order,x(p,v,S,y,b),v=S,y=b)}x(p,v,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let x=h[f];x||(h[f]=x={}),x[m]=!0}function s(h,f,m){if(f>m){let x=f;f=m,m=x}return!!h[f]&&Object.hasOwn(h[f],m)}function a(h,f,m,x){let g={},p={},b={};return f.forEach(y=>{y.forEach((v,w)=>{g[v]=v,p[v]=v,b[v]=w})}),f.forEach(y=>{let v=-1;y.forEach(w=>{let S=x(w);if(S.length){S=S.sort((C,_)=>b[C]-b[_]);let j=(S.length-1)/2;for(let C=Math.floor(j),_=Math.ceil(j);C<=_;++C){let E=S[C];p[w]===w&&v<b[E]&&!s(m,w,E)&&(p[E]=w,p[w]=g[w]=g[E],v=b[E])}}})}),{root:g,align:p}}function i(h,f,m,x,g){let p={},b=function(w,S,j,C){let _=new t,E=w.graph(),M=function(I,D,F){return(O,P,R)=>{let z,N=O.node(P),k=O.node(R),B=0;if(B+=N.width/2,Object.hasOwn(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":z=-N.width/2;break;case"r":z=N.width/2}if(z&&(B+=F?z:-z),z=0,B+=(N.dummy?D:I)/2,B+=(k.dummy?D:I)/2,B+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":z=k.width/2;break;case"r":z=-k.width/2}return z&&(B+=F?z:-z),z=0,B}}(E.nodesep,E.edgesep,C);return S.forEach(I=>{let D;I.forEach(F=>{let O=j[F];if(_.setNode(O),D){var P=j[D],R=_.edge(P,O);_.setEdge(P,O,Math.max(M(w,F,D),R||0))}D=F})}),_}(h,f,m,g),y=g?"borderLeft":"borderRight";function v(w,S){let j=b.nodes(),C=j.pop(),_={};for(;C;)_[C]?w(C):(_[C]=!0,j.push(C),j=j.concat(S(C))),C=j.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((S,j)=>Math.max(S,p[j.v]+b.edge(j)),0)},b.predecessors.bind(b)),v(function(w){let S=b.outEdges(w).reduce((C,_)=>Math.min(C,p[_.w]-b.edge(_)),Number.POSITIVE_INFINITY),j=h.node(w);S!==Number.POSITIVE_INFINITY&&j.borderType!==y&&(p[w]=Math.max(p[w],S))},b.successors.bind(b)),Object.keys(x).forEach(w=>p[w]=p[m[w]]),p}function l(h,f){return Object.values(f).reduce((m,x)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(x).forEach(([y,v])=>{let w=function(S,j){return S.node(j).width}(h,y)/2;g=Math.max(v+w,g),p=Math.min(v-w,p)});const b=g-p;return b<m[0]&&(m=[b,x]),m},[Number.POSITIVE_INFINITY,null])[1]}function d(h,f){let m=Object.values(f),x=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,v=h[y];if(v===f)return;let w=Object.values(v),S=x-e.applyWithChunking(Math.min,w);b!=="l"&&(S=g-e.applyWithChunking(Math.max,w)),S&&(h[y]=e.mapValues(v,j=>j+S))})})}function u(h,f){return e.mapValues(h.ul,(m,x)=>{if(f)return h[f.toLowerCase()][x];{let g=Object.values(h).map(p=>p[x]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return If={positionX:function(h){let f,m=e.buildLayerMatrix(h),x=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(j=>Object.values(j).reverse()));let v=(b==="u"?h.predecessors:h.successors).bind(h),w=a(h,f,x,v),S=i(h,f,w.root,w.align,y==="r");y==="r"&&(S=e.mapValues(S,j=>-j)),g[b+y]=S})});let p=l(h,g);return d(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:a,horizontalCompaction:i,alignCoordinates:d,findSmallestWidthAlignment:l,balance:u},If}function DT(){if(Nw)return Af;Nw=1;let t=_t(),e=OT().positionX;return Af=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,a=0;r.forEach(i=>{const l=i.reduce((d,u)=>{const h=o.node(u).height;return d>h?d:h},0);i.forEach(d=>o.node(d).y=a+l/2),a+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Af}function PT(){if(Ew)return Tf;Ew=1;let t=kT(),e=jT(),n=CT(),o=_t().normalizeRanks,r=NT(),s=_t().removeEmptyRanks,a=ET(),i=function(){if(dw)return kf;dw=1;let C=_t();function _(E,M,I,D,F,O){let P={width:0,height:0,rank:O,borderType:M},R=F[M][O-1],z=C.addDummyNode(E,"border",P,I);F[M][O]=z,E.setParent(z,D),R&&E.setEdge(R,z,{weight:1})}return kf=function(E){E.children().forEach(function M(I){let D=E.children(I),F=E.node(I);if(D.length&&D.forEach(M),Object.hasOwn(F,"minRank")){F.borderLeft=[],F.borderRight=[];for(let O=F.minRank,P=F.maxRank+1;O<P;++O)_(E,"borderLeft","_bl",I,F,O),_(E,"borderRight","_br",I,F,O)}})},kf}(),l=_T(),d=MT(),u=DT(),h=_t(),f=On().Graph;Tf=function(C,_){let E=_&&_.debugTiming?h.time:h.notime;E("layout",()=>{let M=E(" buildLayoutGraph",()=>function(I){let D=new f({multigraph:!0,compound:!0}),F=j(I.graph());return D.setGraph(Object.assign({},x,S(F,m),h.pick(F,g))),I.nodes().forEach(O=>{const P=S(j(I.node(O)),p);Object.keys(b).forEach(R=>{P[R]===void 0&&(P[R]=b[R])}),D.setNode(O,P),D.setParent(O,I.parent(O))}),I.edges().forEach(O=>{let P=j(I.edge(O));D.setEdge(O,Object.assign({},v,S(P,y),h.pick(P,w)))}),D}(C));E(" runLayout",()=>function(I,D,F){D(" makeSpaceForEdgeLabels",()=>function(O){let P=O.graph();P.ranksep/=2,O.edges().forEach(R=>{let z=O.edge(R);z.minlen*=2,z.labelpos.toLowerCase()!=="c"&&(P.rankdir==="TB"||P.rankdir==="BT"?z.width+=z.labeloffset:z.height+=z.labeloffset)})}(I)),D(" removeSelfEdges",()=>function(O){O.edges().forEach(P=>{if(P.v===P.w){var R=O.node(P.v);R.selfEdges||(R.selfEdges=[]),R.selfEdges.push({e:P,label:O.edge(P)}),O.removeEdge(P)}})}(I)),D(" acyclic",()=>t.run(I)),D(" nestingGraph.run",()=>a.run(I)),D(" rank",()=>n(h.asNonCompoundGraph(I))),D(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(P=>{let R=O.edge(P);if(R.width&&R.height){let z=O.node(P.v),N={rank:(O.node(P.w).rank-z.rank)/2+z.rank,e:P};h.addDummyNode(O,"edge-proxy",N,"_ep")}})}(I)),D(" removeEmptyRanks",()=>s(I)),D(" nestingGraph.cleanup",()=>a.cleanup(I)),D(" normalizeRanks",()=>o(I)),D(" assignRankMinMax",()=>function(O){let P=0;O.nodes().forEach(R=>{let z=O.node(R);z.borderTop&&(z.minRank=O.node(z.borderTop).rank,z.maxRank=O.node(z.borderBottom).rank,P=Math.max(P,z.maxRank))}),O.graph().maxRank=P}(I)),D(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(P=>{let R=O.node(P);R.dummy==="edge-proxy"&&(O.edge(R.e).labelRank=R.rank,O.removeNode(P))})}(I)),D(" normalize.run",()=>e.run(I)),D(" parentDummyChains",()=>r(I)),D(" addBorderSegments",()=>i(I)),D(" order",()=>d(I,F)),D(" insertSelfEdges",()=>function(O){var P=h.buildLayerMatrix(O);P.forEach(R=>{var z=0;R.forEach((N,k)=>{var B=O.node(N);B.order=k+z,(B.selfEdges||[]).forEach(A=>{h.addDummyNode(O,"selfedge",{width:A.label.width,height:A.label.height,rank:B.rank,order:k+ ++z,e:A.e,label:A.label},"_se")}),delete B.selfEdges})})}(I)),D(" adjustCoordinateSystem",()=>l.adjust(I)),D(" position",()=>u(I)),D(" positionSelfEdges",()=>function(O){O.nodes().forEach(P=>{var R=O.node(P);if(R.dummy==="selfedge"){var z=O.node(R.e.v),N=z.x+z.width/2,k=z.y,B=R.x-N,A=z.height/2;O.setEdge(R.e,R.label),O.removeNode(P),R.label.points=[{x:N+2*B/3,y:k-A},{x:N+5*B/6,y:k-A},{x:N+B,y:k},{x:N+5*B/6,y:k+A},{x:N+2*B/3,y:k+A}],R.label.x=R.x,R.label.y=R.y}})}(I)),D(" removeBorderNodes",()=>function(O){O.nodes().forEach(P=>{if(O.children(P).length){let R=O.node(P),z=O.node(R.borderTop),N=O.node(R.borderBottom),k=O.node(R.borderLeft[R.borderLeft.length-1]),B=O.node(R.borderRight[R.borderRight.length-1]);R.width=Math.abs(B.x-k.x),R.height=Math.abs(N.y-z.y),R.x=k.x+R.width/2,R.y=z.y+R.height/2}}),O.nodes().forEach(P=>{O.node(P).dummy==="border"&&O.removeNode(P)})}(I)),D(" normalize.undo",()=>e.undo(I)),D(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(P=>{let R=O.edge(P);if(Object.hasOwn(R,"x"))switch(R.labelpos!=="l"&&R.labelpos!=="r"||(R.width-=R.labeloffset),R.labelpos){case"l":R.x-=R.width/2+R.labeloffset;break;case"r":R.x+=R.width/2+R.labeloffset}})}(I)),D(" undoCoordinateSystem",()=>l.undo(I)),D(" translateGraph",()=>function(O){let P=Number.POSITIVE_INFINITY,R=0,z=Number.POSITIVE_INFINITY,N=0,k=O.graph(),B=k.marginx||0,A=k.marginy||0;function U($){let X=$.x,Y=$.y,G=$.width,W=$.height;P=Math.min(P,X-G/2),R=Math.max(R,X+G/2),z=Math.min(z,Y-W/2),N=Math.max(N,Y+W/2)}O.nodes().forEach($=>U(O.node($))),O.edges().forEach($=>{let X=O.edge($);Object.hasOwn(X,"x")&&U(X)}),P-=B,z-=A,O.nodes().forEach($=>{let X=O.node($);X.x-=P,X.y-=z}),O.edges().forEach($=>{let X=O.edge($);X.points.forEach(Y=>{Y.x-=P,Y.y-=z}),Object.hasOwn(X,"x")&&(X.x-=P),Object.hasOwn(X,"y")&&(X.y-=z)}),k.width=R-P+B,k.height=N-z+A}(I)),D(" assignNodeIntersects",()=>function(O){O.edges().forEach(P=>{let R,z,N=O.edge(P),k=O.node(P.v),B=O.node(P.w);N.points?(R=N.points[0],z=N.points[N.points.length-1]):(N.points=[],R=B,z=k),N.points.unshift(h.intersectRect(k,R)),N.points.push(h.intersectRect(B,z))})}(I)),D(" reversePoints",()=>function(O){O.edges().forEach(P=>{let R=O.edge(P);R.reversed&&R.points.reverse()})}(I)),D(" acyclic.undo",()=>t.undo(I))}(M,E,_)),E(" updateInputGraph",()=>function(I,D){I.nodes().forEach(F=>{let O=I.node(F),P=D.node(F);O&&(O.x=P.x,O.y=P.y,O.rank=P.rank,D.children(F).length&&(O.width=P.width,O.height=P.height))}),I.edges().forEach(F=>{let O=I.edge(F),P=D.edge(F);O.points=P.points,Object.hasOwn(P,"x")&&(O.x=P.x,O.y=P.y)}),I.graph().width=D.graph().width,I.graph().height=D.graph().height}(C,M))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],x={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],v={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function S(C,_){return h.mapValues(h.pick(C,_),Number)}function j(C){var _={};return C&&Object.entries(C).forEach(([E,M])=>{typeof E=="string"&&(E=E.toLowerCase()),_[E]=M}),_}return Tf}function RT(){if(_w)return Mf;_w=1;let t=_t(),e=On().Graph;return Mf={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,a)=>{let i="layer"+a;r.setNode(i,{rank:"same"}),s.reduce((l,d)=>(r.setEdge(l,d,{style:"invis"}),d))}),r}},Mf}var zw=Mw?Tw:(Mw=1,Tw={graphlib:On(),layout:PT(),debug:RT(),util:{time:_t().time,notime:_t().notime},version:Aw?Iw:(Aw=1,Iw="1.1.5")});const ja=new zw.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Bw=({nodes:t,edges:e,direction:n})=>(ja.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>ja.setEdge(o.source,o.target)),t.forEach(o=>ja.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),zw.layout(ja),{nodes:t.map(o=>{const{x:r,y:s}=ja.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),Uw=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:qr.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:Gh(Qe.get(e).code.trim().split(`
|
147
|
-
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Im.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=Qe.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},LT=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Uw.createElements(n,r,o,i.hidePureMarkdown);return k=Bw({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=T.useState(l),[u,h,f]=y2(d.nodes),[m,x,g]=v2(d.edges),p=va();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Bw({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=Le(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Uw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),T.useEffect(v,w);const[S,j]=T.useState();let C;E2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{j(void 0)},e[17]=C):C=e[17];const _=C;let E,M,I,D,F,O,P,R,z,N;return e[18]===Symbol.for("react.memo_cache_sentinel")?(E={minZoom:.5,maxZoom:1.5},M=(k,B)=>{j({type:"node",id:B.id})},I=(k,B)=>{const{source:A,target:U}=B;j({type:"edge",source:A,target:U})},e[18]=E,e[19]=M,e[20]=I):(E=e[18],M=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(D=c.jsx(oT,{color:"#ccc",variant:Cn.Dots}),e[21]=D):D=e[21],e[22]!==p||e[23]!==u?(F=()=>{const k=Qe.get(gP);if(k){const B=u.find(A=>A.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),j({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=F):F=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=c.jsx(dp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==F?(P=c.jsx(JA,{position:"bottom-right",showInteractive:!1,children:c.jsx(Ne,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(es,{onMouseDown:Rn.preventFocus,onClick:F,children:O})})}),e[26]=F,e[27]=P):P=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(R=c.jsx(Fl,{selection:S,variables:o,edges:m,onClearSelection:_}),e[28]=m,e[29]=S,e[30]=o,e[31]=R):R=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==P||e[38]!==R?(z=c.jsxs(qh,{nodes:u,edges:m,nodeTypes:C2,minZoom:.2,fitViewOptions:E,onNodeClick:M,onEdgeClick:I,onNodeDoubleClick:FT,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[D,P,R,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=P,e[38]=R,e[39]=z):z=e[39],e[40]!==a||e[41]!==z?(N=c.jsx(j2,{value:a,children:z}),e[40]=a,e[41]=z,e[42]=N):N=e[42],N};function FT(t,e){Y3(e.id,"focus")}const zT=yt("_minimap_"),BT=yt({hidePureMarkdown:!0}),UT=t=>{const e=H.c(11),[n,o]=Ot(zT),[r,s]=Ot(BT);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(lT,{...t,children:c.jsx(Kh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(LT,{...t,settings:r,layoutDirection:n,children:c.jsx(Kh,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(Wh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},$T=()=>{const t=H.c(5),e=Mm(),n=gr(),[o]=xP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=xe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(UT,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},VT=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=q.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),q.useEffect(a,i),r?o:null},HT=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=Qe.get(hc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Ia(l);d&&Tm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=xe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},WT=yt(t=>{const e=t(bP),n=t(hc),o=t(ei);return ii(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),qT=yt(t=>{const e=new Map(t(yP));for(const n of K3){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ii([...e.values()],n=>K3.has(n.name)?1:0)}),GT=()=>{const t=H.c(32),[e,n]=q.useState(""),o=jt(X3),r=Se(WT),s=Se(qT);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(ln,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(ug,{children:c.jsxs(ve,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Yo,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx(Wo,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Ma,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(yn,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(ug,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(YT,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(KT,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(XT,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(J3,{children:[c.jsx(Xl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx($w,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(ym,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(cc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},YT=t=>{const e=H.c(26),{connection:n,children:o,hasChildren:r}=t,s=n.name===vP,a=s?"In-Memory":n.name,{previewDataSourceConnection:i}=et(),[l,d]=q.useState(!1);let u;e[0]!==n.name||e[1]!==i?(u=async()=>{d(!0),await i({engine:n.name}),setTimeout(()=>d(!1),500)},e[0]=n.name,e[1]=i,e[2]=u):u=e[2];const h=u;let f,m,x;e[3]!==n.dialect?(f=c.jsx(Bk,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[3]=n.dialect,e[4]=f):f=e[4],e[5]!==n.dialect?(m=wP(n.dialect),e[5]=n.dialect,e[6]=m):m=e[6],e[7]!==m?(x=c.jsx("span",{className:"text-xs",children:m}),e[7]=m,e[8]=x):x=e[8];const g=a;let p,b,y,v,w;return e[9]!==g?(p=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(HT,{variableName:g}),")"]}),e[9]=g,e[10]=p):p=e[10],e[11]!==h||e[12]!==s||e[13]!==l?(b=!s&&c.jsx(Ne,{content:"Refresh connection",children:c.jsx(ve,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:h,children:c.jsx(wc,{className:xe("h-4 w-4 text-muted-foreground hover:text-foreground",l&&"animate-[spin_0.5s]")})})}),e[11]=h,e[12]=s,e[13]=l,e[14]=b):b=e[14],e[15]!==f||e[16]!==x||e[17]!==p||e[18]!==b?(y=c.jsxs(J3,{children:[f,x,p,b]}),e[15]=f,e[16]=x,e[17]=p,e[18]=b,e[19]=y):y=e[19],e[20]!==o||e[21]!==r?(v=r?o:c.jsx(Mc,{content:"No databases available",className:"pl-2"}),e[20]=o,e[21]=r,e[22]=v):v=e[22],e[23]!==y||e[24]!==v?(w=c.jsxs(c.Fragment,{children:[y,v]}),e[23]=y,e[24]=v,e[25]=w):w=e[25],w},KT=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),q.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(oj,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=xe("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(Wo,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,j;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(j=c.jsxs(Xn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=j):j=e[24];const C=a&&s;let _;return e[25]!==j||e[26]!==C?(_=c.jsxs(c.Fragment,{children:[j,C]}),e[25]=j,e[26]=C,e[27]=_):_=e[27],_},XT=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Mc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(JT,{databaseName:a,schema:x,hasSearch:i,children:c.jsx($w,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},JT=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),q.useEffect(h,f),nj(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(oj,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=xe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(_P,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Xn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const j=a&&r;let C;return e[23]!==S||e[24]!==j?(C=c.jsxs(c.Fragment,{children:[S,j]}),e[23]=S,e[24]=j,e[25]=C):C=e[25],C},$w=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=Z3(),[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await HR.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=In(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Q3,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(ej,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Mc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(ZT,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},ZT=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=Z3(),[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:W,database:J,schema:V}=o,Q=await WR.request({engine:W,database:J,schema:V,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=In(h,f),p=Se(Yl),b=ls(),{createNewCell:y}=it(),v=tj();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Kn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const W=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${W}")`}if(o)return rj({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return rj({table:n,columnName:"*",sqlTableContext:o});default:return nc(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let j;e[17]!==n.num_columns||e[18]!==n.num_rows?(j=()=>{const W=[];return n.num_rows!=null&&W.push(`${n.num_rows} rows`),n.num_columns!=null&&W.push(`${n.num_columns} columns`),W.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:W.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=j):j=e[19];const C=j;let _;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(_=()=>{if(x||m)return c.jsx(Q3,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(ej,{error:g,className:"pl-12"});const W=n.columns;return W.length===0?c.jsx(Mc,{content:"No columns found",className:"pl-12"}):W.map(J=>c.jsx(QT,{table:n,column:J,sqlTableContext:o},J.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=_):_=e[25];const E=_;let M;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(M=()=>{if(n.source_type==="local")return;const W=n.type==="table"?kP:Vf;return c.jsx(W,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=M):M=e[30];const I=M,D=o?`${o.database}.${o.schema}.${n.name}`:n.name,F=o&&(nj(o.schema)?"pl-9":"pl-12"),O=(a||r)&&"font-semibold";let P,R,z,N,k,B,A,U,$,X,Y,G;return e[31]!==F||e[32]!==O?(P=xe("rounded-none group h-8 cursor-pointer",F,O),e[31]=F,e[32]=O,e[33]=P):P=e[33],e[34]!==a?(R=()=>i(!a),e[34]=a,e[35]=R):R=e[35],e[36]!==I?(z=I(),e[36]=I,e[37]=z):z=e[37],e[38]!==n.name?(N=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=N):N=e[39],e[40]!==z||e[41]!==N?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,N]}),e[40]=z,e[41]=N,e[42]=k):k=e[42],e[43]!==C?(B=C(),e[43]=C,e[44]=B):B=e[44],e[45]!==S?(A=Rn.stopPropagation(()=>S()),e[45]=S,e[46]=A):A=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(jP,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==A?($=c.jsx(Ne,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ve,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:A,children:U})}),e[48]=A,e[49]=$):$=e[49],e[50]!==a||e[51]!==R||e[52]!==k||e[53]!==B||e[54]!==$||e[55]!==P||e[56]!==D?(X=c.jsxs(Xn,{className:P,value:D,"aria-selected":a,forceMount:!0,onSelect:R,children:[k,B,$]}),e[50]=a,e[51]=R,e[52]=k,e[53]=B,e[54]=$,e[55]=P,e[56]=D,e[57]=X):X=e[57],e[58]!==a||e[59]!==E?(Y=a&&E(),e[58]=a,e[59]=E,e[60]=Y):Y=e[60],e[61]!==X||e[62]!==Y?(G=c.jsxs(c.Fragment,{children:[X,Y]}),e[61]=X,e[62]=Y,e[63]=G):G=e[63],G},QT=t=>{var A,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=q.useState(!1),i=Se(X3),l=jt(SP);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),q.useEffect(d,u),l(s?$=>new Set([...$,`${n.name}:${o.name}`]):$=>($.delete(`${n.name}:${o.name}`),new Set($)));const h=tj(),{columnsPreviews:f}=CP();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((A=n.primary_keys)==null?void 0:A.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=$=>{h($)},e[9]=h,e[10]=b):b=e[10];const y=b,v=e7,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const j=S,C=`${n.name}.${o.name}`,_=`${n.name}.${o.name}`;let E;e[14]!==s?(E=()=>a(!s),e[14]=s,e[15]=E):E=e[15];const M=r?"pl-14":"pl-7";let I,D,F,O,P,R,z,N,k,B;return e[16]!==M?(I=xe("flex flex-row gap-2 items-center flex-1",M),e[16]=M,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==j?(D=c.jsx(NP,{columnName:j,dataType:o.type}),e[18]=o.type,e[19]=j,e[20]=D):D=e[20],e[21]!==x?(F=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=F):F=e[22],e[23]!==p?(O=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=O):O=e[24],e[25]!==I||e[26]!==D||e[27]!==F||e[28]!==O?(P=c.jsxs("div",{className:I,children:[D,F,O]}),e[25]=I,e[26]=D,e[27]=F,e[28]=O,e[29]=P):P=e[29],e[30]!==o.name?(R=c.jsx(Ne,{content:"Copy column name",delayDuration:400,children:c.jsx(ve,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(W3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=R):R=e[31],e[32]!==o.external_type?(z=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=z):z=e[33],e[34]!==E||e[35]!==P||e[36]!==R||e[37]!==z||e[38]!==C||e[39]!==_?(N=c.jsxs(Xn,{className:"rounded-none py-1 group cursor-pointer",value:_,onSelect:E,children:[P,R,z]},C),e[34]=E,e[35]=P,e[36]=R,e[37]=z,e[38]=C,e[39]=_,e[40]=N):N=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-(--slate-1) shadow-inner border-b",children:c.jsx(dc,{children:c.jsx(EP,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==N||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[N,k]}),e[48]=N,e[49]=k,e[50]=B):B=e[50],B};function e7(t){const{tooltipContent:e,content:n}=t;return c.jsx(Ne,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const t7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(GT,{}),t[0]=e):e=t[0],e},n7=()=>{const t=H.c(5),{documentation:e}=Se(IP);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(ln,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Jc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Am({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},o7=()=>{const t=H.c(5),e=AP();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(ln,{title:"No errors!",icon:c.jsx(bp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(r7),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function r7(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(TP,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(MP,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Df=new Map,s7=({file:t,onOpenNotebook:e})=>{const{theme:n}=Ko(),{sendFileDetails:o,sendUpdateFile:r}=et(),s=Se(Ql),[a,i]=T.useState(""),{data:l,isPending:d,error:u,setData:h}=In(async()=>{const b=await o({path:t.path}),y=b.contents||"";return i(Df.get(t.path)||y),b},[t.path]),f=async()=>{a!==(l==null?void 0:l.contents)&&await r({path:t.path,contents:a}).then(b=>{b.success&&(h(y=>({...y,contents:a})),i(a))})},m=T.useRef(a);if(m.current=a,T.useEffect(()=>()=>{if(!(l!=null&&l.contents))return;const b=m.current;b===l.contents?Df.delete(t.path):Df.set(t.path,b)},[t.path,l==null?void 0:l.contents]),u)return c.jsx(xr,{error:u});if(d||!l)return null;const x=l.mimeType||"text/plain",g=x in Pf;if(!l.contents&&!g)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:l.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:x})]});const p=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Zt()&&c.jsx(Ne,{content:"Open notebook",children:c.jsx(an,{size:"small",onClick:b=>e(b),children:c.jsx(ic,{})})}),c.jsx(Ne,{content:"Download",children:c.jsx(an,{size:"small",onClick:()=>{if(Vw(x)){const b=FP(l.contents,x);return void zP(b,l.file.name)}za(new Blob([l.contents||a],{type:x}),l.file.name)},children:c.jsx(nm,{})})}),!Vw(x)&&c.jsxs(c.Fragment,{children:[c.jsx(Ne,{content:"Copy contents to clipboard",children:c.jsx(an,{size:"small",onClick:async()=>{await on(a)},children:c.jsx(Na,{})})}),c.jsx(Ne,{content:Wt("global.save"),children:c.jsx(an,{size:"small",color:a===l.contents?void 0:"green",onClick:f,disabled:a===l.contents,children:c.jsx(hi,{})})})]})]});return x.startsWith("image/")?c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(OP,{base64:l.contents,mime:x})})]}):x==="text/csv"&&l.contents?c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(DP,{contents:l.contents})})]}):x.startsWith("audio/")?c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(PP,{base64:l.contents,mime:x})})]}):x.startsWith("video/")?c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(RP,{base64:l.contents,mime:x})})]}):x.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(LP,{base64:l.contents,mime:x})})]}):c.jsxs(c.Fragment,{children:[p,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(T.Suspense,{children:c.jsx(oi,{theme:n==="dark"?"dark":"light",language:Pf[x]||Pf.default,className:"border-b",extensions:[We.lineWrapping,An.of([{key:s.getHotkey("global.save").key,stopPropagation:!0,run:()=>a!==l.contents&&(f(),!0)}])],value:a,onChange:i})})})]})},Vw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Pf={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"};class a7{constructor(e){this.callbacks=e,this.delegate=new Lm([]),this.rootPath="",this.onChange=Ln.NOOP,this.path=new rc("/"),this.initialize=async n=>{if(this.onChange=n,this.delegate.data.length===0)try{const o=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Lm(o.files),this.rootPath=o.root,this.path=rc.guessDeliminator(o.root)}catch(o){Je({title:"Failed",description:v3(o)})}this.onChange(this.delegate.data)},this.refreshAll=async n=>{const o=[this.rootPath,...n.map(s=>{var a;return(a=this.delegate.find(s))==null?void 0:a.data.path})].filter(Boolean),r=await Promise.all(o.map(s=>this.callbacks.listFiles({path:s}).catch(()=>({files:[]}))));for(const[s,a]of o.entries()){const i=r[s];a===this.rootPath?this.delegate=new Lm(i.files):this.delegate.update({id:a,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=n=>{const o=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return n.startsWith(o)?n.slice(o.length):n},this.handleResponse=n=>n.success?n:(Je({title:"Failed",description:n.message}),null)}async expand(e){const n=this.delegate.find(e);if(!n||!n.data.isDirectory)return!1;if(n.children&&n.children.length>0)return!0;const o=await this.callbacks.listFiles({path:n.data.path});return this.delegate.update({id:e,changes:{children:o.files}}),this.onChange(this.delegate.data),!0}async rename(e,n){const o=this.delegate.find(e);if(!o)return;const r=o.data.path,s=this.path.join(this.path.dirname(r),n);await this.callbacks.renameFileOrFolder({path:r,newPath:s}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:n,path:s}}),this.onChange(this.delegate.data),await this.refreshAll([s])}async move(e,n){var r;const o=n?((r=this.delegate.find(n))==null?void 0:r.data.path)??n:this.rootPath;await Promise.all(e.map(s=>{this.delegate.move({id:s,parentId:n,index:0});const a=this.delegate.find(s);if(!a)return Promise.resolve();const i=this.path.join(o,this.path.basename(a.data.path));return this.delegate.update({id:s,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:a.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const n=this.delegate.find(e);n&&(await this.callbacks.deleteFileOrFolder({path:n.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}const Hw=yt(t=>{const e=t(BP);return Fn(e,"no requestClientAtom set"),new a7({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),i7=yt({});function l7(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Ww(t){const e=H.c(7);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n,{sendCreateFileOrFolder:r}=et();let s,a;return e[2]!==r?(s=async i=>{for(const l of i){const d=m7(f7(l));let u="";d&&(u=rc.guessDeliminator(d).dirname(d));const h=(await l7(l)).split(",")[1];await r({path:u,type:"file",name:l.name,contents:h})}await async function(){await Qe.get(Hw).refreshAll([])}()},e[2]=r,e[3]=s):s=e[3],e[4]!==o||e[5]!==s?(a={multiple:!0,maxSize:104857600,onError:h7,onDropRejected:c7,onDrop:s,...o},e[4]=o,e[5]=s,e[6]=a):a=e[6],UP(a)}function c7(t){Je({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(d7)}),variant:"danger"})}function d7(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(u7).join(", "),")"]},t.file.name)}function u7(t){return t.message}function h7(t){ft.error(t),Je({title:"File upload failed",description:t.message,variant:"danger"})}function f7(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function m7(t){if(t)return t.replace(/^\/+/,"")}const qw=q.createContext(null),p7=t=>{const e=H.c(60),{height:n}=t,o=T.useRef(null),[r]=Ot(Hw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=T.useState(s),[l,d]=T.useState(null),{openPrompt:u}=_n(),[h,f]=Ot(i7);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=In(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Le(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=Le(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const j=Le(S);let C;e[13]!==f?(C=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=C):C=e[14];const _=Le(C);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(vn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(xr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,A,U,$,X;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ve,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(A=c.jsxs("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=A):A=e[21],e[22]!==l.path||e[23]!==r?(U=Y=>Gw(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?($=c.jsx(T.Suspense,{children:c.jsx(s7,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=$):$=e[27],e[28]!==A||e[29]!==$?(X=c.jsxs(c.Fragment,{children:[A,$]}),e[28]=A,e[29]=$,e[30]=X):X=e[30],X}let E;e[31]!==_||e[32]!==j||e[33]!==w||e[34]!==y||e[35]!==r?(E=c.jsx(x7,{onRefresh:y,onCreateFile:j,onCreateFolder:w,onCollapseAll:_,tree:r}),e[31]=_,e[32]=j,e[33]=w,e[34]=y,e[35]=r,e[36]=E):E=e[36];const M=n-33;let I,D,F,O,P,R,z,N;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const A of B)await r.delete(A)},D=async k=>{const{id:B,name:A}=k;await r.rename(B,A)},F=async k=>{const{dragIds:B,parentId:A}=k;await r.move(B,A)},e[37]=r,e[38]=I,e[39]=D,e[40]=F):(I=e[38],D=e[39],F=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=O):O=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(P=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=P):P=e[45],e[46]!==a||e[47]!==h||e[48]!==I||e[49]!==D||e[50]!==F||e[51]!==P||e[52]!==M?(R=c.jsx(ER,{width:"100%",ref:o,height:M,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:k7,disableDrop:j7,onDelete:I,onRename:D,onMove:F,onSelect:O,onToggle:P,padding:15,rowHeight:30,indent:g7,overscanCount:1e3,disableMultiSelection:!0,children:v7}),e[46]=a,e[47]=h,e[48]=I,e[49]=D,e[50]=F,e[51]=P,e[52]=M,e[53]=R):R=e[53],e[54]!==R||e[55]!==r?(z=c.jsx(qw,{value:r,children:R}),e[54]=R,e[55]=r,e[56]=z):z=e[56],e[57]!==z||e[58]!==E?(N=c.jsxs(c.Fragment,{children:[E,z]}),e[57]=z,e[58]=E,e[59]=N):N=e[59],N},g7=15,x7=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Ww(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,j,C;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(di,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(Ne,{content:"Add file",children:c.jsx(ve,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Vc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(Ne,{content:"Add folder",children:c.jsx(ve,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=$P({variant:"text",size:"xs"}),g=c.jsx(HP,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(Ne,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(A3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(Ne,{content:"Refresh",children:c.jsx(ve,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(Xm,{size:16}),e[20]=S):S=e[20],e[21]!==s?(j=c.jsx(Ne,{content:"Collapse all folders",children:c.jsx(ve,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=j):j=e[22],e[23]!==y||e[24]!==w||e[25]!==j||e[26]!==u||e[27]!==f||e[28]!==p?(C=c.jsxs("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,f,p,y,w,j]}),e[23]=y,e[24]=w,e[25]=j,e[26]=u,e[27]=f,e[28]=p,e[29]=C):C=e[29],C},b7=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Zt()&&c.jsxs("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(ic,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},y7=t=>{const e=H.c(10),{node:n}=t,o=T.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),T.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:S7,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},v7=({node:t,style:e,dragHandle:n})=>{const{openFile:o,sendCreateFileOrFolder:r,sendFileDetails:s}=et(),a=t.data.isDirectory?"directory":qk(t.data.name),i=Gk[a],{openConfirm:l,openPrompt:d}=_n(),{createNewCell:u}=it(),h=ls(),f=T.use(qw),m=async y=>{Gw(y,f?f.relativeFromRoot(t.data.path):t.data.path)},x=async y=>{y.stopPropagation(),y.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Uk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},g=Le(async()=>{t.open(),d({title:"Folder name",onConfirm:async y=>{f==null||f.createFolder(y,t.id)}})}),p=Le(async()=>{t.open(),d({title:"File name",onConfirm:async y=>{f==null||f.createFile(y,t.id)}})}),b=Le(async()=>{var S;if(!f||t.data.isDirectory)return;const[y,v]=VP(t.data.name),w=`${y}_copy${v}`;try{const j=await s({path:t.data.path}),C=((S=t.parent)==null?void 0:S.data.path)||"";await r({path:C,type:"file",name:w,contents:j.contents?btoa(j.contents):void 0}),await f.refreshAll([C])}catch{Je({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:xe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:y=>{y.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(w7,{node:t}),c.jsxs("span",{className:xe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:qR,className:"w-5 h-5 shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(i,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(y7,{node:t}):c.jsx(b7,{node:t,onOpenMarimoFile:m}),c.jsxs(So,{modal:!1,children:[c.jsx(Co,{asChild:!0,tabIndex:-1,onClick:y=>y.stopPropagation(),children:c.jsx(ve,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx($c,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const y={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(No,{align:"end",className:"no-print w-[220px]",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(It,{onSelect:()=>t.select(),children:[c.jsx(Op,{...y}),"Open file"]}),!t.data.isDirectory&&!Zt()&&c.jsxs(It,{onSelect:()=>{o({path:t.data.path})},children:[c.jsx(ic,{...y}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(It,{onSelect:()=>p(),children:[c.jsx(di,{...y}),"Create file"]}),c.jsxs(It,{onSelect:()=>g(),children:[c.jsx(Vc,{...y}),"Create folder"]}),c.jsx(rn,{})]}),c.jsxs(It,{onSelect:()=>t.edit(),children:[c.jsx(yp,{...y}),"Rename"]}),!t.data.isDirectory&&c.jsxs(It,{onSelect:b,children:[c.jsx(Na,{...y}),"Duplicate"]}),c.jsxs(It,{onSelect:async()=>{await on(t.data.path),Je({title:"Copied to clipboard"})},children:[c.jsx(qc,{...y}),"Copy path"]}),f&&c.jsxs(It,{onSelect:async()=>{await on(f.relativeFromRoot(t.data.path)),Je({title:"Copied to clipboard"})},children:[c.jsx(qc,{...y}),"Copy relative path"]}),c.jsx(rn,{}),c.jsxs(It,{onSelect:()=>{const{path:v}=t.data;(w=>{u({code:w,before:!1,cellId:h??"__end__"})})(sj[a](v))},children:[c.jsx(wr,{...y}),"Insert snippet for reading file"]}),c.jsxs(It,{onSelect:async()=>{Je({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:v}=t.data,w=sj[a](v);await on(w)},children:[c.jsx(WP,{...y}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Zt()&&c.jsxs(c.Fragment,{children:[c.jsx(rn,{}),c.jsxs(It,{onSelect:m,children:[c.jsx(_p,{...y}),"Open notebook"]})]}),c.jsx(rn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(It,{onSelect:async()=>{const v=(await s({path:t.data.path})).contents||"";za(new Blob([v]),t.data.name)},children:[c.jsx(nm,{...y}),"Download"]}),c.jsx(rn,{})]}),c.jsxs(It,{onSelect:x,variant:"danger",children:[c.jsx(Zl,{...y}),"Delete"]})]})})()]})]})]})},w7=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(jo,{className:"w-5 h-5 shrink-0"}):c.jsx(Ta,{className:"w-5 h-5 shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Gw(t,e){t.stopPropagation(),t.preventDefault(),mj(e)}function k7(){return null}function j7(t){const{parentNode:e}=t;return!e.data.isDirectory}function S7(t){return t.stopPropagation()}let Yw,Kw,Xw;Yw=()=>{const t=H.c(20),{ref:e,height:n}=qP(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:a,isDragActive:i}=Ww(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=xe("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(p7,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Hm=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=xe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.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},Kw=()=>{const t=H.c(9),e=GP(),{clearLogs:n}=it();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(ln,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx($f,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Hm,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(Xw,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Xw=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=xe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(a=n.map(E7),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px_1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function C7(t){const e=YP(t.timestamp),n=N7[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",e,"]"]}),c.jsx("span",{className:xe("shrink-0",n),children:o}),c.jsxs("span",{className:"shrink-0 text-(--gray-10)",children:["(",c.jsx(Io,{cellId:t.cellId}),")"]}),t.message]})}const N7={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function E7(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:C7(t)})]},e)}const _7=()=>{const t=H.c(7),{items:e}=Se(KP);let n,o;t[0]!==e?(o=GR(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=YR(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ln,{title:"No outline-solid",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Xc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(KR,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},Jw=yt(null),Zw=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(vn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=xe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Rn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},I7=()=>{var C,_;const t=H.c(30),[e]=fr(),n=e.package_management.manager,{getDependencyTree:o,getPackageList:r}=et(),[s,a]=q.useState(null);let i,l;t[0]!==o||t[1]!==r?(i=async()=>{const[E,M]=await Promise.all([r(),o()]);return{list:E.packages,tree:M.tree}},t[0]=o,t[1]=r,t[2]=i):i=t[2],t[3]!==n?(l=[n],t[3]=n,t[4]=l):l=t[4];const{data:d,error:u,refetch:h,isPending:f}=In(i,l);if(f){let E;return t[5]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(vn,{size:"medium",centered:!0}),t[5]=E):E=t[5],E}if(u){let E;return t[6]!==u?(E=c.jsx(xr,{error:u}),t[6]=u,t[7]=E):E=t[7],E}const m=d.tree!=null;let x;t[8]!==m||t[9]!==s?(x=function(E,M){return E==="list"?"list":M?E||"tree":"list"}(s,m),t[8]=m,t[9]=s,t[10]=x):x=t[10];const g=x,p=(C=d.tree)==null?void 0:C.name,b=(_=d==null?void 0:d.tree)==null?void 0:_.version,y=p==="<root>";let v,w,S,j;return t[11]!==n||t[12]!==h?(v=c.jsx(A7,{packageManager:n,onSuccess:h}),t[11]=n,t[12]=h,t[13]=v):v=t[13],t[14]!==y||t[15]!==m||t[16]!==p||t[17]!==b||t[18]!==g?(w=m&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",g==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>a("list"),children:"List"}),c.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",g==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>a("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,b&&` v${b}`]})]})]}),t[14]=y,t[15]=m,t[16]=p,t[17]=b,t[18]=g,t[19]=w):w=t[19],t[20]!==d.list||t[21]!==d.tree||t[22]!==u||t[23]!==h||t[24]!==g?(S=g==="list"?c.jsx(T7,{packages:d.list,onSuccess:h}):c.jsx(M7,{tree:d.tree,error:u,onSuccess:h}),t[20]=d.list,t[21]=d.tree,t[22]=u,t[23]=h,t[24]=g,t[25]=S):S=t[25],t[26]!==v||t[27]!==w||t[28]!==S?(j=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v,w,S]}),t[26]=v,t[27]=w,t[28]=S,t[29]=j):j=t[29],j},A7=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:a}=si(),i=Se(Jw),l=jt(Jw);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),q.useEffect(d,u);const{loading:h,handleInstallPackages:f}=XP();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(O7),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,j,C,_,E,M,I,D,F,O,P;e[10]!==h||e[11]!==a?(y=h?c.jsx(vn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(Ne,{content:"Change package manager",children:c.jsx(ws,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=A=>{A.key==="Enter"&&(A.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=A=>s(A.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(aj,{placeholder:b,id:p1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=j):j=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsxs("div",{children:[j," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),_=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=C,e[23]=_):(C=e[22],_=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsxs("div",{children:[_," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=E,e[25]=M):(E=e[24],M=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{children:[M," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),D=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=D):(I=e[26],D=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(F=c.jsxs("div",{children:[D," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),O=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=F,e[29]=O):(F=e[28],O=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(Ne,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[C,E,I,F,c.jsxs("div",{children:[O," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(Nm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=P):P=e[30];const R=r&&"bg-accent text-accent-foreground";let z;e[31]!==R?(z=xe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",R,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=R,e[32]=z):z=e[32];const N=!r;let k,B;return e[33]!==p||e[34]!==z||e[35]!==N?(k=c.jsx("button",{type:"button",className:z,onClick:p,disabled:N,children:"Add"}),e[33]=p,e[34]=z,e[35]=N,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,P,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},T7=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(ln,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(ws,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Om,{children:c.jsxs(vs,{children:[c.jsx(br,{children:"Name"}),c.jsx(br,{children:"Version"}),c.jsx(br,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(vs,{className:"group",onClick:async()=>{await on(`${l.name}==${l.version}`),Je({title:"Copied to clipboard"})},children:[c.jsx(yr,{children:l.name}),c.jsx(yr,{children:l.version}),c.jsxs(yr,{className:"flex justify-end",children:[c.jsx(Qw,{packageName:l.name,onSuccess:n}),c.jsx(ek,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(Dm,{className:"overflow-auto flex-1",children:[r,c.jsx(Pm,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},Qw=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{addPackage:r}=et();return Zt()?null:c.jsx(Zw,{onClick:async()=>{try{o(!0);const s=await r({package:t,upgrade:!0});s.success?(e(),ij(t)):ij(t,s.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},ek=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{removePackage:r}=et();return c.jsx(Zw,{onClick:async()=>{try{o(!0);const s=await r({package:t});s.success?(e(),lj(t)):lj(t,s.error)}finally{o(!1)}},loading:n,children:"Remove"})},M7=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[a,i]=q.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],q.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(xr,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(vn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(ln,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(ws,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(tk,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},tk=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=z=>{z.key!=="Enter"&&z.key!==" "||(z.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=z=>{z.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=xe("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const j=u?f:void 0;let C,_,E,M,I,D,F,O,P,R;return e[17]!==u||e[18]!==f?(C=u?f?c.jsx(jo,{className:"w-4 h-4 mr-2 shrink-0"}):c.jsx(Ta,{className:"w-4 h-4 mr-2 shrink-0"}):c.jsx("div",{className:"w-4 mr-2 shrink-0"}),e[17]=u,e[18]=f,e[19]=C):C=e[19],e[20]!==o.name?(_=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=_):_=e[21],e[22]!==o.version?(E=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=E):E=e[23],e[24]!==_||e[25]!==E?(M=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[_,E]}),e[24]=_,e[25]=E,e[26]=M):M=e[26],e[27]!==o.tags?(I=o.tags.map(D7),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(D=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=D):D=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(F=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(Qw,{packageName:o.name,onSuccess:l}),c.jsx(ek,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=F):F=e[34],e[35]!==b||e[36]!==g||e[37]!==C||e[38]!==M||e[39]!==D||e[40]!==F||e[41]!==w||e[42]!==S||e[43]!==j?(O=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":j,children:[C,M,D,F]}),e[35]=b,e[36]=g,e[37]=C,e[38]=M,e[39]=D,e[40]=F,e[41]=w,e[42]=S,e[43]=j,e[44]=O):O=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(P=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((z,N)=>c.jsx(tk,{nodeId:`${n}-${N}`,node:z,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${z.name}-${N}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=P):P=e[53],e[54]!==O||e[55]!==P?(R=c.jsxs("div",{children:[O,P]}),e[54]=O,e[55]=P,e[56]=R):R=e[56],R};function O7(t){return t.trim()}function D7(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const Rf=kk("marimo:scratchpadHistory:v1",[]),P7=yt(!1),R7=yt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Rf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Rf,r)}),L7={hide_code:!1,disabled:!1},F7=()=>{const t=H.c(71),e=cm(),[n]=fr(),{theme:o}=Ko(),r=T.useRef(null),s=ls(),{createNewCell:a,updateCellCode:i}=it(),{sendRunScratchpad:l}=et(),d=e.cellRuntime[Xo],u=d==null?void 0:d.output,h=d==null?void 0:d.status,f=d==null?void 0:d.consoleOutputs,m=e.cellData[Xo],x=(m==null?void 0:m.code)??"",g=jt(R7),[p,b]=Ot(P7),y=Se(Rf);let v;t[0]!==g||t[1]!==x||t[2]!==l?(v=()=>{l({code:x}),g(x)},t[0]=g,t[1]=x,t[2]=l,t[3]=v):v=t[3];const w=Le(v);let S;t[4]!==x||t[5]!==a||t[6]!==s?(S=()=>{x.trim()&&a({code:x,before:!1,cellId:s??"__end__"})},t[4]=x,t[5]=a,t[6]=s,t[7]=S):S=t[7];const j=Le(S);let C;t[8]!==l||t[9]!==i?(C=()=>{i({cellId:Xo,code:"",formattingChange:!1}),l({code:""});const ue=r.current;ue&&ue.dispatch({changes:{from:0,to:ue.state.doc.length,insert:""}})},t[8]=l,t[9]=i,t[10]=C):C=t[10];const _=Le(C);let E;t[11]!==b||t[12]!==i?(E=ue=>{b(!1),i({cellId:Xo,code:ue,formattingChange:!1});const de=r.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:ue}})},t[11]=b,t[12]=i,t[13]=E):E=t[13];const M=Le(E),[I,D]=T.useState();let F;t[14]!==x||t[15]!==f||t[16]!==w||t[17]!==I||t[18]!==u||t[19]!==o||t[20]!==n?(F=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto shrink-0 max-h-[40%]",children:c.jsx(Cu,{theme:o,showPlaceholder:!1,id:Xo,code:x,config:L7,status:"idle",serializedEditorState:null,runCell:w,userConfig:n,editorViewRef:r,setEditorView:ue=>{r.current=ue},hidden:!1,showHiddenCode:Ln.NOOP,languageAdapter:I,setLanguageAdapter:D})}),c.jsx("div",{className:"flex-1 overflow-auto shrink-0",children:c.jsx(Ic,{allowExpand:!1,output:u,className:"output-area",cellId:Xo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto shrink-0 max-h-[35%]",children:c.jsx(Bm,{consoleOutputs:f,className:"overflow-auto",stale:!1,cellName:jk,onSubmitDebugger:Ln.NOOP,cellId:Xo,debuggerActive:!1})})]}),t[14]=x,t[15]=f,t[16]=w,t[17]=I,t[18]=u,t[19]=o,t[20]=n,t[21]=F):F=t[21];const O=F;let P;t[22]!==M||t[23]!==y||t[24]!==p||t[25]!==o?(P=()=>p?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:y.map((ue,de)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>M(ue),children:c.jsx(T.Suspense,{children:c.jsx(oi,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ue.trim(),editable:!1,readOnly:!0})})},de))})}):null,t[22]=M,t[23]=y,t[24]=p,t[25]=o,t[26]=P):P=t[26];const R=P;let z,N,k,B,A,U,$,X,Y,G,W;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=Ea.create(Xo),N=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[27]=z,t[28]=N):(z=t[27],N=t[28]),t[29]===Symbol.for("react.memo_cache_sentinel")?(k=Wt("cell.run"),t[29]=k):k=t[29],t[30]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(vr,{color:"var(--grass-11)",size:16}),t[30]=B):B=t[30],t[31]!==w||t[32]!==p?(A=c.jsx(Ne,{content:k,children:c.jsx(ve,{"data-testid":"scratchpad-run-button",onClick:w,disabled:p,variant:"text",size:"xs",children:B})}),t[31]=w,t[32]=p,t[33]=A):A=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(Zm,{size:16}),t[34]=U):U=t[34],t[35]!==_||t[36]!==p?($=c.jsx(Ne,{content:"Clear code and outputs",children:c.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:_,children:U})}),t[35]=_,t[36]=p,t[37]=$):$=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(X=c.jsx(wr,{size:16}),t[38]=X):X=t[38],t[39]!==j||t[40]!==p?(Y=c.jsx(Ts,{children:c.jsx(Ne,{content:"Insert code",children:c.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:j,children:X})})}),t[39]=j,t[40]=p,t[41]=Y):Y=t[41],t[42]!==h?(G=(h==="running"||h==="queued")&&c.jsx(vn,{className:"inline",size:"small"}),t[42]=h,t[43]=G):G=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx("div",{className:"flex-1"}),t[44]=W):W=t[44];const J=p&&"bg-(--sky-3) rounded-none";let V,Q;t[45]!==J?(V=xe(J),t[45]=J,t[46]=V):V=t[46],t[47]!==p||t[48]!==b?(Q=()=>b(!p),t[47]=p,t[48]=b,t[49]=Q):Q=t[49];const te=y.length===0;let re,ne,ae,se,ie,ge,oe;return t[50]===Symbol.for("react.memo_cache_sentinel")?(re=c.jsx(sp,{size:16}),t[50]=re):re=t[50],t[51]!==V||t[52]!==Q||t[53]!==te?(ne=c.jsx(Ne,{content:"Toggle history",children:c.jsx(ve,{size:"xs",variant:"text",className:V,onClick:Q,disabled:te,children:re})}),t[51]=V,t[52]=Q,t[53]=te,t[54]=ne):ne=t[54],t[55]!==A||t[56]!==$||t[57]!==Y||t[58]!==G||t[59]!==ne?(ae=c.jsxs("div",{className:"flex items-center shrink-0",children:[A,$,Y,G,W,ne]}),t[55]=A,t[56]=$,t[57]=Y,t[58]=G,t[59]=ne,t[60]=ae):ae=t[60],t[61]!==O?(se=O(),t[61]=O,t[62]=se):se=t[62],t[63]!==R?(ie=R(),t[63]=R,t[64]=ie):ie=t[64],t[65]!==se||t[66]!==ie?(ge=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[se,ie]}),t[65]=se,t[66]=ie,t[67]=ge):ge=t[67],t[68]!==ae||t[69]!==ge?(oe=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[N,ae,ge]}),t[68]=ae,t[69]=ge,t[70]=oe):oe=t[70],oe},z7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(F7,{}),t[0]=e):e=t[0],e},B7=()=>{const t=H.c(23),{openModal:e,closeModal:n}=_n();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=In($7,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(vn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(xr,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(V7).map(H7),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(ln,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx(Hc,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(ig,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Yo,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Om,{children:c.jsxs(vs,{children:[c.jsx(br,{children:"Environment Variable"}),c.jsx(br,{children:"Source"}),c.jsx(br,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(W7),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(Dm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Pm,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},U7=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=q.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(ac,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Na,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function $7(){return ag((await wj.request({})).secrets)}function V7(t){return t.provider!=="env"}function H7(t){return t.name}function W7(t){return t.keys.map(e=>c.jsxs(vs,{className:"group",children:[c.jsx(yr,{children:e}),c.jsx(yr,{children:t.provider!=="env"&&c.jsx(G3,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(yr,{children:c.jsx(U7,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await on(`os.environ["${e}"]`),Je({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:xe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const q7=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=_n();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(Y7,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(z3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},G7=[We.lineWrapping],Y7=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=T.useState(""),{theme:s}=Ko();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),j=w.get("description"),C=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:j,code:C})}),n(),Je({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx($o,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(os,{children:[i,c.jsxs(rs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:Pn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Vo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(JP,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(oi,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:G7,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ve,{"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=c.jsx(ve,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Ho,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},K7=[We.lineWrapping],X7=()=>{const t=H.c(22),{readSnippets:e}=et(),[n,o]=q.useState();let r,s;t[0]!==e?(r=()=>e(),t[0]=e,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2];const{data:a,error:i,isPending:l}=In(r,s);if(i){let v;return t[3]!==i?(v=c.jsx(xr,{error:i}),t[3]=i,t[4]=v):v=t[4],v}if(l||!a){let v;return t[5]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(vn,{size:"medium",centered:!0}),t[5]=v):v=t[5],v}const d=n?"h-1/3":"h-full";let u,h,f,m,x,g,p,b,y;return t[6]!==d?(u=xe("border-b rounded-none",d),t[6]=d,t[7]=u):u=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Ma,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[8]=h):h=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsxs("div",{className:"flex items-center w-full",children:[h,c.jsx(q7,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})})]}),m=c.jsx(tc,{children:"No results"}),t[9]=f,t[10]=m):(f=t[9],m=t[10]),t[11]===Symbol.for("react.memo_cache_sentinel")?(x=v=>o(v),t[11]=x):x=t[11],t[12]!==a.snippets?(g=c.jsx(Z7,{onSelect:x,snippets:a.snippets}),t[12]=a.snippets,t[13]=g):g=t[13],t[14]!==u||t[15]!==g?(p=c.jsxs(cc,{className:u,children:[f,m,g]}),t[14]=u,t[15]=g,t[16]=p):p=t[16],t[17]!==n?(b=c.jsx(T.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:n?c.jsx(J7,{snippet:n,onClose:()=>o(void 0)},n.title):c.jsx(ln,{title:"",description:"Click on a snippet to view its content."})})}),t[17]=n,t[18]=b):b=t[18],t[19]!==b||t[20]!==p?(y=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[p,b]}),t[19]=b,t[20]=p,t[21]=y):y=t[21],y},J7=t=>{const e=H.c(33),{snippet:n,onClose:o}=t,{theme:r}=Ko(),{createNewCell:s}=it(),a=ls();let i;e[0]!==s||e[1]!==a||e[2]!==n.sections?(i=()=>{for(const w of[...n.sections].reverse())w.code&&s({code:w.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=s,e[1]=a,e[2]=n.sections,e[3]=i):i=e[3];const l=i;let d;e[4]!==s||e[5]!==a?(d=w=>{s({code:w,before:!1,cellId:a??"__end__"})},e[4]=s,e[5]=a,e[6]=d):d=e[6];const u=d;let h,f,m,x,g,p,b,y,v;if(e[7]!==n.title?(h=c.jsx("span",{children:n.title}),e[7]=n.title,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(yn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==o?(m=c.jsx(ve,{size:"sm",variant:"ghost",onClick:o,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:f}),e[10]=o,e[11]=m):m=e[11],e[12]!==h||e[13]!==m?(x=c.jsxs("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[h,m]}),e[12]=h,e[13]=m,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(wr,{className:"ml-2 h-4 w-4"}),e[15]=g):g=e[15],e[16]!==l?(p=c.jsx("div",{className:"flex justify-end",children:c.jsx(Ts,{children:c.jsxs(ve,{className:"float-right",size:"xs",variant:"outline",onClick:l,children:["Insert snippet",g]})})}),e[16]=l,e[17]=p):p=e[17],e[18]!==u||e[19]!==n.sections||e[20]!==n.title||e[21]!==r){let w;e[23]!==u||e[24]!==n.title||e[25]!==r?(w=S=>{const{code:j,html:C,id:_}=S;return C?c.jsx("div",{children:Am({html:C})},`${n.title}-${_}`):j?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(Ts,{children:c.jsx(Ne,{content:"Insert snippet",children:c.jsx(ve,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{u(j)},children:c.jsx(wr,{className:"h-5 w-5"})})})}),c.jsx(T.Suspense,{children:c.jsx(oi,{theme:r==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:K7,value:j,readOnly:!0},`${n.title}-${_}`)})]},`${n.title}-${_}`):null},e[23]=u,e[24]=n.title,e[25]=r,e[26]=w):w=e[26],b=n.sections.map(w),e[18]=u,e[19]=n.sections,e[20]=n.title,e[21]=r,e[22]=b}else b=e[22];return e[27]!==p||e[28]!==b?(y=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[p,b]}),e[27]=p,e[28]=b,e[29]=y):y=e[29],e[30]!==y||e[31]!==x?(v=c.jsxs(c.Fragment,{children:[x,y]}),e[30]=y,e[31]=x,e[32]=v):v=e[32],v},Z7=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Xn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(ym,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s},Q7=q.lazy(()=>wm(()=>import("./tracing-Ci_pZpdF.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),eM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(q.Suspense,{fallback:c.jsx(tM,{}),children:c.jsx(Q7,{})}),t[0]=e):e=t[0],e},tM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(vn,{})}),t[0]=e):e=t[0],e},nk="name",ok="type-value",Lf="defs-refs",nM=[{id:nk,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Rm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Yh,{name:e,declaredBy:n})}},{id:ok,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Rm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Lf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Rm,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=Ia(s);a&&Tm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Np,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(Io,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(Io,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(fi,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(N2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],rk=T.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,a]=q.useState(""),i=ZP(),l=T.useMemo(()=>{const h=f=>{const m=i[f];return oR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=T.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Lf,desc:!1});let g=[];switch(m.id){case nk:g=ii(f,p=>p.name);break;case ok:g=ii(f,p=>p.dataType);break;case Lf:g=ii(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=QP({data:d,columns:nM,getCoreRowModel:nR(),onGlobalFilterChange:a,getFilteredRowModel:tR(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:eR(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(aj,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(Dm,{className:xe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Om,{children:c.jsx(vs,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(br,{className:"sticky top-0 bg-background border-b",children:cj(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Pm,{children:u.getRowModel().rows.map(h=>c.jsx(vs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(yr,{className:"border-b",children:cj(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});rk.displayName="VariableTable";const oM=()=>{const t=H.c(4),e=Mm(),n=gr();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(ln,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Vl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(rk,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},rM=t=>{const e=H.c(54),n=Se(rR),o=Se(P_),r=it(),s=C3(),a=t.cellId,i=o[t.cellId],l=Ja(t.cellId),d=l.code,u=Za(t.cellId);let h,f,m,x,g,p,b,y,v,w,S,j,C,_;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==i||e[6]!==l.code||e[7]!==u.errored){if(h={id:a,graph:i,code:d,hasError:u.errored},n.focusedCellId&&o[n.focusedCellId]){const z=o[n.focusedCellId];let N;e[20]!==n.focusedCellId||e[21]!==z?(N={id:n.focusedCellId,graph:z},e[20]=n.focusedCellId,e[21]=z,e[22]=N):N=e[22],x=N}m=(x==null?void 0:x.id)===h.id,f=ak(h.graph)?1.5:3;const O=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};j=h.id;const P=m?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[23]!==P?(g=xe("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",P),e[23]=P,e[24]=g):g=e[24],p=O,b=uM;const R=m&&"bg-primary group-hover:bg-primary";e[25]!==R?(S=xe("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",R),e[25]=R,e[26]=S):S=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?c.jsx(lM,{cell:h,selectedCell:x}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:iM(h.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=i,e[6]=l.code,e[7]=u.errored,e[8]=h,e[9]=f,e[10]=m,e[11]=x,e[12]=g,e[13]=p,e[14]=b,e[15]=y,e[16]=v,e[17]=w,e[18]=S,e[19]=j}else h=e[8],f=e[9],m=e[10],x=e[11],g=e[12],p=e[13],b=e[14],y=e[15],v=e[16],w=e[17],S=e[18],j=e[19];e[27]!==y||e[28]!==v||e[29]!==w?(C=c.jsx("div",{className:y,title:v,children:w}),e[27]=y,e[28]=v,e[29]=w,e[30]=C):C=e[30],e[31]!==C||e[32]!==S?(_=c.jsx("div",{className:S,children:C}),e[31]=C,e[32]=S,e[33]=_):_=e[33];const E=m?"z-30":"z-20";let M,I,D,F;return e[34]!==h||e[35]!==x||e[36]!==E?(M=xe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",E,function({cell:O,selectedCell:P}){return O.hasError?"text-destructive":!P&&!ak(O.graph)?"text-foreground":(P==null?void 0:P.id)===O.id||P!=null&&P.graph.parents.has(O.id)||P!=null&&P.graph.children.has(O.id)?"text-primary":"text-(--gray-8)"}({cell:h,selectedCell:x})),e[34]=h,e[35]=x,e[36]=E,e[37]=M):M=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==x?(I=m?c.jsx(cM,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):c.jsx(dM,{cell:h,selectedCell:x,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=x,e[43]=I):I=e[43],e[44]!==M||e[45]!==I?(D=c.jsx("svg",{className:M,width:"1",height:"1",children:I}),e[44]=M,e[45]=I,e[46]=D):D=e[46],e[47]!==g||e[48]!==p||e[49]!==b||e[50]!==_||e[51]!==D||e[52]!==j?(F=c.jsxs("button",{"data-node-id":j,className:g,onClick:p,onMouseDown:b,children:[_,D]}),e[47]=g,e[48]=p,e[49]=b,e[50]=_,e[51]=D,e[52]=j,e[53]=F):F=e[53],F},sM=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=gr();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(hM)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r){i=[];let v=0;for(const[w,S]of r.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=xe("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(yn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ve,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==r.inOrderIds||e[13]!==a||e[14]!==i){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const j=i.includes(S);return c.jsxs(T.Fragment,{children:[j&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-(--gray-4) pointer-events-none","aria-hidden":"true"}),c.jsx(rM,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.inOrderIds.map(v),e[12]=r.inOrderIds,e[13]=a,e[14]=i,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},aM=()=>{const t=H.c(5),[e,n]=Ot(yb);let o,r;return t[0]!==n?(o=()=>n(fM),t[0]=n,t[1]=o):o=t[1],Dt("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=c.jsx(sM,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function iM(t){return t.split(`
|
148
|
-
`)[0].trim()||void 0}const lM=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=Mm(),s=n.id===(o==null?void 0:o.id);let a,i;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let l;e[5]!==s||e[6]!==o||e[7]!==r?(l=(d,u)=>{const h=r[d];return c.jsxs(T.Fragment,{children:[u>0&&", ",c.jsx("span",{className:xe({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&R_(h,o)}),children:d})]},d)},e[5]=s,e[6]=o,e[7]=r,e[8]=l):l=e[8],a=n.graph.variables.map(l),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[9]!==a?(i=c.jsx(c.Fragment,{children:a}),e[9]=a,e[10]=i):i=e[10],i},cM=t=>{const e=H.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,a,i,l;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const d=o[n.id]??0,u=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&u.add(h);for(const h of u){const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h 14 v ${-m} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${m} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(a=c.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=a):a=e[6],e[7]!==s?(i=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=i):i=e[8],e[9]!==a||e[10]!==i?(l=c.jsxs("g",{transform:"translate(0, 0)",children:[a,i]}),e[9]=a,e[10]=i,e[11]=l):l=e[11],l};function dM(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return sk({circleRadius:o,leftWisker:r,rightWisker:s});const a=n.graph.ancestors.has(e.id),i=n.graph.descendants.has(e.id);return sk(a||i?{circleRadius:o,leftWisker:r,rightWisker:s,shift:a&&i?void 0:a?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function sk(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function ak(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function uM(t){return t.preventDefault()}function hM(t,e){return[t,e]}function fM(t){return!t}const mM=q.lazy(()=>wm(()=>import("./terminal-BertI5HS.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),pM=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=sc(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=Fa(),l=q.useRef(null),d=q.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Pe=l.current.isCollapsed();o&&Pe&&l.current.expand(),o||Pe||l.current.collapse(),requestAnimationFrame(xM)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),T.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Pe=d.current.isCollapsed();r&&Pe&&d.current.expand(),r||Pe||d.current.collapse(),requestAnimationFrame(yM)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),T.useEffect(f,m),e[6]!==n?(x=c.jsx(Oc,{id:"app",className:"relative h-full",children:c.jsx(T.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=xe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(dj,{onDragging:uj,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,j;e[12]!==w?(S=xe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(j=c.jsx(dj,{onDragging:uj,className:S}),e[14]=S,e[15]=j):j=e[15];const C=j;let _,E,M,I,D,F,O,P,R,z,N,k,B,A,U,$,X,Y,G,W,J;e[16]!==s?(_=c.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=_):_=e[17],e[18]!==a?(E=()=>a(!1),e[18]=a,e[19]=E):E=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(yn,{className:"w-4 h-4"}),e[20]=M):M=e[20],e[21]!==E?(I=c.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:E,children:M}),e[21]=E,e[22]=I):I=e[22],e[23]!==_||e[24]!==I?(D=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[_,I]}),e[23]=_,e[24]=I,e[25]=D):D=e[25],e[26]!==s?(F=s==="files"&&c.jsx(Yw,{}),e[26]=s,e[27]=F):F=e[27],e[28]!==s?(O=s==="errors"&&c.jsx(o7,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(P=s==="variables"&&c.jsx(oM,{}),e[30]=s,e[31]=P):P=e[31],e[32]!==s?(R=s==="dependencies"&&c.jsx($T,{}),e[32]=s,e[33]=R):R=e[33],e[34]!==s?(z=s==="packages"&&c.jsx(I7,{}),e[34]=s,e[35]=z):z=e[35],e[36]!==s?(N=s==="outline"&&c.jsx(_7,{}),e[36]=s,e[37]=N):N=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(t7,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(n7,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(A=s==="snippets"&&c.jsx(X7,{}),e[42]=s,e[43]=A):A=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(z7,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?($=s==="chat"&&c.jsx(d8,{}),e[46]=s,e[47]=$):$=e[47],e[48]!==s?(X=s==="logs"&&c.jsx(Kw,{}),e[48]=s,e[49]=X):X=e[49],e[50]!==s?(Y=s==="tracing"&&c.jsx(eM,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(G=s==="secrets"&&c.jsx(B7,{}),e[52]=s,e[53]=G):G=e[53],e[54]!==F||e[55]!==O||e[56]!==P||e[57]!==R||e[58]!==z||e[59]!==N||e[60]!==k||e[61]!==B||e[62]!==A||e[63]!==U||e[64]!==$||e[65]!==X||e[66]!==Y||e[67]!==G?(W=c.jsx(T.Suspense,{children:c.jsxs(Ac,{children:[F,O,P,R,z,N,k,B,A,U,$,X,Y,G]})}),e[54]=F,e[55]=O,e[56]=P,e[57]=R,e[58]=z,e[59]=N,e[60]=k,e[61]=B,e[62]=A,e[63]=U,e[64]=$,e[65]=X,e[66]=Y,e[67]=G,e[68]=W):W=e[68],e[69]!==D||e[70]!==W?(J=c.jsx(dc,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,W]})}),e[69]=D,e[70]=W,e[71]=J):J=e[71];const V=J,Q=o&&"border-r border-l border-(--slate-7)";let te,re,ne,ae,se,ie;e[72]!==Q?(te=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(re=(Pe,Re)=>{var He;Re===0&&Pe===10&&((He=l.current)==null||He.resize(30))},e[74]=re):re=e[74],e[75]!==a?(ne=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=ne,e[77]=ae):(ne=e[76],ae=e[77]),e[78]!==V||e[79]!==v?(se=c.jsxs("span",{className:"flex flex-row h-full",children:[V," ",v]}),e[78]=V,e[79]=v,e[80]=se):se=e[80],e[81]!==te||e[82]!==ne||e[83]!==ae||e[84]!==se?(ie=c.jsx(Oc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:te,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ne,onExpand:ae,children:se},"helper"),e[81]=te,e[82]=ne,e[83]=ae,e[84]=se,e[85]=ie):ie=e[85];const ge=ie,oe=r&&"border-(--slate-7)";let ue,de,Ce,Te,Fe,_e,ke,Ye,Ve;e[86]!==oe?(ue=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",oe),e[86]=oe,e[87]=ue):ue=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(de=(Pe,Re)=>{var He;Re===0&&Pe===10&&((He=d.current)==null||He.resize(30))},e[88]=de):de=e[88],e[89]!==i?(Ce=()=>i(!1),Te=()=>i(!0),e[89]=i,e[90]=Ce,e[91]=Te):(Ce=e[90],Te=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Fe=c.jsx("div",{}),e[92]=Fe):Fe=e[92],e[93]!==i?(_e=()=>i(!1),e[93]=i,e[94]=_e):_e=e[94],e[95]!==r||e[96]!==_e?(ke=c.jsx(T.Suspense,{fallback:Fe,children:c.jsx(mM,{visible:r,onClose:_e})}),e[95]=r,e[96]=_e,e[97]=ke):ke=e[97],e[98]!==r||e[99]!==ke?(Ye=c.jsx(VT,{isOpen:r,children:ke}),e[98]=r,e[99]=ke,e[100]=Ye):Ye=e[100],e[101]!==ue||e[102]!==Ce||e[103]!==Te||e[104]!==Ye||e[105]!==C?(Ve=c.jsxs(Oc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:de,onCollapse:Ce,onExpand:Te,children:[C,Ye]},"terminal"),e[101]=ue,e[102]=Ce,e[103]=Te,e[104]=Ye,e[105]=C,e[106]=Ve):Ve=e[106];const Ke=Ve;let ee,ye,we,Ie,K,me,pe,he,je;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ee=XR(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=c.jsx(Ac,{children:c.jsx(q_,{})}),e[108]=ye):ye=e[108],e[109]!==Ke?(we=c.jsx(xb,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Ie=c.jsx(Oc,{children:c.jsxs(hj,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Ie):Ie=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(K=c.jsx(sR,{}),e[114]=K):K=e[114],e[115]!==ge||e[116]!==Ie?(me=c.jsxs(hj,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ee,children:[ye,ge,Ie,K]}),e[115]=ge,e[116]=Ie,e[117]=me):me=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(pe=c.jsx(aM,{}),e[118]=pe):pe=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(he=c.jsx(dc,{children:c.jsx(Ac,{children:c.jsx(U_,{})})}),e[119]=he):he=e[119],e[120]!==me?(je=c.jsxs(JR,{children:[me,pe,he]}),e[120]=me,e[121]=je):je=e[121],je};function gM(){window.dispatchEvent(new Event("resize"))}function xM(){requestAnimationFrame(gM)}function bM(){window.dispatchEvent(new Event("resize"))}function yM(){requestAnimationFrame(bM)}let ik;ik=new URL(window.location.href).searchParams.get(aR.showChrome)==="false",Pj=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(ik){let s,a,i;return e[0]!==t?(s=c.jsx(gb,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Bp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(gb,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Bp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(pM,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Hm as C,Pc as E,ln as P,sL as __tla,Rc as a,Pj as e,js as f};
|