@marimo-team/frontend 0.15.1-dev38 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-D8km1NYJ.js → ConnectedDataExplorerComponent-BmuPnAsd.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CERR01UB.js → ImageComparisonComponent-uf-9TFG8.js} +1 -1
  3. package/dist/assets/{VegaLite-DzZIYwlo.js → VegaLite-CQyOAWzz.js} +1 -1
  4. package/dist/assets/{_baseEach-DO-XcSIV.js → _baseEach-2yxz4QPK.js} +1 -1
  5. package/dist/assets/_baseMap-Uhjhm4ni.js +1 -0
  6. package/dist/assets/{_baseUniq-urG2vBXB.js → _baseUniq-kkBJp3jc.js} +1 -1
  7. package/dist/assets/{_createAggregator-DBxX1xI5.js → _createAggregator-ByV0zOLy.js} +1 -1
  8. package/dist/assets/{any-language-editor-BhBzti0Q.js → any-language-editor-B-cvHGmQ.js} +1 -1
  9. package/dist/assets/{architectureDiagram-KFL7JDKH-mgZE9P9E.js → architectureDiagram-KFL7JDKH-CrRiJlSM.js} +1 -1
  10. package/dist/assets/{blockDiagram-ZYB65J3Q-DhlvqBBN.js → blockDiagram-ZYB65J3Q-BARtxPtR.js} +1 -1
  11. package/dist/assets/{c4Diagram-AAMF2YG6-WgF7TmcX.js → c4Diagram-AAMF2YG6-C1rZ_aGX.js} +1 -1
  12. package/dist/assets/channel-BFLyOCHP.js +1 -0
  13. package/dist/assets/{chunk-ANTBXLJU-Cc0FLBv4.js → chunk-ANTBXLJU-CXz5OLFO.js} +1 -1
  14. package/dist/assets/{chunk-FHKO5MBM-TDVJkINs.js → chunk-FHKO5MBM-BIrdB1fE.js} +1 -1
  15. package/dist/assets/{chunk-GLLZNHP4-BFZQsgmM.js → chunk-GLLZNHP4-jO0hO6S-.js} +1 -1
  16. package/dist/assets/{chunk-JBRWN2VN-jewL7EcA.js → chunk-JBRWN2VN-CqtMDVwa.js} +1 -1
  17. package/dist/assets/{chunk-LXBSTHXV-DtMvensd.js → chunk-LXBSTHXV-68wVSxsz.js} +1 -1
  18. package/dist/assets/{chunk-NRVI72HA-B7LxIi5N.js → chunk-NRVI72HA-6jfSceAv.js} +1 -1
  19. package/dist/assets/{chunk-OMD6QJNC-D77lwHsv.js → chunk-OMD6QJNC-DItPiESC.js} +1 -1
  20. package/dist/assets/{chunk-WVR4S24B-BdzaJi_f.js → chunk-WVR4S24B-Dk_4BMrf.js} +1 -1
  21. package/dist/assets/{circle-play-DbLJhgWd.js → circle-play-DlcxXne6.js} +1 -1
  22. package/dist/assets/classDiagram-3BZAVTQC-DmaMTSt3.js +1 -0
  23. package/dist/assets/classDiagram-v2-QTMF73CY-DmaMTSt3.js +1 -0
  24. package/dist/assets/clone-D8_RSzqX.js +1 -0
  25. package/dist/assets/{compile-ittiAa-p.js → compile-rRtwsAuM.js} +1 -1
  26. package/dist/assets/{dagre-2BBEFEWP-woDg8Awj.js → dagre-2BBEFEWP-BRQiUAjN.js} +1 -1
  27. package/dist/assets/{data-grid-overlay-editor-ncLMoVIb.js → data-grid-overlay-editor-D69G4ntu.js} +1 -1
  28. package/dist/assets/{diagram-4IRLE6MV-PAN7AATi.js → diagram-4IRLE6MV-dbf1VDp2.js} +1 -1
  29. package/dist/assets/{diagram-GUPCWM2R-Ce2AHqMP.js → diagram-GUPCWM2R-03cBW_UX.js} +1 -1
  30. package/dist/assets/{diagram-RP2FKANI-2WiKea8D.js → diagram-RP2FKANI-izLn5JA6.js} +1 -1
  31. package/dist/assets/edit-page-KQGIuOho.css +1 -0
  32. package/dist/assets/{edit-page-CZn2bhY3.js → edit-page-zgOEBr1X.js} +48 -48
  33. package/dist/assets/{erDiagram-HZWUO2LU-D5yTZwmt.js → erDiagram-HZWUO2LU-DvzfndiW.js} +1 -1
  34. package/dist/assets/{flowDiagram-THRYKUMA-CgN86sZ8.js → flowDiagram-THRYKUMA-DvMVXvqb.js} +1 -1
  35. package/dist/assets/{ganttDiagram-WV7ZQ7D5-5skQ2H3l.js → ganttDiagram-WV7ZQ7D5-BzN8gykN.js} +1 -1
  36. package/dist/assets/{gitGraphDiagram-OJR772UL-C75De8fN.js → gitGraphDiagram-OJR772UL-wxIdjcsZ.js} +1 -1
  37. package/dist/assets/{glide-data-editor-x0d0Up5U.js → glide-data-editor-D6Yhpu80.js} +4 -4
  38. package/dist/assets/{graph-Die-6Bfl.js → graph-DLqrcAlu.js} +1 -1
  39. package/dist/assets/{home-page-XrEKfDMd.js → home-page-CDKRxIoa.js} +1 -1
  40. package/dist/assets/{index-D_ebOE-e.js → index-0xwlfUxT.js} +1 -1
  41. package/dist/assets/{index-CXwX4pUI.js → index-BB71mG_d.js} +182 -182
  42. package/dist/assets/{index-BfqMljbw.js → index-BZeyS4ec.js} +1 -1
  43. package/dist/assets/{index-CoAopzxc.js → index-Bs6OAQYb.js} +1 -1
  44. package/dist/assets/{index-Dlrab0dK.js → index-BsnxGFdv.js} +1 -1
  45. package/dist/assets/{index-Dh8C39yO.js → index-C0OGBvcf.js} +1 -1
  46. package/dist/assets/{index-BSJet7Zq.js → index-CK28dYOC.js} +1 -1
  47. package/dist/assets/{index-DmHX1Rlv.js → index-CQZ2Knp2.js} +1 -1
  48. package/dist/assets/{index-De7juNGF.js → index-Cdz_z5nt.js} +1 -1
  49. package/dist/assets/{index-BWBg8Lhk.js → index-ClD_znk5.js} +1 -1
  50. package/dist/assets/{index-kraNHKP1.js → index-D-b5sgmz.js} +1 -1
  51. package/dist/assets/{index-CCZkMG5j.js → index-D2UJqE4Q.js} +1 -1
  52. package/dist/assets/{index-v546YXgW.js → index-D2fV3sDg.js} +1 -1
  53. package/dist/assets/{index-UAPuSZUk.js → index-DUN68f-4.js} +1 -1
  54. package/dist/assets/{index-B3-zxsj0.js → index-DZKpeoa1.js} +1 -1
  55. package/dist/assets/{index-F531CohR.js → index-DgoUxLCo.js} +1 -1
  56. package/dist/assets/{index-B1-fG89N.js → index-Dh_3Mb5d.js} +1 -1
  57. package/dist/assets/{index-D9ot8WPl.js → index-DroyKRLH.js} +1 -1
  58. package/dist/assets/index-DryPQDfA.css +1 -0
  59. package/dist/assets/{index-jwhWh6uS.js → index-bUE-XbFV.js} +1 -1
  60. package/dist/assets/{index-B7JwzNrx.js → index-yz44yADt.js} +1 -1
  61. package/dist/assets/infoDiagram-6WOFNB3A-CvNjv0rh.js +2 -0
  62. package/dist/assets/{journeyDiagram-FFXJYRFH-CrWxkiXG.js → journeyDiagram-FFXJYRFH-BON6WB5Z.js} +1 -1
  63. package/dist/assets/{kanban-definition-KOZQBZVT-D5haTqpz.js → kanban-definition-KOZQBZVT-DENjuTrn.js} +1 -1
  64. package/dist/assets/{layout-BEc7rmra.js → layout-3QJH3hkO.js} +1 -1
  65. package/dist/assets/{linear-BLmy5c_P.js → linear-BFvzcy10.js} +1 -1
  66. package/dist/assets/links-B7kV7dQW.js +17 -0
  67. package/dist/assets/{mermaid-Bu2fp8N3.js → mermaid-0ClPHFIM.js} +4 -4
  68. package/dist/assets/{min-BF5a70Ha.js → min-CO20nzic.js} +1 -1
  69. package/dist/assets/{mindmap-definition-LNHGMQRG-jD2ylGBG.js → mindmap-definition-LNHGMQRG-0ssdD2sg.js} +1 -1
  70. package/dist/assets/{number-overlay-editor-BadGHMrr.js → number-overlay-editor-CVVXgCAp.js} +1 -1
  71. package/dist/assets/{pieDiagram-DBDJKBY4-B11UeqxS.js → pieDiagram-DBDJKBY4-DI0JNhUn.js} +1 -1
  72. package/dist/assets/{quadrantDiagram-YPSRARAO-DznrQXs-.js → quadrantDiagram-YPSRARAO-Bqg0IAoq.js} +1 -1
  73. package/dist/assets/{react-plotly-B6W1vV_l.js → react-plotly-yplDi2oo.js} +1 -1
  74. package/dist/assets/{requirementDiagram-EGVEC5DT-BuWp2ov9.js → requirementDiagram-EGVEC5DT-C_YIxDr_.js} +1 -1
  75. package/dist/assets/{run-page-BD4YehOu.js → run-page-Bv2C3uJ1.js} +1 -1
  76. package/dist/assets/{sankeyDiagram-HRAUVNP4-BmDCzHkG.js → sankeyDiagram-HRAUVNP4-Dm-w1V71.js} +1 -1
  77. package/dist/assets/{sequenceDiagram-WFGC7UMF-B6aCHwAd.js → sequenceDiagram-WFGC7UMF-uox9Aix1.js} +1 -1
  78. package/dist/assets/{slides-component-CkHAJhvv.js → slides-component-BBkS68D5.js} +1 -1
  79. package/dist/assets/{sortBy-BgSF6Z3p.js → sortBy-yoFvjOas.js} +1 -1
  80. package/dist/assets/{stateDiagram-UUKSUZ4H-DcGKoXUB.js → stateDiagram-UUKSUZ4H-DVHFynm4.js} +1 -1
  81. package/dist/assets/stateDiagram-v2-EYPG3UTE-_z_RwTAL.js +1 -0
  82. package/dist/assets/{storage-BX5GfYeC.js → storage-C__Jd9kD.js} +3 -3
  83. package/dist/assets/{terminal-CpmTRzDD.js → terminal-BpOKN-Gr.js} +1 -1
  84. package/dist/assets/{time-igUPFhda.js → time-q7el0-6s.js} +1 -1
  85. package/dist/assets/{timeline-definition-3HZDQTIS-7b4K28uW.js → timeline-definition-3HZDQTIS-K-bheyBf.js} +1 -1
  86. package/dist/assets/{tracing-BWeRyJmf.js → tracing-Cv9nIL_Y.js} +2 -2
  87. package/dist/assets/{trash-Bv9cD3VE.js → trash-Izx1PgIJ.js} +1 -1
  88. package/dist/assets/{treemap-75Q7IDZK-DPkOPTcz.js → treemap-75Q7IDZK-mGt3Vxl-.js} +1 -1
  89. package/dist/assets/{vega-component-CGVDFtwG.js → vega-component-B1UZ_5Pg.js} +1 -1
  90. package/dist/assets/{xychartDiagram-FDP5SA34-BbvKlNzf.js → xychartDiagram-FDP5SA34-DGx9I_mu.js} +1 -1
  91. package/dist/index.html +2 -2
  92. package/package.json +7 -7
  93. package/src/components/ai/ai-model-dropdown.tsx +3 -3
  94. package/src/components/app-config/ai-config.tsx +244 -8
  95. package/src/components/chat/markdown-renderer.css +15 -0
  96. package/src/components/chat/markdown-renderer.tsx +2 -1
  97. package/src/components/editor/ai/completion-utils.ts +6 -2
  98. package/src/components/editor/cell/cell-context-menu.tsx +35 -13
  99. package/src/core/ai/__tests__/model-registry.test.ts +28 -0
  100. package/src/core/ai/model-registry.ts +44 -8
  101. package/src/core/codemirror/language/languages/sql/utils.ts +6 -1
  102. package/src/plugins/impl/FileBrowserPlugin.tsx +14 -20
  103. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +19 -2
  104. package/src/plugins/impl/common/error-banner.tsx +3 -0
  105. package/dist/assets/_baseMap-Dg1mkEJY.js +0 -1
  106. package/dist/assets/channel-D1aHTD78.js +0 -1
  107. package/dist/assets/classDiagram-3BZAVTQC-C8Rjm-tQ.js +0 -1
  108. package/dist/assets/classDiagram-v2-QTMF73CY-C8Rjm-tQ.js +0 -1
  109. package/dist/assets/clone-BWlvmMhq.js +0 -1
  110. package/dist/assets/edit-page-jgH_jXgs.css +0 -1
  111. package/dist/assets/index-B6q_Qknx.css +0 -1
  112. package/dist/assets/infoDiagram-6WOFNB3A-mJ455ogl.js +0 -2
  113. package/dist/assets/links-BGVSWGyv.js +0 -17
  114. package/dist/assets/stateDiagram-v2-EYPG3UTE-BW5Lhcrb.js +0 -1
