@marimo-team/frontend 0.14.18-dev13 → 0.14.18-dev14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-C4nFa3tg.js → ConnectedDataExplorerComponent-D95A9uiw.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-B3Y4Q7Vt.js → ImageComparisonComponent-DZj9yg8O.js} +1 -1
- package/dist/assets/{VegaLite-CKHk6EK9.js → VegaLite-DslKI3P8.js} +1 -1
- package/dist/assets/{_baseEach-CpCWcW5e.js → _baseEach-C7H_5mkd.js} +1 -1
- package/dist/assets/_baseMap-Qu73w612.js +1 -0
- package/dist/assets/{_baseUniq-CjjMZTnk.js → _baseUniq-CJ0jg5fC.js} +1 -1
- package/dist/assets/{_createAggregator-qOR0JkB9.js → _createAggregator-LrS5FEya.js} +1 -1
- package/dist/assets/{any-language-editor-Sg_y5nsy.js → any-language-editor-DKF4Jmsk.js} +1 -1
- package/dist/assets/{architectureDiagram-SUXI7LT5-DO10DgrR.js → architectureDiagram-SUXI7LT5-R5iMGXph.js} +1 -1
- package/dist/assets/{blockDiagram-6J76NXCF-BKjDnk4w.js → blockDiagram-6J76NXCF-DCR2_8fi.js} +1 -1
- package/dist/assets/{c4Diagram-6F6E4RAY-H2RbPMuS.js → c4Diagram-6F6E4RAY-LScEn0Sx.js} +1 -1
- package/dist/assets/channel-BzDjtdst.js +1 -0
- package/dist/assets/{chunk-353BL4L5-D3DRoM9V.js → chunk-353BL4L5-Hj6gHAXA.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-Euioumbw.js → chunk-67H74DCK-CymIC2E8.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-CqmFASXO.js → chunk-AACKK3MU-BtBZMCrL.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-C36dsemd.js → chunk-BFAMUDN2-2TJziCQB.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-CuAcD-qX.js → chunk-E2GYISFI-DT2O_G67.js} +1 -1
- package/dist/assets/{chunk-OW32GOEJ-CGljs7lQ.js → chunk-OW32GOEJ-hKOkRIq2.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-HN5SCTGt.js → chunk-SKB7J2MH-DQjvh9UZ.js} +1 -1
- package/dist/assets/{chunk-SZ463SBG-C1tKwrEv.js → chunk-SZ463SBG-DW8Pb-TX.js} +1 -1
- package/dist/assets/{circle-play-BEgJAiHk.js → circle-play-Cl82gkhS.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-CHXMjpq1.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-CHXMjpq1.js +1 -0
- package/dist/assets/clone-BhZLn_Yt.js +1 -0
- package/dist/assets/{compile-CqiLj9Y0.js → compile-CC8hqnTY.js} +1 -1
- package/dist/assets/{dagre-JOIXM2OF-Csxy8eUf.js → dagre-JOIXM2OF-COWWKdXa.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-DmpCFZBN.js → data-grid-overlay-editor-C2Y6aqU8.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-CeNLoyOp.js → diagram-5UYTHUR4-CxvyXtWA.js} +1 -1
- package/dist/assets/{diagram-VMROVX33-PA1nQ1xm.js → diagram-VMROVX33-KS0_ogMc.js} +1 -1
- package/dist/assets/{diagram-ZTM2IBQH-CGX5wfoy.js → diagram-ZTM2IBQH-DYoCSThG.js} +1 -1
- package/dist/assets/{edit-page-CZUOJlu7.js → edit-page-BlbVNVDn.js} +49 -49
- package/dist/assets/{erDiagram-3M52JZNH-pNpk-kbU.js → erDiagram-3M52JZNH-CE3yLnN-.js} +1 -1
- package/dist/assets/{flowDiagram-KYDEHFYC-DJxJWKxL.js → flowDiagram-KYDEHFYC-By4vXcuY.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-BhcHb5d8.js → ganttDiagram-EK5VF46D-uo0Cydh5.js} +1 -1
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-B9qPpq_y.js → gitGraphDiagram-GW3U2K7C-CpqaxZIO.js} +1 -1
- package/dist/assets/{glide-data-editor-CTVCtvK_.js → glide-data-editor-B9rd_uM3.js} +4 -4
- package/dist/assets/{graph-B9VxIZ9c.js → graph--fHhlg7t.js} +1 -1
- package/dist/assets/{home-page-DZIMmCkL.js → home-page-lAI7jlTR.js} +1 -1
- package/dist/assets/{index-CYeuBm8x.js → index-B-lYQMqn.js} +1 -1
- package/dist/assets/{index-DpeKdu-Z.js → index-B9v4qFNJ.js} +1 -1
- package/dist/assets/{index-3yGXsFgh.js → index-BPs4kBZX.js} +1 -1
- package/dist/assets/{index-BLVh4qZd.js → index-BWVO7d1Q.js} +1 -1
- package/dist/assets/{index-gXOqccpp.js → index-BXdINcmG.js} +1 -1
- package/dist/assets/{index-CQNbHK7o.js → index-BiRN4vu3.js} +1 -1
- package/dist/assets/{index-znx6nCP6.js → index-BmYgWLms.js} +1 -1
- package/dist/assets/{index-D7vxWcsp.js → index-Bt7rmkIA.js} +1 -1
- package/dist/assets/{index-BXDJR3T4.js → index-CHfcSR3G.js} +1 -1
- package/dist/assets/{index-B9b7vkZy.js → index-CNfvweBx.js} +1 -1
- package/dist/assets/{index-CErQehcm.js → index-CPlN-zCs.js} +96 -96
- package/dist/assets/{index-BTBrpo4d.js → index-CXeugt0c.js} +1 -1
- package/dist/assets/{index-D0jmZqpB.js → index-CZMcdPXD.js} +1 -1
- package/dist/assets/{index-BqoRGJPY.js → index-ChkLHzfK.js} +1 -1
- package/dist/assets/{index-ztu-v2P9.js → index-Ck70qzGC.js} +1 -1
- package/dist/assets/{index-DJdXs0l4.js → index-ClE8-m11.js} +1 -1
- package/dist/assets/{index-DfloOC7j.js → index-DxmCL2XI.js} +1 -1
- package/dist/assets/{index-A5Sz0a7y.js → index-rGvvC1Xp.js} +1 -1
- package/dist/assets/{index-BoJ3D5u3.js → index-tfWBlRcm.js} +1 -1
- package/dist/assets/{infoDiagram-LHK5PUON-1eJXZO69.js → infoDiagram-LHK5PUON-BzblqKyG.js} +1 -1
- package/dist/assets/{journeyDiagram-EWQZEKCU-BBepBA4_.js → journeyDiagram-EWQZEKCU-Cex--9F4.js} +1 -1
- package/dist/assets/{kanban-definition-ZSS6B67P-DQXzW3Xb.js → kanban-definition-ZSS6B67P-2_HGy5yi.js} +1 -1
- package/dist/assets/{layout-9cwCdjWH.js → layout-CS1ey6uL.js} +1 -1
- package/dist/assets/{linear-Bu5yfHuR.js → linear-BslqlKo9.js} +1 -1
- package/dist/assets/{links-Dh6K56fO.js → links-BD7-k0qF.js} +13 -13
- package/dist/assets/{mermaid-fWoiyqkX.js → mermaid-eZvsYmPV.js} +4 -4
- package/dist/assets/{min-1PMA9dnD.js → min-Bu4ESu3s.js} +1 -1
- package/dist/assets/{mindmap-definition-6CBA2TL7-0P4YNaKJ.js → mindmap-definition-6CBA2TL7-C7urdebq.js} +1 -1
- package/dist/assets/{number-overlay-editor-D5DZyRNv.js → number-overlay-editor-DohmqdGC.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-ldZJBjXy.js → pieDiagram-NIOCPIFQ-GGwrl6ZS.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-D3dwPzL8.js → quadrantDiagram-2OG54O6I-BHy-W9Ys.js} +1 -1
- package/dist/assets/{react-plotly-CkZ02re1.js → react-plotly-8Vb5039F.js} +1 -1
- package/dist/assets/{requirementDiagram-QOLK2EJ7-B6dAw8En.js → requirementDiagram-QOLK2EJ7-q5jqK3Nx.js} +1 -1
- package/dist/assets/{run-page-DzZGYVz3.js → run-page-CL7YXNGv.js} +1 -1
- package/dist/assets/{sankeyDiagram-4UZDY2LN-BLCldlS6.js → sankeyDiagram-4UZDY2LN-BBw-9nok.js} +1 -1
- package/dist/assets/{sequenceDiagram-SKLFT4DO-CddMnUFm.js → sequenceDiagram-SKLFT4DO-BPUkB5Uz.js} +1 -1
- package/dist/assets/{slides-component-BNWyDmh3.js → slides-component-B_C5ebqb.js} +1 -1
- package/dist/assets/{sortBy-DgJdOd5z.js → sortBy-DbTdEHIS.js} +1 -1
- package/dist/assets/{stateDiagram-MI5ZYTHO-B7IZpvPI.js → stateDiagram-MI5ZYTHO-CAImvtJM.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-CZn_hCEq.js +1 -0
- package/dist/assets/{storage-cEacdJkQ.js → storage-CY1YTebA.js} +3 -3
- package/dist/assets/{terminal-uDsq5k0v.js → terminal-C8Bne6J-.js} +1 -1
- package/dist/assets/{time-C1S-1cAL.js → time-AT3x74ZG.js} +1 -1
- package/dist/assets/{timeline-definition-MYPXXCX6-Cxplc_KG.js → timeline-definition-MYPXXCX6-BMj-_RFo.js} +1 -1
- package/dist/assets/{tracing-T3sWbY_r.js → tracing-Ct-yyQCK.js} +2 -2
- package/dist/assets/{trash-Cywld6UR.js → trash-BWgapvJS.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-BnGbxlzA.js → treemap-75Q7IDZK-Bqaxfph8.js} +1 -1
- package/dist/assets/{vega-component-CdsruZxj.js → vega-component-CpEVEBeG.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-B3YttDms.js → xychartDiagram-H2YORKM3-YvOKG_to.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/_baseMap-BxqvwI1_.js +0 -1
- package/dist/assets/channel-CG1U1yOg.js +0 -1
- package/dist/assets/classDiagram-M3E45YP4-W_fOuGn_.js +0 -1
- package/dist/assets/classDiagram-v2-YAWTLIQI-W_fOuGn_.js +0 -1
- package/dist/assets/clone-D9SuHa4t.js +0 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-C--jJPiO.js +0 -1
@@ -1,17 +1,17 @@
|
|
1
|
-
import{cd as
|
1
|
+
import{cd as js,aO as ws,c as te,U as I,b as Ke,j as s,fr as Is,fs as Ss,a as U,cA as Os,ar as $e,ft as ks,T as Le,fu as Mn,f8 as Cs,fv as Rn,fw as _,fx as Ln,fy as P,fz as D,fA as A,fB as ce,fC as M,bn as ke,fD as zn,fE as F,fF as G,ac as ze,fG as ie,bo as Q,fH as dt,e2 as Fn,fI as Hn,fJ as Ns,fK as Fe,fL as xe,fM as Un,fN as Ds,fO as qn,fP as ut,fQ as Vn,fR as Ts,fS as ht,L as W,fT as ne,fU as Es,dP as ft,fV as Bn,eI as _s,ds as Ft,fh as Ps,fW as Ht,fX as As,fY as Ms,fZ as Wn,f_ as Gn,f$ as Rs,al as Ye,bd as Xe,eQ as Kn,V as pt,g0 as Ls,g1 as zs,g2 as $n,g3 as Yn,g4 as Fs,a6 as ue,et as gt,g5 as Xn,a4 as Ut,g6 as Hs,g7 as Us,a7 as Qn,a8 as qs,a9 as Vs,g8 as Bs,g9 as Ws,ga as Gs,b4 as Ks,gb as $s,gc as Ys,gd as Xs,ge as Qs,gf as Zs,gg as Js,cl as eo,bp as mt,eq as to,dL as Zn,ad as no,ab as ro,gh as io,bl as vt,cg as Jn,gi as so,gj as er,at as Qe,gk as tr,gl as qt,gm as nr,gn as rr,ag as Ne,go as oo,gp as ir,gq as ao,gr as lo,gs as co,gt as uo,aJ as ho,gu as sr,gv as Vt,aw as fo,_ as or,E as po,gw as go,gx as yt,gy as mo,gz as vo,ao as Bt,ff as yo,gA as xo,gB as bo,gC as jo,gD as wo,eo as Ze,dC as xt,gE as Io,gF as ar,a5 as So,gG as Oo,gH as ko,gI as Co,b9 as No,bi as Do,b7 as To}from"./index-CPlN-zCs.js";import{e as Eo}from"./index-rGvvC1Xp.js";/**
|
2
2
|
* @license lucide-react v0.525.0 - ISC
|
3
3
|
*
|
4
4
|
* This source code is licensed under the ISC license.
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
6
|
-
*/const Eo=te("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"}]]),_o=te("book-marked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),Po=te("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),or=te("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Ao=te("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"}]]),ar=te("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),lr=te("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Mo=te("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]),cr=te("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),Ro=te("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),Lo=te("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),zo=te("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),Fo=te("messages-square",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]),Ho=te("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"}]]),Uo=te("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),Bo=te("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Vo=te("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);function Wt(t,e){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Wt(t,e)}function dr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}const ur=I.createContext(null);function de(){const t=I.useContext(ur);if(t===null)throw new Error("No Tree Api Provided");return t}const hr=I.createContext(null),fr=I.createContext(null),pr=I.createContext(0);function gr(){I.useContext(pr)}function jt(t,e,n){return Math.max(Math.min(t,n),e)}function mr(t){return t&&t.isLeaf}function vr(t){return t&&t.isInternal&&!t.isOpen}function yr(t){var e;return t&&t.isOpen&&!(!((e=t.children)===null||e===void 0)&&e.length)}const xr=(t,e)=>{let n=t;for(;n;){if(n.id===e.id)return!0;n=n.parent}return!1},br=t=>{if(!t.parent)throw Error("Node does not have a parent");return t.parent.children.findIndex(e=>e.id===t.id)};function Gt(t,e){if(!t)return null;if(t.id===e)return t;if(t.children)for(let n of t.children){const r=Gt(n,e);if(r)return r}return null}function wt(t,e){if(e(t),t.children)for(let n of t.children)wt(n,e)}function jr(t){const e=Ir(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=qo(e,r);break}n==null||n.focus()}function wr(t){const e=Ir(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Wo(e,r);break}n==null||n.focus()}function qo(t,e){return e+1<t.length?t[e+1]:t[0]}function Wo(t,e){return e-1>=0?t[e-1]:t[t.length-1]}function Ir(t){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(e=>e===t||!t.contains(e))}function Je(t,e){return typeof e=="boolean"?e:typeof e=="string"?t[e]:e(t)}function Sr(t){return t===null?null:De(t)}function De(t){return typeof t=="string"?t:t.id}function kr(t,...e){if(t)return t(...e)}function Or(t){return new Promise((e,n)=>{let r=0;(function i(){r+=1,r===100&&n(),t()?e():setTimeout(i,10)})()})}function Cr(t){var e,n;const r=t.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:(n=(e=t.root.children)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}function Nr(t){const e=t.focusedNode;return e?e.isOpen?e.id:e.parent&&!e.parent.isRoot?e.parent.id:null:null}const Go=Object.freeze(Object.defineProperty({__proto__:null,access:Je,bound:jt,dfs:Gt,focusNextElement:jr,focusPrevElement:wr,getInsertIndex:Cr,getInsertParentId:Nr,identify:De,identifyNull:Sr,indexOf:br,isClosed:vr,isDescendant:xr,isItem:mr,isOpenWithEmptyChildren:yr,mergeRefs:function(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}},noop:function(){},safeRun:kr,waitFor:Or,walk:wt},Symbol.toStringTag,{value:"Module"})),Ko={display:"flex",alignItems:"center",zIndex:1},$o={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Yo={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Xo=Ke.memo(function({top:t,left:e,indent:n}){const r={position:"absolute",pointerEvents:"none",top:t-2+"px",left:e+"px",right:n+"px"};return s.jsxs("div",{style:Object.assign(Object.assign({},Ko),r),children:[s.jsx("div",{style:Object.assign({},Yo)}),s.jsx("div",{style:Object.assign({},$o)})]})});function Qo({node:t,attrs:e,innerRef:n,children:r}){return s.jsx("div",Object.assign({},e,{ref:n,onFocus:i=>i.stopPropagation(),onClick:t.handleClick,children:r}))}function Zo(t){return s.jsxs("div",{ref:t.dragHandle,style:t.style,children:[s.jsx("span",{onClick:e=>{e.stopPropagation(),t.node.toggle()},children:t.node.isLeaf?"\u{1F333}":t.node.isOpen?"\u{1F5C1}":"\u{1F5C0}"})," ",t.node.isEditing?s.jsx(ea,Object.assign({},t)):s.jsx(Jo,Object.assign({},t))]})}function Jo(t){return s.jsx(s.Fragment,{children:s.jsx("span",{children:t.node.data.name})})}function ea({node:t}){const e=I.useRef();return I.useEffect(()=>{var n,r;(n=e.current)===null||n===void 0||n.focus(),(r=e.current)===null||r===void 0||r.select()},[]),s.jsx("input",{ref:e,defaultValue:t.data.name,onBlur:()=>t.reset(),onKeyDown:n=>{var r;n.key==="Escape"&&t.reset(),n.key==="Enter"&&t.submit(((r=e.current)===null||r===void 0?void 0:r.value)||"")}})}function Kt(t){return{type:"EDIT",id:t}}function Ue(t){return{type:"FOCUS",id:t}}class Lt{constructor(e){this.handleClick=n=>{n.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():n.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===et}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var e;return this.isSelected&&!(!((e=this.prev)===null||e===void 0)&&e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(!((e=this.next)===null||e===void 0)&&e.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,n;const r=this.childIndex;return(n=(e=this.parent)===null||e===void 0?void 0:e.children[r+1])!==null&&n!==void 0?n:null}isAncestorOf(e){if(!e)return!1;let n=e;for(;n;){if(n.id===this.id)return!0;n=n.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new Lt(Object.assign({},this))}edit(){return this.tree.edit(this)}}const et="__REACT_ARBORIST_INTERNAL_ROOT__";function Dr(t){var e;function n(o,a,l){const c=t.accessId(o),d=new Lt({tree:t,data:o,level:a,parent:l,id:c,children:null,isDraggable:t.isDraggable(o),rowIndex:null}),u=t.accessChildren(o);return u&&(d.children=u.map(g=>n(g,a+1,d))),d}const r=new Lt({tree:t,id:et,data:{id:et},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),i=(e=t.props.data)!==null&&e!==void 0?e:[];return r.children=i.map(o=>n(o,0,r)),r}const $t={open:(t,e)=>({type:"VISIBILITY_OPEN",id:t,filtered:e}),close:(t,e)=>({type:"VISIBILITY_CLOSE",id:t,filtered:e}),toggle:(t,e)=>({type:"VISIBILITY_TOGGLE",id:t,filtered:e}),clear:t=>({type:"VISIBILITY_CLEAR",filtered:t})};function Tr(t={},e){if(e.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},t),{[e.id]:!0});if(e.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},t),{[e.id]:!1});if(e.type==="VISIBILITY_TOGGLE"){const n=t[e.id];return Object.assign(Object.assign({},t),{[e.id]:!n})}return e.type==="VISIBILITY_CLEAR"?{}:t}const Be=t=>{var e;return{nodes:{open:{filtered:{},unfiltered:(e=t==null?void 0:t.initialOpenState)!==null&&e!==void 0?e:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},ta=t=>({type:"SELECTION_ONLY",id:De(t)}),Er=t=>({type:"SELECTION_ADD",ids:(Array.isArray(t)?t:[t]).map(De)}),_r=t=>({type:"SELECTION_REMOVE",ids:(Array.isArray(t)?t:[t]).map(De)}),na=t=>Object.assign({type:"SELECTION_SET"},t),Yt=t=>({type:"SELECTION_MOST_RECENT",id:t===null?null:De(t)}),Pr=t=>({type:"SELECTION_ANCHOR",id:t===null?null:De(t)}),Ve={cursor:t=>({type:"DND_CURSOR",cursor:t}),dragStart:(t,e)=>({type:"DND_DRAG_START",id:t,dragIds:e}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(t,e)=>({type:"DND_HOVERING",parentId:t,index:e})},ra={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},ia=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e}px, ${n}px)`}},sa=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e+10}px, ${n+10}px)`}};function Ar({offset:t,mouse:e,id:n,dragIds:r,isDragging:i}){return s.jsxs(oa,{isDragging:i,children:[s.jsx(aa,{offset:t,children:s.jsx(ca,{id:n,dragIds:r})}),s.jsx(la,{mouse:e,count:r.length})]})}const oa=I.memo(function(t){return t.isDragging?s.jsx("div",{style:ra,children:t.children}):null});function aa(t){return s.jsx("div",{className:"row preview",style:ia(t.offset),children:t.children})}function la(t){const{count:e,mouse:n}=t;return e>1?s.jsx("div",{className:"selected-count",style:sa(n),children:e}):null}const ca=I.memo(function(t){const e=de(),n=e.get(t.id);return n?s.jsx(e.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*e.indent,opacity:.2,background:"transparent"},tree:e}):null});var Mr=Number.isNaN||function(t){return typeof t=="number"&&t!=t};function da(t,e){return t===e||!(!Mr(t)||!Mr(e))}function ua(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!da(t[n],e[n]))return!1;return!0}function Xt(t,e){var n;e===void 0&&(e=ua);var r,i=[],o=!1;return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&n===this&&e(a,i)||(r=t.apply(this,a),o=!0,n=this,i=a),r}}var Rr=typeof performance=="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Lr(t){cancelAnimationFrame(t.id)}var Qt=-1;function zr(t){if(t===void 0&&(t=!1),Qt===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),Qt=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return Qt}var tt=null;function Fr(t){if(t===void 0&&(t=!1),tt===null||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),i=r.style;return i.width="100px",i.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?tt="positive-descending":(e.scrollLeft=1,tt=e.scrollLeft===0?"negative":"positive-ascending"),document.body.removeChild(e),tt}return tt}var ha=function(t,e){return t};function fa(t){var e,n=t.getItemOffset,r=t.getEstimatedTotalSize,i=t.getItemSize,o=t.getOffsetForIndexAndAlignment,a=t.getStartIndexForOffset,l=t.getStopIndexForStartIndex,c=t.initInstanceProps,d=t.shouldResetStyleCacheOnItemSizeChange,u=t.validateProps;return e=function(g){function f(h){var p;return(p=g.call(this,h)||this)._instanceProps=c(p.props,dr(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:dr(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Xt(function(v,x,b,j){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:x,visibleStartIndex:b,visibleStopIndex:j})}),p._callOnScroll=void 0,p._callOnScroll=Xt(function(v,x,b){return p.props.onScroll({scrollDirection:v,scrollOffset:x,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var x,b=p.props,j=b.direction,S=b.itemSize,w=b.layout,C=p._getItemStyleCache(d&&S,d&&w,d&&j);if(C.hasOwnProperty(v))x=C[v];else{var N=n(p.props,v,p._instanceProps),T=i(p.props,v,p._instanceProps),L=j==="horizontal"||w==="horizontal",z=j==="rtl",V=L?N:0;C[v]=x={position:"absolute",left:z?void 0:V,right:z?V:void 0,top:L?0:N,height:L?"100%":T,width:L?T:"100%"}}return x},p._getItemStyleCache=void 0,p._getItemStyleCache=Xt(function(v,x,b){return{}}),p._onScrollHorizontal=function(v){var x=v.currentTarget,b=x.clientWidth,j=x.scrollLeft,S=x.scrollWidth;p.setState(function(w){if(w.scrollOffset===j)return null;var C=p.props.direction,N=j;if(C==="rtl")switch(Fr()){case"negative":N=-j;break;case"positive-descending":N=S-b-j}return N=Math.max(0,Math.min(N,S-b)),{isScrolling:!0,scrollDirection:w.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var x=v.currentTarget,b=x.clientHeight,j=x.scrollHeight,S=x.scrollTop;p.setState(function(w){if(w.scrollOffset===S)return null;var C=Math.max(0,Math.min(S,j-b));return{isScrolling:!0,scrollDirection:w.scrollOffset<C?"forward":"backward",scrollOffset:C,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var x=p.props.outerRef;p._outerRef=v,typeof x=="function"?x(v):x!=null&&typeof x=="object"&&x.hasOwnProperty("current")&&(x.current=v)},p._resetIsScrollingDebounced=function(){var v,x,b,j;p._resetIsScrollingTimeoutId!==null&&Lr(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=(v=p._resetIsScrolling,x=150,b=Rr(),j={id:requestAnimationFrame(function S(){Rr()-b>=x?v.call(null):j.id=requestAnimationFrame(S)})})},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}(function(h,p){h.prototype=Object.create(p.prototype),h.prototype.constructor=h,Wt(h,p)})(f,g),f.getDerivedStateFromProps=function(h,p){return pa(h,p),u(h),null};var m=f.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(p){return p.scrollOffset===h?null:{scrollDirection:p.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,p){p===void 0&&(p="auto");var v=this.props,x=v.itemCount,b=v.layout,j=this.state.scrollOffset;h=Math.max(0,Math.min(h,x-1));var S=0;if(this._outerRef){var w=this._outerRef;S=b==="vertical"?w.scrollWidth>w.clientWidth?zr():0:w.scrollHeight>w.clientHeight?zr():0}this.scrollTo(o(this.props,h,p,j,this._instanceProps,S))},m.componentDidMount=function(){var h=this.props,p=h.direction,v=h.initialScrollOffset,x=h.layout;if(typeof v=="number"&&this._outerRef!=null){var b=this._outerRef;p==="horizontal"||x==="horizontal"?b.scrollLeft=v:b.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,p=h.direction,v=h.layout,x=this.state,b=x.scrollOffset;if(x.scrollUpdateWasRequested&&this._outerRef!=null){var j=this._outerRef;if(p==="horizontal"||v==="horizontal")if(p==="rtl")switch(Fr()){case"negative":j.scrollLeft=-b;break;case"positive-ascending":j.scrollLeft=b;break;default:var S=j.clientWidth,w=j.scrollWidth;j.scrollLeft=w-S-b}else j.scrollLeft=b;else j.scrollTop=b}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Lr(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,p=h.children,v=h.className,x=h.direction,b=h.height,j=h.innerRef,S=h.innerElementType,w=h.innerTagName,C=h.itemCount,N=h.itemData,T=h.itemKey,L=T===void 0?ha:T,z=h.layout,V=h.outerElementType,$=h.outerTagName,G=h.style,q=h.useIsScrolling,J=h.width,Y=this.state.isScrolling,ee=x==="horizontal"||z==="horizontal",ae=ee?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),y=k[0],O=k[1],we=[];if(C>0)for(var ye=y;ye<=O;ye++)we.push(I.createElement(p,{data:N,key:L(ye,N),index:ye,isScrolling:q?Y:void 0,style:this._getItemStyle(ye)}));var Ie=r(this.props,this._instanceProps);return I.createElement(V||$||"div",{className:v,onScroll:ae,ref:this._outerRefSetter,style:ws({position:"relative",height:b,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:x},G)},I.createElement(S||w||"div",{children:we,ref:j,style:{height:ee?"100%":Ie,pointerEvents:Y?"none":void 0,width:ee?Ie:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"&&this.props.itemCount>0){var h=this._getRangeToRender(),p=h[0],v=h[1],x=h[2],b=h[3];this._callOnItemsRendered(p,v,x,b)}if(typeof this.props.onScroll=="function"){var j=this.state,S=j.scrollDirection,w=j.scrollOffset,C=j.scrollUpdateWasRequested;this._callOnScroll(S,w,C)}},m._getRangeToRender=function(){var h=this.props,p=h.itemCount,v=h.overscanCount,x=this.state,b=x.isScrolling,j=x.scrollDirection,S=x.scrollOffset;if(p===0)return[0,0,0,0];var w=a(this.props,S,this._instanceProps),C=l(this.props,w,S,this._instanceProps),N=b&&j!=="backward"?1:Math.max(1,v),T=b&&j!=="forward"?1:Math.max(1,v);return[Math.max(0,w-N),Math.max(0,Math.min(p-1,C+T)),w,C]},f}(I.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var pa=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},ga=fa({getItemOffset:function(t,e){return e*t.itemSize},getItemSize:function(t,e){return t.itemSize},getEstimatedTotalSize:function(t){var e=t.itemCount;return t.itemSize*e},getOffsetForIndexAndAlignment:function(t,e,n,r,i,o){var a=t.direction,l=t.height,c=t.itemCount,d=t.itemSize,u=t.layout,g=t.width,f=a==="horizontal"||u==="horizontal"?g:l,m=Math.max(0,c*d-f),h=Math.min(m,e*d),p=Math.max(0,e*d-f+d+o);switch(n==="smart"&&(n=r>=p-f&&r<=h+f?"auto":"center"),n){case"start":return h;case"end":return p;case"center":var v=Math.round(p+(h-p)/2);return v<Math.ceil(f/2)?0:v>m+Math.floor(f/2)?m:v;default:return r>=p&&r<=h?r:r<p?p:h}},getStartIndexForOffset:function(t,e){var n=t.itemCount,r=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(e/r)))},getStopIndexForStartIndex:function(t,e,n){var r=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,l=t.layout,c=t.width,d=e*a,u=r==="horizontal"||l==="horizontal"?c:i,g=Math.ceil((u+n-d)/a);return Math.max(0,Math.min(o-1,e+g-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});function ma(){var t,e;const n=de(),r=function(){const c=I.useContext(fr);if(c===null)throw new Error("Provide a DnDContext");return c}().cursor;if(!r||r.type!=="line")return null;const i=n.indent,o=n.rowHeight*r.index+((e=(t=n.props.padding)!==null&&t!==void 0?t:n.props.paddingTop)!==null&&e!==void 0?e:0),a=i*r.level,l=n.renderCursor;return s.jsx(l,{top:o,left:a,indent:i})}var va=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const ya=I.forwardRef(function(t,e){const{children:n}=t,r=va(t,["children"]),i=de();return s.jsxs("div",Object.assign({ref:e},r,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[s.jsx(xa,{}),n]}))}),xa=()=>{const t=de();return s.jsx("div",{style:{height:t.visibleNodes.length*t.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:s.jsx(ma,{})})};var ba=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const ja=I.forwardRef(function(t,e){var n,r,i,o,{style:a}=t,l=ba(t,["style"]);const c=de(),d=(r=(n=c.props.padding)!==null&&n!==void 0?n:c.props.paddingTop)!==null&&r!==void 0?r:0,u=(o=(i=c.props.padding)!==null&&i!==void 0?i:c.props.paddingBottom)!==null&&o!==void 0?o:0;return s.jsx("div",Object.assign({ref:e,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+u}px`})},l))});var he,Hr=I.createContext({dragDropManager:void 0});function E(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(!t){var o;if(e===void 0)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(o=new Error(e.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw o.framesToPop=1,o}}(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(he||(he={}));var Zt="dnd-core/INIT_COORDS",Jt="dnd-core/BEGIN_DRAG",Ur="dnd-core/PUBLISH_DRAG_SOURCE",It="dnd-core/HOVER",en="dnd-core/DROP",tn="dnd-core/END_DRAG";function Br(t,e){return{type:Zt,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}function nn(t){return nn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nn(t)}function Vr(t){return nn(t)==="object"}var wa={type:Zt,payload:{clientOffset:null,sourceClientOffset:null}};function Ia(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0||r,o=n.clientOffset,a=n.getSourceClientOffset,l=t.getMonitor(),c=t.getRegistry();t.dispatch(Br(o)),function(m,h,p){E(!h.isDragging(),"Cannot call beginDrag while dragging."),m.forEach(function(v){E(p.getSource(v),"Expected sourceIds to be registered.")})}(e,l,c);var d=function(m,h){for(var p=null,v=m.length-1;v>=0;v--)if(h.canDragSource(m[v])){p=m[v];break}return p}(e,l);if(d!==null){var u=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");(function(m){E(typeof m=="function","When clientOffset is provided, getSourceClientOffset must be a function.")})(a),u=a(d)}t.dispatch(Br(o,u));var g=c.getSource(d).beginDrag(l,d);if(g!=null){(function(m){E(Vr(m),"Item must be an object.")})(g),c.pinSource(d);var f=c.getSourceType(d);return{type:Jt,payload:{itemType:f,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}else t.dispatch(wa)}}function Sa(t){return function(){if(t.getMonitor().isDragging())return{type:Ur}}}function rn(t,e){return e===null?t===null:Array.isArray(t)?t.some(function(n){return n===e}):t===e}function ka(t){return function(e){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;(function(a){E(Array.isArray(a),"Expected targetIds to be an array.")})(e);var r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(a,l,c){E(l.isDragging(),"Cannot call hover while not dragging."),E(!l.didDrop(),"Cannot call hover after drop.");for(var d=0;d<a.length;d++){var u=a[d];E(a.lastIndexOf(u)===d,"Expected targetIds to be unique in the passed array."),E(c.getTarget(u),"Expected targetIds to be registered.")}}(r,i,o),function(a,l,c){for(var d=a.length-1;d>=0;d--){var u=a[d];rn(l.getTargetType(u),c)||a.splice(d,1)}}(r,o,i.getItemType()),function(a,l,c){a.forEach(function(d){c.getTarget(d).hover(l,d)})}(r,i,o),{type:It,payload:{targetIds:r,clientOffset:n||null}}}}function qr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(n),!0).forEach(function(r){Oa(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Oa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ca(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.getMonitor(),r=t.getRegistry();(function(o){E(o.isDragging(),"Cannot call drop while not dragging."),E(!o.didDrop(),"Cannot call drop twice during one drag operation.")})(n);var i=function(o){var a=o.getTargetIds().filter(o.canDropOnTarget,o);return a.reverse(),a}(n);i.forEach(function(o,a){var l=function(d,u,g,f){var m=g.getTarget(d),h=m?m.drop(f,d):void 0;return function(p){E(p===void 0||Vr(p),"Drop result must either be an object or undefined.")}(h),h===void 0&&(h=u===0?{}:f.getDropResult()),h}(o,a,r,n),c={type:en,payload:{dropResult:Wr(Wr({},e),l)}};t.dispatch(c)})}}function Na(t){return function(){var e=t.getMonitor(),n=t.getRegistry();(function(i){E(i.isDragging(),"Cannot call endDrag while not dragging.")})(e);var r=e.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:tn}}}function Da(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function nt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ta=function(){function t(e,n){var r=this;(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),nt(this,"store",void 0),nt(this,"monitor",void 0),nt(this,"backend",void 0),nt(this,"isSetUp",!1),nt(this,"handleRefCountChange",function(){var i=r.store.getState().refCount>0;r.backend&&(i&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!i&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}return Da(t,[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,n=this.store.dispatch,r=function(i){return{beginDrag:Ia(i),publishDragSource:Sa(i),hover:ka(i),drop:Ca(i),endDrag:Na(i)}}(this);return Object.keys(r).reduce(function(i,o){var a,l=r[o];return i[o]=(a=l,function(){for(var c=arguments.length,d=new Array(c),u=0;u<c;u++)d[u]=arguments[u];var g=a.apply(e,d);g!==void 0&&n(g)}),i},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),t}();function fe(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Gr=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kr=function(){return Math.random().toString(36).substring(7).split("").join(".")},$r={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr()};function Yr(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(fe(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(fe(1));return n(Yr)(t,e)}if(typeof t!="function")throw new Error(fe(2));var i=t,o=e,a=[],l=a,c=!1;function d(){l===a&&(l=a.slice())}function u(){if(c)throw new Error(fe(3));return o}function g(m){if(typeof m!="function")throw new Error(fe(4));if(c)throw new Error(fe(5));var h=!0;return d(),l.push(m),function(){if(h){if(c)throw new Error(fe(6));h=!1,d();var p=l.indexOf(m);l.splice(p,1),a=null}}}function f(m){if(!function(v){if(typeof v!="object"||v===null)return!1;for(var x=v;Object.getPrototypeOf(x)!==null;)x=Object.getPrototypeOf(x);return Object.getPrototypeOf(v)===x}(m))throw new Error(fe(7));if(m.type===void 0)throw new Error(fe(8));if(c)throw new Error(fe(9));try{c=!0,o=i(o,m)}finally{c=!1}for(var h=a=l,p=0;p<h.length;p++)(0,h[p])();return m}return f({type:$r.INIT}),(r={dispatch:f,subscribe:g,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(fe(10));i=m,f({type:$r.REPLACE})}})[Gr]=function(){var m,h=g;return(m={subscribe:function(p){if(typeof p!="object"||p===null)throw new Error(fe(11));function v(){p.next&&p.next(u())}return v(),{unsubscribe:h(v)}}})[Gr]=function(){return this},m},r}var Ea=function(t,e){return t===e};function Xr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xr(Object(n),!0).forEach(function(r){_a(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Zr={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pa(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zr,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Zt:case Jt:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case It:return t=n.clientOffset,e=i.clientOffset,!t&&!e||t&&e&&t.x===e.x&&t.y===e.y?n:Qr(Qr({},n),{},{clientOffset:i.clientOffset});case tn:case en:return Zr;default:return n}}var sn="dnd-core/ADD_SOURCE",on="dnd-core/ADD_TARGET",an="dnd-core/REMOVE_SOURCE",St="dnd-core/REMOVE_TARGET";function Jr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jr(Object(n),!0).forEach(function(r){Aa(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Aa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ma={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ra(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ma,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Jt:return pe(pe({},n),{},{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case Ur:return pe(pe({},n),{},{isSourcePublic:!0});case It:return pe(pe({},n),{},{targetIds:i.targetIds});case St:return n.targetIds.indexOf(i.targetId)===-1?n:pe(pe({},n),{},{targetIds:(t=n.targetIds,e=i.targetId,t.filter(function(o){return o!==e}))});case en:return pe(pe({},n),{},{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case tn:return pe(pe({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function La(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case sn:case on:return t+1;case an:case St:return t-1;default:return t}}var kt=[],ln=[];function za(){var t=arguments.length>1?arguments[1]:void 0;switch(t.type){case It:break;case sn:case on:case St:case an:return kt;default:return ln}var e=t.payload,n=e.targetIds,r=n===void 0?[]:n,i=e.prevTargetIds,o=i===void 0?[]:i,a=function(u,g){var f=new Map,m=function(p){f.set(p,f.has(p)?f.get(p)+1:1)};u.forEach(m),g.forEach(m);var h=[];return f.forEach(function(p,v){p===1&&h.push(v)}),h}(r,o),l=a.length>0||!function(u,g){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ea;if(u.length!==g.length)return!1;for(var m=0;m<u.length;++m)if(!f(u[m],g[m]))return!1;return!0}(r,o);if(!l)return kt;var c=o[o.length-1],d=r[r.length-1];return c!==d&&(c&&a.push(c),d&&a.push(d)),a}function Fa(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function ei(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ti(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ei(Object(n),!0).forEach(function(r){Ha(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ei(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ha(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ua(){var t,e,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:za(r.dirtyHandlerIds,{type:i.type,payload:ti(ti({},i.payload),{},{prevTargetIds:(t=r,e="dragOperation.targetIds",n=[],e.split(".").reduce(function(o,a){return o&&o[a]?o[a]:n||null},t))})}),dragOffset:Pa(r.dragOffset,i),refCount:La(r.refCount,i),dragOperation:Ra(r.dragOperation,i),stateId:Fa(r.stateId)}}function ni(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ba(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function ri(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}kt.__IS_NONE__=!0,ln.__IS_ALL__=!0;var Va=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),ri(this,"store",void 0),ri(this,"registry",void 0),this.store=e,this.registry=n}return Ba(t,[{key:"subscribeToStateChange",value:function(e){var n=this,r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;E(typeof e=="function","listener must be a function."),E(r===void 0||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");var i=this.store.getState().stateId;return this.store.subscribe(function(){var o=n.store.getState(),a=o.stateId;try{var l=a===i||a===i+1&&!function(c,d){if(c===kt)return!1;if(c===ln||d===void 0)return!0;var u,g=(u=c,d.filter(function(f){return u.indexOf(f)>-1}));return g.length>0}(o.dirtyHandlerIds,r);l||e()}finally{i=a}})}},{key:"subscribeToOffsetChange",value:function(e){var n=this;E(typeof e=="function","listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var i=n.store.getState().dragOffset;i!==r&&(r=i,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e);return E(n,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&n.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var n=this.registry.getTarget(e);return E(n,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&rn(this.registry.getTargetType(e),this.getItemType())&&n.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e,!0);return E(n,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&n.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!rn(r,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return n?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,i=e.clientOffset,o=e.initialClientOffset,a=e.initialSourceClientOffset,i&&o&&a?ni((r=a,{x:(n=i).x+r.x,y:n.y+r.y}),o):null;var e,n,r,i,o,a}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,r=e.initialClientOffset,n&&r?ni(n,r):null;var e,n,r}}]),t}(),qa=0;function cn(t){return cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cn(t)}function dn(t,e){e&&Array.isArray(t)?t.forEach(function(n){return dn(n,!1)}):E(typeof t=="string"||cn(t)==="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const ii=typeof global<"u"?global:self,si=ii.MutationObserver||ii.WebKitMutationObserver;function oi(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const Wa=typeof si=="function"?function(t){let e=1;const n=new si(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:oi;class Ga{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}const ai=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let n=0,r=t.length-this.index;n<r;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Wa(this.flush),this.requestErrorThrow=oi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Ka=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new Ga(this.onError,r=>e[e.length]=r);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(ai.registerPendingError);function $a(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function qe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ya(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return li(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return li(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ui(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function tl(t,e){if(t==null)return{};var n,r,i=function(a,l){if(a==null)return{};var c,d,u={},g=Object.keys(a);for(d=0;d<g.length;d++)c=g[d],l.indexOf(c)>=0||(u[c]=a[c]);return u}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var hi=0,Ot=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),nl=I.memo(function(t){var e=t.children,n=function(a){if("manager"in a)return[{dragDropManager:a.manager},!1];var l=function(d){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fi(),g=arguments.length>2?arguments[2]:void 0,f=arguments.length>3?arguments[3]:void 0,m=u;return m[Ot]||(m[Ot]={dragDropManager:Za(d,u,g,f)}),m[Ot]}(a.backend,a.context,a.options,a.debugMode),c=!a.context;return[l,c]}(tl(t,Ja)),r=el(n,2),i=r[0],o=r[1];return I.useEffect(function(){if(o){var a=fi();return++hi,function(){--hi===0&&(a[Ot]=null)}}},[]),s.jsx(Hr.Provider,Object.assign({value:i},{children:e}),void 0)});function fi(){return typeof global<"u"?global:window}function rl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function pi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var un=!1,hn=!1,il=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),pi(this,"internalMonitor",void 0),pi(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return rl(t,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){E(!un,"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 un=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{un=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;E(!hn,"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 hn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{hn=!1}}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,n){return this.internalMonitor.isOverTarget(e,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function sl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function gi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fn=!1,ol=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),gi(this,"internalMonitor",void 0),gi(this,"targetId",null),this.internalMonitor=e.getMonitor()}return sl(t,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;E(!fn,"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 fn=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{fn=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function al(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!I.isValidElement(e)){var r=e;return t(r,n),r}var i=e;(function(a){if(typeof a.type!="string"){var l=a.type.displayName||a.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(l," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}})(i);var o=n?function(a){return t(a,n)}:t;return function(a,l){var c=a.ref;return E(typeof c!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),c?I.cloneElement(a,{ref:function(d){vi(c,d),vi(l,d)}}):I.cloneElement(a,{ref:l})}(i,o)}}function mi(t){var e={};return Object.keys(t).forEach(function(n){var r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{var i=al(r);e[n]=function(){return i}}}),e}function vi(t,e){typeof t=="function"?t(e):t.current=e}function pn(t){return pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pn(t)}function gn(t){return t!==null&&pn(t)==="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function mn(t,e,n,r){var i=void 0;if(i!==void 0)return!!i;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;var o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(e),c=0;c<o.length;c++){var d=o[c];if(!l(d))return!1;var u=t[d],g=e[d];if((i=void 0)===!1||i===void 0&&u!==g)return!1}return!0}function ll(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function se(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var cl=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),se(this,"hooks",mi({dragSource:function(r,i){n.clearDragSource(),n.dragSourceOptions=i||null,gn(r)?n.dragSourceRef=r:n.dragSourceNode=r,n.reconnectDragSource()},dragPreview:function(r,i){n.clearDragPreview(),n.dragPreviewOptions=i||null,gn(r)?n.dragPreviewRef=r:n.dragPreviewNode=r,n.reconnectDragPreview()}})),se(this,"handlerId",null),se(this,"dragSourceRef",null),se(this,"dragSourceNode",void 0),se(this,"dragSourceOptionsInternal",null),se(this,"dragSourceUnsubscribe",void 0),se(this,"dragPreviewRef",null),se(this,"dragPreviewNode",void 0),se(this,"dragPreviewOptionsInternal",null),se(this,"dragPreviewUnsubscribe",void 0),se(this,"lastConnectedHandlerId",null),se(this,"lastConnectedDragSource",null),se(this,"lastConnectedDragSourceOptions",null),se(this,"lastConnectedDragPreview",null),se(this,"lastConnectedDragPreviewOptions",null),se(this,"backend",void 0),this.backend=e}return ll(t,[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();n&&this.disconnectDragSource(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!mn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!mn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),t}();function dl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function be(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ul=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),be(this,"hooks",mi({dropTarget:function(r,i){n.clearDropTarget(),n.dropTargetOptions=i,gn(r)?n.dropTargetRef=r:n.dropTargetNode=r,n.reconnect()}})),be(this,"handlerId",null),be(this,"dropTargetRef",null),be(this,"dropTargetNode",void 0),be(this,"dropTargetOptionsInternal",null),be(this,"unsubscribeDropTarget",void 0),be(this,"lastConnectedHandlerId",null),be(this,"lastConnectedDropTarget",null),be(this,"lastConnectedDropTargetOptions",null),be(this,"backend",void 0),this.backend=e}return dl(t,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var n=this.dropTarget;this.handlerId&&(n?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions)):this.lastConnectedDropTarget=n)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!mn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),t}(),Te=typeof window<"u"?I.useLayoutEffect:I.useEffect;function vn(t){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vn(t)}function hl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function yn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fl=function(){function t(e,n,r){(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),yn(this,"spec",void 0),yn(this,"monitor",void 0),yn(this,"connector",void 0),this.spec=e,this.monitor=n,this.connector=r}return hl(t,[{key:"beginDrag",value:function(){var e,n=this.spec,r=this.monitor;return(e=vn(n.item)==="object"?n.item:typeof n.item=="function"?n.item(r):{})!==null&&e!==void 0?e:null}},{key:"canDrag",value:function(){var e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag!="function"||e.canDrag(n)}},{key:"isDragging",value:function(e,n){var r=this.spec,i=this.monitor,o=r.isDragging;return o?o(i):n===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,n=this.monitor,r=this.connector,i=e.end;i&&i(n.getItem(),n),r.reconnect()}}]),t}();function Ee(){var t=I.useContext(Hr).dragDropManager;return E(t!=null,"Expected drag drop context"),t}function pl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return yi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return yi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function xn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
14
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
15
|
-
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Nt(it,Mi,{exposeProperties:{text:function(t,e){return bn(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),it);function Pl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function zi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Al=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),zi(this,"item",void 0),zi(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return Pl(t,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(e.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var n=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(i){r[i]={value:n.config.exposeProperties[i](e,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,n){return n===e.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function wn(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(jn).filter(function(n){return jn[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function Ml(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function In(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Rl=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),In(this,"ownerDocument",null),In(this,"globalContext",void 0),In(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return Ml(t,[{key:"window",get:function(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}},{key:"document",get:function(){var e;return(e=this.globalContext)!==null&&e!==void 0&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}}]),t}();function Fi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fi(Object(n),!0).forEach(function(r){R(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fi(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ll(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function R(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Sn,zl=function(){function t(e,n,r){var i=this;(function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")})(this,t),R(this,"options",void 0),R(this,"actions",void 0),R(this,"monitor",void 0),R(this,"registry",void 0),R(this,"enterLeaveCounter",void 0),R(this,"sourcePreviewNodes",new Map),R(this,"sourcePreviewNodeOptions",new Map),R(this,"sourceNodes",new Map),R(this,"sourceNodeOptions",new Map),R(this,"dragStartSourceIds",null),R(this,"dropTargetIds",[]),R(this,"dragEnterTargetIds",[]),R(this,"currentNativeSource",null),R(this,"currentNativeHandle",null),R(this,"currentDragSourceNode",null),R(this,"altKeyPressed",!1),R(this,"mouseMoveTimeoutTimer",null),R(this,"asyncEndDragFrameId",null),R(this,"dragOverTargetIds",null),R(this,"lastClientOffset",null),R(this,"hoverRafId",null),R(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&_i(a)||null}),R(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),R(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),R(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),R(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=Ct(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var c=o.dataTransfer,d=wn(c);if(i.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=i.monitor.getSourceId(),g=i.sourceNodes.get(u),f=i.sourcePreviewNodes.get(u)||g;if(f){var m=i.getCurrentSourcePreviewNodeOptions(),h=_l(g,f,l,{anchorX:m.anchorX,anchorY:m.anchorY},{offsetX:m.offsetX,offsetY:m.offsetY});c.setDragImage(f,h.x,h.y)}}try{c==null||c.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(d)i.beginDragNativeItem(d);else{if(c&&!c.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),R(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var a=o.dataTransfer,l=wn(a);l&&i.beginDragNativeItem(l,a)}}),R(this,"handleTopDragEnter",function(o){var a=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=o.altKey,a.length>0&&i.actions.hover(a,{clientOffset:Ct(o)}),a.some(function(l){return i.monitor.canDropOnTarget(l)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),R(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),R(this,"handleTopDragOver",function(o){var a=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));i.altKeyPressed=o.altKey,i.lastClientOffset=Ct(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(a||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(a||[]).some(function(l){return i.monitor.canDropOnTarget(l)})?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),R(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),R(this,"handleTopDropCapture",function(o){var a;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)):wn(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),R(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:Ct(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleSelectStart",function(o){var a=o.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(o.preventDefault(),a.dragDrop()))}),this.options=new Rl(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Dl(this.isNodeInDocument)}return Ll(t,[{key:"profile",value:function(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,n=this.rootElement;n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&((e=this.window)===null||e===void 0||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,n,r){var i=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),function(){i.sourcePreviewNodes.delete(e),i.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,n,r){var i=this;this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,r);var o=function(l){return i.handleDragStart(l,e)},a=function(l){return i.handleSelectStart(l)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(e),i.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,n){var r=this,i=function(l){return r.handleDragEnter(l,e)},o=function(l){return r.handleDragOver(l,e)},a=function(l){return r.handleDrop(l,e)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return Hi({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return Hi({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(Li).some(function(n){return Li[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new Al(jn[r]);return o.loadDataTransfer(i),o}(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var r;return(r=n.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;return this.currentDragSourceNode=null,this.rootElement&&((e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(e,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(e,n){this.dropTargetIds.unshift(n)}}]),t}(),Fl=function(t,e,n){return new zl(t,e,n)};function Hl(t){const e=de(),n=e.selectedIds,[r,i,o]=jl(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(Ve.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(Ve.dragEnd())}}),[n,t]);return I.useEffect(()=>{o((Sn||((Sn=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Sn))},[o]),i}function Dt(t,e){return{parentId:t||null,index:e}}function We(t,e){return{type:"line",index:t,level:e}}function kn(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;return{parentId:((n=r.parent)===null||n===void 0?void 0:n.id)||null,index:br(r)+1}}function Ui(t){var e;const n=function(g,f){const m=g.getBoundingClientRect(),h=f.x-Math.round(m.x),p=f.y-Math.round(m.y),v=m.height,x=p<v/2,b=!x,j=v/4,S=p>j&&p<v-j;return{x:h,inTopHalf:x,inBottomHalf:b,inMiddle:S,atTop:!S&&x,atBottom:!S&&b}}(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:a,prevNode:l}=t,[c,d]=function(g,f,m,h){return g?g.isInternal?h.atTop?[f,g]:h.inMiddle?[g,g]:[g,m]:h.inTopHalf?[f,g]:[g,m]:[f,null]}(o,l,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:Dt(o.id,null),cursor:(u=o.id,{type:"highlight",id:u})};var u;if(!c)return{drop:Dt((e=d==null?void 0:d.parent)===null||e===void 0?void 0:e.id,0),cursor:We(0,0)};if(mr(c)){const g=jt(i,(d==null?void 0:d.level)||0,c.level);return{drop:kn(c,g),cursor:We(c.rowIndex+1,g)}}if(vr(c)){const g=jt(i,(d==null?void 0:d.level)||0,c.level);return{drop:kn(c,g),cursor:We(c.rowIndex+1,g)}}if(yr(c)){const g=jt(i,0,c.level+1);return g>c.level?{drop:Dt(c.id,0),cursor:We(c.rowIndex+1,g)}:{drop:kn(c,g),cursor:We(c.rowIndex+1,g)}}return{drop:Dt(c==null?void 0:c.id,0),cursor:We(c.rowIndex+1,c.level+1)}}const Ul=Ke.memo(function({index:t,style:e}){gr(),function(){if(I.useContext(hr)===null)throw new Error("Provide a NodesContext")}();const n=de(),r=function(h){const p=de(),v=p.at(h);if(!v)throw new Error(`Could not find node for index: ${h}`);return I.useMemo(()=>{const x=v.clone();return p.visibleNodes[h]=x,x},[...Object.values(v.state),v])}(t),i=I.useRef(null),o=Hl(r),a=function(h,p){const v=de(),[x,b]=Oi(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(j,S)=>{const w=S.getClientOffset();if(!h.current||!w)return;const{cursor:C,drop:N}=Ui({element:h.current,offset:w,indent:v.indent,node:p,prevNode:p.prev,nextNode:p.next});N&&v.dispatch(Ve.hovering(N.parentId,N.index)),S.canDrop()?C&&v.showCursor(C):v.hideCursor()},drop:(j,S)=>{if(!S.canDrop())return null;let{parentId:w,index:C,dragIds:N}=v.state.dnd;kr(v.props.onMove,{dragIds:N,parentId:w===et?null:w,index:C===null?0:C,dragNodes:v.dragNodes,parentNode:v.get(w)}),v.open(w)}}),[p,h.current,v.props]);return b}(i,r),l=I.useCallback(h=>{i.current=h,a(h)},[a]),c=n.indent*r.level,d=I.useMemo(()=>({paddingLeft:c}),[c]),u=I.useMemo(()=>{var h,p;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((p=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&p!==void 0?p:0)})},[e,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};I.useEffect(()=>{var h;!r.isEditing&&r.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const f=n.renderNode,m=n.renderRow;return s.jsx(m,{node:r,innerRef:l,attrs:g,children:s.jsx(f,{node:r,tree:n,style:d,dragHandle:o})})});let On="",Bi=null;function Vi(){gr();const t=de();return s.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var n;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const a=o.nextSibling,l=o.parent;t.focus(a||l,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey)return e.preventDefault(),void jr(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void wr(e.currentTarget);if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey)return t.select(t.focusedNode),void t.activate(t.focusedNode);if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode))}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode))}}if(e.key==="ArrowRight"){const i=t.focusedNode;return i?void(i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id)):void 0}if(e.key==="ArrowLeft"){const i=t.focusedNode;return!i||i.isRoot?void 0:void(i.isInternal&&i.isOpen?t.close(i.id):((n=i.parent)===null||n===void 0?void 0:n.isRoot)||t.focus(i.parent))}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection)return e.preventDefault(),void t.selectAll();if(e.key==="a"&&!e.metaKey&&t.props.onCreate)return void t.createLeaf();if(e.key==="A"&&!e.metaKey)return t.props.onCreate?void t.createInternal():void 0;if(e.key==="Home")return e.preventDefault(),void t.focus(t.firstNode);if(e.key==="End")return e.preventDefault(),void t.focus(t.lastNode);if(e.key==="Enter"){const i=t.focusedNode;return!i||!i.isEditable||!t.props.onRename?void 0:void setTimeout(()=>{i&&t.edit(i)})}if(e.key===" "){e.preventDefault();const i=t.focusedNode;return i?void(i.isLeaf?(i.select(),i.activate()):i.toggle()):void 0}if(e.key==="*"){const i=t.focusedNode;return i?void t.openSiblings(i):void 0}if(e.key==="PageUp")return e.preventDefault(),void t.pageUp();e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(Bi),On+=e.key,Bi=setTimeout(()=>{On=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(On)});r&&t.focus(r.id)},children:s.jsx(ga,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:ya,innerElementType:ja,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:Ul})})}function qi(t){return t.isFiltered?function(e,n){const r={},i=[];function o(l){if(!l.isRoot&&n(l)){r[l.id]=!0;let c=l.parent;for(;c;)r[c.id]=!0,c=c.parent}if(l.children)for(let c of l.children)o(c)}function a(l){var c;l.level>=0&&r[l.id]&&i.push(l),l.isOpen&&((c=l.children)===null||c===void 0||c.forEach(a))}return o(e),a(e),i.forEach(Wi),i}(t.root,t.isMatch.bind(t)):function(e){const n=[];function r(i){var o;i.level>=0&&n.push(i),i.isOpen&&((o=i.children)===null||o===void 0||o.forEach(r))}return r(e),n.forEach(Wi),n}(t.root)}function Wi(t,e){t.rowIndex=e}const Gi=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var Cn=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(d){try{c(r.next(d))}catch(u){o(u)}}function l(d){try{c(r.throw(d))}catch(u){o(u)}}function c(d){var u;d.done?i(d.value):(u=d.value,u instanceof n?u:new n(function(g){g(u)})).then(a,l)}c((r=r.apply(t,e||[])).next())})};const{safeRun:Z,identify:Se,identifyNull:ve}=Go;class lt{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=Dr(this),this.visibleNodes=qi(this),this.idToIndex=Gi(this.visibleNodes)}update(e){this.props=e,this.root=Dr(this),this.visibleNodes=qi(this),this.idToIndex=Gi(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;return(n=Je(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=Je(e,this.props.idAccessor||"id");if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const a=Math.min(i,o),l=Math.max(i,o);return this.visibleNodes.slice(a,l+1)}indexOf(e){const n=Sr(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Cn(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?Nr(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:Cr(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",l=yield Z(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});l&&(this.focus(l),setTimeout(()=>{this.edit(l).then(()=>{this.select(l),this.activate(l)})}))})}delete(e){return Cn(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Se),r=n.map(i=>this.get(i)).filter(i=>!!i);yield Z(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=Se(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(Kt(n)),new Promise(r=>{lt.editPromise=r})}submit(e,n){return Cn(this,void 0,void 0,function*(){if(!e)return;const r=Se(e);yield Z(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(Kt(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Kt(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(ve(e));n&&Z(this.props.onActivate,n)}resolveEdit(e){const n=lt.editPromise;n&&n(e),lt.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Ue(Se(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&Z(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex-r;let o=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;o=o>r?r:Math.max(r-i,0),this.focus(this.at(o))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a=a<i?i:Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=Se(e);r&&this.dispatch(Ue(i)),this.dispatch(ta(i)),this.dispatch(Pr(i)),this.dispatch(Yt(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=Se(e);this.dispatch(_r(n)),Z(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(ve(e));n&&(this.dispatch(Ue(n.id)),this.dispatch(Er(n.id)),this.dispatch(Pr(n.id)),this.dispatch(Yt(n.id)),this.scrollTo(n),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=Se(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Ue(n)),this.dispatch(_r(this.nodesBetween(r,i))),this.dispatch(Er(this.nodesBetween(r,ve(n)))),this.dispatch(Yt(n)),this.scrollTo(n),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),Z(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Ue((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(Se)),i=ve(e.anchor),o=ve(e.mostRecent);this.dispatch(na({ids:r,anchor:i,mostRecent:o})),Z(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return e.type==="highlight"?e.id:null}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;const n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&xr(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i!="boolean"||!i}hideCursor(){this.dispatch(Ve.cursor({type:"none"}))}showCursor(e){this.dispatch(Ve.cursor(e))}open(e){const n=ve(e);n&&(this.isOpen(n)||(this.dispatch($t.open(n,this.isFiltered)),Z(this.props.onToggle,n)))}close(e){const n=ve(e);n&&this.isOpen(n)&&(this.dispatch($t.close(n,this.isFiltered)),Z(this.props.onToggle,n))}toggle(e){const n=ve(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=ve(e);if(!n)return;const r=Gt(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(n){if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){wt(this.root,e=>{e.isInternal&&e.open()})}closeAll(){wt(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=Se(e);return this.openParents(r),Or(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var n,r,i;if(!e)return!1;if(e===et)return!0;const o=(n=this.props.openByDefault)===null||n===void 0||n;return this.isFiltered?(r=this.state.nodes.open.filtered[e])===null||r===void 0||r:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){return!Je(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!Je(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=ve(e);return!!n&&this.state.nodes.drag.id===n}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=ve(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Ue(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Vi}get renderRow(){return this.props.renderRow||Qo}get renderNode(){return this.props.children||Zo}get renderDragPreview(){return this.props.renderDragPreview||Ar}get renderCursor(){return this.props.renderCursor||Xo}}function oe(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Ki=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nn=()=>Math.random().toString(36).substring(7).split("").join("."),Tt={INIT:`@@redux/INIT${Nn()}`,REPLACE:`@@redux/REPLACE${Nn()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Nn()}`};function $i(t,e,n){if(typeof t!="function")throw new Error(oe(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(oe(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(oe(1));return n($i)(t,e)}let r=t,i=e,o=new Map,a=o,l=0,c=!1;function d(){a===o&&(a=new Map,o.forEach((m,h)=>{a.set(h,m)}))}function u(){if(c)throw new Error(oe(3));return i}function g(m){if(typeof m!="function")throw new Error(oe(4));if(c)throw new Error(oe(5));let h=!0;d();const p=l++;return a.set(p,m),function(){if(h){if(c)throw new Error(oe(6));h=!1,d(),a.delete(p),o=null}}}function f(m){if(!function(h){if(typeof h!="object"||h===null)return!1;let p=h;for(;Object.getPrototypeOf(p)!==null;)p=Object.getPrototypeOf(p);return Object.getPrototypeOf(h)===p||Object.getPrototypeOf(h)===null}(m))throw new Error(oe(7));if(m.type===void 0)throw new Error(oe(8));if(typeof m.type!="string")throw new Error(oe(17));if(c)throw new Error(oe(9));try{c=!0,i=r(i,m)}finally{c=!1}return(o=a).forEach(h=>{h()}),m}return f({type:Tt.INIT}),{dispatch:f,subscribe:g,getState:u,replaceReducer:function(m){if(typeof m!="function")throw new Error(oe(10));r=m,f({type:Tt.REPLACE})},[Ki]:function(){const m=g;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(oe(11));function p(){const v=h;v.next&&v.next(u())}return p(),{unsubscribe:m(p)}},[Ki](){return this}}}}}function Yi(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{(function(o){Object.keys(o).forEach(a=>{const l=o[a];if(l(void 0,{type:Tt.INIT})===void 0)throw new Error(oe(12));if(l(void 0,{type:Tt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(oe(13))})})(n)}catch(o){i=o}return function(o={},a){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const u=r[d],g=n[u],f=o[u],m=g(f,a);if(m===void 0)throw a&&a.type,new Error(oe(14));c[u]=m,l=l||m!==f}return l=l||r.length!==Object.keys(o).length,l?c:o}}const Bl=Yi({nodes:Yi({focus:function(t={id:null,treeFocused:!1},e){return e.type==="FOCUS"?Object.assign(Object.assign({},t),{id:e.id,treeFocused:!0}):e.type==="TREE_BLUR"?Object.assign(Object.assign({},t),{treeFocused:!1}):t},edit:function(t={id:null},e){return e.type==="EDIT"?Object.assign(Object.assign({},t),{id:e.id}):t},open:function(t={filtered:{},unfiltered:{}},e){return e.type.startsWith("VISIBILITY")?e.filtered?Object.assign(Object.assign({},t),{filtered:Tr(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:Tr(t.unfiltered,e)}):t},selection:function(t=Be().nodes.selection,e){const n=t.ids;switch(e.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},t),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},t),{ids:new Set([e.id])});case"SELECTION_ADD":return e.ids.length===0?t:(e.ids.forEach(r=>n.add(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_REMOVE":return e.ids.length===0?t:(e.ids.forEach(r=>n.delete(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},t),{ids:e.ids,mostRecent:e.mostRecent,anchor:e.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},t),{mostRecent:e.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},t),{anchor:e.id});default:return t}},drag:function(t=Be().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}}),dnd:function(t=Be().dnd,e){switch(e.type){case"DND_CURSOR":return Object.assign(Object.assign({},t),{cursor:e.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},t),{dragId:e.id,dragIds:e.dragIds});case"DND_DRAG_END":return Be().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),Vl=Be();function ql({treeProps:t,imperativeHandle:e,children:n}){const r=I.useRef(null),i=I.useRef(null),o=I.useRef($i(Bl,Be(t))),a=Is.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>Vl),l=I.useMemo(()=>new lt(o.current,t,r,i),[]),c=I.useRef(0);return I.useMemo(()=>{c.current+=1,l.update(t)},[...Object.values(t),a.nodes.open]),I.useImperativeHandle(e,()=>l),I.useEffect(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),I.useEffect(()=>{l.props.searchTerm||o.current.dispatch($t.clear(!0))},[l.props.searchTerm]),s.jsx(ur.Provider,{value:l,children:s.jsx(pr.Provider,{value:c.current,children:s.jsx(hr.Provider,{value:a.nodes,children:s.jsx(fr.Provider,{value:a.dnd,children:s.jsx(nl,Object.assign({backend:Fl,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Wl(t){return function(){const e=de(),[,n]=Oi(()=>({accept:"NODE",canDrop:(r,i)=>!!i.isOver({shallow:!0})&&e.canDrop(),hover:(r,i)=>{if(!i.isOver({shallow:!0}))return;const o=i.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:a,drop:l}=Ui({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});l&&e.dispatch(Ve.hovering(l.parentId,l.index)),i.canDrop()?a&&e.showCursor(a):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function Gl(){const t=de().props.renderContainer||Vi;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function Kl(){const t=de(),{offset:e,mouse:n,item:r,isDragging:i}=(o=g=>({offset:g.getSourceClientOffset(),mouse:g.getClientOffset(),item:g.getItem(),isDragging:g.isDragging()}),a=Ee().getMonitor(),l=Cl(ji(a,o),2),c=l[0],d=l[1],I.useEffect(function(){return a.subscribeToOffsetChange(d)}),I.useEffect(function(){return a.subscribeToStateChange(d)}),c);var o,a,l,c,d;const u=t.props.renderDragPreview||Ar;return s.jsx(u,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class Xi{constructor(e){this.root=function(n){const r=new Qi({id:"ROOT"},null);return r.children=n.map(i=>Dn(i,r)),r}(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;n&&r&&(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function Dn(t,e){const n=new Qi(t,e);return t.children&&(n.children=t.children.map(r=>Dn(r,n))),n}class Qi{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=Dn(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let $l=0;function Yl(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
16
|
-
Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=function(r){const[i,o]=I.useState(r),a=I.useMemo(()=>new Xi(i),[i]);return[i,{onMove:c=>{for(const d of c.dragIds)a.move({id:d,parentId:c.parentId,index:c.index});o(a.data)},onRename:({name:c,id:d})=>{a.update({id:d,changes:{name:c}}),o(a.data)},onCreate:({parentId:c,index:d,type:u})=>{const g={id:"simple-tree-id-"+$l++,name:""};return u==="internal"&&(g.children=[]),a.create({parentId:c,index:d,data:g}),o(a.data),g},onDelete:c=>{c.ids.forEach(d=>a.drop({id:d})),o(a.data)}}]}(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}return t}const Xl=I.forwardRef(function(t,e){const n=Yl(t);return s.jsxs(ql,{treeProps:n,imperativeHandle:e,children:[s.jsx(Wl,{children:s.jsx(Gl,{})}),s.jsx(Kl,{})]})});function Ql(t,e){const n=U.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,a=o!==void 0&&o,l=I.useRef(void 0);let c,d,u,g,f;return n[0]!==t?(c=()=>{l.current=t},d=[t],n[0]=t,n[1]=c,n[2]=d):(c=n[1],d=n[2]),I.useEffect(c,d),n[3]!==r||n[4]!==a||n[5]!==i?(u=()=>{if(r===null||a)return;const m=setInterval(()=>{var h;i&&document.visibilityState!=="visible"||((h=l.current)==null||h.call(l))},r);return()=>clearInterval(m)},g=[r,i,a],n[3]=r,n[4]=a,n[5]=i,n[6]=u,n[7]=g):(u=n[6],g=n[7]),I.useEffect(u,g),n[8]!==a||n[9]!==i?(f=()=>{var m;document.visibilityState==="visible"&&i&&!a&&((m=l.current)==null||m.call(l))},n[8]=a,n[9]=i,n[10]=f):f=n[10],Ss(document,"visibilitychange",f),null}function Zl(){return["compact","medium","full","columns"]}const Jl=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),e[0]=n,e[1]=r):r=e[1],r},Et=t=>{const e=U.c(10);let n,r,i,o,a;return e[0]!==t?({children:n,className:r,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]),e[4]!==r?(o=$e("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",r),e[4]=r,e[5]=o):o=e[5],e[6]!==n||e[7]!==i||e[8]!==o?(a=s.jsx("div",{...i,className:o,children:n}),e[6]=n,e[7]=i,e[8]=o,e[9]=a):a=e[9],a},ec=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r},Zi=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],tc=()=>{const t=U.c(31),[e,n]=ks(),{saveAppConfig:r}=ze();let i,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=An(Os),t[0]=i):i=t[0],t[1]!==e?(o={resolver:i,defaultValues:e},t[1]=e,t[2]=o):o=t[2];const a=Mn(o);let l;t[3]!==r||t[4]!==n?(l=async j=>{await r({config:j}).then(()=>{n(j)}).catch(()=>{n(j)})},t[3]=r,t[4]=n,t[5]=l):l=t[5];const c=l;let d,u,g,f,m,h,p,v,x,b;return t[6]!==e.width?(d=[e.width],t[6]=e.width,t[7]=d):d=t[7],I.useEffect(nc,d),t[8]!==a||t[9]!==c?(u=a.handleSubmit(c),t[8]=a,t[9]=c,t[10]=u):u=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{children:[s.jsx(Jl,{children:"Notebook Settings"}),s.jsx(ec,{children:"Configure how your notebook or application looks and behaves."})]}),t[11]=g):g=t[11],t[12]!==a.control?(f=s.jsxs(_t,{title:"Display",children:[s.jsx(_,{control:a.control,name:"width",render:ic}),s.jsx(_,{control:a.control,name:"app_title",render:sc})]}),t[12]=a.control,t[13]=f):f=t[13],t[14]!==a.control?(m=s.jsxs(_t,{title:"Custom Files",children:[s.jsx(_,{control:a.control,name:"css_file",render:oc}),s.jsx(_,{control:a.control,name:"html_head_file",render:ac})]}),t[14]=a.control,t[15]=m):m=t[15],t[16]!==a.control?(h=s.jsx(_t,{title:"Data",children:s.jsx(_,{control:a.control,name:"sql_output",render:cc})}),t[16]=a.control,t[17]=h):h=t[17],t[18]!==a.control?(p=s.jsx(_t,{title:"Exporting outputs",children:s.jsx(_,{control:a.control,name:"auto_download",render:dc})}),t[18]=a.control,t[19]=p):p=t[19],t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==p?(v=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[f,m,h,p]}),t[20]=f,t[21]=m,t[22]=h,t[23]=p,t[24]=v):v=t[24],t[25]!==v||t[26]!==u?(x=s.jsxs("form",{onChange:u,className:"flex flex-col gap-6",children:[g,v]}),t[25]=v,t[26]=u,t[27]=x):x=t[27],t[28]!==a||t[29]!==x?(b=s.jsx(Rn,{...a,children:x}),t[28]=a,t[29]=x,t[30]=b):b=t[30],b},_t=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx("h3",{className:"text-base font-semibold mb-1",children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-y-2",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function nc(){window.dispatchEvent(new Event("resize"))}function rc(t){return s.jsx("option",{value:t,children:t},t)}function ic(t){const{field:e}=t;return s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"Width"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"app-width-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(rc)})}),s.jsx(M,{})]})}function sc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"App title"}),s.jsx(A,{children:s.jsx(Oe,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),Ln.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{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 oc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"Custom CSS"}),s.jsx(A,{children:s.jsx(Oe,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),Ln.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function ac(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"HTML Head"}),s.jsx(A,{children:s.jsx(Oe,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(M,{})]}),s.jsxs(F,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(K,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function lc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function cc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"SQL Output Type"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),Fe({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:Zi.map(lc)})}),s.jsx(M,{})]}),s.jsxs(F,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(K,{className:"inline",children:"native"}),". See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}function dc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-col gap-2",children:[s.jsx(A,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"html-checkbox",checked:e.value.includes("html"),onCheckedChange:()=>{e.onChange(ut(e.value,"html"))}}),s.jsx(D,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"ipynb-checkbox",checked:e.value.includes("ipynb"),onCheckedChange:()=>{e.onChange(ut(e.value,"ipynb"))}}),s.jsx(D,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(M,{})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(K,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const uc=zn("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xs-solid hover:cursor-pointer active:shadow-none dark:border-border text-sm",{variants:{color:{gray:"mo-button gray",white:"mo-button white",green:"mo-button green",red:"mo-button red",yellow:"mo-button yellow","hint-green":"mo-button hint-green",disabled:"mo-button disabled active:shadow-xs-solid"},shape:{rectangle:"rounded",circle:"rounded-full"},size:{small:"",medium:""}},compoundVariants:[{size:"small",shape:"circle",class:"h-[24px] w-[24px] px-[5.5px] py-[5.5px]"},{size:"medium",shape:"circle",class:"px-2 py-2"},{size:"small",shape:"rectangle",class:"px-1 py-1 h-[24px] w-[24px]"},{size:"medium",shape:"rectangle",class:"px-3 py-2"}],defaultVariants:{color:"gray",size:"medium",shape:"rectangle"}}),hc=zn("font-mono w-full flex-1 inline-flex items-center justify-center rounded px-2.5 text-foreground/60 h-[36px] hover:shadow-md hover:cursor-pointer focus:shadow-md focus:outline-hidden text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),Pt=Ke.forwardRef((t,e)=>{const n=U.c(15);let r,i,o,a,l,c,d;return n[0]!==t?({color:i,shape:a,size:l,className:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=a,n[5]=l):(r=n[1],i=n[2],o=n[3],a=n[4],l=n[5]),n[6]!==r||n[7]!==i||n[8]!==a||n[9]!==l?(c=Fn(uc({color:i,shape:a,size:l}),r),n[6]=r,n[7]=i,n[8]=a,n[9]=l,n[10]=c):c=n[10],n[11]!==o||n[12]!==e||n[13]!==c?(d=s.jsx("button",{ref:e,className:c,...o,children:o.children}),n[11]=o,n[12]=e,n[13]=c,n[14]=d):d=n[14],d});Pt.displayName="Button",Ke.forwardRef((t,e)=>{const n=U.c(9);let r,i,o,a;return n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]),n[3]!==r?(o=Fn(hc(),r),n[3]=r,n[4]=o):o=n[4],n[5]!==i||n[6]!==e||n[7]!==o?(a=s.jsx("input",{ref:e,className:o,...i}),n[5]=i,n[6]=e,n[7]=o,n[8]=a):a=n[8],a}).displayName="Input";let At=null;class fc{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{At=new WeakRef(this.view)},{signal:this.abortController.signal,capture:!0}),this.update()}update(){const e=this.view.dom.querySelector(".cm-vimCursorLayer");if(e instanceof HTMLElement)if(Cs())e.style.display="none";else{const n=(At==null?void 0:At.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const Ji={map:{args:["lhs","rhs"]},nmap:{mode:"normal",args:["lhs","rhs"]},vmap:{mode:"visual",args:["lhs","rhs"]},imap:{mode:"insert",args:["lhs","rhs"]},noremap:{args:["lhs","rhs"]},nnoremap:{mode:"normal",args:["lhs","rhs"]},vnoremap:{mode:"visual",args:["lhs","rhs"]},inoremap:{mode:"insert",args:["lhs","rhs"]},unmap:{args:["lhs"]},nunmap:{mode:"normal",args:["lhs"]},vunmap:{mode:"visual",args:["lhs"]},iunmap:{mode:"insert",args:["lhs"]},mapclear:{},nmapclear:{mode:"normal"},vmapclear:{mode:"visual"},imapclear:{mode:"insert"}};function pc(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in Ji){const o=Ji[r],a={};for(const c of o.args||[]){if(i+=1,!(i<n.length))return void(e&&e(`Not enough arguments for "${r}" command: "${t}"`));a[c]=n[i]}const l={name:r};return"args"in o&&(l.args=a),"mode"in o&&(l.mode=o.mode),l}e&&e(`Unknown vimrc command: "${t}"`)}var es;const gc=He(()=>{ne.defineAction("goToDefinition",t=>{const e=t.cm6;return Ts(e)}),ne.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),ne.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(ht).saveNotebook()})}),mc=He(async()=>{var n;const t=pt.get(Vn),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{W.log(`Loading vimrc from ${e}`);const r=(await Es().sendFileDetails({path:e})).contents;if(!r)return void W.error(`Failed to load vimrc from ${e}`);const i=function(o,a){const l=[];for(const c of o.split(`
|
17
|
-
`)){if(c.startsWith('"')||c.trim()==="")continue;const d=pc(c,a);d&&l.push(d)}return l}(r,W.warn);(function(o){function a(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ne.map(u.args.lhs,u.args.rhs,u.mode):ne.map(u.args.lhs,u.args.rhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function l(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ne.noremap(u.args.lhs,u.args.rhs,u.mode):ne.noremap(u.args.lhs,u.args.rhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function c(u){u.args&&u.args.lhs?u.mode?ne.unmap(u.args.lhs,u.mode):ne.unmap(u.args.lhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function d(u){u.mode?ne.mapclear(u.mode):ne.mapclear()}for(const u of o)"map|nmap|vmap|imap".split("|").includes(u.name)?a(u):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(u.name)?l(u):"unmap|nunmap|vunmap|iunmap".split("|").includes(u.name)?c(u):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(u.name)?d(u):W.warn(`Could not execute vimrc command "${u.name}: unknown command"`)})(i)}catch(r){W.error("Failed to load vimrc:",r)}});class Mt{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=ft(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Ft("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):W.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){Ft("exitInsertMode"in ne,"Vim does not have an exitInsertMode method"),Ft("exitVisualMode"in ne,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=ft(i);if(!o){W.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!ts(o)){W.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&ne.exitInsertMode(o,!0),l.visualMode&&ne.exitVisualMode(o,!0);break;case"insert":l.insertMode||ne.handleKey(o,"i","")}o.setSelections=a}}}function ts(t){return t.state.vim!==void 0}es=Mt,Mt.INSTANCES=new es;const vc=["default","vim"];function yc(t,e){switch(t.preset){case"default":return[xe.of(ns()),xe.of(rs(e)),Ht.low(xe.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[xe.of(bc()),xe.of(rs(e)),xe.of([{key:"Enter",run:n=>{var i;const r=ft(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&As(n)}}]),Ht.high(jc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(ht).deleteCell(),!0):!1)),Ps({status:!1}),Ht.high((gc(),mc(),[xe.of([{key:"j",run:n=>{if(Ns(n,!0)&&Un(n)){const r=n.state.facet(ht),i=n.state.facet(Bn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),xe.of([{key:"k",run:n=>{if(Ds(n)&&Un(n)){const r=n.state.facet(ht),i=n.state.facet(Bn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),xe.of([{linux:"Ctrl-[",win:"Ctrl-[",run:n=>{const r=ft(n);return r?ts(r)?!!r.state.vim.insertMode&&(ne.exitInsertMode(r,!0),!0):(W.warn("Expected CodeMirror instance to have Vim state"),!1):(W.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),Hn.define(n=>(requestAnimationFrame(()=>{Mt.INSTANCES.addInstance(n)}),{destroy(){Mt.INSTANCES.removeInstance(n)}})),Hn.define(n=>new fc({view:n}))]))];default:return _s(t.preset),[]}}const xc=new Set([qn,Wn]),ns=He(()=>Ms.filter(t=>!xc.has(t.run))),rs=t=>[{key:t.getHotkey("cell.toggleComment").key,run:qn},{key:t.getHotkey("cell.toggleBlockComment").key,run:Wn}],bc=He(()=>{const t=new Set(["Enter","Ctrl-v"]);return ns().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function jc(t,e,n){let r="",i=0;return xe.of([{any:(o,a)=>{const l=a.key,c=a.timeStamp;return l!==t||!e(o)?(r="",i=0,!1):r===t&&c-i<500&&n(o)?(r="",i=0,!0):(r=l,i=c,!1)}}])}const Tn=Ye(!1),wc=()=>{const t=U.c(82),[e,n]=Xe(Tn),[r,i]=I.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[a,l]=I.useState(o),[c,d]=Gn(),u=gt(Rs),{saveUserConfig:g}=ze();let f,m;t[1]!==n?(f=()=>n(Ic),t[1]=n,t[2]=f):f=t[2],Ls("global.showHelp",f),t[3]!==c||t[4]!==g||t[5]!==d?(m=async ke=>{const re={...c};d(ke),await g({config:ke}).catch(X=>{throw d(re),X})},t[3]=c,t[4]=g,t[5]=d,t[6]=m):m=t[6];const h=m;let p;t[7]!==c||t[8]!==r||t[9]!==h?(p=async ke=>{if(!r)return;const re=ke.join("-"),X={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:re}}};i(null),l([]),await h(X)},t[7]=c,t[8]=r,t[9]=h,t[10]=p):p=t[10];const v=p;let x,b,j;if(t[11]!==c||t[12]!==r||t[13]!==v||t[14]!==u||t[15]!==e||t[16]!==a||t[17]!==h){j=Symbol.for("react.early_return_sentinel");{const ke=async()=>{if(!r)return;const X={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete X.keymap.overrides[r],i(null),l([]),await h(X)};let re;t[21]!==c||t[22]!==h?(re=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const X={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await h(X)},t[21]=c,t[22]=h,t[23]=re):re=t[23],x=re,e?b=X=>{const me=u.getHotkey(X);if(r===X){const dt=zs(X);return s.jsxs("div",{children:[s.jsx(Oe,{defaultValue:a.join("+"),placeholder:me.name,onKeyDown:le=>{le.preventDefault();const Ce=[];if(le.key==="Meta"||le.key==="Control"||le.key==="Alt"||le.key==="Shift"||(le.metaKey&&Ce.push($n()?"Cmd":"Meta"),le.ctrlKey&&Ce.push("Ctrl"),le.altKey&&Ce.push("Alt"),le.shiftKey&&Ce.push("Shift"),le.key==="-"))return;if(le.key==="Escape"&&Ce.length===0)return i(null),void l([]);let Pn=le.key.toLowerCase();le.key===" "&&(Pn="Space"),Ce.push(Pn),v(Ce)},autoFocus:!0,endAdornment:s.jsx(ue,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(mt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),dt.key!==me.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:ke,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:dt.key})]})]})]},X)}return s.jsxs("div",{className:"grid grid-cols-[auto_2fr_3fr] gap-2 items-center",children:[u.isEditable(X)?s.jsx(Yn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(X)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx(Kn,{className:"justify-end",shortcut:me.key}),s.jsx("span",{children:me.name.toLowerCase()})]},X)}:j=null}t[11]=c,t[12]=r,t[13]=v,t[14]=u,t[15]=e,t[16]=a,t[17]=h,t[18]=x,t[19]=b,t[20]=j}else x=t[18],b=t[19],j=t[20];if(j!==Symbol.for("react.early_return_sentinel"))return j;const S=b;let w,C,N,T,L,z,V,$,G,q,J,Y,ee,ae,k,y,O,we,ye,Ie,Ae,Me,Re,Le,ct;if(t[24]!==c.keymap.preset||t[25]!==u||t[26]!==e||t[27]!==S||t[28]!==n){const ke=u.getHotkeyGroups(),re=(me,dt)=>{const le=ke[me];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:me}),dt]}),le.map(S)]})},X=me=>re(me,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",c.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx(Kn,{shortcut:$n()?"Cmd":"Ctrl"}),s.jsx(K,{children:"Esc"})]}):s.jsx(K,{children:"Esc"})," ","in a cell to enter command mode"]}));N=Ut,ee=e,t[47]!==n?(ae=me=>n(me),t[47]=n,t[48]=ae):ae=t[48],C=Fs,J="sm:items-center sm:top-0",t[49]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(Hs,{}),t[49]=Y):Y=t[49],w=Xn,$=!1,G="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[50]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Us,{children:s.jsx(Bs,{children:"Shortcuts"})}),t[50]=q):q=t[50],z="flex flex-row gap-3",V=s.jsxs("div",{className:"w-1/2",children:[re("Editing"),re("Markdown")]}),k="w-1/2",y=re("Navigation"),O=re("Running Cells"),we=re("Creation and Ordering"),T=X("Command"),L=re("Other"),t[24]=c.keymap.preset,t[25]=u,t[26]=e,t[27]=S,t[28]=n,t[29]=w,t[30]=C,t[31]=N,t[32]=T,t[33]=L,t[34]=z,t[35]=V,t[36]=$,t[37]=G,t[38]=q,t[39]=J,t[40]=Y,t[41]=ee,t[42]=ae,t[43]=k,t[44]=y,t[45]=O,t[46]=we}else w=t[29],C=t[30],N=t[31],T=t[32],L=t[33],z=t[34],V=t[35],$=t[36],G=t[37],q=t[38],J=t[39],Y=t[40],ee=t[41],ae=t[42],k=t[43],y=t[44],O=t[45],we=t[46];return t[51]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[51]=ye):ye=t[51],t[52]!==x?(Ie=s.jsx(ue,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:x,tabIndex:-1,children:ye}),t[52]=x,t[53]=Ie):Ie=t[53],t[54]!==T||t[55]!==L||t[56]!==Ie||t[57]!==k||t[58]!==y||t[59]!==O||t[60]!==we?(Ae=s.jsxs("div",{className:k,children:[y,O,we,T,L,Ie]}),t[54]=T,t[55]=L,t[56]=Ie,t[57]=k,t[58]=y,t[59]=O,t[60]=we,t[61]=Ae):Ae=t[61],t[62]!==z||t[63]!==V||t[64]!==Ae?(Me=s.jsxs("div",{className:z,children:[V,Ae]}),t[62]=z,t[63]=V,t[64]=Ae,t[65]=Me):Me=t[65],t[66]!==w||t[67]!==$||t[68]!==G||t[69]!==q||t[70]!==Me?(Re=s.jsxs(w,{usePortal:$,className:G,children:[q,Me]}),t[66]=w,t[67]=$,t[68]=G,t[69]=q,t[70]=Me,t[71]=Re):Re=t[71],t[72]!==C||t[73]!==J||t[74]!==Y||t[75]!==Re?(Le=s.jsxs(C,{className:J,children:[Y,Re]}),t[72]=C,t[73]=J,t[74]=Y,t[75]=Re,t[76]=Le):Le=t[76],t[77]!==N||t[78]!==ee||t[79]!==ae||t[80]!==Le?(ct=s.jsx(N,{open:ee,onOpenChange:ae,children:Le}),t[77]=N,t[78]=ee,t[79]=ae,t[80]=Le,t[81]=ct):ct=t[81],ct};function Ic(t){return!t}var Sc=Vs();const is="marimo:copilot:signedIn",ss=Gs(is,null,void 0,{getOnInit:!0}),os=Ye(null),Rt=Ye(null);function as(){const t=localStorage.getItem(is)==="true",e=qs();return t&&e.completion.copilot==="github"}const ge=W.get("@github/copilot-language-server");class kc extends Ks{constructor(...e){super(...e),this.documentVersion=0,this.hasOpenedDocument=!1,this.getCompletionInternal=async(n,r)=>await this._request("textDocument/inlineCompletion",{...n,textDocument:{...n.textDocument,version:r}}),this.throttledGetCompletionInternal=function(n,r,i){var o=!0,a=!0;if(typeof n!="function")throw new TypeError("Expected a function");return bs(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),js(n,r,{leading:o,maxWait:r,trailing:a})}(this.getCompletionInternal,200)}async _request(e,n){try{return await this.request(e,n)}catch(r){throw ge.error("#request: Error",r),r}}async notify(e,n){return ge.debug("#notify",e,n),super.notify(e,n)}getInitializationOptions(){const e={name:"marimo",version:"0.1.0"};return{...super.getInitializationOptions(),workspaceFolders:[],capabilities:{workspace:{workspaceFolders:!1}},initializationOptions:{editorInfo:e,editorPluginInfo:e}}}isDisabled(){return!as()}async textDocumentDidOpen(e){return this.isDisabled()?e:(this.hasOpenedDocument=!0,super.textDocumentDidOpen(e))}async textDocumentCompletion(e){return[]}async textDocumentDidChange(e){if(this.isDisabled())return e;this.hasOpenedDocument||await this.textDocumentDidOpen({textDocument:{uri:e.textDocument.uri,languageId:"python",version:e.textDocument.version,text:e.contentChanges[0].text}});const n=e.contentChanges;n.length!==1&&ge.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&ge.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=$s(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:Ys.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){ge.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return ge.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw ge.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){ge.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return ge.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw ge.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return ge.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw ge.warn("#signedIn: Failed to check sign-in status",e),e}}async getCompletion(e){if(this.isDisabled())return null;const n=this.documentVersion;if(e.textDocument.version=n,n===0)return null;var r;r=n,pt.set(Rt,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,pt.get(Rt)===o&&pt.set(Rt,null),n!==this.documentVersion?null:i??null}}const ls="/__marimo_copilot__.py",cs=`file://${ls}`,Oc=He(()=>new Cc);class Cc extends Sc.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return Qs().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new Zs.WebSocketTransport(this.getWsUrl())),await this.delegate.connect(),void W.log("Copilot#connect: Connected successfully")}catch(i){if(W.warn(`Copilot#connect: Connection attempt ${r}/${e} failed`,i),r===e)throw this.delegate=void 0,Fe({variant:"danger",title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Please check settings and try again."}),i;await new Promise(o=>setTimeout(o,n))}}async connect(){return await Ws(Vn,e=>e.completion.copilot==="github"),await Js(),this.tryConnect()}close(){var e;(e=this.delegate)==null||e.close(),this.delegate=void 0}async sendData(e,n){var r;return n=Math.min(n??5e3,5e3),(r=this.delegate)==null?void 0:r.sendData(e,n)}}const st=He(()=>new kc({rootUri:cs,workspaceFolders:null,transport:Oc()}));function Nc(){return Xs({documentUri:cs,client:st(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const ds=I.memo(()=>{const[t,e]=Xe(ss),[n,r]=Xe(os),[i,o]=I.useState(),[a,l]=I.useState(!1),c=async g=>{g.preventDefault(),l(!0);try{const{verificationUri:f,status:m,userCode:h}=await async function(){return await st().signInInitiate()}();fs(m)?e(!0):(r("signingIn"),o({url:f,code:h}))}finally{l(!1)}},d=async g=>{if(g.preventDefault(),i){l(!0);try{const f=await async function(m){const h=st();try{W.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:p}=await h.signInConfirm({userCode:m});return fs(p)?(W.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(W.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:p}),{success:!1})}catch(p){return hs(p)?(W.error("Copilot#tryFinishSignIn: Connection error during sign-in",p),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<us;x++)try{if(await new Promise(b=>setTimeout(b,Dc)),await v.signedIn())return W.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(b){if(W.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:us}),hs(b))return{success:!1,error:"connection"}}return W.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(h)}}(i.code);f.success?(e(!0),r("signedIn")):f.error==="connection"?(r("connectionError"),Fe({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:s.jsx(ue,{onClick:c,children:"Retry"})})):r("signInFailed")}finally{l(!1)}}},u=async g=>{g.preventDefault(),await async function(){await st().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(vt,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return s.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[s.jsx("li",{children:s.jsxs("div",{className:"flex items-center",children:["Copy this code:",s.jsx("strong",{className:"ml-2",children:i==null?void 0:i.code}),s.jsx(to,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await no(i.code),Fe({description:"Copied to clipboard"}))}})]})}),s.jsxs("li",{children:["Enter the code at this link:",s.jsx("a",{href:i==null?void 0:i.url,target:"_blank",rel:"noreferrer",className:ro({variant:"link",size:"xs"}),children:i==null?void 0:i.url})]}),s.jsxs("li",{children:["Click here when done:",s.jsxs(ue,{size:"xs",onClick:d,className:"ml-1",children:[a&&s.jsx(Qn,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),a?s.jsx(Qn,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return s.jsxs("div",{className:"flex items-center gap-5",children:[s.jsxs(vt,{className:"font-normal flex items-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center bg-(--grass-7) rounded-full p-1 mr-2",children:s.jsx(eo,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(ue,{onClick:u,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(vt,{className:"font-normal flex",children:[s.jsx(mt,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),s.jsx("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(vt,{className:"font-normal flex",children:[s.jsx(mt,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(ie,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});ds.displayName="CopilotConfig";const us=5,Dc=3e3;function hs(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function fs(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}const Tc={openai:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M22.2819%209.8211a5.9847%205.9847%200%200%200-.5157-4.9108%206.0462%206.0462%200%200%200-6.5098-2.9A6.0651%206.0651%200%200%200%204.9807%204.1818a5.9847%205.9847%200%200%200-3.9977%202.9%206.0462%206.0462%200%200%200%20.7427%207.0966%205.98%205.98%200%200%200%20.511%204.9107%206.051%206.051%200%200%200%206.5146%202.9001A5.9847%205.9847%200%200%200%2013.2599%2024a6.0557%206.0557%200%200%200%205.7718-4.2058%205.9894%205.9894%200%200%200%203.9977-2.9001%206.0557%206.0557%200%200%200-.7475-7.0729zm-9.022%2012.6081a4.4755%204.4755%200%200%201-2.8764-1.0408l.1419-.0804%204.7783-2.7582a.7948.7948%200%200%200%20.3927-.6813v-6.7369l2.02%201.1686a.071.071%200%200%201%20.038.052v5.5826a4.504%204.504%200%200%201-4.4945%204.4944zm-9.6607-4.1254a4.4708%204.4708%200%200%201-.5346-3.0137l.142.0852%204.783%202.7582a.7712.7712%200%200%200%20.7806%200l5.8428-3.3685v2.3324a.0804.0804%200%200%201-.0332.0615L9.74%2019.9502a4.4992%204.4992%200%200%201-6.1408-1.6464zM2.3408%207.8956a4.485%204.485%200%200%201%202.3655-1.9728V11.6a.7664.7664%200%200%200%20.3879.6765l5.8144%203.3543-2.0201%201.1685a.0757.0757%200%200%201-.071%200l-4.8303-2.7865A4.504%204.504%200%200%201%202.3408%207.872zm16.5963%203.8558L13.1038%208.364%2015.1192%207.2a.0757.0757%200%200%201%20.071%200l4.8303%202.7913a4.4944%204.4944%200%200%201-.6765%208.1042v-5.6772a.79.79%200%200%200-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759%200%200%200-.7854%200L9.409%209.2297V6.8974a.0662.0662%200%200%201%20.0284-.0615l4.8303-2.7866a4.4992%204.4992%200%200%201%206.6802%204.66zM8.3065%2012.863l-2.02-1.1638a.0804.0804%200%200%201-.038-.0567V6.0742a4.4992%204.4992%200%200%201%207.3757-3.4537l-.142.0805L8.704%205.459a.7948.7948%200%200%200-.3927.6813zm1.0976-2.3654l2.602-1.4998%202.6069%201.4998v2.9994l-2.5974%201.4997-2.6067-1.4997Z'/%3e%3c/svg%3e",anthropic:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAnthropic%3c/title%3e%3cpath%20d='M17.3041%203.541h-3.6718l6.696%2016.918H24Zm-10.6082%200L0%2020.459h3.7442l1.3693-3.5527h7.0052l1.3693%203.5528h3.7442L10.5363%203.5409Zm-.3712%2010.2232%202.2914-5.9456%202.2914%205.9456Z'/%3e%3c/svg%3e",google:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGoogle%3c/title%3e%3cpath%20d='M12.48%2010.92v3.28h7.84c-.24%201.84-.853%203.187-1.787%204.133-1.147%201.147-2.933%202.4-6.053%202.4-4.827%200-8.6-3.893-8.6-8.72s3.773-8.72%208.6-8.72c2.6%200%204.507%201.027%205.907%202.347l2.307-2.307C18.747%201.44%2016.133%200%2012.48%200%205.867%200%20.307%205.387.307%2012s5.56%2012%2012.173%2012c3.573%200%206.267-1.173%208.373-3.36%202.16-2.16%202.84-5.213%202.84-7.667%200-.76-.053-1.467-.173-2.053H12.48z'/%3e%3c/svg%3e",ollama:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOllama%3c/title%3e%3cpath%20d='M16.361%2010.26a.894.894%200%200%200-.558.47l-.072.148.001.207c0%20.193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86%200%200%200%20.517-.436.752.752%200%200%200%20.08-.498c-.064-.453-.33-.782-.724-.897a1.06%201.06%200%200%200-.466%200zm-9.203.005c-.305.096-.533.32-.65.639a1.187%201.187%200%200%200-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894%200%200%200-.565-.472%201.02%201.02%200%200%200-.474.007Zm4.184%202c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365%200%200%200-.175-.48.394.394%200%200%200-.181-.033c-.126%200-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396%200%200%200-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589%201.226-1.787%202.114-.04.176-.045.234-.045.53%200%20.294.005.357.043.524.264%201.16%201.332%202.017%202.714%202.173.3.033%201.596.033%201.896%200%201.11-.125%202.064-.727%202.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523%200-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873%206.873%200%200%200-.855-.031zm.645.937a3.283%203.283%200%200%201%201.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115%203.115%200%200%201-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46%201.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653%201.653%200%200%200-.683.298C5.617.74%205.173%201.666%204.985%202.819c-.07.436-.119%201.04-.119%201.503%200%20.544.064%201.24.155%201.721.02.107.031.202.023.208a8.12%208.12%200%200%201-.187.152%205.324%205.324%200%200%200-.949%201.02%205.49%205.49%200%200%200-.94%202.339%206.625%206.625%200%200%200-.023%201.357c.091.78.325%201.438.727%202.04l.13.195-.037.064c-.269.452-.498%201.105-.605%201.732-.084.496-.095.629-.095%201.294%200%20.67.009.803.088%201.266.095.555.288%201.143.503%201.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405%207.405%200%200%200-.548%201.873c-.062.417-.071.552-.071.991%200%20.56.031.832.148%201.279L3.42%2024h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915%200%200%200-.194-.25%201.74%201.74%200%200%201-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787%200%200%200%20.223-.531c0-.195-.07-.355-.224-.522a3.136%203.136%200%200%201-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814%201.353-1.336%202.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467%201.352-.561.17-.035.25-.04.569-.04.319%200%20.398.005.569.04a4.07%204.07%200%200%201%201.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016%201.144.23%202.14%201.173%202.581%202.437.385%201.108.276%202.267-.296%203.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001%201.053.493.539.801%201.866.708%203.036-.062.772-.26%201.463-.533%201.854a2.096%202.096%200%200%201-.224.258.916.916%200%200%200-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498%201.295.253%201.008.231%202.01-.059%202.581a.845.845%200%200%200-.044.098c0%20.006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016%200-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378%200-1.628-.083-.645-.182-1.082-.348-1.525a6.083%206.083%200%200%200-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625%206.625%200%200%200-.024-1.358%205.512%205.512%200%200%200-.939-2.339%205.325%205.325%200%200%200-.95-1.02%208.097%208.097%200%200%201-.186-.152.692.692%200%200%201%20.023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8%201.205-2.116%203.01a6.805%206.805%200%200%200-.097.726c0%20.036-.007.066-.015.066a.96.96%200%200%201-.149-.078A4.857%204.857%200%200%200%2012%203.03c-.832%200-1.687.243-2.456.698a.958.958%200%200%201-.148.078c-.008%200-.015-.03-.015-.066a6.71%206.71%200%200%200-.097-.725C8.997%201.392%208.337.319%207.46.048a2.096%202.096%200%200%200-.585-.041Zm.293%201.402c.248.197.523.759.682%201.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102%201.24l.002.475-.12.175-.118.178h-.278c-.324%200-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438%208.438%200%200%201%20.016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36%202.028.212%203.145-.019.14-.024.151-.057.144l-.238-.06a3.693%203.693%200%200%200-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z'/%3e%3c/svg%3e",azure:"data:image/svg+xml,%3csvg%20width='150'%20height='150'%20viewBox='0%200%2096%2096'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='e399c19f-b68f-429d-b176-18c2117ff73c'%20x1='-1032.172'%20x2='-1059.213'%20y1='145.312'%20y2='65.426'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23114a8b'/%3e%3cstop%20offset='1'%20stop-color='%230669bc'/%3e%3c/linearGradient%3e%3clinearGradient%20id='ac2a6fc2-ca48-4327-9a3c-d4dcc3256e15'%20x1='-1023.725'%20x2='-1029.98'%20y1='108.083'%20y2='105.968'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-opacity='.3'/%3e%3cstop%20offset='.071'%20stop-opacity='.2'/%3e%3cstop%20offset='.321'%20stop-opacity='.1'/%3e%3cstop%20offset='.623'%20stop-opacity='.05'/%3e%3cstop%20offset='1'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='a7fee970-a784-4bb1-af8d-63d18e5f7db9'%20x1='-1027.165'%20x2='-997.482'%20y1='147.642'%20y2='68.561'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%233ccbf4'/%3e%3cstop%20offset='1'%20stop-color='%232892df'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20fill='url(%23e399c19f-b68f-429d-b176-18c2117ff73c)'%20d='M33.338%206.544h26.038l-27.03%2080.087a4.152%204.152%200%200%201-3.933%202.824H8.149a4.145%204.145%200%200%201-3.928-5.47L29.404%209.368a4.152%204.152%200%200%201%203.934-2.825z'/%3e%3cpath%20fill='%230078d4'%20d='M71.175%2060.261h-41.29a1.911%201.911%200%200%200-1.305%203.309l26.532%2024.764a4.171%204.171%200%200%200%202.846%201.121h23.38z'/%3e%3cpath%20fill='url(%23ac2a6fc2-ca48-4327-9a3c-d4dcc3256e15)'%20d='M33.338%206.544a4.118%204.118%200%200%200-3.943%202.879L4.252%2083.917a4.14%204.14%200%200%200%203.908%205.538h20.787a4.443%204.443%200%200%200%203.41-2.9l5.014-14.777%2017.91%2016.705a4.237%204.237%200%200%200%202.666.972H81.24L71.024%2060.261l-29.781.007L59.47%206.544z'/%3e%3cpath%20fill='url(%23a7fee970-a784-4bb1-af8d-63d18e5f7db9)'%20d='M66.595%209.364a4.145%204.145%200%200%200-3.928-2.82H33.648a4.146%204.146%200%200%201%203.928%202.82l25.184%2074.62a4.146%204.146%200%200%201-3.928%205.472h29.02a4.146%204.146%200%200%200%203.927-5.472z'/%3e%3c/svg%3e",bedrock:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20y='0'%20x='0'%20id='Layer_1'%20version='1.1'%20viewBox='0%200%20300.67%20179.8'%3e%3cstyle%20id='style1855'%20type='text/css'%3e.st1{fill-rule:evenodd;clip-rule:evenodd;fill:%23f90}%3c/style%3e%3cg%20transform='translate(-1.668%20-1.1)'%20id='g1865'%3e%3cpath%20id='path1857'%20d='M86.4%2066.4c0%203.7.4%206.7%201.1%208.9.8%202.2%201.8%204.6%203.2%207.2.5.8.7%201.6.7%202.3%200%201-.6%202-1.9%203L83.2%2092c-.9.6-1.8.9-2.6.9-1%200-2-.5-3-1.4-1.4-1.5-2.6-3.1-3.6-4.7-1-1.7-2-3.6-3.1-5.9-7.8%209.2-17.6%2013.8-29.4%2013.8-8.4%200-15.1-2.4-20-7.2-4.9-4.8-7.4-11.2-7.4-19.2%200-8.5%203-15.4%209.1-20.6%206.1-5.2%2014.2-7.8%2024.5-7.8%203.4%200%206.9.3%2010.6.8%203.7.5%207.5%201.3%2011.5%202.2v-7.3c0-7.6-1.6-12.9-4.7-16-3.2-3.1-8.6-4.6-16.3-4.6-3.5%200-7.1.4-10.8%201.3-3.7.9-7.3%202-10.8%203.4-1.6.7-2.8%201.1-3.5%201.3-.7.2-1.2.3-1.6.3-1.4%200-2.1-1-2.1-3.1v-4.9c0-1.6.2-2.8.7-3.5.5-.7%201.4-1.4%202.8-2.1%203.5-1.8%207.7-3.3%2012.6-4.5C41%201.9%2046.2%201.3%2051.7%201.3c11.9%200%2020.6%202.7%2026.2%208.1%205.5%205.4%208.3%2013.6%208.3%2024.6v32.4zM45.8%2081.6c3.3%200%206.7-.6%2010.3-1.8%203.6-1.2%206.8-3.4%209.5-6.4%201.6-1.9%202.8-4%203.4-6.4.6-2.4%201-5.3%201-8.7v-4.2c-2.9-.7-6-1.3-9.2-1.7-3.2-.4-6.3-.6-9.4-.6-6.7%200-11.6%201.3-14.9%204-3.3%202.7-4.9%206.5-4.9%2011.5%200%204.7%201.2%208.2%203.7%2010.6%202.4%202.5%205.9%203.7%2010.5%203.7zm80.3%2010.8c-1.8%200-3-.3-3.8-1-.8-.6-1.5-2-2.1-3.9L96.7%2010.2c-.6-2-.9-3.3-.9-4%200-1.6.8-2.5%202.4-2.5h9.8c1.9%200%203.2.3%203.9%201%20.8.6%201.4%202%202%203.9l16.8%2066.2%2015.6-66.2c.5-2%201.1-3.3%201.9-3.9.8-.6%202.2-1%204-1h8c1.9%200%203.2.3%204%201%20.8.6%201.5%202%201.9%203.9l15.8%2067%2017.3-67c.6-2%201.3-3.3%202-3.9.8-.6%202.1-1%203.9-1h9.3c1.6%200%202.5.8%202.5%202.5%200%20.5-.1%201-.2%201.6-.1.6-.3%201.4-.7%202.5l-24.1%2077.3c-.6%202-1.3%203.3-2.1%203.9-.8.6-2.1%201-3.8%201h-8.6c-1.9%200-3.2-.3-4-1-.8-.7-1.5-2-1.9-4L156%2023l-15.4%2064.4c-.5%202-1.1%203.3-1.9%204-.8.7-2.2%201-4%201zm128.5%202.7c-5.2%200-10.4-.6-15.4-1.8-5-1.2-8.9-2.5-11.5-4-1.6-.9-2.7-1.9-3.1-2.8-.4-.9-.6-1.9-.6-2.8v-5.1c0-2.1.8-3.1%202.3-3.1.6%200%201.2.1%201.8.3.6.2%201.5.6%202.5%201%203.4%201.5%207.1%202.7%2011%203.5%204%20.8%207.9%201.2%2011.9%201.2%206.3%200%2011.2-1.1%2014.6-3.3%203.4-2.2%205.2-5.4%205.2-9.5%200-2.8-.9-5.1-2.7-7-1.8-1.9-5.2-3.6-10.1-5.2L246%2052c-7.3-2.3-12.7-5.7-16-10.2-3.3-4.4-5-9.3-5-14.5%200-4.2.9-7.9%202.7-11.1%201.8-3.2%204.2-6%207.2-8.2%203-2.3%206.4-4%2010.4-5.2%204-1.2%208.2-1.7%2012.6-1.7%202.2%200%204.5.1%206.7.4%202.3.3%204.4.7%206.5%201.1%202%20.5%203.9%201%205.7%201.6%201.8.6%203.2%201.2%204.2%201.8%201.4.8%202.4%201.6%203%202.5.6.8.9%201.9.9%203.3v4.7c0%202.1-.8%203.2-2.3%203.2-.8%200-2.1-.4-3.8-1.2-5.7-2.6-12.1-3.9-19.2-3.9-5.7%200-10.2.9-13.3%202.8-3.1%201.9-4.7%204.8-4.7%208.9%200%202.8%201%205.2%203%207.1%202%201.9%205.7%203.8%2011%205.5l14.2%204.5c7.2%202.3%2012.4%205.5%2015.5%209.6%203.1%204.1%204.6%208.8%204.6%2014%200%204.3-.9%208.2-2.6%2011.6-1.8%203.4-4.2%206.4-7.3%208.8-3.1%202.5-6.8%204.3-11.1%205.6-4.5%201.4-9.2%202.1-14.3%202.1z'%20fill='%23252f3e'/%3e%3cg%20id='g1863'%3e%3cpath%20id='path1859'%20d='M273.5%20143.7c-32.9%2024.3-80.7%2037.2-121.8%2037.2-57.6%200-109.5-21.3-148.7-56.7-3.1-2.8-.3-6.6%203.4-4.4%2042.4%2024.6%2094.7%2039.5%20148.8%2039.5%2036.5%200%2076.6-7.6%20113.5-23.2%205.5-2.5%2010.2%203.6%204.8%207.6z'%20class='st1'/%3e%3cpath%20id='path1861'%20d='M287.2%20128.1c-4.2-5.4-27.8-2.6-38.5-1.3-3.2.4-3.7-2.4-.8-4.5%2018.8-13.2%2049.7-9.4%2053.3-5%203.6%204.5-1%2035.4-18.6%2050.2-2.7%202.3-5.3%201.1-4.1-1.9%204-9.9%2012.9-32.2%208.7-37.5z'%20class='st1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e"},Ec=t=>{const e=U.c(15);let n,r,i;e[0]!==t?({provider:r,className:i,...n}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);const o=i===void 0?"":i;if(r==="openai-compatible"){let d,u;return e[4]!==o?(d=$e("h-4 w-4",o),e[4]=o,e[5]=d):d=e[5],e[6]!==d?(u=s.jsx(Po,{className:d}),e[6]=d,e[7]=u):u=e[7],u}const a=Tc[r];let l,c;return e[8]!==o?(l=$e("h-4 w-4 grayscale dark:invert",o),e[8]=o,e[9]=l):l=e[9],e[10]!==a||e[11]!==n||e[12]!==r||e[13]!==l?(c=s.jsx("img",{src:a,alt:r,className:l,...n}),e[10]=a,e[11]=n,e[12]=r,e[13]=l,e[14]=c):c=e[14],c},ps=["anthropic/claude-opus-4-1-20250805","anthropic/claude-opus-4-20250514","anthropic/claude-sonnet-4-20250514","anthropic/claude-3-7-sonnet-latest","anthropic/claude-3-5-sonnet-latest","anthropic/claude-3-5-haiku-latest","deepseek/deepseek-v3","deepseek/deepseek-r1","google/gemini-2.5-flash-preview-05-20","google/gemini-2.5-pro-preview-06-05","google/gemini-2.0-flash","google/gemini-2.0-flash-lite","openai/o3","openai/o4-mini","openai/gpt-4.5-preview","openai/gpt-4.1","openai/gpt-4o","openai/gpt-3.5-turbo","bedrock/anthropic.claude-3-5-haiku-20241022-v1:0","bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0","bedrock/anthropic.claude-3-7-sonnet-20250219-v1:0","bedrock/meta.llama3-3-70b-instruct-v1:0","bedrock/cohere.command-r-plus-v1"],_c=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"];class zt{constructor(e,n){this.providerId=void 0,this.shortModelId=void 0,this.providerId=e,this.shortModelId=n}get id(){return`${this.providerId}/${this.shortModelId}`}static parse(e){if(!e.includes("/")){const i=function(o){return o.startsWith("gpt")||o.startsWith("o3")||o.startsWith("o1")?"openai":o.startsWith("claude")?"anthropic":o.startsWith("gemini")||o.startsWith("google")?"google":"ollama"}(e);return new zt(i,e)}const[n,...r]=e.split("/");return new zt(n,r.join("/"))}}const Pc=t=>{const e=U.c(11),{value:n}=t;if(!n||n.includes("/"))return null;let r;e[0]!==n?(r=zt.parse(n),e[0]=n,e[1]=r):r=e[1];const i=r.id;let o,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("code",{className:"font-bold",children:"provider/model"}),e[2]=o):o=e[2],e[3]!==n?(a=s.jsxs("span",{children:["Model id should be in the form"," ",o,". ",n," is missing a provider."]}),e[3]=n,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("br",{}),e[5]=l):l=e[5],e[6]!==i?(c=i&&s.jsxs("span",{children:["Did you mean ",s.jsx("code",{className:"font-bold",children:i}),"?"]}),e[6]=i,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=s.jsxs(yt,{kind:"danger",className:"mt-1",children:[a,l,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d};function gs(t,e){const n=U.c(10);let r;n[0]!==e||n[1]!==t?(r=Zn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=gt(io);let a;n[3]!==e||n[4]!==o?(a=Zn(o,e),n[3]=e,n[4]=o,n[5]=a):a=n[5];const l=a,c=l!=null&&i!==l;let d;return n[6]!==i||n[7]!==c||n[8]!==l?(d={isOverridden:c,currentValue:i,overriddenValue:l},n[6]=i,n[7]=c,n[8]=l,n[9]=d):d=n[9],d}const Ac=t=>{const e=U.c(3),{name:n,children:r}=t,[i]=Jn(),{isOverridden:o}=gs(i,n);let a;return e[0]!==r||e[1]!==o?(a=o?s.jsx(Qe,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(K,{className:"inline mx-px",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(K,{className:"inline mx-px",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=a):a=e[2],a},H=t=>{const e=U.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:a}=gs(n,r);if(!i)return null;let l,c,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(K,{className:"inline",children:"pyproject.toml"}),"."]}),c=s.jsx("br",{}),e[0]=l,e[1]=c):(l=e[0],c=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("span",{children:["Edit the ",s.jsx(K,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),u=s.jsx("br",{}),e[2]=d,e[3]=u):(d=e[2],u=e[3]);const g=String(o);let f,m;e[4]!==g?(f=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:g})]}),e[4]=g,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("br",{}),e[6]=m):m=e[6];const h=String(a);let p,v,x;e[7]!==h?(p=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:h})]}),e[7]=h,e[8]=p):p=e[8],e[9]!==f||e[10]!==p?(v=s.jsxs(s.Fragment,{children:[l,c,d,u,f,m,p]}),e[9]=f,e[10]=p,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(cr,{className:"w-3 h-3"}),e[12]=x):x=e[12];const b=String(a);let j,S;return e[13]!==b?(j=s.jsxs("span",{className:"text-(--amber-12) text-xs flex items-center gap-1 border rounded px-2 py-1 bg-(--amber-2) border-(--amber-6) ml-1",children:[x,"Overridden by pyproject.toml [",b,"]"]}),e[13]=b,e[14]=j):j=e[14],e[15]!==v||e[16]!==j?(S=s.jsx(Qe,{content:v,children:j}),e[15]=v,e[16]=j,e[17]=S):S=e[17],S},Ge="flex flex-row items-center space-x-1 space-y-0",Mc=t=>{const e=U.c(5),{provider:n,children:r}=t;let i,o;return e[0]!==n?(i=n&&s.jsx(Ec,{provider:n,className:"mr-2"}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex items-center text-base font-semibold",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},_e=t=>{const e=U.c(10),{form:n,config:r,name:i,placeholder:o,testId:a,description:l}=t;let c,d;return e[0]!==r||e[1]!==l||e[2]!==i||e[3]!==o||e[4]!==a?(c=u=>{const{field:g}=u;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"API Key"}),s.jsx(A,{children:s.jsx(Oe,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,...g,value:ot(g.value),onChange:f=>{const m=f.target.value;m.includes("*")||g.onChange(m)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=i,e[3]=o,e[4]=a,e[5]=c):c=e[5],e[6]!==n.control||e[7]!==i||e[8]!==c?(d=s.jsx(_,{control:n.control,name:i,render:c}),e[6]=n.control,e[7]=i,e[8]=c,e[9]=d):d=e[9],d};function ot(t){if(t!=null)return typeof t=="string"?t:String(t)}const at=t=>{const e=U.c(12),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c,defaultValue:d}=t,u=c!==void 0&&c;let g,f;return e[0]!==r||e[1]!==d||e[2]!==l||e[3]!==i||e[4]!==o||e[5]!==a?(g=m=>{const{field:h}=m;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"Base URL"}),s.jsx(A,{children:s.jsx(Oe,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,defaultValue:d,...h,value:ot(h.value)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=d,e[2]=l,e[3]=i,e[4]=o,e[5]=a,e[6]=g):g=e[6],e[7]!==u||e[8]!==n.control||e[9]!==i||e[10]!==g?(f=s.jsx(_,{control:n.control,name:i,disabled:u,render:g}),e[7]=u,e[8]=n.control,e[9]=i,e[10]=g,e[11]=f):f=e[11],f},ms=t=>{const e=U.c(12),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c}=t,d=c!==void 0&&c,u=I.useId();let g,f;return e[0]!==r||e[1]!==l||e[2]!==u||e[3]!==i||e[4]!==o||e[5]!==a?(g=m=>{const{field:h}=m;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"Model"}),s.jsx(A,{children:s.jsx(Oe,{list:u,"data-testid":a,className:"m-0 inline-flex",placeholder:o,...h,value:ot(h.value)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),s.jsx("datalist",{id:u,children:ps.map(Uc)}),s.jsx(Pc,{value:ot(h.value)}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=u,e[3]=i,e[4]=o,e[5]=a,e[6]=g):g=e[6],e[7]!==d||e[8]!==n.control||e[9]!==i||e[10]!==g?(f=s.jsx(_,{control:n.control,name:i,disabled:d,render:g}),e[7]=d,e[8]=n.control,e[9]=i,e[10]=g,e[11]=f):f=e[11],f},Rc=t=>{const e=U.c(10),{form:n,config:r,name:i,options:o,testId:a,disabled:l}=t,c=l!==void 0&&l;let d,u;return e[0]!==r||e[1]!==i||e[2]!==o||e[3]!==a?(d=g=>{const{field:f}=g;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"Provider"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":a,onChange:m=>{m.target.value==="none"?f.onChange(!1):f.onChange(m.target.value)},value:ot(f.value===!0?"github":f.value===!1?"none":f.value),disabled:f.disabled,className:"inline-flex mr-2",children:o.map(Bc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]})})},e[0]=r,e[1]=i,e[2]=o,e[3]=a,e[4]=d):d=e[4],e[5]!==c||e[6]!==n.control||e[7]!==i||e[8]!==d?(u=s.jsx(_,{control:n.control,name:i,disabled:c,render:d}),e[5]=c,e[6]=n.control,e[7]=i,e[8]=d,e[9]=u):u=e[9],u},En=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"flex flex-col gap-4 pb-4",children:n}),e[0]=n,e[1]=r):r=e[1],r},Lc=t=>{const e=U.c(10),{form:n,config:r}=t;let i,o,a,l,c,d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Et,{children:"Code Completion"}),o=s.jsx("p",{className:"text-sm text-muted-secondary",children:"Choose GitHub Copilot, Codeium, or a custom provider (such as Ollama) to enable AI-powered code completion."}),e[0]=i,e[1]=o):(i=e[0],o=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["none","github","codeium","custom"],e[2]=a):a=e[2],e[3]!==r||e[4]!==n?(l=s.jsx(Rc,{form:n,config:r,name:"completion.copilot",options:a,testId:"copilot-select"}),c=((u,g)=>{const f=u.getValues("completion.copilot");return f===!1?null:f==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(_e,{form:u,config:g,name:"completion.codeium_api_key",placeholder:"key",testId:"codeium-api-key-input"})]}):f==="github"?s.jsx(ds,{}):f==="custom"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"Configure your custom AI completion provider with the following settings."}),s.jsx(ms,{form:u,config:g,name:"completion.model",placeholder:"Qwen2.5-Coder-7B",testId:"custom-model-input"}),s.jsx(at,{form:u,config:g,name:"completion.base_url",placeholder:"http://localhost:11434/v1",testId:"custom-base-url-input"}),s.jsx(_e,{form:u,config:g,name:"completion.api_key",placeholder:"key",testId:"custom-api-key-input"})]}):void 0})(n,r),e[3]=r,e[4]=n,e[5]=l,e[6]=c):(l=e[5],c=e[6]),e[7]!==l||e[8]!==c?(d=s.jsxs(En,{children:[i,o,l,c]}),e[7]=l,e[8]=c,e[9]=d):d=e[9],d},Pe=t=>{const e=U.c(12),{title:n,triggerClassName:r,provider:i,children:o}=t;let a,l,c,d;return e[0]!==i||e[1]!==n?(a=s.jsx(Mc,{provider:i,children:n}),e[0]=i,e[1]=n,e[2]=a):a=e[2],e[3]!==a||e[4]!==r?(l=s.jsx(ao,{className:r,children:a}),e[3]=a,e[4]=r,e[5]=l):l=e[5],e[6]!==o?(c=s.jsx(lo,{wrapperClassName:"flex flex-col gap-4",children:o}),e[6]=o,e[7]=c):c=e[7],e[8]!==i||e[9]!==l||e[10]!==c?(d=s.jsxs(co,{value:i,children:[l,c]}),e[8]=i,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},zc=t=>{const e=U.c(55),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ne(),e[0]=i):i=e[0];const o=i;let a,l,c,d,u,g,f,m,h,p,v,x,b,j,S,w,C,N,T,L,z,V,$;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(K,{className:"inline",children:"marimo.toml"}),e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add your API keys below or to ",a," ","to set up a provider for the Code Completion and Assistant features; see"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion/#connecting-to-an-llm",children:"docs"})," ","for more info."]}),e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(s.Fragment,{children:["Your OpenAI API key from"," ",s.jsx(ie,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]}),e[3]=c):c=e[3],e[4]!==r||e[5]!==n?(d=s.jsxs(Pe,{title:"OpenAI",provider:"openai",triggerClassName:"pt-0",children:[s.jsx(_e,{form:n,config:r,name:"ai.open_ai.api_key",placeholder:"sk-proj...",testId:"ai-openai-api-key-input",description:c}),s.jsx(at,{form:n,config:r,name:"ai.open_ai.base_url",placeholder:"https://api.openai.com/v1",testId:"ai-base-url-input",disabled:o})]}),e[4]=r,e[5]=n,e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs(s.Fragment,{children:["Your Anthropic API key from"," ",s.jsx(ie,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]}),e[7]=u):u=e[7],e[8]!==r||e[9]!==n?(g=s.jsx(Pe,{title:"Anthropic",provider:"anthropic",children:s.jsx(_e,{form:n,config:r,name:"ai.anthropic.api_key",placeholder:"sk-ant...",testId:"ai-anthropic-api-key-input",description:u})}),e[8]=r,e[9]=n,e[10]=g):g=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(s.Fragment,{children:["Your Google AI API key from"," ",s.jsx(ie,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]}),e[11]=f):f=e[11],e[12]!==r||e[13]!==n?(m=s.jsx(Pe,{title:"Google",provider:"google",children:s.jsx(_e,{form:n,config:r,name:"ai.google.api_key",placeholder:"AI...",testId:"ai-google-api-key-input",description:f})}),e[12]=r,e[13]=n,e[14]=m):m=e[14],e[15]!==r||e[16]!==n?(h=s.jsx(Pe,{title:"Ollama",provider:"ollama",children:s.jsx(at,{form:n,config:r,name:"ai.ollama.base_url",placeholder:"http://localhost:11434/v1",defaultValue:"http://localhost:11434/v1",testId:"ollama-base-url-input"})}),e[15]=r,e[16]=n,e[17]=h):h=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(s.Fragment,{children:["Your Azure API key from"," ",s.jsx(ie,{href:"https://portal.azure.com/",children:"portal.azure.com"}),"."]}),e[18]=p):p=e[18],e[19]!==r||e[20]!==n?(v=s.jsxs(Pe,{title:"Azure",provider:"azure",children:[s.jsx(_e,{form:n,config:r,name:"ai.azure.api_key",placeholder:"sk-proj...",testId:"ai-azure-api-key-input",description:p}),s.jsx(at,{form:n,config:r,name:"ai.azure.base_url",placeholder:"https://<your-resource-name>.openai.azure.com",testId:"ai-azure-base-url-input"})]}),e[19]=r,e[20]=n,e[21]=v):v=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),e[22]=x):x=e[22],e[23]!==r?(b=G=>{const{field:q}=G;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"AWS Region"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"bedrock-region-select",onChange:J=>q.onChange(J.target.value),value:typeof q.value=="string"?q.value:"us-east-1",disabled:q.disabled,className:"inline-flex mr-2",children:_c.map(Vc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.bedrock.region_name"})]}),s.jsx(F,{children:"The AWS region where Bedrock service is available."})]})},e[23]=r,e[24]=b):b=e[24],e[25]!==n.control||e[26]!==b?(j=s.jsx(_,{control:n.control,disabled:o,name:"ai.bedrock.region_name",render:b}),e[25]=n.control,e[26]=b,e[27]=j):j=e[27],e[28]!==r?(S=G=>{const{field:q}=G;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:Ge,children:[s.jsx(D,{children:"AWS Profile Name (Optional)"}),s.jsx(A,{children:s.jsx(Oe,{"data-testid":"bedrock-profile-input",rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:"default",...q,value:q.value||""})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.bedrock.profile_name"})]}),s.jsx(F,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})},e[28]=r,e[29]=S):S=e[29],e[30]!==n.control||e[31]!==S?(w=s.jsx(_,{control:n.control,disabled:o,name:"ai.bedrock.profile_name",render:S}),e[30]=n.control,e[31]=S,e[32]=w):w=e[32],e[33]!==j||e[34]!==w?(C=s.jsxs(Pe,{title:"AWS Bedrock",provider:"bedrock",children:[x,j,w]}),e[33]=j,e[34]=w,e[35]=C):C=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(s.Fragment,{children:"API key for any OpenAI-compatible provider (e.g., Together, Groq, Mistral, Perplexity, etc)."}),e[36]=N):N=e[36],e[37]!==r||e[38]!==n?(T=s.jsx(_e,{form:n,config:r,name:"ai.open_ai_compatible.api_key",placeholder:"sk-...",testId:"ai-openai-compatible-api-key-input",description:N}),e[37]=r,e[38]=n,e[39]=T):T=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(s.Fragment,{children:"Base URL for your OpenAI-compatible provider."}),e[40]=L):L=e[40],e[41]!==r||e[42]!==n?(z=s.jsx(at,{form:n,config:r,name:"ai.open_ai_compatible.base_url",placeholder:"https://api.together.xyz/v1",testId:"ai-openai-compatible-base-url-input",description:L}),e[41]=r,e[42]=n,e[43]=z):z=e[43],e[44]!==T||e[45]!==z?(V=s.jsxs(Pe,{title:"OpenAI-Compatible",provider:"openai-compatible",children:[T,z]}),e[44]=T,e[45]=z,e[46]=V):V=e[46],e[47]!==h||e[48]!==v||e[49]!==C||e[50]!==V||e[51]!==d||e[52]!==g||e[53]!==m?($=s.jsxs(En,{children:[l,s.jsxs(so,{type:"multiple",children:[d,g,m,h,v,C,V]})]}),e[47]=h,e[48]=v,e[49]=C,e[50]=V,e[51]=d,e[52]=g,e[53]=m,e[54]=$):$=e[54],$},Fc=t=>{const e=U.c(15),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ne(),e[0]=i):i=e[0];const o=i;let a,l,c,d,u,g,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Et,{children:"AI Assistant"}),e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Use the Chat panel to talk to your codebase, or make edits using the"," ",s.jsx(K,{className:"inline",children:"Generate with AI"})," button."]}),e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(s.Fragment,{children:[s.jsx("p",{children:'Models should include the provider name and model name separated by a slash. For example, "anthropic/claude-3-7-sonnet-latest" or "google/gemini-2.5-flash-preview-05-20".'}),s.jsx("p",{className:"pt-1",children:"Depending on the provider, we will use the respective API key and additional configuration."})]}),e[3]=c):c=e[3],e[4]!==r||e[5]!==n?(d=s.jsx(ms,{form:n,config:r,name:"ai.open_ai.model",placeholder:"gpt-4-turbo",testId:"ai-model-input",disabled:o,description:c}),e[4]=r,e[5]=n,e[6]=d):d=e[6],e[7]!==r?(u=m=>{const{field:h}=m;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(P,{children:[s.jsx(D,{children:"Custom Rules"}),s.jsx(A,{children:s.jsx(oo,{"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",...h,value:h.value})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.rules"})]}),s.jsx(F,{children:"Custom rules to include in all AI completion prompts."})]})},e[7]=r,e[8]=u):u=e[8],e[9]!==n.control||e[10]!==u?(g=s.jsx(_,{control:n.control,name:"ai.rules",render:u}),e[9]=n.control,e[10]=u,e[11]=g):g=e[11],e[12]!==d||e[13]!==g?(f=s.jsxs(En,{children:[a,l,d,g]}),e[12]=d,e[13]=g,e[14]=f):f=e[14],f},Hc=t=>{const e=U.c(12),{form:n,config:r,onSubmit:i}=t;let o,a,l,c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(er,{className:"mb-2",children:[s.jsx(Bt,{value:"ai-features",children:"AI Features"}),s.jsx(Bt,{value:"ai-providers",children:"AI Providers"})]}),e[0]=o):o=e[0],e[1]!==r||e[2]!==n||e[3]!==i?(a=s.jsxs(tr,{value:"ai-features",children:[s.jsx(Lc,{form:n,config:r,onSubmit:i}),s.jsx(Fc,{form:n,config:r,onSubmit:i})]}),e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],e[5]!==r||e[6]!==n||e[7]!==i?(l=s.jsx(tr,{value:"ai-providers",children:s.jsx(zc,{form:n,config:r,onSubmit:i})}),e[5]=r,e[6]=n,e[7]=i,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(c=s.jsxs(nr,{defaultValue:"ai-features",children:[o,a,l]}),e[9]=a,e[10]=l,e[11]=c):c=e[11],c};function Uc(t){return s.jsx("option",{value:t,children:t},t)}function Bc(t){return s.jsx("option",{value:t,children:t},t)}function Vc(t){return s.jsx("option",{value:t,children:t},t)}const vs=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Ne()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Ne()||vs.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const qc=()=>{const t=U.c(23),[e]=Gn(),n=e.package_management.manager,{getPackageList:r}=ze();let i,o;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1],t[2]!==n?(o=[n],t[2]=n,t[3]=o):o=t[3];const{data:a,error:l,refetch:c,isPending:d}=uo(i,o);if(d){let w;return t[4]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(ir,{size:"medium",centered:!0}),t[4]=w):w=t[4],w}if(l){let w;return t[5]!==l?(w=s.jsx(fo,{error:l}),t[5]=l,t[6]=w):w=t[6],w}let u;t[7]!==(a==null?void 0:a.packages)?(u=(a==null?void 0:a.packages)||[],t[7]=a==null?void 0:a.packages,t[8]=u):u=t[8];const g=u;let f;t[9]!==g?(f=new Set(g.map(Gc)),t[9]=g,t[10]=f):f=t[10];const m=f;let h,p,v,x,b,j,S;return t[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Et,{children:"Optional Features"}),t[11]=h):h=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(po,{children:s.jsxs(rr,{children:[s.jsx(xt,{children:"Dependency"}),s.jsx(xt,{children:"Feature"}),s.jsx(xt,{children:"Status"}),s.jsx(xt,{})]})}),t[13]=v):v=t[13],t[14]!==m||t[15]!==n||t[16]!==c?(x=vs.map(w=>{const C=w.packagesRequired.every(T=>m.has(T.name.split("[")[0])),N=w.packagesRequired.map(Kc).join(", ");return s.jsxs(rr,{className:"text-sm",children:[s.jsx(Vt,{children:w.description}),s.jsx(Vt,{className:"font-mono text-xs",children:N}),s.jsx(Vt,{children:C?s.jsxs("div",{className:"flex items-center",children:[s.jsx(ar,{className:"h-4 w-4 text-(--grass-10) mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(ho,{className:"h-4 w-4 text-(--red-10) mr-2"}),s.jsx(Wc,{packageSpecs:[...w.packagesRequired,...w.additionalPackageInstalls],packageManager:n,onSuccess:c})]})})]},w.id)}),t[14]=m,t[15]=n,t[16]=c,t[17]=x):x=t[17],t[18]!==x?(b=s.jsxs(go,{children:[v,s.jsx(mo,{children:x})]}),t[18]=x,t[19]=b):b=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[20]=j):j=t[20],t[21]!==b?(S=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[h,p,b,j]}),t[21]=b,t[22]=S):S=t[22],S},Wc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=Ke.useState(!1),{addPackage:o}=ze();return s.jsxs(ue,{size:"xs",variant:"outline",className:$e("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const a=t.map(c=>c.minVersion?`${c.name}>=${c.minVersion}`:c.name).join(" "),l=await o({package:a});l.success?(n(),Fe({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(K,{className:"inline",children:t.map(c=>c.name).join(", ")})," ","have been added to your environment."]})})):Fe({title:"Failed to install package",description:l.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(ir,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(or,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function Gc(t){return t.name}function Kc(t){return t.name}const B="flex flex-row items-center space-x-1 space-y-0",ys=[{id:"editor",label:"Editor",Icon:Yn,className:"bg-(--blue-4)"},{id:"display",label:"Display",Icon:Ho,className:"bg-(--grass-4)"},{id:"packageManagement",label:"Package Management",Icon:Uo,className:"bg-(--red-4)"},{id:"runtime",label:"Runtime",Icon:lr,className:"bg-(--amber-4)"},{id:"ai",label:"AI",Icon:Ao,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:cr,className:"bg-(--orange-4)"},{id:"labs",label:"Labs",Icon:Mo,className:"bg-(--slate-4)"}],xs=Ye(ys[0].id),$c=()=>{const t=U.c(45),[e,n]=Jn(),r=I.useRef(null),i=qt(Tn),[o,a]=Xe(xs),l=gt(vo),c=gt(yo),{saveUserConfig:d}=ze();let u,g;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=An(xo),t[0]=u):u=t[0],t[1]!==e?(g={resolver:u,defaultValues:e},t[1]=e,t[2]=g):g=t[2];const f=Mn(g);let m;t[3]!==d||t[4]!==n?(m=async k=>{await d({config:k}).then(()=>{n(k)})},t[3]=d,t[4]=n,t[5]=m):m=t[5];const h=m;let p;t[6]===Symbol.for("react.memo_cache_sentinel")?(p=Ne(),t[6]=p):p=t[6];const v=p;let x;t[7]!==o||t[8]!==l||t[9]!==e||t[10]!==f||t[11]!==h||t[12]!==a||t[13]!==i?(x=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(je,{title:"Autosave",children:[s.jsx(_,{control:f.control,name:"save.autosave",render:k=>{const{field:y}=k;return s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Autosave enabled"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"autosave-checkbox",checked:y.value==="after_delay",disabled:y.disabled,onCheckedChange:O=>{y.onChange(O?"after_delay":"off")}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(_,{control:f.control,name:"save.autosave_delay",render:k=>{const{field:y}=k;return s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Autosave delay (seconds)"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:f.getValues("save.autosave")!=="after_delay",...y,value:y.value/1e3,minValue:1,onChange:O=>{y.onChange(1e3*O),Number.isNaN(O)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.autosave_delay"})]})}}),s.jsx(_,{control:f.control,name:"runtime.default_auto_download",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Save cell outputs as"}),s.jsx(A,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"html-checkbox",checked:Array.isArray(y.value)&&y.value.includes("html"),onCheckedChange:()=>{const O=Array.isArray(y.value)?y.value:[];y.onChange(ut(O,"html"))}}),s.jsx(D,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"ipynb-checkbox",checked:Array.isArray(y.value)&&y.value.includes("ipynb"),onCheckedChange:()=>{const O=Array.isArray(y.value)?y.value:[];y.onChange(ut(O,"ipynb"))}}),s.jsx(D,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(K,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}})]}),s.jsxs(je,{title:"Formatting",children:[s.jsx(_,{control:f.control,name:"save.format_on_save",render:k=>{const{field:y}=k;return s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Format on save"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"format-on-save-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(_,{control:f.control,name:"formatting.line_length",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Line length"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"line-length-input",className:"m-0 w-24",...y,value:y.value,minValue:1,maxValue:1e3,onChange:O=>{y.onChange(O),Number.isNaN(O)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(F,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(je,{title:"Autocomplete",children:s.jsx(_,{control:f.control,name:"completion.activate_on_typing",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Autocomplete"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"autocomplete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(F,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(ue,{variant:"link",className:"mb-0 px-0",type:"button",onClick:O=>{O.preventDefault(),O.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(je,{title:"Language Servers",children:[s.jsxs(F,{children:["See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(F,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(_,{control:f.control,name:"language_servers.pylsp.enabled",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:B,children:[s.jsxs(D,{children:[s.jsx(bt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(ie,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"pylsp-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),y.value&&!l.pylsp&&s.jsxs(yt,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(K,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"language_servers.basedpyright.enabled",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:B,children:[s.jsxs(D,{children:[s.jsx(bt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(ie,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"basedpyright-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),y.value&&!l.basedpyright&&s.jsxs(yt,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(K,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"language_servers.ty.enabled",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:B,children:[s.jsxs(D,{children:[s.jsx(bt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(ie,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"ty-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.ty.enabled"})]}),y.value&&!l.ty&&s.jsxs(yt,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(K,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"diagnostics.enabled",render:k=>{const{field:y}=k;return s.jsxs(P,{className:B,children:[s.jsxs(D,{children:[s.jsx(bt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"diagnostics-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(je,{title:"Keymap",children:[s.jsx(_,{control:f.control,name:"keymap.preset",render:k=>{const{field:y}=k;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Keymap"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"keymap-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:vc.map(Yc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(_,{control:f.control,name:"keymap.destructive_delete",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Destructive delete"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"destructive-delete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:O=>{y.onChange(!!O)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(F,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Qe,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(wo,{className:"w-3 h-3 text-(--amber-11)"})})]}),s.jsx("div",{children:s.jsx(ue,{variant:"link",className:"mb-0 px-0",type:"button",onClick:O=>{O.preventDefault(),O.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(je,{title:"Display",children:[s.jsx(_,{control:f.control,name:"display.default_width",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Default width"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"user-config-width-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Xc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_width"})]}),s.jsx(F,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(_,{control:f.control,name:"display.theme",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Theme"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"theme-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:jo.map(Qc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.theme"})]}),s.jsx(F,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(_,{control:f.control,name:"display.code_editor_font_size",render:k=>{const{field:y}=k;return s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Code editor font size (px)"}),s.jsx(A,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(Ze,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...y,value:y.value,minValue:8,maxValue:32,onChange:O=>{y.onChange(O),h(f.getValues())}})})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(_,{control:f.control,name:"display.reference_highlighting",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Reference highlighting"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"reference-highlighting-checkbox",checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(F,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(je,{title:"Outputs",children:[s.jsx(_,{control:f.control,name:"display.cell_output",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Cell output area"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"cell-output-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["above","below"].map(Zc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.cell_output"})]}),s.jsx(F,{children:"Where to display cell's output."})]})}}),s.jsx(_,{control:f.control,name:"display.dataframes",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Dataframe viewer"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"display-dataframes-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(Jc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.dataframes"})]}),s.jsx(F,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(_,{control:f.control,name:"display.default_table_page_size",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Default table page size"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:O=>{y.onChange(O),Number.isNaN(O)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(F,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(_,{control:f.control,name:"display.default_table_max_columns",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Default table max columns"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"default-table-max-columns-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:O=>{y.onChange(O),Number.isNaN(O)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(F,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(je,{title:"Package Management",children:s.jsx(_,{control:f.control,disabled:v,name:"package_management.manager",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Manager"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"package-manager-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:bo.map(ed)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(F,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(K,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(je,{title:"Runtime configuration",children:[s.jsx(_,{control:f.control,name:"runtime.auto_instantiate",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Autorun on startup"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"auto-instantiate-checkbox",disabled:y.disabled,checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(F,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(_,{control:f.control,name:"runtime.on_cell_change",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"On cell change"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"on-cell-change-select",onChange:O=>y.onChange(O.target.value),value:y.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(td)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(F,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(_,{control:f.control,name:"runtime.auto_reload",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"On module change"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"auto-reload-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:v,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(nd)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(F,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(_,{control:f.control,name:"runtime.default_sql_output",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{children:"Default SQL output"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"user-config-sql-output-select",onChange:O=>y.onChange(O.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:Zi.map(rd)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(F,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(_,{control:f.control,name:"runtime.reactive_tests",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"reactive-test-checkbox",checked:y.value,onCheckedChange:y.onChange})})]}),s.jsx(H,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(M,{}),s.jsx(F,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(F,{children:["Learn more in the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsx(Hc,{form:f,config:e,onSubmit:h});case"optionalDeps":return s.jsx(qc,{});case"labs":return s.jsxs(je,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(_,{control:f.control,name:"experimental.inline_ai_tooltip",render:id}),s.jsx(_,{control:f.control,name:"experimental.rtc_v2",render:sd}),s.jsx(_,{control:f.control,name:"experimental.performant_table_charts",render:k=>{const{field:y}=k;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"performant-table-charts-checkbox",checked:y.value===!0,onCheckedChange:y.onChange})})]}),s.jsx(H,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(F,{children:"Enable experimental table charts which are computed on the backend."})]})}})]})}},t[7]=o,t[8]=l,t[9]=e,t[10]=f,t[11]=h,t[12]=a,t[13]=i,t[14]=x):x=t[14];const b=x;let j,S,w;t[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(K,{className:"inline",children:"marimo.toml"}),S=s.jsx("br",{}),t[15]=j,t[16]=S):(j=t[15],S=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",j,S,"Run ",s.jsx(K,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[17]=w):w=t[17];const C=w;let N,T,L,z,V,$,G,q,J,Y,ee,ae;return t[18]!==f||t[19]!==h?(N=f.handleSubmit(h),t[18]=f,t[19]=h,t[20]=N):N=t[20],t[21]!==a?(T=k=>a(k),t[21]=a,t[22]=T):T=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(L=ys.map(od),t[23]=L):L=t[23],t[24]!==c?(z=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",c]})}),t[24]=c,t[25]=z):z=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"flex-1"}),$=!Ne()&&C,t[26]=V,t[27]=$):(V=t[26],$=t[27]),t[28]!==z?(G=s.jsxs(er,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[L,z,V,$]}),t[28]=z,t[29]=G):G=t[29],t[30]!==o||t[31]!==G||t[32]!==T?(q=s.jsx(nr,{value:o,onValueChange:T,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:G}),t[30]=o,t[31]=G,t[32]=T,t[33]=q):q=t[33],t[34]!==b?(J=b(),t[34]=b,t[35]=J):J=t[35],t[36]!==J?(Y=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:J}),t[36]=J,t[37]=Y):Y=t[37],t[38]!==q||t[39]!==Y||t[40]!==N?(ee=s.jsxs("form",{ref:r,onChange:N,className:"flex text-pretty overflow-hidden",children:[q,Y]}),t[38]=q,t[39]=Y,t[40]=N,t[41]=ee):ee=t[41],t[42]!==f||t[43]!==ee?(ae=s.jsx(Rn,{...f,children:ee}),t[42]=f,t[43]=ee,t[44]=ae):ae=t[44],ae},je=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Et,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Yc(t){return s.jsx("option",{value:t,children:t},t)}function Xc(t){return s.jsx("option",{value:t,children:t},t)}function Qc(t){return s.jsx("option",{value:t,children:t},t)}function Zc(t){return s.jsx("option",{value:t,children:t},t)}function Jc(t){return s.jsx("option",{value:t,children:t},t)}function ed(t){return s.jsx("option",{value:t,children:t},t)}function td(t){return s.jsx("option",{value:t,children:t},t)}function nd(t){return s.jsx("option",{value:t,children:t},t)}function rd(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function id(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function sd(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:B,children:[s.jsx(D,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function od(t){return s.jsx(Bt,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:$e(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const _n=Ye(!1);function ad(){const t=U.c(5),e=qt(xs),n=qt(_n);let r;t[0]!==e||t[1]!==n?(r=a=>{e(a),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const ld=t=>{const e=U.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,a=r!==void 0&&r,l=i===void 0?"Settings":i,[c,d]=Xe(_n),u=a?"disabled":"hint-green";let g,f,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(sr,{strokeWidth:1.8}),e[0]=g):g=e[0],e[1]!==l?(f=s.jsx(Qe,{content:l,children:g}),e[1]=l,e[2]=f):f=e[2],e[3]!==a||e[4]!==u||e[5]!==f?(m=s.jsx(Pt,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:u,children:f}),e[3]=a,e[4]=u,e[5]=f,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Xn,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx($c,{})}),e[7]=p):p=e[7];const v=p;if(!o){let z,V;return e[8]!==h?(z=s.jsx(Io,{children:h}),e[8]=h,e[9]=z):z=e[9],e[10]!==d||e[11]!==c||e[12]!==z?(V=s.jsxs(Ut,{open:c,onOpenChange:d,children:[z,v]}),e[10]=d,e[11]=c,e[12]=z,e[13]=V):V=e[13],V}let x,b,j,S,w,C,N,T,L;return e[14]!==h?(x=s.jsx(So,{asChild:!0,children:h}),e[14]=h,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(tc,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=b,e[17]=j):(b=e[16],j=e[17]),e[18]!==d?(S=()=>d(!0),e[18]=d,e[19]=S):S=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(sr,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=w):w=e[20],e[21]!==S?(C=s.jsxs(ko,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:cd,children:[b,j,s.jsxs(ue,{onClick:S,variant:"link",className:"px-0",children:[w,"User settings"]})]}),e[21]=S,e[22]=C):C=e[22],e[23]!==C||e[24]!==x?(N=s.jsxs(Oo,{children:[x,C]}),e[23]=C,e[24]=x,e[25]=N):N=e[25],e[26]!==d||e[27]!==c?(T=s.jsx(Ut,{open:c,onOpenChange:d,children:v}),e[26]=d,e[27]=c,e[28]=T):T=e[28],e[29]!==N||e[30]!==T?(L=s.jsxs(s.Fragment,{children:[N,T]}),e[29]=N,e[30]=T,e[31]=L):L=e[31],L};function cd(t){return t.preventDefault()}const dd=t=>{const e=U.c(15),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=Co(),{sendShutdown:d}=ze();let u;e[0]!==d?(u=()=>{d(),setTimeout(ud,200)},e[0]=d,e[1]=u):u=e[1];const g=u;if(Ne())return null;const f=o?"disabled":"red";let m,h,p,v;return e[2]!==c||e[3]!==n||e[4]!==g||e[5]!==l?(m=x=>{x.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(No,{onClick:()=>{g(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=c,e[3]=n,e[4]=g,e[5]=l,e[6]=m):m=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{strokeWidth:1}),e[7]=h):h=e[7],e[8]!==o||e[9]!==f||e[10]!==m?(p=s.jsx(Pt,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:f,className:"h-[27px] w-[27px]",disabled:o,onClick:m,children:h}),e[8]=o,e[9]=f,e[10]=m,e[11]=p):p=e[11],e[12]!==p||e[13]!==a?(v=s.jsx(Qe,{content:a,children:p}),e[12]=p,e[13]=a,e[14]=v):v=e[14],v};function ud(){window.close()}function hd(t){window.open(Do(`?file=${t}`).toString(),"_blank")}export{Eo as A,_o as B,ld as C,Ac as D,Lo as G,wc as K,zo as L,Fo as M,Bo as P,dd as S,Xl as T,Vo as Y,Ro as a,or as b,Pt as c,Nc as d,st as e,ls as f,Zl as g,yc as h,as as i,ad as j,Tn as k,ss as l,Rt as m,os as n,hd as o,lr as p,ar as q,ps as r,_n as s,Xi as t,Ql as u};
|
6
|
+
*/const _o=te("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"}]]),Po=te("book-marked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),Ao=te("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),lr=te("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Mo=te("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"}]]),cr=te("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),dr=te("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Ro=te("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]),ur=te("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),Lo=te("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),zo=te("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Fo=te("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),Ho=te("messages-square",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]),Uo=te("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"}]]),qo=te("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),Vo=te("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Bo=te("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);function Wt(t,e){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Wt(t,e)}function hr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}const fr=I.createContext(null);function de(){const t=I.useContext(fr);if(t===null)throw new Error("No Tree Api Provided");return t}const pr=I.createContext(null),gr=I.createContext(null),mr=I.createContext(0);function vr(){I.useContext(mr)}function bt(t,e,n){return Math.max(Math.min(t,n),e)}function yr(t){return t&&t.isLeaf}function xr(t){return t&&t.isInternal&&!t.isOpen}function br(t){var e;return t&&t.isOpen&&!(!((e=t.children)===null||e===void 0)&&e.length)}const jr=(t,e)=>{let n=t;for(;n;){if(n.id===e.id)return!0;n=n.parent}return!1},wr=t=>{if(!t.parent)throw Error("Node does not have a parent");return t.parent.children.findIndex(e=>e.id===t.id)};function Gt(t,e){if(!t)return null;if(t.id===e)return t;if(t.children)for(let n of t.children){const r=Gt(n,e);if(r)return r}return null}function jt(t,e){if(e(t),t.children)for(let n of t.children)jt(n,e)}function Ir(t){const e=Or(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Wo(e,r);break}n==null||n.focus()}function Sr(t){const e=Or(t);let n;for(let r=0;r<e.length;++r)if(e[r]===t){n=Go(e,r);break}n==null||n.focus()}function Wo(t,e){return e+1<t.length?t[e+1]:t[0]}function Go(t,e){return e-1>=0?t[e-1]:t[t.length-1]}function Or(t){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(e=>e===t||!t.contains(e))}function Je(t,e){return typeof e=="boolean"?e:typeof e=="string"?t[e]:e(t)}function kr(t){return t===null?null:De(t)}function De(t){return typeof t=="string"?t:t.id}function Cr(t,...e){if(t)return t(...e)}function Nr(t){return new Promise((e,n)=>{let r=0;(function i(){r+=1,r===100&&n(),t()?e():setTimeout(i,10)})()})}function Dr(t){var e,n;const r=t.focusedNode;return r?r.isOpen?0:r.parent?r.childIndex+1:0:(n=(e=t.root.children)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}function Tr(t){const e=t.focusedNode;return e?e.isOpen?e.id:e.parent&&!e.parent.isRoot?e.parent.id:null:null}const Ko=Object.freeze(Object.defineProperty({__proto__:null,access:Je,bound:bt,dfs:Gt,focusNextElement:Ir,focusPrevElement:Sr,getInsertIndex:Dr,getInsertParentId:Tr,identify:De,identifyNull:kr,indexOf:wr,isClosed:xr,isDescendant:jr,isItem:yr,isOpenWithEmptyChildren:br,mergeRefs:function(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}},noop:function(){},safeRun:Cr,waitFor:Nr,walk:jt},Symbol.toStringTag,{value:"Module"})),$o={display:"flex",alignItems:"center",zIndex:1},Yo={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Xo={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Qo=Ke.memo(function({top:t,left:e,indent:n}){const r={position:"absolute",pointerEvents:"none",top:t-2+"px",left:e+"px",right:n+"px"};return s.jsxs("div",{style:Object.assign(Object.assign({},$o),r),children:[s.jsx("div",{style:Object.assign({},Xo)}),s.jsx("div",{style:Object.assign({},Yo)})]})});function Zo({node:t,attrs:e,innerRef:n,children:r}){return s.jsx("div",Object.assign({},e,{ref:n,onFocus:i=>i.stopPropagation(),onClick:t.handleClick,children:r}))}function Jo(t){return s.jsxs("div",{ref:t.dragHandle,style:t.style,children:[s.jsx("span",{onClick:e=>{e.stopPropagation(),t.node.toggle()},children:t.node.isLeaf?"\u{1F333}":t.node.isOpen?"\u{1F5C1}":"\u{1F5C0}"})," ",t.node.isEditing?s.jsx(ta,Object.assign({},t)):s.jsx(ea,Object.assign({},t))]})}function ea(t){return s.jsx(s.Fragment,{children:s.jsx("span",{children:t.node.data.name})})}function ta({node:t}){const e=I.useRef();return I.useEffect(()=>{var n,r;(n=e.current)===null||n===void 0||n.focus(),(r=e.current)===null||r===void 0||r.select()},[]),s.jsx("input",{ref:e,defaultValue:t.data.name,onBlur:()=>t.reset(),onKeyDown:n=>{var r;n.key==="Escape"&&t.reset(),n.key==="Enter"&&t.submit(((r=e.current)===null||r===void 0?void 0:r.value)||"")}})}function Kt(t){return{type:"EDIT",id:t}}function He(t){return{type:"FOCUS",id:t}}class Lt{constructor(e){this.handleClick=n=>{n.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():n.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===et}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var e;return this.isSelected&&!(!((e=this.prev)===null||e===void 0)&&e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(!((e=this.next)===null||e===void 0)&&e.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,n;const r=this.childIndex;return(n=(e=this.parent)===null||e===void 0?void 0:e.children[r+1])!==null&&n!==void 0?n:null}isAncestorOf(e){if(!e)return!1;let n=e;for(;n;){if(n.id===this.id)return!0;n=n.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new Lt(Object.assign({},this))}edit(){return this.tree.edit(this)}}const et="__REACT_ARBORIST_INTERNAL_ROOT__";function Er(t){var e;function n(o,a,l){const c=t.accessId(o),d=new Lt({tree:t,data:o,level:a,parent:l,id:c,children:null,isDraggable:t.isDraggable(o),rowIndex:null}),u=t.accessChildren(o);return u&&(d.children=u.map(m=>n(m,a+1,d))),d}const r=new Lt({tree:t,id:et,data:{id:et},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),i=(e=t.props.data)!==null&&e!==void 0?e:[];return r.children=i.map(o=>n(o,0,r)),r}const $t={open:(t,e)=>({type:"VISIBILITY_OPEN",id:t,filtered:e}),close:(t,e)=>({type:"VISIBILITY_CLOSE",id:t,filtered:e}),toggle:(t,e)=>({type:"VISIBILITY_TOGGLE",id:t,filtered:e}),clear:t=>({type:"VISIBILITY_CLEAR",filtered:t})};function _r(t={},e){if(e.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},t),{[e.id]:!0});if(e.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},t),{[e.id]:!1});if(e.type==="VISIBILITY_TOGGLE"){const n=t[e.id];return Object.assign(Object.assign({},t),{[e.id]:!n})}return e.type==="VISIBILITY_CLEAR"?{}:t}const Ue=t=>{var e;return{nodes:{open:{filtered:{},unfiltered:(e=t==null?void 0:t.initialOpenState)!==null&&e!==void 0?e:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},na=t=>({type:"SELECTION_ONLY",id:De(t)}),Pr=t=>({type:"SELECTION_ADD",ids:(Array.isArray(t)?t:[t]).map(De)}),Ar=t=>({type:"SELECTION_REMOVE",ids:(Array.isArray(t)?t:[t]).map(De)}),ra=t=>Object.assign({type:"SELECTION_SET"},t),Yt=t=>({type:"SELECTION_MOST_RECENT",id:t===null?null:De(t)}),Mr=t=>({type:"SELECTION_ANCHOR",id:t===null?null:De(t)}),qe={cursor:t=>({type:"DND_CURSOR",cursor:t}),dragStart:(t,e)=>({type:"DND_DRAG_START",id:t,dragIds:e}),dragEnd:()=>({type:"DND_DRAG_END"}),hovering:(t,e)=>({type:"DND_HOVERING",parentId:t,index:e})},ia={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},sa=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e}px, ${n}px)`}},oa=t=>{if(!t)return{display:"none"};const{x:e,y:n}=t;return{transform:`translate(${e+10}px, ${n+10}px)`}};function Rr({offset:t,mouse:e,id:n,dragIds:r,isDragging:i}){return s.jsxs(aa,{isDragging:i,children:[s.jsx(la,{offset:t,children:s.jsx(da,{id:n,dragIds:r})}),s.jsx(ca,{mouse:e,count:r.length})]})}const aa=I.memo(function(t){return t.isDragging?s.jsx("div",{style:ia,children:t.children}):null});function la(t){return s.jsx("div",{className:"row preview",style:sa(t.offset),children:t.children})}function ca(t){const{count:e,mouse:n}=t;return e>1?s.jsx("div",{className:"selected-count",style:oa(n),children:e}):null}const da=I.memo(function(t){const e=de(),n=e.get(t.id);return n?s.jsx(e.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*e.indent,opacity:.2,background:"transparent"},tree:e}):null});var Lr=Number.isNaN||function(t){return typeof t=="number"&&t!=t};function ua(t,e){return t===e||!(!Lr(t)||!Lr(e))}function ha(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!ua(t[n],e[n]))return!1;return!0}function Xt(t,e){var n;e===void 0&&(e=ha);var r,i=[],o=!1;return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&n===this&&e(a,i)||(r=t.apply(this,a),o=!0,n=this,i=a),r}}var zr=typeof performance=="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Fr(t){cancelAnimationFrame(t.id)}var Qt=-1;function Hr(t){if(t===void 0&&(t=!1),Qt===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),Qt=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return Qt}var tt=null;function Ur(t){if(t===void 0&&(t=!1),tt===null||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),i=r.style;return i.width="100px",i.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?tt="positive-descending":(e.scrollLeft=1,tt=e.scrollLeft===0?"negative":"positive-ascending"),document.body.removeChild(e),tt}return tt}var fa=function(t,e){return t};function pa(t){var e,n=t.getItemOffset,r=t.getEstimatedTotalSize,i=t.getItemSize,o=t.getOffsetForIndexAndAlignment,a=t.getStartIndexForOffset,l=t.getStopIndexForStartIndex,c=t.initInstanceProps,d=t.shouldResetStyleCacheOnItemSizeChange,u=t.validateProps;return e=function(m){function f(h){var p;return(p=m.call(this,h)||this)._instanceProps=c(p.props,hr(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:hr(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Xt(function(v,x,b,j){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:x,visibleStartIndex:b,visibleStopIndex:j})}),p._callOnScroll=void 0,p._callOnScroll=Xt(function(v,x,b){return p.props.onScroll({scrollDirection:v,scrollOffset:x,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var x,b=p.props,j=b.direction,S=b.itemSize,w=b.layout,C=p._getItemStyleCache(d&&S,d&&w,d&&j);if(C.hasOwnProperty(v))x=C[v];else{var N=n(p.props,v,p._instanceProps),T=i(p.props,v,p._instanceProps),L=j==="horizontal"||w==="horizontal",z=j==="rtl",V=L?N:0;C[v]=x={position:"absolute",left:z?void 0:V,right:z?V:void 0,top:L?0:N,height:L?"100%":T,width:L?T:"100%"}}return x},p._getItemStyleCache=void 0,p._getItemStyleCache=Xt(function(v,x,b){return{}}),p._onScrollHorizontal=function(v){var x=v.currentTarget,b=x.clientWidth,j=x.scrollLeft,S=x.scrollWidth;p.setState(function(w){if(w.scrollOffset===j)return null;var C=p.props.direction,N=j;if(C==="rtl")switch(Ur()){case"negative":N=-j;break;case"positive-descending":N=S-b-j}return N=Math.max(0,Math.min(N,S-b)),{isScrolling:!0,scrollDirection:w.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var x=v.currentTarget,b=x.clientHeight,j=x.scrollHeight,S=x.scrollTop;p.setState(function(w){if(w.scrollOffset===S)return null;var C=Math.max(0,Math.min(S,j-b));return{isScrolling:!0,scrollDirection:w.scrollOffset<C?"forward":"backward",scrollOffset:C,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var x=p.props.outerRef;p._outerRef=v,typeof x=="function"?x(v):x!=null&&typeof x=="object"&&x.hasOwnProperty("current")&&(x.current=v)},p._resetIsScrollingDebounced=function(){var v,x,b,j;p._resetIsScrollingTimeoutId!==null&&Fr(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=(v=p._resetIsScrolling,x=150,b=zr(),j={id:requestAnimationFrame(function S(){zr()-b>=x?v.call(null):j.id=requestAnimationFrame(S)})})},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}(function(h,p){h.prototype=Object.create(p.prototype),h.prototype.constructor=h,Wt(h,p)})(f,m),f.getDerivedStateFromProps=function(h,p){return ga(h,p),u(h),null};var g=f.prototype;return g.scrollTo=function(h){h=Math.max(0,h),this.setState(function(p){return p.scrollOffset===h?null:{scrollDirection:p.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(h,p){p===void 0&&(p="auto");var v=this.props,x=v.itemCount,b=v.layout,j=this.state.scrollOffset;h=Math.max(0,Math.min(h,x-1));var S=0;if(this._outerRef){var w=this._outerRef;S=b==="vertical"?w.scrollWidth>w.clientWidth?Hr():0:w.scrollHeight>w.clientHeight?Hr():0}this.scrollTo(o(this.props,h,p,j,this._instanceProps,S))},g.componentDidMount=function(){var h=this.props,p=h.direction,v=h.initialScrollOffset,x=h.layout;if(typeof v=="number"&&this._outerRef!=null){var b=this._outerRef;p==="horizontal"||x==="horizontal"?b.scrollLeft=v:b.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,p=h.direction,v=h.layout,x=this.state,b=x.scrollOffset;if(x.scrollUpdateWasRequested&&this._outerRef!=null){var j=this._outerRef;if(p==="horizontal"||v==="horizontal")if(p==="rtl")switch(Ur()){case"negative":j.scrollLeft=-b;break;case"positive-ascending":j.scrollLeft=b;break;default:var S=j.clientWidth,w=j.scrollWidth;j.scrollLeft=w-S-b}else j.scrollLeft=b;else j.scrollTop=b}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Fr(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,p=h.children,v=h.className,x=h.direction,b=h.height,j=h.innerRef,S=h.innerElementType,w=h.innerTagName,C=h.itemCount,N=h.itemData,T=h.itemKey,L=T===void 0?fa:T,z=h.layout,V=h.outerElementType,$=h.outerTagName,K=h.style,B=h.useIsScrolling,J=h.width,Y=this.state.isScrolling,ee=x==="horizontal"||z==="horizontal",ae=ee?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),y=O[0],k=O[1],we=[];if(C>0)for(var ye=y;ye<=k;ye++)we.push(I.createElement(p,{data:N,key:L(ye,N),index:ye,isScrolling:B?Y:void 0,style:this._getItemStyle(ye)}));var Ie=r(this.props,this._instanceProps);return I.createElement(V||$||"div",{className:v,onScroll:ae,ref:this._outerRefSetter,style:Is({position:"relative",height:b,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:x},K)},I.createElement(S||w||"div",{children:we,ref:j,style:{height:ee?"100%":Ie,pointerEvents:Y?"none":void 0,width:ee?Ie:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"&&this.props.itemCount>0){var h=this._getRangeToRender(),p=h[0],v=h[1],x=h[2],b=h[3];this._callOnItemsRendered(p,v,x,b)}if(typeof this.props.onScroll=="function"){var j=this.state,S=j.scrollDirection,w=j.scrollOffset,C=j.scrollUpdateWasRequested;this._callOnScroll(S,w,C)}},g._getRangeToRender=function(){var h=this.props,p=h.itemCount,v=h.overscanCount,x=this.state,b=x.isScrolling,j=x.scrollDirection,S=x.scrollOffset;if(p===0)return[0,0,0,0];var w=a(this.props,S,this._instanceProps),C=l(this.props,w,S,this._instanceProps),N=b&&j!=="backward"?1:Math.max(1,v),T=b&&j!=="forward"?1:Math.max(1,v);return[Math.max(0,w-N),Math.max(0,Math.min(p-1,C+T)),w,C]},f}(I.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var ga=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},ma=pa({getItemOffset:function(t,e){return e*t.itemSize},getItemSize:function(t,e){return t.itemSize},getEstimatedTotalSize:function(t){var e=t.itemCount;return t.itemSize*e},getOffsetForIndexAndAlignment:function(t,e,n,r,i,o){var a=t.direction,l=t.height,c=t.itemCount,d=t.itemSize,u=t.layout,m=t.width,f=a==="horizontal"||u==="horizontal"?m:l,g=Math.max(0,c*d-f),h=Math.min(g,e*d),p=Math.max(0,e*d-f+d+o);switch(n==="smart"&&(n=r>=p-f&&r<=h+f?"auto":"center"),n){case"start":return h;case"end":return p;case"center":var v=Math.round(p+(h-p)/2);return v<Math.ceil(f/2)?0:v>g+Math.floor(f/2)?g:v;default:return r>=p&&r<=h?r:r<p?p:h}},getStartIndexForOffset:function(t,e){var n=t.itemCount,r=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(e/r)))},getStopIndexForStartIndex:function(t,e,n){var r=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,l=t.layout,c=t.width,d=e*a,u=r==="horizontal"||l==="horizontal"?c:i,m=Math.ceil((u+n-d)/a);return Math.max(0,Math.min(o-1,e+m-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});function va(){var t,e;const n=de(),r=function(){const c=I.useContext(gr);if(c===null)throw new Error("Provide a DnDContext");return c}().cursor;if(!r||r.type!=="line")return null;const i=n.indent,o=n.rowHeight*r.index+((e=(t=n.props.padding)!==null&&t!==void 0?t:n.props.paddingTop)!==null&&e!==void 0?e:0),a=i*r.level,l=n.renderCursor;return s.jsx(l,{top:o,left:a,indent:i})}var ya=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const xa=I.forwardRef(function(t,e){const{children:n}=t,r=ya(t,["children"]),i=de();return s.jsxs("div",Object.assign({ref:e},r,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[s.jsx(ba,{}),n]}))}),ba=()=>{const t=de();return s.jsx("div",{style:{height:t.visibleNodes.length*t.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:s.jsx(va,{})})};var ja=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const wa=I.forwardRef(function(t,e){var n,r,i,o,{style:a}=t,l=ja(t,["style"]);const c=de(),d=(r=(n=c.props.padding)!==null&&n!==void 0?n:c.props.paddingTop)!==null&&r!==void 0?r:0,u=(o=(i=c.props.padding)!==null&&i!==void 0?i:c.props.paddingBottom)!==null&&o!==void 0?o:0;return s.jsx("div",Object.assign({ref:e,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+u}px`})},l))});var he,qr=I.createContext({dragDropManager:void 0});function E(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(!t){var o;if(e===void 0)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(o=new Error(e.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw o.framesToPop=1,o}}(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(he||(he={}));var Zt="dnd-core/INIT_COORDS",Jt="dnd-core/BEGIN_DRAG",Vr="dnd-core/PUBLISH_DRAG_SOURCE",wt="dnd-core/HOVER",en="dnd-core/DROP",tn="dnd-core/END_DRAG";function Br(t,e){return{type:Zt,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}function nn(t){return nn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nn(t)}function Wr(t){return nn(t)==="object"}var Ia={type:Zt,payload:{clientOffset:null,sourceClientOffset:null}};function Sa(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0||r,o=n.clientOffset,a=n.getSourceClientOffset,l=t.getMonitor(),c=t.getRegistry();t.dispatch(Br(o)),function(g,h,p){E(!h.isDragging(),"Cannot call beginDrag while dragging."),g.forEach(function(v){E(p.getSource(v),"Expected sourceIds to be registered.")})}(e,l,c);var d=function(g,h){for(var p=null,v=g.length-1;v>=0;v--)if(h.canDragSource(g[v])){p=g[v];break}return p}(e,l);if(d!==null){var u=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");(function(g){E(typeof g=="function","When clientOffset is provided, getSourceClientOffset must be a function.")})(a),u=a(d)}t.dispatch(Br(o,u));var m=c.getSource(d).beginDrag(l,d);if(m!=null){(function(g){E(Wr(g),"Item must be an object.")})(m),c.pinSource(d);var f=c.getSourceType(d);return{type:Jt,payload:{itemType:f,item:m,sourceId:d,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}else t.dispatch(Ia)}}function Oa(t){return function(){if(t.getMonitor().isDragging())return{type:Vr}}}function rn(t,e){return e===null?t===null:Array.isArray(t)?t.some(function(n){return n===e}):t===e}function ka(t){return function(e){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;(function(a){E(Array.isArray(a),"Expected targetIds to be an array.")})(e);var r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(a,l,c){E(l.isDragging(),"Cannot call hover while not dragging."),E(!l.didDrop(),"Cannot call hover after drop.");for(var d=0;d<a.length;d++){var u=a[d];E(a.lastIndexOf(u)===d,"Expected targetIds to be unique in the passed array."),E(c.getTarget(u),"Expected targetIds to be registered.")}}(r,i,o),function(a,l,c){for(var d=a.length-1;d>=0;d--){var u=a[d];rn(l.getTargetType(u),c)||a.splice(d,1)}}(r,o,i.getItemType()),function(a,l,c){a.forEach(function(d){c.getTarget(d).hover(l,d)})}(r,i,o),{type:wt,payload:{targetIds:r,clientOffset:n||null}}}}function Gr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Kr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(n),!0).forEach(function(r){Ca(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ca(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Na(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.getMonitor(),r=t.getRegistry();(function(o){E(o.isDragging(),"Cannot call drop while not dragging."),E(!o.didDrop(),"Cannot call drop twice during one drag operation.")})(n);var i=function(o){var a=o.getTargetIds().filter(o.canDropOnTarget,o);return a.reverse(),a}(n);i.forEach(function(o,a){var l=function(d,u,m,f){var g=m.getTarget(d),h=g?g.drop(f,d):void 0;return function(p){E(p===void 0||Wr(p),"Drop result must either be an object or undefined.")}(h),h===void 0&&(h=u===0?{}:f.getDropResult()),h}(o,a,r,n),c={type:en,payload:{dropResult:Kr(Kr({},e),l)}};t.dispatch(c)})}}function Da(t){return function(){var e=t.getMonitor(),n=t.getRegistry();(function(i){E(i.isDragging(),"Cannot call endDrag while not dragging.")})(e);var r=e.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:tn}}}function Ta(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function nt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ea=function(){function t(e,n){var r=this;(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),nt(this,"store",void 0),nt(this,"monitor",void 0),nt(this,"backend",void 0),nt(this,"isSetUp",!1),nt(this,"handleRefCountChange",function(){var i=r.store.getState().refCount>0;r.backend&&(i&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!i&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}return Ta(t,[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,n=this.store.dispatch,r=function(i){return{beginDrag:Sa(i),publishDragSource:Oa(i),hover:ka(i),drop:Na(i),endDrag:Da(i)}}(this);return Object.keys(r).reduce(function(i,o){var a,l=r[o];return i[o]=(a=l,function(){for(var c=arguments.length,d=new Array(c),u=0;u<c;u++)d[u]=arguments[u];var m=a.apply(e,d);m!==void 0&&n(m)}),i},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}]),t}();function fe(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var $r=typeof Symbol=="function"&&Symbol.observable||"@@observable",Yr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Xr={INIT:"@@redux/INIT"+Yr(),REPLACE:"@@redux/REPLACE"+Yr()};function Qr(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(fe(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(fe(1));return n(Qr)(t,e)}if(typeof t!="function")throw new Error(fe(2));var i=t,o=e,a=[],l=a,c=!1;function d(){l===a&&(l=a.slice())}function u(){if(c)throw new Error(fe(3));return o}function m(g){if(typeof g!="function")throw new Error(fe(4));if(c)throw new Error(fe(5));var h=!0;return d(),l.push(g),function(){if(h){if(c)throw new Error(fe(6));h=!1,d();var p=l.indexOf(g);l.splice(p,1),a=null}}}function f(g){if(!function(v){if(typeof v!="object"||v===null)return!1;for(var x=v;Object.getPrototypeOf(x)!==null;)x=Object.getPrototypeOf(x);return Object.getPrototypeOf(v)===x}(g))throw new Error(fe(7));if(g.type===void 0)throw new Error(fe(8));if(c)throw new Error(fe(9));try{c=!0,o=i(o,g)}finally{c=!1}for(var h=a=l,p=0;p<h.length;p++)(0,h[p])();return g}return f({type:Xr.INIT}),(r={dispatch:f,subscribe:m,getState:u,replaceReducer:function(g){if(typeof g!="function")throw new Error(fe(10));i=g,f({type:Xr.REPLACE})}})[$r]=function(){var g,h=m;return(g={subscribe:function(p){if(typeof p!="object"||p===null)throw new Error(fe(11));function v(){p.next&&p.next(u())}return v(),{unsubscribe:h(v)}}})[$r]=function(){return this},g},r}var _a=function(t,e){return t===e};function Zr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zr(Object(n),!0).forEach(function(r){Pa(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ei={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Aa(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ei,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Zt:case Jt:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case wt:return t=n.clientOffset,e=i.clientOffset,!t&&!e||t&&e&&t.x===e.x&&t.y===e.y?n:Jr(Jr({},n),{},{clientOffset:i.clientOffset});case tn:case en:return ei;default:return n}}var sn="dnd-core/ADD_SOURCE",on="dnd-core/ADD_TARGET",an="dnd-core/REMOVE_SOURCE",It="dnd-core/REMOVE_TARGET";function ti(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ti(Object(n),!0).forEach(function(r){Ma(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ma(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ra={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function La(){var t,e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ra,r=arguments.length>1?arguments[1]:void 0,i=r.payload;switch(r.type){case Jt:return pe(pe({},n),{},{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case Vr:return pe(pe({},n),{},{isSourcePublic:!0});case wt:return pe(pe({},n),{},{targetIds:i.targetIds});case It:return n.targetIds.indexOf(i.targetId)===-1?n:pe(pe({},n),{},{targetIds:(t=n.targetIds,e=i.targetId,t.filter(function(o){return o!==e}))});case en:return pe(pe({},n),{},{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case tn:return pe(pe({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function za(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case sn:case on:return t+1;case an:case It:return t-1;default:return t}}var St=[],ln=[];function Fa(){var t=arguments.length>1?arguments[1]:void 0;switch(t.type){case wt:break;case sn:case on:case It:case an:return St;default:return ln}var e=t.payload,n=e.targetIds,r=n===void 0?[]:n,i=e.prevTargetIds,o=i===void 0?[]:i,a=function(u,m){var f=new Map,g=function(p){f.set(p,f.has(p)?f.get(p)+1:1)};u.forEach(g),m.forEach(g);var h=[];return f.forEach(function(p,v){p===1&&h.push(v)}),h}(r,o),l=a.length>0||!function(u,m){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_a;if(u.length!==m.length)return!1;for(var g=0;g<u.length;++g)if(!f(u[g],m[g]))return!1;return!0}(r,o);if(!l)return St;var c=o[o.length-1],d=r[r.length-1];return c!==d&&(c&&a.push(c),d&&a.push(d)),a}function Ha(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function ni(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ri(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ni(Object(n),!0).forEach(function(r){Ua(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ni(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ua(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qa(){var t,e,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Fa(r.dirtyHandlerIds,{type:i.type,payload:ri(ri({},i.payload),{},{prevTargetIds:(t=r,e="dragOperation.targetIds",n=[],e.split(".").reduce(function(o,a){return o&&o[a]?o[a]:n||null},t))})}),dragOffset:Aa(r.dragOffset,i),refCount:za(r.refCount,i),dragOperation:La(r.dragOperation,i),stateId:Ha(r.stateId)}}function ii(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Va(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function si(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}St.__IS_NONE__=!0,ln.__IS_ALL__=!0;var Ba=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),si(this,"store",void 0),si(this,"registry",void 0),this.store=e,this.registry=n}return Va(t,[{key:"subscribeToStateChange",value:function(e){var n=this,r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;E(typeof e=="function","listener must be a function."),E(r===void 0||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");var i=this.store.getState().stateId;return this.store.subscribe(function(){var o=n.store.getState(),a=o.stateId;try{var l=a===i||a===i+1&&!function(c,d){if(c===St)return!1;if(c===ln||d===void 0)return!0;var u,m=(u=c,d.filter(function(f){return u.indexOf(f)>-1}));return m.length>0}(o.dirtyHandlerIds,r);l||e()}finally{i=a}})}},{key:"subscribeToOffsetChange",value:function(e){var n=this;E(typeof e=="function","listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var i=n.store.getState().dragOffset;i!==r&&(r=i,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e);return E(n,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&n.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var n=this.registry.getTarget(e);return E(n,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&rn(this.registry.getTargetType(e),this.getItemType())&&n.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var n=this.registry.getSource(e,!0);return E(n,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&n.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!rn(r,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return n?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,i=e.clientOffset,o=e.initialClientOffset,a=e.initialSourceClientOffset,i&&o&&a?ii((r=a,{x:(n=i).x+r.x,y:n.y+r.y}),o):null;var e,n,r,i,o,a}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,r=e.initialClientOffset,n&&r?ii(n,r):null;var e,n,r}}]),t}(),Wa=0;function cn(t){return cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cn(t)}function dn(t,e){e&&Array.isArray(t)?t.forEach(function(n){return dn(n,!1)}):E(typeof t=="string"||cn(t)==="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const oi=typeof global<"u"?global:self,ai=oi.MutationObserver||oi.WebKitMutationObserver;function li(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const Ga=typeof ai=="function"?function(t){let e=1;const n=new ai(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:li;class Ka{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}const ci=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let n=0,r=t.length-this.index;n<r;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Ga(this.flush),this.requestErrorThrow=li(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},$a=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new Ka(this.onError,r=>e[e.length]=r);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(ci.registerPendingError);function Ya(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Ve(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xa(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return di(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return di(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function di(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Qa(t){var e=(Wa++).toString();switch(t){case he.SOURCE:return"S".concat(e);case he.TARGET:return"T".concat(e);default:throw new Error("Unknown Handler Role: ".concat(t))}}function ui(t){switch(t[0]){case"S":return he.SOURCE;case"T":return he.TARGET;default:E(!1,"Cannot parse handler ID: ".concat(t))}}function hi(t,e){var n=t.entries(),r=!1;do{var i=n.next(),o=i.done;if(Xa(i.value,2)[1]===e)return!0;r=!!o}while(!r);return!1}var Za=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Ve(this,"types",new Map),Ve(this,"dragSources",new Map),Ve(this,"dropTargets",new Map),Ve(this,"pinnedSourceId",null),Ve(this,"pinnedSource",null),Ve(this,"store",void 0),this.store=e}return Ya(t,[{key:"addSource",value:function(e,n){dn(e),function(i){E(typeof i.canDrag=="function","Expected canDrag to be a function."),E(typeof i.beginDrag=="function","Expected beginDrag to be a function."),E(typeof i.endDrag=="function","Expected endDrag to be a function.")}(n);var r=this.addHandler(he.SOURCE,e,n);return this.store.dispatch(function(i){return{type:sn,payload:{sourceId:i}}}(r)),r}},{key:"addTarget",value:function(e,n){dn(e,!0),function(i){E(typeof i.canDrop=="function","Expected canDrop to be a function."),E(typeof i.hover=="function","Expected hover to be a function."),E(typeof i.drop=="function","Expected beginDrag to be a function.")}(n);var r=this.addHandler(he.TARGET,e,n);return this.store.dispatch(function(i){return{type:on,payload:{targetId:i}}}(r)),r}},{key:"containsHandler",value:function(e){return hi(this.dragSources,e)||hi(this.dropTargets,e)}},{key:"getSource",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return E(this.isSourceId(e),"Expected a valid source ID."),n&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return E(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return E(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return E(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return ui(e)===he.SOURCE}},{key:"isTargetId",value:function(e){return ui(e)===he.TARGET}},{key:"removeSource",value:function(e){var n,r=this;E(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(i){return{type:an,payload:{sourceId:i}}}(e)),n=function(){r.dragSources.delete(e),r.types.delete(e)},ci.enqueueTask($a.create(n))}},{key:"removeTarget",value:function(e){E(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(n){return{type:It,payload:{targetId:n}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var n=this.getSource(e);E(n,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=n}},{key:"unpinSource",value:function(){E(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,n,r){var i=Qa(e);return this.types.set(i,n),e===he.SOURCE?this.dragSources.set(i,r):e===he.TARGET&&this.dropTargets.set(i,r),i}}]),t}();function Ja(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=function(l){var c=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Qr(qa,l&&c&&c({name:"dnd-core",instanceId:"dnd-core"}))}(arguments.length>3&&arguments[3]!==void 0&&arguments[3]),i=new Ba(r,new Za(r)),o=new Ea(r,i),a=t(o,e,n);return o.receiveBackend(a),o}var el=["children"];function tl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return fi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return fi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function fi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nl(t,e){if(t==null)return{};var n,r,i=function(a,l){if(a==null)return{};var c,d,u={},m=Object.keys(a);for(d=0;d<m.length;d++)c=m[d],l.indexOf(c)>=0||(u[c]=a[c]);return u}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var pi=0,Ot=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),rl=I.memo(function(t){var e=t.children,n=function(a){if("manager"in a)return[{dragDropManager:a.manager},!1];var l=function(d){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gi(),m=arguments.length>2?arguments[2]:void 0,f=arguments.length>3?arguments[3]:void 0,g=u;return g[Ot]||(g[Ot]={dragDropManager:Ja(d,u,m,f)}),g[Ot]}(a.backend,a.context,a.options,a.debugMode),c=!a.context;return[l,c]}(nl(t,el)),r=tl(n,2),i=r[0],o=r[1];return I.useEffect(function(){if(o){var a=gi();return++pi,function(){--pi===0&&(a[Ot]=null)}}},[]),s.jsx(qr.Provider,Object.assign({value:i},{children:e}),void 0)});function gi(){return typeof global<"u"?global:window}function il(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function mi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var un=!1,hn=!1,sl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),mi(this,"internalMonitor",void 0),mi(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return il(t,[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){E(!un,"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 un=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{un=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;E(!hn,"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 hn=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{hn=!1}}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,n){return this.internalMonitor.isOverTarget(e,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function ol(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function vi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fn=!1,al=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),vi(this,"internalMonitor",void 0),vi(this,"targetId",null),this.internalMonitor=e.getMonitor()}return ol(t,[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;E(!fn,"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 fn=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{fn=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),t}();function ll(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!I.isValidElement(e)){var r=e;return t(r,n),r}var i=e;(function(a){if(typeof a.type!="string"){var l=a.type.displayName||a.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(l," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}})(i);var o=n?function(a){return t(a,n)}:t;return function(a,l){var c=a.ref;return E(typeof c!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),c?I.cloneElement(a,{ref:function(d){xi(c,d),xi(l,d)}}):I.cloneElement(a,{ref:l})}(i,o)}}function yi(t){var e={};return Object.keys(t).forEach(function(n){var r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{var i=ll(r);e[n]=function(){return i}}}),e}function xi(t,e){typeof t=="function"?t(e):t.current=e}function pn(t){return pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pn(t)}function gn(t){return t!==null&&pn(t)==="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function mn(t,e,n,r){var i=void 0;if(i!==void 0)return!!i;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;var o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(e),c=0;c<o.length;c++){var d=o[c];if(!l(d))return!1;var u=t[d],m=e[d];if((i=void 0)===!1||i===void 0&&u!==m)return!1}return!0}function cl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function se(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var dl=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),se(this,"hooks",yi({dragSource:function(r,i){n.clearDragSource(),n.dragSourceOptions=i||null,gn(r)?n.dragSourceRef=r:n.dragSourceNode=r,n.reconnectDragSource()},dragPreview:function(r,i){n.clearDragPreview(),n.dragPreviewOptions=i||null,gn(r)?n.dragPreviewRef=r:n.dragPreviewNode=r,n.reconnectDragPreview()}})),se(this,"handlerId",null),se(this,"dragSourceRef",null),se(this,"dragSourceNode",void 0),se(this,"dragSourceOptionsInternal",null),se(this,"dragSourceUnsubscribe",void 0),se(this,"dragPreviewRef",null),se(this,"dragPreviewNode",void 0),se(this,"dragPreviewOptionsInternal",null),se(this,"dragPreviewUnsubscribe",void 0),se(this,"lastConnectedHandlerId",null),se(this,"lastConnectedDragSource",null),se(this,"lastConnectedDragSourceOptions",null),se(this,"lastConnectedDragPreview",null),se(this,"lastConnectedDragPreviewOptions",null),se(this,"backend",void 0),this.backend=e}return cl(t,[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();n&&this.disconnectDragSource(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!mn(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!mn(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),t}();function ul(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function be(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var hl=function(){function t(e){var n=this;(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),be(this,"hooks",yi({dropTarget:function(r,i){n.clearDropTarget(),n.dropTargetOptions=i,gn(r)?n.dropTargetRef=r:n.dropTargetNode=r,n.reconnect()}})),be(this,"handlerId",null),be(this,"dropTargetRef",null),be(this,"dropTargetNode",void 0),be(this,"dropTargetOptionsInternal",null),be(this,"unsubscribeDropTarget",void 0),be(this,"lastConnectedHandlerId",null),be(this,"lastConnectedDropTarget",null),be(this,"lastConnectedDropTargetOptions",null),be(this,"backend",void 0),this.backend=e}return ul(t,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var n=this.dropTarget;this.handlerId&&(n?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions)):this.lastConnectedDropTarget=n)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!mn(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),t}(),Te=typeof window<"u"?I.useLayoutEffect:I.useEffect;function vn(t){return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vn(t)}function fl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function yn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pl=function(){function t(e,n,r){(function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")})(this,t),yn(this,"spec",void 0),yn(this,"monitor",void 0),yn(this,"connector",void 0),this.spec=e,this.monitor=n,this.connector=r}return fl(t,[{key:"beginDrag",value:function(){var e,n=this.spec,r=this.monitor;return(e=vn(n.item)==="object"?n.item:typeof n.item=="function"?n.item(r):{})!==null&&e!==void 0?e:null}},{key:"canDrag",value:function(){var e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag!="function"||e.canDrag(n)}},{key:"isDragging",value:function(e,n){var r=this.spec,i=this.monitor,o=r.isDragging;return o?o(i):n===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,n=this.monitor,r=this.connector,i=e.end;i&&i(n.getItem(),n),r.reconnect()}}]),t}();function Ee(){var t=I.useContext(qr).dragDropManager;return E(t!=null,"Expected drag drop context"),t}function gl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return bi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return bi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function bi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ml(t,e,n){var r=Ee(),i=function(a,l,c){var d=I.useMemo(function(){return new pl(a,l,c)},[l,c]);return I.useEffect(function(){d.spec=a},[a]),d}(t,e,n),o=function(a){return I.useMemo(function(){var l=a.type;return E(l!=null,"spec.type must be defined"),l},[a])}(t);Te(function(){if(o!=null){var a=function(u,m,f){var g=f.getRegistry(),h=g.addSource(u,m);return[h,function(){return g.removeSource(h)}]}(o,i,r),l=gl(a,2),c=l[0],d=l[1];return e.receiveHandlerId(c),n.receiveHandlerId(c),d}},[r,e,n,i,o])}function vl(t){return function(e){if(Array.isArray(e))return xn(e)}(t)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(t)||function(e,n){if(e){if(typeof e=="string")return xn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xn(e,n)}}(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function xn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ji(t,e){var n=vl(e||[]);return e==null&&typeof t!="function"&&n.push(t),I.useMemo(function(){return typeof t=="function"?t():t},n)}function yl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return wi(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return wi(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function wi(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ii(t,e,n){var r=yl(I.useState(function(){return e(t)}),2),i=r[0],o=r[1],a=I.useCallback(function(){var l=e(t);Eo(i,l)||(o(l),n&&n())},[i,t,n]);return Te(a),[i,a]}function xl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Si(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Si(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Si(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Oi(t,e,n){return function(r,i,o){var a=xl(Ii(r,i,o),2),l=a[0],c=a[1];return Te(function(){var d=r.getHandlerId();if(d!=null)return r.subscribeToStateChange(c,{handlerIds:[d]})},[r,c]),l}(e,t||function(){return{}},function(){return n.reconnect()})}function bl(t){return I.useMemo(function(){return t.hooks.dragSource()},[t])}function jl(t){return I.useMemo(function(){return t.hooks.dragPreview()},[t])}function wl(t,e){var n=ji(t,e);E(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var r,i=(r=Ee(),I.useMemo(function(){return new sl(r)},[r])),o=function(a,l){var c=Ee(),d=I.useMemo(function(){return new dl(c.getBackend())},[c]);return Te(function(){return d.dragSourceOptions=a||null,d.reconnect(),function(){return d.disconnectDragSource()}},[d,a]),Te(function(){return d.dragPreviewOptions=l||null,d.reconnect(),function(){return d.disconnectDragPreview()}},[d,l]),d}(n.options,n.previewOptions);return ml(n,i,o),[Oi(n.collect,i,o),bl(o),jl(o)]}function Il(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function ki(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Sl=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),ki(this,"spec",void 0),ki(this,"monitor",void 0),this.spec=e,this.monitor=n}return Il(t,[{key:"canDrop",value:function(){var e=this.spec,n=this.monitor;return!e.canDrop||e.canDrop(n.getItem(),n)}},{key:"hover",value:function(){var e=this.spec,n=this.monitor;e.hover&&e.hover(n.getItem(),n)}},{key:"drop",value:function(){var e=this.spec,n=this.monitor;if(e.drop)return e.drop(n.getItem(),n)}}]),t}();function Ol(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Ci(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ci(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ci(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function kl(t,e,n){var r=Ee(),i=function(a,l){var c=I.useMemo(function(){return new Sl(a,l)},[l]);return I.useEffect(function(){c.spec=a},[a]),c}(t,e),o=function(a){var l=a.accept;return I.useMemo(function(){return E(a.accept!=null,"accept must be defined"),Array.isArray(l)?l:[l]},[l])}(t);Te(function(){var a=function(u,m,f){var g=f.getRegistry(),h=g.addTarget(u,m);return[h,function(){return g.removeTarget(h)}]}(o,i,r),l=Ol(a,2),c=l[0],d=l[1];return e.receiveHandlerId(c),n.receiveHandlerId(c),d},[r,e,i,n,o.map(function(a){return a.toString()}).join("|")])}function Cl(t){return I.useMemo(function(){return t.hooks.dropTarget()},[t])}function Ni(t,e){var n,r=ji(t,e),i=(n=Ee(),I.useMemo(function(){return new al(n)},[n])),o=function(a){var l=Ee(),c=I.useMemo(function(){return new hl(l.getBackend())},[l]);return Te(function(){return c.dropTargetOptions=a||null,c.reconnect(),function(){return c.disconnectDropTarget()}},[a]),c}(r.options);return kl(r,i,o),[Oi(r.collect,i,o),Cl(o)]}function Nl(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,a,l=[],c=!0,d=!1;try{for(i=i.call(n);!(c=(o=i.next()).done)&&(l.push(o.value),!r||l.length!==r);c=!0);}catch(u){d=!0,a=u}finally{try{c||i.return==null||i.return()}finally{if(d)throw a}}return l}}(t,e)||function(n,r){if(n){if(typeof n=="string")return Di(n,r);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Di(n,r)}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
14
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Di(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ti(t){var e=null;return function(){return e==null&&(e=t()),e}}function Dl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Ei(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Tl=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Ei(this,"entered",[]),Ei(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return Dl(t,[{key:"enter",value:function(e){var n=this,r=this.entered.length;return this.entered=function(i,o){var a=new Set,l=function(d){return a.add(d)};i.forEach(l),o.forEach(l);var c=[];return a.forEach(function(d){return c.push(d)}),c}(this.entered.filter(function(i){return n.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),[e]),r===0&&this.entered.length>0}},{key:"leave",value:function(e){var n,r,i=this.entered.length;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(function(o){return o!==r})),i>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),El=Ti(function(){return/firefox/i.test(navigator.userAgent)}),_i=Ti(function(){return!!window.safari});function _l(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function rt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Pi=function(){function t(e,n){(function(T,L){if(!(T instanceof L))throw new TypeError("Cannot call a class as a function")})(this,t),rt(this,"xs",void 0),rt(this,"ys",void 0),rt(this,"c1s",void 0),rt(this,"c2s",void 0),rt(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(T,L){return e[T]<e[L]?-1:1});for(var a,l,c=[],d=[],u=0;u<r-1;u++)a=e[u+1]-e[u],l=n[u+1]-n[u],c.push(a),d.push(l/a);for(var m=[d[0]],f=0;f<c.length-1;f++){var g=d[f],h=d[f+1];if(g*h<=0)m.push(0);else{a=c[f];var p=c[f+1],v=a+p;m.push(3*v/((v+p)/g+(v+a)/h))}}m.push(d[d.length-1]);for(var x,b=[],j=[],S=0;S<m.length-1;S++){x=d[S];var w=m[S],C=1/c[S],N=w+m[S+1]-x-x;b.push((x-w-N)*C),j.push(N*C*C)}this.xs=e,this.ys=n,this.c1s=m,this.c2s=b,this.c3s=j}return _l(t,[{key:"interpolate",value:function(e){var n=this.xs,r=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,l=n.length-1;if(e===n[l])return r[l];for(var c,d=0,u=a.length-1;d<=u;){var m=n[c=Math.floor(.5*(d+u))];if(m<e)d=c+1;else{if(!(m>e))return r[c];u=c-1}}var f=e-n[l=Math.max(0,u)],g=f*f;return r[l]+i[l]*f+o[l]*g+a[l]*f*g}}]),t}();function Ai(t){var e=t.nodeType===1?t:t.parentElement;if(!e)return null;var n=e.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function kt(t){return{x:t.clientX,y:t.clientY}}function Pl(t,e,n,r,i){var o,a,l,c=(o=e).nodeName==="IMG"&&(El()||!((a=document.documentElement)!==null&&a!==void 0&&a.contains(o))),d=Ai(c?t:e),u={x:n.x-d.x,y:n.y-d.y},m=t.offsetWidth,f=t.offsetHeight,g=r.anchorX,h=r.anchorY,p=function(w,C,N,T){var L=w?C.width:N,z=w?C.height:T;return _i()&&w&&(z/=window.devicePixelRatio,L/=window.devicePixelRatio),{dragPreviewWidth:L,dragPreviewHeight:z}}(c,e,m,f),v=p.dragPreviewWidth,x=p.dragPreviewHeight,b=i.offsetX,j=i.offsetY,S=j===0||j;return{x:b===0||b?b:new Pi([0,.5,1],[u.x,u.x/m*v,u.x+v-m]).interpolate(g),y:S?j:(l=new Pi([0,.5,1],[u.y,u.y/f*x,u.y+x-f]).interpolate(h),_i()&&c&&(l+=(window.devicePixelRatio-1)*x),l)}}var Mi="__NATIVE_FILE__",Ri="__NATIVE_URL__",Li="__NATIVE_TEXT__",zi="__NATIVE_HTML__";const Fi=Object.freeze(Object.defineProperty({__proto__:null,FILE:Mi,HTML:zi,TEXT:Li,URL:Ri},Symbol.toStringTag,{value:"Module"}));function bn(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var it;function Ct(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var jn=(Ct(it={},Mi,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Ct(it,zi,{exposeProperties:{html:function(t,e){return bn(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Ct(it,Ri,{exposeProperties:{urls:function(t,e){return bn(t,e,"").split(`
|
15
|
+
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Ct(it,Li,{exposeProperties:{text:function(t,e){return bn(t,e,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),it);function Al(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function Hi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ml=function(){function t(e){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Hi(this,"item",void 0),Hi(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return Al(t,[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(e.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var n=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(i){r[i]={value:n.config.exposeProperties[i](e,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,n){return n===e.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function wn(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(jn).filter(function(n){return jn[n].matchesTypes.some(function(r){return e.indexOf(r)>-1})})[0]||null}function Rl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function In(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ll=function(){function t(e,n){(function(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")})(this,t),In(this,"ownerDocument",null),In(this,"globalContext",void 0),In(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return Rl(t,[{key:"window",get:function(){return this.globalContext?this.globalContext:typeof window<"u"?window:void 0}},{key:"document",get:function(){var e;return(e=this.globalContext)!==null&&e!==void 0&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}}]),t}();function Ui(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ui(Object(n),!0).forEach(function(r){R(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zl(t,e,n){return e&&function(r,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}(t.prototype,e),t}function R(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Sn,Fl=function(){function t(e,n,r){var i=this;(function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")})(this,t),R(this,"options",void 0),R(this,"actions",void 0),R(this,"monitor",void 0),R(this,"registry",void 0),R(this,"enterLeaveCounter",void 0),R(this,"sourcePreviewNodes",new Map),R(this,"sourcePreviewNodeOptions",new Map),R(this,"sourceNodes",new Map),R(this,"sourceNodeOptions",new Map),R(this,"dragStartSourceIds",null),R(this,"dropTargetIds",[]),R(this,"dragEnterTargetIds",[]),R(this,"currentNativeSource",null),R(this,"currentNativeHandle",null),R(this,"currentDragSourceNode",null),R(this,"altKeyPressed",!1),R(this,"mouseMoveTimeoutTimer",null),R(this,"asyncEndDragFrameId",null),R(this,"dragOverTargetIds",null),R(this,"lastClientOffset",null),R(this,"hoverRafId",null),R(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&Ai(a)||null}),R(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),R(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),R(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),R(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=kt(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var c=o.dataTransfer,d=wn(c);if(i.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=i.monitor.getSourceId(),m=i.sourceNodes.get(u),f=i.sourcePreviewNodes.get(u)||m;if(f){var g=i.getCurrentSourcePreviewNodeOptions(),h=Pl(m,f,l,{anchorX:g.anchorX,anchorY:g.anchorY},{offsetX:g.offsetX,offsetY:g.offsetY});c.setDragImage(f,h.x,h.y)}}try{c==null||c.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(d)i.beginDragNativeItem(d);else{if(c&&!c.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),R(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleTopDragEnterCapture",function(o){if(i.dragEnterTargetIds=[],i.enterLeaveCounter.enter(o.target)&&!i.monitor.isDragging()){var a=o.dataTransfer,l=wn(a);l&&i.beginDragNativeItem(l,a)}}),R(this,"handleTopDragEnter",function(o){var a=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=o.altKey,a.length>0&&i.actions.hover(a,{clientOffset:kt(o)}),a.some(function(l){return i.monitor.canDropOnTarget(l)})&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),R(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),R(this,"handleTopDragOver",function(o){var a=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging())return o.preventDefault(),void(o.dataTransfer&&(o.dataTransfer.dropEffect="none"));i.altKeyPressed=o.altKey,i.lastClientOffset=kt(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(a||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(a||[]).some(function(l){return i.monitor.canDropOnTarget(l)})?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),R(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault(),i.enterLeaveCounter.leave(o.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),R(this,"handleTopDropCapture",function(o){var a;i.dropTargetIds=[],i.isDraggingNativeItem()?(o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)):wn(o.dataTransfer)&&o.preventDefault(),i.enterLeaveCounter.reset()}),R(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:kt(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),R(this,"handleSelectStart",function(o){var a=o.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(o.preventDefault(),a.dragDrop()))}),this.options=new Ll(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Tl(this.isNodeInDocument)}return zl(t,[{key:"profile",value:function(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,n=this.rootElement;n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&((e=this.window)===null||e===void 0||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,n,r){var i=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),function(){i.sourcePreviewNodes.delete(e),i.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,n,r){var i=this;this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,r);var o=function(l){return i.handleDragStart(l,e)},a=function(l){return i.handleSelectStart(l)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(e),i.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,n){var r=this,i=function(l){return r.handleDragEnter(l,e)},o=function(l){return r.handleDragOver(l,e)},a=function(l){return r.handleDrop(l,e)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return qi({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return qi({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(Fi).some(function(n){return Fi[n]===e})}},{key:"beginDragNativeItem",value:function(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(r,i){var o=new Ml(jn[r]);return o.loadDataTransfer(i),o}(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var r;return(r=n.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){var e;return this.currentDragSourceNode=null,this.rootElement&&((e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(e,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(e,n){this.dropTargetIds.unshift(n)}}]),t}(),Hl=function(t,e,n){return new Fl(t,e,n)};function Ul(t){const e=de(),n=e.selectedIds,[r,i,o]=wl(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(qe.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(qe.dragEnd())}}),[n,t]);return I.useEffect(()=>{o((Sn||((Sn=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Sn))},[o]),i}function Nt(t,e){return{parentId:t||null,index:e}}function Be(t,e){return{type:"line",index:t,level:e}}function On(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;return{parentId:((n=r.parent)===null||n===void 0?void 0:n.id)||null,index:wr(r)+1}}function Vi(t){var e;const n=function(m,f){const g=m.getBoundingClientRect(),h=f.x-Math.round(g.x),p=f.y-Math.round(g.y),v=g.height,x=p<v/2,b=!x,j=v/4,S=p>j&&p<v-j;return{x:h,inTopHalf:x,inBottomHalf:b,inMiddle:S,atTop:!S&&x,atBottom:!S&&b}}(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:a,prevNode:l}=t,[c,d]=function(m,f,g,h){return m?m.isInternal?h.atTop?[f,m]:h.inMiddle?[m,m]:[m,g]:h.inTopHalf?[f,m]:[m,g]:[f,null]}(o,l,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:Nt(o.id,null),cursor:(u=o.id,{type:"highlight",id:u})};var u;if(!c)return{drop:Nt((e=d==null?void 0:d.parent)===null||e===void 0?void 0:e.id,0),cursor:Be(0,0)};if(yr(c)){const m=bt(i,(d==null?void 0:d.level)||0,c.level);return{drop:On(c,m),cursor:Be(c.rowIndex+1,m)}}if(xr(c)){const m=bt(i,(d==null?void 0:d.level)||0,c.level);return{drop:On(c,m),cursor:Be(c.rowIndex+1,m)}}if(br(c)){const m=bt(i,0,c.level+1);return m>c.level?{drop:Nt(c.id,0),cursor:Be(c.rowIndex+1,m)}:{drop:On(c,m),cursor:Be(c.rowIndex+1,m)}}return{drop:Nt(c==null?void 0:c.id,0),cursor:Be(c.rowIndex+1,c.level+1)}}const ql=Ke.memo(function({index:t,style:e}){vr(),function(){if(I.useContext(pr)===null)throw new Error("Provide a NodesContext")}();const n=de(),r=function(h){const p=de(),v=p.at(h);if(!v)throw new Error(`Could not find node for index: ${h}`);return I.useMemo(()=>{const x=v.clone();return p.visibleNodes[h]=x,x},[...Object.values(v.state),v])}(t),i=I.useRef(null),o=Ul(r),a=function(h,p){const v=de(),[x,b]=Ni(()=>({accept:"NODE",canDrop:()=>v.canDrop(),hover:(j,S)=>{const w=S.getClientOffset();if(!h.current||!w)return;const{cursor:C,drop:N}=Vi({element:h.current,offset:w,indent:v.indent,node:p,prevNode:p.prev,nextNode:p.next});N&&v.dispatch(qe.hovering(N.parentId,N.index)),S.canDrop()?C&&v.showCursor(C):v.hideCursor()},drop:(j,S)=>{if(!S.canDrop())return null;let{parentId:w,index:C,dragIds:N}=v.state.dnd;Cr(v.props.onMove,{dragIds:N,parentId:w===et?null:w,index:C===null?0:C,dragNodes:v.dragNodes,parentNode:v.get(w)}),v.open(w)}}),[p,h.current,v.props]);return b}(i,r),l=I.useCallback(h=>{i.current=h,a(h)},[a]),c=n.indent*r.level,d=I.useMemo(()=>({paddingLeft:c}),[c]),u=I.useMemo(()=>{var h,p;return Object.assign(Object.assign({},e),{top:parseFloat(e.top)+((p=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&p!==void 0?p:0)})},[e,n.props.padding,n.props.paddingTop]),m={role:"treeitem","aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};I.useEffect(()=>{var h;!r.isEditing&&r.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);const f=n.renderNode,g=n.renderRow;return s.jsx(g,{node:r,innerRef:l,attrs:m,children:s.jsx(f,{node:r,tree:n,style:d,dragHandle:o})})});let kn="",Bi=null;function Wi(){vr();const t=de();return s.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var n;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const a=o.nextSibling,l=o.parent;t.focus(a||l,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey)return e.preventDefault(),void Ir(e.currentTarget);if(e.key==="Tab"&&e.shiftKey)return e.preventDefault(),void Sr(e.currentTarget);if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey)return t.select(t.focusedNode),void t.activate(t.focusedNode);if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode))}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection)return void t.focus(i);{if(!i)return;const o=t.focusedNode;return void(o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode))}}if(e.key==="ArrowRight"){const i=t.focusedNode;return i?void(i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id)):void 0}if(e.key==="ArrowLeft"){const i=t.focusedNode;return!i||i.isRoot?void 0:void(i.isInternal&&i.isOpen?t.close(i.id):((n=i.parent)===null||n===void 0?void 0:n.isRoot)||t.focus(i.parent))}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection)return e.preventDefault(),void t.selectAll();if(e.key==="a"&&!e.metaKey&&t.props.onCreate)return void t.createLeaf();if(e.key==="A"&&!e.metaKey)return t.props.onCreate?void t.createInternal():void 0;if(e.key==="Home")return e.preventDefault(),void t.focus(t.firstNode);if(e.key==="End")return e.preventDefault(),void t.focus(t.lastNode);if(e.key==="Enter"){const i=t.focusedNode;return!i||!i.isEditable||!t.props.onRename?void 0:void setTimeout(()=>{i&&t.edit(i)})}if(e.key===" "){e.preventDefault();const i=t.focusedNode;return i?void(i.isLeaf?(i.select(),i.activate()):i.toggle()):void 0}if(e.key==="*"){const i=t.focusedNode;return i?void t.openSiblings(i):void 0}if(e.key==="PageUp")return e.preventDefault(),void t.pageUp();e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(Bi),kn+=e.key,Bi=setTimeout(()=>{kn=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"&&o.toLowerCase().startsWith(kn)});r&&t.focus(r.id)},children:s.jsx(ma,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:xa,innerElementType:wa,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:ql})})}function Gi(t){return t.isFiltered?function(e,n){const r={},i=[];function o(l){if(!l.isRoot&&n(l)){r[l.id]=!0;let c=l.parent;for(;c;)r[c.id]=!0,c=c.parent}if(l.children)for(let c of l.children)o(c)}function a(l){var c;l.level>=0&&r[l.id]&&i.push(l),l.isOpen&&((c=l.children)===null||c===void 0||c.forEach(a))}return o(e),a(e),i.forEach(Ki),i}(t.root,t.isMatch.bind(t)):function(e){const n=[];function r(i){var o;i.level>=0&&n.push(i),i.isOpen&&((o=i.children)===null||o===void 0||o.forEach(r))}return r(e),n.forEach(Ki),n}(t.root)}function Ki(t,e){t.rowIndex=e}const $i=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var Cn=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(d){try{c(r.next(d))}catch(u){o(u)}}function l(d){try{c(r.throw(d))}catch(u){o(u)}}function c(d){var u;d.done?i(d.value):(u=d.value,u instanceof n?u:new n(function(m){m(u)})).then(a,l)}c((r=r.apply(t,e||[])).next())})};const{safeRun:Z,identify:Se,identifyNull:ve}=Ko;class at{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=Er(this),this.visibleNodes=Gi(this),this.idToIndex=$i(this.visibleNodes)}update(e){this.props=e,this.root=Er(this),this.visibleNodes=Gi(this),this.idToIndex=$i(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;return(n=Je(e,this.props.childrenAccessor||"children"))!==null&&n!==void 0?n:null}accessId(e){const n=Je(e,this.props.idAccessor||"id");if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const a=Math.min(i,o),l=Math.max(i,o);return this.visibleNodes.slice(a,l+1)}indexOf(e){const n=kr(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Cn(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?Tr(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:Dr(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",l=yield Z(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});l&&(this.focus(l),setTimeout(()=>{this.edit(l).then(()=>{this.select(l),this.activate(l)})}))})}delete(e){return Cn(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Se),r=n.map(i=>this.get(i)).filter(i=>!!i);yield Z(this.props.onDelete,{nodes:r,ids:n})})}edit(e){const n=Se(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(Kt(n)),new Promise(r=>{at.editPromise=r})}submit(e,n){return Cn(this,void 0,void 0,function*(){if(!e)return;const r=Se(e);yield Z(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(Kt(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Kt(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(ve(e));n&&Z(this.props.onActivate,n)}resolveEdit(e){const n=at.editPromise;n&&n(e),at.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(He(Se(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&Z(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex-r;let o=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;o=o>r?r:Math.max(r-i,0),this.focus(this.at(o))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a=a<i?i:Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=Se(e);r&&this.dispatch(He(i)),this.dispatch(na(i)),this.dispatch(Mr(i)),this.dispatch(Yt(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=Se(e);this.dispatch(Ar(n)),Z(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(ve(e));n&&(this.dispatch(He(n.id)),this.dispatch(Pr(n.id)),this.dispatch(Mr(n.id)),this.dispatch(Yt(n.id)),this.scrollTo(n),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=Se(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(He(n)),this.dispatch(Ar(this.nodesBetween(r,i))),this.dispatch(Pr(this.nodesBetween(r,ve(n)))),this.dispatch(Yt(n)),this.scrollTo(n),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),Z(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(He((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&Z(this.props.onFocus,this.focusedNode),Z(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(Se)),i=ve(e.anchor),o=ve(e.mostRecent);this.dispatch(ra({ids:r,anchor:i,mostRecent:o})),Z(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;return e.type==="highlight"?e.id:null}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;const n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&jr(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i!="boolean"||!i}hideCursor(){this.dispatch(qe.cursor({type:"none"}))}showCursor(e){this.dispatch(qe.cursor(e))}open(e){const n=ve(e);n&&(this.isOpen(n)||(this.dispatch($t.open(n,this.isFiltered)),Z(this.props.onToggle,n)))}close(e){const n=ve(e);n&&this.isOpen(n)&&(this.dispatch($t.close(n,this.isFiltered)),Z(this.props.onToggle,n))}toggle(e){const n=ve(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=ve(e);if(!n)return;const r=Gt(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(n){if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){jt(this.root,e=>{e.isInternal&&e.open()})}closeAll(){jt(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=Se(e);return this.openParents(r),Nr(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var n,r,i;if(!e)return!1;if(e===et)return!0;const o=(n=this.props.openByDefault)===null||n===void 0||n;return this.isFiltered?(r=this.state.nodes.open.filtered[e])===null||r===void 0||r:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){return!Je(e,this.props.disableEdit||(()=>!1))}isDraggable(e){return!Je(e,this.props.disableDrag||(()=>!1))}isDragging(e){const n=ve(e);return!!n&&this.state.nodes.drag.id===n}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=ve(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(He(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Wi}get renderRow(){return this.props.renderRow||Zo}get renderNode(){return this.props.children||Jo}get renderDragPreview(){return this.props.renderDragPreview||Rr}get renderCursor(){return this.props.renderCursor||Qo}}function oe(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Yi=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nn=()=>Math.random().toString(36).substring(7).split("").join("."),Dt={INIT:`@@redux/INIT${Nn()}`,REPLACE:`@@redux/REPLACE${Nn()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Nn()}`};function Xi(t,e,n){if(typeof t!="function")throw new Error(oe(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(oe(0));if(typeof e=="function"&&n===void 0&&(n=e,e=void 0),n!==void 0){if(typeof n!="function")throw new Error(oe(1));return n(Xi)(t,e)}let r=t,i=e,o=new Map,a=o,l=0,c=!1;function d(){a===o&&(a=new Map,o.forEach((g,h)=>{a.set(h,g)}))}function u(){if(c)throw new Error(oe(3));return i}function m(g){if(typeof g!="function")throw new Error(oe(4));if(c)throw new Error(oe(5));let h=!0;d();const p=l++;return a.set(p,g),function(){if(h){if(c)throw new Error(oe(6));h=!1,d(),a.delete(p),o=null}}}function f(g){if(!function(h){if(typeof h!="object"||h===null)return!1;let p=h;for(;Object.getPrototypeOf(p)!==null;)p=Object.getPrototypeOf(p);return Object.getPrototypeOf(h)===p||Object.getPrototypeOf(h)===null}(g))throw new Error(oe(7));if(g.type===void 0)throw new Error(oe(8));if(typeof g.type!="string")throw new Error(oe(17));if(c)throw new Error(oe(9));try{c=!0,i=r(i,g)}finally{c=!1}return(o=a).forEach(h=>{h()}),g}return f({type:Dt.INIT}),{dispatch:f,subscribe:m,getState:u,replaceReducer:function(g){if(typeof g!="function")throw new Error(oe(10));r=g,f({type:Dt.REPLACE})},[Yi]:function(){const g=m;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(oe(11));function p(){const v=h;v.next&&v.next(u())}return p(),{unsubscribe:g(p)}},[Yi](){return this}}}}}function Qi(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{(function(o){Object.keys(o).forEach(a=>{const l=o[a];if(l(void 0,{type:Dt.INIT})===void 0)throw new Error(oe(12));if(l(void 0,{type:Dt.PROBE_UNKNOWN_ACTION()})===void 0)throw new Error(oe(13))})})(n)}catch(o){i=o}return function(o={},a){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const u=r[d],m=n[u],f=o[u],g=m(f,a);if(g===void 0)throw a&&a.type,new Error(oe(14));c[u]=g,l=l||g!==f}return l=l||r.length!==Object.keys(o).length,l?c:o}}const Vl=Qi({nodes:Qi({focus:function(t={id:null,treeFocused:!1},e){return e.type==="FOCUS"?Object.assign(Object.assign({},t),{id:e.id,treeFocused:!0}):e.type==="TREE_BLUR"?Object.assign(Object.assign({},t),{treeFocused:!1}):t},edit:function(t={id:null},e){return e.type==="EDIT"?Object.assign(Object.assign({},t),{id:e.id}):t},open:function(t={filtered:{},unfiltered:{}},e){return e.type.startsWith("VISIBILITY")?e.filtered?Object.assign(Object.assign({},t),{filtered:_r(t.filtered,e)}):Object.assign(Object.assign({},t),{unfiltered:_r(t.unfiltered,e)}):t},selection:function(t=Ue().nodes.selection,e){const n=t.ids;switch(e.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},t),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},t),{ids:new Set([e.id])});case"SELECTION_ADD":return e.ids.length===0?t:(e.ids.forEach(r=>n.add(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_REMOVE":return e.ids.length===0?t:(e.ids.forEach(r=>n.delete(r)),Object.assign(Object.assign({},t),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},t),{ids:e.ids,mostRecent:e.mostRecent,anchor:e.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},t),{mostRecent:e.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},t),{anchor:e.id});default:return t}},drag:function(t=Ue().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}}),dnd:function(t=Ue().dnd,e){switch(e.type){case"DND_CURSOR":return Object.assign(Object.assign({},t),{cursor:e.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},t),{dragId:e.id,dragIds:e.dragIds});case"DND_DRAG_END":return Ue().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},t),{parentId:e.parentId,index:e.index});default:return t}}}),Bl=Ue();function Wl({treeProps:t,imperativeHandle:e,children:n}){const r=I.useRef(null),i=I.useRef(null),o=I.useRef(Xi(Vl,Ue(t))),a=Ss.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>Bl),l=I.useMemo(()=>new at(o.current,t,r,i),[]),c=I.useRef(0);return I.useMemo(()=>{c.current+=1,l.update(t)},[...Object.values(t),a.nodes.open]),I.useImperativeHandle(e,()=>l),I.useEffect(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),I.useEffect(()=>{l.props.searchTerm||o.current.dispatch($t.clear(!0))},[l.props.searchTerm]),s.jsx(fr.Provider,{value:l,children:s.jsx(mr.Provider,{value:c.current,children:s.jsx(pr.Provider,{value:a.nodes,children:s.jsx(gr.Provider,{value:a.dnd,children:s.jsx(rl,Object.assign({backend:Hl,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function Gl(t){return function(){const e=de(),[,n]=Ni(()=>({accept:"NODE",canDrop:(r,i)=>!!i.isOver({shallow:!0})&&e.canDrop(),hover:(r,i)=>{if(!i.isOver({shallow:!0}))return;const o=i.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:a,drop:l}=Vi({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});l&&e.dispatch(qe.hovering(l.parentId,l.index)),i.canDrop()?a&&e.showCursor(a):e.hideCursor()}}),[e]);n(e.listEl)}(),t.children}function Kl(){const t=de().props.renderContainer||Wi;return s.jsx(s.Fragment,{children:s.jsx(t,{})})}function $l(){const t=de(),{offset:e,mouse:n,item:r,isDragging:i}=(o=m=>({offset:m.getSourceClientOffset(),mouse:m.getClientOffset(),item:m.getItem(),isDragging:m.isDragging()}),a=Ee().getMonitor(),l=Nl(Ii(a,o),2),c=l[0],d=l[1],I.useEffect(function(){return a.subscribeToOffsetChange(d)}),I.useEffect(function(){return a.subscribeToStateChange(d)}),c);var o,a,l,c,d;const u=t.props.renderDragPreview||Rr;return s.jsx(u,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class Zi{constructor(e){this.root=function(n){const r=new Ji({id:"ROOT"},null);return r.children=n.map(i=>Dn(i,r)),r}(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;n&&r&&(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function Dn(t,e){const n=new Ji(t,e);return t.children&&(n.children=t.children.map(r=>Dn(r,n))),n}class Ji{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=Dn(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let Yl=0;function Xl(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
16
|
+
Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=function(r){const[i,o]=I.useState(r),a=I.useMemo(()=>new Zi(i),[i]);return[i,{onMove:c=>{for(const d of c.dragIds)a.move({id:d,parentId:c.parentId,index:c.index});o(a.data)},onRename:({name:c,id:d})=>{a.update({id:d,changes:{name:c}}),o(a.data)},onCreate:({parentId:c,index:d,type:u})=>{const m={id:"simple-tree-id-"+Yl++,name:""};return u==="internal"&&(m.children=[]),a.create({parentId:c,index:d,data:m}),o(a.data),m},onDelete:c=>{c.ids.forEach(d=>a.drop({id:d})),o(a.data)}}]}(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}return t}const Ql=I.forwardRef(function(t,e){const n=Xl(t);return s.jsxs(Wl,{treeProps:n,imperativeHandle:e,children:[s.jsx(Gl,{children:s.jsx(Kl,{})}),s.jsx($l,{})]})});function Zl(t,e){const n=U.c(11),{delayMs:r,whenVisible:i,disabled:o}=e,a=o!==void 0&&o,l=I.useRef(void 0);let c,d,u,m,f;return n[0]!==t?(c=()=>{l.current=t},d=[t],n[0]=t,n[1]=c,n[2]=d):(c=n[1],d=n[2]),I.useEffect(c,d),n[3]!==r||n[4]!==a||n[5]!==i?(u=()=>{if(r===null||a)return;const g=setInterval(()=>{var h;i&&document.visibilityState!=="visible"||((h=l.current)==null||h.call(l))},r);return()=>clearInterval(g)},m=[r,i,a],n[3]=r,n[4]=a,n[5]=i,n[6]=u,n[7]=m):(u=n[6],m=n[7]),I.useEffect(u,m),n[8]!==a||n[9]!==i?(f=()=>{var g;document.visibilityState==="visible"&&i&&!a&&((g=l.current)==null||g.call(l))},n[8]=a,n[9]=i,n[10]=f):f=n[10],Os(document,"visibilitychange",f),null}function Jl(){return["compact","medium","full","columns"]}const ec=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:n}),e[0]=n,e[1]=r):r=e[1],r},Tt=t=>{const e=U.c(10);let n,r,i,o,a;return e[0]!==t?({children:n,className:r,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]),e[4]!==r?(o=$e("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",r),e[4]=r,e[5]=o):o=e[5],e[6]!==n||e[7]!==i||e[8]!==o?(a=s.jsx("div",{...i,className:o,children:n}),e[6]=n,e[7]=i,e[8]=o,e[9]=a):a=e[9],a},tc=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r},es=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],nc=()=>{const t=U.c(31),[e,n]=ks(),{saveAppConfig:r}=Le();let i,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Mn(Cs),t[0]=i):i=t[0],t[1]!==e?(o={resolver:i,defaultValues:e},t[1]=e,t[2]=o):o=t[2];const a=Rn(o);let l;t[3]!==r||t[4]!==n?(l=async j=>{await r({config:j}).then(()=>{n(j)}).catch(()=>{n(j)})},t[3]=r,t[4]=n,t[5]=l):l=t[5];const c=l;let d,u,m,f,g,h,p,v,x,b;return t[6]!==e.width?(d=[e.width],t[6]=e.width,t[7]=d):d=t[7],I.useEffect(rc,d),t[8]!==a||t[9]!==c?(u=a.handleSubmit(c),t[8]=a,t[9]=c,t[10]=u):u=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("div",{children:[s.jsx(ec,{children:"Notebook Settings"}),s.jsx(tc,{children:"Configure how your notebook or application looks and behaves."})]}),t[11]=m):m=t[11],t[12]!==a.control?(f=s.jsxs(Et,{title:"Display",children:[s.jsx(_,{control:a.control,name:"width",render:sc}),s.jsx(_,{control:a.control,name:"app_title",render:oc})]}),t[12]=a.control,t[13]=f):f=t[13],t[14]!==a.control?(g=s.jsxs(Et,{title:"Custom Files",children:[s.jsx(_,{control:a.control,name:"css_file",render:ac}),s.jsx(_,{control:a.control,name:"html_head_file",render:lc})]}),t[14]=a.control,t[15]=g):g=t[15],t[16]!==a.control?(h=s.jsx(Et,{title:"Data",children:s.jsx(_,{control:a.control,name:"sql_output",render:dc})}),t[16]=a.control,t[17]=h):h=t[17],t[18]!==a.control?(p=s.jsx(Et,{title:"Exporting outputs",children:s.jsx(_,{control:a.control,name:"auto_download",render:uc})}),t[18]=a.control,t[19]=p):p=t[19],t[20]!==f||t[21]!==g||t[22]!==h||t[23]!==p?(v=s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[f,g,h,p]}),t[20]=f,t[21]=g,t[22]=h,t[23]=p,t[24]=v):v=t[24],t[25]!==v||t[26]!==u?(x=s.jsxs("form",{onChange:u,className:"flex flex-col gap-6",children:[m,v]}),t[25]=v,t[26]=u,t[27]=x):x=t[27],t[28]!==a||t[29]!==x?(b=s.jsx(Ln,{...a,children:x}),t[28]=a,t[29]=x,t[30]=b):b=t[30],b},Et=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx("h3",{className:"text-base font-semibold mb-1",children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-y-2",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function rc(){window.dispatchEvent(new Event("resize"))}function ic(t){return s.jsx("option",{value:t,children:t},t)}function sc(t){const{field:e}=t;return s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"Width"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"app-width-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(ic)})}),s.jsx(M,{})]})}function oc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"App title"}),s.jsx(A,{children:s.jsx(ke,{...e,value:e.value??"",onChange:n=>{e.onChange(n.target.value),zn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{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 ac(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"Custom CSS"}),s.jsx(A,{children:s.jsx(ke,{...e,value:e.value??"",placeholder:"custom.css",onChange:n=>{e.onChange(n.target.value),zn.safeParse(n.target.value).success&&(document.title=n.target.value)}})}),s.jsx(M,{})]}),s.jsx(F,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function lc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{className:"shrink-0",children:"HTML Head"}),s.jsx(A,{children:s.jsx(ke,{...e,value:e.value??"",placeholder:"head.html",onChange:n=>{e.onChange(n.target.value)}})}),s.jsx(M,{})]}),s.jsxs(F,{children:["A filepath to an HTML file to be injected into the"," ",s.jsx(G,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function cc(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function dc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-row items-center space-x-1 space-y-0",children:[s.jsx(D,{children:"SQL Output Type"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"sql-output-select",onChange:n=>{e.onChange(n.target.value),ze({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:es.map(cc)})}),s.jsx(M,{})]}),s.jsxs(F,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",s.jsx(G,{className:"inline",children:"native"}),". See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}function uc(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:"flex flex-col gap-2",children:[s.jsx(A,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"html-checkbox",checked:e.value.includes("html"),onCheckedChange:()=>{e.onChange(dt(e.value,"html"))}}),s.jsx(D,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"ipynb-checkbox",checked:e.value.includes("ipynb"),onCheckedChange:()=>{e.onChange(dt(e.value,"ipynb"))}}),s.jsx(D,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(M,{})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(G,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}const hc=Fn("flex items-center justify-center m-0 leading-none font-medium border border-foreground/10 shadow-xs-solid hover:cursor-pointer active:shadow-none dark:border-border text-sm",{variants:{color:{gray:"mo-button gray",white:"mo-button white",green:"mo-button green",red:"mo-button red",yellow:"mo-button yellow","hint-green":"mo-button hint-green",disabled:"mo-button disabled active:shadow-xs-solid"},shape:{rectangle:"rounded",circle:"rounded-full"},size:{small:"",medium:""}},compoundVariants:[{size:"small",shape:"circle",class:"h-[24px] w-[24px] px-[5.5px] py-[5.5px]"},{size:"medium",shape:"circle",class:"px-2 py-2"},{size:"small",shape:"rectangle",class:"px-1 py-1 h-[24px] w-[24px]"},{size:"medium",shape:"rectangle",class:"px-3 py-2"}],defaultVariants:{color:"gray",size:"medium",shape:"rectangle"}}),fc=Fn("font-mono w-full flex-1 inline-flex items-center justify-center rounded px-2.5 text-foreground/60 h-[36px] hover:shadow-md hover:cursor-pointer focus:shadow-md focus:outline-hidden text-[hsl(0, 0%, 43.5%)] bg-transparent hover:bg-background focus:bg-background"),_t=Ke.forwardRef((t,e)=>{const n=U.c(15);let r,i,o,a,l,c,d;return n[0]!==t?({color:i,shape:a,size:l,className:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=a,n[5]=l):(r=n[1],i=n[2],o=n[3],a=n[4],l=n[5]),n[6]!==r||n[7]!==i||n[8]!==a||n[9]!==l?(c=Hn(hc({color:i,shape:a,size:l}),r),n[6]=r,n[7]=i,n[8]=a,n[9]=l,n[10]=c):c=n[10],n[11]!==o||n[12]!==e||n[13]!==c?(d=s.jsx("button",{ref:e,className:c,...o,children:o.children}),n[11]=o,n[12]=e,n[13]=c,n[14]=d):d=n[14],d});_t.displayName="Button",Ke.forwardRef((t,e)=>{const n=U.c(9);let r,i,o,a;return n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]),n[3]!==r?(o=Hn(fc(),r),n[3]=r,n[4]=o):o=n[4],n[5]!==i||n[6]!==e||n[7]!==o?(a=s.jsx("input",{ref:e,className:o,...i}),n[5]=i,n[6]=e,n[7]=o,n[8]=a):a=n[8],a}).displayName="Input";let Pt=null;class pc{constructor(e){this.view=void 0,this.abortController=new AbortController,this.view=e.view,this.view.dom.addEventListener("focus",()=>{Pt=new WeakRef(this.view)},{signal:this.abortController.signal,capture:!0}),this.update()}update(){const e=this.view.dom.querySelector(".cm-vimCursorLayer");if(e instanceof HTMLElement)if(Ns())e.style.display="none";else{const n=(Pt==null?void 0:Pt.deref())===this.view;e.style.display=n?"":"none"}}destroy(){this.abortController.abort()}}const ts={map:{args:["lhs","rhs"]},nmap:{mode:"normal",args:["lhs","rhs"]},vmap:{mode:"visual",args:["lhs","rhs"]},imap:{mode:"insert",args:["lhs","rhs"]},noremap:{args:["lhs","rhs"]},nnoremap:{mode:"normal",args:["lhs","rhs"]},vnoremap:{mode:"visual",args:["lhs","rhs"]},inoremap:{mode:"insert",args:["lhs","rhs"]},unmap:{args:["lhs"]},nunmap:{mode:"normal",args:["lhs"]},vunmap:{mode:"visual",args:["lhs"]},iunmap:{mode:"insert",args:["lhs"]},mapclear:{},nmapclear:{mode:"normal"},vmapclear:{mode:"visual"},imapclear:{mode:"insert"}};function gc(t,e){const n=t.split(/\s+/),r=n[0];let i=0;if(r in ts){const o=ts[r],a={};for(const c of o.args||[]){if(i+=1,!(i<n.length))return void(e&&e(`Not enough arguments for "${r}" command: "${t}"`));a[c]=n[i]}const l={name:r};return"args"in o&&(l.args=a),"mode"in o&&(l.mode=o.mode),l}e&&e(`Unknown vimrc command: "${t}"`)}var ns;const mc=Fe(()=>{ne.defineAction("goToDefinition",t=>{const e=t.cm6;return Es(e)}),ne.mapCommand("gd","action","goToDefinition",{},{context:"normal"}),ne.defineEx("write","w",t=>{const e=t.cm6;e&&e.state.facet(ut).saveNotebook()})}),vc=Fe(async()=>{var n;const t=ft.get(Bn),e=(n=t.keymap)==null?void 0:n.vimrc;if(e)try{W.log(`Loading vimrc from ${e}`);const r=(await _s().sendFileDetails({path:e})).contents;if(!r)return void W.error(`Failed to load vimrc from ${e}`);const i=function(o,a){const l=[];for(const c of o.split(`
|
17
|
+
`)){if(c.startsWith('"')||c.trim()==="")continue;const d=gc(c,a);d&&l.push(d)}return l}(r,W.warn);(function(o){function a(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ne.map(u.args.lhs,u.args.rhs,u.mode):ne.map(u.args.lhs,u.args.rhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function l(u){u.args&&u.args.lhs&&u.args.rhs?u.mode?ne.noremap(u.args.lhs,u.args.rhs,u.mode):ne.noremap(u.args.lhs,u.args.rhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function c(u){u.args&&u.args.lhs?u.mode?ne.unmap(u.args.lhs,u.mode):ne.unmap(u.args.lhs):W.warn(`Could not execute vimrc command "${u.name}: expected arguments"`)}function d(u){u.mode?ne.mapclear(u.mode):ne.mapclear()}for(const u of o)"map|nmap|vmap|imap".split("|").includes(u.name)?a(u):"noremap|nnoremap|vnoremap|inoremap".split("|").includes(u.name)?l(u):"unmap|nunmap|vunmap|iunmap".split("|").includes(u.name)?c(u):"mapclear|nmapclear|vmapclear|imapclear".split("|").includes(u.name)?d(u):W.warn(`Could not execute vimrc command "${u.name}: unknown command"`)})(i)}catch(r){W.error("Failed to load vimrc:",r)}});class At{constructor(){this.instances=new Set,this.isBroadcasting=!1}addInstance(e){this.instances.add(e);const n=ht(e);n?n.on("vim-mode-change",r=>{var i;this.isBroadcasting||(Ft("mode"in r,'Expected event to have a "mode" property'),this.isBroadcasting=!0,i=()=>{this.broadcastModeChange(e,r.mode,r.subMode),this.isBroadcasting=!1},"scheduler"in window?window.scheduler.postTask(i,{priority:"background"}):"requestIdleCallback"in window?requestIdleCallback(i):setTimeout(i,0))}):W.warn("Expected CodeMirror instance to have CodeMirror instance state")}removeInstance(e){this.instances.delete(e)}broadcastModeChange(e,n,r){Ft("exitInsertMode"in ne,"Vim does not have an exitInsertMode method"),Ft("exitVisualMode"in ne,"Vim does not have an exitVisualMode method");for(const i of this.instances)if(i!==e){const o=ht(i);if(!o){W.warn("Expected CodeMirror instance to have CodeMirror instance state");continue}const a=o.setSelections.bind(o);if(o.setSelections=()=>[],!rs(o)){W.warn("Expected CodeMirror instance to have Vim state");continue}const l=o.state.vim;switch(n){case"normal":l.insertMode&&ne.exitInsertMode(o,!0),l.visualMode&&ne.exitVisualMode(o,!0);break;case"insert":l.insertMode||ne.handleKey(o,"i","")}o.setSelections=a}}}function rs(t){return t.state.vim!==void 0}ns=At,At.INSTANCES=new ns;const yc=["default","vim"];function xc(t,e){switch(t.preset){case"default":return[xe.of(is()),xe.of(ss(e)),Ht.low(xe.of([{key:"Escape",preventDefault:!0,run:n=>(n.contentDOM.blur(),!0)}]))];case"vim":return[xe.of(jc()),xe.of(ss(e)),xe.of([{key:"Enter",run:n=>{var i;const r=ht(n);return!!((i=r==null?void 0:r.state.vim)!=null&&i.insertMode)&&Ms(n)}}]),Ht.high(wc("d",n=>n.state.doc.toString()==="",n=>n.state.doc.toString()===""?(n.state.facet(ut).deleteCell(),!0):!1)),As({status:!1}),Ht.high((mc(),vc(),[xe.of([{key:"j",run:n=>{if(Ds(n,!0)&&qn(n)){const r=n.state.facet(ut),i=n.state.facet(Vn);return r.moveToNextCell({cellId:i,before:!1,noCreate:!0}),!0}return!1}}]),xe.of([{key:"k",run:n=>{if(Ts(n)&&qn(n)){const r=n.state.facet(ut),i=n.state.facet(Vn);return r.moveToNextCell({cellId:i,before:!0,noCreate:!0}),!0}return!1}}]),xe.of([{linux:"Ctrl-[",win:"Ctrl-[",run:n=>{const r=ht(n);return r?rs(r)?!!r.state.vim.insertMode&&(ne.exitInsertMode(r,!0),!0):(W.warn("Expected CodeMirror instance to have Vim state"),!1):(W.warn("Expected CodeMirror instance to have CodeMirror instance state"),!1)}}]),Un.define(n=>(requestAnimationFrame(()=>{At.INSTANCES.addInstance(n)}),{destroy(){At.INSTANCES.removeInstance(n)}})),Un.define(n=>new pc({view:n}))]))];default:return Ps(t.preset),[]}}const bc=new Set([Wn,Gn]),is=Fe(()=>Rs.filter(t=>!bc.has(t.run))),ss=t=>[{key:t.getHotkey("cell.toggleComment").key,run:Wn},{key:t.getHotkey("cell.toggleBlockComment").key,run:Gn}],jc=Fe(()=>{const t=new Set(["Enter","Ctrl-v"]);return is().filter(e=>!t.has(e.key||e.mac||e.linux||e.win||""))});function wc(t,e,n){let r="",i=0;return xe.of([{any:(o,a)=>{const l=a.key,c=a.timeStamp;return l!==t||!e(o)?(r="",i=0,!1):r===t&&c-i<500&&n(o)?(r="",i=0,!0):(r=l,i=c,!1)}}])}const Tn=Ye(!1),Ic=()=>{const t=U.c(82),[e,n]=Xe(Tn),[r,i]=I.useState(null);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[a,l]=I.useState(o),[c,d]=Kn(),u=pt(Ls),{saveUserConfig:m}=Le();let f,g;t[1]!==n?(f=()=>n(Sc),t[1]=n,t[2]=f):f=t[2],zs("global.showHelp",f),t[3]!==c||t[4]!==m||t[5]!==d?(g=async Oe=>{const re={...c};d(Oe),await m({config:Oe}).catch(X=>{throw d(re),X})},t[3]=c,t[4]=m,t[5]=d,t[6]=g):g=t[6];const h=g;let p;t[7]!==c||t[8]!==r||t[9]!==h?(p=async Oe=>{if(!r)return;const re=Oe.join("-"),X={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides,[r]:re}}};i(null),l([]),await h(X)},t[7]=c,t[8]=r,t[9]=h,t[10]=p):p=t[10];const v=p;let x,b,j;if(t[11]!==c||t[12]!==r||t[13]!==v||t[14]!==u||t[15]!==e||t[16]!==a||t[17]!==h){j=Symbol.for("react.early_return_sentinel");{const Oe=async()=>{if(!r)return;const X={...c,keymap:{...c.keymap,overrides:{...c.keymap.overrides}}};delete X.keymap.overrides[r],i(null),l([]),await h(X)};let re;t[21]!==c||t[22]!==h?(re=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;const X={...c,keymap:{...c.keymap,overrides:{}}};i(null),l([]),await h(X)},t[21]=c,t[22]=h,t[23]=re):re=t[23],x=re,e?b=X=>{const me=u.getHotkey(X);if(r===X){const ct=Fs(X);return s.jsxs("div",{children:[s.jsx(ke,{defaultValue:a.join("+"),placeholder:me.name,onKeyDown:le=>{le.preventDefault();const Ce=[];if(le.key==="Meta"||le.key==="Control"||le.key==="Alt"||le.key==="Shift"||(le.metaKey&&Ce.push(Yn()?"Cmd":"Meta"),le.ctrlKey&&Ce.push("Ctrl"),le.altKey&&Ce.push("Alt"),le.shiftKey&&Ce.push("Shift"),le.key==="-"))return;if(le.key==="Escape"&&Ce.length===0)return i(null),void l([]);let An=le.key.toLowerCase();le.key===" "&&(An="Space"),Ce.push(An),v(Ce)},autoFocus:!0,endAdornment:s.jsx(ue,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{i(null),l([])},children:s.jsx(gt,{className:"w-4 h-4"})})}),s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),ct.key!==me.key&&s.jsxs("span",{className:"text-xs cursor-pointer text-primary",onClick:Oe,children:["Reset to default:"," ",s.jsx("span",{className:"font-mono",children:ct.key})]})]})]},X)}return s.jsxs("div",{className:"grid grid-cols-[auto_2fr_3fr] gap-2 items-center",children:[u.isEditable(X)?s.jsx(Xn,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{l([]),i(X)}}):s.jsx("div",{className:"w-3 h-3"}),s.jsx($n,{className:"justify-end",shortcut:me.key}),s.jsx("span",{children:me.name.toLowerCase()})]},X)}:j=null}t[11]=c,t[12]=r,t[13]=v,t[14]=u,t[15]=e,t[16]=a,t[17]=h,t[18]=x,t[19]=b,t[20]=j}else x=t[18],b=t[19],j=t[20];if(j!==Symbol.for("react.early_return_sentinel"))return j;const S=b;let w,C,N,T,L,z,V,$,K,B,J,Y,ee,ae,O,y,k,we,ye,Ie,Pe,Ae,Me,Re,lt;if(t[24]!==c.keymap.preset||t[25]!==u||t[26]!==e||t[27]!==S||t[28]!==n){const Oe=u.getHotkeyGroups(),re=(me,ct)=>{const le=Oe[me];return s.jsxs("div",{className:"mb-[40px] gap-2 flex flex-col",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:me}),ct]}),le.map(S)]})},X=me=>re(me,s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",c.keymap.preset==="vim"?s.jsxs(s.Fragment,{children:[s.jsx($n,{shortcut:Yn()?"Cmd":"Ctrl"}),s.jsx(G,{children:"Esc"})]}):s.jsx(G,{children:"Esc"})," ","in a cell to enter command mode"]}));N=Ut,ee=e,t[47]!==n?(ae=me=>n(me),t[47]=n,t[48]=ae):ae=t[48],C=Hs,J="sm:items-center sm:top-0",t[49]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(Us,{}),t[49]=Y):Y=t[49],w=Qn,$=!1,K="max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",t[50]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qs,{children:s.jsx(Vs,{children:"Shortcuts"})}),t[50]=B):B=t[50],z="flex flex-row gap-3",V=s.jsxs("div",{className:"w-1/2",children:[re("Editing"),re("Markdown")]}),O="w-1/2",y=re("Navigation"),k=re("Running Cells"),we=re("Creation and Ordering"),T=X("Command"),L=re("Other"),t[24]=c.keymap.preset,t[25]=u,t[26]=e,t[27]=S,t[28]=n,t[29]=w,t[30]=C,t[31]=N,t[32]=T,t[33]=L,t[34]=z,t[35]=V,t[36]=$,t[37]=K,t[38]=B,t[39]=J,t[40]=Y,t[41]=ee,t[42]=ae,t[43]=O,t[44]=y,t[45]=k,t[46]=we}else w=t[29],C=t[30],N=t[31],T=t[32],L=t[33],z=t[34],V=t[35],$=t[36],K=t[37],B=t[38],J=t[39],Y=t[40],ee=t[41],ae=t[42],O=t[43],y=t[44],k=t[45],we=t[46];return t[51]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx("span",{className:"text-destructive",children:"Reset all to default"}),t[51]=ye):ye=t[51],t[52]!==x?(Ie=s.jsx(ue,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:x,tabIndex:-1,children:ye}),t[52]=x,t[53]=Ie):Ie=t[53],t[54]!==T||t[55]!==L||t[56]!==Ie||t[57]!==O||t[58]!==y||t[59]!==k||t[60]!==we?(Pe=s.jsxs("div",{className:O,children:[y,k,we,T,L,Ie]}),t[54]=T,t[55]=L,t[56]=Ie,t[57]=O,t[58]=y,t[59]=k,t[60]=we,t[61]=Pe):Pe=t[61],t[62]!==z||t[63]!==V||t[64]!==Pe?(Ae=s.jsxs("div",{className:z,children:[V,Pe]}),t[62]=z,t[63]=V,t[64]=Pe,t[65]=Ae):Ae=t[65],t[66]!==w||t[67]!==$||t[68]!==K||t[69]!==B||t[70]!==Ae?(Me=s.jsxs(w,{usePortal:$,className:K,children:[B,Ae]}),t[66]=w,t[67]=$,t[68]=K,t[69]=B,t[70]=Ae,t[71]=Me):Me=t[71],t[72]!==C||t[73]!==J||t[74]!==Y||t[75]!==Me?(Re=s.jsxs(C,{className:J,children:[Y,Me]}),t[72]=C,t[73]=J,t[74]=Y,t[75]=Me,t[76]=Re):Re=t[76],t[77]!==N||t[78]!==ee||t[79]!==ae||t[80]!==Re?(lt=s.jsx(N,{open:ee,onOpenChange:ae,children:Re}),t[77]=N,t[78]=ee,t[79]=ae,t[80]=Re,t[81]=lt):lt=t[81],lt};function Sc(t){return!t}var Oc=Bs();const os="marimo:copilot:signedIn",as=Ks(os,null,void 0,{getOnInit:!0}),ls=Ye(null),Mt=Ye(null);function cs(){const t=localStorage.getItem(os)==="true",e=Ws();return t&&e.completion.copilot==="github"}const ge=W.get("@github/copilot-language-server");class kc extends $s{constructor(...e){super(...e),this.documentVersion=0,this.hasOpenedDocument=!1,this.getCompletionInternal=async(n,r)=>await this._request("textDocument/inlineCompletion",{...n,textDocument:{...n.textDocument,version:r}}),this.throttledGetCompletionInternal=function(n,r,i){var o=!0,a=!0;if(typeof n!="function")throw new TypeError("Expected a function");return js(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),ws(n,r,{leading:o,maxWait:r,trailing:a})}(this.getCompletionInternal,200)}async _request(e,n){try{return await this.request(e,n)}catch(r){throw ge.error("#request: Error",r),r}}async notify(e,n){return ge.debug("#notify",e,n),super.notify(e,n)}getInitializationOptions(){const e={name:"marimo",version:"0.1.0"};return{...super.getInitializationOptions(),workspaceFolders:[],capabilities:{workspace:{workspaceFolders:!1}},initializationOptions:{editorInfo:e,editorPluginInfo:e}}}isDisabled(){return!cs()}async textDocumentDidOpen(e){return this.isDisabled()?e:(this.hasOpenedDocument=!0,super.textDocumentDidOpen(e))}async textDocumentCompletion(e){return[]}async textDocumentDidChange(e){if(this.isDisabled())return e;this.hasOpenedDocument||await this.textDocumentDidOpen({textDocument:{uri:e.textDocument.uri,languageId:"python",version:e.textDocument.version,text:e.contentChanges[0].text}});const n=e.contentChanges;n.length!==1&&ge.warn("#textDocumentDidChange: Multiple changes detected. This is not supported.",n);const r=n[0];"range"in r&&ge.warn("#textDocumentDidChange: Copilot doesn't support range changes.",r);const i=Ys(r.text);return super.textDocumentDidChange({...e,contentChanges:[{text:i}],textDocument:Xs.VersionedTextDocumentIdentifier.create(e.textDocument.uri,++this.documentVersion)})}textDocumentHover(e){return Promise.resolve({contents:[]})}signOut(){return this._request("signOut",{})}async signInInitiate(){ge.log("#signInInitiate: Starting sign-in flow");try{const e=await this._request("signIn",{});return ge.log("#signInInitiate: Sign-in flow started successfully"),e}catch(e){throw ge.warn("#signInInitiate: Failed to start sign-in flow",e),e}}async signInConfirm(e){ge.log("#signInConfirm: Confirming sign-in");try{const n=await this._request("signInConfirm",e);return ge.log("#signInConfirm: Sign-in confirmed successfully"),n}catch(n){throw ge.warn("#signInConfirm: Failed to confirm sign-in",n),n}}async signedIn(){try{const{status:e}=await this._request("checkStatus",{});return ge.log("#checkStatus: Status check completed",{status:e}),e==="SignedIn"||e==="AlreadySignedIn"||e==="OK"}catch(e){throw ge.warn("#signedIn: Failed to check sign-in status",e),e}}async getCompletion(e){if(this.isDisabled())return null;const n=this.documentVersion;if(e.textDocument.version=n,n===0)return null;var r;r=n,ft.set(Mt,r);const i=await this.throttledGetCompletionInternal(e,n);var o;return o=n,ft.get(Mt)===o&&ft.set(Mt,null),n!==this.documentVersion?null:i??null}}const ds="/__marimo_copilot__.py",us=`file://${ds}`,Cc=Fe(()=>new Nc);class Nc extends Oc.Transport{constructor(){super(),this.delegate=void 0,this.delegate=void 0}getWsUrl(){return Zs().getLSPURL("copilot").toString()}async tryConnect(e=3,n=1e3){for(let r=1;r<=e;r++)try{return this.delegate||(this.delegate=new Js.WebSocketTransport(this.getWsUrl())),await this.delegate.connect(),void W.log("Copilot#connect: Connected successfully")}catch(i){if(W.warn(`Copilot#connect: Connection attempt ${r}/${e} failed`,i),r===e)throw this.delegate=void 0,ze({variant:"danger",title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Please check settings and try again."}),i;await new Promise(o=>setTimeout(o,n))}}async connect(){return await Gs(Bn,e=>e.completion.copilot==="github"),await eo(),this.tryConnect()}close(){var e;(e=this.delegate)==null||e.close(),this.delegate=void 0}async sendData(e,n){var r;return n=Math.min(n??5e3,5e3),(r=this.delegate)==null?void 0:r.sendData(e,n)}}const st=Fe(()=>new kc({rootUri:us,workspaceFolders:null,transport:Cc()}));function Dc(){return Qs({documentUri:us,client:st(),languageId:"copilot",hoverEnabled:!1,completionEnabled:!1,definitionEnabled:!1,renameEnabled:!1,codeActionsEnabled:!1,signatureHelpEnabled:!1,diagnosticsEnabled:!1,sendIncrementalChanges:!1})}const hs=I.memo(()=>{const[t,e]=Xe(as),[n,r]=Xe(ls),[i,o]=I.useState(),[a,l]=I.useState(!1),c=async m=>{m.preventDefault(),l(!0);try{const{verificationUri:f,status:g,userCode:h}=await async function(){return await st().signInInitiate()}();gs(g)?e(!0):(r("signingIn"),o({url:f,code:h}))}finally{l(!1)}},d=async m=>{if(m.preventDefault(),i){l(!0);try{const f=await async function(g){const h=st();try{W.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");const{status:p}=await h.signInConfirm({userCode:g});return gs(p)?(W.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(W.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:p}),{success:!1})}catch(p){return ps(p)?(W.error("Copilot#tryFinishSignIn: Connection error during sign-in",p),{success:!1,error:"connection"}):await async function(v){for(let x=0;x<fs;x++)try{if(await new Promise(b=>setTimeout(b,Tc)),await v.signedIn())return W.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(b){if(W.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:x+1,maxRetries:fs}),ps(b))return{success:!1,error:"connection"}}return W.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}(h)}}(i.code);f.success?(e(!0),r("signedIn")):f.error==="connection"?(r("connectionError"),ze({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:s.jsx(ue,{onClick:c,children:"Retry"})})):r("signInFailed")}finally{l(!1)}}},u=async m=>{m.preventDefault(),await async function(){await st().signOut()}(),e(!1),r("signedOut")};return(()=>{switch(n??(t?"signedIn":"connecting")){case"connecting":return s.jsx(mt,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return s.jsxs("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[s.jsx("li",{children:s.jsxs("div",{className:"flex items-center",children:["Copy this code:",s.jsx("strong",{className:"ml-2",children:i==null?void 0:i.code}),s.jsx(no,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{i&&(await ro(i.code),ze({description:"Copied to clipboard"}))}})]})}),s.jsxs("li",{children:["Enter the code at this link:",s.jsx("a",{href:i==null?void 0:i.url,target:"_blank",rel:"noreferrer",className:io({variant:"link",size:"xs"}),children:i==null?void 0:i.url})]}),s.jsxs("li",{children:["Click here when done:",s.jsxs(ue,{size:"xs",onClick:d,className:"ml-1",children:[a&&s.jsx(Zn,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),a?s.jsx(Zn,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return s.jsxs("div",{className:"flex items-center gap-5",children:[s.jsxs(mt,{className:"font-normal flex items-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center bg-(--grass-7) rounded-full p-1 mr-2",children:s.jsx(to,{className:"h-3 w-3 text-white"})}),"Connected"]}),s.jsx(ue,{onClick:u,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(mt,{className:"font-normal flex",children:[s.jsx(gt,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),s.jsx("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),s.jsx(ue,{onClick:c,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(mt,{className:"font-normal flex",children:[s.jsx(gt,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),s.jsxs("div",{className:"text-sm",children:["For troubleshooting, see the"," ",s.jsx(ie,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});hs.displayName="CopilotConfig";const fs=5,Tc=3e3;function ps(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function gs(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}const Ec={openai:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M22.2819%209.8211a5.9847%205.9847%200%200%200-.5157-4.9108%206.0462%206.0462%200%200%200-6.5098-2.9A6.0651%206.0651%200%200%200%204.9807%204.1818a5.9847%205.9847%200%200%200-3.9977%202.9%206.0462%206.0462%200%200%200%20.7427%207.0966%205.98%205.98%200%200%200%20.511%204.9107%206.051%206.051%200%200%200%206.5146%202.9001A5.9847%205.9847%200%200%200%2013.2599%2024a6.0557%206.0557%200%200%200%205.7718-4.2058%205.9894%205.9894%200%200%200%203.9977-2.9001%206.0557%206.0557%200%200%200-.7475-7.0729zm-9.022%2012.6081a4.4755%204.4755%200%200%201-2.8764-1.0408l.1419-.0804%204.7783-2.7582a.7948.7948%200%200%200%20.3927-.6813v-6.7369l2.02%201.1686a.071.071%200%200%201%20.038.052v5.5826a4.504%204.504%200%200%201-4.4945%204.4944zm-9.6607-4.1254a4.4708%204.4708%200%200%201-.5346-3.0137l.142.0852%204.783%202.7582a.7712.7712%200%200%200%20.7806%200l5.8428-3.3685v2.3324a.0804.0804%200%200%201-.0332.0615L9.74%2019.9502a4.4992%204.4992%200%200%201-6.1408-1.6464zM2.3408%207.8956a4.485%204.485%200%200%201%202.3655-1.9728V11.6a.7664.7664%200%200%200%20.3879.6765l5.8144%203.3543-2.0201%201.1685a.0757.0757%200%200%201-.071%200l-4.8303-2.7865A4.504%204.504%200%200%201%202.3408%207.872zm16.5963%203.8558L13.1038%208.364%2015.1192%207.2a.0757.0757%200%200%201%20.071%200l4.8303%202.7913a4.4944%204.4944%200%200%201-.6765%208.1042v-5.6772a.79.79%200%200%200-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759%200%200%200-.7854%200L9.409%209.2297V6.8974a.0662.0662%200%200%201%20.0284-.0615l4.8303-2.7866a4.4992%204.4992%200%200%201%206.6802%204.66zM8.3065%2012.863l-2.02-1.1638a.0804.0804%200%200%201-.038-.0567V6.0742a4.4992%204.4992%200%200%201%207.3757-3.4537l-.142.0805L8.704%205.459a.7948.7948%200%200%200-.3927.6813zm1.0976-2.3654l2.602-1.4998%202.6069%201.4998v2.9994l-2.5974%201.4997-2.6067-1.4997Z'/%3e%3c/svg%3e",anthropic:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAnthropic%3c/title%3e%3cpath%20d='M17.3041%203.541h-3.6718l6.696%2016.918H24Zm-10.6082%200L0%2020.459h3.7442l1.3693-3.5527h7.0052l1.3693%203.5528h3.7442L10.5363%203.5409Zm-.3712%2010.2232%202.2914-5.9456%202.2914%205.9456Z'/%3e%3c/svg%3e",google:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGoogle%3c/title%3e%3cpath%20d='M12.48%2010.92v3.28h7.84c-.24%201.84-.853%203.187-1.787%204.133-1.147%201.147-2.933%202.4-6.053%202.4-4.827%200-8.6-3.893-8.6-8.72s3.773-8.72%208.6-8.72c2.6%200%204.507%201.027%205.907%202.347l2.307-2.307C18.747%201.44%2016.133%200%2012.48%200%205.867%200%20.307%205.387.307%2012s5.56%2012%2012.173%2012c3.573%200%206.267-1.173%208.373-3.36%202.16-2.16%202.84-5.213%202.84-7.667%200-.76-.053-1.467-.173-2.053H12.48z'/%3e%3c/svg%3e",ollama:"data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOllama%3c/title%3e%3cpath%20d='M16.361%2010.26a.894.894%200%200%200-.558.47l-.072.148.001.207c0%20.193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86%200%200%200%20.517-.436.752.752%200%200%200%20.08-.498c-.064-.453-.33-.782-.724-.897a1.06%201.06%200%200%200-.466%200zm-9.203.005c-.305.096-.533.32-.65.639a1.187%201.187%200%200%200-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894%200%200%200-.565-.472%201.02%201.02%200%200%200-.474.007Zm4.184%202c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365%200%200%200-.175-.48.394.394%200%200%200-.181-.033c-.126%200-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396%200%200%200-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589%201.226-1.787%202.114-.04.176-.045.234-.045.53%200%20.294.005.357.043.524.264%201.16%201.332%202.017%202.714%202.173.3.033%201.596.033%201.896%200%201.11-.125%202.064-.727%202.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523%200-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873%206.873%200%200%200-.855-.031zm.645.937a3.283%203.283%200%200%201%201.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115%203.115%200%200%201-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46%201.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653%201.653%200%200%200-.683.298C5.617.74%205.173%201.666%204.985%202.819c-.07.436-.119%201.04-.119%201.503%200%20.544.064%201.24.155%201.721.02.107.031.202.023.208a8.12%208.12%200%200%201-.187.152%205.324%205.324%200%200%200-.949%201.02%205.49%205.49%200%200%200-.94%202.339%206.625%206.625%200%200%200-.023%201.357c.091.78.325%201.438.727%202.04l.13.195-.037.064c-.269.452-.498%201.105-.605%201.732-.084.496-.095.629-.095%201.294%200%20.67.009.803.088%201.266.095.555.288%201.143.503%201.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405%207.405%200%200%200-.548%201.873c-.062.417-.071.552-.071.991%200%20.56.031.832.148%201.279L3.42%2024h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915%200%200%200-.194-.25%201.74%201.74%200%200%201-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787%200%200%200%20.223-.531c0-.195-.07-.355-.224-.522a3.136%203.136%200%200%201-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814%201.353-1.336%202.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467%201.352-.561.17-.035.25-.04.569-.04.319%200%20.398.005.569.04a4.07%204.07%200%200%201%201.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016%201.144.23%202.14%201.173%202.581%202.437.385%201.108.276%202.267-.296%203.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001%201.053.493.539.801%201.866.708%203.036-.062.772-.26%201.463-.533%201.854a2.096%202.096%200%200%201-.224.258.916.916%200%200%200-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498%201.295.253%201.008.231%202.01-.059%202.581a.845.845%200%200%200-.044.098c0%20.006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016%200-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378%200-1.628-.083-.645-.182-1.082-.348-1.525a6.083%206.083%200%200%200-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625%206.625%200%200%200-.024-1.358%205.512%205.512%200%200%200-.939-2.339%205.325%205.325%200%200%200-.95-1.02%208.097%208.097%200%200%201-.186-.152.692.692%200%200%201%20.023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8%201.205-2.116%203.01a6.805%206.805%200%200%200-.097.726c0%20.036-.007.066-.015.066a.96.96%200%200%201-.149-.078A4.857%204.857%200%200%200%2012%203.03c-.832%200-1.687.243-2.456.698a.958.958%200%200%201-.148.078c-.008%200-.015-.03-.015-.066a6.71%206.71%200%200%200-.097-.725C8.997%201.392%208.337.319%207.46.048a2.096%202.096%200%200%200-.585-.041Zm.293%201.402c.248.197.523.759.682%201.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102%201.24l.002.475-.12.175-.118.178h-.278c-.324%200-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438%208.438%200%200%201%20.016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36%202.028.212%203.145-.019.14-.024.151-.057.144l-.238-.06a3.693%203.693%200%200%200-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z'/%3e%3c/svg%3e",azure:"data:image/svg+xml,%3csvg%20width='150'%20height='150'%20viewBox='0%200%2096%2096'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='e399c19f-b68f-429d-b176-18c2117ff73c'%20x1='-1032.172'%20x2='-1059.213'%20y1='145.312'%20y2='65.426'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23114a8b'/%3e%3cstop%20offset='1'%20stop-color='%230669bc'/%3e%3c/linearGradient%3e%3clinearGradient%20id='ac2a6fc2-ca48-4327-9a3c-d4dcc3256e15'%20x1='-1023.725'%20x2='-1029.98'%20y1='108.083'%20y2='105.968'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-opacity='.3'/%3e%3cstop%20offset='.071'%20stop-opacity='.2'/%3e%3cstop%20offset='.321'%20stop-opacity='.1'/%3e%3cstop%20offset='.623'%20stop-opacity='.05'/%3e%3cstop%20offset='1'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='a7fee970-a784-4bb1-af8d-63d18e5f7db9'%20x1='-1027.165'%20x2='-997.482'%20y1='147.642'%20y2='68.561'%20gradientTransform='matrix(1%200%200%20-1%201075%20158)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%233ccbf4'/%3e%3cstop%20offset='1'%20stop-color='%232892df'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20fill='url(%23e399c19f-b68f-429d-b176-18c2117ff73c)'%20d='M33.338%206.544h26.038l-27.03%2080.087a4.152%204.152%200%200%201-3.933%202.824H8.149a4.145%204.145%200%200%201-3.928-5.47L29.404%209.368a4.152%204.152%200%200%201%203.934-2.825z'/%3e%3cpath%20fill='%230078d4'%20d='M71.175%2060.261h-41.29a1.911%201.911%200%200%200-1.305%203.309l26.532%2024.764a4.171%204.171%200%200%200%202.846%201.121h23.38z'/%3e%3cpath%20fill='url(%23ac2a6fc2-ca48-4327-9a3c-d4dcc3256e15)'%20d='M33.338%206.544a4.118%204.118%200%200%200-3.943%202.879L4.252%2083.917a4.14%204.14%200%200%200%203.908%205.538h20.787a4.443%204.443%200%200%200%203.41-2.9l5.014-14.777%2017.91%2016.705a4.237%204.237%200%200%200%202.666.972H81.24L71.024%2060.261l-29.781.007L59.47%206.544z'/%3e%3cpath%20fill='url(%23a7fee970-a784-4bb1-af8d-63d18e5f7db9)'%20d='M66.595%209.364a4.145%204.145%200%200%200-3.928-2.82H33.648a4.146%204.146%200%200%201%203.928%202.82l25.184%2074.62a4.146%204.146%200%200%201-3.928%205.472h29.02a4.146%204.146%200%200%200%203.927-5.472z'/%3e%3c/svg%3e",bedrock:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20y='0'%20x='0'%20id='Layer_1'%20version='1.1'%20viewBox='0%200%20300.67%20179.8'%3e%3cstyle%20id='style1855'%20type='text/css'%3e.st1{fill-rule:evenodd;clip-rule:evenodd;fill:%23f90}%3c/style%3e%3cg%20transform='translate(-1.668%20-1.1)'%20id='g1865'%3e%3cpath%20id='path1857'%20d='M86.4%2066.4c0%203.7.4%206.7%201.1%208.9.8%202.2%201.8%204.6%203.2%207.2.5.8.7%201.6.7%202.3%200%201-.6%202-1.9%203L83.2%2092c-.9.6-1.8.9-2.6.9-1%200-2-.5-3-1.4-1.4-1.5-2.6-3.1-3.6-4.7-1-1.7-2-3.6-3.1-5.9-7.8%209.2-17.6%2013.8-29.4%2013.8-8.4%200-15.1-2.4-20-7.2-4.9-4.8-7.4-11.2-7.4-19.2%200-8.5%203-15.4%209.1-20.6%206.1-5.2%2014.2-7.8%2024.5-7.8%203.4%200%206.9.3%2010.6.8%203.7.5%207.5%201.3%2011.5%202.2v-7.3c0-7.6-1.6-12.9-4.7-16-3.2-3.1-8.6-4.6-16.3-4.6-3.5%200-7.1.4-10.8%201.3-3.7.9-7.3%202-10.8%203.4-1.6.7-2.8%201.1-3.5%201.3-.7.2-1.2.3-1.6.3-1.4%200-2.1-1-2.1-3.1v-4.9c0-1.6.2-2.8.7-3.5.5-.7%201.4-1.4%202.8-2.1%203.5-1.8%207.7-3.3%2012.6-4.5C41%201.9%2046.2%201.3%2051.7%201.3c11.9%200%2020.6%202.7%2026.2%208.1%205.5%205.4%208.3%2013.6%208.3%2024.6v32.4zM45.8%2081.6c3.3%200%206.7-.6%2010.3-1.8%203.6-1.2%206.8-3.4%209.5-6.4%201.6-1.9%202.8-4%203.4-6.4.6-2.4%201-5.3%201-8.7v-4.2c-2.9-.7-6-1.3-9.2-1.7-3.2-.4-6.3-.6-9.4-.6-6.7%200-11.6%201.3-14.9%204-3.3%202.7-4.9%206.5-4.9%2011.5%200%204.7%201.2%208.2%203.7%2010.6%202.4%202.5%205.9%203.7%2010.5%203.7zm80.3%2010.8c-1.8%200-3-.3-3.8-1-.8-.6-1.5-2-2.1-3.9L96.7%2010.2c-.6-2-.9-3.3-.9-4%200-1.6.8-2.5%202.4-2.5h9.8c1.9%200%203.2.3%203.9%201%20.8.6%201.4%202%202%203.9l16.8%2066.2%2015.6-66.2c.5-2%201.1-3.3%201.9-3.9.8-.6%202.2-1%204-1h8c1.9%200%203.2.3%204%201%20.8.6%201.5%202%201.9%203.9l15.8%2067%2017.3-67c.6-2%201.3-3.3%202-3.9.8-.6%202.1-1%203.9-1h9.3c1.6%200%202.5.8%202.5%202.5%200%20.5-.1%201-.2%201.6-.1.6-.3%201.4-.7%202.5l-24.1%2077.3c-.6%202-1.3%203.3-2.1%203.9-.8.6-2.1%201-3.8%201h-8.6c-1.9%200-3.2-.3-4-1-.8-.7-1.5-2-1.9-4L156%2023l-15.4%2064.4c-.5%202-1.1%203.3-1.9%204-.8.7-2.2%201-4%201zm128.5%202.7c-5.2%200-10.4-.6-15.4-1.8-5-1.2-8.9-2.5-11.5-4-1.6-.9-2.7-1.9-3.1-2.8-.4-.9-.6-1.9-.6-2.8v-5.1c0-2.1.8-3.1%202.3-3.1.6%200%201.2.1%201.8.3.6.2%201.5.6%202.5%201%203.4%201.5%207.1%202.7%2011%203.5%204%20.8%207.9%201.2%2011.9%201.2%206.3%200%2011.2-1.1%2014.6-3.3%203.4-2.2%205.2-5.4%205.2-9.5%200-2.8-.9-5.1-2.7-7-1.8-1.9-5.2-3.6-10.1-5.2L246%2052c-7.3-2.3-12.7-5.7-16-10.2-3.3-4.4-5-9.3-5-14.5%200-4.2.9-7.9%202.7-11.1%201.8-3.2%204.2-6%207.2-8.2%203-2.3%206.4-4%2010.4-5.2%204-1.2%208.2-1.7%2012.6-1.7%202.2%200%204.5.1%206.7.4%202.3.3%204.4.7%206.5%201.1%202%20.5%203.9%201%205.7%201.6%201.8.6%203.2%201.2%204.2%201.8%201.4.8%202.4%201.6%203%202.5.6.8.9%201.9.9%203.3v4.7c0%202.1-.8%203.2-2.3%203.2-.8%200-2.1-.4-3.8-1.2-5.7-2.6-12.1-3.9-19.2-3.9-5.7%200-10.2.9-13.3%202.8-3.1%201.9-4.7%204.8-4.7%208.9%200%202.8%201%205.2%203%207.1%202%201.9%205.7%203.8%2011%205.5l14.2%204.5c7.2%202.3%2012.4%205.5%2015.5%209.6%203.1%204.1%204.6%208.8%204.6%2014%200%204.3-.9%208.2-2.6%2011.6-1.8%203.4-4.2%206.4-7.3%208.8-3.1%202.5-6.8%204.3-11.1%205.6-4.5%201.4-9.2%202.1-14.3%202.1z'%20fill='%23252f3e'/%3e%3cg%20id='g1863'%3e%3cpath%20id='path1859'%20d='M273.5%20143.7c-32.9%2024.3-80.7%2037.2-121.8%2037.2-57.6%200-109.5-21.3-148.7-56.7-3.1-2.8-.3-6.6%203.4-4.4%2042.4%2024.6%2094.7%2039.5%20148.8%2039.5%2036.5%200%2076.6-7.6%20113.5-23.2%205.5-2.5%2010.2%203.6%204.8%207.6z'%20class='st1'/%3e%3cpath%20id='path1861'%20d='M287.2%20128.1c-4.2-5.4-27.8-2.6-38.5-1.3-3.2.4-3.7-2.4-.8-4.5%2018.8-13.2%2049.7-9.4%2053.3-5%203.6%204.5-1%2035.4-18.6%2050.2-2.7%202.3-5.3%201.1-4.1-1.9%204-9.9%2012.9-32.2%208.7-37.5z'%20class='st1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e"},_c=t=>{const e=U.c(15);let n,r,i;e[0]!==t?({provider:r,className:i,...n}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);const o=i===void 0?"":i;if(r==="openai-compatible"){let d,u;return e[4]!==o?(d=$e("h-4 w-4",o),e[4]=o,e[5]=d):d=e[5],e[6]!==d?(u=s.jsx(Ao,{className:d}),e[6]=d,e[7]=u):u=e[7],u}const a=Ec[r];let l,c;return e[8]!==o?(l=$e("h-4 w-4 grayscale dark:invert",o),e[8]=o,e[9]=l):l=e[9],e[10]!==a||e[11]!==n||e[12]!==r||e[13]!==l?(c=s.jsx("img",{src:a,alt:r,className:l,...n}),e[10]=a,e[11]=n,e[12]=r,e[13]=l,e[14]=c):c=e[14],c},ms=["anthropic/claude-opus-4-1-20250805","anthropic/claude-opus-4-20250514","anthropic/claude-sonnet-4-20250514","anthropic/claude-3-7-sonnet-latest","anthropic/claude-3-5-sonnet-latest","anthropic/claude-3-5-haiku-latest","deepseek/deepseek-v3","deepseek/deepseek-r1","google/gemini-2.5-flash-preview-05-20","google/gemini-2.5-pro-preview-06-05","google/gemini-2.0-flash","google/gemini-2.0-flash-lite","openai/o3","openai/o4-mini","openai/gpt-4.5-preview","openai/gpt-4.1","openai/gpt-4o","openai/gpt-3.5-turbo","bedrock/anthropic.claude-3-5-haiku-20241022-v1:0","bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0","bedrock/anthropic.claude-3-7-sonnet-20250219-v1:0","bedrock/meta.llama3-3-70b-instruct-v1:0","bedrock/cohere.command-r-plus-v1"],Pc=["us-east-1","us-east-2","us-west-2","eu-central-1","ap-northeast-1","ap-southeast-1"];class zt{constructor(e,n){this.providerId=void 0,this.shortModelId=void 0,this.providerId=e,this.shortModelId=n}get id(){return`${this.providerId}/${this.shortModelId}`}static parse(e){if(!e.includes("/")){const i=function(o){return o.startsWith("gpt")||o.startsWith("o3")||o.startsWith("o1")?"openai":o.startsWith("claude")?"anthropic":o.startsWith("gemini")||o.startsWith("google")?"google":"ollama"}(e);return new zt(i,e)}const[n,...r]=e.split("/");return new zt(n,r.join("/"))}}const Ac=t=>{const e=U.c(11),{value:n}=t;if(!n||n.includes("/"))return null;let r;e[0]!==n?(r=zt.parse(n),e[0]=n,e[1]=r):r=e[1];const i=r.id;let o,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("code",{className:"font-bold",children:"provider/model"}),e[2]=o):o=e[2],e[3]!==n?(a=s.jsxs("span",{children:["Model id should be in the form"," ",o,". ",n," is missing a provider."]}),e[3]=n,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("br",{}),e[5]=l):l=e[5],e[6]!==i?(c=i&&s.jsxs("span",{children:["Did you mean ",s.jsx("code",{className:"font-bold",children:i}),"?"]}),e[6]=i,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=s.jsxs(vt,{kind:"danger",className:"mt-1",children:[a,l,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d};function vs(t,e){const n=U.c(10);let r;n[0]!==e||n[1]!==t?(r=Jn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2];const i=r,o=pt(so);let a;n[3]!==e||n[4]!==o?(a=Jn(o,e),n[3]=e,n[4]=o,n[5]=a):a=n[5];const l=a,c=l!=null&&i!==l;let d;return n[6]!==i||n[7]!==c||n[8]!==l?(d={isOverridden:c,currentValue:i,overriddenValue:l},n[6]=i,n[7]=c,n[8]=l,n[9]=d):d=n[9],d}const Mc=t=>{const e=U.c(3),{name:n,children:r}=t,[i]=er(),{isOverridden:o}=vs(i,n);let a;return e[0]!==r||e[1]!==o?(a=o?s.jsx(Qe,{delayDuration:200,content:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{children:["This setting is overridden by the"," ",s.jsx(G,{className:"inline mx-px",children:"pyproject.toml"})," config."]}),s.jsxs("p",{children:["To change it, edit the project config"," ",s.jsx(G,{className:"inline mx-px",children:"pyproject.toml"}),"directly."]})]}),children:s.jsx("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:r})}):r,e[0]=r,e[1]=o,e[2]=a):a=e[2],a},H=t=>{const e=U.c(18),{userConfig:n,name:r}=t,{isOverridden:i,currentValue:o,overriddenValue:a}=vs(n,r);if(!i)return null;let l,c,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("span",{children:["This setting is overridden by"," ",s.jsx(G,{className:"inline",children:"pyproject.toml"}),"."]}),c=s.jsx("br",{}),e[0]=l,e[1]=c):(l=e[0],c=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs("span",{children:["Edit the ",s.jsx(G,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),u=s.jsx("br",{}),e[2]=d,e[3]=u):(d=e[2],u=e[3]);const m=String(o);let f,g;e[4]!==m?(f=s.jsxs("span",{children:["User value: ",s.jsx("strong",{children:m})]}),e[4]=m,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("br",{}),e[6]=g):g=e[6];const h=String(a);let p,v,x;e[7]!==h?(p=s.jsxs("span",{children:["Project value: ",s.jsx("strong",{children:h})]}),e[7]=h,e[8]=p):p=e[8],e[9]!==f||e[10]!==p?(v=s.jsxs(s.Fragment,{children:[l,c,d,u,f,g,p]}),e[9]=f,e[10]=p,e[11]=v):v=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(ur,{className:"w-3 h-3"}),e[12]=x):x=e[12];const b=String(a);let j,S;return e[13]!==b?(j=s.jsxs("span",{className:"text-(--amber-12) text-xs flex items-center gap-1 border rounded px-2 py-1 bg-(--amber-2) border-(--amber-6) ml-1",children:[x,"Overridden by pyproject.toml [",b,"]"]}),e[13]=b,e[14]=j):j=e[14],e[15]!==v||e[16]!==j?(S=s.jsx(Qe,{content:v,children:j}),e[15]=v,e[16]=j,e[17]=S):S=e[17],S},We="flex flex-row items-center space-x-1 space-y-0",Rc=t=>{const e=U.c(5),{provider:n,children:r}=t;let i,o;return e[0]!==n?(i=n&&s.jsx(_c,{provider:n,className:"mr-2"}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex items-center text-base font-semibold",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o},Ge=t=>{const e=U.c(10),{form:n,config:r,name:i,placeholder:o,testId:a,description:l}=t;let c,d;return e[0]!==r||e[1]!==l||e[2]!==i||e[3]!==o||e[4]!==a?(c=u=>{const{field:m}=u;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:We,children:[s.jsx(D,{children:"API Key"}),s.jsx(A,{children:s.jsx(ke,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,...m,value:ot(m.value),onChange:f=>{const g=f.target.value;g.includes("*")||m.onChange(g)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=i,e[3]=o,e[4]=a,e[5]=c):c=e[5],e[6]!==n.control||e[7]!==i||e[8]!==c?(d=s.jsx(_,{control:n.control,name:i,render:c}),e[6]=n.control,e[7]=i,e[8]=c,e[9]=d):d=e[9],d};function ot(t){if(t!=null)return typeof t=="string"?t:String(t)}const Rt=t=>{const e=U.c(12),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c,defaultValue:d}=t,u=c!==void 0&&c;let m,f;return e[0]!==r||e[1]!==d||e[2]!==l||e[3]!==i||e[4]!==o||e[5]!==a?(m=g=>{const{field:h}=g;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:We,children:[s.jsx(D,{children:"Base URL"}),s.jsx(A,{children:s.jsx(ke,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:o,defaultValue:d,...h,value:ot(h.value)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=d,e[2]=l,e[3]=i,e[4]=o,e[5]=a,e[6]=m):m=e[6],e[7]!==u||e[8]!==n.control||e[9]!==i||e[10]!==m?(f=s.jsx(_,{control:n.control,name:i,disabled:u,render:m}),e[7]=u,e[8]=n.control,e[9]=i,e[10]=m,e[11]=f):f=e[11],f},En=t=>{const e=U.c(13),{form:n,config:r,name:i,placeholder:o,testId:a,description:l,disabled:c,label:d}=t,u=c!==void 0&&c,m=I.useId();let f,g;return e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==i||e[5]!==o||e[6]!==a?(f=h=>{const{field:p}=h;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:We,children:[s.jsx(D,{children:d}),s.jsx(A,{children:s.jsx(ke,{list:m,"data-testid":a,className:"m-0 inline-flex",placeholder:o,...p,value:ot(p.value)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]}),s.jsx("datalist",{id:m,children:ms.map(qc)}),s.jsx(Ac,{value:ot(p.value)}),l&&s.jsx(F,{children:l})]})},e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=i,e[5]=o,e[6]=a,e[7]=f):f=e[7],e[8]!==u||e[9]!==n.control||e[10]!==i||e[11]!==f?(g=s.jsx(_,{control:n.control,name:i,disabled:u,render:f}),e[8]=u,e[9]=n.control,e[10]=i,e[11]=f,e[12]=g):g=e[12],g},Lc=t=>{const e=U.c(10),{form:n,config:r,name:i,options:o,testId:a,disabled:l}=t,c=l!==void 0&&l;let d,u;return e[0]!==r||e[1]!==i||e[2]!==o||e[3]!==a?(d=m=>{const{field:f}=m;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(P,{className:We,children:[s.jsx(D,{children:"Provider"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":a,onChange:g=>{g.target.value==="none"?f.onChange(!1):f.onChange(g.target.value)},value:ot(f.value===!0?"github":f.value===!1?"none":f.value),disabled:f.disabled,className:"inline-flex mr-2",children:o.map(Vc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:i})]})})},e[0]=r,e[1]=i,e[2]=o,e[3]=a,e[4]=d):d=e[4],e[5]!==c||e[6]!==n.control||e[7]!==i||e[8]!==d?(u=s.jsx(_,{control:n.control,name:i,disabled:c,render:d}),e[5]=c,e[6]=n.control,e[7]=i,e[8]=d,e[9]=u):u=e[9],u},_n=t=>{const e=U.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"flex flex-col gap-4 pb-4",children:n}),e[0]=n,e[1]=r):r=e[1],r},zc=t=>{const e=U.c(10),{form:n,config:r}=t;let i,o,a,l,c,d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Tt,{children:"Code Completion"}),o=s.jsx("p",{className:"text-sm text-muted-secondary",children:"Choose GitHub Copilot, Codeium, or a custom provider (such as Ollama) to enable AI-powered code completion."}),e[0]=i,e[1]=o):(i=e[0],o=e[1]),e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["none","github","codeium","custom"],e[2]=a):a=e[2],e[3]!==r||e[4]!==n?(l=s.jsx(Lc,{form:n,config:r,name:"completion.copilot",options:a,testId:"copilot-select"}),c=((u,m)=>{const f=u.getValues("completion.copilot");return f===!1?null:f==="codeium"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),s.jsx(Ge,{form:u,config:m,name:"completion.codeium_api_key",placeholder:"key",testId:"codeium-api-key-input"})]}):f==="github"?s.jsx(hs,{}):f==="custom"?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm text-muted-secondary",children:"Configure your custom AI completion provider with the following settings."}),s.jsx(En,{label:"Autocomplete Model",form:u,config:m,name:"ai.models.autocomplete_model",placeholder:"ollama/qwen2.5-coder:1.5b",testId:"custom-model-input",description:s.jsx(s.Fragment,{children:"Model to use for code completion when using a custom provider. Models should include the provider name and model name separated by a slash."})})]}):void 0})(n,r),e[3]=r,e[4]=n,e[5]=l,e[6]=c):(l=e[5],c=e[6]),e[7]!==l||e[8]!==c?(d=s.jsxs(_n,{children:[i,o,l,c]}),e[7]=l,e[8]=c,e[9]=d):d=e[9],d},_e=t=>{const e=U.c(12),{title:n,triggerClassName:r,provider:i,children:o}=t;let a,l,c,d;return e[0]!==i||e[1]!==n?(a=s.jsx(Rc,{provider:i,children:n}),e[0]=i,e[1]=n,e[2]=a):a=e[2],e[3]!==a||e[4]!==r?(l=s.jsx(lo,{className:r,children:a}),e[3]=a,e[4]=r,e[5]=l):l=e[5],e[6]!==o?(c=s.jsx(co,{wrapperClassName:"flex flex-col gap-4",children:o}),e[6]=o,e[7]=c):c=e[7],e[8]!==i||e[9]!==l||e[10]!==c?(d=s.jsxs(uo,{value:i,children:[l,c]}),e[8]=i,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},Fc=t=>{const e=U.c(55),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ne(),e[0]=i):i=e[0];const o=i;let a,l,c,d,u,m,f,g,h,p,v,x,b,j,S,w,C,N,T,L,z,V,$;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(G,{className:"inline",children:"marimo.toml"}),e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Add your API keys below or to ",a," ","to set up a provider for the Code Completion and Assistant features; see"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion/#connecting-to-an-llm",children:"docs"})," ","for more info."]}),e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(s.Fragment,{children:["Your OpenAI API key from"," ",s.jsx(ie,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]}),e[3]=c):c=e[3],e[4]!==r||e[5]!==n?(d=s.jsxs(_e,{title:"OpenAI",provider:"openai",triggerClassName:"pt-0",children:[s.jsx(Ge,{form:n,config:r,name:"ai.open_ai.api_key",placeholder:"sk-proj...",testId:"ai-openai-api-key-input",description:c}),s.jsx(Rt,{form:n,config:r,name:"ai.open_ai.base_url",placeholder:"https://api.openai.com/v1",testId:"ai-base-url-input",disabled:o})]}),e[4]=r,e[5]=n,e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs(s.Fragment,{children:["Your Anthropic API key from"," ",s.jsx(ie,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]}),e[7]=u):u=e[7],e[8]!==r||e[9]!==n?(m=s.jsx(_e,{title:"Anthropic",provider:"anthropic",children:s.jsx(Ge,{form:n,config:r,name:"ai.anthropic.api_key",placeholder:"sk-ant...",testId:"ai-anthropic-api-key-input",description:u})}),e[8]=r,e[9]=n,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(s.Fragment,{children:["Your Google AI API key from"," ",s.jsx(ie,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]}),e[11]=f):f=e[11],e[12]!==r||e[13]!==n?(g=s.jsx(_e,{title:"Google",provider:"google",children:s.jsx(Ge,{form:n,config:r,name:"ai.google.api_key",placeholder:"AI...",testId:"ai-google-api-key-input",description:f})}),e[12]=r,e[13]=n,e[14]=g):g=e[14],e[15]!==r||e[16]!==n?(h=s.jsx(_e,{title:"Ollama",provider:"ollama",children:s.jsx(Rt,{form:n,config:r,name:"ai.ollama.base_url",placeholder:"http://localhost:11434/v1",defaultValue:"http://localhost:11434/v1",testId:"ollama-base-url-input"})}),e[15]=r,e[16]=n,e[17]=h):h=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(s.Fragment,{children:["Your Azure API key from"," ",s.jsx(ie,{href:"https://portal.azure.com/",children:"portal.azure.com"}),"."]}),e[18]=p):p=e[18],e[19]!==r||e[20]!==n?(v=s.jsxs(_e,{title:"Azure",provider:"azure",children:[s.jsx(Ge,{form:n,config:r,name:"ai.azure.api_key",placeholder:"sk-proj...",testId:"ai-azure-api-key-input",description:p}),s.jsx(Rt,{form:n,config:r,name:"ai.azure.base_url",placeholder:"https://<your-resource-name>.openai.azure.com",testId:"ai-azure-base-url-input"})]}),e[19]=r,e[20]=n,e[21]=v):v=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsxs("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),e[22]=x):x=e[22],e[23]!==r?(b=K=>{const{field:B}=K;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:We,children:[s.jsx(D,{children:"AWS Region"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"bedrock-region-select",onChange:J=>B.onChange(J.target.value),value:typeof B.value=="string"?B.value:"us-east-1",disabled:B.disabled,className:"inline-flex mr-2",children:Pc.map(Bc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.bedrock.region_name"})]}),s.jsx(F,{children:"The AWS region where Bedrock service is available."})]})},e[23]=r,e[24]=b):b=e[24],e[25]!==n.control||e[26]!==b?(j=s.jsx(_,{control:n.control,disabled:o,name:"ai.bedrock.region_name",render:b}),e[25]=n.control,e[26]=b,e[27]=j):j=e[27],e[28]!==r?(S=K=>{const{field:B}=K;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:We,children:[s.jsx(D,{children:"AWS Profile Name (Optional)"}),s.jsx(A,{children:s.jsx(ke,{"data-testid":"bedrock-profile-input",rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:"default",...B,value:B.value||""})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.bedrock.profile_name"})]}),s.jsx(F,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})},e[28]=r,e[29]=S):S=e[29],e[30]!==n.control||e[31]!==S?(w=s.jsx(_,{control:n.control,disabled:o,name:"ai.bedrock.profile_name",render:S}),e[30]=n.control,e[31]=S,e[32]=w):w=e[32],e[33]!==j||e[34]!==w?(C=s.jsxs(_e,{title:"AWS Bedrock",provider:"bedrock",children:[x,j,w]}),e[33]=j,e[34]=w,e[35]=C):C=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(s.Fragment,{children:"API key for any OpenAI-compatible provider (e.g., Together, Groq, Mistral, Perplexity, etc)."}),e[36]=N):N=e[36],e[37]!==r||e[38]!==n?(T=s.jsx(Ge,{form:n,config:r,name:"ai.open_ai_compatible.api_key",placeholder:"sk-...",testId:"ai-openai-compatible-api-key-input",description:N}),e[37]=r,e[38]=n,e[39]=T):T=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(s.Fragment,{children:"Base URL for your OpenAI-compatible provider."}),e[40]=L):L=e[40],e[41]!==r||e[42]!==n?(z=s.jsx(Rt,{form:n,config:r,name:"ai.open_ai_compatible.base_url",placeholder:"https://api.together.xyz/v1",testId:"ai-openai-compatible-base-url-input",description:L}),e[41]=r,e[42]=n,e[43]=z):z=e[43],e[44]!==T||e[45]!==z?(V=s.jsxs(_e,{title:"OpenAI-Compatible",provider:"openai-compatible",children:[T,z]}),e[44]=T,e[45]=z,e[46]=V):V=e[46],e[47]!==h||e[48]!==v||e[49]!==C||e[50]!==V||e[51]!==d||e[52]!==m||e[53]!==g?($=s.jsxs(_n,{children:[l,s.jsxs(oo,{type:"multiple",children:[d,m,g,h,v,C,V]})]}),e[47]=h,e[48]=v,e[49]=C,e[50]=V,e[51]=d,e[52]=m,e[53]=g,e[54]=$):$=e[54],$},Hc=t=>{const e=U.c(20),{form:n,config:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ne(),e[0]=i):i=e[0];const o=i;let a,l,c,d,u,m,f,g,h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Tt,{children:"AI Assistant"}),e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("p",{className:"text-sm text-muted-secondary",children:["Use the Chat panel to talk to your codebase, or make edits using the"," ",s.jsx(G,{className:"inline",children:"Generate with AI"})," button."]}),e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(s.Fragment,{children:[s.jsx("p",{children:'Model to use for chat conversations in the Chat panel. Models should include the provider name and model name separated by a slash. For example, "anthropic/claude-3-5-sonnet-latest" or "google/gemini-2.0-flash-exp".'}),s.jsx("p",{className:"pt-1",children:"Depending on the provider, we will use the respective API key and additional configuration."})]}),e[3]=c):c=e[3],e[4]!==r||e[5]!==n?(d=s.jsx(En,{label:"Chat Model",form:n,config:r,name:"ai.models.chat_model",placeholder:ir,testId:"ai-chat-model-input",disabled:o,description:c}),e[4]=r,e[5]=n,e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Model to use for code editing with the"," ",s.jsx(G,{className:"inline",children:"Generate with AI"})," button. Models should include the provider name and model name separated by a slash."]}),s.jsx("p",{className:"pt-1",children:"You can use a faster, cheaper model for edits if desired."})]}),e[7]=u):u=e[7],e[8]!==r||e[9]!==n?(m=s.jsx(En,{label:"Edit Model",form:n,config:r,name:"ai.models.edit_model",placeholder:ir,testId:"ai-edit-model-input",disabled:o,description:u}),e[8]=r,e[9]=n,e[10]=m):m=e[10],e[11]!==r?(f=p=>{const{field:v}=p;return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(P,{children:[s.jsx(D,{children:"Custom Rules"}),s.jsx(A,{children:s.jsx(ao,{"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",...v,value:v.value})}),s.jsx(M,{}),s.jsx(H,{userConfig:r,name:"ai.rules"})]}),s.jsx(F,{children:"Custom rules to include in all AI completion prompts."})]})},e[11]=r,e[12]=f):f=e[12],e[13]!==n.control||e[14]!==f?(g=s.jsx(_,{control:n.control,name:"ai.rules",render:f}),e[13]=n.control,e[14]=f,e[15]=g):g=e[15],e[16]!==d||e[17]!==m||e[18]!==g?(h=s.jsxs(_n,{children:[a,l,d,m,g]}),e[16]=d,e[17]=m,e[18]=g,e[19]=h):h=e[19],h},Uc=t=>{const e=U.c(12),{form:n,config:r,onSubmit:i}=t;let o,a,l,c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(tr,{className:"mb-2",children:[s.jsx(qt,{value:"ai-features",children:"AI Features"}),s.jsx(qt,{value:"ai-providers",children:"AI Providers"})]}),e[0]=o):o=e[0],e[1]!==r||e[2]!==n||e[3]!==i?(a=s.jsxs(nr,{value:"ai-features",children:[s.jsx(zc,{form:n,config:r,onSubmit:i}),s.jsx(Hc,{form:n,config:r,onSubmit:i})]}),e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],e[5]!==r||e[6]!==n||e[7]!==i?(l=s.jsx(nr,{value:"ai-providers",children:s.jsx(Fc,{form:n,config:r,onSubmit:i})}),e[5]=r,e[6]=n,e[7]=i,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(c=s.jsxs(rr,{defaultValue:"ai-features",children:[o,a,l]}),e[9]=a,e[10]=l,e[11]=c):c=e[11],c};function qc(t){return s.jsx("option",{value:t,children:t},t)}function Vc(t){return s.jsx("option",{value:t,children:t},t)}function Bc(t){return s.jsx("option",{value:t,children:t},t)}const ys=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Ne()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Ne()||ys.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const Wc=()=>{const t=U.c(23),[e]=Kn(),n=e.package_management.manager,{getPackageList:r}=Le();let i,o;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1],t[2]!==n?(o=[n],t[2]=n,t[3]=o):o=t[3];const{data:a,error:l,refetch:c,isPending:d}=ho(i,o);if(d){let w;return t[4]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(or,{size:"medium",centered:!0}),t[4]=w):w=t[4],w}if(l){let w;return t[5]!==l?(w=s.jsx(po,{error:l}),t[5]=l,t[6]=w):w=t[6],w}let u;t[7]!==(a==null?void 0:a.packages)?(u=(a==null?void 0:a.packages)||[],t[7]=a==null?void 0:a.packages,t[8]=u):u=t[8];const m=u;let f;t[9]!==m?(f=new Set(m.map(Kc)),t[9]=m,t[10]=f):f=t[10];const g=f;let h,p,v,x,b,j,S;return t[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Tt,{children:"Optional Features"}),t[11]=h):h=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",s.jsx("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(go,{children:s.jsxs(sr,{children:[s.jsx(yt,{children:"Dependency"}),s.jsx(yt,{children:"Feature"}),s.jsx(yt,{children:"Status"}),s.jsx(yt,{})]})}),t[13]=v):v=t[13],t[14]!==g||t[15]!==n||t[16]!==c?(x=ys.map(w=>{const C=w.packagesRequired.every(T=>g.has(T.name.split("[")[0])),N=w.packagesRequired.map($c).join(", ");return s.jsxs(sr,{className:"text-sm",children:[s.jsx(Vt,{children:w.description}),s.jsx(Vt,{className:"font-mono text-xs",children:N}),s.jsx(Vt,{children:C?s.jsxs("div",{className:"flex items-center",children:[s.jsx(cr,{className:"h-4 w-4 text-(--grass-10) mr-2"}),s.jsx("span",{children:"Installed"})]}):s.jsxs("div",{className:"flex items-center",children:[s.jsx(fo,{className:"h-4 w-4 text-(--red-10) mr-2"}),s.jsx(Gc,{packageSpecs:[...w.packagesRequired,...w.additionalPackageInstalls],packageManager:n,onSuccess:c})]})})]},w.id)}),t[14]=g,t[15]=n,t[16]=c,t[17]=x):x=t[17],t[18]!==x?(b=s.jsxs(mo,{children:[v,s.jsx(vo,{children:x})]}),t[18]=x,t[19]=b):b=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[20]=j):j=t[20],t[21]!==b?(S=s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[h,p,b,j]}),t[21]=b,t[22]=S):S=t[22],S},Gc=({packageSpecs:t,packageManager:e,onSuccess:n})=>{const[r,i]=Ke.useState(!1),{addPackage:o}=Le();return s.jsxs(ue,{size:"xs",variant:"outline",className:$e("text-xs",r&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{i(!0);const a=t.map(c=>c.minVersion?`${c.name}>=${c.minVersion}`:c.name).join(" "),l=await o({package:a});l.success?(n(),ze({title:"Package installed",description:s.jsxs("span",{children:["The packages"," ",s.jsx(G,{className:"inline",children:t.map(c=>c.name).join(", ")})," ","have been added to your environment."]})})):ze({title:"Failed to install package",description:l.error,variant:"danger"})}finally{i(!1)}},disabled:r,children:[r?s.jsx(or,{size:"small",className:"mr-2 h-3 w-3"}):s.jsx(lr,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function Kc(t){return t.name}function $c(t){return t.name}const q="flex flex-row items-center space-x-1 space-y-0",xs=[{id:"editor",label:"Editor",Icon:Xn,className:"bg-(--blue-4)"},{id:"display",label:"Display",Icon:Uo,className:"bg-(--grass-4)"},{id:"packageManagement",label:"Package Management",Icon:qo,className:"bg-(--red-4)"},{id:"runtime",label:"Runtime",Icon:dr,className:"bg-(--amber-4)"},{id:"ai",label:"AI",Icon:Mo,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:ur,className:"bg-(--orange-4)"},{id:"labs",label:"Labs",Icon:Ro,className:"bg-(--slate-4)"}],bs=Ye(xs[0].id),Yc=()=>{const t=U.c(45),[e,n]=er(),r=I.useRef(null),i=Bt(Tn),[o,a]=Xe(bs),l=pt(yo),c=pt(xo),{saveUserConfig:d}=Le();let u,m;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=Mn(bo),t[0]=u):u=t[0],t[1]!==e?(m={resolver:u,defaultValues:e},t[1]=e,t[2]=m):m=t[2];const f=Rn(m);let g;t[3]!==d||t[4]!==n?(g=async O=>{await d({config:O}).then(()=>{n(O)})},t[3]=d,t[4]=n,t[5]=g):g=t[5];const h=g;let p;t[6]===Symbol.for("react.memo_cache_sentinel")?(p=Ne(),t[6]=p):p=t[6];const v=p;let x;t[7]!==o||t[8]!==l||t[9]!==e||t[10]!==f||t[11]!==h||t[12]!==a||t[13]!==i?(x=()=>{switch(o){case"editor":return s.jsxs(s.Fragment,{children:[s.jsxs(je,{title:"Autosave",children:[s.jsx(_,{control:f.control,name:"save.autosave",render:O=>{const{field:y}=O;return s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autosave enabled"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"autosave-checkbox",checked:y.value==="after_delay",disabled:y.disabled,onCheckedChange:k=>{y.onChange(k?"after_delay":"off")}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.autosave"})]})}}),s.jsx(_,{control:f.control,name:"save.autosave_delay",render:O=>{const{field:y}=O;return s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Autosave delay (seconds)"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:f.getValues("save.autosave")!=="after_delay",...y,value:y.value/1e3,minValue:1,onChange:k=>{y.onChange(1e3*k),Number.isNaN(k)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.autosave_delay"})]})}}),s.jsx(_,{control:f.control,name:"runtime.default_auto_download",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Save cell outputs as"}),s.jsx(A,{children:s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"html-checkbox",checked:Array.isArray(y.value)&&y.value.includes("html"),onCheckedChange:()=>{const k=Array.isArray(y.value)?y.value:[];y.onChange(dt(k,"html"))}}),s.jsx(D,{htmlFor:"html-checkbox",children:"HTML"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Q,{id:"ipynb-checkbox",checked:Array.isArray(y.value)&&y.value.includes("ipynb"),onCheckedChange:()=>{const k=Array.isArray(y.value)?y.value:[];y.onChange(dt(k,"ipynb"))}}),s.jsx(D,{htmlFor:"ipynb-checkbox",children:"IPYNB"})]})]})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.default_auto_download"})]}),s.jsxs(F,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",s.jsx(G,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})}})]}),s.jsxs(je,{title:"Formatting",children:[s.jsx(_,{control:f.control,name:"save.format_on_save",render:O=>{const{field:y}=O;return s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Format on save"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"format-on-save-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"save.format_on_save"})]})}}),s.jsx(_,{control:f.control,name:"formatting.line_length",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Line length"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"line-length-input",className:"m-0 w-24",...y,value:y.value,minValue:1,maxValue:1e3,onChange:k=>{y.onChange(k),Number.isNaN(k)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"formatting.line_length"})]}),s.jsx(F,{children:"Maximum line length when formatting code."})]})}})]}),s.jsx(je,{title:"Autocomplete",children:s.jsx(_,{control:f.control,name:"completion.activate_on_typing",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autocomplete"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"autocomplete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"completion.activate_on_typing"})]}),s.jsx(F,{children:"When unchecked, code completion is still available through a hotkey."}),s.jsx("div",{children:s.jsx(ue,{variant:"link",className:"mb-0 px-0",type:"button",onClick:k=>{k.preventDefault(),k.stopPropagation(),a("ai")},children:"Edit AI autocomplete"})})]})}})}),s.jsxs(je,{title:"Language Servers",children:[s.jsxs(F,{children:["See the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),s.jsxs(F,{children:[s.jsx("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),s.jsx(_,{control:f.control,name:"language_servers.pylsp.enabled",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",s.jsx(ie,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"pylsp-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.pylsp.enabled"})]}),y.value&&!l.pylsp&&s.jsxs(vt,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",s.jsx(G,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"language_servers.basedpyright.enabled",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",s.jsx(ie,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"basedpyright-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.basedpyright.enabled"})]}),y.value&&!l.basedpyright&&s.jsxs(vt,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",s.jsx(G,{className:"inline",children:"basedpyright"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"language_servers.ty.enabled",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs(P,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",s.jsx(ie,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"ty-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"language_servers.ty.enabled"})]}),y.value&&!l.ty&&s.jsxs(vt,{kind:"danger",children:["ty is not available in your current environment. Please install ",s.jsx(G,{className:"inline",children:"ty"})," in your environment."]})]})}}),s.jsx(_,{control:f.control,name:"diagnostics.enabled",render:O=>{const{field:y}=O;return s.jsxs(P,{className:q,children:[s.jsxs(D,{children:[s.jsx(xt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"diagnostics-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"diagnostics.enabled"})]})}})]}),s.jsxs(je,{title:"Keymap",children:[s.jsx(_,{control:f.control,name:"keymap.preset",render:O=>{const{field:y}=O;return s.jsx("div",{className:"flex flex-col space-y-1",children:s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Keymap"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"keymap-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:yc.map(Xc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"keymap.preset"})]})})}}),s.jsx(_,{control:f.control,name:"keymap.destructive_delete",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Destructive delete"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"destructive-delete-checkbox",checked:y.value,disabled:y.disabled,onCheckedChange:k=>{y.onChange(!!k)}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"keymap.destructive_delete"})]}),s.jsxs(F,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",s.jsx(Qe,{content:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:s.jsx(Io,{className:"w-3 h-3 text-(--amber-11)"})})]}),s.jsx("div",{children:s.jsx(ue,{variant:"link",className:"mb-0 px-0",type:"button",onClick:k=>{k.preventDefault(),k.stopPropagation(),i(!0)},children:"Edit Keyboard Shortcuts"})})]})}})]})]});case"display":return s.jsxs(s.Fragment,{children:[s.jsxs(je,{title:"Display",children:[s.jsx(_,{control:f.control,name:"display.default_width",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Default width"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"user-config-width-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["compact","medium","full","columns"].map(Qc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_width"})]}),s.jsx(F,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}}),s.jsx(_,{control:f.control,name:"display.theme",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Theme"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"theme-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:wo.map(Zc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.theme"})]}),s.jsx(F,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}}),s.jsx(_,{control:f.control,name:"display.code_editor_font_size",render:O=>{const{field:y}=O;return s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Code editor font size (px)"}),s.jsx(A,{children:s.jsx("span",{className:"inline-flex mr-2",children:s.jsx(Ze,{"data-testid":"code-editor-font-size-input",className:"m-0 w-24",...y,value:y.value,minValue:8,maxValue:32,onChange:k=>{y.onChange(k),h(f.getValues())}})})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.code_editor_font_size"})]})}}),s.jsx(_,{control:f.control,name:"display.reference_highlighting",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Reference highlighting"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"reference-highlighting-checkbox",checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.reference_highlighting"})]}),s.jsx(F,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})}})]}),s.jsxs(je,{title:"Outputs",children:[s.jsx(_,{control:f.control,name:"display.cell_output",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Cell output area"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"cell-output-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["above","below"].map(Jc)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.cell_output"})]}),s.jsx(F,{children:"Where to display cell's output."})]})}}),s.jsx(_,{control:f.control,name:"display.dataframes",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Dataframe viewer"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"display-dataframes-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(ed)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.dataframes"})]}),s.jsx(F,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})}}),s.jsx(_,{control:f.control,name:"display.default_table_page_size",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Default table page size"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"default-table-page-size-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:k=>{y.onChange(k),Number.isNaN(k)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_table_page_size"})]}),s.jsx(F,{children:"The default number of rows displayed in dataframes and SQL results."})]})}}),s.jsx(_,{control:f.control,name:"display.default_table_max_columns",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Default table max columns"}),s.jsx(A,{children:s.jsx(Ze,{"data-testid":"default-table-max-columns-input",className:"m-0 w-24",...y,value:y.value,minValue:1,step:1,onChange:k=>{y.onChange(k),Number.isNaN(k)||h(f.getValues())}})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"display.default_table_max_columns"})]}),s.jsx(F,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})}})]})]});case"packageManagement":return s.jsx(je,{title:"Package Management",children:s.jsx(_,{control:f.control,disabled:v,name:"package_management.manager",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Manager"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"package-manager-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:jo.map(td)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"package_management.manager"})]}),s.jsxs(F,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",s.jsx("br",{}),s.jsx("br",{}),"Running marimo in a"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only",children:"sandboxed environment"})," ","is only supported by ",s.jsx(G,{className:"inline",children:"uv"})]})]})}})});case"runtime":return s.jsxs(je,{title:"Runtime configuration",children:[s.jsx(_,{control:f.control,name:"runtime.auto_instantiate",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autorun on startup"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"auto-instantiate-checkbox",disabled:y.disabled,checked:y.value,onCheckedChange:y.onChange})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.auto_instantiate"})]}),s.jsx(F,{children:"Whether to automatically run all cells on startup."})]})}}),s.jsx(_,{control:f.control,name:"runtime.on_cell_change",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"On cell change"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"on-cell-change-select",onChange:k=>y.onChange(k.target.value),value:y.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(nd)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.on_cell_change"})]}),s.jsx(F,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}}),s.jsx(_,{control:f.control,name:"runtime.auto_reload",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"On module change"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"auto-reload-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:v,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(rd)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.auto_reload"})]}),s.jsx(F,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}}),s.jsx(_,{control:f.control,name:"runtime.default_sql_output",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{children:"Default SQL output"}),s.jsx(A,{children:s.jsx(ce,{"data-testid":"user-config-sql-output-select",onChange:k=>y.onChange(k.target.value),value:y.value,disabled:y.disabled,className:"inline-flex mr-2",children:es.map(id)})}),s.jsx(M,{}),s.jsx(H,{userConfig:e,name:"runtime.default_sql_output"})]}),s.jsx(F,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})}}),s.jsx(_,{control:f.control,name:"runtime.reactive_tests",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Autorun Unit Tests"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"reactive-test-checkbox",checked:y.value,onCheckedChange:y.onChange})})]}),s.jsx(H,{userConfig:e,name:"runtime.reactive_tests"}),s.jsx(M,{}),s.jsx(F,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}}),s.jsxs(F,{children:["Learn more in the"," ",s.jsx(ie,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return s.jsx(Uc,{form:f,config:e,onSubmit:h});case"optionalDeps":return s.jsx(Wc,{});case"labs":return s.jsxs(je,{title:"Experimental Features",children:[s.jsx("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),s.jsx(_,{control:f.control,name:"experimental.inline_ai_tooltip",render:sd}),s.jsx(_,{control:f.control,name:"experimental.rtc_v2",render:od}),s.jsx(_,{control:f.control,name:"experimental.performant_table_charts",render:O=>{const{field:y}=O;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Performant Table Charts"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"performant-table-charts-checkbox",checked:y.value===!0,onCheckedChange:y.onChange})})]}),s.jsx(H,{userConfig:e,name:"experimental.performant_table_charts"}),s.jsx(F,{children:"Enable experimental table charts which are computed on the backend."})]})}})]})}},t[7]=o,t[8]=l,t[9]=e,t[10]=f,t[11]=h,t[12]=a,t[13]=i,t[14]=x):x=t[14];const b=x;let j,S,w;t[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(G,{className:"inline",children:"marimo.toml"}),S=s.jsx("br",{}),t[15]=j,t[16]=S):(j=t[15],S=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsxs("p",{className:"text-muted-secondary",children:["User configuration is stored in ",j,S,"Run ",s.jsx(G,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]}),t[17]=w):w=t[17];const C=w;let N,T,L,z,V,$,K,B,J,Y,ee,ae;return t[18]!==f||t[19]!==h?(N=f.handleSubmit(h),t[18]=f,t[19]=h,t[20]=N):N=t[20],t[21]!==a?(T=O=>a(O),t[21]=a,t[22]=T):T=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(L=xs.map(ad),t[23]=L):L=t[23],t[24]!==c?(z=s.jsx("div",{className:"p-2 text-xs text-muted-foreground self-start",children:s.jsxs("span",{children:["Version: ",c]})}),t[24]=c,t[25]=z):z=t[25],t[26]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"flex-1"}),$=!Ne()&&C,t[26]=V,t[27]=$):(V=t[26],$=t[27]),t[28]!==z?(K=s.jsxs(tr,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[L,z,V,$]}),t[28]=z,t[29]=K):K=t[29],t[30]!==o||t[31]!==K||t[32]!==T?(B=s.jsx(rr,{value:o,onValueChange:T,orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:K}),t[30]=o,t[31]=K,t[32]=T,t[33]=B):B=t[33],t[34]!==b?(J=b(),t[34]=b,t[35]=J):J=t[35],t[36]!==J?(Y=s.jsx("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:J}),t[36]=J,t[37]=Y):Y=t[37],t[38]!==B||t[39]!==Y||t[40]!==N?(ee=s.jsxs("form",{ref:r,onChange:N,className:"flex text-pretty overflow-hidden",children:[B,Y]}),t[38]=B,t[39]=Y,t[40]=N,t[41]=ee):ee=t[41],t[42]!==f||t[43]!==ee?(ae=s.jsx(Ln,{...f,children:ee}),t[42]=f,t[43]=ee,t[44]=ae):ae=t[44],ae},je=t=>{const e=U.c(5),{title:n,children:r}=t;let i,o;return e[0]!==n?(i=s.jsx(Tt,{children:n}),e[0]=n,e[1]=i):i=e[1],e[2]!==r||e[3]!==i?(o=s.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[i,r]}),e[2]=r,e[3]=i,e[4]=o):o=e[4],o};function Xc(t){return s.jsx("option",{value:t,children:t},t)}function Qc(t){return s.jsx("option",{value:t,children:t},t)}function Zc(t){return s.jsx("option",{value:t,children:t},t)}function Jc(t){return s.jsx("option",{value:t,children:t},t)}function ed(t){return s.jsx("option",{value:t,children:t},t)}function td(t){return s.jsx("option",{value:t,children:t},t)}function nd(t){return s.jsx("option",{value:t,children:t},t)}function rd(t){return s.jsx("option",{value:t,children:t},t)}function id(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function sd(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"AI Edit Tooltip"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:'Enable experimental "Edit with AI" tooltip when selecting code.'})]})}function od(t){const{field:e}=t;return s.jsxs("div",{className:"flex flex-col gap-y-1",children:[s.jsxs(P,{className:q,children:[s.jsx(D,{className:"font-normal",children:"Real-Time Collaboration"}),s.jsx(A,{children:s.jsx(Q,{"data-testid":"rtc-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),s.jsx(F,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}function ad(t){return s.jsx(qt,{value:t.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:s.jsxs("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[s.jsx("span",{className:$e(t.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground shrink-0"),children:s.jsx(t.Icon,{className:"w-4 h-4"})}),s.jsx("span",{className:"truncate",children:t.label})]})},t.id)}const Pn=Ye(!1);function ld(){const t=U.c(5),e=Bt(bs),n=Bt(Pn);let r;t[0]!==e||t[1]!==n?(r=a=>{e(a),n(!0)},t[0]=e,t[1]=n,t[2]=r):r=t[2];const i=r;let o;return t[3]!==i?(o={handleClick:i},t[3]=i,t[4]=o):o=t[4],o}const cd=t=>{const e=U.c(32),{showAppConfig:n,disabled:r,tooltip:i}=t,o=n===void 0||n,a=r!==void 0&&r,l=i===void 0?"Settings":i,[c,d]=Xe(Pn),u=a?"disabled":"hint-green";let m,f,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(ar,{strokeWidth:1.8}),e[0]=m):m=e[0],e[1]!==l?(f=s.jsx(Qe,{content:l,children:m}),e[1]=l,e[2]=f):f=e[2],e[3]!==a||e[4]!==u||e[5]!==f?(g=s.jsx(_t,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:a,color:u,children:f}),e[3]=a,e[4]=u,e[5]=f,e[6]=g):g=e[6];const h=g;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Qn,{className:"w-[80vw] h-[70vh] overflow-hidden sm:max-w-5xl top-[15vh] p-0",children:s.jsx(Yc,{})}),e[7]=p):p=e[7];const v=p;if(!o){let z,V;return e[8]!==h?(z=s.jsx(So,{children:h}),e[8]=h,e[9]=z):z=e[9],e[10]!==d||e[11]!==c||e[12]!==z?(V=s.jsxs(Ut,{open:c,onOpenChange:d,children:[z,v]}),e[10]=d,e[11]=c,e[12]=z,e[13]=V):V=e[13],V}let x,b,j,S,w,C,N,T,L;return e[14]!==h?(x=s.jsx(Oo,{asChild:!0,children:h}),e[14]=h,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(nc,{}),j=s.jsx("div",{className:"h-px bg-border my-2"}),e[16]=b,e[17]=j):(b=e[16],j=e[17]),e[18]!==d?(S=()=>d(!0),e[18]=d,e[19]=S):S=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(ar,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=w):w=e[20],e[21]!==S?(C=s.jsxs(ko,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:dd,children:[b,j,s.jsxs(ue,{onClick:S,variant:"link",className:"px-0",children:[w,"User settings"]})]}),e[21]=S,e[22]=C):C=e[22],e[23]!==C||e[24]!==x?(N=s.jsxs(Co,{children:[x,C]}),e[23]=C,e[24]=x,e[25]=N):N=e[25],e[26]!==d||e[27]!==c?(T=s.jsx(Ut,{open:c,onOpenChange:d,children:v}),e[26]=d,e[27]=c,e[28]=T):T=e[28],e[29]!==N||e[30]!==T?(L=s.jsxs(s.Fragment,{children:[N,T]}),e[29]=N,e[30]=T,e[31]=L):L=e[31],L};function dd(t){return t.preventDefault()}const ud=t=>{const e=U.c(15),{description:n,disabled:r,tooltip:i}=t,o=r!==void 0&&r,a=i===void 0?"Shutdown":i,{openConfirm:l,closeModal:c}=No(),{sendShutdown:d}=Le();let u;e[0]!==d?(u=()=>{d(),setTimeout(hd,200)},e[0]=d,e[1]=u):u=e[1];const m=u;if(Ne())return null;const f=o?"disabled":"red";let g,h,p,v;return e[2]!==c||e[3]!==n||e[4]!==m||e[5]!==l?(g=x=>{x.stopPropagation(),l({title:"Shutdown",description:n,variant:"destructive",confirmAction:s.jsx(Do,{onClick:()=>{m(),c()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=c,e[3]=n,e[4]=m,e[5]=l,e[6]=g):g=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(gt,{strokeWidth:1}),e[7]=h):h=e[7],e[8]!==o||e[9]!==f||e[10]!==g?(p=s.jsx(_t,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:f,className:"h-[27px] w-[27px]",disabled:o,onClick:g,children:h}),e[8]=o,e[9]=f,e[10]=g,e[11]=p):p=e[11],e[12]!==p||e[13]!==a?(v=s.jsx(Qe,{content:a,children:p}),e[12]=p,e[13]=a,e[14]=v):v=e[14],v};function hd(){window.close()}function fd(t){window.open(To(`?file=${t}`).toString(),"_blank")}export{_o as A,Po as B,cd as C,Mc as D,zo as G,Ic as K,Fo as L,Ho as M,Vo as P,ud as S,Ql as T,Bo as Y,Lo as a,lr as b,_t as c,Dc as d,st as e,ds as f,Jl as g,xc as h,cs as i,ld as j,Tn as k,as as l,Mt as m,ls as n,fd as o,dr as p,cr as q,ms as r,Pn as s,Zi as t,Zl as u};
|