@marimo-team/frontend 0.10.14-dev18 → 0.10.14-dev20

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 (92) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-DF_ksLUs.js → ConnectedDataExplorerComponent-CCtjwLOf.js} +1 -1
  2. package/dist/assets/{VegaLite-BBoIPtah.js → VegaLite-DNI_b4nX.js} +1 -1
  3. package/dist/assets/_baseEach-Dd7oGk6B.js +1 -0
  4. package/dist/assets/_baseMap-DTQpJdsE.js +1 -0
  5. package/dist/assets/{_baseUniq-C3ZCMAHg.js → _baseUniq-62wySGli.js} +1 -1
  6. package/dist/assets/{any-language-editor-BHnZXMrt.js → any-language-editor-C4Dyz7ma.js} +1 -1
  7. package/dist/assets/{architectureDiagram-IFBEXTG3-B7SlCqY_.js → architectureDiagram-IFBEXTG3-BDvCf3tD.js} +1 -1
  8. package/dist/assets/{blockDiagram-TCMKQVZ6-Xit3_Avc.js → blockDiagram-TCMKQVZ6-BRRH4xeu.js} +1 -1
  9. package/dist/assets/{c4Diagram-ZCSEYPFN-Ctvz_Cs5.js → c4Diagram-ZCSEYPFN-wNp2q18w.js} +1 -1
  10. package/dist/assets/channel-BUJJpeL2.js +1 -0
  11. package/dist/assets/{chunk-4LC2V6XN-Bh0BwbCd.js → chunk-4LC2V6XN-DhUVT_az.js} +1 -1
  12. package/dist/assets/{chunk-5RIWM3LS-CcDcJCO2.js → chunk-5RIWM3LS-C0bgUHxV.js} +1 -1
  13. package/dist/assets/{chunk-6JKP7OK7-D3EZD-uJ.js → chunk-6JKP7OK7-C5kQRXJb.js} +1 -1
  14. package/dist/assets/{chunk-NGC4727B-D035M01F.js → chunk-NGC4727B-CGllU8Pw.js} +1 -1
  15. package/dist/assets/{chunk-REEJFE46-DVpIaP39.js → chunk-REEJFE46-CufZI3a2.js} +1 -1
  16. package/dist/assets/{chunk-RYO7GUH3-bJhMzA-O.js → chunk-RYO7GUH3-U4yr-MTt.js} +1 -1
  17. package/dist/assets/{chunk-V35ELUW5-CWtImN_3.js → chunk-V35ELUW5-RFNh6H2a.js} +1 -1
  18. package/dist/assets/{classDiagram-Q73GJZWF-CMdrjVzD.js → classDiagram-Q73GJZWF-BhMVQTnX.js} +1 -1
  19. package/dist/assets/{classDiagram-v2-C6QPLPW4-CirOwqOP.js → classDiagram-v2-C6QPLPW4-DiAV6GTx.js} +1 -1
  20. package/dist/assets/clone-DB3DIEGo.js +1 -0
  21. package/dist/assets/{compile-DG-fGieP.js → compile-KKCufuSc.js} +1 -1
  22. package/dist/assets/createWsUrl-BbJIcZOS.js +1 -0
  23. package/dist/assets/{dagre-7KT5K2WU-C7KeVp1M.js → dagre-7KT5K2WU-DmWVaB_Y.js} +1 -1
  24. package/dist/assets/{data-editor-CRhDVqzu.js → data-editor-Djy_eP8F.js} +1 -1
  25. package/dist/assets/{diagram-AVGMFHF7-BAkYYaHm.js → diagram-AVGMFHF7-DvjfThgd.js} +1 -1
  26. package/dist/assets/{edit-page-BuRawKwc.js → edit-page-Drw22h8v.js} +4 -4
  27. package/dist/assets/{erDiagram-DKC2X5TE-BZKZ-VIj.js → erDiagram-DKC2X5TE-CQsI0UGB.js} +1 -1
  28. package/dist/assets/{flowDiagram-NWEUNK3L-B7TKTolM.js → flowDiagram-NWEUNK3L-B4VzVKUt.js} +1 -1
  29. package/dist/assets/{ganttDiagram-HLVPPPRE-Do7DtmV-.js → ganttDiagram-HLVPPPRE-BSSRGCbC.js} +1 -1
  30. package/dist/assets/{gitGraph-YCYPL57B-BD94MrDZ.js → gitGraph-YCYPL57B-DyoJw82I.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-JPZ3KUXI-DihxOzr8.js → gitGraphDiagram-JPZ3KUXI-bSpbqhqV.js} +1 -1
  32. package/dist/assets/{graph-CEuLxKwc.js → graph-C6REC5BJ.js} +1 -1
  33. package/dist/assets/{home-page-BtAEvCdG.js → home-page-C3MeQJ2V.js} +3 -3
  34. package/dist/assets/{index-C9yRAoDU.js → index-4XylTOiT.js} +1 -1
  35. package/dist/assets/{index-CMpdtWnx.js → index-A9gUFLam.js} +1 -1
  36. package/dist/assets/{index-CnlV3IQH.js → index-BERLeAKl.js} +1 -1
  37. package/dist/assets/{index-Bc1f--vB.js → index-BHfbaAhZ.js} +1 -1
  38. package/dist/assets/{index-Bm_F3bXs.js → index-Bj-sa9ub.js} +1 -1
  39. package/dist/assets/{index-SCcSzC0s.js → index-BsF6CoqS.js} +1 -1
  40. package/dist/assets/{index-DASGtz8e.js → index-BxaHqJpH.js} +5 -5
  41. package/dist/assets/{index-CAtBmvGF.js → index-C6AdyrW7.js} +1 -1
  42. package/dist/assets/{index-BsBeWGQP.js → index-CJgoyquc.js} +1 -1
  43. package/dist/assets/index-CiyYqgHW.css +1 -0
  44. package/dist/assets/{index-C5h_lw6w.js → index-CnufaNF1.js} +1 -1
  45. package/dist/assets/{index-B7hZsCev.js → index-D3SMqK1D.js} +1 -1
  46. package/dist/assets/{index-CVHVhK7W.js → index-DRRyvnI8.js} +1 -1
  47. package/dist/assets/{index-BeKWP0er.js → index-Dnjrjesq.js} +1 -1
  48. package/dist/assets/{index-D_QmFH0t.js → index-XcW7FJSw.js} +1 -1
  49. package/dist/assets/{index-DUzfUaN8.js → index-af0t78lI.js} +1 -1
  50. package/dist/assets/{index-BRyTvDtf.js → index-i1dfFvsl.js} +1 -1
  51. package/dist/assets/{index-C9TcZfHP.js → index-wPJs3p0F.js} +1 -1
  52. package/dist/assets/{infoDiagram-RZZSJVI2-CVEjtUuS.js → infoDiagram-RZZSJVI2-Dznzj5gc.js} +1 -1
  53. package/dist/assets/{journeyDiagram-BLD6N6MZ-BN156fQh.js → journeyDiagram-BLD6N6MZ-SHW0U8fK.js} +1 -1
  54. package/dist/assets/json-llhAW4dh.js +1 -0
  55. package/dist/assets/{layout-BilGI5J0.js → layout-CpgLBv0Y.js} +1 -1
  56. package/dist/assets/{linear-CpydTXKM.js → linear-DcS2-VQK.js} +1 -1
  57. package/dist/assets/{mermaid-DPd8KG8J.js → mermaid-BZAHYtJB.js} +3 -3
  58. package/dist/assets/min-B1WA1U4d.js +1 -0
  59. package/dist/assets/{mindmap-definition-OEB2RXX2-Bm3VGsC-.js → mindmap-definition-OEB2RXX2-DKc4XIaD.js} +1 -1
  60. package/dist/assets/{ordinal-DDUp3AbE.js → ordinal-BcaZTuz9.js} +1 -1
  61. package/dist/assets/{pieDiagram-X7YZ5ZEZ-8DOgiUmc.js → pieDiagram-X7YZ5ZEZ-HSqKDpag.js} +1 -1
  62. package/dist/assets/{quadrantDiagram-F36EZAVT-DAkEeG4A.js → quadrantDiagram-F36EZAVT-ehji2ZVu.js} +1 -1
  63. package/dist/assets/{react-plotly-CFGijGrf.js → react-plotly-C8aEowZo.js} +1 -1
  64. package/dist/assets/{requirementDiagram-JG2LMPGF-DpOs5Miu.js → requirementDiagram-JG2LMPGF-DXPvC90X.js} +1 -1
  65. package/dist/assets/run-page-zX89681u.js +1 -0
  66. package/dist/assets/{sankeyDiagram-ATFNWWW6-CkP1D1HO.js → sankeyDiagram-ATFNWWW6-YnJO1vpc.js} +1 -1
  67. package/dist/assets/{sequenceDiagram-WK7YDQ3N-Dswvevxm.js → sequenceDiagram-WK7YDQ3N-DjpwMfni.js} +1 -1
  68. package/dist/assets/{slides-component-4J79kqn7.js → slides-component-q4E-AgmS.js} +1 -1
  69. package/dist/assets/{sortBy-B5ZsT5ys.js → sortBy-VldpYeJV.js} +1 -1
  70. package/dist/assets/{stateDiagram-4JV6CC6H-CxclQw_O.js → stateDiagram-4JV6CC6H-DHpvvXyc.js} +1 -1
  71. package/dist/assets/stateDiagram-v2-7KT6RKTD-BK44GG8c.js +1 -0
  72. package/dist/assets/terminal-s6be-Xs3.js +1 -0
  73. package/dist/assets/{time-CLbitvEm.js → time-Bp1NTh2B.js} +1 -1
  74. package/dist/assets/{timeline-definition-3ZMEY6HS-BSSE2l6H.js → timeline-definition-3ZMEY6HS-PEOHOOX3.js} +1 -1
  75. package/dist/assets/{tree-ByEXTmA5.js → tree-kDlxkJYV.js} +3 -3
  76. package/dist/assets/{useMarimoWebSocket-BRMBsTTs.js → useMarimoWebSocket-hjFAWBWV.js} +5 -5
  77. package/dist/assets/{vega-component-BiqfirI4.js → vega-component-DXZ8bDOP.js} +1 -1
  78. package/dist/assets/{worker-CIUac72O.js → worker-Dw8OSzEJ.js} +1 -1
  79. package/dist/assets/{xychartDiagram-KECQ2H5Q-DnWpXrn8.js → xychartDiagram-KECQ2H5Q-CMhq9EqI.js} +1 -1
  80. package/dist/index.html +2 -2
  81. package/package.json +1 -1
  82. package/dist/assets/_baseEach-DG3rHrFD.js +0 -1
  83. package/dist/assets/_baseMap-BeiGpJe9.js +0 -1
  84. package/dist/assets/channel-D_jRiPxs.js +0 -1
  85. package/dist/assets/clone-B5LneqDU.js +0 -1
  86. package/dist/assets/feature-flag-KM9NqfOw.js +0 -1
  87. package/dist/assets/index-BfaV3xuw.css +0 -1
  88. package/dist/assets/json-BBh3wh28.js +0 -1
  89. package/dist/assets/min-D_W9AKur.js +0 -1
  90. package/dist/assets/run-page-DIQjJvtO.js +0 -1
  91. package/dist/assets/stateDiagram-v2-7KT6RKTD-DFj-HcKi.js +0 -1
  92. package/dist/assets/terminal-CgnM0a86.js +0 -1
@@ -1,14 +1,14 @@
1
- import{c9 as e,av as t,aF as n,dX as r,R as o,G as i,eN as s,O as a,bb as c,a7 as l,bh as u,dg as d,aB as f,eO as h,J as p,co as g,ag as m,aH as y,eA as v,dJ as b,ab as x,eP as w,eQ as T,aE as D,d7 as S,eR as j,eS as O,eT as R,eU as C,eV as k,eW as N,aa as P,eX as E,aL as I,b3 as _,dc as M,Z as q,e5 as A,a4 as L,a2 as F,a3 as H,eY as W,eZ as U,e_ as B,e$ as z,f0 as $,f1 as V,f2 as K,f3 as G,dq as J,er as Y,f4 as X,f5 as Z,f6 as Q,K as ee,aO as te,au as ne,f7 as re,aG as oe,f8 as ie,aA as se,dD as ae,ac as ce,f9 as le,b1 as ue,fa as de,fb as fe,fc as he,X as pe,fd as ge,fe as me,_ as ye,$ as ve,a0 as be,ff as xe,fg as we,fh as Te,fi as De,fj as Se,fk as je,fl as Oe,fm as Re,fn as Ce,fo as ke,fp as Ne,fq as Pe,b2 as Ee,fr as Ie,fs as _e,ft as Me,fu as qe,fv as Ae,fw as Le,d9 as Fe,fx as He,cc as We,fy as Ue,fz as Be,eh as ze,fA as $e,fB as Ve,fC as Ke,fD as Ge,Y as Je,fE as Ye,fF as Xe,fG as Ze,fH as Qe,fI as et}from"./index-DASGtz8e.js";import{i as tt,c as nt,r as rt,e as ot,m as it}from"./main-cdvIQCIX.js";import{r as st,g as at}from"./feature-flag-KM9NqfOw.js";import{e as ct}from"./index-C5h_lw6w.js";
1
+ import{c7 as e,as as t,aD as n,dV as r,R as o,G as i,eN as s,P as a,b9 as c,a9 as l,bf as u,de as d,az as f,eO as h,J as p,cm as g,ad as m,aF as y,eA as v,dH as b,eh as x,eP as w,eQ as T,aC as D,d5 as S,eR as O,eS as j,eT as R,eU as C,eV as k,eW as N,ax as P,eX as E,aJ as I,b1 as _,da as M,$ as q,e3 as A,a6 as L,a4 as F,a5 as H,eY as W,eZ as U,e_ as B,e$ as z,f0 as $,f1 as V,f2 as K,f3 as G,dn as J,er as Y,f4 as X,f5 as Z,f6 as Q,M as ee,aM as te,ar as ne,f7 as re,aE as oe,f8 as ie,ay as se,dB as ae,ei as ce,f9 as le,a$ as ue,fa as de,fb as fe,fc as he,Z as pe,fd as ge,fe as me,a0 as ye,a1 as ve,a2 as be,ff as xe,fg as we,fh as Te,fi as De,fj as Se,fk as Oe,fl as je,fm as Re,fn as Ce,fo as ke,fp as Ne,fq as Pe,b0 as Ee,fr as Ie,fs as _e,ft as Me,fu as qe,fv as Ae,fw as Le,d7 as Fe,fx as He,ca as We,fy as Ue,fz as Be,ef as ze,fA as $e,fB as Ve,fC as Ke,fD as Ge,_ as Je,fE as Ye,fF as Xe,fG as Ze,fH as Qe,fI as et}from"./index-BxaHqJpH.js";import{i as tt,c as nt,r as rt,e as ot,m as it}from"./main-cdvIQCIX.js";import{r as st}from"./createWsUrl-BbJIcZOS.js";import{e as at}from"./index-CnufaNF1.js";
2
2
  /**
3
3
  * @license lucide-react v0.428.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
- const lt=n("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"}]]),ut=n("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]),dt=n("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]),ft=n("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]),ht=n("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]),pt=n("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]),gt=n("Grid3x3",[["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"}]]),mt=n("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"}]]),yt=n("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["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"}]]),vt=n("PowerOff",[["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"}]]);
8
+ const ct=n("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"}]]),lt=n("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]),ut=n("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]),dt=n("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]),ft=n("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]),ht=n("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]),pt=n("Grid3x3",[["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"}]]),gt=n("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"}]]),mt=n("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["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"}]]),yt=n("PowerOff",[["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"}]]);
9
9
  /**
10
10
  * @license lucide-react v0.428.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
- */function bt(e,t){return(bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}const wt=r("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xsSolid 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"},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"}}),Tt=r("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-none text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),Dt=o.forwardRef(((e,t)=>{const n=i(15);let r,o,c,l,u,d,f;return n[0]!==e?(({color:r,shape:o,size:c,className:l,...u}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=c,n[4]=l,n[5]=u):(r=n[1],o=n[2],c=n[3],l=n[4],u=n[5]),n[6]!==r||n[7]!==o||n[8]!==c||n[9]!==l?(d=s(wt({color:r,shape:o,size:c}),l),n[6]=r,n[7]=o,n[8]=c,n[9]=l,n[10]=d):d=n[10],n[11]!==t||n[12]!==d||n[13]!==u?(f=a.jsx("button",{ref:t,className:d,...u,children:u.children}),n[11]=t,n[12]=d,n[13]=u,n[14]=f):f=n[14],f}));Dt.displayName="Button";o.forwardRef(((e,t)=>{const n=i(9);let r,o,c,l;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(c=s(Tt(),r),n[3]=r,n[4]=c):c=n[4],n[5]!==t||n[6]!==c||n[7]!==o?(l=a.jsx("input",{ref:t,className:c,...o}),n[5]=t,n[6]=c,n[7]=o,n[8]=l):l=n[8],l})).displayName="Input";const St=e=>{const t=i(7),{openConfirm:n,closeModal:r}=c(),o=Ot;if(l())return null;let s,h,p;return t[0]!==n||t[1]!==e.description||t[2]!==r?(s=t=>{t.stopPropagation(),n({title:"Shutdown",description:e.description,variant:"destructive",confirmAction:a.jsx(u,{onClick:e=>{o(),r()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},t[0]=n,t[1]=e.description,t[2]=r,t[3]=s):s=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(d,{strokeWidth:1}),t[4]=h):h=t[4],t[5]!==s?(p=a.jsx(f,{content:"Shutdown",children:a.jsx(Dt,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:"red",className:"h-[27px] w-[27px]",onClick:s,children:h})}),t[5]=s,t[6]=p):p=t[6],p};function jt(){window.close()}function Ot(){h(),setTimeout(jt,200)}function Rt(e,t){const n=i(11),{delayMs:r,whenVisible:o,disabled:s}=t,a=void 0!==s&&s,c=p.useRef();let l,u,d,f,h;return n[0]!==e?(l=()=>{c.current=e},u=[e],n[0]=e,n[1]=l,n[2]=u):(l=n[1],u=n[2]),p.useEffect(l,u),n[3]!==r||n[4]!==a||n[5]!==o?(d=()=>{if(null===r||a)return;const e=setInterval((()=>{var e;o&&"visible"!==document.visibilityState||null==(e=c.current)||e.call(c)}),r);return()=>clearInterval(e)},f=[r,o,a],n[3]=r,n[4]=a,n[5]=o,n[6]=d,n[7]=f):(d=n[6],f=n[7]),p.useEffect(d,f),n[8]!==o||n[9]!==a?(h=()=>{var e;"visible"===document.visibilityState&&o&&!a&&(null==(e=c.current)||e.call(c))},n[8]=o,n[9]=a,n[10]=h):h=n[10],g(document,"visibilitychange",h),null}const Ct=e=>{const t=i(2),{children:n}=e;let r;return t[0]!==n?(r=a.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),t[0]=n,t[1]=r):r=t[1],r},kt=e=>{const t=i(10);let n,r,o,s,c;return t[0]!==e?(({children:o,className:n,...r}=e),t[0]=e,t[1]=n,t[2]=r,t[3]=o):(n=t[1],r=t[2],o=t[3]),t[4]!==n?(s=m("text-sm font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",n),t[4]=n,t[5]=s):s=t[5],t[6]!==r||t[7]!==s||t[8]!==o?(c=a.jsx("div",{...r,className:s,children:o}),t[6]=r,t[7]=s,t[8]=o,t[9]=c):c=t[9],c},Nt=e=>{const t=i(2),{children:n}=e;let r;return t[0]!==n?(r=a.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1],r},Pt="marimo:copilot:signedIn",Et=y(Pt,null,void 0,{getOnInit:!0}),It=v(null);function _t(){const e="true"===localStorage.getItem(Pt),t=x();return e&&"github"===t.completion.copilot}var Mt,qt={},At={},Lt={exports:{}},Ft="object"==typeof Reflect?Reflect:null,Ht=Ft&&"function"==typeof Ft.apply?Ft.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};Mt=Ft&&"function"==typeof Ft.ownKeys?Ft.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Wt=Number.isNaN||function(e){return e!=e};function Ut(){Ut.init.call(this)}Lt.exports=Ut,Lt.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}Zt(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&Zt(e,"error",t,n)}(e,o,{once:!0})}))},Ut.EventEmitter=Ut,Ut.prototype._events=void 0,Ut.prototype._eventsCount=0,Ut.prototype._maxListeners=void 0;var Bt=10;function zt(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function $t(e){return void 0===e._maxListeners?Ut.defaultMaxListeners:e._maxListeners}function Vt(e,t,n,r){var o,i,s,a;if(zt(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=$t(e))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function Kt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Gt(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Kt.bind(r);return o.listener=n,r.wrapFn=o,o}function Jt(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):Xt(o,o.length)}function Yt(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function Xt(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Zt(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}Object.defineProperty(Ut,"defaultMaxListeners",{enumerable:!0,get:function(){return Bt},set:function(e){if("number"!=typeof e||e<0||Wt(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Bt=e}}),Ut.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ut.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Wt(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Ut.prototype.getMaxListeners=function(){return $t(this)},Ut.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[e];if(void 0===a)return!1;if("function"==typeof a)Ht(a,this,t);else{var c=a.length,l=Xt(a,c);for(n=0;n<c;++n)Ht(l[n],this,t)}return!0},Ut.prototype.addListener=function(e,t){return Vt(this,e,t,!1)},Ut.prototype.on=Ut.prototype.addListener,Ut.prototype.prependListener=function(e,t){return Vt(this,e,t,!0)},Ut.prototype.once=function(e,t){return zt(t),this.on(e,Gt(this,e,t)),this},Ut.prototype.prependOnceListener=function(e,t){return zt(t),this.prependListener(e,Gt(this,e,t)),this},Ut.prototype.removeListener=function(e,t){var n,r,o,i,s;if(zt(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},Ut.prototype.off=Ut.prototype.removeListener,Ut.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},Ut.prototype.listeners=function(e){return Jt(this,e,!0)},Ut.prototype.rawListeners=function(e){return Jt(this,e,!1)},Ut.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Yt.call(e,t)},Ut.prototype.listenerCount=Yt,Ut.prototype.eventNames=function(){return this._eventsCount>0?Mt(this._events):[]};var Qt=Lt.exports;!function(e){var t=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},n=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultNextRequest=void 0;var r=Qt;e.defaultNextRequest=function(){var e=-1;return function(){return++e}};var o=function(){function o(t,n){void 0===n&&(n=e.defaultNextRequest()),this.batch=[],this.batchStarted=!1,this.lastId=-1,this.transports=t,this.requests={},this.connectPromise=this.connect(),this.requestChannel=new r.EventEmitter,this.nextID=n}return o.prototype.connect=function(){var e=this;return Promise.all(this.transports.map((function(r){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return r.subscribe("error",this.handleError.bind(this)),r.subscribe("notification",this.handleNotification.bind(this)),[4,r.connect()];case 1:return e.sent(),[2]}}))}))})))},o.prototype.getPrimaryTransport=function(){return this.transports[0]},o.prototype.request=function(e,r,o){return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){var t,i,s,a=this;return n(this,(function(n){return t=this.nextID().toString(),i=r?null:t,s={request:this.makeRequest(e.method,e.params||[],i),internalID:t},this.batchStarted?[2,new Promise((function(e,t){a.batch.push({resolve:e,reject:t,request:s})}))]:[2,this.getPrimaryTransport().sendData(s,o)]}))}))},o.prototype.close=function(){this.requestChannel.removeAllListeners(),this.transports.forEach((function(e){e.unsubscribe(),e.close()}))},o.prototype.startBatch=function(){this.batchStarted=!0},o.prototype.stopBatch=function(){if(!1===this.batchStarted)throw new Error("cannot end that which has never started");0!==this.batch.length?(this.getPrimaryTransport().sendData(this.batch),this.batch=[],this.batchStarted=!1):this.batchStarted=!1},o.prototype.makeRequest=function(e,t,n){return n?{jsonrpc:"2.0",id:n,method:e,params:t}:{jsonrpc:"2.0",method:e,params:t}},o.prototype.handleError=function(e){this.requestChannel.emit("error",e)},o.prototype.handleNotification=function(e){this.requestChannel.emit("notification",e)},o}();e.default=o}(At);var en={},tn={},nn={},rn={};!function(e){var t=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.convertJSONToRPCError=e.JSONRPCError=e.ERR_UNKNOWN=e.ERR_MISSIING_ID=e.ERR_TIMEOUT=void 0,e.ERR_TIMEOUT=7777,e.ERR_MISSIING_ID=7878,e.ERR_UNKNOWN=7979;var n=function(e){function n(t,n,r){var o=this.constructor,i=e.call(this,t)||this;return i.message=t,i.code=n,i.data=r,Object.setPrototypeOf(i,o.prototype),i}return t(n,e),n}(Error);e.JSONRPCError=n,e.convertJSONToRPCError=function(t){if(t.error){var r=t.error,o=r.message,i=r.code,s=r.data;return new n(o,i,s)}return new n("Unknown error",e.ERR_UNKNOWN,t)}}(rn),Object.defineProperty(nn,"__esModule",{value:!0}),nn.TransportRequestManager=void 0;var on=Qt,sn=rn,an=function(){function e(){this.pendingRequest={},this.pendingBatchRequest={},this.transportEventChannel=new on.EventEmitter}return e.prototype.addRequest=function(e,t){return this.transportEventChannel.emit("pending",e),e instanceof Array?(this.addBatchReq(e,t),Promise.resolve()):this.addReq(e.internalID,t)},e.prototype.settlePendingRequest=function(e,t){var n=this;e.forEach((function(e){var r=n.pendingRequest[e.internalID];delete n.pendingBatchRequest[e.internalID],void 0!==r&&(t?r.reject(t):(r.resolve(),null!==e.request.id&&void 0!==e.request.id||delete n.pendingRequest[e.internalID]))}))},e.prototype.isPendingRequest=function(e){return this.pendingRequest.hasOwnProperty(e)},e.prototype.resolveResponse=function(e,t){void 0===t&&(t=!0);var n=e;try{if(n=JSON.parse(e),!1===this.checkJSONRPC(n))return;return n instanceof Array?this.resolveBatch(n,t):this.resolveRes(n,t)}catch(o){var r=new sn.JSONRPCError("Bad response format",sn.ERR_UNKNOWN,e);return t&&this.transportEventChannel.emit("error",r),r}},e.prototype.addBatchReq=function(e,t){var n=this;return e.forEach((function(e){var t=e.resolve,r=e.reject,o=e.request.internalID;n.pendingBatchRequest[o]=!0,n.pendingRequest[o]={resolve:t,reject:r}})),Promise.resolve()},e.prototype.addReq=function(e,t){var n=this;return new Promise((function(r,o){null!==t&&t&&n.setRequestTimeout(e,t,o),n.pendingRequest[e]={resolve:r,reject:o}}))},e.prototype.checkJSONRPC=function(e){var t=[e];return e instanceof Array&&(t=e),t.every((function(e){return void 0!==e.result||void 0!==e.error||void 0!==e.method}))},e.prototype.processResult=function(e,t){if(e.error){var n=sn.convertJSONToRPCError(e);t.reject(n)}else t.resolve(e.result)},e.prototype.resolveBatch=function(e,t){var n=this,r=e.map((function(e){return n.resolveRes(e,t)})).filter((function(e){return e}));if(r.length>0)return r[0]},e.prototype.resolveRes=function(e,t){var n,r=e.id,o=e.error,i=this.pendingRequest[r];return i?(delete this.pendingRequest[r],this.processResult(e,i),void this.transportEventChannel.emit("response",e)):void 0!==r||void 0!==o?(o&&(n=sn.convertJSONToRPCError(e)),t&&o&&n&&this.transportEventChannel.emit("error",n),n):void this.transportEventChannel.emit("notification",e)},e.prototype.setRequestTimeout=function(e,t,n){var r=this;setTimeout((function(){delete r.pendingRequest[e],n(new sn.JSONRPCError("Request timeout request took longer than "+t+" ms to resolve",sn.ERR_TIMEOUT))}),t)},e}();nn.TransportRequestManager=an,Object.defineProperty(tn,"__esModule",{value:!0});var cn=tn.Transport=void 0,ln=nn,un=function(){function e(){this.transportRequestManager=new ln.TransportRequestManager,this.transportRequestManager.transportEventChannel.on("error",(function(){}))}return e.prototype.subscribe=function(e,t){this.transportRequestManager.transportEventChannel.addListener(e,t)},e.prototype.unsubscribe=function(e,t){if(!e)return this.transportRequestManager.transportEventChannel.removeAllListeners();e&&t&&this.transportRequestManager.transportEventChannel.removeListener(e,t)},e.prototype.parseData=function(e){return e instanceof Array?e.map((function(e){return e.request.request})):e.request},e}();cn=tn.Transport=un;var dn,fn={};dn=fn,Object.defineProperty(dn,"__esModule",{value:!0}),dn.getNotifications=dn.getBatchRequests=dn.isNotification=void 0,dn.isNotification=function(e){return void 0===e.request.id||null===e.request.id},dn.getBatchRequests=function(e){return e instanceof Array?e.filter((function(e){var t=e.request.request.id;return null!=t})).map((function(e){return e.request})):[]},dn.getNotifications=function(e){return e instanceof Array?e.filter((function(e){return dn.isNotification(e.request)})).map((function(e){return e.request})):dn.isNotification(e)?[e]:[]};var hn=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(en,"__esModule",{value:!0});var pn=fn,gn=rn,mn=function(e){function t(t,n,r){var o=e.call(this)||this;return o.connection=t,o.reqUri=n,o.resUri=r,o}return hn(t,e),t.prototype.connect=function(){var e=this;return this.connection.on(this.resUri,(function(t){e.transportRequestManager.resolveResponse(t)})),Promise.resolve()},t.prototype.sendData=function(e,t){void 0===t&&(t=null);var n=this.transportRequestManager.addRequest(e,t),r=pn.getNotifications(e),o=this.parseData(e);try{return this.connection.emit(this.reqUri,o),this.transportRequestManager.settlePendingRequest(r),n}catch(s){var i=new gn.JSONRPCError(s.message,gn.ERR_UNKNOWN,s);return this.transportRequestManager.settlePendingRequest(r,i),Promise.reject(i)}},t.prototype.close=function(){this.connection.removeAllListeners()},t}(tn.Transport);en.default=mn;var yn={},vn="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},bn="URLSearchParams"in vn,xn="Symbol"in vn&&"iterator"in Symbol,wn="FileReader"in vn&&"Blob"in vn&&function(){try{return new Blob,!0}catch(e){return!1}}(),Tn="FormData"in vn,Dn="ArrayBuffer"in vn;if(Dn)var Sn=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],jn=ArrayBuffer.isView||function(e){return e&&Sn.indexOf(Object.prototype.toString.call(e))>-1};function On(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function Rn(e){return"string"!=typeof e&&(e=String(e)),e}function Cn(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return xn&&(t[Symbol.iterator]=function(){return t}),t}function kn(e){this.map={},e instanceof kn?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function Nn(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function Pn(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function En(e){var t=new FileReader,n=Pn(t);return t.readAsArrayBuffer(e),n}function In(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _n(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:wn&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:Tn&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:bn&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():Dn&&wn&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=In(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Dn&&(ArrayBuffer.prototype.isPrototypeOf(e)||jn(e))?this._bodyArrayBuffer=In(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):bn&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},wn&&(this.blob=function(){var e=Nn(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=Nn(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(wn)return this.blob().then(En);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,n,r,o,i=Nn(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=Pn(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),o=r?r[1]:"utf-8",t.readAsText(e,o),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Tn&&(this.formData=function(){return this.text().then(An)}),this.json=function(){return this.text().then(JSON.parse)},this}kn.prototype.append=function(e,t){e=On(e),t=Rn(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},kn.prototype.delete=function(e){delete this.map[On(e)]},kn.prototype.get=function(e){return e=On(e),this.has(e)?this.map[e]:null},kn.prototype.has=function(e){return this.map.hasOwnProperty(On(e))},kn.prototype.set=function(e,t){this.map[On(e)]=Rn(t)},kn.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},kn.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),Cn(e)},kn.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),Cn(e)},kn.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),Cn(e)},xn&&(kn.prototype[Symbol.iterator]=kn.prototype.entries);var Mn=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function qn(e,t){if(!(this instanceof qn))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,o=(t=t||{}).body;if(e instanceof qn){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new kn(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new kn(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),Mn.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in vn)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function An(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function Ln(e,t){if(!(this instanceof Ln))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new kn(t.headers),this.url=t.url||"",this._initBody(e)}qn.prototype.clone=function(){return new qn(this,{body:this._bodyInit})},_n.call(qn.prototype),_n.call(Ln.prototype),Ln.prototype.clone=function(){return new Ln(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new kn(this.headers),url:this.url})},Ln.error=function(){var e=new Ln(null,{status:200,statusText:""});return e.status=0,e.type="error",e};var Fn=[301,302,303,307,308];Ln.redirect=function(e,t){if(-1===Fn.indexOf(t))throw new RangeError("Invalid status code");return new Ln(null,{status:t,headers:{location:e}})};var Hn=vn.DOMException;try{new Hn}catch(rp){(Hn=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack}).prototype=Object.create(Error.prototype),Hn.prototype.constructor=Hn}function Wn(e,t){return new Promise((function(n,r){var o=new qn(e,t);if(o.signal&&o.signal.aborted)return r(new Hn("Aborted","AbortError"));var i=new XMLHttpRequest;function s(){i.abort()}if(i.onload=function(){var e,t,r={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",t=new kn,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();try{t.append(r,o)}catch(i){console.warn("Response "+i.message)}}})),t)};r.url="responseURL"in i?i.responseURL:r.headers.get("X-Request-URL");var o="response"in i?i.response:i.responseText;setTimeout((function(){n(new Ln(o,r))}),0)},i.onerror=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},i.ontimeout=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},i.onabort=function(){setTimeout((function(){r(new Hn("Aborted","AbortError"))}),0)},i.open(o.method,function(e){try{return""===e&&vn.location.href?vn.location.href:e}catch(t){return e}}(o.url),!0),"include"===o.credentials?i.withCredentials=!0:"omit"===o.credentials&&(i.withCredentials=!1),"responseType"in i&&(wn?i.responseType="blob":Dn&&(i.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof kn||vn.Headers&&t.headers instanceof vn.Headers)){var a=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){a.push(On(e)),i.setRequestHeader(e,Rn(t.headers[e]))})),o.headers.forEach((function(e,t){-1===a.indexOf(t)&&i.setRequestHeader(t,e)}))}else o.headers.forEach((function(e,t){i.setRequestHeader(t,e)}));o.signal&&(o.signal.addEventListener("abort",s),i.onreadystatechange=function(){4===i.readyState&&o.signal.removeEventListener("abort",s)}),i.send(void 0===o._bodyInit?null:o._bodyInit)}))}Wn.polyfill=!0,vn.fetch||(vn.fetch=Wn,vn.Headers=kn,vn.Request=qn,vn.Response=Ln);var Un=self.fetch.bind(self),Bn=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),zn=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},$n=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},Vn=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yn,"__esModule",{value:!0}),yn.HTTPTransport=void 0;var Kn=Vn(Un),Gn=fn,Jn=rn,Yn=function(e){function t(n,r){var o=e.call(this)||this;return o.onlyNotifications=function(e){return e instanceof Array?e.every((function(e){return null===e.request.request.id||void 0===e.request.request.id})):null===e.request.id||void 0===e.request.id},o.uri=n,o.credentials=r&&r.credentials,o.headers=t.setupHeaders(r&&r.headers),o.injectedFetcher=null==r?void 0:r.fetcher,o}return Bn(t,e),t.prototype.connect=function(){return Promise.resolve()},t.prototype.sendData=function(e,t){return void 0===t&&(t=null),zn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,l;return $n(this,(function(u){switch(u.label){case 0:n=this.transportRequestManager.addRequest(e,t),r=Gn.getNotifications(e),o=Gn.getBatchRequests(e),i=this.injectedFetcher||Kn.default,u.label=1;case 1:return u.trys.push([1,4,,5]),[4,i(this.uri,{method:"POST",headers:this.headers,body:JSON.stringify(this.parseData(e)),credentials:this.credentials})];case 2:return s=u.sent(),this.transportRequestManager.settlePendingRequest(r),this.onlyNotifications(e)?[2,Promise.resolve()]:[4,s.text()];case 3:return a=u.sent(),(l=this.transportRequestManager.resolveResponse(a))?(this.transportRequestManager.settlePendingRequest(o,l),[2,Promise.reject(l)]):[3,5];case 4:return c=u.sent(),l=new Jn.JSONRPCError(c.message,Jn.ERR_UNKNOWN,c),this.transportRequestManager.settlePendingRequest(r,l),this.transportRequestManager.settlePendingRequest(Gn.getBatchRequests(e),l),[2,Promise.reject(l)];case 5:return[2,n]}}))}))},t.prototype.close=function(){},t.setupHeaders=function(e){var t=new Headers(e);return t.set("Content-Type","application/json"),t},t}(tn.Transport);yn.HTTPTransport=Yn,yn.default=Yn;var Xn={},Zn=null;"undefined"!=typeof WebSocket?Zn=WebSocket:"undefined"!=typeof MozWebSocket?Zn=MozWebSocket:"undefined"!=typeof global?Zn=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window?Zn=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(Zn=self.WebSocket||self.MozWebSocket);const Qn=Zn,er=S(Object.freeze(Object.defineProperty({__proto__:null,default:Qn},Symbol.toStringTag,{value:"Module"})));var tr=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},rr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},or=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xn,"__esModule",{value:!0});var ir=or(er),sr=fn,ar=rn,cr=function(e){function t(t){var n=e.call(this)||this;return n.uri=t,n.connection=new ir.default(t),n}return tr(t,e),t.prototype.connect=function(){var e=this;return new Promise((function(t,n){var r=function(){e.connection.removeEventListener("open",r),t()};e.connection.addEventListener("open",r),e.connection.addEventListener("message",(function(t){var n=t.data;e.transportRequestManager.resolveResponse(n)}))}))},t.prototype.sendData=function(e,t){return void 0===t&&(t=5e3),nr(this,void 0,void 0,(function(){var n,r,o;return rr(this,(function(i){n=this.transportRequestManager.addRequest(e,t),r=sr.getNotifications(e);try{this.connection.send(JSON.stringify(this.parseData(e))),this.transportRequestManager.settlePendingRequest(r)}catch(rp){o=new ar.JSONRPCError(rp.message,ar.ERR_UNKNOWN,rp),this.transportRequestManager.settlePendingRequest(r,o),this.transportRequestManager.settlePendingRequest(sr.getBatchRequests(e),o),n=Promise.reject(o)}return[2,n]}))}))},t.prototype.close=function(){this.connection.close()},t}(tn.Transport);Xn.default=cr;var lr={},ur=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},fr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(lr,"__esModule",{value:!0});var hr=fn,pr=function(e){function t(t){var n=e.call(this)||this;return n.messageHandler=function(e){n.transportRequestManager.resolveResponse(JSON.stringify(e.data))},n.uri=t,n.postMessageID="post-message-transport-"+Math.random(),n}return ur(t,e),t.prototype.createWindow=function(e){return new Promise((function(t,n){var r,o,i;o=e,i=window.screen.height,r=window.open(o,"inspector:popup","left=0,top=0,width=400,height="+i+",resizable,scrollbars=yes,status=1"),setTimeout((function(){t(r)}),3e3)}))},t.prototype.connect=function(){var e=this,t=/^(http|https):\/\/.*$/;return new Promise((function(n,r){return dr(e,void 0,void 0,(function(){var e;return fr(this,(function(o){switch(o.label){case 0:return t.test(this.uri)||r(new Error("Bad URI")),e=this,[4,this.createWindow(this.uri)];case 1:return e.frame=o.sent(),window.addEventListener("message",this.messageHandler),n(),[2]}}))}))}))},t.prototype.sendData=function(e,t){return dr(this,void 0,void 0,(function(){var t,n;return fr(this,(function(r){return t=this.transportRequestManager.addRequest(e,null),n=hr.getNotifications(e),this.frame&&(this.frame.postMessage(e.request,this.uri),this.transportRequestManager.settlePendingRequest(n)),[2,t]}))}))},t.prototype.close=function(){this.frame&&(window.removeEventListener("message",this.messageHandler),this.frame.close())},t}(tn.Transport);lr.default=pr;var gr={},mr=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},vr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(gr,"__esModule",{value:!0});var br=fn,xr=function(e){function t(t){var n=e.call(this)||this;return n.messageHandler=function(e){n.transportRequestManager.resolveResponse(JSON.stringify(e.data))},n.uri=t,n.postMessageID="post-message-transport-"+Math.random(),n}return mr(t,e),t.prototype.createWindow=function(e){var t=this;return new Promise((function(n,r){var o,i=document.createElement("iframe");i.setAttribute("id",t.postMessageID),i.setAttribute("width","0px"),i.setAttribute("height","0px"),i.setAttribute("style","visiblity:hidden;border:none;outline:none;"),i.addEventListener("load",(function(){n(o)})),i.setAttribute("src",e),window.document.body.appendChild(i),o=i.contentWindow}))},t.prototype.connect=function(){var e=this,t=/^(http|https):\/\/.*$/;return new Promise((function(n,r){return yr(e,void 0,void 0,(function(){var e;return vr(this,(function(o){switch(o.label){case 0:return t.test(this.uri)||r(new Error("Bad URI")),e=this,[4,this.createWindow(this.uri)];case 1:return e.frame=o.sent(),window.addEventListener("message",this.messageHandler),n(),[2]}}))}))}))},t.prototype.sendData=function(e,t){return yr(this,void 0,void 0,(function(){var t,n;return vr(this,(function(r){return t=this.transportRequestManager.addRequest(e,null),n=br.getNotifications(e),this.frame&&(this.frame.postMessage(e.request,"*"),this.transportRequestManager.settlePendingRequest(n)),[2,t]}))}))},t.prototype.close=function(){var e=document.getElementById(this.postMessageID);null==e||e.remove(),window.removeEventListener("message",this.messageHandler)},t}(tn.Transport);gr.default=xr;var wr={},Tr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Dr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(wr,"__esModule",{value:!0});var Sr=function(){function e(e){this.requestManager=e}return e.prototype.startBatch=function(){return this.requestManager.startBatch()},e.prototype.stopBatch=function(){return this.requestManager.stopBatch()},e.prototype.request=function(e,t){return Tr(this,void 0,void 0,(function(){return Dr(this,(function(n){switch(n.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2,this.requestManager.request(e,!1,t)]}}))}))},e.prototype.notify=function(e){return Tr(this,void 0,void 0,(function(){return Dr(this,(function(t){switch(t.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2,this.requestManager.request(e,!0,null)]}}))}))},e.prototype.onNotification=function(e){this.requestManager.requestChannel.addListener("notification",e)},e.prototype.onError=function(e){this.requestManager.requestChannel.addListener("error",e)},e.prototype.close=function(){this.requestManager.close()},e}();wr.default=Sr,function(e){var t=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PostMessageIframeTransport=e.PostMessageWindowTransport=e.JSONRPCError=e.WebSocketTransport=e.EventEmitterTransport=e.HTTPTransport=e.RequestManager=e.Client=void 0;var n=t(At);e.RequestManager=n.default;var r=t(en);e.EventEmitterTransport=r.default;var o=t(yn);e.HTTPTransport=o.default;var i=t(Xn);e.WebSocketTransport=i.default;var s=t(lr);e.PostMessageWindowTransport=s.default;var a=t(gr);e.PostMessageIframeTransport=a.default;var c=rn;Object.defineProperty(e,"JSONRPCError",{enumerable:!0,get:function(){return c.JSONRPCError}});var l=t(wr);e.Client=l.default,e.default=l.default}(qt);var jr={},Or={},Rr={},Cr={},kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.Message=kr.NotificationType9=kr.NotificationType8=kr.NotificationType7=kr.NotificationType6=kr.NotificationType5=kr.NotificationType4=kr.NotificationType3=kr.NotificationType2=kr.NotificationType1=kr.NotificationType0=kr.NotificationType=kr.RequestType9=kr.RequestType8=kr.RequestType7=kr.RequestType6=kr.RequestType5=kr.RequestType4=kr.RequestType3=kr.RequestType2=kr.RequestType1=kr.RequestType=kr.RequestType0=kr.AbstractMessageSignature=kr.ParameterStructures=kr.ResponseError=kr.ErrorCodes=void 0;const Nr=tt;var Pr,Er,Ir,_r;(Er=Pr||(kr.ErrorCodes=Pr={})).ParseError=-32700,Er.InvalidRequest=-32600,Er.MethodNotFound=-32601,Er.InvalidParams=-32602,Er.InternalError=-32603,Er.jsonrpcReservedErrorRangeStart=-32099,Er.serverErrorStart=-32099,Er.MessageWriteError=-32099,Er.MessageReadError=-32098,Er.PendingResponseRejected=-32097,Er.ConnectionInactive=-32096,Er.ServerNotInitialized=-32002,Er.UnknownErrorCode=-32001,Er.jsonrpcReservedErrorRangeEnd=-32e3,Er.serverErrorEnd=-32e3;class Mr extends Error{constructor(e,t,n){super(t),this.code=Nr.number(e)?e:Pr.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,Mr.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}kr.ResponseError=Mr;class qr{constructor(e){this.kind=e}static is(e){return e===qr.auto||e===qr.byName||e===qr.byPosition}toString(){return this.kind}}kr.ParameterStructures=qr,qr.auto=new qr("auto"),qr.byPosition=new qr("byPosition"),qr.byName=new qr("byName");class Ar{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return qr.auto}}kr.AbstractMessageSignature=Ar;kr.RequestType0=class extends Ar{constructor(e){super(e,0)}};kr.RequestType=class extends Ar{constructor(e,t=qr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};kr.RequestType1=class extends Ar{constructor(e,t=qr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};kr.RequestType2=class extends Ar{constructor(e){super(e,2)}};kr.RequestType3=class extends Ar{constructor(e){super(e,3)}};kr.RequestType4=class extends Ar{constructor(e){super(e,4)}};kr.RequestType5=class extends Ar{constructor(e){super(e,5)}};kr.RequestType6=class extends Ar{constructor(e){super(e,6)}};kr.RequestType7=class extends Ar{constructor(e){super(e,7)}};kr.RequestType8=class extends Ar{constructor(e){super(e,8)}};kr.RequestType9=class extends Ar{constructor(e){super(e,9)}};kr.NotificationType=class extends Ar{constructor(e,t=qr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};kr.NotificationType0=class extends Ar{constructor(e){super(e,0)}};kr.NotificationType1=class extends Ar{constructor(e,t=qr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};kr.NotificationType2=class extends Ar{constructor(e){super(e,2)}};kr.NotificationType3=class extends Ar{constructor(e){super(e,3)}};kr.NotificationType4=class extends Ar{constructor(e){super(e,4)}};kr.NotificationType5=class extends Ar{constructor(e){super(e,5)}};kr.NotificationType6=class extends Ar{constructor(e){super(e,6)}};kr.NotificationType7=class extends Ar{constructor(e){super(e,7)}};kr.NotificationType8=class extends Ar{constructor(e){super(e,8)}};kr.NotificationType9=class extends Ar{constructor(e){super(e,9)}},(_r=Ir||(kr.Message=Ir={})).isRequest=function(e){const t=e;return t&&Nr.string(t.method)&&(Nr.string(t.id)||Nr.number(t.id))},_r.isNotification=function(e){const t=e;return t&&Nr.string(t.method)&&void 0===e.id},_r.isResponse=function(e){const t=e;return t&&(void 0!==t.result||!!t.error)&&(Nr.string(t.id)||Nr.number(t.id)||null===t.id)};var Lr,Fr,Hr,Wr={};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.LRUCache=Wr.LinkedMap=Wr.Touch=void 0,(Hr=Fr||(Wr.Touch=Fr={})).None=0,Hr.First=1,Hr.AsOld=Hr.First,Hr.Last=2,Hr.AsNew=Hr.Last;class Ur{constructor(){this[Lr]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return null==(e=this._head)?void 0:e.value}get last(){var e;return null==(e=this._tail)?void 0:e.value}has(e){return this._map.has(e)}get(e,t=Fr.None){const n=this._map.get(e);if(n)return t!==Fr.None&&this.touch(n,t),n.value}set(e,t,n=Fr.None){let r=this._map.get(e);if(r)r.value=t,n!==Fr.None&&this.touch(r,n);else{switch(r={key:e,value:t,next:void 0,previous:void 0},n){case Fr.None:this.addItemLast(r);break;case Fr.First:this.addItemFirst(r);break;case Fr.Last:default:this.addItemLast(r)}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const n=this._state;let r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(Lr=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(t===Fr.First||t===Fr.Last)if(t===Fr.First){if(e===this._head)return;const t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===Fr.Last){if(e===this._tail)return;const t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,n)=>{e.push([n,t])})),e}fromJSON(e){this.clear();for(const[t,n]of e)this.set(t,n)}}Wr.LinkedMap=Ur;Wr.LRUCache=class extends Ur{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=Fr.AsNew){return super.get(e,t)}peek(e){return super.get(e,Fr.None)}set(e,t){return super.set(e,t,Fr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};var Br,zr={};Object.defineProperty(zr,"__esModule",{value:!0}),zr.Disposable=void 0,(Br||(zr.Disposable=Br={})).create=function(e){return{dispose:e}};var $r={};Object.defineProperty($r,"__esModule",{value:!0}),$r.SharedArrayReceiverStrategy=$r.SharedArraySenderStrategy=void 0;const Vr=nt;var Kr,Gr;(Gr=Kr||(Kr={})).Continue=0,Gr.Cancelled=1;$r.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const t=new SharedArrayBuffer(4);new Int32Array(t,0,1)[0]=Kr.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){const n=this.buffers.get(t);if(void 0===n)return;const r=new Int32Array(n,0,1);Atomics.store(r,0,Kr.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class Jr{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Kr.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class Yr{constructor(e){this.token=new Jr(e)}cancel(){}dispose(){}}$r.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){const t=e.$cancellationData;return void 0===t?new Vr.CancellationTokenSource:new Yr(t)}};var Xr={},Zr={};Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Semaphore=void 0;const Qr=rt;Zr.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise(((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()}))}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,Qr.default)().timer.setImmediate((()=>this.doRunNext()))}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then((t=>{this._active--,e.resolve(t),this.runNext()}),(t=>{this._active--,e.reject(t),this.runNext()})):(this._active--,e.resolve(t),this.runNext())}catch(rp){this._active--,e.reject(rp),this.runNext()}}},Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.ReadableStreamMessageReader=Xr.AbstractMessageReader=Xr.MessageReader=void 0;const eo=rt,to=tt,no=ot,ro=Zr;var oo,io;(oo||(Xr.MessageReader=oo={})).is=function(e){let t=e;return t&&to.func(t.listen)&&to.func(t.dispose)&&to.func(t.onError)&&to.func(t.onClose)&&to.func(t.onPartialMessage)};class so{constructor(){this.errorEmitter=new no.Emitter,this.closeEmitter=new no.Emitter,this.partialMessageEmitter=new no.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${to.string(e.message)?e.message:"unknown"}`)}}Xr.AbstractMessageReader=so,(io||(io={})).fromOptions=function(e){let t,n;const r=new Map;let o;const i=new Map;if(void 0===e||"string"==typeof e)t=e??"utf-8";else{if(t=e.charset??"utf-8",void 0!==e.contentDecoder&&(n=e.contentDecoder,r.set(n.name,n)),void 0!==e.contentDecoders)for(const t of e.contentDecoders)r.set(t.name,t);if(void 0!==e.contentTypeDecoder&&(o=e.contentTypeDecoder,i.set(o.name,o)),void 0!==e.contentTypeDecoders)for(const t of e.contentTypeDecoders)i.set(t.name,t)}return void 0===o&&(o=(0,eo.default)().applicationJson.decoder,i.set(o.name,o)),{charset:t,contentDecoder:n,contentDecoders:r,contentTypeDecoder:o,contentTypeDecoders:i}};Xr.ReadableStreamMessageReader=class extends so{constructor(e,t){super(),this.readable=e,this.options=io.fromOptions(t),this.buffer=(0,eo.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new ro.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData((e=>{this.onData(e)}));return this.readable.onError((e=>this.fireError(e))),this.readable.onClose((()=>this.fireClose())),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const n=parseInt(t);if(isNaN(n))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=n}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock((async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)})).catch((e=>{this.fireError(e)}))}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,eo.default)().timer.setTimeout(((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())}),this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};var ao={};Object.defineProperty(ao,"__esModule",{value:!0}),ao.WriteableStreamMessageWriter=ao.AbstractMessageWriter=ao.MessageWriter=void 0;const co=rt,lo=tt,uo=Zr,fo=ot;var ho,po;(ho||(ao.MessageWriter=ho={})).is=function(e){let t=e;return t&&lo.func(t.dispose)&&lo.func(t.onClose)&&lo.func(t.onError)&&lo.func(t.write)};class go{constructor(){this.errorEmitter=new fo.Emitter,this.closeEmitter=new fo.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${lo.string(e.message)?e.message:"unknown"}`)}}ao.AbstractMessageWriter=go,(po||(po={})).fromOptions=function(e){return void 0===e||"string"==typeof e?{charset:e??"utf-8",contentTypeEncoder:(0,co.default)().applicationJson.encoder}:{charset:e.charset??"utf-8",contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,co.default)().applicationJson.encoder}};ao.WriteableStreamMessageWriter=class extends go{constructor(e,t){super(),this.writable=e,this.options=po.fromOptions(t),this.errorCount=0,this.writeSemaphore=new uo.Semaphore(1),this.writable.onError((e=>this.fireError(e))),this.writable.onClose((()=>this.fireClose()))}async write(e){return this.writeSemaphore.lock((async()=>this.options.contentTypeEncoder.encode(e,this.options).then((e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e)).then((t=>{const n=[];return n.push("Content-Length: ",t.byteLength.toString(),"\r\n"),n.push("\r\n"),this.doWrite(e,n,t)}),(e=>{throw this.fireError(e),e}))))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};var mo={};Object.defineProperty(mo,"__esModule",{value:!0}),mo.AbstractMessageBuffer=void 0;mo.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,n=0,r=0,o=0;e:for(;n<this._chunks.length;){const e=this._chunks[n];for(r=0;r<e.length;){switch(e[r]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,r++;break e;default:t=0}break;default:t=0}r++}o+=e.byteLength,n++}if(4!==t)return;const i=this._read(o+r),s=new Map,a=this.toString(i,"ascii").split("\r\n");if(a.length<2)return s;for(let c=0;c<a.length-2;c++){const t=a[c],n=t.indexOf(":");if(-1===n)throw new Error(`Message header must separate key and value using ':'\n${t}`);const r=t.substr(0,n),o=t.substr(n+1).trim();s.set(e?r.toLowerCase():r,o)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}const t=this.allocNative(e);let n=0;for(;e>0;){const r=this._chunks[0];if(r.byteLength>e){const o=r.slice(0,e);t.set(o,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}};var yo={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=rt,n=tt,r=kr,o=Wr,i=ot,s=nt;var a,c,l,u,d,f,h,p,g,m,y,v,b,x,w,T,D,S,j,O,R,C,k,N,P,E,I;(a||(a={})).type=new r.NotificationType("$/cancelRequest"),(c||(e.ProgressToken=c={})).is=function(e){return"string"==typeof e||"number"==typeof e},(l||(l={})).type=new r.NotificationType("$/progress");e.ProgressType=class{constructor(){}},(u||(u={})).is=function(e){return n.func(e)},e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(f=d||(e.Trace=d={}))[f.Off=0]="Off",f[f.Messages=1]="Messages",f[f.Compact=2]="Compact",f[f.Verbose=3]="Verbose",(p=h||(e.TraceValues=h={})).Off="off",p.Messages="messages",p.Compact="compact",p.Verbose="verbose",function(e){e.fromString=function(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(d||(e.Trace=d={})),(m=g||(e.TraceFormat=g={})).Text="text",m.JSON="json",function(e){e.fromString=function(t){return n.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(g||(e.TraceFormat=g={})),(y||(e.SetTraceNotification=y={})).type=new r.NotificationType("$/setTrace"),(v||(e.LogTraceNotification=v={})).type=new r.NotificationType("$/logTrace"),(x=b||(e.ConnectionErrors=b={}))[x.Closed=1]="Closed",x[x.Disposed=2]="Disposed",x[x.AlreadyListening=3]="AlreadyListening";class _ extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,_.prototype)}}e.ConnectionError=_,(w||(e.ConnectionStrategy=w={})).is=function(e){const t=e;return t&&n.func(t.cancelUndispatched)},(T||(e.IdCancellationReceiverStrategy=T={})).is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))},(D||(e.RequestCancellationReceiverStrategy=D={})).is=function(e){const t=e;return t&&"request"===t.kind&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))},(j=S||(e.CancellationReceiverStrategy=S={})).Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),j.is=function(e){return T.is(e)||D.is(e)},(R=O||(e.CancellationSenderStrategy=O={})).Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),R.is=function(e){const t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)},(k=C||(e.CancellationStrategy=C={})).Message=Object.freeze({receiver:S.Message,sender:O.Message}),k.is=function(e){const t=e;return t&&S.is(t.receiver)&&O.is(t.sender)},(N||(e.MessageStrategy=N={})).is=function(e){const t=e;return t&&n.func(t.handleMessage)},(P||(e.ConnectionOptions=P={})).is=function(e){const t=e;return t&&(C.is(t.cancellationStrategy)||w.is(t.connectionStrategy)||N.is(t.messageStrategy))},(I=E||(E={}))[I.New=1]="New",I[I.Listening=2]="Listening",I[I.Closed=3]="Closed",I[I.Disposed=4]="Disposed",e.createMessageConnection=function(f,h,p,m){const x=void 0!==p?p:e.NullLogger;let w=0,D=0,S=0;const j="2.0";let O;const R=new Map;let k;const P=new Map,I=new Map;let M,q,A=new o.LinkedMap,L=new Map,F=new Set,H=new Map,W=d.Off,U=g.Text,B=E.New;const z=new i.Emitter,$=new i.Emitter,V=new i.Emitter,K=new i.Emitter,G=new i.Emitter,J=m&&m.cancellationStrategy?m.cancellationStrategy:C.Message;function Y(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function X(e,t){var n;r.Message.isRequest(t)?e.set(Y(t.id),t):r.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++S).toString():"res-"+n.toString(),t):e.set("not-"+(++D).toString(),t)}function Z(e){}function Q(){return B===E.Listening}function ee(){return B===E.Closed}function te(){return B===E.Disposed}function ne(){B!==E.New&&B!==E.Listening||(B=E.Closed,$.fire(void 0))}function re(){M||0===A.size||(M=(0,t.default)().timer.setImmediate((()=>{M=void 0,function(){if(0===A.size)return;const e=A.shift();try{const t=null==m?void 0:m.messageStrategy;N.is(t)?t.handleMessage(e,oe):oe(e)}finally{re()}}()})))}function oe(e){r.Message.isRequest(e)?function(e){if(te())return;function t(t,n,o){const i={jsonrpc:j,id:e.id};t instanceof r.ResponseError?i.error=t.toJson():i.result=void 0===t?null:t,ae(i,n,o),h.write(i).catch((()=>x.error("Sending response failed.")))}function o(t,n,r){const o={jsonrpc:j,id:e.id,error:t.toJson()};ae(o,n,r),h.write(o).catch((()=>x.error("Sending response failed.")))}function i(t,n,r){void 0===t&&(t=null);const o={jsonrpc:j,id:e.id,result:t};ae(o,n,r),h.write(o).catch((()=>x.error("Sending response failed.")))}!function(e){if(W===d.Off||!q)return;if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),q.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const s=R.get(e.method);let a,c;s&&(a=s.type,c=s.handler);const l=Date.now();if(c||O){const s=e.id??String(Date.now()),d=T.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&F.has(e.id)&&d.cancel(),null!==e.id&&H.set(s,d);try{let u;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);u=c(d.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byName)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);u=c(...e.params,d.token)}else{if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byPosition)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);u=c(e.params,d.token)}else O&&(u=O(e.method,e.params,d.token));const f=u;u?f.then?f.then((n=>{H.delete(s),t(n,e.method,l)}),(t=>{H.delete(s),t instanceof r.ResponseError?o(t,e.method,l):t&&n.string(t.message)?o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)})):(H.delete(s),t(u,e.method,l)):(H.delete(s),i(u,e.method,l))}catch(u){H.delete(s),u instanceof r.ResponseError?t(u,e.method,l):u&&n.string(u.message)?o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${u.message}`),e.method,l):o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else o(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):r.Message.isNotification(e)?function(e){if(te())return;let t,n;if(e.method===a.type.method){const t=e.params.id;return F.delete(t),void ce(e)}{const r=P.get(e.method);r&&(n=r.handler,t=r.type)}if(n||k)try{if(ce(e),n)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){const o=e.params;e.method===l.type.method&&2===o.length&&c.is(o[0])?n({token:o[0],value:o[1]}):(void 0!==t&&(t.parameterStructures===r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${o.length} arguments`)),n(...o))}else void 0!==t&&t.parameterStructures===r.ParameterStructures.byPosition&&x.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else k&&k(e.method,e.params)}catch(o){o.message?x.error(`Notification handler '${e.method}' failed with message: ${o.message}`):x.error(`Notification handler '${e.method}' failed unexpectedly.`)}else V.fire(e)}(e):r.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?x.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):x.error("Received response message without id. No further error information provided.");else{const n=e.id,o=L.get(n);if(function(e,t){if(W===d.Off||!q)return;if(U===g.Text){let n;if(W!==d.Verbose&&W!==d.Compact||(e.error&&e.error.data?n=`Error data: ${se(e.error.data)}\n\n`:e.result?n=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";q.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else q.log(`Received response ${e.id} without active response promise.`,n)}else le("receive-response",e)}(e,o),void 0!==o){L.delete(n);try{if(e.error){const t=e.error;o.reject(new r.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");o.resolve(e.result)}}catch(t){t.message?x.error(`Response handler '${o.method}' failed with message: ${t.message}`):x.error(`Response handler '${o.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void x.error("Received empty message.");x.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(n.string(t.id)||n.number(t.id)){const e=t.id,n=L.get(e);n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}f.onClose(ne),f.onError((function(e){z.fire([e,void 0,void 0])})),h.onClose(ne),h.onError((function(e){z.fire(e)}));const ie=e=>{try{if(r.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,n=Y(t),o=A.get(n);if(r.Message.isRequest(o)){const r=null==m?void 0:m.connectionStrategy,i=r&&r.cancelUndispatched?r.cancelUndispatched(o,Z):void 0;if(i&&(void 0!==i.error||void 0!==i.result))return A.delete(n),H.delete(t),i.id=o.id,ae(i,e.method,Date.now()),void h.write(i).catch((()=>x.error("Sending response for canceled message failed.")))}const i=H.get(t);if(void 0!==i)return i.cancel(),void ce(e);F.add(t)}X(A,e)}finally{re()}};function se(e){if(null!=e)switch(W){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(W!==d.Off&&q)if(U===g.Text){let r;W!==d.Verbose&&W!==d.Compact||(e.error&&e.error.data?r=`Error data: ${se(e.error.data)}\n\n`:e.result?r=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(r="No result returned.\n\n")),q.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else le("send-response",e)}function ce(e){if(W!==d.Off&&q&&e.method!==v.type.method)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),q.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!q||W===d.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};q.log(n)}function ue(){if(ee())throw new _(b.Closed,"Connection is closed.");if(te())throw new _(b.Disposed,"Connection is disposed.")}function de(e){return void 0===e?null:e}function fe(e){return null===e?void 0:e}function he(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function pe(e,t){switch(e){case r.ParameterStructures.auto:return he(t)?fe(t):[de(t)];case r.ParameterStructures.byName:if(!he(t))throw new Error("Received parameters by name but param is not an object literal.");return fe(t);case r.ParameterStructures.byPosition:return[de(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function ge(e,t){let n;const r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=pe(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(de(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null)}return n}const me={sendNotification:(e,...t)=>{let o,i;if(ue(),n.string(e)){o=e;const n=t[0];let s=0,a=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(s=1,a=n);let c=t.length;const l=c-s;switch(l){case 0:i=void 0;break;case 1:i=pe(a,t[s]);break;default:if(a===r.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);i=t.slice(s,c).map((e=>de(e)))}}else{const n=t;o=e.method,i=ge(e,n)}const s={jsonrpc:j,method:o,params:i};return function(e){if(W!==d.Off&&q)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),q.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(s),h.write(s).catch((e=>{throw x.error("Sending notification failed."),e}))},onNotification:(e,t)=>{let r;return ue(),n.func(e)?k=e:t&&(n.string(e)?(r=e,P.set(e,{type:void 0,handler:t})):(r=e.method,P.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==r?P.delete(r):k=void 0}}},onProgress:(e,t,n)=>{if(I.has(t))throw new Error(`Progress handler for token ${t} already registered`);return I.set(t,n),{dispose:()=>{I.delete(t)}}},sendProgress:(e,t,n)=>me.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:K.event,sendRequest:(e,...t)=>{let o,i,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),n.string(e)){o=e;const n=t[0],c=t[t.length-1];let l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;s.CancellationToken.is(c)&&(d-=1,a=c);const f=d-l;switch(f){case 0:i=void 0;break;case 1:i=pe(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw new Error(`Received ${f} parameters for 'by Name' request parameter structure.`);i=t.slice(l,d).map((e=>de(e)))}}else{const n=t;o=e.method,i=ge(e,n);const r=e.numberOfParams;a=s.CancellationToken.is(n[r])?n[r]:void 0}const c=w++;let l;a&&(l=a.onCancellationRequested((()=>{const e=J.sender.sendCancellation(me,c);return void 0===e?(x.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch((()=>{x.log(`Sending cancellation messages for id ${c} failed`)}))})));const u={jsonrpc:j,id:c,method:o,params:i};return function(e){if(W!==d.Off&&q)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),q.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof J.sender.enableCancellation&&J.sender.enableCancellation(u),new Promise((async(e,t)=>{const n={method:o,timerStart:Date.now(),resolve:t=>{e(t),J.sender.cleanup(c),null==l||l.dispose()},reject:e=>{t(e),J.sender.cleanup(c),null==l||l.dispose()}};try{await h.write(u),L.set(c,n)}catch(i){throw x.error("Sending request failed."),n.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,i.message?i.message:"Unknown reason")),i}}))},onRequest:(e,t)=>{ue();let r=null;return u.is(e)?(r=void 0,O=e):n.string(e)?(r=null,void 0!==t&&(r=e,R.set(e,{handler:t,type:void 0}))):void 0!==t&&(r=e.method,R.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==r&&(void 0!==r?R.delete(r):O=void 0)}}},hasPendingResponse:()=>L.size>0,trace:async(e,t,r)=>{let o=!1,i=g.Text;void 0!==r&&(n.boolean(r)?o=r:(o=r.sendNotification||!1,i=r.traceFormat||g.Text)),W=e,U=i,q=W===d.Off?void 0:t,!o||ee()||te()||await me.sendNotification(y.type,{value:d.toString(e)})},onError:z.event,onClose:$.event,onUnhandledNotification:V.event,onDispose:G.event,end:()=>{h.end()},dispose:()=>{if(te())return;B=E.Disposed,G.fire(void 0);const e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of L.values())t.reject(e);L=new Map,H=new Map,F=new Set,A=new o.LinkedMap,n.func(h.dispose)&&h.dispose(),n.func(f.dispose)&&f.dispose()},listen:()=>{ue(),function(){if(Q())throw new _(b.AlreadyListening,"Connection is already listening")}(),B=E.Listening,f.listen(ie)},inspect:()=>{(0,t.default)().console.log("inspect")}};return me.onNotification(v.type,(e=>{if(W===d.Off||!q)return;const t=W===d.Verbose||W===d.Compact;q.log(e.message,t?e.verbose:void 0)})),me.onNotification(l.type,(e=>{const t=I.get(e.token);t?t(e.value):K.fire(e)})),me}}(yo),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=kr;Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const n=Wr;Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=zr;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const o=ot;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const i=nt;Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return i.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return i.CancellationToken}});const s=$r;Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return s.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return s.SharedArrayReceiverStrategy}});const a=Xr;Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const c=ao;Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const l=mo;Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});const u=yo;Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=rt;e.RAL=d.default}(Cr),Object.defineProperty(Rr,"__esModule",{value:!0});const vo=Cr;class bo extends vo.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return bo.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}bo.emptyBuffer=new Uint8Array(0);class xo{constructor(e){this.socket=e,this._onData=new vo.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then((e=>{this._onData.fire(new Uint8Array(e))}),(()=>{(0,vo.RAL)().console.error("Converting blob to array buffer failed.")}))},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),vo.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),vo.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),vo.Disposable.create((()=>this.socket.removeEventListener("end",e)))}onData(e){return this._onData.event(e)}}class wo{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),vo.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),vo.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),vo.Disposable.create((()=>this.socket.removeEventListener("end",e)))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const To=new TextEncoder,Do=Object.freeze({messageBuffer:Object.freeze({create:e=>new bo(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(To.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new xo(e),asWritableStream:e=>new wo(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...n){const r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){const n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){const r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function So(){return Do}(So||(So={})).install=function(){vo.RAL.install(Do)},Rr.default=So,function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;Rr.default.install();const r=Cr;n(Cr,e);class o extends r.AbstractMessageReader{constructor(e){super(),this._onData=new r.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",(e=>this.fireError(e))),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}e.BrowserMessageReader=o;class i extends r.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",(e=>this.fireError(e)))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.BrowserMessageWriter=i,e.createMessageConnection=function(e,t,n,o){return void 0===n&&(n=r.NullLogger),r.ConnectionStrategy.is(o)&&(o={connectionStrategy:o}),(0,r.createMessageConnection)(e,t,n,o)}}(Or);var jo=Or,Oo={};const Ro=S(it);var Co={};Object.defineProperty(Co,"__esModule",{value:!0}),Co.ProtocolNotificationType=Co.ProtocolNotificationType0=Co.ProtocolRequestType=Co.ProtocolRequestType0=Co.RegistrationType=Co.MessageDirection=void 0;const ko=Or;var No,Po;(Po=No||(Co.MessageDirection=No={})).clientToServer="clientToServer",Po.serverToClient="serverToClient",Po.both="both";Co.RegistrationType=class{constructor(e){this.method=e}};Co.ProtocolRequestType0=class extends ko.RequestType0{constructor(e){super(e)}};Co.ProtocolRequestType=class extends ko.RequestType{constructor(e){super(e,ko.ParameterStructures.byName)}};Co.ProtocolNotificationType0=class extends ko.NotificationType0{constructor(e){super(e)}};Co.ProtocolNotificationType=class extends ko.NotificationType{constructor(e){super(e,ko.ParameterStructures.byName)}};var Eo={},Io={};function _o(e){return"string"==typeof e||e instanceof String}function Mo(e){return Array.isArray(e)}Object.defineProperty(Io,"__esModule",{value:!0}),Io.objectLiteral=Io.typedArray=Io.stringArray=Io.array=Io.func=Io.error=Io.number=Io.string=Io.boolean=void 0,Io.boolean=function(e){return!0===e||!1===e},Io.string=_o,Io.number=function(e){return"number"==typeof e||e instanceof Number},Io.error=function(e){return e instanceof Error},Io.func=function(e){return"function"==typeof e},Io.array=Mo,Io.stringArray=function(e){return Mo(e)&&e.every((e=>_o(e)))},Io.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)},Io.objectLiteral=function(e){return null!==e&&"object"==typeof e};var qo={};Object.defineProperty(qo,"__esModule",{value:!0}),qo.ImplementationRequest=void 0;const Ao=Co;var Lo,Fo;(Fo=Lo||(qo.ImplementationRequest=Lo={})).method="textDocument/implementation",Fo.messageDirection=Ao.MessageDirection.clientToServer,Fo.type=new Ao.ProtocolRequestType(Fo.method);var Ho={};Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.TypeDefinitionRequest=void 0;const Wo=Co;var Uo,Bo;(Bo=Uo||(Ho.TypeDefinitionRequest=Uo={})).method="textDocument/typeDefinition",Bo.messageDirection=Wo.MessageDirection.clientToServer,Bo.type=new Wo.ProtocolRequestType(Bo.method);var zo={};Object.defineProperty(zo,"__esModule",{value:!0}),zo.DidChangeWorkspaceFoldersNotification=zo.WorkspaceFoldersRequest=void 0;const $o=Co;var Vo,Ko,Go,Jo;(Ko=Vo||(zo.WorkspaceFoldersRequest=Vo={})).method="workspace/workspaceFolders",Ko.messageDirection=$o.MessageDirection.serverToClient,Ko.type=new $o.ProtocolRequestType0(Ko.method),(Jo=Go||(zo.DidChangeWorkspaceFoldersNotification=Go={})).method="workspace/didChangeWorkspaceFolders",Jo.messageDirection=$o.MessageDirection.clientToServer,Jo.type=new $o.ProtocolNotificationType(Jo.method);var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.ConfigurationRequest=void 0;const Xo=Co;var Zo,Qo;(Qo=Zo||(Yo.ConfigurationRequest=Zo={})).method="workspace/configuration",Qo.messageDirection=Xo.MessageDirection.serverToClient,Qo.type=new Xo.ProtocolRequestType(Qo.method);var ei={};Object.defineProperty(ei,"__esModule",{value:!0}),ei.ColorPresentationRequest=ei.DocumentColorRequest=void 0;const ti=Co;var ni,ri,oi,ii;(ri=ni||(ei.DocumentColorRequest=ni={})).method="textDocument/documentColor",ri.messageDirection=ti.MessageDirection.clientToServer,ri.type=new ti.ProtocolRequestType(ri.method),(ii=oi||(ei.ColorPresentationRequest=oi={})).method="textDocument/colorPresentation",ii.messageDirection=ti.MessageDirection.clientToServer,ii.type=new ti.ProtocolRequestType(ii.method);var si={};Object.defineProperty(si,"__esModule",{value:!0}),si.FoldingRangeRefreshRequest=si.FoldingRangeRequest=void 0;const ai=Co;var ci,li,ui,di;(li=ci||(si.FoldingRangeRequest=ci={})).method="textDocument/foldingRange",li.messageDirection=ai.MessageDirection.clientToServer,li.type=new ai.ProtocolRequestType(li.method),(di=ui||(si.FoldingRangeRefreshRequest=ui={})).method="workspace/foldingRange/refresh",di.messageDirection=ai.MessageDirection.serverToClient,di.type=new ai.ProtocolRequestType0(di.method);var fi={};Object.defineProperty(fi,"__esModule",{value:!0}),fi.DeclarationRequest=void 0;const hi=Co;var pi,gi;(gi=pi||(fi.DeclarationRequest=pi={})).method="textDocument/declaration",gi.messageDirection=hi.MessageDirection.clientToServer,gi.type=new hi.ProtocolRequestType(gi.method);var mi={};Object.defineProperty(mi,"__esModule",{value:!0}),mi.SelectionRangeRequest=void 0;const yi=Co;var vi,bi;(bi=vi||(mi.SelectionRangeRequest=vi={})).method="textDocument/selectionRange",bi.messageDirection=yi.MessageDirection.clientToServer,bi.type=new yi.ProtocolRequestType(bi.method);var xi={};Object.defineProperty(xi,"__esModule",{value:!0}),xi.WorkDoneProgressCancelNotification=xi.WorkDoneProgressCreateRequest=xi.WorkDoneProgress=void 0;const wi=Or,Ti=Co;var Di,Si,ji,Oi,Ri,Ci;(Si=Di||(xi.WorkDoneProgress=Di={})).type=new wi.ProgressType,Si.is=function(e){return e===Si.type},(Oi=ji||(xi.WorkDoneProgressCreateRequest=ji={})).method="window/workDoneProgress/create",Oi.messageDirection=Ti.MessageDirection.serverToClient,Oi.type=new Ti.ProtocolRequestType(Oi.method),(Ci=Ri||(xi.WorkDoneProgressCancelNotification=Ri={})).method="window/workDoneProgress/cancel",Ci.messageDirection=Ti.MessageDirection.clientToServer,Ci.type=new Ti.ProtocolNotificationType(Ci.method);var ki={};Object.defineProperty(ki,"__esModule",{value:!0}),ki.CallHierarchyOutgoingCallsRequest=ki.CallHierarchyIncomingCallsRequest=ki.CallHierarchyPrepareRequest=void 0;const Ni=Co;var Pi,Ei,Ii,_i,Mi,qi;(Ei=Pi||(ki.CallHierarchyPrepareRequest=Pi={})).method="textDocument/prepareCallHierarchy",Ei.messageDirection=Ni.MessageDirection.clientToServer,Ei.type=new Ni.ProtocolRequestType(Ei.method),(_i=Ii||(ki.CallHierarchyIncomingCallsRequest=Ii={})).method="callHierarchy/incomingCalls",_i.messageDirection=Ni.MessageDirection.clientToServer,_i.type=new Ni.ProtocolRequestType(_i.method),(qi=Mi||(ki.CallHierarchyOutgoingCallsRequest=Mi={})).method="callHierarchy/outgoingCalls",qi.messageDirection=Ni.MessageDirection.clientToServer,qi.type=new Ni.ProtocolRequestType(qi.method);var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.SemanticTokensRefreshRequest=Ai.SemanticTokensRangeRequest=Ai.SemanticTokensDeltaRequest=Ai.SemanticTokensRequest=Ai.SemanticTokensRegistrationType=Ai.TokenFormat=void 0;const Li=Co;var Fi,Hi,Wi,Ui,Bi,zi,$i,Vi,Ki,Gi,Ji;(Fi||(Ai.TokenFormat=Fi={})).Relative="relative",(Wi=Hi||(Ai.SemanticTokensRegistrationType=Hi={})).method="textDocument/semanticTokens",Wi.type=new Li.RegistrationType(Wi.method),(Bi=Ui||(Ai.SemanticTokensRequest=Ui={})).method="textDocument/semanticTokens/full",Bi.messageDirection=Li.MessageDirection.clientToServer,Bi.type=new Li.ProtocolRequestType(Bi.method),Bi.registrationMethod=Hi.method,($i=zi||(Ai.SemanticTokensDeltaRequest=zi={})).method="textDocument/semanticTokens/full/delta",$i.messageDirection=Li.MessageDirection.clientToServer,$i.type=new Li.ProtocolRequestType($i.method),$i.registrationMethod=Hi.method,(Ki=Vi||(Ai.SemanticTokensRangeRequest=Vi={})).method="textDocument/semanticTokens/range",Ki.messageDirection=Li.MessageDirection.clientToServer,Ki.type=new Li.ProtocolRequestType(Ki.method),Ki.registrationMethod=Hi.method,(Ji=Gi||(Ai.SemanticTokensRefreshRequest=Gi={})).method="workspace/semanticTokens/refresh",Ji.messageDirection=Li.MessageDirection.serverToClient,Ji.type=new Li.ProtocolRequestType0(Ji.method);var Yi={};Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.ShowDocumentRequest=void 0;const Xi=Co;var Zi,Qi;(Qi=Zi||(Yi.ShowDocumentRequest=Zi={})).method="window/showDocument",Qi.messageDirection=Xi.MessageDirection.serverToClient,Qi.type=new Xi.ProtocolRequestType(Qi.method);var es={};Object.defineProperty(es,"__esModule",{value:!0}),es.LinkedEditingRangeRequest=void 0;const ts=Co;var ns,rs;(rs=ns||(es.LinkedEditingRangeRequest=ns={})).method="textDocument/linkedEditingRange",rs.messageDirection=ts.MessageDirection.clientToServer,rs.type=new ts.ProtocolRequestType(rs.method);var os={};Object.defineProperty(os,"__esModule",{value:!0}),os.WillDeleteFilesRequest=os.DidDeleteFilesNotification=os.DidRenameFilesNotification=os.WillRenameFilesRequest=os.DidCreateFilesNotification=os.WillCreateFilesRequest=os.FileOperationPatternKind=void 0;const is=Co;var ss,as,cs,ls,us,ds,fs,hs,ps,gs,ms,ys,vs,bs;(as=ss||(os.FileOperationPatternKind=ss={})).file="file",as.folder="folder",(ls=cs||(os.WillCreateFilesRequest=cs={})).method="workspace/willCreateFiles",ls.messageDirection=is.MessageDirection.clientToServer,ls.type=new is.ProtocolRequestType(ls.method),(ds=us||(os.DidCreateFilesNotification=us={})).method="workspace/didCreateFiles",ds.messageDirection=is.MessageDirection.clientToServer,ds.type=new is.ProtocolNotificationType(ds.method),(hs=fs||(os.WillRenameFilesRequest=fs={})).method="workspace/willRenameFiles",hs.messageDirection=is.MessageDirection.clientToServer,hs.type=new is.ProtocolRequestType(hs.method),(gs=ps||(os.DidRenameFilesNotification=ps={})).method="workspace/didRenameFiles",gs.messageDirection=is.MessageDirection.clientToServer,gs.type=new is.ProtocolNotificationType(gs.method),(ys=ms||(os.DidDeleteFilesNotification=ms={})).method="workspace/didDeleteFiles",ys.messageDirection=is.MessageDirection.clientToServer,ys.type=new is.ProtocolNotificationType(ys.method),(bs=vs||(os.WillDeleteFilesRequest=vs={})).method="workspace/willDeleteFiles",bs.messageDirection=is.MessageDirection.clientToServer,bs.type=new is.ProtocolRequestType(bs.method);var xs={};Object.defineProperty(xs,"__esModule",{value:!0}),xs.MonikerRequest=xs.MonikerKind=xs.UniquenessLevel=void 0;const ws=Co;var Ts,Ds,Ss,js,Os,Rs;(Ds=Ts||(xs.UniquenessLevel=Ts={})).document="document",Ds.project="project",Ds.group="group",Ds.scheme="scheme",Ds.global="global",(js=Ss||(xs.MonikerKind=Ss={})).$import="import",js.$export="export",js.local="local",(Rs=Os||(xs.MonikerRequest=Os={})).method="textDocument/moniker",Rs.messageDirection=ws.MessageDirection.clientToServer,Rs.type=new ws.ProtocolRequestType(Rs.method);var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.TypeHierarchySubtypesRequest=Cs.TypeHierarchySupertypesRequest=Cs.TypeHierarchyPrepareRequest=void 0;const ks=Co;var Ns,Ps,Es,Is,_s,Ms;(Ps=Ns||(Cs.TypeHierarchyPrepareRequest=Ns={})).method="textDocument/prepareTypeHierarchy",Ps.messageDirection=ks.MessageDirection.clientToServer,Ps.type=new ks.ProtocolRequestType(Ps.method),(Is=Es||(Cs.TypeHierarchySupertypesRequest=Es={})).method="typeHierarchy/supertypes",Is.messageDirection=ks.MessageDirection.clientToServer,Is.type=new ks.ProtocolRequestType(Is.method),(Ms=_s||(Cs.TypeHierarchySubtypesRequest=_s={})).method="typeHierarchy/subtypes",Ms.messageDirection=ks.MessageDirection.clientToServer,Ms.type=new ks.ProtocolRequestType(Ms.method);var qs={};Object.defineProperty(qs,"__esModule",{value:!0}),qs.InlineValueRefreshRequest=qs.InlineValueRequest=void 0;const As=Co;var Ls,Fs,Hs,Ws;(Fs=Ls||(qs.InlineValueRequest=Ls={})).method="textDocument/inlineValue",Fs.messageDirection=As.MessageDirection.clientToServer,Fs.type=new As.ProtocolRequestType(Fs.method),(Ws=Hs||(qs.InlineValueRefreshRequest=Hs={})).method="workspace/inlineValue/refresh",Ws.messageDirection=As.MessageDirection.serverToClient,Ws.type=new As.ProtocolRequestType0(Ws.method);var Us={};Object.defineProperty(Us,"__esModule",{value:!0}),Us.InlayHintRefreshRequest=Us.InlayHintResolveRequest=Us.InlayHintRequest=void 0;const Bs=Co;var zs,$s,Vs,Ks,Gs,Js;($s=zs||(Us.InlayHintRequest=zs={})).method="textDocument/inlayHint",$s.messageDirection=Bs.MessageDirection.clientToServer,$s.type=new Bs.ProtocolRequestType($s.method),(Ks=Vs||(Us.InlayHintResolveRequest=Vs={})).method="inlayHint/resolve",Ks.messageDirection=Bs.MessageDirection.clientToServer,Ks.type=new Bs.ProtocolRequestType(Ks.method),(Js=Gs||(Us.InlayHintRefreshRequest=Gs={})).method="workspace/inlayHint/refresh",Js.messageDirection=Bs.MessageDirection.serverToClient,Js.type=new Bs.ProtocolRequestType0(Js.method);var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.DiagnosticRefreshRequest=Ys.WorkspaceDiagnosticRequest=Ys.DocumentDiagnosticRequest=Ys.DocumentDiagnosticReportKind=Ys.DiagnosticServerCancellationData=void 0;const Xs=Or,Zs=Io,Qs=Co;var ea,ta,na,ra,oa,ia,sa,aa,ca;(ea||(Ys.DiagnosticServerCancellationData=ea={})).is=function(e){const t=e;return t&&Zs.boolean(t.retriggerRequest)},(na=ta||(Ys.DocumentDiagnosticReportKind=ta={})).Full="full",na.Unchanged="unchanged",(oa=ra||(Ys.DocumentDiagnosticRequest=ra={})).method="textDocument/diagnostic",oa.messageDirection=Qs.MessageDirection.clientToServer,oa.type=new Qs.ProtocolRequestType(oa.method),oa.partialResult=new Xs.ProgressType,(sa=ia||(Ys.WorkspaceDiagnosticRequest=ia={})).method="workspace/diagnostic",sa.messageDirection=Qs.MessageDirection.clientToServer,sa.type=new Qs.ProtocolRequestType(sa.method),sa.partialResult=new Xs.ProgressType,(ca=aa||(Ys.DiagnosticRefreshRequest=aa={})).method="workspace/diagnostic/refresh",ca.messageDirection=Qs.MessageDirection.serverToClient,ca.type=new Qs.ProtocolRequestType0(ca.method);var la={};Object.defineProperty(la,"__esModule",{value:!0}),la.DidCloseNotebookDocumentNotification=la.DidSaveNotebookDocumentNotification=la.DidChangeNotebookDocumentNotification=la.NotebookCellArrayChange=la.DidOpenNotebookDocumentNotification=la.NotebookDocumentSyncRegistrationType=la.NotebookDocument=la.NotebookCell=la.ExecutionSummary=la.NotebookCellKind=void 0;const ua=Ro,da=Io,fa=Co;var ha,pa,ga,ma,ya,va,ba,xa,wa,Ta,Da,Sa,ja,Oa,Ra,Ca,ka,Na,Pa;(pa=ha||(la.NotebookCellKind=ha={})).Markup=1,pa.Code=2,pa.is=function(e){return 1===e||2===e},(ma=ga||(la.ExecutionSummary=ga={})).create=function(e,t){const n={executionOrder:e};return!0!==t&&!1!==t||(n.success=t),n},ma.is=function(e){const t=e;return da.objectLiteral(t)&&ua.uinteger.is(t.executionOrder)&&(void 0===t.success||da.boolean(t.success))},ma.equals=function(e,t){return e===t||null!=e&&null!=t&&e.executionOrder===t.executionOrder&&e.success===t.success},function(e){function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(typeof e!=typeof n)return!1;if("object"!=typeof e)return!1;const r=Array.isArray(e),o=Array.isArray(n);if(r!==o)return!1;if(r&&o){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1}if(da.objectLiteral(e)&&da.objectLiteral(n)){const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;if(r.sort(),o.sort(),!t(r,o))return!1;for(let i=0;i<r.length;i++){const o=r[i];if(!t(e[o],n[o]))return!1}}return!0}e.create=function(e,t){return{kind:e,document:t}},e.is=function(e){const t=e;return da.objectLiteral(t)&&ha.is(t.kind)&&ua.DocumentUri.is(t.document)&&(void 0===t.metadata||da.objectLiteral(t.metadata))},e.diff=function(e,n){const r=new Set;return e.document!==n.document&&r.add("document"),e.kind!==n.kind&&r.add("kind"),e.executionSummary!==n.executionSummary&&r.add("executionSummary"),void 0===e.metadata&&void 0===n.metadata||t(e.metadata,n.metadata)||r.add("metadata"),void 0===e.executionSummary&&void 0===n.executionSummary||ga.equals(e.executionSummary,n.executionSummary)||r.add("executionSummary"),r}}(ya||(la.NotebookCell=ya={})),(ba=va||(la.NotebookDocument=va={})).create=function(e,t,n,r){return{uri:e,notebookType:t,version:n,cells:r}},ba.is=function(e){const t=e;return da.objectLiteral(t)&&da.string(t.uri)&&ua.integer.is(t.version)&&da.typedArray(t.cells,ya.is)},(wa=xa||(la.NotebookDocumentSyncRegistrationType=xa={})).method="notebookDocument/sync",wa.messageDirection=fa.MessageDirection.clientToServer,wa.type=new fa.RegistrationType(wa.method),(Da=Ta||(la.DidOpenNotebookDocumentNotification=Ta={})).method="notebookDocument/didOpen",Da.messageDirection=fa.MessageDirection.clientToServer,Da.type=new fa.ProtocolNotificationType(Da.method),Da.registrationMethod=xa.method,(ja=Sa||(la.NotebookCellArrayChange=Sa={})).is=function(e){const t=e;return da.objectLiteral(t)&&ua.uinteger.is(t.start)&&ua.uinteger.is(t.deleteCount)&&(void 0===t.cells||da.typedArray(t.cells,ya.is))},ja.create=function(e,t,n){const r={start:e,deleteCount:t};return void 0!==n&&(r.cells=n),r},(Ra=Oa||(la.DidChangeNotebookDocumentNotification=Oa={})).method="notebookDocument/didChange",Ra.messageDirection=fa.MessageDirection.clientToServer,Ra.type=new fa.ProtocolNotificationType(Ra.method),Ra.registrationMethod=xa.method,(ka=Ca||(la.DidSaveNotebookDocumentNotification=Ca={})).method="notebookDocument/didSave",ka.messageDirection=fa.MessageDirection.clientToServer,ka.type=new fa.ProtocolNotificationType(ka.method),ka.registrationMethod=xa.method,(Pa=Na||(la.DidCloseNotebookDocumentNotification=Na={})).method="notebookDocument/didClose",Pa.messageDirection=fa.MessageDirection.clientToServer,Pa.type=new fa.ProtocolNotificationType(Pa.method),Pa.registrationMethod=xa.method;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.InlineCompletionRequest=void 0;const Ia=Co;var _a,Ma;(Ma=_a||(Ea.InlineCompletionRequest=_a={})).method="textDocument/inlineCompletion",Ma.messageDirection=Ia.MessageDirection.clientToServer,Ma.type=new Ia.ProtocolRequestType(Ma.method),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=Co,n=Ro,r=Io,o=qo;Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return o.ImplementationRequest}});const i=Ho;Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return i.TypeDefinitionRequest}});const s=zo;Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});const a=Yo;Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=ei;Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=si;Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(e,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=fi;Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=mi;Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=xi;Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const h=ki;Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const p=Ai;Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return p.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return p.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return p.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return p.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return p.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return p.SemanticTokensRegistrationType}});const g=Yi;Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return g.ShowDocumentRequest}});const m=es;Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return m.LinkedEditingRangeRequest}});const y=os;Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return y.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return y.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return y.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return y.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return y.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return y.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return y.WillDeleteFilesRequest}});const v=xs;Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return v.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return v.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return v.MonikerRequest}});const b=Cs;Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return b.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySupertypesRequest}});const x=qs;Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});const w=Us;Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return w.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return w.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return w.InlayHintRefreshRequest}});const T=Ys;Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return T.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return T.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return T.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return T.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return T.DiagnosticRefreshRequest}});const D=la;Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return D.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return D.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return D.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return D.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return D.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return D.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidCloseNotebookDocumentNotification}});const S=Ea;var j,O,R,C,k,N,P,E,I,_,M,q,A,L,F,H,W,U,B,z,$,V,K,G,J,Y,X,Z,Q,ee,te,ne,re,oe,ie,se,ae,ce,le,ue,de,fe,he,pe,ge,me,ye,ve,be,xe,we,Te,De,Se,je,Oe,Re,Ce,ke,Ne,Pe,Ee,Ie,_e,Me,qe,Ae,Le,Fe,He,We,Ue,Be,ze,$e,Ve,Ke,Ge,Je,Ye,Xe,Ze,Qe,et,tt,nt,rt,ot,it,st,at,ct,lt,ut,dt,ft,ht,pt,gt,mt,yt,vt,bt,xt,wt,Tt,Dt,St,jt,Ot,Rt,Ct,kt,Nt,Pt,Et,It,_t,Mt,qt,At;Object.defineProperty(e,"InlineCompletionRequest",{enumerable:!0,get:function(){return S.InlineCompletionRequest}}),(j||(e.TextDocumentFilter=j={})).is=function(e){const t=e;return r.string(t)||r.string(t.language)||r.string(t.scheme)||r.string(t.pattern)},(O||(e.NotebookDocumentFilter=O={})).is=function(e){const t=e;return r.objectLiteral(t)&&(r.string(t.notebookType)||r.string(t.scheme)||r.string(t.pattern))},(R||(e.NotebookCellTextDocumentFilter=R={})).is=function(e){const t=e;return r.objectLiteral(t)&&(r.string(t.notebook)||O.is(t.notebook))&&(void 0===t.language||r.string(t.language))},(C||(e.DocumentSelector=C={})).is=function(e){if(!Array.isArray(e))return!1;for(let t of e)if(!r.string(t)&&!j.is(t)&&!R.is(t))return!1;return!0},(N=k||(e.RegistrationRequest=k={})).method="client/registerCapability",N.messageDirection=t.MessageDirection.serverToClient,N.type=new t.ProtocolRequestType(N.method),(E=P||(e.UnregistrationRequest=P={})).method="client/unregisterCapability",E.messageDirection=t.MessageDirection.serverToClient,E.type=new t.ProtocolRequestType(E.method),(_=I||(e.ResourceOperationKind=I={})).Create="create",_.Rename="rename",_.Delete="delete",(q=M||(e.FailureHandlingKind=M={})).Abort="abort",q.Transactional="transactional",q.TextOnlyTransactional="textOnlyTransactional",q.Undo="undo",(L=A||(e.PositionEncodingKind=A={})).UTF8="utf-8",L.UTF16="utf-16",L.UTF32="utf-32",(F||(e.StaticRegistrationOptions=F={})).hasId=function(e){const t=e;return t&&r.string(t.id)&&t.id.length>0},(H||(e.TextDocumentRegistrationOptions=H={})).is=function(e){const t=e;return t&&(null===t.documentSelector||C.is(t.documentSelector))},(U=W||(e.WorkDoneProgressOptions=W={})).is=function(e){const t=e;return r.objectLiteral(t)&&(void 0===t.workDoneProgress||r.boolean(t.workDoneProgress))},U.hasWorkDoneProgress=function(e){const t=e;return t&&r.boolean(t.workDoneProgress)},(z=B||(e.InitializeRequest=B={})).method="initialize",z.messageDirection=t.MessageDirection.clientToServer,z.type=new t.ProtocolRequestType(z.method),($||(e.InitializeErrorCodes=$={})).unknownProtocolVersion=1,(K=V||(e.InitializedNotification=V={})).method="initialized",K.messageDirection=t.MessageDirection.clientToServer,K.type=new t.ProtocolNotificationType(K.method),(J=G||(e.ShutdownRequest=G={})).method="shutdown",J.messageDirection=t.MessageDirection.clientToServer,J.type=new t.ProtocolRequestType0(J.method),(X=Y||(e.ExitNotification=Y={})).method="exit",X.messageDirection=t.MessageDirection.clientToServer,X.type=new t.ProtocolNotificationType0(X.method),(Q=Z||(e.DidChangeConfigurationNotification=Z={})).method="workspace/didChangeConfiguration",Q.messageDirection=t.MessageDirection.clientToServer,Q.type=new t.ProtocolNotificationType(Q.method),(te=ee||(e.MessageType=ee={})).Error=1,te.Warning=2,te.Info=3,te.Log=4,te.Debug=5,(re=ne||(e.ShowMessageNotification=ne={})).method="window/showMessage",re.messageDirection=t.MessageDirection.serverToClient,re.type=new t.ProtocolNotificationType(re.method),(ie=oe||(e.ShowMessageRequest=oe={})).method="window/showMessageRequest",ie.messageDirection=t.MessageDirection.serverToClient,ie.type=new t.ProtocolRequestType(ie.method),(ae=se||(e.LogMessageNotification=se={})).method="window/logMessage",ae.messageDirection=t.MessageDirection.serverToClient,ae.type=new t.ProtocolNotificationType(ae.method),(le=ce||(e.TelemetryEventNotification=ce={})).method="telemetry/event",le.messageDirection=t.MessageDirection.serverToClient,le.type=new t.ProtocolNotificationType(le.method),(de=ue||(e.TextDocumentSyncKind=ue={})).None=0,de.Full=1,de.Incremental=2,(he=fe||(e.DidOpenTextDocumentNotification=fe={})).method="textDocument/didOpen",he.messageDirection=t.MessageDirection.clientToServer,he.type=new t.ProtocolNotificationType(he.method),(ge=pe||(e.TextDocumentContentChangeEvent=pe={})).isIncremental=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)},ge.isFull=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength},(ye=me||(e.DidChangeTextDocumentNotification=me={})).method="textDocument/didChange",ye.messageDirection=t.MessageDirection.clientToServer,ye.type=new t.ProtocolNotificationType(ye.method),(be=ve||(e.DidCloseTextDocumentNotification=ve={})).method="textDocument/didClose",be.messageDirection=t.MessageDirection.clientToServer,be.type=new t.ProtocolNotificationType(be.method),(we=xe||(e.DidSaveTextDocumentNotification=xe={})).method="textDocument/didSave",we.messageDirection=t.MessageDirection.clientToServer,we.type=new t.ProtocolNotificationType(we.method),(De=Te||(e.TextDocumentSaveReason=Te={})).Manual=1,De.AfterDelay=2,De.FocusOut=3,(je=Se||(e.WillSaveTextDocumentNotification=Se={})).method="textDocument/willSave",je.messageDirection=t.MessageDirection.clientToServer,je.type=new t.ProtocolNotificationType(je.method),(Re=Oe||(e.WillSaveTextDocumentWaitUntilRequest=Oe={})).method="textDocument/willSaveWaitUntil",Re.messageDirection=t.MessageDirection.clientToServer,Re.type=new t.ProtocolRequestType(Re.method),(ke=Ce||(e.DidChangeWatchedFilesNotification=Ce={})).method="workspace/didChangeWatchedFiles",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method),(Pe=Ne||(e.FileChangeType=Ne={})).Created=1,Pe.Changed=2,Pe.Deleted=3,(Ee||(e.RelativePattern=Ee={})).is=function(e){const t=e;return r.objectLiteral(t)&&(n.URI.is(t.baseUri)||n.WorkspaceFolder.is(t.baseUri))&&r.string(t.pattern)},(_e=Ie||(e.WatchKind=Ie={})).Create=1,_e.Change=2,_e.Delete=4,(qe=Me||(e.PublishDiagnosticsNotification=Me={})).method="textDocument/publishDiagnostics",qe.messageDirection=t.MessageDirection.serverToClient,qe.type=new t.ProtocolNotificationType(qe.method),(Le=Ae||(e.CompletionTriggerKind=Ae={})).Invoked=1,Le.TriggerCharacter=2,Le.TriggerForIncompleteCompletions=3,(He=Fe||(e.CompletionRequest=Fe={})).method="textDocument/completion",He.messageDirection=t.MessageDirection.clientToServer,He.type=new t.ProtocolRequestType(He.method),(Ue=We||(e.CompletionResolveRequest=We={})).method="completionItem/resolve",Ue.messageDirection=t.MessageDirection.clientToServer,Ue.type=new t.ProtocolRequestType(Ue.method),(ze=Be||(e.HoverRequest=Be={})).method="textDocument/hover",ze.messageDirection=t.MessageDirection.clientToServer,ze.type=new t.ProtocolRequestType(ze.method),(Ve=$e||(e.SignatureHelpTriggerKind=$e={})).Invoked=1,Ve.TriggerCharacter=2,Ve.ContentChange=3,(Ge=Ke||(e.SignatureHelpRequest=Ke={})).method="textDocument/signatureHelp",Ge.messageDirection=t.MessageDirection.clientToServer,Ge.type=new t.ProtocolRequestType(Ge.method),(Ye=Je||(e.DefinitionRequest=Je={})).method="textDocument/definition",Ye.messageDirection=t.MessageDirection.clientToServer,Ye.type=new t.ProtocolRequestType(Ye.method),(Ze=Xe||(e.ReferencesRequest=Xe={})).method="textDocument/references",Ze.messageDirection=t.MessageDirection.clientToServer,Ze.type=new t.ProtocolRequestType(Ze.method),(et=Qe||(e.DocumentHighlightRequest=Qe={})).method="textDocument/documentHighlight",et.messageDirection=t.MessageDirection.clientToServer,et.type=new t.ProtocolRequestType(et.method),(nt=tt||(e.DocumentSymbolRequest=tt={})).method="textDocument/documentSymbol",nt.messageDirection=t.MessageDirection.clientToServer,nt.type=new t.ProtocolRequestType(nt.method),(ot=rt||(e.CodeActionRequest=rt={})).method="textDocument/codeAction",ot.messageDirection=t.MessageDirection.clientToServer,ot.type=new t.ProtocolRequestType(ot.method),(st=it||(e.CodeActionResolveRequest=it={})).method="codeAction/resolve",st.messageDirection=t.MessageDirection.clientToServer,st.type=new t.ProtocolRequestType(st.method),(ct=at||(e.WorkspaceSymbolRequest=at={})).method="workspace/symbol",ct.messageDirection=t.MessageDirection.clientToServer,ct.type=new t.ProtocolRequestType(ct.method),(ut=lt||(e.WorkspaceSymbolResolveRequest=lt={})).method="workspaceSymbol/resolve",ut.messageDirection=t.MessageDirection.clientToServer,ut.type=new t.ProtocolRequestType(ut.method),(ft=dt||(e.CodeLensRequest=dt={})).method="textDocument/codeLens",ft.messageDirection=t.MessageDirection.clientToServer,ft.type=new t.ProtocolRequestType(ft.method),(pt=ht||(e.CodeLensResolveRequest=ht={})).method="codeLens/resolve",pt.messageDirection=t.MessageDirection.clientToServer,pt.type=new t.ProtocolRequestType(pt.method),(mt=gt||(e.CodeLensRefreshRequest=gt={})).method="workspace/codeLens/refresh",mt.messageDirection=t.MessageDirection.serverToClient,mt.type=new t.ProtocolRequestType0(mt.method),(vt=yt||(e.DocumentLinkRequest=yt={})).method="textDocument/documentLink",vt.messageDirection=t.MessageDirection.clientToServer,vt.type=new t.ProtocolRequestType(vt.method),(xt=bt||(e.DocumentLinkResolveRequest=bt={})).method="documentLink/resolve",xt.messageDirection=t.MessageDirection.clientToServer,xt.type=new t.ProtocolRequestType(xt.method),(Tt=wt||(e.DocumentFormattingRequest=wt={})).method="textDocument/formatting",Tt.messageDirection=t.MessageDirection.clientToServer,Tt.type=new t.ProtocolRequestType(Tt.method),(St=Dt||(e.DocumentRangeFormattingRequest=Dt={})).method="textDocument/rangeFormatting",St.messageDirection=t.MessageDirection.clientToServer,St.type=new t.ProtocolRequestType(St.method),(Ot=jt||(e.DocumentRangesFormattingRequest=jt={})).method="textDocument/rangesFormatting",Ot.messageDirection=t.MessageDirection.clientToServer,Ot.type=new t.ProtocolRequestType(Ot.method),(Ct=Rt||(e.DocumentOnTypeFormattingRequest=Rt={})).method="textDocument/onTypeFormatting",Ct.messageDirection=t.MessageDirection.clientToServer,Ct.type=new t.ProtocolRequestType(Ct.method),(kt||(e.PrepareSupportDefaultBehavior=kt={})).Identifier=1,(Pt=Nt||(e.RenameRequest=Nt={})).method="textDocument/rename",Pt.messageDirection=t.MessageDirection.clientToServer,Pt.type=new t.ProtocolRequestType(Pt.method),(It=Et||(e.PrepareRenameRequest=Et={})).method="textDocument/prepareRename",It.messageDirection=t.MessageDirection.clientToServer,It.type=new t.ProtocolRequestType(It.method),(Mt=_t||(e.ExecuteCommandRequest=_t={})).method="workspace/executeCommand",Mt.messageDirection=t.MessageDirection.clientToServer,Mt.type=new t.ProtocolRequestType(Mt.method),(At=qt||(e.ApplyWorkspaceEditRequest=qt={})).method="workspace/applyEdit",At.messageDirection=t.MessageDirection.serverToClient,At.type=new t.ProtocolRequestType("workspace/applyEdit")}(Eo);var qa={};Object.defineProperty(qa,"__esModule",{value:!0}),qa.createProtocolConnection=void 0;const Aa=Or;qa.createProtocolConnection=function(e,t,n,r){return Aa.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Aa.createMessageConnection)(e,t,n,r)},function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(Or,e),n(Ro,e),n(Co,e),n(Eo,e);var r,o,i=qa;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return i.createProtocolConnection}}),(o=r||(e.LSPErrorCodes=r={})).lspReservedErrorRangeStart=-32899,o.RequestFailed=-32803,o.ServerCancelled=-32802,o.ContentModified=-32801,o.RequestCancelled=-32800,o.lspReservedErrorRangeEnd=-32800}(Oo),function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;const r=jo;n(jo,e),n(Oo,e),e.createProtocolConnection=function(e,t,n,o){return(0,r.createMessageConnection)(e,t,n,o)}}(jr);const La=1e4,Fa=Object.fromEntries(Object.entries(jr.CompletionItemKind).map((([e,t])=>[t,e]))),Ha=e=>e.reduce(((e,t)=>t),""),Wa=j.define({combine:Ha}),Ua=j.define({combine:Ha}),Ba=j.define({combine:Ha});class za{constructor(e){this.rootUri=e.rootUri,this.workspaceFolders=e.workspaceFolders,this.autoClose=e.autoClose,this.plugins=[],this.transport=e.transport,this.requestManager=new qt.RequestManager([this.transport]),this.client=new qt.Client(this.requestManager),this.client.onNotification((e=>{this.processNotification(e)}));const t=this.transport;t&&t.connection&&t.connection.addEventListener("message",(e=>{const n=JSON.parse(e.data);n.method&&n.id&&t.connection.send(JSON.stringify({jsonrpc:"2.0",id:n.id,result:null}))})),this.initializePromise=this.initialize()}async initialize(){const{capabilities:e}=await this.request("initialize",{capabilities:{textDocument:{hover:{dynamicRegistration:!0,contentFormat:["plaintext","markdown"]},moniker:{},synchronization:{dynamicRegistration:!0,willSave:!1,didSave:!1,willSaveWaitUntil:!1},completion:{dynamicRegistration:!0,completionItem:{snippetSupport:!1,commitCharactersSupport:!0,documentationFormat:["plaintext","markdown"],deprecatedSupport:!1,preselectSupport:!1},contextSupport:!1},signatureHelp:{dynamicRegistration:!0,signatureInformation:{documentationFormat:["plaintext","markdown"]}},declaration:{dynamicRegistration:!0,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!0,linkSupport:!0},implementation:{dynamicRegistration:!0,linkSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!0}}},initializationOptions:null,processId:null,rootUri:this.rootUri,workspaceFolders:this.workspaceFolders},3e4);this.capabilities=e,this.notify("initialized",{}),this.ready=!0}close(){this.client.close()}textDocumentDidOpen(e){return this.notify("textDocument/didOpen",e)}textDocumentDidChange(e){return this.notify("textDocument/didChange",e)}async textDocumentHover(e){return await this.request("textDocument/hover",e,La)}async textDocumentCompletion(e){return await this.request("textDocument/completion",e,La)}attachPlugin(e){this.plugins.push(e)}detachPlugin(e){const t=this.plugins.indexOf(e);-1!==t&&(this.plugins.splice(t,1),this.autoClose&&this.close())}request(e,t,n){return this.client.request({method:e,params:t},n)}notify(e,t){return this.client.notify({method:e,params:t})}processNotification(e){for(const t of this.plugins)t.processNotification(e)}}class $a{constructor(e,t){this.view=e,this.allowHTMLContent=t,this.client=this.view.state.facet(Wa),this.documentUri=this.view.state.facet(Ua),this.languageId=this.view.state.facet(Ba),this.documentVersion=0,this.changesTimeout=0,this.client.attachPlugin(this),this.initialize({documentText:this.view.state.doc.toString()})}update({docChanged:e}){e&&(this.changesTimeout&&clearTimeout(this.changesTimeout),this.changesTimeout=self.setTimeout((()=>{this.sendChange({documentText:this.view.state.doc.toString()})}),500))}destroy(){this.client.detachPlugin(this)}async initialize({documentText:e}){this.client.initializePromise&&await this.client.initializePromise,this.client.textDocumentDidOpen({textDocument:{uri:this.documentUri,languageId:this.languageId,text:e,version:this.documentVersion}})}async sendChange({documentText:e}){if(this.client.ready)try{await this.client.textDocumentDidChange({textDocument:{uri:this.documentUri,version:this.documentVersion++},contentChanges:[{text:e}]})}catch(t){console.error(t)}}requestDiagnostics(e){this.sendChange({documentText:e.state.doc.toString()})}async requestHoverTooltip(e,{line:t,character:n}){if(!this.client.ready||!this.client.capabilities.hoverProvider)return null;this.sendChange({documentText:e.state.doc.toString()});const r=await this.client.textDocumentHover({textDocument:{uri:this.documentUri},position:{line:t,character:n}});if(!r)return null;const{contents:o,range:i}=r;let s,a=Va(e.state.doc,{line:t,character:n});if(i&&(a=Va(e.state.doc,i.start),s=Va(e.state.doc,i.end)),null===a)return null;const c=document.createElement("div");return c.classList.add("documentation"),this.allowHTMLContent?c.innerHTML=Ga(o):c.textContent=Ga(o),{pos:a,end:s,create:e=>({dom:c}),above:!0}}async requestCompletion(e,{line:t,character:n},{triggerKind:r,triggerCharacter:o}){if(!this.client.ready||!this.client.capabilities.completionProvider)return null;this.sendChange({documentText:e.state.doc.toString()});const i=await this.client.textDocumentCompletion({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{triggerKind:r,triggerCharacter:o}});if(!i)return null;let s=("items"in i?i.items:i).map((({detail:e,label:t,kind:n,textEdit:r,documentation:o,sortText:i,filterText:s})=>{var a;const c={label:t,detail:e,apply:null!==(a=null==r?void 0:r.newText)&&void 0!==a?a:t,type:n&&Fa[n].toLowerCase(),sortText:null!=i?i:t,filterText:null!=s?s:t};return o&&(c.info=Ga(o)),c}));const[a,c]=function(e){const t=new Set,n=new Set;for(const{apply:o}of e){const[e,...r]=o;t.add(e);for(const t of r)n.add(t)}const r=Ja(t)+Ja(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(s),l=e.matchBefore(c);let{pos:u}=e;if(l){u=l.from;const e=l.text.toLowerCase();/^\w+$/.test(e)&&(s=s.filter((({filterText:t})=>t.toLowerCase().startsWith(e))).sort((({apply:e},{apply:t})=>{switch(!0){case e.startsWith(l.text)&&!t.startsWith(l.text):return-1;case!e.startsWith(l.text)&&t.startsWith(l.text):return 1}return 0})))}return{from:u,options:s}}processNotification(e){try{if("textDocument/publishDiagnostics"===e.method)this.processDiagnostics(e.params)}catch(t){console.error(t)}}processDiagnostics(e){if(e.uri!==this.documentUri)return;const t=e.diagnostics.map((({range:e,message:t,severity:n})=>({from:Va(this.view.state.doc,e.start),to:Va(this.view.state.doc,e.end),severity:{[jr.DiagnosticSeverity.Error]:"error",[jr.DiagnosticSeverity.Warning]:"warning",[jr.DiagnosticSeverity.Information]:"info",[jr.DiagnosticSeverity.Hint]:"info"}[n],message:t}))).filter((({from:e,to:t})=>null!==e&&null!==t&&void 0!==e&&void 0!==t)).sort(((e,t)=>{switch(!0){case e.from<t.from:return-1;case e.from>t.from:return 1}return 0}));this.view.dispatch(k(this.view.state,t))}}function Va(e,t){if(t.line>=e.lines)return;const n=e.line(t.line+1).from+t.character;return n>e.length?void 0:n}function Ka(e,t){const n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}function Ga(e){return Array.isArray(e)?e.map((e=>Ga(e)+"\n\n")).join(""):"string"==typeof e?e:e.value}function Ja(e){let t="",n=Array.from(e).join("");return/\w/.test(n)&&(t+="\\w",n=n.replace(/\w/g,"")),`[${t}${n.replace(/[^\w\s]/g,"\\$&")}]`}class Ya extends za{constructor(...n){super(...n),this.documentVersion=0,this.getCompletionInternal=async(e,t)=>await this._request("getCompletions",{doc:{...e.doc,version:t}}),this.throttledGetCompletionInternal=function(n,r,o){var i=!0,s=!0;if("function"!=typeof n)throw new TypeError("Expected a function");return e(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),t(n,r,{leading:i,maxWait:r,trailing:s})}(this.getCompletionInternal,200)}_request(e,t){return this.request(e,t)}isDisabled(){return!_t()}async textDocumentDidOpen(e){return this.isDisabled()?e:super.textDocumentDidOpen(e)}async textDocumentCompletion(e){return this.isDisabled()?[]:super.textDocumentCompletion(e)}async textDocumentDidChange(e){return this.isDisabled()?e:super.textDocumentDidChange({...e,contentChanges:[{text:N(e.contentChanges[0].text)}],textDocument:jr.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return this.isDisabled()?Promise.resolve({contents:[]}):super.textDocumentHover(e)}signOut(){return this._request("signOut",{})}signInInitiate(){return this._request("signInInitiate",{})}signInConfirm(e){return this._request("signInConfirm",e)}async signedIn(){const{status:e,user:t}=await this._request("checkStatus",{});return P.debug("Copilot#signedIn",e,t),"SignedIn"===e||"AlreadySignedIn"===e||"OK"===e}acceptCompletion(e){return this._request("notifyAccepted",e)}rejectCompletions(e){return this._request("notifyRejected",e)}async getCompletion(e){if(this.isDisabled())return{completions:[]};const t=this.documentVersion;if(e.doc.version=t,0===t)return{completions:[]};var n;n=t,b.set(It,n);const r=await this.throttledGetCompletionInternal(e,t);var o;return o=t,b.get(It)===o&&b.set(It,null),t!==this.documentVersion?{completions:[]}:r||{completions:[]}}}async function Xa(e){return new Promise(((t,n)=>{const r=new WebSocket(e);r.onopen=()=>{r.close(),t(e)},r.onerror=t=>{r.close(),n(new Error(`Failed to connect to ${e}: ${t.type}`))}}))}const Za="/marimo.py",Qa="copilot",ec=`file://${Za}`,tc=E((()=>new nc));class nc extends cn{constructor(){super(),this.delegate=void 0,this.delegate=void 0}async connect(){return await w(T,(e=>"github"===e.completion.copilot)),await async function(e,t=5){for(let n=0;n<t;n++)try{return await Xa(e)}catch{await new Promise((e=>setTimeout(e,1e3*(n+1))))}throw new Error(`Failed to connect to ${e}`)}(ic(),3),this.delegate||(this.delegate=new qt.WebSocketTransport(ic())),this.delegate.connect()}close(){var e;null==(e=this.delegate)||e.close()}async sendData(e,t){var n;return null==(n=this.delegate)?void 0:n.sendData(e,t)}}const rc=E((()=>new Ya({rootUri:ec,documentUri:ec,languageId:Qa,workspaceFolders:null,transport:tc()})));function oc(){return function(e){let t=null;return[Wa.of(e.client||new za({...e,autoClose:!0})),Ua.of(e.documentUri),Ba.of(e.languageId),O.define((n=>t=new $a(n,e.allowHTMLContent))),R(((e,n)=>{var r;return null!==(r=null==t?void 0:t.requestHoverTooltip(e,Ka(e.state.doc,n)))&&void 0!==r?r:null})),C({override:[async e=>{var n,r,o;if(null==t)return null;const{state:i,pos:s,explicit:a}=e,c=i.doc.lineAt(s);let l,u=jr.CompletionTriggerKind.Invoked;return!a&&(null===(o=null===(r=null===(n=t.client.capabilities)||void 0===n?void 0:n.completionProvider)||void 0===r?void 0:r.triggerCharacters)||void 0===o?void 0:o.includes(c.text[s-c.from-1]))&&(u=jr.CompletionTriggerKind.TriggerCharacter,l=c.text[s-c.from-1]),u!==jr.CompletionTriggerKind.Invoked||e.matchBefore(/\w+$/)?await t.requestCompletion(e,Ka(i.doc,s),{triggerKind:u,triggerCharacter:l}):null}]})]}({rootUri:ec,documentUri:ec,workspaceFolders:[],transport:tc(),client:rc(),languageId:Qa})}function ic(){return st("lsp/copilot")}const sc=p.memo((()=>{const[e,t]=I(Et),[n,r]=p.useState(),[o,i]=p.useState(),[s,c]=p.useState(!1);p.useEffect((()=>{const e=rc();e.initializePromise.catch((()=>{t(!1),r("notConnected")})),e.signedIn().then((e=>{t(e),r(e?"signedIn":"signedOut")})).catch((()=>{t(!1),r("notConnected")}))}),[]);const l=async e=>{e.preventDefault(),c(!0);try{const e=rc(),{verificationUri:n,status:o,userCode:s}=await e.signInInitiate();"OK"===o||"AlreadySignedIn"===o?t(!0):(r("signingIn"),i({url:n,code:s}))}finally{c(!1)}},u=async e=>{if(e.preventDefault(),!o)return;const n=rc();try{c(!0);const{status:e}=await n.signInConfirm({userCode:o.code});"OK"===e||"AlreadySignedIn"===e?(t(!0),r("signedIn")):r("signInFailed")}catch{for(let e=0;e<3;e++){await new Promise((e=>setTimeout(e,1e3)));if(await n.signedIn())return t(!0),void r("signedIn")}r("signInFailed")}finally{c(!1)}},f=async e=>{e.preventDefault();const n=rc();t(!1),r("signedOut"),await n.signOut()};return(()=>{switch(n??(e?"signedIn":"connecting")){case"connecting":return a.jsx(_,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return a.jsx(q,{onClick:l,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return a.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[a.jsx("li",{children:a.jsxs("div",{className:"flex items-center",children:["Copy this code:",a.jsx("strong",{className:"ml-2",children:null==o?void 0:o.code}),a.jsx(L,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{o&&(await F(o.code),H({description:"Copied to clipboard"}))}})]})}),a.jsxs("li",{children:["Enter the code at this link:",a.jsx("a",{href:null==o?void 0:o.url,target:"_blank",rel:"noreferrer",className:W({variant:"link",size:"xs"}),children:null==o?void 0:o.url})]}),a.jsxs("li",{children:["Click here when done:",a.jsxs(q,{size:"xs",onClick:u,className:"ml-1",children:[s&&a.jsx(A,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),s?a.jsx(A,{className:"h-3 w-3 mr-1 animate-spin"}):a.jsx(q,{onClick:l,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return a.jsxs("div",{className:"flex items-center gap-5",children:[a.jsxs(_,{className:"font-normal flex items-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center bg-[var(--grass-7)] rounded-full p-1 mr-2",children:a.jsx(M,{className:"h-3 w-3 text-white"})}),"Connected"]}),a.jsx(q,{onClick:f,size:"xs",variant:"text",children:"Disconnect"})]});case"notConnected":return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs(_,{className:"font-normal flex",children:[a.jsx(d,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),a.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",a.jsx("a",{className:"hyperlink",href:"https://docs.marimo.io/getting_started/index.html#github-copilot",target:"_blank",rel:"noreferrer",children:"docs"}),"."]})]})}})()}));var ac;function cc(e){return lc(),[U.of([{key:"j",run:t=>!(!B(t,!0)||!z(t))&&(e.focusDown(),!0)}]),U.of([{key:"k",run:t=>!(!$(t)||!z(t))&&(e.focusUp(),!0)}]),O.define((e=>(uc.INSTANCES.addInstance(e),{destroy(){uc.INSTANCES.removeInstance(e)}})))]}sc.displayName="CopilotConfig";const lc=E((()=>{V.defineAction("goToDefinition",(e=>{const t=e.cm6;return K(t)})),V.mapCommand("gd","action","goToDefinition",{},{context:"normal"})}));class uc{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const t=G(e);t?t.on("vim-mode-change",(t=>{this.isBroadcasting||(J("mode"in t,'Expected event to have a "mode" property'),this.isBroadcasting=!0,this.broadcastModeChange(e,t.mode,t.subMode),this.isBroadcasting=!1)})):P.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,t,n){J("exitInsertMode"in V,"Vim does not have an exitInsertMode method"),J("exitVisualMode"in V,"Vim does not have an exitVisualMode method");for(const r of this.instances)if(r!==e){const e=G(r);if(!e){P.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const n=e.setSelections.bind(e);e.setSelections=()=>[];const o=e.state.vim;if(!o){P.warn("Expected CodeMirror instance to have Vim state");continue}switch(t){case"normal":o.insertMode&&V.exitInsertMode(e,!0),o.visualMode&&V.exitVisualMode(e,!0);break;case"insert":o.insertMode||V.handleKey(e,"i","")}e.setSelections=n}}}ac=uc,uc.INSTANCES=new ac;const dc=["default","vim"];function fc(e,t){switch(e.preset){case"default":return[U.of(X),U.of([{key:"Escape",preventDefault:!0,run:e=>(e.contentDOM.blur(),!0)}])];case"vim":return[U.of(X),Z.high(hc("d",(e=>""===e.state.doc.toString()),(e=>""===e.state.doc.toString()&&(t.deleteCell(),!0)))),Z.highest(Q({status:!1})),Z.highest(cc(t))];default:return Y(e.preset),[]}}function hc(e,t,n){let r="",o=0;return U.of([{any:(i,s)=>{const a=s.key,c=s.timeStamp;if(a!==e||!t(i))return r="",o=0,!1;if(r===e&&c-o<500){if(n(i))return r="",o=0,!0}return r=a,o=c,!1}}])}function pc(){return at("multi_column")?["compact","medium","full","columns"]:["compact","medium","full"]}const gc=v({});function mc(){return ee(gc)}function yc(e,t){const n=i(13),{registerAction:r,unregisterAction:o}=function(){const e=te(gc);return{registerAction:ne(((t,n)=>{e((e=>({...e,[t]:n})))})),unregisterAction:ne((t=>{e((e=>{const{[t]:n,...r}=e;return r}))}))}}(),s=ee(re),a=t===oe.NOOP;let c;n[0]!==t?(c=e=>t(e),n[0]=t,n[1]=c):c=n[1];const l=ne(c);let u;n[2]!==s||n[3]!==e||n[4]!==t?(u=n=>{const r=s.getHotkey(e).key;if(ie(r)(n)){!1!==t(n)&&(n.preventDefault(),n.stopPropagation())}},n[2]=s,n[3]=e,n[4]=t,n[5]=u):u=n[5];const d=ne(u);let f,h;g(document,"keydown",d),n[6]!==a||n[7]!==r||n[8]!==e||n[9]!==l||n[10]!==o?(f=()=>{if(!a)return r(e,l),()=>o(e)},h=[l,e,a,r,o],n[6]=a,n[7]=r,n[8]=e,n[9]=l,n[10]=o,n[11]=f,n[12]=h):(f=n[11],h=n[12]),p.useEffect(f,h)}function vc(e,t){const n=i(3),r=ee(re);let o;n[0]!==t||n[1]!==r?(o=e=>{for(const[n,o]of se.entries(t)){if(void 0===o)continue;const t=r.getHotkey(n).key;if(ie(t)(e)){P.debug("Satisfied",t,e);!1!==o(e)&&(e.preventDefault(),e.stopPropagation())}}},n[0]=t,n[1]=r,n[2]=o):o=n[2],g(e,"keydown",o)}function bc(e,t){const n=i(2);let r;n[0]!==t?(r=e=>{for(const[n,r]of se.entries(t))if(ie(n)(e)){P.debug("Satisfied",n,e);!1!==r(e)&&(e.preventDefault(),e.stopPropagation())}},n[0]=t,n[1]=r):r=n[1],g(e,"keydown",r)}const xc=v(!1),wc=()=>{const e=i(78),[t,n]=I(xc),[r,o]=p.useState(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[c,l]=p.useState(s),[u,f]=ae(),h=ee(re);let g,m;e[1]!==n?(g=()=>n((e=>!e)),e[1]=n,e[2]=g):g=e[2],yc("global.showHelp",g),e[3]!==u||e[4]!==f?(m=async e=>{const t={...u};f(e),await ce({config:e}).catch((e=>{throw f(t),e}))},e[3]=u,e[4]=f,e[5]=m):m=e[5];const y=m;let v;e[6]!==r||e[7]!==u||e[8]!==y?(v=async e=>{if(!r)return;const t=e.join("-"),n={...u,keymap:{...u.keymap,overrides:{...u.keymap.overrides,[r]:t}}};o(null),l([]),await y(n)},e[6]=r,e[7]=u,e[8]=y,e[9]=v):v=e[9];const b=v;let x;e[10]!==r||e[11]!==u||e[12]!==y?(x=async()=>{if(!r)return;const e={...u,keymap:{...u.keymap,overrides:{...u.keymap.overrides}}};delete e.keymap.overrides[r],o(null),l([]),await y(e)},e[10]=r,e[11]=u,e[12]=y,e[13]=x):x=e[13];const w=x;let T;e[14]!==u||e[15]!==y?(T=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const e={...u,keymap:{...u.keymap,overrides:{}}};o(null),l([]),await y(e)},e[14]=u,e[15]=y,e[16]=T):T=e[16];const D=T;if(!t)return null;let S;e[17]!==h||e[18]!==r||e[19]!==c||e[20]!==b||e[21]!==w?(S=e=>{const t=h.getHotkey(e);if(r===e){const n=le(e);return a.jsxs("div",{children:[a.jsx(ue,{defaultValue:c.join("+"),placeholder:t.name,onKeyDown:e=>{e.preventDefault();const t=[];if("Meta"===e.key||"Control"===e.key||"Alt"===e.key||"Shift"===e.key)return;if(e.metaKey&&t.push(de()?"Cmd":"Meta"),e.ctrlKey&&t.push("Ctrl"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),"-"===e.key)return;if("Escape"===e.key&&0===t.length)return o(null),void l([]);let n=e.key.toLowerCase();" "===e.key&&(n="Space"),t.push(n),b(t)},autoFocus:!0,endAdornment:a.jsx(q,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{o(null),l([])},children:a.jsx(d,{className:"w-4 h-4"})})}),a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),n.key!==t.key&&a.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:w,children:["Reset to default:"," ",a.jsx("span",{className:"font-mono",children:n.key})]})]})]},e)}return a.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[h.isEditable(e)?a.jsx(fe,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),o(e)}}):a.jsx("div",{className:"w-3 h-3"}),a.jsx(he,{className:"justify-end",shortcut:t.key}),a.jsx("span",{children:t.name.toLowerCase()})]},e)},e[17]=h,e[18]=r,e[19]=c,e[20]=b,e[21]=w,e[22]=S):S=e[22];const j=S;let O,R,C,k,N,P,E,_,M,A,L,F,H,W,U,B,z,$,V,K,G,J,Y,X;if(e[23]!==h||e[24]!==j||e[25]!==t||e[26]!==n){const r=h.getHotkeyGroups(),o=e=>{const t=r[e];return a.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[a.jsx("h3",{className:"text-lg font-medium",children:e}),t.map((e=>j(e)))]})};U=pe,B=t,e[44]!==n?(z=e=>n(e),e[44]=n,e[45]=z):z=e[45],F=ge,H="sm:items-center sm:top-0",e[46]===Symbol.for("react.memo_cache_sentinel")?(W=a.jsx(me,{}),e[46]=W):W=e[46],_=ye,M=!1,A="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",e[47]===Symbol.for("react.memo_cache_sentinel")?(L=a.jsx(ve,{children:a.jsx(be,{children:"Shortcuts"})}),e[47]=L):L=e[47],P="flex flex-row gap-3",E=a.jsxs("div",{className:"w-1/2",children:[o("Editing"),o("Markdown")]}),O="w-1/2",R=o("Navigation"),C=o("Running Cells"),k=o("Creation and Ordering"),N=o("Other"),e[23]=h,e[24]=j,e[25]=t,e[26]=n,e[27]=O,e[28]=R,e[29]=C,e[30]=k,e[31]=N,e[32]=P,e[33]=E,e[34]=_,e[35]=M,e[36]=A,e[37]=L,e[38]=F,e[39]=H,e[40]=W,e[41]=U,e[42]=B,e[43]=z}else O=e[27],R=e[28],C=e[29],k=e[30],N=e[31],P=e[32],E=e[33],_=e[34],M=e[35],A=e[36],L=e[37],F=e[38],H=e[39],W=e[40],U=e[41],B=e[42],z=e[43];return e[48]===Symbol.for("react.memo_cache_sentinel")?($=a.jsx("span",{className:"text-destructive",children:"Reset all to default"}),e[48]=$):$=e[48],e[49]!==D?(V=a.jsx(q,{className:"mt-4 hover:bg-destructive/10 hover:border-destructive",variant:"outline",size:"xs",onClick:D,tabIndex:-1,children:$}),e[49]=D,e[50]=V):V=e[50],e[51]!==O||e[52]!==R||e[53]!==C||e[54]!==k||e[55]!==N||e[56]!==V?(K=a.jsxs("div",{className:O,children:[R,C,k,N,V]}),e[51]=O,e[52]=R,e[53]=C,e[54]=k,e[55]=N,e[56]=V,e[57]=K):K=e[57],e[58]!==P||e[59]!==E||e[60]!==K?(G=a.jsxs("div",{className:P,children:[E,K]}),e[58]=P,e[59]=E,e[60]=K,e[61]=G):G=e[61],e[62]!==_||e[63]!==M||e[64]!==A||e[65]!==L||e[66]!==G?(J=a.jsxs(_,{usePortal:M,className:A,children:[L,G]}),e[62]=_,e[63]=M,e[64]=A,e[65]=L,e[66]=G,e[67]=J):J=e[67],e[68]!==F||e[69]!==H||e[70]!==W||e[71]!==J?(Y=a.jsxs(F,{className:H,children:[W,J]}),e[68]=F,e[69]=H,e[70]=W,e[71]=J,e[72]=Y):Y=e[72],e[73]!==U||e[74]!==B||e[75]!==z||e[76]!==Y?(X=a.jsx(U,{open:B,onOpenChange:z,children:Y}),e[73]=U,e[74]=B,e[75]=z,e[76]=Y,e[77]=X):X=e[77],X},Tc=["gpt-4o","gpt-4-turbo","gpt-4","gpt-3.5-turbo","claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","claude-3-5-sonnet-20240620","gemini-pro","gemini-1.5-pro-001","gemini-1.5-flash-001","gemini-1.5-pro-001","gemini-1.5-flash-002","gemini-1.5-pro-002","gemini-1.5-flash-002"],Dc="flex flex-row items-center space-x-1 space-y-0",Sc=[{id:"editor",label:"Editor",Icon:fe,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:mt,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:yt,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:ft,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:ut,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"labs",label:"Labs",Icon:ht,className:"bg-[var(--slate-4)]"}],jc=v(Sc[0].id),Oc=()=>{const e=i(40),[t,n]=xe(),r=p.useRef(null),o=te(xc),[s,c]=I(jc);let u,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=we(Te),e[0]=u):u=e[0],e[1]!==t?(d={resolver:u,defaultValues:t},e[1]=t,e[2]=d):d=e[2];const f=De(d);let h;e[3]!==n?(h=async e=>{await ce({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=h):h=e[4];const g=h;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(),e[5]=m):m=e[5];const y=m;let v;e[6]!==f||e[7]!==t?(v=()=>{const e=f.getValues("completion.copilot");return!1===e?null:"codeium"===e?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Codeium API key, follow"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#codeium-copilot",target:"_blank",rel:"noreferrer",children:"these instructions"}),"."]}),a.jsx(Re,{control:f.control,name:"completion.codeium_api_key",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...n,value:n.value||""})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"completion.codeium_api_key"})]})}})]}):"github"===e?a.jsx(sc,{}):void 0},e[6]=f,e[7]=t,e[8]=v):v=e[8];const b=v;let x;e[9]!==s||e[10]!==f||e[11]!==t||e[12]!==g||e[13]!==c||e[14]!==o||e[15]!==b?(x=()=>{switch(s){case"editor":return a.jsxs(a.Fragment,{children:[a.jsxs(Rc,{title:"Autosave",children:[a.jsx(Re,{control:f.control,name:"save.autosave",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Autosave enabled"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"autosave-checkbox",checked:"after_delay"===n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(e?"after_delay":"off")}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"save.autosave"})]})}}),a.jsx(Re,{control:f.control,name:"save.autosave_delay",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Autosave delay (seconds)"}),a.jsx(Ne,{children:a.jsx(Fe,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:"after_delay"!==f.getValues("save.autosave"),...n,value:n.value/1e3,minValue:1,onChange:e=>{n.onChange(1e3*e),Number.isNaN(e)||g(f.getValues())}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"save.autosave_delay"})]})}})]}),a.jsxs(Rc,{title:"Formatting",children:[a.jsx(Re,{control:f.control,name:"save.format_on_save",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Format on save"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"format-on-save-checkbox",checked:n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(e)}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"save.format_on_save"})]})}}),a.jsx(Re,{control:f.control,name:"formatting.line_length",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Line length"}),a.jsx(Ne,{children:a.jsx(Fe,{"data-testid":"line-length-input",className:"m-0 w-24",...n,value:n.value,minValue:1,maxValue:1e3,onChange:e=>{n.onChange(e),Number.isNaN(e)||g(f.getValues())}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"formatting.line_length"})]}),a.jsx(Ie,{children:"Maximum line length when formatting code."})]})}})]}),a.jsx(Rc,{title:"Autocomplete",children:a.jsx(Re,{control:f.control,name:"completion.activate_on_typing",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Autocomplete"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"autocomplete-checkbox",checked:n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(Boolean(e))}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"completion.activate_on_typing"})]}),a.jsx(Ie,{children:"When unchecked, code completion is still available through a hotkey."}),a.jsx("div",{children:a.jsx(q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),c("ai")},children:"Edit AI autocomplete"})})]})}})}),a.jsx(Rc,{title:"Keymap",children:a.jsx(Re,{control:f.control,name:"keymap.preset",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Keymap"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"keymap-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:dc.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"keymap.preset"})]}),a.jsx("div",{children:a.jsx(q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),o(!0)},children:"Edit Keyboard Shortcuts"})})]})}})})]});case"display":return a.jsxs(a.Fragment,{children:[a.jsxs(Rc,{title:"Display",children:[a.jsx(Re,{control:f.control,name:"display.default_width",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Default width"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"user-config-width-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:pc().map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"display.default_width"})]}),a.jsx(Ie,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),a.jsx(Re,{control:f.control,name:"display.theme",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Theme"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"theme-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:Le.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"display.theme"})]}),a.jsx(Ie,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),a.jsx(Re,{control:f.control,name:"display.code_editor_font_size",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Code editor font size (px)"}),a.jsx(Ne,{children:a.jsx("span",{className:"inline-flex mr-2",children:a.jsx(Fe,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...n,value:n.value,minValue:8,maxValue:32,onChange:e=>{n.onChange(e),g(f.getValues())}})})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"display.code_editor_font_size"})]})}})]}),a.jsxs(Rc,{title:"Outputs",children:[a.jsx(Re,{control:f.control,name:"display.cell_output",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Cell output area"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"cell-output-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["above","below"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"display.cell_output"})]}),a.jsx(Ie,{children:"Where to display cell's output."})]})}}),a.jsx(Re,{control:f.control,name:"display.dataframes",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Dataframe viewer"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"display-dataframes-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["rich","plain"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"display.dataframes"})]}),a.jsx(Ie,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}})]})]});case"packageManagement":return a.jsx(Rc,{title:"Package Management",children:a.jsx(Re,{control:f.control,disabled:y,name:"package_management.manager",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Manager"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"package-manager-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:Ae.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"package_management.manager"})]}),a.jsxs(Ie,{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"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/package_management.html",target:"_blank",rel:"noreferrer",children:"docs"}),".",a.jsx("br",{}),a.jsx("br",{}),"Running marimo in a"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",target:"_blank",rel:"noreferrer",children:"sandboxed environment"})," ","is only supported by ",a.jsx(Me,{className:"inline",children:"uv"})]})]})}})});case"runtime":return a.jsxs(Rc,{title:"Runtime configuration",children:[a.jsx(Re,{control:f.control,name:"runtime.auto_instantiate",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Autorun on startup"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"auto-instantiate-checkbox",disabled:n.disabled,checked:n.value,onCheckedChange:n.onChange})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"runtime.auto_instantiate"})]}),a.jsx(Ie,{children:"Whether to automatically run all cells on startup."})]})}}),a.jsx(Re,{control:f.control,name:"runtime.on_cell_change",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"On cell change"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"on-cell-change-select",onChange:e=>n.onChange(e.target.value),value:n.value,className:"inline-flex mr-2",children:["lazy","autorun"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"runtime.on_cell_change"})]}),a.jsx(Ie,{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.'})]})}}),a.jsx(Re,{control:f.control,name:"runtime.auto_reload",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"On module change"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"auto-reload-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:y,className:"inline-flex mr-2",children:["off","lazy","autorun"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"runtime.auto_reload"})]}),a.jsx(Ie,{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.'})]})}}),a.jsxs(Ie,{children:["Learn more in the"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",target:"_blank",rel:"noreferrer",children:"docs"}),"."]})]});case"ai":return a.jsxs(a.Fragment,{children:[a.jsxs(Rc,{title:"AI Code Completion",children:[a.jsx("p",{className:"text-sm text-muted-secondary",children:"You may use GitHub Copilot or Codeium for AI code completion."}),a.jsx(Re,{control:f.control,name:"completion.copilot",render:e=>{const{field:n}=e;return a.jsx("div",{className:"flex flex-col space-y-1",children:a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Provider"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"copilot-select",onChange:e=>{"none"===e.target.value?n.onChange(!1):n.onChange(e.target.value)},value:!0===n.value?"github":!1===n.value?"none":n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["none","github","codeium"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"completion.copilot"})]})})}}),b()]}),a.jsxs(Rc,{title:"AI Keys",children:[a.jsx(Re,{control:f.control,name:"ai.open_ai.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"OpenAI API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.open_ai.api_key"})]}),a.jsxs(Ie,{children:["Your OpenAI API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://platform.openai.com/account/api-keys",target:"_blank",rel:"noreferrer",children:"platform.openai.com"}),"."]})]})}}),a.jsx(Re,{control:f.control,name:"ai.anthropic.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Anthropic API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.anthropic.api_key"})]}),a.jsxs(Ie,{children:["Your Anthropic API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noreferrer",children:"console.anthropic.com"}),"."]})]})}}),a.jsx(Re,{control:f.control,name:"ai.google.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Google AI API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.google.api_key"})]}),a.jsxs(Ie,{children:["Your Google AI API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",children:"aistudio.google.com"}),"."]})]})}})]}),a.jsxs(Rc,{title:"AI Assist",children:[a.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",a.jsx(Me,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",target:"_blank",rel:"noreferrer",children:"docs"})," ","for more info."]}),a.jsx(Re,{control:f.control,disabled:y,name:"ai.open_ai.base_url",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Base URL"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...n})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.open_ai.base_url"})]}),a.jsx(Ie,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),a.jsx(Re,{control:f.control,disabled:y,name:"ai.open_ai.model",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{children:"Model"}),a.jsx(Ne,{children:a.jsx(ue,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...n})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.open_ai.model"})]}),a.jsx("datalist",{id:"ai-model-datalist",children:Tc.map((e=>a.jsx("option",{value:e,children:e},e)))}),a.jsx(Ie,{children:'If the model starts with "claude-", we will use your Anthropic API key. If the model starts with "gemini-", we will use your Google AI API key. Otherwise, we will use your OpenAI API key.'})]})}}),a.jsx(Re,{control:f.control,name:"ai.rules",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs(Ce,{children:[a.jsx(ke,{children:"Custom Rules"}),a.jsx(Ne,{children:a.jsx(qe,{"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",...n,value:n.value})}),a.jsx(Pe,{}),a.jsx(Cc,{userConfig:t,name:"ai.rules"})]}),a.jsx(Ie,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"labs":return a.jsxs(Rc,{title:"Experimental Features",children:[a.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"⚠️ These features are experimental and may require restarting your notebook to take effect."}),a.jsx(Re,{control:f.control,name:"experimental.multi_column",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Multi-column layout"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"multi-column-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental support for multi-column notebook layouts. This adds a new width setting to the notebook settings menu."})]})}}),a.jsx(Re,{control:f.control,name:"experimental.chat_sidebar",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Chat sidebar"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"chat-sidebar-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental chat sidebar to ask questions with an AI assistant."})]})}}),a.jsx(Re,{control:f.control,name:"experimental.tracing",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Tracing sidebar"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"tracing-sidebar-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental tracing sidebar to debug cell execution times and dependencies."})]})}}),!l()&&a.jsx(Re,{control:f.control,name:"experimental.rtc",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Dc,children:[a.jsx(ke,{className:"font-normal",children:"Real-time Collaboration"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"rtc-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental real-time collaboration to allow editing cell inputs by multiple users. Requires refreshing the page to take effect."})]})}})]})}},e[9]=s,e[10]=f,e[11]=t,e[12]=g,e[13]=c,e[14]=o,e[15]=b,e[16]=x):x=e[16];const w=x;let T,D,S;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(Me,{className:"inline",children:"marimo.toml"}),D=a.jsx("br",{}),e[17]=T,e[18]=D):(T=e[17],D=e[18]),e[19]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",T,D,"Run ",a.jsx(Me,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),e[19]=S):S=e[19];const j=S;let O,R,C,k,N,P,E,_;return e[20]!==f||e[21]!==g?(O=f.handleSubmit(g),e[20]=f,e[21]=g,e[22]=O):O=e[22],e[23]!==c?(R=e=>c(e),e[23]=c,e[24]=R):R=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsxs(Se,{className:"self-start max-h-none flex flex-col gap-2 flex-shrink-0 bg-background flex-1 min-h-full",children:[Sc.map(kc),a.jsx("div",{className:"flex-1"}),!l()&&j]}),e[25]=C):C=e[25],e[26]!==s||e[27]!==R?(k=a.jsx(He,{value:s,onValueChange:R,orientation:"vertical",className:"w-1/3 pr-4 border-r h-full overflow-auto p-6",children:C}),e[26]=s,e[27]=R,e[28]=k):k=e[28],e[29]!==w?(N=w(),e[29]=w,e[30]=N):N=e[30],e[31]!==N?(P=a.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:N}),e[31]=N,e[32]=P):P=e[32],e[33]!==O||e[34]!==k||e[35]!==P?(E=a.jsxs("form",{ref:r,onChange:O,className:"flex text-pretty overflow-hidden",children:[k,P]}),e[33]=O,e[34]=k,e[35]=P,e[36]=E):E=e[36],e[37]!==f||e[38]!==E?(_=a.jsx(je,{...f,children:E}),e[37]=f,e[38]=E,e[39]=_):_=e[39],_},Rc=e=>{const t=i(5),{title:n,children:r}=e;let o,s;return t[0]!==n?(o=a.jsx(kt,{className:"text-base",children:n}),t[0]=n,t[1]=o):o=t[1],t[2]!==o||t[3]!==r?(s=a.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[o,r]}),t[2]=o,t[3]=r,t[4]=s):s=t[4],s},Cc=e=>{const t=i(24),{userConfig:n,name:r}=e;let o;t[0]!==n||t[1]!==r?(o=We(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];const s=o,c=ee(Ue);let l;t[3]!==c||t[4]!==r?(l=We(c,r),t[3]=c,t[4]=r,t[5]=l):l=t[5];const u=l;if(null==u)return null;if(s===u)return null;let d,h,p,g;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsxs("span",{children:["This setting is overridden by"," ",a.jsx(Me,{className:"inline",children:"pyproject.toml"}),"."]}),h=a.jsx("br",{}),t[6]=d,t[7]=h):(d=t[6],h=t[7]),t[8]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsxs("span",{children:["Edit the ",a.jsx(Me,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),g=a.jsx("br",{}),t[8]=p,t[9]=g):(p=t[8],g=t[9]);const m=String(s);let y,v;t[10]!==m?(y=a.jsxs("span",{children:["User value: ",a.jsx("strong",{children:m})]}),t[10]=m,t[11]=y):y=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx("br",{}),t[12]=v):v=t[12];const b=String(u);let x,w,T;t[13]!==b?(x=a.jsxs("span",{children:["Project value: ",a.jsx("strong",{children:b})]}),t[13]=b,t[14]=x):x=t[14],t[15]!==y||t[16]!==x?(w=a.jsxs(a.Fragment,{children:[d,h,p,g,y,v,x]}),t[15]=y,t[16]=x,t[17]=w):w=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(pt,{className:"w-3 h-3"}),t[18]=T):T=t[18];const D=String(u);let S,j;return t[19]!==D?(S=a.jsxs("span",{className:"text-[var(--amber-12)] text-xs flex items-center gap-1 border rounded px-2 py-1 bg-[var(--amber-2)] border-[var(--amber-6)] ml-1",children:[T,"Overridden by pyproject.toml [",D,"]"]}),t[19]=D,t[20]=S):S=t[20],t[21]!==w||t[22]!==S?(j=a.jsx(f,{content:w,children:S}),t[21]=w,t[22]=S,t[23]=j):j=t[23],j};function kc(e){return a.jsx(Oe,{value:e.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:a.jsxs("div",{className:"flex gap-4 items-center text-lg",children:[a.jsx("span",{className:m(e.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground"),children:a.jsx(e.Icon,{className:"w-4 h-4"})}),e.label]})},e.id)}const Nc=()=>{const e=i(27),[t,n]=Be();let r,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=we(ze),e[0]=r):r=e[0],e[1]!==t?(o={resolver:r,defaultValues:t},e[1]=t,e[2]=o):o=e[2];const s=De(o);let c;e[3]!==n?(c=async e=>{await Ke({config:e}).then((()=>{n(e)})).catch((()=>{n(e)}))},e[3]=n,e[4]=c):c=e[4];const l=c;let u,d,f,h,g,m,y,v,b,x;return e[5]!==t.width?(u=[t.width],e[5]=t.width,e[6]=u):u=e[6],p.useEffect(Pc,u),e[7]!==s||e[8]!==l?(d=s.handleSubmit(l),e[7]=s,e[8]=l,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsxs("div",{children:[a.jsx(Ct,{children:"Application Config"}),a.jsx(Nt,{children:"Settings applied to this notebook"})]}),e[10]=f):f=e[10],e[11]!==s.control?(h=a.jsx(Re,{control:s.control,name:"width",render:Ic}),g=a.jsx(Re,{control:s.control,name:"app_title",render:_c}),m=a.jsx(Re,{control:s.control,name:"css_file",render:Mc}),y=a.jsx(Re,{control:s.control,name:"html_head_file",render:qc}),v=a.jsx(Re,{control:s.control,name:"auto_download",render:Ac}),e[11]=s.control,e[12]=h,e[13]=g,e[14]=m,e[15]=y,e[16]=v):(h=e[12],g=e[13],m=e[14],y=e[15],v=e[16]),e[17]!==d||e[18]!==h||e[19]!==g||e[20]!==m||e[21]!==y||e[22]!==v?(b=a.jsxs("form",{onChange:d,className:"flex flex-col gap-4",children:[f,h,g,m,y,v]}),e[17]=d,e[18]=h,e[19]=g,e[20]=m,e[21]=y,e[22]=v,e[23]=b):b=e[23],e[24]!==s||e[25]!==b?(x=a.jsx(je,{...s,children:b}),e[24]=s,e[25]=b,e[26]=x):x=e[26],x};function Pc(){window.dispatchEvent(new Event("resize"))}function Ec(e){return a.jsx("option",{value:e,children:e},e)}function Ic(e){const{field:t}=e;return a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{children:"Width"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"app-width-select",onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:"inline-flex mr-2",children:pc().map(Ec)})}),a.jsx(Pe,{})]})}function _c(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{children:"App title"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",onChange:e=>{t.onChange(e.target.value),$e.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),a.jsx(Pe,{})]}),a.jsx(Ie,{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 Mc(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{className:"flex-shrink-0",children:"Custom CSS"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",placeholder:"custom.css",onChange:e=>{t.onChange(e.target.value),$e.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),a.jsx(Pe,{})]}),a.jsx(Ie,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function qc(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{className:"flex-shrink-0",children:"HTML Head"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",placeholder:"head.html",onChange:e=>{t.onChange(e.target.value)}})}),a.jsx(Pe,{})]}),a.jsxs(Ie,{children:["A filepath to an HTML file to be injected into the"," ",a.jsx(Me,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function Ac(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsx("div",{className:"text-base font-bold text-muted-foreground",children:"Auto-download"}),a.jsxs(Ce,{className:"flex flex-col gap-2",children:[a.jsx(Ne,{children:a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ee,{id:"html-checkbox",checked:t.value.includes("html"),onCheckedChange:()=>{t.onChange(Ve(t.value,"html"))}}),a.jsx(ke,{htmlFor:"html-checkbox",children:"HTML"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ee,{id:"ipynb-checkbox",checked:t.value.includes("ipynb"),onCheckedChange:()=>{t.onChange(Ve(t.value,"ipynb"))}}),a.jsx(ke,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),a.jsx(Pe,{})]}),a.jsxs(Ie,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",a.jsx(Me,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const Lc=v(!1),Fc=e=>{const t=i(20),{showAppConfig:n}=e,r=void 0===n||n,[o,s]=I(Lc);let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx(Dt,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",color:"hint-green",children:a.jsx(f,{content:"Settings",children:a.jsx(Ge,{strokeWidth:1.8})})}),t[0]=c):c=t[0];const l=c;let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(ye,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:a.jsx(Oc,{})}),t[1]=u):u=t[1];const d=u;if(!r){let e,n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(Je,{children:l}),t[2]=e):e=t[2],t[3]!==o||t[4]!==s?(n=a.jsxs(pe,{open:o,onOpenChange:s,children:[e,d]}),t[3]=o,t[4]=s,t[5]=n):n=t[5],n}let h,p,g,m,y,v,b,x;return t[6]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(Ye,{asChild:!0,children:l}),t[6]=h):h=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(Nc,{}),g=a.jsx("div",{className:"h-px bg-border my-2"}),t[7]=p,t[8]=g):(p=t[7],g=t[8]),t[9]!==s?(m=()=>s(!0),t[9]=s,t[10]=m):m=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsx(Ge,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),t[11]=y):y=t[11],t[12]!==m?(v=a.jsxs(Xe,{children:[h,a.jsxs(Ze,{className:"w-80 overflow-auto",align:"end",side:"bottom",onFocusOutside:Hc,children:[p,g,a.jsxs(q,{onClick:m,variant:"link",className:"px-0",children:[y,"User settings"]})]})]}),t[12]=m,t[13]=v):v=t[13],t[14]!==o||t[15]!==s?(b=a.jsx(pe,{open:o,onOpenChange:s,children:d}),t[14]=o,t[15]=s,t[16]=b):b=t[16],t[17]!==v||t[18]!==b?(x=a.jsxs(a.Fragment,{children:[v,b]}),t[17]=v,t[18]=b,t[19]=x):x=t[19],x};function Hc(e){return e.preventDefault()}const Wc=e=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 448 512",...e,children:a.jsx("path",{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"})}),Uc=e=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 640 512",fill:"currentColor",...e,children:a.jsx("path",{d:"M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"})}),Bc=p.createContext(null);function zc(){const e=p.useContext(Bc);if(null===e)throw new Error("No Tree Api Provided");return e}const $c=p.createContext(null);const Vc=p.createContext(null);const Kc=p.createContext(0);function Gc(){p.useContext(Kc)}function Jc(e,t,n){return Math.max(Math.min(e,n),t)}function Yc(e){return e&&e.isLeaf}function Xc(e){return e&&e.isInternal&&!e.isOpen}function Zc(e){var t;return e&&e.isOpen&&!(null===(t=e.children)||void 0===t?void 0:t.length)}const Qc=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},el=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex((t=>t.id===e.id))};function tl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){const e=tl(n,t);if(e)return e}return null}function nl(e,t){if(t(e),e.children)for(let n of e.children)nl(n,t)}function rl(e){const t=al(e);let n;for(let r=0;r<t.length;++r){if(t[r]===e){n=il(t,r);break}}null==n||n.focus()}function ol(e){const t=al(e);let n;for(let r=0;r<t.length;++r){if(t[r]===e){n=sl(t,r);break}}null==n||n.focus()}function il(e,t){return t+1<e.length?e[t+1]:e[0]}function sl(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function al(e){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((t=>t===e||!e.contains(t)))}function cl(e,t){return"boolean"==typeof t?t:"string"==typeof t?e[t]:t(e)}function ll(e){return null===e?null:ul(e)}function ul(e){return"string"==typeof e?e:e.id}function dl(e,...t){if(e)return e(...t)}function fl(e){return new Promise(((t,n)=>{let r=0;!function o(){r+=1,100===r&&n(),e()?t():setTimeout(o,10)}()}))}function hl(e){var t,n;const r=e.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:null!==(n=null===(t=e.root.children)||void 0===t?void 0:t.length)&&void 0!==n?n:0}function pl(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const gl=Object.freeze(Object.defineProperty({__proto__:null,access:cl,bound:Jc,dfs:tl,focusNextElement:rl,focusPrevElement:ol,getInsertIndex:hl,getInsertParentId:pl,identify:ul,identifyNull:ll,indexOf:el,isClosed:Xc,isDescendant:Qc,isItem:Yc,isOpenWithEmptyChildren:Zc,mergeRefs:function(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}},noop:function(){},safeRun:dl,waitFor:fl,walk:nl},Symbol.toStringTag,{value:"Module"})),ml={display:"flex",alignItems:"center",zIndex:1},yl={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},vl={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},bl=o.memo((function({top:e,left:t,indent:n}){const r={position:"absolute",pointerEvents:"none",top:e-2+"px",left:t+"px",right:n+"px"};return a.jsxs("div",{style:Object.assign(Object.assign({},ml),r),children:[a.jsx("div",{style:Object.assign({},vl)}),a.jsx("div",{style:Object.assign({},yl)})]})}));function xl({node:e,attrs:t,innerRef:n,children:r}){return a.jsx("div",Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function wl(e){return a.jsxs("div",{ref:e.dragHandle,style:e.style,children:[a.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?a.jsx(Dl,Object.assign({},e)):a.jsx(Tl,Object.assign({},e))]})}function Tl(e){return a.jsx(a.Fragment,{children:a.jsx("span",{children:e.node.data.name})})}function Dl({node:e}){const t=p.useRef();return p.useEffect((()=>{var e,n;null===(e=t.current)||void 0===e||e.focus(),null===(n=t.current)||void 0===n||n.select()}),[]),a.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{var r;"Escape"===n.key&&e.reset(),"Enter"===n.key&&e.submit((null===(r=t.current)||void 0===r?void 0:r.value)||"")}})}function Sl(e){return{type:"EDIT",id:e}}function jl(e){return{type:"FOCUS",id:e}}class Ol{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.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===Rl}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&&!(null===(e=this.prev)||void 0===e?void 0:e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(null===(e=this.next)||void 0===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 null===this.rowIndex?null:this.tree.at(this.rowIndex+1)}get prev(){return null===this.rowIndex?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,t;const n=this.childIndex;return null!==(t=null===(e=this.parent)||void 0===e?void 0:e.children[n+1])&&void 0!==t?t:null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.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 Ol(Object.assign({},this))}edit(){return this.tree.edit(this)}}const Rl="__REACT_ARBORIST_INTERNAL_ROOT__";function Cl(e){var t;function n(t,r,o){const i=e.accessId(t),s=new Ol({tree:e,data:t,level:r,parent:o,id:i,children:null,isDraggable:e.isDraggable(t),rowIndex:null}),a=e.accessChildren(t);return a&&(s.children=a.map((e=>n(e,r+1,s)))),s}const r=new Ol({tree:e,id:Rl,data:{id:Rl},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),o=null!==(t=e.props.data)&&void 0!==t?t:[];return r.children=o.map((e=>n(e,0,r))),r}const kl={open:(e,t)=>({type:"VISIBILITY_OPEN",id:e,filtered:t}),close:(e,t)=>({type:"VISIBILITY_CLOSE",id:e,filtered:t}),toggle:(e,t)=>({type:"VISIBILITY_TOGGLE",id:e,filtered:t}),clear:e=>({type:"VISIBILITY_CLEAR",filtered:e})};function Nl(e={},t){if("VISIBILITY_OPEN"===t.type)return Object.assign(Object.assign({},e),{[t.id]:!0});if("VISIBILITY_CLOSE"===t.type)return Object.assign(Object.assign({},e),{[t.id]:!1});if("VISIBILITY_TOGGLE"===t.type){const n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}return"VISIBILITY_CLEAR"===t.type?{}:e}const Pl=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:null!==(t=null==e?void 0:e.initialOpenState)&&void 0!==t?t:{}},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}}},El=e=>({type:"SELECTION_ONLY",id:ul(e)}),Il=e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(ul)}),_l=e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(ul)}),Ml=e=>Object.assign({type:"SELECTION_SET"},e),ql=e=>({type:"SELECTION_MOST_RECENT",id:null===e?null:ul(e)}),Al=e=>({type:"SELECTION_ANCHOR",id:null===e?null:ul(e)});const Ll={cursor:e=>({type:"DND_CURSOR",cursor:e}),dragStart:(e,t)=>({type:"DND_DRAG_START",id:e,dragIds:t}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(e,t)=>({type:"DND_HOVERING",parentId:e,index:t})};const Fl={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Hl=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},Wl=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function Ul({offset:e,mouse:t,id:n,dragIds:r,isDragging:o}){return a.jsxs(Bl,{isDragging:o,children:[a.jsx(zl,{offset:e,children:a.jsx(Vl,{id:n,dragIds:r})}),a.jsx($l,{mouse:t,count:r.length})]})}const Bl=p.memo((function(e){return e.isDragging?a.jsx("div",{style:Fl,children:e.children}):null}));function zl(e){return a.jsx("div",{className:"row preview",style:Hl(e.offset),children:e.children})}function $l(e){const{count:t,mouse:n}=e;return t>1?a.jsx("div",{className:"selected-count",style:Wl(n),children:t}):null}const Vl=p.memo((function(e){const t=zc(),n=t.get(e.id);return n?a.jsx(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:"transparent"},tree:t}):null}));var Kl=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function Gl(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(r=e[n],o=t[n],!(r===o||Kl(r)&&Kl(o)))return!1;var r,o;return!0}function Jl(e,t){var n;void 0===t&&(t=Gl);var r,o=[],i=!1;return function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}var Yl="object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()};function Xl(e){cancelAnimationFrame(e.id)}var Zl=-1;function Ql(e){if(void 0===e&&(e=!1),-1===Zl||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),Zl=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Zl}var eu=null;function tu(e){if(void 0===e&&(e=!1),null===eu||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),o=r.style;return o.width="100px",o.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?eu="positive-descending":(t.scrollLeft=1,eu=0===t.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(t),eu}return eu}var nu=function(e,t){return e};function ru(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,o=e.getItemSize,i=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return(t=function(e){var t,d;function f(t){var r;return(r=e.call(this,t)||this)._instanceProps=c(r.props,xt(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:xt(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Jl((function(e,t,n,o){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:o})})),r._callOnScroll=void 0,r._callOnScroll=Jl((function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})})),r._getItemStyle=void 0,r._getItemStyle=function(e){var t,i=r.props,s=i.direction,a=i.itemSize,c=i.layout,u=r._getItemStyleCache(l&&a,l&&c,l&&s);if(u.hasOwnProperty(e))t=u[e];else{var d=n(r.props,e,r._instanceProps),f=o(r.props,e,r._instanceProps),h="horizontal"===s||"horizontal"===c,p="rtl"===s,g=h?d:0;u[e]=t={position:"absolute",left:p?void 0:g,right:p?g:void 0,top:h?0:d,height:h?"100%":f,width:h?f:"100%"}}return t},r._getItemStyleCache=void 0,r._getItemStyleCache=Jl((function(e,t,n){return{}})),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,o=t.scrollLeft,i=t.scrollWidth;r.setState((function(e){if(e.scrollOffset===o)return null;var t=r.props.direction,s=o;if("rtl"===t)switch(tu()){case"negative":s=-o;break;case"positive-descending":s=i-n-o}return s=Math.max(0,Math.min(s,i-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<s?"forward":"backward",scrollOffset:s,scrollUpdateWasRequested:!1}}),r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,o=t.scrollHeight,i=t.scrollTop;r.setState((function(e){if(e.scrollOffset===i)return null;var t=Math.max(0,Math.min(i,o-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!1}}),r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,"function"==typeof t?t(e):null!=t&&"object"==typeof t&&t.hasOwnProperty("current")&&(t.current=e)},r._resetIsScrollingDebounced=function(){var e,t,n,o;null!==r._resetIsScrollingTimeoutId&&Xl(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=(e=r._resetIsScrolling,t=150,n=Yl(),o={id:requestAnimationFrame((function r(){Yl()-n>=t?e.call(null):o.id=requestAnimationFrame(r)}))})},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},(function(){r._getItemStyleCache(-1,null)}))},r}d=e,(t=f).prototype=Object.create(d.prototype),t.prototype.constructor=t,bt(t,d),f.getDerivedStateFromProps=function(e,t){return ou(e,t),u(e),null};var h=f.prototype;return h.scrollTo=function(e){e=Math.max(0,e),this.setState((function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}}),this._resetIsScrollingDebounced)},h.scrollToItem=function(e,t){void 0===t&&(t="auto");var n=this.props,r=n.itemCount,o=n.layout,s=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var a=0;if(this._outerRef){var c=this._outerRef;a="vertical"===o?c.scrollWidth>c.clientWidth?Ql():0:c.scrollHeight>c.clientHeight?Ql():0}this.scrollTo(i(this.props,e,t,s,this._instanceProps,a))},h.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if("number"==typeof n&&null!=this._outerRef){var o=this._outerRef;"horizontal"===t||"horizontal"===r?o.scrollLeft=n:o.scrollTop=n}this._callPropsCallbacks()},h.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,o=r.scrollOffset;if(r.scrollUpdateWasRequested&&null!=this._outerRef){var i=this._outerRef;if("horizontal"===t||"horizontal"===n)if("rtl"===t)switch(tu()){case"negative":i.scrollLeft=-o;break;case"positive-ascending":i.scrollLeft=o;break;default:var s=i.clientWidth,a=i.scrollWidth;i.scrollLeft=a-s-o}else i.scrollLeft=o;else i.scrollTop=o}this._callPropsCallbacks()},h.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&Xl(this._resetIsScrollingTimeoutId)},h.render=function(){var e=this.props,t=e.children,n=e.className,o=e.direction,i=e.height,s=e.innerRef,a=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=void 0===d?nu:d,h=e.layout,g=e.outerElementType,m=e.outerTagName,y=e.style,v=e.useIsScrolling,b=e.width,x=this.state.isScrolling,w="horizontal"===o||"horizontal"===h,T=w?this._onScrollHorizontal:this._onScrollVertical,D=this._getRangeToRender(),S=D[0],j=D[1],O=[];if(l>0)for(var R=S;R<=j;R++)O.push(p.createElement(t,{data:u,key:f(R,u),index:R,isScrolling:v?x:void 0,style:this._getItemStyle(R)}));var C=r(this.props,this._instanceProps);return p.createElement(g||m||"div",{className:n,onScroll:T,ref:this._outerRefSetter,style:Qe({position:"relative",height:i,width:b,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:o},y)},p.createElement(a||c||"div",{children:O,ref:s,style:{height:w?"100%":C,pointerEvents:x?"none":void 0,width:w?C:"100%"}}))},h._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],o=e[3];this._callOnItemsRendered(t,n,r,o)}if("function"==typeof this.props.onScroll){var i=this.state,s=i.scrollDirection,a=i.scrollOffset,c=i.scrollUpdateWasRequested;this._callOnScroll(s,a,c)}},h._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,o=r.isScrolling,i=r.scrollDirection,c=r.scrollOffset;if(0===t)return[0,0,0,0];var l=s(this.props,c,this._instanceProps),u=a(this.props,l,c,this._instanceProps),d=o&&"backward"!==i?1:Math.max(1,n),f=o&&"forward"!==i?1:Math.max(1,n);return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},f}(p.PureComponent)).defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ou=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},iu=ru({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,o,i){var s=e.direction,a=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f="horizontal"===s||"horizontal"===u?d:a,h=Math.max(0,c*l-f),p=Math.min(h,t*l),g=Math.max(0,t*l-f+l+i);switch("smart"===n&&(n=r>=g-f&&r<=p+f?"auto":"center"),n){case"start":return p;case"end":return g;case"center":var m=Math.round(g+(p-g)/2);return m<Math.ceil(f/2)?0:m>h+Math.floor(f/2)?h:m;default:return r>=g&&r<=p?r:r<g?g:p}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,o=e.height,i=e.itemCount,s=e.itemSize,a=e.layout,c=e.width,l=t*s,u="horizontal"===r||"horizontal"===a?c:o,d=Math.ceil((u+n-l)/s);return Math.max(0,Math.min(i-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function su(){var e,t;const n=zc(),r=function(){const e=p.useContext(Vc);if(null===e)throw new Error("Provide a DnDContext");return e}().cursor;if(!r||"line"!==r.type)return null;const o=n.indent,i=n.rowHeight*r.index+(null!==(t=null!==(e=n.props.padding)&&void 0!==e?e:n.props.paddingTop)&&void 0!==t?t:0),s=o*r.level,c=n.renderCursor;return a.jsx(c,{top:i,left:s,indent:o})}const au=p.forwardRef((function(e,t){const{children:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]),o=zc();return a.jsxs("div",Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&o.deselectAll()},children:[a.jsx(cu,{}),n]}))})),cu=()=>{const e=zc();return a.jsx("div",{style:{height:e.visibleNodes.length*e.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:a.jsx(su,{})})};const lu=p.forwardRef((function(e,t){var n,r,o,i,{style:s}=e,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["style"]);const l=zc(),u=null!==(r=null!==(n=l.props.padding)&&void 0!==n?n:l.props.paddingTop)&&void 0!==r?r:0,d=null!==(i=null!==(o=l.props.padding)&&void 0!==o?o:l.props.paddingBottom)&&void 0!==i?i:0;return a.jsx("div",Object.assign({ref:t,style:Object.assign(Object.assign({},s),{height:`${parseFloat(s.height)+u+d}px`})},c))}));var uu,du,fu=p.createContext({dragDropManager:void 0});function hu(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=0;(i=new Error(t.replace(/%s/g,(function(){return r[s++]})))).name="Invariant Violation"}throw i.framesToPop=1,i}}(du=uu||(uu={})).SOURCE="SOURCE",du.TARGET="TARGET";var pu="dnd-core/INIT_COORDS",gu="dnd-core/BEGIN_DRAG",mu="dnd-core/PUBLISH_DRAG_SOURCE",yu="dnd-core/HOVER",vu="dnd-core/DROP",bu="dnd-core/END_DRAG";function xu(e,t){return{type:pu,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function wu(e){return(wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Tu(e){return"object"===wu(e)}var Du={type:pu,payload:{clientOffset:null,sourceClientOffset:null}};function Su(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},r=n.publishSource,o=void 0===r||r,i=n.clientOffset,s=n.getSourceClientOffset,a=e.getMonitor(),c=e.getRegistry();e.dispatch(xu(i)),function(e,t,n){hu(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){hu(n.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,c);var l=function(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,a);if(null!==l){var u=null;if(i){if(!s)throw new Error("getSourceClientOffset must be defined");!function(e){hu("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(s),u=s(l)}e.dispatch(xu(i,u));var d=c.getSource(l).beginDrag(a,l);if(null!=d){!function(e){hu(Tu(e),"Item must be an object.")}(d),c.pinSource(l);var f=c.getSourceType(l);return{type:gu,payload:{itemType:f,item:d,sourceId:l,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!o}}}}else e.dispatch(Du)}}function ju(e){return function(){if(e.getMonitor().isDragging())return{type:mu}}}function Ou(e,t){return null===t?null===e:Array.isArray(e)?e.some((function(e){return e===t})):e===t}function Ru(e){return function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).clientOffset;!function(e){hu(Array.isArray(e),"Expected targetIds to be an array.")}(t);var r=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,n){hu(t.isDragging(),"Cannot call hover while not dragging."),hu(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r<e.length;r++){var o=e[r];hu(e.lastIndexOf(o)===r,"Expected targetIds to be unique in the passed array."),hu(n.getTarget(o),"Expected targetIds to be registered.")}}(r,o,i),function(e,t,n){for(var r=e.length-1;r>=0;r--){var o=e[r];Ou(t.getTargetType(o),n)||e.splice(r,1)}}(r,i,o.getItemType()),function(e,t,n){e.forEach((function(e){n.getTarget(e).hover(t,e)}))}(r,o,i),{type:yu,payload:{targetIds:r,clientOffset:n||null}}}}function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cu(Object(n),!0).forEach((function(t){Nu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pu(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();!function(e){hu(e.isDragging(),"Cannot call drop while not dragging."),hu(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);var o=function(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach((function(o,i){var s=function(e,t,n,r){var o=n.getTarget(e),i=o?o.drop(r,e):void 0;(function(e){hu(void 0===e||Tu(e),"Drop result must either be an object or undefined.")})(i),void 0===i&&(i=0===t?{}:r.getDropResult());return i}(o,i,r,n),a={type:vu,payload:{dropResult:ku(ku({},t),s)}};e.dispatch(a)}))}}function Eu(e){return function(){var t=e.getMonitor(),n=e.getRegistry();!function(e){hu(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var r=t.getSourceId();null!=r&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource());return{type:bu}}}function Iu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function _u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mu=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_u(this,"store",void 0),_u(this,"monitor",void 0),_u(this,"backend",void 0),_u(this,"isSetUp",!1),_u(this,"handleRefCountChange",(function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))})),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return Iu(e,[{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,t=this.store.dispatch;var n=function(e){return{beginDrag:Su(e),publishDragSource:ju(e),hover:Ru(e),drop:Pu(e),endDrag:Eu(e)}}(this);return Object.keys(n).reduce((function(r,o){var i,s=n[o];return r[o]=(i=s,function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=i.apply(e,r);void 0!==s&&t(s)}),r}),{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),e}();function qu(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Au="function"==typeof Symbol&&Symbol.observable||"@@observable",Lu=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fu={INIT:"@@redux/INIT"+Lu(),REPLACE:"@@redux/REPLACE"+Lu(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Lu()}};function Hu(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(qu(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(qu(1));return n(Hu)(e,t)}if("function"!=typeof e)throw new Error(qu(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(qu(3));return i}function d(e){if("function"!=typeof e)throw new Error(qu(4));if(c)throw new Error(qu(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(qu(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(qu(7));if(void 0===e.type)throw new Error(qu(8));if(c)throw new Error(qu(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++){(0,t[n])()}return e}return f({type:Fu.INIT}),(r={dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(qu(10));o=e,f({type:Fu.REPLACE})}})[Au]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(qu(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Au]=function(){return this},e},r}var Wu=function(e,t){return e===t};function Uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uu(Object(n),!0).forEach((function(t){zu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $u={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Vu(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$u,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case pu:case gu:return{initialSourceClientOffset:o.sourceClientOffset,initialClientOffset:o.clientOffset,clientOffset:o.clientOffset};case yu:return e=n.clientOffset,t=o.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?n:Bu(Bu({},n),{},{clientOffset:o.clientOffset});case bu:case vu:return $u;default:return n}}var Ku="dnd-core/ADD_SOURCE",Gu="dnd-core/ADD_TARGET",Ju="dnd-core/REMOVE_SOURCE",Yu="dnd-core/REMOVE_TARGET";function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xu(Object(n),!0).forEach((function(t){Qu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ed={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function td(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ed,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case gu:return Zu(Zu({},n),{},{itemType:o.itemType,item:o.item,sourceId:o.sourceId,isSourcePublic:o.isSourcePublic,dropResult:null,didDrop:!1});case mu:return Zu(Zu({},n),{},{isSourcePublic:!0});case yu:return Zu(Zu({},n),{},{targetIds:o.targetIds});case Yu:return-1===n.targetIds.indexOf(o.targetId)?n:Zu(Zu({},n),{},{targetIds:(e=n.targetIds,t=o.targetId,e.filter((function(e){return e!==t})))});case vu:return Zu(Zu({},n),{},{dropResult:o.dropResult,didDrop:!0,targetIds:[]});case bu:return Zu(Zu({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function nd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case Ku:case Gu:return e+1;case Ju:case Yu:return e-1;default:return e}}var rd=[],od=[];function id(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case yu:break;case Ku:case Gu:case Yu:case Ju:return rd;default:return od}var t=e.payload,n=t.targetIds,r=void 0===n?[]:n,o=t.prevTargetIds,i=void 0===o?[]:o,s=function(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var o=[];return n.forEach((function(e,t){1===e&&o.push(t)})),o}(r,i),a=s.length>0||!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wu;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(r,i);if(!a)return rd;var c=i[i.length-1],l=r[r.length-1];return c!==l&&(c&&s.push(c),l&&s.push(l)),s}function sd(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+1}function ad(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ad(Object(n),!0).forEach((function(t){ld(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ad(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ld(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ud(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:id(r.dirtyHandlerIds,{type:o.type,payload:cd(cd({},o.payload),{},{prevTargetIds:(e=r,t="dragOperation.targetIds",n=[],t.split(".").reduce((function(e,t){return e&&e[t]?e[t]:n||null}),e))})}),dragOffset:Vu(r.dragOffset,o),refCount:nd(r.refCount,o),dragOperation:td(r.dragOperation,o),stateId:sd(r.stateId)}}function dd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function fd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function hd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}rd.__IS_NONE__=!0,od.__IS_ALL__=!0;var pd=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hd(this,"store",void 0),hd(this,"registry",void 0),this.store=t,this.registry=n}return fd(e,[{key:"subscribeToStateChange",value:function(e){var t=this,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0}).handlerIds;hu("function"==typeof e,"listener must be a function."),hu(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var r=this.store.getState().stateId;return this.store.subscribe((function(){var o=t.store.getState(),i=o.stateId;try{var s=i===r||i===r+1&&!function(e,t){return e!==rd&&(e===od||void 0===t||(n=e,t.filter((function(e){return n.indexOf(e)>-1}))).length>0);var n}(o.dirtyHandlerIds,n);s||e()}finally{r=i}}))}},{key:"subscribeToOffsetChange",value:function(e){var t=this;hu("function"==typeof e,"listener must be a function.");var n=this.store.getState().dragOffset;return this.store.subscribe((function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())}))}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return hu(t,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return hu(t,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&(Ou(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return hu(t,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}},{key:"isOverTarget",value:function(e){if(!e)return!1;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),r=this.getItemType();if(r&&!Ou(n,r))return!1;var o=this.getTargetIds();if(!o.length)return!1;var i=o.indexOf(e);return t?i===o.length-1:i>-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 Boolean(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,r=e.clientOffset,o=e.initialClientOffset,i=e.initialSourceClientOffset,r&&o&&i?dd((n=i,{x:(t=r).x+n.x,y:t.y+n.y}),o):null;var e,t,n,r,o,i}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,t=e.clientOffset,n=e.initialClientOffset,t&&n?dd(t,n):null;var e,t,n}}]),e}(),gd=0;function md(e){return(md="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yd(e,t){t&&Array.isArray(e)?e.forEach((function(e){return yd(e,!1)})):hu("string"==typeof e||"symbol"===md(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const vd="undefined"!=typeof global?global:self,bd=vd.MutationObserver||vd.WebKitMutationObserver;function xd(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const wd="function"==typeof bd?function(e){let t=1;const n=new bd(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:xd;class Td{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Dd=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=wd(this.flush),this.requestErrorThrow=xd((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Sd=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new Td(this.onError,(e=>t[t.length]=e));return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(Dd.registerPendingError);function jd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Od(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Cd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kd(e){var t=(gd++).toString();switch(e){case uu.SOURCE:return"S".concat(t);case uu.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Nd(e){switch(e[0]){case"S":return uu.SOURCE;case"T":return uu.TARGET;default:hu(!1,"Cannot parse handler ID: ".concat(e))}}function Pd(e,t){var n=e.entries(),r=!1;do{var o=n.next(),i=o.done;if(Rd(o.value,2)[1]===t)return!0;r=!!i}while(!r);return!1}var Ed=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Od(this,"types",new Map),Od(this,"dragSources",new Map),Od(this,"dropTargets",new Map),Od(this,"pinnedSourceId",null),Od(this,"pinnedSource",null),Od(this,"store",void 0),this.store=t}return jd(e,[{key:"addSource",value:function(e,t){yd(e),function(e){hu("function"==typeof e.canDrag,"Expected canDrag to be a function."),hu("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),hu("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var n=this.addHandler(uu.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Ku,payload:{sourceId:e}}}(n)),n}},{key:"addTarget",value:function(e,t){yd(e,!0),function(e){hu("function"==typeof e.canDrop,"Expected canDrop to be a function."),hu("function"==typeof e.hover,"Expected hover to be a function."),hu("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var n=this.addHandler(uu.TARGET,e,t);return this.store.dispatch(function(e){return{type:Gu,payload:{targetId:e}}}(n)),n}},{key:"containsHandler",value:function(e){return Pd(this.dragSources,e)||Pd(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return hu(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return hu(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return hu(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return hu(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Nd(e)===uu.SOURCE}},{key:"isTargetId",value:function(e){return Nd(e)===uu.TARGET}},{key:"removeSource",value:function(e){var t,n=this;hu(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Ju,payload:{sourceId:e}}}(e)),t=function(){n.dragSources.delete(e),n.types.delete(e)},Dd.enqueueTask(Sd.create(t))}},{key:"removeTarget",value:function(e){hu(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Yu,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);hu(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){hu(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var r=kd(e);return this.types.set(r,t),e===uu.SOURCE?this.dragSources.set(r,n):e===uu.TARGET&&this.dropTargets.set(r,n),r}}]),e}();function Id(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return Hu(ud,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(arguments.length>3&&void 0!==arguments[3]&&arguments[3]),o=new pd(r,new Ed(r)),i=new Mu(r,o),s=e(i,t,n);return i.receiveBackend(s),i}var _d=["children"];function Md(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ad(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Ld=0,Fd=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),Hd=p.memo((function(e){var t=e.children,n=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wd(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;o[Fd]||(o[Fd]={dragDropManager:Id(e,t,n,r)});return o[Fd]}(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}(Ad(e,_d)),r=Md(n,2),o=r[0],i=r[1];return p.useEffect((function(){if(i){var e=Wd();return++Ld,function(){0==--Ld&&(e[Fd]=null)}}}),[]),a.jsx(fu.Provider,Object.assign({value:o},{children:t}),void 0)}));function Wd(){return"undefined"!=typeof global?global:window}function Ud(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Bd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zd=!1,$d=!1,Vd=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Bd(this,"internalMonitor",void 0),Bd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return Ud(e,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){hu(!zd,"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 zd=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{zd=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;hu(!$d,"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 $d=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{$d=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{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()}}]),e}();function Kd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Gd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jd=!1,Yd=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gd(this,"internalMonitor",void 0),Gd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return Kd(e,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;hu(!Jd,"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 Jd=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Jd=!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()}}]),e}();function Xd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!p.isValidElement(t)){var r=t;return e(r,n),r}var o=t;return function(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}(o),function(e,t){var n=e.ref;return hu("string"!=typeof n,"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"),n?p.cloneElement(e,{ref:function(e){Qd(n,e),Qd(t,e)}}):p.cloneElement(e,{ref:t})}(o,n?function(t){return e(t,n)}:e)}}function Zd(e){var t={};return Object.keys(e).forEach((function(n){var r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var o=Xd(r);t[n]=function(){return o}}})),t}function Qd(e,t){"function"==typeof e?e(t):e.current=t}function ef(e){return(ef="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tf(e){return null!==e&&"object"===ef(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function nf(e,t,n,r){var o=void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var l=i[c];if(!a(l))return!1;var u=e[l],d=t[l];if(!1===(o=void 0)||void 0===o&&u!==d)return!1}return!0}function rf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function of(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sf=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),of(this,"hooks",Zd({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,tf(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,tf(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),of(this,"handlerId",null),of(this,"dragSourceRef",null),of(this,"dragSourceNode",void 0),of(this,"dragSourceOptionsInternal",null),of(this,"dragSourceUnsubscribe",void 0),of(this,"dragPreviewRef",null),of(this,"dragPreviewNode",void 0),of(this,"dragPreviewOptionsInternal",null),of(this,"dragPreviewUnsubscribe",void 0),of(this,"lastConnectedHandlerId",null),of(this,"lastConnectedDragSource",null),of(this,"lastConnectedDragSourceOptions",null),of(this,"lastConnectedDragPreview",null),of(this,"lastConnectedDragPreviewOptions",null),of(this,"backend",void 0),this.backend=t}return rf(e,[{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,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(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,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();t&&this.disconnectDragPreview(),this.handlerId&&(e?t&&(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!nf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!nf(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}}]),e}();function af(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function cf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lf=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),cf(this,"hooks",Zd({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,tf(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),cf(this,"handlerId",null),cf(this,"dropTargetRef",null),cf(this,"dropTargetNode",void 0),cf(this,"dropTargetOptionsInternal",null),cf(this,"unsubscribeDropTarget",void 0),cf(this,"lastConnectedHandlerId",null),cf(this,"lastConnectedDropTarget",null),cf(this,"lastConnectedDropTargetOptions",null),cf(this,"backend",void 0),this.backend=t}return af(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{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!nf(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}}]),e}();var uf="undefined"!=typeof window?p.useLayoutEffect:p.useEffect;function df(e){return(df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ff(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function hf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pf=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hf(this,"spec",void 0),hf(this,"monitor",void 0),hf(this,"connector",void 0),this.spec=t,this.monitor=n,this.connector=r}return ff(e,[{key:"beginDrag",value:function(){var e,t=this.spec,n=this.monitor;return null!==(e="object"===df(t.item)?t.item:"function"==typeof t.item?t.item(n):{})&&void 0!==e?e:null}},{key:"canDrag",value:function(){var e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}},{key:"isDragging",value:function(e,t){var n=this.spec,r=this.monitor,o=n.isDragging;return o?o(r):t===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,t=this.monitor,n=this.connector,r=e.end;r&&r(t.getItem(),t),n.reconnect()}}]),e}();function gf(){var e=p.useContext(fu).dragDropManager;return hu(null!=e,"Expected drag drop context"),e}function mf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return yf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vf(e,t,n){var r=gf(),o=function(e,t,n){var r=p.useMemo((function(){return new pf(e,t,n)}),[t,n]);return p.useEffect((function(){r.spec=e}),[e]),r}(e,t,n),i=function(e){return p.useMemo((function(){var t=e.type;return hu(null!=t,"spec.type must be defined"),t}),[e])}(e);uf((function(){if(null!=i){var e=function(e,t,n){var r=n.getRegistry(),o=r.addSource(e,t);return[o,function(){return r.removeSource(o)}]}(i,o,r),s=mf(e,2),a=s[0],c=s[1];return t.receiveHandlerId(a),n.receiveHandlerId(a),c}}),[r,t,n,o,i])}function bf(e){return function(e){if(Array.isArray(e))return xf(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return xf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xf(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wf(e,t){var n=bf(t||[]);return null==t&&"function"!=typeof e&&n.push(e),p.useMemo((function(){return"function"==typeof e?e():e}),n)}function Tf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Df(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Df(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Df(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sf(e,t,n){var r=Tf(p.useState((function(){return t(e)})),2),o=r[0],i=r[1],s=p.useCallback((function(){var r=t(e);ct(o,r)||(i(r),n&&n())}),[o,e,n]);return uf(s),[o,s]}function jf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Of(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Of(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Of(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Rf(e,t,n){return function(e,t,n){var r=jf(Sf(e,t,n),2),o=r[0],i=r[1];return uf((function(){var t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})}),[e,i]),o}(t,e||function(){return{}},(function(){return n.reconnect()}))}function Cf(e){return p.useMemo((function(){return e.hooks.dragSource()}),[e])}function kf(e){return p.useMemo((function(){return e.hooks.dragPreview()}),[e])}function Nf(e,t){var n=wf(e,t);hu(!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,o=(r=gf(),p.useMemo((function(){return new Vd(r)}),[r])),i=function(e,t){var n=gf(),r=p.useMemo((function(){return new sf(n.getBackend())}),[n]);return uf((function(){return r.dragSourceOptions=e||null,r.reconnect(),function(){return r.disconnectDragSource()}}),[r,e]),uf((function(){return r.dragPreviewOptions=t||null,r.reconnect(),function(){return r.disconnectDragPreview()}}),[r,t]),r}(n.options,n.previewOptions);return vf(n,o,i),[Rf(n.collect,o,i),Cf(i),kf(i)]}function Pf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Ef(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var If=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ef(this,"spec",void 0),Ef(this,"monitor",void 0),this.spec=t,this.monitor=n}return Pf(e,[{key:"canDrop",value:function(){var e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}},{key:"hover",value:function(){var e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}},{key:"drop",value:function(){var e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}}]),e}();function _f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Mf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qf(e,t,n){var r=gf(),o=function(e,t){var n=p.useMemo((function(){return new If(e,t)}),[t]);return p.useEffect((function(){n.spec=e}),[e]),n}(e,t),i=function(e){var t=e.accept;return p.useMemo((function(){return hu(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]}),[t])}(e);uf((function(){var e=function(e,t,n){var r=n.getRegistry(),o=r.addTarget(e,t);return[o,function(){return r.removeTarget(o)}]}(i,o,r),s=_f(e,2),a=s[0],c=s[1];return t.receiveHandlerId(a),n.receiveHandlerId(a),c}),[r,t,o,n,i.map((function(e){return e.toString()})).join("|")])}function Af(e){return p.useMemo((function(){return e.hooks.dropTarget()}),[e])}function Lf(e,t){var n,r=wf(e,t),o=(n=gf(),p.useMemo((function(){return new Yd(n)}),[n])),i=function(e){var t=gf(),n=p.useMemo((function(){return new lf(t.getBackend())}),[t]);return uf((function(){return n.dropTargetOptions=e||null,n.reconnect(),function(){return n.disconnectDropTarget()}}),[e]),n}(r.options);return qf(r,o,i),[Rf(r.collect,o,i),Af(i)]}function Ff(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(rp){a=!0,o=rp}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Hf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wf(e){var t=null;return function(){return null==t&&(t=e()),t}}function Uf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Bf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Bf(this,"entered",[]),Bf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return Uf(e,[{key:"enter",value:function(e){var t=this,n=this.entered.length;return this.entered=function(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var o=[];return n.forEach((function(e){return o.push(e)})),o}(this.entered.filter((function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))})),[e]),0===n&&this.entered.length>0}},{key:"leave",value:function(e){var t,n,r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),n=e,t.filter((function(e){return e!==n}))),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}]),e}(),$f=Wf((function(){return/firefox/i.test(navigator.userAgent)})),Vf=Wf((function(){return Boolean(window.safari)}));function Kf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Gf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jf=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gf(this,"xs",void 0),Gf(this,"ys",void 0),Gf(this,"c1s",void 0),Gf(this,"c2s",void 0),Gf(this,"c3s",void 0);for(var r=t.length,o=[],i=0;i<r;i++)o.push(i);o.sort((function(e,n){return t[e]<t[n]?-1:1}));for(var s,a,c=[],l=[],u=0;u<r-1;u++)s=t[u+1]-t[u],a=n[u+1]-n[u],c.push(s),l.push(a/s);for(var d=[l[0]],f=0;f<c.length-1;f++){var h=l[f],p=l[f+1];if(h*p<=0)d.push(0);else{s=c[f];var g=c[f+1],m=s+g;d.push(3*m/((m+g)/h+(m+s)/p))}}d.push(l[l.length-1]);for(var y,v=[],b=[],x=0;x<d.length-1;x++){y=l[x];var w=d[x],T=1/c[x],D=w+d[x+1]-y-y;v.push((y-w-D)*T),b.push(D*T*T)}this.xs=t,this.ys=n,this.c1s=d,this.c2s=v,this.c3s=b}return Kf(e,[{key:"interpolate",value:function(e){var t=this.xs,n=this.ys,r=this.c1s,o=this.c2s,i=this.c3s,s=t.length-1;if(e===t[s])return n[s];for(var a,c=0,l=i.length-1;c<=l;){var u=t[a=Math.floor(.5*(c+l))];if(u<e)c=a+1;else{if(!(u>e))return n[a];l=a-1}}var d=e-t[s=Math.max(0,l)],f=d*d;return n[s]+r[s]*d+o[s]*f+i[s]*d*f}}]),e}();function Yf(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Xf(e){return{x:e.clientX,y:e.clientY}}function Zf(e,t,n,r,o){var i,s,a,c="IMG"===(i=t).nodeName&&($f()||!(null!==(s=document.documentElement)&&void 0!==s&&s.contains(i))),l=Yf(c?e:t),u={x:n.x-l.x,y:n.y-l.y},d=e.offsetWidth,f=e.offsetHeight,h=r.anchorX,p=r.anchorY,g=function(e,t,n,r){var o=e?t.width:n,i=e?t.height:r;return Vf()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(c,t,d,f),m=g.dragPreviewWidth,y=g.dragPreviewHeight,v=o.offsetX,b=o.offsetY,x=0===b||b;return{x:0===v||v?v:new Jf([0,.5,1],[u.x,u.x/d*m,u.x+m-d]).interpolate(h),y:x?b:(a=new Jf([0,.5,1],[u.y,u.y/f*y,u.y+y-f]).interpolate(p),Vf()&&c&&(a+=(window.devicePixelRatio-1)*y),a)}}var Qf="__NATIVE_FILE__",eh="__NATIVE_URL__",th="__NATIVE_TEXT__",nh="__NATIVE_HTML__";const rh=Object.freeze(Object.defineProperty({__proto__:null,FILE:Qf,HTML:nh,TEXT:th,URL:eh},Symbol.toStringTag,{value:"Module"}));function oh(e,t,n){var r=t.reduce((function(t,n){return t||e.getData(n)}),"");return null!=r?r:n}var ih;function sh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ah=(sh(ih={},Qf,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),sh(ih,nh,{exposeProperties:{html:function(e,t){return oh(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),sh(ih,eh,{exposeProperties:{urls:function(e,t){return oh(e,t,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),sh(ih,th,{exposeProperties:{text:function(e,t){return oh(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),ih);function ch(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function lh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var uh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lh(this,"item",void 0),lh(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return ch(e,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach((function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(t,'" until the drop event.')),null}})}))}},{key:"loadDataTransfer",value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach((function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}})),Object.defineProperties(this.item,n)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function dh(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(ah).filter((function(e){return ah[e].matchesTypes.some((function(e){return t.indexOf(e)>-1}))}))[0]||null}function fh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function hh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ph=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hh(this,"ownerDocument",null),hh(this,"globalContext",void 0),hh(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=n}return fh(e,[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){var e;return null!==(e=this.globalContext)&&void 0!==e&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}}]),e}();function gh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gh(Object(n),!0).forEach((function(t){vh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function vh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bh,xh=function(){function e(t,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),vh(this,"options",void 0),vh(this,"actions",void 0),vh(this,"monitor",void 0),vh(this,"registry",void 0),vh(this,"enterLeaveCounter",void 0),vh(this,"sourcePreviewNodes",new Map),vh(this,"sourcePreviewNodeOptions",new Map),vh(this,"sourceNodes",new Map),vh(this,"sourceNodeOptions",new Map),vh(this,"dragStartSourceIds",null),vh(this,"dropTargetIds",[]),vh(this,"dragEnterTargetIds",[]),vh(this,"currentNativeSource",null),vh(this,"currentNativeHandle",null),vh(this,"currentDragSourceNode",null),vh(this,"altKeyPressed",!1),vh(this,"mouseMoveTimeoutTimer",null),vh(this,"asyncEndDragFrameId",null),vh(this,"dragOverTargetIds",null),vh(this,"lastClientOffset",null),vh(this,"hoverRafId",null),vh(this,"getSourceClientOffset",(function(e){var t=o.sourceNodes.get(e);return t&&Yf(t)||null})),vh(this,"endDragNativeItem",(function(){o.isDraggingNativeItem()&&(o.actions.endDrag(),o.currentNativeHandle&&o.registry.removeSource(o.currentNativeHandle),o.currentNativeHandle=null,o.currentNativeSource=null)})),vh(this,"isNodeInDocument",(function(e){return Boolean(e&&o.document&&o.document.body&&o.document.body.contains(e))})),vh(this,"endDragIfSourceWasRemovedFromDOM",(function(){var e=o.currentDragSourceNode;null==e||o.isNodeInDocument(e)||o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()})),vh(this,"handleTopDragStartCapture",(function(){o.clearCurrentDragSourceNode(),o.dragStartSourceIds=[]})),vh(this,"handleTopDragStart",(function(e){if(!e.defaultPrevented){var t=o.dragStartSourceIds;o.dragStartSourceIds=null;var n=Xf(e);o.monitor.isDragging()&&o.actions.endDrag(),o.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:o.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,i=dh(r);if(o.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){var s=o.monitor.getSourceId(),a=o.sourceNodes.get(s),c=o.sourcePreviewNodes.get(s)||a;if(c){var l=o.getCurrentSourcePreviewNodeOptions(),u=Zf(a,c,n,{anchorX:l.anchorX,anchorY:l.anchorY},{offsetX:l.offsetX,offsetY:l.offsetY});r.setDragImage(c,u.x,u.y)}}try{null==r||r.setData("application/json",{})}catch(rp){}o.setCurrentDragSourceNode(e.target),o.getCurrentSourcePreviewNodeOptions().captureDraggingState?o.actions.publishDragSource():setTimeout((function(){return o.actions.publishDragSource()}),0)}else if(i)o.beginDragNativeItem(i);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}})),vh(this,"handleTopDragEndCapture",(function(){o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()})),vh(this,"handleTopDragEnterCapture",(function(e){if(o.dragEnterTargetIds=[],o.enterLeaveCounter.enter(e.target)&&!o.monitor.isDragging()){var t=e.dataTransfer,n=dh(t);n&&o.beginDragNativeItem(n,t)}})),vh(this,"handleTopDragEnter",(function(e){var t=o.dragEnterTargetIds;(o.dragEnterTargetIds=[],o.monitor.isDragging())&&(o.altKeyPressed=e.altKey,t.length>0&&o.actions.hover(t,{clientOffset:Xf(e)}),t.some((function(e){return o.monitor.canDropOnTarget(e)}))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())))})),vh(this,"handleTopDragOverCapture",(function(){o.dragOverTargetIds=[]})),vh(this,"handleTopDragOver",(function(e){var t=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));o.altKeyPressed=e.altKey,o.lastClientOffset=Xf(e),null===o.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(o.hoverRafId=requestAnimationFrame((function(){o.monitor.isDragging()&&o.actions.hover(t||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null}))),(t||[]).some((function(e){return o.monitor.canDropOnTarget(e)}))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))})),vh(this,"handleTopDragLeaveCapture",(function(e){o.isDraggingNativeItem()&&e.preventDefault(),o.enterLeaveCounter.leave(e.target)&&o.isDraggingNativeItem()&&setTimeout((function(){return o.endDragNativeItem()}),0)})),vh(this,"handleTopDropCapture",(function(e){var t;(o.dropTargetIds=[],o.isDraggingNativeItem())?(e.preventDefault(),null===(t=o.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):dh(e.dataTransfer)&&e.preventDefault();o.enterLeaveCounter.reset()})),vh(this,"handleTopDrop",(function(e){var t=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(t,{clientOffset:Xf(e)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()})),vh(this,"handleSelectStart",(function(e){var t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))})),this.options=new ph(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new zf(this.isNodeInDocument)}return yh(e,[{key:"profile",value:function(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.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(void 0!==e){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,t=this.rootElement;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var o=function(t){return r.handleDragStart(t,e)},i=function(e){return r.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",o),t.addEventListener("selectstart",i),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",o),t.removeEventListener("selectstart",i),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},o=function(t){return n.handleDragOver(t,e)},i=function(t){return n.handleDrop(t,e)};return t.addEventListener("dragenter",r),t.addEventListener("dragover",o),t.addEventListener("drop",i),function(){t.removeEventListener("dragenter",r),t.removeEventListener("dragover",o),t.removeEventListener("drop",i)}}},{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(),t=this.sourceNodeOptions.get(e);return mh({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return mh({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(rh).some((function(t){return rh[t]===e}))}},{key:"beginDragNativeItem",value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){var n=new uh(ah[e]);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout((function(){var e;return null===(e=t.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;if(this.currentDragSourceNode=null,this.rootElement)null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0);return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}}]),e}();var wh=function(e,t,n){return new xh(e,t,n)};function Th(e){const t=zc(),n=t.selectedIds,[r,o,i]=Nf((()=>({canDrag:()=>e.isDraggable,type:"NODE",item:()=>{const r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(Ll.dragStart(e.id,r)),{id:e.id}},end:()=>{t.hideCursor();let{parentId:e,index:n,dragIds:r}=t.state.dnd;t.canDrop()&&(dl(t.props.onMove,{dragIds:r,parentId:e===Rl?null:e,index:null===n?0:n,dragNodes:t.dragNodes,parentNode:t.get(e)}),t.open(e)),t.dispatch(Ll.dragEnd())}})),[n,e]);return p.useEffect((()=>{i((bh||((bh=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),bh))}),[i]),o}function Dh(e,t){return{parentId:e||null,index:t}}function Sh(e,t){return{type:"line",index:e,level:t}}function jh(e,t){var n;let r=e;for(;r.parent&&r.level>t;)r=r.parent;return{parentId:(null===(n=r.parent)||void 0===n?void 0:n.id)||null,index:el(r)+1}}function Oh(e){var t;const n=function(e,t){const n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),o=t.y-Math.round(n.y),i=n.height,s=o<i/2,a=!s,c=i/4,l=o>c&&o<i-c;return{x:r,inTopHalf:s,inBottomHalf:a,inMiddle:l,atTop:!l&&s,atBottom:!l&&a}}(e.element,e.offset),r=e.indent,o=Math.round(Math.max(0,n.x-r)/r),{node:i,nextNode:s,prevNode:a}=e,[c,l]=function(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}(i,a,s,n);if(i&&i.isInternal&&n.inMiddle)return{drop:Dh(i.id,null),cursor:(u=i.id,{type:"highlight",id:u})};var u;if(!c)return{drop:Dh(null===(t=null==l?void 0:l.parent)||void 0===t?void 0:t.id,0),cursor:Sh(0,0)};if(Yc(c)){const e=Jc(o,(null==l?void 0:l.level)||0,c.level);return{drop:jh(c,e),cursor:Sh(c.rowIndex+1,e)}}if(Xc(c)){const e=Jc(o,(null==l?void 0:l.level)||0,c.level);return{drop:jh(c,e),cursor:Sh(c.rowIndex+1,e)}}if(Zc(c)){const e=Jc(o,0,c.level+1);return e>c.level?{drop:Dh(c.id,0),cursor:Sh(c.rowIndex+1,e)}:{drop:jh(c,e),cursor:Sh(c.rowIndex+1,e)}}return{drop:Dh(null==c?void 0:c.id,0),cursor:Sh(c.rowIndex+1,c.level+1)}}const Rh=o.memo((function({index:e,style:t}){Gc(),function(){const e=p.useContext($c);if(null===e)throw new Error("Provide a NodesContext")}();const n=zc(),r=function(e){const t=zc(),n=t.at(e);if(!n)throw new Error(`Could not find node for index: ${e}`);return p.useMemo((()=>{const r=n.clone();return t.visibleNodes[e]=r,r}),[...Object.values(n.state),n])}(e),o=p.useRef(null),i=Th(r),s=function(e,t){const n=zc(),[r,o]=Lf((()=>({accept:"NODE",canDrop:()=>n.canDrop(),hover:(r,o)=>{const i=o.getClientOffset();if(!e.current||!i)return;const{cursor:s,drop:a}=Oh({element:e.current,offset:i,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});a&&n.dispatch(Ll.hovering(a.parentId,a.index)),o.canDrop()?s&&n.showCursor(s):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null}})),[t,e.current,n.props]);return o}(o,r),c=p.useCallback((e=>{o.current=e,s(e)}),[s]),l=n.indent*r.level,u=p.useMemo((()=>({paddingLeft:l})),[l]),d=p.useMemo((()=>{var e,r;return Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(null!==(r=null!==(e=n.props.padding)&&void 0!==e?e:n.props.paddingTop)&&void 0!==r?r:0)})}),[t,n.props.padding,n.props.paddingTop]),f={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,style:d,tabIndex:-1,className:n.props.rowClassName};p.useEffect((()=>{var e;!r.isEditing&&r.isFocused&&(null===(e=o.current)||void 0===e||e.focus({preventScroll:!0}))}),[r.isEditing,r.isFocused,o.current]);const h=n.renderNode,g=n.renderRow;return a.jsx(g,{node:r,innerRef:c,attrs:f,children:a.jsx(h,{node:r,tree:n,style:u,dragHandle:i})})}));let Ch="",kh=null;function Nh(){Gc();const e=zc();return a.jsx("div",{role:"tree",style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var n;if(e.isEditing)return;if("Backspace"===t.key){if(!e.props.onDelete)return;const t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||(n=e.lastNode),e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{const t=e.focusedNode;if(t){const n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if("Tab"===t.key&&!t.shiftKey)return t.preventDefault(),void rl(t.currentTarget);if("Tab"===t.key&&t.shiftKey)return t.preventDefault(),void ol(t.currentTarget);if("ArrowDown"===t.key){t.preventDefault();const n=e.nextNode;if(t.metaKey)return e.select(e.focusedNode),void e.activate(e.focusedNode);if(!t.shiftKey||e.props.disableMultiSelection)return void e.focus(n);{if(!n)return;const t=e.focusedNode;return void(t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode))}}if("ArrowUp"===t.key){t.preventDefault();const n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection)return void e.focus(n);{if(!n)return;const t=e.focusedNode;return void(t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode))}}if("ArrowRight"===t.key){const t=e.focusedNode;if(!t)return;return void(t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id))}if("ArrowLeft"===t.key){const t=e.focusedNode;if(!t||t.isRoot)return;return void(t.isInternal&&t.isOpen?e.close(t.id):(null===(n=t.parent)||void 0===n?void 0:n.isRoot)||e.focus(t.parent))}if("a"===t.key&&t.metaKey&&!e.props.disableMultiSelection)return t.preventDefault(),void e.selectAll();if("a"===t.key&&!t.metaKey&&e.props.onCreate)return void e.createLeaf();if("A"===t.key&&!t.metaKey){if(!e.props.onCreate)return;return void e.createInternal()}if("Home"===t.key)return t.preventDefault(),void e.focus(e.firstNode);if("End"===t.key)return t.preventDefault(),void e.focus(e.lastNode);if("Enter"===t.key){const t=e.focusedNode;if(!t)return;if(!t.isEditable||!e.props.onRename)return;return void setTimeout((()=>{t&&e.edit(t)}))}if(" "===t.key){t.preventDefault();const n=e.focusedNode;if(!n)return;return void(n.isLeaf?(n.select(),n.activate()):n.toggle())}if("*"===t.key){const t=e.focusedNode;if(!t)return;return void e.openSiblings(t)}if("PageUp"===t.key)return t.preventDefault(),void e.pageUp();"PageDown"===t.key&&(t.preventDefault(),e.pageDown()),clearTimeout(kh),Ch+=t.key,kh=setTimeout((()=>{Ch=""}),600);const r=e.visibleNodes.find((e=>{const t=e.data.name;return"string"==typeof t&&t.toLowerCase().startsWith(Ch)}));r&&e.focus(r.id)},children:a.jsx(iu,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:t=>{var n;return(null===(n=e.visibleNodes[t])||void 0===n?void 0:n.id)||t},outerElementType:au,innerElementType:lu,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:Rh})})}function Ph(e){return e.isFiltered?function(e,t){const n={},r=[];function o(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)o(t)}function i(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&(null===(t=e.children)||void 0===t||t.forEach(i))}return o(e),i(e),r.forEach(Eh),r}(e.root,e.isMatch.bind(e)):function(e){const t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&(null===(r=e.children)||void 0===r||r.forEach(n))}return n(e),t.forEach(Eh),t}(e.root)}function Eh(e,t){e.rowIndex=t}const Ih=e=>e.reduce(((e,t,n)=>(e[t.id]=n,e)),{});var _h=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const{safeRun:Mh,identify:qh,identifyNull:Ah}=gl;class Lh{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=Cl(this),this.visibleNodes=Ph(this),this.idToIndex=Ih(this.visibleNodes)}update(e){this.props=e,this.root=Cl(this),this.visibleNodes=Ph(this),this.idToIndex=Ih(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 null!==(e=this.props.width)&&void 0!==e?e:300}get height(){var e;return null!==(e=this.props.height)&&void 0!==e?e:500}get indent(){var e;return null!==(e=this.props.indent)&&void 0!==e?e:24}get rowHeight(){var e;return null!==(e=this.props.rowHeight)&&void 0!==e?e:24}get overscanCount(){var e;return null!==(e=this.props.overscanCount)&&void 0!==e?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const t=null!==(e=this.props.searchMatch)&&void 0!==e?e:(e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase());return e=>t(e,this.searchTerm)}accessChildren(e){var t;return null!==(t=cl(e,this.props.childrenAccessor||"children"))&&void 0!==t?t:null}accessId(e){const t=cl(e,this.props.idAccessor||"id");if(!t)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return t}get firstNode(){var e;return null!==(e=this.visibleNodes[0])&&void 0!==e?e:null}get lastNode(){var e;return null!==(e=this.visibleNodes[this.visibleNodes.length-1])&&void 0!==e?e:null}get focusedNode(){var e;return null!==(e=this.get(this.state.nodes.focus.id))&&void 0!==e?e:null}get mostRecentNode(){var e;return null!==(e=this.get(this.state.nodes.selection.mostRecent))&&void 0!==e?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return null===e?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return null===e?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,t){var n;if(null===e||null===t)return[];const r=null!==(n=this.indexOf(e))&&void 0!==n?n:0,o=this.indexOf(t);if(null===o)return[];const i=Math.min(r,o),s=Math.max(r,o);return this.visibleNodes.slice(i,s+1)}indexOf(e){const t=ll(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(e={}){var t,n;return _h(this,void 0,void 0,(function*(){const r=void 0===e.parentId?pl(this):e.parentId,o=null!==(t=e.index)&&void 0!==t?t:hl(this),i=null!==(n=e.type)&&void 0!==n?n:"leaf",s=yield Mh(this.props.onCreate,{type:i,parentId:r,index:o,parentNode:this.get(r)});s&&(this.focus(s),setTimeout((()=>{this.edit(s).then((()=>{this.select(s),this.activate(s)}))})))}))}delete(e){return _h(this,void 0,void 0,(function*(){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(qh),n=t.map((e=>this.get(e))).filter((e=>!!e));yield Mh(this.props.onDelete,{nodes:n,ids:t})}))}edit(e){const t=qh(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(t),this.dispatch(Sl(t)),new Promise((e=>{Lh.editPromise=e}))}submit(e,t){return _h(this,void 0,void 0,(function*(){if(!e)return;const n=qh(e);yield Mh(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(Sl(null)),this.resolveEdit({cancelled:!1,value:t}),setTimeout((()=>this.onFocus()))}))}reset(){this.dispatch(Sl(null)),this.resolveEdit({cancelled:!0}),setTimeout((()=>this.onFocus()))}activate(e){const t=this.get(Ah(e));t&&Mh(this.props.onActivate,t)}resolveEdit(e){const t=Lh.editPromise;t&&t(e),Lh.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){const n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(jl(qh(e))),!1!==t.scroll&&this.scrollTo(e),this.focusedNode&&Mh(this.props.onFocus,this.focusedNode)))}pageUp(){var e,t;const n=this.visibleStartIndex,r=this.visibleStopIndex-n;let o=null!==(t=null===(e=this.focusedNode)||void 0===e?void 0:e.rowIndex)&&void 0!==t?t:0;o=o>n?n:Math.max(n-r,0),this.focus(this.at(o))}pageDown(){var e,t;const n=this.visibleStartIndex,r=this.visibleStopIndex,o=r-n;let i=null!==(t=null===(e=this.focusedNode)||void 0===e?void 0:e.rowIndex)&&void 0!==t?t:0;i=i<r?r:Math.min(i+o,this.visibleNodes.length-1),this.focus(this.at(i))}select(e,t={}){if(!e)return;const n=!1!==t.focus,r=qh(e);n&&this.dispatch(jl(r)),this.dispatch(El(r)),this.dispatch(Al(r)),this.dispatch(ql(r)),this.scrollTo(r,t.align),this.focusedNode&&n&&Mh(this.props.onFocus,this.focusedNode),Mh(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const t=qh(e);this.dispatch(_l(t))}selectMulti(e){const t=this.get(Ah(e));t&&(this.dispatch(jl(t.id)),this.dispatch(Il(t.id)),this.dispatch(Al(t.id)),this.dispatch(ql(t.id)),this.scrollTo(t),this.focusedNode&&Mh(this.props.onFocus,this.focusedNode),Mh(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const t=qh(e),{anchor:n,mostRecent:r}=this.state.nodes.selection;this.dispatch(jl(t)),this.dispatch(_l(this.nodesBetween(n,r))),this.dispatch(Il(this.nodesBetween(n,Ah(t)))),this.dispatch(ql(t)),this.scrollTo(t),this.focusedNode&&Mh(this.props.onFocus,this.focusedNode),Mh(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),Mh(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(jl(null===(e=this.lastNode)||void 0===e?void 0:e.id)),this.focusedNode&&Mh(this.props.onFocus,this.focusedNode),Mh(this.props.onSelect,this.selectedNodes)}setSelection(e){var t;const n=new Set(null===(t=e.ids)||void 0===t?void 0:t.map(qh)),r=Ah(e.anchor),o=Ah(e.mostRecent);this.dispatch(Ml({ids:n,anchor:r,mostRecent:o})),Mh(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return"highlight"===e.type?e.id:null}get cursorOverFolder(){return"highlight"===this.state.dnd.cursor.type}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 t=null!==(e=this.get(this.state.dnd.parentId))&&void 0!==e?e:this.root,n=this.dragNodes,r=this.props.disableDrop;for(const o of n){if(!o)return!1;if(!t)return!1;if(o.isInternal&&Qc(t,o))return!1}return"function"==typeof r?!r({parentNode:t,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):"string"==typeof r?!t.data[r]:"boolean"!=typeof r||!r}hideCursor(){this.dispatch(Ll.cursor({type:"none"}))}showCursor(e){this.dispatch(Ll.cursor(e))}open(e){const t=Ah(e);t&&(this.isOpen(t)||(this.dispatch(kl.open(t,this.isFiltered)),Mh(this.props.onToggle,t)))}close(e){const t=Ah(e);t&&this.isOpen(t)&&(this.dispatch(kl.close(t,this.isFiltered)),Mh(this.props.onToggle,t))}toggle(e){const t=Ah(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){const t=Ah(e);if(!t)return;const n=tl(this.root,t);let r=null==n?void 0:n.parent;for(;r;)this.open(r.id),r=r.parent}openSiblings(e){const t=e.parent;if(t){if(t.children){const n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){nl(this.root,(e=>{e.isInternal&&e.open()}))}closeAll(){nl(this.root,(e=>{e.isInternal&&e.close()}))}scrollTo(e,t="smart"){if(!e)return;const n=qh(e);return this.openParents(n),fl((()=>n in this.idToIndex)).then((()=>{var e;const r=this.idToIndex[n];void 0!==r&&(null===(e=this.list.current)||void 0===e||e.scrollToItem(r,t))})).catch((()=>{}))}get isEditing(){return null!==this.state.nodes.edit.id}get isFiltered(){var e;return!!(null===(e=this.props.searchTerm)||void 0===e?void 0:e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return 0===this.state.nodes.selection.ids.size}get hasOneSelection(){return 1===this.state.nodes.selection.ids.size}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var t,n,r;if(!e)return!1;if(e===Rl)return!0;const o=null===(t=this.props.openByDefault)||void 0===t||t;return this.isFiltered?null===(n=this.state.nodes.open.filtered[e])||void 0===n||n:null!==(r=this.state.nodes.open.unfiltered[e])&&void 0!==r?r:o}isEditable(e){var t;return null===(t=!cl(e,this.props.disableEdit||(()=>!1)))||void 0===t||t}isDraggable(e){var t;return null===(t=!cl(e,this.props.disableDrag||(()=>!1)))||void 0===t||t}isDragging(e){const t=Ah(e);return!!t&&this.state.nodes.drag.id===t}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const t=Ah(e);if(!t)return!1;const{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&null===r}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(jl(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Nh}get renderRow(){return this.props.renderRow||xl}get renderNode(){return this.props.children||wl}get renderDragPreview(){return this.props.renderDragPreview||Ul}get renderCursor(){return this.props.renderCursor||bl}}function Fh(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Hh=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Wh=()=>Math.random().toString(36).substring(7).split("").join("."),Uh={INIT:`@@redux/INIT${Wh()}`,REPLACE:`@@redux/REPLACE${Wh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Wh()}`};function Bh(e,t,n){if("function"!=typeof e)throw new Error(Fh(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Fh(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Fh(1));return n(Bh)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)throw new Error(Fh(3));return o}function d(e){if("function"!=typeof e)throw new Error(Fh(4));if(c)throw new Error(Fh(5));let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error(Fh(6));t=!1,l(),s.delete(n),i=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}(e))throw new Error(Fh(7));if(void 0===e.type)throw new Error(Fh(8));if("string"!=typeof e.type)throw new Error(Fh(17));if(c)throw new Error(Fh(9));try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}f({type:Uh.INIT});return{dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Fh(10));r=e,f({type:Uh.REPLACE})},[Hh]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(Fh(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[Hh](){return this}}}}}function zh(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const r=t[s];"function"==typeof e[r]&&(n[r]=e[r])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Uh.INIT}))throw new Error(Fh(12));if(void 0===n(void 0,{type:Uh.PROBE_UNKNOWN_ACTION()}))throw new Error(Fh(13))}))}(n)}catch(i){o=i}return function(e={},t){if(o)throw o;let i=!1;const s={};for(let o=0;o<r.length;o++){const a=r[o],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(Fh(14));s[a]=u,i=i||u!==l}return i=i||r.length!==Object.keys(e).length,i?s:e}}const $h=zh({nodes:zh({focus:function(e={id:null,treeFocused:!1},t){return"FOCUS"===t.type?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):"TREE_BLUR"===t.type?Object.assign(Object.assign({},e),{treeFocused:!1}):e},edit:function(e={id:null},t){return"EDIT"===t.type?Object.assign(Object.assign({},e),{id:t.id}):e},open:function(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Nl(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Nl(e.unfiltered,t)}):e},selection:function(e=Pl().nodes.selection,t){const n=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return 0===t.ids.length?e:(t.ids.forEach((e=>n.add(e))),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_REMOVE":return 0===t.ids.length?e:(t.ids.forEach((e=>n.delete(e))),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}},drag:function(e=Pl().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}}),dnd:function(e=Pl().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return Pl().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}}),Vh=Pl();function Kh({treeProps:e,imperativeHandle:t,children:n}){const r=p.useRef(null),o=p.useRef(null),i=p.useRef(Bh($h,Pl(e))),s=et.useSyncExternalStore(i.current.subscribe,i.current.getState,(()=>Vh)),c=p.useMemo((()=>new Lh(i.current,e,r,o)),[]),l=p.useRef(0);return p.useMemo((()=>{l.current+=1,c.update(e)}),[...Object.values(e),s.nodes.open]),p.useImperativeHandle(t,(()=>c)),p.useEffect((()=>{c.props.selection?c.select(c.props.selection,{focus:!1}):c.deselectAll()}),[c.props.selection]),p.useEffect((()=>{c.props.searchTerm||i.current.dispatch(kl.clear(!0))}),[c.props.searchTerm]),a.jsx(Bc.Provider,{value:c,children:a.jsx(Kc.Provider,{value:l.current,children:a.jsx($c.Provider,{value:s.nodes,children:a.jsx(Vc.Provider,{value:s.dnd,children:a.jsx(Hd,Object.assign({backend:wh,options:{rootElement:c.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:n}))})})})})}function Gh(e){return function(){const e=zc(),[,t]=Lf((()=>({accept:"NODE",canDrop:(t,n)=>!!n.isOver({shallow:!0})&&e.canDrop(),hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;const r=n.getClientOffset();if(!e.listEl.current||!r)return;const{cursor:o,drop:i}=Oh({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});i&&e.dispatch(Ll.hovering(i.parentId,i.index)),n.canDrop()?o&&e.showCursor(o):e.hideCursor()}})),[e]);t(e.listEl)}(),e.children}function Jh(){const e=zc().props.renderContainer||Nh;return a.jsx(a.Fragment,{children:a.jsx(e,{})})}function Yh(){const e=zc(),{offset:t,mouse:n,item:r,isDragging:o}=(i=e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}),s=gf().getMonitor(),c=Ff(Sf(s,i),2),l=c[0],u=c[1],p.useEffect((function(){return s.subscribeToOffsetChange(u)})),p.useEffect((function(){return s.subscribeToStateChange(u)})),l);var i,s,c,l,u;const d=e.props.renderDragPreview||Ul;return a.jsx(d,{offset:t,mouse:n,id:(null==r?void 0:r.id)||null,dragIds:(null==r?void 0:r.dragIds)||[],isDragging:o})}class Xh{constructor(e){this.root=function(e){const t=new Qh({id:"ROOT"},null);return t.children=e.map((e=>Zh(e,t))),t}(e)}get data(){var e,t;return null!==(t=null===(e=this.root.children)||void 0===e?void 0:e.map((e=>e.data)))&&void 0!==t?t:[]}create(e){const t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){const t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;t&&n&&(n.addChild(t.data,e.index),t.drop())}update(e){const t=this.find(e.id);t&&t.update(e.changes)}drop(e){const t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){const t=this.find(e,n);if(t)return t}return null}return null}}function Zh(e,t){const n=new Qh(e,t);return e.children&&(n.children=e.children.map((e=>Zh(e,n)))),n}class Qh{constructor(e,t){this.data=e,this.parent=t,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){var n,r;const o=Zh(e,this);this.children=null!==(n=this.children)&&void 0!==n?n:[],this.children.splice(t,0,o),this.data.children=null!==(r=this.data.children)&&void 0!==r?r:[],this.data.children.splice(t,0,e)}removeChild(e){var t,n;null===(t=this.children)||void 0===t||t.splice(e,1),null===(n=this.data.children)||void 0===n||n.splice(e,1)}update(e){if(this.hasParent()){const t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let ep=0;function tp(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error("React Arborist Tree => You passed the initialData prop along with a data handler.\nUse the data prop if you want to provide your own handlers.");if(e.initialData){const[t,n]=function(e){const[t,n]=p.useState(e),r=p.useMemo((()=>new Xh(t)),[t]);return[t,{onMove:e=>{for(const t of e.dragIds)r.move({id:t,parentId:e.parentId,index:e.index});n(r.data)},onRename:({name:e,id:t})=>{r.update({id:t,changes:{name:e}}),n(r.data)},onCreate:({parentId:e,index:t,type:o})=>{const i={id:"simple-tree-id-"+ep++,name:""};return"internal"===o&&(i.children=[]),r.create({parentId:e,index:t,data:i}),n(r.data),i},onDelete:e=>{e.ids.forEach((e=>r.drop({id:e}))),n(r.data)}}]}(e.initialData);return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}const np=p.forwardRef((function(e,t){const n=tp(e);return a.jsxs(Kh,{treeProps:n,imperativeHandle:t,children:[a.jsx(Gh,{children:a.jsx(Jh,{})}),a.jsx(Yh,{})]})}));export{lt as A,Dt as B,dt as C,gt as G,wc as K,Qa as L,Uc as M,vt as P,St as S,np as T,Fc as a,Wc as b,mc as c,yc as d,oc as e,rc as f,pc as g,Za as h,_t as i,fc as j,xc as k,vc as l,bc as m,jc as n,Et as o,It as p,ft as q,Xh as r,Lc as s,Rt as u};
14
+ */function vt(e,t){return(vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}const xt=r("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xsSolid 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"},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"}}),wt=r("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-none text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),Tt=o.forwardRef(((e,t)=>{const n=i(15);let r,o,c,l,u,d,f;return n[0]!==e?(({color:r,shape:o,size:c,className:l,...u}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=c,n[4]=l,n[5]=u):(r=n[1],o=n[2],c=n[3],l=n[4],u=n[5]),n[6]!==r||n[7]!==o||n[8]!==c||n[9]!==l?(d=s(xt({color:r,shape:o,size:c}),l),n[6]=r,n[7]=o,n[8]=c,n[9]=l,n[10]=d):d=n[10],n[11]!==t||n[12]!==d||n[13]!==u?(f=a.jsx("button",{ref:t,className:d,...u,children:u.children}),n[11]=t,n[12]=d,n[13]=u,n[14]=f):f=n[14],f}));Tt.displayName="Button";o.forwardRef(((e,t)=>{const n=i(9);let r,o,c,l;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(c=s(wt(),r),n[3]=r,n[4]=c):c=n[4],n[5]!==t||n[6]!==c||n[7]!==o?(l=a.jsx("input",{ref:t,className:c,...o}),n[5]=t,n[6]=c,n[7]=o,n[8]=l):l=n[8],l})).displayName="Input";const Dt=e=>{const t=i(7),{openConfirm:n,closeModal:r}=c(),o=Ot;if(l())return null;let s,h,p;return t[0]!==n||t[1]!==e.description||t[2]!==r?(s=t=>{t.stopPropagation(),n({title:"Shutdown",description:e.description,variant:"destructive",confirmAction:a.jsx(u,{onClick:e=>{o(),r()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},t[0]=n,t[1]=e.description,t[2]=r,t[3]=s):s=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(d,{strokeWidth:1}),t[4]=h):h=t[4],t[5]!==s?(p=a.jsx(f,{content:"Shutdown",children:a.jsx(Tt,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:"red",className:"h-[27px] w-[27px]",onClick:s,children:h})}),t[5]=s,t[6]=p):p=t[6],p};function St(){window.close()}function Ot(){h(),setTimeout(St,200)}function jt(e,t){const n=i(11),{delayMs:r,whenVisible:o,disabled:s}=t,a=void 0!==s&&s,c=p.useRef();let l,u,d,f,h;return n[0]!==e?(l=()=>{c.current=e},u=[e],n[0]=e,n[1]=l,n[2]=u):(l=n[1],u=n[2]),p.useEffect(l,u),n[3]!==r||n[4]!==a||n[5]!==o?(d=()=>{if(null===r||a)return;const e=setInterval((()=>{var e;o&&"visible"!==document.visibilityState||null==(e=c.current)||e.call(c)}),r);return()=>clearInterval(e)},f=[r,o,a],n[3]=r,n[4]=a,n[5]=o,n[6]=d,n[7]=f):(d=n[6],f=n[7]),p.useEffect(d,f),n[8]!==o||n[9]!==a?(h=()=>{var e;"visible"===document.visibilityState&&o&&!a&&(null==(e=c.current)||e.call(c))},n[8]=o,n[9]=a,n[10]=h):h=n[10],g(document,"visibilitychange",h),null}const Rt=e=>{const t=i(2),{children:n}=e;let r;return t[0]!==n?(r=a.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),t[0]=n,t[1]=r):r=t[1],r},Ct=e=>{const t=i(10);let n,r,o,s,c;return t[0]!==e?(({children:o,className:n,...r}=e),t[0]=e,t[1]=n,t[2]=r,t[3]=o):(n=t[1],r=t[2],o=t[3]),t[4]!==n?(s=m("text-sm font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",n),t[4]=n,t[5]=s):s=t[5],t[6]!==r||t[7]!==s||t[8]!==o?(c=a.jsx("div",{...r,className:s,children:o}),t[6]=r,t[7]=s,t[8]=o,t[9]=c):c=t[9],c},kt=e=>{const t=i(2),{children:n}=e;let r;return t[0]!==n?(r=a.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1],r},Nt="marimo:copilot:signedIn",Pt=y(Nt,null,void 0,{getOnInit:!0}),Et=v(null);function It(){const e="true"===localStorage.getItem(Nt),t=x();return e&&"github"===t.completion.copilot}var _t,Mt={},qt={},At={exports:{}},Lt="object"==typeof Reflect?Reflect:null,Ft=Lt&&"function"==typeof Lt.apply?Lt.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};_t=Lt&&"function"==typeof Lt.ownKeys?Lt.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Ht=Number.isNaN||function(e){return e!=e};function Wt(){Wt.init.call(this)}At.exports=Wt,At.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}Xt(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&Xt(e,"error",t,n)}(e,o,{once:!0})}))},Wt.EventEmitter=Wt,Wt.prototype._events=void 0,Wt.prototype._eventsCount=0,Wt.prototype._maxListeners=void 0;var Ut=10;function Bt(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function zt(e){return void 0===e._maxListeners?Wt.defaultMaxListeners:e._maxListeners}function $t(e,t,n,r){var o,i,s,a;if(Bt(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=zt(e))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function Vt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Kt(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Vt.bind(r);return o.listener=n,r.wrapFn=o,o}function Gt(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):Yt(o,o.length)}function Jt(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function Yt(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Xt(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}Object.defineProperty(Wt,"defaultMaxListeners",{enumerable:!0,get:function(){return Ut},set:function(e){if("number"!=typeof e||e<0||Ht(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Ut=e}}),Wt.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Wt.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Ht(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Wt.prototype.getMaxListeners=function(){return zt(this)},Wt.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[e];if(void 0===a)return!1;if("function"==typeof a)Ft(a,this,t);else{var c=a.length,l=Yt(a,c);for(n=0;n<c;++n)Ft(l[n],this,t)}return!0},Wt.prototype.addListener=function(e,t){return $t(this,e,t,!1)},Wt.prototype.on=Wt.prototype.addListener,Wt.prototype.prependListener=function(e,t){return $t(this,e,t,!0)},Wt.prototype.once=function(e,t){return Bt(t),this.on(e,Kt(this,e,t)),this},Wt.prototype.prependOnceListener=function(e,t){return Bt(t),this.prependListener(e,Kt(this,e,t)),this},Wt.prototype.removeListener=function(e,t){var n,r,o,i,s;if(Bt(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},Wt.prototype.off=Wt.prototype.removeListener,Wt.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},Wt.prototype.listeners=function(e){return Gt(this,e,!0)},Wt.prototype.rawListeners=function(e){return Gt(this,e,!1)},Wt.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Jt.call(e,t)},Wt.prototype.listenerCount=Jt,Wt.prototype.eventNames=function(){return this._eventsCount>0?_t(this._events):[]};var Zt=At.exports;!function(e){var t=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},n=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultNextRequest=void 0;var r=Zt;e.defaultNextRequest=function(){var e=-1;return function(){return++e}};var o=function(){function o(t,n){void 0===n&&(n=e.defaultNextRequest()),this.batch=[],this.batchStarted=!1,this.lastId=-1,this.transports=t,this.requests={},this.connectPromise=this.connect(),this.requestChannel=new r.EventEmitter,this.nextID=n}return o.prototype.connect=function(){var e=this;return Promise.all(this.transports.map((function(r){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return r.subscribe("error",this.handleError.bind(this)),r.subscribe("notification",this.handleNotification.bind(this)),[4,r.connect()];case 1:return e.sent(),[2]}}))}))})))},o.prototype.getPrimaryTransport=function(){return this.transports[0]},o.prototype.request=function(e,r,o){return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){var t,i,s,a=this;return n(this,(function(n){return t=this.nextID().toString(),i=r?null:t,s={request:this.makeRequest(e.method,e.params||[],i),internalID:t},this.batchStarted?[2,new Promise((function(e,t){a.batch.push({resolve:e,reject:t,request:s})}))]:[2,this.getPrimaryTransport().sendData(s,o)]}))}))},o.prototype.close=function(){this.requestChannel.removeAllListeners(),this.transports.forEach((function(e){e.unsubscribe(),e.close()}))},o.prototype.startBatch=function(){this.batchStarted=!0},o.prototype.stopBatch=function(){if(!1===this.batchStarted)throw new Error("cannot end that which has never started");0!==this.batch.length?(this.getPrimaryTransport().sendData(this.batch),this.batch=[],this.batchStarted=!1):this.batchStarted=!1},o.prototype.makeRequest=function(e,t,n){return n?{jsonrpc:"2.0",id:n,method:e,params:t}:{jsonrpc:"2.0",method:e,params:t}},o.prototype.handleError=function(e){this.requestChannel.emit("error",e)},o.prototype.handleNotification=function(e){this.requestChannel.emit("notification",e)},o}();e.default=o}(qt);var Qt={},en={},tn={},nn={};!function(e){var t=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.convertJSONToRPCError=e.JSONRPCError=e.ERR_UNKNOWN=e.ERR_MISSIING_ID=e.ERR_TIMEOUT=void 0,e.ERR_TIMEOUT=7777,e.ERR_MISSIING_ID=7878,e.ERR_UNKNOWN=7979;var n=function(e){function n(t,n,r){var o=this.constructor,i=e.call(this,t)||this;return i.message=t,i.code=n,i.data=r,Object.setPrototypeOf(i,o.prototype),i}return t(n,e),n}(Error);e.JSONRPCError=n,e.convertJSONToRPCError=function(t){if(t.error){var r=t.error,o=r.message,i=r.code,s=r.data;return new n(o,i,s)}return new n("Unknown error",e.ERR_UNKNOWN,t)}}(nn),Object.defineProperty(tn,"__esModule",{value:!0}),tn.TransportRequestManager=void 0;var rn=Zt,on=nn,sn=function(){function e(){this.pendingRequest={},this.pendingBatchRequest={},this.transportEventChannel=new rn.EventEmitter}return e.prototype.addRequest=function(e,t){return this.transportEventChannel.emit("pending",e),e instanceof Array?(this.addBatchReq(e,t),Promise.resolve()):this.addReq(e.internalID,t)},e.prototype.settlePendingRequest=function(e,t){var n=this;e.forEach((function(e){var r=n.pendingRequest[e.internalID];delete n.pendingBatchRequest[e.internalID],void 0!==r&&(t?r.reject(t):(r.resolve(),null!==e.request.id&&void 0!==e.request.id||delete n.pendingRequest[e.internalID]))}))},e.prototype.isPendingRequest=function(e){return this.pendingRequest.hasOwnProperty(e)},e.prototype.resolveResponse=function(e,t){void 0===t&&(t=!0);var n=e;try{if(n=JSON.parse(e),!1===this.checkJSONRPC(n))return;return n instanceof Array?this.resolveBatch(n,t):this.resolveRes(n,t)}catch(o){var r=new on.JSONRPCError("Bad response format",on.ERR_UNKNOWN,e);return t&&this.transportEventChannel.emit("error",r),r}},e.prototype.addBatchReq=function(e,t){var n=this;return e.forEach((function(e){var t=e.resolve,r=e.reject,o=e.request.internalID;n.pendingBatchRequest[o]=!0,n.pendingRequest[o]={resolve:t,reject:r}})),Promise.resolve()},e.prototype.addReq=function(e,t){var n=this;return new Promise((function(r,o){null!==t&&t&&n.setRequestTimeout(e,t,o),n.pendingRequest[e]={resolve:r,reject:o}}))},e.prototype.checkJSONRPC=function(e){var t=[e];return e instanceof Array&&(t=e),t.every((function(e){return void 0!==e.result||void 0!==e.error||void 0!==e.method}))},e.prototype.processResult=function(e,t){if(e.error){var n=on.convertJSONToRPCError(e);t.reject(n)}else t.resolve(e.result)},e.prototype.resolveBatch=function(e,t){var n=this,r=e.map((function(e){return n.resolveRes(e,t)})).filter((function(e){return e}));if(r.length>0)return r[0]},e.prototype.resolveRes=function(e,t){var n,r=e.id,o=e.error,i=this.pendingRequest[r];return i?(delete this.pendingRequest[r],this.processResult(e,i),void this.transportEventChannel.emit("response",e)):void 0!==r||void 0!==o?(o&&(n=on.convertJSONToRPCError(e)),t&&o&&n&&this.transportEventChannel.emit("error",n),n):void this.transportEventChannel.emit("notification",e)},e.prototype.setRequestTimeout=function(e,t,n){var r=this;setTimeout((function(){delete r.pendingRequest[e],n(new on.JSONRPCError("Request timeout request took longer than "+t+" ms to resolve",on.ERR_TIMEOUT))}),t)},e}();tn.TransportRequestManager=sn,Object.defineProperty(en,"__esModule",{value:!0});var an=en.Transport=void 0,cn=tn,ln=function(){function e(){this.transportRequestManager=new cn.TransportRequestManager,this.transportRequestManager.transportEventChannel.on("error",(function(){}))}return e.prototype.subscribe=function(e,t){this.transportRequestManager.transportEventChannel.addListener(e,t)},e.prototype.unsubscribe=function(e,t){if(!e)return this.transportRequestManager.transportEventChannel.removeAllListeners();e&&t&&this.transportRequestManager.transportEventChannel.removeListener(e,t)},e.prototype.parseData=function(e){return e instanceof Array?e.map((function(e){return e.request.request})):e.request},e}();an=en.Transport=ln;var un,dn={};un=dn,Object.defineProperty(un,"__esModule",{value:!0}),un.getNotifications=un.getBatchRequests=un.isNotification=void 0,un.isNotification=function(e){return void 0===e.request.id||null===e.request.id},un.getBatchRequests=function(e){return e instanceof Array?e.filter((function(e){var t=e.request.request.id;return null!=t})).map((function(e){return e.request})):[]},un.getNotifications=function(e){return e instanceof Array?e.filter((function(e){return un.isNotification(e.request)})).map((function(e){return e.request})):un.isNotification(e)?[e]:[]};var fn=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Qt,"__esModule",{value:!0});var hn=dn,pn=nn,gn=function(e){function t(t,n,r){var o=e.call(this)||this;return o.connection=t,o.reqUri=n,o.resUri=r,o}return fn(t,e),t.prototype.connect=function(){var e=this;return this.connection.on(this.resUri,(function(t){e.transportRequestManager.resolveResponse(t)})),Promise.resolve()},t.prototype.sendData=function(e,t){void 0===t&&(t=null);var n=this.transportRequestManager.addRequest(e,t),r=hn.getNotifications(e),o=this.parseData(e);try{return this.connection.emit(this.reqUri,o),this.transportRequestManager.settlePendingRequest(r),n}catch(s){var i=new pn.JSONRPCError(s.message,pn.ERR_UNKNOWN,s);return this.transportRequestManager.settlePendingRequest(r,i),Promise.reject(i)}},t.prototype.close=function(){this.connection.removeAllListeners()},t}(en.Transport);Qt.default=gn;var mn={},yn="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},vn="URLSearchParams"in yn,bn="Symbol"in yn&&"iterator"in Symbol,xn="FileReader"in yn&&"Blob"in yn&&function(){try{return new Blob,!0}catch(e){return!1}}(),wn="FormData"in yn,Tn="ArrayBuffer"in yn;if(Tn)var Dn=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Sn=ArrayBuffer.isView||function(e){return e&&Dn.indexOf(Object.prototype.toString.call(e))>-1};function On(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function jn(e){return"string"!=typeof e&&(e=String(e)),e}function Rn(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return bn&&(t[Symbol.iterator]=function(){return t}),t}function Cn(e){this.map={},e instanceof Cn?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function kn(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function Nn(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function Pn(e){var t=new FileReader,n=Nn(t);return t.readAsArrayBuffer(e),n}function En(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function In(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:xn&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:wn&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:vn&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():Tn&&xn&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=En(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Tn&&(ArrayBuffer.prototype.isPrototypeOf(e)||Sn(e))?this._bodyArrayBuffer=En(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):vn&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},xn&&(this.blob=function(){var e=kn(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=kn(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(xn)return this.blob().then(Pn);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,n,r,o,i=kn(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=Nn(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),o=r?r[1]:"utf-8",t.readAsText(e,o),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},wn&&(this.formData=function(){return this.text().then(qn)}),this.json=function(){return this.text().then(JSON.parse)},this}Cn.prototype.append=function(e,t){e=On(e),t=jn(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},Cn.prototype.delete=function(e){delete this.map[On(e)]},Cn.prototype.get=function(e){return e=On(e),this.has(e)?this.map[e]:null},Cn.prototype.has=function(e){return this.map.hasOwnProperty(On(e))},Cn.prototype.set=function(e,t){this.map[On(e)]=jn(t)},Cn.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},Cn.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),Rn(e)},Cn.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),Rn(e)},Cn.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),Rn(e)},bn&&(Cn.prototype[Symbol.iterator]=Cn.prototype.entries);var _n=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Mn(e,t){if(!(this instanceof Mn))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,o=(t=t||{}).body;if(e instanceof Mn){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Cn(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new Cn(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),_n.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in yn)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function qn(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function An(e,t){if(!(this instanceof An))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new Cn(t.headers),this.url=t.url||"",this._initBody(e)}Mn.prototype.clone=function(){return new Mn(this,{body:this._bodyInit})},In.call(Mn.prototype),In.call(An.prototype),An.prototype.clone=function(){return new An(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Cn(this.headers),url:this.url})},An.error=function(){var e=new An(null,{status:200,statusText:""});return e.status=0,e.type="error",e};var Ln=[301,302,303,307,308];An.redirect=function(e,t){if(-1===Ln.indexOf(t))throw new RangeError("Invalid status code");return new An(null,{status:t,headers:{location:e}})};var Fn=yn.DOMException;try{new Fn}catch(np){(Fn=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack}).prototype=Object.create(Error.prototype),Fn.prototype.constructor=Fn}function Hn(e,t){return new Promise((function(n,r){var o=new Mn(e,t);if(o.signal&&o.signal.aborted)return r(new Fn("Aborted","AbortError"));var i=new XMLHttpRequest;function s(){i.abort()}if(i.onload=function(){var e,t,r={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",t=new Cn,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();try{t.append(r,o)}catch(i){console.warn("Response "+i.message)}}})),t)};r.url="responseURL"in i?i.responseURL:r.headers.get("X-Request-URL");var o="response"in i?i.response:i.responseText;setTimeout((function(){n(new An(o,r))}),0)},i.onerror=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},i.ontimeout=function(){setTimeout((function(){r(new TypeError("Network request failed"))}),0)},i.onabort=function(){setTimeout((function(){r(new Fn("Aborted","AbortError"))}),0)},i.open(o.method,function(e){try{return""===e&&yn.location.href?yn.location.href:e}catch(t){return e}}(o.url),!0),"include"===o.credentials?i.withCredentials=!0:"omit"===o.credentials&&(i.withCredentials=!1),"responseType"in i&&(xn?i.responseType="blob":Tn&&(i.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof Cn||yn.Headers&&t.headers instanceof yn.Headers)){var a=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){a.push(On(e)),i.setRequestHeader(e,jn(t.headers[e]))})),o.headers.forEach((function(e,t){-1===a.indexOf(t)&&i.setRequestHeader(t,e)}))}else o.headers.forEach((function(e,t){i.setRequestHeader(t,e)}));o.signal&&(o.signal.addEventListener("abort",s),i.onreadystatechange=function(){4===i.readyState&&o.signal.removeEventListener("abort",s)}),i.send(void 0===o._bodyInit?null:o._bodyInit)}))}Hn.polyfill=!0,yn.fetch||(yn.fetch=Hn,yn.Headers=Cn,yn.Request=Mn,yn.Response=An);var Wn=self.fetch.bind(self),Un=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bn=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},zn=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},$n=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mn,"__esModule",{value:!0}),mn.HTTPTransport=void 0;var Vn=$n(Wn),Kn=dn,Gn=nn,Jn=function(e){function t(n,r){var o=e.call(this)||this;return o.onlyNotifications=function(e){return e instanceof Array?e.every((function(e){return null===e.request.request.id||void 0===e.request.request.id})):null===e.request.id||void 0===e.request.id},o.uri=n,o.credentials=r&&r.credentials,o.headers=t.setupHeaders(r&&r.headers),o.injectedFetcher=null==r?void 0:r.fetcher,o}return Un(t,e),t.prototype.connect=function(){return Promise.resolve()},t.prototype.sendData=function(e,t){return void 0===t&&(t=null),Bn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,l;return zn(this,(function(u){switch(u.label){case 0:n=this.transportRequestManager.addRequest(e,t),r=Kn.getNotifications(e),o=Kn.getBatchRequests(e),i=this.injectedFetcher||Vn.default,u.label=1;case 1:return u.trys.push([1,4,,5]),[4,i(this.uri,{method:"POST",headers:this.headers,body:JSON.stringify(this.parseData(e)),credentials:this.credentials})];case 2:return s=u.sent(),this.transportRequestManager.settlePendingRequest(r),this.onlyNotifications(e)?[2,Promise.resolve()]:[4,s.text()];case 3:return a=u.sent(),(l=this.transportRequestManager.resolveResponse(a))?(this.transportRequestManager.settlePendingRequest(o,l),[2,Promise.reject(l)]):[3,5];case 4:return c=u.sent(),l=new Gn.JSONRPCError(c.message,Gn.ERR_UNKNOWN,c),this.transportRequestManager.settlePendingRequest(r,l),this.transportRequestManager.settlePendingRequest(Kn.getBatchRequests(e),l),[2,Promise.reject(l)];case 5:return[2,n]}}))}))},t.prototype.close=function(){},t.setupHeaders=function(e){var t=new Headers(e);return t.set("Content-Type","application/json"),t},t}(en.Transport);mn.HTTPTransport=Jn,mn.default=Jn;var Yn={},Xn=null;"undefined"!=typeof WebSocket?Xn=WebSocket:"undefined"!=typeof MozWebSocket?Xn=MozWebSocket:"undefined"!=typeof global?Xn=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window?Xn=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(Xn=self.WebSocket||self.MozWebSocket);const Zn=Xn,Qn=S(Object.freeze(Object.defineProperty({__proto__:null,default:Zn},Symbol.toStringTag,{value:"Module"})));var er=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),tr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},nr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},rr=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yn,"__esModule",{value:!0});var or=rr(Qn),ir=dn,sr=nn,ar=function(e){function t(t){var n=e.call(this)||this;return n.uri=t,n.connection=new or.default(t),n}return er(t,e),t.prototype.connect=function(){var e=this;return new Promise((function(t,n){var r=function(){e.connection.removeEventListener("open",r),t()};e.connection.addEventListener("open",r),e.connection.addEventListener("message",(function(t){var n=t.data;e.transportRequestManager.resolveResponse(n)}))}))},t.prototype.sendData=function(e,t){return void 0===t&&(t=5e3),tr(this,void 0,void 0,(function(){var n,r,o;return nr(this,(function(i){n=this.transportRequestManager.addRequest(e,t),r=ir.getNotifications(e);try{this.connection.send(JSON.stringify(this.parseData(e))),this.transportRequestManager.settlePendingRequest(r)}catch(np){o=new sr.JSONRPCError(np.message,sr.ERR_UNKNOWN,np),this.transportRequestManager.settlePendingRequest(r,o),this.transportRequestManager.settlePendingRequest(ir.getBatchRequests(e),o),n=Promise.reject(o)}return[2,n]}))}))},t.prototype.close=function(){this.connection.close()},t}(en.Transport);Yn.default=ar;var cr={},lr=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ur=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},dr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(cr,"__esModule",{value:!0});var fr=dn,hr=function(e){function t(t){var n=e.call(this)||this;return n.messageHandler=function(e){n.transportRequestManager.resolveResponse(JSON.stringify(e.data))},n.uri=t,n.postMessageID="post-message-transport-"+Math.random(),n}return lr(t,e),t.prototype.createWindow=function(e){return new Promise((function(t,n){var r,o,i;o=e,i=window.screen.height,r=window.open(o,"inspector:popup","left=0,top=0,width=400,height="+i+",resizable,scrollbars=yes,status=1"),setTimeout((function(){t(r)}),3e3)}))},t.prototype.connect=function(){var e=this,t=/^(http|https):\/\/.*$/;return new Promise((function(n,r){return ur(e,void 0,void 0,(function(){var e;return dr(this,(function(o){switch(o.label){case 0:return t.test(this.uri)||r(new Error("Bad URI")),e=this,[4,this.createWindow(this.uri)];case 1:return e.frame=o.sent(),window.addEventListener("message",this.messageHandler),n(),[2]}}))}))}))},t.prototype.sendData=function(e,t){return ur(this,void 0,void 0,(function(){var t,n;return dr(this,(function(r){return t=this.transportRequestManager.addRequest(e,null),n=fr.getNotifications(e),this.frame&&(this.frame.postMessage(e.request,this.uri),this.transportRequestManager.settlePendingRequest(n)),[2,t]}))}))},t.prototype.close=function(){this.frame&&(window.removeEventListener("message",this.messageHandler),this.frame.close())},t}(en.Transport);cr.default=hr;var pr={},gr=D&&D.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},yr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(pr,"__esModule",{value:!0});var vr=dn,br=function(e){function t(t){var n=e.call(this)||this;return n.messageHandler=function(e){n.transportRequestManager.resolveResponse(JSON.stringify(e.data))},n.uri=t,n.postMessageID="post-message-transport-"+Math.random(),n}return gr(t,e),t.prototype.createWindow=function(e){var t=this;return new Promise((function(n,r){var o,i=document.createElement("iframe");i.setAttribute("id",t.postMessageID),i.setAttribute("width","0px"),i.setAttribute("height","0px"),i.setAttribute("style","visiblity:hidden;border:none;outline:none;"),i.addEventListener("load",(function(){n(o)})),i.setAttribute("src",e),window.document.body.appendChild(i),o=i.contentWindow}))},t.prototype.connect=function(){var e=this,t=/^(http|https):\/\/.*$/;return new Promise((function(n,r){return mr(e,void 0,void 0,(function(){var e;return yr(this,(function(o){switch(o.label){case 0:return t.test(this.uri)||r(new Error("Bad URI")),e=this,[4,this.createWindow(this.uri)];case 1:return e.frame=o.sent(),window.addEventListener("message",this.messageHandler),n(),[2]}}))}))}))},t.prototype.sendData=function(e,t){return mr(this,void 0,void 0,(function(){var t,n;return yr(this,(function(r){return t=this.transportRequestManager.addRequest(e,null),n=vr.getNotifications(e),this.frame&&(this.frame.postMessage(e.request,"*"),this.transportRequestManager.settlePendingRequest(n)),[2,t]}))}))},t.prototype.close=function(){var e=document.getElementById(this.postMessageID);null==e||e.remove(),window.removeEventListener("message",this.messageHandler)},t}(en.Transport);pr.default=br;var xr={},wr=D&&D.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Tr=D&&D.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(xr,"__esModule",{value:!0});var Dr=function(){function e(e){this.requestManager=e}return e.prototype.startBatch=function(){return this.requestManager.startBatch()},e.prototype.stopBatch=function(){return this.requestManager.stopBatch()},e.prototype.request=function(e,t){return wr(this,void 0,void 0,(function(){return Tr(this,(function(n){switch(n.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2,this.requestManager.request(e,!1,t)]}}))}))},e.prototype.notify=function(e){return wr(this,void 0,void 0,(function(){return Tr(this,(function(t){switch(t.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2,this.requestManager.request(e,!0,null)]}}))}))},e.prototype.onNotification=function(e){this.requestManager.requestChannel.addListener("notification",e)},e.prototype.onError=function(e){this.requestManager.requestChannel.addListener("error",e)},e.prototype.close=function(){this.requestManager.close()},e}();xr.default=Dr,function(e){var t=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PostMessageIframeTransport=e.PostMessageWindowTransport=e.JSONRPCError=e.WebSocketTransport=e.EventEmitterTransport=e.HTTPTransport=e.RequestManager=e.Client=void 0;var n=t(qt);e.RequestManager=n.default;var r=t(Qt);e.EventEmitterTransport=r.default;var o=t(mn);e.HTTPTransport=o.default;var i=t(Yn);e.WebSocketTransport=i.default;var s=t(cr);e.PostMessageWindowTransport=s.default;var a=t(pr);e.PostMessageIframeTransport=a.default;var c=nn;Object.defineProperty(e,"JSONRPCError",{enumerable:!0,get:function(){return c.JSONRPCError}});var l=t(xr);e.Client=l.default,e.default=l.default}(Mt);var Sr={},Or={},jr={},Rr={},Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.Message=Cr.NotificationType9=Cr.NotificationType8=Cr.NotificationType7=Cr.NotificationType6=Cr.NotificationType5=Cr.NotificationType4=Cr.NotificationType3=Cr.NotificationType2=Cr.NotificationType1=Cr.NotificationType0=Cr.NotificationType=Cr.RequestType9=Cr.RequestType8=Cr.RequestType7=Cr.RequestType6=Cr.RequestType5=Cr.RequestType4=Cr.RequestType3=Cr.RequestType2=Cr.RequestType1=Cr.RequestType=Cr.RequestType0=Cr.AbstractMessageSignature=Cr.ParameterStructures=Cr.ResponseError=Cr.ErrorCodes=void 0;const kr=tt;var Nr,Pr,Er,Ir;(Pr=Nr||(Cr.ErrorCodes=Nr={})).ParseError=-32700,Pr.InvalidRequest=-32600,Pr.MethodNotFound=-32601,Pr.InvalidParams=-32602,Pr.InternalError=-32603,Pr.jsonrpcReservedErrorRangeStart=-32099,Pr.serverErrorStart=-32099,Pr.MessageWriteError=-32099,Pr.MessageReadError=-32098,Pr.PendingResponseRejected=-32097,Pr.ConnectionInactive=-32096,Pr.ServerNotInitialized=-32002,Pr.UnknownErrorCode=-32001,Pr.jsonrpcReservedErrorRangeEnd=-32e3,Pr.serverErrorEnd=-32e3;class _r extends Error{constructor(e,t,n){super(t),this.code=kr.number(e)?e:Nr.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,_r.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}Cr.ResponseError=_r;class Mr{constructor(e){this.kind=e}static is(e){return e===Mr.auto||e===Mr.byName||e===Mr.byPosition}toString(){return this.kind}}Cr.ParameterStructures=Mr,Mr.auto=new Mr("auto"),Mr.byPosition=new Mr("byPosition"),Mr.byName=new Mr("byName");class qr{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return Mr.auto}}Cr.AbstractMessageSignature=qr;Cr.RequestType0=class extends qr{constructor(e){super(e,0)}};Cr.RequestType=class extends qr{constructor(e,t=Mr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Cr.RequestType1=class extends qr{constructor(e,t=Mr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Cr.RequestType2=class extends qr{constructor(e){super(e,2)}};Cr.RequestType3=class extends qr{constructor(e){super(e,3)}};Cr.RequestType4=class extends qr{constructor(e){super(e,4)}};Cr.RequestType5=class extends qr{constructor(e){super(e,5)}};Cr.RequestType6=class extends qr{constructor(e){super(e,6)}};Cr.RequestType7=class extends qr{constructor(e){super(e,7)}};Cr.RequestType8=class extends qr{constructor(e){super(e,8)}};Cr.RequestType9=class extends qr{constructor(e){super(e,9)}};Cr.NotificationType=class extends qr{constructor(e,t=Mr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Cr.NotificationType0=class extends qr{constructor(e){super(e,0)}};Cr.NotificationType1=class extends qr{constructor(e,t=Mr.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Cr.NotificationType2=class extends qr{constructor(e){super(e,2)}};Cr.NotificationType3=class extends qr{constructor(e){super(e,3)}};Cr.NotificationType4=class extends qr{constructor(e){super(e,4)}};Cr.NotificationType5=class extends qr{constructor(e){super(e,5)}};Cr.NotificationType6=class extends qr{constructor(e){super(e,6)}};Cr.NotificationType7=class extends qr{constructor(e){super(e,7)}};Cr.NotificationType8=class extends qr{constructor(e){super(e,8)}};Cr.NotificationType9=class extends qr{constructor(e){super(e,9)}},(Ir=Er||(Cr.Message=Er={})).isRequest=function(e){const t=e;return t&&kr.string(t.method)&&(kr.string(t.id)||kr.number(t.id))},Ir.isNotification=function(e){const t=e;return t&&kr.string(t.method)&&void 0===e.id},Ir.isResponse=function(e){const t=e;return t&&(void 0!==t.result||!!t.error)&&(kr.string(t.id)||kr.number(t.id)||null===t.id)};var Ar,Lr,Fr,Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.LRUCache=Hr.LinkedMap=Hr.Touch=void 0,(Fr=Lr||(Hr.Touch=Lr={})).None=0,Fr.First=1,Fr.AsOld=Fr.First,Fr.Last=2,Fr.AsNew=Fr.Last;class Wr{constructor(){this[Ar]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return null==(e=this._head)?void 0:e.value}get last(){var e;return null==(e=this._tail)?void 0:e.value}has(e){return this._map.has(e)}get(e,t=Lr.None){const n=this._map.get(e);if(n)return t!==Lr.None&&this.touch(n,t),n.value}set(e,t,n=Lr.None){let r=this._map.get(e);if(r)r.value=t,n!==Lr.None&&this.touch(r,n);else{switch(r={key:e,value:t,next:void 0,previous:void 0},n){case Lr.None:this.addItemLast(r);break;case Lr.First:this.addItemFirst(r);break;case Lr.Last:default:this.addItemLast(r)}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const n=this._state;let r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(Ar=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(t===Lr.First||t===Lr.Last)if(t===Lr.First){if(e===this._head)return;const t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===Lr.Last){if(e===this._tail)return;const t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,n)=>{e.push([n,t])})),e}fromJSON(e){this.clear();for(const[t,n]of e)this.set(t,n)}}Hr.LinkedMap=Wr;Hr.LRUCache=class extends Wr{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=Lr.AsNew){return super.get(e,t)}peek(e){return super.get(e,Lr.None)}set(e,t){return super.set(e,t,Lr.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};var Ur,Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.Disposable=void 0,(Ur||(Br.Disposable=Ur={})).create=function(e){return{dispose:e}};var zr={};Object.defineProperty(zr,"__esModule",{value:!0}),zr.SharedArrayReceiverStrategy=zr.SharedArraySenderStrategy=void 0;const $r=nt;var Vr,Kr;(Kr=Vr||(Vr={})).Continue=0,Kr.Cancelled=1;zr.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const t=new SharedArrayBuffer(4);new Int32Array(t,0,1)[0]=Vr.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){const n=this.buffers.get(t);if(void 0===n)return;const r=new Int32Array(n,0,1);Atomics.store(r,0,Vr.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class Gr{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Vr.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class Jr{constructor(e){this.token=new Gr(e)}cancel(){}dispose(){}}zr.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){const t=e.$cancellationData;return void 0===t?new $r.CancellationTokenSource:new Jr(t)}};var Yr={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.Semaphore=void 0;const Zr=rt;Xr.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise(((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()}))}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,Zr.default)().timer.setImmediate((()=>this.doRunNext()))}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then((t=>{this._active--,e.resolve(t),this.runNext()}),(t=>{this._active--,e.reject(t),this.runNext()})):(this._active--,e.resolve(t),this.runNext())}catch(np){this._active--,e.reject(np),this.runNext()}}},Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.ReadableStreamMessageReader=Yr.AbstractMessageReader=Yr.MessageReader=void 0;const Qr=rt,eo=tt,to=ot,no=Xr;var ro,oo;(ro||(Yr.MessageReader=ro={})).is=function(e){let t=e;return t&&eo.func(t.listen)&&eo.func(t.dispose)&&eo.func(t.onError)&&eo.func(t.onClose)&&eo.func(t.onPartialMessage)};class io{constructor(){this.errorEmitter=new to.Emitter,this.closeEmitter=new to.Emitter,this.partialMessageEmitter=new to.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${eo.string(e.message)?e.message:"unknown"}`)}}Yr.AbstractMessageReader=io,(oo||(oo={})).fromOptions=function(e){let t,n;const r=new Map;let o;const i=new Map;if(void 0===e||"string"==typeof e)t=e??"utf-8";else{if(t=e.charset??"utf-8",void 0!==e.contentDecoder&&(n=e.contentDecoder,r.set(n.name,n)),void 0!==e.contentDecoders)for(const t of e.contentDecoders)r.set(t.name,t);if(void 0!==e.contentTypeDecoder&&(o=e.contentTypeDecoder,i.set(o.name,o)),void 0!==e.contentTypeDecoders)for(const t of e.contentTypeDecoders)i.set(t.name,t)}return void 0===o&&(o=(0,Qr.default)().applicationJson.decoder,i.set(o.name,o)),{charset:t,contentDecoder:n,contentDecoders:r,contentTypeDecoder:o,contentTypeDecoders:i}};Yr.ReadableStreamMessageReader=class extends io{constructor(e,t){super(),this.readable=e,this.options=oo.fromOptions(t),this.buffer=(0,Qr.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new no.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData((e=>{this.onData(e)}));return this.readable.onError((e=>this.fireError(e))),this.readable.onClose((()=>this.fireClose())),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const n=parseInt(t);if(isNaN(n))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=n}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock((async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)})).catch((e=>{this.fireError(e)}))}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,Qr.default)().timer.setTimeout(((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())}),this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};var so={};Object.defineProperty(so,"__esModule",{value:!0}),so.WriteableStreamMessageWriter=so.AbstractMessageWriter=so.MessageWriter=void 0;const ao=rt,co=tt,lo=Xr,uo=ot;var fo,ho;(fo||(so.MessageWriter=fo={})).is=function(e){let t=e;return t&&co.func(t.dispose)&&co.func(t.onClose)&&co.func(t.onError)&&co.func(t.write)};class po{constructor(){this.errorEmitter=new uo.Emitter,this.closeEmitter=new uo.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${co.string(e.message)?e.message:"unknown"}`)}}so.AbstractMessageWriter=po,(ho||(ho={})).fromOptions=function(e){return void 0===e||"string"==typeof e?{charset:e??"utf-8",contentTypeEncoder:(0,ao.default)().applicationJson.encoder}:{charset:e.charset??"utf-8",contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,ao.default)().applicationJson.encoder}};so.WriteableStreamMessageWriter=class extends po{constructor(e,t){super(),this.writable=e,this.options=ho.fromOptions(t),this.errorCount=0,this.writeSemaphore=new lo.Semaphore(1),this.writable.onError((e=>this.fireError(e))),this.writable.onClose((()=>this.fireClose()))}async write(e){return this.writeSemaphore.lock((async()=>this.options.contentTypeEncoder.encode(e,this.options).then((e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e)).then((t=>{const n=[];return n.push("Content-Length: ",t.byteLength.toString(),"\r\n"),n.push("\r\n"),this.doWrite(e,n,t)}),(e=>{throw this.fireError(e),e}))))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};var go={};Object.defineProperty(go,"__esModule",{value:!0}),go.AbstractMessageBuffer=void 0;go.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,n=0,r=0,o=0;e:for(;n<this._chunks.length;){const e=this._chunks[n];for(r=0;r<e.length;){switch(e[r]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,r++;break e;default:t=0}break;default:t=0}r++}o+=e.byteLength,n++}if(4!==t)return;const i=this._read(o+r),s=new Map,a=this.toString(i,"ascii").split("\r\n");if(a.length<2)return s;for(let c=0;c<a.length-2;c++){const t=a[c],n=t.indexOf(":");if(-1===n)throw new Error(`Message header must separate key and value using ':'\n${t}`);const r=t.substr(0,n),o=t.substr(n+1).trim();s.set(e?r.toLowerCase():r,o)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}const t=this.allocNative(e);let n=0;for(;e>0;){const r=this._chunks[0];if(r.byteLength>e){const o=r.slice(0,e);t.set(o,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}};var mo={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=rt,n=tt,r=Cr,o=Hr,i=ot,s=nt;var a,c,l,u,d,f,h,p,g,m,y,v,b,x,w,T,D,S,O,j,R,C,k,N,P,E,I;(a||(a={})).type=new r.NotificationType("$/cancelRequest"),(c||(e.ProgressToken=c={})).is=function(e){return"string"==typeof e||"number"==typeof e},(l||(l={})).type=new r.NotificationType("$/progress");e.ProgressType=class{constructor(){}},(u||(u={})).is=function(e){return n.func(e)},e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(f=d||(e.Trace=d={}))[f.Off=0]="Off",f[f.Messages=1]="Messages",f[f.Compact=2]="Compact",f[f.Verbose=3]="Verbose",(p=h||(e.TraceValues=h={})).Off="off",p.Messages="messages",p.Compact="compact",p.Verbose="verbose",function(e){e.fromString=function(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(d||(e.Trace=d={})),(m=g||(e.TraceFormat=g={})).Text="text",m.JSON="json",function(e){e.fromString=function(t){return n.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(g||(e.TraceFormat=g={})),(y||(e.SetTraceNotification=y={})).type=new r.NotificationType("$/setTrace"),(v||(e.LogTraceNotification=v={})).type=new r.NotificationType("$/logTrace"),(x=b||(e.ConnectionErrors=b={}))[x.Closed=1]="Closed",x[x.Disposed=2]="Disposed",x[x.AlreadyListening=3]="AlreadyListening";class _ extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,_.prototype)}}e.ConnectionError=_,(w||(e.ConnectionStrategy=w={})).is=function(e){const t=e;return t&&n.func(t.cancelUndispatched)},(T||(e.IdCancellationReceiverStrategy=T={})).is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))},(D||(e.RequestCancellationReceiverStrategy=D={})).is=function(e){const t=e;return t&&"request"===t.kind&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))},(O=S||(e.CancellationReceiverStrategy=S={})).Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),O.is=function(e){return T.is(e)||D.is(e)},(R=j||(e.CancellationSenderStrategy=j={})).Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),R.is=function(e){const t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)},(k=C||(e.CancellationStrategy=C={})).Message=Object.freeze({receiver:S.Message,sender:j.Message}),k.is=function(e){const t=e;return t&&S.is(t.receiver)&&j.is(t.sender)},(N||(e.MessageStrategy=N={})).is=function(e){const t=e;return t&&n.func(t.handleMessage)},(P||(e.ConnectionOptions=P={})).is=function(e){const t=e;return t&&(C.is(t.cancellationStrategy)||w.is(t.connectionStrategy)||N.is(t.messageStrategy))},(I=E||(E={}))[I.New=1]="New",I[I.Listening=2]="Listening",I[I.Closed=3]="Closed",I[I.Disposed=4]="Disposed",e.createMessageConnection=function(f,h,p,m){const x=void 0!==p?p:e.NullLogger;let w=0,D=0,S=0;const O="2.0";let j;const R=new Map;let k;const P=new Map,I=new Map;let M,q,A=new o.LinkedMap,L=new Map,F=new Set,H=new Map,W=d.Off,U=g.Text,B=E.New;const z=new i.Emitter,$=new i.Emitter,V=new i.Emitter,K=new i.Emitter,G=new i.Emitter,J=m&&m.cancellationStrategy?m.cancellationStrategy:C.Message;function Y(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function X(e,t){var n;r.Message.isRequest(t)?e.set(Y(t.id),t):r.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++S).toString():"res-"+n.toString(),t):e.set("not-"+(++D).toString(),t)}function Z(e){}function Q(){return B===E.Listening}function ee(){return B===E.Closed}function te(){return B===E.Disposed}function ne(){B!==E.New&&B!==E.Listening||(B=E.Closed,$.fire(void 0))}function re(){M||0===A.size||(M=(0,t.default)().timer.setImmediate((()=>{M=void 0,function(){if(0===A.size)return;const e=A.shift();try{const t=null==m?void 0:m.messageStrategy;N.is(t)?t.handleMessage(e,oe):oe(e)}finally{re()}}()})))}function oe(e){r.Message.isRequest(e)?function(e){if(te())return;function t(t,n,o){const i={jsonrpc:O,id:e.id};t instanceof r.ResponseError?i.error=t.toJson():i.result=void 0===t?null:t,ae(i,n,o),h.write(i).catch((()=>x.error("Sending response failed.")))}function o(t,n,r){const o={jsonrpc:O,id:e.id,error:t.toJson()};ae(o,n,r),h.write(o).catch((()=>x.error("Sending response failed.")))}function i(t,n,r){void 0===t&&(t=null);const o={jsonrpc:O,id:e.id,result:t};ae(o,n,r),h.write(o).catch((()=>x.error("Sending response failed.")))}!function(e){if(W===d.Off||!q)return;if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),q.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const s=R.get(e.method);let a,c;s&&(a=s.type,c=s.handler);const l=Date.now();if(c||j){const s=e.id??String(Date.now()),d=T.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&F.has(e.id)&&d.cancel(),null!==e.id&&H.set(s,d);try{let u;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);u=c(d.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byName)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);u=c(...e.params,d.token)}else{if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byPosition)return void o(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);u=c(e.params,d.token)}else j&&(u=j(e.method,e.params,d.token));const f=u;u?f.then?f.then((n=>{H.delete(s),t(n,e.method,l)}),(t=>{H.delete(s),t instanceof r.ResponseError?o(t,e.method,l):t&&n.string(t.message)?o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)})):(H.delete(s),t(u,e.method,l)):(H.delete(s),i(u,e.method,l))}catch(u){H.delete(s),u instanceof r.ResponseError?t(u,e.method,l):u&&n.string(u.message)?o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${u.message}`),e.method,l):o(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else o(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):r.Message.isNotification(e)?function(e){if(te())return;let t,n;if(e.method===a.type.method){const t=e.params.id;return F.delete(t),void ce(e)}{const r=P.get(e.method);r&&(n=r.handler,t=r.type)}if(n||k)try{if(ce(e),n)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){const o=e.params;e.method===l.type.method&&2===o.length&&c.is(o[0])?n({token:o[0],value:o[1]}):(void 0!==t&&(t.parameterStructures===r.ParameterStructures.byName&&x.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&x.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${o.length} arguments`)),n(...o))}else void 0!==t&&t.parameterStructures===r.ParameterStructures.byPosition&&x.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else k&&k(e.method,e.params)}catch(o){o.message?x.error(`Notification handler '${e.method}' failed with message: ${o.message}`):x.error(`Notification handler '${e.method}' failed unexpectedly.`)}else V.fire(e)}(e):r.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?x.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):x.error("Received response message without id. No further error information provided.");else{const n=e.id,o=L.get(n);if(function(e,t){if(W===d.Off||!q)return;if(U===g.Text){let n;if(W!==d.Verbose&&W!==d.Compact||(e.error&&e.error.data?n=`Error data: ${se(e.error.data)}\n\n`:e.result?n=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";q.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else q.log(`Received response ${e.id} without active response promise.`,n)}else le("receive-response",e)}(e,o),void 0!==o){L.delete(n);try{if(e.error){const t=e.error;o.reject(new r.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");o.resolve(e.result)}}catch(t){t.message?x.error(`Response handler '${o.method}' failed with message: ${t.message}`):x.error(`Response handler '${o.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void x.error("Received empty message.");x.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(n.string(t.id)||n.number(t.id)){const e=t.id,n=L.get(e);n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}f.onClose(ne),f.onError((function(e){z.fire([e,void 0,void 0])})),h.onClose(ne),h.onError((function(e){z.fire(e)}));const ie=e=>{try{if(r.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,n=Y(t),o=A.get(n);if(r.Message.isRequest(o)){const r=null==m?void 0:m.connectionStrategy,i=r&&r.cancelUndispatched?r.cancelUndispatched(o,Z):void 0;if(i&&(void 0!==i.error||void 0!==i.result))return A.delete(n),H.delete(t),i.id=o.id,ae(i,e.method,Date.now()),void h.write(i).catch((()=>x.error("Sending response for canceled message failed.")))}const i=H.get(t);if(void 0!==i)return i.cancel(),void ce(e);F.add(t)}X(A,e)}finally{re()}};function se(e){if(null!=e)switch(W){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(W!==d.Off&&q)if(U===g.Text){let r;W!==d.Verbose&&W!==d.Compact||(e.error&&e.error.data?r=`Error data: ${se(e.error.data)}\n\n`:e.result?r=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(r="No result returned.\n\n")),q.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else le("send-response",e)}function ce(e){if(W!==d.Off&&q&&e.method!==v.type.method)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),q.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!q||W===d.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};q.log(n)}function ue(){if(ee())throw new _(b.Closed,"Connection is closed.");if(te())throw new _(b.Disposed,"Connection is disposed.")}function de(e){return void 0===e?null:e}function fe(e){return null===e?void 0:e}function he(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function pe(e,t){switch(e){case r.ParameterStructures.auto:return he(t)?fe(t):[de(t)];case r.ParameterStructures.byName:if(!he(t))throw new Error("Received parameters by name but param is not an object literal.");return fe(t);case r.ParameterStructures.byPosition:return[de(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function ge(e,t){let n;const r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=pe(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(de(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null)}return n}const me={sendNotification:(e,...t)=>{let o,i;if(ue(),n.string(e)){o=e;const n=t[0];let s=0,a=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(s=1,a=n);let c=t.length;const l=c-s;switch(l){case 0:i=void 0;break;case 1:i=pe(a,t[s]);break;default:if(a===r.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);i=t.slice(s,c).map((e=>de(e)))}}else{const n=t;o=e.method,i=ge(e,n)}const s={jsonrpc:O,method:o,params:i};return function(e){if(W!==d.Off&&q)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),q.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(s),h.write(s).catch((e=>{throw x.error("Sending notification failed."),e}))},onNotification:(e,t)=>{let r;return ue(),n.func(e)?k=e:t&&(n.string(e)?(r=e,P.set(e,{type:void 0,handler:t})):(r=e.method,P.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==r?P.delete(r):k=void 0}}},onProgress:(e,t,n)=>{if(I.has(t))throw new Error(`Progress handler for token ${t} already registered`);return I.set(t,n),{dispose:()=>{I.delete(t)}}},sendProgress:(e,t,n)=>me.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:K.event,sendRequest:(e,...t)=>{let o,i,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),n.string(e)){o=e;const n=t[0],c=t[t.length-1];let l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;s.CancellationToken.is(c)&&(d-=1,a=c);const f=d-l;switch(f){case 0:i=void 0;break;case 1:i=pe(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw new Error(`Received ${f} parameters for 'by Name' request parameter structure.`);i=t.slice(l,d).map((e=>de(e)))}}else{const n=t;o=e.method,i=ge(e,n);const r=e.numberOfParams;a=s.CancellationToken.is(n[r])?n[r]:void 0}const c=w++;let l;a&&(l=a.onCancellationRequested((()=>{const e=J.sender.sendCancellation(me,c);return void 0===e?(x.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch((()=>{x.log(`Sending cancellation messages for id ${c} failed`)}))})));const u={jsonrpc:O,id:c,method:o,params:i};return function(e){if(W!==d.Off&&q)if(U===g.Text){let t;W!==d.Verbose&&W!==d.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),q.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof J.sender.enableCancellation&&J.sender.enableCancellation(u),new Promise((async(e,t)=>{const n={method:o,timerStart:Date.now(),resolve:t=>{e(t),J.sender.cleanup(c),null==l||l.dispose()},reject:e=>{t(e),J.sender.cleanup(c),null==l||l.dispose()}};try{await h.write(u),L.set(c,n)}catch(i){throw x.error("Sending request failed."),n.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,i.message?i.message:"Unknown reason")),i}}))},onRequest:(e,t)=>{ue();let r=null;return u.is(e)?(r=void 0,j=e):n.string(e)?(r=null,void 0!==t&&(r=e,R.set(e,{handler:t,type:void 0}))):void 0!==t&&(r=e.method,R.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==r&&(void 0!==r?R.delete(r):j=void 0)}}},hasPendingResponse:()=>L.size>0,trace:async(e,t,r)=>{let o=!1,i=g.Text;void 0!==r&&(n.boolean(r)?o=r:(o=r.sendNotification||!1,i=r.traceFormat||g.Text)),W=e,U=i,q=W===d.Off?void 0:t,!o||ee()||te()||await me.sendNotification(y.type,{value:d.toString(e)})},onError:z.event,onClose:$.event,onUnhandledNotification:V.event,onDispose:G.event,end:()=>{h.end()},dispose:()=>{if(te())return;B=E.Disposed,G.fire(void 0);const e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of L.values())t.reject(e);L=new Map,H=new Map,F=new Set,A=new o.LinkedMap,n.func(h.dispose)&&h.dispose(),n.func(f.dispose)&&f.dispose()},listen:()=>{ue(),function(){if(Q())throw new _(b.AlreadyListening,"Connection is already listening")}(),B=E.Listening,f.listen(ie)},inspect:()=>{(0,t.default)().console.log("inspect")}};return me.onNotification(v.type,(e=>{if(W===d.Off||!q)return;const t=W===d.Verbose||W===d.Compact;q.log(e.message,t?e.verbose:void 0)})),me.onNotification(l.type,(e=>{const t=I.get(e.token);t?t(e.value):K.fire(e)})),me}}(mo),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=Cr;Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const n=Hr;Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=Br;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const o=ot;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const i=nt;Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return i.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return i.CancellationToken}});const s=zr;Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return s.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return s.SharedArrayReceiverStrategy}});const a=Yr;Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const c=so;Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const l=go;Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});const u=mo;Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=rt;e.RAL=d.default}(Rr),Object.defineProperty(jr,"__esModule",{value:!0});const yo=Rr;class vo extends yo.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return vo.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}vo.emptyBuffer=new Uint8Array(0);class bo{constructor(e){this.socket=e,this._onData=new yo.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then((e=>{this._onData.fire(new Uint8Array(e))}),(()=>{(0,yo.RAL)().console.error("Converting blob to array buffer failed.")}))},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),yo.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),yo.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),yo.Disposable.create((()=>this.socket.removeEventListener("end",e)))}onData(e){return this._onData.event(e)}}class xo{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),yo.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),yo.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),yo.Disposable.create((()=>this.socket.removeEventListener("end",e)))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const wo=new TextEncoder,To=Object.freeze({messageBuffer:Object.freeze({create:e=>new vo(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(wo.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new bo(e),asWritableStream:e=>new xo(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...n){const r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){const n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){const r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function Do(){return To}(Do||(Do={})).install=function(){yo.RAL.install(To)},jr.default=Do,function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;jr.default.install();const r=Rr;n(Rr,e);class o extends r.AbstractMessageReader{constructor(e){super(),this._onData=new r.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",(e=>this.fireError(e))),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}e.BrowserMessageReader=o;class i extends r.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",(e=>this.fireError(e)))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.BrowserMessageWriter=i,e.createMessageConnection=function(e,t,n,o){return void 0===n&&(n=r.NullLogger),r.ConnectionStrategy.is(o)&&(o={connectionStrategy:o}),(0,r.createMessageConnection)(e,t,n,o)}}(Or);var So=Or,Oo={};const jo=S(it);var Ro={};Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.ProtocolNotificationType=Ro.ProtocolNotificationType0=Ro.ProtocolRequestType=Ro.ProtocolRequestType0=Ro.RegistrationType=Ro.MessageDirection=void 0;const Co=Or;var ko,No;(No=ko||(Ro.MessageDirection=ko={})).clientToServer="clientToServer",No.serverToClient="serverToClient",No.both="both";Ro.RegistrationType=class{constructor(e){this.method=e}};Ro.ProtocolRequestType0=class extends Co.RequestType0{constructor(e){super(e)}};Ro.ProtocolRequestType=class extends Co.RequestType{constructor(e){super(e,Co.ParameterStructures.byName)}};Ro.ProtocolNotificationType0=class extends Co.NotificationType0{constructor(e){super(e)}};Ro.ProtocolNotificationType=class extends Co.NotificationType{constructor(e){super(e,Co.ParameterStructures.byName)}};var Po={},Eo={};function Io(e){return"string"==typeof e||e instanceof String}function _o(e){return Array.isArray(e)}Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.objectLiteral=Eo.typedArray=Eo.stringArray=Eo.array=Eo.func=Eo.error=Eo.number=Eo.string=Eo.boolean=void 0,Eo.boolean=function(e){return!0===e||!1===e},Eo.string=Io,Eo.number=function(e){return"number"==typeof e||e instanceof Number},Eo.error=function(e){return e instanceof Error},Eo.func=function(e){return"function"==typeof e},Eo.array=_o,Eo.stringArray=function(e){return _o(e)&&e.every((e=>Io(e)))},Eo.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)},Eo.objectLiteral=function(e){return null!==e&&"object"==typeof e};var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.ImplementationRequest=void 0;const qo=Ro;var Ao,Lo;(Lo=Ao||(Mo.ImplementationRequest=Ao={})).method="textDocument/implementation",Lo.messageDirection=qo.MessageDirection.clientToServer,Lo.type=new qo.ProtocolRequestType(Lo.method);var Fo={};Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.TypeDefinitionRequest=void 0;const Ho=Ro;var Wo,Uo;(Uo=Wo||(Fo.TypeDefinitionRequest=Wo={})).method="textDocument/typeDefinition",Uo.messageDirection=Ho.MessageDirection.clientToServer,Uo.type=new Ho.ProtocolRequestType(Uo.method);var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.DidChangeWorkspaceFoldersNotification=Bo.WorkspaceFoldersRequest=void 0;const zo=Ro;var $o,Vo,Ko,Go;(Vo=$o||(Bo.WorkspaceFoldersRequest=$o={})).method="workspace/workspaceFolders",Vo.messageDirection=zo.MessageDirection.serverToClient,Vo.type=new zo.ProtocolRequestType0(Vo.method),(Go=Ko||(Bo.DidChangeWorkspaceFoldersNotification=Ko={})).method="workspace/didChangeWorkspaceFolders",Go.messageDirection=zo.MessageDirection.clientToServer,Go.type=new zo.ProtocolNotificationType(Go.method);var Jo={};Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.ConfigurationRequest=void 0;const Yo=Ro;var Xo,Zo;(Zo=Xo||(Jo.ConfigurationRequest=Xo={})).method="workspace/configuration",Zo.messageDirection=Yo.MessageDirection.serverToClient,Zo.type=new Yo.ProtocolRequestType(Zo.method);var Qo={};Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.ColorPresentationRequest=Qo.DocumentColorRequest=void 0;const ei=Ro;var ti,ni,ri,oi;(ni=ti||(Qo.DocumentColorRequest=ti={})).method="textDocument/documentColor",ni.messageDirection=ei.MessageDirection.clientToServer,ni.type=new ei.ProtocolRequestType(ni.method),(oi=ri||(Qo.ColorPresentationRequest=ri={})).method="textDocument/colorPresentation",oi.messageDirection=ei.MessageDirection.clientToServer,oi.type=new ei.ProtocolRequestType(oi.method);var ii={};Object.defineProperty(ii,"__esModule",{value:!0}),ii.FoldingRangeRefreshRequest=ii.FoldingRangeRequest=void 0;const si=Ro;var ai,ci,li,ui;(ci=ai||(ii.FoldingRangeRequest=ai={})).method="textDocument/foldingRange",ci.messageDirection=si.MessageDirection.clientToServer,ci.type=new si.ProtocolRequestType(ci.method),(ui=li||(ii.FoldingRangeRefreshRequest=li={})).method="workspace/foldingRange/refresh",ui.messageDirection=si.MessageDirection.serverToClient,ui.type=new si.ProtocolRequestType0(ui.method);var di={};Object.defineProperty(di,"__esModule",{value:!0}),di.DeclarationRequest=void 0;const fi=Ro;var hi,pi;(pi=hi||(di.DeclarationRequest=hi={})).method="textDocument/declaration",pi.messageDirection=fi.MessageDirection.clientToServer,pi.type=new fi.ProtocolRequestType(pi.method);var gi={};Object.defineProperty(gi,"__esModule",{value:!0}),gi.SelectionRangeRequest=void 0;const mi=Ro;var yi,vi;(vi=yi||(gi.SelectionRangeRequest=yi={})).method="textDocument/selectionRange",vi.messageDirection=mi.MessageDirection.clientToServer,vi.type=new mi.ProtocolRequestType(vi.method);var bi={};Object.defineProperty(bi,"__esModule",{value:!0}),bi.WorkDoneProgressCancelNotification=bi.WorkDoneProgressCreateRequest=bi.WorkDoneProgress=void 0;const xi=Or,wi=Ro;var Ti,Di,Si,Oi,ji,Ri;(Di=Ti||(bi.WorkDoneProgress=Ti={})).type=new xi.ProgressType,Di.is=function(e){return e===Di.type},(Oi=Si||(bi.WorkDoneProgressCreateRequest=Si={})).method="window/workDoneProgress/create",Oi.messageDirection=wi.MessageDirection.serverToClient,Oi.type=new wi.ProtocolRequestType(Oi.method),(Ri=ji||(bi.WorkDoneProgressCancelNotification=ji={})).method="window/workDoneProgress/cancel",Ri.messageDirection=wi.MessageDirection.clientToServer,Ri.type=new wi.ProtocolNotificationType(Ri.method);var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.CallHierarchyOutgoingCallsRequest=Ci.CallHierarchyIncomingCallsRequest=Ci.CallHierarchyPrepareRequest=void 0;const ki=Ro;var Ni,Pi,Ei,Ii,_i,Mi;(Pi=Ni||(Ci.CallHierarchyPrepareRequest=Ni={})).method="textDocument/prepareCallHierarchy",Pi.messageDirection=ki.MessageDirection.clientToServer,Pi.type=new ki.ProtocolRequestType(Pi.method),(Ii=Ei||(Ci.CallHierarchyIncomingCallsRequest=Ei={})).method="callHierarchy/incomingCalls",Ii.messageDirection=ki.MessageDirection.clientToServer,Ii.type=new ki.ProtocolRequestType(Ii.method),(Mi=_i||(Ci.CallHierarchyOutgoingCallsRequest=_i={})).method="callHierarchy/outgoingCalls",Mi.messageDirection=ki.MessageDirection.clientToServer,Mi.type=new ki.ProtocolRequestType(Mi.method);var qi={};Object.defineProperty(qi,"__esModule",{value:!0}),qi.SemanticTokensRefreshRequest=qi.SemanticTokensRangeRequest=qi.SemanticTokensDeltaRequest=qi.SemanticTokensRequest=qi.SemanticTokensRegistrationType=qi.TokenFormat=void 0;const Ai=Ro;var Li,Fi,Hi,Wi,Ui,Bi,zi,$i,Vi,Ki,Gi;(Li||(qi.TokenFormat=Li={})).Relative="relative",(Hi=Fi||(qi.SemanticTokensRegistrationType=Fi={})).method="textDocument/semanticTokens",Hi.type=new Ai.RegistrationType(Hi.method),(Ui=Wi||(qi.SemanticTokensRequest=Wi={})).method="textDocument/semanticTokens/full",Ui.messageDirection=Ai.MessageDirection.clientToServer,Ui.type=new Ai.ProtocolRequestType(Ui.method),Ui.registrationMethod=Fi.method,(zi=Bi||(qi.SemanticTokensDeltaRequest=Bi={})).method="textDocument/semanticTokens/full/delta",zi.messageDirection=Ai.MessageDirection.clientToServer,zi.type=new Ai.ProtocolRequestType(zi.method),zi.registrationMethod=Fi.method,(Vi=$i||(qi.SemanticTokensRangeRequest=$i={})).method="textDocument/semanticTokens/range",Vi.messageDirection=Ai.MessageDirection.clientToServer,Vi.type=new Ai.ProtocolRequestType(Vi.method),Vi.registrationMethod=Fi.method,(Gi=Ki||(qi.SemanticTokensRefreshRequest=Ki={})).method="workspace/semanticTokens/refresh",Gi.messageDirection=Ai.MessageDirection.serverToClient,Gi.type=new Ai.ProtocolRequestType0(Gi.method);var Ji={};Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.ShowDocumentRequest=void 0;const Yi=Ro;var Xi,Zi;(Zi=Xi||(Ji.ShowDocumentRequest=Xi={})).method="window/showDocument",Zi.messageDirection=Yi.MessageDirection.serverToClient,Zi.type=new Yi.ProtocolRequestType(Zi.method);var Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.LinkedEditingRangeRequest=void 0;const es=Ro;var ts,ns;(ns=ts||(Qi.LinkedEditingRangeRequest=ts={})).method="textDocument/linkedEditingRange",ns.messageDirection=es.MessageDirection.clientToServer,ns.type=new es.ProtocolRequestType(ns.method);var rs={};Object.defineProperty(rs,"__esModule",{value:!0}),rs.WillDeleteFilesRequest=rs.DidDeleteFilesNotification=rs.DidRenameFilesNotification=rs.WillRenameFilesRequest=rs.DidCreateFilesNotification=rs.WillCreateFilesRequest=rs.FileOperationPatternKind=void 0;const os=Ro;var is,ss,as,cs,ls,us,ds,fs,hs,ps,gs,ms,ys,vs;(ss=is||(rs.FileOperationPatternKind=is={})).file="file",ss.folder="folder",(cs=as||(rs.WillCreateFilesRequest=as={})).method="workspace/willCreateFiles",cs.messageDirection=os.MessageDirection.clientToServer,cs.type=new os.ProtocolRequestType(cs.method),(us=ls||(rs.DidCreateFilesNotification=ls={})).method="workspace/didCreateFiles",us.messageDirection=os.MessageDirection.clientToServer,us.type=new os.ProtocolNotificationType(us.method),(fs=ds||(rs.WillRenameFilesRequest=ds={})).method="workspace/willRenameFiles",fs.messageDirection=os.MessageDirection.clientToServer,fs.type=new os.ProtocolRequestType(fs.method),(ps=hs||(rs.DidRenameFilesNotification=hs={})).method="workspace/didRenameFiles",ps.messageDirection=os.MessageDirection.clientToServer,ps.type=new os.ProtocolNotificationType(ps.method),(ms=gs||(rs.DidDeleteFilesNotification=gs={})).method="workspace/didDeleteFiles",ms.messageDirection=os.MessageDirection.clientToServer,ms.type=new os.ProtocolNotificationType(ms.method),(vs=ys||(rs.WillDeleteFilesRequest=ys={})).method="workspace/willDeleteFiles",vs.messageDirection=os.MessageDirection.clientToServer,vs.type=new os.ProtocolRequestType(vs.method);var bs={};Object.defineProperty(bs,"__esModule",{value:!0}),bs.MonikerRequest=bs.MonikerKind=bs.UniquenessLevel=void 0;const xs=Ro;var ws,Ts,Ds,Ss,Os,js;(Ts=ws||(bs.UniquenessLevel=ws={})).document="document",Ts.project="project",Ts.group="group",Ts.scheme="scheme",Ts.global="global",(Ss=Ds||(bs.MonikerKind=Ds={})).$import="import",Ss.$export="export",Ss.local="local",(js=Os||(bs.MonikerRequest=Os={})).method="textDocument/moniker",js.messageDirection=xs.MessageDirection.clientToServer,js.type=new xs.ProtocolRequestType(js.method);var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.TypeHierarchySubtypesRequest=Rs.TypeHierarchySupertypesRequest=Rs.TypeHierarchyPrepareRequest=void 0;const Cs=Ro;var ks,Ns,Ps,Es,Is,_s;(Ns=ks||(Rs.TypeHierarchyPrepareRequest=ks={})).method="textDocument/prepareTypeHierarchy",Ns.messageDirection=Cs.MessageDirection.clientToServer,Ns.type=new Cs.ProtocolRequestType(Ns.method),(Es=Ps||(Rs.TypeHierarchySupertypesRequest=Ps={})).method="typeHierarchy/supertypes",Es.messageDirection=Cs.MessageDirection.clientToServer,Es.type=new Cs.ProtocolRequestType(Es.method),(_s=Is||(Rs.TypeHierarchySubtypesRequest=Is={})).method="typeHierarchy/subtypes",_s.messageDirection=Cs.MessageDirection.clientToServer,_s.type=new Cs.ProtocolRequestType(_s.method);var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.InlineValueRefreshRequest=Ms.InlineValueRequest=void 0;const qs=Ro;var As,Ls,Fs,Hs;(Ls=As||(Ms.InlineValueRequest=As={})).method="textDocument/inlineValue",Ls.messageDirection=qs.MessageDirection.clientToServer,Ls.type=new qs.ProtocolRequestType(Ls.method),(Hs=Fs||(Ms.InlineValueRefreshRequest=Fs={})).method="workspace/inlineValue/refresh",Hs.messageDirection=qs.MessageDirection.serverToClient,Hs.type=new qs.ProtocolRequestType0(Hs.method);var Ws={};Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.InlayHintRefreshRequest=Ws.InlayHintResolveRequest=Ws.InlayHintRequest=void 0;const Us=Ro;var Bs,zs,$s,Vs,Ks,Gs;(zs=Bs||(Ws.InlayHintRequest=Bs={})).method="textDocument/inlayHint",zs.messageDirection=Us.MessageDirection.clientToServer,zs.type=new Us.ProtocolRequestType(zs.method),(Vs=$s||(Ws.InlayHintResolveRequest=$s={})).method="inlayHint/resolve",Vs.messageDirection=Us.MessageDirection.clientToServer,Vs.type=new Us.ProtocolRequestType(Vs.method),(Gs=Ks||(Ws.InlayHintRefreshRequest=Ks={})).method="workspace/inlayHint/refresh",Gs.messageDirection=Us.MessageDirection.serverToClient,Gs.type=new Us.ProtocolRequestType0(Gs.method);var Js={};Object.defineProperty(Js,"__esModule",{value:!0}),Js.DiagnosticRefreshRequest=Js.WorkspaceDiagnosticRequest=Js.DocumentDiagnosticRequest=Js.DocumentDiagnosticReportKind=Js.DiagnosticServerCancellationData=void 0;const Ys=Or,Xs=Eo,Zs=Ro;var Qs,ea,ta,na,ra,oa,ia,sa,aa;(Qs||(Js.DiagnosticServerCancellationData=Qs={})).is=function(e){const t=e;return t&&Xs.boolean(t.retriggerRequest)},(ta=ea||(Js.DocumentDiagnosticReportKind=ea={})).Full="full",ta.Unchanged="unchanged",(ra=na||(Js.DocumentDiagnosticRequest=na={})).method="textDocument/diagnostic",ra.messageDirection=Zs.MessageDirection.clientToServer,ra.type=new Zs.ProtocolRequestType(ra.method),ra.partialResult=new Ys.ProgressType,(ia=oa||(Js.WorkspaceDiagnosticRequest=oa={})).method="workspace/diagnostic",ia.messageDirection=Zs.MessageDirection.clientToServer,ia.type=new Zs.ProtocolRequestType(ia.method),ia.partialResult=new Ys.ProgressType,(aa=sa||(Js.DiagnosticRefreshRequest=sa={})).method="workspace/diagnostic/refresh",aa.messageDirection=Zs.MessageDirection.serverToClient,aa.type=new Zs.ProtocolRequestType0(aa.method);var ca={};Object.defineProperty(ca,"__esModule",{value:!0}),ca.DidCloseNotebookDocumentNotification=ca.DidSaveNotebookDocumentNotification=ca.DidChangeNotebookDocumentNotification=ca.NotebookCellArrayChange=ca.DidOpenNotebookDocumentNotification=ca.NotebookDocumentSyncRegistrationType=ca.NotebookDocument=ca.NotebookCell=ca.ExecutionSummary=ca.NotebookCellKind=void 0;const la=jo,ua=Eo,da=Ro;var fa,ha,pa,ga,ma,ya,va,ba,xa,wa,Ta,Da,Sa,Oa,ja,Ra,Ca,ka,Na;(ha=fa||(ca.NotebookCellKind=fa={})).Markup=1,ha.Code=2,ha.is=function(e){return 1===e||2===e},(ga=pa||(ca.ExecutionSummary=pa={})).create=function(e,t){const n={executionOrder:e};return!0!==t&&!1!==t||(n.success=t),n},ga.is=function(e){const t=e;return ua.objectLiteral(t)&&la.uinteger.is(t.executionOrder)&&(void 0===t.success||ua.boolean(t.success))},ga.equals=function(e,t){return e===t||null!=e&&null!=t&&e.executionOrder===t.executionOrder&&e.success===t.success},function(e){function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(typeof e!=typeof n)return!1;if("object"!=typeof e)return!1;const r=Array.isArray(e),o=Array.isArray(n);if(r!==o)return!1;if(r&&o){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1}if(ua.objectLiteral(e)&&ua.objectLiteral(n)){const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;if(r.sort(),o.sort(),!t(r,o))return!1;for(let i=0;i<r.length;i++){const o=r[i];if(!t(e[o],n[o]))return!1}}return!0}e.create=function(e,t){return{kind:e,document:t}},e.is=function(e){const t=e;return ua.objectLiteral(t)&&fa.is(t.kind)&&la.DocumentUri.is(t.document)&&(void 0===t.metadata||ua.objectLiteral(t.metadata))},e.diff=function(e,n){const r=new Set;return e.document!==n.document&&r.add("document"),e.kind!==n.kind&&r.add("kind"),e.executionSummary!==n.executionSummary&&r.add("executionSummary"),void 0===e.metadata&&void 0===n.metadata||t(e.metadata,n.metadata)||r.add("metadata"),void 0===e.executionSummary&&void 0===n.executionSummary||pa.equals(e.executionSummary,n.executionSummary)||r.add("executionSummary"),r}}(ma||(ca.NotebookCell=ma={})),(va=ya||(ca.NotebookDocument=ya={})).create=function(e,t,n,r){return{uri:e,notebookType:t,version:n,cells:r}},va.is=function(e){const t=e;return ua.objectLiteral(t)&&ua.string(t.uri)&&la.integer.is(t.version)&&ua.typedArray(t.cells,ma.is)},(xa=ba||(ca.NotebookDocumentSyncRegistrationType=ba={})).method="notebookDocument/sync",xa.messageDirection=da.MessageDirection.clientToServer,xa.type=new da.RegistrationType(xa.method),(Ta=wa||(ca.DidOpenNotebookDocumentNotification=wa={})).method="notebookDocument/didOpen",Ta.messageDirection=da.MessageDirection.clientToServer,Ta.type=new da.ProtocolNotificationType(Ta.method),Ta.registrationMethod=ba.method,(Sa=Da||(ca.NotebookCellArrayChange=Da={})).is=function(e){const t=e;return ua.objectLiteral(t)&&la.uinteger.is(t.start)&&la.uinteger.is(t.deleteCount)&&(void 0===t.cells||ua.typedArray(t.cells,ma.is))},Sa.create=function(e,t,n){const r={start:e,deleteCount:t};return void 0!==n&&(r.cells=n),r},(ja=Oa||(ca.DidChangeNotebookDocumentNotification=Oa={})).method="notebookDocument/didChange",ja.messageDirection=da.MessageDirection.clientToServer,ja.type=new da.ProtocolNotificationType(ja.method),ja.registrationMethod=ba.method,(Ca=Ra||(ca.DidSaveNotebookDocumentNotification=Ra={})).method="notebookDocument/didSave",Ca.messageDirection=da.MessageDirection.clientToServer,Ca.type=new da.ProtocolNotificationType(Ca.method),Ca.registrationMethod=ba.method,(Na=ka||(ca.DidCloseNotebookDocumentNotification=ka={})).method="notebookDocument/didClose",Na.messageDirection=da.MessageDirection.clientToServer,Na.type=new da.ProtocolNotificationType(Na.method),Na.registrationMethod=ba.method;var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.InlineCompletionRequest=void 0;const Ea=Ro;var Ia,_a;(_a=Ia||(Pa.InlineCompletionRequest=Ia={})).method="textDocument/inlineCompletion",_a.messageDirection=Ea.MessageDirection.clientToServer,_a.type=new Ea.ProtocolRequestType(_a.method),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=Ro,n=jo,r=Eo,o=Mo;Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return o.ImplementationRequest}});const i=Fo;Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return i.TypeDefinitionRequest}});const s=Bo;Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});const a=Jo;Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=Qo;Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=ii;Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(e,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=di;Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=gi;Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=bi;Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const h=Ci;Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const p=qi;Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return p.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return p.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return p.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return p.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return p.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return p.SemanticTokensRegistrationType}});const g=Ji;Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return g.ShowDocumentRequest}});const m=Qi;Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return m.LinkedEditingRangeRequest}});const y=rs;Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return y.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return y.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return y.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return y.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return y.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return y.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return y.WillDeleteFilesRequest}});const v=bs;Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return v.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return v.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return v.MonikerRequest}});const b=Rs;Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return b.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySupertypesRequest}});const x=Ms;Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});const w=Ws;Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return w.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return w.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return w.InlayHintRefreshRequest}});const T=Js;Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return T.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return T.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return T.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return T.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return T.DiagnosticRefreshRequest}});const D=ca;Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return D.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return D.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return D.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return D.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return D.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return D.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return D.DidCloseNotebookDocumentNotification}});const S=Pa;var O,j,R,C,k,N,P,E,I,_,M,q,A,L,F,H,W,U,B,z,$,V,K,G,J,Y,X,Z,Q,ee,te,ne,re,oe,ie,se,ae,ce,le,ue,de,fe,he,pe,ge,me,ye,ve,be,xe,we,Te,De,Se,Oe,je,Re,Ce,ke,Ne,Pe,Ee,Ie,_e,Me,qe,Ae,Le,Fe,He,We,Ue,Be,ze,$e,Ve,Ke,Ge,Je,Ye,Xe,Ze,Qe,et,tt,nt,rt,ot,it,st,at,ct,lt,ut,dt,ft,ht,pt,gt,mt,yt,vt,bt,xt,wt,Tt,Dt,St,Ot,jt,Rt,Ct,kt,Nt,Pt,Et,It,_t,Mt,qt,At;Object.defineProperty(e,"InlineCompletionRequest",{enumerable:!0,get:function(){return S.InlineCompletionRequest}}),(O||(e.TextDocumentFilter=O={})).is=function(e){const t=e;return r.string(t)||r.string(t.language)||r.string(t.scheme)||r.string(t.pattern)},(j||(e.NotebookDocumentFilter=j={})).is=function(e){const t=e;return r.objectLiteral(t)&&(r.string(t.notebookType)||r.string(t.scheme)||r.string(t.pattern))},(R||(e.NotebookCellTextDocumentFilter=R={})).is=function(e){const t=e;return r.objectLiteral(t)&&(r.string(t.notebook)||j.is(t.notebook))&&(void 0===t.language||r.string(t.language))},(C||(e.DocumentSelector=C={})).is=function(e){if(!Array.isArray(e))return!1;for(let t of e)if(!r.string(t)&&!O.is(t)&&!R.is(t))return!1;return!0},(N=k||(e.RegistrationRequest=k={})).method="client/registerCapability",N.messageDirection=t.MessageDirection.serverToClient,N.type=new t.ProtocolRequestType(N.method),(E=P||(e.UnregistrationRequest=P={})).method="client/unregisterCapability",E.messageDirection=t.MessageDirection.serverToClient,E.type=new t.ProtocolRequestType(E.method),(_=I||(e.ResourceOperationKind=I={})).Create="create",_.Rename="rename",_.Delete="delete",(q=M||(e.FailureHandlingKind=M={})).Abort="abort",q.Transactional="transactional",q.TextOnlyTransactional="textOnlyTransactional",q.Undo="undo",(L=A||(e.PositionEncodingKind=A={})).UTF8="utf-8",L.UTF16="utf-16",L.UTF32="utf-32",(F||(e.StaticRegistrationOptions=F={})).hasId=function(e){const t=e;return t&&r.string(t.id)&&t.id.length>0},(H||(e.TextDocumentRegistrationOptions=H={})).is=function(e){const t=e;return t&&(null===t.documentSelector||C.is(t.documentSelector))},(U=W||(e.WorkDoneProgressOptions=W={})).is=function(e){const t=e;return r.objectLiteral(t)&&(void 0===t.workDoneProgress||r.boolean(t.workDoneProgress))},U.hasWorkDoneProgress=function(e){const t=e;return t&&r.boolean(t.workDoneProgress)},(z=B||(e.InitializeRequest=B={})).method="initialize",z.messageDirection=t.MessageDirection.clientToServer,z.type=new t.ProtocolRequestType(z.method),($||(e.InitializeErrorCodes=$={})).unknownProtocolVersion=1,(K=V||(e.InitializedNotification=V={})).method="initialized",K.messageDirection=t.MessageDirection.clientToServer,K.type=new t.ProtocolNotificationType(K.method),(J=G||(e.ShutdownRequest=G={})).method="shutdown",J.messageDirection=t.MessageDirection.clientToServer,J.type=new t.ProtocolRequestType0(J.method),(X=Y||(e.ExitNotification=Y={})).method="exit",X.messageDirection=t.MessageDirection.clientToServer,X.type=new t.ProtocolNotificationType0(X.method),(Q=Z||(e.DidChangeConfigurationNotification=Z={})).method="workspace/didChangeConfiguration",Q.messageDirection=t.MessageDirection.clientToServer,Q.type=new t.ProtocolNotificationType(Q.method),(te=ee||(e.MessageType=ee={})).Error=1,te.Warning=2,te.Info=3,te.Log=4,te.Debug=5,(re=ne||(e.ShowMessageNotification=ne={})).method="window/showMessage",re.messageDirection=t.MessageDirection.serverToClient,re.type=new t.ProtocolNotificationType(re.method),(ie=oe||(e.ShowMessageRequest=oe={})).method="window/showMessageRequest",ie.messageDirection=t.MessageDirection.serverToClient,ie.type=new t.ProtocolRequestType(ie.method),(ae=se||(e.LogMessageNotification=se={})).method="window/logMessage",ae.messageDirection=t.MessageDirection.serverToClient,ae.type=new t.ProtocolNotificationType(ae.method),(le=ce||(e.TelemetryEventNotification=ce={})).method="telemetry/event",le.messageDirection=t.MessageDirection.serverToClient,le.type=new t.ProtocolNotificationType(le.method),(de=ue||(e.TextDocumentSyncKind=ue={})).None=0,de.Full=1,de.Incremental=2,(he=fe||(e.DidOpenTextDocumentNotification=fe={})).method="textDocument/didOpen",he.messageDirection=t.MessageDirection.clientToServer,he.type=new t.ProtocolNotificationType(he.method),(ge=pe||(e.TextDocumentContentChangeEvent=pe={})).isIncremental=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)},ge.isFull=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength},(ye=me||(e.DidChangeTextDocumentNotification=me={})).method="textDocument/didChange",ye.messageDirection=t.MessageDirection.clientToServer,ye.type=new t.ProtocolNotificationType(ye.method),(be=ve||(e.DidCloseTextDocumentNotification=ve={})).method="textDocument/didClose",be.messageDirection=t.MessageDirection.clientToServer,be.type=new t.ProtocolNotificationType(be.method),(we=xe||(e.DidSaveTextDocumentNotification=xe={})).method="textDocument/didSave",we.messageDirection=t.MessageDirection.clientToServer,we.type=new t.ProtocolNotificationType(we.method),(De=Te||(e.TextDocumentSaveReason=Te={})).Manual=1,De.AfterDelay=2,De.FocusOut=3,(Oe=Se||(e.WillSaveTextDocumentNotification=Se={})).method="textDocument/willSave",Oe.messageDirection=t.MessageDirection.clientToServer,Oe.type=new t.ProtocolNotificationType(Oe.method),(Re=je||(e.WillSaveTextDocumentWaitUntilRequest=je={})).method="textDocument/willSaveWaitUntil",Re.messageDirection=t.MessageDirection.clientToServer,Re.type=new t.ProtocolRequestType(Re.method),(ke=Ce||(e.DidChangeWatchedFilesNotification=Ce={})).method="workspace/didChangeWatchedFiles",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method),(Pe=Ne||(e.FileChangeType=Ne={})).Created=1,Pe.Changed=2,Pe.Deleted=3,(Ee||(e.RelativePattern=Ee={})).is=function(e){const t=e;return r.objectLiteral(t)&&(n.URI.is(t.baseUri)||n.WorkspaceFolder.is(t.baseUri))&&r.string(t.pattern)},(_e=Ie||(e.WatchKind=Ie={})).Create=1,_e.Change=2,_e.Delete=4,(qe=Me||(e.PublishDiagnosticsNotification=Me={})).method="textDocument/publishDiagnostics",qe.messageDirection=t.MessageDirection.serverToClient,qe.type=new t.ProtocolNotificationType(qe.method),(Le=Ae||(e.CompletionTriggerKind=Ae={})).Invoked=1,Le.TriggerCharacter=2,Le.TriggerForIncompleteCompletions=3,(He=Fe||(e.CompletionRequest=Fe={})).method="textDocument/completion",He.messageDirection=t.MessageDirection.clientToServer,He.type=new t.ProtocolRequestType(He.method),(Ue=We||(e.CompletionResolveRequest=We={})).method="completionItem/resolve",Ue.messageDirection=t.MessageDirection.clientToServer,Ue.type=new t.ProtocolRequestType(Ue.method),(ze=Be||(e.HoverRequest=Be={})).method="textDocument/hover",ze.messageDirection=t.MessageDirection.clientToServer,ze.type=new t.ProtocolRequestType(ze.method),(Ve=$e||(e.SignatureHelpTriggerKind=$e={})).Invoked=1,Ve.TriggerCharacter=2,Ve.ContentChange=3,(Ge=Ke||(e.SignatureHelpRequest=Ke={})).method="textDocument/signatureHelp",Ge.messageDirection=t.MessageDirection.clientToServer,Ge.type=new t.ProtocolRequestType(Ge.method),(Ye=Je||(e.DefinitionRequest=Je={})).method="textDocument/definition",Ye.messageDirection=t.MessageDirection.clientToServer,Ye.type=new t.ProtocolRequestType(Ye.method),(Ze=Xe||(e.ReferencesRequest=Xe={})).method="textDocument/references",Ze.messageDirection=t.MessageDirection.clientToServer,Ze.type=new t.ProtocolRequestType(Ze.method),(et=Qe||(e.DocumentHighlightRequest=Qe={})).method="textDocument/documentHighlight",et.messageDirection=t.MessageDirection.clientToServer,et.type=new t.ProtocolRequestType(et.method),(nt=tt||(e.DocumentSymbolRequest=tt={})).method="textDocument/documentSymbol",nt.messageDirection=t.MessageDirection.clientToServer,nt.type=new t.ProtocolRequestType(nt.method),(ot=rt||(e.CodeActionRequest=rt={})).method="textDocument/codeAction",ot.messageDirection=t.MessageDirection.clientToServer,ot.type=new t.ProtocolRequestType(ot.method),(st=it||(e.CodeActionResolveRequest=it={})).method="codeAction/resolve",st.messageDirection=t.MessageDirection.clientToServer,st.type=new t.ProtocolRequestType(st.method),(ct=at||(e.WorkspaceSymbolRequest=at={})).method="workspace/symbol",ct.messageDirection=t.MessageDirection.clientToServer,ct.type=new t.ProtocolRequestType(ct.method),(ut=lt||(e.WorkspaceSymbolResolveRequest=lt={})).method="workspaceSymbol/resolve",ut.messageDirection=t.MessageDirection.clientToServer,ut.type=new t.ProtocolRequestType(ut.method),(ft=dt||(e.CodeLensRequest=dt={})).method="textDocument/codeLens",ft.messageDirection=t.MessageDirection.clientToServer,ft.type=new t.ProtocolRequestType(ft.method),(pt=ht||(e.CodeLensResolveRequest=ht={})).method="codeLens/resolve",pt.messageDirection=t.MessageDirection.clientToServer,pt.type=new t.ProtocolRequestType(pt.method),(mt=gt||(e.CodeLensRefreshRequest=gt={})).method="workspace/codeLens/refresh",mt.messageDirection=t.MessageDirection.serverToClient,mt.type=new t.ProtocolRequestType0(mt.method),(vt=yt||(e.DocumentLinkRequest=yt={})).method="textDocument/documentLink",vt.messageDirection=t.MessageDirection.clientToServer,vt.type=new t.ProtocolRequestType(vt.method),(xt=bt||(e.DocumentLinkResolveRequest=bt={})).method="documentLink/resolve",xt.messageDirection=t.MessageDirection.clientToServer,xt.type=new t.ProtocolRequestType(xt.method),(Tt=wt||(e.DocumentFormattingRequest=wt={})).method="textDocument/formatting",Tt.messageDirection=t.MessageDirection.clientToServer,Tt.type=new t.ProtocolRequestType(Tt.method),(St=Dt||(e.DocumentRangeFormattingRequest=Dt={})).method="textDocument/rangeFormatting",St.messageDirection=t.MessageDirection.clientToServer,St.type=new t.ProtocolRequestType(St.method),(jt=Ot||(e.DocumentRangesFormattingRequest=Ot={})).method="textDocument/rangesFormatting",jt.messageDirection=t.MessageDirection.clientToServer,jt.type=new t.ProtocolRequestType(jt.method),(Ct=Rt||(e.DocumentOnTypeFormattingRequest=Rt={})).method="textDocument/onTypeFormatting",Ct.messageDirection=t.MessageDirection.clientToServer,Ct.type=new t.ProtocolRequestType(Ct.method),(kt||(e.PrepareSupportDefaultBehavior=kt={})).Identifier=1,(Pt=Nt||(e.RenameRequest=Nt={})).method="textDocument/rename",Pt.messageDirection=t.MessageDirection.clientToServer,Pt.type=new t.ProtocolRequestType(Pt.method),(It=Et||(e.PrepareRenameRequest=Et={})).method="textDocument/prepareRename",It.messageDirection=t.MessageDirection.clientToServer,It.type=new t.ProtocolRequestType(It.method),(Mt=_t||(e.ExecuteCommandRequest=_t={})).method="workspace/executeCommand",Mt.messageDirection=t.MessageDirection.clientToServer,Mt.type=new t.ProtocolRequestType(Mt.method),(At=qt||(e.ApplyWorkspaceEditRequest=qt={})).method="workspace/applyEdit",At.messageDirection=t.MessageDirection.serverToClient,At.type=new t.ProtocolRequestType("workspace/applyEdit")}(Po);var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.createProtocolConnection=void 0;const qa=Or;Ma.createProtocolConnection=function(e,t,n,r){return qa.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,qa.createMessageConnection)(e,t,n,r)},function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(Or,e),n(jo,e),n(Ro,e),n(Po,e);var r,o,i=Ma;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return i.createProtocolConnection}}),(o=r||(e.LSPErrorCodes=r={})).lspReservedErrorRangeStart=-32899,o.RequestFailed=-32803,o.ServerCancelled=-32802,o.ContentModified=-32801,o.RequestCancelled=-32800,o.lspReservedErrorRangeEnd=-32800}(Oo),function(e){var t=D&&D.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=D&&D.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;const r=So;n(So,e),n(Oo,e),e.createProtocolConnection=function(e,t,n,o){return(0,r.createMessageConnection)(e,t,n,o)}}(Sr);const Aa=1e4,La=Object.fromEntries(Object.entries(Sr.CompletionItemKind).map((([e,t])=>[t,e]))),Fa=e=>e.reduce(((e,t)=>t),""),Ha=O.define({combine:Fa}),Wa=O.define({combine:Fa}),Ua=O.define({combine:Fa});class Ba{constructor(e){this.rootUri=e.rootUri,this.workspaceFolders=e.workspaceFolders,this.autoClose=e.autoClose,this.plugins=[],this.transport=e.transport,this.requestManager=new Mt.RequestManager([this.transport]),this.client=new Mt.Client(this.requestManager),this.client.onNotification((e=>{this.processNotification(e)}));const t=this.transport;t&&t.connection&&t.connection.addEventListener("message",(e=>{const n=JSON.parse(e.data);n.method&&n.id&&t.connection.send(JSON.stringify({jsonrpc:"2.0",id:n.id,result:null}))})),this.initializePromise=this.initialize()}async initialize(){const{capabilities:e}=await this.request("initialize",{capabilities:{textDocument:{hover:{dynamicRegistration:!0,contentFormat:["plaintext","markdown"]},moniker:{},synchronization:{dynamicRegistration:!0,willSave:!1,didSave:!1,willSaveWaitUntil:!1},completion:{dynamicRegistration:!0,completionItem:{snippetSupport:!1,commitCharactersSupport:!0,documentationFormat:["plaintext","markdown"],deprecatedSupport:!1,preselectSupport:!1},contextSupport:!1},signatureHelp:{dynamicRegistration:!0,signatureInformation:{documentationFormat:["plaintext","markdown"]}},declaration:{dynamicRegistration:!0,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!0,linkSupport:!0},implementation:{dynamicRegistration:!0,linkSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!0}}},initializationOptions:null,processId:null,rootUri:this.rootUri,workspaceFolders:this.workspaceFolders},3e4);this.capabilities=e,this.notify("initialized",{}),this.ready=!0}close(){this.client.close()}textDocumentDidOpen(e){return this.notify("textDocument/didOpen",e)}textDocumentDidChange(e){return this.notify("textDocument/didChange",e)}async textDocumentHover(e){return await this.request("textDocument/hover",e,Aa)}async textDocumentCompletion(e){return await this.request("textDocument/completion",e,Aa)}attachPlugin(e){this.plugins.push(e)}detachPlugin(e){const t=this.plugins.indexOf(e);-1!==t&&(this.plugins.splice(t,1),this.autoClose&&this.close())}request(e,t,n){return this.client.request({method:e,params:t},n)}notify(e,t){return this.client.notify({method:e,params:t})}processNotification(e){for(const t of this.plugins)t.processNotification(e)}}class za{constructor(e,t){this.view=e,this.allowHTMLContent=t,this.client=this.view.state.facet(Ha),this.documentUri=this.view.state.facet(Wa),this.languageId=this.view.state.facet(Ua),this.documentVersion=0,this.changesTimeout=0,this.client.attachPlugin(this),this.initialize({documentText:this.view.state.doc.toString()})}update({docChanged:e}){e&&(this.changesTimeout&&clearTimeout(this.changesTimeout),this.changesTimeout=self.setTimeout((()=>{this.sendChange({documentText:this.view.state.doc.toString()})}),500))}destroy(){this.client.detachPlugin(this)}async initialize({documentText:e}){this.client.initializePromise&&await this.client.initializePromise,this.client.textDocumentDidOpen({textDocument:{uri:this.documentUri,languageId:this.languageId,text:e,version:this.documentVersion}})}async sendChange({documentText:e}){if(this.client.ready)try{await this.client.textDocumentDidChange({textDocument:{uri:this.documentUri,version:this.documentVersion++},contentChanges:[{text:e}]})}catch(t){console.error(t)}}requestDiagnostics(e){this.sendChange({documentText:e.state.doc.toString()})}async requestHoverTooltip(e,{line:t,character:n}){if(!this.client.ready||!this.client.capabilities.hoverProvider)return null;this.sendChange({documentText:e.state.doc.toString()});const r=await this.client.textDocumentHover({textDocument:{uri:this.documentUri},position:{line:t,character:n}});if(!r)return null;const{contents:o,range:i}=r;let s,a=$a(e.state.doc,{line:t,character:n});if(i&&(a=$a(e.state.doc,i.start),s=$a(e.state.doc,i.end)),null===a)return null;const c=document.createElement("div");return c.classList.add("documentation"),this.allowHTMLContent?c.innerHTML=Ka(o):c.textContent=Ka(o),{pos:a,end:s,create:e=>({dom:c}),above:!0}}async requestCompletion(e,{line:t,character:n},{triggerKind:r,triggerCharacter:o}){if(!this.client.ready||!this.client.capabilities.completionProvider)return null;this.sendChange({documentText:e.state.doc.toString()});const i=await this.client.textDocumentCompletion({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{triggerKind:r,triggerCharacter:o}});if(!i)return null;let s=("items"in i?i.items:i).map((({detail:e,label:t,kind:n,textEdit:r,documentation:o,sortText:i,filterText:s})=>{var a;const c={label:t,detail:e,apply:null!==(a=null==r?void 0:r.newText)&&void 0!==a?a:t,type:n&&La[n].toLowerCase(),sortText:null!=i?i:t,filterText:null!=s?s:t};return o&&(c.info=Ka(o)),c}));const[a,c]=function(e){const t=new Set,n=new Set;for(const{apply:o}of e){const[e,...r]=o;t.add(e);for(const t of r)n.add(t)}const r=Ga(t)+Ga(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(s),l=e.matchBefore(c);let{pos:u}=e;if(l){u=l.from;const e=l.text.toLowerCase();/^\w+$/.test(e)&&(s=s.filter((({filterText:t})=>t.toLowerCase().startsWith(e))).sort((({apply:e},{apply:t})=>{switch(!0){case e.startsWith(l.text)&&!t.startsWith(l.text):return-1;case!e.startsWith(l.text)&&t.startsWith(l.text):return 1}return 0})))}return{from:u,options:s}}processNotification(e){try{if("textDocument/publishDiagnostics"===e.method)this.processDiagnostics(e.params)}catch(t){console.error(t)}}processDiagnostics(e){if(e.uri!==this.documentUri)return;const t=e.diagnostics.map((({range:e,message:t,severity:n})=>({from:$a(this.view.state.doc,e.start),to:$a(this.view.state.doc,e.end),severity:{[Sr.DiagnosticSeverity.Error]:"error",[Sr.DiagnosticSeverity.Warning]:"warning",[Sr.DiagnosticSeverity.Information]:"info",[Sr.DiagnosticSeverity.Hint]:"info"}[n],message:t}))).filter((({from:e,to:t})=>null!==e&&null!==t&&void 0!==e&&void 0!==t)).sort(((e,t)=>{switch(!0){case e.from<t.from:return-1;case e.from>t.from:return 1}return 0}));this.view.dispatch(k(this.view.state,t))}}function $a(e,t){if(t.line>=e.lines)return;const n=e.line(t.line+1).from+t.character;return n>e.length?void 0:n}function Va(e,t){const n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}function Ka(e){return Array.isArray(e)?e.map((e=>Ka(e)+"\n\n")).join(""):"string"==typeof e?e:e.value}function Ga(e){let t="",n=Array.from(e).join("");return/\w/.test(n)&&(t+="\\w",n=n.replace(/\w/g,"")),`[${t}${n.replace(/[^\w\s]/g,"\\$&")}]`}class Ja extends Ba{constructor(...n){super(...n),this.documentVersion=0,this.getCompletionInternal=async(e,t)=>await this._request("getCompletions",{doc:{...e.doc,version:t}}),this.throttledGetCompletionInternal=function(n,r,o){var i=!0,s=!0;if("function"!=typeof n)throw new TypeError("Expected a function");return e(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),t(n,r,{leading:i,maxWait:r,trailing:s})}(this.getCompletionInternal,200)}_request(e,t){return this.request(e,t)}isDisabled(){return!It()}async textDocumentDidOpen(e){return this.isDisabled()?e:super.textDocumentDidOpen(e)}async textDocumentCompletion(e){return this.isDisabled()?[]:super.textDocumentCompletion(e)}async textDocumentDidChange(e){return this.isDisabled()?e:super.textDocumentDidChange({...e,contentChanges:[{text:N(e.contentChanges[0].text)}],textDocument:Sr.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return this.isDisabled()?Promise.resolve({contents:[]}):super.textDocumentHover(e)}signOut(){return this._request("signOut",{})}signInInitiate(){return this._request("signInInitiate",{})}signInConfirm(e){return this._request("signInConfirm",e)}async signedIn(){const{status:e,user:t}=await this._request("checkStatus",{});return P.debug("Copilot#signedIn",e,t),"SignedIn"===e||"AlreadySignedIn"===e||"OK"===e}acceptCompletion(e){return this._request("notifyAccepted",e)}rejectCompletions(e){return this._request("notifyRejected",e)}async getCompletion(e){if(this.isDisabled())return{completions:[]};const t=this.documentVersion;if(e.doc.version=t,0===t)return{completions:[]};var n;n=t,b.set(Et,n);const r=await this.throttledGetCompletionInternal(e,t);var o;return o=t,b.get(Et)===o&&b.set(Et,null),t!==this.documentVersion?{completions:[]}:r||{completions:[]}}}async function Ya(e){return new Promise(((t,n)=>{const r=new WebSocket(e);r.onopen=()=>{r.close(),t(e)},r.onerror=t=>{r.close(),n(new Error(`Failed to connect to ${e}: ${t.type}`))}}))}const Xa="/marimo.py",Za="copilot",Qa=`file://${Xa}`,ec=E((()=>new tc));class tc extends an{constructor(){super(),this.delegate=void 0,this.delegate=void 0}async connect(){return await w(T,(e=>"github"===e.completion.copilot)),await async function(e,t=5){for(let n=0;n<t;n++)try{return await Ya(e)}catch{await new Promise((e=>setTimeout(e,1e3*(n+1))))}throw new Error(`Failed to connect to ${e}`)}(oc(),3),this.delegate||(this.delegate=new Mt.WebSocketTransport(oc())),this.delegate.connect()}close(){var e;null==(e=this.delegate)||e.close()}async sendData(e,t){var n;return null==(n=this.delegate)?void 0:n.sendData(e,t)}}const nc=E((()=>new Ja({rootUri:Qa,documentUri:Qa,languageId:Za,workspaceFolders:null,transport:ec()})));function rc(){return function(e){let t=null;return[Ha.of(e.client||new Ba({...e,autoClose:!0})),Wa.of(e.documentUri),Ua.of(e.languageId),j.define((n=>t=new za(n,e.allowHTMLContent))),R(((e,n)=>{var r;return null!==(r=null==t?void 0:t.requestHoverTooltip(e,Va(e.state.doc,n)))&&void 0!==r?r:null})),C({override:[async e=>{var n,r,o;if(null==t)return null;const{state:i,pos:s,explicit:a}=e,c=i.doc.lineAt(s);let l,u=Sr.CompletionTriggerKind.Invoked;return!a&&(null===(o=null===(r=null===(n=t.client.capabilities)||void 0===n?void 0:n.completionProvider)||void 0===r?void 0:r.triggerCharacters)||void 0===o?void 0:o.includes(c.text[s-c.from-1]))&&(u=Sr.CompletionTriggerKind.TriggerCharacter,l=c.text[s-c.from-1]),u!==Sr.CompletionTriggerKind.Invoked||e.matchBefore(/\w+$/)?await t.requestCompletion(e,Va(i.doc,s),{triggerKind:u,triggerCharacter:l}):null}]})]}({rootUri:Qa,documentUri:Qa,workspaceFolders:[],transport:ec(),client:nc(),languageId:Za})}function oc(){return st("lsp/copilot")}const ic=p.memo((()=>{const[e,t]=I(Pt),[n,r]=p.useState(),[o,i]=p.useState(),[s,c]=p.useState(!1);p.useEffect((()=>{const e=nc();e.initializePromise.catch((()=>{t(!1),r("notConnected")})),e.signedIn().then((e=>{t(e),r(e?"signedIn":"signedOut")})).catch((()=>{t(!1),r("notConnected")}))}),[]);const l=async e=>{e.preventDefault(),c(!0);try{const e=nc(),{verificationUri:n,status:o,userCode:s}=await e.signInInitiate();"OK"===o||"AlreadySignedIn"===o?t(!0):(r("signingIn"),i({url:n,code:s}))}finally{c(!1)}},u=async e=>{if(e.preventDefault(),!o)return;const n=nc();try{c(!0);const{status:e}=await n.signInConfirm({userCode:o.code});"OK"===e||"AlreadySignedIn"===e?(t(!0),r("signedIn")):r("signInFailed")}catch{for(let e=0;e<3;e++){await new Promise((e=>setTimeout(e,1e3)));if(await n.signedIn())return t(!0),void r("signedIn")}r("signInFailed")}finally{c(!1)}},f=async e=>{e.preventDefault();const n=nc();t(!1),r("signedOut"),await n.signOut()};return(()=>{switch(n??(e?"signedIn":"connecting")){case"connecting":return a.jsx(_,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return a.jsx(q,{onClick:l,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return a.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[a.jsx("li",{children:a.jsxs("div",{className:"flex items-center",children:["Copy this code:",a.jsx("strong",{className:"ml-2",children:null==o?void 0:o.code}),a.jsx(L,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{o&&(await F(o.code),H({description:"Copied to clipboard"}))}})]})}),a.jsxs("li",{children:["Enter the code at this link:",a.jsx("a",{href:null==o?void 0:o.url,target:"_blank",rel:"noreferrer",className:W({variant:"link",size:"xs"}),children:null==o?void 0:o.url})]}),a.jsxs("li",{children:["Click here when done:",a.jsxs(q,{size:"xs",onClick:u,className:"ml-1",children:[s&&a.jsx(A,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),s?a.jsx(A,{className:"h-3 w-3 mr-1 animate-spin"}):a.jsx(q,{onClick:l,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return a.jsxs("div",{className:"flex items-center gap-5",children:[a.jsxs(_,{className:"font-normal flex items-center",children:[a.jsx("div",{className:"inline-flex items-center justify-center bg-[var(--grass-7)] rounded-full p-1 mr-2",children:a.jsx(M,{className:"h-3 w-3 text-white"})}),"Connected"]}),a.jsx(q,{onClick:f,size:"xs",variant:"text",children:"Disconnect"})]});case"notConnected":return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs(_,{className:"font-normal flex",children:[a.jsx(d,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),a.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",a.jsx("a",{className:"hyperlink",href:"https://docs.marimo.io/getting_started/index.html#github-copilot",target:"_blank",rel:"noreferrer",children:"docs"}),"."]})]})}})()}));var sc;function ac(e){return cc(),[U.of([{key:"j",run:t=>!(!B(t,!0)||!z(t))&&(e.focusDown(),!0)}]),U.of([{key:"k",run:t=>!(!$(t)||!z(t))&&(e.focusUp(),!0)}]),j.define((e=>(lc.INSTANCES.addInstance(e),{destroy(){lc.INSTANCES.removeInstance(e)}})))]}ic.displayName="CopilotConfig";const cc=E((()=>{V.defineAction("goToDefinition",(e=>{const t=e.cm6;return K(t)})),V.mapCommand("gd","action","goToDefinition",{},{context:"normal"})}));class lc{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const t=G(e);t?t.on("vim-mode-change",(t=>{this.isBroadcasting||(J("mode"in t,'Expected event to have a "mode" property'),this.isBroadcasting=!0,this.broadcastModeChange(e,t.mode,t.subMode),this.isBroadcasting=!1)})):P.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,t,n){J("exitInsertMode"in V,"Vim does not have an exitInsertMode method"),J("exitVisualMode"in V,"Vim does not have an exitVisualMode method");for(const r of this.instances)if(r!==e){const e=G(r);if(!e){P.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const n=e.setSelections.bind(e);e.setSelections=()=>[];const o=e.state.vim;if(!o){P.warn("Expected CodeMirror instance to have Vim state");continue}switch(t){case"normal":o.insertMode&&V.exitInsertMode(e,!0),o.visualMode&&V.exitVisualMode(e,!0);break;case"insert":o.insertMode||V.handleKey(e,"i","")}e.setSelections=n}}}sc=lc,lc.INSTANCES=new sc;const uc=["default","vim"];function dc(e,t){switch(e.preset){case"default":return[U.of(X),U.of([{key:"Escape",preventDefault:!0,run:e=>(e.contentDOM.blur(),!0)}])];case"vim":return[U.of(X),Z.high(fc("d",(e=>""===e.state.doc.toString()),(e=>""===e.state.doc.toString()&&(t.deleteCell(),!0)))),Z.highest(Q({status:!1})),Z.highest(ac(t))];default:return Y(e.preset),[]}}function fc(e,t,n){let r="",o=0;return U.of([{any:(i,s)=>{const a=s.key,c=s.timeStamp;if(a!==e||!t(i))return r="",o=0,!1;if(r===e&&c-o<500){if(n(i))return r="",o=0,!0}return r=a,o=c,!1}}])}function hc(){return["compact","medium","full","columns"]}const pc=v({});function gc(){return ee(pc)}function mc(e,t){const n=i(13),{registerAction:r,unregisterAction:o}=function(){const e=te(pc);return{registerAction:ne(((t,n)=>{e((e=>({...e,[t]:n})))})),unregisterAction:ne((t=>{e((e=>{const{[t]:n,...r}=e;return r}))}))}}(),s=ee(re),a=t===oe.NOOP;let c;n[0]!==t?(c=e=>t(e),n[0]=t,n[1]=c):c=n[1];const l=ne(c);let u;n[2]!==s||n[3]!==e||n[4]!==t?(u=n=>{const r=s.getHotkey(e).key;if(ie(r)(n)){!1!==t(n)&&(n.preventDefault(),n.stopPropagation())}},n[2]=s,n[3]=e,n[4]=t,n[5]=u):u=n[5];const d=ne(u);let f,h;g(document,"keydown",d),n[6]!==a||n[7]!==r||n[8]!==e||n[9]!==l||n[10]!==o?(f=()=>{if(!a)return r(e,l),()=>o(e)},h=[l,e,a,r,o],n[6]=a,n[7]=r,n[8]=e,n[9]=l,n[10]=o,n[11]=f,n[12]=h):(f=n[11],h=n[12]),p.useEffect(f,h)}function yc(e,t){const n=i(3),r=ee(re);let o;n[0]!==t||n[1]!==r?(o=e=>{for(const[n,o]of se.entries(t)){if(void 0===o)continue;const t=r.getHotkey(n).key;if(ie(t)(e)){P.debug("Satisfied",t,e);!1!==o(e)&&(e.preventDefault(),e.stopPropagation())}}},n[0]=t,n[1]=r,n[2]=o):o=n[2],g(e,"keydown",o)}function vc(e,t){const n=i(2);let r;n[0]!==t?(r=e=>{for(const[n,r]of se.entries(t))if(ie(n)(e)){P.debug("Satisfied",n,e);!1!==r(e)&&(e.preventDefault(),e.stopPropagation())}},n[0]=t,n[1]=r):r=n[1],g(e,"keydown",r)}const bc=v(!1),xc=()=>{const e=i(78),[t,n]=I(bc),[r,o]=p.useState(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[c,l]=p.useState(s),[u,f]=ae(),h=ee(re);let g,m;e[1]!==n?(g=()=>n((e=>!e)),e[1]=n,e[2]=g):g=e[2],mc("global.showHelp",g),e[3]!==u||e[4]!==f?(m=async e=>{const t={...u};f(e),await ce({config:e}).catch((e=>{throw f(t),e}))},e[3]=u,e[4]=f,e[5]=m):m=e[5];const y=m;let v;e[6]!==r||e[7]!==u||e[8]!==y?(v=async e=>{if(!r)return;const t=e.join("-"),n={...u,keymap:{...u.keymap,overrides:{...u.keymap.overrides,[r]:t}}};o(null),l([]),await y(n)},e[6]=r,e[7]=u,e[8]=y,e[9]=v):v=e[9];const b=v;let x;e[10]!==r||e[11]!==u||e[12]!==y?(x=async()=>{if(!r)return;const e={...u,keymap:{...u.keymap,overrides:{...u.keymap.overrides}}};delete e.keymap.overrides[r],o(null),l([]),await y(e)},e[10]=r,e[11]=u,e[12]=y,e[13]=x):x=e[13];const w=x;let T;e[14]!==u||e[15]!==y?(T=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const e={...u,keymap:{...u.keymap,overrides:{}}};o(null),l([]),await y(e)},e[14]=u,e[15]=y,e[16]=T):T=e[16];const D=T;if(!t)return null;let S;e[17]!==h||e[18]!==r||e[19]!==c||e[20]!==b||e[21]!==w?(S=e=>{const t=h.getHotkey(e);if(r===e){const n=le(e);return a.jsxs("div",{children:[a.jsx(ue,{defaultValue:c.join("+"),placeholder:t.name,onKeyDown:e=>{e.preventDefault();const t=[];if("Meta"===e.key||"Control"===e.key||"Alt"===e.key||"Shift"===e.key)return;if(e.metaKey&&t.push(de()?"Cmd":"Meta"),e.ctrlKey&&t.push("Ctrl"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),"-"===e.key)return;if("Escape"===e.key&&0===t.length)return o(null),void l([]);let n=e.key.toLowerCase();" "===e.key&&(n="Space"),t.push(n),b(t)},autoFocus:!0,endAdornment:a.jsx(q,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{o(null),l([])},children:a.jsx(d,{className:"w-4 h-4"})})}),a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),n.key!==t.key&&a.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:w,children:["Reset to default:"," ",a.jsx("span",{className:"font-mono",children:n.key})]})]})]},e)}return a.jsxs("div",{className:"grid grid-cols-[auto,2fr,3fr] gap-2 items-center",children:[h.isEditable(e)?a.jsx(fe,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),o(e)}}):a.jsx("div",{className:"w-3 h-3"}),a.jsx(he,{className:"justify-end",shortcut:t.key}),a.jsx("span",{children:t.name.toLowerCase()})]},e)},e[17]=h,e[18]=r,e[19]=c,e[20]=b,e[21]=w,e[22]=S):S=e[22];const O=S;let j,R,C,k,N,P,E,_,M,A,L,F,H,W,U,B,z,$,V,K,G,J,Y,X;if(e[23]!==h||e[24]!==O||e[25]!==t||e[26]!==n){const r=h.getHotkeyGroups(),o=e=>{const t=r[e];return a.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[a.jsx("h3",{className:"text-lg font-medium",children:e}),t.map((e=>O(e)))]})};U=pe,B=t,e[44]!==n?(z=e=>n(e),e[44]=n,e[45]=z):z=e[45],F=ge,H="sm:items-center sm:top-0",e[46]===Symbol.for("react.memo_cache_sentinel")?(W=a.jsx(me,{}),e[46]=W):W=e[46],_=ye,M=!1,A="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",e[47]===Symbol.for("react.memo_cache_sentinel")?(L=a.jsx(ve,{children:a.jsx(be,{children:"Shortcuts"})}),e[47]=L):L=e[47],P="flex flex-row gap-3",E=a.jsxs("div",{className:"w-1/2",children:[o("Editing"),o("Markdown")]}),j="w-1/2",R=o("Navigation"),C=o("Running Cells"),k=o("Creation and Ordering"),N=o("Other"),e[23]=h,e[24]=O,e[25]=t,e[26]=n,e[27]=j,e[28]=R,e[29]=C,e[30]=k,e[31]=N,e[32]=P,e[33]=E,e[34]=_,e[35]=M,e[36]=A,e[37]=L,e[38]=F,e[39]=H,e[40]=W,e[41]=U,e[42]=B,e[43]=z}else j=e[27],R=e[28],C=e[29],k=e[30],N=e[31],P=e[32],E=e[33],_=e[34],M=e[35],A=e[36],L=e[37],F=e[38],H=e[39],W=e[40],U=e[41],B=e[42],z=e[43];return e[48]===Symbol.for("react.memo_cache_sentinel")?($=a.jsx("span",{className:"text-destructive",children:"Reset all to default"}),e[48]=$):$=e[48],e[49]!==D?(V=a.jsx(q,{className:"mt-4 hover:bg-destructive/10 hover:border-destructive",variant:"outline",size:"xs",onClick:D,tabIndex:-1,children:$}),e[49]=D,e[50]=V):V=e[50],e[51]!==j||e[52]!==R||e[53]!==C||e[54]!==k||e[55]!==N||e[56]!==V?(K=a.jsxs("div",{className:j,children:[R,C,k,N,V]}),e[51]=j,e[52]=R,e[53]=C,e[54]=k,e[55]=N,e[56]=V,e[57]=K):K=e[57],e[58]!==P||e[59]!==E||e[60]!==K?(G=a.jsxs("div",{className:P,children:[E,K]}),e[58]=P,e[59]=E,e[60]=K,e[61]=G):G=e[61],e[62]!==_||e[63]!==M||e[64]!==A||e[65]!==L||e[66]!==G?(J=a.jsxs(_,{usePortal:M,className:A,children:[L,G]}),e[62]=_,e[63]=M,e[64]=A,e[65]=L,e[66]=G,e[67]=J):J=e[67],e[68]!==F||e[69]!==H||e[70]!==W||e[71]!==J?(Y=a.jsxs(F,{className:H,children:[W,J]}),e[68]=F,e[69]=H,e[70]=W,e[71]=J,e[72]=Y):Y=e[72],e[73]!==U||e[74]!==B||e[75]!==z||e[76]!==Y?(X=a.jsx(U,{open:B,onOpenChange:z,children:Y}),e[73]=U,e[74]=B,e[75]=z,e[76]=Y,e[77]=X):X=e[77],X},wc=["gpt-4o","gpt-4-turbo","gpt-4","gpt-3.5-turbo","claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","claude-3-5-sonnet-20240620","gemini-pro","gemini-1.5-pro-001","gemini-1.5-flash-001","gemini-1.5-pro-001","gemini-1.5-flash-002","gemini-1.5-pro-002","gemini-1.5-flash-002"],Tc="flex flex-row items-center space-x-1 space-y-0",Dc=[{id:"editor",label:"Editor",Icon:fe,className:"bg-[var(--blue-4)]"},{id:"display",label:"Display",Icon:gt,className:"bg-[var(--grass-4)]"},{id:"packageManagement",label:"Package Management",Icon:mt,className:"bg-[var(--red-4)]"},{id:"runtime",label:"Runtime",Icon:dt,className:"bg-[var(--amber-4)]"},{id:"ai",label:"AI",Icon:lt,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"labs",label:"Labs",Icon:ft,className:"bg-[var(--slate-4)]"}],Sc=v(Dc[0].id),Oc=()=>{const e=i(40),[t,n]=xe(),r=p.useRef(null),o=te(bc),[s,c]=I(Sc);let u,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=we(Te),e[0]=u):u=e[0],e[1]!==t?(d={resolver:u,defaultValues:t},e[1]=t,e[2]=d):d=e[2];const f=De(d);let h;e[3]!==n?(h=async e=>{await ce({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=h):h=e[4];const g=h;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(),e[5]=m):m=e[5];const y=m;let v;e[6]!==f||e[7]!==t?(v=()=>{const e=f.getValues("completion.copilot");return!1===e?null:"codeium"===e?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Codeium API key, follow"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#codeium-copilot",target:"_blank",rel:"noreferrer",children:"these instructions"}),"."]}),a.jsx(Re,{control:f.control,name:"completion.codeium_api_key",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"codeium-api-key-input",className:"m-0 inline-flex",placeholder:"key",...n,value:n.value||""})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"completion.codeium_api_key"})]})}})]}):"github"===e?a.jsx(ic,{}):void 0},e[6]=f,e[7]=t,e[8]=v):v=e[8];const b=v;let x;e[9]!==s||e[10]!==f||e[11]!==t||e[12]!==g||e[13]!==c||e[14]!==o||e[15]!==b?(x=()=>{switch(s){case"editor":return a.jsxs(a.Fragment,{children:[a.jsxs(jc,{title:"Autosave",children:[a.jsx(Re,{control:f.control,name:"save.autosave",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Autosave enabled"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"autosave-checkbox",checked:"after_delay"===n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(e?"after_delay":"off")}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"save.autosave"})]})}}),a.jsx(Re,{control:f.control,name:"save.autosave_delay",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Autosave delay (seconds)"}),a.jsx(Ne,{children:a.jsx(Fe,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:"after_delay"!==f.getValues("save.autosave"),...n,value:n.value/1e3,minValue:1,onChange:e=>{n.onChange(1e3*e),Number.isNaN(e)||g(f.getValues())}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"save.autosave_delay"})]})}})]}),a.jsxs(jc,{title:"Formatting",children:[a.jsx(Re,{control:f.control,name:"save.format_on_save",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Format on save"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"format-on-save-checkbox",checked:n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(e)}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"save.format_on_save"})]})}}),a.jsx(Re,{control:f.control,name:"formatting.line_length",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Line length"}),a.jsx(Ne,{children:a.jsx(Fe,{"data-testid":"line-length-input",className:"m-0 w-24",...n,value:n.value,minValue:1,maxValue:1e3,onChange:e=>{n.onChange(e),Number.isNaN(e)||g(f.getValues())}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"formatting.line_length"})]}),a.jsx(Ie,{children:"Maximum line length when formatting code."})]})}})]}),a.jsx(jc,{title:"Autocomplete",children:a.jsx(Re,{control:f.control,name:"completion.activate_on_typing",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Autocomplete"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"autocomplete-checkbox",checked:n.value,disabled:n.disabled,onCheckedChange:e=>{n.onChange(Boolean(e))}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"completion.activate_on_typing"})]}),a.jsx(Ie,{children:"When unchecked, code completion is still available through a hotkey."}),a.jsx("div",{children:a.jsx(q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),c("ai")},children:"Edit AI autocomplete"})})]})}})}),a.jsx(jc,{title:"Keymap",children:a.jsx(Re,{control:f.control,name:"keymap.preset",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Keymap"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"keymap-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:uc.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"keymap.preset"})]}),a.jsx("div",{children:a.jsx(q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),o(!0)},children:"Edit Keyboard Shortcuts"})})]})}})})]});case"display":return a.jsxs(a.Fragment,{children:[a.jsxs(jc,{title:"Display",children:[a.jsx(Re,{control:f.control,name:"display.default_width",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Default width"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"user-config-width-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"display.default_width"})]}),a.jsx(Ie,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),a.jsx(Re,{control:f.control,name:"display.theme",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Theme"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"theme-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:Le.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"display.theme"})]}),a.jsx(Ie,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),a.jsx(Re,{control:f.control,name:"display.code_editor_font_size",render:e=>{const{field:n}=e;return a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Code editor font size (px)"}),a.jsx(Ne,{children:a.jsx("span",{className:"inline-flex mr-2",children:a.jsx(Fe,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...n,value:n.value,minValue:8,maxValue:32,onChange:e=>{n.onChange(e),g(f.getValues())}})})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"display.code_editor_font_size"})]})}})]}),a.jsxs(jc,{title:"Outputs",children:[a.jsx(Re,{control:f.control,name:"display.cell_output",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Cell output area"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"cell-output-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["above","below"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"display.cell_output"})]}),a.jsx(Ie,{children:"Where to display cell's output."})]})}}),a.jsx(Re,{control:f.control,name:"display.dataframes",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Dataframe viewer"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"display-dataframes-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["rich","plain"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"display.dataframes"})]}),a.jsx(Ie,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}})]})]});case"packageManagement":return a.jsx(jc,{title:"Package Management",children:a.jsx(Re,{control:f.control,disabled:y,name:"package_management.manager",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Manager"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"package-manager-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:n.disabled,className:"inline-flex mr-2",children:Ae.map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"package_management.manager"})]}),a.jsxs(Ie,{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"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/package_management.html",target:"_blank",rel:"noreferrer",children:"docs"}),".",a.jsx("br",{}),a.jsx("br",{}),"Running marimo in a"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",target:"_blank",rel:"noreferrer",children:"sandboxed environment"})," ","is only supported by ",a.jsx(Me,{className:"inline",children:"uv"})]})]})}})});case"runtime":return a.jsxs(jc,{title:"Runtime configuration",children:[a.jsx(Re,{control:f.control,name:"runtime.auto_instantiate",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Autorun on startup"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"auto-instantiate-checkbox",disabled:n.disabled,checked:n.value,onCheckedChange:n.onChange})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"runtime.auto_instantiate"})]}),a.jsx(Ie,{children:"Whether to automatically run all cells on startup."})]})}}),a.jsx(Re,{control:f.control,name:"runtime.on_cell_change",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"On cell change"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"on-cell-change-select",onChange:e=>n.onChange(e.target.value),value:n.value,className:"inline-flex mr-2",children:["lazy","autorun"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"runtime.on_cell_change"})]}),a.jsx(Ie,{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.'})]})}}),a.jsx(Re,{control:f.control,name:"runtime.auto_reload",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"On module change"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"auto-reload-select",onChange:e=>n.onChange(e.target.value),value:n.value,disabled:y,className:"inline-flex mr-2",children:["off","lazy","autorun"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"runtime.auto_reload"})]}),a.jsx(Ie,{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.'})]})}}),a.jsxs(Ie,{children:["Learn more in the"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",target:"_blank",rel:"noreferrer",children:"docs"}),"."]})]});case"ai":return a.jsxs(a.Fragment,{children:[a.jsxs(jc,{title:"AI Code Completion",children:[a.jsx("p",{className:"text-sm text-muted-secondary",children:"You may use GitHub Copilot or Codeium for AI code completion."}),a.jsx(Re,{control:f.control,name:"completion.copilot",render:e=>{const{field:n}=e;return a.jsx("div",{className:"flex flex-col space-y-1",children:a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Provider"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"copilot-select",onChange:e=>{"none"===e.target.value?n.onChange(!1):n.onChange(e.target.value)},value:!0===n.value?"github":!1===n.value?"none":n.value,disabled:n.disabled,className:"inline-flex mr-2",children:["none","github","codeium"].map((e=>a.jsx("option",{value:e,children:e},e)))})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"completion.copilot"})]})})}}),b()]}),a.jsxs(jc,{title:"AI Keys",children:[a.jsx(Re,{control:f.control,name:"ai.open_ai.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"OpenAI API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-openai-api-key-input",className:"m-0 inline-flex",placeholder:"sk-proj...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.open_ai.api_key"})]}),a.jsxs(Ie,{children:["Your OpenAI API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://platform.openai.com/account/api-keys",target:"_blank",rel:"noreferrer",children:"platform.openai.com"}),"."]})]})}}),a.jsx(Re,{control:f.control,name:"ai.anthropic.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Anthropic API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-anthropic-api-key-input",className:"m-0 inline-flex",placeholder:"sk-ant...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.anthropic.api_key"})]}),a.jsxs(Ie,{children:["Your Anthropic API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noreferrer",children:"console.anthropic.com"}),"."]})]})}}),a.jsx(Re,{control:f.control,name:"ai.google.api_key",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Google AI API Key"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-google-api-key-input",className:"m-0 inline-flex",placeholder:"AI...",...n,onChange:e=>{const t=e.target.value;t.includes("*")||n.onChange(t)}})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.google.api_key"})]}),a.jsxs(Ie,{children:["Your Google AI API key from"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",children:"aistudio.google.com"}),"."]})]})}})]}),a.jsxs(jc,{title:"AI Assist",children:[a.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add an API key to ",a.jsx(Me,{className:"inline",children:"marimo.toml"})," to activate marimo's AI assistant; see"," ",a.jsx("a",{className:"text-link hover:underline",href:"https://docs.marimo.io/guides/editor_features/ai_completion.html",target:"_blank",rel:"noreferrer",children:"docs"})," ","for more info."]}),a.jsx(Re,{control:f.control,disabled:y,name:"ai.open_ai.base_url",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Base URL"}),a.jsx(Ne,{children:a.jsx(ue,{"data-testid":"ai-base-url-input",className:"m-0 inline-flex",placeholder:"https://api.openai.com/v1",...n})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.open_ai.base_url"})]}),a.jsx(Ie,{children:"This URL can be any OpenAI-compatible API endpoint."})]})}}),a.jsx(Re,{control:f.control,disabled:y,name:"ai.open_ai.model",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col space-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{children:"Model"}),a.jsx(Ne,{children:a.jsx(ue,{list:"ai-model-datalist","data-testid":"ai-model-input",className:"m-0 inline-flex",placeholder:"gpt-4-turbo",...n})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.open_ai.model"})]}),a.jsx("datalist",{id:"ai-model-datalist",children:wc.map((e=>a.jsx("option",{value:e,children:e},e)))}),a.jsx(Ie,{children:'If the model starts with "claude-", we will use your Anthropic API key. If the model starts with "gemini-", we will use your Google AI API key. Otherwise, we will use your OpenAI API key.'})]})}}),a.jsx(Re,{control:f.control,name:"ai.rules",render:e=>{const{field:n}=e;return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs(Ce,{children:[a.jsx(ke,{children:"Custom Rules"}),a.jsx(Ne,{children:a.jsx(qe,{"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",...n,value:n.value})}),a.jsx(Pe,{}),a.jsx(Rc,{userConfig:t,name:"ai.rules"})]}),a.jsx(Ie,{children:"Custom rules to include in all AI completion prompts."})]})}})]})]});case"labs":return a.jsxs(jc,{title:"Experimental Features",children:[a.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"⚠️ These features are experimental and may require restarting your notebook to take effect."}),a.jsx(Re,{control:f.control,name:"experimental.chat_sidebar",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Chat sidebar"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"chat-sidebar-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental chat sidebar to ask questions with an AI assistant."})]})}}),a.jsx(Re,{control:f.control,name:"experimental.tracing",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Tracing sidebar"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"tracing-sidebar-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental tracing sidebar to debug cell execution times and dependencies."})]})}}),!l()&&a.jsx(Re,{control:f.control,name:"experimental.rtc",render:e=>{const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:Tc,children:[a.jsx(ke,{className:"font-normal",children:"Real-time Collaboration"}),a.jsx(Ne,{children:a.jsx(Ee,{"data-testid":"rtc-checkbox",checked:!0===t.value,onCheckedChange:t.onChange})})]}),a.jsx(Ie,{children:"Enable experimental real-time collaboration to allow editing cell inputs by multiple users. Requires refreshing the page to take effect."})]})}})]})}},e[9]=s,e[10]=f,e[11]=t,e[12]=g,e[13]=c,e[14]=o,e[15]=b,e[16]=x):x=e[16];const w=x;let T,D,S;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(Me,{className:"inline",children:"marimo.toml"}),D=a.jsx("br",{}),e[17]=T,e[18]=D):(T=e[17],D=e[18]),e[19]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",T,D,"Run ",a.jsx(Me,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),e[19]=S):S=e[19];const O=S;let j,R,C,k,N,P,E,_;return e[20]!==f||e[21]!==g?(j=f.handleSubmit(g),e[20]=f,e[21]=g,e[22]=j):j=e[22],e[23]!==c?(R=e=>c(e),e[23]=c,e[24]=R):R=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsxs(Se,{className:"self-start max-h-none flex flex-col gap-2 flex-shrink-0 bg-background flex-1 min-h-full",children:[Dc.map(Cc),a.jsx("div",{className:"flex-1"}),!l()&&O]}),e[25]=C):C=e[25],e[26]!==s||e[27]!==R?(k=a.jsx(He,{value:s,onValueChange:R,orientation:"vertical",className:"w-1/3 pr-4 border-r h-full overflow-auto p-6",children:C}),e[26]=s,e[27]=R,e[28]=k):k=e[28],e[29]!==w?(N=w(),e[29]=w,e[30]=N):N=e[30],e[31]!==N?(P=a.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:N}),e[31]=N,e[32]=P):P=e[32],e[33]!==j||e[34]!==k||e[35]!==P?(E=a.jsxs("form",{ref:r,onChange:j,className:"flex text-pretty overflow-hidden",children:[k,P]}),e[33]=j,e[34]=k,e[35]=P,e[36]=E):E=e[36],e[37]!==f||e[38]!==E?(_=a.jsx(Oe,{...f,children:E}),e[37]=f,e[38]=E,e[39]=_):_=e[39],_},jc=e=>{const t=i(5),{title:n,children:r}=e;let o,s;return t[0]!==n?(o=a.jsx(Ct,{className:"text-base",children:n}),t[0]=n,t[1]=o):o=t[1],t[2]!==o||t[3]!==r?(s=a.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[o,r]}),t[2]=o,t[3]=r,t[4]=s):s=t[4],s},Rc=e=>{const t=i(24),{userConfig:n,name:r}=e;let o;t[0]!==n||t[1]!==r?(o=We(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];const s=o,c=ee(Ue);let l;t[3]!==c||t[4]!==r?(l=We(c,r),t[3]=c,t[4]=r,t[5]=l):l=t[5];const u=l;if(null==u)return null;if(s===u)return null;let d,h,p,g;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsxs("span",{children:["This setting is overridden by"," ",a.jsx(Me,{className:"inline",children:"pyproject.toml"}),"."]}),h=a.jsx("br",{}),t[6]=d,t[7]=h):(d=t[6],h=t[7]),t[8]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsxs("span",{children:["Edit the ",a.jsx(Me,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),g=a.jsx("br",{}),t[8]=p,t[9]=g):(p=t[8],g=t[9]);const m=String(s);let y,v;t[10]!==m?(y=a.jsxs("span",{children:["User value: ",a.jsx("strong",{children:m})]}),t[10]=m,t[11]=y):y=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx("br",{}),t[12]=v):v=t[12];const b=String(u);let x,w,T;t[13]!==b?(x=a.jsxs("span",{children:["Project value: ",a.jsx("strong",{children:b})]}),t[13]=b,t[14]=x):x=t[14],t[15]!==y||t[16]!==x?(w=a.jsxs(a.Fragment,{children:[d,h,p,g,y,v,x]}),t[15]=y,t[16]=x,t[17]=w):w=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(ht,{className:"w-3 h-3"}),t[18]=T):T=t[18];const D=String(u);let S,O;return t[19]!==D?(S=a.jsxs("span",{className:"text-[var(--amber-12)] text-xs flex items-center gap-1 border rounded px-2 py-1 bg-[var(--amber-2)] border-[var(--amber-6)] ml-1",children:[T,"Overridden by pyproject.toml [",D,"]"]}),t[19]=D,t[20]=S):S=t[20],t[21]!==w||t[22]!==S?(O=a.jsx(f,{content:w,children:S}),t[21]=w,t[22]=S,t[23]=O):O=t[23],O};function Cc(e){return a.jsx(je,{value:e.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:a.jsxs("div",{className:"flex gap-4 items-center text-lg",children:[a.jsx("span",{className:m(e.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground"),children:a.jsx(e.Icon,{className:"w-4 h-4"})}),e.label]})},e.id)}const kc=()=>{const e=i(27),[t,n]=Be();let r,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=we(ze),e[0]=r):r=e[0],e[1]!==t?(o={resolver:r,defaultValues:t},e[1]=t,e[2]=o):o=e[2];const s=De(o);let c;e[3]!==n?(c=async e=>{await Ke({config:e}).then((()=>{n(e)})).catch((()=>{n(e)}))},e[3]=n,e[4]=c):c=e[4];const l=c;let u,d,f,h,g,m,y,v,b,x;return e[5]!==t.width?(u=[t.width],e[5]=t.width,e[6]=u):u=e[6],p.useEffect(Nc,u),e[7]!==s||e[8]!==l?(d=s.handleSubmit(l),e[7]=s,e[8]=l,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsxs("div",{children:[a.jsx(Rt,{children:"Application Config"}),a.jsx(kt,{children:"Settings applied to this notebook"})]}),e[10]=f):f=e[10],e[11]!==s.control?(h=a.jsx(Re,{control:s.control,name:"width",render:Ec}),g=a.jsx(Re,{control:s.control,name:"app_title",render:Ic}),m=a.jsx(Re,{control:s.control,name:"css_file",render:_c}),y=a.jsx(Re,{control:s.control,name:"html_head_file",render:Mc}),v=a.jsx(Re,{control:s.control,name:"auto_download",render:qc}),e[11]=s.control,e[12]=h,e[13]=g,e[14]=m,e[15]=y,e[16]=v):(h=e[12],g=e[13],m=e[14],y=e[15],v=e[16]),e[17]!==d||e[18]!==h||e[19]!==g||e[20]!==m||e[21]!==y||e[22]!==v?(b=a.jsxs("form",{onChange:d,className:"flex flex-col gap-4",children:[f,h,g,m,y,v]}),e[17]=d,e[18]=h,e[19]=g,e[20]=m,e[21]=y,e[22]=v,e[23]=b):b=e[23],e[24]!==s||e[25]!==b?(x=a.jsx(Oe,{...s,children:b}),e[24]=s,e[25]=b,e[26]=x):x=e[26],x};function Nc(){window.dispatchEvent(new Event("resize"))}function Pc(e){return a.jsx("option",{value:e,children:e},e)}function Ec(e){const{field:t}=e;return a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{children:"Width"}),a.jsx(Ne,{children:a.jsx(_e,{"data-testid":"app-width-select",onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Pc)})}),a.jsx(Pe,{})]})}function Ic(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{children:"App title"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",onChange:e=>{t.onChange(e.target.value),$e.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),a.jsx(Pe,{})]}),a.jsx(Ie,{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 _c(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{className:"flex-shrink-0",children:"Custom CSS"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",placeholder:"custom.css",onChange:e=>{t.onChange(e.target.value),$e.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),a.jsx(Pe,{})]}),a.jsx(Ie,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Mc(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsxs(Ce,{className:"flex flex-row items-center space-x-1 space-y-0",children:[a.jsx(ke,{className:"flex-shrink-0",children:"HTML Head"}),a.jsx(Ne,{children:a.jsx(ue,{...t,value:t.value??"",placeholder:"head.html",onChange:e=>{t.onChange(e.target.value)}})}),a.jsx(Pe,{})]}),a.jsxs(Ie,{children:["A filepath to an HTML file to be injected into the"," ",a.jsx(Me,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function qc(e){const{field:t}=e;return a.jsxs("div",{className:"flex flex-col gap-y-1",children:[a.jsx("div",{className:"text-base font-bold text-muted-foreground",children:"Auto-download"}),a.jsxs(Ce,{className:"flex flex-col gap-2",children:[a.jsx(Ne,{children:a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ee,{id:"html-checkbox",checked:t.value.includes("html"),onCheckedChange:()=>{t.onChange(Ve(t.value,"html"))}}),a.jsx(ke,{htmlFor:"html-checkbox",children:"HTML"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ee,{id:"ipynb-checkbox",checked:t.value.includes("ipynb"),onCheckedChange:()=>{t.onChange(Ve(t.value,"ipynb"))}}),a.jsx(ke,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),a.jsx(Pe,{})]}),a.jsxs(Ie,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",a.jsx(Me,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const Ac=v(!1),Lc=e=>{const t=i(20),{showAppConfig:n}=e,r=void 0===n||n,[o,s]=I(Ac);let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx(Tt,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",color:"hint-green",children:a.jsx(f,{content:"Settings",children:a.jsx(Ge,{strokeWidth:1.8})})}),t[0]=c):c=t[0];const l=c;let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(ye,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:a.jsx(Oc,{})}),t[1]=u):u=t[1];const d=u;if(!r){let e,n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(Je,{children:l}),t[2]=e):e=t[2],t[3]!==o||t[4]!==s?(n=a.jsxs(pe,{open:o,onOpenChange:s,children:[e,d]}),t[3]=o,t[4]=s,t[5]=n):n=t[5],n}let h,p,g,m,y,v,b,x;return t[6]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(Ye,{asChild:!0,children:l}),t[6]=h):h=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(kc,{}),g=a.jsx("div",{className:"h-px bg-border my-2"}),t[7]=p,t[8]=g):(p=t[7],g=t[8]),t[9]!==s?(m=()=>s(!0),t[9]=s,t[10]=m):m=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsx(Ge,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),t[11]=y):y=t[11],t[12]!==m?(v=a.jsxs(Xe,{children:[h,a.jsxs(Ze,{className:"w-80 overflow-auto",align:"end",side:"bottom",onFocusOutside:Fc,children:[p,g,a.jsxs(q,{onClick:m,variant:"link",className:"px-0",children:[y,"User settings"]})]})]}),t[12]=m,t[13]=v):v=t[13],t[14]!==o||t[15]!==s?(b=a.jsx(pe,{open:o,onOpenChange:s,children:d}),t[14]=o,t[15]=s,t[16]=b):b=t[16],t[17]!==v||t[18]!==b?(x=a.jsxs(a.Fragment,{children:[v,b]}),t[17]=v,t[18]=b,t[19]=x):x=t[19],x};function Fc(e){return e.preventDefault()}const Hc=e=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 448 512",...e,children:a.jsx("path",{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"})}),Wc=e=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 640 512",fill:"currentColor",...e,children:a.jsx("path",{d:"M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"})}),Uc=p.createContext(null);function Bc(){const e=p.useContext(Uc);if(null===e)throw new Error("No Tree Api Provided");return e}const zc=p.createContext(null);const $c=p.createContext(null);const Vc=p.createContext(0);function Kc(){p.useContext(Vc)}function Gc(e,t,n){return Math.max(Math.min(e,n),t)}function Jc(e){return e&&e.isLeaf}function Yc(e){return e&&e.isInternal&&!e.isOpen}function Xc(e){var t;return e&&e.isOpen&&!(null===(t=e.children)||void 0===t?void 0:t.length)}const Zc=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Qc=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex((t=>t.id===e.id))};function el(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){const e=el(n,t);if(e)return e}return null}function tl(e,t){if(t(e),e.children)for(let n of e.children)tl(n,t)}function nl(e){const t=sl(e);let n;for(let r=0;r<t.length;++r){if(t[r]===e){n=ol(t,r);break}}null==n||n.focus()}function rl(e){const t=sl(e);let n;for(let r=0;r<t.length;++r){if(t[r]===e){n=il(t,r);break}}null==n||n.focus()}function ol(e,t){return t+1<e.length?e[t+1]:e[0]}function il(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function sl(e){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((t=>t===e||!e.contains(t)))}function al(e,t){return"boolean"==typeof t?t:"string"==typeof t?e[t]:t(e)}function cl(e){return null===e?null:ll(e)}function ll(e){return"string"==typeof e?e:e.id}function ul(e,...t){if(e)return e(...t)}function dl(e){return new Promise(((t,n)=>{let r=0;!function o(){r+=1,100===r&&n(),e()?t():setTimeout(o,10)}()}))}function fl(e){var t,n;const r=e.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:null!==(n=null===(t=e.root.children)||void 0===t?void 0:t.length)&&void 0!==n?n:0}function hl(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const pl=Object.freeze(Object.defineProperty({__proto__:null,access:al,bound:Gc,dfs:el,focusNextElement:nl,focusPrevElement:rl,getInsertIndex:fl,getInsertParentId:hl,identify:ll,identifyNull:cl,indexOf:Qc,isClosed:Yc,isDescendant:Zc,isItem:Jc,isOpenWithEmptyChildren:Xc,mergeRefs:function(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}},noop:function(){},safeRun:ul,waitFor:dl,walk:tl},Symbol.toStringTag,{value:"Module"})),gl={display:"flex",alignItems:"center",zIndex:1},ml={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},yl={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},vl=o.memo((function({top:e,left:t,indent:n}){const r={position:"absolute",pointerEvents:"none",top:e-2+"px",left:t+"px",right:n+"px"};return a.jsxs("div",{style:Object.assign(Object.assign({},gl),r),children:[a.jsx("div",{style:Object.assign({},yl)}),a.jsx("div",{style:Object.assign({},ml)})]})}));function bl({node:e,attrs:t,innerRef:n,children:r}){return a.jsx("div",Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function xl(e){return a.jsxs("div",{ref:e.dragHandle,style:e.style,children:[a.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?a.jsx(Tl,Object.assign({},e)):a.jsx(wl,Object.assign({},e))]})}function wl(e){return a.jsx(a.Fragment,{children:a.jsx("span",{children:e.node.data.name})})}function Tl({node:e}){const t=p.useRef();return p.useEffect((()=>{var e,n;null===(e=t.current)||void 0===e||e.focus(),null===(n=t.current)||void 0===n||n.select()}),[]),a.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{var r;"Escape"===n.key&&e.reset(),"Enter"===n.key&&e.submit((null===(r=t.current)||void 0===r?void 0:r.value)||"")}})}function Dl(e){return{type:"EDIT",id:e}}function Sl(e){return{type:"FOCUS",id:e}}class Ol{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.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===jl}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&&!(null===(e=this.prev)||void 0===e?void 0:e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(null===(e=this.next)||void 0===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 null===this.rowIndex?null:this.tree.at(this.rowIndex+1)}get prev(){return null===this.rowIndex?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,t;const n=this.childIndex;return null!==(t=null===(e=this.parent)||void 0===e?void 0:e.children[n+1])&&void 0!==t?t:null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.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 Ol(Object.assign({},this))}edit(){return this.tree.edit(this)}}const jl="__REACT_ARBORIST_INTERNAL_ROOT__";function Rl(e){var t;function n(t,r,o){const i=e.accessId(t),s=new Ol({tree:e,data:t,level:r,parent:o,id:i,children:null,isDraggable:e.isDraggable(t),rowIndex:null}),a=e.accessChildren(t);return a&&(s.children=a.map((e=>n(e,r+1,s)))),s}const r=new Ol({tree:e,id:jl,data:{id:jl},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),o=null!==(t=e.props.data)&&void 0!==t?t:[];return r.children=o.map((e=>n(e,0,r))),r}const Cl={open:(e,t)=>({type:"VISIBILITY_OPEN",id:e,filtered:t}),close:(e,t)=>({type:"VISIBILITY_CLOSE",id:e,filtered:t}),toggle:(e,t)=>({type:"VISIBILITY_TOGGLE",id:e,filtered:t}),clear:e=>({type:"VISIBILITY_CLEAR",filtered:e})};function kl(e={},t){if("VISIBILITY_OPEN"===t.type)return Object.assign(Object.assign({},e),{[t.id]:!0});if("VISIBILITY_CLOSE"===t.type)return Object.assign(Object.assign({},e),{[t.id]:!1});if("VISIBILITY_TOGGLE"===t.type){const n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}return"VISIBILITY_CLEAR"===t.type?{}:e}const Nl=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:null!==(t=null==e?void 0:e.initialOpenState)&&void 0!==t?t:{}},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}}},Pl=e=>({type:"SELECTION_ONLY",id:ll(e)}),El=e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(ll)}),Il=e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(ll)}),_l=e=>Object.assign({type:"SELECTION_SET"},e),Ml=e=>({type:"SELECTION_MOST_RECENT",id:null===e?null:ll(e)}),ql=e=>({type:"SELECTION_ANCHOR",id:null===e?null:ll(e)});const Al={cursor:e=>({type:"DND_CURSOR",cursor:e}),dragStart:(e,t)=>({type:"DND_DRAG_START",id:e,dragIds:t}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(e,t)=>({type:"DND_HOVERING",parentId:e,index:t})};const Ll={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Fl=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},Hl=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function Wl({offset:e,mouse:t,id:n,dragIds:r,isDragging:o}){return a.jsxs(Ul,{isDragging:o,children:[a.jsx(Bl,{offset:e,children:a.jsx($l,{id:n,dragIds:r})}),a.jsx(zl,{mouse:t,count:r.length})]})}const Ul=p.memo((function(e){return e.isDragging?a.jsx("div",{style:Ll,children:e.children}):null}));function Bl(e){return a.jsx("div",{className:"row preview",style:Fl(e.offset),children:e.children})}function zl(e){const{count:t,mouse:n}=e;return t>1?a.jsx("div",{className:"selected-count",style:Hl(n),children:t}):null}const $l=p.memo((function(e){const t=Bc(),n=t.get(e.id);return n?a.jsx(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:"transparent"},tree:t}):null}));var Vl=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function Kl(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(r=e[n],o=t[n],!(r===o||Vl(r)&&Vl(o)))return!1;var r,o;return!0}function Gl(e,t){var n;void 0===t&&(t=Kl);var r,o=[],i=!1;return function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}var Jl="object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()};function Yl(e){cancelAnimationFrame(e.id)}var Xl=-1;function Zl(e){if(void 0===e&&(e=!1),-1===Xl||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),Xl=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Xl}var Ql=null;function eu(e){if(void 0===e&&(e=!1),null===Ql||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),o=r.style;return o.width="100px",o.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Ql="positive-descending":(t.scrollLeft=1,Ql=0===t.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(t),Ql}return Ql}var tu=function(e,t){return e};function nu(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,o=e.getItemSize,i=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return(t=function(e){var t,d;function f(t){var r;return(r=e.call(this,t)||this)._instanceProps=c(r.props,bt(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:bt(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Gl((function(e,t,n,o){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:o})})),r._callOnScroll=void 0,r._callOnScroll=Gl((function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})})),r._getItemStyle=void 0,r._getItemStyle=function(e){var t,i=r.props,s=i.direction,a=i.itemSize,c=i.layout,u=r._getItemStyleCache(l&&a,l&&c,l&&s);if(u.hasOwnProperty(e))t=u[e];else{var d=n(r.props,e,r._instanceProps),f=o(r.props,e,r._instanceProps),h="horizontal"===s||"horizontal"===c,p="rtl"===s,g=h?d:0;u[e]=t={position:"absolute",left:p?void 0:g,right:p?g:void 0,top:h?0:d,height:h?"100%":f,width:h?f:"100%"}}return t},r._getItemStyleCache=void 0,r._getItemStyleCache=Gl((function(e,t,n){return{}})),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,o=t.scrollLeft,i=t.scrollWidth;r.setState((function(e){if(e.scrollOffset===o)return null;var t=r.props.direction,s=o;if("rtl"===t)switch(eu()){case"negative":s=-o;break;case"positive-descending":s=i-n-o}return s=Math.max(0,Math.min(s,i-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<s?"forward":"backward",scrollOffset:s,scrollUpdateWasRequested:!1}}),r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,o=t.scrollHeight,i=t.scrollTop;r.setState((function(e){if(e.scrollOffset===i)return null;var t=Math.max(0,Math.min(i,o-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!1}}),r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,"function"==typeof t?t(e):null!=t&&"object"==typeof t&&t.hasOwnProperty("current")&&(t.current=e)},r._resetIsScrollingDebounced=function(){var e,t,n,o;null!==r._resetIsScrollingTimeoutId&&Yl(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=(e=r._resetIsScrolling,t=150,n=Jl(),o={id:requestAnimationFrame((function r(){Jl()-n>=t?e.call(null):o.id=requestAnimationFrame(r)}))})},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},(function(){r._getItemStyleCache(-1,null)}))},r}d=e,(t=f).prototype=Object.create(d.prototype),t.prototype.constructor=t,vt(t,d),f.getDerivedStateFromProps=function(e,t){return ru(e,t),u(e),null};var h=f.prototype;return h.scrollTo=function(e){e=Math.max(0,e),this.setState((function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}}),this._resetIsScrollingDebounced)},h.scrollToItem=function(e,t){void 0===t&&(t="auto");var n=this.props,r=n.itemCount,o=n.layout,s=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var a=0;if(this._outerRef){var c=this._outerRef;a="vertical"===o?c.scrollWidth>c.clientWidth?Zl():0:c.scrollHeight>c.clientHeight?Zl():0}this.scrollTo(i(this.props,e,t,s,this._instanceProps,a))},h.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if("number"==typeof n&&null!=this._outerRef){var o=this._outerRef;"horizontal"===t||"horizontal"===r?o.scrollLeft=n:o.scrollTop=n}this._callPropsCallbacks()},h.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,o=r.scrollOffset;if(r.scrollUpdateWasRequested&&null!=this._outerRef){var i=this._outerRef;if("horizontal"===t||"horizontal"===n)if("rtl"===t)switch(eu()){case"negative":i.scrollLeft=-o;break;case"positive-ascending":i.scrollLeft=o;break;default:var s=i.clientWidth,a=i.scrollWidth;i.scrollLeft=a-s-o}else i.scrollLeft=o;else i.scrollTop=o}this._callPropsCallbacks()},h.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&Yl(this._resetIsScrollingTimeoutId)},h.render=function(){var e=this.props,t=e.children,n=e.className,o=e.direction,i=e.height,s=e.innerRef,a=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=void 0===d?tu:d,h=e.layout,g=e.outerElementType,m=e.outerTagName,y=e.style,v=e.useIsScrolling,b=e.width,x=this.state.isScrolling,w="horizontal"===o||"horizontal"===h,T=w?this._onScrollHorizontal:this._onScrollVertical,D=this._getRangeToRender(),S=D[0],O=D[1],j=[];if(l>0)for(var R=S;R<=O;R++)j.push(p.createElement(t,{data:u,key:f(R,u),index:R,isScrolling:v?x:void 0,style:this._getItemStyle(R)}));var C=r(this.props,this._instanceProps);return p.createElement(g||m||"div",{className:n,onScroll:T,ref:this._outerRefSetter,style:Qe({position:"relative",height:i,width:b,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:o},y)},p.createElement(a||c||"div",{children:j,ref:s,style:{height:w?"100%":C,pointerEvents:x?"none":void 0,width:w?C:"100%"}}))},h._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],o=e[3];this._callOnItemsRendered(t,n,r,o)}if("function"==typeof this.props.onScroll){var i=this.state,s=i.scrollDirection,a=i.scrollOffset,c=i.scrollUpdateWasRequested;this._callOnScroll(s,a,c)}},h._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,o=r.isScrolling,i=r.scrollDirection,c=r.scrollOffset;if(0===t)return[0,0,0,0];var l=s(this.props,c,this._instanceProps),u=a(this.props,l,c,this._instanceProps),d=o&&"backward"!==i?1:Math.max(1,n),f=o&&"forward"!==i?1:Math.max(1,n);return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},f}(p.PureComponent)).defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ru=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},ou=nu({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,o,i){var s=e.direction,a=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f="horizontal"===s||"horizontal"===u?d:a,h=Math.max(0,c*l-f),p=Math.min(h,t*l),g=Math.max(0,t*l-f+l+i);switch("smart"===n&&(n=r>=g-f&&r<=p+f?"auto":"center"),n){case"start":return p;case"end":return g;case"center":var m=Math.round(g+(p-g)/2);return m<Math.ceil(f/2)?0:m>h+Math.floor(f/2)?h:m;default:return r>=g&&r<=p?r:r<g?g:p}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,o=e.height,i=e.itemCount,s=e.itemSize,a=e.layout,c=e.width,l=t*s,u="horizontal"===r||"horizontal"===a?c:o,d=Math.ceil((u+n-l)/s);return Math.max(0,Math.min(i-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function iu(){var e,t;const n=Bc(),r=function(){const e=p.useContext($c);if(null===e)throw new Error("Provide a DnDContext");return e}().cursor;if(!r||"line"!==r.type)return null;const o=n.indent,i=n.rowHeight*r.index+(null!==(t=null!==(e=n.props.padding)&&void 0!==e?e:n.props.paddingTop)&&void 0!==t?t:0),s=o*r.level,c=n.renderCursor;return a.jsx(c,{top:i,left:s,indent:o})}const su=p.forwardRef((function(e,t){const{children:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]),o=Bc();return a.jsxs("div",Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&o.deselectAll()},children:[a.jsx(au,{}),n]}))})),au=()=>{const e=Bc();return a.jsx("div",{style:{height:e.visibleNodes.length*e.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:a.jsx(iu,{})})};const cu=p.forwardRef((function(e,t){var n,r,o,i,{style:s}=e,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["style"]);const l=Bc(),u=null!==(r=null!==(n=l.props.padding)&&void 0!==n?n:l.props.paddingTop)&&void 0!==r?r:0,d=null!==(i=null!==(o=l.props.padding)&&void 0!==o?o:l.props.paddingBottom)&&void 0!==i?i:0;return a.jsx("div",Object.assign({ref:t,style:Object.assign(Object.assign({},s),{height:`${parseFloat(s.height)+u+d}px`})},c))}));var lu,uu,du=p.createContext({dragDropManager:void 0});function fu(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=0;(i=new Error(t.replace(/%s/g,(function(){return r[s++]})))).name="Invariant Violation"}throw i.framesToPop=1,i}}(uu=lu||(lu={})).SOURCE="SOURCE",uu.TARGET="TARGET";var hu="dnd-core/INIT_COORDS",pu="dnd-core/BEGIN_DRAG",gu="dnd-core/PUBLISH_DRAG_SOURCE",mu="dnd-core/HOVER",yu="dnd-core/DROP",vu="dnd-core/END_DRAG";function bu(e,t){return{type:hu,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function xu(e){return(xu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wu(e){return"object"===xu(e)}var Tu={type:hu,payload:{clientOffset:null,sourceClientOffset:null}};function Du(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},r=n.publishSource,o=void 0===r||r,i=n.clientOffset,s=n.getSourceClientOffset,a=e.getMonitor(),c=e.getRegistry();e.dispatch(bu(i)),function(e,t,n){fu(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){fu(n.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,c);var l=function(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,a);if(null!==l){var u=null;if(i){if(!s)throw new Error("getSourceClientOffset must be defined");!function(e){fu("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(s),u=s(l)}e.dispatch(bu(i,u));var d=c.getSource(l).beginDrag(a,l);if(null!=d){!function(e){fu(wu(e),"Item must be an object.")}(d),c.pinSource(l);var f=c.getSourceType(l);return{type:pu,payload:{itemType:f,item:d,sourceId:l,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!o}}}}else e.dispatch(Tu)}}function Su(e){return function(){if(e.getMonitor().isDragging())return{type:gu}}}function Ou(e,t){return null===t?null===e:Array.isArray(e)?e.some((function(e){return e===t})):e===t}function ju(e){return function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).clientOffset;!function(e){fu(Array.isArray(e),"Expected targetIds to be an array.")}(t);var r=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,n){fu(t.isDragging(),"Cannot call hover while not dragging."),fu(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r<e.length;r++){var o=e[r];fu(e.lastIndexOf(o)===r,"Expected targetIds to be unique in the passed array."),fu(n.getTarget(o),"Expected targetIds to be registered.")}}(r,o,i),function(e,t,n){for(var r=e.length-1;r>=0;r--){var o=e[r];Ou(t.getTargetType(o),n)||e.splice(r,1)}}(r,i,o.getItemType()),function(e,t,n){e.forEach((function(e){n.getTarget(e).hover(t,e)}))}(r,o,i),{type:mu,payload:{targetIds:r,clientOffset:n||null}}}}function Ru(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ru(Object(n),!0).forEach((function(t){ku(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ru(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ku(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nu(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();!function(e){fu(e.isDragging(),"Cannot call drop while not dragging."),fu(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);var o=function(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach((function(o,i){var s=function(e,t,n,r){var o=n.getTarget(e),i=o?o.drop(r,e):void 0;(function(e){fu(void 0===e||wu(e),"Drop result must either be an object or undefined.")})(i),void 0===i&&(i=0===t?{}:r.getDropResult());return i}(o,i,r,n),a={type:yu,payload:{dropResult:Cu(Cu({},t),s)}};e.dispatch(a)}))}}function Pu(e){return function(){var t=e.getMonitor(),n=e.getRegistry();!function(e){fu(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var r=t.getSourceId();null!=r&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource());return{type:vu}}}function Eu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Iu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _u=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Iu(this,"store",void 0),Iu(this,"monitor",void 0),Iu(this,"backend",void 0),Iu(this,"isSetUp",!1),Iu(this,"handleRefCountChange",(function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))})),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return Eu(e,[{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,t=this.store.dispatch;var n=function(e){return{beginDrag:Du(e),publishDragSource:Su(e),hover:ju(e),drop:Nu(e),endDrag:Pu(e)}}(this);return Object.keys(n).reduce((function(r,o){var i,s=n[o];return r[o]=(i=s,function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=i.apply(e,r);void 0!==s&&t(s)}),r}),{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),e}();function Mu(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var qu="function"==typeof Symbol&&Symbol.observable||"@@observable",Au=function(){return Math.random().toString(36).substring(7).split("").join(".")},Lu={INIT:"@@redux/INIT"+Au(),REPLACE:"@@redux/REPLACE"+Au(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Au()}};function Fu(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Mu(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Mu(1));return n(Fu)(e,t)}if("function"!=typeof e)throw new Error(Mu(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(Mu(3));return i}function d(e){if("function"!=typeof e)throw new Error(Mu(4));if(c)throw new Error(Mu(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(Mu(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Mu(7));if(void 0===e.type)throw new Error(Mu(8));if(c)throw new Error(Mu(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++){(0,t[n])()}return e}return f({type:Lu.INIT}),(r={dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Mu(10));o=e,f({type:Lu.REPLACE})}})[qu]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Mu(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[qu]=function(){return this},e},r}var Hu=function(e,t){return e===t};function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Uu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wu(Object(n),!0).forEach((function(t){Bu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Bu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zu={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function $u(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zu,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case hu:case pu:return{initialSourceClientOffset:o.sourceClientOffset,initialClientOffset:o.clientOffset,clientOffset:o.clientOffset};case mu:return e=n.clientOffset,t=o.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?n:Uu(Uu({},n),{},{clientOffset:o.clientOffset});case vu:case yu:return zu;default:return n}}var Vu="dnd-core/ADD_SOURCE",Ku="dnd-core/ADD_TARGET",Gu="dnd-core/REMOVE_SOURCE",Ju="dnd-core/REMOVE_TARGET";function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yu(Object(n),!0).forEach((function(t){Zu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qu={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function ed(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qu,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case pu:return Xu(Xu({},n),{},{itemType:o.itemType,item:o.item,sourceId:o.sourceId,isSourcePublic:o.isSourcePublic,dropResult:null,didDrop:!1});case gu:return Xu(Xu({},n),{},{isSourcePublic:!0});case mu:return Xu(Xu({},n),{},{targetIds:o.targetIds});case Ju:return-1===n.targetIds.indexOf(o.targetId)?n:Xu(Xu({},n),{},{targetIds:(e=n.targetIds,t=o.targetId,e.filter((function(e){return e!==t})))});case yu:return Xu(Xu({},n),{},{dropResult:o.dropResult,didDrop:!0,targetIds:[]});case vu:return Xu(Xu({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function td(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case Vu:case Ku:return e+1;case Gu:case Ju:return e-1;default:return e}}var nd=[],rd=[];function od(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case mu:break;case Vu:case Ku:case Ju:case Gu:return nd;default:return rd}var t=e.payload,n=t.targetIds,r=void 0===n?[]:n,o=t.prevTargetIds,i=void 0===o?[]:o,s=function(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var o=[];return n.forEach((function(e,t){1===e&&o.push(t)})),o}(r,i),a=s.length>0||!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hu;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(r,i);if(!a)return nd;var c=i[i.length-1],l=r[r.length-1];return c!==l&&(c&&s.push(c),l&&s.push(l)),s}function id(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+1}function sd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ad(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sd(Object(n),!0).forEach((function(t){cd(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sd(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ld(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:od(r.dirtyHandlerIds,{type:o.type,payload:ad(ad({},o.payload),{},{prevTargetIds:(e=r,t="dragOperation.targetIds",n=[],t.split(".").reduce((function(e,t){return e&&e[t]?e[t]:n||null}),e))})}),dragOffset:$u(r.dragOffset,o),refCount:td(r.refCount,o),dragOperation:ed(r.dragOperation,o),stateId:id(r.stateId)}}function ud(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function fd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}nd.__IS_NONE__=!0,rd.__IS_ALL__=!0;var hd=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fd(this,"store",void 0),fd(this,"registry",void 0),this.store=t,this.registry=n}return dd(e,[{key:"subscribeToStateChange",value:function(e){var t=this,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0}).handlerIds;fu("function"==typeof e,"listener must be a function."),fu(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var r=this.store.getState().stateId;return this.store.subscribe((function(){var o=t.store.getState(),i=o.stateId;try{var s=i===r||i===r+1&&!function(e,t){return e!==nd&&(e===rd||void 0===t||(n=e,t.filter((function(e){return n.indexOf(e)>-1}))).length>0);var n}(o.dirtyHandlerIds,n);s||e()}finally{r=i}}))}},{key:"subscribeToOffsetChange",value:function(e){var t=this;fu("function"==typeof e,"listener must be a function.");var n=this.store.getState().dragOffset;return this.store.subscribe((function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())}))}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return fu(t,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return fu(t,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&(Ou(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return fu(t,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}},{key:"isOverTarget",value:function(e){if(!e)return!1;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),r=this.getItemType();if(r&&!Ou(n,r))return!1;var o=this.getTargetIds();if(!o.length)return!1;var i=o.indexOf(e);return t?i===o.length-1:i>-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 Boolean(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,r=e.clientOffset,o=e.initialClientOffset,i=e.initialSourceClientOffset,r&&o&&i?ud((n=i,{x:(t=r).x+n.x,y:t.y+n.y}),o):null;var e,t,n,r,o,i}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,t=e.clientOffset,n=e.initialClientOffset,t&&n?ud(t,n):null;var e,t,n}}]),e}(),pd=0;function gd(e){return(gd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function md(e,t){t&&Array.isArray(e)?e.forEach((function(e){return md(e,!1)})):fu("string"==typeof e||"symbol"===gd(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const yd="undefined"!=typeof global?global:self,vd=yd.MutationObserver||yd.WebKitMutationObserver;function bd(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const xd="function"==typeof vd?function(e){let t=1;const n=new vd(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:bd;class wd{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Td=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=xd(this.flush),this.requestErrorThrow=bd((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Dd=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new wd(this.onError,(e=>t[t.length]=e));return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(Td.registerPendingError);function Sd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Od(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Rd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Cd(e){var t=(pd++).toString();switch(e){case lu.SOURCE:return"S".concat(t);case lu.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function kd(e){switch(e[0]){case"S":return lu.SOURCE;case"T":return lu.TARGET;default:fu(!1,"Cannot parse handler ID: ".concat(e))}}function Nd(e,t){var n=e.entries(),r=!1;do{var o=n.next(),i=o.done;if(jd(o.value,2)[1]===t)return!0;r=!!i}while(!r);return!1}var Pd=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Od(this,"types",new Map),Od(this,"dragSources",new Map),Od(this,"dropTargets",new Map),Od(this,"pinnedSourceId",null),Od(this,"pinnedSource",null),Od(this,"store",void 0),this.store=t}return Sd(e,[{key:"addSource",value:function(e,t){md(e),function(e){fu("function"==typeof e.canDrag,"Expected canDrag to be a function."),fu("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),fu("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var n=this.addHandler(lu.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Vu,payload:{sourceId:e}}}(n)),n}},{key:"addTarget",value:function(e,t){md(e,!0),function(e){fu("function"==typeof e.canDrop,"Expected canDrop to be a function."),fu("function"==typeof e.hover,"Expected hover to be a function."),fu("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var n=this.addHandler(lu.TARGET,e,t);return this.store.dispatch(function(e){return{type:Ku,payload:{targetId:e}}}(n)),n}},{key:"containsHandler",value:function(e){return Nd(this.dragSources,e)||Nd(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return fu(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return fu(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return fu(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return fu(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return kd(e)===lu.SOURCE}},{key:"isTargetId",value:function(e){return kd(e)===lu.TARGET}},{key:"removeSource",value:function(e){var t,n=this;fu(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Gu,payload:{sourceId:e}}}(e)),t=function(){n.dragSources.delete(e),n.types.delete(e)},Td.enqueueTask(Dd.create(t))}},{key:"removeTarget",value:function(e){fu(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Ju,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);fu(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){fu(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var r=Cd(e);return this.types.set(r,t),e===lu.SOURCE?this.dragSources.set(r,n):e===lu.TARGET&&this.dropTargets.set(r,n),r}}]),e}();function Ed(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return Fu(ld,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(arguments.length>3&&void 0!==arguments[3]&&arguments[3]),o=new hd(r,new Pd(r)),i=new _u(r,o),s=e(i,t,n);return i.receiveBackend(s),i}var Id=["children"];function _d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Md(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Md(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Md(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qd(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Ad=0,Ld=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),Fd=p.memo((function(e){var t=e.children,n=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hd(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;o[Ld]||(o[Ld]={dragDropManager:Ed(e,t,n,r)});return o[Ld]}(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}(qd(e,Id)),r=_d(n,2),o=r[0],i=r[1];return p.useEffect((function(){if(i){var e=Hd();return++Ad,function(){0==--Ad&&(e[Ld]=null)}}}),[]),a.jsx(du.Provider,Object.assign({value:o},{children:t}),void 0)}));function Hd(){return"undefined"!=typeof global?global:window}function Wd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Ud(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bd=!1,zd=!1,$d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ud(this,"internalMonitor",void 0),Ud(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return Wd(e,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){fu(!Bd,"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 Bd=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Bd=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;fu(!zd,"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 zd=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{zd=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{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()}}]),e}();function Vd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Kd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gd=!1,Jd=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Kd(this,"internalMonitor",void 0),Kd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return Vd(e,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;fu(!Gd,"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 Gd=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Gd=!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()}}]),e}();function Yd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!p.isValidElement(t)){var r=t;return e(r,n),r}var o=t;return function(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}(o),function(e,t){var n=e.ref;return fu("string"!=typeof n,"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"),n?p.cloneElement(e,{ref:function(e){Zd(n,e),Zd(t,e)}}):p.cloneElement(e,{ref:t})}(o,n?function(t){return e(t,n)}:e)}}function Xd(e){var t={};return Object.keys(e).forEach((function(n){var r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var o=Yd(r);t[n]=function(){return o}}})),t}function Zd(e,t){"function"==typeof e?e(t):e.current=t}function Qd(e){return(Qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ef(e){return null!==e&&"object"===Qd(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function tf(e,t,n,r){var o=void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var l=i[c];if(!a(l))return!1;var u=e[l],d=t[l];if(!1===(o=void 0)||void 0===o&&u!==d)return!1}return!0}function nf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var of=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rf(this,"hooks",Xd({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,ef(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,ef(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),rf(this,"handlerId",null),rf(this,"dragSourceRef",null),rf(this,"dragSourceNode",void 0),rf(this,"dragSourceOptionsInternal",null),rf(this,"dragSourceUnsubscribe",void 0),rf(this,"dragPreviewRef",null),rf(this,"dragPreviewNode",void 0),rf(this,"dragPreviewOptionsInternal",null),rf(this,"dragPreviewUnsubscribe",void 0),rf(this,"lastConnectedHandlerId",null),rf(this,"lastConnectedDragSource",null),rf(this,"lastConnectedDragSourceOptions",null),rf(this,"lastConnectedDragPreview",null),rf(this,"lastConnectedDragPreviewOptions",null),rf(this,"backend",void 0),this.backend=t}return nf(e,[{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,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(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,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();t&&this.disconnectDragPreview(),this.handlerId&&(e?t&&(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!tf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!tf(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}}]),e}();function sf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function af(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cf=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),af(this,"hooks",Xd({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,ef(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),af(this,"handlerId",null),af(this,"dropTargetRef",null),af(this,"dropTargetNode",void 0),af(this,"dropTargetOptionsInternal",null),af(this,"unsubscribeDropTarget",void 0),af(this,"lastConnectedHandlerId",null),af(this,"lastConnectedDropTarget",null),af(this,"lastConnectedDropTargetOptions",null),af(this,"backend",void 0),this.backend=t}return sf(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{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!tf(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}}]),e}();var lf="undefined"!=typeof window?p.useLayoutEffect:p.useEffect;function uf(e){return(uf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function df(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function ff(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hf=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ff(this,"spec",void 0),ff(this,"monitor",void 0),ff(this,"connector",void 0),this.spec=t,this.monitor=n,this.connector=r}return df(e,[{key:"beginDrag",value:function(){var e,t=this.spec,n=this.monitor;return null!==(e="object"===uf(t.item)?t.item:"function"==typeof t.item?t.item(n):{})&&void 0!==e?e:null}},{key:"canDrag",value:function(){var e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}},{key:"isDragging",value:function(e,t){var n=this.spec,r=this.monitor,o=n.isDragging;return o?o(r):t===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,t=this.monitor,n=this.connector,r=e.end;r&&r(t.getItem(),t),n.reconnect()}}]),e}();function pf(){var e=p.useContext(du).dragDropManager;return fu(null!=e,"Expected drag drop context"),e}function gf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return mf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yf(e,t,n){var r=pf(),o=function(e,t,n){var r=p.useMemo((function(){return new hf(e,t,n)}),[t,n]);return p.useEffect((function(){r.spec=e}),[e]),r}(e,t,n),i=function(e){return p.useMemo((function(){var t=e.type;return fu(null!=t,"spec.type must be defined"),t}),[e])}(e);lf((function(){if(null!=i){var e=function(e,t,n){var r=n.getRegistry(),o=r.addSource(e,t);return[o,function(){return r.removeSource(o)}]}(i,o,r),s=gf(e,2),a=s[0],c=s[1];return t.receiveHandlerId(a),n.receiveHandlerId(a),c}}),[r,t,n,o,i])}function vf(e){return function(e){if(Array.isArray(e))return bf(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return bf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bf(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xf(e,t){var n=vf(t||[]);return null==t&&"function"!=typeof e&&n.push(e),p.useMemo((function(){return"function"==typeof e?e():e}),n)}function wf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Tf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Df(e,t,n){var r=wf(p.useState((function(){return t(e)})),2),o=r[0],i=r[1],s=p.useCallback((function(){var r=t(e);at(o,r)||(i(r),n&&n())}),[o,e,n]);return lf(s),[o,s]}function Sf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Of(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Of(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Of(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jf(e,t,n){return function(e,t,n){var r=Sf(Df(e,t,n),2),o=r[0],i=r[1];return lf((function(){var t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})}),[e,i]),o}(t,e||function(){return{}},(function(){return n.reconnect()}))}function Rf(e){return p.useMemo((function(){return e.hooks.dragSource()}),[e])}function Cf(e){return p.useMemo((function(){return e.hooks.dragPreview()}),[e])}function kf(e,t){var n=xf(e,t);fu(!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,o=(r=pf(),p.useMemo((function(){return new $d(r)}),[r])),i=function(e,t){var n=pf(),r=p.useMemo((function(){return new of(n.getBackend())}),[n]);return lf((function(){return r.dragSourceOptions=e||null,r.reconnect(),function(){return r.disconnectDragSource()}}),[r,e]),lf((function(){return r.dragPreviewOptions=t||null,r.reconnect(),function(){return r.disconnectDragPreview()}}),[r,t]),r}(n.options,n.previewOptions);return yf(n,o,i),[jf(n.collect,o,i),Rf(i),Cf(i)]}function Nf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Pf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ef=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pf(this,"spec",void 0),Pf(this,"monitor",void 0),this.spec=t,this.monitor=n}return Nf(e,[{key:"canDrop",value:function(){var e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}},{key:"hover",value:function(){var e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}},{key:"drop",value:function(){var e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}}]),e}();function If(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return _f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mf(e,t,n){var r=pf(),o=function(e,t){var n=p.useMemo((function(){return new Ef(e,t)}),[t]);return p.useEffect((function(){n.spec=e}),[e]),n}(e,t),i=function(e){var t=e.accept;return p.useMemo((function(){return fu(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]}),[t])}(e);lf((function(){var e=function(e,t,n){var r=n.getRegistry(),o=r.addTarget(e,t);return[o,function(){return r.removeTarget(o)}]}(i,o,r),s=If(e,2),a=s[0],c=s[1];return t.receiveHandlerId(a),n.receiveHandlerId(a),c}),[r,t,o,n,i.map((function(e){return e.toString()})).join("|")])}function qf(e){return p.useMemo((function(){return e.hooks.dropTarget()}),[e])}function Af(e,t){var n,r=xf(e,t),o=(n=pf(),p.useMemo((function(){return new Jd(n)}),[n])),i=function(e){var t=pf(),n=p.useMemo((function(){return new cf(t.getBackend())}),[t]);return lf((function(){return n.dropTargetOptions=e||null,n.reconnect(),function(){return n.disconnectDropTarget()}}),[e]),n}(r.options);return Mf(r,o,i),[jf(r.collect,o,i),qf(i)]}function Lf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(np){a=!0,o=np}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ff(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ff(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ff(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Hf(e){var t=null;return function(){return null==t&&(t=e()),t}}function Wf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Uf(this,"entered",[]),Uf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return Wf(e,[{key:"enter",value:function(e){var t=this,n=this.entered.length;return this.entered=function(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var o=[];return n.forEach((function(e){return o.push(e)})),o}(this.entered.filter((function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))})),[e]),0===n&&this.entered.length>0}},{key:"leave",value:function(e){var t,n,r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),n=e,t.filter((function(e){return e!==n}))),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}]),e}(),zf=Hf((function(){return/firefox/i.test(navigator.userAgent)})),$f=Hf((function(){return Boolean(window.safari)}));function Vf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Kf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gf=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Kf(this,"xs",void 0),Kf(this,"ys",void 0),Kf(this,"c1s",void 0),Kf(this,"c2s",void 0),Kf(this,"c3s",void 0);for(var r=t.length,o=[],i=0;i<r;i++)o.push(i);o.sort((function(e,n){return t[e]<t[n]?-1:1}));for(var s,a,c=[],l=[],u=0;u<r-1;u++)s=t[u+1]-t[u],a=n[u+1]-n[u],c.push(s),l.push(a/s);for(var d=[l[0]],f=0;f<c.length-1;f++){var h=l[f],p=l[f+1];if(h*p<=0)d.push(0);else{s=c[f];var g=c[f+1],m=s+g;d.push(3*m/((m+g)/h+(m+s)/p))}}d.push(l[l.length-1]);for(var y,v=[],b=[],x=0;x<d.length-1;x++){y=l[x];var w=d[x],T=1/c[x],D=w+d[x+1]-y-y;v.push((y-w-D)*T),b.push(D*T*T)}this.xs=t,this.ys=n,this.c1s=d,this.c2s=v,this.c3s=b}return Vf(e,[{key:"interpolate",value:function(e){var t=this.xs,n=this.ys,r=this.c1s,o=this.c2s,i=this.c3s,s=t.length-1;if(e===t[s])return n[s];for(var a,c=0,l=i.length-1;c<=l;){var u=t[a=Math.floor(.5*(c+l))];if(u<e)c=a+1;else{if(!(u>e))return n[a];l=a-1}}var d=e-t[s=Math.max(0,l)],f=d*d;return n[s]+r[s]*d+o[s]*f+i[s]*d*f}}]),e}();function Jf(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Yf(e){return{x:e.clientX,y:e.clientY}}function Xf(e,t,n,r,o){var i,s,a,c="IMG"===(i=t).nodeName&&(zf()||!(null!==(s=document.documentElement)&&void 0!==s&&s.contains(i))),l=Jf(c?e:t),u={x:n.x-l.x,y:n.y-l.y},d=e.offsetWidth,f=e.offsetHeight,h=r.anchorX,p=r.anchorY,g=function(e,t,n,r){var o=e?t.width:n,i=e?t.height:r;return $f()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(c,t,d,f),m=g.dragPreviewWidth,y=g.dragPreviewHeight,v=o.offsetX,b=o.offsetY,x=0===b||b;return{x:0===v||v?v:new Gf([0,.5,1],[u.x,u.x/d*m,u.x+m-d]).interpolate(h),y:x?b:(a=new Gf([0,.5,1],[u.y,u.y/f*y,u.y+y-f]).interpolate(p),$f()&&c&&(a+=(window.devicePixelRatio-1)*y),a)}}var Zf="__NATIVE_FILE__",Qf="__NATIVE_URL__",eh="__NATIVE_TEXT__",th="__NATIVE_HTML__";const nh=Object.freeze(Object.defineProperty({__proto__:null,FILE:Zf,HTML:th,TEXT:eh,URL:Qf},Symbol.toStringTag,{value:"Module"}));function rh(e,t,n){var r=t.reduce((function(t,n){return t||e.getData(n)}),"");return null!=r?r:n}var oh;function ih(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sh=(ih(oh={},Zf,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),ih(oh,th,{exposeProperties:{html:function(e,t){return rh(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),ih(oh,Qf,{exposeProperties:{urls:function(e,t){return rh(e,t,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),ih(oh,eh,{exposeProperties:{text:function(e,t){return rh(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),oh);function ah(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function ch(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ch(this,"item",void 0),ch(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return ah(e,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach((function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(t,'" until the drop event.')),null}})}))}},{key:"loadDataTransfer",value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach((function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}})),Object.defineProperties(this.item,n)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function uh(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(sh).filter((function(e){return sh[e].matchesTypes.some((function(e){return t.indexOf(e)>-1}))}))[0]||null}function dh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function fh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hh=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fh(this,"ownerDocument",null),fh(this,"globalContext",void 0),fh(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=n}return dh(e,[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){var e;return null!==(e=this.globalContext)&&void 0!==e&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}}]),e}();function ph(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ph(Object(n),!0).forEach((function(t){yh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ph(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function yh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vh,bh=function(){function e(t,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yh(this,"options",void 0),yh(this,"actions",void 0),yh(this,"monitor",void 0),yh(this,"registry",void 0),yh(this,"enterLeaveCounter",void 0),yh(this,"sourcePreviewNodes",new Map),yh(this,"sourcePreviewNodeOptions",new Map),yh(this,"sourceNodes",new Map),yh(this,"sourceNodeOptions",new Map),yh(this,"dragStartSourceIds",null),yh(this,"dropTargetIds",[]),yh(this,"dragEnterTargetIds",[]),yh(this,"currentNativeSource",null),yh(this,"currentNativeHandle",null),yh(this,"currentDragSourceNode",null),yh(this,"altKeyPressed",!1),yh(this,"mouseMoveTimeoutTimer",null),yh(this,"asyncEndDragFrameId",null),yh(this,"dragOverTargetIds",null),yh(this,"lastClientOffset",null),yh(this,"hoverRafId",null),yh(this,"getSourceClientOffset",(function(e){var t=o.sourceNodes.get(e);return t&&Jf(t)||null})),yh(this,"endDragNativeItem",(function(){o.isDraggingNativeItem()&&(o.actions.endDrag(),o.currentNativeHandle&&o.registry.removeSource(o.currentNativeHandle),o.currentNativeHandle=null,o.currentNativeSource=null)})),yh(this,"isNodeInDocument",(function(e){return Boolean(e&&o.document&&o.document.body&&o.document.body.contains(e))})),yh(this,"endDragIfSourceWasRemovedFromDOM",(function(){var e=o.currentDragSourceNode;null==e||o.isNodeInDocument(e)||o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()})),yh(this,"handleTopDragStartCapture",(function(){o.clearCurrentDragSourceNode(),o.dragStartSourceIds=[]})),yh(this,"handleTopDragStart",(function(e){if(!e.defaultPrevented){var t=o.dragStartSourceIds;o.dragStartSourceIds=null;var n=Yf(e);o.monitor.isDragging()&&o.actions.endDrag(),o.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:o.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,i=uh(r);if(o.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){var s=o.monitor.getSourceId(),a=o.sourceNodes.get(s),c=o.sourcePreviewNodes.get(s)||a;if(c){var l=o.getCurrentSourcePreviewNodeOptions(),u=Xf(a,c,n,{anchorX:l.anchorX,anchorY:l.anchorY},{offsetX:l.offsetX,offsetY:l.offsetY});r.setDragImage(c,u.x,u.y)}}try{null==r||r.setData("application/json",{})}catch(np){}o.setCurrentDragSourceNode(e.target),o.getCurrentSourcePreviewNodeOptions().captureDraggingState?o.actions.publishDragSource():setTimeout((function(){return o.actions.publishDragSource()}),0)}else if(i)o.beginDragNativeItem(i);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}})),yh(this,"handleTopDragEndCapture",(function(){o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()})),yh(this,"handleTopDragEnterCapture",(function(e){if(o.dragEnterTargetIds=[],o.enterLeaveCounter.enter(e.target)&&!o.monitor.isDragging()){var t=e.dataTransfer,n=uh(t);n&&o.beginDragNativeItem(n,t)}})),yh(this,"handleTopDragEnter",(function(e){var t=o.dragEnterTargetIds;(o.dragEnterTargetIds=[],o.monitor.isDragging())&&(o.altKeyPressed=e.altKey,t.length>0&&o.actions.hover(t,{clientOffset:Yf(e)}),t.some((function(e){return o.monitor.canDropOnTarget(e)}))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())))})),yh(this,"handleTopDragOverCapture",(function(){o.dragOverTargetIds=[]})),yh(this,"handleTopDragOver",(function(e){var t=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));o.altKeyPressed=e.altKey,o.lastClientOffset=Yf(e),null===o.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(o.hoverRafId=requestAnimationFrame((function(){o.monitor.isDragging()&&o.actions.hover(t||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null}))),(t||[]).some((function(e){return o.monitor.canDropOnTarget(e)}))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))})),yh(this,"handleTopDragLeaveCapture",(function(e){o.isDraggingNativeItem()&&e.preventDefault(),o.enterLeaveCounter.leave(e.target)&&o.isDraggingNativeItem()&&setTimeout((function(){return o.endDragNativeItem()}),0)})),yh(this,"handleTopDropCapture",(function(e){var t;(o.dropTargetIds=[],o.isDraggingNativeItem())?(e.preventDefault(),null===(t=o.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):uh(e.dataTransfer)&&e.preventDefault();o.enterLeaveCounter.reset()})),yh(this,"handleTopDrop",(function(e){var t=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(t,{clientOffset:Yf(e)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()})),yh(this,"handleSelectStart",(function(e){var t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))})),this.options=new hh(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Bf(this.isNodeInDocument)}return mh(e,[{key:"profile",value:function(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.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(void 0!==e){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,t=this.rootElement;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var o=function(t){return r.handleDragStart(t,e)},i=function(e){return r.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",o),t.addEventListener("selectstart",i),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",o),t.removeEventListener("selectstart",i),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},o=function(t){return n.handleDragOver(t,e)},i=function(t){return n.handleDrop(t,e)};return t.addEventListener("dragenter",r),t.addEventListener("dragover",o),t.addEventListener("drop",i),function(){t.removeEventListener("dragenter",r),t.removeEventListener("dragover",o),t.removeEventListener("drop",i)}}},{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(),t=this.sourceNodeOptions.get(e);return gh({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return gh({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(nh).some((function(t){return nh[t]===e}))}},{key:"beginDragNativeItem",value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){var n=new lh(sh[e]);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout((function(){var e;return null===(e=t.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;if(this.currentDragSourceNode=null,this.rootElement)null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0);return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}}]),e}();var xh=function(e,t,n){return new bh(e,t,n)};function wh(e){const t=Bc(),n=t.selectedIds,[r,o,i]=kf((()=>({canDrag:()=>e.isDraggable,type:"NODE",item:()=>{const r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(Al.dragStart(e.id,r)),{id:e.id}},end:()=>{t.hideCursor();let{parentId:e,index:n,dragIds:r}=t.state.dnd;t.canDrop()&&(ul(t.props.onMove,{dragIds:r,parentId:e===jl?null:e,index:null===n?0:n,dragNodes:t.dragNodes,parentNode:t.get(e)}),t.open(e)),t.dispatch(Al.dragEnd())}})),[n,e]);return p.useEffect((()=>{i((vh||((vh=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),vh))}),[i]),o}function Th(e,t){return{parentId:e||null,index:t}}function Dh(e,t){return{type:"line",index:e,level:t}}function Sh(e,t){var n;let r=e;for(;r.parent&&r.level>t;)r=r.parent;return{parentId:(null===(n=r.parent)||void 0===n?void 0:n.id)||null,index:Qc(r)+1}}function Oh(e){var t;const n=function(e,t){const n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),o=t.y-Math.round(n.y),i=n.height,s=o<i/2,a=!s,c=i/4,l=o>c&&o<i-c;return{x:r,inTopHalf:s,inBottomHalf:a,inMiddle:l,atTop:!l&&s,atBottom:!l&&a}}(e.element,e.offset),r=e.indent,o=Math.round(Math.max(0,n.x-r)/r),{node:i,nextNode:s,prevNode:a}=e,[c,l]=function(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}(i,a,s,n);if(i&&i.isInternal&&n.inMiddle)return{drop:Th(i.id,null),cursor:(u=i.id,{type:"highlight",id:u})};var u;if(!c)return{drop:Th(null===(t=null==l?void 0:l.parent)||void 0===t?void 0:t.id,0),cursor:Dh(0,0)};if(Jc(c)){const e=Gc(o,(null==l?void 0:l.level)||0,c.level);return{drop:Sh(c,e),cursor:Dh(c.rowIndex+1,e)}}if(Yc(c)){const e=Gc(o,(null==l?void 0:l.level)||0,c.level);return{drop:Sh(c,e),cursor:Dh(c.rowIndex+1,e)}}if(Xc(c)){const e=Gc(o,0,c.level+1);return e>c.level?{drop:Th(c.id,0),cursor:Dh(c.rowIndex+1,e)}:{drop:Sh(c,e),cursor:Dh(c.rowIndex+1,e)}}return{drop:Th(null==c?void 0:c.id,0),cursor:Dh(c.rowIndex+1,c.level+1)}}const jh=o.memo((function({index:e,style:t}){Kc(),function(){const e=p.useContext(zc);if(null===e)throw new Error("Provide a NodesContext")}();const n=Bc(),r=function(e){const t=Bc(),n=t.at(e);if(!n)throw new Error(`Could not find node for index: ${e}`);return p.useMemo((()=>{const r=n.clone();return t.visibleNodes[e]=r,r}),[...Object.values(n.state),n])}(e),o=p.useRef(null),i=wh(r),s=function(e,t){const n=Bc(),[r,o]=Af((()=>({accept:"NODE",canDrop:()=>n.canDrop(),hover:(r,o)=>{const i=o.getClientOffset();if(!e.current||!i)return;const{cursor:s,drop:a}=Oh({element:e.current,offset:i,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});a&&n.dispatch(Al.hovering(a.parentId,a.index)),o.canDrop()?s&&n.showCursor(s):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null}})),[t,e.current,n.props]);return o}(o,r),c=p.useCallback((e=>{o.current=e,s(e)}),[s]),l=n.indent*r.level,u=p.useMemo((()=>({paddingLeft:l})),[l]),d=p.useMemo((()=>{var e,r;return Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(null!==(r=null!==(e=n.props.padding)&&void 0!==e?e:n.props.paddingTop)&&void 0!==r?r:0)})}),[t,n.props.padding,n.props.paddingTop]),f={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,style:d,tabIndex:-1,className:n.props.rowClassName};p.useEffect((()=>{var e;!r.isEditing&&r.isFocused&&(null===(e=o.current)||void 0===e||e.focus({preventScroll:!0}))}),[r.isEditing,r.isFocused,o.current]);const h=n.renderNode,g=n.renderRow;return a.jsx(g,{node:r,innerRef:c,attrs:f,children:a.jsx(h,{node:r,tree:n,style:u,dragHandle:i})})}));let Rh="",Ch=null;function kh(){Kc();const e=Bc();return a.jsx("div",{role:"tree",style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var n;if(e.isEditing)return;if("Backspace"===t.key){if(!e.props.onDelete)return;const t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||(n=e.lastNode),e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{const t=e.focusedNode;if(t){const n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if("Tab"===t.key&&!t.shiftKey)return t.preventDefault(),void nl(t.currentTarget);if("Tab"===t.key&&t.shiftKey)return t.preventDefault(),void rl(t.currentTarget);if("ArrowDown"===t.key){t.preventDefault();const n=e.nextNode;if(t.metaKey)return e.select(e.focusedNode),void e.activate(e.focusedNode);if(!t.shiftKey||e.props.disableMultiSelection)return void e.focus(n);{if(!n)return;const t=e.focusedNode;return void(t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode))}}if("ArrowUp"===t.key){t.preventDefault();const n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection)return void e.focus(n);{if(!n)return;const t=e.focusedNode;return void(t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode))}}if("ArrowRight"===t.key){const t=e.focusedNode;if(!t)return;return void(t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id))}if("ArrowLeft"===t.key){const t=e.focusedNode;if(!t||t.isRoot)return;return void(t.isInternal&&t.isOpen?e.close(t.id):(null===(n=t.parent)||void 0===n?void 0:n.isRoot)||e.focus(t.parent))}if("a"===t.key&&t.metaKey&&!e.props.disableMultiSelection)return t.preventDefault(),void e.selectAll();if("a"===t.key&&!t.metaKey&&e.props.onCreate)return void e.createLeaf();if("A"===t.key&&!t.metaKey){if(!e.props.onCreate)return;return void e.createInternal()}if("Home"===t.key)return t.preventDefault(),void e.focus(e.firstNode);if("End"===t.key)return t.preventDefault(),void e.focus(e.lastNode);if("Enter"===t.key){const t=e.focusedNode;if(!t)return;if(!t.isEditable||!e.props.onRename)return;return void setTimeout((()=>{t&&e.edit(t)}))}if(" "===t.key){t.preventDefault();const n=e.focusedNode;if(!n)return;return void(n.isLeaf?(n.select(),n.activate()):n.toggle())}if("*"===t.key){const t=e.focusedNode;if(!t)return;return void e.openSiblings(t)}if("PageUp"===t.key)return t.preventDefault(),void e.pageUp();"PageDown"===t.key&&(t.preventDefault(),e.pageDown()),clearTimeout(Ch),Rh+=t.key,Ch=setTimeout((()=>{Rh=""}),600);const r=e.visibleNodes.find((e=>{const t=e.data.name;return"string"==typeof t&&t.toLowerCase().startsWith(Rh)}));r&&e.focus(r.id)},children:a.jsx(ou,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:t=>{var n;return(null===(n=e.visibleNodes[t])||void 0===n?void 0:n.id)||t},outerElementType:su,innerElementType:cu,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:jh})})}function Nh(e){return e.isFiltered?function(e,t){const n={},r=[];function o(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)o(t)}function i(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&(null===(t=e.children)||void 0===t||t.forEach(i))}return o(e),i(e),r.forEach(Ph),r}(e.root,e.isMatch.bind(e)):function(e){const t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&(null===(r=e.children)||void 0===r||r.forEach(n))}return n(e),t.forEach(Ph),t}(e.root)}function Ph(e,t){e.rowIndex=t}const Eh=e=>e.reduce(((e,t,n)=>(e[t.id]=n,e)),{});var Ih=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const{safeRun:_h,identify:Mh,identifyNull:qh}=pl;class Ah{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=Rl(this),this.visibleNodes=Nh(this),this.idToIndex=Eh(this.visibleNodes)}update(e){this.props=e,this.root=Rl(this),this.visibleNodes=Nh(this),this.idToIndex=Eh(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 null!==(e=this.props.width)&&void 0!==e?e:300}get height(){var e;return null!==(e=this.props.height)&&void 0!==e?e:500}get indent(){var e;return null!==(e=this.props.indent)&&void 0!==e?e:24}get rowHeight(){var e;return null!==(e=this.props.rowHeight)&&void 0!==e?e:24}get overscanCount(){var e;return null!==(e=this.props.overscanCount)&&void 0!==e?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const t=null!==(e=this.props.searchMatch)&&void 0!==e?e:(e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase());return e=>t(e,this.searchTerm)}accessChildren(e){var t;return null!==(t=al(e,this.props.childrenAccessor||"children"))&&void 0!==t?t:null}accessId(e){const t=al(e,this.props.idAccessor||"id");if(!t)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return t}get firstNode(){var e;return null!==(e=this.visibleNodes[0])&&void 0!==e?e:null}get lastNode(){var e;return null!==(e=this.visibleNodes[this.visibleNodes.length-1])&&void 0!==e?e:null}get focusedNode(){var e;return null!==(e=this.get(this.state.nodes.focus.id))&&void 0!==e?e:null}get mostRecentNode(){var e;return null!==(e=this.get(this.state.nodes.selection.mostRecent))&&void 0!==e?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return null===e?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return null===e?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,t){var n;if(null===e||null===t)return[];const r=null!==(n=this.indexOf(e))&&void 0!==n?n:0,o=this.indexOf(t);if(null===o)return[];const i=Math.min(r,o),s=Math.max(r,o);return this.visibleNodes.slice(i,s+1)}indexOf(e){const t=cl(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(e={}){var t,n;return Ih(this,void 0,void 0,(function*(){const r=void 0===e.parentId?hl(this):e.parentId,o=null!==(t=e.index)&&void 0!==t?t:fl(this),i=null!==(n=e.type)&&void 0!==n?n:"leaf",s=yield _h(this.props.onCreate,{type:i,parentId:r,index:o,parentNode:this.get(r)});s&&(this.focus(s),setTimeout((()=>{this.edit(s).then((()=>{this.select(s),this.activate(s)}))})))}))}delete(e){return Ih(this,void 0,void 0,(function*(){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(Mh),n=t.map((e=>this.get(e))).filter((e=>!!e));yield _h(this.props.onDelete,{nodes:n,ids:t})}))}edit(e){const t=Mh(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(t),this.dispatch(Dl(t)),new Promise((e=>{Ah.editPromise=e}))}submit(e,t){return Ih(this,void 0,void 0,(function*(){if(!e)return;const n=Mh(e);yield _h(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(Dl(null)),this.resolveEdit({cancelled:!1,value:t}),setTimeout((()=>this.onFocus()))}))}reset(){this.dispatch(Dl(null)),this.resolveEdit({cancelled:!0}),setTimeout((()=>this.onFocus()))}activate(e){const t=this.get(qh(e));t&&_h(this.props.onActivate,t)}resolveEdit(e){const t=Ah.editPromise;t&&t(e),Ah.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){const n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Sl(Mh(e))),!1!==t.scroll&&this.scrollTo(e),this.focusedNode&&_h(this.props.onFocus,this.focusedNode)))}pageUp(){var e,t;const n=this.visibleStartIndex,r=this.visibleStopIndex-n;let o=null!==(t=null===(e=this.focusedNode)||void 0===e?void 0:e.rowIndex)&&void 0!==t?t:0;o=o>n?n:Math.max(n-r,0),this.focus(this.at(o))}pageDown(){var e,t;const n=this.visibleStartIndex,r=this.visibleStopIndex,o=r-n;let i=null!==(t=null===(e=this.focusedNode)||void 0===e?void 0:e.rowIndex)&&void 0!==t?t:0;i=i<r?r:Math.min(i+o,this.visibleNodes.length-1),this.focus(this.at(i))}select(e,t={}){if(!e)return;const n=!1!==t.focus,r=Mh(e);n&&this.dispatch(Sl(r)),this.dispatch(Pl(r)),this.dispatch(ql(r)),this.dispatch(Ml(r)),this.scrollTo(r,t.align),this.focusedNode&&n&&_h(this.props.onFocus,this.focusedNode),_h(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const t=Mh(e);this.dispatch(Il(t))}selectMulti(e){const t=this.get(qh(e));t&&(this.dispatch(Sl(t.id)),this.dispatch(El(t.id)),this.dispatch(ql(t.id)),this.dispatch(Ml(t.id)),this.scrollTo(t),this.focusedNode&&_h(this.props.onFocus,this.focusedNode),_h(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const t=Mh(e),{anchor:n,mostRecent:r}=this.state.nodes.selection;this.dispatch(Sl(t)),this.dispatch(Il(this.nodesBetween(n,r))),this.dispatch(El(this.nodesBetween(n,qh(t)))),this.dispatch(Ml(t)),this.scrollTo(t),this.focusedNode&&_h(this.props.onFocus,this.focusedNode),_h(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),_h(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Sl(null===(e=this.lastNode)||void 0===e?void 0:e.id)),this.focusedNode&&_h(this.props.onFocus,this.focusedNode),_h(this.props.onSelect,this.selectedNodes)}setSelection(e){var t;const n=new Set(null===(t=e.ids)||void 0===t?void 0:t.map(Mh)),r=qh(e.anchor),o=qh(e.mostRecent);this.dispatch(_l({ids:n,anchor:r,mostRecent:o})),_h(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return"highlight"===e.type?e.id:null}get cursorOverFolder(){return"highlight"===this.state.dnd.cursor.type}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 t=null!==(e=this.get(this.state.dnd.parentId))&&void 0!==e?e:this.root,n=this.dragNodes,r=this.props.disableDrop;for(const o of n){if(!o)return!1;if(!t)return!1;if(o.isInternal&&Zc(t,o))return!1}return"function"==typeof r?!r({parentNode:t,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):"string"==typeof r?!t.data[r]:"boolean"!=typeof r||!r}hideCursor(){this.dispatch(Al.cursor({type:"none"}))}showCursor(e){this.dispatch(Al.cursor(e))}open(e){const t=qh(e);t&&(this.isOpen(t)||(this.dispatch(Cl.open(t,this.isFiltered)),_h(this.props.onToggle,t)))}close(e){const t=qh(e);t&&this.isOpen(t)&&(this.dispatch(Cl.close(t,this.isFiltered)),_h(this.props.onToggle,t))}toggle(e){const t=qh(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){const t=qh(e);if(!t)return;const n=el(this.root,t);let r=null==n?void 0:n.parent;for(;r;)this.open(r.id),r=r.parent}openSiblings(e){const t=e.parent;if(t){if(t.children){const n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){tl(this.root,(e=>{e.isInternal&&e.open()}))}closeAll(){tl(this.root,(e=>{e.isInternal&&e.close()}))}scrollTo(e,t="smart"){if(!e)return;const n=Mh(e);return this.openParents(n),dl((()=>n in this.idToIndex)).then((()=>{var e;const r=this.idToIndex[n];void 0!==r&&(null===(e=this.list.current)||void 0===e||e.scrollToItem(r,t))})).catch((()=>{}))}get isEditing(){return null!==this.state.nodes.edit.id}get isFiltered(){var e;return!!(null===(e=this.props.searchTerm)||void 0===e?void 0:e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return 0===this.state.nodes.selection.ids.size}get hasOneSelection(){return 1===this.state.nodes.selection.ids.size}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var t,n,r;if(!e)return!1;if(e===jl)return!0;const o=null===(t=this.props.openByDefault)||void 0===t||t;return this.isFiltered?null===(n=this.state.nodes.open.filtered[e])||void 0===n||n:null!==(r=this.state.nodes.open.unfiltered[e])&&void 0!==r?r:o}isEditable(e){var t;return null===(t=!al(e,this.props.disableEdit||(()=>!1)))||void 0===t||t}isDraggable(e){var t;return null===(t=!al(e,this.props.disableDrag||(()=>!1)))||void 0===t||t}isDragging(e){const t=qh(e);return!!t&&this.state.nodes.drag.id===t}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const t=qh(e);if(!t)return!1;const{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&null===r}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Sl(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||kh}get renderRow(){return this.props.renderRow||bl}get renderNode(){return this.props.children||xl}get renderDragPreview(){return this.props.renderDragPreview||Wl}get renderCursor(){return this.props.renderCursor||vl}}function Lh(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Fh=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Hh=()=>Math.random().toString(36).substring(7).split("").join("."),Wh={INIT:`@@redux/INIT${Hh()}`,REPLACE:`@@redux/REPLACE${Hh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Hh()}`};function Uh(e,t,n){if("function"!=typeof e)throw new Error(Lh(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Lh(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Lh(1));return n(Uh)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)throw new Error(Lh(3));return o}function d(e){if("function"!=typeof e)throw new Error(Lh(4));if(c)throw new Error(Lh(5));let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error(Lh(6));t=!1,l(),s.delete(n),i=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}(e))throw new Error(Lh(7));if(void 0===e.type)throw new Error(Lh(8));if("string"!=typeof e.type)throw new Error(Lh(17));if(c)throw new Error(Lh(9));try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}f({type:Wh.INIT});return{dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Lh(10));r=e,f({type:Wh.REPLACE})},[Fh]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(Lh(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[Fh](){return this}}}}}function Bh(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const r=t[s];"function"==typeof e[r]&&(n[r]=e[r])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Wh.INIT}))throw new Error(Lh(12));if(void 0===n(void 0,{type:Wh.PROBE_UNKNOWN_ACTION()}))throw new Error(Lh(13))}))}(n)}catch(i){o=i}return function(e={},t){if(o)throw o;let i=!1;const s={};for(let o=0;o<r.length;o++){const a=r[o],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(Lh(14));s[a]=u,i=i||u!==l}return i=i||r.length!==Object.keys(e).length,i?s:e}}const zh=Bh({nodes:Bh({focus:function(e={id:null,treeFocused:!1},t){return"FOCUS"===t.type?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):"TREE_BLUR"===t.type?Object.assign(Object.assign({},e),{treeFocused:!1}):e},edit:function(e={id:null},t){return"EDIT"===t.type?Object.assign(Object.assign({},e),{id:t.id}):e},open:function(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:kl(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:kl(e.unfiltered,t)}):e},selection:function(e=Nl().nodes.selection,t){const n=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return 0===t.ids.length?e:(t.ids.forEach((e=>n.add(e))),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_REMOVE":return 0===t.ids.length?e:(t.ids.forEach((e=>n.delete(e))),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}},drag:function(e=Nl().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}}),dnd:function(e=Nl().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return Nl().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}}),$h=Nl();function Vh({treeProps:e,imperativeHandle:t,children:n}){const r=p.useRef(null),o=p.useRef(null),i=p.useRef(Uh(zh,Nl(e))),s=et.useSyncExternalStore(i.current.subscribe,i.current.getState,(()=>$h)),c=p.useMemo((()=>new Ah(i.current,e,r,o)),[]),l=p.useRef(0);return p.useMemo((()=>{l.current+=1,c.update(e)}),[...Object.values(e),s.nodes.open]),p.useImperativeHandle(t,(()=>c)),p.useEffect((()=>{c.props.selection?c.select(c.props.selection,{focus:!1}):c.deselectAll()}),[c.props.selection]),p.useEffect((()=>{c.props.searchTerm||i.current.dispatch(Cl.clear(!0))}),[c.props.searchTerm]),a.jsx(Uc.Provider,{value:c,children:a.jsx(Vc.Provider,{value:l.current,children:a.jsx(zc.Provider,{value:s.nodes,children:a.jsx($c.Provider,{value:s.dnd,children:a.jsx(Fd,Object.assign({backend:xh,options:{rootElement:c.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:n}))})})})})}function Kh(e){return function(){const e=Bc(),[,t]=Af((()=>({accept:"NODE",canDrop:(t,n)=>!!n.isOver({shallow:!0})&&e.canDrop(),hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;const r=n.getClientOffset();if(!e.listEl.current||!r)return;const{cursor:o,drop:i}=Oh({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});i&&e.dispatch(Al.hovering(i.parentId,i.index)),n.canDrop()?o&&e.showCursor(o):e.hideCursor()}})),[e]);t(e.listEl)}(),e.children}function Gh(){const e=Bc().props.renderContainer||kh;return a.jsx(a.Fragment,{children:a.jsx(e,{})})}function Jh(){const e=Bc(),{offset:t,mouse:n,item:r,isDragging:o}=(i=e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}),s=pf().getMonitor(),c=Lf(Df(s,i),2),l=c[0],u=c[1],p.useEffect((function(){return s.subscribeToOffsetChange(u)})),p.useEffect((function(){return s.subscribeToStateChange(u)})),l);var i,s,c,l,u;const d=e.props.renderDragPreview||Wl;return a.jsx(d,{offset:t,mouse:n,id:(null==r?void 0:r.id)||null,dragIds:(null==r?void 0:r.dragIds)||[],isDragging:o})}class Yh{constructor(e){this.root=function(e){const t=new Zh({id:"ROOT"},null);return t.children=e.map((e=>Xh(e,t))),t}(e)}get data(){var e,t;return null!==(t=null===(e=this.root.children)||void 0===e?void 0:e.map((e=>e.data)))&&void 0!==t?t:[]}create(e){const t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){const t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;t&&n&&(n.addChild(t.data,e.index),t.drop())}update(e){const t=this.find(e.id);t&&t.update(e.changes)}drop(e){const t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){const t=this.find(e,n);if(t)return t}return null}return null}}function Xh(e,t){const n=new Zh(e,t);return e.children&&(n.children=e.children.map((e=>Xh(e,n)))),n}class Zh{constructor(e,t){this.data=e,this.parent=t,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){var n,r;const o=Xh(e,this);this.children=null!==(n=this.children)&&void 0!==n?n:[],this.children.splice(t,0,o),this.data.children=null!==(r=this.data.children)&&void 0!==r?r:[],this.data.children.splice(t,0,e)}removeChild(e){var t,n;null===(t=this.children)||void 0===t||t.splice(e,1),null===(n=this.data.children)||void 0===n||n.splice(e,1)}update(e){if(this.hasParent()){const t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let Qh=0;function ep(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error("React Arborist Tree => You passed the initialData prop along with a data handler.\nUse the data prop if you want to provide your own handlers.");if(e.initialData){const[t,n]=function(e){const[t,n]=p.useState(e),r=p.useMemo((()=>new Yh(t)),[t]);return[t,{onMove:e=>{for(const t of e.dragIds)r.move({id:t,parentId:e.parentId,index:e.index});n(r.data)},onRename:({name:e,id:t})=>{r.update({id:t,changes:{name:e}}),n(r.data)},onCreate:({parentId:e,index:t,type:o})=>{const i={id:"simple-tree-id-"+Qh++,name:""};return"internal"===o&&(i.children=[]),r.create({parentId:e,index:t,data:i}),n(r.data),i},onDelete:e=>{e.ids.forEach((e=>r.drop({id:e}))),n(r.data)}}]}(e.initialData);return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}return e}const tp=p.forwardRef((function(e,t){const n=ep(e);return a.jsxs(Vh,{treeProps:n,imperativeHandle:t,children:[a.jsx(Kh,{children:a.jsx(Gh,{})}),a.jsx(Jh,{})]})}));export{ct as A,Tt as B,ut as C,pt as G,xc as K,Za as L,Wc as M,yt as P,Dt as S,tp as T,Lc as a,Hc as b,gc as c,mc as d,rc as e,nc as f,hc as g,Xa as h,It as i,dc as j,bc as k,yc as l,vc as m,Sc as n,Pt as o,Et as p,dt as q,Yh as r,Ac as s,jt as u};