@@ -1,17 +0,0 @@
1
- import{ce as nl,aP as rl,c as xe,U as y,ft as it,fu as St,fv as ze,fw as il,fx as ol,fy as xr,fz as br,fA as ln,fB as wr,dG as Ne,b as M,fC as sl,fD as Sr,fE as jr,ay as kr,fF as Cr,fG as jt,fH as Ir,fI as ot,fJ as ll,fK as an,fL as Nr,fM as kt,fN as Te,fO as al,fP as Re,fQ as Dr,dF as Or,fR as cl,fS as Er,fT as Tr,fU as Ct,fV as dl,fW as ul,fX as hl,dM as It,fY as fl,fZ as pl,f_ as gl,f$ as ml,dH as cn,dI as vl,dJ as dn,dL as st,g0 as yl,g1 as Pr,g2 as un,g3 as hn,dK as xl,g4 as bl,g5 as wl,g6 as Sl,j as s,g7 as jl,a as re,cB as kl,ar as lt,g8 as Cl,T as qe,g9 as Kr,fa as Il,ga as _r,gb as Mr,gc as q,gd as Ar,ge as W,gf as U,gg as G,gh as be,gi as X,bo as Fe,gj as Rr,gk as J,gl as he,ac as We,gm as me,bp as fe,gn as Nt,e4 as Fr,go as Lr,gp as Nl,gq as Ge,gr as Me,gs as zr,o as Dl,gt as Ol,gu as $r,gv as Dt,gw as Vr,gx as El,gy as Ot,L as ue,gz as ge,gA as Tl,dR as Et,gB as Br,eK as Pl,dt as fn,fj as Kl,gC as Hr,gD as _l,gE as Ml,gF as Ur,gG as qr,gH as Al,al as at,be as ct,eS as Wr,V as Tt,gI as Rl,gJ as Fl,gK as Gr,gL as Yr,gM as Ll,a6 as Se,ev as Pt,gN as Xr,a4 as pn,gO as zl,gP as $l,a7 as Qr,a8 as Vl,a9 as Zr,gQ as Bl,gR as Hl,gS as Ul,b5 as ql,gT as Wl,gU as Gl,gV as Yl,gW as Xl,gX as Ql,gY as Zl,cm as Jl,bq as Kt,es as ea,dN as Jr,ad as ta,ab as na,gZ as ra,g_ as _t,bm as Mt,ch as ei,g$ as ia,h0 as ti,at as Ye,h1 as ni,h2 as At,h3 as gn,h4 as ri,ag as $e,h5 as ii,h6 as oa,aO as mn,eJ as sa,h7 as la,h8 as aa,h9 as oi,ha as ca,aT as si,hb as li,hc as da,av as ua,hd as ha,e_ as fa,he as pa,er as ga,hf as ai,hg as ma,hh as va,hi as ya,hj as xa,aK as ba,hk as ci,hl as vn,aw as wa,_ as di,E as Sa,hm as ja,hn as Rt,ho as ka,hp as Ca,ao as yn,fh as Ia,hq as Na,hr as Da,hs as Oa,ht as Ea,eq as dt,dD as Ft,hu as Ta,hv as ui,hw as Pa,a5 as Ka,hx as _a,hy as Ma,hz as Aa,ba as Ra,bj as Fa,b8 as La}from"./index-CXwX4pUI.js";import{e as za}from"./index-BWBg8Lhk.js";/**
2
- * @license lucide-react v0.525.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const $a=xe("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Va=xe("book-marked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),hi=xe("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),fi=xe("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),pi=xe("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Ba=xe("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]),gi=xe("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),Ha=xe("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),Ua=xe("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),qa=xe("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),Wa=xe("messages-square",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]),Ga=xe("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),Ya=xe("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),Xa=xe("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Qa=xe("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);function mi(t,e){const n=y.useRef(!0),r=y.useRef(null);it(()=>(n.current=!0,()=>{n.current=!1}),[]),it(()=>{n.current?n.current=!1:r.current&&!e.some((i,o)=>!Object.is(i,r[o]))||t(),r.current=e},e)}function Za(t){const e=y.version.split(".");return parseInt(e[0],10)>=19?t:t?"true":void 0}function Xe(t){return il()?t.metaKey:t.ctrlKey}class gr{get childNodes(){throw new Error("childNodes is not supported")}clone(){let e=new gr(this.type,this.key);return e.value=this.value,e.level=this.level,e.hasChildNodes=this.hasChildNodes,e.rendered=this.rendered,e.textValue=this.textValue,e["aria-label"]=this["aria-label"],e.index=this.index,e.parentKey=this.parentKey,e.prevKey=this.prevKey,e.nextKey=this.nextKey,e.firstChildKey=this.firstChildKey,e.lastChildKey=this.lastChildKey,e.props=this.props,e.render=this.render,e.colSpan=this.colSpan,e.colIndex=this.colIndex,e}constructor(e,n){this.value=null,this.level=0,this.hasChildNodes=!1,this.rendered=null,this.textValue="",this["aria-label"]=void 0,this.index=0,this.parentKey=null,this.prevKey=null,this.nextKey=null,this.firstChildKey=null,this.lastChildKey=null,this.props={},this.colSpan=null,this.colIndex=null,this.type=e,this.key=n}}class mr{get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}*[Symbol.iterator](){let e=this.firstKey!=null?this.keyMap.get(this.firstKey):void 0;for(;e;)yield e,e=e.nextKey!=null?this.keyMap.get(e.nextKey):void 0}getChildren(e){let n=this.keyMap;return{*[Symbol.iterator](){let r=n.get(e),i=(r==null?void 0:r.firstChildKey)!=null?n.get(r.firstChildKey):null;for(;i;)yield i,i=i.nextKey!=null?n.get(i.nextKey):void 0}}}getKeyBefore(e){let n=this.keyMap.get(e);if(!n)return null;if(n.prevKey!=null){for(n=this.keyMap.get(n.prevKey);n&&n.type!=="item"&&n.lastChildKey!=null;)n=this.keyMap.get(n.lastChildKey);var r;return(r=n==null?void 0:n.key)!==null&&r!==void 0?r:null}return n.parentKey}getKeyAfter(e){let n=this.keyMap.get(e);if(!n)return null;if(n.type!=="item"&&n.firstChildKey!=null)return n.firstChildKey;for(;n;){if(n.nextKey!=null)return n.nextKey;if(n.parentKey==null)return null;n=this.keyMap.get(n.parentKey)}return null}getFirstKey(){return this.firstKey}getLastKey(){let e=this.lastKey!=null?this.keyMap.get(this.lastKey):null;for(;(e==null?void 0:e.lastChildKey)!=null;)e=this.keyMap.get(e.lastChildKey);var n;return(n=e==null?void 0:e.key)!==null&&n!==void 0?n:null}getItem(e){var n;return(n=this.keyMap.get(e))!==null&&n!==void 0?n:null}at(){throw new Error("Not implemented")}clone(){let e=new this.constructor;return e.keyMap=new Map(this.keyMap),e.firstKey=this.firstKey,e.lastKey=this.lastKey,e.itemCount=this.itemCount,e}addNode(e){if(this.frozen)throw new Error("Cannot add a node to a frozen collection");e.type==="item"&&this.keyMap.get(e.key)==null&&this.itemCount++,this.keyMap.set(e.key,e)}removeNode(e){if(this.frozen)throw new Error("Cannot remove a node to a frozen collection");let n=this.keyMap.get(e);n!=null&&n.type==="item"&&this.itemCount--,this.keyMap.delete(e)}commit(e,n,r=!1){if(this.frozen)throw new Error("Cannot commit a frozen collection");this.firstKey=e,this.lastKey=n,this.frozen=!r}UNSTABLE_filter(e){let n=new mr,r=null;for(let i of this)if(i.type==="section"&&i.hasChildNodes){let o=i.clone(),l=null;for(let c of this.getChildren(i.key))if(vi(c,e,this,n)){let a=c.clone();l==null&&(o.firstChildKey=a.key),n.firstKey==null&&(n.firstKey=o.key),l&&l.parentKey===a.parentKey?(l.nextKey=a.key,a.prevKey=l.key):a.prevKey=null,a.nextKey=null,n.addNode(a),l=a}l&&(l.type!=="header"?(o.lastChildKey=l.key,r==null?o.prevKey=null:r.type!=="section"&&r.type!=="separator"||(r.nextKey=o.key,o.prevKey=r.key),o.nextKey=null,r=o,n.addNode(o)):(n.firstKey===o.key&&(n.firstKey=null),n.removeNode(l.key)))}else if(i.type==="separator"){let o=i.clone();o.nextKey=null,(r==null?void 0:r.type)==="section"&&(r.nextKey=o.key,o.prevKey=r.key,r=o,n.addNode(o))}else{let o=i.clone();vi(o,e,this,n)&&(n.firstKey==null&&(n.firstKey=o.key),r!=null&&r.type!=="section"&&r.type!=="separator"&&r.parentKey===o.parentKey?(r.nextKey=o.key,o.prevKey=r.key):o.prevKey=null,o.nextKey=null,n.addNode(o),r=o)}if((r==null?void 0:r.type)==="separator"&&r.nextKey===null){let i;r.prevKey!=null&&(i=n.getItem(r.prevKey),i.nextKey=null),n.removeNode(r.key),r=i}return n.lastKey=(r==null?void 0:r.key)||null,n}constructor(){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.frozen=!1,this.itemCount=0}}function vi(t,e,n,r){if(t.type==="subdialogtrigger"||t.type==="submenutrigger"){let i=[...n.getChildren(t.key)][0];if(i&&e(i.textValue)){let o=i.clone();return r.addNode(o),!0}return!1}return t.type==="header"||e(t.textValue)}class yi{*[Symbol.iterator](){let e=this.firstChild;for(;e;)yield e,e=e.nextSibling}get firstChild(){return this._firstChild}set firstChild(e){this._firstChild=e,this.ownerDocument.markDirty(this)}get lastChild(){return this._lastChild}set lastChild(e){this._lastChild=e,this.ownerDocument.markDirty(this)}get previousSibling(){return this._previousSibling}set previousSibling(e){this._previousSibling=e,this.ownerDocument.markDirty(this)}get nextSibling(){return this._nextSibling}set nextSibling(e){this._nextSibling=e,this.ownerDocument.markDirty(this)}get parentNode(){return this._parentNode}set parentNode(e){this._parentNode=e,this.ownerDocument.markDirty(this)}get isConnected(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.isConnected)||!1}invalidateChildIndices(e){(this._minInvalidChildIndex==null||!this._minInvalidChildIndex.isConnected||e.index<this._minInvalidChildIndex.index)&&(this._minInvalidChildIndex=e,this.ownerDocument.markDirty(this))}updateChildIndices(){let e=this._minInvalidChildIndex;for(;e;)e.index=e.previousSibling?e.previousSibling.index+1:0,e=e.nextSibling;this._minInvalidChildIndex=null}appendChild(e){e.parentNode&&e.parentNode.removeChild(e),this.firstChild==null&&(this.firstChild=e),this.lastChild?(this.lastChild.nextSibling=e,e.index=this.lastChild.index+1,e.previousSibling=this.lastChild):(e.previousSibling=null,e.index=0),e.parentNode=this,e.nextSibling=null,this.lastChild=e,this.ownerDocument.markDirty(this),this.isConnected&&this.ownerDocument.queueUpdate()}insertBefore(e,n){if(n==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e),e.nextSibling=n,e.previousSibling=n.previousSibling,e.index=n.index-1,this.firstChild===n?this.firstChild=e:n.previousSibling&&(n.previousSibling.nextSibling=e),n.previousSibling=e,e.parentNode=n.parentNode,this.invalidateChildIndices(e),this.isConnected&&this.ownerDocument.queueUpdate()}removeChild(e){e.parentNode===this&&this.ownerDocument.isMounted&&(this._minInvalidChildIndex===e&&(this._minInvalidChildIndex=null),e.nextSibling&&(this.invalidateChildIndices(e.nextSibling),e.nextSibling.previousSibling=e.previousSibling),e.previousSibling&&(e.previousSibling.nextSibling=e.nextSibling),this.firstChild===e&&(this.firstChild=e.nextSibling),this.lastChild===e&&(this.lastChild=e.previousSibling),e.parentNode=null,e.nextSibling=null,e.previousSibling=null,e.index=0,this.ownerDocument.markDirty(e),this.isConnected&&this.ownerDocument.queueUpdate())}addEventListener(){}removeEventListener(){}get previousVisibleSibling(){let e=this.previousSibling;for(;e&&e.isHidden;)e=e.previousSibling;return e}get nextVisibleSibling(){let e=this.nextSibling;for(;e&&e.isHidden;)e=e.nextSibling;return e}get firstVisibleChild(){let e=this.firstChild;for(;e&&e.isHidden;)e=e.nextSibling;return e}get lastVisibleChild(){let e=this.lastChild;for(;e&&e.isHidden;)e=e.previousSibling;return e}constructor(e){this._firstChild=null,this._lastChild=null,this._previousSibling=null,this._nextSibling=null,this._parentNode=null,this._minInvalidChildIndex=null,this.ownerDocument=e}}class rt extends yi{get index(){return this._index}set index(e){this._index=e,this.ownerDocument.markDirty(this)}get level(){return this.parentNode instanceof rt?this.parentNode.level+(this.node.type==="item"?1:0):0}getMutableNode(){return this.isMutated||(this.node=this.node.clone(),this.isMutated=!0),this.ownerDocument.markDirty(this),this.node}updateNode(){var e,n,r;let i=this.nextVisibleSibling,o=this.getMutableNode();var l,c,a,d;if(o.index=this.index,o.level=this.level,o.parentKey=this.parentNode instanceof rt?this.parentNode.node.key:null,o.prevKey=(l=(e=this.previousVisibleSibling)===null||e===void 0?void 0:e.node.key)!==null&&l!==void 0?l:null,o.nextKey=(c=i==null?void 0:i.node.key)!==null&&c!==void 0?c:null,o.hasChildNodes=!!this.firstChild,o.firstChildKey=(a=(n=this.firstVisibleChild)===null||n===void 0?void 0:n.node.key)!==null&&a!==void 0?a:null,o.lastChildKey=(d=(r=this.lastVisibleChild)===null||r===void 0?void 0:r.node.key)!==null&&d!==void 0?d:null,(o.colSpan!=null||o.colIndex!=null)&&i){var u,f;let p=((u=o.colIndex)!==null&&u!==void 0?u:o.index)+((f=o.colSpan)!==null&&f!==void 0?f:1);p!==i.node.colIndex&&(i.getMutableNode().colIndex=p)}}setProps(e,n,r,i){let o=this.getMutableNode(),{value:l,textValue:c,id:a,...d}=e;if(d.ref=n,o.props=d,o.rendered=r,o.render=i,o.value=l,o.textValue=c||(typeof d.children=="string"?d.children:"")||e["aria-label"]||"",a!=null&&a!==o.key){if(this.hasSetProps)throw new Error("Cannot change the id of an item");o.key=a}d.colSpan!=null&&(o.colSpan=d.colSpan),this.hasSetProps=!0,this.isConnected&&this.ownerDocument.queueUpdate()}get style(){let e=this;return{get display(){return e.isHidden?"none":""},set display(n){let r=n==="none";if(e.isHidden!==r){var i,o;((i=e.parentNode)===null||i===void 0?void 0:i.firstVisibleChild)!==e&&((o=e.parentNode)===null||o===void 0?void 0:o.lastVisibleChild)!==e||e.ownerDocument.markDirty(e.parentNode);let l=e.previousVisibleSibling,c=e.nextVisibleSibling;l&&e.ownerDocument.markDirty(l),c&&e.ownerDocument.markDirty(c),e.isHidden=r,e.ownerDocument.markDirty(e)}}}}hasAttribute(){}setAttribute(){}setAttributeNS(){}removeAttribute(){}constructor(e,n){super(n),this.nodeType=8,this.isMutated=!0,this._index=0,this.hasSetProps=!1,this.isHidden=!1,this.node=new gr(e,"react-aria-"+ ++n.nodeId)}}class Ja extends yi{get isConnected(){return this.isMounted}createElement(e){return new rt(e,this)}getMutableCollection(){return this.nextCollection||(this.nextCollection=this.collection.clone()),this.nextCollection}markDirty(e){this.dirtyNodes.add(e)}addNode(e){if(e.isHidden)return;let n=this.getMutableCollection();if(!n.getItem(e.node.key))for(let r of e)this.addNode(r);n.addNode(e.node)}removeNode(e){for(let n of e)this.removeNode(n);this.getMutableCollection().removeNode(e.node.key)}getCollection(){return this.inSubscription?this.collection.clone():(this.queuedRender=!1,this.updateCollection(),this.collection)}updateCollection(){for(let o of this.dirtyNodes)o instanceof rt&&(!o.isConnected||o.isHidden)?this.removeNode(o):o.updateChildIndices();for(let o of this.dirtyNodes)o instanceof rt&&(o.isConnected&&!o.isHidden&&(o.updateNode(),this.addNode(o)),o.isMutated=!1);var e,n,r,i;this.dirtyNodes.clear(),this.nextCollection&&(this.nextCollection.commit((r=(e=this.firstVisibleChild)===null||e===void 0?void 0:e.node.key)!==null&&r!==void 0?r:null,(i=(n=this.lastVisibleChild)===null||n===void 0?void 0:n.node.key)!==null&&i!==void 0?i:null,this.isSSR),this.isSSR||(this.collection=this.nextCollection,this.nextCollection=null))}queueUpdate(){if(this.dirtyNodes.size!==0&&!this.queuedRender){this.queuedRender=!0,this.inSubscription=!0;for(let e of this.subscriptions)e();this.inSubscription=!1}}subscribe(e){return this.subscriptions.add(e),()=>this.subscriptions.delete(e)}resetAfterSSR(){this.isSSR&&(this.isSSR=!1,this.firstChild=null,this.lastChild=null,this.nodeId=0)}constructor(e){super(null),this.nodeType=11,this.ownerDocument=this,this.dirtyNodes=new Set,this.isSSR=!1,this.nodeId=0,this.nodesByProps=new WeakMap,this.isMounted=!0,this.nextCollection=null,this.subscriptions=new Set,this.queuedRender=!1,this.inSubscription=!1,this.collection=e,this.nextCollection=e}}function xn(t){let{children:e,items:n,idScope:r,addIdAndValue:i,dependencies:o=[]}=t,l=y.useMemo(()=>new WeakMap,o);return y.useMemo(()=>{if(n&&typeof e=="function"){let d=[];for(let u of n){let f=l.get(u);if(!f){var c,a;f=e(u);let p=(a=(c=f.props.id)!==null&&c!==void 0?c:u.key)!==null&&a!==void 0?a:u.id;if(p==null)throw new Error("Could not determine key for item");r&&(p=r+":"+p),f=y.cloneElement(f,i?{key:p,id:p,value:u}:{key:p}),l.set(u,f)}d.push(f)}return d}if(typeof e!="function")return e},[e,n,l,r,i])}const ec=500,xi=y.createContext(!1),ut=y.createContext(null);function tc(t){if(y.useContext(ut))return t.content;let{collection:e,document:n}=function(r){let[i]=y.useState(()=>new Ja((r==null?void 0:r())||new mr)),o=y.useCallback(d=>i.subscribe(d),[i]),l=y.useCallback(()=>{let d=i.getCollection();return i.isSSR&&i.resetAfterSSR(),d},[i]),c=y.useCallback(()=>(i.isSSR=!0,i.getCollection()),[i]),a=rc(o,l,c);return it(()=>(i.isMounted=!0,()=>{i.isMounted=!1}),[i]),{collection:a,document:i}}(t.createCollection);return M.createElement(M.Fragment,null,M.createElement(sl,null,M.createElement(ut.Provider,{value:n},t.content)),M.createElement(nc,{render:t.children,collection:e}))}function nc({collection:t,render:e}){return e(t)}const rc=typeof M.useSyncExternalStore=="function"?M.useSyncExternalStore:function(t,e,n){let r=Sr(),i=y.useRef(r);i.current=r;let o=y.useCallback(()=>i.current?n():e(),[e,n]);return jr.useSyncExternalStore(t,o)},bn=y.createContext(null);function bi(t,e,n,r,i,o){let l=y.useCallback(a=>{a==null||a.setProps(e,n,r,o)},[e,n,r,o]),c=y.useContext(bn);if(c){let a=c.ownerDocument.nodesByProps.get(e);return a||(a=c.ownerDocument.createElement(t),a.setProps(e,n,r,o),c.appendChild(a),c.ownerDocument.updateCollection(),c.ownerDocument.nodesByProps.set(e,a)),i?M.createElement(bn.Provider,{value:a},i):null}return M.createElement(t,{ref:l},i)}function wi(t,e){let n=({node:i})=>e(i.props,i.props.ref,i),r=y.forwardRef((i,o)=>{let l=y.useContext(Cr);if(!y.useContext(xi)){if(e.length>=3)throw new Error(e.name+" cannot be rendered outside a collection.");return e(i,o)}return bi(t,i,o,"children"in i?i.children:null,null,c=>M.createElement(Cr.Provider,{value:l},M.createElement(n,{node:c})))});return r.displayName=e.name,r}function ic(t,e,n=Si){let r=({node:o})=>e(o.props,o.props.ref,o),i=y.forwardRef((o,l)=>{let c=n(o);var a;return(a=bi(t,o,l,null,c,d=>M.createElement(r,{node:d})))!==null&&a!==void 0?a:M.createElement(M.Fragment,null)});return i.displayName=e.name,i}function Si(t){return xn({...t,addIdAndValue:!0})}const ji=y.createContext(null);function oc(t){let e=y.useContext(ji),n=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),r=t.idScope||(e==null?void 0:e.idScope),i=Si({...t,idScope:r,dependencies:n});return y.useContext(ut)&&(i=M.createElement(sc,null,i)),e=y.useMemo(()=>({dependencies:n,idScope:r}),[r,...n]),M.createElement(ji.Provider,{value:e},i)}function sc({children:t}){let e=y.useContext(ut),n=y.useMemo(()=>M.createElement(ut.Provider,{value:null},M.createElement(xi.Provider,{value:!0},t)),[t]);return Sr()?M.createElement(bn.Provider,{value:e},n):kr.createPortal(n,e)}function ki(t){let e=function(n){let r=Ir(n),i=r==null?void 0:r.getAttribute("aria-activedescendant");return i&&n.getElementById(i)||r}(br(t));e!==t&&(e&&function(n,r){n.dispatchEvent(new FocusEvent("blur",{relatedTarget:r})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:r}))}(e,t),t&&Ci(t,e))}function Ci(t,e){t.dispatchEvent(new FocusEvent("focus",{relatedTarget:e})),t.dispatchEvent(new FocusEvent("focusin",{bubbles:!0,relatedTarget:e}))}function wn(t){return ll()?t.altKey:t.ctrlKey}function Lt(t,e){var n,r;let i=`[data-key="${CSS.escape(String(e))}"]`,o=(n=t.current)===null||n===void 0?void 0:n.dataset.collection;return o&&(i=`[data-collection="${CSS.escape(o)}"]${i}`),(r=t.current)===null||r===void 0?void 0:r.querySelector(i)}const Ii=new WeakMap;function lc(t){let{selectionManager:e,keyboardDelegate:n,ref:r,autoFocus:i=!1,shouldFocusWrap:o=!1,disallowEmptySelection:l=!1,disallowSelectAll:c=!1,escapeKeyBehavior:a="clearSelection",selectOnFocus:d=e.selectionBehavior==="replace",disallowTypeAhead:u=!1,shouldUseVirtualFocus:f,allowsTabNavigation:p=!1,isVirtualized:m,scrollRef:h=r,linkBehavior:g="action"}=t,{direction:v}=an(),x=Nr(),S=y.useRef({top:0,left:0});kt(h,"scroll",m?void 0:()=>{var I,K,F,V;S.current={top:(F=(I=h.current)===null||I===void 0?void 0:I.scrollTop)!==null&&F!==void 0?F:0,left:(V=(K=h.current)===null||K===void 0?void 0:K.scrollLeft)!==null&&V!==void 0?V:0}});let j=y.useRef(!1);kt(r,"react-aria-focus",f?I=>{let{detail:K}=I;I.stopPropagation(),e.setFocused(!0),(K==null?void 0:K.focusStrategy)==="first"&&(j.current=!0)}:void 0);let C=St(()=>{var I,K;let F=(K=(I=n.getFirstKey)===null||I===void 0?void 0:I.call(n))!==null&&K!==void 0?K:null;if(F==null){let V=Ir();ki(r.current),Ci(V,null),e.collection.size>0&&(j.current=!1)}else e.setFocusedKey(F),j.current=!1});mi(()=>{j.current&&C()},[e.collection,C]);let k=St(()=>{e.collection.size>0&&(j.current=!1)});mi(()=>{k()},[e.focusedKey,k]),kt(r,"react-aria-clear-focus",f?I=>{var K;I.stopPropagation(),e.setFocused(!1),!((K=I.detail)===null||K===void 0)&&K.clearFocusKey&&e.setFocusedKey(null)}:void 0);const D=y.useRef(i),N=y.useRef(!1);y.useEffect(()=>{if(D.current){var I,K;let $=null;var F,V;i==="first"&&($=(F=(I=n.getFirstKey)===null||I===void 0?void 0:I.call(n))!==null&&F!==void 0?F:null),i==="last"&&($=(V=(K=n.getLastKey)===null||K===void 0?void 0:K.call(n))!==null&&V!==void 0?V:null);let w=e.selectedKeys;if(w.size){for(let z of w)if(e.canSelectItem(z)){$=z;break}}e.setFocused(!0),e.setFocusedKey($),$==null&&!f&&r.current&&Te(r.current),e.collection.size>0&&(D.current=!1,N.current=!0)}});let P=y.useRef(e.focusedKey),O=y.useRef(null);y.useEffect(()=>{if(e.isFocused&&e.focusedKey!=null&&(e.focusedKey!==P.current||N.current)&&h.current&&r.current){let I=Dr(),K=Lt(r,e.focusedKey);if(!(K instanceof HTMLElement))return;(I==="keyboard"||N.current)&&(O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame(()=>{h.current&&(al(h.current,K),I!=="virtual"&&Re(K,{containingElement:r.current}))}))}!f&&e.isFocused&&e.focusedKey==null&&P.current!=null&&r.current&&Te(r.current),P.current=e.focusedKey,N.current=!1}),y.useEffect(()=>()=>{O.current&&cancelAnimationFrame(O.current)},[]),kt(r,"react-aria-focus-scope-restore",I=>{I.preventDefault(),e.setFocused(!0)});let _,R={onKeyDown:I=>{var K;if(I.altKey&&I.key==="Tab"&&I.preventDefault(),!(!((K=r.current)===null||K===void 0)&&K.contains(I.target)))return;const F=(A,oe)=>{if(A!=null){if(e.isLink(A)&&g==="selection"&&d&&!wn(I)){kr.flushSync(()=>{e.setFocusedKey(A,oe)});let B=Lt(r,A),ne=e.getItemProps(A);return void(B&&x.open(B,I,ne.href,ne.routerOptions))}if(e.setFocusedKey(A,oe),e.isLink(A)&&g==="override")return;I.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(A):d&&!wn(I)&&e.replaceSelection(A)}};switch(I.key){case"ArrowDown":if(n.getKeyBelow){var V,$,w;let A=e.focusedKey!=null?(V=n.getKeyBelow)===null||V===void 0?void 0:V.call(n,e.focusedKey):($=n.getFirstKey)===null||$===void 0?void 0:$.call(n);A==null&&o&&(A=(w=n.getFirstKey)===null||w===void 0?void 0:w.call(n,e.focusedKey)),A!=null&&(I.preventDefault(),F(A))}break;case"ArrowUp":if(n.getKeyAbove){var z,T,b;let A=e.focusedKey!=null?(z=n.getKeyAbove)===null||z===void 0?void 0:z.call(n,e.focusedKey):(T=n.getLastKey)===null||T===void 0?void 0:T.call(n);A==null&&o&&(A=(b=n.getLastKey)===null||b===void 0?void 0:b.call(n,e.focusedKey)),A!=null&&(I.preventDefault(),F(A))}break;case"ArrowLeft":if(n.getKeyLeftOf){var E,se,ae;let A=e.focusedKey!=null?(E=n.getKeyLeftOf)===null||E===void 0?void 0:E.call(n,e.focusedKey):null;A==null&&o&&(A=v==="rtl"?(se=n.getFirstKey)===null||se===void 0?void 0:se.call(n,e.focusedKey):(ae=n.getLastKey)===null||ae===void 0?void 0:ae.call(n,e.focusedKey)),A!=null&&(I.preventDefault(),F(A,v==="rtl"?"first":"last"))}break;case"ArrowRight":if(n.getKeyRightOf){var Z,te,le;let A=e.focusedKey!=null?(Z=n.getKeyRightOf)===null||Z===void 0?void 0:Z.call(n,e.focusedKey):null;A==null&&o&&(A=v==="rtl"?(te=n.getLastKey)===null||te===void 0?void 0:te.call(n,e.focusedKey):(le=n.getFirstKey)===null||le===void 0?void 0:le.call(n,e.focusedKey)),A!=null&&(I.preventDefault(),F(A,v==="rtl"?"last":"first"))}break;case"Home":if(n.getFirstKey){if(e.focusedKey===null&&I.shiftKey)return;I.preventDefault();let A=n.getFirstKey(e.focusedKey,Xe(I));e.setFocusedKey(A),A!=null&&(Xe(I)&&I.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(A):d&&e.replaceSelection(A))}break;case"End":if(n.getLastKey){if(e.focusedKey===null&&I.shiftKey)return;I.preventDefault();let A=n.getLastKey(e.focusedKey,Xe(I));e.setFocusedKey(A),A!=null&&(Xe(I)&&I.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(A):d&&e.replaceSelection(A))}break;case"PageDown":if(n.getKeyPageBelow&&e.focusedKey!=null){let A=n.getKeyPageBelow(e.focusedKey);A!=null&&(I.preventDefault(),F(A))}break;case"PageUp":if(n.getKeyPageAbove&&e.focusedKey!=null){let A=n.getKeyPageAbove(e.focusedKey);A!=null&&(I.preventDefault(),F(A))}break;case"a":Xe(I)&&e.selectionMode==="multiple"&&c!==!0&&(I.preventDefault(),e.selectAll());break;case"Escape":a!=="clearSelection"||l||e.selectedKeys.size===0||(I.stopPropagation(),I.preventDefault(),e.clearSelection());break;case"Tab":if(!p){if(I.shiftKey)r.current.focus();else{let A,oe,B=jt(r.current,{tabbable:!0});do oe=B.lastChild(),oe&&(A=oe);while(oe);A&&!A.contains(document.activeElement)&&ln(A)}break}}},onFocus:I=>{if(e.isFocused)I.currentTarget.contains(I.target)||e.setFocused(!1);else if(I.currentTarget.contains(I.target)){if(e.setFocused(!0),e.focusedKey==null){var K,F;let w=T=>{T!=null&&(e.setFocusedKey(T),d&&!e.isSelected(T)&&e.replaceSelection(T))},z=I.relatedTarget;var V,$;z&&I.currentTarget.compareDocumentPosition(z)&Node.DOCUMENT_POSITION_FOLLOWING?w((V=e.lastSelectedKey)!==null&&V!==void 0?V:(K=n.getLastKey)===null||K===void 0?void 0:K.call(n)):w(($=e.firstSelectedKey)!==null&&$!==void 0?$:(F=n.getFirstKey)===null||F===void 0?void 0:F.call(n))}else!m&&h.current&&(h.current.scrollTop=S.current.top,h.current.scrollLeft=S.current.left);if(e.focusedKey!=null&&h.current){let w=Lt(r,e.focusedKey);w instanceof HTMLElement&&(w.contains(document.activeElement)||f||ln(w),Dr()==="keyboard"&&Re(w,{containingElement:r.current}))}}},onBlur:I=>{I.currentTarget.contains(I.relatedTarget)||e.setFocused(!1)},onMouseDown(I){h.current===I.target&&I.preventDefault()}},{typeSelectProps:L}=function(I){let{keyboardDelegate:K,selectionManager:F,onTypeSelect:V}=I,$=y.useRef({search:"",timeout:void 0}).current;return{typeSelectProps:{onKeyDownCapture:K.getKeyForSearch?w=>{let z=(T=w.key).length!==1&&/^[A-Z]/i.test(T)?"":T;var T;if(z&&!w.ctrlKey&&!w.metaKey&&w.currentTarget.contains(w.target)&&($.search.length!==0||z!==" ")){if(z===" "&&$.search.trim().length>0&&(w.preventDefault(),"continuePropagation"in w||w.stopPropagation()),$.search+=z,K.getKeyForSearch!=null){let b=K.getKeyForSearch($.search,F.focusedKey);b==null&&(b=K.getKeyForSearch($.search)),b!=null&&(F.setFocusedKey(b),V&&V(b))}clearTimeout($.timeout),$.timeout=setTimeout(()=>{$.search=""},1e3)}}:void 0}}}({keyboardDelegate:n,selectionManager:e});u||(R=Ne(L,R)),f||(_=e.focusedKey==null?0:-1);let H=function(I){let K=ot();return Ii.set(I,K),K}(e.collection);return{collectionProps:Ne(R,{tabIndex:_,"data-collection":H})}}function ac(t){let{id:e,selectionManager:n,key:r,ref:i,shouldSelectOnPressUp:o,shouldUseVirtualFocus:l,focus:c,isDisabled:a,onAction:d,allowsDifferentPressOrigin:u,linkBehavior:f="action"}=t,p=Nr();e=ot(e);let m=w=>{if(w.pointerType==="keyboard"&&wn(w))n.toggleSelection(r);else{if(n.selectionMode==="none")return;if(n.isLink(r)){if(f==="selection"&&i.current){let z=n.getItemProps(r);return p.open(i.current,w,z.href,z.routerOptions),void n.setSelectedKeys(n.selectedKeys)}if(f==="override"||f==="none")return}n.selectionMode==="single"?n.isSelected(r)&&!n.disallowEmptySelection?n.toggleSelection(r):n.replaceSelection(r):w&&w.shiftKey?n.extendSelection(r):n.selectionBehavior==="toggle"||w&&(Xe(w)||w.pointerType==="touch"||w.pointerType==="virtual")?n.toggleSelection(r):n.replaceSelection(r)}};y.useEffect(()=>{r===n.focusedKey&&n.isFocused&&(l?ki(i.current):c?c():document.activeElement!==i.current&&i.current&&Te(i.current))},[i,r,n.focusedKey,n.childFocusStrategy,n.isFocused,l]),a=a||n.isDisabled(r);let h={};l||a?a&&(h.onMouseDown=w=>{w.preventDefault()}):h={tabIndex:r===n.focusedKey?0:-1,onFocus(w){w.target===i.current&&n.setFocusedKey(r)}};let g=n.isLink(r)&&f==="override",v=n.isLink(r)&&f!=="selection"&&f!=="none",x=!a&&n.canSelectItem(r)&&!g,S=(d||v)&&!a,j=S&&(n.selectionBehavior==="replace"?!x:!x||n.isEmpty),C=S&&x&&n.selectionBehavior==="replace",k=j||C,D=y.useRef(null),N=k&&x,P=y.useRef(!1),O=y.useRef(!1),_=n.getItemProps(r),R=w=>{d&&d(),v&&i.current&&p.open(i.current,w,_.href,_.routerOptions)},L={ref:i};var H;if(o?(L.onPressStart=w=>{D.current=w.pointerType,P.current=N,w.pointerType!=="keyboard"||k&&!Di()||m(w)},u?(L.onPressUp=j?void 0:w=>{w.pointerType==="mouse"&&x&&m(w)},L.onPress=j?R:w=>{w.pointerType!=="keyboard"&&w.pointerType!=="mouse"&&x&&m(w)}):L.onPress=w=>{if(j||C&&w.pointerType!=="mouse"){if(w.pointerType==="keyboard"&&!Ni())return;R(w)}else w.pointerType!=="keyboard"&&x&&m(w)}):(L.onPressStart=w=>{D.current=w.pointerType,P.current=N,O.current=j,x&&(w.pointerType==="mouse"&&!j||w.pointerType==="keyboard"&&(!S||Di()))&&m(w)},L.onPress=w=>{(w.pointerType==="touch"||w.pointerType==="pen"||w.pointerType==="virtual"||w.pointerType==="keyboard"&&k&&Ni()||w.pointerType==="mouse"&&O.current)&&(k?R(w):x&&m(w))}),h["data-collection"]=(H=n.collection,Ii.get(H)),h["data-key"]=r,L.preventFocusOnPress=l,l&&(L=Ne(L,{onPressStart(w){w.pointerType!=="touch"&&(n.setFocused(!0),n.setFocusedKey(r))},onPress(w){w.pointerType==="touch"&&(n.setFocused(!0),n.setFocusedKey(r))}})),_)for(let w of["onPressStart","onPressEnd","onPressChange","onPress","onPressUp","onClick"])_[w]&&(L[w]=Or(L[w],_[w]));let{pressProps:I,isPressed:K}=xr(L),F=C?w=>{D.current==="mouse"&&(w.stopPropagation(),w.preventDefault(),R(w))}:void 0,{longPressProps:V}=function(w){let{isDisabled:z,onLongPressStart:T,onLongPressEnd:b,onLongPress:E,threshold:se=ec,accessibilityDescription:ae}=w;const Z=y.useRef(void 0);let{addGlobalListener:te,removeGlobalListener:le}=ol(),{pressProps:A}=xr({isDisabled:z,onPressStart(B){if(B.continuePropagation(),(B.pointerType==="mouse"||B.pointerType==="touch")&&(T&&T({...B,type:"longpressstart"}),Z.current=setTimeout(()=>{B.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),br(B.target).activeElement!==B.target&&ln(B.target),E&&E({...B,type:"longpress"}),Z.current=void 0},se),B.pointerType==="touch")){let ne=ce=>{ce.preventDefault()};te(B.target,"contextmenu",ne,{once:!0}),te(window,"pointerup",()=>{setTimeout(()=>{le(B.target,"contextmenu",ne)},30)},{once:!0})}},onPressEnd(B){Z.current&&clearTimeout(Z.current),!b||B.pointerType!=="mouse"&&B.pointerType!=="touch"||b({...B,type:"longpressend"})}}),oe=wr(E&&!z?ae:void 0);return{longPressProps:Ne(A,oe)}}({isDisabled:!N,onLongPress(w){w.pointerType==="touch"&&(m(w),n.setSelectionBehavior("toggle"))}}),$=f!=="none"&&n.isLink(r)?w=>{cl.isOpening||w.preventDefault()}:void 0;return{itemProps:Ne(h,x||j||l&&!a?I:{},N?V:{},{onDoubleClick:F,onDragStartCapture:w=>{D.current==="touch"&&P.current&&w.preventDefault()},onClick:$,id:e},l?{onMouseDown:w=>w.preventDefault()}:void 0),isPressed:K,isSelected:n.isSelected(r),isFocused:n.isFocused&&n.focusedKey===r,isDisabled:a,allowsSelection:x,hasAction:k}}function Ni(){let t=window.event;return(t==null?void 0:t.key)==="Enter"}function Di(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}class Oi{getItemRect(e){let n=this.ref.current;if(!n)return null;let r=e!=null?Lt(this.ref,e):null;if(!r)return null;let i=n.getBoundingClientRect(),o=r.getBoundingClientRect();return{x:o.left-i.left+n.scrollLeft,y:o.top-i.top+n.scrollTop,width:o.width,height:o.height}}getContentSize(){let e=this.ref.current;var n,r;return{width:(n=e==null?void 0:e.scrollWidth)!==null&&n!==void 0?n:0,height:(r=e==null?void 0:e.scrollHeight)!==null&&r!==void 0?r:0}}getVisibleRect(){let e=this.ref.current;var n,r,i,o;return{x:(n=e==null?void 0:e.scrollLeft)!==null&&n!==void 0?n:0,y:(r=e==null?void 0:e.scrollTop)!==null&&r!==void 0?r:0,width:(i=e==null?void 0:e.offsetWidth)!==null&&i!==void 0?i:0,height:(o=e==null?void 0:e.offsetHeight)!==null&&o!==void 0?o:0}}constructor(e){this.ref=e}}class Ei{isDisabled(e){var n;return this.disabledBehavior==="all"&&(((n=e.props)===null||n===void 0?void 0:n.isDisabled)||this.disabledKeys.has(e.key))}findNextNonDisabled(e,n){let r=e;for(;r!=null;){let i=this.collection.getItem(r);if((i==null?void 0:i.type)==="item"&&!this.isDisabled(i))return r;r=n(r)}return null}getNextKey(e){let n=e;return n=this.collection.getKeyAfter(n),this.findNextNonDisabled(n,r=>this.collection.getKeyAfter(r))}getPreviousKey(e){let n=e;return n=this.collection.getKeyBefore(n),this.findNextNonDisabled(n,r=>this.collection.getKeyBefore(r))}findKey(e,n,r){let i=e,o=this.layoutDelegate.getItemRect(i);if(!o||i==null)return null;let l=o;do{if(i=n(i),i==null)break;o=this.layoutDelegate.getItemRect(i)}while(o&&r(l,o)&&i!=null);return i}isSameRow(e,n){return e.y===n.y||e.x!==n.x}isSameColumn(e,n){return e.x===n.x||e.y!==n.y}getKeyBelow(e){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,n=>this.getNextKey(n),this.isSameRow):this.getNextKey(e)}getKeyAbove(e){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,n=>this.getPreviousKey(n),this.isSameRow):this.getPreviousKey(e)}getNextColumn(e,n){return n?this.getPreviousKey(e):this.getNextKey(e)}getKeyRightOf(e){let n=this.direction==="ltr"?"getKeyRightOf":"getKeyLeftOf";return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,r=>this.layoutDelegate[n](r))):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="rtl"):this.findKey(e,r=>this.getNextColumn(r,this.direction==="rtl"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="rtl"):null}getKeyLeftOf(e){let n=this.direction==="ltr"?"getKeyLeftOf":"getKeyRightOf";return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,r=>this.layoutDelegate[n](r))):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="ltr"):this.findKey(e,r=>this.getNextColumn(r,this.direction==="ltr"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="ltr"):null}getFirstKey(){let e=this.collection.getFirstKey();return this.findNextNonDisabled(e,n=>this.collection.getKeyAfter(n))}getLastKey(){let e=this.collection.getLastKey();return this.findNextNonDisabled(e,n=>this.collection.getKeyBefore(n))}getKeyPageAbove(e){let n=this.ref.current,r=this.layoutDelegate.getItemRect(e);if(!r)return null;if(n&&!Er(n))return this.getFirstKey();let i=e;if(this.orientation==="horizontal"){let o=Math.max(0,r.x+r.width-this.layoutDelegate.getVisibleRect().width);for(;r&&r.x>o&&i!=null;)i=this.getKeyAbove(i),r=i==null?null:this.layoutDelegate.getItemRect(i)}else{let o=Math.max(0,r.y+r.height-this.layoutDelegate.getVisibleRect().height);for(;r&&r.y>o&&i!=null;)i=this.getKeyAbove(i),r=i==null?null:this.layoutDelegate.getItemRect(i)}return i??this.getFirstKey()}getKeyPageBelow(e){let n=this.ref.current,r=this.layoutDelegate.getItemRect(e);if(!r)return null;if(n&&!Er(n))return this.getLastKey();let i=e;if(this.orientation==="horizontal"){let o=Math.min(this.layoutDelegate.getContentSize().width,r.y-r.width+this.layoutDelegate.getVisibleRect().width);for(;r&&r.x<o&&i!=null;)i=this.getKeyBelow(i),r=i==null?null:this.layoutDelegate.getItemRect(i)}else{let o=Math.min(this.layoutDelegate.getContentSize().height,r.y-r.height+this.layoutDelegate.getVisibleRect().height);for(;r&&r.y<o&&i!=null;)i=this.getKeyBelow(i),r=i==null?null:this.layoutDelegate.getItemRect(i)}return i??this.getLastKey()}getKeyForSearch(e,n){if(!this.collator)return null;let r=this.collection,i=n||this.getFirstKey();for(;i!=null;){let o=r.getItem(i);if(!o)return null;let l=o.textValue.slice(0,e.length);if(o.textValue&&this.collator.compare(l,e)===0)return i;i=this.getNextKey(i)}return null}constructor(...e){if(e.length===1){let n=e[0];this.collection=n.collection,this.ref=n.ref,this.collator=n.collator,this.disabledKeys=n.disabledKeys||new Set,this.disabledBehavior=n.disabledBehavior||"all",this.orientation=n.orientation||"vertical",this.direction=n.direction,this.layout=n.layout||"stack",this.layoutDelegate=n.layoutDelegate||new Oi(n.ref)}else this.collection=e[0],this.disabledKeys=e[1],this.ref=e[2],this.collator=e[3],this.layout="stack",this.orientation="vertical",this.disabledBehavior="all",this.layoutDelegate=new Oi(this.ref);this.layout==="stack"&&this.orientation==="vertical"&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}}class cc{build(e,n){return this.context=n,Ti(()=>this.iterateCollection(e))}*iterateCollection(e){let{children:n,items:r}=e;if(M.isValidElement(n)&&n.type===M.Fragment)yield*this.iterateCollection({children:n.props.children,items:r});else if(typeof n=="function"){if(!r)throw new Error("props.children was a function but props.items is missing");let i=0;for(let o of r)yield*this.getFullNode({value:o,index:i},{renderer:n}),i++}else{let i=[];M.Children.forEach(n,l=>{l&&i.push(l)});let o=0;for(let l of i){let c=this.getFullNode({element:l,index:o},{});for(let a of c)o++,yield a}}}getKey(e,n,r,i){if(e.key!=null)return e.key;if(n.type==="cell"&&n.key!=null)return`${i}${n.key}`;let o=n.value;if(o!=null){var l;let c=(l=o.key)!==null&&l!==void 0?l:o.id;if(c==null)throw new Error("No key found for item");return c}return i?`${i}.${n.index}`:`$.${n.index}`}getChildState(e,n){return{renderer:n.renderer||e.renderer}}*getFullNode(e,n,r,i){if(M.isValidElement(e.element)&&e.element.type===M.Fragment){let v=[];var o;M.Children.forEach(e.element.props.children,S=>{v.push(S)});let x=(o=e.index)!==null&&o!==void 0?o:0;for(const S of v)yield*this.getFullNode({element:S,index:x++},n,r,i);return}let l=e.element;if(!l&&e.value&&n&&n.renderer){let v=this.cache.get(e.value);if(v&&(!v.shouldInvalidate||!v.shouldInvalidate(this.context)))return v.index=e.index,v.parentKey=i?i.key:null,void(yield v);l=n.renderer(e.value)}if(M.isValidElement(l)){let v=l.type;if(typeof v!="function"&&typeof v.getCollectionNode!="function"){let C=l.type;throw new Error(`Unknown element <${C}> in collection.`)}let x=v.getCollectionNode(l.props,this.context);var c;let S=(c=e.index)!==null&&c!==void 0?c:0,j=x.next();for(;!j.done&&j.value;){let C=j.value;var a;e.index=S;let k=(a=C.key)!==null&&a!==void 0?a:null;k==null&&(k=C.element?null:this.getKey(l,e,n,r));let D=[...this.getFullNode({...C,key:k,index:S,wrapper:dc(e.wrapper,C.wrapper)},this.getChildState(n,C),r?`${r}${l.key}`:l.key,i)];for(let N of D){var d,u,f;if(N.value=(u=(d=C.value)!==null&&d!==void 0?d:e.value)!==null&&u!==void 0?u:null,N.value&&this.cache.set(N.value,N),e.type&&N.type!==e.type)throw new Error(`Unsupported type <${Sn(N.type)}> in <${Sn((f=i==null?void 0:i.type)!==null&&f!==void 0?f:"unknown parent type")}>. Only <${Sn(e.type)}> is supported.`);S++,yield N}j=x.next(D)}return}if(e.key==null||e.type==null)return;let p=this;var m,h;let g={type:e.type,props:e.props,key:e.key,parentKey:i?i.key:null,value:(m=e.value)!==null&&m!==void 0?m:null,level:i?i.level+1:0,index:e.index,rendered:e.rendered,textValue:(h=e.textValue)!==null&&h!==void 0?h:"","aria-label":e["aria-label"],wrapper:e.wrapper,shouldInvalidate:e.shouldInvalidate,hasChildNodes:e.hasChildNodes||!1,childNodes:Ti(function*(){if(!e.hasChildNodes||!e.childNodes)return;let v=0;for(let x of e.childNodes()){x.key!=null&&(x.key=`${g.key}${x.key}`);let S=p.getFullNode({...x,index:v},p.getChildState(n,x),g.key,g);for(let j of S)v++,yield j}})};yield g}constructor(){this.cache=new WeakMap}}function Ti(t){let e=[],n=null;return{*[Symbol.iterator](){for(let r of e)yield r;n||(n=t());for(let r of n)e.push(r),yield r}}}function dc(t,e){return t&&e?n=>t(e(n)):t||e||void 0}function Sn(t){return t[0].toUpperCase()+t.slice(1)}function uc(t,e){return typeof e.getChildren=="function"?e.getChildren(t.key):t.childNodes}function hc(t){return function(e){for(let n of e)return n}(t)}function jn(t,e,n){if(e.parentKey===n.parentKey)return e.index-n.index;let r=[...Pi(t,e),e],i=[...Pi(t,n),n],o=r.slice(0,i.length).findIndex((l,c)=>l!==i[c]);return o!==-1?(e=r[o],n=i[o],e.index-n.index):r.findIndex(l=>l===n)>=0?1:(i.findIndex(l=>l===e),-1)}function Pi(t,e){let n=[],r=e;for(;(r==null?void 0:r.parentKey)!=null;)r=t.getItem(r.parentKey),r&&n.unshift(r);return n}const kn=new WeakMap;function Cn(t,e){var n;let{id:r}=(n=kn.get(t))!==null&&n!==void 0?n:{};if(!r)throw new Error("Unknown list");return`${r}-${function(i){return typeof i=="string"?i.replace(/\s*/g,""):""+i}(e)}`}var zt;function Ki(t,e){let n=new Set;if(t==="all"||e==="all")return n;for(let r of t.keys())e.has(r)||n.add(r);return n}function fc(t,e,n){let{isVirtualized:r,keyboardDelegate:i,layoutDelegate:o,onAction:l,disallowTypeAhead:c,linkBehavior:a="action",keyboardNavigationBehavior:d="arrow",escapeKeyBehavior:u="clearSelection",shouldSelectOnPressUp:f}=t;t["aria-label"]||t["aria-labelledby"]||console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:p}=function(S){let{selectionManager:j,collection:C,disabledKeys:k,ref:D,keyboardDelegate:N,layoutDelegate:P}=S,O=Tr({usage:"search",sensitivity:"base"}),_=j.disabledBehavior,R=y.useMemo(()=>N||new Ei({collection:C,disabledKeys:k,disabledBehavior:_,ref:D,collator:O,layoutDelegate:P}),[N,P,C,k,D,O,_]),{collectionProps:L}=lc({...S,ref:D,selectionManager:j,keyboardDelegate:R});return{listProps:L}}({selectionManager:e.selectionManager,collection:e.collection,disabledKeys:e.disabledKeys,ref:n,keyboardDelegate:i,layoutDelegate:o,isVirtualized:r,selectOnFocus:e.selectionManager.selectionBehavior==="replace",shouldFocusWrap:t.shouldFocusWrap,linkBehavior:a,disallowTypeAhead:c,autoFocus:t.autoFocus,escapeKeyBehavior:u}),m=ot(t.id);kn.set(e,{id:m,onAction:l,linkBehavior:a,keyboardNavigationBehavior:d,shouldSelectOnPressUp:f});let h=function(S){let j=Ct((C=zt)&&C.__esModule?C.default:C,"@react-aria/grid");var C;let k=hl(),D=(k==="pointer"||k==="virtual"||k==null)&&typeof window<"u"&&"ontouchstart"in window,N=y.useMemo(()=>{let P,O=S.selectionManager.selectionMode,_=S.selectionManager.selectionBehavior;return D&&(P=j.format("longPressToSelect")),_==="replace"&&O!=="none"&&S.hasItemActions?P:void 0},[S.selectionManager.selectionMode,S.selectionManager.selectionBehavior,S.hasItemActions,j,D]);return wr(N)}({selectionManager:e.selectionManager,hasItemActions:!!l}),g=function(S,j){let C=j==null?void 0:j.isDisabled,[k,D]=y.useState(!1);return it(()=>{if(S!=null&&S.current&&!C){let N=()=>{if(S.current){let O=jt(S.current,{tabbable:!0});D(!!O.nextNode())}};N();let P=new MutationObserver(N);return P.observe(S.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{P.disconnect()}}}),!C&&k}(n,{isDisabled:e.collection.size!==0}),v=It(t,{labelable:!0}),x=Ne(v,{role:"grid",id:m,"aria-multiselectable":e.selectionManager.selectionMode==="multiple"?"true":void 0},e.collection.size===0?{tabIndex:g?-1:0}:p,h);return r&&(x["aria-rowcount"]=e.collection.size,x["aria-colcount"]=1),function(S,j){let{getRowText:C=_=>{var R,L,H,I;return(I=(R=(L=j.collection).getTextValue)===null||R===void 0?void 0:R.call(L,_))!==null&&I!==void 0?I:(H=j.collection.getItem(_))===null||H===void 0?void 0:H.textValue}}=S,k=Ct((D=zt)&&D.__esModule?D.default:D,"@react-aria/grid");var D;let N=j.selectionManager.rawSelection,P=y.useRef(N),O=St(()=>{var _;if(!j.selectionManager.isFocused||N===P.current)return void(P.current=N);let R=Ki(N,P.current),L=Ki(P.current,N),H=j.selectionManager.selectionBehavior==="replace",I=[];if(j.selectionManager.selectedKeys.size===1&&H){let K=j.selectionManager.selectedKeys.keys().next().value;if(K!=null&&j.collection.getItem(K)){let F=C(K);F&&I.push(k.format("selectedItem",{item:F}))}}else if(R.size===1&&L.size===0){let K=R.keys().next().value;if(K!=null){let F=C(K);F&&I.push(k.format("selectedItem",{item:F}))}}else if(L.size===1&&R.size===0){let K=L.keys().next().value;if(K!=null&&j.collection.getItem(K)){let F=C(K);F&&I.push(k.format("deselectedItem",{item:F}))}}j.selectionManager.selectionMode==="multiple"&&(I.length===0||N==="all"||N.size>1||P.current==="all"||((_=P.current)===null||_===void 0?void 0:_.size)>1)&&I.push(N==="all"?k.format("selectedAll"):k.format("selectedCount",{count:N.size})),I.length>0&&dl(I.join(" ")),P.current=N});ul(()=>{if(!j.selectionManager.isFocused){let _=requestAnimationFrame(O);return()=>cancelAnimationFrame(_)}O()},[N,j.selectionManager.isFocused])}({},e),{gridProps:x}}zt={"ar-AE":{deselectedItem:t=>`${t.item} \u063A\u064A\u0631 \u0627\u0644\u0645\u062D\u062F\u062F`,longPressToSelect:"\u0627\u0636\u063A\u0637 \u0645\u0637\u0648\u0644\u064B\u0627 \u0644\u0644\u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0648\u0636\u0639 \u0627\u0644\u062A\u062D\u062F\u064A\u062F.",select:"\u062A\u062D\u062F\u064A\u062F",selectedAll:"\u062C\u0645\u064A\u0639 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u062D\u062F\u062F\u0629.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0644\u0645 \u064A\u062A\u0645 \u062A\u062D\u062F\u064A\u062F \u0639\u0646\u0627\u0635\u0631",one:()=>`${e.number(t.count)} \u0639\u0646\u0635\u0631 \u0645\u062D\u062F\u062F`,other:()=>`${e.number(t.count)} \u0639\u0646\u0635\u0631 \u0645\u062D\u062F\u062F`})}.`,selectedItem:t=>`${t.item} \u0627\u0644\u0645\u062D\u062F\u062F`},"bg-BG":{deselectedItem:t=>`${t.item} \u043D\u0435 \u0435 \u0438\u0437\u0431\u0440\u0430\u043D.`,longPressToSelect:"\u041D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 \u0438 \u0437\u0430\u0434\u0440\u044A\u0436\u0442\u0435 \u0437\u0430 \u0434\u0430 \u0432\u043B\u0435\u0437\u0435\u0442\u0435 \u0432 \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043B\u0435\u043D \u0440\u0435\u0436\u0438\u043C.",select:"\u0418\u0437\u0431\u0435\u0440\u0435\u0442\u0435",selectedAll:"\u0412\u0441\u0438\u0447\u043A\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438 \u0441\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u0438.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u041D\u044F\u043C\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438",one:()=>`${e.number(t.count)} \u0438\u0437\u0431\u0440\u0430\u043D \u0435\u043B\u0435\u043C\u0435\u043D\u0442`,other:()=>`${e.number(t.count)} \u0438\u0437\u0431\u0440\u0430\u043D\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438`})}.`,selectedItem:t=>`${t.item} \u0438\u0437\u0431\u0440\u0430\u043D.`},"cs-CZ":{deselectedItem:t=>`Polo\u017Eka ${t.item} nen\xED vybr\xE1na.`,longPressToSelect:"Dlouh\xFDm stisknut\xEDm p\u0159ejdete do re\u017Eimu v\xFDb\u011Bru.",select:"Vybrat",selectedAll:"Vybr\xE1ny v\u0161echny polo\u017Eky.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nevybr\xE1ny \u017E\xE1dn\xE9 polo\u017Eky",one:()=>`Vybr\xE1na ${e.number(t.count)} polo\u017Eka`,other:()=>`Vybr\xE1no ${e.number(t.count)} polo\u017Eek`})}.`,selectedItem:t=>`Vybr\xE1na polo\u017Eka ${t.item}.`},"da-DK":{deselectedItem:t=>`${t.item} ikke valgt.`,longPressToSelect:"Lav et langt tryk for at aktivere valgtilstand.",select:"V\xE6lg",selectedAll:"Alle elementer valgt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ingen elementer valgt",one:()=>`${e.number(t.count)} element valgt`,other:()=>`${e.number(t.count)} elementer valgt`})}.`,selectedItem:t=>`${t.item} valgt.`},"de-DE":{deselectedItem:t=>`${t.item} nicht ausgew\xE4hlt.`,longPressToSelect:"Gedr\xFCckt halten, um Auswahlmodus zu \xF6ffnen.",select:"Ausw\xE4hlen",selectedAll:"Alle Elemente ausgew\xE4hlt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Keine Elemente ausgew\xE4hlt",one:()=>`${e.number(t.count)} Element ausgew\xE4hlt`,other:()=>`${e.number(t.count)} Elemente ausgew\xE4hlt`})}.`,selectedItem:t=>`${t.item} ausgew\xE4hlt.`},"el-GR":{deselectedItem:t=>`\u0394\u03B5\u03BD \u03B5\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 \u03C4\u03BF \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF ${t.item}.`,longPressToSelect:"\u03A0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u03C0\u03B1\u03C1\u03B1\u03C4\u03B5\u03C4\u03B1\u03BC\u03AD\u03BD\u03B1 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03BC\u03C0\u03B5\u03AF\u03C4\u03B5 \u03C3\u03B5 \u03BB\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE\u03C2.",select:"\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE",selectedAll:"\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD \u03CC\u03BB\u03B1 \u03C4\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0394\u03B5\u03BD \u03B5\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",one:()=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 ${e.number(t.count)} \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF`,other:()=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD ${e.number(t.count)} \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1`})}.`,selectedItem:t=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 \u03C4\u03BF \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF ${t.item}.`},"en-US":{deselectedItem:t=>`${t.item} not selected.`,select:"Select",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"No items selected",one:()=>`${e.number(t.count)} item selected`,other:()=>`${e.number(t.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:t=>`${t.item} selected.`,longPressToSelect:"Long press to enter selection mode."},"es-ES":{deselectedItem:t=>`${t.item} no seleccionado.`,longPressToSelect:"Mantenga pulsado para abrir el modo de selecci\xF3n.",select:"Seleccionar",selectedAll:"Todos los elementos seleccionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ning\xFAn elemento seleccionado",one:()=>`${e.number(t.count)} elemento seleccionado`,other:()=>`${e.number(t.count)} elementos seleccionados`})}.`,selectedItem:t=>`${t.item} seleccionado.`},"et-EE":{deselectedItem:t=>`${t.item} pole valitud.`,longPressToSelect:"Valikure\u017Eiimi sisenemiseks vajutage pikalt.",select:"Vali",selectedAll:"K\xF5ik \xFCksused valitud.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\xDCksusi pole valitud",one:()=>`${e.number(t.count)} \xFCksus valitud`,other:()=>`${e.number(t.count)} \xFCksust valitud`})}.`,selectedItem:t=>`${t.item} valitud.`},"fi-FI":{deselectedItem:t=>`Kohdetta ${t.item} ei valittu.`,longPressToSelect:"Siirry valintatilaan painamalla pitk\xE4\xE4n.",select:"Valitse",selectedAll:"Kaikki kohteet valittu.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ei yht\xE4\xE4n kohdetta valittu",one:()=>`${e.number(t.count)} kohde valittu`,other:()=>`${e.number(t.count)} kohdetta valittu`})}.`,selectedItem:t=>`${t.item} valittu.`},"fr-FR":{deselectedItem:t=>`${t.item} non s\xE9lectionn\xE9.`,longPressToSelect:"Appuyez de mani\xE8re prolong\xE9e pour passer en mode de s\xE9lection.",select:"S\xE9lectionner",selectedAll:"Tous les \xE9l\xE9ments s\xE9lectionn\xE9s.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Aucun \xE9l\xE9ment s\xE9lectionn\xE9",one:()=>`${e.number(t.count)} \xE9l\xE9ment s\xE9lectionn\xE9`,other:()=>`${e.number(t.count)} \xE9l\xE9ments s\xE9lectionn\xE9s`})}.`,selectedItem:t=>`${t.item} s\xE9lectionn\xE9.`},"he-IL":{deselectedItem:t=>`${t.item} \u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8.`,longPressToSelect:"\u05D4\u05E7\u05E9\u05D4 \u05D0\u05E8\u05D5\u05DB\u05D4 \u05DC\u05DB\u05E0\u05D9\u05E1\u05D4 \u05DC\u05DE\u05E6\u05D1 \u05D1\u05D7\u05D9\u05E8\u05D4.",select:"\u05D1\u05D7\u05E8",selectedAll:"\u05DB\u05DC \u05D4\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E0\u05D1\u05D7\u05E8\u05D5.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D5 \u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",one:()=>`\u05E4\u05E8\u05D9\u05D8 ${e.number(t.count)} \u05E0\u05D1\u05D7\u05E8`,other:()=>`${e.number(t.count)} \u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E0\u05D1\u05D7\u05E8\u05D5`})}.`,selectedItem:t=>`${t.item} \u05E0\u05D1\u05D7\u05E8.`},"hr-HR":{deselectedItem:t=>`Stavka ${t.item} nije odabrana.`,longPressToSelect:"Dugo pritisnite za ulazak u na\u010Din odabira.",select:"Odaberite",selectedAll:"Odabrane su sve stavke.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nije odabrana nijedna stavka",one:()=>`Odabrana je ${e.number(t.count)} stavka`,other:()=>`Odabrano je ${e.number(t.count)} stavki`})}.`,selectedItem:t=>`Stavka ${t.item} je odabrana.`},"hu-HU":{deselectedItem:t=>`${t.item} nincs kijel\xF6lve.`,longPressToSelect:"Nyomja hosszan a kijel\xF6l\xE9shez.",select:"Kijel\xF6l\xE9s",selectedAll:"Az \xF6sszes elem kijel\xF6lve.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Egy elem sincs kijel\xF6lve",one:()=>`${e.number(t.count)} elem kijel\xF6lve`,other:()=>`${e.number(t.count)} elem kijel\xF6lve`})}.`,selectedItem:t=>`${t.item} kijel\xF6lve.`},"it-IT":{deselectedItem:t=>`${t.item} non selezionato.`,longPressToSelect:"Premi a lungo per passare alla modalit\xE0 di selezione.",select:"Seleziona",selectedAll:"Tutti gli elementi selezionati.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nessun elemento selezionato",one:()=>`${e.number(t.count)} elemento selezionato`,other:()=>`${e.number(t.count)} elementi selezionati`})}.`,selectedItem:t=>`${t.item} selezionato.`},"ja-JP":{deselectedItem:t=>`${t.item} \u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002`,longPressToSelect:"\u9577\u62BC\u3057\u3057\u3066\u9078\u629E\u30E2\u30FC\u30C9\u3092\u958B\u304D\u307E\u3059\u3002",select:"\u9078\u629E",selectedAll:"\u3059\u3079\u3066\u306E\u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u9805\u76EE\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093",one:()=>`${e.number(t.count)} \u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F`,other:()=>`${e.number(t.count)} \u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F`})}\u3002`,selectedItem:t=>`${t.item} \u3092\u9078\u629E\u3057\u307E\u3057\u305F\u3002`},"ko-KR":{deselectedItem:t=>`${t.item}\uC774(\uAC00) \uC120\uD0DD\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.`,longPressToSelect:"\uC120\uD0DD \uBAA8\uB4DC\uB85C \uB4E4\uC5B4\uAC00\uB824\uBA74 \uAE38\uAC8C \uB204\uB974\uC2ED\uC2DC\uC624.",select:"\uC120\uD0DD",selectedAll:"\uBAA8\uB4E0 \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\uC120\uD0DD\uB41C \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",one:()=>`${e.number(t.count)}\uAC1C \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4`,other:()=>`${e.number(t.count)}\uAC1C \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4`})}.`,selectedItem:t=>`${t.item}\uC774(\uAC00) \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`},"lt-LT":{deselectedItem:t=>`${t.item} nepasirinkta.`,longPressToSelect:"Nor\u0117dami \u012Fjungti pasirinkimo re\u017Eim\u0105, paspauskite ir palaikykite.",select:"Pasirinkti",selectedAll:"Pasirinkti visi elementai.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nepasirinktas n\u0117 vienas elementas",one:()=>`Pasirinktas ${e.number(t.count)} elementas`,other:()=>`Pasirinkta element\u0173: ${e.number(t.count)}`})}.`,selectedItem:t=>`Pasirinkta: ${t.item}.`},"lv-LV":{deselectedItem:t=>`Vienums ${t.item} nav atlas\u012Bts.`,longPressToSelect:"Ilgi turiet nospiestu. lai iesl\u0113gtu atlases re\u017E\u012Bmu.",select:"Atlas\u012Bt",selectedAll:"Atlas\u012Bti visi vienumi.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nav atlas\u012Bts neviens vienums",one:()=>`Atlas\u012Bto vienumu skaits: ${e.number(t.count)}`,other:()=>`Atlas\u012Bto vienumu skaits: ${e.number(t.count)}`})}.`,selectedItem:t=>`Atlas\u012Bts vienums ${t.item}.`},"nb-NO":{deselectedItem:t=>`${t.item} er ikke valgt.`,longPressToSelect:"Bruk et langt trykk for \xE5 g\xE5 inn i valgmodus.",select:"Velg",selectedAll:"Alle elementer er valgt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ingen elementer er valgt",one:()=>`${e.number(t.count)} element er valgt`,other:()=>`${e.number(t.count)} elementer er valgt`})}.`,selectedItem:t=>`${t.item} er valgt.`},"nl-NL":{deselectedItem:t=>`${t.item} niet geselecteerd.`,longPressToSelect:"Druk lang om de selectiemodus te openen.",select:"Selecteren",selectedAll:"Alle items geselecteerd.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Geen items geselecteerd",one:()=>`${e.number(t.count)} item geselecteerd`,other:()=>`${e.number(t.count)} items geselecteerd`})}.`,selectedItem:t=>`${t.item} geselecteerd.`},"pl-PL":{deselectedItem:t=>`Nie zaznaczono ${t.item}.`,longPressToSelect:"Naci\u015Bnij i przytrzymaj, aby wej\u015B\u0107 do trybu wyboru.",select:"Zaznacz",selectedAll:"Wszystkie zaznaczone elementy.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nie zaznaczono \u017Cadnych element\xF3w",one:()=>`${e.number(t.count)} zaznaczony element`,other:()=>`${e.number(t.count)} zaznaczonych element\xF3w`})}.`,selectedItem:t=>`Zaznaczono ${t.item}.`},"pt-BR":{deselectedItem:t=>`${t.item} n\xE3o selecionado.`,longPressToSelect:"Mantenha pressionado para entrar no modo de sele\xE7\xE3o.",select:"Selecionar",selectedAll:"Todos os itens selecionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nenhum item selecionado",one:()=>`${e.number(t.count)} item selecionado`,other:()=>`${e.number(t.count)} itens selecionados`})}.`,selectedItem:t=>`${t.item} selecionado.`},"pt-PT":{deselectedItem:t=>`${t.item} n\xE3o selecionado.`,longPressToSelect:"Prima continuamente para entrar no modo de sele\xE7\xE3o.",select:"Selecionar",selectedAll:"Todos os itens selecionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nenhum item selecionado",one:()=>`${e.number(t.count)} item selecionado`,other:()=>`${e.number(t.count)} itens selecionados`})}.`,selectedItem:t=>`${t.item} selecionado.`},"ro-RO":{deselectedItem:t=>`${t.item} neselectat.`,longPressToSelect:"Ap\u0103sa\u021Bi lung pentru a intra \xEEn modul de selectare.",select:"Selectare",selectedAll:"Toate elementele selectate.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Niciun element selectat",one:()=>`${e.number(t.count)} element selectat`,other:()=>`${e.number(t.count)} elemente selectate`})}.`,selectedItem:t=>`${t.item} selectat.`},"ru-RU":{deselectedItem:t=>`${t.item} \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E.`,longPressToSelect:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u0432 \u0440\u0435\u0436\u0438\u043C \u0432\u044B\u0431\u043E\u0440\u0430.",select:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C",selectedAll:"\u0412\u044B\u0431\u0440\u0430\u043D\u044B \u0432\u0441\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u041D\u0435\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0445 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",one:()=>`${e.number(t.count)} \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u044B\u0431\u0440\u0430\u043D`,other:()=>`${e.number(t.count)} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u0432\u044B\u0431\u0440\u0430\u043D\u043E`})}.`,selectedItem:t=>`${t.item} \u0432\u044B\u0431\u0440\u0430\u043D\u043E.`},"sk-SK":{deselectedItem:t=>`Nevybrat\xE9 polo\u017Eky: ${t.item}.`,longPressToSelect:"Dlh\u0161\xEDm stla\u010Den\xEDm prejdite do re\u017Eimu v\xFDberu.",select:"Vybra\u0165",selectedAll:"V\u0161etky vybrat\xE9 polo\u017Eky.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u017Diadne vybrat\xE9 polo\u017Eky",one:()=>`${e.number(t.count)} vybrat\xE1 polo\u017Eka`,other:()=>`Po\u010Det vybrat\xFDch polo\u017Eiek:${e.number(t.count)}`})}.`,selectedItem:t=>`Vybrat\xE9 polo\u017Eky: ${t.item}.`},"sl-SI":{deselectedItem:t=>`Element ${t.item} ni izbran.`,longPressToSelect:"Za izbirni na\u010Din pritisnite in dlje \u010Dasa dr\u017Eite.",select:"Izberite",selectedAll:"Vsi elementi so izbrani.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Noben element ni izbran",one:()=>`${e.number(t.count)} element je izbran`,other:()=>`${e.number(t.count)} elementov je izbranih`})}.`,selectedItem:t=>`Element ${t.item} je izbran.`},"sr-SP":{deselectedItem:t=>`${t.item} nije izabrano.`,longPressToSelect:"Dugo pritisnite za ulazak u re\u017Eim biranja.",select:"Izaberite",selectedAll:"Izabrane su sve stavke.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nije izabrana nijedna stavka",one:()=>`Izabrana je ${e.number(t.count)} stavka`,other:()=>`Izabrano je ${e.number(t.count)} stavki`})}.`,selectedItem:t=>`${t.item} je izabrano.`},"sv-SE":{deselectedItem:t=>`${t.item} ej markerat.`,longPressToSelect:"Tryck l\xE4nge n\xE4r du vill \xF6ppna v\xE4ljarl\xE4ge.",select:"Markera",selectedAll:"Alla markerade objekt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Inga markerade objekt",one:()=>`${e.number(t.count)} markerat objekt`,other:()=>`${e.number(t.count)} markerade objekt`})}.`,selectedItem:t=>`${t.item} markerat.`},"tr-TR":{deselectedItem:t=>`${t.item} se\xE7ilmedi.`,longPressToSelect:"Se\xE7im moduna girmek i\xE7in uzun bas\u0131n.",select:"Se\xE7",selectedAll:"T\xFCm \xF6geler se\xE7ildi.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Hi\xE7bir \xF6ge se\xE7ilmedi",one:()=>`${e.number(t.count)} \xF6ge se\xE7ildi`,other:()=>`${e.number(t.count)} \xF6ge se\xE7ildi`})}.`,selectedItem:t=>`${t.item} se\xE7ildi.`},"uk-UA":{deselectedItem:t=>`${t.item} \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u043E.`,longPressToSelect:"\u0412\u0438\u043A\u043E\u043D\u0430\u0439\u0442\u0435 \u0434\u043E\u0432\u0433\u0435 \u043D\u0430\u0442\u0438\u0441\u043D\u0435\u043D\u043D\u044F, \u0449\u043E\u0431 \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0440\u0435\u0436\u0438\u043C \u0432\u0438\u0431\u043E\u0440\u0443.",select:"\u0412\u0438\u0431\u0440\u0430\u0442\u0438",selectedAll:"\u0423\u0441\u0456 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u043E.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0416\u043E\u0434\u043D\u0438\u0445 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432 \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u043E",one:()=>`${e.number(t.count)} \u0435\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u0438\u0431\u0440\u0430\u043D\u043E`,other:()=>`\u0412\u0438\u0431\u0440\u0430\u043D\u043E \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432: ${e.number(t.count)}`})}.`,selectedItem:t=>`${t.item} \u0432\u0438\u0431\u0440\u0430\u043D\u043E.`},"zh-CN":{deselectedItem:t=>`\u672A\u9009\u62E9 ${t.item}\u3002`,longPressToSelect:"\u957F\u6309\u4EE5\u8FDB\u5165\u9009\u62E9\u6A21\u5F0F\u3002",select:"\u9009\u62E9",selectedAll:"\u5DF2\u9009\u62E9\u6240\u6709\u9879\u76EE\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u672A\u9009\u62E9\u9879\u76EE",one:()=>`\u5DF2\u9009\u62E9 ${e.number(t.count)} \u4E2A\u9879\u76EE`,other:()=>`\u5DF2\u9009\u62E9 ${e.number(t.count)} \u4E2A\u9879\u76EE`})}\u3002`,selectedItem:t=>`\u5DF2\u9009\u62E9 ${t.item}\u3002`},"zh-TW":{deselectedItem:t=>`\u672A\u9078\u53D6\u300C${t.item}\u300D\u3002`,longPressToSelect:"\u9577\u6309\u4EE5\u9032\u5165\u9078\u64C7\u6A21\u5F0F\u3002",select:"\u9078\u53D6",selectedAll:"\u5DF2\u9078\u53D6\u6240\u6709\u9805\u76EE\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u672A\u9078\u53D6\u4EFB\u4F55\u9805\u76EE",one:()=>`\u5DF2\u9078\u53D6 ${e.number(t.count)} \u500B\u9805\u76EE`,other:()=>`\u5DF2\u9078\u53D6 ${e.number(t.count)} \u500B\u9805\u76EE`})}\u3002`,selectedItem:t=>`\u5DF2\u9078\u53D6\u300C${t.item}\u300D\u3002`}};const pc={ltr:"ArrowRight",rtl:"ArrowLeft"},gc={ltr:"ArrowLeft",rtl:"ArrowRight"};function _i(t){let e=null,n=null;do n=t.lastChild(),n&&(e=n);while(n);return e}function mc(t,e){let{key:n}=t;const{checkboxProps:r}=function(i,o){let{key:l}=i,c=o.selectionManager,a=ot(),d=!o.selectionManager.canSelectItem(l),u=o.selectionManager.isSelected(l);var f;return{checkboxProps:{id:a,"aria-label":Ct((f=zt)&&f.__esModule?f.default:f,"@react-aria/grid").format("select"),isSelected:u,isDisabled:d,onChange:()=>c.toggleSelection(l)}}}(t,e);return{checkboxProps:{...r,"aria-labelledby":`${r.id} ${Cn(e,n)}`}}}var Mi;function Ai(t,e,n){let{node:r}=t,i=function(d,u,f){var p,m;let{node:h,isVirtualized:g}=d,{direction:v}=an(),{onAction:x,linkBehavior:S,keyboardNavigationBehavior:j,shouldSelectOnPressUp:C}=kn.get(u),k=fl(),D=y.useRef(null),N={},P=d.hasChildItems,O=u.selectionManager.isLink(h.key);if(h!=null&&"expandedKeys"in u){var _,R;let w=(_=(R=u.collection).getChildren)===null||_===void 0?void 0:_.call(R,h.key);P=P||[...w??[]].length>1,x==null&&!O&&u.selectionManager.selectionMode==="none"&&P&&(x=()=>u.toggleKey(h.key));let z=P?u.expandedKeys.has(h.key):void 0,T=1;if(h.level>0&&(h==null?void 0:h.parentKey)!=null){let b=u.collection.getItem(h.parentKey);var L,H;b&&(T=[...(L=(H=u.collection).getChildren)===null||L===void 0?void 0:L.call(H,b.key)].filter(E=>E.type==="item").length)}else T=[...u.collection].filter(b=>b.level===0&&b.type==="item").length;N={"aria-expanded":z,"aria-level":h.level+1,"aria-posinset":(h==null?void 0:h.index)+1,"aria-setsize":T}}let{itemProps:I,...K}=ac({selectionManager:u.selectionManager,key:h.key,ref:f,isVirtualized:g,shouldSelectOnPressUp:d.shouldSelectOnPressUp||C,onAction:x||!((p=h.props)===null||p===void 0)&&p.onAction?Or((m=h.props)===null||m===void 0?void 0:m.onAction,x?()=>x(h.key):void 0):void 0,focus:()=>{var w;f.current===null||(D.current==null||h.key===D.current)&&(!((w=f.current)===null||w===void 0)&&w.contains(document.activeElement))||Te(f.current)},linkBehavior:S}),F=pl(h.props),V=K.hasAction?F:{},$=Ne(I,V,{role:"row",onKeyDownCapture:w=>{if(!w.currentTarget.contains(w.target)||!f.current||!document.activeElement)return;let z=jt(f.current);if(z.currentNode=document.activeElement,"expandedKeys"in u&&document.activeElement===f.current&&(w.key===pc[v]&&u.selectionManager.focusedKey===h.key&&P&&!u.expandedKeys.has(h.key)||w.key===gc[v]&&u.selectionManager.focusedKey===h.key&&P&&u.expandedKeys.has(h.key)))return u.toggleKey(h.key),void w.stopPropagation();switch(w.key){case"ArrowLeft":if(j==="arrow"){let b=v==="rtl"?z.nextNode():z.previousNode();if(b)w.preventDefault(),w.stopPropagation(),Te(b),Re(b,{containingElement:ze(f.current)});else if(w.preventDefault(),w.stopPropagation(),v==="rtl")Te(f.current),Re(f.current,{containingElement:ze(f.current)});else{z.currentNode=f.current;let E=_i(z);E&&(Te(E),Re(E,{containingElement:ze(f.current)}))}}break;case"ArrowRight":if(j==="arrow"){let b=v==="rtl"?z.previousNode():z.nextNode();if(b)w.preventDefault(),w.stopPropagation(),Te(b),Re(b,{containingElement:ze(f.current)});else if(w.preventDefault(),w.stopPropagation(),v==="ltr")Te(f.current),Re(f.current,{containingElement:ze(f.current)});else{z.currentNode=f.current;let E=_i(z);E&&(Te(E),Re(E,{containingElement:ze(f.current)}))}}break;case"ArrowUp":case"ArrowDown":var T;!w.altKey&&f.current.contains(w.target)&&(w.stopPropagation(),w.preventDefault(),(T=f.current.parentElement)===null||T===void 0||T.dispatchEvent(new KeyboardEvent(w.nativeEvent.type,w.nativeEvent)))}},onKeyDown:w=>{if(w.currentTarget.contains(w.target)&&f.current&&document.activeElement&&w.key==="Tab"&&j==="tab"){let z=jt(f.current,{tabbable:!0});z.currentNode=document.activeElement,(w.shiftKey?z.previousNode():z.nextNode())&&w.stopPropagation()}},onFocus:w=>{D.current=h.key,w.target===f.current||gl()||u.selectionManager.setFocusedKey(h.key)},"aria-label":h.textValue||void 0,"aria-selected":u.selectionManager.canSelectItem(h.key)?u.selectionManager.isSelected(h.key):void 0,"aria-disabled":u.selectionManager.isDisabled(h.key)||void 0,"aria-labelledby":k&&h.textValue?`${Cn(u,h.key)} ${k}`:void 0,id:Cn(u,h.key)});return g&&($["aria-rowindex"]=h.index+1),{rowProps:{...Ne($,N)},gridCellProps:{role:"gridcell","aria-colindex":1},descriptionProps:{id:k},...K}}(t,e,n),o=i.rowProps["aria-expanded"]===!0,l=Ct((c=Mi)&&c.__esModule?c.default:c,"@react-aria/tree");var c;let a={onPress:()=>{i.isDisabled||(e.toggleKey(r.key),e.selectionManager.setFocused(!0),e.selectionManager.setFocusedKey(r.key))},excludeFromTabOrder:!0,preventFocusOnPress:!0,"data-react-aria-prevent-focus":!0,...ml({"aria-label":o?l.format("collapse"):l.format("expand"),"aria-labelledby":i.rowProps.id})};return{...i,expandButtonProps:a}}Mi={"ar-AE":{collapse:"\u0637\u064A",expand:"\u062A\u0645\u062F\u064A\u062F"},"bg-BG":{collapse:"\u0421\u0432\u0438\u0432\u0430\u043D\u0435",expand:"\u0420\u0430\u0437\u0448\u0438\u0440\u044F\u0432\u0430\u043D\u0435"},"cs-CZ":{collapse:"Sbalit",expand:"Rozt\xE1hnout"},"da-DK":{collapse:"Skjul",expand:"Udvid"},"de-DE":{collapse:"Reduzieren",expand:"Erweitern"},"el-GR":{collapse:"\u03A3\u03CD\u03BC\u03C0\u03C4\u03C5\u03BE\u03B7",expand:"\u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03BE\u03B7"},"en-US":{expand:"Expand",collapse:"Collapse"},"es-ES":{collapse:"Contraer",expand:"Ampliar"},"et-EE":{collapse:"Ahenda",expand:"Laienda"},"fi-FI":{collapse:"Pienenn\xE4",expand:"Laajenna"},"fr-FR":{collapse:"R\xE9duire",expand:"D\xE9velopper"},"he-IL":{collapse:"\u05DB\u05D5\u05D5\u05E5",expand:"\u05D4\u05E8\u05D7\u05D1"},"hr-HR":{collapse:"Sa\u017Emi",expand:"Pro\u0161iri"},"hu-HU":{collapse:"\xD6sszecsuk\xE1s",expand:"Kibont\xE1s"},"it-IT":{collapse:"Comprimi",expand:"Espandi"},"ja-JP":{collapse:"\u6298\u308A\u305F\u305F\u3080",expand:"\u5C55\u958B"},"ko-KR":{collapse:"\uC811\uAE30",expand:"\uD3BC\uCE58\uAE30"},"lt-LT":{collapse:"Sutraukti",expand:"I\u0161skleisti"},"lv-LV":{collapse:"Sak\u013Caut",expand:"Izv\u0113rst"},"nb-NO":{collapse:"Skjul",expand:"Utvid"},"nl-NL":{collapse:"Samenvouwen",expand:"Uitvouwen"},"pl-PL":{collapse:"Zwi\u0144",expand:"Rozwi\u0144"},"pt-BR":{collapse:"Recolher",expand:"Expandir"},"pt-PT":{collapse:"Colapsar",expand:"Expandir"},"ro-RO":{collapse:"Restr\xE2nge\u021Bi",expand:"Extinde\u021Bi"},"ru-RU":{collapse:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",expand:"\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C"},"sk-SK":{collapse:"Zbali\u0165",expand:"Rozbali\u0165"},"sl-SI":{collapse:"Strni",expand:"Raz\u0161iri"},"sr-SP":{collapse:" Skupi",expand:"Pro\u0161iri"},"sv-SE":{collapse:"D\xF6lj",expand:"Expandera"},"tr-TR":{collapse:"Daralt",expand:"Geni\u015Flet"},"uk-UA":{collapse:"\u0417\u0433\u043E\u0440\u043D\u0443\u0442\u0438",expand:"\u0420\u043E\u0437\u0433\u043E\u0440\u043D\u0443\u0442\u0438"},"zh-CN":{collapse:"\u6298\u53E0",expand:"\u6269\u5C55"},"zh-TW":{collapse:"\u6536\u5408",expand:"\u5C55\u958B"}};class Oe extends Set{constructor(e,n,r){super(e),e instanceof Oe?(this.anchorKey=n??e.anchorKey,this.currentKey=r??e.currentKey):(this.anchorKey=n??null,this.currentKey=r??null)}}function Ri(t,e){return t?t==="all"?"all":new Oe(t):e}class vr{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,n){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,n)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if(this.state.selectionMode==="none")return!1;let n=this.getKey(e);return n!=null&&(this.state.selectedKeys==="all"?this.canSelectItem(n):this.state.selectedKeys.has(n))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),n=this.state.selectedKeys;return this._isSelectAll=e.every(r=>n.has(r)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let i=this.collection.getItem(r);(!e||i&&jn(this.collection,i,e)<0)&&(e=i)}var n;return(n=e==null?void 0:e.key)!==null&&n!==void 0?n:null}get lastSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let i=this.collection.getItem(r);(!e||i&&jn(this.collection,i,e)>0)&&(e=i)}var n;return(n=e==null?void 0:e.key)!==null&&n!==void 0?n:null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single")return void this.replaceSelection(e);let n,r=this.getKey(e);if(r!=null){if(this.state.selectedKeys==="all")n=new Oe([r],r,r);else{let l=this.state.selectedKeys;var i;let c=(i=l.anchorKey)!==null&&i!==void 0?i:r;var o;n=new Oe(l,c,r);for(let a of this.getKeyRange(c,(o=l.currentKey)!==null&&o!==void 0?o:r))n.delete(a);for(let a of this.getKeyRange(r,c))this.canSelectItem(a)&&n.add(a)}this.state.setSelectedKeys(n)}}getKeyRange(e,n){let r=this.collection.getItem(e),i=this.collection.getItem(n);return r&&i?jn(this.collection,r,i)<=0?this.getKeyRangeInternal(e,n):this.getKeyRangeInternal(n,e):[]}getKeyRangeInternal(e,n){var r;if(!((r=this.layoutDelegate)===null||r===void 0)&&r.getKeyRange)return this.layoutDelegate.getKeyRange(e,n);let i=[],o=e;for(;o!=null;){let l=this.collection.getItem(o);if(l&&(l.type==="item"||l.type==="cell"&&this.allowsCellSelection)&&i.push(o),o===n)return i;o=this.collection.getKeyAfter(o)}return[]}getKey(e){let n=this.collection.getItem(e);if(!n||n.type==="cell"&&this.allowsCellSelection)return e;for(;n&&n.type!=="item"&&n.parentKey!=null;)n=this.collection.getItem(n.parentKey);return n&&n.type==="item"?n.key:null}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e))return void this.replaceSelection(e);let n=this.getKey(e);if(n==null)return;let r=new Oe(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);r.has(n)?r.delete(n):this.canSelectItem(n)&&(r.add(n),r.anchorKey=n,r.currentKey=n),this.disallowEmptySelection&&r.size===0||this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode==="none")return;let n=this.getKey(e);if(n==null)return;let r=this.canSelectItem(n)?new Oe([n],n,n):new Oe;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let n=new Oe;for(let r of e){let i=this.getKey(r);if(i!=null&&(n.add(i),this.selectionMode==="single"))break}this.state.setSelectedKeys(n)}getSelectAllKeys(){let e=[],n=r=>{for(;r!=null;){if(this.canSelectItem(r)){var i;let l=this.collection.getItem(r);var o;(l==null?void 0:l.type)==="item"&&e.push(r),l!=null&&l.hasChildNodes&&(this.allowsCellSelection||l.type!=="item")&&n((o=(i=hc(uc(l,this.collection)))===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:null)}r=this.collection.getKeyAfter(r)}};return n(this.collection.getFirstKey()),e}selectAll(){this.isSelectAll||this.selectionMode!=="multiple"||this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new Oe)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,n){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||n&&(n.pointerType==="touch"||n.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let n=this.selectedKeys;if(e.size!==n.size)return!1;for(let r of e)if(!n.has(r))return!1;for(let r of n)if(!e.has(r))return!1;return!0}canSelectItem(e){var n;if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let r=this.collection.getItem(e);return!(!r||!(r==null||(n=r.props)===null||n===void 0)&&n.isDisabled||r.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){var n,r;return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!(!((r=this.collection.getItem(e))===null||r===void 0||(n=r.props)===null||n===void 0)&&n.isDisabled))}isLink(e){var n,r;return!!(!((r=this.collection.getItem(e))===null||r===void 0||(n=r.props)===null||n===void 0)&&n.href)}getItemProps(e){var n;return(n=this.collection.getItem(e))===null||n===void 0?void 0:n.props}withCollection(e){return new vr(e,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0})}constructor(e,n,r){var i;this.collection=e,this.state=n,this.allowsCellSelection=(i=r==null?void 0:r.allowsCellSelection)!==null&&i!==void 0&&i,this._isSelectAll=null,this.layoutDelegate=(r==null?void 0:r.layoutDelegate)||null}}class vc{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let n=this.keyMap.get(e);var r;return n&&(r=n.prevKey)!==null&&r!==void 0?r:null}getKeyAfter(e){let n=this.keyMap.get(e);var r;return n&&(r=n.nextKey)!==null&&r!==void 0?r:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){var n;return(n=this.keyMap.get(e))!==null&&n!==void 0?n:null}at(e){const n=[...this.getKeys()];return this.getItem(n[e])}constructor(e,{expandedKeys:n}={}){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e,n=n||new Set;let r=c=>{if(this.keyMap.set(c.key,c),c.childNodes&&(c.type==="section"||n.has(c.key)))for(let a of c.childNodes)r(a)};for(let c of e)r(c);let i=null,o=0;for(let[c,a]of this.keyMap)i?(i.nextKey=c,a.prevKey=i.key):(this.firstKey=c,a.prevKey=void 0),a.type==="item"&&(a.index=o++),i=a,i.nextKey=void 0;var l;this.lastKey=(l=i==null?void 0:i.key)!==null&&l!==void 0?l:null}}function yc(t){let{onExpandedChange:e}=t,[n,r]=cn(t.expandedKeys?new Set(t.expandedKeys):void 0,t.defaultExpandedKeys?new Set(t.defaultExpandedKeys):new Set,e),i=function(c){let{selectionMode:a="none",disallowEmptySelection:d=!1,allowDuplicateSelectionEvents:u,selectionBehavior:f="toggle",disabledBehavior:p="all"}=c,m=y.useRef(!1),[,h]=y.useState(!1),g=y.useRef(null),v=y.useRef(null),[,x]=y.useState(null),S=y.useMemo(()=>Ri(c.selectedKeys),[c.selectedKeys]),j=y.useMemo(()=>Ri(c.defaultSelectedKeys,new Oe),[c.defaultSelectedKeys]),[C,k]=cn(S,j,c.onSelectionChange),D=y.useMemo(()=>c.disabledKeys?new Set(c.disabledKeys):new Set,[c.disabledKeys]),[N,P]=y.useState(f);f==="replace"&&N==="toggle"&&typeof C=="object"&&C.size===0&&P("replace");let O=y.useRef(f);return y.useEffect(()=>{f!==O.current&&(P(f),O.current=f)},[f]),{selectionMode:a,disallowEmptySelection:d,selectionBehavior:N,setSelectionBehavior:P,get isFocused(){return m.current},setFocused(_){m.current=_,h(_)},get focusedKey(){return g.current},get childFocusStrategy(){return v.current},setFocusedKey(_,R="first"){g.current=_,v.current=R,x(_)},selectedKeys:C,setSelectedKeys(_){!u&&function(R,L){if(R.size!==L.size)return!1;for(let H of R)if(!L.has(H))return!1;return!0}(_,C)||k(_)},disabledKeys:D,disabledBehavior:p}}(t),o=y.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),l=function(c,a,d){let u=y.useMemo(()=>new cc,[]),{children:f,items:p,collection:m}=c;return y.useMemo(()=>{if(m)return m;let h=u.build({children:f,items:p},d);return a(h)},[u,f,p,m,d,a])}(t,y.useCallback(c=>new vc(c,{expandedKeys:n}),[n]),null);return y.useEffect(()=>{i.focusedKey==null||l.getItem(i.focusedKey)||i.setFocusedKey(null)},[l,i.focusedKey]),{collection:l,expandedKeys:n,disabledKeys:o,toggleKey:c=>{r(function(a,d){let u=new Set(a);return u.has(d)?u.delete(d):u.add(d),u}(n,c))},setExpandedKeys:r,selectionManager:new vr(l,i)}}const Fi={CollectionRoot:({collection:t,renderDropIndicator:e})=>Li(t,null,e),CollectionBranch:({collection:t,parent:e,renderDropIndicator:n})=>Li(t,e,n)};function Li(t,e,n){return xn({items:e?t.getChildren(e.key):t,dependencies:[n],children(r){let i=r.render(r);return n&&r.type==="item"?M.createElement(M.Fragment,null,n({type:"item",key:r.key,dropPosition:"before"}),i,function(o,l,c){let a=l.key,d=o.getKeyAfter(a),u=d!=null?o.getItem(d):null;for(;u!=null&&u.type!=="item";)d=o.getKeyAfter(u.key),u=d!=null?o.getItem(d):null;let f=l.nextKey!=null?o.getItem(l.nextKey):null;for(;f!=null&&f.type!=="item";)f=f.nextKey!=null?o.getItem(f.nextKey):null;let p=[];if(f==null){let m=l;for(;m&&(!u||m.parentKey!==u.parentKey&&u.level<m.level);){let h=c({type:"item",key:m.key,dropPosition:"after"});y.isValidElement(h)&&p.push(y.cloneElement(h,{key:`${m.key}-after`})),m=m.parentKey!=null?o.getItem(m.parentKey):null}}return p}(t,r,n)):i}})}const In=y.createContext(Fi),$t=y.createContext({}),zi=y.createContext(null),xc=y.forwardRef(function(t,e){let{render:n}=y.useContext(zi);return M.createElement(M.Fragment,null,n(t,e))});function bc(t,e){var n;let r=t==null?void 0:t.renderDropIndicator,i=t==null||(n=t.isVirtualDragging)===null||n===void 0?void 0:n.call(t),o=y.useCallback(l=>{if(i||e!=null&&e.isDropTarget(l))return r?r(l):M.createElement(xc,{target:l})},[e==null?void 0:e.target,i,r]);return t!=null&&t.useDropIndicator?o:void 0}function wc(t,e,n){var r,i;let o=t.focusedKey,l=null;if(!(e==null||(r=e.isVirtualDragging)===null||r===void 0)&&r.call(e)&&(n==null||(i=n.target)===null||i===void 0?void 0:i.type)==="item"&&(l=n.target.key,n.target.dropPosition==="after")){let f=n.collection.getKeyAfter(l),p=null;if(f!=null){var c,a;let m=(a=(c=n.collection.getItem(l))===null||c===void 0?void 0:c.level)!==null&&a!==void 0?a:0;for(;f;){let h=n.collection.getItem(f);if(!h)break;if(h.type==="item"){var d;if(((d=h.level)!==null&&d!==void 0?d:0)<=m)break;p=f,f=n.collection.getKeyAfter(f)}else f=n.collection.getKeyAfter(f)}}var u;l=(u=f??p)!==null&&u!==void 0?u:l}return y.useMemo(()=>new Set([o,l].filter(f=>f!=null)),[o,l])}class Sc{setup(e,n,r){this.delegate=e,this.state=n,this.direction=r}getDropTargetFromPoint(e,n,r){let i=this.delegate.getDropTargetFromPoint(e,n,r);return i&&i.type!=="root"?this.resolveDropTarget(i,e,n,r):i}resolveDropTarget(e,n,r,i){let o=this.pointerTracking,l=r-o.lastY,c=n-o.lastX,a=o.yDirection,d=o.xDirection;if(Math.abs(l)>5&&(a=l>0?"down":"up",o.yDirection=a,o.lastY=r),Math.abs(c)>10&&(d=c>0?"right":"left",o.xDirection=d,o.lastX=n),e.dropPosition==="before"){let p=this.state.collection.getKeyBefore(e.key);if(p!=null){let m={type:"item",key:p,dropPosition:"after"};i(m)&&(e=m)}}let u,f=this.getPotentialTargets(e,i);return f.length===0?{type:"root"}:(f.length>1?u=this.selectTarget(f,e,n,r,a,d):(u=f[0],o.boundaryContext=null),u)}getPotentialTargets(e,n){if(e.dropPosition==="on")return[e];let r=e,i=this.state.collection,o=i.getItem(r.key);for(;o&&(o==null?void 0:o.type)!=="item"&&o.nextKey!=null;)r.key=o.nextKey,o=i.getItem(o.nextKey);let l=[r];if(o&&o.hasChildNodes&&this.state.expandedKeys.has(o.key)&&i.getChildren&&r.dropPosition==="after"){let d=null;for(let u of i.getChildren(o.key))if(u.type==="item"){d=u;break}if(d){const u={type:"item",key:d.key,dropPosition:"before"};return n(u)?[u]:[]}}if((o==null?void 0:o.nextKey)!=null)return[e];let c=o==null?void 0:o.parentKey,a=[];for(;c;){let d=i.getItem(c),u=d!=null&&d.nextKey?i.getItem(d.nextKey):null;if(!u||u.parentKey!==c){let f={type:"item",key:c,dropPosition:"after"};if(n(f)&&a.push(f),u)break}c=d==null?void 0:d.parentKey}if(a.length>0&&l.push(...a),l.length===1){let d=i.getKeyAfter(r.key),u=d?i.getItem(d):null;if(d!=null&&u&&o&&u.level!=null&&o.level!=null&&u.level>o.level){let f={type:"item",key:d,dropPosition:"before"};if(n(f))return[f]}}return l.filter(n)}selectTarget(e,n,r,i,o,l){if(e.length<2)return e[0];let c=this.pointerTracking,a=this.state.collection.getItem(n.key),d=a==null?void 0:a.parentKey;if(!d)return e[0];if(!c.boundaryContext||c.boundaryContext.parentKey!==d){let p=c.yDirection==="up"?e.length-1:0;c.boundaryContext={parentKey:d,preferredTargetIndex:p,lastSwitchY:i,lastSwitchX:r}}let u=c.boundaryContext,f=Math.abs(r-u.lastSwitchX);if(Math.abs(i-u.lastSwitchY)>5&&o){let p=u.preferredTargetIndex||0;o==="down"&&p===0?u.preferredTargetIndex=e.length-1:o==="up"&&p===e.length-1&&(u.preferredTargetIndex=0),c.xDirection=null}if(f>10&&l){let p=u.preferredTargetIndex||0;l==="left"?this.direction==="ltr"?p<e.length-1&&(u.preferredTargetIndex=p+1,u.lastSwitchX=r):p>0&&(u.preferredTargetIndex=p-1,u.lastSwitchX=r):l==="right"&&(this.direction==="ltr"?p>0&&(u.preferredTargetIndex=p-1,u.lastSwitchX=r):p<e.length-1&&(u.preferredTargetIndex=p+1,u.lastSwitchX=r)),c.yDirection=null}return e[Math.max(0,Math.min(u.preferredTargetIndex||0,e.length-1))]}constructor(){this.delegate=null,this.state=null,this.direction="ltr",this.pointerTracking={lastY:0,lastX:0,yDirection:null,xDirection:null,boundaryContext:null}}}class jc{*[Symbol.iterator](){yield*this.flattenedRows}get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}getItem(e){return this.keyMap.get(e)||null}at(e){return this.flattenedRows[e]}getFirstKey(){var e;return(e=this.flattenedRows[0])===null||e===void 0?void 0:e.key}getLastKey(){var e;return(e=this.flattenedRows[this.flattenedRows.length-1])===null||e===void 0?void 0:e.key}getKeyAfter(e){var n;let r=this.flattenedRows.findIndex(i=>i.key===e);return(n=this.flattenedRows[r+1])===null||n===void 0?void 0:n.key}getKeyBefore(e){var n;let r=this.flattenedRows.findIndex(i=>i.key===e);return(n=this.flattenedRows[r-1])===null||n===void 0?void 0:n.key}getChildren(e){let n=this.keyMap;return{*[Symbol.iterator](){let r=n.get(e),i=(r==null?void 0:r.firstChildKey)!=null?n.get(r.firstChildKey):null;for(;i;)yield i,i=i.nextKey!=null?n.get(i.nextKey):void 0}}}getTextValue(e){let n=this.getItem(e);return n?n.textValue:""}constructor(e){this.keyMap=new Map,this.itemCount=0;let{collection:n,expandedKeys:r}=e,{flattenedRows:i,keyMap:o,itemCount:l}=function(c,a){let{expandedKeys:d=new Set}=a,u=new Map,f=[],p=0,m=h=>{if(h.type==="item"||h.type==="loader"){let g=h==null?void 0:h.parentKey,v={...h};g!=null?([...c.getChildren(g)][0].type!=="item"&&(v.index=(h==null?void 0:h.index)!=null?(h==null?void 0:h.index)-1:0),h.type==="loader"&&(v.level=h.level+1),u.set(v.key,v)):u.set(h.key,h);let x=u.get(h.key)||h;(x.level===0||x.parentKey!=null&&d.has(x.parentKey)&&f.find(S=>S.key===x.parentKey))&&(x.type==="item"&&p++,f.push(x))}else h.type!==null&&u.set(h.key,h);for(let g of c.getChildren(h.key))m(g)};for(let h of c)m(h);return{flattenedRows:f,keyMap:u,itemCount:p}}(n,{expandedKeys:r});this.flattenedRows=i,this.keyMap=o,this.itemCount=l}}const kc=y.createContext(null),Nn=y.createContext(null),Cc=y.forwardRef(function(t,e){return[t,e]=vl(t,e,kc),M.createElement(tc,{content:M.createElement(oc,t)},n=>M.createElement(Ic,{props:t,collection:n,treeRef:e}))}),$i={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ic({props:t,collection:e,treeRef:n}){const{dragAndDropHooks:r}=t;let{direction:i}=an(),o=Tr({usage:"search",sensitivity:"base"}),l=!!(r!=null&&r.useDraggableCollectionState),c=!!(r!=null&&r.useDroppableCollectionState),a=y.useRef(l),d=y.useRef(c);y.useEffect(()=>{a.current!==l&&console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."),d.current!==c&&console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.")},[l,c]);let u,f,p,{selectionMode:m="none",expandedKeys:h,defaultExpandedKeys:g,onExpandedChange:v,disabledBehavior:x="all"}=t,{CollectionRoot:S,isVirtualized:j,layoutDelegate:C,dropTargetDelegate:k}=y.useContext(In),[D,N]=cn(h?Ui(h):void 0,g?Ui(g):new Set,v),P=y.useMemo(()=>new jc({collection:e,expandedKeys:D}),[e,D]),O=yc({...t,selectionMode:m,expandedKeys:D,onExpandedChange:N,collection:P,children:void 0,disabledBehavior:x}),{gridProps:_}=function(E,se,ae){let{gridProps:Z}=fc(E,se,ae);return Z.role="treegrid",{gridProps:Z}}({...t,isVirtualized:j,layoutDelegate:C},O,n),R=!1,L=null,H=y.useRef(null);if(l&&r){u=r.useDraggableCollectionState({collection:O.collection,selectionManager:O.selectionManager,preview:r.renderDragPreview?H:void 0}),r.useDraggableCollection({},u,n);let E=r.DragPreview;L=r.renderDragPreview?M.createElement(E,{ref:H},r.renderDragPreview):null}let[I]=y.useState(()=>new Sc);if(c&&r){f=r.useDroppableCollectionState({collection:O.collection,selectionManager:O.selectionManager});let E=r.dropTargetDelegate||k||new r.ListDropTargetDelegate(O.collection,n,{direction:i});I.setup(E,O,i);let se=new Ei({collection:O.collection,collator:o,ref:n,disabledKeys:O.selectionManager.disabledKeys,disabledBehavior:O.selectionManager.disabledBehavior,direction:i,layoutDelegate:C});p=r.useDroppableCollection({keyboardDelegate:se,dropTargetDelegate:I,onDropActivate:Z=>{if(Z.target.type==="item"){var te;let le=Z.target.key,A=O.collection.getItem(le),oe=D!=="all"&&D.has(le);A&&A.hasChildNodes&&(!oe||!(r==null||(te=r.isVirtualDragging)===null||te===void 0)&&te.call(r))&&O.toggleKey(le)}},onKeyDown:Z=>{let te=f==null?void 0:f.target;if(te&&te.type==="item"&&te.dropPosition==="on"){let le=O.collection.getItem(te.key);(Z.key===$i.expand[i]&&(le!=null&&le.hasChildNodes)&&!O.expandedKeys.has(te.key)||Z.key===$i.collapse[i]&&(le!=null&&le.hasChildNodes)&&O.expandedKeys.has(te.key))&&O.toggleKey(te.key)}}},f,n);let ae=f.getDropOperation;f.getDropOperation=Z=>{let{target:te,isInternal:le}=Z;var A;let oe=(A=u==null?void 0:u.draggingKeys)!==null&&A!==void 0?A:new Set;if(le&&te.type==="item"&&oe.size>0){if(oe.has(te.key)&&te.dropPosition==="on")return"cancel";let B=te.key;for(;B!=null;){let ne=O.collection.getItem(B),ce=ne==null?void 0:ne.parentKey;if(ce!=null&&oe.has(ce))return"cancel";B=ce??null}}return ae(Z)},R=f.isDropTarget({type:"root"})}let K=!(!l||u!=null&&u.isDisabled),{focusProps:F,isFocused:V,isFocusVisible:$}=dn(),w={isEmpty:O.collection.size===0,isFocused:V,isFocusVisible:$,isDropTarget:R,selectionMode:O.selectionManager.selectionMode,allowsDragging:!!K,state:O},z=st({className:t.className,style:t.style,defaultClassName:"react-aria-Tree",values:w}),T=null;if(O.collection.size===0&&t.renderEmptyState){let{isEmpty:E,...se}=w,ae=t.renderEmptyState({...se}),Z={"aria-level":1};T=M.createElement("div",{role:"row",style:{display:"contents"},...Z},M.createElement("div",{role:"gridcell",style:{display:"contents"}},ae))}let b=It(t,{global:!0});return M.createElement(M.Fragment,null,M.createElement(yl,null,M.createElement("div",{...Ne(b,z,_,F,p==null?void 0:p.collectionProps),ref:n,slot:t.slot||void 0,"data-empty":O.collection.size===0||void 0,"data-focused":V||void 0,"data-drop-target":R||void 0,"data-focus-visible":$||void 0,"data-selection-mode":O.selectionManager.selectionMode==="none"?void 0:O.selectionManager.selectionMode,"data-allows-dragging":!!K||void 0},M.createElement(Pr,{values:[[Nn,O],[$t,{dragAndDropHooks:r,dragState:u,dropState:f}],[zi,{render:Nc}]]},c&&M.createElement(Ec,null),M.createElement(S,{collection:O.collection,persistedKeys:wc(O.selectionManager,r,f),scrollRef:n,renderDropIndicator:bc(r,f)})),T)),L)}const Vi=wi("content",function(t){let e=y.useContext(Bi),n=st({children:t.children,values:e});return M.createElement(In.Provider,{value:Fi},n.children)}),Bi=y.createContext(null),Hi=ic("item",(t,e,n)=>{var r;let i=y.useContext(Nn);e=un(e);let{dragAndDropHooks:o,dragState:l,dropState:c}=y.useContext($t),{rowProps:a,gridCellProps:d,expandButtonProps:u,descriptionProps:f,...p}=Ai({node:n,shouldSelectOnPressUp:!!l},i,e),m=a["aria-expanded"]===!0,h=t.hasChildItems||((r=[...i.collection.getChildren(n.key)])===null||r===void 0?void 0:r.length)>1,g=a["aria-level"]||1,{hoverProps:v,isHovered:x}=xl({isDisabled:!p.allowsSelection&&!p.hasAction,onHoverStart:t.onHoverStart,onHoverChange:t.onHoverChange,onHoverEnd:t.onHoverEnd}),{isFocusVisible:S,focusProps:j}=dn(),{isFocusVisible:C,focusProps:k}=dn({within:!0}),{checkboxProps:D}=mc({key:n.key},i),N=null;l&&o&&(N=o.useDraggableItem({key:n.key,hasDragButton:!0},l));let P=null,O=y.useRef(null),_=y.useRef(null),R=y.useRef(null),{visuallyHiddenProps:L}=hn();c&&o&&(P=o.useDropIndicator({target:{type:"item",key:n.key,dropPosition:"on"},activateButtonRef:R},c,_));let H=l&&l.isDragging(n.key),I=P==null?void 0:P.isDropTarget,K=i.selectionManager.selectionMode,F=i.selectionManager.selectionBehavior,V=M.useMemo(()=>({...p,isHovered:x,isFocusVisible:S,isExpanded:m,hasChildItems:h,level:g,selectionMode:K,selectionBehavior:F,isFocusVisibleWithin:C,state:i,id:n.key,allowsDragging:!!l,isDragging:H,isDropTarget:I}),[p,x,S,m,h,g,C,i,n.key,l,H,I,F,K]),$=st({...t,id:void 0,children:n.rendered,defaultClassName:"react-aria-TreeItem",defaultStyle:{"--tree-item-level":g},values:V});y.useEffect(()=>{n.textValue},[n.textValue]),y.useEffect(()=>{h&&O.current},[]);let w=y.useRef(null);y.useEffect(()=>{l&&w.current},[]);let z=xn({items:i.collection.getChildren(n.key),children:E=>{switch(E.type){case"content":return E.render(E);case"loader":case"item":return M.createElement(M.Fragment,null);default:throw new Error("Unsupported element type in TreeRow: "+E.type)}}}),T=ot(),b=It(t,{global:!0});return delete b.id,delete b.onClick,M.createElement(M.Fragment,null,P&&!P.isHidden&&M.createElement("div",{role:"row","aria-level":a["aria-level"],"aria-expanded":a["aria-expanded"],"aria-label":P.dropIndicatorProps["aria-label"]},M.createElement("div",{role:"gridcell","aria-colindex":1,style:{display:"contents"}},M.createElement("div",{role:"button",...L,...P.dropIndicatorProps,ref:_}),a["aria-expanded"]!=null?M.createElement("div",{role:"button",...L,id:T,"aria-label":u["aria-label"],"aria-labelledby":`${T} ${a.id}`,tabIndex:-1,ref:R}):null)),M.createElement("div",{...Ne(b,a,j,v,k,N==null?void 0:N.dragProps),...$,ref:e,"data-expanded":h&&m||void 0,"data-has-child-items":h||void 0,"data-level":g,"data-selected":p.isSelected||void 0,"data-disabled":p.isDisabled||void 0,"data-hovered":x||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":S||void 0,"data-pressed":p.isPressed||void 0,"data-selection-mode":i.selectionManager.selectionMode==="none"?void 0:i.selectionManager.selectionMode,"data-allows-dragging":!!l||void 0,"data-dragging":H||void 0,"data-drop-target":I||void 0},M.createElement("div",{...d,style:{display:"contents"}},M.createElement(Pr,{values:[[bl,{slots:{selection:D}}],[wl,{slots:{[Sl]:{},chevron:{...u,ref:O},drag:{...N==null?void 0:N.dragButtonProps,ref:w,style:{pointerEvents:"none"}}}}],[Bi,{...V}]]},z))))});function Ui(t){return t?t==="all"?"all":new Set(t):new Set}function Nc(t,e){var n;e=un(e);let{dragAndDropHooks:r,dropState:i}=y.useContext($t),o=y.useRef(null),{dropIndicatorProps:l,isHidden:c,isDropTarget:a}=r.useDropIndicator(t,i,o);if(c)return null;let d=i&&t.target.type==="item"?(((n=i.collection.getItem(t.target.key))===null||n===void 0?void 0:n.level)||0)+1:1;return M.createElement(Oc,{...t,dropIndicatorProps:l,isDropTarget:a,ref:e,buttonRef:o,level:d})}function Dc(t,e){let{dropIndicatorProps:n,isDropTarget:r,buttonRef:i,level:o,...l}=t,{visuallyHiddenProps:c}=hn(),a=st({...l,defaultClassName:"react-aria-DropIndicator",defaultStyle:{position:"relative","--tree-item-level":o},values:{isDropTarget:r}});return M.createElement("div",{...a,role:"row","aria-level":o,ref:e,"data-drop-target":r||void 0},M.createElement("div",{role:"gridcell"},M.createElement("div",{...c,role:"button",...n,ref:i}),a.children))}wi("loader",function(t,e,n){let{isVirtualized:r}=y.useContext(In),i=y.useContext(Nn),{isLoading:o,onLoadMore:l,scrollOffset:c,...a}=t,d=y.useRef(null);(function(v,x){let{collection:S,onLoadMore:j,scrollOffset:C=1}=v,k=y.useRef(null),D=St(N=>{for(let P of N)P.isIntersecting&&j&&j()});it(()=>(x.current&&(k.current=new IntersectionObserver(D,{root:ze(x==null?void 0:x.current),rootMargin:`0px ${100*C}% ${100*C}% ${100*C}%`}),k.current.observe(x.current)),()=>{k.current&&k.current.disconnect()}),[S,D,x,C])})(y.useMemo(()=>({onLoadMore:l,collection:i==null?void 0:i.collection,sentinelRef:d,scrollOffset:c}),[l,c,i==null?void 0:i.collection]),d),e=un(e);let{rowProps:u,gridCellProps:f}=Ai({node:n},i,e),p=u["aria-level"]||1,m={role:"row","aria-level":u["aria-level"]},h=st({...a,id:void 0,children:n.rendered,defaultClassName:"react-aria-TreeLoader",values:{level:p}}),g={};return r&&(g={display:"contents"}),M.createElement(M.Fragment,null,M.createElement("div",{style:{position:"relative",width:0,height:0},inert:Za(!0)},M.createElement("div",{"data-testid":"loadMoreSentinel",ref:d,style:{position:"absolute",height:1,width:1}})),o&&h.children&&M.createElement("div",{ref:e,...Ne(It(t),m),...h,"data-level":p},M.createElement("div",{...f,style:g},h.children)))});const Oc=y.forwardRef(Dc);function Ec(){let{dragAndDropHooks:t,dropState:e}=y.useContext($t),n=y.useRef(null),{dropIndicatorProps:r}=t.useDropIndicator({target:{type:"root"}},e,n),i=e.isDropTarget({type:"root"}),{visuallyHiddenProps:o}=hn();return!i&&r["aria-hidden"]?null:M.createElement("div",{role:"row","aria-hidden":r["aria-hidden"],style:{position:"absolute"}},M.createElement("div",{role:"gridcell"},M.createElement("div",{role:"button",...o,...r,ref:n})))}function Dn(t,e){return Dn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Dn(t,e)}function qi(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}const Wi=y.createContext(null);function we(){const t=y.useContext(Wi);if(t===null)throw new Error("No Tree Api Provided");return t}const Gi=y.createContext(null),Yi=y.createContext(null),Xi=y.createContext(0);function Qi(){y.useContext(Xi)}function Vt(t,e,n){return Math.max(Math.min(t,n),e)}function Zi(t){return t&&t.isLeaf}function Ji(t){return t&&t.isInternal&&!t.isOpen}function eo(t){var e;return t&&t.isOpen&&!(!((e=t.children)===null||e===void 0)&&e.length)}const to=(t,e)=>{let n=t;for(;n;){if(n.id===e.id)return!0;n=n.parent}return!1},no=t=>{if(!t.parent)throw Error("Node does not have a parent");return t.parent.children.findIndex(e=>e.id===t.id)};function On(t,e){if(!t)return null;if(t.id===e)return t;if(t.children)for(let n of t.children){const r=On(n,e);if(r)return r}return null}function Bt(t,e){if(e(t),t.children)for(let n of t.children)Bt(n,e)}function ro(t){const e=oo(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Tc(e,r);break}n==null||n.focus()}function io(t){const e=oo(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Pc(e,r);break}n==null||n.focus()}function Tc(t,e){return e+1<t.length?t[e+1]:t[0]}function Pc(t,e){return e-1>=0?t[e-1]:t[t.length-1]}function oo(t){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(e=>e===t||!t.contains(e))}function ht(t,e){return typeof e=="boolean"?e:typeof e=="string"?t[e]:e(t)}function so(t){return t===null?null:Ve(t)}function Ve(t){return typeof t=="string"?t:t.id}function lo(t,...e){if(t)return t(...e)}function ao(t){return new Promise((e,n)=>{let r=0;(function i(){r+=1,r===100&&n(),t()?e():setTimeout(i,10)})()})}function co(t){var e,n;const r=t.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:(n=(e=t.root.children)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}function uo(t){const e=t.focusedNode;return e?e.isOpen?e.id:e.parent&&!e.parent.isRoot?e.parent.id:null:null}const Kc=Object.freeze(Object.defineProperty({__proto__:null,access:ht,bound:Vt,dfs:On,focusNextElement:ro,focusPrevElement:io,getInsertIndex:co,getInsertParentId:uo,identify:Ve,identifyNull:so,indexOf:no,isClosed:Ji,isDescendant:to,isItem:Zi,isOpenWithEmptyChildren:eo,mergeRefs:function(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}},noop:function(){},safeRun:lo,waitFor:ao,walk:Bt},Symbol.toStringTag,{value:"Module"})),_c={display:"flex",alignItems:"center",zIndex:1},Mc={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Ac={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Rc=M.memo(function({top:t,left:e,indent:n}){const r={position:"absolute",pointerEvents:"none",top:t-2+"px",left:e+"px",right:n+"px"};return s.jsxs("div",{style:Object.assign(Object.assign({},_c),r),children:[s.jsx("div",{style:Object.assign({},Ac)}),s.jsx("div",{style:Object.assign({},Mc)})]})});function Fc({node:t,attrs:e,innerRef:n,children:r}){return s.jsx("div",Object.assign({},e,{ref:n,onFocus:i=>i.stopPropagation(),onClick:t.handleClick,children:r}))}function Lc(t){return s.jsxs("div",{ref:t.dragHandle,style:t.style,children:[s.jsx("span",{onClick:e=>{e.stopPropagation(),t.node.toggle()},children:t.node.isLeaf?"\u{1F333}":t.node.isOpen?"\u{1F5C1}":"\u{1F5C0}"})," ",t.node.isEditing?s.jsx($c,Object.assign({},t)):s.jsx(zc,Object.assign({},t))]})}function zc(t){return s.jsx(s.Fragment,{children:s.jsx("span",{children:t.node.data.name})})}function $c({node:t}){const e=y.useRef();return y.useEffect(()=>{var n,r;(n=e.current)===null||n===void 0||n.focus(),(r=e.current)===null||r===void 0||r.select()},[]),s.jsx("input",{ref:e,defaultValue:t.data.name,onBlur:()=>t.reset(),onKeyDown:n=>{var r;n.key==="Escape"&&t.reset(),n.key==="Enter"&&t.submit(((r=e.current)===null||r===void 0?void 0:r.value)||"")}})}function En(t){return{type:"EDIT",id:t}}function Qe(t){return{type:"FOCUS",id:t}}class sn{constructor(e){this.handleClick=n=>{n.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():n.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===ft}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var e;return this.isSelected&&!(!((e=this.prev)===null||e===void 0)&&e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(!((e=this.next)===null||e===void 0)&&e.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,n;const r=this.childIndex;return(n=(e=this.parent)===null||e===void 0?void 0:e.children[r+1])!==null&&n!==void 0?n:null}isAncestorOf(e){if(!e)return!1;let n=e;for(;n;){if(n.id===this.id)return!0;n=n.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new sn(Object.assign({},this))}edit(){return this.tree.edit(this)}}const ft="__REACT_ARBORIST_INTERNAL_ROOT__";function ho(t){var e;function n(o,l,c){const a=t.accessId(o),d=new sn({tree:t,data:o,level:l,parent:c,id:a,children:null,isDraggable:t.isDraggable(o),rowIndex:null}),u=t.accessChildren(o);return u&&(d.children=u.map(f=>n(f,l+1,d))),d}const r=new sn({tree:t,id:ft,data:{id:ft},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),i=(e=t.props.data)!==null&&e!==void 0?e:[];return r.children=i.map(o=>n(o,0,r)),r}const Tn={open:(t,e)=>({type:"VISIBILITY_OPEN",id:t,filtered:e}),close:(t,e)=>({type:"VISIBILITY_CLOSE",id:t,filtered:e}),toggle:(t,e)=>({type:"VISIBILITY_TOGGLE",id:t,filtered:e}),clear:t=>({type:"VISIBILITY_CLEAR",filtered:t})};function fo(t={},e){if(e.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},t),{[e.id]:!0});if(e.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},t),{[e.id]:!1});if(e.type==="VISIBILITY_TOGGLE"){const n=t[e.id];return Object.assign(Object.assign({},t),{[e.id]:!n})}return e.type==="VISIBILITY_CLEAR"?{}:t}const Ze=t=>{var e;return{nodes:{open:{filtered:{},unfiltered:(e=t==null?void 0:t.initialOpenState)!==null&&e!==void 0?e:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},Vc=t=>({type:"SELECTION_ONLY",id:Ve(t)}),po=t=>({type:"SELECTION_ADD",ids:(Array.isArray(t)?t:[t]).map(Ve)}),go=t=>({type:"SELECTION_REMOVE",ids:(Array.isArray(t)?t:[t]).map(Ve)}),Bc=t=>Object.assign({type:"SELECTION_SET"},t),Pn=t=>({type:"SELECTION_MOST_RECENT",id:t===null?null:Ve(t)}),mo=t=>({type:"SELECTION_ANCHOR",id:t===null?null:Ve(t)}),Je={cursor:t=>({type:"DND_CURSOR",cursor:t}),dragStart:(t,e)=>({type:"DND_DRAG_START",id:t,dragIds:e}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(t,e)=>({type:"DND_HOVERING",parentId:t,index:e})},Hc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Uc=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e}px, ${n}px)`}},qc=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e+10}px, ${n+10}px)`}};function vo({offset:t,mouse:e,id:n,dragIds:r,isDragging:i}){return s.jsxs(Wc,{isDragging:i,children:[s.jsx(Gc,{offset:t,children:s.jsx(Xc,{id:n,dragIds:r})}),s.jsx(Yc,{mouse:e,count:r.length})]})}const Wc=y.memo(function(t){return t.isDragging?s.jsx("div",{style:Hc,children:t.children}):null});function Gc(t){return s.jsx("div",{className:"row preview",style:Uc(t.offset),children:t.children})}function Yc(t){const{count:e,mouse:n}=t;return e>1?s.jsx("div",{className:"selected-count",style:qc(n),children:e}):null}const Xc=y.memo(function(t){const e=we(),n=e.get(t.id);return n?s.jsx(e.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*e.indent,opacity:.2,background:"transparent"},tree:e}):null});var yo=Number.isNaN||function(t){return typeof t=="number"&&t!=t};function Qc(t,e){return t===e||!(!yo(t)||!yo(e))}function Zc(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!Qc(t[n],e[n]))return!1;return!0}function Kn(t,e){var n;e===void 0&&(e=Zc);var r,i=[],o=!1;return function(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];return o&&n===this&&e(l,i)||(r=t.apply(this,l),o=!0,n=this,i=l),r}}var xo=typeof performance=="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function bo(t){cancelAnimationFrame(t.id)}var _n=-1;function wo(t){if(t===void 0&&(t=!1),_n===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),_n=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return _n}var pt=null;function So(t){if(t===void 0&&(t=!1),pt===null||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),i=r.style;return i.width="100px",i.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?pt="positive-descending":(e.scrollLeft=1,pt=e.scrollLeft===0?"negative":"positive-ascending"),document.body.removeChild(e),pt}return pt}var Jc=function(t,e){return t};function ed(t){var e,n=t.getItemOffset,r=t.getEstimatedTotalSize,i=t.getItemSize,o=t.getOffsetForIndexAndAlignment,l=t.getStartIndexForOffset,c=t.getStopIndexForStartIndex,a=t.initInstanceProps,d=t.shouldResetStyleCacheOnItemSizeChange,u=t.validateProps;return e=function(f){function p(h){var g;return(g=f.call(this,h)||this)._instanceProps=a(g.props,qi(g)),g._outerRef=void 0,g._resetIsScrollingTimeoutId=null,g.state={instance:qi(g),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof g.props.initialScrollOffset=="number"?g.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},g._callOnItemsRendered=void 0,g._callOnItemsRendered=Kn(function(v,x,S,j){return g.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:x,visibleStartIndex:S,visibleStopIndex:j})}),g._callOnScroll=void 0,g._callOnScroll=Kn(function(v,x,S){return g.props.onScroll({scrollDirection:v,scrollOffset:x,scrollUpdateWasRequested:S})}),g._getItemStyle=void 0,g._getItemStyle=function(v){var x,S=g.props,j=S.direction,C=S.itemSize,k=S.layout,D=g._getItemStyleCache(d&&C,d&&k,d&&j);if(D.hasOwnProperty(v))x=D[v];else{var N=n(g.props,v,g._instanceProps),P=i(g.props,v,g._instanceProps),O=j==="horizontal"||k==="horizontal",_=j==="rtl",R=O?N:0;D[v]=x={position:"absolute",left:_?void 0:R,right:_?R:void 0,top:O?0:N,height:O?"100%":P,width:O?P:"100%"}}return x},g._getItemStyleCache=void 0,g._getItemStyleCache=Kn(function(v,x,S){return{}}),g._onScrollHorizontal=function(v){var x=v.currentTarget,S=x.clientWidth,j=x.scrollLeft,C=x.scrollWidth;g.setState(function(k){if(k.scrollOffset===j)return null;var D=g.props.direction,N=j;if(D==="rtl")switch(So()){case"negative":N=-j;break;case"positive-descending":N=C-S-j}return N=Math.max(0,Math.min(N,C-S)),{isScrolling:!0,scrollDirection:k.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._onScrollVertical=function(v){var x=v.currentTarget,S=x.clientHeight,j=x.scrollHeight,C=x.scrollTop;g.setState(function(k){if(k.scrollOffset===C)return null;var D=Math.max(0,Math.min(C,j-S));return{isScrolling:!0,scrollDirection:k.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._outerRefSetter=function(v){var x=g.props.outerRef;g._outerRef=v,typeof x=="function"?x(v):x!=null&&typeof x=="object"&&x.hasOwnProperty("current")&&(x.current=v)},g._resetIsScrollingDebounced=function(){var v,x,S,j;g._resetIsScrollingTimeoutId!==null&&bo(g._resetIsScrollingTimeoutId),g._resetIsScrollingTimeoutId=(v=g._resetIsScrolling,x=150,S=xo(),j={id:requestAnimationFrame(function C(){xo()-S>=x?v.call(null):j.id=requestAnimationFrame(C)})})},g._resetIsScrolling=function(){g._resetIsScrollingTimeoutId=null,g.setState({isScrolling:!1},function(){g._getItemStyleCache(-1,null)})},g}(function(h,g){h.prototype=Object.create(g.prototype),h.prototype.constructor=h,Dn(h,g)})(p,f),p.getDerivedStateFromProps=function(h,g){return td(h,g),u(h),null};var m=p.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(g){return g.scrollOffset===h?null:{scrollDirection:g.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,g){g===void 0&&(g="auto");var v=this.props,x=v.itemCount,S=v.layout,j=this.state.scrollOffset;h=Math.max(0,Math.min(h,x-1));var C=0;if(this._outerRef){var k=this._outerRef;C=S==="vertical"?k.scrollWidth>k.clientWidth?wo():0:k.scrollHeight>k.clientHeight?wo():0}this.scrollTo(o(this.props,h,g,j,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,g=h.direction,v=h.initialScrollOffset,x=h.layout;if(typeof v=="number"&&this._outerRef!=null){var S=this._outerRef;g==="horizontal"||x==="horizontal"?S.scrollLeft=v:S.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,g=h.direction,v=h.layout,x=this.state,S=x.scrollOffset;if(x.scrollUpdateWasRequested&&this._outerRef!=null){var j=this._outerRef;if(g==="horizontal"||v==="horizontal")if(g==="rtl")switch(So()){case"negative":j.scrollLeft=-S;break;case"positive-ascending":j.scrollLeft=S;break;default:var C=j.clientWidth,k=j.scrollWidth;j.scrollLeft=k-C-S}else j.scrollLeft=S;else j.scrollTop=S}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&bo(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,g=h.children,v=h.className,x=h.direction,S=h.height,j=h.innerRef,C=h.innerElementType,k=h.innerTagName,D=h.itemCount,N=h.itemData,P=h.itemKey,O=P===void 0?Jc:P,_=h.layout,R=h.outerElementType,L=h.outerTagName,H=h.style,I=h.useIsScrolling,K=h.width,F=this.state.isScrolling,V=x==="horizontal"||_==="horizontal",$=V?this._onScrollHorizontal:this._onScrollVertical,w=this._getRangeToRender(),z=w[0],T=w[1],b=[];if(D>0)for(var E=z;E<=T;E++)b.push(y.createElement(g,{data:N,key:O(E,N),index:E,isScrolling:I?F:void 0,style:this._getItemStyle(E)}));var se=r(this.props,this._instanceProps);return y.createElement(R||L||"div",{className:v,onScroll:$,ref:this._outerRefSetter,style:jl({position:"relative",height:S,width:K,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:x},H)},y.createElement(C||k||"div",{children:b,ref:j,style:{height:V?"100%":se,pointerEvents:F?"none":void 0,width:V?se:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"&&this.props.itemCount>0){var h=this._getRangeToRender(),g=h[0],v=h[1],x=h[2],S=h[3];this._callOnItemsRendered(g,v,x,S)}if(typeof this.props.onScroll=="function"){var j=this.state,C=j.scrollDirection,k=j.scrollOffset,D=j.scrollUpdateWasRequested;this._callOnScroll(C,k,D)}},m._getRangeToRender=function(){var h=this.props,g=h.itemCount,v=h.overscanCount,x=this.state,S=x.isScrolling,j=x.scrollDirection,C=x.scrollOffset;if(g===0)return[0,0,0,0];var k=l(this.props,C,this._instanceProps),D=c(this.props,k,C,this._instanceProps),N=S&&j!=="backward"?1:Math.max(1,v),P=S&&j!=="forward"?1:Math.max(1,v);return[Math.max(0,k-N),Math.max(0,Math.min(g-1,D+P)),k,D]},p}(y.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var td=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},nd=ed({getItemOffset:function(t,e){return e*t.itemSize},getItemSize:function(t,e){return t.itemSize},getEstimatedTotalSize:function(t){var e=t.itemCount;return t.itemSize*e},getOffsetForIndexAndAlignment:function(t,e,n,r,i,o){var l=t.direction,c=t.height,a=t.itemCount,d=t.itemSize,u=t.layout,f=t.width,p=l==="horizontal"||u==="horizontal"?f:c,m=Math.max(0,a*d-p),h=Math.min(m,e*d),g=Math.max(0,e*d-p+d+o);switch(n==="smart"&&(n=r>=g-p&&r<=h+p?"auto":"center"),n){case"start":return h;case"end":return g;case"center":var v=Math.round(g+(h-g)/2);return v<Math.ceil(p/2)?0:v>m+Math.floor(p/2)?m:v;default:return r>=g&&r<=h?r:r<g?g:h}},getStartIndexForOffset:function(t,e){var n=t.itemCount,r=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(e/r)))},getStopIndexForStartIndex:function(t,e,n){var r=t.direction,i=t.height,o=t.itemCount,l=t.itemSize,c=t.layout,a=t.width,d=e*l,u=r==="horizontal"||c==="horizontal"?a:i,f=Math.ceil((u+n-d)/l);return Math.max(0,Math.min(o-1,e+f-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});function rd(){var t,e;const n=we(),r=function(){const a=y.useContext(Yi);if(a===null)throw new Error("Provide a DnDContext");return a}().cursor;if(!r||r.type!=="line")return null;const i=n.indent,o=n.rowHeight*r.index+((e=(t=n.props.padding)!==null&&t!==void 0?t:n.props.paddingTop)!==null&&e!==void 0?e:0),l=i*r.level,c=n.renderCursor;return s.jsx(c,{top:o,left:l,indent:i})}var id=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const od=y.forwardRef(function(t,e){const{children:n}=t,r=id(t,["children"]),i=we();return s.jsxs("div",Object.assign({ref:e},r,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[s.jsx(sd,{}),n]}))}),sd=()=>{const t=we();return s.jsx("div",{style:{height:t.visibleNodes.length*t.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:s.jsx(rd,{})})};var ld=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const ad=y.forwardRef(function(t,e){var n,r,i,o,{style:l}=t,c=ld(t,["style"]);const a=we(),d=(r=(n=a.props.padding)!==null&&n!==void 0?n:a.props.paddingTop)!==null&&r!==void 0?r:0,u=(o=(i=a.props.padding)!==null&&i!==void 0?i:a.props.paddingBottom)!==null&&o!==void 0?o:0;return s.jsx("div",Object.assign({ref:e,style:Object.assign(Object.assign({},l),{height:`${parseFloat(l.height)+d+u}px`})},c))});var je,jo=y.createContext({dragDropManager:void 0});function Y(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(!t){var o;if(e===void 0)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=0;(o=new Error(e.replace(/%s/g,function(){return r[l++]}))).name="Invariant Violation"}throw o.framesToPop=1,o}}(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(je||(je={}));var Mn="dnd-core/INIT_COORDS",An="dnd-core/BEGIN_DRAG",ko="dnd-core/PUBLISH_DRAG_SOURCE",Ht="dnd-core/HOVER",Rn="dnd-core/DROP",Fn="dnd-core/END_DRAG";function Co(t,e){return{type:Mn,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}function Ln(t){return Ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ln(t)}function Io(t){return Ln(t)==="object"}var cd={type:Mn,payload:{clientOffset:null,sourceClientOffset:null}};function dd(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0||r,o=n.clientOffset,l=n.getSourceClientOffset,c=t.getMonitor(),a=t.getRegistry();t.dispatch(Co(o)),function(m,h,g){Y(!h.isDragging(),"Cannot call beginDrag while dragging."),m.forEach(function(v){Y(g.getSource(v),"Expected sourceIds to be registered.")})}(e,c,a);var d=function(m,h){for(var g=null,v=m.length-1;v>=0;v--)if(h.canDragSource(m[v])){g=m[v];break}return g}(e,c);if(d!==null){var u=null;if(o){if(!l)throw new Error("getSourceClientOffset must be defined");(function(m){Y(typeof m=="function","When clientOffset is provided, getSourceClientOffset must be a function.")})(l),u=l(d)}t.dispatch(Co(o,u));var f=a.getSource(d).beginDrag(c,d);if(f!=null){(function(m){Y(Io(m),"Item must be an object.")})(f),a.pinSource(d);var p=a.getSourceType(d);return{type:An,payload:{itemType:p,item:f,sourceId:d,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}else t.dispatch(cd)}}function ud(t){return function(){if(t.getMonitor().isDragging())return{type:ko}}}function zn(t,e){return e===null?t===null:Array.isArray(t)?t.some(function(n){return n===e}):t===e}function hd(t){return function(e){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;(function(l){Y(Array.isArray(l),"Expected targetIds to be an array.")})(e);var r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(l,c,a){Y(c.isDragging(),"Cannot call hover while not dragging."),Y(!c.didDrop(),"Cannot call hover after drop.");for(var d=0;d<l.length;d++){var u=l[d];Y(l.lastIndexOf(u)===d,"Expected targetIds to be unique in the passed array."),Y(a.getTarget(u),"Expected targetIds to be registered.")}}(r,i,o),function(l,c,a){for(var d=l.length-1;d>=0;d--){var u=l[d];zn(c.getTargetType(u),a)||l.splice(d,1)}}(r,o,i.getItemType()),function(l,c,a){l.forEach(function(d){a.getTarget(d).hover(c,d)})}(r,i,o),{type:Ht,payload:{targetIds:r,clientOffset:n||null}}}}function No(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Do(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?No(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):No(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pd(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.getMonitor(),r=t.getRegistry();(function(o){Y(o.isDragging(),"Cannot call drop while not dragging."),Y(!o.didDrop(),"Cannot call drop twice during one drag operation.")})(n);var i=function(o){var l=o.getTargetIds().filter(o.canDropOnTarget,o);return l.reverse(),l}(n);i.forEach(function(o,l){var c=function(d,u,f,p){var m=f.getTarget(d),h=m?m.drop(p,d):void 0;return function(g){Y(g===void 0||Io(g),"Drop result must either be an object or undefined.")}(h),h===void 0&&(h=u===0?{}:p.getDropResult()),h}(o,l,r,n),a={type:Rn,payload:{dropResult:Do(Do({},e),c)}};t.dispatch(a)})}}function gd(t){return function(){var e=t.getMonitor(),n=t.getRegistry();(function(i){Y(i.isDragging(),"Cannot call endDrag while not dragging.")})(e);var r=e.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:Fn}}}function md(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function gt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var vd=function(){function t(e,n){var r=this;(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),gt(this,"store",void 0),gt(this,"monitor",void 0),gt(this,"backend",void 0),gt(this,"isSetUp",!1),gt(this,"handleRefCountChange",function(){var i=r.store.getState().refCount>0;r.backend&&(i&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!i&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}return md(t,[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,n=this.store.dispatch,r=function(i){return{beginDrag:dd(i),publishDragSource:ud(i),hover:hd(i),drop:pd(i),endDrag:gd(i)}}(this);return Object.keys(r).reduce(function(i,o){var l,c=r[o];return i[o]=(l=c,function(){for(var a=arguments.length,d=new Array(a),u=0;u<a;u++)d[u]=arguments[u];var f=l.apply(e,d);f!==void 0&&n(f)}),i},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),t}();function ke(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Oo=typeof Symbol=="function"&&Symbol.observable||"@@observable",Eo=function(){return Math.random().toString(36).substring(7).split("").join(".")},To={INIT:"@@redux/INIT"+Eo(),REPLACE:"@@redux/REPLACE"+Eo()};function Po(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ke(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(ke(1));return n(Po)(t,e)}if(typeof t!="function")throw new Error(ke(2));var i=t,o=e,l=[],c=l,a=!1;function d(){c===l&&(c=l.slice())}function u(){if(a)throw new Error(ke(3));return o}function f(m){if(typeof m!="function")throw new Error(ke(4));if(a)throw new Error(ke(5));var h=!0;return d(),c.push(m),function(){if(h){if(a)throw new Error(ke(6));h=!1,d();var g=c.indexOf(m);c.splice(g,1),l=null}}}function p(m){if(!function(v){if(typeof v!="object"||v===null)return!1;for(var x=v;Object.getPrototypeOf(x)!==null;)x=Object.getPrototypeOf(x);return Object.getPrototypeOf(v)===x}(m))throw new Error(ke(7));if(m.type===void 0)throw new Error(ke(8));if(a)throw new Error(ke(9));try{a=!0,o=i(o,m)}finally{a=!1}for(var h=l=c,g=0;g<h.length;g++)(0,h[g])();return m}return p({type:To.INIT}),(r={dispatch:p,subscribe:f,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(ke(10));i=m,p({type:To.REPLACE})}})[Oo]=function(){var m,h=f;return(m={subscribe:function(g){if(typeof g!="object"||g===null)throw new Error(ke(11));function v(){g.next&&g.next(u())}return v(),{unsubscribe:h(v)}}})[Oo]=function(){return this},m},r}var yd=function(t,e){return t===e};function Ko(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _o(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ko(Object(n),!0).forEach(function(r){xd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ko(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Mo={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function bd(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mo,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Mn:case An:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case Ht:return t=n.clientOffset,e=i.clientOffset,!t&&!e||t&&e&&t.x===e.x&&t.y===e.y?n:_o(_o({},n),{},{clientOffset:i.clientOffset});case Fn:case Rn:return Mo;default:return n}}var $n="dnd-core/ADD_SOURCE",Vn="dnd-core/ADD_TARGET",Bn="dnd-core/REMOVE_SOURCE",Ut="dnd-core/REMOVE_TARGET";function Ao(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ce(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ao(Object(n),!0).forEach(function(r){wd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ao(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Sd={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function jd(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sd,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case An:return Ce(Ce({},n),{},{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case ko:return Ce(Ce({},n),{},{isSourcePublic:!0});case Ht:return Ce(Ce({},n),{},{targetIds:i.targetIds});case Ut:return n.targetIds.indexOf(i.targetId)===-1?n:Ce(Ce({},n),{},{targetIds:(t=n.targetIds,e=i.targetId,t.filter(function(o){return o!==e}))});case Rn:return Ce(Ce({},n),{},{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case Fn:return Ce(Ce({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function kd(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case $n:case Vn:return t+1;case Bn:case Ut:return t-1;default:return t}}var qt=[],Hn=[];function Cd(){var t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Ht:break;case $n:case Vn:case Ut:case Bn:return qt;default:return Hn}var e=t.payload,n=e.targetIds,r=n===void 0?[]:n,i=e.prevTargetIds,o=i===void 0?[]:i,l=function(u,f){var p=new Map,m=function(g){p.set(g,p.has(g)?p.get(g)+1:1)};u.forEach(m),f.forEach(m);var h=[];return p.forEach(function(g,v){g===1&&h.push(v)}),h}(r,o),c=l.length>0||!function(u,f){var p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yd;if(u.length!==f.length)return!1;for(var m=0;m<u.length;++m)if(!p(u[m],f[m]))return!1;return!0}(r,o);if(!c)return qt;var a=o[o.length-1],d=r[r.length-1];return a!==d&&(a&&l.push(a),d&&l.push(d)),l}function Id(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function Ro(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Fo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ro(Object(n),!0).forEach(function(r){Nd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ro(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nd(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dd(){var t,e,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Cd(r.dirtyHandlerIds,{type:i.type,payload:Fo(Fo({},i.payload),{},{prevTargetIds:(t=r,e="dragOperation.targetIds",n=[],e.split(".").reduce(function(o,l){return o&&o[l]?o[l]:n||null},t))})}),dragOffset:bd(r.dragOffset,i),refCount:kd(r.refCount,i),dragOperation:jd(r.dragOperation,i),stateId:Id(r.stateId)}}function Lo(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Od(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function zo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}qt.__IS_NONE__=!0,Hn.__IS_ALL__=!0;var Ed=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),zo(this,"store",void 0),zo(this,"registry",void 0),this.store=e,this.registry=n}return Od(t,[{key:"subscribeToStateChange",value:function(e){var n=this,r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;Y(typeof e=="function","listener must be a function."),Y(r===void 0||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");var i=this.store.getState().stateId;return this.store.subscribe(function(){var o=n.store.getState(),l=o.stateId;try{var c=l===i||l===i+1&&!function(a,d){if(a===qt)return!1;if(a===Hn||d===void 0)return!0;var u,f=(u=a,d.filter(function(p){return u.indexOf(p)>-1}));return f.length>0}(o.dirtyHandlerIds,r);c||e()}finally{i=l}})}},{key:"subscribeToOffsetChange",value:function(e){var n=this;Y(typeof e=="function","listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var i=n.store.getState().dragOffset;i!==r&&(r=i,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e);return Y(n,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&n.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var n=this.registry.getTarget(e);return Y(n,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&zn(this.registry.getTargetType(e),this.getItemType())&&n.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e,!0);return Y(n,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&n.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!zn(r,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var l=o.indexOf(e);return n?l===o.length-1:l>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,i=e.clientOffset,o=e.initialClientOffset,l=e.initialSourceClientOffset,i&&o&&l?Lo((r=l,{x:(n=i).x+r.x,y:n.y+r.y}),o):null;var e,n,r,i,o,l}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,r=e.initialClientOffset,n&&r?Lo(n,r):null;var e,n,r}}]),t}(),Td=0;function Un(t){return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Un(t)}function qn(t,e){e&&Array.isArray(t)?t.forEach(function(n){return qn(n,!1)}):Y(typeof t=="string"||Un(t)==="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const $o=typeof global<"u"?global:self,Vo=$o.MutationObserver||$o.WebKitMutationObserver;function Bo(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const Pd=typeof Vo=="function"?function(t){let e=1;const n=new Vo(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:Bo;class Kd{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}const Ho=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let n=0,r=t.length-this.index;n<r;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Pd(this.flush),this.requestErrorThrow=Bo(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},_d=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new Kd(this.onError,r=>e[e.length]=r);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(Ho.registerPendingError);function Md(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ad(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Uo(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Uo(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Uo(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Rd(t){var e=(Td++).toString();switch(t){case je.SOURCE:return"S".concat(e);case je.TARGET:return"T".concat(e);default:throw new Error("Unknown Handler Role: ".concat(t))}}function qo(t){switch(t[0]){case"S":return je.SOURCE;case"T":return je.TARGET;default:Y(!1,"Cannot parse handler ID: ".concat(t))}}function Wo(t,e){var n=t.entries(),r=!1;do{var i=n.next(),o=i.done;if(Ad(i.value,2)[1]===e)return!0;r=!!o}while(!r);return!1}var Fd=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),et(this,"types",new Map),et(this,"dragSources",new Map),et(this,"dropTargets",new Map),et(this,"pinnedSourceId",null),et(this,"pinnedSource",null),et(this,"store",void 0),this.store=e}return Md(t,[{key:"addSource",value:function(e,n){qn(e),function(i){Y(typeof i.canDrag=="function","Expected canDrag to be a function."),Y(typeof i.beginDrag=="function","Expected beginDrag to be a function."),Y(typeof i.endDrag=="function","Expected endDrag to be a function.")}(n);var r=this.addHandler(je.SOURCE,e,n);return this.store.dispatch(function(i){return{type:$n,payload:{sourceId:i}}}(r)),r}},{key:"addTarget",value:function(e,n){qn(e,!0),function(i){Y(typeof i.canDrop=="function","Expected canDrop to be a function."),Y(typeof i.hover=="function","Expected hover to be a function."),Y(typeof i.drop=="function","Expected beginDrag to be a function.")}(n);var r=this.addHandler(je.TARGET,e,n);return this.store.dispatch(function(i){return{type:Vn,payload:{targetId:i}}}(r)),r}},{key:"containsHandler",value:function(e){return Wo(this.dragSources,e)||Wo(this.dropTargets,e)}},{key:"getSource",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return Y(this.isSourceId(e),"Expected a valid source ID."),n&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return Y(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return Y(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return Y(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return qo(e)===je.SOURCE}},{key:"isTargetId",value:function(e){return qo(e)===je.TARGET}},{key:"removeSource",value:function(e){var n,r=this;Y(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(i){return{type:Bn,payload:{sourceId:i}}}(e)),n=function(){r.dragSources.delete(e),r.types.delete(e)},Ho.enqueueTask(_d.create(n))}},{key:"removeTarget",value:function(e){Y(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(n){return{type:Ut,payload:{targetId:n}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var n=this.getSource(e);Y(n,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=n}},{key:"unpinSource",value:function(){Y(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,n,r){var i=Rd(e);return this.types.set(i,n),e===je.SOURCE?this.dragSources.set(i,r):e===je.TARGET&&this.dropTargets.set(i,r),i}}]),t}();function Ld(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=function(c){var a=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Po(Dd,c&&a&&a({name:"dnd-core",instanceId:"dnd-core"}))}(arguments.length>3&&arguments[3]!==void 0&&arguments[3]),i=new Ed(r,new Fd(r)),o=new vd(r,i),l=t(o,e,n);return o.receiveBackend(l),o}var zd=["children"];function $d(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Go(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Go(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Go(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Vd(t,e){if(t==null)return{};var n,r,i=function(l,c){if(l==null)return{};var a,d,u={},f=Object.keys(l);for(d=0;d<f.length;d++)a=f[d],c.indexOf(a)>=0||(u[a]=l[a]);return u}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var Yo=0,Wt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),Bd=y.memo(function(t){var e=t.children,n=function(l){if("manager"in l)return[{dragDropManager:l.manager},!1];var c=function(d){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xo(),f=arguments.length>2?arguments[2]:void 0,p=arguments.length>3?arguments[3]:void 0,m=u;return m[Wt]||(m[Wt]={dragDropManager:Ld(d,u,f,p)}),m[Wt]}(l.backend,l.context,l.options,l.debugMode),a=!l.context;return[c,a]}(Vd(t,zd)),r=$d(n,2),i=r[0],o=r[1];return y.useEffect(function(){if(o){var l=Xo();return++Yo,function(){--Yo===0&&(l[Wt]=null)}}},[]),s.jsx(jo.Provider,Object.assign({value:i},{children:e}),void 0)});function Xo(){return typeof global<"u"?global:window}function Hd(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function Qo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Wn=!1,Gn=!1,Ud=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Qo(this,"internalMonitor",void 0),Qo(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return Hd(t,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){Y(!Wn,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Wn=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Wn=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;Y(!Gn,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Gn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Gn=!1}}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,n){return this.internalMonitor.isOverTarget(e,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function qd(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function Zo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Yn=!1,Wd=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Zo(this,"internalMonitor",void 0),Zo(this,"targetId",null),this.internalMonitor=e.getMonitor()}return qd(t,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;Y(!Yn,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Yn=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Yn=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function Gd(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!y.isValidElement(e)){var r=e;return t(r,n),r}var i=e;(function(l){if(typeof l.type!="string"){var c=l.type.displayName||l.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(c," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}})(i);var o=n?function(l){return t(l,n)}:t;return function(l,c){var a=l.ref;return Y(typeof a!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),a?y.cloneElement(l,{ref:function(d){es(a,d),es(c,d)}}):y.cloneElement(l,{ref:c})}(i,o)}}function Jo(t){var e={};return Object.keys(t).forEach(function(n){var r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{var i=Gd(r);e[n]=function(){return i}}}),e}function es(t,e){typeof t=="function"?t(e):t.current=e}function Xn(t){return Xn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xn(t)}function Qn(t){return t!==null&&Xn(t)==="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Zn(t,e,n,r){var i=void 0;if(i!==void 0)return!!i;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;var o=Object.keys(t),l=Object.keys(e);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(e),a=0;a<o.length;a++){var d=o[a];if(!c(d))return!1;var u=t[d],f=e[d];if((i=void 0)===!1||i===void 0&&u!==f)return!1}return!0}function Yd(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function ve(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Xd=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),ve(this,"hooks",Jo({dragSource:function(r,i){n.clearDragSource(),n.dragSourceOptions=i||null,Qn(r)?n.dragSourceRef=r:n.dragSourceNode=r,n.reconnectDragSource()},dragPreview:function(r,i){n.clearDragPreview(),n.dragPreviewOptions=i||null,Qn(r)?n.dragPreviewRef=r:n.dragPreviewNode=r,n.reconnectDragPreview()}})),ve(this,"handlerId",null),ve(this,"dragSourceRef",null),ve(this,"dragSourceNode",void 0),ve(this,"dragSourceOptionsInternal",null),ve(this,"dragSourceUnsubscribe",void 0),ve(this,"dragPreviewRef",null),ve(this,"dragPreviewNode",void 0),ve(this,"dragPreviewOptionsInternal",null),ve(this,"dragPreviewUnsubscribe",void 0),ve(this,"lastConnectedHandlerId",null),ve(this,"lastConnectedDragSource",null),ve(this,"lastConnectedDragSourceOptions",null),ve(this,"lastConnectedDragPreview",null),ve(this,"lastConnectedDragPreviewOptions",null),ve(this,"backend",void 0),this.backend=e}return Yd(t,[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();n&&this.disconnectDragSource(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Zn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Zn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),t}();function Qd(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function Pe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Zd=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),Pe(this,"hooks",Jo({dropTarget:function(r,i){n.clearDropTarget(),n.dropTargetOptions=i,Qn(r)?n.dropTargetRef=r:n.dropTargetNode=r,n.reconnect()}})),Pe(this,"handlerId",null),Pe(this,"dropTargetRef",null),Pe(this,"dropTargetNode",void 0),Pe(this,"dropTargetOptionsInternal",null),Pe(this,"unsubscribeDropTarget",void 0),Pe(this,"lastConnectedHandlerId",null),Pe(this,"lastConnectedDropTarget",null),Pe(this,"lastConnectedDropTargetOptions",null),Pe(this,"backend",void 0),this.backend=e}return Qd(t,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var n=this.dropTarget;this.handlerId&&(n?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions)):this.lastConnectedDropTarget=n)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Zn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),t}(),Be=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Jn(t){return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function Jd(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function er(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var eu=function(){function t(e,n,r){(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),er(this,"spec",void 0),er(this,"monitor",void 0),er(this,"connector",void 0),this.spec=e,this.monitor=n,this.connector=r}return Jd(t,[{key:"beginDrag",value:function(){var e,n=this.spec,r=this.monitor;return(e=Jn(n.item)==="object"?n.item:typeof n.item=="function"?n.item(r):{})!==null&&e!==void 0?e:null}},{key:"canDrag",value:function(){var e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag!="function"||e.canDrag(n)}},{key:"isDragging",value:function(e,n){var r=this.spec,i=this.monitor,o=r.isDragging;return o?o(i):n===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,n=this.monitor,r=this.connector,i=e.end;i&&i(n.getItem(),n),r.reconnect()}}]),t}();function He(){var t=y.useContext(jo).dragDropManager;return Y(t!=null,"Expected drag drop context"),t}function tu(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return ts(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ts(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
9
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ts(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nu(t,e,n){var r=He(),i=function(l,c,a){var d=y.useMemo(function(){return new eu(l,c,a)},[c,a]);return y.useEffect(function(){d.spec=l},[l]),d}(t,e,n),o=function(l){return y.useMemo(function(){var c=l.type;return Y(c!=null,"spec.type must be defined"),c},[l])}(t);Be(function(){if(o!=null){var l=function(u,f,p){var m=p.getRegistry(),h=m.addSource(u,f);return[h,function(){return m.removeSource(h)}]}(o,i,r),c=tu(l,2),a=c[0],d=c[1];return e.receiveHandlerId(a),n.receiveHandlerId(a),d}},[r,e,n,i,o])}function ru(t){return function(e){if(Array.isArray(e))return tr(e)}(t)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(t)||function(e,n){if(e){if(typeof e=="string")return tr(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tr(e,n)}}(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function tr(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ns(t,e){var n=ru(e||[]);return e==null&&typeof t!="function"&&n.push(t),y.useMemo(function(){return typeof t=="function"?t():t},n)}function iu(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return rs(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return rs(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
11
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function rs(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function is(t,e,n){var r=iu(y.useState(function(){return e(t)}),2),i=r[0],o=r[1],l=y.useCallback(function(){var c=e(t);za(i,c)||(o(c),n&&n())},[i,t,n]);return Be(l),[i,l]}function ou(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return os(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return os(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
12
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function os(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ss(t,e,n){return function(r,i,o){var l=ou(is(r,i,o),2),c=l[0],a=l[1];return Be(function(){var d=r.getHandlerId();if(d!=null)return r.subscribeToStateChange(a,{handlerIds:[d]})},[r,a]),c}(e,t||function(){return{}},function(){return n.reconnect()})}function su(t){return y.useMemo(function(){return t.hooks.dragSource()},[t])}function lu(t){return y.useMemo(function(){return t.hooks.dragPreview()},[t])}function au(t,e){var n=ns(t,e);Y(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var r,i=(r=He(),y.useMemo(function(){return new Ud(r)},[r])),o=function(l,c){var a=He(),d=y.useMemo(function(){return new Xd(a.getBackend())},[a]);return Be(function(){return d.dragSourceOptions=l||null,d.reconnect(),function(){return d.disconnectDragSource()}},[d,l]),Be(function(){return d.dragPreviewOptions=c||null,d.reconnect(),function(){return d.disconnectDragPreview()}},[d,c]),d}(n.options,n.previewOptions);return nu(n,i,o),[ss(n.collect,i,o),su(o),lu(o)]}function cu(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function ls(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var du=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),ls(this,"spec",void 0),ls(this,"monitor",void 0),this.spec=e,this.monitor=n}return cu(t,[{key:"canDrop",value:function(){var e=this.spec,n=this.monitor;return!e.canDrop||e.canDrop(n.getItem(),n)}},{key:"hover",value:function(){var e=this.spec,n=this.monitor;e.hover&&e.hover(n.getItem(),n)}},{key:"drop",value:function(){var e=this.spec,n=this.monitor;if(e.drop)return e.drop(n.getItem(),n)}}]),t}();function uu(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return as(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return as(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function as(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function hu(t,e,n){var r=He(),i=function(l,c){var a=y.useMemo(function(){return new du(l,c)},[c]);return y.useEffect(function(){a.spec=l},[l]),a}(t,e),o=function(l){var c=l.accept;return y.useMemo(function(){return Y(l.accept!=null,"accept must be defined"),Array.isArray(c)?c:[c]},[c])}(t);Be(function(){var l=function(u,f,p){var m=p.getRegistry(),h=m.addTarget(u,f);return[h,function(){return m.removeTarget(h)}]}(o,i,r),c=uu(l,2),a=c[0],d=c[1];return e.receiveHandlerId(a),n.receiveHandlerId(a),d},[r,e,i,n,o.map(function(l){return l.toString()}).join("|")])}function fu(t){return y.useMemo(function(){return t.hooks.dropTarget()},[t])}function cs(t,e){var n,r=ns(t,e),i=(n=He(),y.useMemo(function(){return new Wd(n)},[n])),o=function(l){var c=He(),a=y.useMemo(function(){return new Zd(c.getBackend())},[c]);return Be(function(){return a.dropTargetOptions=l||null,a.reconnect(),function(){return a.disconnectDropTarget()}},[l]),a}(r.options);return hu(r,i,o),[ss(r.collect,i,o),fu(o)]}function pu(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,l,c=[],a=!0,d=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(c.push(o.value),!r||c.length!==r);a=!0);}catch(u){d=!0,l=u}finally{try{a||i.return==null||i.return()}finally{if(d)throw l}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return ds(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ds(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ds(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function us(t){var e=null;return function(){return e==null&&(e=t()),e}}function gu(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function hs(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var mu=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),hs(this,"entered",[]),hs(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return gu(t,[{key:"enter",value:function(e){var n=this,r=this.entered.length;return this.entered=function(i,o){var l=new Set,c=function(d){return l.add(d)};i.forEach(c),o.forEach(c);var a=[];return l.forEach(function(d){return a.push(d)}),a}(this.entered.filter(function(i){return n.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),[e]),r===0&&this.entered.length>0}},{key:"leave",value:function(e){var n,r,i=this.entered.length;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(function(o){return o!==r})),i>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),vu=us(function(){return/firefox/i.test(navigator.userAgent)}),fs=us(function(){return!!window.safari});function yu(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function mt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ps=function(){function t(e,n){(function(P,O){if(!(P instanceof O))throw new TypeError("Cannot call a class as a function")})(this,t),mt(this,"xs",void 0),mt(this,"ys",void 0),mt(this,"c1s",void 0),mt(this,"c2s",void 0),mt(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(P,O){return e[P]<e[O]?-1:1});for(var l,c,a=[],d=[],u=0;u<r-1;u++)l=e[u+1]-e[u],c=n[u+1]-n[u],a.push(l),d.push(c/l);for(var f=[d[0]],p=0;p<a.length-1;p++){var m=d[p],h=d[p+1];if(m*h<=0)f.push(0);else{l=a[p];var g=a[p+1],v=l+g;f.push(3*v/((v+g)/m+(v+l)/h))}}f.push(d[d.length-1]);for(var x,S=[],j=[],C=0;C<f.length-1;C++){x=d[C];var k=f[C],D=1/a[C],N=k+f[C+1]-x-x;S.push((x-k-N)*D),j.push(N*D*D)}this.xs=e,this.ys=n,this.c1s=f,this.c2s=S,this.c3s=j}return yu(t,[{key:"interpolate",value:function(e){var n=this.xs,r=this.ys,i=this.c1s,o=this.c2s,l=this.c3s,c=n.length-1;if(e===n[c])return r[c];for(var a,d=0,u=l.length-1;d<=u;){var f=n[a=Math.floor(.5*(d+u))];if(f<e)d=a+1;else{if(!(f>e))return r[a];u=a-1}}var p=e-n[c=Math.max(0,u)],m=p*p;return r[c]+i[c]*p+o[c]*m+l[c]*p*m}}]),t}();function gs(t){var e=t.nodeType===1?t:t.parentElement;if(!e)return null;var n=e.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Gt(t){return{x:t.clientX,y:t.clientY}}function xu(t,e,n,r,i){var o,l,c,a=(o=e).nodeName==="IMG"&&(vu()||!((l=document.documentElement)!==null&&l!==void 0&&l.contains(o))),d=gs(a?t:e),u={x:n.x-d.x,y:n.y-d.y},f=t.offsetWidth,p=t.offsetHeight,m=r.anchorX,h=r.anchorY,g=function(k,D,N,P){var O=k?D.width:N,_=k?D.height:P;return fs()&&k&&(_/=window.devicePixelRatio,O/=window.devicePixelRatio),{dragPreviewWidth:O,dragPreviewHeight:_}}(a,e,f,p),v=g.dragPreviewWidth,x=g.dragPreviewHeight,S=i.offsetX,j=i.offsetY,C=j===0||j;return{x:S===0||S?S:new ps([0,.5,1],[u.x,u.x/f*v,u.x+v-f]).interpolate(m),y:C?j:(c=new ps([0,.5,1],[u.y,u.y/p*x,u.y+x-p]).interpolate(h),fs()&&a&&(c+=(window.devicePixelRatio-1)*x),c)}}var ms="__NATIVE_FILE__",vs="__NATIVE_URL__",ys="__NATIVE_TEXT__",xs="__NATIVE_HTML__";const bs=Object.freeze(Object.defineProperty({__proto__:null,FILE:ms,HTML:xs,TEXT:ys,URL:vs},Symbol.toStringTag,{value:"Module"}));function nr(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var vt;function Yt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var rr=(Yt(vt={},ms,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Yt(vt,xs,{exposeProperties:{html:function(t,e){return nr(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Yt(vt,vs,{exposeProperties:{urls:function(t,e){return nr(t,e,"").split(`
15
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Yt(vt,ys,{exposeProperties:{text:function(t,e){return nr(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),vt);function bu(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function ws(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var wu=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),ws(this,"item",void 0),ws(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return bu(t,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(e.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var n=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(i){r[i]={value:n.config.exposeProperties[i](e,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,n){return n===e.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function ir(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(rr).filter(function(n){return rr[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function Su(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function or(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ju=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),or(this,"ownerDocument",null),or(this,"globalContext",void 0),or(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return Su(t,[{key:"window",get:function(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}},{key:"document",get:function(){var e;return(e=this.globalContext)!==null&&e!==void 0&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}}]),t}();function Ss(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function js(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ss(Object(n),!0).forEach(function(r){Q(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ss(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ku(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var l=i[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}(t.prototype,e),t}function Q(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var sr,Cu=function(){function t(e,n,r){var i=this;(function(o,l){if(!(o instanceof l))throw new TypeError("Cannot call a class as a function")})(this,t),Q(this,"options",void 0),Q(this,"actions",void 0),Q(this,"monitor",void 0),Q(this,"registry",void 0),Q(this,"enterLeaveCounter",void 0),Q(this,"sourcePreviewNodes",new Map),Q(this,"sourcePreviewNodeOptions",new Map),Q(this,"sourceNodes",new Map),Q(this,"sourceNodeOptions",new Map),Q(this,"dragStartSourceIds",null),Q(this,"dropTargetIds",[]),Q(this,"dragEnterTargetIds",[]),Q(this,"currentNativeSource",null),Q(this,"currentNativeHandle",null),Q(this,"currentDragSourceNode",null),Q(this,"altKeyPressed",!1),Q(this,"mouseMoveTimeoutTimer",null),Q(this,"asyncEndDragFrameId",null),Q(this,"dragOverTargetIds",null),Q(this,"lastClientOffset",null),Q(this,"hoverRafId",null),Q(this,"getSourceClientOffset",function(o){var l=i.sourceNodes.get(o);return l&&gs(l)||null}),Q(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),Q(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),Q(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Q(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),Q(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var l=i.dragStartSourceIds;i.dragStartSourceIds=null;var c=Gt(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(l||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:c});var a=o.dataTransfer,d=ir(a);if(i.monitor.isDragging()){if(a&&typeof a.setDragImage=="function"){var u=i.monitor.getSourceId(),f=i.sourceNodes.get(u),p=i.sourcePreviewNodes.get(u)||f;if(p){var m=i.getCurrentSourcePreviewNodeOptions(),h=xu(f,p,c,{anchorX:m.anchorX,anchorY:m.anchorY},{offsetX:m.offsetX,offsetY:m.offsetY});a.setDragImage(p,h.x,h.y)}}try{a==null||a.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(d)i.beginDragNativeItem(d);else{if(a&&!a.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),Q(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Q(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var l=o.dataTransfer,c=ir(l);c&&i.beginDragNativeItem(c,l)}}),Q(this,"handleTopDragEnter",function(o){var l=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=o.altKey,l.length>0&&i.actions.hover(l,{clientOffset:Gt(o)}),l.some(function(c){return i.monitor.canDropOnTarget(c)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),Q(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),Q(this,"handleTopDragOver",function(o){var l=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));i.altKeyPressed=o.altKey,i.lastClientOffset=Gt(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(l||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(l||[]).some(function(c){return i.monitor.canDropOnTarget(c)})?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),Q(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),Q(this,"handleTopDropCapture",function(o){var l;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(l=i.currentNativeSource)===null||l===void 0||l.loadDataTransfer(o.dataTransfer)):ir(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),Q(this,"handleTopDrop",function(o){var l=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(l,{clientOffset:Gt(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),Q(this,"handleSelectStart",function(o){var l=o.target;typeof l.dragDrop=="function"&&(l.tagName==="INPUT"||l.tagName==="SELECT"||l.tagName==="TEXTAREA"||l.isContentEditable||(o.preventDefault(),l.dragDrop()))}),this.options=new ju(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new mu(this.isNodeInDocument)}return ku(t,[{key:"profile",value:function(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,n=this.rootElement;n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&((e=this.window)===null||e===void 0||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,n,r){var i=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),function(){i.sourcePreviewNodes.delete(e),i.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,n,r){var i=this;this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,r);var o=function(c){return i.handleDragStart(c,e)},l=function(c){return i.handleSelectStart(c)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",l),function(){i.sourceNodes.delete(e),i.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",l),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,n){var r=this,i=function(c){return r.handleDragEnter(c,e)},o=function(c){return r.handleDragOver(c,e)},l=function(c){return r.handleDrop(c,e)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",l),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",l)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return js({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return js({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(bs).some(function(n){return bs[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new wu(rr[r]);return o.loadDataTransfer(i),o}(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var r;return(r=n.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;return this.currentDragSourceNode=null,this.rootElement&&((e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(e,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(e,n){this.dropTargetIds.unshift(n)}}]),t}(),Iu=function(t,e,n){return new Cu(t,e,n)};function Nu(t){const e=we(),n=e.selectedIds,[r,i,o]=au(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const l=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(Je.dragStart(t.id,l)),{id:t.id,dragIds:l}},end:()=>{e.hideCursor(),e.dispatch(Je.dragEnd())}}),[n,t]);return y.useEffect(()=>{o((sr||((sr=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),sr))},[o]),i}function Xt(t,e){return{parentId:t||null,index:e}}function tt(t,e){return{type:"line",index:t,level:e}}function lr(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;return{parentId:((n=r.parent)===null||n===void 0?void 0:n.id)||null,index:no(r)+1}}function ks(t){var e;const n=function(f,p){const m=f.getBoundingClientRect(),h=p.x-Math.round(m.x),g=p.y-Math.round(m.y),v=m.height,x=g<v/2,S=!x,j=v/4,C=g>j&&g<v-j;return{x:h,inTopHalf:x,inBottomHalf:S,inMiddle:C,atTop:!C&&x,atBottom:!C&&S}}(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:l,prevNode:c}=t,[a,d]=function(f,p,m,h){return f?f.isInternal?h.atTop?[p,f]:h.inMiddle?[f,f]:[f,m]:h.inTopHalf?[p,f]:[f,m]:[p,null]}(o,c,l,n);if(o&&o.isInternal&&n.inMiddle)return{drop:Xt(o.id,null),cursor:(u=o.id,{type:"highlight",id:u})};var u;if(!a)return{drop:Xt((e=d==null?void 0:d.parent)===null||e===void 0?void 0:e.id,0),cursor:tt(0,0)};if(Zi(a)){const f=Vt(i,(d==null?void 0:d.level)||0,a.level);return{drop:lr(a,f),cursor:tt(a.rowIndex+1,f)}}if(Ji(a)){const f=Vt(i,(d==null?void 0:d.level)||0,a.level);return{drop:lr(a,f),cursor:tt(a.rowIndex+1,f)}}if(eo(a)){const f=Vt(i,0,a.level+1);return f>a.level?{drop:Xt(a.id,0),cursor:tt(a.rowIndex+1,f)}:{drop:lr(a,f),cursor:tt(a.rowIndex+1,f)}}return{drop:Xt(a==null?void 0:a.id,0),cursor:tt(a.rowIndex+1,a.level+1)}}const Du=M.memo(function({index:t,style:e}){Qi(),function(){if(y.useContext(Gi)===null)throw new Error("Provide a NodesContext")}();const n=we(),r=function(h){const g=we(),v=g.at(h);if(!v)throw new Error(`Could not find node for index: ${h}`);return y.useMemo(()=>{const x=v.clone();return g.visibleNodes[h]=x,x},[...Object.values(v.state),v])}(t),i=y.useRef(null),o=Nu(r),l=function(h,g){const v=we(),[x,S]=cs(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(j,C)=>{const k=C.getClientOffset();if(!h.current||!k)return;const{cursor:D,drop:N}=ks({element:h.current,offset:k,indent:v.indent,node:g,prevNode:g.prev,nextNode:g.next});N&&v.dispatch(Je.hovering(N.parentId,N.index)),C.canDrop()?D&&v.showCursor(D):v.hideCursor()},drop:(j,C)=>{if(!C.canDrop())return null;let{parentId:k,index:D,dragIds:N}=v.state.dnd;lo(v.props.onMove,{dragIds:N,parentId:k===ft?null:k,index:D===null?0:D,dragNodes:v.dragNodes,parentNode:v.get(k)}),v.open(k)}}),[g,h.current,v.props]);return S}(i,r),c=y.useCallback(h=>{i.current=h,l(h)},[l]),a=n.indent*r.level,d=y.useMemo(()=>({paddingLeft:a}),[a]),u=y.useMemo(()=>{var h,g;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((g=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&g!==void 0?g:0)})},[e,n.props.padding,n.props.paddingTop]),f={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};y.useEffect(()=>{var h;!r.isEditing&&r.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const p=n.renderNode,m=n.renderRow;return s.jsx(m,{node:r,innerRef:c,attrs:f,children:s.jsx(p,{node:r,tree:n,style:d,dragHandle:o})})});let ar="",Cs=null;function Is(){Qi();const t=we();return s.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var n;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const l=o.nextSibling,c=o.parent;t.focus(l||c,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey)return e.preventDefault(),void ro(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void io(e.currentTarget);if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey)return t.select(t.focusedNode),void t.activate(t.focusedNode);if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode))}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode))}}if(e.key==="ArrowRight"){const i=t.focusedNode;return i?void(i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id)):void 0}if(e.key==="ArrowLeft"){const i=t.focusedNode;return!i||i.isRoot?void 0:void(i.isInternal&&i.isOpen?t.close(i.id):((n=i.parent)===null||n===void 0?void 0:n.isRoot)||t.focus(i.parent))}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection)return e.preventDefault(),void t.selectAll();if(e.key==="a"&&!e.metaKey&&t.props.onCreate)return void t.createLeaf();if(e.key==="A"&&!e.metaKey)return t.props.onCreate?void t.createInternal():void 0;if(e.key==="Home")return e.preventDefault(),void t.focus(t.firstNode);if(e.key==="End")return e.preventDefault(),void t.focus(t.lastNode);if(e.key==="Enter"){const i=t.focusedNode;return!i||!i.isEditable||!t.props.onRename?void 0:void setTimeout(()=>{i&&t.edit(i)})}if(e.key===" "){e.preventDefault();const i=t.focusedNode;return i?void(i.isLeaf?(i.select(),i.activate()):i.toggle()):void 0}if(e.key==="*"){const i=t.focusedNode;return i?void t.openSiblings(i):void 0}if(e.key==="PageUp")return e.preventDefault(),void t.pageUp();e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(Cs),ar+=e.key,Cs=setTimeout(()=>{ar=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(ar)});r&&t.focus(r.id)},children:s.jsx(nd,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:od,innerElementType:ad,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:Du})})}function Ns(t){return t.isFiltered?function(e,n){const r={},i=[];function o(c){if(!c.isRoot&&n(c)){r[c.id]=!0;let a=c.parent;for(;a;)r[a.id]=!0,a=a.parent}if(c.children)for(let a of c.children)o(a)}function l(c){var a;c.level>=0&&r[c.id]&&i.push(c),c.isOpen&&((a=c.children)===null||a===void 0||a.forEach(l))}return o(e),l(e),i.forEach(Ds),i}(t.root,t.isMatch.bind(t)):function(e){const n=[];function r(i){var o;i.level>=0&&n.push(i),i.isOpen&&((o=i.children)===null||o===void 0||o.forEach(r))}return r(e),n.forEach(Ds),n}(t.root)}function Ds(t,e){t.rowIndex=e}const Os=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var cr=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function l(d){try{a(r.next(d))}catch(u){o(u)}}function c(d){try{a(r.throw(d))}catch(u){o(u)}}function a(d){var u;d.done?i(d.value):(u=d.value,u instanceof n?u:new n(function(f){f(u)})).then(l,c)}a((r=r.apply(t,e||[])).next())})};const{safeRun:pe,identify:Ae,identifyNull:De}=Kc;class wt{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=ho(this),this.visibleNodes=Ns(this),this.idToIndex=Os(this.visibleNodes)}update(e){this.props=e,this.root=ho(this),this.visibleNodes=Ns(this),this.idToIndex=Os(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;return(n=ht(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=ht(e,this.props.idAccessor||"id");if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const l=Math.min(i,o),c=Math.max(i,o);return this.visibleNodes.slice(l,c+1)}indexOf(e){const n=so(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return cr(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?uo(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:co(this),l=(r=e.type)!==null&&r!==void 0?r:"leaf",c=yield pe(this.props.onCreate,{type:l,parentId:i,index:o,parentNode:this.get(i)});c&&(this.focus(c),setTimeout(()=>{this.edit(c).then(()=>{this.select(c),this.activate(c)})}))})}delete(e){return cr(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Ae),r=n.map(i=>this.get(i)).filter(i=>!!i);yield pe(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=Ae(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(En(n)),new Promise(r=>{wt.editPromise=r})}submit(e,n){return cr(this,void 0,void 0,function*(){if(!e)return;const r=Ae(e);yield pe(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(En(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(En(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(De(e));n&&pe(this.props.onActivate,n)}resolveEdit(e){const n=wt.editPromise;n&&n(e),wt.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Qe(Ae(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&pe(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex-r;let o=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;o=o>r?r:Math.max(r-i,0),this.focus(this.at(o))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let l=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;l=l<i?i:Math.min(l+o,this.visibleNodes.length-1),this.focus(this.at(l))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=Ae(e);r&&this.dispatch(Qe(i)),this.dispatch(Vc(i)),this.dispatch(mo(i)),this.dispatch(Pn(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&pe(this.props.onFocus,this.focusedNode),pe(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=Ae(e);this.dispatch(go(n)),pe(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(De(e));n&&(this.dispatch(Qe(n.id)),this.dispatch(po(n.id)),this.dispatch(mo(n.id)),this.dispatch(Pn(n.id)),this.scrollTo(n),this.focusedNode&&pe(this.props.onFocus,this.focusedNode),pe(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=Ae(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Qe(n)),this.dispatch(go(this.nodesBetween(r,i))),this.dispatch(po(this.nodesBetween(r,De(n)))),this.dispatch(Pn(n)),this.scrollTo(n),this.focusedNode&&pe(this.props.onFocus,this.focusedNode),pe(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),pe(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Qe((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&pe(this.props.onFocus,this.focusedNode),pe(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(Ae)),i=De(e.anchor),o=De(e.mostRecent);this.dispatch(Bc({ids:r,anchor:i,mostRecent:o})),pe(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return e.type==="highlight"?e.id:null}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;const n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&to(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i!="boolean"||!i}hideCursor(){this.dispatch(Je.cursor({type:"none"}))}showCursor(e){this.dispatch(Je.cursor(e))}open(e){const n=De(e);n&&(this.isOpen(n)||(this.dispatch(Tn.open(n,this.isFiltered)),pe(this.props.onToggle,n)))}close(e){const n=De(e);n&&this.isOpen(n)&&(this.dispatch(Tn.close(n,this.isFiltered)),pe(this.props.onToggle,n))}toggle(e){const n=De(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=De(e);if(!n)return;const r=On(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(n){if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){Bt(this.root,e=>{e.isInternal&&e.open()})}closeAll(){Bt(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=Ae(e);return this.openParents(r),ao(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var n,r,i;if(!e)return!1;if(e===ft)return!0;const o=(n=this.props.openByDefault)===null||n===void 0||n;return this.isFiltered?(r=this.state.nodes.open.filtered[e])===null||r===void 0||r:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){return!ht(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!ht(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=De(e);return!!n&&this.state.nodes.drag.id===n}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=De(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Qe(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Is}get renderRow(){return this.props.renderRow||Fc}get renderNode(){return this.props.children||Lc}get renderDragPreview(){return this.props.renderDragPreview||vo}get renderCursor(){return this.props.renderCursor||Rc}}function ye(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Es=typeof Symbol=="function"&&Symbol.observable||"@@observable",dr=()=>Math.random().toString(36).substring(7).split("").join("."),Qt={INIT:`@@redux/INIT${dr()}`,REPLACE:`@@redux/REPLACE${dr()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dr()}`};function Ts(t,e,n){if(typeof t!="function")throw new Error(ye(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ye(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(ye(1));return n(Ts)(t,e)}let r=t,i=e,o=new Map,l=o,c=0,a=!1;function d(){l===o&&(l=new Map,o.forEach((m,h)=>{l.set(h,m)}))}function u(){if(a)throw new Error(ye(3));return i}function f(m){if(typeof m!="function")throw new Error(ye(4));if(a)throw new Error(ye(5));let h=!0;d();const g=c++;return l.set(g,m),function(){if(h){if(a)throw new Error(ye(6));h=!1,d(),l.delete(g),o=null}}}function p(m){if(!function(h){if(typeof h!="object"||h===null)return!1;let g=h;for(;Object.getPrototypeOf(g)!==null;)g=Object.getPrototypeOf(g);return Object.getPrototypeOf(h)===g||Object.getPrototypeOf(h)===null}(m))throw new Error(ye(7));if(m.type===void 0)throw new Error(ye(8));if(typeof m.type!="string")throw new Error(ye(17));if(a)throw new Error(ye(9));try{a=!0,i=r(i,m)}finally{a=!1}return(o=l).forEach(h=>{h()}),m}return p({type:Qt.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(ye(10));r=m,p({type:Qt.REPLACE})},[Es]:function(){const m=f;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(ye(11));function g(){const v=h;v.next&&v.next(u())}return g(),{unsubscribe:m(g)}},[Es](){return this}}}}}function Ps(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const l=e[o];typeof t[l]=="function"&&(n[l]=t[l])}const r=Object.keys(n);let i;try{(function(o){Object.keys(o).forEach(l=>{const c=o[l];if(c(void 0,{type:Qt.INIT})===void 0)throw new Error(ye(12));if(c(void 0,{type:Qt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(ye(13))})})(n)}catch(o){i=o}return function(o={},l){if(i)throw i;let c=!1;const a={};for(let d=0;d<r.length;d++){const u=r[d],f=n[u],p=o[u],m=f(p,l);if(m===void 0)throw l&&l.type,new Error(ye(14));a[u]=m,c=c||m!==p}return c=c||r.length!==Object.keys(o).length,c?a:o}}const Ou=Ps({nodes:Ps({focus:function(t={id:null,treeFocused:!1},e){return e.type==="FOCUS"?Object.assign(Object.assign({},t),{id:e.id,treeFocused:!0}):e.type==="TREE_BLUR"?Object.assign(Object.assign({},t),{treeFocused:!1}):t},edit:function(t={id:null},e){return e.type==="EDIT"?Object.assign(Object.assign({},t),{id:e.id}):t},open:function(t={filtered:{},unfiltered:{}},e){return e.type.startsWith("VISIBILITY")?e.filtered?Object.assign(Object.assign({},t),{filtered:fo(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:fo(t.unfiltered,e)}):t},selection:function(t=Ze().nodes.selection,e){const n=t.ids;switch(e.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},t),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},t),{ids:new Set([e.id])});case"SELECTION_ADD":return e.ids.length===0?t:(e.ids.forEach(r=>n.add(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_REMOVE":return e.ids.length===0?t:(e.ids.forEach(r=>n.delete(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},t),{ids:e.ids,mostRecent:e.mostRecent,anchor:e.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},t),{mostRecent:e.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},t),{anchor:e.id});default:return t}},drag:function(t=Ze().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}}),dnd:function(t=Ze().dnd,e){switch(e.type){case"DND_CURSOR":return Object.assign(Object.assign({},t),{cursor:e.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},t),{dragId:e.id,dragIds:e.dragIds});case"DND_DRAG_END":return Ze().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),Eu=Ze();function Tu({treeProps:t,imperativeHandle:e,children:n}){const r=y.useRef(null),i=y.useRef(null),o=y.useRef(Ts(Ou,Ze(t))),l=jr.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>Eu),c=y.useMemo(()=>new wt(o.current,t,r,i),[]),a=y.useRef(0);return y.useMemo(()=>{a.current+=1,c.update(t)},[...Object.values(t),l.nodes.open]),y.useImperativeHandle(e,()=>c),y.useEffect(()=>{c.props.selection?c.select(c.props.selection,{focus:!1}):c.deselectAll()},[c.props.selection]),y.useEffect(()=>{c.props.searchTerm||o.current.dispatch(Tn.clear(!0))},[c.props.searchTerm]),s.jsx(Wi.Provider,{value:c,children:s.jsx(Xi.Provider,{value:a.current,children:s.jsx(Gi.Provider,{value:l.nodes,children:s.jsx(Yi.Provider,{value:l.dnd,children:s.jsx(Bd,Object.assign({backend:Iu,options:{rootElement:c.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Pu(t){return function(){const e=we(),[,n]=cs(()=>({accept:"NODE",canDrop:(r,i)=>!!i.isOver({shallow:!0})&&e.canDrop(),hover:(r,i)=>{if(!i.isOver({shallow:!0}))return;const o=i.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:l,drop:c}=ks({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});c&&e.dispatch(Je.hovering(c.parentId,c.index)),i.canDrop()?l&&e.showCursor(l):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function Ku(){const t=we().props.renderContainer||Is;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function _u(){const t=we(),{offset:e,mouse:n,item:r,isDragging:i}=(o=f=>({offset:f.getSourceClientOffset(),mouse:f.getClientOffset(),item:f.getItem(),isDragging:f.isDragging()}),l=He().getMonitor(),c=pu(is(l,o),2),a=c[0],d=c[1],y.useEffect(function(){return l.subscribeToOffsetChange(d)}),y.useEffect(function(){return l.subscribeToStateChange(d)}),a);var o,l,c,a,d;const u=t.props.renderDragPreview||vo;return s.jsx(u,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class Ks{constructor(e){this.root=function(n){const r=new _s({id:"ROOT"},null);return r.children=n.map(i=>ur(i,r)),r}(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;n&&r&&(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function ur(t,e){const n=new _s(t,e);return t.children&&(n.children=t.children.map(r=>ur(r,n))),n}class _s{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=ur(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let Mu=0;function Au(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
16
- Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=function(r){const[i,o]=y.useState(r),l=y.useMemo(()=>new Ks(i),[i]);return[i,{onMove:a=>{for(const d of a.dragIds)l.move({id:d,parentId:a.parentId,index:a.index});o(l.data)},onRename:({name:a,id:d})=>{l.update({id:d,changes:{name:a}}),o(l.data)},onCreate:({parentId:a,index:d,type:u})=>{const f={id:"simple-tree-id-"+Mu++,name:""};return u==="internal"&&(f.children=[]),l.create({parentId:a,index:d,data:f}),o(l.data),f},onDelete:a=>{a.ids.forEach(d=>l.drop({id:d})),o(l.data)}}]}(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}return t}const Ru=y.forwardRef(function(t,e){const n=Au(t);return s.jsxs(Tu,{treeProps:n,imperativeHandle:e,children:[s.jsx(Pu,{children:s.jsx(Ku,{})}),s.jsx(_u,{})]})});function Fu(t,e){const n=re.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,l=o!==void 0&&o,c=y.useRef(void 0);let a,d,u,f,p;return n[0]!==t?(a=()=>{c.current=t},d=[t],n[0]=t,n[1]=a,n[2]=d):(a=n[1],d=n[2]),y.useEffect(a,d),n[3]!==r||n[4]!==l||n[5]!==i?(u=()=>{if(r===null||l)return;const m=setInterval(()=>{var h;i&&document.visibilityState!=="visible"||((h=c.current)==null||h.call(c))},r);return()=>clearInterval(m)},f=[r,i,l],n[3]=r,n[4]=l,n[5]=i,n[6]=u,n[7]=f):(u=n[6],f=n[7]),y.useEffect(u,f),n[8]!==l||n[9]!==i?(p=()=>{var m;document.visibilityState==="visible"&&i&&!l&&((m=c.current)==null||m.call(c))},n[8]=l,n[9]=i,n[10]=p):p=n[10],kl(document,"visibilitychange",p),null}function Lu(){return["compact","medium","full","columns"]}const zu=t=>{const e=re.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),e[0]=n,e[1]=r):r=e[1],r},Zt=t=>{const e=re.c(10);let n,r,i,o,l;return e[0]!==t?({children:n,className:r,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]),e[4]!==r?(o=lt("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",r),e[4]=r,e[5]=o):o=e[5],e[6]!==n||e[7]!==i||e[8]!==o?(l=s.jsx("div",{...i,className:o,children:n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l},$u=t=>{const e=re.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r},Ms=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],Vu=()=>{const t=re.c(37),[e,n]=Cl(),{saveAppConfig:r}=qe(),i=y.useId(),o=y.useId();let l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=Kr(Il),t[0]=l):l=t[0],t[1]!==e?(c={resolver:l,defaultValues:e},t[1]=e,t[2]=c):c=t[2];const a=_r(c);let d;t[3]!==r||t[4]!==n?(d=async P=>{await r({config:P}).then(()=>{n(P)}).catch(()=>{n(P)})},t[3]=r,t[4]=n,t[5]=d):d=t[5];const u=d;let f;t[6]!==u?(f=P=>{u(P)},t[6]=u,t[7]=f):f=t[7];const p=Mr(f,100);let m,h,g,v,x,S,j,C,k,D,N;return t[8]!==e.width?(m=[e.width],t[8]=e.width,t[9]=m):m=t[9],y.useEffect(Bu,m),t[10]!==p||t[11]!==a?(h=a.handleSubmit(p),t[10]=p,t[11]=a,t[12]=h):h=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{children:[s.jsx(zu,{children:"Notebook Settings"}),s.jsx($u,{children:"Configure how your notebook or application looks and behaves."})]}),t[13]=g):g=t[13],t[14]!==a.control?(v=s.jsxs(Jt,{title:"Display",children:[s.jsx(q,{control:a.control,name:"width",render:Uu}),s.jsx(q,{control:a.control,name:"app_title",render:qu})]}),t[14]=a.control,t[15]=v):v=t[15],t[16]!==a.control?(x=s.jsxs(Jt,{title:"Custom Files",children:[s.jsx(q,{control:a.control,name:"css_file",render:Wu}),s.jsx(q,{control:a.control,name:"html_head_file",render:Gu})]}),t[16]=a.control,t[17]=x):x=t[17],t[18]!==a.control?(S=s.jsx(Jt,{title:"Data",children:s.jsx(q,{control:a.control,name:"sql_output",render:Xu})}),t[18]=a.control,t[19]=S):S=t[19],t[20]!==i||t[21]!==o?(j=P=>{const{field:O}=P;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:"flex flex-col gap-2",children:[s.jsx(G,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:i,"data-testid":"html-checkbox",checked:O.value.includes("html"),onCheckedChange:()=>{O.onChange(Nt(O.value,"html"))}}),s.jsx(U,{htmlFor:i,children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:o,"data-testid":"ipynb-checkbox",checked:O.value.includes("ipynb"),onCheckedChange:()=>{O.onChange(Nt(O.value,"ipynb"))}}),s.jsx(U,{htmlFor:o,children:"IPYNB"})]})]})}),s.jsx(X,{})]}),s.jsxs(J,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(he,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})},t[20]=i,t[21]=o,t[22]=j):j=t[22],t[23]!==a.control||t[24]!==j?(C=s.jsx(Jt,{title:"Exporting outputs",children:s.jsx(q,{control:a.control,name:"auto_download",render:j})}),t[23]=a.control,t[24]=j,t[25]=C):C=t[25],t[26]!==C||t[27]!==v||t[28]!==x||t[29]!==S?(k=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[v,x,S,C]}),t[26]=C,t[27]=v,t[28]=x,t[29]=S,t[30]=k):k=t[30],t[31]!==k||t[32]!==h?(D=s.jsxs("form",{onChange:h,className:"flex flex-col gap-6",children:[g,k]}),t[31]=k,t[32]=h,t[33]=D):D=t[33],t[34]!==a||t[35]!==D?(N=s.jsx(Ar,{...a,children:D}),t[34]=a,t[35]=D,t[36]=N):N=t[36],N},Jt=t=>{const e=re.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx("h3",{className:"text-base font-semibold mb-1",children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-y-2",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Bu(){window.dispatchEvent(new Event("resize"))}function Hu(t){return s.jsx("option",{value:t,children:t},t)}function Uu(t){const{field:e}=t;return s.jsxs(W,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(U,{children:"Width"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"app-width-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Hu)})}),s.jsx(X,{})]})}function qu(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(U,{children:"App title"}),s.jsx(G,{children:s.jsx(Fe,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),Rr.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(X,{})]}),s.jsx(J,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function Wu(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(U,{className:"shrink-0",children:"Custom CSS"}),s.jsx(G,{children:s.jsx(Fe,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),Rr.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(X,{})]}),s.jsx(J,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Gu(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(U,{className:"shrink-0",children:"HTML Head"}),s.jsx(G,{children:s.jsx(Fe,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(X,{})]}),s.jsxs(J,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(he,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function Yu(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Xu(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(U,{children:"SQL Output Type"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),We({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:Ms.map(Yu)})}),s.jsx(X,{})]}),s.jsxs(J,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(he,{className:"inline",children:"native"}),". See the"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}const Qu=Fr("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xs-solid hover:cursor-pointer active:shadow-none dark:border-border text-sm",{variants:{color:{gray:"mo-button gray",white:"mo-button white",green:"mo-button green",red:"mo-button red",yellow:"mo-button yellow","hint-green":"mo-button hint-green",disabled:"mo-button disabled active:shadow-xs-solid"},shape:{rectangle:"rounded",circle:"rounded-full"},size:{small:"",medium:""}},compoundVariants:[{size:"small",shape:"circle",class:"h-[24px] w-[24px] px-[5.5px] py-[5.5px]"},{size:"medium",shape:"circle",class:"px-2 py-2"},{size:"small",shape:"rectangle",class:"px-1 py-1 h-[24px] w-[24px]"},{size:"medium",shape:"rectangle",class:"px-3 py-2"}],defaultVariants:{color:"gray",size:"medium",shape:"rectangle"}}),Zu=Fr("font-mono w-full flex-1 inline-flex items-center justify-center rounded px-2.5 text-foreground/60 h-[36px] hover:shadow-md hover:cursor-pointer focus:shadow-md focus:outline-hidden text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),en=M.forwardRef((t,e)=>{const n=re.c(15);let r,i,o,l,c,a,d;return n[0]!==t?({color:i,shape:l,size:c,className:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=l,n[5]=c):(r=n[1],i=n[2],o=n[3],l=n[4],c=n[5]),n[6]!==r||n[7]!==i||n[8]!==l||n[9]!==c?(a=Lr(Qu({color:i,shape:l,size:c}),r),n[6]=r,n[7]=i,n[8]=l,n[9]=c,n[10]=a):a=n[10],n[11]!==o||n[12]!==e||n[13]!==a?(d=s.jsx("button",{ref:e,className:a,...o,children:o.children}),n[11]=o,n[12]=e,n[13]=a,n[14]=d):d=n[14],d});en.displayName="Button",M.forwardRef((t,e)=>{const n=re.c(9);let r,i,o,l;return n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]),n[3]!==r?(o=Lr(Zu(),r),n[3]=r,n[4]=o):o=n[4],n[5]!==i||n[6]!==e||n[7]!==o?(l=s.jsx("input",{ref:e,className:o,...i}),n[5]=i,n[6]=e,n[7]=o,n[8]=l):l=n[8],l}).displayName="Input";let tn=null;class Ju{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{tn=new WeakRef(this.view)},{signal:this.abortController.signal,capture:!0}),this.update()}update(){const e=this.view.dom.querySelector(".cm-vimCursorLayer");if(e instanceof HTMLElement)if(Nl())e.style.display="none";else{const n=(tn==null?void 0:tn.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const As={map:{args:["lhs","rhs"]},nmap:{mode:"normal",args:["lhs","rhs"]},vmap:{mode:"visual",args:["lhs","rhs"]},imap:{mode:"insert",args:["lhs","rhs"]},noremap:{args:["lhs","rhs"]},nnoremap:{mode:"normal",args:["lhs","rhs"]},vnoremap:{mode:"visual",args:["lhs","rhs"]},inoremap:{mode:"insert",args:["lhs","rhs"]},unmap:{args:["lhs"]},nunmap:{mode:"normal",args:["lhs"]},vunmap:{mode:"visual",args:["lhs"]},iunmap:{mode:"insert",args:["lhs"]},mapclear:{},nmapclear:{mode:"normal"},vmapclear:{mode:"visual"},imapclear:{mode:"insert"}};function eh(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in As){const o=As[r],l={};for(const a of o.args||[]){if(i+=1,!(i<n.length))return void(e&&e(`Not enough arguments for "${r}" command: "${t}"`));l[a]=n[i]}const c={name:r};return"args"in o&&(c.args=l),"mode"in o&&(c.mode=o.mode),c}e&&e(`Unknown vimrc command: "${t}"`)}var Rs;const th=Ge(()=>{ge.defineAction("goToDefinition",t=>{const e=t.cm6;return Tl(e)}),ge.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),ge.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(Dt).saveNotebook()})}),nh=Ge(async()=>{var n;const t=Et.get(Br),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{ue.log(`Loading vimrc from ${e}`);const r=(await Pl().sendFileDetails({path:e})).contents;if(!r)return void ue.error(`Failed to load vimrc from ${e}`);const i=function(o,l){const c=[];for(const a of o.split(`
17
- `)){if(a.startsWith('"')||a.trim()==="")continue;const d=eh(a,l);d&&c.push(d)}return c}(r,ue.warn);(function(o){function l(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ge.map(u.args.lhs,u.args.rhs,u.mode):ge.map(u.args.lhs,u.args.rhs):ue.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function c(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ge.noremap(u.args.lhs,u.args.rhs,u.mode):ge.noremap(u.args.lhs,u.args.rhs):ue.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function a(u){u.args&&u.args.lhs?u.mode?ge.unmap(u.args.lhs,u.mode):ge.unmap(u.args.lhs):ue.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function d(u){u.mode?ge.mapclear(u.mode):ge.mapclear()}for(const u of o)"map|nmap|vmap|imap".split("|").includes(u.name)?l(u):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(u.name)?c(u):"unmap|nunmap|vunmap|iunmap".split("|").includes(u.name)?a(u):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(u.name)?d(u):ue.warn(`Could not execute vimrc command "${u.name}: unknown command"`)})(i)}catch(r){ue.error("Failed to load vimrc:",r)}});class nn{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=Ot(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(fn("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):ue.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){fn("exitInsertMode"in ge,"Vim does not have an exitInsertMode method"),fn("exitVisualMode"in ge,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=Ot(i);if(!o){ue.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const l=o.setSelections.bind(o);if(o.setSelections=()=>[],!Fs(o)){ue.warn("Expected CodeMirror instance to have Vim state");continue}const c=o.state.vim;switch(n){case"normal":c.insertMode&&ge.exitInsertMode(o,!0),c.visualMode&&ge.exitVisualMode(o,!0);break;case"insert":c.insertMode||ge.handleKey(o,"i","")}o.setSelections=l}}}function Fs(t){return t.state.vim!==void 0}Rs=nn,nn.INSTANCES=new Rs;const rh=["default","vim"];function ih(t,e){switch(t.preset){case"default":return[Me.of(Ls()),Me.of(zs(e))];case"vim":return[Me.of(sh()),Me.of(zs(e)),Me.of([{key:"Enter",run:n=>{var i;const r=Ot(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ml(n)}}]),Hr.high(lh("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(Dt).deleteCell(),!0):!1)),_l({status:!1}),Hr.high((th(),nh(),[Me.of([{key:"j",run:n=>{if(Ol(n,!0)&&$r(n)){const r=n.state.facet(Dt),i=n.state.facet(Vr);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),Me.of([{key:"k",run:n=>{if(El(n)&&$r(n)){const r=n.state.facet(Dt),i=n.state.facet(Vr);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),Me.of([{linux:"Ctrl-[",win:"Ctrl-[",run:n=>{const r=Ot(n);return r?Fs(r)?!!r.state.vim.insertMode&&(ge.exitInsertMode(r,!0),!0):(ue.warn("Expected CodeMirror instance to have Vim state"),!1):(ue.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),zr.define(n=>(requestAnimationFrame(()=>{nn.INSTANCES.addInstance(n)}),{destroy(){nn.INSTANCES.removeInstance(n)}})),zr.define(n=>new Ju({view:n})),Dl.domEventHandlers({keydown:(n,r)=>!(!n.ctrlKey||n.key!=="Escape"||(r.dom.dispatchEvent(new KeyboardEvent(n.type,n)),0))})]))];default:return Kl(t.preset),[]}}const oh=new Set([Ur,qr]),Ls=Ge(()=>Al.filter(t=>!oh.has(t.run))),zs=t=>[{key:t.getHotkey("cell.toggleComment").key,run:Ur},{key:t.getHotkey("cell.toggleBlockComment").key,run:qr}],sh=Ge(()=>{const t=new Set(["Enter","Ctrl-v"]);return Ls().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function lh(t,e,n){let r="",i=0;return Me.of([{any:(o,l)=>{const c=l.key,a=l.timeStamp;return c!==t||!e(o)?(r="",i=0,!1):r===t&&a-i<500&&n(o)?(r="",i=0,!0):(r=c,i=a,!1)}}])}const hr=at(!1),ah=()=>{const t=re.c(82),[e,n]=ct(hr),[r,i]=y.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[l,c]=y.useState(o),[a,d]=Wr(),u=Tt(Rl),{saveUserConfig:f}=qe();let p,m;t[1]!==n?(p=()=>n(ch),t[1]=n,t[2]=p):p=t[2],Fl("global.showHelp",p),t[3]!==a||t[4]!==f||t[5]!==d?(m=async oe=>{const B={...a};d(oe),await f({config:oe}).catch(ne=>{throw d(B),ne})},t[3]=a,t[4]=f,t[5]=d,t[6]=m):m=t[6];const h=m;let g;t[7]!==a||t[8]!==r||t[9]!==h?(g=async oe=>{if(!r)return;const B=oe.join("-"),ne={...a,keymap:{...a.keymap,overrides:{...a.keymap.overrides,[r]:B}}};i(null),c([]),await h(ne)},t[7]=a,t[8]=r,t[9]=h,t[10]=g):g=t[10];const v=g;let x,S,j;if(t[11]!==a||t[12]!==r||t[13]!==v||t[14]!==u||t[15]!==e||t[16]!==l||t[17]!==h){j=Symbol.for("react.early_return_sentinel");{const oe=async()=>{if(!r)return;const ne={...a,keymap:{...a.keymap,overrides:{...a.keymap.overrides}}};delete ne.keymap.overrides[r],i(null),c([]),await h(ne)};let B;t[21]!==a||t[22]!==h?(B=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const ne={...a,keymap:{...a.keymap,overrides:{}}};i(null),c([]),await h(ne)},t[21]=a,t[22]=h,t[23]=B):B=t[23],x=B,e?S=ne=>{const ce=u.getHotkey(ne);if(r===ne){const Ee=Ll(ne);return s.jsxs("div",{children:[s.jsx(Fe,{defaultValue:l.join("+"),placeholder:ce.name,onKeyDown:de=>{de.preventDefault();const _e=[];if(de.key==="Meta"||de.key==="Control"||de.key==="Alt"||de.key==="Shift"||(de.metaKey&&_e.push(Yr()?"Cmd":"Meta"),de.ctrlKey&&_e.push("Ctrl"),de.altKey&&_e.push("Alt"),de.shiftKey&&_e.push("Shift"),de.key==="-"))return;if(de.key==="Escape"&&_e.length===0)return i(null),void c([]);let yr=de.key.toLowerCase();de.key===" "&&(yr="Space"),_e.push(yr),v(_e)},autoFocus:!0,endAdornment:s.jsx(Se,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),c([])},children:s.jsx(Pt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),Ee.key!==ce.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:oe,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:Ee.key})]})]})]},ne)}return s.jsxs("div",{className:"grid grid-cols-[auto_2fr_3fr] gap-2 items-center",children:[u.isEditable(ne)?s.jsx(Xr,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{c([]),i(ne)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Gr,{className:"justify-end",shortcut:ce.key}),s.jsx("span",{children:ce.name.toLowerCase()})]},ne)}:j=null}t[11]=a,t[12]=r,t[13]=v,t[14]=u,t[15]=e,t[16]=l,t[17]=h,t[18]=x,t[19]=S,t[20]=j}else x=t[18],S=t[19],j=t[20];if(j!==Symbol.for("react.early_return_sentinel"))return j;const C=S;let k,D,N,P,O,_,R,L,H,I,K,F,V,$,w,z,T,b,E,se,ae,Z,te,le,A;if(t[24]!==a.keymap.preset||t[25]!==u||t[26]!==e||t[27]!==C||t[28]!==n){const oe=u.getHotkeyGroups(),B=(ce,Ee)=>{const de=oe[ce];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:ce}),Ee]}),de.map(C)]})},ne=ce=>B(ce,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",a.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx(Gr,{shortcut:Yr()?"Cmd":"Ctrl"}),s.jsx(he,{children:"Esc"})]}):s.jsx(he,{children:"Esc"})," ","in a cell to enter command mode"]}));N=pn,V=e,t[47]!==n?($=ce=>n(ce),t[47]=n,t[48]=$):$=t[48],D=zl,K="sm:items-center sm:top-0",t[49]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx($l,{}),t[49]=F):F=t[49],k=Qr,L=!1,H="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[50]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Vl,{children:s.jsx(Zr,{children:"Shortcuts"})}),t[50]=I):I=t[50],_="flex flex-row gap-3",R=s.jsxs("div",{className:"w-1/2",children:[B("Editing"),B("Markdown")]}),w="w-1/2",z=B("Navigation"),T=B("Running Cells"),b=B("Creation and Ordering"),P=ne("Command"),O=B("Other"),t[24]=a.keymap.preset,t[25]=u,t[26]=e,t[27]=C,t[28]=n,t[29]=k,t[30]=D,t[31]=N,t[32]=P,t[33]=O,t[34]=_,t[35]=R,t[36]=L,t[37]=H,t[38]=I,t[39]=K,t[40]=F,t[41]=V,t[42]=$,t[43]=w,t[44]=z,t[45]=T,t[46]=b}else k=t[29],D=t[30],N=t[31],P=t[32],O=t[33],_=t[34],R=t[35],L=t[36],H=t[37],I=t[38],K=t[39],F=t[40],V=t[41],$=t[42],w=t[43],z=t[44],T=t[45],b=t[46];return t[51]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[51]=E):E=t[51],t[52]!==x?(se=s.jsx(Se,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:x,tabIndex:-1,children:E}),t[52]=x,t[53]=se):se=t[53],t[54]!==P||t[55]!==O||t[56]!==se||t[57]!==w||t[58]!==z||t[59]!==T||t[60]!==b?(ae=s.jsxs("div",{className:w,children:[z,T,b,P,O,se]}),t[54]=P,t[55]=O,t[56]=se,t[57]=w,t[58]=z,t[59]=T,t[60]=b,t[61]=ae):ae=t[61],t[62]!==_||t[63]!==R||t[64]!==ae?(Z=s.jsxs("div",{className:_,children:[R,ae]}),t[62]=_,t[63]=R,t[64]=ae,t[65]=Z):Z=t[65],t[66]!==k||t[67]!==L||t[68]!==H||t[69]!==I||t[70]!==Z?(te=s.jsxs(k,{usePortal:L,className:H,children:[I,Z]}),t[66]=k,t[67]=L,t[68]=H,t[69]=I,t[70]=Z,t[71]=te):te=t[71],t[72]!==D||t[73]!==K||t[74]!==F||t[75]!==te?(le=s.jsxs(D,{className:K,children:[F,te]}),t[72]=D,t[73]=K,t[74]=F,t[75]=te,t[76]=le):le=t[76],t[77]!==N||t[78]!==V||t[79]!==$||t[80]!==le?(A=s.jsx(N,{open:V,onOpenChange:$,children:le}),t[77]=N,t[78]=V,t[79]=$,t[80]=le,t[81]=A):A=t[81],A};function ch(t){return!t}var dh=Bl();const $s="marimo:copilot:signedIn",Vs=ql($s,null,void 0,{getOnInit:!0}),Bs=at(null),rn=at(null);function Hs(){const t=localStorage.getItem($s)==="true",e=Hl();return t&&e.completion.copilot==="github"}const Ie=ue.get("@github/copilot-language-server");class uh extends Wl{constructor(...e){super(...e),this.documentVersion=0,this.hasOpenedDocument=!1,this.getCompletionInternal=async(n,r)=>await this._request("textDocument/inlineCompletion",{...n,textDocument:{...n.textDocument,version:r}}),this.throttledGetCompletionInternal=function(n,r,i){var o=!0,l=!0;if(typeof n!="function")throw new TypeError("Expected a function");return nl(i)&&(o="leading"in i?!!i.leading:o,l="trailing"in i?!!i.trailing:l),rl(n,r,{leading:o,maxWait:r,trailing:l})}(this.getCompletionInternal,200)}async _request(e,n){try{return await this.request(e,n)}catch(r){throw Ie.error("#request: Error",r),r}}async notify(e,n){return Ie.debug("#notify",e,n),super.notify(e,n)}getInitializationOptions(){const e={name:"marimo",version:"0.1.0"};return{...super.getInitializationOptions(),workspaceFolders:[],capabilities:{workspace:{workspaceFolders:!1}},initializationOptions:{editorInfo:e,editorPluginInfo:e}}}isDisabled(){return!Hs()}async textDocumentDidOpen(e){return this.isDisabled()?e:(this.hasOpenedDocument=!0,super.textDocumentDidOpen(e))}async textDocumentCompletion(e){return[]}async textDocumentDidChange(e){if(this.isDisabled())return e;this.hasOpenedDocument||await this.textDocumentDidOpen({textDocument:{uri:e.textDocument.uri,languageId:"python",version:e.textDocument.version,text:e.contentChanges[0].text}});const n=e.contentChanges;n.length!==1&&Ie.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&Ie.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=Gl(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:Yl.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){Ie.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return Ie.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw Ie.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){Ie.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return Ie.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw Ie.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return Ie.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw Ie.warn("#signedIn: Failed to check sign-in status",e),e}}async getCompletion(e){if(this.isDisabled())return null;const n=this.documentVersion;if(e.textDocument.version=n,n===0)return null;var r;r=n,Et.set(rn,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,Et.get(rn)===o&&Et.set(rn,null),n!==this.documentVersion?null:i??null}}const Us="/__marimo_copilot__.py",qs=`file://${Us}`,hh=Ge(()=>new fh);class fh extends dh.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return Ql().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new Zl.WebSocketTransport(this.getWsUrl())),await this.delegate.connect(),void ue.log("Copilot#connect: Connected successfully")}catch(i){if(ue.warn(`Copilot#connect: Connection attempt ${r}/${e} failed`,i),r===e)throw this.delegate=void 0,We({variant:"danger",title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Please check settings and try again."}),i;await new Promise(o=>setTimeout(o,n))}}async connect(){return await Ul(Br,e=>e.completion.copilot==="github"),await Jl(),this.tryConnect()}close(){var e;(e=this.delegate)==null||e.close(),this.delegate=void 0}async sendData(e,n){var r;return n=Math.min(n??5e3,5e3),(r=this.delegate)==null?void 0:r.sendData(e,n)}}const yt=Ge(()=>new uh({rootUri:qs,workspaceFolders:null,transport:hh()}));function ph(){return Xl({documentUri:qs,client:yt(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const Ws=y.memo(()=>{const[t,e]=ct(Vs),[n,r]=ct(Bs),[i,o]=y.useState(),[l,c]=y.useState(!1),a=async f=>{f.preventDefault(),c(!0);try{const{verificationUri:p,status:m,userCode:h}=await async function(){return await yt().signInInitiate()}();Xs(m)?e(!0):(r("signingIn"),o({url:p,code:h}))}finally{c(!1)}},d=async f=>{if(f.preventDefault(),i){c(!0);try{const p=await async function(m){const h=yt();try{ue.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:g}=await h.signInConfirm({userCode:m});return Xs(g)?(ue.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(ue.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:g}),{success:!1})}catch(g){return Ys(g)?(ue.error("Copilot#tryFinishSignIn: Connection error during sign-in",g),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<Gs;x++)try{if(await new Promise(S=>setTimeout(S,gh)),await v.signedIn())return ue.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(S){if(ue.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:Gs}),Ys(S))return{success:!1,error:"connection"}}return ue.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(h)}}(i.code);p.success?(e(!0),r("signedIn")):p.error==="connection"?(r("connectionError"),We({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:s.jsx(Se,{onClick:a,children:"Retry"})})):r("signInFailed")}finally{c(!1)}}},u=async f=>{f.preventDefault(),await async function(){await yt().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(Kt,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return s.jsx(Se,{onClick:a,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return s.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[s.jsx("li",{children:s.jsxs("div",{className:"flex items-center",children:["Copy this code:",s.jsx("strong",{className:"ml-2",children:i==null?void 0:i.code}),s.jsx(ta,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await na(i.code),We({description:"Copied to clipboard"}))}})]})}),s.jsxs("li",{children:["Enter the code at this link:",s.jsx("a",{href:i==null?void 0:i.url,target:"_blank",rel:"noreferrer",className:ra({variant:"link",size:"xs"}),children:i==null?void 0:i.url})]}),s.jsxs("li",{children:["Click here when done:",s.jsxs(Se,{size:"xs",onClick:d,className:"ml-1",children:[l&&s.jsx(Jr,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),l?s.jsx(Jr,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(Se,{onClick:a,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return s.jsxs("div",{className:"flex items-center gap-5",children:[s.jsxs(Kt,{className:"font-normal flex items-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center bg-(--grass-7) rounded-full p-1 mr-2",children:s.jsx(ea,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(Se,{onClick:u,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(Kt,{className:"font-normal flex",children:[s.jsx(Pt,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),s.jsx("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),s.jsx(Se,{onClick:a,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(Kt,{className:"font-normal flex",children:[s.jsx(Pt,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(me,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});Ws.displayName="CopilotConfig";const Gs=5,gh=3e3;function Ys(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function Xs(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}const mh=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"],Qs=t=>{const e=re.c(12),{value:n,includeSuggestion:r}=t,i=r===void 0||r;if(!n||n.includes("/"))return null;let o;e[0]!==n?(o=_t.parse(n),e[0]=n,e[1]=o):o=e[1];const l=o.id;let c,a,d,u,f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("code",{className:"font-bold",children:"provider/model"}),e[2]=c):c=e[2],e[3]!==n?(a=s.jsxs("span",{children:["Model id should be in the form"," ",c,". ",n," is missing a provider."]}),e[3]=n,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("br",{}),e[5]=d):d=e[5],e[6]!==i||e[7]!==l?(u=i&&l&&s.jsxs("span",{children:["Did you mean ",s.jsx("code",{className:"font-bold",children:l}),"?"]}),e[6]=i,e[7]=l,e[8]=u):u=e[8],e[9]!==a||e[10]!==u?(f=s.jsxs(Mt,{kind:"danger",className:"mt-1",children:[a,d,u]}),e[9]=a,e[10]=u,e[11]=f):f=e[11],f};function Zs(t,e){const n=re.c(10);let r;n[0]!==e||n[1]!==t?(r=ei(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=Tt(ia);let l;n[3]!==e||n[4]!==o?(l=ei(o,e),n[3]=e,n[4]=o,n[5]=l):l=n[5];const c=l,a=c!=null&&i!==c;let d;return n[6]!==i||n[7]!==a||n[8]!==c?(d={isOverridden:a,currentValue:i,overriddenValue:c},n[6]=i,n[7]=a,n[8]=c,n[9]=d):d=n[9],d}const vh=t=>{const e=re.c(3),{name:n,children:r}=t,[i]=ti(),{isOverridden:o}=Zs(i,n);let l;return e[0]!==r||e[1]!==o?(l=o?s.jsx(Ye,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(he,{className:"inline mx-px",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(he,{className:"inline mx-px",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=l):l=e[2],l},ee=t=>{const e=re.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:l}=Zs(n,r);if(!i)return null;let c,a,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(he,{className:"inline",children:"pyproject.toml"}),"."]}),a=s.jsx("br",{}),e[0]=c,e[1]=a):(c=e[0],a=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("span",{children:["Edit the ",s.jsx(he,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),u=s.jsx("br",{}),e[2]=d,e[3]=u):(d=e[2],u=e[3]);const f=String(o);let p,m;e[4]!==f?(p=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:f})]}),e[4]=f,e[5]=p):p=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("br",{}),e[6]=m):m=e[6];const h=String(l);let g,v,x;e[7]!==h?(g=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:h})]}),e[7]=h,e[8]=g):g=e[8],e[9]!==p||e[10]!==g?(v=s.jsxs(s.Fragment,{children:[c,a,d,u,p,m,g]}),e[9]=p,e[10]=g,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(gi,{className:"w-3 h-3"}),e[12]=x):x=e[12];const S=String(l);let j,C;return e[13]!==S?(j=s.jsxs("span",{className:"text-(--amber-12) text-xs flex items-center gap-1 border rounded px-2 py-1 bg-(--amber-2) border-(--amber-6) ml-1",children:[x,"Overridden by pyproject.toml [",S,"]"]}),e[13]=S,e[14]=j):j=e[14],e[15]!==v||e[16]!==j?(C=s.jsx(Ye,{content:v,children:j}),e[15]=v,e[16]=j,e[17]=C):C=e[17],C},nt="flex flex-row items-center space-x-1 space-y-0",yh=t=>{const e=re.c(5),{provider:n,children:r}=t;let i,o;return e[0]!==n?(i=n&&s.jsx(li,{provider:n,className:"mr-2"}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex items-center text-base font-semibold",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},Ue=t=>{const e=re.c(10),{form:n,config:r,name:i,placeholder:o,testId:l,description:c}=t;let a,d;return e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o||e[4]!==l?(a=u=>{const{field:f}=u;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:nt,children:[s.jsx(U,{children:"API Key"}),s.jsx(G,{children:s.jsx(Fe,{"data-testid":l,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,...f,value:xt(f.value),onChange:p=>{const m=p.target.value;m.includes("*")||f.onChange(m)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:i})]}),c&&s.jsx(J,{children:c})]})},e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=l,e[5]=a):a=e[5],e[6]!==n.control||e[7]!==i||e[8]!==a?(d=s.jsx(q,{control:n.control,name:i,render:a}),e[6]=n.control,e[7]=i,e[8]=a,e[9]=d):d=e[9],d};function xt(t){if(t!=null)return typeof t=="string"?t:String(t)}const bt=t=>{const e=re.c(12),{form:n,config:r,name:i,placeholder:o,testId:l,description:c,disabled:a,defaultValue:d}=t,u=a!==void 0&&a;let f,p;return e[0]!==r||e[1]!==d||e[2]!==c||e[3]!==i||e[4]!==o||e[5]!==l?(f=m=>{const{field:h}=m;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:nt,children:[s.jsx(U,{children:"Base URL"}),s.jsx(G,{children:s.jsx(Fe,{"data-testid":l,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,defaultValue:d,...h,value:xt(h.value)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:i})]}),c&&s.jsx(J,{children:c})]})},e[0]=r,e[1]=d,e[2]=c,e[3]=i,e[4]=o,e[5]=l,e[6]=f):f=e[6],e[7]!==u||e[8]!==n.control||e[9]!==i||e[10]!==f?(p=s.jsx(q,{control:n.control,name:i,disabled:u,render:f}),e[7]=u,e[8]=n.control,e[9]=i,e[10]=f,e[11]=p):p=e[11],p},fr=t=>{const e=re.c(14),{form:n,config:r,name:i,placeholder:o,testId:l,description:c,disabled:a,label:d,onSubmit:u}=t,f=a!==void 0&&a;let p,m;return e[0]!==r||e[1]!==c||e[2]!==n||e[3]!==d||e[4]!==i||e[5]!==u||e[6]!==o||e[7]!==l?(p=h=>{const{field:g}=h,v=xt(g.value),x=S=>{g.onChange(S),u(n.getValues())};return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:nt,children:[s.jsx(U,{children:d}),s.jsx(G,{children:s.jsx(ha,{value:v,placeholder:o,onSelect:x,triggerClassName:"text-sm",customDropdownContent:s.jsxs(s.Fragment,{children:[s.jsx(fa,{}),s.jsxs("p",{className:"px-2 py-1.5 text-sm text-muted-secondary flex items-center gap-1",children:["Enter a custom model",s.jsx(Ye,{content:"Models should include the provider prefix, e.g. 'openai/gpt-4o'",children:s.jsx(pa,{className:"h-3 w-3"})})]}),s.jsxs("div",{className:"px-2 py-1",children:[s.jsx(Fe,{"data-testid":l,className:"w-full border-border shadow-none focus-visible:shadow-xs",placeholder:o,...g,value:xt(g.value),onKeyDown:si.stopPropagation()}),v&&s.jsx(Qs,{value:v,includeSuggestion:!1})]})]})})}),s.jsx(X,{})]}),s.jsx(ee,{userConfig:r,name:i}),s.jsx(Qs,{value:v}),c&&s.jsx(J,{children:c})]})},e[0]=r,e[1]=c,e[2]=n,e[3]=d,e[4]=i,e[5]=u,e[6]=o,e[7]=l,e[8]=p):p=e[8],e[9]!==f||e[10]!==n.control||e[11]!==i||e[12]!==p?(m=s.jsx(q,{control:n.control,name:i,disabled:f,render:p}),e[9]=f,e[10]=n.control,e[11]=i,e[12]=p,e[13]=m):m=e[13],m},xh=t=>{const e=re.c(10),{form:n,config:r,name:i,options:o,testId:l,disabled:c}=t,a=c!==void 0&&c;let d,u;return e[0]!==r||e[1]!==i||e[2]!==o||e[3]!==l?(d=f=>{const{field:p}=f;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(W,{className:nt,children:[s.jsx(U,{children:"Provider"}),s.jsx(G,{children:s.jsx(be,{"data-testid":l,onChange:m=>{m.target.value==="none"?p.onChange(!1):p.onChange(m.target.value)},value:xt(p.value===!0?"github":p.value===!1?"none":p.value),disabled:p.disabled,className:"inline-flex mr-2",children:o.map(Dh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:i})]})})},e[0]=r,e[1]=i,e[2]=o,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==n.control||e[7]!==i||e[8]!==d?(u=s.jsx(q,{control:n.control,name:i,disabled:a,render:d}),e[5]=a,e[6]=n.control,e[7]=i,e[8]=d,e[9]=u):u=e[9],u},on=t=>{const e=re.c(5),{children:n,className:r}=t;let i,o;return e[0]!==r?(i=lt("flex flex-col gap-4 pb-4",r),e[0]=r,e[1]=i):i=e[1],e[2]!==n||e[3]!==i?(o=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o},bh=t=>{const e=re.c(17),{qualifiedId:n,model:r,isEnabled:i,onToggle:o}=t;let l;e[0]!==o||e[1]!==n?(l=()=>{o(n)},e[0]=o,e[1]=n,e[2]=l):l=e[2];const c=l;let a,d,u,f;return e[3]!==r||e[4]!==n?(a=s.jsx(wh,{model:r,qualifiedId:n}),e[3]=r,e[4]=n,e[5]=a):a=e[5],e[6]!==c||e[7]!==i?(d=s.jsx(ga,{checked:i,onClick:c,size:"sm"}),e[6]=c,e[7]=i,e[8]=d):d=e[8],e[9]!==a||e[10]!==d?(u=s.jsx(Vi,{children:s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b last:border-b-0 cursor-pointer outline-none",children:[a,d]})}),e[9]=a,e[10]=d,e[11]=u):u=e[11],e[12]!==c||e[13]!==r.name||e[14]!==n||e[15]!==u?(f=s.jsx(Hi,{id:n,textValue:r.name,className:"pl-6 outline-none data-focused:bg-muted/50 hover:bg-muted/50",onAction:c,children:u}),e[12]=c,e[13]=r.name,e[14]=n,e[15]=u,e[16]=f):f=e[16],f},wh=t=>{const e=re.c(14),{model:n,qualifiedId:r}=t;let i,o,l,c,a;return e[0]!==n.name?(i=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("h3",{className:"font-medium",children:n.name})}),e[0]=n.name,e[1]=i):i=e[1],e[2]!==r?(o=s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:r}),e[2]=r,e[3]=o):o=e[3],e[4]!==n.custom||e[5]!==n.description?(l=n.description&&!n.custom&&s.jsx("p",{className:"text-sm text-muted-secondary mt-1 line-clamp-2",children:n.description}),e[4]=n.custom,e[5]=n.description,e[6]=l):l=e[6],e[7]!==n.thinking?(c=n.thinking&&s.jsxs("div",{className:lt("flex items-center gap-1 rounded px-1 py-0.5 w-fit mt-1.5",ma("thinking")),children:[s.jsx(ai,{className:"h-3 w-3"}),s.jsx("span",{className:"text-xs font-medium",children:"Reasoning"})]}),e[7]=n.thinking,e[8]=c):c=e[8],e[9]!==i||e[10]!==o||e[11]!==l||e[12]!==c?(a=s.jsx("div",{className:"flex items-center gap-3 flex-1",children:s.jsxs("div",{className:"flex flex-col flex-1",children:[i,o,l,c]})}),e[9]=i,e[10]=o,e[11]=l,e[12]=c,e[13]=a):a=e[13],a},Sh=t=>{const e=re.c(13),{form:n,config:r,onSubmit:i}=t;let o,l,c,a,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Zt,{children:"Code Completion"}),l=s.jsx("p",{className:"text-sm text-muted-secondary",children:"Choose GitHub Copilot, Codeium, or a custom provider (such as Ollama) to enable AI-powered code completion."}),e[0]=o,e[1]=l):(o=e[0],l=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["none","github","codeium","custom"],e[2]=c):c=e[2],e[3]!==r||e[4]!==n?(a=s.jsx(xh,{form:n,config:r,name:"completion.copilot",options:c,testId:"copilot-select"}),e[3]=r,e[4]=n,e[5]=a):a=e[5],e[6]!==r||e[7]!==n||e[8]!==i?(d=(({form:f,config:p,onSubmit:m})=>{const h=f.getValues("completion.copilot");return h===!1?null:h==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(Ue,{form:f,config:p,name:"completion.codeium_api_key",placeholder:"key",testId:"codeium-api-key-input"})]}):h==="github"?s.jsx(Ws,{}):h==="custom"?s.jsx(fr,{label:"Autocomplete Model",form:f,config:p,name:"ai.models.autocomplete_model",placeholder:"ollama/qwen2.5-coder:1.5b",testId:"custom-model-input",description:"Model to use for code completion when using a custom provider.",onSubmit:m}):void 0})({form:n,config:r,onSubmit:i}),e[6]=r,e[7]=n,e[8]=i,e[9]=d):d=e[9],e[10]!==a||e[11]!==d?(u=s.jsxs(on,{children:[o,l,a,d]}),e[10]=a,e[11]=d,e[12]=u):u=e[12],u},Le=t=>{const e=re.c(15),{title:n,triggerClassName:r,provider:i,children:o,isConfigured:l}=t;let c,a,d,u,f;return e[0]!==l?(c=l&&s.jsx("span",{className:"ml-2 px-1 rounded bg-muted text-xs font-medium border",children:"Configured"}),e[0]=l,e[1]=c):c=e[1],e[2]!==i||e[3]!==c||e[4]!==n?(a=s.jsxs(yh,{provider:i,children:[n,c]}),e[2]=i,e[3]=c,e[4]=n,e[5]=a):a=e[5],e[6]!==a||e[7]!==r?(d=s.jsx(va,{className:r,children:a}),e[6]=a,e[7]=r,e[8]=d):d=e[8],e[9]!==o?(u=s.jsx(ya,{wrapperClassName:"flex flex-col gap-4",children:o}),e[9]=o,e[10]=u):u=e[10],e[11]!==i||e[12]!==d||e[13]!==u?(f=s.jsxs(xa,{value:i,children:[d,u]}),e[11]=i,e[12]=d,e[13]=u,e[14]=f):f=e[14],f},jh=t=>{const e=re.c(88),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=$e(),e[0]=i):i=e[0];const o=i;let l;e[1]!==n?(l=Ee=>!!n.getValues(Ee),e[1]=n,e[2]=l):l=e[2];const c=l;let a,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(he,{className:"inline",children:"marimo.toml"}),e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add your API keys below or to ",a," ","to set up a provider for the Code Completion and Assistant features; see"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/ai_completion/#connecting-to-an-llm",children:"docs"})," ","for more info."]}),e[4]=d):d=e[4];const u=c("ai.open_ai.api_key");let f,p,m,h;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(s.Fragment,{children:["Your OpenAI API key from"," ",s.jsx(me,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]}),e[5]=f):f=e[5],e[6]!==r||e[7]!==n?(p=s.jsx(Ue,{form:n,config:r,name:"ai.open_ai.api_key",placeholder:"sk-proj...",testId:"ai-openai-api-key-input",description:f}),m=s.jsx(bt,{form:n,config:r,name:"ai.open_ai.base_url",placeholder:"https://api.openai.com/v1",testId:"ai-base-url-input",disabled:o}),e[6]=r,e[7]=n,e[8]=p,e[9]=m):(p=e[8],m=e[9]),e[10]!==u||e[11]!==p||e[12]!==m?(h=s.jsxs(Le,{title:"OpenAI",provider:"openai",triggerClassName:"pt-0",isConfigured:u,children:[p,m]}),e[10]=u,e[11]=p,e[12]=m,e[13]=h):h=e[13];const g=c("ai.anthropic.api_key");let v,x,S;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs(s.Fragment,{children:["Your Anthropic API key from"," ",s.jsx(me,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]}),e[14]=v):v=e[14],e[15]!==r||e[16]!==n?(x=s.jsx(Ue,{form:n,config:r,name:"ai.anthropic.api_key",placeholder:"sk-ant...",testId:"ai-anthropic-api-key-input",description:v}),e[15]=r,e[16]=n,e[17]=x):x=e[17],e[18]!==g||e[19]!==x?(S=s.jsx(Le,{title:"Anthropic",provider:"anthropic",isConfigured:g,children:x}),e[18]=g,e[19]=x,e[20]=S):S=e[20];const j=c("ai.google.api_key");let C,k,D;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsxs(s.Fragment,{children:["Your Google AI API key from"," ",s.jsx(me,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]}),e[21]=C):C=e[21],e[22]!==r||e[23]!==n?(k=s.jsx(Ue,{form:n,config:r,name:"ai.google.api_key",placeholder:"AI...",testId:"ai-google-api-key-input",description:C}),e[22]=r,e[23]=n,e[24]=k):k=e[24],e[25]!==j||e[26]!==k?(D=s.jsx(Le,{title:"Google",provider:"google",isConfigured:j,children:k}),e[25]=j,e[26]=k,e[27]=D):D=e[27];const N=c("ai.ollama.base_url");let P,O;e[28]!==r||e[29]!==n?(P=s.jsx(bt,{form:n,config:r,name:"ai.ollama.base_url",placeholder:"http://localhost:11434/v1",defaultValue:"http://localhost:11434/v1",testId:"ollama-base-url-input"}),e[28]=r,e[29]=n,e[30]=P):P=e[30],e[31]!==N||e[32]!==P?(O=s.jsx(Le,{title:"Ollama",provider:"ollama",isConfigured:N,children:P}),e[31]=N,e[32]=P,e[33]=O):O=e[33];const _=c("ai.github.api_key");let R,L,H,I;e[34]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(s.Fragment,{children:["Your GitHub API token from"," ",s.jsx(he,{className:"inline",children:"gh auth token"}),"."]}),e[34]=R):R=e[34],e[35]!==r||e[36]!==n?(L=s.jsx(Ue,{form:n,config:r,name:"ai.github.api_key",placeholder:"gho_...",testId:"ai-github-api-key-input",description:R}),H=s.jsx(bt,{form:n,config:r,name:"ai.github.base_url",placeholder:"https://api.githubcopilot.com/",testId:"ai-github-base-url-input"}),e[35]=r,e[36]=n,e[37]=L,e[38]=H):(L=e[37],H=e[38]),e[39]!==_||e[40]!==L||e[41]!==H?(I=s.jsxs(Le,{title:"GitHub",provider:"github",isConfigured:_,children:[L,H]}),e[39]=_,e[40]=L,e[41]=H,e[42]=I):I=e[42];const K=c("ai.azure.api_key")&&c("ai.azure.base_url");let F,V,$,w;e[43]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs(s.Fragment,{children:["Your Azure API key from"," ",s.jsx(me,{href:"https://portal.azure.com/",children:"portal.azure.com"}),"."]}),e[43]=F):F=e[43],e[44]!==r||e[45]!==n?(V=s.jsx(Ue,{form:n,config:r,name:"ai.azure.api_key",placeholder:"sk-proj...",testId:"ai-azure-api-key-input",description:F}),$=s.jsx(bt,{form:n,config:r,name:"ai.azure.base_url",placeholder:"https://<your-resource-name>.openai.azure.com",testId:"ai-azure-base-url-input"}),e[44]=r,e[45]=n,e[46]=V,e[47]=$):(V=e[46],$=e[47]),e[48]!==K||e[49]!==V||e[50]!==$?(w=s.jsxs(Le,{title:"Azure",provider:"azure",isConfigured:K,children:[V,$]}),e[48]=K,e[49]=V,e[50]=$,e[51]=w):w=e[51];const z=c("ai.bedrock.region_name");let T,b,E,se,ae,Z;e[52]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),e[52]=T):T=e[52],e[53]!==r?(b=Ee=>{const{field:de}=Ee;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:nt,children:[s.jsx(U,{children:"AWS Region"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"bedrock-region-select",onChange:_e=>de.onChange(_e.target.value),value:typeof de.value=="string"?de.value:"us-east-1",disabled:de.disabled,className:"inline-flex mr-2",children:mh.map(Oh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:"ai.bedrock.region_name"})]}),s.jsx(J,{children:"The AWS region where Bedrock service is available."})]})},e[53]=r,e[54]=b):b=e[54],e[55]!==n.control||e[56]!==b?(E=s.jsx(q,{control:n.control,disabled:o,name:"ai.bedrock.region_name",render:b}),e[55]=n.control,e[56]=b,e[57]=E):E=e[57],e[58]!==r?(se=Ee=>{const{field:de}=Ee;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:nt,children:[s.jsx(U,{children:"AWS Profile Name (Optional)"}),s.jsx(G,{children:s.jsx(Fe,{"data-testid":"bedrock-profile-input",rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:"default",...de,value:de.value||""})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:"ai.bedrock.profile_name"})]}),s.jsx(J,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})},e[58]=r,e[59]=se):se=e[59],e[60]!==n.control||e[61]!==se?(ae=s.jsx(q,{control:n.control,disabled:o,name:"ai.bedrock.profile_name",render:se}),e[60]=n.control,e[61]=se,e[62]=ae):ae=e[62],e[63]!==z||e[64]!==E||e[65]!==ae?(Z=s.jsxs(Le,{title:"AWS Bedrock",provider:"bedrock",isConfigured:z,children:[T,E,ae]}),e[63]=z,e[64]=E,e[65]=ae,e[66]=Z):Z=e[66];const te=c("ai.open_ai_compatible.api_key")&&c("ai.open_ai_compatible.base_url");let le,A,oe,B,ne,ce;return e[67]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx(s.Fragment,{children:"API key for any OpenAI-compatible provider (e.g., Together, Groq, Mistral, Perplexity, etc)."}),e[67]=le):le=e[67],e[68]!==r||e[69]!==n?(A=s.jsx(Ue,{form:n,config:r,name:"ai.open_ai_compatible.api_key",placeholder:"sk-...",testId:"ai-openai-compatible-api-key-input",description:le}),e[68]=r,e[69]=n,e[70]=A):A=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx(s.Fragment,{children:"Base URL for your OpenAI-compatible provider."}),e[71]=oe):oe=e[71],e[72]!==r||e[73]!==n?(B=s.jsx(bt,{form:n,config:r,name:"ai.open_ai_compatible.base_url",placeholder:"https://api.together.xyz/v1",testId:"ai-openai-compatible-base-url-input",description:oe}),e[72]=r,e[73]=n,e[74]=B):B=e[74],e[75]!==te||e[76]!==A||e[77]!==B?(ne=s.jsxs(Le,{title:"OpenAI-Compatible",provider:"openai-compatible",isConfigured:te,children:[A,B]}),e[75]=te,e[76]=A,e[77]=B,e[78]=ne):ne=e[78],e[79]!==S||e[80]!==D||e[81]!==O||e[82]!==I||e[83]!==w||e[84]!==Z||e[85]!==ne||e[86]!==h?(ce=s.jsxs(on,{children:[d,s.jsxs(la,{type:"multiple",children:[h,S,D,O,I,w,Z,ne]})]}),e[79]=S,e[80]=D,e[81]=O,e[82]=I,e[83]=w,e[84]=Z,e[85]=ne,e[86]=h,e[87]=ce):ce=e[87],ce},kh=t=>{const e=re.c(23),{form:n,config:r,onSubmit:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=$e(),e[0]=o):o=e[0];const l=o;let c,a,d,u,f,p,m,h,g,v;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Zt,{children:"AI Assistant"}),a=s.jsx(aa,{}),e[1]=c,e[2]=a):(c=e[1],a=e[2]),e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("span",{children:"Model to use for chat conversations in the Chat panel."}),e[3]=d):d=e[3],e[4]!==r||e[5]!==n||e[6]!==i?(u=s.jsx(fr,{label:"Chat Model",form:n,config:r,name:"ai.models.chat_model",placeholder:oi,testId:"ai-chat-model-input",disabled:l,description:d,onSubmit:i}),e[4]=r,e[5]=n,e[6]=i,e[7]=u):u=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs("span",{children:["Model to use for code editing with the"," ",s.jsx(he,{className:"inline",children:"Generate with AI"})," button."]}),e[8]=f):f=e[8],e[9]!==r||e[10]!==n||e[11]!==i?(p=s.jsx(fr,{label:"Edit Model",form:n,config:r,name:"ai.models.edit_model",placeholder:oi,testId:"ai-edit-model-input",disabled:l,description:f,onSubmit:i}),e[9]=r,e[10]=n,e[11]=i,e[12]=p):p=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("ul",{className:"bg-muted p-2 rounded-md list-disc space-y-1 pl-6",children:[s.jsx("li",{className:"text-xs text-muted-secondary",children:'Models should include the provider name and model name separated by a slash. For example, "anthropic/claude-3-5-sonnet-latest" or "google/gemini-2.0-flash-exp"'}),s.jsx("li",{className:"text-xs text-muted-secondary",children:"Depending on the provider, we will use the respective API key and additional configuration."})]}),e[13]=m):m=e[13],e[14]!==r?(h=x=>{const{field:S}=x;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(W,{children:[s.jsx(U,{children:"Custom Rules"}),s.jsx(G,{children:s.jsx(ca,{"data-testid":"ai-rules-input",className:"m-0 inline-flex w-full h-32 p-2 text-sm",placeholder:"e.g. Always use type hints; prefer polars over pandas",...S,value:S.value})}),s.jsx(X,{}),s.jsx(ee,{userConfig:r,name:"ai.rules"})]}),s.jsx(J,{children:"Custom rules to include in all AI completion prompts."})]})},e[14]=r,e[15]=h):h=e[15],e[16]!==n.control||e[17]!==h?(g=s.jsx(q,{control:n.control,name:"ai.rules",render:h}),e[16]=n.control,e[17]=h,e[18]=g):g=e[18],e[19]!==g||e[20]!==u||e[21]!==p?(v=s.jsxs(on,{children:[c,a,u,p,m,g]}),e[19]=g,e[20]=u,e[21]=p,e[22]=v):v=e[22],v},Ch=t=>{const e=re.c(49),{providerId:n,models:r,enabledModels:i,onToggleModel:o,onToggleProvider:l}=t;let c;if(e[0]!==i||e[1]!==r||e[2]!==n){let R;e[4]!==i||e[5]!==n?(R=L=>i.has(new _t(n,L.model).id),e[4]=i,e[5]=n,e[6]=R):R=e[6],c=r.filter(R),e[0]=i,e[1]=r,e[2]=n,e[3]=c}else c=e[3];const a=c.length,d=r.length;let u;e[7]!==n?(u=ii.getProviderInfo(n),e[7]=n,e[8]=u):u=e[8];const f=u;let p;e[9]!==(f==null?void 0:f.name)||e[10]!==n?(p=(f==null?void 0:f.name)||sa.startCase(n),e[9]=f==null?void 0:f.name,e[10]=n,e[11]=p):p=e[11];const m=p,h=a!==0&&(a===d||"indeterminate");let g;e[12]!==a||e[13]!==l||e[14]!==n||e[15]!==d?(g=()=>{l(n,a<d/2)},e[12]=a,e[13]=l,e[14]=n,e[15]=d,e[16]=g):g=e[16];const v=mn(g);let x,S,j,C,k,D,N,P,O,_;if(e[17]===Symbol.for("react.memo_cache_sentinel")?(x=si.stopPropagation(),e[17]=x):x=e[17],e[18]!==h||e[19]!==v?(S=s.jsx(fe,{checked:h,onCheckedChange:v,onClick:x}),e[18]=h,e[19]=v,e[20]=S):S=e[20],e[21]!==n?(j=s.jsx(li,{provider:n,className:"h-5 w-5"}),e[21]=n,e[22]=j):j=e[22],e[23]!==m?(C=s.jsx("h2",{className:"font-semibold",children:m}),e[23]=m,e[24]=C):C=e[24],e[25]!==a||e[26]!==d?(k=s.jsxs("p",{className:"text-sm text-muted-secondary",children:[a,"/",d," models"]}),e[25]=a,e[26]=d,e[27]=k):k=e[27],e[28]!==C||e[29]!==k?(D=s.jsxs("div",{className:"flex items-center justify-between w-full",children:[C,k]}),e[28]=C,e[29]=k,e[30]=D):D=e[30],e[31]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(da,{slot:"chevron",children:s.jsx(ua,{className:"h-4 w-4 text-muted-foreground shrink-0 transition-transform duration-200 group-data-[expanded]:rotate-90"})}),e[31]=N):N=e[31],e[32]!==D||e[33]!==S||e[34]!==j?(P=s.jsx(Vi,{children:s.jsxs("div",{className:"flex items-center gap-3 px-3 py-3 hover:bg-muted/50 cursor-pointer outline-none focus-visible:outline-none",children:[S,j,D,N]})}),e[32]=D,e[33]=S,e[34]=j,e[35]=P):P=e[35],e[36]!==i||e[37]!==r||e[38]!==o||e[39]!==n){let R;e[41]!==i||e[42]!==o||e[43]!==n?(R=L=>{const H=new _t(n,L.model).id;return s.jsx(bh,{qualifiedId:H,model:L,isEnabled:i.has(H),onToggle:o},H)},e[41]=i,e[42]=o,e[43]=n,e[44]=R):R=e[44],O=r.map(R),e[36]=i,e[37]=r,e[38]=o,e[39]=n,e[40]=O}else O=e[40];return e[45]!==n||e[46]!==P||e[47]!==O?(_=s.jsxs(Hi,{id:n,hasChildItems:!0,textValue:n,className:"outline-none data-focused:bg-muted/50 group",children:[P,O]}),e[45]=n,e[46]=P,e[47]=O,e[48]=_):_=e[48],_},Ih=({form:t,onSubmit:e})=>{const n=y.useMemo(()=>ii.create({displayedModels:[],customModels:["openrouter/deepseek-r1-distill-llama-70b"]}),[]),r=oa({control:t.control,name:"ai.models.displayed_models",defaultValue:[]}),i=new Set(r),o=n.getGroupedModelsByProvider(),l=mn(a=>{const d=i.has(a)?r.filter(u=>u!==a):[...r,a];t.setValue("ai.models.displayed_models",d),e(t.getValues())}),c=mn(async(a,d)=>{const u=o.get(a)||[],f=new Set(u.map(m=>new _t(a,m.model).id)),p=d?[...new Set([...r,...f])]:r.filter(m=>!f.has(m));t.setValue("ai.models.displayed_models",p),e(t.getValues())});return s.jsxs(on,{children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"Control which AI models are displayed in model selection dropdowns. When no models are selected, all available models will be shown."}),s.jsx("div",{className:"border rounded-md bg-background",children:s.jsx(Cc,{"aria-label":"AI Models by Provider",className:"flex-1 overflow-auto outline-none focus-visible:outline-none",selectionMode:"none",children:[...o.entries()].map(([a,d])=>s.jsx(Ch,{providerId:a,models:d,enabledModels:i,onToggleModel:l,onToggleProvider:c},a))})})]})},Nh=t=>{const e=re.c(17),{form:n,config:r,onSubmit:i}=t;let o,l,c,a,d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(ni,{className:"mb-2",children:[s.jsx(At,{value:"ai-features",children:"AI Features"}),s.jsx(At,{value:"ai-providers",children:"AI Providers"}),s.jsx(At,{value:"ai-models",children:"AI Models"})]}),e[0]=o):o=e[0],e[1]!==r||e[2]!==n||e[3]!==i?(l=s.jsxs(gn,{value:"ai-features",children:[s.jsx(Sh,{form:n,config:r,onSubmit:i}),s.jsx(kh,{form:n,config:r,onSubmit:i})]}),e[1]=r,e[2]=n,e[3]=i,e[4]=l):l=e[4],e[5]!==r||e[6]!==n||e[7]!==i?(c=s.jsx(gn,{value:"ai-providers",children:s.jsx(jh,{form:n,config:r,onSubmit:i})}),e[5]=r,e[6]=n,e[7]=i,e[8]=c):c=e[8],e[9]!==r||e[10]!==n||e[11]!==i?(a=s.jsx(gn,{value:"ai-models",children:s.jsx(Ih,{form:n,config:r,onSubmit:i})}),e[9]=r,e[10]=n,e[11]=i,e[12]=a):a=e[12],e[13]!==l||e[14]!==c||e[15]!==a?(d=s.jsxs(ri,{defaultValue:"ai-features",className:"flex-1",children:[o,l,c,a]}),e[13]=l,e[14]=c,e[15]=a,e[16]=d):d=e[16],d};function Dh(t){return s.jsx("option",{value:t,children:t},t)}function Oh(t){return s.jsx("option",{value:t,children:t},t)}const Js=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[$e()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];$e()||Js.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const Eh=()=>{const t=re.c(23),[e]=Wr(),n=e.package_management.manager,{getPackageList:r}=qe();let i,o;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1],t[2]!==n?(o=[n],t[2]=n,t[3]=o):o=t[3];const{data:l,error:c,refetch:a,isPending:d}=ba(i,o);if(d){let k;return t[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(di,{size:"medium",centered:!0}),t[4]=k):k=t[4],k}if(c){let k;return t[5]!==c?(k=s.jsx(Sa,{error:c}),t[5]=c,t[6]=k):k=t[6],k}let u;t[7]!==(l==null?void 0:l.packages)?(u=(l==null?void 0:l.packages)||[],t[7]=l==null?void 0:l.packages,t[8]=u):u=t[8];const f=u;let p;t[9]!==f?(p=new Set(f.map(Ph)),t[9]=f,t[10]=p):p=t[10];const m=p;let h,g,v,x,S,j,C;return t[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Zt,{children:"Optional Features"}),t[11]=h):h=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[12]=g):g=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ja,{children:s.jsxs(ci,{children:[s.jsx(Rt,{children:"Dependency"}),s.jsx(Rt,{children:"Feature"}),s.jsx(Rt,{children:"Status"}),s.jsx(Rt,{})]})}),t[13]=v):v=t[13],t[14]!==m||t[15]!==n||t[16]!==a?(x=Js.map(k=>{const D=k.packagesRequired.every(P=>m.has(P.name.split("[")[0])),N=k.packagesRequired.map(Kh).join(", ");return s.jsxs(ci,{className:"text-sm",children:[s.jsx(vn,{children:k.description}),s.jsx(vn,{className:"font-mono text-xs",children:N}),s.jsx(vn,{children:D?s.jsxs("div",{className:"flex items-center",children:[s.jsx(fi,{className:"h-4 w-4 text-(--grass-10) mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(wa,{className:"h-4 w-4 text-(--red-10) mr-2"}),s.jsx(Th,{packageSpecs:[...k.packagesRequired,...k.additionalPackageInstalls],packageManager:n,onSuccess:a})]})})]},k.id)}),t[14]=m,t[15]=n,t[16]=a,t[17]=x):x=t[17],t[18]!==x?(S=s.jsxs(ka,{children:[v,s.jsx(Ca,{children:x})]}),t[18]=x,t[19]=S):S=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[20]=j):j=t[20],t[21]!==S?(C=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[h,g,S,j]}),t[21]=S,t[22]=C):C=t[22],C},Th=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=M.useState(!1),{addPackage:o}=qe();return s.jsxs(Se,{size:"xs",variant:"outline",className:lt("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const l=t.map(a=>a.minVersion?`${a.name}>=${a.minVersion}`:a.name).join(" "),c=await o({package:l});c.success?(n(),We({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(he,{className:"inline",children:t.map(a=>a.name).join(", ")})," ","have been added to your environment."]})})):We({title:"Failed to install package",description:c.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(di,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(hi,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function Ph(t){return t.name}function Kh(t){return t.name}const ie="flex flex-row items-center space-x-1 space-y-0",el=[{id:"editor",label:"Editor",Icon:Xr,className:"bg-(--blue-4)"},{id:"display",label:"Display",Icon:Ga,className:"bg-(--grass-4)"},{id:"packageManagement",label:"Package Management",Icon:Ya,className:"bg-(--red-4)"},{id:"runtime",label:"Runtime",Icon:pi,className:"bg-(--amber-4)"},{id:"ai",label:"AI",Icon:ai,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:gi,className:"bg-(--orange-4)"},{id:"labs",label:"Labs",Icon:Ba,className:"bg-(--slate-4)"}],tl=at(el[0].id),_h=()=>{const t=re.c(47),[e,n]=ti(),r=y.useRef(null),i=yn(hr),[o,l]=ct(tl),c=Tt(Ia),a=Tt(Na),{saveUserConfig:d}=qe();let u,f;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=Kr(Da),t[0]=u):u=t[0],t[1]!==e?(f={resolver:u,defaultValues:e},t[1]=e,t[2]=f):f=t[2];const p=_r(f);let m;t[3]!==d||t[4]!==n?(m=async T=>{await d({config:T}).then(()=>{n(T)})},t[3]=d,t[4]=n,t[5]=m):m=t[5];const h=Mr(m,100);let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=$e(),t[6]=g):g=t[6];const v=g,x=y.useId(),S=y.useId();let j;t[7]!==o||t[8]!==c||t[9]!==e||t[10]!==p||t[11]!==x||t[12]!==S||t[13]!==h||t[14]!==l||t[15]!==i?(j=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(Ke,{title:"Autosave",children:[s.jsx(q,{control:p.control,name:"save.autosave",render:T=>{const{field:b}=T;return s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Autosave enabled"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"autosave-checkbox",checked:b.value==="after_delay",disabled:b.disabled,onCheckedChange:E=>{b.onChange(E?"after_delay":"off")}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(q,{control:p.control,name:"save.autosave_delay",render:T=>{const{field:b}=T;return s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Autosave delay (seconds)"}),s.jsx(G,{children:s.jsx(dt,{"aria-label":"Autosave delay","data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:p.getValues("save.autosave")!=="after_delay",...b,value:b.value/1e3,minValue:1,onChange:E=>{b.onChange(1e3*E),Number.isNaN(E)||h(p.getValues())}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"save.autosave_delay"})]})}}),s.jsx(q,{control:p.control,name:"runtime.default_auto_download",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Save cell outputs as"}),s.jsx(G,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:x,checked:Array.isArray(b.value)&&b.value.includes("html"),onCheckedChange:()=>{const E=Array.isArray(b.value)?b.value:[];b.onChange(Nt(E,"html"))}}),s.jsx(U,{htmlFor:x,children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(fe,{id:S,checked:Array.isArray(b.value)&&b.value.includes("ipynb"),onCheckedChange:()=>{const E=Array.isArray(b.value)?b.value:[];b.onChange(Nt(E,"ipynb"))}}),s.jsx(U,{htmlFor:S,children:"IPYNB"})]})]})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(J,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(he,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}})]}),s.jsxs(Ke,{title:"Formatting",children:[s.jsx(q,{control:p.control,name:"save.format_on_save",render:T=>{const{field:b}=T;return s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Format on save"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"format-on-save-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(q,{control:p.control,name:"formatting.line_length",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Line length"}),s.jsx(G,{children:s.jsx(dt,{"aria-label":"Line length","data-testid":"line-length-input",className:"m-0 w-24",...b,value:b.value,minValue:1,maxValue:1e3,onChange:E=>{b.onChange(E),Number.isNaN(E)||h(p.getValues())}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(J,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(Ke,{title:"Autocomplete",children:s.jsx(q,{control:p.control,name:"completion.activate_on_typing",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Autocomplete"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"autocomplete-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(J,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(Se,{variant:"link",className:"mb-0 px-0",type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),l("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(Ke,{title:"Language Servers",children:[s.jsxs(J,{children:["See the"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(J,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(q,{control:p.control,name:"language_servers.pylsp.enabled",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(W,{className:ie,children:[s.jsxs(U,{children:[s.jsx(Ft,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(me,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"pylsp-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),b.value&&!c.pylsp&&s.jsxs(Mt,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(he,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(q,{control:p.control,name:"language_servers.basedpyright.enabled",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(W,{className:ie,children:[s.jsxs(U,{children:[s.jsx(Ft,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(me,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"basedpyright-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),b.value&&!c.basedpyright&&s.jsxs(Mt,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(he,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(q,{control:p.control,name:"language_servers.ty.enabled",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(W,{className:ie,children:[s.jsxs(U,{children:[s.jsx(Ft,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(me,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"ty-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"language_servers.ty.enabled"})]}),b.value&&!c.ty&&s.jsxs(Mt,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(he,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(q,{control:p.control,name:"diagnostics.enabled",render:T=>{const{field:b}=T;return s.jsxs(W,{className:ie,children:[s.jsxs(U,{children:[s.jsx(Ft,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"diagnostics-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(Ke,{title:"Keymap",children:[s.jsx(q,{control:p.control,name:"keymap.preset",render:T=>{const{field:b}=T;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Keymap"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"keymap-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:rh.map(Mh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(q,{control:p.control,name:"keymap.destructive_delete",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Destructive delete"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"destructive-delete-checkbox",checked:b.value,disabled:b.disabled,onCheckedChange:E=>{b.onChange(!!E)}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(J,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Ye,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(Ta,{className:"w-3 h-3 text-(--amber-11)"})})]}),s.jsx("div",{children:s.jsx(Se,{variant:"link",className:"mb-0 px-0",type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(Ke,{title:"Display",children:[s.jsx(q,{control:p.control,name:"display.default_width",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Default width"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"user-config-width-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Ah)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.default_width"})]}),s.jsx(J,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(q,{control:p.control,name:"display.theme",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Theme"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"theme-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:Ea.map(Rh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.theme"})]}),s.jsx(J,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(q,{control:p.control,name:"display.code_editor_font_size",render:T=>{const{field:b}=T;return s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Code editor font size (px)"}),s.jsx(G,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(dt,{"aria-label":"Code editor font size","data-testid":"code-editor-font-size-input",className:"m-0 w-24",...b,value:b.value,minValue:8,maxValue:32,onChange:E=>{b.onChange(E),h(p.getValues())}})})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(q,{control:p.control,name:"display.reference_highlighting",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Reference highlighting"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"reference-highlighting-checkbox",checked:b.value,onCheckedChange:b.onChange})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(J,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(Ke,{title:"Outputs",children:[s.jsx(q,{control:p.control,name:"display.cell_output",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Cell output area"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"cell-output-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:["above","below"].map(Fh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.cell_output"})]}),s.jsx(J,{children:"Where to display cell's output."})]})}}),s.jsx(q,{control:p.control,name:"display.dataframes",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Dataframe viewer"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"display-dataframes-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(Lh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.dataframes"})]}),s.jsx(J,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(q,{control:p.control,name:"display.default_table_page_size",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Default table page size"}),s.jsx(G,{children:s.jsx(dt,{"aria-label":"Default table page size","data-testid":"default-table-page-size-input",className:"m-0 w-24",...b,value:b.value,minValue:1,step:1,onChange:E=>{b.onChange(E),Number.isNaN(E)||h(p.getValues())}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(J,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(q,{control:p.control,name:"display.default_table_max_columns",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Default table max columns"}),s.jsx(G,{children:s.jsx(dt,{"aria-label":"Default table max columns","data-testid":"default-table-max-columns-input",className:"m-0 w-24",...b,value:b.value,minValue:1,step:1,onChange:E=>{b.onChange(E),Number.isNaN(E)||h(p.getValues())}})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(J,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(Ke,{title:"Package Management",children:s.jsx(q,{control:p.control,disabled:v,name:"package_management.manager",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Manager"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"package-manager-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:Oa.map(zh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(J,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(he,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(Ke,{title:"Runtime configuration",children:[s.jsx(q,{control:p.control,name:"runtime.auto_instantiate",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Autorun on startup"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"auto-instantiate-checkbox",disabled:b.disabled,checked:b.value,onCheckedChange:b.onChange})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(J,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(q,{control:p.control,name:"runtime.on_cell_change",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"On cell change"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"on-cell-change-select",onChange:E=>b.onChange(E.target.value),value:b.value,className:"inline-flex mr-2",children:["lazy","autorun"].map($h)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(J,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(q,{control:p.control,name:"runtime.auto_reload",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"On module change"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"auto-reload-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:v,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(Vh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(J,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(q,{control:p.control,name:"runtime.default_sql_output",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{children:"Default SQL output"}),s.jsx(G,{children:s.jsx(be,{"data-testid":"user-config-sql-output-select",onChange:E=>b.onChange(E.target.value),value:b.value,disabled:b.disabled,className:"inline-flex mr-2",children:Ms.map(Bh)})}),s.jsx(X,{}),s.jsx(ee,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(J,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(q,{control:p.control,name:"runtime.reactive_tests",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"reactive-test-checkbox",checked:b.value,onCheckedChange:b.onChange})})]}),s.jsx(ee,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(X,{}),s.jsx(J,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(J,{children:["Learn more in the"," ",s.jsx(me,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsx(Nh,{form:p,config:e,onSubmit:h});case"optionalDeps":return s.jsx(Eh,{});case"labs":return s.jsxs(Ke,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(q,{control:p.control,name:"experimental.inline_ai_tooltip",render:Hh}),s.jsx(q,{control:p.control,name:"experimental.rtc_v2",render:Uh}),s.jsx(q,{control:p.control,name:"experimental.performant_table_charts",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"performant-table-charts-checkbox",checked:b.value===!0,onCheckedChange:b.onChange})})]}),s.jsx(ee,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(J,{children:"Enable experimental table charts which are computed on the backend."})]})}}),s.jsx(q,{control:p.control,name:"experimental.sql_linter",render:T=>{const{field:b}=T;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"SQL Linter"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"sql-linter-checkbox",checked:b.value===!0,onCheckedChange:b.onChange})})]}),s.jsx(ee,{userConfig:e,name:"experimental.sql_linter"}),s.jsx(J,{children:"Enable experimental SQL linting and autocompletion."})]})}})]})}},t[7]=o,t[8]=c,t[9]=e,t[10]=p,t[11]=x,t[12]=S,t[13]=h,t[14]=l,t[15]=i,t[16]=j):j=t[16];const C=j;let k,D,N;t[17]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(he,{className:"inline",children:"marimo.toml"}),D=s.jsx("br",{}),t[17]=k,t[18]=D):(k=t[17],D=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",k,D,"Run ",s.jsx(he,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[19]=N):N=t[19];const P=N;let O,_,R,L,H,I,K,F,V,$,w,z;return t[20]!==p||t[21]!==h?(O=p.handleSubmit(h),t[20]=p,t[21]=h,t[22]=O):O=t[22],t[23]!==l?(_=T=>l(T),t[23]=l,t[24]=_):_=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(R=el.map(qh),t[25]=R):R=t[25],t[26]!==a?(L=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",a]})}),t[26]=a,t[27]=L):L=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx("div",{className:"flex-1"}),I=!$e()&&P,t[28]=H,t[29]=I):(H=t[28],I=t[29]),t[30]!==L?(K=s.jsxs(ni,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[R,L,H,I]}),t[30]=L,t[31]=K):K=t[31],t[32]!==o||t[33]!==K||t[34]!==_?(F=s.jsx(ri,{value:o,onValueChange:_,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:K}),t[32]=o,t[33]=K,t[34]=_,t[35]=F):F=t[35],t[36]!==C?(V=C(),t[36]=C,t[37]=V):V=t[37],t[38]!==V?($=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:V}),t[38]=V,t[39]=$):$=t[39],t[40]!==F||t[41]!==$||t[42]!==O?(w=s.jsxs("form",{ref:r,onChange:O,className:"flex text-pretty overflow-hidden",children:[F,$]}),t[40]=F,t[41]=$,t[42]=O,t[43]=w):w=t[43],t[44]!==p||t[45]!==w?(z=s.jsx(Ar,{...p,children:w}),t[44]=p,t[45]=w,t[46]=z):z=t[46],z},Ke=t=>{const e=re.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Zt,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Mh(t){return s.jsx("option",{value:t,children:t},t)}function Ah(t){return s.jsx("option",{value:t,children:t},t)}function Rh(t){return s.jsx("option",{value:t,children:t},t)}function Fh(t){return s.jsx("option",{value:t,children:t},t)}function Lh(t){return s.jsx("option",{value:t,children:t},t)}function zh(t){return s.jsx("option",{value:t,children:t},t)}function $h(t){return s.jsx("option",{value:t,children:t},t)}function Vh(t){return s.jsx("option",{value:t,children:t},t)}function Bh(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function Hh(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(J,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function Uh(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(W,{className:ie,children:[s.jsx(U,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(G,{children:s.jsx(fe,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(J,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function qh(t){return s.jsx(At,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:lt(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const pr=at(!1);function Wh(){const t=re.c(5),e=yn(tl),n=yn(pr);let r;t[0]!==e||t[1]!==n?(r=l=>{e(l),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const Gh=t=>{const e=re.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,l=r!==void 0&&r,c=i===void 0?"Settings":i,[a,d]=ct(pr),u=l?"disabled":"hint-green";let f,p,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ui,{strokeWidth:1.8}),e[0]=f):f=e[0],e[1]!==c?(p=s.jsx(Ye,{content:c,children:f}),e[1]=c,e[2]=p):p=e[2],e[3]!==l||e[4]!==u||e[5]!==p?(m=s.jsx(en,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:l,color:u,children:p}),e[3]=l,e[4]=u,e[5]=p,e[6]=m):m=e[6];const h=m;let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs(Qr,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[s.jsx(Pa,{children:s.jsx(Zr,{children:"User settings"})}),s.jsx(_h,{})]}),e[7]=g):g=e[7];const v=g;if(!o){let _,R;return e[8]!==h?(_=s.jsx(Ka,{children:h}),e[8]=h,e[9]=_):_=e[9],e[10]!==d||e[11]!==a||e[12]!==_?(R=s.jsxs(pn,{open:a,onOpenChange:d,children:[_,v]}),e[10]=d,e[11]=a,e[12]=_,e[13]=R):R=e[13],R}let x,S,j,C,k,D,N,P,O;return e[14]!==h?(x=s.jsx(_a,{asChild:!0,children:h}),e[14]=h,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Vu,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=S,e[17]=j):(S=e[16],j=e[17]),e[18]!==d?(C=()=>d(!0),e[18]=d,e[19]=C):C=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ui,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=k):k=e[20],e[21]!==C?(D=s.jsxs(Ma,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Yh,children:[S,j,s.jsxs(Se,{onClick:C,variant:"link",className:"px-0",children:[k,"User settings"]})]}),e[21]=C,e[22]=D):D=e[22],e[23]!==D||e[24]!==x?(N=s.jsxs(Aa,{children:[x,D]}),e[23]=D,e[24]=x,e[25]=N):N=e[25],e[26]!==d||e[27]!==a?(P=s.jsx(pn,{open:a,onOpenChange:d,children:v}),e[26]=d,e[27]=a,e[28]=P):P=e[28],e[29]!==N||e[30]!==P?(O=s.jsxs(s.Fragment,{children:[N,P]}),e[29]=N,e[30]=P,e[31]=O):O=e[31],O};function Yh(t){return t.preventDefault()}const Xh=t=>{const e=re.c(15),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,l=i===void 0?"Shutdown":i,{openConfirm:c,closeModal:a}=Ra(),{sendShutdown:d}=qe();let u;e[0]!==d?(u=()=>{d(),setTimeout(Qh,200)},e[0]=d,e[1]=u):u=e[1];const f=u;if($e())return null;const p=o?"disabled":"red";let m,h,g,v;return e[2]!==a||e[3]!==n||e[4]!==f||e[5]!==c?(m=x=>{x.stopPropagation(),c({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(Fa,{onClick:()=>{f(),a()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=a,e[3]=n,e[4]=f,e[5]=c,e[6]=m):m=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Pt,{strokeWidth:1}),e[7]=h):h=e[7],e[8]!==o||e[9]!==p||e[10]!==m?(g=s.jsx(en,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:p,className:"h-[27px] w-[27px]",disabled:o,onClick:m,children:h}),e[8]=o,e[9]=p,e[10]=m,e[11]=g):g=e[11],e[12]!==g||e[13]!==l?(v=s.jsx(Ye,{content:l,children:g}),e[12]=g,e[13]=l,e[14]=v):v=e[14],v};function Qh(){window.close()}function Zh(t){window.open(La(`?file=${t}`).toString(),"_blank")}export{$a as A,Va as B,Gh as C,vh as D,Ua as G,ah as K,qa as L,Wa as M,Xa as P,Xh as S,Ru as T,Qa as Y,Ha as a,hi as b,en as c,ph as d,yt as e,Us as f,Lu as g,ih as h,Hs as i,Wh as j,hr as k,Vs as l,rn as m,Bs as n,Zh as o,pi as p,fi as q,Ks as r,pr as s,Fu as u};