@ensocode/server 0.3.15-beta.244 → 0.3.15-beta.245
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/out/phone/assets/{EditDiff-Dl1v7xzD.js → EditDiff-LjLnu8xm.js} +1 -1
- package/out/phone/assets/{ReadFileView-DnbZC0ty.js → ReadFileView-D_aDFZ3i.js} +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-Co7grfeK.js → abnfDiagram-VCTEODGH-BH4d-cbL.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-CzvFNlBu.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-63szDTwV.js → architectureDiagram-5GKGNRK7-CZUm8whq.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-DiqufW2M.js → blockDiagram-I7D4REHJ-CibsN4eX.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-DEkuGuT5.js → c4Diagram-7LVT6UL2-4Q1GvDNL.js} +1 -1
- package/out/phone/assets/channel-B1OjjanR.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-BBPCzb9_.js → chunk-4HAMMTFA-qmi-wrXZ.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-CvsXKk5y.js → chunk-75Z2AOVW-BuwyNEKi.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-DFN-6z2K.js → chunk-DU6HZSFF-BU48Ba4y.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-CxbPevJY.js → chunk-F27PBJKO-BmRqQ1LD.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-BKkB3y89.js → chunk-GMAD6QVW-2xpTjCMU.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-BmuuVTk9.js → chunk-GVQU2GXP-DcgAJ1hb.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-DtyReyu7.js → chunk-IMKFNOWR-CDKQTDLE.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-CYQouxRc.js → chunk-L3NEJ4N5-C9I8xbyo.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-C8s892Xu.js → chunk-OSK3NFVY-B68u1et1.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-Wo7i2bF8.js → chunk-P2QGCYS3-3LE80g6a.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-Cs3x8DIB.js → chunk-POPQ4Y6H-DYC-7n06.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-JEGLXjtH.js → chunk-PWAF6VOD--cFXgKVZ.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-DtlDK80W.js → chunk-SHT3W25Y-BBi9f7KR.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-DCDTtBi2.js → chunk-SVP7TREG-B1DVeaeC.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-DH_cShpv.js → chunk-TICWLB2K-DGL1KENT.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-DIqrjRkT.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-DIqrjRkT.js +1 -0
- package/out/phone/assets/{codeHighlighter-oIs6aBXZ.js → codeHighlighter-Dv9S_gnx.js} +1 -1
- package/out/phone/assets/{cynefin-OW5HDTMX-DWY8sMmw.js → cynefin-OW5HDTMX-DvPig7gg.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-DystTHhc.js → cynefinDiagram-5FMLGOSQ-CZScsP4a.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-CjIk5Pm7.js → dagre-GXQ25YYZ-Rm1WuHFV.js} +1 -1
- package/out/phone/assets/{diagram-S7CK7UJ4-CY0PD39z.js → diagram-S7CK7UJ4-DNecQbFS.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-CwX9S12n.js → diagram-UQ7AKVKN-DNJ5891_.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-Bk_rb32-.js → diagram-VSXAHHWV-hgX1MmPB.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-C3JVMUBL.js → diagram-VX7I27RA-BINDbSM_.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-Drf5stHv.js → diagram-Z3DM3KII-BznaX7I6.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-Cz19FBqO.js → ebnfDiagram-PWID7BFC-35AZ2YXG.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-BXmpqk2p.js → erDiagram-RLTQ6QDP-Cchr8eGN.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-Rdm0dM4t.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-qD44MaaR.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-Bum0_E5J.js → ganttDiagram-EL5Y4UJY-D5_HL1Hs.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-BCw9r0Vf.js → gitGraph-4MIJSDKK-CWlj41of.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-BrS3oYOR.js → gitGraphDiagram-WWUBYQGX-B1Z4kUI3.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-CdAqHFpo.js → info-A6RAGUB7-BsUYEjC5.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-eIHi-wVl.js → infoDiagram-27XIBGKW-lrQnoW76.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U--ZByOgbd.js → ishikawaDiagram-5VMMS53U-BBmwYGjK.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-Cez_oRvQ.js → journeyDiagram-3NMN7TZE-DNkmhKoE.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-CzRnvsUw.js → kanban-definition-UXKFOSKX-CN7mnAup.js} +1 -1
- package/out/phone/assets/{line-BI6dRkfB.js → line-B8a5usVN.js} +1 -1
- package/out/phone/assets/{main-Bb-GRoqY.js → main-Drpa9hsc.js} +4 -4
- package/out/phone/assets/{mermaid-parser.core-hbmkLOwJ.js → mermaid-parser.core-PgYmkOU6.js} +3 -3
- package/out/phone/assets/{mermaid.core-DyabQfxY.js → mermaid.core-DbT50CUC.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-BsrANfeL.js → mindmap-definition-YA3MSWOX-CMdUpbu5.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-C10GNvQY.js → packet-AYTQ26CC-DE5zcURD.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-BJZdvuYe.js → pegDiagram-XKGWAZYB-CAHbWi6O.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-BO4lKzBO.js → pie-WAS4IAKB-CeuBFJWN.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-CebvsUnG.js → pieDiagram-E7YTZNPT-EsoDg3k_.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DAIoWitA.js → quadrantDiagram-AXDQQJYC-BjX3KPnW.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-BSvMj116.js → radar-RG4KPBEZ-jlg2WilL.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-CC8n5mQv.js → railroad-74A4TZTK-BhL0maDf.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-CG8Dvjf0.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-BmdoUAXy.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-BPjXhfuj.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-BzydbcBb.js → railroadDiagram-O6MQD6OU-CJUntIWK.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-CKe0Zr83.js → requirementDiagram-BXWQKSXE-CUYcJ7Ct.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-CJworGIH.js → sankeyDiagram-P5KCCOFB-B7yjnRpp.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-DdpCJT7e.js → sequenceDiagram-WJ2MYXX4-CI73HGux.js} +1 -1
- package/out/phone/assets/{stateDiagram-D77RDMKH-D-IrCDnR.js → stateDiagram-D77RDMKH-BF_1QkEi.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-CgcJvB8p.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-Cy0iyaFc.js → swimlanes-42K2YHIH-Bwq7r81u.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-3afyqKQ7.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-DmctHGEI.js → timeline-definition-24CTP7MA-Drxbs-AR.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-DJ3NLlKQ.js → treeView-Q6P3EWNA-DuBbC28F.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-Wu9CYVkP.js → treemap-WGGIJYW6-BfQDwuyr.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-C9U0vhBw.js → vennDiagram-4TSXK5OY-D2oNPJPu.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-Bux_FNX8.js → wardley-WFR3VGLG-BCgggqb2.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-YeXD-Py0.js → wardleyDiagram-VM6X3IG4-C1BpdV7C.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-6G4BJgCo.js → xychartDiagram-S5SC5T6Z-DHZBXtsf.js} +1 -1
- package/out/phone/desk.html +1 -1
- package/out/phone/index.html +2 -2
- package/out/phone/sw.js +1 -1
- package/out/renderer/assets/{EditDiff-Dq1ru-27.js → EditDiff-1q8ZinKY.js} +1 -1
- package/out/renderer/assets/{ReadFileView-DRDsV4Qh.js → ReadFileView-B24dkbc8.js} +1 -1
- package/out/renderer/assets/{SidePanel-BzHQWaD_.js → SidePanel-HvFay_uK.js} +1 -1
- package/out/renderer/assets/{abnfDiagram-VCTEODGH-BvoAbCWQ.js → abnfDiagram-VCTEODGH-C28b6KaR.js} +1 -1
- package/out/renderer/assets/{arc-CJC8vTfi.js → arc-D654WPOQ.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-DUaKoTV1.js → architectureDiagram-5GKGNRK7-in73oE1l.js} +1 -1
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-Ctrde6gr.js → blockDiagram-I7D4REHJ-D3Uz_3X8.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-m237al85.js → c4Diagram-7LVT6UL2-BFnUhWBv.js} +1 -1
- package/out/renderer/assets/channel-Dtd4BQ0v.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-DxInKfng.js → chunk-2Q5K7J3B-BRnCXB5O.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-DYWVp5wB.js → chunk-5VM5RSS4-Bzdf1vbV.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-B4co86fQ.js → chunk-F27PBJKO-TNiuEksf.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-BhBcruMO.js → chunk-IMKFNOWR-CibX_GX4.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-C_OTocS8.js → chunk-JWPE2WC7-Cvj3V5D8.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-DuPM2iNq.js → chunk-POPQ4Y6H-DD8kMK_f.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-BBAC9v6R.js → chunk-SVP7TREG-Cr44V1VF.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-N6m7s6mw.js → chunk-TICWLB2K-BJZ6A5Jw.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-B1Gr5MJz.js → chunk-XXDRQBXY-wAi8ZQ9I.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-B2CoHNXJ.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-B2CoHNXJ.js +1 -0
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-BGacAdLc.js → cose-bilkent-JH36ORCC-vqLyUO2H.js} +1 -1
- package/out/renderer/assets/{cynefin-OW5HDTMX-CstxFU_f.js → cynefin-OW5HDTMX-utxTipjM.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-B2A_z92b.js → cynefinDiagram-5FMLGOSQ-tmHpgrII.js} +1 -1
- package/out/renderer/assets/{dagre-GXQ25YYZ-B2Cuq6s4.js → dagre-GXQ25YYZ-DHvmbJzP.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-sPp6xmTo.js → diagram-S7CK7UJ4-CxkJYeKg.js} +1 -1
- package/out/renderer/assets/{diagram-UQ7AKVKN-C1nSgHxc.js → diagram-UQ7AKVKN-DXiV9Phb.js} +1 -1
- package/out/renderer/assets/{diagram-VSXAHHWV-DyrFmlyo.js → diagram-VSXAHHWV-Bqowd_xF.js} +1 -1
- package/out/renderer/assets/{diagram-VX7I27RA-C1YDNDgn.js → diagram-VX7I27RA-BFJEhjwB.js} +1 -1
- package/out/renderer/assets/{diagram-Z3DM3KII-vDjTMVCb.js → diagram-Z3DM3KII-B8M6zQkH.js} +1 -1
- package/out/renderer/assets/{ebnfDiagram-PWID7BFC-go5p9rJU.js → ebnfDiagram-PWID7BFC-AWO_Tu8S.js} +1 -1
- package/out/renderer/assets/{erDiagram-RLTQ6QDP--7HBypuL.js → erDiagram-RLTQ6QDP-CFT_O4xb.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-BhISSZBS.js → flowDiagram-HODETNUW-aVBgaS_Y.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-BcBSKfXJ.js → ganttDiagram-EL5Y4UJY-Cm5xhQPI.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-CKps0oQ_.js → gitGraphDiagram-WWUBYQGX-Ypn2Cmdp.js} +1 -1
- package/out/renderer/assets/{index-DOMKWUhA.js → index-C_-_8kzt.js} +6 -6
- package/out/renderer/assets/{infoDiagram-27XIBGKW-Cuwh5obU.js → infoDiagram-27XIBGKW-C7fB8bNU.js} +1 -1
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-BLMUHtbz.js → ishikawaDiagram-5VMMS53U-CcWTHcnO.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-CdyKTe8S.js → journeyDiagram-3NMN7TZE-xqTIZ2Hh.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-CLmlyeai.js → kanban-definition-UXKFOSKX-BOT23Tck.js} +1 -1
- package/out/renderer/assets/{layout-Blff8S_S.js → layout-CjcdzPZ2.js} +1 -1
- package/out/renderer/assets/{linear-E24BfEe_.js → linear-h8_X4_Uj.js} +1 -1
- package/out/renderer/assets/{mermaid.core-tBzIgBPK.js → mermaid.core-CSXvmdq9.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-Ctunlg4e.js → mindmap-definition-YA3MSWOX-C_1TjiTd.js} +1 -1
- package/out/renderer/assets/{pegDiagram-XKGWAZYB-BGUDmJ0t.js → pegDiagram-XKGWAZYB-BzuEKB_Y.js} +1 -1
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-BV3SKGcw.js → pieDiagram-E7YTZNPT-DjKNMc5Y.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-Cto7yY8W.js → quadrantDiagram-AXDQQJYC-C20n16ud.js} +1 -1
- package/out/renderer/assets/{railroadDiagram-O6MQD6OU--eLvppDh.js → railroadDiagram-O6MQD6OU-nL2WEzvu.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-Dom34Gkz.js → requirementDiagram-BXWQKSXE-CjSoTsFt.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-CN11JSQo.js → sankeyDiagram-P5KCCOFB-Cf75s3NX.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-9uQUwoRg.js → sequenceDiagram-WJ2MYXX4-F5oCjnNZ.js} +1 -1
- package/out/renderer/assets/{sessionChanges-DLMjbWOi.js → sessionChanges-9mvBQ4nC.js} +1 -1
- package/out/renderer/assets/{sizeCapture-INFHLROL-C1rIYWoA.js → sizeCapture-INFHLROL-xvtssqwL.js} +1 -1
- package/out/renderer/assets/{stateDiagram-D77RDMKH-M3C0QecZ.js → stateDiagram-D77RDMKH-WIM9GNDw.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-C4trPT9p.js +1 -0
- package/out/renderer/assets/{swimlanes-42K2YHIH-DnLqJear.js → swimlanes-42K2YHIH-Cx1Lq7uL.js} +1 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CdzbCDJL.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-DJcjXRdy.js → timeline-definition-24CTP7MA-DAenmhFb.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-B7cvho9j.js → vennDiagram-4TSXK5OY-C20f02ii.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-BE0YuPQP.js → wardleyDiagram-VM6X3IG4-BKts4ozC.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-D6oIwCDT.js → xychartDiagram-S5SC5T6Z-Bega92Q5.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/out/server/agent.js +4 -4
- package/out/server/chunks/{builtinOccupancy-DvzfBkum.js → builtinOccupancy-8qzMLEUu.js} +3 -3
- package/out/server/chunks/{dispatchModel-0Gu9nhKa.js → dispatchModel-ztJp_gru.js} +2 -2
- package/out/server/chunks/{loadProvider-CDXRBHj8.js → loadProvider-6Q-YAwjb.js} +2 -2
- package/out/server/chunks/{menuSkills-C0v0R3gX.js → menuSkills-BPjdWW4F.js} +3 -3
- package/out/server/chunks/{projectCode-CxP4jjhK.js → projectCode-D1meiWQp.js} +2 -2
- package/out/server/chunks/{web-Dw5EcbGj.js → web-2773VU9n.js} +2 -2
- package/out/server/chunks/{workflowPresets-CI-duJC2.js → workflowPresets-CPtxxd8V.js} +2 -2
- package/out/server/index.js +6 -6
- package/package.json +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-CPQkhXxx.js +0 -1
- package/out/phone/assets/channel-CTU5U1Gc.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CAp7xfKw.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CAp7xfKw.js +0 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-3NMIapix.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-DEM4t2yp.js +0 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-CFJfM9dh.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-B_0R-wZF.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-ObEBCIxG.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-D6EyGCQb.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-BgU-mVRE.js +0 -8
- package/out/renderer/assets/channel-4OCJMTsH.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-lVKI638e.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-lVKI638e.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-B8HJtGSb.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CNAGwVvM.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aU as Ri,aV as tf,aW as sf,aX as vs,U as Yn,aY as rf,aZ as nf,a_ as of,aq as _l,D as af,aR as bl,h as Bd,aw as lf,a$ as hf,b0 as df,b1 as cf,az as uf,ap as pf,r as b,d as ff,W as mf,g as Ci,b2 as xr,j as c,b3 as gf,b4 as re,b5 as vf,b6 as Y,u as le,b7 as Wd,b8 as hs,b9 as qi,ba as _f,bb as de,bc as bf,bd as Xs,be as ca,bf as Os,bg as Yr,bh as ua,bi as pa,bj as fa,bk as wf,bl as Sf,bm as Xr,bn as Jr,bo as yf,bp as xf,bq as Cf,br as Df,bs as kf,bt as Pf,bu as Ef,bv as Pt,bw as Ei,bx as Tf,by as If,bz as Af,bA as Rf,bB as Js,bC as $e,bD as Lf,bE as Xn,bF as Mf,bG as Hd,bH as Nf,bI as ma,bJ as Of,bK as Gf,bL as zf,bM as Bf,bN as as,bO as $d,bP as Fd,bQ as jd,bR as Wf,bS as Hf,bT as Vd,bU as Ud,bV as ga,bW as $f,bX as Ff,bY as Kd,bZ as jf,b_ as Vf,b$ as Uf,c0 as Kf,c1 as qf,c2 as Yf,c3 as Xf,c4 as wl,c5 as Jf,c6 as qd,c7 as Yd,c8 as Zf,c9 as Qf,ca as Xd,cb as Jd,cc as Zd,cd as em,ce as tm,cf as im,cg as Sl,ch as sm,ci as va,cj as rm,ck as nm,M as om,cl as am,cm as lm,cn as hm,co as dm,cp as cm,cq as um,cr as pm,cs as Qd,ct as $i,cu as _a,cv as ec,l as fm,cw as Ie,cx as ba,cy as mm,cz as Hs,cA as gm,cB as tc,cC as vm,a as wa,C as Sa,e as ya,cD as _m,cE as xa,cF as bm,cG as ic,cH as wm,cI as Sm,cJ as ym,cK as xm,cL as Cm,cM as Dm,cN as Ca,cO as km,cP as Pm,cQ as Em,cR as gn,cS as Zr,cT as Qr,cU as en,cV as Ye,cW as Da,cX as Tm,cY as sc,cZ as rc,c_ as nc,c$ as Ot,d0 as Im,d1 as ke,d2 as oc,d3 as ac,d4 as Jn,i as Am,k as Rm,d5 as Lm,d6 as Mm,d7 as lc,d8 as hc,d9 as dc,da as Nm,db as tn,dc as sn,dd as rn,de as sr,df as Om,dg as Gm,dh as zm,di as Bm,dj as Wm,dk as Hm,dl as $m,dm as Fm,dn as jm,dp as Vm,dq as yl,dr as Um,ds as Km,dt as qm,du as ka,dv as Ym,dw as rr,dx as _s,dy as Xm,dz as Jm,dA as Zm,dB as cc,dC as Zn,dD as Qm,dE as eg,dF as tg,dG as ig,dH as vn,dI as xl,dJ as Cl,dK as uc,dL as sg,F as rg,dM as ng,dN as og,dO as ag,dP as Pa,dQ as nn,dR as lg,dS as hg,dT as dg,dU as Ti,dV as cg,dW as ug,dX as pc,dY as pg,dZ as Qn,d_ as fg,d$ as mg,e0 as gg,e1 as vg,e2 as _g,e3 as bg,e4 as wg,e5 as Sg,e6 as yg,e7 as xg,e8 as _n,e9 as Cg,ea as Dg,eb as kg,ec as Pg,ed as Eg,ee as Tg,ef as Ig,eg as Ag,eh as Ea,ei as Rg,ej as Dl,ek as Lg,el as Mg,em as Ng,en as Og,eo as Gg,ep as zg,eq as Bg,er as Wg,es as Hg,et as fc,eu as mc,ev as gc,ew as vc,ex as _c,ey as $g,ez as Fg,eA as jg,eB as Vg,eC as Ug,eD as Kg,eE as qg,eF as Yg}from"./index-
|
|
1
|
+
import{aU as Ri,aV as tf,aW as sf,aX as vs,U as Yn,aY as rf,aZ as nf,a_ as of,aq as _l,D as af,aR as bl,h as Bd,aw as lf,a$ as hf,b0 as df,b1 as cf,az as uf,ap as pf,r as b,d as ff,W as mf,g as Ci,b2 as xr,j as c,b3 as gf,b4 as re,b5 as vf,b6 as Y,u as le,b7 as Wd,b8 as hs,b9 as qi,ba as _f,bb as de,bc as bf,bd as Xs,be as ca,bf as Os,bg as Yr,bh as ua,bi as pa,bj as fa,bk as wf,bl as Sf,bm as Xr,bn as Jr,bo as yf,bp as xf,bq as Cf,br as Df,bs as kf,bt as Pf,bu as Ef,bv as Pt,bw as Ei,bx as Tf,by as If,bz as Af,bA as Rf,bB as Js,bC as $e,bD as Lf,bE as Xn,bF as Mf,bG as Hd,bH as Nf,bI as ma,bJ as Of,bK as Gf,bL as zf,bM as Bf,bN as as,bO as $d,bP as Fd,bQ as jd,bR as Wf,bS as Hf,bT as Vd,bU as Ud,bV as ga,bW as $f,bX as Ff,bY as Kd,bZ as jf,b_ as Vf,b$ as Uf,c0 as Kf,c1 as qf,c2 as Yf,c3 as Xf,c4 as wl,c5 as Jf,c6 as qd,c7 as Yd,c8 as Zf,c9 as Qf,ca as Xd,cb as Jd,cc as Zd,cd as em,ce as tm,cf as im,cg as Sl,ch as sm,ci as va,cj as rm,ck as nm,M as om,cl as am,cm as lm,cn as hm,co as dm,cp as cm,cq as um,cr as pm,cs as Qd,ct as $i,cu as _a,cv as ec,l as fm,cw as Ie,cx as ba,cy as mm,cz as Hs,cA as gm,cB as tc,cC as vm,a as wa,C as Sa,e as ya,cD as _m,cE as xa,cF as bm,cG as ic,cH as wm,cI as Sm,cJ as ym,cK as xm,cL as Cm,cM as Dm,cN as Ca,cO as km,cP as Pm,cQ as Em,cR as gn,cS as Zr,cT as Qr,cU as en,cV as Ye,cW as Da,cX as Tm,cY as sc,cZ as rc,c_ as nc,c$ as Ot,d0 as Im,d1 as ke,d2 as oc,d3 as ac,d4 as Jn,i as Am,k as Rm,d5 as Lm,d6 as Mm,d7 as lc,d8 as hc,d9 as dc,da as Nm,db as tn,dc as sn,dd as rn,de as sr,df as Om,dg as Gm,dh as zm,di as Bm,dj as Wm,dk as Hm,dl as $m,dm as Fm,dn as jm,dp as Vm,dq as yl,dr as Um,ds as Km,dt as qm,du as ka,dv as Ym,dw as rr,dx as _s,dy as Xm,dz as Jm,dA as Zm,dB as cc,dC as Zn,dD as Qm,dE as eg,dF as tg,dG as ig,dH as vn,dI as xl,dJ as Cl,dK as uc,dL as sg,F as rg,dM as ng,dN as og,dO as ag,dP as Pa,dQ as nn,dR as lg,dS as hg,dT as dg,dU as Ti,dV as cg,dW as ug,dX as pc,dY as pg,dZ as Qn,d_ as fg,d$ as mg,e0 as gg,e1 as vg,e2 as _g,e3 as bg,e4 as wg,e5 as Sg,e6 as yg,e7 as xg,e8 as _n,e9 as Cg,ea as Dg,eb as kg,ec as Pg,ed as Eg,ee as Tg,ef as Ig,eg as Ag,eh as Ea,ei as Rg,ej as Dl,ek as Lg,el as Mg,em as Ng,en as Og,eo as Gg,ep as zg,eq as Bg,er as Wg,es as Hg,et as fc,eu as mc,ev as gc,ew as vc,ex as _c,ey as $g,ez as Fg,eA as jg,eB as Vg,eC as Ug,eD as Kg,eE as qg,eF as Yg}from"./index-C_-_8kzt.js";import{V as Xg,f as Jg,r as Zg,p as Qg,s as ev,b as tv,c as iv}from"./sessionChanges-9mvBQ4nC.js";function sv(e){const t=[];for(const i of e){const s=t.at(-1);if(s&&s.batch===i.batch&&s.phase===i.phase){s.members.push(i);continue}t.push({batch:i.batch,members:[i],...i.phase?{phase:i.phase}:{}})}return t}const rv=[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]],nv=Ri("chevrons-down-up",rv);const ov=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],av=Ri("coffee",ov);const lv=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],hv=Ri("earth",lv);const dv=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],cv=Ri("file-diff",dv);const uv=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],pv=Ri("git-commit-horizontal",uv);const fv=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],bc=Ri("layout-grid",fv);const mv=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],gv=Ri("list-tree",mv);const vv=[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],_v=Ri("sunrise",vv),bv=new Set(["failed","needs-user"]),kl=40,wv="Done · needs you",Sv="Done · with secretary",Lr={"goal-complete":{tone:"ok",label:"Goal complete"},"turn-ended":{tone:"ok",label:"Turn ended"},"goal-blocked":{tone:"warn",label:"Goal blocked"},"needs-user":{tone:"warn",label:"Waiting for you"},stalled:{tone:"warn",label:"Stalled"},interrupted:{tone:"warn",label:"Interrupted"},failed:{tone:"bad",label:"Failed"}},yv={running:{tone:"run",label:"Started"},idle:{tone:"idle",label:"Idle"},waiting:{tone:"idle",label:"Waiting for you"},error:{tone:"idle",label:"Failed"},"not-started":{tone:"idle",label:"Not started"},queued:{tone:"idle",label:"Queued"}};function Ta(e){if(!(e.pendingReminder&&e.state!=="running")&&!e.continuing&&!(!e.result||e.state==="running"))return e.state==="waiting"&&e.result==="goal-complete"?"needs-user":e.result}function Ia(e,t){const i=e.summary?.trim();if(e.triage)return{feed:{tone:"ok",label:Sv},detail:i??""};const s=(e.needsUser??[]).map(r=>r.trim()).filter(r=>r.length>0);if(s.length>0)return{feed:{tone:"ok",label:wv},detail:s.join(";")};if(i)return{feed:t,detail:i}}function wc(e){const t=Ta(e);return t?{...(t==="goal-complete"?Ia(e,Lr[t]):void 0)?.feed??Lr[t],at:e.resultAt??e.stateSince}:e.pendingReminder&&e.state!=="running"?{tone:"idle",label:"Waiting for reminder",at:e.stateSince}:e.continuing?{tone:"run",label:"In progress",at:e.stateSince}:{...yv[e.state],at:e.stateSince}}function xv(e){const t=wc(e),i=Ta(e),r=(i==="goal-complete"?Ia(e,Lr[i]):void 0)?.detail||(e.needsUser&&e.needsUser.length>0&&!e.triage?e.needsUser.join(";"):e.lastText);return{id:`session:${e.conversationId}`,at:t.at,tone:t.tone,projectName:e.projectName,title:e.title,label:t.label,...r?{detail:r}:{},conversationId:e.conversationId,...e.state==="running"?{running:!0}:{}}}function Cv(e){return e.kind==="profile"?"Update the secretary profile":e.kind==="skill"?`Skill: ${e.draft.name}`:e.kind==="tool"?`Tool: ${e.draft.name}`:e.kind==="takeover"?e.draft.title??e.draft.conversationId:e.kind==="cleanup"?`Clean up ${e.draft.items.length} items`:e.draft.title?.trim()||e.draft.prompt.split(`
|
|
2
2
|
`)[0]?.trim()||""}function Dv(e){return{id:`proposal:${e.proposal.id}`,at:e.proposal.createdAt,tone:"warn",projectName:e.projectName??"",title:Cv(e.proposal),label:"Waiting for your confirmation"}}function kv(e){const t=e.pending.status==="failed";return{id:`pending:${e.pending.id}`,at:e.pending.updatedAt,tone:t?"bad":"run",projectName:e.projectName,title:e.pending.draft.title?.trim()||e.pending.draft.prompt.split(`
|
|
3
3
|
`)[0]?.trim()||"",label:t?"Dispatch problem":"Waiting for dependencies"}}function Pv(e,t){const i=e.kind==="seen"?{tone:"idle",label:"Secretary saw this"}:Lr[e.kind],s=t!==void 0&&t.result===e.kind&&t.resultAt===e.at?t:void 0,r=t!==void 0&&s===void 0,n=s?.needsUser&&s.needsUser.length>0?s:void 0,o=e.kind==="goal-complete"?Ia({needsUser:r?void 0:n&&!n.triage?n.needsUser:e.needsUser??s?.needsUser,summary:e.summary??s?.summary,triage:s?.triage===!0},i):void 0,a=o?.detail||e.text;return{id:`activity:${e.conversationId}:${e.at}:${e.kind}`,at:e.at,tone:o?.feed.tone??i.tone,projectName:t?.projectName??"",title:t?.title||e.conversationId,label:o?.feed.label??i.label,...a?{detail:a}:{},conversationId:e.conversationId}}function Ev(e,t){return t.at-e.at||e.id.localeCompare(t.id)}function Tv(e){const t=[...e.needsYou,...e.running,...e.done].filter(n=>n.kind==="session"),i=new Map(t.map(n=>[n.conversationId,n])),s=new Set((e.activity??[]).map(n=>`${n.conversationId}:${n.at}:${n.kind}`)),r=n=>{const o=Ta(n);return!!o&&s.has(`${n.conversationId}:${n.resultAt}:${o}`)};return[...e.needsYou,...e.running,...e.done].filter(n=>n.kind!=="session"||!r(n)).map(n=>n.kind==="proposal"?Dv(n):n.kind==="pending"?kv(n):xv(n)).concat((e.activity??[]).map(n=>Pv(n,i.get(n.conversationId)))).sort(Ev)}function bn(e,t,i){const s=new Map(t.map(a=>[a.id,a])),r=new Set(e.map(a=>a.id)),n=e.map(a=>s.get(a.id)??a),o=t.filter(a=>!r.has(a.id));return i?{events:[...o,...n],pending:[]}:{events:n,pending:o}}function Iv(e,t){const i=new Map(e.map((n,o)=>[n.id,o])),s=e.slice(),r=[];for(const n of t){const o=i.get(n.id);o===void 0?r.push(n):s[o]=n}return[...s,...r]}const Av=/^(\d{4})-(\d{2})-(\d{2})$/u;function Pl(e){return e<10?`0${e}`:String(e)}function Gs(e){const t=new Date(e);return`${t.getFullYear()}-${Pl(t.getMonth()+1)}-${Pl(t.getDate())}`}function Rv(e){if(typeof e!="string")return null;const t=Av.exec(e.trim());if(!t)return null;const i=Number(t[1]),s=Number(t[2]),r=Number(t[3]),n=new Date(i,s-1,r);return n.getFullYear()!==i||n.getMonth()!==s-1||n.getDate()!==r?null:`${t[1]}-${t[2]}-${t[3]}`}function Lv(e){const t=Rv(e);if(!t)return Number.NaN;const[i,s,r]=t.split("-").map(Number);return new Date(i,s-1,r).getTime()}function El(e,t){const i=Lv(e);if(Number.isNaN(i))return e;const s=new Date(i);return Gs(new Date(s.getFullYear(),s.getMonth(),s.getDate()+t).getTime())}function Sc(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Mv(e.items,t.items)}function Mv(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++){const s=e[i],r=t[i];if(s==null||r==null||s.id!==r.id||s.type!==r.type||s.element!==r.element||s.instance!==r.instance||s.version!==r.version)return!1}return!0}function Nv(e,t,i){const s=document.createElement("div");return s.style.display="flow-root",e==="header"?(s.setAttribute(tf,""),t.before(s)):(s.setAttribute(sf,""),t.after(s)),i?.observe(s),s}function Ov(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Ht(e){const t=window.devicePixelRatio??1;return Math.round(e*t)/t}const Gv=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","loadDiffFiles","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],zv=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],Tl=["renderCustomHeader","renderHeaderPrefix","renderHeaderFilenameSuffix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],Il=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],yc=Symbol("CodeView.itemOptionsState");function Al(e,t){Object.defineProperty(e,yc,{configurable:!1,enumerable:!1,value:t})}function bs(e){return e[yc]}function ei(e,t,i){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return i(this)}})}const Bv=120,Rl=1,Ll="--diffs-overflow-override",Aa=12e6,xc=1e6,Cc=2e6,Wv=Aa-Cc,Ml=Aa-xc;function Hv(e){if(e==null)throw new Error("CodeView: createEditor is required for items with edit: true")}const $v=(()=>{const{navigator:e}=globalThis,t=e.userAgent,i=/iP(?:hone|ad|od)/.test(t),s=e.platform==="MacIntel"&&e.maxTouchPoints>1;return(i||s)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})();var Fv=class ri{static __STOP=!1;static __lastScrollPosition=0;type="advanced";config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=vs;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement("div");stickyContainer=document.createElement("div");stickyOffset=document.createElement("div");header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;isContainerManaged;constructor(t={theme:Yn},i,s=!1){this.options=t,this.computeMetricsCache(t.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=i,this.isContainerManaged=s,this.stickyOffset.style.contain="layout size",this.stickyContainer.style.position="sticky",this.stickyContainer.style.width="100%",this.stickyContainer.style.contain="layout style inline-size",this.stickyContainer.style.isolation="isolate",this.stickyContainer.style.display="flex",this.stickyContainer.style.flexDirection="column"}getLayout(){return this.options.layout??rf}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(t){return this.itemMetricsCache={hunkLineCount:t?.hunkLineCount??vs.hunkLineCount,lineHeight:t?.lineHeight??vs.lineHeight,diffHeaderHeight:t?.diffHeaderHeight??vs.diffHeaderHeight,hunkSeparatorHeight:t?.hunkSeparatorHeight,spacing:t?.spacing??vs.spacing,paddingTop:t?.paddingTop,paddingBottom:t?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??nf}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return of&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(t){if(!this.shouldValidateItemHeights()||t.element==null)return;const i=t.instance.getAdvancedStickySpecs();if(i==null)return;const s=i.height,r=t.element.getBoundingClientRect().height;s!==r&&console.error("CodeView: reconciled item height does not match DOM height",{id:t.item.id,type:t.type,index:t.index,version:t.version,expectedHeight:s,actualHeight:r,delta:r-s,stickyTopOffset:i.topOffset,virtualizedHeight:t.instance.getVirtualizedHeight(),top:t.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:t.element,instance:t.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;const{firstIndex:t,lastIndex:i,stickyHeight:s,stickyTop:r,stickyBottom:n}=this.renderState;if(t===-1||i===-1)return;const o=this.stickyContainer.getBoundingClientRect().height;Math.abs(o-s)<Rl||console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:s,actualStickyHeight:o,delta:o-s,stickyTop:r,stickyBottom:n,firstIndex:t,lastIndex:i,firstStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[i]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0),$v&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Ll,"hidden"),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Bv)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&(this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1),this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Ll,"auto"),this.codeOverflowFix=!1)};syncLayout(){const{gap:t,paddingBottom:i,paddingTop:s}=this.getLayout();this.stickyContainer.style.gap=`${t}px`,this.container?.style.setProperty("margin-top",`${s}px`),this.container?.style.setProperty("margin-bottom",`${i}px`)}reconcileHeaderFooterHosts(){const t=this.reconcileHost("header"),i=this.reconcileHost("footer");return t||i}reconcileHost(t){const{root:i,container:s}=this;if(i==null||s==null)return!1;const r=t==="header"?this.header:this.footer,n=t==="header"?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(n==null)return r.element==null||(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0)),!1;if(r.element!=null&&n===r.render)return!1;const o=r.element??Nv(t,s,this.resizeObserver);r.element=o;const a=n();return a!=null?o.replaceChildren(a):!this.isContainerManaged&&o.children.length>0&&(o.textContent=""),r.render=n,!0}setHostHeight(t,i){t.height!==i&&(t.height=i,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw new Error("CodeView.setup: already setup");this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor="none",this.root.hasAttribute("tabindex")||(this.root.tabIndex=-1),this.container??=document.createElement("div"),this.container.style.contain="layout style",this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener("scroll",this.handleScroll,{passive:!0}),this.root.addEventListener("wheel",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("touchstart",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("pointerdown",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("keydown",this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{ri.__STOP?(ri.__STOP=!1,this.scrollTo({type:"position",position:ri.__lastScrollPosition,behavior:"instant"})):(ri.__lastScrollPosition=this.getScrollTop(),ri.__STOP=!0)}}reset(){_l(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();for(const t of this.itemEditors.values())t.editor.cleanUp();this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",this.container?.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener("scroll",this.handleScroll),this.root?.removeEventListener("wheel",this.clearPendingScroll),this.root?.removeEventListener("touchstart",this.clearPendingScroll),this.root?.removeEventListener("pointerdown",this.clearPendingScroll),this.root?.removeEventListener("keydown",this.clearPendingScroll),this.root?.style.removeProperty("overflow-anchor"),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let t=this.renderState.firstIndex;t<=this.renderState.lastIndex;t++){const i=this.items[t];if(i==null)throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${t}`);this.releaseRenderedItem(i)}}primeScrollTarget(t){if(t.type==="position")return;const i=this.idToItem.get(t.id);i?.instance.primeHighlightCache()}getElementPoolLimit(){const t=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:i}=this.itemMetricsCache;return Math.max(8,Math.ceil(t/Math.max(i,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let t=this.elementPool.pop();for(;t!=null&&!this.isElementPoolGenerationCurrent(t);)t=this.elementPool.pop();return t??=document.createElement(af),this.markElementPoolGenerationCurrent(t),t}releaseRenderedItem(t){const{element:i}=t;i!=null&&this.renderedItemOwnsFocus(i)&&(this.shouldFixContainerFocus=!0),t.instance.cleanUp(!0),this.attachedEditors.delete(t.item.id),t.element=void 0,i!=null&&(i.remove(),this.cleanElement(i),this.queueElementForPool(i))}renderedItemOwnsFocus(t){const{activeElement:i}=document;return i===t||t.contains(i)||t.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(t){const{shadowRoot:i}=t;if(i!=null)for(const s of Array.from(i.children))qv(s)||s.remove();this.isContainerManaged||t.replaceChildren()}queueElementForPool(t){const i=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(t)||this.getElementPoolSize()>=i||(this.isElementClean(t)?this.elementPool.push(t):this.pendingElementPool.push(t))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;const{pendingElementPool:t}=this;this.pendingElementPool=[];const i=this.getElementPoolLimit();for(const s of t)this.isElementPoolGenerationCurrent(s)&&this.isElementClean(s)&&this.elementPool.length<i?this.elementPool.push(s):this.isElementPoolGenerationCurrent(s)&&this.getElementPoolSize()<i&&this.pendingElementPool.push(s)}isElementClean(t){return t.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(t){this.elementPoolTracker.set(t,this.elementPoolVersion)}isElementPoolGenerationCurrent(t){return this.elementPoolTracker.get(t)===this.elementPoolVersion}resolveEffectiveScrollBehavior(t,i){return Ov()?"instant":t.behavior!=="smooth-auto"?t.behavior??"instant":Math.abs(i-this.getScrollTop())<=this.getHeight()*10?"smooth":"instant"}scrollTo(t){if(this.root==null)return;const i=this.normalizeScrollTarget(t);if(i==null)return;const s=this.resolveScrollTargetTop(i);s!=null&&(this.primeScrollTarget(i),this.resolveEffectiveScrollBehavior(i,s)==="smooth"?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=i,this.render())}setSelectedLines(t,i){this.applySelectedLines(t,i)}getSelectedLines(){return this.selectedLines}clearSelectedLines(t){this.applySelectedLines(null,t)}getItem(t){return this.idToItem.get(t)?.item}getEditor(t){return this.itemEditors.get(t)?.editor}updateItem(t){const i=this.idToItem.get(t.id);return i==null?(console.error(`CodeView.updateItem: unknown item id "${t.id}"`),!1):this.syncItemRecord(i,t)?(this.markItemLayoutDirty(i),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(t,i){if(t===i)return!0;const s=this.idToItem.get(t);if(s==null)return console.error(`CodeView.updateItemId: unknown item id "${t}"`),!1;if(this.idToItem.has(i))return console.error(`CodeView.updateItemId: duplicate item id "${i}"`),!1;this.idToItem.delete(t),s.item.id=i,this.idToItem.set(i,s),this.updateItemOptionsId(s.instance.options,i),this.selectedLines?.id===t&&(this.selectedLines={...this.selectedLines,id:i},this.options.onSelectedLinesChange?.(this.selectedLines));const r=this.itemEditors.get(t);return r!=null&&(r.state.id=i,this.itemEditors.delete(t),this.itemEditors.set(i,r),this.attachedEditors.delete(t)&&this.attachedEditors.add(i)),this.renamePendingScrollTarget(t,i),this.renamePendingLayoutAnchor(t,i),this.render(),!0}addItem(t){this.addItems([t])}addItems(t){this.appendItemsInternal(t),this.syncItemEditors(),this.syncSelection()}removeItem(t){const i=this.idToItem.get(t);if(i==null)return console.error(`CodeView.removeItem: unknown item id "${t}"`),!1;const s=[];for(const r of this.items)r!==i&&s.push(r.item);return this.setItems(s),!0}setItems(t){let i;this.items.length===0?this.appendItemsInternal(t):this.tryAppendItems(t)||(i=this.reconcileItems(t)),this.syncItemEditors(i),this.syncSelection()}appendItemsInternal(t,i=!0){if(t.length===0)return;const s=this.getLayout();let r=this.items.length===0?0:this.scrollHeight+s.gap;const n=r;for(let o=0;o<t.length;o++){const a=t[o];if(a==null)throw new Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(a.id))throw new Error(`CodeView.addItem: duplicate id "${a.id}"`);const l=this.createItem(a,this.items.length,r);this.items.push(l),this.idToItem.set(l.item.id,l),this.instanceToItem.set(l.instance,l),l.height=jv(l),r+=l.height+s.gap}this.scrollHeight=r-s.gap,this.scrollDirty=!0,i&&(this.canSkipRenderForAppend(n)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(t){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&t>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(t){if(t==null)return;this.capturePendingLayoutAnchor();const{options:i}=this,s=this.getLayout(),{itemMetricsCache:r}=this;Vv(i,t)&&this.invalidateElementPool(),this.options=t;const n=this.computeMetricsCache(t.itemMetrics),o=!bl(r,n),a=!bl(s,this.getLayout());a&&this.syncLayout();const l=o||Uv(i,t);if(l){const d=this.pendingLayoutReset;this.pendingLayoutReset={metrics:o?n:d?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:d?.includeEstimatedDiffHeights===!0||o||Kv(i,t)}}(a||l)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),Bd(i,t)||this.renderOptionsRevision++,this.syncItemEditors();const h=i.renderCodeViewHeader!==t.renderCodeViewHeader||i.renderCodeViewFooter!==t.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||h)&&this.render()}capturePendingLayoutAnchor(t=this.idToItem){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),t))}render(t=!1){ri.__STOP||(t?(_l(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):lf(this.computeRenderRangeAndEmit))}isReady(){const{workerManager:t}=this;return t==null||t.isInitialized()||t.getStats().workersFailed?(this.clearReadySubscription(),!0):(this.isReadySubscription??=t.subscribeToStatChanges(i=>{i.managerState!=="initialized"&&!i.workersFailed||(this.clearReadySubscription(),this.render(!0))}),t.getStats().managerState==="waiting"&&t.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0)}instanceChanged(t,i){const s=this.instanceToItem.get(t);if(s==null)throw new Error("CodeView.instanceChanged: An instance has changed that is not registered");i&&this.markItemLayoutDirty(s),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){const{firstIndex:t,lastIndex:i}=this.renderState;if(t===-1||i===-1||i<t)return[];const s=[];for(let r=t;r<=i;r++){const n=this.items[r];n?.element!=null&&(n.type==="diff"?s.push({id:n.item.id,type:"diff",item:n.item,version:n.version,element:n.element,instance:n.instance}):s.push({id:n.item.id,type:"file",item:n.item,version:n.version,element:n.element,instance:n.instance}))}return s}setSlotCoordinator(t){return t===this.slotCoordinator?!1:(this.slotCoordinator=t,this.slotSnapshot=void 0,!0)}getSlotSnapshot(t){return this.buildSlotSnapshot(t)}buildSlotSnapshot(t){const i=Xv(this.getRenderedItems(),t),{element:s}=this.header,{element:r}=this.footer;if(!(i==null&&s==null&&r==null))return{items:i,header:s,footer:r}}subscribeToScroll(t){return this.scrollListeners.add(t),()=>{this.scrollListeners.delete(t)}}getLocalTopForInstance(t){const i=this.instanceToItem.get(t);if(i==null)throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return i.top}getTopForItem(t){const i=this.idToItem.get(t);if(i!=null)return i.top+this.getItemTopOffset()}createItem(t,i,s){const{itemMetricsCache:r}=this;if(t.type==="diff"){const o=new Xg(this.createDiffOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"diff",item:t,version:t.version,index:i,top:s,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:o}}const n=new hf(this.createFileOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"file",item:t,version:t.version,index:i,top:s,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:n}}applySelectedLines(t,i){const{selectedLines:s}=this;t==null&&s==null||t!=null&&s?.id===t.id&&df(s.range,t.range)||(s!=null&&s.id!==t?.id&&this.idToItem.get(s.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=t,this.idToItem.get(t?.id??"")?.instance.setSelectedLines(t?.range??null,i))}syncSelection(){if(this.selectedLines==null)return;const t=this.idToItem.get(this.selectedLines.id);if(t==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}t.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(t){return t.item.edit===!0&&t.item.collapsed!==!0}attachItemEditor(t){const{id:i}=t.item,{createEditor:s}=this.options;if(t.element==null||this.attachedEditors.has(i)||!this.isItemInEditMode(t))return;let r=this.itemEditors.get(i),n=!1;try{if(r==null){Hv(s);const o={id:i},a=s({onChange:(l,h)=>{const d=this.idToItem.get(o.id);d!=null&&(o.lastChange={item:d.item,file:l,lineAnnotations:h},this.options.onItemEditChange?.(d.item,l,h))}});if(a==null)return;r={editor:a,state:o},this.itemEditors.set(i,r),n=!0}r.editor.edit(t.instance),this.attachedEditors.add(i)}catch(o){throw n&&r!=null&&(this.itemEditors.delete(i),r.editor.cleanUp()),this.releaseRenderedItem(t),o}}syncItemEditors(t){if(this.itemEditors.size===0)return;const i=[];for(const[s,r]of this.itemEditors){const n=this.idToItem.get(s),o=t?.get(s);if(o==null&&n!=null&&this.isItemInEditMode(n))continue;r.editor.cleanUp(),this.itemEditors.delete(s),this.attachedEditors.delete(s);const{lastChange:a}=r.state,l=o==null?n?.item??a?.item:a?.item??o.item;l?.type==="diff"&&(o==null&&n!=null&&n.type==="diff"&&n.instance.completeEditSession()&&(this.markItemLayoutDirty(n),this.render()),Jg(l.fileDiff)),a!=null&&i.push(o!=null||n==null?a:{...a,item:n.item})}for(const{item:s,file:r,lineAnnotations:n}of i)this.options.onItemEditComplete?.(s,r,n)}renamePendingScrollTarget(t,i){const{pendingScrollTarget:s}=this;s==null||s.type==="position"||s.id!==t||(this.pendingScrollTarget={...s,id:i})}renamePendingLayoutAnchor(t,i){this.pendingLayoutAnchor?.id===t&&(this.pendingLayoutAnchor.id=i)}createFileOptionsPrototype(){const t={};for(const i of zv)ei(t,i,()=>this.options[i]);ei(t,"stickyHeader",()=>this.options.stickyHeaders),ei(t,"collapsed",i=>{const s=bs(i);if(s!=null)return this.getItemOptions(s,"file")?.item.collapsed});for(const i of Tl)this.defineItemSharedCallback(t,"file",i);for(const i of Il)this.defineItemSelectionCallback(t,"file",i);return t}createDiffOptionsPrototype(){const t={};for(const i of Gv)ei(t,i,()=>this.options[i]);ei(t,"stickyHeader",()=>this.options.stickyHeaders),ei(t,"hunkSeparators",()=>this.options.hunkSeparators),ei(t,"collapsed",i=>{const s=bs(i);if(s!=null)return this.getItemOptions(s,"diff")?.item.collapsed});for(const i of Tl)this.defineItemSharedCallback(t,"diff",i);for(const i of Il)this.defineItemSelectionCallback(t,"diff",i);return t}createFileOptions(t){const i=Object.create(this.fileOptionsPrototype);return Al(i,{id:t}),i}createDiffOptions(t){const i=Object.create(this.diffOptionsPrototype);return Al(i,{id:t}),i}updateItemOptionsId(t,i){const s=bs(t);if(s==null)throw new Error("CodeView.updateItemOptionsId: No valid state");s.id=i}getItemOptions(t,i){const s=this.idToItem.get(t.id);if(!(s==null||s.type!==i))return s}defineItemSharedCallback(t,i,s){ei(t,s,r=>{if(this.options[s]==null)return;const n=bs(r);if(n==null)return;const o=n.callbackCache??={};let a=o[s];return a==null&&(a=((...l)=>{const h=this.getItemOptions(n,i);if(h==null)return;const d=this.options[s];return d?.(...l,h)}),o[s]=a),a})}defineItemSelectionCallback(t,i,s){ei(t,s,r=>{const n=bs(r);if(n==null)return;const o=n.callbackCache??={};let a=o[s];return a==null&&(a=(l=>{const h=this.getItemOptions(n,i);if(h==null)return;const d=l==null?null:{id:h.item.id,range:l};this.options.controlledSelection!==!0&&(l!=null||this.selectedLines?.id===h.item.id)&&this.applySelectedLines(d,{notify:!1}),this.options.onSelectedLinesChange?.(d);const u=this.options[s];return u?.(l,h)}),o[s]=a),a})}markLayoutDirtyFromIndex(t){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??t,t)}markItemLayoutDirty(t){if(this.items[t.index]!==t)throw new Error(`CodeView.markItemLayoutDirty: unknown item id "${t.item.id}"`);this.markLayoutDirtyFromIndex(t.index)}tryAppendItems(t){if(t.length<=this.items.length)return!1;for(let i=0;i<this.items.length;i++){const s=this.items[i];if(s==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[i];if(r==null||s.item.id!==r.id||s.type!==r.type)return!1}for(let i=0;i<this.items.length;i++){const s=this.items[i];if(s==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[i];if(r==null)throw new Error("CodeView.tryAppendItems: append candidate missing prefix item");this.syncItemRecord(s,r)&&this.markLayoutDirtyFromIndex(i)}return this.appendItemsInternal(t.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(t){const{items:i,idToItem:s}=this,r=new Set(i),n=[],o=new Map,a=new Map,l=new Map;let h;for(let d=0;d<t.length;d++){const u=t[d];if(u==null)throw new Error("CodeView.reconcileItems: missing input item");if(o.has(u.id))throw new Error(`CodeView.setItems: duplicate id "${u.id}"`);const p=s.get(u.id),f=p!=null&&p.type===u.type?p:this.createItem(u,d,0);f.index=d,p!=null&&p.type===u.type?(r.delete(p),this.syncItemRecord(f,u)&&(h=Math.min(h??d,d))):h=Math.min(h??d,d),i[d]!==f&&(h=Math.min(h??d,d)),n.push(f),o.set(u.id,f),a.set(f.instance,f)}if(h==null){if(r.size===0)return;h=Math.max(n.length-1,0)}this.capturePendingLayoutAnchor(o);for(let d=0;d<i.length;d++){const u=i[d];if(u==null||!r.has(u))continue;l.set(u.item.id,u),this.releaseRenderedItem(u);const p=Math.max(n.length-1,0);h=Math.min(h??p,p)}return this.items=n,this.idToItem=o,this.instanceToItem=a,this.renderState.firstIndex>=n.length?this.resetRenderState():this.renderState.lastIndex>=n.length&&(this.renderState.lastIndex=n.length-1),this.markLayoutDirtyFromIndex(h),this.scrollDirty=!0,this.render(),l.size>0?l:void 0}syncItemRecord(t,i){if(t.type!==i.type)throw new Error(`CodeView.syncItemRecord: type mismatch for id "${i.id}"`);return t.version===i.version?!1:(t.item=i,t.version=i.version,t.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(t){const{paddingBottom:i,paddingTop:s}=this.getLayout();return Math.max(s+this.header.height+t+this.footer.height+i-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Ml}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Aa):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(t){const i=this.getMaxPagedScrollTop();return Math.max(0,Math.min(t,i))}clampScrollTop(t){const i=this.getMaxScrollTop();return Math.max(0,Math.min(t,i))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(t){const i=this.getMaxScrollPageOffset();return Math.max(0,Math.min(t,i))}resolveScrollPageWindow(t,i){let s=Ht(this.clampPagedScrollTop(i)),r=this.clampScrollPageOffset(t-s);return s=Ht(this.clampPagedScrollTop(t-r)),r=this.clampScrollPageOffset(t-s),{pagedScrollTop:s,scrollPageOffset:r}}resolvePagedScrollPosition(t){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(t),scrollPageOffset:0};const i=this.clampScrollPageOffset(this.scrollPageOffset),s=t-i,r=this.getMaxPagedScrollTop(),n=this.getMaxScrollPageOffset(),o=s>Ml&&i<n,a=s<xc&&i>0;return s<0||s>r||o||a?this.resolveScrollPageWindow(t,a?Math.min(Wv,r):Cc):{pagedScrollTop:Ht(this.clampPagedScrollTop(s)),scrollPageOffset:i}}needsScrollPageUpdate(t){const i=Ht(this.clampScrollTop(t)),{scrollPageOffset:s}=this.resolvePagedScrollPosition(i);return s!==this.scrollPageOffset}getPagedLayoutTop(t){return this.shouldRebaseScroll()?Math.max(t-this.scrollPageOffset,0):t}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(t){const i=this.idToItem.get(t.id);if(i==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return{top:i.top,height:i.height};if(t.type==="range"){const r=this.getRangeScrollPosition(i,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Nl(t.range)} for item "${t.id}"`);return}return{top:i.top+r.top,height:r.height}}const s=this.getLineScrollPosition(i,t);if(s==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return{top:i.top+s.top,height:s.height}}normalizeScrollTarget(t){if(t.type==="position"||t.align!=="nearest")return t;const i=this.getScrollTargetRect(t);if(i==null)return;const s=t.offset??0,r=this.getItemTopOffset()+i.top,n=r+i.height,o=this.getScrollTop(),a=o+(t.type==="line"||t.type==="range"?this.getStickyHeaderOffset():0),l=o+this.getHeight();if(!(r-s<=a&&n+s>=l)){if(r-s<a)return{...t,align:"start"};if(n+s>l)return{...t,align:"end"}}}resolveScrollTargetTop(t){if(t.type==="position"){const r=this.clampScrollTop(t.position);return r!==t.position?r:this.clampScrollTop(t.position-this.getStickyHeaderOffset())}const i=this.idToItem.get(t.id);if(i==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return this.clampScrollTop(this.resolveAlignedScrollPosition(i.top,i.height,t.align,t.offset));if(t.type==="range"){const r=this.getRangeScrollPosition(i,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Nl(t.range)} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(i.top+r.top,r.height,t.align,t.offset,this.getStickyHeaderOffset()))}const s=this.getLineScrollPosition(i,t);if(s==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(i.top+s.top,s.height,t.align,t.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(t,i,s,r=0,n=0){t+=this.getItemTopOffset();const o=this.getHeight();return s==="center"&&i+r<o?t-(o-i)/2+r:s==="end"?t-(o-i)+r:t-n-r}getLineScrollPosition(t,i){return t.type==="diff"?t.instance.getLinePosition(i.lineNumber,i.side):t.instance.getLinePosition(i.lineNumber)}getRangeScrollPosition(t,i){const{range:s}=i,r=this.getLineScrollPosition(t,{type:"line",id:i.id,lineNumber:s.start,side:s.side}),n=this.getLineScrollPosition(t,{type:"line",id:i.id,lineNumber:s.end,side:s.endSide??s.side});if(r==null||n==null)return;const o=r.top,a=o+r.height,l=n.top,h=l+n.height,d=Math.min(o,l);return{top:d,height:Math.max(a,h)-d}}computeTargetScrollTopForFrame(t,i){if(this.pendingScrollTarget==null)return t;const s=this.resolveScrollTargetTop(this.pendingScrollTarget);if(s==null)return t;const{scrollAnimation:r}=this;return r==null?s:this.computeSpringStep(r,s,i).position}computeSpringStep(t,i,s){const r=Math.max(0,s-t.lastTimestamp),{omega:n}=this.getSmoothScrollSettings(),o=Math.exp(-n*r),a=t.position-i,l=t.velocity+n*a;return{position:i+(a+l*r)*o,velocity:(l*(1-n*r)-n*a)*o}}advanceScrollAnimation(t,i){if(this.pendingScrollTarget==null)return;const s=this.resolveScrollTargetTop(this.pendingScrollTarget);if(s==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}const r=this.scrollAnimation;if(r==null)return s;r.position+=i;const{position:n,velocity:o}=this.computeSpringStep(r,s,t);r.lastTimestamp=t,r.position=n,r.velocity=o;const{positionEpsilon:a,velocityEpsilon:l}=this.getSmoothScrollSettings();return Math.abs(s-n)<=a&&Math.abs(o)<=l?(r.position=s,r.velocity=0,this.scrollAnimation=void 0,s):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(ri.__STOP||this.container==null||!this.isReady())return;const i=this.getHeight(),s=this.getScrollTop();let r=s,n=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(r);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,n=!0),n&&o!=null){const L=this.resolveAnchoredScrollTop(o);if(L!=null){const G=L-r;r=L,this.scrollAnimation!=null&&(this.scrollAnimation.position+=G)}}n&&(r=this.clampScrollTop(r),this.syncContainerHeight());const a=this.computeTargetScrollTopForFrame(r,t),l=!n&&(this.renderState.scrollTop===-1||Math.abs(a-this.renderState.scrollTop)>i+this.config.overscrollSize*2);l&&(o=void 0),this.windowSpecs=cf({scrollTop:a-this.header.height,height:i,scrollHeight:this.getScrollHeight(),fitPerfectly:l,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let h=s;(this.pendingScrollTarget!=null&&a!==h||this.needsScrollPageUpdate(a))&&(this.applyScrollFix(a,h,this.windowSpecs),h=a);const{top:d,bottom:u}=this.windowSpecs,{firstIndex:p,lastIndex:f}=this.renderState;if(p>=0)for(let L=p;L<=f;L++){const G=this.items[L];if(G==null)throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${L}`);G.top>d-G.height&&G.top<=u||this.releaseRenderedItem(G)}const m=this.reconcileHeaderFooterHosts();let g;const _=new Set,A=this.findFirstVisibleIndex(d),P=this.findLastVisibleIndex(u);for(let L=A;L<=P;L++){const G=this.items[L];if(G==null)throw new Error("CodeView.computeRenderRangeAndEmit: missing item");const{instance:H}=G;G.element==null?(G.element=this.acquireElement(),zl(this.stickyContainer,G.element,g),H.virtualizedSetup(),Gl(G,G.element)&&(G.renderedOptionsRevision=this.renderOptionsRevision,_.add(G)),g=G.element):(zl(this.stickyContainer,G.element,g),Gl(G,void 0,G.renderedOptionsRevision!==this.renderOptionsRevision)&&(G.renderedOptionsRevision=this.renderOptionsRevision,_.add(G)),g=G.element),G.item.edit===!0&&this.attachItemEditor(G)}this.renderState.firstIndex=A<=P?A:-1,this.renderState.lastIndex=P,this.flushSlotCoordinator(),this.flushManagers(_),m&&this.measureMountedHosts(),this.reconcileRenderedItems(_),this.syncContainerHeight(),this.updateStickyPositioning();const E=o!=null?this.resolveAnchoredScrollTop(o):void 0;o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);const y=E!=null?E-r:0;let T=a,D=!1;if(this.pendingScrollTarget!=null){const L=this.advanceScrollAnimation(t,y);L!=null?(T=L,D=!0):T=r}else T=E??a;T!==h&&(this.applyScrollFix(T,h,this.windowSpecs),h=T),D&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Ht(h),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(l||this.scrollAnimation!=null)&&this.render()};flushManagers(t){for(const i of t)i.instance.flushManagers()}syncContainerHeight(){const t=this.getPagedScrollHeight();this.container==null||this.containerHeight===t||(this.container.style.height=`${t}px`,this.containerHeight=t)}getStickyBounds(t){const{firstIndex:i,lastIndex:s}=t!=null?{firstIndex:this.findFirstVisibleIndex(t.top),lastIndex:this.findLastVisibleIndex(t.bottom)}:this.renderState;if(i===-1||s===-1||i>s)return;const r=this.items[i]?.instance.getAdvancedStickySpecs(t),n=this.items[s]?.instance.getAdvancedStickySpecs(t);if(!(r==null||n==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(n.topOffset+n.height)}}applyStickyPositioning({stickyTop:t,stickyBottom:i}){const s=this.getHeight(),{itemMetricsCache:r}=this,n=i-t;this.renderState.stickyHeight=n,this.renderState.stickyTop=t,this.renderState.stickyBottom=i,this.stickyOffset.style.height=`${t}px`;const o=(Math.random()*r.lineHeight>>0)*-1,a=-Math.max(n+o,0)+s;this.stickyContainer.style.top=`${a}px`,this.stickyContainer.style.bottom=`${a+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(t){this.syncContainerHeight();const i=this.getStickyBounds(t);i!=null&&this.applyStickyPositioning(i)}reconcileRenderedItems(t){const{firstIndex:i,lastIndex:s}=this.renderState;if(i===-1)return;let r=-1,n=!1;for(let o=i;o<this.items.length&&!(!n&&o>s);o++){const a=this.items[o];if(a==null)throw new Error("CodeView.reconcileRenderedItems: Invalid item");r===-1?r=a.top:a.top!==r&&(a.top=r,a.instance.syncVirtualizedTop(),n=!0),(t==null?o<=s:t.has(a))&&(a.instance.reconcileHeights()&&(n=!0,a.height=a.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(a)),r+=a.instance.getVirtualizedHeight(),o<this.items.length-1&&(r+=this.getLayout().gap)}n&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){const t=this.getStickyBounds();if(t==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height="");return}const{stickyTop:i,stickyBottom:s}=t;s-i===this.renderState.stickyHeight&&i===this.renderState.stickyTop&&s===this.renderState.stickyBottom||this.applyStickyPositioning(t)}handleScroll=()=>{ri.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=t=>{let i=!1;for(const s of t)if(s.target===this.stickyContainer){const r=s.borderBoxSize[0].blockSize;if(Math.abs(r-this.renderState.stickyHeight)>=Rl){const n=this.getScrollTop(),o=this.getScrollAnchor(n);this.reconcileRenderedItems(),this.updateStickyPositioning();const a=o!=null?this.resolveAnchoredScrollTop(o):void 0;if(a!=null){const l=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=l)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),i=!0}}else if(s.target===this.header.element||s.target===this.footer.element){const r=s.target===this.header.element?this.header:this.footer,n=s.borderBoxSize[0].blockSize;if(n!==r.height){const o=this.getScrollTop(),a=this.getScrollAnchor(o);this.setHostHeight(r,n);const l=a!=null?this.resolveAnchoredScrollTop(a):void 0;if(l!=null){const h=l-o;this.applyScrollFix(l,o,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=h)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),i=!0}}else this.scrollDirty=!0,this.heightDirty=!0,i=!0;i&&this.render(!0)};getScrollAnchorViewportTop(t,i){return t<i?i+this.getStickyHeaderOffset():i}getScrollAnchor(t,i=this.idToItem){let s;const{pendingLayoutAnchor:r}=this;if(r!=null){const d=this.idToItem.get(r.id);if(d!=null&&i.get(r.id)===d)return r;d!=null&&(s=d)}if(t<=0)return;const{firstIndex:n,lastIndex:o,stickyTop:a,stickyBottom:l}=this.renderState;if(n===-1||o===-1)return;const h=this.getHeight();if(!(a===-1||l===-1)){for(let d=n;d<=o;d++){const u=this.items[d];if(u==null)continue;const p=this.getItemTopOffset()+u.top;if(p+u.height<=t)continue;if(p>=t+h)break;if(i.get(u.item.id)!==u){s??=u;continue}if(p>=t)return{type:"item",id:u.item.id,viewportOffset:p-t};const f=this.getScrollAnchorViewportTop(p,t)-p,m=u.instance.getNumericScrollAnchor(f);if(m!=null){const g=p+m.top;return{type:"line",id:u.item.id,lineNumber:m.lineNumber,side:m.side,viewportOffset:g-t}}}if(s!=null)for(let d=s.index+1;d<this.items.length;d++){const u=this.items[d];if(u!=null&&i.get(u.item.id)===u)return{type:"item",id:u.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(t){const i=this.idToItem.get(t.id);if(i==null)return;const s=this.getItemTopOffset();if(t.type==="item"){const o=s+i.top;return this.clampScrollTop(o-t.viewportOffset)}const r=i.type==="diff"?i.instance.getLinePosition(t.lineNumber,t.side):i.instance.getLinePosition(t.lineNumber);if(r==null)return;const n=s+i.top+r.top;return this.clampScrollTop(n-t.viewportOffset)}applyScrollFix(t,i,s){if(this.root==null)return;const r=Ht(this.clampScrollTop(t)),n=Ht(i),{scrollPageOffset:o}=this,a=Ht(this.clampPagedScrollTop(n-o)),{pagedScrollTop:l,scrollPageOffset:h}=this.resolvePagedScrollPosition(r),d=l,u=o!==h;r===this.renderState.scrollTop&&r===n&&d===a&&!u||(this.suspendScrollInteractions(),(d!==a||u)&&(this.scrollPageOffset=h,this.syncPagedScrollScaffolding(s)),d!==a&&this.root.scrollTo({top:d,behavior:"instant"}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(t){const i=this.resolveScrollTargetTop(t);return i==null?!0:Ht(this.getScrollTop())===Ht(i)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;const t=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(t+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;const t=this.buildSlotSnapshot(this.slotCoordinator);Sc(this.slotSnapshot,t)||(this.slotSnapshot=t,this.slotCoordinator.onSnapshotChange(t))}notifyScroll(){if(this.scrollListeners.size===0)return;const t=this.getScrollTop();for(const i of this.scrollListeners)i(t,this)}findFirstVisibleIndex(t){let i=0,s=this.items.length-1,r=this.items.length;for(;i<=s;){const n=i+s>>1,o=this.items[n];if(o==null)throw new Error("CodeView.findFirstVisibleIndex: invalid item index");o.top+o.height>t?(r=n,s=n-1):i=n+1}return r}findLastVisibleIndex(t){let i=0,s=this.items.length-1,r=-1;for(;i<=s;){const n=i+s>>1,o=this.items[n];if(o==null)throw new Error("CodeView.findLastVisibleIndex: invalid item index");o.top<=t?(r=n,i=n+1):s=n-1}return r}recomputeLayout(t=0,i){if(this.items.length===0){this.scrollHeight=0;return}const s=this.getLayout();let r=0;if(t>0){const n=this.items[t-1];if(n==null)throw new Error("CodeView.recomputeLayout: invalid dirty index");r=n.top+n.height+s.gap}for(let n=t;n<this.items.length;n++){const o=this.items[n];if(o==null)throw new Error("CodeView.recomputeLayout: invalid item index");if(o.top=r,o.type==="diff"){const a=o.instance.consumeCodeViewLayoutChanges(o.item.fileDiff);a!=null&&Object.assign(o.item.fileDiff,a),o.height=o.instance.prepareCodeViewItem(o.item.fileDiff,r,i,o.item.annotations??[])}else o.height=o.instance.prepareCodeViewItem(o.item.file,r,i,o.item.annotations??[]);r+=o.height,n<this.items.length-1&&(r+=s.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function jv(e){return e.instance.cleanUp(!0),e.type==="diff"?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function Vv(e,t){return!pf(e.theme??Yn,t.theme??Yn)||(e.themeType??"system")!==(t.themeType??"system")||e.unsafeCSS!==t.unsafeCSS}function Uv(e,t){return(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Kv(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function qv(e){return e instanceof SVGElement?!0:uf(e)&&(e.hasAttribute("data-core-css")||e.hasAttribute("data-theme-css")||e.hasAttribute("data-unsafe-css"))}function Nl(e){const t=Ol(e.start,e.side),i=Ol(e.end,e.endSide??e.side);return t===i?t:`${t}-${i}`}function Ol(e,t){return t==null?`${e}`:`${t==="deletions"?"D":"A"}${e}`}function Gl(e,t,i=!1){return e.type==="diff"?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:i,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:i,lineAnnotations:e.item.annotations??[]})}function zl(e,t,i){if(i==null){e.firstChild!==t&&e.prepend(t);return}i.nextSibling!==t&&i.after(t)}function Yv(e){return(e.annotations?.length??0)>0}function Xv(e,{hasHeaderRenderers:t,hasAnnotationRenderer:i,hasGutterRenderer:s}){if(e.length===0)return;if(t||s)return e;if(!i)return;const r=[];for(const n of e)Yv(n.item)&&r.push(n);return r.length>0?r:void 0}const Bl=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Wl(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Jv(e,t){const{className:i,containerRef:s,disableWorkerPool:r=!1,editorOptions:n,initialItems:o,items:a,onItemEditChange:l,onItemEditComplete:h,onScroll:d,onSelectedLinesChange:u,options:p,renderAnnotation:f,renderCodeViewFooter:m,renderCodeViewHeader:g,renderCustomHeader:_,renderGutterUtility:A,renderHeaderFilenameSuffix:P,renderHeaderMetadata:E,renderHeaderPrefix:y,selectedLines:T,style:D}=e,L=a!==void 0,G=ff(),H=b.useContext(mf),M=b.useRef(Wl(L)),N=_!=null,C=f!=null,v=A!=null,S=N||y!=null||P!=null||E!=null,x=S||C||v,w=g!=null,R=m!=null,I=Ci(X=>{u?.(X)}),B=T!==void 0,W=Ci(X=>{if(G==null)throw new Error("CodeView: EditContext is not attached");const fe=G({...n,...X});if(fe==null)throw new Error("CodeView: EditProvider.createEditor must return an editor instance");return fe}),Z=Ci((X,fe,me)=>{l?.(X,fe,me)}),ie=Ci((X,fe,me)=>{h?.(X,fe,me)}),se=b.useMemo(()=>t_({options:p,hasCustomHeader:N,hasGutterRenderer:v,hasCodeViewHeader:w,hasCodeViewFooter:R,onSelectedLinesChange:u!=null?I:void 0,controlledSelection:B,createEditor:G!=null?W:void 0,onItemEditChange:l!=null?Z:void 0,onItemEditComplete:h!=null?ie:void 0}),[G,B,W,Z,ie,I,R,w,N,v,l,h,u,p]),[ae]=b.useState(()=>e_()),[,Se]=b.useState({}),ne=Ci(X=>{M.current.instance!=null&&(X==null||X!==M.current.instance.getContainerElement())&&(M.current.instance.cleanUp(),ae.publish(void 0),M.current=Wl(L)),X!=null&&X!==M.current.instance?.getContainerElement()&&(M.current.instance=new Fv(se,r?void 0:H,!0),M.current.instance.setup(X)),typeof s=="function"?s(X):s!=null&&(s.current=X)}),_e=Ci(X=>{M.current.disableFlushSync?ae.publish(X):xr.flushSync(()=>{ae.publish(X)})}),We=b.useMemo(()=>{if(!(!S&&!C&&!v&&!w&&!R))return{hasHeaderRenderers:S,hasAnnotationRenderer:C,hasGutterRenderer:v,onSnapshotChange:_e}},[_e,C,v,S,w,R]);return Bl(()=>d!=null?M.current.instance?.subscribeToScroll(d):void 0),Bl(()=>{const{instance:X,controlled:fe,items:me,managedOptions:Ce,slotCoordinator:ce}=M.current;if(X!=null)try{M.current.disableFlushSync=!0;let Re=!1;if(Bd(se,Ce)||(M.current.managedOptions=se,X.setOptions(se),Re=!0),fe!==L){console.error("CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.");return}if(L)a!==me&&(Qv(me,a)?M.current.items=a:Zv(me,a)?(M.current.items=a,X.addItems(a.slice(me.length))):(M.current.items=a,X.setItems(a),Re=!0));else if(me==null){const ft=o??[];M.current.items=ft,ft.length>0&&(X.setItems(ft),Re=!0)}T!==void 0&&X.setSelectedLines(T,{notify:!1});const Le=X.setSlotCoordinator(We);let Me=!1;We!==ce&&((We==null||ce==null)&&(Me=!0),M.current.slotCoordinator=We),(Re||Le)&&X.render(!0),Le&&We==null&&ae.publish(void 0),Me&&Se({})}finally{M.current.disableFlushSync=!1}}),b.useImperativeHandle(t,()=>({addItems(X){const{controlled:fe,instance:me}=M.current;nr(fe,"addItems"),me==null?console.error("CodeView.addItems: no valid instance to append items with",X):me.addItems(X)},getItem(X){const{instance:fe}=M.current;if(fe==null){console.error("CodeView.getItem: no valid instance exists",X);return}else return fe.getItem(X)},removeItem(X){const{controlled:fe,instance:me}=M.current;return nr(fe,"removeItem"),me==null?(console.error("CodeView.removeItem: no valid instance to remove item from",X),!1):me.removeItem(X)},updateItem(X){const{controlled:fe,instance:me}=M.current;return nr(fe,"updateItem"),me==null?(console.error("CodeView.updateItem: no valid instance to update item with",X),!1):me.updateItem(X)},updateItemId(X,fe){const{controlled:me,instance:Ce}=M.current;return nr(me,"updateItemId"),Ce==null?(console.error("CodeView.updateItemId: no valid instance to update item id with",X,fe),!1):Ce.updateItemId(X,fe)},scrollTo(X){const{instance:fe}=M.current;fe==null?console.error("CodeView.scrollTo: no valid instance to scroll with",X):fe.scrollTo(X)},setSelectedLines(X){const{instance:fe}=M.current;fe==null?console.error("CodeView.setSelectedLines: no valid instance to update selection with",X):(fe.setSelectedLines(X,{notify:!1}),I(X))},getSelectedLines(){const{instance:X}=M.current;return X==null?(console.error("CodeView.getSelectedLines: no valid instance exists"),null):X.getSelectedLines()},clearSelectedLines(){const{instance:X}=M.current;X==null?console.error("CodeView.clearSelectedLines: no valid instance to update selection with"):(X.clearSelectedLines({notify:!1}),I(null))},getEditor(X){const{instance:fe}=M.current;if(fe==null){console.error("CodeView.getEditor: no valid instance exists",X);return}return fe.getEditor(X)},getInstance(){return M.current.instance}}),[I]),c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:ne,className:i,style:D}),(x||w||R)&&c.jsx(i_,{managedContentStore:ae,renderCustomHeader:_,renderHeaderPrefix:y,renderHeaderFilenameSuffix:P,renderHeaderMetadata:E,renderAnnotation:f,renderGutterUtility:A,renderCodeViewHeader:g,renderCodeViewFooter:m})]})}const Dc=b.forwardRef(Jv);function Zv(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let i=0;i<e.length;i++)if(t[i]!==e[i])return!1;return!0}function Qv(e,t){if(e==null||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function nr(e,t){if(e)throw new Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function e_(){let e;const t=new Set;return{getSnapshot(){return e},publish(i){if(!Sc(e,i)){e=i;for(const s of t)s()}},subscribe(i){return t.add(i),()=>{t.delete(i)}}}}function t_({options:e,hasCustomHeader:t,hasGutterRenderer:i,hasCodeViewHeader:s,hasCodeViewFooter:r,onSelectedLinesChange:n,controlledSelection:o,createEditor:a,onItemEditChange:l,onItemEditComplete:h}){const d={...e,controlledSelection:o,onSelectedLinesChange:n,createEditor:a};return l!=null&&(d.onItemEditChange=l),h!=null&&(d.onItemEditComplete=h),t&&(d.renderCustomHeader=or),i&&(d.renderGutterUtility=or),s&&(d.renderCodeViewHeader=or),r&&(d.renderCodeViewFooter=or),d}const i_=b.memo(function({managedContentStore:t,renderCustomHeader:i,renderHeaderPrefix:s,renderHeaderFilenameSuffix:r,renderHeaderMetadata:n,renderAnnotation:o,renderGutterUtility:a,renderCodeViewHeader:l,renderCodeViewFooter:h}){"use no memo";const d=Ci(m=>t.subscribe(m)),u=Ci(()=>t.getSnapshot()),p=b.useSyncExternalStore(d,u,u);let f="";for(const m of p?.items??[])f+=`${m.id}:${m.version}:${m.type}`;return c.jsxs(c.Fragment,{children:[b.useMemo(()=>p?.items?.map(m=>xr.createPortal(s_({renderedItem:m,renderCustomHeader:i,renderHeaderPrefix:s,renderHeaderFilenameSuffix:r,renderHeaderMetadata:n,renderAnnotation:o,renderGutterUtility:a}),m.element,m.id)),[i,s,r,n,o,a,f]),b.useMemo(()=>l!=null&&p?.header!=null?xr.createPortal(l(),p.header):null,[l,p?.header]),b.useMemo(()=>h!=null&&p?.footer!=null?xr.createPortal(h(),p.footer):null,[h,p?.footer])]})});function s_({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:i,renderHeaderFilenameSuffix:s,renderHeaderMetadata:r,renderAnnotation:n,renderGutterUtility:o}){if(e.type==="diff"){const{item:a,instance:l}=e;return Zg({fileDiff:a.fileDiff,renderCustomHeader:t!=null?()=>t(a):void 0,renderHeaderPrefix:i!=null?()=>i(a):void 0,renderHeaderFilenameSuffix:s!=null?()=>s(a):void 0,renderHeaderMetadata:r!=null?()=>r(a):void 0,renderAnnotation:n!=null?h=>n(h,a):void 0,lineAnnotations:a.annotations,renderGutterUtility:o!=null?h=>o(h,a):void 0,getHoveredLine:l.getHoveredLine})}else{const{item:a,instance:l}=e;return gf({file:a.file,renderCustomHeader:t!=null?()=>t(a):void 0,renderHeaderPrefix:i!=null?()=>i(a):void 0,renderHeaderFilenameSuffix:s!=null?()=>s(a):void 0,renderHeaderMetadata:r!=null?()=>r(a):void 0,renderAnnotation:n!=null?h=>n(h,a):void 0,lineAnnotations:a.annotations,renderGutterUtility:o!=null?h=>o(h,a):void 0,getHoveredLine:l.getHoveredLine})}}function or(){}var kc,Pc=class{constructor(){}},Et=class extends Pc{constructor(e,t,i,s){super(),this.viewId=e,this.groupId=t,this.panelId=i,this.tabGroupId=s}},zs=class extends Pc{constructor(e,t){super(),this.viewId=e,this.paneId=t}},di=class Ec{constructor(){}static getInstance(){return Ec.INSTANCE}hasData(t){return t&&t===this.proto}clearData(t){this.hasData(t)&&(this.proto=void 0,this.data=void 0)}getData(t){if(this.hasData(t))return this.data}setData(t,i){i&&(this.data=t,this.proto=i)}};kc=di;di.INSTANCE=new kc;function Te(){const e=di.getInstance();if(e.hasData(Et.prototype))return e.getData(Et.prototype)[0]}function ws(){const e=di.getInstance();if(e.hasData(zs.prototype))return e.getData(zs.prototype)[0]}let be;(function(e){e.NONE={dispose:()=>{}};function t(i){return{dispose:()=>{i()}}}e.from=t})(be||(be={}));var ee=class{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach(t=>this._disposables.add(t))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables.clear())}},ze=class{constructor(){this._disposable=be.NONE}get value(){return this._disposable===be.NONE?void 0:this._disposable}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=be.NONE)}};let Tt;(function(e){e.any=(...t)=>i=>{const s=t.map(r=>r(i));return{dispose:()=>{s.forEach(r=>{r.dispose()})}}}})(Tt||(Tt={}));var Ra=class{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}},Tc=class{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}},r_=class{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}},Hl=class Ic{static create(){var t;return new Ic((t=new Error("listener stacktrace").stack)!==null&&t!==void 0?t:"")}constructor(t){this.value=t}print(){console.warn("dockview: stacktrace",this.value)}},n_=class{constructor(e,t){this.callback=e,this.stacktrace=t}},O=class jt{static setLeakageMonitorEnabled(t){t!==jt.ENABLE_TRACKING&&jt.MEMORY_LEAK_WATCHER.clear(),jt.ENABLE_TRACKING=t}get value(){return this._last}constructor(t){this.options=t,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=t=>{var i;!((i=this.options)===null||i===void 0)&&i.replay&&this._last!==void 0&&t(this._last);const s=new n_(t,jt.ENABLE_TRACKING?Hl.create():void 0);return this._listeners.push(s),{dispose:()=>{const r=this._listeners.indexOf(s);r>-1&&this._listeners.splice(r,1)}}},jt.ENABLE_TRACKING&&jt.MEMORY_LEAK_WATCHER.add(this._event,Hl.create())),this._event}fire(t){var i;if(this._pauseTokens!==void 0&&this._pauseTokens.size>0)return;!((i=this.options)===null||i===void 0)&&i.replay&&(this._last=t);const s=this._listeners,r=s.length;if(r!==0){if(r===1){s[0].callback(t);return}for(const n of s.slice())n.callback(t)}}pause(){var t;const i={};return(t=this._pauseTokens)!==null&&t!==void 0||(this._pauseTokens=new Set),this._pauseTokens.add(i),be.from(()=>{var s;return(s=this._pauseTokens)===null||s===void 0?void 0:s.delete(i)})}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(jt.ENABLE_TRACKING?queueMicrotask(()=>{for(const i of this._listeners){var t;console.warn("dockview: stacktrace",(t=i.stacktrace)===null||t===void 0?void 0:t.print())}this._listeners=[]}):this._listeners=[]),jt.ENABLE_TRACKING&&this._event&&jt.MEMORY_LEAK_WATCHER.delete(this._event))}};O.ENABLE_TRACKING=!1;O.MEMORY_LEAK_WATCHER=new r_;function J(e,t,i,s){return e.addEventListener(t,i,s),{dispose:()=>{e.removeEventListener(t,i,s)}}}var $l=class{constructor(){this._onFired=new O,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const t=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>t&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}},o_=class extends ee{constructor(e){super(),this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,Yi(e,t=>{const i=t.target.scrollWidth>t.target.clientWidth,s=t.target.scrollHeight>t.target.clientHeight;this._value={hasScrollX:i,hasScrollY:s},this._onDidChange.fire(this._value)}))}};function Yi(e,t){const i=new ResizeObserver(s=>{requestAnimationFrame(()=>{const r=s[0];t(r)})});return i.observe(e),{dispose:()=>{i.unobserve(e),i.disconnect()}}}const zt=(e,...t)=>{for(const i of t)e.classList.contains(i)&&e.classList.remove(i)},Bt=(e,...t)=>{for(const i of t)e.classList.contains(i)||e.classList.add(i)},K=(e,t,i)=>{const s=e.classList.contains(t);i&&!s&&e.classList.add(t),!i&&s&&e.classList.remove(t)};function eo(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function Ac(e){return new a_(e)}var a_=class extends ee{constructor(e){super(),this._onDidFocus=new O,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new O,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=eo(document.activeElement,e),i=!1;const s=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},r=()=>{t&&(i=!0,globalThis.setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{eo(document.activeElement,e)!==t&&(t?r():s())},this.addDisposables(J(e,"focus",s,!0)),this.addDisposables(J(e,"blur",r,!0))}refreshState(){this._refreshStateHandler()}};const Rc="dv-quasiPreventDefault";function Lc(e){e[Rc]=!0}function Fl(e){return e[Rc]}function l_(e,t,i={}){const s=Array.from(t),{nonce:r}=i,n=typeof r=="function"?r(e):r;for(const o of s){if(o.href){const h=e.createElement("link");h.href=o.href,h.type=o.type,h.rel="stylesheet",e.head.appendChild(h);continue}let a=[];try{o.cssRules&&(a=Array.from(o.cssRules).map(h=>h.cssText))}catch(h){console.warn("dockview: failed to access stylesheet rules due to security restrictions",h)}const l=e.createDocumentFragment();for(const h of a){const d=e.createElement("style");n&&d.setAttribute("nonce",n),d.appendChild(e.createTextNode(h)),l.appendChild(d)}e.head.appendChild(l)}}function to(e){const{left:t,top:i,width:s,height:r}=e.getBoundingClientRect();return{left:t+window.scrollX,top:i+window.scrollY,width:s,height:r}}function Mc(e){let t=e;for(;t?.parentNode;){if(t.parentNode===document)return!0;t.parentNode instanceof DocumentFragment?t=t.parentNode.host:t=t.parentNode}return!1}function h_(e,t){e.dataset.testid=t}function d_(e,t){const i=[];function s(r){if(r.nodeType===Node.ELEMENT_NODE){e.includes(r.tagName)&&i.push(r),r.shadowRoot&&s(r.shadowRoot);for(const n of r.children)s(n)}}return s(t instanceof Document?t.documentElement:t),i}function $s(e=document){const t=d_(["IFRAME","WEBVIEW"],e),i=new WeakMap;for(const s of t)i.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{for(const r of t){var s;r.style.pointerEvents=(s=i.get(r))!==null&&s!==void 0?s:"auto"}t.splice(0,t.length)}}}function c_(e){function t(r){const n=[];for(let o=0;o<r.classList.length;o++)n.push(r.classList.item(o));return n}let i,s=e;for(;s!==null&&(i=t(s).find(r=>r.startsWith("dockview-theme-")),typeof i!="string");)s=s.parentElement;return i}var on=class{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const t of this._classNames)K(this.element,t,!1);this._classNames=e.split(" ").filter(t=>t.trim().length>0);for(const t of this._classNames)K(this.element,t,!0)}};const Nc=100;function wn(e,t){const i=to(e),s=to(t);return!(i.left<s.left||i.left+i.width>s.left+s.width||i.top<s.top||i.top+i.height>s.top+s.height)}function u_(e){const t=new O;let i=e.screenX,s=e.screenY,r,n=0,o=!1;const a=()=>{if(o||e.closed)return;const h=e.screenX,d=e.screenY;(h!==i||d!==s)&&(clearTimeout(r),r=setTimeout(()=>{t.fire()},Nc),i=h,s=d),n=requestAnimationFrame(a)};a();const l=t.dispose.bind(t);return t.dispose=()=>{o||(o=!0,cancelAnimationFrame(n),clearTimeout(r)),l()},t}function p_(e,t){let i;return new ee(J(e,"resize",()=>{clearTimeout(i),i=setTimeout(()=>{t()},Nc)}))}function f_(e,t,i){var s;const r=(s=void 0)!==null&&s!==void 0?s:10,n=e.getBoundingClientRect(),o=t.getBoundingClientRect();let a=0,l=0;const h=n.left-o.left,d=n.top-o.top,u=n.bottom-o.bottom,p=n.right-o.right;h<r?a=r-h:p>r&&(a=-r-p),d<r?l=r-d:u>r&&(l=-u-r),(a!==0||l!==0)&&(e.style.transform=`translate(${a}px, ${l}px)`)}function m_(e){let t=e;for(;t&&(t.style.zIndex==="auto"||t.style.zIndex==="");)t=t.parentElement;return t}function li(e){if(e.length===0)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function Oc(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function Sn(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))}function ar(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))}function g_(e,t){for(let i=0;i<e.length;i++){const s=e[i];if(t(s))return i}return-1}function Gc(e,t){const i=e.indexOf(t);return i>-1?(e.splice(i,1),!0):!1}const Ee=(e,t,i)=>t>i?t:Math.min(i,Math.max(e,t)),La=()=>{let e=1;return{next:()=>(e++).toString()}},Nt=(e,t)=>{const i=[];if(typeof t!="number"&&(t=e,e=0),e<=t)for(let s=e;s<t;s++)i.push(s);else for(let s=e;s>t;s--)i.push(s);return i};var v_=class{set size(e){this._size=e}setContainerGeometry(e,t){this._appliedStyles[e]!==t&&(this._appliedStyles[e]=t,this.container.style[e]=t)}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return this._cachedVisibleSize===void 0}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,s){this.container=e,this.view=t,this.disposable=s,this._cachedVisibleSize=void 0,this._appliedStyles={},typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}setVisible(e,t){if(e!==this.visible){if(e){var i;this.size=Ee((i=this._cachedVisibleSize)!==null&&i!==void 0?i:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0}else this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0;this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e)}}dispose(){return this.disposable.dispose(),this.view}};function jl(e,t,i){e.appliedLeft!==t&&(e.appliedLeft=t,e.container.style.left=t),e.appliedTop!==i&&(e.appliedTop=i,e.container.style.top=i)}let ht;(function(e){e.Distribute={type:"distribute"};function t(s){return{type:"split",index:s}}e.Split=t;function i(s){return{type:"invisible",cachedVisibleSize:s}}e.Invisible=i})(ht||(ht={}));var Vi=class{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,zt(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation=="HORIZONTAL"?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,K(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,K(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,t){var i,s;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new O,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new O,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new O,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(r,n,o=this.viewItems.map(f=>f.size),a,l,h=Number.NEGATIVE_INFINITY,d=Number.POSITIVE_INFINITY,u,p)=>{if(r<0||r>this.viewItems.length)return 0;const f=Nt(r,-1),m=Nt(r+1,this.viewItems.length);if(l)for(const M of l)Sn(f,M),Sn(m,M);if(a)for(const M of a)ar(f,M),ar(m,M);const g=f.reduce((M,N)=>M+this.viewItems[N].minimumSize-o[N],0),_=f.reduce((M,N)=>M+this.viewItems[N].maximumSize-o[N],0),A=m.length===0?Number.POSITIVE_INFINITY:m.reduce((M,N)=>M+o[N]-this.viewItems[N].minimumSize,0),P=m.length===0?Number.NEGATIVE_INFINITY:m.reduce((M,N)=>M+o[N]-this.viewItems[N].maximumSize,0),E=Math.max(g,P),y=Math.min(A,_);let T=!1;if(u){const M=this.viewItems[u.index],N=n>=u.limitDelta;T=N!==M.visible,M.setVisible(N,u.size)}if(!T&&p){const M=this.viewItems[p.index],N=n<p.limitDelta;T=N!==M.visible,M.setVisible(N,p.size)}if(T)return this.resize(r,n,o,a,l,h,d);const D=Ee(n,E,y);let L=0,G=D;for(const M of f){const N=this.viewItems[M],C=o[M],v=Ee(C+G,N.minimumSize,N.maximumSize),S=v-C;L+=S,G-=S,N.size=v}let H=L;for(const M of m){const N=this.viewItems[M],C=o[M],v=Ee(C-H,N.minimumSize,N.maximumSize),S=v-C;H+=S,N.size=v}return n},this._orientation=(i=t.orientation)!==null&&i!==void 0?i:"VERTICAL",this.element=this.createContainer(),this.margin=(s=t.margin)!==null&&s!==void 0?s:0,this.proportionalLayout=t.proportionalLayout===void 0?!0:!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach((r,n)=>{const o=r.visible===void 0||r.visible?r.size:{type:"invisible",cachedVisibleSize:r.size},a=r.view;this.addView(a,o,n,!0)}),this._contentSize=this.viewItems.reduce((r,n)=>r+n.size,0),this.saveProportions())}style(e){e?.separatorBorder==="transparent"?(zt(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(Bt(this.element,"dv-separator-border"),e?.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const i=this.viewItems[e];i.setVisible(t,i.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;const i=Nt(this.viewItems.length).filter(o=>o!==e),s=[...i.filter(o=>this.viewItems[o].priority==="low"),e],r=i.filter(o=>this.viewItems[o].priority==="high"),n=this.viewItems[e];t=Math.round(t),t=Ee(t,n.minimumSize,Math.min(n.maximumSize,this._size)),n.size=t,this.relayout(s,r)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,t){const i=this.viewItems.indexOf(e);if(i<0||i>=this.viewItems.length)return;t=typeof t=="number"?t:e.size,t=Ee(t,e.minimumSize,e.maximumSize),e.size=t;const s=Nt(this.viewItems.length).filter(o=>o!==i),r=[...s.filter(o=>this.viewItems[o].priority==="low"),i],n=s.filter(o=>this.viewItems[o].priority==="high");this.relayout([...r,i],n)}addView(e,t=ht.Distribute,i=this.viewItems.length,s){const r=document.createElement("div");r.className="dv-view",r.appendChild(e.element);let n;typeof t=="number"?n=t:t.type==="split"?n=this.getViewSize(t.index)/2:t.type==="invisible"?n={cachedVisibleSize:t.cachedVisibleSize}:n=e.minimumSize;const o=e.onDidChange(l=>this.onDidChange(a,l.size)),a=new v_(r,e,n,{dispose:()=>{o.dispose(),r.remove()}});if(i===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(i)),this.viewItems.splice(i,0,a),this.viewItems.length>1){const l=document.createElement("div");l.className="dv-sash";const h=u=>{var p;for(const w of this.viewItems)w.enabled=!1;const f=(p=l.ownerDocument)!==null&&p!==void 0?p:document,m=$s(f),g=this._orientation==="HORIZONTAL"?u.clientX:u.clientY,_=g_(this.sashes,w=>w.container===l),A=this.viewItems.map(w=>w.size);let P,E;const y=Nt(_,-1),T=Nt(_+1,this.viewItems.length),D=y.reduce((w,R)=>w+(this.viewItems[R].minimumSize-A[R]),0),L=y.reduce((w,R)=>w+(this.viewItems[R].viewMaximumSize-A[R]),0),G=T.length===0?Number.POSITIVE_INFINITY:T.reduce((w,R)=>w+(A[R]-this.viewItems[R].minimumSize),0),H=T.length===0?Number.NEGATIVE_INFINITY:T.reduce((w,R)=>w+(A[R]-this.viewItems[R].viewMaximumSize),0),M=Math.max(D,H),N=Math.min(G,L),C=this.findFirstSnapIndex(y),v=this.findFirstSnapIndex(T);if(typeof C=="number"){const w=this.viewItems[C],R=Math.floor(w.viewMinimumSize/2);P={index:C,limitDelta:w.visible?M-R:M+R,size:w.size}}if(typeof v=="number"){const w=this.viewItems[v],R=Math.floor(w.viewMinimumSize/2);E={index:v,limitDelta:w.visible?N+R:N-R,size:w.size}}const S=w=>{const R=(this._orientation==="HORIZONTAL"?w.clientX:w.clientY)-g;this.resize(_,R,A,void 0,void 0,M,N,P,E),this.distributeEmptySpace(),this.layoutViews()},x=()=>{for(const w of this.viewItems)w.enabled=!0;m.release(),this.saveProportions(),f.removeEventListener("pointermove",S),f.removeEventListener("pointerup",x),f.removeEventListener("pointercancel",x),f.removeEventListener("contextmenu",x),this._onDidSashEnd.fire(void 0)};f.addEventListener("pointermove",S),f.addEventListener("pointerup",x),f.addEventListener("pointercancel",x),f.addEventListener("contextmenu",x)};l.addEventListener("pointerdown",h);const d={container:l,disposable:()=>{l.removeEventListener("pointerdown",h),l.remove()}};this.sashContainer.appendChild(l),this.sashes.push(d)}s||this.relayout([i]),!s&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let t=0;for(const o of this.viewItems)o.maximumSize-o.minimumSize>0&&(e.push(o),t+=o.size);const i=Math.floor(t/e.length);for(const o of e)o.size=Ee(i,o.minimumSize,o.maximumSize);const s=Nt(this.viewItems.length),r=s.filter(o=>this.viewItems[o].priority==="low"),n=s.filter(o=>this.viewItems[o].priority==="high");this.relayout(r,n)}removeView(e,t,i=!1){const s=this.viewItems.splice(e,1)[0];if(s.dispose(),this.viewItems.length>=1){const r=Math.max(e-1,0);this.sashes.splice(r,1)[0].disposable()}return i||this.relayout(),t?.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(s.view),s.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,t){const i=this.getViewCachedVisibleSize(e),s=i===void 0?this.getViewSize(e):ht.Invisible(i),r=this.removeView(e,void 0,!0);this.addView(r,s,t)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let s=0;for(let r=0;r<this.viewItems.length;r++){const n=this.viewItems[r],o=this.proportions[r];typeof o=="number"?s+=o:e-=n.size}for(let r=0;r<this.viewItems.length;r++){const n=this.viewItems[r],o=this.proportions[r];typeof o=="number"&&s>0&&(n.size=Ee(Math.round(o*e/s),n.minimumSize,n.maximumSize))}}else{const s=Nt(this.viewItems.length),r=s.filter(o=>this.viewItems[o].priority==="low"),n=s.filter(o=>this.viewItems[o].priority==="high");this.resize(this.viewItems.length-1,e-i,void 0,r,n)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const i=this.viewItems.reduce((s,r)=>s+r.size,0);this.resize(this.viewItems.length-1,this._size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){let t=0;for(const n of this.viewItems)t+=n.size;let i=this.size-t;if(i===0)return;const s=Nt(this.viewItems.length-1,-1);let r=!1;for(const n of this.viewItems)if(n.priority==="low"||n.priority==="high"){r=!0;break}if(r){const n=s.filter(a=>this.viewItems[a].priority==="low"),o=s.filter(a=>this.viewItems[a].priority==="high");for(const a of o)Sn(s,a);for(const a of n)ar(s,a)}typeof e=="number"&&ar(s,e);for(let n=0;i!==0&&n<s.length;n++){const o=this.viewItems[s[n]],a=Ee(o.size+i,o.minimumSize,o.maximumSize),l=a-o.size;i-=l,o.size=a}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){let e=0,t=0;for(const l of this.viewItems)e+=l.size,l.visible&&t++;if(this._contentSize=e,this.updateSashEnablement(),this.viewItems.length===0)return;const i=Math.max(0,t-1),s=this.margin*i/Math.max(1,t);let r=0;const n=[],o=4;let a=0;this.viewItems.forEach((l,h)=>{r+=this.viewItems[h].size,n.push(r),a+=l.visible?1:0;const d=l.visible?l.size-s:0,u=Math.max(0,a-1),p=h===0||u===0?0:n[h-1]+u/i*s;if(h<this.viewItems.length-1){const f=l.visible?p+d-o/2+this.margin/2:p,m=this.sashes[h];this._orientation==="HORIZONTAL"&&jl(m,`${f}px`,"0px"),this._orientation==="VERTICAL"&&jl(m,"0px",`${f}px`)}this._orientation==="HORIZONTAL"&&(l.setContainerGeometry("width",`${d}px`),l.setContainerGeometry("left",`${p}px`),l.setContainerGeometry("top",""),l.setContainerGeometry("height","")),this._orientation==="VERTICAL"&&(l.setContainerGeometry("height",`${d}px`),l.setContainerGeometry("top",`${p}px`),l.setContainerGeometry("width",""),l.setContainerGeometry("left","")),l.view.layout(l.size-s,this._orthogonalSize)})}findFirstSnapIndex(e){for(const t of e){const i=this.viewItems[t];if(i.visible&&i.snap)return t}for(const t of e){const i=this.viewItems[t];if(i.visible&&i.maximumSize-i.minimumSize>0)return;if(!i.visible&&i.snap)return t}}updateSashEnablement(){if(this.sashes.length===0)return;let e=!1;const t=this.viewItems.map(a=>e=a.size-a.minimumSize>0||e);e=!1;const i=this.viewItems.map(a=>e=a.maximumSize-a.size>0||e),s=[...this.viewItems].reverse();e=!1;const r=s.map(a=>e=a.size-a.minimumSize>0||e).reverse();e=!1;const n=s.map(a=>e=a.maximumSize-a.size>0||e).reverse();let o=0;for(let a=0;a<this.sashes.length;a++){const l=this.sashes[a],h=this.viewItems[a];o+=h.size;const d=!(t[a]&&n[a+1]),u=!(i[a]&&r[a+1]);if(d&&u){const p=Nt(a,-1),f=Nt(a+1,this.viewItems.length),m=this.findFirstSnapIndex(p),g=this.findFirstSnapIndex(f),_=typeof m=="number"&&!this.viewItems[m].visible,A=typeof g=="number"&&!this.viewItems[g].visible;_&&r[a]&&(o>0||this.startSnappingEnabled)?this.updateSash(l,1):A&&t[a]&&(o<this._contentSize||this.endSnappingEnabled)?this.updateSash(l,0):this.updateSash(l,2)}else d&&!u?this.updateSash(l,1):!d&&u?this.updateSash(l,0):this.updateSash(l,3)}}updateSash(e,t){K(e.container,"dv-disabled",t===2),K(e.container,"dv-enabled",t===3),K(e.container,"dv-maximum",t===0),K(e.container,"dv-minimum",t===1)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div");return e.className=`dv-split-view-container ${this._orientation==="HORIZONTAL"?"dv-horizontal":"dv-vertical"}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.remove();break}for(const e of this.viewItems)e.dispose();this.element.remove()}};const io=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});var Vl=class extends ee{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,t){var i;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._orientation=(i=t.orientation)!==null&&i!==void 0?i:"VERTICAL",this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new Vi(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:t.descriptor}),this.getPanes().forEach(s=>{const r=new ee(s.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),n={pane:s,disposable:{dispose:()=>{r.dispose()}}};this.paneItems.push(n),s.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,t){this.splitview.setViewVisible(e,t)}addPane(e,t,i=this.splitview.length,s=!1){const r=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),n={pane:e,disposable:{dispose:()=>{r.dispose()}}};this.paneItems.splice(i,0,n),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,i,s)}getViewSize(e){return this.splitview.getViewSize(e)}getViewCachedVisibleSize(e){return this.splitview.getViewCachedVisibleSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,t){const i=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t?.skipDispose||(i.disposable.dispose(),i.pane.dispose()),i}moveView(e,t){if(e===t)return;const i=this.removePane(e,{skipDispose:!0});i.disposable.dispose(),this.skipAnimation=!0;try{this.addPane(i.pane,i.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),Bt(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,zt(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}},rt=class{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation==="HORIZONTAL"?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation==="HORIZONTAL"?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation==="HORIZONTAL"?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation==="HORIZONTAL"?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation==="HORIZONTAL"?this.orthogonalSize:this.size}get height(){return this.orientation==="HORIZONTAL"?this.size:this.orthogonalSize}constructor(e,t,i,s=0){this.view=e,this.orientation=t,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._orthogonalSize=i,this._size=s,this._disposable=this.view.onDidChange(r=>{r?this._onDidChange.fire({size:this.orientation==="VERTICAL"?r.width:r.height,orthogonalSize:this.orientation==="VERTICAL"?r.height:r.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}},qe=class so extends ee{get width(){return this.orientation==="HORIZONTAL"?this.size:this.orthogonalSize}get height(){return this.orientation==="HORIZONTAL"?this.orthogonalSize:this.size}get minimumSize(){if(this._cachedMinimumSize===void 0){let t=0;for(let i=0;i<this.children.length;i++)this.splitview.isViewVisible(i)&&(t=Math.max(t,this.children[i].minimumOrthogonalSize));this._cachedMinimumSize=t}return this._cachedMinimumSize}get maximumSize(){if(this._cachedMaximumSize===void 0){let t=Number.POSITIVE_INFINITY;for(let i=0;i<this.children.length;i++)this.splitview.isViewVisible(i)&&(t=Math.min(t,this.children[i].maximumOrthogonalSize));this._cachedMaximumSize=t}return this._cachedMaximumSize}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation==="HORIZONTAL"?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation==="HORIZONTAL"?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation==="HORIZONTAL"?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation==="HORIZONTAL"?this.maximumSize:this.maximumOrthogonalSize}get priority(){var t;return(t=this._cachedPriority)!==null&&t!==void 0||(this._cachedPriority=this.computePriority()),this._cachedPriority}computePriority(){if(this.children.length===0)return"normal";let t=!1,i=!1;for(const r of this.children){var s;const n=(s=r.priority)!==null&&s!==void 0?s:"normal";n==="high"?t=!0:n==="low"&&(i=!0)}return t?"high":i?"low":"normal"}invalidateCachedSizes(){this._cachedMinimumSize=void 0,this._cachedMaximumSize=void 0,this._cachedPriority=void 0}get disabled(){return this.splitview.disabled}set disabled(t){this.splitview.disabled=t}get margin(){return this.splitview.margin}set margin(t){this.splitview.margin=t,this.children.forEach(i=>{i instanceof so&&(i.margin=t)})}constructor(t,i,s,r,n,o,a,l){if(super(),this.orientation=t,this.proportionalLayout=i,this.styles=s,this._childrenDisposable=be.NONE,this.children=[],this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new O,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=n,this._size=r,this.element=document.createElement("div"),this.element.className="dv-branch-node",l){const h={views:l.map(d=>{var u;return{view:d.node,size:d.node.size,visible:(u=d.visible)!==null&&u!==void 0?u:!0}}),size:this.orthogonalSize};this.children=l.map(d=>d.node),this.splitview=new Vi(this.element,{orientation:this.orientation,descriptor:h,proportionalLayout:i,styles:s,margin:a})}else this.splitview=new Vi(this.element,{orientation:this.orientation,proportionalLayout:i,styles:s,margin:a}),this.splitview.layout(this.size,this.orthogonalSize);this.disabled=o,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(t){}isChildVisible(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(t)}setChildVisible(t,i){if(t<0||t>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(t)===i)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(t,i),this.invalidateCachedSizes();const r=this.splitview.contentSize===0;(i&&s||!i&&r)&&this._onDidVisibilityChange.fire({visible:i})}moveChild(t,i){if(t===i)return;if(t<0||t>=this.children.length)throw new Error("Invalid from index");t<i&&i--,this.splitview.moveView(t,i);const s=this._removeChild(t);this._addChild(s,i)}getChildSize(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(t)}resizeChild(t,i){if(t<0||t>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(t,i)}layout(t,i){this._size=i,this._orthogonalSize=t,this.splitview.layout(i,t)}addChild(t,i,s,r){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(t,i,s,r),this._addChild(t,s)}getChildCachedVisibleSize(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(t)}removeChild(t,i){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(t,i),this._removeChild(t)}_addChild(t,i){this.children.splice(i,0,t),this.setupChildrenEvents()}_removeChild(t){const[i]=this.children.splice(t,1);return this.setupChildrenEvents(),i}setupChildrenEvents(){this.invalidateCachedSizes(),this._childrenDisposable.dispose(),this._childrenDisposable=new ee(Tt.any(...this.children.map(t=>t.onDidChange))(t=>{this.invalidateCachedSizes(),this._onDidChange.fire({size:t.orthogonalSize})}),...this.children.map((t,i)=>t instanceof so?t.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(i,s)}):be.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(t=>t.dispose()),super.dispose()}};function ro(e,t){if(e instanceof rt)return e;if(e instanceof qe)return ro(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")}function zc(e,t,i){if(e instanceof qe){const s=new qe(e.orientation,e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);for(let r=e.children.length-1;r>=0;r--){const n=e.children[r];s.addChild(zc(n,n.size,n.orthogonalSize),n.size,0,!0)}return s}else return new rt(e.view,e.orientation,i)}function no(e,t,i){if(e instanceof qe){const s=new qe(Kt(e.orientation),e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);let r=0;for(let n=e.children.length-1;n>=0;n--){const o=e.children[n],a=o instanceof qe?o.orthogonalSize:o.size;let l=e.size===0?0:Math.round(t*a/e.size);r+=l,n===0&&(l+=t-r),s.addChild(no(o,i,l),l,0,!0)}return s}else return new rt(e.view,Kt(e.orientation),i)}function __(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let i=t.firstElementChild,s=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,s++;return s}function De(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(t.className))return[];const i=__(t),s=t.parentElement.parentElement.parentElement;return[...De(s),i]}function Dt(e,t,i){if(w_(e,t)===b_(i)){const[s,r]=li(t);let n=r;return(i==="right"||i==="bottom")&&(n+=1),[...s,n]}else{const s=i==="right"||i==="bottom"?1:0;return[...t,s]}}function b_(e){return e==="top"||e==="bottom"?"VERTICAL":"HORIZONTAL"}function w_(e,t){return t.length%2===0?Kt(e):e}const Kt=e=>e==="HORIZONTAL"?"VERTICAL":"HORIZONTAL";function S_(e){return!!e.children}const oo=(e,t)=>{const i=t==="VERTICAL"?e.box.width:e.box.height;if(!S_(e))return typeof e.cachedVisibleSize=="number"?{type:"leaf",data:e.view.toJSON(),size:e.cachedVisibleSize,visible:!1}:{type:"leaf",data:e.view.toJSON(),size:i};const s=e.children.map(r=>oo(r,Kt(t)));return typeof e.cachedVisibleSize=="number"?{type:"branch",data:s,size:e.cachedVisibleSize,visible:!1}:{type:"branch",data:s,size:i}};var Bc=class{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:i}=this.root;this.root=no(this.root,i,t),this.root.layout(t,i)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumWidth}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const t=[this.root];for(;t.length>0;){const i=t.pop();i instanceof qe&&(i.disabled=e,t.push(...i.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var t;const i=De(e.element),[s,r]=this.getNode(i);if(!(r instanceof rt)||((t=this._maximizedNode)===null||t===void 0?void 0:t.leaf)===r)return;this.hasMaximizedView()&&this.exitMaximizedView(),oo(this.getView(),this.orientation);const n=[];function o(a,l){for(let h=0;h<a.children.length;h++){const d=a.children[h];d instanceof rt?d!==l&&(a.isChildVisible(h)?a.setChildVisible(h,!1):n.push(d)):o(d,l)}}o(this.root,r),this._maximizedNode={leaf:r,hiddenOnMaximize:n},this._onDidMaximizedNodeChange.fire({view:r.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;function t(s){for(let r=s.children.length-1;r>=0;r--){const n=s.children[r];n instanceof rt?e.includes(n)||s.setChildVisible(r,!0):t(n)}}t(this.root);const i=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:i.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let t;e&&(t=De(e.element));const i=this._onDidMaximizedNodeChange.pause();try{this.hasMaximizedView()&&this.exitMaximizedView();const s={root:oo(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(s.maximizedNode={location:t}),e&&this.maximizeView(e),s}finally{i.dispose()}}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new qe(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){const i=e.orientation,s=i==="VERTICAL"?e.height:e.width;if(this._deserialize(e.root,i,t,s),this.layout(e.width,e.height),e.maximizedNode){const r=e.maximizedNode.location,[n,o]=this.getNode(r);if(!(o instanceof rt))return;this.maximizeView(o.view)}}_deserialize(e,t,i,s){this.root=this._deserializeNode(e,t,i,s)}_deserializeNode(e,t,i,s){let r;if(e.type==="branch"){const o=e.data.map(a=>({node:this._deserializeNode(a,Kt(t),i,e.size),visible:a.visible}));r=new qe(t,this.proportionalLayout,this.styles,e.size,s,this.locked,this.margin,o)}else{const o=i.fromJSON(e);if(typeof e.visible=="boolean"){var n;(n=o.setVisible)===null||n===void 0||n.call(o,e.visible)}r=new rt(o,t,s,e.size)}return r}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,t.element.remove()),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(i=>{this._onDidChange.fire(i)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,t=e.children[0];if(t instanceof rt)return;e.element.remove();const i=e.removeChild(0);e.dispose(),i.dispose(),this._root=zc(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new qe(Kt(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(no(t,t.orthogonalSize,t.size),ht.Distribute,0)}else this._root.addChild(e,ht.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(t=>{this._onDidChange.fire(t)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,i){const s={height:e.height,width:e.width};if(e instanceof rt)return{box:s,view:e.view,cachedVisibleSize:i};const r=[];for(let n=0;n<e.children.length;n++){const o=e.children[n],a=e.getChildCachedVisibleSize(n);r.push(this._getViews(o,Kt(t),a))}return{box:s,children:r,cachedVisibleSize:i}}progmaticSelect(e,t=!1){const[i,s]=this.getNode(e);if(!(s instanceof rt))throw new TypeError("invalid location");for(let r=i.length-1;r>-1;r--){const n=i[r],o=e[r]||0;if(t?o-1>-1:o+1<n.children.length)return ro(n.children[t?o-1:o+1],t)}return ro(this.root,t)}constructor(e,t,i,s,r){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new ze,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new O,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new O,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=s??!1,this._margin=r??0,this.root=new qe(i,e,t,0,0,this.locked,this.margin)}isViewVisible(e){const[t,i]=li(e),[,s]=this.getNode(t);if(!(s instanceof qe))throw new TypeError("Invalid from location");return s.isChildVisible(i)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=li(e),[,r]=this.getNode(i);if(!(r instanceof qe))throw new TypeError("Invalid from location");this._onDidViewVisibilityChange.fire(),r.setChildVisible(s,t)}moveView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[,s]=this.getNode(e);if(!(s instanceof qe))throw new TypeError("Invalid location");s.moveChild(t,i)}addView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[s,r]=li(i),[n,o]=this.getNode(s);if(o instanceof qe){const a=new rt(e,Kt(o.orientation),o.orthogonalSize);o.addChild(a,t,r)}else{const[a,...l]=[...n].reverse(),[h,...d]=[...s].reverse();let u=0;const p=a.getChildCachedVisibleSize(h);typeof p=="number"&&(u=ht.Invisible(p)),a.removeChild(h).dispose();const f=new qe(o.orientation,this.proportionalLayout,this.styles,o.size,o.orthogonalSize,this.locked,this.margin);a.addChild(f,o.size,h);const m=new rt(o.view,a.orientation,o.size);f.addChild(m,u,0),typeof t!="number"&&t.type==="split"&&(t={type:"split",index:0});const g=new rt(e,a.orientation,o.size);f.addChild(g,t,r)}}remove(e,t){const i=De(e.element);return this.removeView(i,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=li(e),[r,n]=this.getNode(i);if(!(n instanceof qe))throw new TypeError("Invalid location");const o=n.children[s];if(!(o instanceof rt))throw new TypeError("Invalid location");if(n.removeChild(s,t),o.dispose(),n.children.length!==1)return o.view;const a=n.children[0];if(r.length===0)return a instanceof rt||(n.removeChild(0,t),this.root=a),o.view;const[l,...h]=[...r].reverse(),[d,...u]=[...i].reverse(),p=n.isChildVisible(0);n.removeChild(0,t);const f=l.children.map((m,g)=>l.getChildSize(g));if(l.removeChild(d,t).dispose(),a instanceof qe){f.splice(d,1,...a.children.map(m=>m.size));for(let m=0;m<a.children.length;m++){const g=a.children[m];l.addChild(g,g.size,d+m)}for(;a.children.length>0;)a.removeChild(0)}else{const m=new rt(a.view,Kt(a.orientation),a.size),g=p?a.orthogonalSize:ht.Invisible(a.orthogonalSize);l.addChild(m,g,d)}a.dispose();for(let m=0;m<f.length;m++)l.resizeChild(m,f[m]);return o.view}layout(e,t){const[i,s]=this.root.orientation==="HORIZONTAL"?[t,e]:[e,t];this.root.layout(i,s)}getNode(e,t=this.root,i=[]){if(e.length===0)return[i,t];if(!(t instanceof qe))throw new TypeError("Invalid location");const[s,...r]=e;if(s<0||s>=t.children.length)throw new Error("Invalid location");const n=t.children[s];return i.push(t),this.getNode(r,n,i)}};const ao=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});var Ma=class extends ee{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._lastWidth=-1,this._lastHeight=-1,this._disableResizing=t,this._element=e,this.addDisposables(Yi(this._element,i=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!Mc(this._element))return;const s=Math.round(i.contentRect.width),r=Math.round(i.contentRect.height);s===this._lastWidth&&r===this._lastHeight||(this._lastWidth=s,this._lastHeight=r,this.layout(s,r))}))}};const y_=La();function Mr(e){switch(e){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";default:return"center"}}var Wc=class extends Ma{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._id=y_.next(),this._groups=new Map,this._onDidRemove=new O,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new O,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new O,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new O,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new $l,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new $l,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new on(this.element),this._classNames.setClassNames((i=t.className)!==null&&i!==void 0?i:""),e.appendChild(this.element),this.gridview=new Bc(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(s=>{this._onDidMaximizedChange.fire({panel:s.view,isMaximized:s.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.forceRelayout()}),be.from(()=>{this.element.remove()}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Tt.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(De(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(De(e.element))}updateOptions(e){if(e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableAutoResizing"in e){var t;this.disableResizing=(t=e.disableAutoResizing)!==null&&t!==void 0?t:!1}if("locked"in e){var i;this.locked=(i=e.locked)!==null&&i!==void 0?i:!1}if("margin"in e){var s;this.gridview.margin=(s=e.margin)!==null&&s!==void 0?s:0}if("className"in e){var r;this._classNames.setClassNames((r=e.className)!==null&&r!==void 0?r:"")}}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],i,s=this.gridview){s.addView(e,i??ht.Distribute,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw new Error("invalid operation");const i=this._groups.get(e.id),s=this.gridview.remove(e,ht.Distribute);if(i&&!t?.skipDispose&&(i.disposable.dispose(),i.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!t?.skipActive&&this._activeGroup===e){const r=Array.from(this._groups.values());this.doSetGroupActive(r.length>0?r[0].value:void 0)}return s}getPanel(e){var t;return(t=this._groups.get(e))===null||t===void 0?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}activateNext(e){var t,i;if((t=e)!==null&&t!==void 0||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=De(e.group.element),r=(i=this.gridview.next(s))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}activatePrevious(e){var t,i;if((t=e)!==null&&t!==void 0||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=De(e.group.element),r=(i=this.gridview.previous(s))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}forceRelayout(){this.layout(this.width,this.height,!0)}layout(e,t,i){(i||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}};function Fs(e){"@babel/helpers - typeof";return Fs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fs(e)}function x_(e,t){if(Fs(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,t);if(Fs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function C_(e){var t=x_(e,"string");return Fs(t)=="symbol"?t:t+""}function D_(e,t,i){return(t=C_(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ul(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function te(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?Ul(Object(i),!0).forEach(function(s){D_(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ul(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function k_(e,t){return e==="center"?`Tab into ${t}`:`Split ${e} of ${t}`}function P_(e,t){return e==="center"?`docked into ${t}`:`split ${e} of ${t}`}const Nr={panelOpened:e=>`${e} opened`,panelClosed:e=>`${e} closed`,groupMaximized:e=>`${e} maximized`,groupRestored:e=>`${e} restored`,groupFloated:e=>`${e} floated`,groupDocked:e=>`${e} docked`,groupPoppedOut:e=>`${e} opened in a new window`,closeTab:e=>`Close ${e}`,closeTabPlain:()=>"Close",movePickTarget:(e,t,i,s)=>`Moving ${e}. Target ${t}, ${i} of ${s}. Enter to choose where, Escape to cancel.`,movePickEdge:(e,t)=>`${k_(e,t)}. Arrows to change, Enter to confirm, Escape to go back.`,moveCommitted:(e,t,i)=>`${e} ${P_(i,t)}.`,moveCancelled:()=>"Move cancelled.",moveNotAllowed:()=>"That move is not allowed.",moveFloated:e=>`${e} floated.`};function Hc(e){return e?te(te({},Nr),e):Nr}var $c=class{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,t){this.component.removePanel(e,t)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}},js=class{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}},Fc=class{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}},Na=class{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get tabGroupColors(){return this.component.tabGroupColorPalette.entries()}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidPanelPinnedChange(){return this.component.onDidPanelPinnedChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillMutateLayout(){return this.component.onWillMutateLayout}get onDidMutateLayout(){return this.component.onDidMutateLayout}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidAddPopoutGroup(){return this.component.onDidAddPopoutGroup}get onDidRemovePopoutGroup(){return this.component.onDidRemovePopoutGroup}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}getPopouts(){return this.component.getPopouts()}get onDidCreateTabGroup(){return this.component.onDidCreateTabGroup}get onDidDestroyTabGroup(){return this.component.onDidDestroyTabGroup}get onDidAddPanelToTabGroup(){return this.component.onDidAddPanelToTabGroup}get onDidRemovePanelFromTabGroup(){return this.component.onDidRemovePanelFromTabGroup}get onDidTabGroupChange(){return this.component.onDidTabGroupChange}get onDidTabGroupCollapsedChange(){return this.component.onDidTabGroupCollapsedChange}get panels(){return this.component.panels}get groups(){return this.component.groups}adjacentGroupInDirection(e,t){return this.component.adjacentGroupInDirection(e,t)}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}get messages(){return Hc(this.component.options.messages)}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.withOrigin("api",()=>this.component.addPanel(e))}removePanel(e){this.component.withOrigin("api",()=>this.component.removePanel(e))}addGroup(e){return this.component.withOrigin("api",()=>this.component.addGroup(e))}closeAllGroups(){return this.component.withOrigin("api",()=>this.component.closeAllGroups())}removeGroup(e){this.component.withOrigin("api",()=>this.component.removeGroup(e))}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.withOrigin("api",()=>this.component.addFloatingGroup(e,t))}fromJSON(e,t){this.component.withOrigin("api",()=>this.component.fromJSON(e,t))}toJSON(){return this.component.toJSON()}clear(){this.component.withOrigin("api",()=>this.component.clear())}undo(){this.component.undo()}redo(){this.component.redo()}get canUndo(){return this.component.canUndo}get canRedo(){return this.component.canRedo}clearHistory(){this.component.clearHistory()}get onDidChangeHistory(){return this.component.onDidChangeHistory}get smartGuidesEnabled(){return this.component.smartGuidesEnabled}setSmartGuidesEnabled(e){this.component.setSmartGuidesEnabled(e)}updateSmartGuidesOptions(e){this.component.updateSmartGuidesOptions(e)}get onDidSnapFloat(){return this.component.onDidSnapFloat}get onDidSnapTogether(){return this.component.onDidSnapTogether}get popoutRestorationPromise(){return this.component.popoutRestorationPromise}activateNext(e){this.component.activateNext(e)}activatePrevious(e){this.component.activatePrevious(e)}moveToNext(e){this.activateNext(e)}moveToPrevious(e){this.activatePrevious(e)}maximizeGroup(e){this.component.withOrigin("api",()=>this.component.maximizeGroup(e.group))}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.withOrigin("api",()=>this.component.exitMaximizedGroup())}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.withOrigin("api",()=>this.component.addPopoutGroup(e,t))}addEdgeGroup(e,t){return this.component.addEdgeGroup(e,t)}revealEdgeGroupWithData(e,t,i){this.component.revealEdgeGroupWithData(e,t,i)}getEdgeGroup(e){return this.component.getEdgeGroup(e)}setEdgeGroupVisible(e,t){this.component.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this.component.isEdgeGroupVisible(e)}removeEdgeGroup(e){this.component.removeEdgeGroup(e)}pinEdgeGroup(e){this.component.pinEdgeGroup(e)}autoHideEdgeGroup(e){this.component.autoHideEdgeGroup(e)}peekEdgeGroup(e,t){this.component.peekEdgeGroup(e,t)}updateOptions(e){this.component.updateOptions(e)}_getGroupModel(e){const t=this.component.getPanel(e);if(!t)throw new Error(`dockview: group '${e}' not found`);return t.model}createTabGroup(e){const t=this._getGroupModel(e.groupId);return this.component.withOrigin("api",()=>t.createTabGroup({label:e.label,color:e.color,componentParams:e.componentParams}))}dissolveTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.dissolveTabGroup(e.tabGroupId))}addPanelToTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.addPanelToTabGroup(e.tabGroupId,e.panelId,e.index))}removePanelFromTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.removePanelFromTabGroup(e.panelId))}getTabGroups(e){return this._getGroupModel(e.groupId).getTabGroups()}getTabGroupForPanel(e){return this._getGroupModel(e.groupId).getTabGroupForPanel(e.panelId)}moveTabGroup(e){this._getGroupModel(e.groupId).moveTabGroup(e.tabGroupId,e.index)}dispose(){this.component.dispose()}},jc=class extends ee{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(J(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(J(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(J(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(J(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(J(this.element,"drop",e=>{this.onDrop(e)}))}};const E_={value:50,type:"percentage"},T_=100,I_=100;function lo(){const e=document.createElement("div");e.className="dv-drop-target-dropzone";const t=document.createElement("div");return t.className="dv-drop-target-selection",e.appendChild(t),{dropzone:e,selection:t}}function Vc(e,t,i,s){var r,n,o;const a=(r=s?.smallWidthBoundary)!==null&&r!==void 0?r:T_,l=(n=s?.smallHeightBoundary)!==null&&n!==void 0?n:I_,h=t<a,d=i<l,u=e==="left",p=e==="right",f=e==="top",m=e==="bottom",g=!h&&p,_=!h&&u,A=!d&&f,P=!d&&m;let E=1;const y=(o=s?.size)!==null&&o!==void 0?o:E_;return y.type==="percentage"?E=Ee(y.value,0,100)/100:((g||_)&&(E=Ee(0,y.value,t)/t),(A||P)&&(E=Ee(0,y.value,i)/i)),{isSmallX:h,isSmallY:d,isLeft:u,isRight:p,isTop:f,isBottom:m,rightClass:g,leftClass:_,topClass:A,bottomClass:P,size:E}}function Uc(e,t,i,s,r){const n=Vc(t,i,s,r),{rightClass:o,leftClass:a,topClass:l,bottomClass:h,size:d}=n,u={top:"0px",left:"0px",width:"100%",height:"100%"};o?(u.left=`${100*(1-d)}%`,u.width=`${100*d}%`):a?u.width=`${100*d}%`:l?u.height=`${100*d}%`:h&&(u.top=`${100*(1-d)}%`,u.height=`${100*d}%`),n.isSmallX&&n.isLeft&&(u.width="4px"),n.isSmallX&&n.isRight&&(u.left=`${i-4}px`,u.width="4px"),n.isSmallY&&n.isTop&&(u.height="4px"),n.isSmallY&&n.isBottom&&(u.top=`${s-4}px`,u.height="4px"),e.style.top=u.top,e.style.left=u.left,e.style.width=u.width,e.style.height=u.height,e.style.visibility="visible",(!e.style.transform||e.style.transform==="")&&(e.style.transform="translate3d(0, 0, 0)");const p=n.isSmallX&&(n.isLeft||n.isRight)||n.isSmallY&&(n.isTop||n.isBottom);K(e,"dv-drop-target-small-vertical",n.isSmallY),K(e,"dv-drop-target-small-horizontal",n.isSmallX),K(e,"dv-drop-target-selection-line",p),K(e,"dv-drop-target-left",n.isLeft),K(e,"dv-drop-target-right",n.isRight),K(e,"dv-drop-target-top",n.isTop),K(e,"dv-drop-target-bottom",n.isBottom),K(e,"dv-drop-target-center",t==="center")}function A_(e,t){const i=`${Math.round(t.top)}px`,s=`${Math.round(t.left)}px`,r=`${Math.round(t.width)}px`,n=`${Math.round(t.height)}px`;return e.style.top!==i||e.style.left!==s||e.style.width!==r||e.style.height!==n}function R_(e,t){e.style.top=`${Math.round(t.top)}px`,e.style.left=`${Math.round(t.left)}px`,e.style.width=`${Math.round(t.width)}px`,e.style.height=`${Math.round(t.height)}px`,e.style.visibility="visible",(!e.style.transform||e.style.transform==="")&&(e.style.transform="translate3d(0, 0, 0)")}function Kc(e){const t=Vc(e.quadrant,e.width,e.height,e.overlayModel),{rightClass:i,leftClass:s,topClass:r,bottomClass:n,size:o}=t,a=e.outlineElement.getBoundingClientRect(),l=e.targetModel.getElements(void 0,e.outlineElement),h=l.root,d=l.overlay,u=h.getBoundingClientRect(),p=a.top-u.top,f=a.left-u.left,m={top:p,left:f,width:e.width,height:e.height};return i?(m.left=f+e.width*(1-o),m.width=e.width*o):s?m.width=e.width*o:r?m.height=e.height*o:n&&(m.top=p+e.height*(1-o),m.height=e.height*o),t.isSmallX&&t.isLeft&&(m.width=4),t.isSmallX&&t.isRight&&(m.left=f+e.width-4,m.width=4),t.isSmallY&&t.isTop&&(m.height=4),t.isSmallY&&t.isBottom&&(m.top=p+e.height-4,m.height=4),A_(d,m)?(R_(d,m),d.className=`dv-drop-target-anchor${e.className?` ${e.className}`:""}`,K(d,"dv-drop-target-left",t.isLeft),K(d,"dv-drop-target-right",t.isRight),K(d,"dv-drop-target-top",t.isTop),K(d,"dv-drop-target-bottom",t.isBottom),K(d,"dv-drop-target-anchor-line",t.isSmallX&&(t.isLeft||t.isRight)||t.isSmallY&&(t.isTop||t.isBottom)),K(d,"dv-drop-target-center",e.quadrant==="center"),l.changed&&(K(d,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{K(d,"dv-drop-target-anchor-container-changed",!1)},10)),{boundsChanged:!0,targetChanged:l.changed}):{boundsChanged:!1,targetChanged:l.changed}}var qc=class extends Ra{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get edge(){return!!this.options.edge}get edgeGroup(){return!!this.options.edgeGroup}constructor(e){super(),this.options=e}};function Kl(e){switch(e){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${e}'`)}}function L_(e){switch(e){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${e}'`)}}const M_={value:20,type:"percentage"};var an=class Ts extends ee{get disabled(){return this._disabled}set disabled(t){this._disabled=t}get state(){return this._state}constructor(t,i){super(),this.element=t,this.options=i,this._edge=!1,this._onDrop=new O,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new O,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new jc(this.element,{onDragEnter:()=>{var s,r;(s=(r=this.options).getOverrideTarget)===null||s===void 0||(s=s.call(r))===null||s===void 0||s.getElements()},onDragOver:s=>{var r,n,o,a,l,h,d;if(this._disabled){this.clearOwnOverlay();return}Ts.ACTUAL_TARGET=this;const u=(r=(n=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(n);if(this._acceptedTargetZonesSet.size===0){this.clearOwnOverlay();return}const p=(o=(a=(l=this.options).getOverlayOutline)===null||a===void 0?void 0:a.call(l))!==null&&o!==void 0?o:this.element,f=p.offsetWidth,m=p.offsetHeight;if(f===0||m===0)return;const g=p.getBoundingClientRect(),_=((h=s.clientX)!==null&&h!==void 0?h:0)-g.left,A=((d=s.clientY)!==null&&d!==void 0?d:0)-g.top,P=this.resolvePosition(_,A,f,m,s);if(this.isAlreadyUsed(s)){this.removeDropTarget();return}if(P===null){this.clearOwnOverlay();return}const E=P.position;if(!this.options.canDisplayOverlay(s,E)){this.clearOwnOverlay();return}const y=new qc({nativeEvent:s,position:E,edge:P.edge,edgeGroup:P.edgeGroup});if(this._onWillShowOverlay.fire(y),y.defaultPrevented){this.clearOwnOverlay();return}if(this.markAsUsed(s),P.edge){this.clearOwnOverlay(),this._state=E,this._edge=!0;return}if(this._edge=!1,!u){if(!this.targetElement){const T=lo();this.targetElement=T.dropzone,this.overlayElement=T.selection,this._state="center",p.classList.add("dv-drop-target"),p.append(this.targetElement)}}this.toggleClasses(E,f,m),this._state=E},onDragLeave:()=>{var s,r;const n=(s=(r=this.options).getOverrideTarget)===null||s===void 0?void 0:s.call(r);if(n){var o;this._state=void 0,this._edge=!1,(o=n.scheduleClear)===null||o===void 0||o.call(n);return}this.removeDropTarget()},onDragEnd:s=>{var r,n;const o=(r=(n=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(n);o&&Ts.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s,edge:this._edge})),this.removeDropTarget(),o?.clear()},onDrop:s=>{var r,n;s.preventDefault();const o=this._state,a=this._edge;this.removeDropTarget(),(r=(n=this.options).getOverrideTarget)===null||r===void 0||(r=r.call(n))===null||r===void 0||r.clear(),o&&(s.stopPropagation(),this._onDrop.fire({position:o,nativeEvent:s,edge:a}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(t){this._acceptedTargetZonesSet=new Set(t)}setOverlayModel(t){this.options.overlayModel=t}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(t){t[Ts.USED_EVENT_ID]=!0}isAlreadyUsed(t){const i=t[Ts.USED_EVENT_ID];return typeof i=="boolean"&&i}toggleClasses(t,i,s){var r,n;const o=(r=(n=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(n);if(o){var a,l,h;Kc({outlineElement:(a=(l=(h=this.options).getOverlayOutline)===null||l===void 0?void 0:l.call(h))!==null&&a!==void 0?a:this.element,targetModel:o,quadrant:t,width:i,height:s,overlayModel:this.options.overlayModel,className:this.options.className});return}this.overlayElement&&Uc(this.overlayElement,t,i,s,this.options.overlayModel)}resolvePosition(t,i,s,r,n){var o,a;const l=(o=(a=this.options).getPositionResolver)===null||o===void 0?void 0:o.call(a);if(l){const d=l.resolve({x:t,y:i,width:s,height:r,zones:this._acceptedTargetZonesSet,event:n});return d?{position:d.position,edge:!!d.edge,edgeGroup:!!d.edgeGroup}:null}const h=this.calculateQuadrant(this._acceptedTargetZonesSet,t,i,s,r);return h?{position:h,edge:!1,edgeGroup:!1}:null}calculateQuadrant(t,i,s,r,n){var o,a;const l=(o=(a=this.options.overlayModel)===null||a===void 0?void 0:a.activationSize)!==null&&o!==void 0?o:M_;return l.type==="percentage"?Yc(t,i,s,r,n,l.value):Xc(t,i,s,r,n,l.value)}clearOwnOverlay(){const t=this._state!==void 0;if(this.removeDropTarget(),t){var i,s;(i=(s=this.options).getOverrideTarget)===null||i===void 0||(i=i.call(s))===null||i===void 0||i.clear()}}removeDropTarget(){if(this._state=void 0,this._edge=!1,this.targetElement){var t;(t=this.targetElement.parentElement)===null||t===void 0||t.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0}}showOverlay(t){var i,s,r,n,o;const a=(i=(s=this.options).getOverrideTarget)===null||i===void 0?void 0:i.call(s),l=(r=(n=(o=this.options).getOverlayOutline)===null||n===void 0?void 0:n.call(o))!==null&&r!==void 0?r:this.element,h=l.offsetWidth,d=l.offsetHeight;if(!a&&!this.targetElement){const u=lo();this.targetElement=u.dropzone,this.overlayElement=u.selection,l.classList.add("dv-drop-target"),l.append(this.targetElement)}this.toggleClasses(t,h,d),this._state=t}clearOverlay(){var t,i;this.removeDropTarget(),(t=(i=this.options).getOverrideTarget)===null||t===void 0||(t=t.call(i))===null||t===void 0||t.clear(),this._state=void 0}};an.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function Yc(e,t,i,s,r,n){const o=100*t/s,a=100*i/r;return e.has("left")&&o<n?"left":e.has("right")&&o>100-n?"right":e.has("top")&&a<n?"top":e.has("bottom")&&a>100-n?"bottom":e.has("center")?"center":null}function Xc(e,t,i,s,r,n){return e.has("left")&&t<n?"left":e.has("right")&&t>s-n?"right":e.has("top")&&i<n?"top":e.has("bottom")&&i>r-n?"bottom":e.has("center")?"center":null}function N_(e,t,i){var s,r,n;Bt(t,"dv-dragged"),t.style.top="-9999px",((s=i?.ownerDocument)!==null&&s!==void 0?s:document).body.appendChild(t),e.setDragImage(t,(r=i?.x)!==null&&r!==void 0?r:0,(n=i?.y)!==null&&n!==void 0?n:0),setTimeout(()=>{zt(t,"dv-dragged"),t.remove()},0)}var Or=class Is extends ee{static getInstance(){var t;return(t=Is._instance)!==null&&t!==void 0||(Is._instance=new Is),Is._instance}constructor(){super(),this._targets=new Set,this._targetByElement=new Map,this._onDragStart=new O,this.onDragStart=this._onDragStart.event,this._onDragMove=new O,this.onDragMove=this._onDragMove.event,this._onDragEnd=new O,this.onDragEnd=this._onDragEnd.event,this.addDisposables(this._onDragStart,this._onDragMove,this._onDragEnd)}get active(){return this._active}registerTarget(t){return this._targets.add(t),this._targetByElement.set(t.element,t),{dispose:()=>{this._targets.delete(t),this._targetByElement.get(t.element)===t&&this._targetByElement.delete(t.element),this._currentTarget===t&&(this._currentTarget=void 0)}}}beginDrag(t){var i,s,r;this._active&&this.cancel();const{pointerEvent:n,source:o}=t,a=t.getData();this._active={pointerId:n.pointerId,startX:n.clientX,startY:n.clientY,source:o},this._lastPointerEvent=n,this._onDragMoveCallback=t.onDragMove,this._onDragEndCallback=t.onDragEnd,this._dataDisposable=a,this._ghost=t.ghost,this._iframeShield=$s((i=o.ownerDocument)!==null&&i!==void 0?i:document);const l={clientX:n.clientX,clientY:n.clientY,pointerEvent:n};this._onDragStart.fire(l);const h=(s=(r=o.ownerDocument)===null||r===void 0?void 0:r.defaultView)!==null&&s!==void 0?s:globalThis.window;this._moveListener=J(h,"pointermove",d=>{var u;d.pointerId===((u=this._active)===null||u===void 0?void 0:u.pointerId)&&this._handleMove(d)}),this._upListener=J(h,"pointerup",d=>{var u;d.pointerId===((u=this._active)===null||u===void 0?void 0:u.pointerId)&&this._handleEnd(d,!0)}),this._cancelListener=J(h,"pointercancel",d=>{var u;d.pointerId===((u=this._active)===null||u===void 0?void 0:u.pointerId)&&this._handleEnd(d,!1)})}cancel(){var t,i;if(!this._active)return;const s=this._onDragEndCallback,r=this._lastPointerEvent;if((t=this._currentTarget)===null||t===void 0||t.handleDragLeave(),this._teardown(),(i=this._dataDisposable)===null||i===void 0||i.dispose(),this._dataDisposable=void 0,r){const n={clientX:r.clientX,clientY:r.clientY,pointerEvent:r};s?.(n,!1),this._onDragEnd.fire(n)}}_findTargetUnder(t,i){var s,r;const n=((s=(r=this._active)===null||r===void 0?void 0:r.source.ownerDocument)!==null&&s!==void 0?s:document).elementsFromPoint(t,i);for(const o of n){let a=o;for(;a;){const l=this._targetByElement.get(a);if(l)return l;a=a.parentElement}}}_handleMove(t){var i,s;this._lastPointerEvent=t,(i=this._ghost)===null||i===void 0||i.update(t.clientX,t.clientY);const r={clientX:t.clientX,clientY:t.clientY,pointerEvent:t},n=this._findTargetUnder(t.clientX,t.clientY);if(n!==this._currentTarget){var o;(o=this._currentTarget)===null||o===void 0||o.handleDragLeave(),this._currentTarget=n}n&&n.handleDragOver(r),(s=this._onDragMoveCallback)===null||s===void 0||s.call(this,r),this._onDragMove.fire(r)}_handleEnd(t,i){const s={clientX:t.clientX,clientY:t.clientY,pointerEvent:t};if(i&&this._currentTarget)this._currentTarget.handleDrop(s);else{var r;(r=this._currentTarget)===null||r===void 0||r.handleDragLeave()}const n=this._onDragEndCallback,o=this._dataDisposable;this._teardown(),this._dataDisposable=void 0,setTimeout(()=>o?.dispose(),0),n?.(s,i),this._onDragEnd.fire(s)}_teardown(){var t,i,s,r,n;this._currentTarget=void 0,this._active=void 0,this._lastPointerEvent=void 0,this._onDragMoveCallback=void 0,this._onDragEndCallback=void 0,(t=this._ghost)===null||t===void 0||t.dispose(),this._ghost=void 0,(i=this._iframeShield)===null||i===void 0||i.release(),this._iframeShield=void 0,(s=this._moveListener)===null||s===void 0||s.dispose(),(r=this._upListener)===null||r===void 0||r.dispose(),(n=this._cancelListener)===null||n===void 0||n.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}};const O_={value:20,type:"percentage"};var G_=class extends ee{get disabled(){return this._disabled}set disabled(e){this._disabled=e,e&&this._removeOverlay()}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._edge=!1,this._onDrop=new O,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new O,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(t.acceptedTargetZones);const i={element:this.element,handleDragOver:s=>this._onDragOver(s),handleDragLeave:()=>this._onDragLeave(),handleDrop:s=>this._onDropEvent(s)};this.addDisposables(this._onDrop,this._onWillShowOverlay,Or.getInstance().registerTarget(i))}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this._removeOverlay(),super.dispose()}_onDragOver(e){var t,i,s,r,n;if(this._disabled){this._clearOwnOverlay();return}const o=(t=(i=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(i);if(this._acceptedTargetZonesSet.size===0){this._clearOwnOverlay();return}const a=(s=(r=(n=this.options).getOverlayOutline)===null||r===void 0?void 0:r.call(n))!==null&&s!==void 0?s:this.element,l=a.offsetWidth,h=a.offsetHeight;if(l===0||h===0)return;const d=a.getBoundingClientRect(),u=e.clientX-d.left,p=e.clientY-d.top,f=this._resolvePosition(u,p,l,h,e.pointerEvent);if(f===null){this._clearOwnOverlay();return}const m=f.position;if(!this.options.canDisplayOverlay(e.pointerEvent,m)){this._clearOwnOverlay();return}const g=new qc({nativeEvent:e.pointerEvent,position:m,edge:f.edge});if(this._onWillShowOverlay.fire(g),g.defaultPrevented){this._clearOwnOverlay();return}if(f.edge){this._clearOwnOverlay(),this._state=m,this._edge=!0;return}if(this._edge=!1,o){Kc({outlineElement:a,targetModel:o,quadrant:m,width:l,height:h,overlayModel:this.options.overlayModel,className:this.options.className}),this._state=m;return}if(!this._targetElement){const _=lo();this._targetElement=_.dropzone,this._overlayElement=_.selection,this._state="center",this.element.classList.add("dv-drop-target"),this.element.append(this._targetElement)}this._overlayElement&&Uc(this._overlayElement,m,l,h,this.options.overlayModel),this._state=m}_onDragLeave(){var e,t;const i=(e=(t=this.options).getOverrideTarget)===null||e===void 0?void 0:e.call(t);if(i){this._state=void 0,i.clear();return}this._removeOverlay()}_onDropEvent(e){var t,i;const s=this._state,r=this._edge,n=(t=(i=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(i);this._removeOverlay(),n?.clear(),s&&this._onDrop.fire({position:s,nativeEvent:e.pointerEvent,edge:r})}_resolvePosition(e,t,i,s,r){var n,o;const a=(n=(o=this.options).getPositionResolver)===null||n===void 0?void 0:n.call(o);if(a){const h=a.resolve({x:e,y:t,width:i,height:s,zones:this._acceptedTargetZonesSet,event:r});return h?{position:h.position,edge:!!h.edge}:null}const l=this._calculateQuadrant(e,t,i,s);return l?{position:l,edge:!1}:null}_calculateQuadrant(e,t,i,s){var r,n;const o=(r=(n=this.options.overlayModel)===null||n===void 0?void 0:n.activationSize)!==null&&r!==void 0?r:O_;return o.type==="percentage"?Yc(this._acceptedTargetZonesSet,e,t,i,s,o.value):Xc(this._acceptedTargetZonesSet,e,t,i,s,o.value)}_clearOwnOverlay(){const e=this._state!==void 0;if(this._removeOverlay(),e){var t,i;(t=(i=this.options).getOverrideTarget)===null||t===void 0||(t=t.call(i))===null||t===void 0||t.clear()}}_removeOverlay(){if(this._edge=!1,this._targetElement){var e;this._state=void 0,(e=this._targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this._targetElement.remove(),this._targetElement=void 0,this._overlayElement=void 0}else this._state=void 0}};const z_=5,B_=250,W_=8;var H_=class extends ee{constructor(e,t){var i;super(),this.element=e,this.options=t,this._disabled=!1,this._armed=!1,this._startX=0,this._startY=0,this._touchOnly=(i=t.touchOnly)!==null&&i!==void 0?i:!0,this.addDisposables(J(this.element,"pointerdown",s=>{this._onPointerDown(s)}))}setDisabled(e){this._disabled=e,e&&this._cancelPending()}setTouchOnly(e){this._touchOnly!==e&&(this._touchOnly=e,e&&this._cancelPending())}_shouldHandle(e){var t,i;return!(this._disabled||this._touchOnly&&e.pointerType!=="touch"&&e.pointerType!=="pen"||!((t=(i=this.options).isCancelled)===null||t===void 0)&&t.call(i,e))}_onPointerDown(e){var t,i,s,r,n;if(!this._shouldHandle(e))return;this._cancelPending(),this._pendingPointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY,this._startEvent=e;const o=e.pointerType==="touch"||e.pointerType==="pen",a=this.options.touchInitiationDelay,l=(t=typeof a=="function"?a():a)!==null&&t!==void 0?t:B_;this._armed=!o||l<=0,o&&l>0&&Number.isFinite(l)&&(this._armTimer=setTimeout(()=>{this._armTimer=void 0,this._armed=!0},l));const h=(i=this.options.threshold)!==null&&i!==void 0?i:z_,d=this.options.pressTolerance,u=(s=typeof d=="function"?d():d)!==null&&s!==void 0?s:W_,p=(r=(n=this.element.ownerDocument)===null||n===void 0?void 0:n.defaultView)!==null&&r!==void 0?r:globalThis.window;this._pendingMoveListener=J(p,"pointermove",f=>{if(f.pointerId!==this._pendingPointerId)return;const m=f.clientX-this._startX,g=f.clientY-this._startY,_=Math.hypot(m,g);if(this._armed){_>=h&&this._beginDrag(f);return}_>u&&this._beginDrag(f)}),this._pendingUpListener=J(p,"pointerup",f=>{f.pointerId===this._pendingPointerId&&this._cancelPending()}),this._pendingCancelListener=J(p,"pointercancel",f=>{f.pointerId===this._pendingPointerId&&this._cancelPending()})}cancelPending(){this._cancelPending()}_cancelPending(){var e,t,i;this._pendingPointerId=void 0,this._armTimer!==void 0&&(clearTimeout(this._armTimer),this._armTimer=void 0),this._armed=!1,(e=this._pendingMoveListener)===null||e===void 0||e.dispose(),(t=this._pendingUpListener)===null||t===void 0||t.dispose(),(i=this._pendingCancelListener)===null||i===void 0||i.dispose(),this._pendingMoveListener=void 0,this._pendingUpListener=void 0,this._pendingCancelListener=void 0,this._startEvent=void 0}_beginDrag(e){var t,i,s,r,n;const o=(t=this._startEvent)!==null&&t!==void 0?t:e;this._cancelPending(),(i=(s=this.options).onDragStart)===null||i===void 0||i.call(s,o);const a=(r=(n=this.options).createGhost)===null||r===void 0?void 0:r.call(n,o);Or.getInstance().beginDrag({pointerEvent:e,source:this.element,getData:()=>this.options.getData(o),ghost:a,onDragMove:this.options.onDragMove,onDragEnd:this.options.onDragEnd})}dispose(){this._cancelPending(),super.dispose()}},$_=class{constructor(e){var t,i,s,r,n;this._disposed=!1,this.element=e.element,this.offsetX=(t=e.offsetX)!==null&&t!==void 0?t:0,this.offsetY=(i=e.offsetY)!==null&&i!==void 0?i:0,this.element.style.position="fixed",this.element.style.left="0px",this.element.style.top="0px",this.element.style.pointerEvents="none",this.element.style.zIndex="99999",this.element.style.opacity=String((s=e.opacity)!==null&&s!==void 0?s:.8),this.element.style.willChange="transform",this.element.style.transform=`translate3d(${e.initialX-this.offsetX}px, ${e.initialY-this.offsetY}px, 0)`,((r=(n=e.owner)===null||n===void 0?void 0:n.ownerDocument)!==null&&r!==void 0?r:document).body.appendChild(this.element)}update(e,t){this._disposed||(this.element.style.transform=`translate3d(${e-this.offsetX}px, ${t-this.offsetY}px, 0)`)}dispose(){this._disposed||(this._disposed=!0,this.element.remove())}},F_=class extends ee{constructor(e,t){super(),this.el=e,this.opts=t,this._dataDisposable=new ze,this._pointerEventsDisposable=new ze,this._disabled=!!t.disabled,this.addDisposables(this._dataDisposable,this._pointerEventsDisposable,J(this.el,"dragstart",i=>{var s,r,n,o,a,l,h;if(i.defaultPrevented||this._disabled||!((s=(r=this.opts).isCancelled)===null||s===void 0)&&s.call(r,i)){i.preventDefault();return}const d=$s((n=this.el.ownerDocument)!==null&&n!==void 0?n:document);this._pointerEventsDisposable.value={dispose:()=>d.release()},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this._dataDisposable.value=this.opts.getData(i);const u=(o=(a=this.opts).createGhost)===null||o===void 0?void 0:o.call(a,i);if(u&&i.dataTransfer){var p,f,m;if(N_(i.dataTransfer,u.element,{x:(p=u.offsetX)!==null&&p!==void 0?p:0,y:(f=u.offsetY)!==null&&f!==void 0?f:0,ownerDocument:(m=this.el.ownerDocument)!==null&&m!==void 0?m:void 0}),u.dispose){const g=u.dispose;setTimeout(()=>g(),0)}}i.dataTransfer&&(i.dataTransfer.effectAllowed="move",i.dataTransfer.items.length===0&&i.dataTransfer.setData("text/plain","")),(l=(h=this.opts).onDragStart)===null||l===void 0||l.call(h,i)}),J(this.el,"dragend",i=>{var s,r;this._pointerEventsDisposable.dispose(),setTimeout(()=>this._dataDisposable.dispose(),0),(s=(r=this.opts).onDragEnd)===null||s===void 0||s.call(r,i)}))}setDisabled(e){this._disabled=e}setTouchOnly(e){}cancelPending(){}},j_=class{constructor(){this.kind="html5"}createDropTarget(e,t){return new an(e,t)}createDragSource(e,t){return new F_(e,t)}},V_=class{constructor(){this.kind="pointer"}createDropTarget(e,t){return new G_(e,t)}createDragSource(e,t){const i=t.createGhost?r=>{const n=t.createGhost(r);if(!n)return;const o=new $_({element:n.element,initialX:r.clientX,initialY:r.clientY,offsetX:n.offsetX,offsetY:n.offsetY,owner:e});if(n.dispose){const a=o.dispose.bind(o),l=n.dispose;o.dispose=()=>{a(),l()}}return o}:void 0,s=new H_(e,{getData:t.getData,isCancelled:t.isCancelled,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd?r=>t.onDragEnd(r.pointerEvent):void 0,createGhost:i,touchOnly:t.touchOnly,touchInitiationDelay:t.touchInitiationDelay,pressTolerance:t.pressTolerance,threshold:t.threshold});return t.disabled&&s.setDisabled(!0),s}};const Ii=new j_,ci=new V_,ho=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});var U_=class extends Tc{constructor(e,t,i,s){super(),this.nativeEvent=e,this.position=t,this.getData=i,this.panel=s}},Jc=class extends Ra{constructor(){super()}},Zc=class extends ee{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new ze,this._onDidDimensionChange=new O,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new O,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new O,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new O,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new O,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new O,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new O,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new O,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(i=>{this._isFocused=i.isFocused}),this.onDidActiveChange(i=>{this._isActive=i.isActive}),this.onDidVisibilityChange(i=>{this._isVisible=i.isVisible}),this.onDidDimensionsChange(i=>{this._width=i.width,this._height=i.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(t=>{this._parameters=t,e.update({params:t})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}},Qc=class extends Zc{constructor(e,t){super(e,t),this._onDidConstraintsChangeInternal=new O,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new O({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new O,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}},K_=class extends Qc{set pane(e){this._pane=e}constructor(e,t){super(e,t),this._onDidExpansionChange=new O({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new O({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new O({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var t;(t=this._pane)===null||t===void 0||t.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}},Oa=class extends ee{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,t,i){super(),this.id=e,this.component=t,this.api=i,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const s=Ac(this._element);this.addDisposables(this.api,s.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),s.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),s)}focus(){const e=new Jc;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,i;this._params=te(te({},this._params),{},{params:te(te({},(t=this._params)===null||t===void 0?void 0:t.params),e.params)});for(const s of Object.keys(e.params))e.params[s]===void 0&&delete this._params.params[s];(i=this.part)===null||i===void 0||i.update({params:this._params.params})}toJSON(){var e,t;const i=(e=(t=this._params)===null||t===void 0?void 0:t.params)!==null&&e!==void 0?e:{};return{id:this.id,component:this.component,params:Object.keys(i).length>0?i:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}},q_=class extends Oa{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){return this.headerSize+(this.isExpanded()?this._minimumBodySize:0)}get maximumSize(){return this.headerSize+(this.isExpanded()?this._maximumBodySize:0)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new K_(e.id,e.component)),this._onDidChangeExpansionState=new O({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(t=>{const{isVisible:i}=t,{accessor:s}=this._params;s.setVisible(this,i)}),this.api.onDidSizeChange(t=>{this._onDidChange.fire({size:t.size})}),J(this.element,"mouseenter",t=>{this.api._onMouseEnter.fire(t)}),J(this.element,"mouseleave",t=>{this.api._onMouseLeave.fire(t)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(t=>{this.api._onDidExpansionChange.fire({isExpanded:t})}),this.api.onDidFocusChange(t=>{this.header&&(t.isFocused?Bt(this.header,"focused"):zt(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){var t;this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):(this._expandedSize=this._size,this.animationTimer=setTimeout(()=>{var i;(i=this.body)===null||i===void 0||i.remove()},200)),this._onDidChange.fire(e?{size:(t=this._expandedSize)!==null&&t!==void 0?t:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,t){this._size=e,this._orthogonalSize=t;const[i,s]=this.orientation==="HORIZONTAL"?[e,t]:[t,e];super.layout(i,s)}init(e){var t,i;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(te(te({},e),{},{api:this.api})),this.headerPart.init(te(te({},e),{},{api:this.api})),(t=this.body)===null||t===void 0||t.append(this.bodyPart.element),(i=this.header)===null||i===void 0||i.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return te(te({},super.toJSON()),{},{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,i;(t=this.bodyPart)===null||t===void 0||t.update({params:e}),(i=this.headerPart)===null||i===void 0||i.update({params:e})},dispose:()=>{var e,t;(e=this.bodyPart)===null||e===void 0||e.dispose(),(t=this.headerPart)===null||t===void 0||t.dispose()}}}},Y_=class extends q_{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new O,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOver=new O,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOver),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,t=this.accessor.id;this.header.draggable=!0;const i={getData:()=>(di.getInstance().setData([new zs(t,e)],zs.prototype),{dispose:()=>{di.getInstance().clearData(zs.prototype)}})};this.html5DragSource=Ii.createDragSource(this.header,i),this.pointerDragSource=ci.createDragSource(this.header,i);const r={acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(n,o)=>{const a=ws();if(a&&a.paneId!==this.id&&a.viewId===this.accessor.id)return!0;const l=new U_(n,o,ws,this);return this._onUnhandledDragOver.fire(l),l.isAccepted}};this.target=Ii.createDropTarget(this.element,r),this.pointerTarget=ci.createDropTarget(this.element,r),this.addDisposables(this._onDidDrop,this.html5DragSource,this.pointerDragSource,this.target,this.pointerTarget,this.target.onDrop(n=>{this.onDrop(n)}),this.pointerTarget.onDrop(n=>{this.onDrop(n)}))}onDrop(e){const t=ws();if(t?.viewId!==this.accessor.id){this._onDidDrop.fire(te(te({},e),{},{panel:this,api:new js(this.accessor),getData:ws}));return}const i=this._params.containerApi,s=t.paneId,r=i.getPanel(s);if(!r){this._onDidDrop.fire(te(te({},e),{},{panel:this,getData:ws,api:new js(this.accessor)}));return}const n=i.panels,o=n.indexOf(r);let a=i.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(a=Math.max(0,a-1)),(e.position==="right"||e.position==="bottom")&&(o>a&&a++,a=Math.min(n.length-1,a)),i.movePanel(o,a)}};let X_=0;const J_=()=>`dv-tabpanel-${X_++}`;var Z_=class extends ee{get element(){return this._element}constructor(e,t){var i,s,r,n,o,a,l;super(),this.accessor=e,this.group=t,this.disposable=new ze,this._onDidFocus=new O,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new O,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this._element.id=J_(),this._element.setAttribute("role","tabpanel"),this.addDisposables(this._onDidFocus,this._onDidBlur);const h=()=>{var u;return(u=t.dropTargetContainer)===null||u===void 0?void 0:u.model},d=(u,p)=>this.group.canDisplayContentOverlay(u,p);this.dropTarget=new an(this.element,{getOverlayOutline:()=>{var u;return((u=e.options.theme)===null||u===void 0?void 0:u.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:d,getOverrideTarget:h,overlayModel:(i=(s=this.accessor).resolveDropOverlayModel)===null||i===void 0?void 0:i.call(s,"content"),getPositionResolver:()=>{var u;return(u=e.getDropPositionResolver)===null||u===void 0?void 0:u.call(e)}}),this.pointerDropTarget=ci.createDropTarget(this.element,{acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:d,getOverlayOutline:()=>{var u;return((u=e.options.theme)===null||u===void 0?void 0:u.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",getOverrideTarget:h,overlayModel:(r=(n=this.accessor).resolveDropOverlayModel)===null||r===void 0?void 0:r.call(n,"content"),getPositionResolver:()=>{var u;return(u=e.getDropPositionResolver)===null||u===void 0?void 0:u.call(e)}}),this.addDisposables(this.dropTarget,this.pointerDropTarget,(o=(a=(l=this.accessor).onDidOptionsChange)===null||a===void 0?void 0:a.call(l,()=>{var u,p,f;const m=(u=(p=(f=this.accessor).resolveDropOverlayModel)===null||p===void 0?void 0:p.call(f,"content"))!==null&&u!==void 0?u:{};this.dropTarget.setOverlayModel(m),this.pointerDropTarget.setOverlayModel(m)}))!==null&&o!==void 0?o:be.NONE)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}setLabelledBy(e){e?this._element.setAttribute("aria-labelledby",e):this._element.removeAttribute("aria-labelledby")}renderPanel(e,t){var i,s;const r=((i=t?.asActive)!==null&&i!==void 0?i:!0)||this.panel&&this.group.isPanelActive(this.panel);if(((s=this.panel)===null||s===void 0?void 0:s.view.content.element.parentElement)===this._element){var n,o;this.panel.view.content.element.remove(),(n=(o=this.panel.view.content).onHide)===null||n===void 0||n.call(o)}this.panel=e;let a;switch(e.api.renderer){case"onlyWhenVisible":if(this.group.renderContainer.detatch(e),this.panel&&r){var l,h;this._element.appendChild(this.panel.view.content.element),(l=(h=this.panel.view.content).onShow)===null||l===void 0||l.call(h)}a=this._element;break;case"always":e.view.content.element.parentElement===this._element&&e.view.content.element.remove(),a=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(r){const d=Ac(a);this.focusTracker=d;const u=new ee;u.addDisposables(d,d.onDidFocus(()=>this._onDidFocus.fire()),d.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=u}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){if(this.panel&&this.panel.api.renderer==="onlyWhenVisible"){var e,t;this.panel.view.content.element.remove(),(e=(t=this.panel.view.content).onHide)===null||e===void 0||e.call(t)}this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}};const ln=e=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttributeNS(null,"height",e.height),t.setAttributeNS(null,"width",e.width),t.setAttributeNS(null,"viewBox",e.viewbox),t.setAttributeNS(null,"aria-hidden","false"),t.setAttributeNS(null,"focusable","false"),t.classList.add("dv-svg");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d",e.path),t.appendChild(i),t},Q_=()=>ln({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),eu=()=>ln({width:"11",height:"11",viewbox:"0 0 24 24",path:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H6c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"}),eb=()=>ln({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),tu=()=>ln({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"}),tb=500,ib=8;var Ga=class extends ee{constructor(e,t){super(),this.element=e,this.options=t,this._startX=0,this._startY=0,this.addDisposables(J(this.element,"pointerdown",i=>{this._onPointerDown(i)}))}_onPointerDown(e){var t,i,s,r,n;if((!((t=this.options.touchOnly)!==null&&t!==void 0)||t)&&e.pointerType!=="touch"&&e.pointerType!=="pen")return;this._cancelPending(),this._pointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY;const o=(i=this.options.delay)!==null&&i!==void 0?i:tb,a=(s=this.options.tolerance)!==null&&s!==void 0?s:ib,l=(r=(n=this.element.ownerDocument)===null||n===void 0?void 0:n.defaultView)!==null&&r!==void 0?r:globalThis.window;this._timer=setTimeout(()=>{this._timer=void 0,this._cancelPending(),this._installContextMenuGuard(l),this._installClickGuard(l),this.options.onLongPress(e)},o),this._moveListener=J(l,"pointermove",h=>{if(h.pointerId!==this._pointerId)return;const d=h.clientX-this._startX,u=h.clientY-this._startY;Math.hypot(d,u)>a&&this._cancelPending()}),this._upListener=J(l,"pointerup",h=>{h.pointerId===this._pointerId&&this._cancelPending()}),this._cancelListener=J(l,"pointercancel",h=>{h.pointerId===this._pointerId&&this._cancelPending()})}_installContextMenuGuard(e){let t;const i=setTimeout(()=>t?.dispose(),500);t=J(e,"contextmenu",s=>{s.preventDefault(),clearTimeout(i),t?.dispose()},{capture:!0})}_installClickGuard(e){let t;const i=setTimeout(()=>t?.dispose(),500);t=J(e,"click",s=>{const r=s.target;r&&this.element.contains(r)&&(s.preventDefault(),s.stopPropagation()),clearTimeout(i),t?.dispose()},{capture:!0})}_cancelPending(){var e,t,i;this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0),this._pointerId=void 0,(e=this._moveListener)===null||e===void 0||e.dispose(),(t=this._upListener)===null||t===void 0||t.dispose(),(i=this._cancelListener)===null||i===void 0||i.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}dispose(){this._cancelPending(),super.dispose()}};function Gt(e){if(e.disableDnd)return{html5:!1,pointer:!1,pointerHandlesMouse:!1};switch(e.dndStrategy){case"pointer":return{html5:!1,pointer:!0,pointerHandlesMouse:!0};case"html5":return{html5:!0,pointer:!1,pointerHandlesMouse:!1};default:return sb()?{html5:!1,pointer:!0,pointerHandlesMouse:!0}:{html5:!0,pointer:!0,pointerHandlesMouse:!1}}}function sb(){if(globalThis.window===void 0||!globalThis.matchMedia)return!1;const e=globalThis.matchMedia("(pointer: coarse)").matches,t=globalThis.matchMedia("(pointer: fine)").matches;return e&&!t}let rb=0;const nb=()=>`dv-tab-${rb++}`;var ob=class extends ee{get element(){return this._element}constructor(e,t,i){var s,r,n,o,a,l,h,d;super(),this.panel=e,this.accessor=t,this.group=i,this.content=void 0,this.panelTransfer=di.getInstance(),this._direction="horizontal",this._pinIndicator=void 0,this._onPointDown=new O,this.onPointerDown=this._onPointDown.event,this._onTabClick=new O,this.onTabClick=this._onTabClick.event,this._onDropped=new O,this.onDrop=this._onDropped.event,this._onDragStart=new O,this.onDragStart=this._onDragStart.event,this._onDragEnd=new O,this.onDragEnd=this._onDragEnd.event;const u=Gt(this.accessor.options);this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=-1,this._element.draggable=u.html5,this._element.id=nb(),this._element.setAttribute("role","tab"),this._element.setAttribute("aria-selected","false"),this._element.setAttribute("aria-label",(s=this.panel.title)!==null&&s!==void 0?s:this.panel.id),this._element.dataset.tabPanelId=this.panel.id;const p=(r=this.group)===null||r===void 0||(r=r.model)===null||r===void 0?void 0:r.contentContainerId;p&&this._element.setAttribute("aria-controls",p),K(this.element,"dv-inactive-tab",!0),this._updatePinnedClasses();const f=(g,_)=>{if(this.group.locked)return!1;const A=Te();if(this.accessor.id===A?.viewId){var P;return((P=this.accessor.options.theme)===null||P===void 0?void 0:P.tabAnimation)!=="smooth"}return this.group.model.canDisplayOverlay(g,_,"tab")};this.dropTarget=Ii.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:f,getOverrideTarget:()=>{var g;return(g=i.model.dropTargetContainer)===null||g===void 0?void 0:g.model}}),this.pointerDropTarget=ci.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:f,getOverrideTarget:()=>{var g;return(g=i.model.dropTargetContainer)===null||g===void 0?void 0:g.model}});const m={getData:()=>(this.panelTransfer.setData([new Et(this.accessor.id,this.group.id,this.panel.id)],Et.prototype),{dispose:()=>{this.panelTransfer.clearData(Et.prototype)}}),createGhost:()=>({element:this._buildGhostElement(),offsetX:30,offsetY:-10}),onDragStart:g=>{var _;this._onDragStart.fire(g),!(g instanceof PointerEvent)&&((_=this.accessor.options.theme)===null||_===void 0?void 0:_.tabAnimation)==="smooth"&&requestAnimationFrame(()=>{K(this.element,"dv-tab--dragging",!0)})},onDragEnd:g=>{this._onDragEnd.fire(g)}};this.html5DragSource=Ii.createDragSource(this._element,te(te({},m),{},{disabled:!u.html5})),this.pointerDragSource=ci.createDragSource(this._element,te(te({},m),{},{disabled:!u.pointer,touchOnly:!u.pointerHandlesMouse,isCancelled:()=>!Gt(this.accessor.options).pointer})),this.onWillShowOverlay=Tt.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this._onPointDown,this._onTabClick,this._onDropped,this._onDragStart,this._onDragEnd,this.accessor.onDidOptionsChange(()=>{const g=this._buildOverlayModel();this.dropTarget.setOverlayModel(g),this.pointerDropTarget.setOverlayModel(g),this._updatePinnedClasses()}),(n=(o=this.panel.api)===null||o===void 0||(a=o.onDidChangePinned)===null||a===void 0?void 0:a.call(o,()=>{this._updatePinnedClasses()}))!==null&&n!==void 0?n:{dispose:()=>{}},(l=(h=this.panel.api)===null||h===void 0||(d=h.onDidTitleChange)===null||d===void 0?void 0:d.call(h,g=>{var _;this._element.setAttribute("aria-label",(_=g.title)!==null&&_!==void 0?_:this.panel.id)}))!==null&&l!==void 0?l:{dispose:()=>{}},J(this._element,"dragend",()=>{K(this.element,"dv-tab--dragging",!1)}),this.html5DragSource,J(this._element,"pointerdown",g=>{this._onPointDown.fire(g)}),J(this._element,"click",g=>{this._onTabClick.fire(g)}),J(this._element,"contextmenu",g=>{var _;(_=this.accessor.contextMenuService)===null||_===void 0||_.show(this.panel,this.group,g)}),new Ga(this._element,{onLongPress:g=>{var _;this.pointerDragSource.cancelPending(),(_=this.accessor.contextMenuService)===null||_===void 0||_.show(this.panel,this.group,g)}}),this.dropTarget.onDrop(g=>{this._onDropped.fire(g)}),this.pointerDropTarget.onDrop(g=>{this._onDropped.fire(g)}),this.dropTarget,this.pointerDropTarget,this.pointerDragSource)}_updatePinnedClasses(){var e,t,i,s;const r=(e=(t=this.panel.api)===null||t===void 0?void 0:t.isPinned)!==null&&e!==void 0?e:!1,n=r&&((i=this.accessor.options.pinnedTabs)===null||i===void 0?void 0:i.compact)===!0;K(this.element,"dv-tab--pinned",r),K(this.element,"dv-tab--pinned-compact",n);const o=r&&!(!((s=this.panel.api)===null||s===void 0)&&s.tabComponent);if(o&&!this._pinIndicator){const a=document.createElement("div");a.className="dv-tab-pin",a.appendChild(eu()),this._element.insertBefore(a,this._element.firstChild),this._pinIndicator=a}else!o&&this._pinIndicator&&(this._pinIndicator.remove(),this._pinIndicator=void 0)}setActive(e){K(this.element,"dv-active-tab",e),K(this.element,"dv-inactive-tab",!e),this._element.setAttribute("aria-selected",e?"true":"false"),this._element.tabIndex=e?0:-1}setContent(e){this.content&&this.content.element.remove(),this.content=e,this._element.appendChild(this.content.element)}_buildOverlayModel(){var e,t,i;const s=(e=(t=this.accessor).resolveDropOverlayModel)===null||e===void 0?void 0:e.call(t,"tab",this.group);if(s)return s;const r=((i=this.accessor.options.theme)===null||i===void 0?void 0:i.dndTabIndicator)==="line"?Number.POSITIVE_INFINITY:0;return{activationSize:{value:50,type:"percentage"},smallWidthBoundary:r,smallHeightBoundary:r}}setDirection(e){this._direction=e;const t=e==="vertical"?["top","bottom"]:["left","right"];this.dropTarget.setTargetZones(t),this.pointerDropTarget.setTargetZones(t)}updateDragAndDropState(){const e=Gt(this.accessor.options);this._element.draggable=e.html5,this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}_buildGhostElement(){const e=getComputedStyle(this.element),t=this.element.cloneNode(!0),i=this._direction==="vertical",s=new Set(["writing-mode","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin-inline","margin-inline-start","margin-inline-end","margin-block","margin-block-start","margin-block-end","padding-inline","padding-inline-start","padding-inline-end","padding-block","padding-block-start","padding-block-end"]);return Array.from(e).forEach(r=>{i&&s.has(r)||t.style.setProperty(r,e.getPropertyValue(r),e.getPropertyPriority(r))}),i&&(t.style.setProperty("writing-mode","horizontal-tb"),t.style.setProperty("width",e.height),t.style.setProperty("height",e.width)),t.style.position="absolute",t.classList.add("dv-tab-ghost-drag"),t}},Vs=class{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get edge(){return this.event.edge}get edgeGroup(){return this.event.edgeGroup}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}},iu=class extends ee{get group(){return this.groupAccessor()}constructor(e){var t,i;super(),this.panelTransfer=di.getInstance(),this._onDragStart=new O,this.onDragStart=this._onDragStart.event,this._element=e.element,this.accessor=e.accessor;const s=e.group;this.groupAccessor=typeof s=="function"?s:()=>s,this.isFloatingMoveHandle=(t=e.isFloatingMoveHandle)!==null&&t!==void 0?t:(()=>!0);const r=Gt(this.accessor.options);this._element.draggable=r.html5,K(this._element,"dv-draggable",r.html5||r.pointer),this.addDisposables(this._onDragStart);const n=()=>{const p=document.createElement("div"),f=globalThis.getComputedStyle(this._element),m=f.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),g=f.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");return p.style.backgroundColor=m,p.style.color=g,p.style.padding="2px 8px",p.style.height="24px",p.style.fontSize="11px",p.style.lineHeight="20px",p.style.borderRadius="12px",p.style.whiteSpace="nowrap",p.style.boxSizing="border-box",p.style.display="inline-block",p.textContent=`Multiple Panels (${this.group.size})`,p},a={getData:()=>(this.panelTransfer.setData([new Et(this.accessor.id,this.group.id,null)],Et.prototype),{dispose:()=>{this.panelTransfer.clearData(Et.prototype)}}),createGhost:()=>{var p,f;const m=(p=(f=this.accessor).buildGroupDragGhost)===null||p===void 0?void 0:p.call(f,this.group);return m||{element:n(),offsetX:30,offsetY:-10}},onDragStart:p=>{this._onDragStart.fire(p)}};this.html5DragSource=Ii.createDragSource(this._element,te(te({},a),{},{disabled:!r.html5,isCancelled:p=>!!(this.group.api.location.type==="floating"&&this.isFloatingMoveHandle()&&!p.shiftKey||this.group.api.location.type==="edge"&&this.group.size===0)}));const l=()=>{var p;return((p=this.group)===null||p===void 0||(p=p.api)===null||p===void 0||(p=p.location)===null||p===void 0?void 0:p.type)==="floating"&&this.isFloatingMoveHandle()};this.pointerDragSource=ci.createDragSource(this._element,te(te({},a),{},{disabled:!r.pointer,touchOnly:!r.pointerHandlesMouse,touchInitiationDelay:()=>l()?500:250,pressTolerance:()=>l()?1/0:8,isCancelled:()=>!Gt(this.accessor.options).pointer||this.group.api.location.type==="edge"&&this.group.size===0,onDragStart:p=>{var f;(f=this.getFloatingOverlay())===null||f===void 0||f.cancelPendingDrag(),this._onDragStart.fire(p)}}));const h=new ze,d=()=>{const p=this.getFloatingOverlay();h.value=p?p.onDidStartMoving(()=>{this.pointerDragSource.cancelPending()}):be.NONE};d(),this.addDisposables(h);const u=(i=this.group)===null||i===void 0||(i=i.api)===null||i===void 0?void 0:i.onDidLocationChange;u&&this.addDisposables(u(d)),this.addDisposables(this.html5DragSource,this.pointerDragSource)}updateDragAndDropState(){const e=Gt(this.accessor.options);this._element.draggable=e.html5,K(this._element,"dv-draggable",e.html5||e.pointer),this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}getFloatingOverlay(){var e;if(this.group)return(e=this.accessor.floatingGroups)===null||e===void 0||(e=e.find(t=>t.group===this.group))===null||e===void 0?void 0:e.overlay}},ab=class extends ee{get element(){return this._element}constructor(e,t){var i,s,r,n,o,a,l;super(),this.accessor=e,this.group=t,this._onDrop=new O,this.onDrop=this._onDrop.event,this._onDragStart=new O,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this.addDisposables(this._onDrop,this._onDragStart,J(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)}),J(this._element,"pointerdown",d=>{d.shiftKey&&Lc(d)},!0)),this.dragSource=new iu({element:this._element,accessor:this.accessor,group:this.group,isFloatingMoveHandle:()=>!this._element.closest(".dv-resize-container-with-titlebar")});const h=(d,u)=>{if(this.group.api.locked)return!1;const p=Te();return this.accessor.id===p?.viewId?!0:t.model.canDisplayOverlay(d,u,"header_space")};this.dropTarget=Ii.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:h,getOverrideTarget:()=>{var d;return(d=t.model.dropTargetContainer)===null||d===void 0?void 0:d.model},overlayModel:(i=(s=this.accessor).resolveDropOverlayModel)===null||i===void 0?void 0:i.call(s,"header_space",this.group)}),this.pointerDropTarget=ci.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:h,getOverrideTarget:()=>{var d;return(d=t.model.dropTargetContainer)===null||d===void 0?void 0:d.model},overlayModel:(r=(n=this.accessor).resolveDropOverlayModel)===null||r===void 0?void 0:r.call(n,"header_space",this.group)}),this.onWillShowOverlay=Tt.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this.dragSource,this.dragSource.onDragStart(d=>{this._onDragStart.fire(d)}),this.dropTarget.onDrop(d=>{this._onDrop.fire(d)}),this.pointerDropTarget.onDrop(d=>{this._onDrop.fire(d)}),this.dropTarget,this.pointerDropTarget,(o=(a=(l=this.accessor).onDidOptionsChange)===null||a===void 0?void 0:a.call(l,()=>{var d,u,p;const f=(d=(u=(p=this.accessor).resolveDropOverlayModel)===null||u===void 0?void 0:u.call(p,"header_space",this.group))!==null&&d!==void 0?d:{};this.dropTarget.setOverlayModel(f),this.pointerDropTarget.setOverlayModel(f)}))!==null&&o!==void 0?o:be.NONE)}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}},su=class ru extends ee{get element(){return this._element}get orientation(){return this._orientation}set orientation(t){this._orientation!==t&&(this._scrollOffset=0,this._orientation=t,zt(this._scrollbar,"dv-scrollbar-vertical","dv-scrollbar-horizontal"),t==="vertical"?Bt(this._scrollbar,"dv-scrollbar-vertical"):Bt(this._scrollbar,"dv-scrollbar-horizontal"))}constructor(t){super(),this.scrollableElement=t,this._scrollOffset=0,this._orientation="horizontal",this._element=document.createElement("div"),this._element.className="dv-scrollable",this._scrollbar=document.createElement("div"),this._scrollbar.className="dv-scrollbar dv-scrollbar-horizontal",this.element.appendChild(t),this.element.appendChild(this._scrollbar),this.addDisposables(J(this.element,"wheel",i=>{this._scrollOffset+=i.deltaY*ru.MouseWheelSpeed,this.scheduleStyleUpdate()}),J(this._scrollbar,"pointerdown",i=>{var s;i.preventDefault();const r=(s=this._scrollbar.ownerDocument)!==null&&s!==void 0?s:document;K(this.element,"dv-scrollable-scrolling",!0);const n=this._orientation==="horizontal"?i.clientX:i.clientY,o=this._scrollOffset,a=h=>{const d=this._orientation==="horizontal"?h.clientX-n:h.clientY-n,u=(this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight)/(this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight);this._scrollOffset=o+d/u,this.scheduleStyleUpdate()},l=()=>{K(this.element,"dv-scrollable-scrolling",!1),r.removeEventListener("pointermove",a),r.removeEventListener("pointerup",l),r.removeEventListener("pointercancel",l)};r.addEventListener("pointermove",a),r.addEventListener("pointerup",l),r.addEventListener("pointercancel",l)}),J(this.element,"scroll",()=>{this.scheduleStyleUpdate()}),J(this.scrollableElement,"scroll",()=>{this._scrollOffset=this._orientation==="horizontal"?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.scheduleStyleUpdate()}),Yi(this.element,()=>{K(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),K(this.element,"dv-scrollable-resizing",!1)},500),this.scheduleStyleUpdate()}),be.from(()=>{this._pendingStyleFrame!==void 0&&(cancelAnimationFrame(this._pendingStyleFrame),this._pendingStyleFrame=void 0)}))}scheduleStyleUpdate(){this._pendingStyleFrame===void 0&&(this._pendingStyleFrame=requestAnimationFrame(()=>{this._pendingStyleFrame=void 0,this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const t=this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight,i=this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(i>t){const s=t*(t/i);this._orientation==="horizontal"?(this._scrollbar.style.width=`${s}px`,this._scrollbar.style.height=""):(this._scrollbar.style.height=`${s}px`,this._scrollbar.style.width=""),this._scrollOffset=Ee(this._scrollOffset,0,i-t),this._orientation==="horizontal"?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;const r=this._scrollOffset/(i-t);this._orientation==="horizontal"?(this._scrollbar.style.left=`${(t-s)*r}px`,this._scrollbar.style.top=""):(this._scrollbar.style.top=`${(t-s)*r}px`,this._scrollbar.style.left="")}else this._orientation==="horizontal"?(this._scrollbar.style.width="0px",this._scrollbar.style.left="0px"):(this._scrollbar.style.height="0px",this._scrollbar.style.top="0px"),this._scrollOffset=0}};su.MouseWheelSpeed=1;const nu="dv-tabs-container--wrap";function lb(e,t){return typeof e=="boolean"?e:!!e?.[t]}function co(e){return typeof e=="boolean"?e:e?Object.values(e).some(Boolean):!1}var ou=class extends Tc{constructor(e,t,i,s,r){super(),this.nativeEvent=e,this.target=t,this.position=i,this.getData=s,this.group=r}};const uo=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,transformFloatingGroupDrag:void 0,smartGuides:void 0,floatingGroupDragHandle:void 0,popoutUrl:void 0,nonce:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,locked:void 0,disableDnd:void 0,dndStrategy:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,dropPositionResolver:void 0,dndCompass:void 0,theme:void 0,disableTabsOverflowList:void 0,overflow:void 0,scrollbars:void 0,getTabContextMenuItems:void 0,getTabGroupChipContextMenuItems:void 0,createTabGroupChipComponent:void 0,createGroupDragGhostComponent:void 0,dropOverlayModel:void 0,announcements:void 0,getAnnouncement:void 0,announcer:void 0,messages:void 0,keyboardNavigation:void 0,layoutHistory:void 0,autoHideEdgeGroups:void 0,dockToEdgeGroups:void 0,edgeGroupPeek:void 0,tabGroupColors:void 0,tabGroupAccent:void 0,pinnedTabs:void 0});function hb(e){return!!e.referencePanel}function db(e){return!!e.referenceGroup}function cb(e){return!!e.referencePanel}function ub(e){return!!e.referenceGroup}const za=[{id:"grey",value:"var(--dv-tab-group-color-grey)",label:"Grey"},{id:"blue",value:"var(--dv-tab-group-color-blue)",label:"Blue"},{id:"red",value:"var(--dv-tab-group-color-red)",label:"Red"},{id:"yellow",value:"var(--dv-tab-group-color-yellow)",label:"Yellow"},{id:"green",value:"var(--dv-tab-group-color-green)",label:"Green"},{id:"pink",value:"var(--dv-tab-group-color-pink)",label:"Pink"},{id:"purple",value:"var(--dv-tab-group-color-purple)",label:"Purple"},{id:"cyan",value:"var(--dv-tab-group-color-cyan)",label:"Cyan"},{id:"orange",value:"var(--dv-tab-group-color-orange)",label:"Orange"}];var au=class{constructor(e,t=!0){this._entries=e.slice(),this._byId=new Map(e.map(i=>[i.id,i])),this._enabled=t}get enabled(){return this._enabled}set enabled(e){this._enabled=e}setEntries(e){this._entries=e.slice(),this._byId=new Map(e.map(t=>[t.id,t]))}entries(){return this._entries}has(e){return this._byId.has(e)}get(e){return this._byId.get(e)}defaultId(){var e;return(e=this._entries[0])===null||e===void 0?void 0:e.id}resolveValue(e){if(!this._enabled||!e)return;const t=this._byId.get(e);return t?t.value:e}};let yn;function lu(){var e;return(e=yn)!==null&&e!==void 0||(yn=new au(za,!0)),yn}function Ba(e,t,i){const s=(i??lu()).resolveValue(t);s===void 0?e.style.removeProperty("--dv-tab-group-color"):e.style.setProperty("--dv-tab-group-color",s)}function Wa(e,t){return(t??lu()).resolveValue(e)}var ql=class extends ee{get element(){return this._element}constructor(e){super(),this._palette=e,this._onClick=new O,this.onClick=this._onClick.event,this._onContextMenu=new O,this.onContextMenu=this._onContextMenu.event,this._element=document.createElement("div"),this._element.className="dv-tab-group-chip",this._element.tabIndex=0,this._label=document.createElement("span"),this._label.className="dv-tab-group-chip-label",this._element.appendChild(this._label),this.addDisposables(this._onClick,this._onContextMenu,new Ga(this._element,{onLongPress:t=>{this._onContextMenu.fire(t)}}),J(this._element,"click",t=>{this._onClick.fire(t)}),J(this._element,"contextmenu",t=>{this._onContextMenu.fire(t)}))}init(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed),this.addDisposables(e.tabGroup.onDidChange(()=>{this._tabGroup&&(this.updateColor(this._tabGroup.color),this.updateLabel(this._tabGroup.label))}),e.tabGroup.onDidCollapseChange(t=>{this.updateCollapsed(t)}),this._onClick.event(()=>{var t;(t=this._tabGroup)===null||t===void 0||t.toggle()}))}update(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed)}updateColor(e){var t;Ba(this._element,e,this._palette),K(this._element,"dv-tab-group-chip--accent-off",((t=this._palette)===null||t===void 0?void 0:t.enabled)===!1)}updateLabel(e){this._label.textContent=e,K(this._label,"dv-tab-group-chip-label--empty",!e)}updateCollapsed(e){K(this._element,"dv-tab-group-chip--collapsed",e)}};const pb="dv-tab-group-chip-continuation",Yl=8;var hu=class{get underlines(){return this._underlines}constructor(e){this._ctx=e,this._underlines=new Map,this._continuationMarkers=new Map,this._rafId=null}positionUnderlines(){requestAnimationFrame(()=>{this._positionUnderlinesSync()})}trackUnderlines(){this._rafId!==null&&cancelAnimationFrame(this._rafId);const e=performance.now(),t=250,i=()=>{this._positionUnderlinesSync(),performance.now()-e<t?this._rafId=requestAnimationFrame(i):this._rafId=null};this._rafId=requestAnimationFrame(i)}syncUnderlineElements(e){for(const t of e)if(!this._underlines.has(t)){const i=document.createElement("div");i.className="dv-tab-group-underline",this._ctx.tabsList.appendChild(i),this._underlines.set(t,i)}for(const[t,i]of this._underlines)e.has(t)||(i.remove(),this._underlines.delete(t),this._clearContinuationMarkers(t))}getUnderline(e){return this._underlines.get(e)}dispose(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null);for(const[,e]of this._underlines)e.remove();this._underlines.clear(),this._clearContinuationMarkers()}_syncContinuationMarkers(e,t){let i=this._continuationMarkers.get(e);for(i||(i=[],this._continuationMarkers.set(e,i));i.length<t;){const s=document.createElement("div");s.className=pb,this._ctx.tabsList.appendChild(s),i.push(s)}for(;i.length>t;){const s=i.pop();s?.remove()}return i}_clearContinuationMarkers(e){if(e===void 0){for(const[,i]of this._continuationMarkers)for(const s of i)s.remove();this._continuationMarkers.clear();return}const t=this._continuationMarkers.get(e);if(t){for(const i of t)i.remove();this._continuationMarkers.delete(e)}}_positionUnderlinesSync(){const e=this._ctx.tabsList.getBoundingClientRect(),t=this._ctx.getTabGroups(),i=this._ctx.getDirection()==="vertical",s=this._ctx.tabsList.classList.contains(nu);s||this._clearContinuationMarkers();const r=i?e.width:e.height,n=this._ctx.getActivePanelId(),o=this._ctx.getTabMap();for(const a of t){const l=this._underlines.get(a.id);if(!l)continue;const h=a.panelIds;if(h.length===0){l.style.display="none";continue}if(l.style.display="",s){this._positionWrappedUnderline(l,a,e,o,i);continue}const d=this._ctx.getChipElement(a.id);let u;if(d){const A=d.getBoundingClientRect(),P=getComputedStyle(d),E=i?Number.parseFloat(P.marginTop)||0:Number.parseFloat(P.marginLeft)||0;u=i?A.top-e.top-E:A.left-e.left-E}else{const A=h[0],P=o.get(A);if(P){const E=P.value.element.getBoundingClientRect();u=i?E.top-e.top:E.left-e.left}else u=0}const p=h[h.length-1],f=o.get(p);if(!f){i?(l.style.top=`${u}px`,l.style.height="0px",l.style.left="",l.style.width=""):(l.style.left=`${u}px`,l.style.width="0px",l.style.top="",l.style.height="");continue}const m=f.value.element.getBoundingClientRect();let g=i?m.bottom-e.top:m.right-e.left,_=g-u;if((a.collapsed||a.panelIds.some(A=>{const P=o.get(A);return P?.value.element.classList.contains("dv-tab--group-expanding")}))&&d){const A=d.getBoundingClientRect(),P=i?A.top+A.height/2-e.top:A.left+A.width/2-e.left;let E=0,y=0;for(const D of a.panelIds){const L=o.get(D);if(!L)continue;const G=L.value.element;i?(E+=G.getBoundingClientRect().height,y+=G.scrollHeight):(E+=G.getBoundingClientRect().width,y+=G.scrollWidth)}const T=y>0?Math.min(1,E/y):0;u=P+(u-P)*T,g=P+(g-P)*T,_=Math.max(0,g-u)}i?(l.style.top=`${u}px`,l.style.height=`${Math.max(0,_)}px`,l.style.left="",l.style.width="",l.style.bottom=""):(l.style.left=`${u}px`,l.style.width=`${Math.max(0,_)}px`,l.style.top="",l.style.height="",l.style.bottom=""),this.applyShape(l,a,u,_,r,n,e,i)}}_positionWrappedUnderline(e,t,i,s,r){const o=Wa(t.color,this._ctx.getColorPalette());if(o===void 0){e.style.display="none",this._clearContinuationMarkers(t.id);return}const{runs:a,firstRun:l}=this._computeWrappedRuns(t,i,s,r);if(a.length===0){e.style.display="none",this._clearContinuationMarkers(t.id);return}this._positionContinuationMarkers(t.id,a,l,o,r);const h=Math.min(...a.map(E=>E.left)),d=Math.max(...a.map(E=>E.right)),u=Math.min(...a.map(E=>E.top)),p=Math.max(...a.map(E=>E.bottom)),f=r?Math.max(0,d-h):i.width,m=r?i.height:Math.max(0,p-u);e.style.left=r?`${h}px`:"0px",e.style.top=r?"0px":`${u}px`,e.style.bottom="auto",e.style.width=`${f}px`,e.style.height=`${m}px`,e.style.backgroundColor="";const{svg:g,path:_}=this.ensureSvgPath(e);g.setAttribute("width",String(f)),g.setAttribute("height",String(m)),_.setAttribute("stroke",o),_.setAttribute("stroke-width",String(2));const A=this._ctx.getHeaderPosition(),P=r?A==="right":A==="bottom";_.setAttribute("d",this._wrappedPathData(a,r,P,h,u,2))}_computeWrappedRuns(e,t,i,s){const r=[];let n;for(const a of e.panelIds){var o;const l=i.get(a);if(!l)continue;const h=l.value.element.getBoundingClientRect();if(h.width===0&&h.height===0)continue;const d=h.top-t.top,u=h.bottom-t.top,p=h.left-t.left,f=h.right-t.left,m=s?p:d;let g=r.find(_=>Math.abs((s?_.left:_.top)-m)<=2);g?(g.top=Math.min(g.top,d),g.bottom=Math.max(g.bottom,u),g.left=Math.min(g.left,p),g.right=Math.max(g.right,f)):(g={top:d,bottom:u,left:p,right:f},r.push(g)),(o=n)!==null&&o!==void 0||(n=g)}return{runs:r,firstRun:n}}_wrappedPathData(e,t,i,s,r,n){let o="";for(const a of e)if(t){const l=i?a.right-s-n/2:a.left-s+n/2;o+=`M ${l},${a.top} L ${l},${a.bottom} `}else{const l=i?a.top-r+n/2:a.bottom-r-n/2;o+=`M ${a.left},${l} L ${a.right},${l} `}return o.trim()}_positionContinuationMarkers(e,t,i,s,r){const n=t.filter(a=>a!==i),o=this._syncContinuationMarkers(e,n.length);n.forEach((a,l)=>{const h=o[l];if(h.style.backgroundColor=s,r){const d=(a.left+a.right)/2;h.style.left=`${d-Yl/2}px`,h.style.top=`${a.top}px`}else{const d=(a.top+a.bottom)/2;h.style.left=`${a.left}px`,h.style.top=`${d-Yl/2}px`}})}ensureSvgPath(e){const t=e.firstElementChild;if(t?.tagName==="svg")return{svg:t,path:t.firstElementChild};e.replaceChildren();const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.style.display="block";const s=document.createElementNS("http://www.w3.org/2000/svg","path");return s.setAttribute("fill","none"),i.appendChild(s),e.appendChild(i),{svg:i,path:s}}},fb=class extends hu{_applyStraightLine(e,t,i,s,r,n,o){const a=o?r:s,l=o?s:r;e.setAttribute("width",String(a)),e.setAttribute("height",String(l)),i.style.width=`${a}px`,i.style.height=`${l}px`,t.setAttribute("d",o?`M ${n},0 L ${n},${s}`:`M 0,${n} L ${s},${n}`)}applyShape(e,t,i,s,r,n,o,a){const h=r,d=s,u=Wa(t.color,this._ctx.getColorPalette());if(d<=0||h<=0||u===void 0){e.style.display="none";return}e.style.display="";let p;n&&t.panelIds.includes(n)&&(p=this._ctx.getTabMap().get(n));const{svg:f,path:m}=this.ensureSvgPath(e);m.setAttribute("stroke",u),m.setAttribute("stroke-width",String(2));const g=2,_=this._ctx.getHeaderPosition(),A=!a&&_==="bottom",P=a&&_==="right";let E,y;if(a?(E=P?h-g:g,y=P?g:h-g):(E=A?g:h-g,y=A?h-g:g),!p){this._applyStraightLine(f,m,e,d,h,E,a);return}const T=p.value.element.getBoundingClientRect();let D,L;if(a?(D=Math.max(0,T.top-o.top-i),L=Math.min(d,T.bottom-o.top-i)):(D=Math.max(0,T.left-o.left-i),L=Math.min(d,T.right-o.left-i)),L<=D){this._applyStraightLine(f,m,e,d,h,E,a);return}const G=6,H=y>E?1:-1;if(a){const M=h,N=d;f.setAttribute("width",String(M)),f.setAttribute("height",String(N)),e.style.width=`${M}px`,e.style.height=`${N}px`;const C=[`M ${E},0`,`L ${E},${D-G}`,`Q ${E},${D} ${E+H*G},${D}`,`L ${y-H*G},${D}`,`Q ${y},${D} ${y},${D+G}`,`L ${y},${L-G}`,`Q ${y},${L} ${y-H*G},${L}`,`L ${E+H*G},${L}`,`Q ${E},${L} ${E},${L+G}`,`L ${E},${N}`].join(" ");m.setAttribute("d",C)}else{const M=d,N=h;f.setAttribute("width",String(M)),f.setAttribute("height",String(N)),e.style.width=`${M}px`,e.style.height=`${N}px`;const C=[`M 0,${E}`,`L ${D-G},${E}`,`Q ${D},${E} ${D},${E+H*G}`,`L ${D},${y-H*G}`,`Q ${D},${y} ${D+G},${y}`,`L ${L-G},${y}`,`Q ${L},${y} ${L},${y-H*G}`,`L ${L},${E+H*G}`,`Q ${L},${E} ${L+G},${E}`,`L ${M},${E}`].join(" ");m.setAttribute("d",C)}}},mb=class extends hu{applyShape(e,t,i,s,r,n,o,a){const h=Wa(t.color,this._ctx.getColorPalette());if(s<=0||h===void 0){e.style.display="none";return}e.style.display="",e.firstElementChild&&e.replaceChildren(),e.style.backgroundColor=h,a?(e.style.width="2px",e.style.height=`${s}px`):(e.style.width=`${s}px`,e.style.height="2px")}};const gb=new Map;var vb=class{get chipRenderers(){return this._chipRenderers}get groupUnderlines(){var e,t;return(e=(t=this._indicator)===null||t===void 0?void 0:t.underlines)!==null&&e!==void 0?e:gb}get skipNextCollapseAnimation(){return this._skipNextCollapseAnimation}set skipNextCollapseAnimation(e){this._skipNextCollapseAnimation=e}constructor(e,t){this._ctx=e,this._callbacks=t,this._chipRenderers=new Map,this._indicator=null,this._skipNextCollapseAnimation=!1,this._pendingTransitionCleanups=new Map}update(){const e=this._ctx.group.model.getTabGroups(),t=new Set;for(const s of e)t.add(s.id),this._ensureChipForGroup(s),this._positionChipForGroup(s);for(const[s,r]of this._chipRenderers)if(!t.has(s)){var i;r.chip.element.remove(),r.chip.dispose(),(i=r.dragSourcesDisposable)===null||i===void 0||i.dispose(),r.disposable.dispose(),this._chipRenderers.delete(s)}this._updateTabGroupClasses()}refreshAccents(){for(const i of this._ctx.group.model.getTabGroups()){var e,t;const s=this._chipRenderers.get(i.id);s==null||(t=(e=s.chip).update)===null||t===void 0||t.call(e,{tabGroup:i})}this._updateTabGroupClasses()}positionAllChips(){if(this._chipRenderers.size!==0)for(const e of this._ctx.group.model.getTabGroups())this._positionChipForGroup(e)}updateDirection(){const e=this._ctx.getDirection()==="vertical";for(const[,t]of this._chipRenderers)t.dropTarget.setTargetZones(e?["top"]:["left"])}snapshotChipWidths(){const e=new Map;for(const[t,i]of this._chipRenderers)e.set(t,i.chip.element.getBoundingClientRect().width);return e}positionUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.positionUnderlines()}trackUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.trackUnderlines()}setGroupDragImage(e,t,i){if(!e.dataTransfer)return;const s=this._ctx.getDirection()==="vertical",r=this._ctx.tabsList.cloneNode(!0);s?(r.classList.remove("dv-tabs-container-vertical","dv-vertical"),r.classList.add("dv-horizontal"),r.style.writingMode="horizontal-tb",r.style.height=`${this._ctx.tabsList.offsetWidth}px`):r.style.height=`${this._ctx.tabsList.offsetHeight}px`,r.style.width="auto",r.style.overflow="visible",r.style.pointerEvents="none";const n=Array.from(r.children),o=Array.from(this._ctx.tabsList.children);for(let f=n.length-1;f>=0;f--)o[f]!==i&&n[f].remove();const a=document.createElement("div");a.className="dv-groupview dv-active-group",a.style.position="fixed",a.style.top="-10000px",a.style.left="0px",a.style.height="auto",a.style.width="auto",a.style.pointerEvents="none";const l=document.createElement("div");l.className="dv-tabs-and-actions-container",l.style.height="auto",l.style.width="auto",a.appendChild(l),l.appendChild(r),this._ctx.accessor.element.appendChild(a);const h=r.querySelector(".dv-tab-group-chip"),d=i.getBoundingClientRect(),u=e.clientX-d.left,p=e.clientY-d.top;if(h){const f=h.getBoundingClientRect(),m=a.getBoundingClientRect(),g=f.left-m.left+u,_=f.top-m.top+p;e.dataTransfer.setDragImage(a,g,_)}else e.dataTransfer.setDragImage(a,u,p);requestAnimationFrame(()=>{a.remove()})}cleanupTransition(e){var t;(t=this._pendingTransitionCleanups.get(e))===null||t===void 0||t(),this._pendingTransitionCleanups.delete(e)}updateDragAndDropState(){const e=Gt(this._ctx.accessor.options);for(const r of this._chipRenderers.values()){var t,i,s;r.chip.element.draggable=e.html5,(t=r.html5DragSource)===null||t===void 0||t.setDisabled(!e.html5),(i=r.pointerDragSource)===null||i===void 0||i.setDisabled(!e.pointer),(s=r.pointerDragSource)===null||s===void 0||s.setTouchOnly(!e.pointerHandlesMouse)}}disposeChipDrag(e){var t;const i=this._chipRenderers.get(e);i&&((t=i.dragSourcesDisposable)===null||t===void 0||t.dispose(),i.html5DragSource=void 0,i.pointerDragSource=void 0,i.dragSourcesDisposable=void 0)}_buildChipGhostElement(e){const t=getComputedStyle(e),i=e.cloneNode(!0);return Array.from(t).forEach(s=>{i.style.setProperty(s,t.getPropertyValue(s),t.getPropertyPriority(s))}),i.style.position="absolute",i}disposeAll(){var e;(e=this._indicator)===null||e===void 0||e.dispose(),this._indicator=null;for(const[,i]of this._pendingTransitionCleanups)i();this._pendingTransitionCleanups.clear();for(const[,i]of this._chipRenderers){var t;i.chip.element.remove(),i.chip.dispose(),(t=i.dragSourcesDisposable)===null||t===void 0||t.dispose(),i.disposable.dispose()}this._chipRenderers.clear()}_ensureIndicator(){var e,t,i;const s=((e=(t=this._ctx.accessor.options.theme)===null||t===void 0?void 0:t.tabGroupIndicator)!==null&&e!==void 0?e:"wrap")==="none"?mb:fb;this._indicator&&!(this._indicator instanceof s)&&(this._indicator.dispose(),this._indicator=null),(i=this._indicator)!==null&&i!==void 0||(this._indicator=new s({tabsList:this._ctx.tabsList,getTabGroups:()=>this._ctx.group.model.getTabGroups(),getActivePanelId:()=>{var r;return(r=this._ctx.group.activePanel)===null||r===void 0?void 0:r.id},getTabMap:()=>this._ctx.getTabMap(),getChipElement:r=>{var n;return(n=this._chipRenderers.get(r))===null||n===void 0?void 0:n.chip.element},getDirection:()=>this._ctx.getDirection(),getHeaderPosition:()=>this._ctx.group.model.headerPosition,getColorPalette:()=>this._ctx.accessor.tabGroupColorPalette}))}_createChipDragSources(e,t){const i=Gt(this._ctx.accessor.options);e.element.draggable=i.html5;const s=di.getInstance(),r=()=>(s.setData([new Et(this._ctx.accessor.id,this._ctx.group.id,null,t.id)],Et.prototype),{dispose:()=>{s.clearData(Et.prototype)}}),n=Ii.createDragSource(e.element,{getData:r,disabled:!i.html5,isCancelled:()=>!Gt(this._ctx.accessor.options).html5,onDragStart:l=>{"dataTransfer"in l&&l.dataTransfer&&this.setGroupDragImage(l,t,e.element),this._callbacks.onChipDragStart(t,e,l)},onDragEnd:l=>{var h,d;(h=(d=this._callbacks).onChipDragEnd)===null||h===void 0||h.call(d,t,e,l)}}),o=()=>{s.clearData(Et.prototype)};e.element.addEventListener("dragend",o,{once:!0});const a=ci.createDragSource(e.element,{getData:r,disabled:!i.pointer,touchOnly:!i.pointerHandlesMouse,isCancelled:()=>!Gt(this._ctx.accessor.options).pointer,createGhost:()=>({element:this._buildChipGhostElement(e.element),offsetX:8,offsetY:8}),onDragStart:l=>{this._callbacks.onChipDragStart(t,e,l)}});return{html5DragSource:n,pointerDragSource:a,disposable:{dispose:()=>{n.dispose(),a.dispose(),e.element.removeEventListener("dragend",o)}}}}_ensureChipForGroup(e){const t=this._chipRenderers.get(e.id);if(t){if(!t.html5DragSource){const d=this._createChipDragSources(t.chip,e);t.html5DragSource=d.html5DragSource,t.pointerDragSource=d.pointerDragSource,t.dragSourcesDisposable=d.disposable}return}const i=this._ctx.accessor.options.createTabGroupChipComponent,s=i?i(e):new ql(this._ctx.accessor.tabGroupColorPalette);s.init({tabGroup:e,api:this._ctx.accessor.api});const r=this._createChipDragSources(s,e),n=[e.onDidChange(()=>{var d;(d=s.update)===null||d===void 0||d.call(s,{tabGroup:e}),this._updateTabGroupClasses()}),e.onDidPanelChange(()=>{this._positionChipForGroup(e),this._updateTabGroupClasses()}),e.onDidCollapseChange(()=>{this._updateTabGroupClasses()})],o=d=>{var u;(u=this._chipRenderers.get(e.id))===null||u===void 0||(u=u.pointerDragSource)===null||u===void 0||u.cancelPending(),this._callbacks.onChipContextMenu(e,d)};s instanceof ql?n.push(s.onContextMenu(o)):n.push(new Ga(s.element,{onLongPress:o}),J(s.element,"contextmenu",o));const a=this._ctx.getDirection()==="vertical",l=new an(s.element,{acceptedTargetZones:a?["top"]:["left"],overlayModel:{activationSize:{value:100,type:"percentage"}},canDisplayOverlay:(d,u)=>{if(this._ctx.group.locked||this._ctx.accessor.options.disableDnd)return!1;const p=Te();if(this._ctx.accessor.id===p?.viewId){var f;return((f=this._ctx.accessor.options.theme)===null||f===void 0?void 0:f.tabAnimation)!=="smooth"}return this._ctx.group.model.canDisplayOverlay(d,u,"tab")}});n.push(l,l.onDrop(d=>{this._callbacks.onChipDrop(e,d)}));const h=new ee(...n);this._chipRenderers.set(e.id,{chip:s,html5DragSource:r.html5DragSource,pointerDragSource:r.pointerDragSource,dragSourcesDisposable:r.disposable,disposable:h,dropTarget:l}),e.collapsed&&(this._skipNextCollapseAnimation=!0)}_positionChipForGroup(e){const t=this._chipRenderers.get(e.id);if(!t)return;const i=t.chip.element,s=e.panelIds;if(s.length===0){i.remove();return}const r=s[0],n=this._ctx.getTabMap().get(r);if(!n){i.remove();return}const o=n.value.element;i.nextSibling!==o&&this._ctx.tabsList.insertBefore(i,o)}_updateTabGroupClasses(){const e=this._ctx.group.model.getTabGroups(),t=this._ctx.getTabs(),i=this._ctx.getTabMap();let s=!1;const r=new Map;for(const a of e)for(const l of a.panelIds)r.set(l,a);for(const a of t){const l=a.value,h=l.panel.id,d=r.get(h),u=!!d;if(K(l.element,"dv-tab--grouped",u),d){const p=d.panelIds,f=p[0]===h,m=p[p.length-1]===h;K(l.element,"dv-tab--group-first",f),K(l.element,"dv-tab--group-last",m),Ba(l.element,d.color,this._ctx.accessor.tabGroupColorPalette);const g=l.element.classList.contains("dv-tab--group-collapsed");if(!d.collapsed&&g){var n;s=!0,l.element.classList.remove("dv-tab--group-collapsed"),l.element.classList.add("dv-tab--group-expanding"),(n=this._pendingTransitionCleanups.get(h))===null||n===void 0||n();const _=()=>{l.element.classList.remove("dv-tab--group-expanding"),l.element.style.removeProperty("width"),l.element.removeEventListener("transitionend",_),clearTimeout(A),this._pendingTransitionCleanups.delete(h)},A=setTimeout(_,300);this._pendingTransitionCleanups.set(h,_),l.element.addEventListener("transitionend",_)}}else K(l.element,"dv-tab--group-first",!1),K(l.element,"dv-tab--group-last",!1),l.element.classList.remove("dv-tab--group-collapsed","dv-tab--group-expanding"),l.element.style.removeProperty("width"),l.element.style.removeProperty("--dv-tab-group-color")}const o=new Set;for(const a of e)if(o.add(a.id),a.collapsed&&a.panelIds.some(l=>{const h=i.get(l);return h&&!h.value.element.classList.contains("dv-tab--group-collapsed")}))if(this._skipNextCollapseAnimation){const l=[];for(const h of a.panelIds){const d=i.get(h);d&&(d.value.element.style.transition="none",d.value.element.classList.add("dv-tab--group-collapsed"),l.push(d.value.element))}if(l.length>0){l[0].offsetHeight;for(const h of l)h.style.removeProperty("transition")}}else{s=!0;const l=this._ctx.getDirection()==="vertical";for(const h of a.panelIds){const d=i.get(h);if(d&&!d.value.element.classList.contains("dv-tab--group-collapsed")){const u=d.value.element.getBoundingClientRect();l?d.value.element.style.height=`${u.height}px`:d.value.element.style.width=`${u.width}px`,d.value.element.offsetHeight,d.value.element.classList.add("dv-tab--group-collapsed")}}}this._skipNextCollapseAnimation=!1,this._ensureIndicator(),this._indicator&&(this._indicator.syncUnderlineElements(o),s?this._indicator.trackUnderlines():this._indicator.positionUnderlines())}},_b=class extends ee{get _tabs(){return this.host.tabItems}get _tabMap(){return this.host.tabMap}get _tabsList(){return this.host.tabsList}get _direction(){return this.host.direction}get group(){return this.host.groupPanel}get accessor(){return this.host.component}get _tabGroupManager(){return this.host.tabGroupManager}get _wrapMode(){return this._tabsList.classList.contains(nu)}get animState(){return this._animState}set animState(e){this._animState=e}get pendingCollapse(){return this._pendingCollapse}set pendingCollapse(e){this._pendingCollapse=e}set voidContainerElement(e){this._voidContainer=e}constructor(e){super(),this.host=e,this._animState=null,this._pendingMarginCleanups=new Map,this._pendingCollapse=!1,this._flipTransitionCleanup=null,this._voidContainer=null,this._extendedDropZone=null,this._pointerInsideTabsList=!1,this._wrapIndicatorEl=null,this.addDisposables({dispose:()=>{var t;(t=this._flipTransitionCleanup)===null||t===void 0||t.call(this)}})}setExtendedDropZone(e){this._extendedDropZone=e}setExternalInsertionIndex(e){this._animState&&e!==this._animState.currentInsertionIndex&&(this._animState.currentInsertionIndex=e,this.applyDragOverTransforms())}clearExternalAnimState(){this._animState&&(this.resetTabTransforms(),this._animState.sourceIndex===-1?this._animState=null:this._animState.currentInsertionIndex=null)}snapshotTabPositions(){const e=new Map;for(const t of this._tabs)e.set(t.value.panel.id,t.value.element.getBoundingClientRect());return e}getAverageTabWidth(){if(this._tabs.length===0)return 0;const e=this._direction==="vertical";let t=0;for(const i of this._tabs){const s=i.value.element.getBoundingClientRect();t+=e?s.height:s.width}return t/this._tabs.length}handlePointerDragMove(e,t){var i;const s=((i=this._tabsList.ownerDocument)!==null&&i!==void 0?i:document).elementFromPoint(e,t);if(!(s&&(this._tabsList.contains(s)||this._extendedDropZone&&this._extendedDropZone.contains(s)))){this._pointerInsideTabsList&&(this._pointerInsideTabsList=!1,this.processDragLeave(s));return}this._pointerInsideTabsList=!0,this.processDragOver(e,t)}handlePointerDragEnd(e){e&&this._animState&&this._animState.sourceIndex!==-1&&!this._animState.sourceTabGroupId&&this._animState.currentInsertionIndex!==null&&this.isPointInsideTabsList(e.clientX,e.clientY)&&this.commitPointerReorder(e.pointerEvent),this._pointerInsideTabsList=!1,this.resetDragAnimation()}isPointInsideTabsList(e,t){var i;const s=((i=this._tabsList.ownerDocument)!==null&&i!==void 0?i:document).elementFromPoint(e,t);return!!s&&this._tabsList.contains(s)}commitPointerReorder(e){const t=this._animState;if(t?.currentInsertionIndex==null)return;const i=t.currentInsertionIndex,s=t.sourceIndex,r=i-(s!==-1&&s<i?1:0);this._animState=null,this.clearWrapDropIndicator(),this.uncollapseSourceTab(t.sourceTabId),r!==s&&this.host.fireDrop({event:e,index:r,targetTabGroupId:null})}processDragOver(e,t){if(this.accessor.options.disableDnd||(this._dropStaleAnimState(),!this._animState&&!this._initAnimStateForExternalDrag()))return!1;if(this._animState.sourceIndex!==-1){var i;(i=this.group.model.dropTargetContainer)===null||i===void 0||(i=i.model)===null||i===void 0||i.clear()}return this.handleDragOver({clientX:e,clientY:t}),!0}_dropStaleAnimState(){if(!this._animState)return;const e=Te();e?.tabGroupId&&e.groupId!==this.group.id&&this._animState.sourceTabGroupId!==e.tabGroupId&&(this._animState=null)}_initAnimStateForExternalDrag(){var e;const t=Te();if(((e=this.accessor.options.theme)===null||e===void 0?void 0:e.tabAnimation)==="default"&&!t?.tabGroupId||!t||!(t.panelId||t.tabGroupId)||t.groupId===this.group.id)return!1;const i=this.getAverageTabWidth();return this._animState=t.tabGroupId?this._makeGroupDragAnimState(t,i):this._makeTabDragAnimState(t,i),!0}_makeGroupDragAnimState(e,t){var i;const s=this.accessor.getPanel(e.groupId),r=s?.model.getTabGroups().find(o=>o.id===e.tabGroupId),n=t*((i=r?.panelIds.length)!==null&&i!==void 0?i:1)+t;return{sourceTabId:"",sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.tabGroupId,sourceGroupPanelIds:r?new Set(r.panelIds):new Set,sourceChipWidth:t,cursorOffsetFromDragLeft:n/2,sourceGapWidth:n,containerLeft:this._tabsList.getBoundingClientRect().left}}_makeTabDragAnimState(e,t){return{sourceTabId:e.panelId,sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:t/2,sourceGapWidth:t,containerLeft:this._tabsList.getBoundingClientRect().left}}processDragLeave(e){var t;if(this._animState&&!(e&&this._tabsList.contains(e))){if(e&&(!((t=this._extendedDropZone)===null||t===void 0)&&t.contains(e))){this.resetTabTransforms(),this._animState.currentInsertionIndex=null;return}if(!(this._voidContainer&&e&&(e===this._voidContainer||this._voidContainer.contains(e))))if(this.resetTabTransforms(),this._animState.sourceIndex===-1){var i;(i=this.group.model.dropTargetContainer)===null||i===void 0||(i=i.model)===null||i===void 0||i.clear(),this._animState=null}else this._animState.currentInsertionIndex=null}}handleDragOver(e){var t;if(!this._animState)return;if(this._wrapMode&&!this._animState.sourceTabGroupId){var i;this.handleWrappedDragOver(e.clientX,(i=e.clientY)!==null&&i!==void 0?i:0);return}const s=e.clientX,r=this._buildFirstPanelToGroupMap();let n=this._computeDragOverInsertionIndex(s,r),o=null;if(n!==null&&this._tabGroupManager.chipRenderers.size>0){const a=this._resolveInsertionAgainstTabGroups(s,n,r);n=a.insertionIndex,o=a.targetTabGroupId}n===this._animState.currentInsertionIndex&&o===this._animState.targetTabGroupId||(this._animState.currentInsertionIndex=n,this._animState.targetTabGroupId=o,((t=this.accessor.options.theme)===null||t===void 0?void 0:t.tabAnimation)==="smooth"&&this.applyDragOverTransforms())}_buildFirstPanelToGroupMap(){const e=new Map;if(this._tabGroupManager.chipRenderers.size===0)return e;for(const t of this.group.model.getTabGroups())t.id!==this._animState.sourceTabGroupId&&t.panelIds.length>0&&e.set(t.panelIds[0],t.id);return e}_computeDragOverInsertionIndex(e,t){const i=this._animState,s=i.sourceGroupPanelIds,r=e-i.cursorOffsetFromDragLeft-i.containerLeft;let n=0,o=null;for(let d=0;d<this._tabs.length;d++){const u=this._tabs[d].value;if(u.panel.id===i.sourceTabId||s?.has(u.panel.id))continue;const p=t.get(u.panel.id);if(p){var a;const g=(a=i.chipPositions.get(p))!==null&&a!==void 0?a:0;if(n+g>r){var l;(l=o)!==null&&l!==void 0||(o=d);break}n+=g}const f=i.tabPositions.get(u.panel.id),m=f?f.width:u.element.getBoundingClientRect().width;if(n+m/2<=r)n+=m,o=d+1;else{var h;(h=o)!==null&&h!==void 0||(o=d);break}}return o}_accumulatedWidthUpTo(e,t){const i=this._animState,s=i.sourceGroupPanelIds;let r=0;for(let o=0;o<this._tabs.length;o++){const a=this._tabs[o].value;if(a.panel.id===i.sourceTabId||s?.has(a.panel.id))continue;if(o>=e)break;const l=t.get(a.panel.id);if(l){var n;r+=(n=i.chipPositions.get(l))!==null&&n!==void 0?n:0}const h=i.tabPositions.get(a.panel.id);r+=h?h.width:a.element.getBoundingClientRect().width}return r}_resolveInsertionAgainstTabGroups(e,t,i){const s=!!this._animState.sourceTabGroupId,r=this._accumulatedWidthUpTo(t,i);for(const n of this.group.model.getTabGroups()){const o=this._evaluateTabGroupForInsertion(n,e,t,r,s);if(o)return o}return{insertionIndex:t,targetTabGroupId:null}}_evaluateTabGroupForInsertion(e,t,i,s,r){const n=this._resolveGroupRange(e);if(!n)return null;const{firstIdx:o,lastIdx:a}=n,l=i>=o&&i<=a,h=!l&&i===o-1;return!l&&!h?null:r?this._resolveGroupDragTarget(i,o,a,l):this._resolveTabDragTarget(e,t,i,s,o,h)}_resolveGroupRange(e){const t=this._animState,i=t.sourceGroupPanelIds,s=e.panelIds.filter(o=>o!==t.sourceTabId&&!i?.has(o));if(s.length===0)return null;const r=this._tabs.findIndex(o=>o.value.panel.id===s[0]),n=this._tabs.findIndex(o=>o.value.panel.id===s[s.length-1]);return r===-1||n===-1?null:{firstIdx:r,lastIdx:n}}_resolveGroupDragTarget(e,t,i,s){return s?{insertionIndex:e<(t+i+1)/2?t:i+1,targetTabGroupId:null}:{insertionIndex:e,targetTabGroupId:null}}_resolveTabDragTarget(e,t,i,s,r,n){var o;const a=this._animState,l=(o=a.chipPositions.get(e.id))!==null&&o!==void 0?o:0;if(n)return this._onlySourceBetween(i,r)?t>=(e.collapsed?a.containerLeft+s+l/2:a.containerLeft+s+l)?{insertionIndex:r,targetTabGroupId:e.id}:{insertionIndex:i,targetTabGroupId:null}:null;const h=a.containerLeft+s+l;return i===r?{insertionIndex:i,targetTabGroupId:t>=h?e.id:null}:{insertionIndex:i,targetTabGroupId:e.id}}_onlySourceBetween(e,t){const i=this._animState;for(let r=e;r<t;r++){var s;const n=this._tabs[r].value.panel.id;if(n!==i.sourceTabId&&!(!((s=i.sourceGroupPanelIds)===null||s===void 0)&&s.has(n)))return!1}return!0}handleWrappedDragOver(e,t){if(!this._animState)return;const i=this.computeWrappedInsertionIndex(e,t);i===this._animState.currentInsertionIndex&&this._animState.targetTabGroupId===null||(this._animState.currentInsertionIndex=i,this._animState.targetTabGroupId=null,this.updateWrapDropIndicator(i))}computeWrappedInsertionIndex(e,t){var i;const s=this._direction==="vertical",r=this._wrappedDragEntries();if(r.length===0)return this._tabs.length;const n=s?e:t,o=s?t:e,a=f=>s?f.left:f.top,l=f=>s?f.right:f.bottom,h=f=>s?f.top:f.left,d=f=>s?f.height:f.width,u=this._bucketWrappedLines(r,a,l),p=[...((i=u.find(f=>n>=f.start&&n<=f.end))!==null&&i!==void 0?i:this._nearestWrappedLine(u,n)).items].sort((f,m)=>h(f.rect)-h(m.rect));for(const f of p)if(o<h(f.rect)+d(f.rect)/2)return f.index;return p[p.length-1].index+1}_wrappedDragEntries(){var e,t;const i=(e=this._animState)===null||e===void 0?void 0:e.sourceTabId,s=(t=this._animState)===null||t===void 0?void 0:t.sourceGroupPanelIds,r=[];for(let n=0;n<this._tabs.length;n++){const o=this._tabs[n].value;o.panel.id!==i&&(s?.has(o.panel.id)||r.push({index:n,rect:o.element.getBoundingClientRect()}))}return r}_bucketWrappedLines(e,t,i){const s=[];for(const r of e){const n=t(r.rect),o=s.find(a=>Math.abs(a.start-n)<=2);o?(o.items.push(r),o.end=Math.max(o.end,i(r.rect))):s.push({start:n,end:i(r.rect),items:[r]})}return s.sort((r,n)=>r.start-n.start),s}_nearestWrappedLine(e,t){const i=s=>t<s.start?s.start-t:t-s.end;return e.reduce((s,r)=>i(r)<i(s)?r:s,e[0])}updateWrapDropIndicator(e){var t;this.clearWrapDropIndicator();const i=this._tabs.length;if(i===0)return;const s=(t=this._animState)===null||t===void 0?void 0:t.sourceTabId;if(e<i){const r=this._tabs[e].value.element;if(this._tabs[e].value.panel.id===s)return;r.classList.add("dv-tab--reorder-before"),this._wrapIndicatorEl=r}else{const r=this._tabs[i-1].value.element;r.classList.add("dv-tab--reorder-after"),this._wrapIndicatorEl=r}}clearWrapDropIndicator(){var e;(e=this._wrapIndicatorEl)===null||e===void 0||e.classList.remove("dv-tab--reorder-before","dv-tab--reorder-after"),this._wrapIndicatorEl=null}_removeClassInstantlyBatch(e,t){const i=[];for(const s of e)s.classList.contains(t)&&(s.style.transition="none",K(s,t,!1),i.push(s));if(i.length>0){i[0].getBoundingClientRect();for(const s of i)s.style.removeProperty("transition")}}uncollapseSourceTab(e){const t=this._tabMap.get(e);t&&this._removeClassInstantlyBatch([t.value.element],"dv-tab--dragging")}applyDragOverTransforms(e=!1){var t;if(this._wrapMode)return;if(((t=this._animState)===null||t===void 0?void 0:t.currentInsertionIndex)==null){this.resetTabTransforms();return}if(this._pendingCollapse)return;const i=this._animState.currentInsertionIndex,s=this._computeGapWidth(),r=this._computeChipToShift(i);this._applyGapMargins(i,s,r,e)}_computeGapWidth(){const e=this._animState;if(e.sourceTabGroupId&&e.sourceGroupPanelIds)return e.sourceGapWidth;const t=e.tabPositions.get(e.sourceTabId);return t?t.width:this.getAverageTabWidth()}_computeChipToShift(e){if(this._tabGroupManager.chipRenderers.size===0)return null;for(const t of this.group.model.getTabGroups()){const i=this._chipToShiftForGroup(t,e);if(i!==void 0)return i}return null}_chipToShiftForGroup(e,t){const i=this._animState;if(e.id===i.sourceTabGroupId||e.panelIds.includes(i.sourceTabId))return;const s=e.panelIds.filter(n=>{var o;return n!==i.sourceTabId&&!(!((o=i.sourceGroupPanelIds)===null||o===void 0)&&o.has(n))});if(s.length===0)return;const r=this._tabs.findIndex(n=>n.value.panel.id===s[0]);if((!i.targetTabGroupId||i.targetTabGroupId===e.id&&e.collapsed)&&!(r<t)){if(this._onlySourceBetween(t,r)){const n=this._tabGroupManager.chipRenderers.get(e.id);if(n)return n.chip.element}return null}}_applyGapMargins(e,t,i,s){const r=this._animState,n=r.sourceGroupPanelIds;let o=!1;for(const[a,l]of this._tabGroupManager.chipRenderers)a!==r.sourceTabGroupId&&this._clearMargin(l.chip.element,s);i&&(this._setMargin(i,`${t}px`,s),o=!0);for(let a=0;a<this._tabs.length;a++){const l=this._tabs[a].value;l.panel.id!==r.sourceTabId&&(n?.has(l.panel.id)||(!o&&a>=e?(this._setMargin(l.element,`${t}px`,s),o=!0):this._clearMargin(l.element,s)))}this._tabGroupManager.trackUnderlines()}_shiftingClass(e){return e.classList.contains("dv-tab-group-chip")?"dv-tab-group-chip--shifting":"dv-tab--shifting"}_setMargin(e,t,i){i?(e.style.transition="none",e.style.marginLeft=t,e.getBoundingClientRect(),e.style.removeProperty("transition")):e.style.marginLeft=t,K(e,this._shiftingClass(e),!0)}_clearMargin(e,t){const i=this._shiftingClass(e),s=this._pendingMarginCleanups.get(e);if(s&&s(),t||!e.style.marginLeft)e.style.removeProperty("margin-left"),K(e,i,!1);else{e.style.marginLeft="0px",K(e,i,!0);const r=()=>{e.style.removeProperty("margin-left"),K(e,i,!1),e.removeEventListener("transitionend",r),clearTimeout(n),this._pendingMarginCleanups.delete(e)},n=setTimeout(r,300);this._pendingMarginCleanups.set(e,r),e.addEventListener("transitionend",r)}}resetTabTransforms(){this.clearWrapDropIndicator();for(const[,e]of this._pendingMarginCleanups)e();this._pendingMarginCleanups.clear();for(const e of this._tabs)e.value.element.style.removeProperty("margin-left"),e.value.element.style.removeProperty("margin-right"),e.value.element.style.removeProperty("margin-top"),e.value.element.style.removeProperty("margin-bottom"),e.value.element.style.removeProperty("transform"),K(e.value.element,"dv-tab--shifting",!1);for(const[,e]of this._tabGroupManager.chipRenderers)e.chip.element.style.removeProperty("margin-left"),K(e.chip.element,"dv-tab-group-chip--shifting",!1);this._tabGroupManager.positionUnderlines()}commitGroupMove(e,t){const i=Te();if(this._tabGroupManager.disposeChipDrag(e),this.group.model.getTabGroups().some(n=>n.id===e)){var s;if(((s=this.accessor.options.theme)===null||s===void 0?void 0:s.tabAnimation)==="smooth"){this._clearGroupDragClasses(e);const n=this.snapshotTabPositions();this.resetTabTransforms(),this.group.model.moveTabGroup(e,t),this.runFlipAnimation(n,"",!1)}else this._tabGroupManager.skipNextCollapseAnimation=!0,this.group.model.moveTabGroup(e,t)}else if(i){var r;this.resetTabTransforms(),this.accessor.moveGroupOrPanel({from:{groupId:i.groupId,tabGroupId:(r=i.tabGroupId)!==null&&r!==void 0?r:e},to:{group:this.group,position:"center",index:t}})}}_clearGroupDragClasses(e){const t=this._tabGroupManager.chipRenderers.get(e);t&&this._removeClassInstantlyBatch([t.chip.element],"dv-tab-group-chip--dragging"),this._removeClassInstantlyBatch(this._tabs.map(s=>s.value.element),"dv-tab--dragging");const i=this._tabGroupManager.groupUnderlines.get(e);i&&i.style.removeProperty("display"),this._tabGroupManager.skipNextCollapseAnimation=!0}resetDragAnimation(){if(this._pendingCollapse=!1,this._animState){this.resetTabTransforms(),this._animState.sourceTabGroupId?this._clearGroupDragClasses(this._animState.sourceTabGroupId):this._removeClassInstantlyBatch(this._tabs.map(e=>e.value.element),"dv-tab--dragging"),this._animState=null;for(const[,e]of this._tabGroupManager.groupUnderlines)e.style.removeProperty("display")}}runFlipAnimation(e,t,i=!1,s){if(this._wrapMode)return;let r=!1;for(let n=0;n<this._tabs.length;n++)this._applyFlipTransform(this._tabs[n],n,t,i,e,s)&&(r=!0);r&&this._scheduleFlipReset()}_applyFlipTransform(e,t,i,s,r,n){const o=this._direction==="vertical",a=e.value.panel.id;if(a===i){if(!s)return!1;const u=e.value.element.getBoundingClientRect();return e.value.element.style.transform=o?`translateY(${u.height}px)`:`translateX(${u.width}px)`,K(e.value.element,"dv-tab--shifting",!0),!0}if(n!==void 0&&(t<n.from||t>n.to))return!1;const l=r.get(a);if(!l)return!1;const h=e.value.element.getBoundingClientRect(),d=o?l.top-h.top:l.left-h.left;return Math.abs(d)<1?!1:(e.value.element.style.transform=o?`translateY(${d}px)`:`translateX(${d}px)`,K(e.value.element,"dv-tab--shifting",!0),!0)}_scheduleFlipReset(){requestAnimationFrame(()=>{var e;for(const s of this._tabs)s.value.element.style.transform&&(s.value.element.style.transform="");this._tabGroupManager.trackUnderlines(),(e=this._flipTransitionCleanup)===null||e===void 0||e.call(this);const t=s=>{if(s.propertyName==="transform"){i();for(const r of this._tabs)K(r.value.element,"dv-tab--shifting",!1);this._tabGroupManager.positionUnderlines()}},i=()=>{this._tabsList.removeEventListener("transitionend",t),this._flipTransitionCleanup=null};this._flipTransitionCleanup=i,this._tabsList.addEventListener("transitionend",t)})}},bb=class extends ee{get _animState(){return this._reorder.animState}set _animState(e){this._reorder.animState=e}get _pendingCollapse(){return this._reorder.pendingCollapse}set _pendingCollapse(e){this._reorder.pendingCollapse=e}get tabItems(){return this._tabs}get tabMap(){return this._tabMap}get tabsList(){return this._tabsList}get groupPanel(){return this.group}get component(){return this.accessor}get tabGroupManager(){return this._tabGroupManager}fireDrop(e){this._onDrop.fire(e)}setOverflowExclude(e){this._overflowExclude=e,this.refreshOverflow()}setForcedOverflow(e){this._forcedOverflow=e,this.refreshOverflow()}refreshOverflow(){this._showTabsOverflowControl&&this.toggleDropdown({reset:!1}),this._applyPinnedSticky()}setPinnedSticky(e){this._pinnedSticky!==e&&(this._pinnedSticky=e,this._applyPinnedSticky())}_applyPinnedSticky(){const e=this._pinnedSticky?this._tabs.filter(i=>this._overflowExclude(i.value.panel.id)):[];if(e.length===0&&!this._hasPinnedStickyStyling)return;for(const i of this._tabs){const s=i.value.element;s.classList.contains("dv-tab--pinned-sticky")&&(s.classList.remove("dv-tab--pinned-sticky"),s.style.removeProperty("--dv-pinned-sticky-left"))}if(e.length===0){this._hasPinnedStickyStyling=!1;return}const t=e.map(i=>i.value.element.offsetLeft);e.forEach((i,s)=>{const r=i.value.element;r.classList.add("dv-tab--pinned-sticky"),r.style.setProperty("--dv-pinned-sticky-left",`${t[s]}px`)}),this._hasPinnedStickyStyling=!0}get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e)if(this._showTabsOverflowControl=e,e){const t=new o_(this._tabsList);this._observerDisposable.value=new ee(t,t.onDidChange(i=>{const s=i.hasScrollX||i.hasScrollY;this.toggleDropdown({reset:!s}),this._applyPinnedSticky(),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}),J(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1}),this._applyPinnedSticky(),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}))}else this._observerDisposable.value=be.NONE}get element(){return this._element}get tabsListElement(){return this._tabsList}set voidContainer(e){var t;(t=this._voidContainerListeners)===null||t===void 0||t.dispose(),this._voidContainerListeners=null,this._reorder.voidContainerElement=e,e&&(this._voidContainerListeners=new ee(J(e,"dragover",i=>{this._animState&&i.preventDefault()}),J(e,"drop",i=>{var s;!((s=this._animState)===null||s===void 0)&&s.sourceTabGroupId&&this._animState.currentInsertionIndex!==null&&(i.preventDefault(),i.stopPropagation(),this.handleVoidDrop())})))}handleVoidDrop(){var e,t;if(!(!((e=this._animState)===null||e===void 0)&&e.sourceTabGroupId))return!1;const i=this._animState.sourceTabGroupId,s=(t=this._animState.currentInsertionIndex)!==null&&t!==void 0?t:this._tabs.length;return this._animState=null,this._commitGroupMove(i,s),!0}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}get direction(){return this._direction}set direction(e){if(this._direction!==e){this._direction=e,this._tabsList.setAttribute("aria-orientation",e==="vertical"?"vertical":"horizontal"),this._scrollbar&&(this._scrollbar.orientation=e),zt(this._tabsList,"dv-horizontal","dv-vertical"),e==="vertical"?Bt(this._tabsList,"dv-tabs-container-vertical","dv-vertical"):(zt(this._tabsList,"dv-tabs-container-vertical"),Bt(this._tabsList,"dv-horizontal"));for(const t of this._tabs)t.value.setDirection(e);this._tabGroupManager.updateDirection()}}constructor(e,t,i){super(),this.group=e,this.accessor=t,this._observerDisposable=new ze,this._pointerActivation=new ze,this._scrollbar=null,this._tabs=[],this._tabMap=new Map,this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._overflowExclude=()=>!1,this._forcedOverflow=()=>!1,this._pinnedSticky=!1,this._hasPinnedStickyStyling=!1,this._direction="horizontal",this._voidContainerListeners=null,this._onTabDragStart=new O,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new O,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new O,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new O,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container",this._tabsList.setAttribute("role","tablist"),this._tabsList.setAttribute("aria-orientation",this._direction==="vertical"?"vertical":"horizontal"),this.showTabsOverflowControl=i.showTabsOverflowControl,t.options.scrollbars==="native"?this._element=this._tabsList:(this._scrollbar=new su(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this._tabGroupManager=new vb({group:this.group,accessor:this.accessor,tabsList:this._tabsList,getTabs:()=>this._tabs,getTabMap:()=>this._tabMap,getDirection:()=>this._direction},{onChipContextMenu:(s,r)=>{var n;(n=this.accessor.contextMenuService)===null||n===void 0||n.showForChip(s,this.group,r)},onChipDragStart:(s,r,n)=>{this._handleChipDragStart(s,r,n)},onChipDragEnd:()=>{this._reorder.resetDragAnimation()},onChipDrop:(s,r)=>{this._handleChipDrop(s,r)}}),this._reorder=new _b(this),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._pointerActivation,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,this._reorder,Or.getInstance().onDragEnd(s=>{this._reorder.handlePointerDragEnd(s)}),Or.getInstance().onDragMove(s=>{this._reorder.handlePointerDragMove(s.clientX,s.clientY)}),J(this.element,"pointerdown",s=>{s.defaultPrevented||s.button===0&&this.accessor.doSetGroupActive(this.group)}),J(this._tabsList,"wheel",s=>{const r=this._direction==="vertical",n=r?s.deltaY||s.deltaX:s.deltaX||s.deltaY;if(n===0)return;const o=r?this._tabsList.scrollHeight-this._tabsList.clientHeight:this._tabsList.scrollWidth-this._tabsList.clientWidth;if(o<=0)return;const a=r?this._tabsList.scrollTop:this._tabsList.scrollLeft;n<0&&a<=0||n>0&&a>=o||(s.preventDefault(),s.stopPropagation(),r?this._tabsList.scrollTop=a+n:this._tabsList.scrollLeft=a+n)},{passive:!1}),J(this._tabsList,"keydown",s=>{this._onKeyDown(s)}),J(this._tabsList,"dragover",s=>{this._reorder.processDragOver(s.clientX,s.clientY)&&s.preventDefault()},!0),J(this._tabsList,"dragleave",s=>{this._reorder.processDragLeave(s.relatedTarget)},!0),J(this._tabsList,"dragend",()=>{this._reorder.resetDragAnimation()}),J(this._tabsList,"drop",s=>{var r,n,o;if(((r=this._animState)===null||r===void 0?void 0:r.currentInsertionIndex)==null||((n=this.accessor.options.theme)===null||n===void 0?void 0:n.tabAnimation)!=="smooth"&&!this._animState.sourceTabGroupId)return;s.stopPropagation(),s.preventDefault(),(o=this.group.model.dropTargetContainer)===null||o===void 0||(o=o.model)===null||o===void 0||o.clear();const a=this._animState;if(this._animState=null,this._pendingCollapse=!1,a.sourceTabGroupId){this._commitGroupMove(a.sourceTabGroupId,a.currentInsertionIndex);return}const l=a.currentInsertionIndex,h=a.sourceIndex,d=l-(h!==-1&&h<l?1:0),u=this.group.model.getTabGroupForPanel(a.sourceTabId);if(d===h&&!a.targetTabGroupId&&!u){this._reorder.uncollapseSourceTab(a.sourceTabId),this.resetTabTransforms();return}this._reorder.uncollapseSourceTab(a.sourceTabId);const p=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:s,index:d,targetTabGroupId:a.targetTabGroupId}),this.runFlipAnimation(p,a.sourceTabId,a.sourceIndex===-1,{from:Math.min(h,d),to:Math.max(h,d)})},!0),be.from(()=>{var s;(s=this._voidContainerListeners)===null||s===void 0||s.dispose(),this._reorder.resetDragAnimation(),this._tabGroupManager.disposeAll();for(const{value:r,disposable:n}of this._tabs)n.dispose(),r.dispose();this._tabs=[],this._tabMap.clear()}))}indexOf(e){return this._tabs.findIndex(t=>t.value.panel.id===e)}getTabId(e){var t;return(t=this._tabMap.get(e))===null||t===void 0?void 0:t.value.element.id}getPanelForTab(e){for(const{value:t}of this._tabs)if(t.element===e||t.element.contains(e))return t.panel}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}_onKeyDown(e){const t=this._tabs.findIndex(o=>o.value.element===e.target);if(t===-1)return;const i=this._direction==="vertical",s=i?"ArrowDown":"ArrowRight",r=i?"ArrowUp":"ArrowLeft",n=this._tabs.length-1;switch(e.key){case s:e.preventDefault(),this._focusTab(Math.min(t+1,n));break;case r:e.preventDefault(),this._focusTab(Math.max(t-1,0));break;case"Home":e.preventDefault(),this._focusTab(0);break;case"End":e.preventDefault(),this._focusTab(n);break;case"Enter":case" ":e.preventDefault(),this.accessor.withOrigin("user",()=>this._tabs[t].value.panel.api.setActive());break;case"Delete":case"Backspace":e.preventDefault(),this._closeTab(t);break}}_closeTab(e){var t,i,s,r,n;const o=(t=this._tabs[e])===null||t===void 0?void 0:t.value;if(!o)return;const a=(i=(s=(r=this._tabs[e+1])===null||r===void 0?void 0:r.value)!==null&&s!==void 0?s:(n=this._tabs[e-1])===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.panel.id;if(o.panel.api.close(),a!==void 0){const l=this._tabs.findIndex(h=>h.value.panel.id===a);l>-1&&this._focusTab(l)}}_focusTab(e){for(let t=0;t<this._tabs.length;t++)this._tabs[t].value.element.tabIndex=t===e?0:-1;this._tabs[e].value.element.focus()}focusActiveTab(){var e;if(this._tabs.length===0)return;const t=(e=this.group.activePanel)===null||e===void 0?void 0:e.id,i=t?this._tabs.findIndex(s=>s.value.panel.id===t):-1;this._focusTab(i>-1?i:0)}setActivePanel(e){const t=this._direction==="vertical";for(const i of this._tabs){const s=e.id===i.value.panel.id;i.value.setActive(s),s&&this._scrollTabIntoView(i.value.element,t)}this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}_scrollTabIntoView(e,t){const i=e.parentElement;if(!i)return;const s=t?e.offsetTop:e.offsetLeft,r=t?e.offsetHeight:e.offsetWidth,n=t?i.scrollTop:i.scrollLeft,o=t?i.clientHeight:i.clientWidth;(s<n||s+r>n+o)&&(t?i.scrollTop=s:i.scrollLeft=s)}_activateOnPointerDown(e){if(!Gt(this.accessor.options).html5){this.group.model.openPanel(e);return}const t=requestAnimationFrame(()=>{this._tabMap.has(e.id)&&this.group.model.openPanel(e)});this._pointerActivation.value={dispose:()=>cancelAnimationFrame(t)}}openPanel(e,t=this._tabs.length){if(this._tabMap.has(e.id))return;const i=new ob(e,this.accessor,this.group);i.setContent(e.view.tab),this._direction!=="horizontal"&&i.setDirection(this._direction);const s={value:i,disposable:new ee(i.onDragStart(r=>{var n;if(this._onTabDragStart.fire({nativeEvent:r,panel:e}),((n=this.accessor.options.theme)===null||n===void 0?void 0:n.tabAnimation)==="smooth"){const o=i.element.getBoundingClientRect().width,a=this._tabs.findIndex(l=>l.value===i);this._animState={sourceTabId:e.id,sourceIndex:a,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:o/2,sourceGapWidth:o,containerLeft:this._tabsList.getBoundingClientRect().left},this._pendingCollapse=!0,requestAnimationFrame(()=>{var l,h;this._pendingCollapse=!1,this._animState&&(this._tabsList.classList.contains("dv-tabs-container--wrap")||(i.element.style.transition="none",K(i.element,"dv-tab--dragging",!0),i.element.offsetHeight),(h=(l=this._animState).currentInsertionIndex)!==null&&h!==void 0||(l.currentInsertionIndex=a),this.applyDragOverTransforms(!0),i.element.style.removeProperty("transition"))})}}),i.onTabClick(r=>{r.defaultPrevented||this.group.api.location.type==="edge"&&(this.group.activePanel===e?this.group.api.isCollapsed()?this.group.api.expand():this.group.api.collapse():(this.group.model.openPanel(e),this.group.api.isCollapsed()&&this.group.api.expand()))}),i.onPointerDown(r=>{if(r.defaultPrevented)return;const n=!this.accessor.options.disableFloatingGroups,o=this.group.api.location.type==="floating"&&this.size===1;if(n&&!o&&r.shiftKey){r.preventDefault();const a=this.accessor.getGroupPanel(i.panel.id),{top:l,left:h}=i.element.getBoundingClientRect(),{top:d,left:u}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(a,{x:h-u,y:l-d,inDragMode:!0});return}r.button===0&&this.group.api.location.type!=="edge"&&this.group.activePanel!==e&&this._activateOnPointerDown(e)}),i.onDrop(r=>{const n=this._animState;this._animState=null,this._pendingCollapse=!1;const o=this._tabs.findIndex(u=>u.value===i);if(n){var a;const u=r.position==="right"?o+1:o;if(n.sourceTabGroupId){var l;this._commitGroupMove(n.sourceTabGroupId,(l=n.currentInsertionIndex)!==null&&l!==void 0?l:u);return}this._reorder.uncollapseSourceTab(n.sourceTabId);const p=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:r.nativeEvent,index:u,targetTabGroupId:n.targetTabGroupId}),((a=this.accessor.options.theme)===null||a===void 0?void 0:a.tabAnimation)==="smooth"&&this.runFlipAnimation(p,n.sourceTabId,n.sourceIndex===-1,n.sourceIndex===-1?void 0:{from:Math.min(n.sourceIndex,u),to:Math.max(n.sourceIndex,u)})}else{var h,d;const u=this._direction==="vertical"?"bottom":"right",p=r.position===u?o+1:o,f=Te(),m=f?this._tabs.findIndex(A=>A.value.panel.id===f.panelId):-1,g=p-(m!==-1&&m<p?1:0),_=(h=(d=this.group.model.getTabGroupForPanel(i.panel.id))===null||d===void 0?void 0:d.id)!==null&&h!==void 0?h:null;this._onDrop.fire({event:r.nativeEvent,index:g,targetTabGroupId:_})}}),i.onWillShowOverlay(r=>{this._onWillShowOverlay.fire(new Vs(r,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Te}))}))};this.addTab(s,t),this._tabGroupManager.positionAllChips(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}delete(e){var t;((t=this._animState)===null||t===void 0?void 0:t.sourceTabId)===e&&(this.resetTabTransforms(),this._animState=null),this._tabGroupManager.cleanupTransition(e);const i=this.indexOf(e),s=this._tabs.splice(i,1)[0];if(this._tabMap.delete(e),s){const{value:r,disposable:n}=s;n.dispose(),r.dispose(),r.element.remove()}this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw new Error("invalid location");const i=t<this._tabs.length?this._tabs[t].value.element:null;this._tabsList.insertBefore(e.value.element,i),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this._tabMap.set(e.value.panel.id,e),this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){const t=this._tabs.some(o=>!this._overflowExclude(o.value.panel.id)&&this._forcedOverflow(o.value.panel.id));if(e.reset&&!t){this._onOverflowTabsChange.fire({tabs:[],tabGroups:[],pinnedTabs:[],reset:!0});return}const i=this._tabs.filter(o=>!this._overflowExclude(o.value.panel.id)&&(this._forcedOverflow(o.value.panel.id)||!e.reset&&!wn(o.value.element,this._tabsList))).map(o=>o.value.panel.id),s=e.reset?[]:this._tabs.filter(o=>this._overflowExclude(o.value.panel.id)&&o.value.element.getBoundingClientRect().width>0&&!wn(o.value.element,this._tabsList)).map(o=>o.value.panel.id),r=new Set(i),n=[];for(const o of this.group.model.getTabGroups()){const a=this._tabGroupManager.chipRenderers.get(o.id),l=a&&!wn(a.chip.element,this._tabsList),h=o.panelIds.length>0&&o.panelIds.every(d=>r.has(d));if((l||h)&&(n.push(o.id),o.collapsed))for(const d of o.panelIds)r.has(d)||(r.add(d),i.push(d))}this._onOverflowTabsChange.fire({tabs:i,tabGroups:n,pinnedTabs:s,reset:!1})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState();this._tabGroupManager.updateDragAndDropState()}updateTabGroups(){this._tabGroupManager.update()}refreshTabGroupAccent(){this._tabGroupManager.refreshAccents()}_handleChipDragStart(e,t,i){var s;const r=e.panelIds[0],n=r?this._tabs.findIndex(h=>h.value.panel.id===r):-1,o=t.element.getBoundingClientRect();let a=o.width;for(const h of e.panelIds){const d=this._tabMap.get(h);d&&(a+=d.value.element.getBoundingClientRect().width)}if(this._animState={sourceTabId:"",sourceIndex:n,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.id,sourceGroupPanelIds:new Set(e.panelIds),sourceChipWidth:o.width,cursorOffsetFromDragLeft:i.clientX-o.left,sourceGapWidth:a,containerLeft:this._tabsList.getBoundingClientRect().left},((s=this.accessor.options.theme)===null||s===void 0?void 0:s.tabAnimation)!=="smooth")return;const l=new Set(e.panelIds);this._pendingCollapse=!0,requestAnimationFrame(()=>{var h,d;if(this._pendingCollapse=!1,!this._animState)return;for(const f of this._tabs)l.has(f.value.panel.id)&&(f.value.element.style.transition="none",K(f.value.element,"dv-tab--dragging",!0));const u=this._tabGroupManager.chipRenderers.get(e.id);u&&(u.chip.element.style.transition="none",K(u.chip.element,"dv-tab-group-chip--dragging",!0)),this._tabsList.offsetHeight;const p=this._tabGroupManager.groupUnderlines.get(e.id);p&&(p.style.display="none"),(d=(h=this._animState).currentInsertionIndex)!==null&&d!==void 0||(h.currentInsertionIndex=n),this.applyDragOverTransforms(!0);for(const f of this._tabs)l.has(f.value.panel.id)&&f.value.element.style.removeProperty("transition");u&&u.chip.element.style.removeProperty("transition")})}_handleChipDrop(e,t){const i=e.panelIds[0];if(!i)return;const s=this._tabs.findIndex(a=>a.value.panel.id===i);if(s===-1)return;const r=Te(),n=r?.groupId===this.group.id&&r?.panelId?this._tabs.findIndex(a=>a.value.panel.id===r.panelId):-1,o=s-(n!==-1&&n<s?1:0);this._onDrop.fire({event:t.nativeEvent,index:o,targetTabGroupId:null})}setExtendedDropZone(e){this._reorder.setExtendedDropZone(e)}setExternalInsertionIndex(e){this._reorder.setExternalInsertionIndex(e)}clearExternalAnimState(){this._reorder.clearExternalAnimState()}snapshotTabPositions(){return this._reorder.snapshotTabPositions()}handleDragOver(e){this._reorder.handleDragOver(e)}applyDragOverTransforms(e=!1){this._reorder.applyDragOverTransforms(e)}resetTabTransforms(){this._reorder.resetTabTransforms()}_commitGroupMove(e,t){this._reorder.commitGroupMove(e,t)}runFlipAnimation(e,t,i=!1,s){this._reorder.runFlipAnimation(e,t,i,s)}};function wb(){const e=document.createElement("div");e.className="dv-tabs-overflow-dropdown-default";const t=document.createElement("span");t.textContent="";const i=tu();return e.appendChild(i),e.appendChild(t),{element:e,update:s=>{t.textContent=`${s.tabs}`}}}var Sb=class extends ee{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get direction(){return this._direction}set direction(e){this._direction=e,e==="vertical"?(Bt(this._element,"dv-groupview-header-vertical"),Bt(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e):(zt(this._element,"dv-groupview-header-vertical"),zt(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e)}get element(){return this._element}get tabsListElement(){return this.tabs.tabsListElement}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction="horizontal",this._dropIndexResolver=(i,s)=>s,this._pinnedRow=void 0,this.dropdownPart=null,this._overflowTabs=[],this._overflowTabGroups=[],this._overflowPinnedTabs=[],this._dropdownDisposable=new ze,this._onDrop=new O,this.onDrop=this._onDrop.event,this._onGroupDragStart=new O,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new O,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",K(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new bb(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new ab(this.accessor,this.group),this.tabs.voidContainer=this.voidContainer.element,this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.tabs.setExtendedDropZone(this._element),this.addDisposables(this.tabs.onDrop(i=>this._onDrop.fire(i)),this.tabs.onWillShowOverlay(i=>this._onWillShowOverlay.fire(i)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(i=>{this.toggleDropdown(i)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(i=>{this._onGroupDragStart.fire({nativeEvent:i,group:this.group})}),this.voidContainer.onDrop(i=>{this.tabs.handleVoidDrop()||this._onDrop.fire({event:i.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(i=>{this._onWillShowOverlay.fire(new Vs(i,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Te}))}),J(this.leftActionsContainer,"dragleave",i=>{const s=i.relatedTarget;!this.leftActionsContainer.contains(s)&&!this._element.contains(s)&&this.tabs.clearExternalAnimState()}),J(this.voidContainer.element,"dragleave",i=>{const s=i.relatedTarget;this.voidContainer.element.contains(s)||(this._element.contains(s)?this.tabs.setExternalInsertionIndex(null):this.tabs.clearExternalAnimState())}),J(this.voidContainer.element,"pointerdown",i=>{if(!i.defaultPrevented&&!this.accessor.options.disableFloatingGroups&&i.shiftKey&&this.group.api.location.type!=="floating"&&this.group.api.location.type!=="edge"){i.preventDefault();const{top:s,left:r}=this.element.getBoundingClientRect(),{top:n,left:o}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:r-o+20,y:s-n+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}getTabId(e){return this.tabs.getTabId(e)}getPanelForTab(e){return this.tabs.getPanelForTab(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}focusActiveTab(){this.tabs.focusActiveTab()}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}setOverflowExclude(e){this.tabs.setOverflowExclude(e)}setForcedOverflow(e){this.tabs.setForcedOverflow(e)}setPinnedSticky(e){this.tabs.setPinnedSticky(e)}refreshOverflow(){this.tabs.refreshOverflow()}setPinnedRow(e){this._pinnedRow!==e&&(this._pinnedRow&&this._pinnedRow.remove(),this._pinnedRow=e,e&&(e.classList.add("dv-pinned-row"),this._element.insertBefore(e,this._element.firstChild)),K(this._element,"dv-tabs-and-actions-container--pinned-row",!!e))}setDropIndexResolver(e){this._dropIndexResolver=e}resolveDropIndex(e,t){return this._dropIndexResolver(e,t)}updateClassnames(){K(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const t=e.reset?[]:e.tabs,i=e.reset?[]:e.tabGroups,s=e.reset?[]:e.pinnedTabs;this._overflowTabs=t,this._overflowTabGroups=i,this._overflowPinnedTabs=s;const r=this._overflowTabs.length+this._overflowPinnedTabs.length;if(r>0&&this.dropdownPart){this.dropdownPart.update({tabs:r});return}if(r===0){this._dropdownDisposable.dispose();return}const n=document.createElement("div");n.className="dv-tabs-overflow-dropdown-root";const o=wb();o.update({tabs:r}),this.dropdownPart=o,n.appendChild(o.element),this.rightActionsContainer.prepend(n),this._dropdownDisposable.value=new ee(be.from(()=>{var a,l;n.remove(),(a=this.dropdownPart)===null||a===void 0||(l=a.dispose)===null||l===void 0||l.call(a),this.dropdownPart=null}),J(n,"pointerdown",a=>{a.preventDefault()},{capture:!0}),J(n,"click",a=>{const l=m_(n),h={x:a.clientX,y:a.clientY,zIndex:l?.style.zIndex?`calc(${l.style.zIndex} * 2)`:void 0},d=this.createOverflowRenderContext(n,h),u=this.accessor.advancedOverflowService;u?u.renderOverflow({group:this.group,overflowTabs:[...this._overflowTabs],overflowTabGroups:[...this._overflowTabGroups],pinnedOverflowTabs:[...this._overflowPinnedTabs],context:d}):d.open(this.renderFreeOverflowList(d))}))}createOverflowRenderContext(e,t){const i=new Set(this._overflowTabGroups),s=this.group.model.getTabGroups(),r=new Map,n=new Map;for(const l of s)if(n.set(l.id,l),i.has(l.id))for(const h of l.panelIds)r.set(h,l);const o=()=>this.accessor.getPopupServiceForGroup(this.group),a=l=>{const h=document.createElement("div");h.className="dv-tabs-overflow-group-header";const d=document.createElement("span");d.className="dv-tabs-overflow-group-color",Ba(d,l.color,this.accessor.tabGroupColorPalette),h.appendChild(d);const u=document.createElement("span");if(u.className="dv-tabs-overflow-group-label",u.textContent=l.label||l.id,h.appendChild(u),l.collapsed){const p=document.createElement("span");p.className="dv-tabs-overflow-group-collapsed-badge",p.textContent=`${l.panelIds.length}`,h.appendChild(p)}return h.addEventListener("click",()=>{o().close(),l.collapsed&&l.expand();const p=l.panelIds[0];if(p){const f=this.group.panels.find(m=>m.id===p);this.accessor.withOrigin("user",()=>f?.api.setActive())}}),h};return{overflowGroupIdForPanel:l=>{var h;return(h=r.get(l))===null||h===void 0?void 0:h.id},buildGroupHeader:l=>{const h=n.get(l);if(!(!h||!i.has(h.id)))return a(h)},buildPinnedHeader:()=>{const l=document.createElement("div");l.className="dv-tabs-overflow-group-header dv-tabs-overflow-pinned-header";const h=eu();h.classList.add("dv-tabs-overflow-pinned-icon"),l.appendChild(h);const d=document.createElement("span");return d.className="dv-tabs-overflow-group-label",d.textContent="Pinned",l.appendChild(d),l},buildRow:l=>{const h=this.group.panels.find(g=>g.id===l);if(!h)return;const d=this.tabs.tabs.find(g=>g.panel.id===l),u=r.get(l),p=h.view.createTabRenderer("headerOverflow").element,f=document.createElement("div");K(f,"dv-tab",!0),K(f,"dv-active-tab",h.api.isActive),K(f,"dv-inactive-tab",!h.api.isActive),u&&K(f,"dv-tab--grouped",!0);const m=()=>{u?.collapsed&&u.expand(),d?.element.scrollIntoView({block:"nearest",inline:"nearest"}),this.accessor.withOrigin("user",()=>h.api.setActive())};return f.addEventListener("click",g=>{o().close(),!g.defaultPrevented&&m()}),f.appendChild(p),{element:f,panel:h,activate:()=>{o().close(),m()}}},open:l=>{o().openPopover(l,t)},close:()=>o().close(),focusTrigger:()=>{e.tabIndex=-1,e.focus()}}}renderFreeOverflowList(e){const t=document.createElement("div");t.style.overflow="auto",t.className="dv-tabs-overflow-container";const i=this._overflowPinnedTabs.map(r=>e.buildRow(r)).filter(r=>r!=null);if(i.length>0){t.appendChild(e.buildPinnedHeader());for(const r of i)t.appendChild(r.element)}const s=new Set;for(const r of this.tabs.tabs.filter(n=>this._overflowTabs.includes(n.panel.id))){const n=e.overflowGroupIdForPanel(r.panel.id);if(n&&!s.has(n)){s.add(n);const a=e.buildGroupHeader(n);a&&t.appendChild(a)}const o=e.buildRow(r.panel.id);o&&t.appendChild(o.element)}return t}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}updateTabGroups(){this.tabs.updateTabGroups()}refreshTabGroupAccent(){this.tabs.refreshTabGroupAccent()}},yb=class extends ee{get label(){return this._label}get color(){return this._color}get componentParams(){return this._componentParams}setLabel(e){this.isDisposed||this._label===e||(this._label=e,this._onDidChange.fire())}setColor(e){if(this.isDisposed)return;const t=e===""?void 0:e;this._color!==t&&(this._color=t,this._onDidChange.fire())}setComponentParams(e){this.isDisposed||(this._componentParams=e,this._onDidChange.fire())}get collapsed(){return this._collapsed}get panelIds(){return this._panelIds}get size(){return this._panelIds.length}get isEmpty(){return this._panelIds.length===0}constructor(e,t){var i,s;super(),this.id=e,this._collapsed=!1,this._panelIds=[],this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._onDidPanelChange=new O,this.onDidPanelChange=this._onDidPanelChange.event,this._onDidCollapseChange=new O,this.onDidCollapseChange=this._onDidCollapseChange.event,this._onDidDestroy=new O,this.onDidDestroy=this._onDidDestroy.event,this._label=(i=t?.label)!==null&&i!==void 0?i:"",this._color=t?.color===""?void 0:t?.color,this._collapsed=(s=t?.collapsed)!==null&&s!==void 0?s:!1,this._componentParams=t?.componentParams,this.addDisposables(this._onDidChange,this._onDidPanelChange,this._onDidCollapseChange,this._onDidDestroy)}addPanel(e,t){if(this.isDisposed||this._panelIds.includes(e))return;const i=t===void 0?this._panelIds.length:Math.max(0,Math.min(t,this._panelIds.length));this._panelIds.splice(i,0,e),this._onDidPanelChange.fire({panelId:e,type:"add"})}removePanel(e){if(this.isDisposed)return!1;const t=this._panelIds.indexOf(e);return t===-1?!1:(this._panelIds.splice(t,1),this._onDidPanelChange.fire({panelId:e,type:"remove"}),!0)}indexOfPanel(e){return this._panelIds.indexOf(e)}containsPanel(e){return this._panelIds.includes(e)}collapse(){this.isDisposed||this._collapsed||(this._collapsed=!0,this._onDidCollapseChange.fire(!0))}expand(){this.isDisposed||!this._collapsed||(this._collapsed=!1,this._onDidCollapseChange.fire(!1))}toggle(){this._collapsed?this.expand():this.collapse()}toJSON(){const e={id:this.id,collapsed:this._collapsed,panelIds:[...this._panelIds]};return this._label&&(e.label=this._label),this._color!==void 0&&(e.color=this._color),this._componentParams!==void 0&&(e.componentParams=this._componentParams),e}dispose(){this._onDidDestroy.fire(),super.dispose()}},Ha=class extends Ra{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}},du=class extends Ha{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}},xb=class extends ee{get tabGroups(){return this._tabGroups}get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get contentContainerId(){return this.contentContainer.element.id}get contentDropTarget(){return this.contentContainer.dropTarget}get locked(){return this._locked}set locked(e){this._locked=e,K(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get tabsListElement(){return this.tabsContainer.tabsListElement}getPanelForTab(e){return this.tabsContainer.getPanelForTab(e)}get isContentFocused(){return document.activeElement?eo(document.activeElement,this.contentContainer.element):!1}get headerPosition(){var e;return(e=this._headerPosition)!==null&&e!==void 0?e:"top"}set headerPosition(e){var t;this._headerPosition=e,this.invalidateHeaderSize(),zt(this.container,"dv-groupview-header-top","dv-groupview-header-bottom","dv-groupview-header-left","dv-groupview-header-right"),Bt(this.container,`dv-groupview-header-${e}`);const i=e==="top"||e==="bottom"?"horizontal":"vertical",s=this._headerDirection;if(this._headerDirection=i,this.tabsContainer.direction=i,this.header.direction=i,!((t=this._activePanel)===null||t===void 0)&&t.layout){const{width:n,height:o}=this.contentDimensions();this._activePanel.layout(n,o)}if(this.updateHeaderActions(),s!==void 0&&s!==i){var r;(r=this.groupPanel)===null||r===void 0||r.api._onDidHeaderDirectionChange.fire({direction:i,position:e})}}get location(){return this._location}set location(e){this._location=e,K(this.container,"dv-groupview-floating",!1),K(this.container,"dv-groupview-popout",!1),K(this.container,"dv-groupview-edge",!1);const t=i=>{this.contentContainer.dropTarget.setTargetZones(i),this.contentContainer.pointerDropTarget.setTargetZones(i)};switch(e.type){case"grid":t(["top","bottom","left","right","center"]);break;case"floating":t(["top","bottom","left","right","center"]),K(this.container,"dv-groupview-floating",!0);break;case"popout":t(["top","bottom","left","right","center"]),K(this.container,"dv-groupview-popout",!0);break;case"edge":t(["center"]),K(this.container,"dv-groupview-edge",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,i,s,r){var n,o;super(),this.container=e,this.accessor=t,this.id=i,this.options=s,this.groupPanel=r,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._tabGroupDisposables=new Map,this._pendingMicrotaskDisposables=new Set,this._onMove=new O,this.onMove=this._onMove.event,this._onDidDrop=new O,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new O,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new O,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new O,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new O,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new O,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new O,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new O,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new O,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new O,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOver=new O,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this._tabGroups=[],this._tabGroupMap=new Map,this._panelToTabGroup=new Map,this._tabGroupIdCounter=0,this._pendingTabGroupUpdate=!1,this._onDidCreateTabGroup=new O,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new O,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new O,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new O,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new O,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new O,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,K(this.container,"dv-groupview",!0),this.container.setAttribute("role","region"),this._api=new Na(this.accessor),this.tabsContainer=new Sb(this.accessor,this.groupPanel),this.contentContainer=new Z_(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!s.hideHeader,this.locked=(n=s.locked)!==null&&n!==void 0?n:!1,this.headerPosition=(o=s.headerPosition)!==null&&o!==void 0?o:t.defaultHeaderPosition,this.addDisposables(Yi(this.tabsContainer.element,()=>{if(this.isDisposed)return;const a=this.measureHeaderSize();a!==this._cachedHeaderSize&&(this._cachedHeaderSize=a,this.layout(this._width,this._height))}),this._onDidPanelTitleChange.event(()=>this.updateAccessibleLabel()),this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(a=>{this._onTabDragStart.fire(a)}),this.tabsContainer.onGroupDragStart(a=>{this._onGroupDragStart.fire(a)}),this.tabsContainer.onDrop(a=>{var l;const h=Te(),d=(l=h?.panelId)!==null&&l!==void 0?l:null,u=d?this.tabsContainer.resolveDropIndex(d,a.index):a.index;if(this.handleDropEvent("header",a.event,"center",u),d&&a.targetTabGroupId){const p=this._tabGroupMap.get(a.targetTabGroupId);let f;if(p){const m=this._panels.findIndex(g=>g.id===d);if(m!==-1){f=0;for(const g of p.panelIds)this._panels.findIndex(_=>_.id===g)<m&&f++}}this.addPanelToTabGroup(a.targetTabGroupId,d,f)}else d&&a.targetTabGroupId===null&&this.removePanelFromTabGroup(d)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(a=>{this.handleDropEvent("content",a.nativeEvent,a.position,void 0,a.edge)}),this.contentContainer.pointerDropTarget.onDrop(a=>{this.handleDropEvent("content",a.nativeEvent,a.position,void 0,a.edge)}),this.tabsContainer.onWillShowOverlay(a=>{this._onWillShowOverlay.fire(a)}),this.contentContainer.dropTarget.onWillShowOverlay(a=>{this._onWillShowOverlay.fire(new Vs(a,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Te}))}),this.contentContainer.pointerDropTarget.onWillShowOverlay(a=>{this._onWillShowOverlay.fire(new Vs(a,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Te}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOver,this._onDidPanelTitleChange,this._onDidPanelParametersChange,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,this._onDidCreateTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidDestroyTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidAddPanelToTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidRemovePanelFromTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupChange.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupCollapsedChange.event(()=>{this._scheduleTabGroupUpdate()}))}_scheduleTabGroupUpdate(){this._pendingTabGroupUpdate||(this._pendingTabGroupUpdate=!0,queueMicrotask(()=>{this._pendingTabGroupUpdate=!1,this.isDisposed||this.tabsContainer.updateTabGroups()}))}_bracketTabGroupMutation(e){return this.accessor.mutation?this.accessor.mutation("tab-group",e):e()}createTabGroup(e){return this._bracketTabGroupMutation(()=>this._doCreateTabGroup(e))}_doCreateTabGroup(e){var t;const i=(t=e?.id)!==null&&t!==void 0?t:`tg-${this.id}-${this._tabGroupIdCounter++}`,s=new yb(i,{label:e?.label,color:e?.color,collapsed:e?.collapsed,componentParams:e?.componentParams});return this._tabGroups.push(s),this._tabGroupMap.set(i,s),this._tabGroupDisposables.set(i,new ee(s.onDidChange(()=>{this._onDidTabGroupChange.fire({tabGroup:s})}),s.onDidCollapseChange(r=>{r?this._handleGroupCollapse(s):this._handleGroupExpand(s),this._onDidTabGroupCollapsedChange.fire({tabGroup:s})}),s.onDidDestroy(()=>{this._removeTabGroupInternal(s)}))),this._onDidCreateTabGroup.fire({tabGroup:s}),s}dissolveTabGroup(e){const t=this._tabGroupMap.get(e);t&&this._bracketTabGroupMutation(()=>{const i=[...t.panelIds];for(const s of i)t.removePanel(s),this._panelToTabGroup.delete(s),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:s});t.dispose()})}addPanelToTabGroup(e,t,i){const s=this._tabGroupMap.get(e);if(!s||!this._panels.some(n=>n.id===t))return;const r=this.getTabGroupForPanel(t);r?.id!==e&&this._bracketTabGroupMutation(()=>{r&&this.removePanelFromTabGroup(t),s.addPanel(t,i),this._panelToTabGroup.set(t,s),this._enforceContiguity(s,t),this._onDidAddPanelToTabGroup.fire({tabGroup:s,panelId:t})})}movePanelWithinGroup(e,t,i){const s=this._tabGroupMap.get(e);s?.containsPanel(t)&&(s.removePanel(t),s.addPanel(t,i),this._enforceContiguity(s,t),this.tabsContainer.updateTabGroups())}movePanelBetweenGroups(e,t,i){const s=this._findTabGroupForPanel(e),r=this._tabGroupMap.get(t);r&&(s&&(s.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:s,panelId:e}),s.isEmpty&&s.dispose()),r.addPanel(e,i),this._panelToTabGroup.set(e,r),this._enforceContiguity(r,e),this._onDidAddPanelToTabGroup.fire({tabGroup:r,panelId:e}))}moveTabGroup(e,t){const i=this._tabGroupMap.get(e);if(!i||i.panelIds.length===0)return;const s=new Set(i.panelIds),r=i.panelIds.map(l=>this._panels.find(h=>h.id===l)).filter(l=>l!==void 0);if(r.length===0)return;let n=0;for(let l=0;l<Math.min(t,this._panels.length);l++)s.has(this._panels[l].id)&&n++;for(const l of r){const h=this._panels.indexOf(l);h!==-1&&this._panels.splice(h,1)}const o=t-n,a=Math.max(0,Math.min(o,this._panels.length));this._panels.splice(a,0,...r);for(const l of this._panels)this.tabsContainer.delete(l.id);for(let l=0;l<this._panels.length;l++)this.tabsContainer.openPanel(this._panels[l],l);this.tabsContainer.updateTabGroups()}_enforceContiguity(e,t){const i=this._panels.find(a=>a.id===t);if(!i)return;const s=e.indexOfPanel(t),r=this._computeGlobalIndex(e,s),n=this._panels.indexOf(i);if(n===r)return;this._panels.splice(n,1);const o=r>n?r-1:r;this._panels.splice(o,0,i),this.tabsContainer.delete(t),this.tabsContainer.openPanel(i,o)}_computeGlobalIndex(e,t){const i=e.panelIds;if(i.length<=1){const s=this._panels.find(r=>r.id===i[0]);return s?this._panels.indexOf(s):this._panels.length}for(let s=0;s<i.length;s++){if(s===t)continue;const r=this._panels.find(n=>n.id===i[s]);if(r){const n=this._panels.indexOf(r);return Math.max(0,n+(t-s))}}return this._panels.length}removePanelFromTabGroup(e){const t=this._findTabGroupForPanel(e);t&&this._bracketTabGroupMutation(()=>{t.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:e}),t.isEmpty&&t.dispose()})}getTabGroups(){return this._tabGroups}updateTabGroups(){this.tabsContainer.updateTabGroups()}refreshTabGroupAccent(){this.tabsContainer.refreshTabGroupAccent()}refreshWatermark(){if(this.watermark){var e,t;this.watermark.element.remove(),(e=(t=this.watermark).dispose)===null||e===void 0||e.call(t),this.watermark=void 0}this.updateContainer()}getTabGroupForPanel(e){return this._findTabGroupForPanel(e)}_findTabGroupForPanel(e){return this._panelToTabGroup.get(e)}_removeTabGroupInternal(e){const t=this._tabGroups.indexOf(e);if(t!==-1){this._tabGroups.splice(t,1),this._tabGroupMap.delete(e.id);for(const s of e.panelIds)this._panelToTabGroup.delete(s);this._onDidDestroyTabGroup.fire({tabGroup:e});const i=this._tabGroupDisposables.get(e.id);this._tabGroupDisposables.delete(e.id),i&&(this._pendingMicrotaskDisposables.add(i),queueMicrotask(()=>{this._pendingMicrotaskDisposables.delete(i),i.dispose()}))}}_handleGroupCollapse(e){if(!this._activePanel||!e.containsPanel(this._activePanel.id))return;const t=this._panels.indexOf(this._activePanel);for(let i=t+1;i<this._panels.length;i++){const s=this._panels[i],r=this._findTabGroupForPanel(s.id);if(!r?.collapsed){this.doSetActivePanel(s),this.updateContainer();return}}for(let i=t-1;i>=0;i--){const s=this._panels[i],r=this._findTabGroupForPanel(s.id);if(!r?.collapsed){this.doSetActivePanel(s),this.updateContainer();return}}this.contentContainer.closePanel(),this.doSetActivePanel(void 0),this.updateContainer()}_handleGroupExpand(e){if(this._activePanel)return;const t=e.panelIds[0];if(t){const i=this._panels.find(s=>s.id===t);i&&(this.doSetActivePanel(i),this.updateContainer())}}restoreTabGroups(e){for(const t of e){const i=/-(\d+)$/.exec(t.id);if(i){const s=Number.parseInt(i[1],10)+1;s>this._tabGroupIdCounter&&(this._tabGroupIdCounter=s)}}for(const t of e){const i=this.createTabGroup({id:t.id,label:t.label,color:t.color,componentParams:t.componentParams}),s=this._tabGroupMap.get(i.id);for(const r of t.panelIds)this._panels.some(n=>n.id===r)&&(i.addPanel(r),this._panelToTabGroup.set(r,s),this._enforceContiguity(s,r));t.collapsed&&i.collapse(),i.isEmpty&&i.dispose()}}focusContent(){this.contentContainer.element.focus()}focusActiveTab(){this.tabsContainer.focusActiveTab()}set renderContainer(e){if(this.panels.forEach(t=>{this.renderContainer.detatch(t)}),this._overwriteRenderContainer=e,this.panels.forEach(t=>{this.rerender(t)}),this._activePanel){this.contentContainer.renderPanel(this._activePanel,{asActive:!0});const{width:t,height:i}=this.contentDimensions();this._activePanel.layout(t,i)}}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return this._location.type==="floating"&&this.accessor.rootDropTargetContainer.disabled?this.accessor.floatingDropTargetContainer:(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){var e;(e=this.accessor.headerActionsService)===null||e===void 0||e.refresh(this.groupPanel)}attachHeaderAction(e,t){switch(e){case"left":this.tabsContainer.setLeftActionsElement(t);break;case"right":this.tabsContainer.setRightActionsElement(t);break;case"prefix":this.tabsContainer.setPrefixActionsElement(t);break}}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const t={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),this.headerPosition!=="top"&&(t.headerPosition=this.headerPosition),this._tabGroups.length>0&&(t.tabGroups=this._tabGroups.map(i=>i.toJSON())),t}moveToNext(e){var t,i,s;(t=e)!==null&&t!==void 0||(e={}),(s=(i=e).panel)!==null&&s!==void 0||(i.panel=this.activePanel);const r=e.panel?this.panels.indexOf(e.panel):-1;let n;if(r<this.panels.length-1)n=r+1;else{if(e.suppressRoll)return;n=0}this.openPanel(this.panels[n])}moveToPrevious(e){var t,i,s;if((t=e)!==null&&t!==void 0||(e={}),(s=(i=e).panel)!==null&&s!==void 0||(i.panel=this.activePanel),!e.panel)return;const r=this.panels.indexOf(e.panel);let n;if(r>0)n=r-1;else{if(e.suppressRoll)return;n=this.panels.length-1}this.openPanel(this.panels[n])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,t={}){(typeof t.index!="number"||t.index>this.panels.length)&&(t.index=this.panels.length);const i=!!t.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:i}),this.invalidateHeaderSize(),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}i||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()}removePanel(e,t){const i=typeof e=="string"?e:e.id,s=this._panels.find(r=>r.id===i);if(!s)throw new Error("invalid operation");return this._removePanel(s,t)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const t=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,t&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){if(!(!t&&this.isActive===e)){if(this._isGroupActive=e,K(this.container,"dv-active-group",e),K(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0){const i=this._panels.find(s=>{const r=this._findTabGroupForPanel(s.id);return!r?.collapsed});i&&this.doSetActivePanel(i)}this.updateContainer()}}layout(e,t){var i;this._width=e,this._height=t;const{width:s,height:r}=this.contentDimensions();this.contentContainer.layout(s,r),!((i=this._activePanel)===null||i===void 0)&&i.layout&&this._activePanel.layout(s,r)}relayout(){this.invalidateHeaderSize(),this.layout(this._width,this._height)}measureHeaderSize(){const e=this.tabsContainer.element;return this.headerPosition==="top"||this.headerPosition==="bottom"?e.offsetHeight:e.offsetWidth}invalidateHeaderSize(){this._cachedHeaderSize=void 0}contentDimensions(){var e;const t=this.headerPosition==="top"||this.headerPosition==="bottom",i=(e=this._cachedHeaderSize)!==null&&e!==void 0?e:this._cachedHeaderSize=this.measureHeaderSize();return{width:t?this._width:Math.max(0,this._width-i),height:t?Math.max(0,this._height-i):this._height}}_removePanel(e,t){const i=this._activePanel===e;if(this.doRemovePanel(e),this.invalidateHeaderSize(),i&&this.panels.length>0){const s=this.mostRecentlyUsed[0];this.openPanel(s,{skipSetActive:t?.skipSetActive,skipSetGroupActive:t?.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),t?.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){const s=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(s,1)}const i=this._panelDisposables.get(e.id);i&&(i.dispose(),this._panelDisposables.delete(e.id)),this.removePanelFromTabGroup(e.id),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,i){const s=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),i?.skipSetActive?e.api.renderer==="always"&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),!s&&(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new ee(e.api.onDidTitleChange(r=>this._onDidPanelTitleChange.fire(r)),e.api.onDidParametersChange(r=>this._onDidPanelParametersChange.fire(r)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){if(this._activePanel!==e){if(this._activePanel=e,e){var t,i,s;this.tabsContainer.setActivePanel(e),this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(e.id)),this.contentContainer.openPanel(e);const{width:r,height:n}=this.contentDimensions();e.layout(r,n),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e,origin:(t=(i=(s=this.accessor).currentOrigin)===null||i===void 0?void 0:i.call(s))!==null&&t!==void 0?t:"user"})}this.updateAccessibleLabel()}}updateAccessibleLabel(){var e;const t=(e=this._activePanel)===null||e===void 0?void 0:e.title;t?this.container.setAttribute("aria-label",t):this.container.removeAttribute("aria-label")}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){this.panels.forEach(s=>s.runEvents());const e=this.isEmpty||!this._activePanel;if(e&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,J(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}if(!e&&this.watermark){var t,i;this.watermark.element.remove(),(t=(i=this.watermark).dispose)===null||t===void 0||t.call(i),this.watermark=void 0}}canDisplayOverlay(e,t,i){const s=new ou(e,i,t,Te,this.accessor.getPanel(this.id));return this._onUnhandledDragOver.fire(s),s.isAccepted}canDisplayContentOverlay(e,t){if(this.locked==="no-drop-target"||this.locked&&t==="center")return!1;const i=Te();return!i&&e.shiftKey&&this.location.type!=="floating"?!1:i?.viewId===this.accessor.id?!0:this.canDisplayOverlay(e,t,"content")}handleDropEvent(e,t,i,s,r){if(this.locked==="no-drop-target")return;if(e==="content"&&r){this.accessor.dockToLayoutEdge(t,i);return}function n(){switch(e){case"header":return typeof s=="number"?"tab":"header_space";case"content":return"content"}}const o=typeof s=="number"?this.panels[s]:void 0,a=new du({nativeEvent:t,position:i,panel:o,getData:()=>Te(),kind:n(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(a),a.defaultPrevented)return;const l=Te();if(l?.viewId===this.accessor.id){if(e==="content"&&l.groupId===this.id&&(i==="center"||l.panelId===null&&!l.tabGroupId)||e==="header"&&l.groupId===this.id&&l.panelId===null&&!l.tabGroupId)return;if(l.panelId===null){const{groupId:u}=l;this._onMove.fire({target:i,groupId:u,index:s,tabGroupId:l.tabGroupId});return}if(this.tabsContainer.indexOf(l.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:h,panelId:d}=l;if(this.id===h&&!i&&this.tabsContainer.indexOf(d)===s)return;this._onMove.fire({target:i,groupId:l.groupId,itemId:l.panelId,index:s})}else this._onDidDrop.fire(new Ha({nativeEvent:t,position:i,panel:o,getData:()=>Te(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,i;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(t=this.watermark)===null||t===void 0||(i=t.dispose)===null||i===void 0||i.call(t),this.watermark=void 0;for(const s of[...this._tabGroups])s.dispose();for(const s of this._tabGroupDisposables.values())s.dispose();this._tabGroupDisposables.clear();for(const s of this._pendingMicrotaskDisposables)s.dispose();this._pendingMicrotaskDisposables.clear();for(const s of this.panels)s.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}},$a=class extends Zc{constructor(e,t,i){super(e,t),this._onDidConstraintsChangeInternal=new O,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new O,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new O,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),i&&this.initialize(i)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}},cu=class extends Oa{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,i,s){super(e,t,s??new $a(e,t)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new O,this.onDidChange=this._onDidChange.event,typeof i?.minimumWidth=="number"&&(this._minimumWidth=i.minimumWidth),typeof i?.maximumWidth=="number"&&(this._maximumWidth=i.maximumWidth),typeof i?.minimumHeight=="number"&&(this._minimumHeight=i.minimumHeight),typeof i?.maximumHeight=="number"&&(this._maximumHeight=i.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(r=>{const{isVisible:n}=r,{accessor:o}=this._params;o.setVisible(this,n)}),this.api.onActiveChange(()=>{const{accessor:r}=this._params;r.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(r=>{(typeof r.minimumWidth=="number"||typeof r.minimumWidth=="function")&&(this._minimumWidth=r.minimumWidth),(typeof r.minimumHeight=="number"||typeof r.minimumHeight=="function")&&(this._minimumHeight=r.minimumHeight),(typeof r.maximumWidth=="number"||typeof r.maximumWidth=="function")&&(this._maximumWidth=r.maximumWidth),(typeof r.maximumHeight=="number"||typeof r.maximumHeight=="function")&&(this._maximumHeight=r.maximumHeight),this._onDidChange.fire(void 0)}),this.api.onDidSizeChange(r=>{this._onDidChange.fire({height:r.height,width:r.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=s=>s===Number.MAX_SAFE_INTEGER?void 0:s,i=s=>s<=0?void 0:s;return te(te({},e),{},{minimumHeight:i(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:i(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}};const ti="dockview: DockviewGroupPanelApiImpl not initialized";var Cb=class extends $a{get location(){if(!this._group)throw new Error(ti);return this._group.model.location}get boundingBox(){if(!this._group||this._group.model.location.type==="popout")return;const e=this.accessor.element.getBoundingClientRect(),t=this._group.element.getBoundingClientRect();return{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}}get locked(){if(!this._group)throw new Error(ti);return this._group.locked}set locked(e){if(!this._group)throw new Error(ti);this._group.locked=e}constructor(e,t){super(e,"__dockviewgroup__"),this.accessor=t,this._onDidLocationChange=new O,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new O,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidCollapsedChange=new O,this.onDidCollapsedChange=this._onDidCollapsedChange.event,this._onDidPeekChange=new O,this.onDidPeekChange=this._onDidPeekChange.event,this._onDidHeaderDirectionChange=new O,this.onDidHeaderDirectionChange=this._onDidHeaderDirectionChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidCollapsedChange,this._onDidPeekChange,this._onDidHeaderDirectionChange,this._onDidVisibilityChange.event(i=>{i.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=te({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():globalThis.window}setHeaderPosition(e){if(!this._group)throw new Error(ti);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw new Error(ti);return this._group.model.headerPosition}moveTo(e){if(!this._group)throw new Error(ti);this.accessor.withOrigin("api",()=>{var t,i,s,r;const n=(t=e.group)!==null&&t!==void 0?t:this.accessor.addGroup({direction:L_((i=e.position)!==null&&i!==void 0?i:"right"),skipSetActive:(s=e.skipSetActive)!==null&&s!==void 0?s:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:n,position:e.group&&(r=e.position)!==null&&r!==void 0?r:"center",index:e.index},skipSetActive:e.skipSetActive})})}maximize(){if(!this._group)throw new Error(ti);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(ti);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(ti);this.isMaximized()&&this.accessor.exitMaximizedGroup()}collapse(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!0)}expand(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!1)}isCollapsed(){return this._group?this.accessor.isEdgeGroupCollapsed(this._group):!1}isPeeking(){return this._group?this.accessor.isEdgeGroupPeeking(this._group):!1}setAutoHide(e){this._group&&this.accessor.setEdgeGroupAutoHide(this._group,e)}isAutoHide(){return this._group?this.accessor.isEdgeGroupAutoHide(this._group):!1}initialize(e){this._group=e}};const Db=100,kb=100;var lr=class extends cu{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof t=="number"?t:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof t=="number"?t:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof t=="number"?t:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof t=="number"?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,i){var s,r,n,o,a,l;super(t,"groupview_default",{minimumHeight:(s=(r=i.constraints)===null||r===void 0?void 0:r.minimumHeight)!==null&&s!==void 0?s:kb,minimumWidth:(n=(o=i.constraints)===null||o===void 0?void 0:o.minimumWidth)!==null&&n!==void 0?n:Db,maximumHeight:(a=i.constraints)===null||a===void 0?void 0:a.maximumHeight,maximumWidth:(l=i.constraints)===null||l===void 0?void 0:l.maximumWidth},new Cb(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new xb(this.element,e,t,i,this),this.addDisposables(this.model.onDidActivePanelChange(h=>{this.api._onDidActivePanelChange.fire(h)}),this.api.onDidConstraintsChangeInternal(h=>{h.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof h.minimumWidth=="function"?h.minimumWidth():h.minimumWidth),h.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof h.minimumHeight=="function"?h.minimumHeight():h.minimumHeight),h.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof h.maximumWidth=="function"?h.maximumWidth():h.maximumWidth),h.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof h.maximumHeight=="function"?h.maximumHeight():h.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}relayout(){this.model.relayout()}getComponent(){return this._model}toJSON(){return this.model.toJSON()}};const Pb={name:"dark",className:"dockview-theme-dark",colorScheme:"dark"},Eb={name:"light",className:"dockview-theme-light",colorScheme:"light"},Tb={className:"dockview-theme-abyss",tabGroupIndicator:"none"};var Ib=class extends $a{get location(){return this.group.api.location}get title(){return this.panel.title}get isPinned(){return this.panel.isPinned}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this.fireLocationChange())}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,i,s,r){super(e.id,s),this.panel=e,this.accessor=i,this._onDidTitleChange=new O,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidChangePinned=new O,this.onDidChangePinned=this._onDidChangePinned.event,this._onDidActiveGroupChange=new O,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new O,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new O,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new O,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new ze,this._tabComponent=r,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidChangePinned,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}setActive(){this.accessor.withOrigin("api",()=>super.setActive())}moveTo(e){this.accessor.withOrigin("api",()=>{var t,i;return this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(t=e.group)!==null&&t!==void 0?t:this._group,position:e.group&&(i=e.position)!==null&&i!==void 0?i:"center",index:e.index},skipSetActive:e.skipSetActive})})}setTitle(e){this.panel.setTitle(e)}setPinned(e){this.accessor.setPanelPinned(this.panel,e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}fireLocationChange(){this.accessor.deferLocationChange(this,()=>{this.isDisposed||this._onDidLocationChange.fire({location:this.location})})}setupGroupEventListeners(e){var t;let i=(t=e?.isActive)!==null&&t!==void 0?t:!1;this.groupEventsDisposable.value=new ee(this.group.api.onDidVisibilityChange(s=>{const r=!s.isVisible&&this.isVisible,n=s.isVisible&&!this.isVisible,o=this.group.model.isPanelActive(this.panel);(r||n&&o)&&this._onDidVisibilityChange.fire(s)}),this.group.api.onDidLocationChange(()=>{this.group===this.panel.group&&this.fireLocationChange()}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&i!==this.isGroupActive&&(i=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}},ss=class extends ee{get params(){return this._params}get title(){return this._title}get isPinned(){return this._pinned}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,i,s,r,n,o,a){super(),this.id=e,this.accessor=s,this.containerApi=r,this.view=o,this._pinned=!1,this._renderer=a.renderer,this._group=n,this._minimumWidth=a.minimumWidth,this._minimumHeight=a.minimumHeight,this._maximumWidth=a.maximumWidth,this._maximumHeight=a.maximumHeight,this.api=new Ib(this,this._group,s,t,i),this.addDisposables(this.api.onActiveChange(()=>{s.setActivePanel(this)}),this.api.onDidSizeChange(l=>{this.group.api.setSize(l)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(te(te({},e),{},{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new Jc;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth,pinned:this._pinned?!0:void 0}}setTitle(e){e!==this.title&&(this._title=e,this.view.setTitle(e),this.api._onDidTitleChange.fire({title:e}))}setPinned(e){this._pinned!==e&&(this._pinned=e,this.api._onDidChangePinned.fire({isPinned:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){this._params=te(te({},this._params),e.params);for(const t of Object.keys(e.params))e.params[t]===void 0&&delete this._params[t];this.view.update({params:this._params})}updateFromStateModel(e){var t,i,s,r,n;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this._params=(t=e.params)!==null&&t!==void 0?t:{},this.view.update({params:this._params}),this.setTitle((i=e.title)!==null&&i!==void 0?i:this.id),this.setRenderer((s=e.renderer)!==null&&s!==void 0?s:this.accessor.renderer),this.setPinned(((r=e.pinned)!==null&&r!==void 0?r:!1)&&!!(!((n=this.accessor.options.pinnedTabs)===null||n===void 0)&&n.enabled))}updateParentGroup(e,t){this._group=e,this.api.group=this._group;const i=this._group.model.isPanelActive(this),s=this.group.api.isActive&&i;t?.skipSetActive||this.api.isActive!==s&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&i}),this.api.isVisible!==i&&this.api._onDidVisibilityChange.fire({isVisible:i})}runEvents(){const e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}},Xl=class extends ee{get element(){return this._element}constructor(){super(),this._messages=Nr,this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.setAttribute("role","button"),this.action.setAttribute("tabindex","-1");const e=Q_();e.setAttribute("aria-hidden","true"),this.action.appendChild(e),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){var t;this._title=e.title,this._messages=(t=e.containerApi.messages)!==null&&t!==void 0?t:Nr,this.addDisposables(e.api.onDidTitleChange(i=>{this._title=i.title,this.render()}),J(this.action,"pointerdown",i=>{i.preventDefault()}),J(this.action,"click",i=>{i.defaultPrevented||(i.preventDefault(),e.api.close())})),this.render()}render(){if(this._content.textContent!==this._title){var e;this._content.textContent=(e=this._title)!==null&&e!==void 0?e:""}this.action.setAttribute("aria-label",this._title?this._messages.closeTab(this._title):this._messages.closeTabPlain())}},uu=class{get content(){return this._content}get tab(){return this._tab}constructor(e,t,i,s){this.accessor=e,this.id=t,this.contentComponent=i,this.tabComponent=s,this._content=this.createContentComponent(this.id,i),this._tab=this.createTabComponent(this.id,s)}createTabRenderer(e){const t=this.createTabComponent(this.id,this.tabComponent);if(this._params&&t.init(te(te({},this._params),{},{tabLocation:e})),this._updateEvent){var i;(i=t.update)===null||i===void 0||i.call(t,this._updateEvent)}return t}init(e){this._params=e,this.content.init(e),this.tab.init(te(te({},e),{},{tabLocation:"header"}))}setTitle(e){this._params&&(this._params.title=e)}layout(e,t){var i,s;(i=(s=this.content).layout)===null||i===void 0||i.call(s,e,t)}update(e){var t,i,s,r;this._updateEvent=e,(t=(i=this.content).update)===null||t===void 0||t.call(i,e),(s=(r=this.tab).update)===null||s===void 0||s.call(r,e)}dispose(){var e,t,i,s;(e=(t=this.content).dispose)===null||e===void 0||e.call(t),(i=(s=this.tab).dispose)===null||i===void 0||i.call(s)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){const i=t??this.accessor.options.defaultTabComponent;if(i){if(this.accessor.options.createTabComponent){const s=this.accessor.options.createTabComponent({id:e,name:i});return s||new Xl}console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new Xl}},Ab=class{constructor(e){this.accessor=e}fromJSON(e,t){var i,s,r;const n=e.id,o=e.params,a=e.title,l=e.view,h=l?l.content.id:(i=e.contentComponent)!==null&&i!==void 0?i:"unknown",d=l?(s=l.tab)===null||s===void 0?void 0:s.id:e.tabComponent,u=new uu(this.accessor,n,h,d),p=new ss(n,h,d,this.accessor,new Na(this.accessor),t,u,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return p.init({title:a??n,params:o??{}}),e.pinned&&(!((r=this.accessor.options.pinnedTabs)===null||r===void 0)&&r.enabled)&&p.setPinned(!0),p}},Rb=class extends ee{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(t){}},Lb=class{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(t=>t!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(t=>t!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}};const hr=new Lb;var Fa=class Oi extends ee{set minimumInViewportWidth(t){this.options.minimumInViewportWidth=t}set minimumInViewportHeight(t){this.options.minimumInViewportHeight=t}get element(){return this._element}get isVisible(){return this._isVisible}get headerHeight(){var t,i;return(t=(i=this.options.header)===null||i===void 0?void 0:i.offsetHeight)!==null&&t!==void 0?t:0}constructor(t){super(),this.options=t,this._element=document.createElement("div"),this._onDidChange=new O,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new O,this.onDidChangeEnd=this._onDidChangeEnd.event,this._onDidStartMoving=new O,this.onDidStartMoving=this._onDidStartMoving.event,this._dragMove=new ze,this._dragCancelled=!1,this.addDisposables(this._onDidChange,this._onDidChangeEnd,this._onDidStartMoving,this._dragMove),this._element.className="dv-resize-container",this._element.setAttribute("role","dialog"),this._element.setAttribute("aria-modal","false"),this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this.options.header&&(K(this._element,"dv-resize-container-with-titlebar",!0),this._element.appendChild(this.options.header)),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(te(te(te(te({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),hr.push(this._element)}setVisible(t){t!==this.isVisible&&(this._isVisible=t,K(this.element,"dv-hidden",!this.isVisible))}bringToFront(){hr.push(this._element)}setBounds(t={}){typeof t.height=="number"&&(this._element.style.height=`${t.height}px`),typeof t.width=="number"&&(this._element.style.width=`${t.width}px`),"top"in t&&typeof t.top=="number"&&(this._element.style.top=`${t.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in t&&typeof t.bottom=="number"&&(this._element.style.bottom=`${t.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in t&&typeof t.left=="number"&&(this._element.style.left=`${t.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in t&&typeof t.right=="number"&&(this._element.style.right=`${t.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const i=this.options.container.getBoundingClientRect(),s=this._element.getBoundingClientRect(),r=Math.max(0,this.getMinimumWidth(s.width)),n=Math.max(0,this.getMinimumHeight(s.height));if(this.verticalAlignment==="top"){const o=Ee(s.top-i.top,-n,Math.max(0,i.height-s.height+n));this._element.style.top=`${o}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const o=Ee(i.bottom-s.bottom,-n,Math.max(0,i.height-s.height+n));this._element.style.bottom=`${o}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const o=Ee(s.left-i.left,-r,Math.max(0,i.width-s.width+r));this._element.style.left=`${o}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const o=Ee(i.right-s.right,-r,Math.max(0,i.width-s.width+r));this._element.style.right=`${o}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const t=this.options.container.getBoundingClientRect(),i=this._element.getBoundingClientRect(),s={};return this.verticalAlignment==="top"?s.top=Number.parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?s.bottom=Number.parseFloat(this._element.style.bottom):s.top=i.top-t.top,this.horiziontalAlignment==="left"?s.left=Number.parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?s.right=Number.parseFloat(this._element.style.right):s.left=i.left-t.left,s.width=i.width,s.height=i.height,s}cancelPendingDrag(){this._dragMove.value&&(this._dragCancelled=!0,K(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=be.NONE)}setupDrag(t,i){const s=(r,n)=>{var o,a,l;let h=null,d=!1;this._dragCancelled=!1;const u=this.options.transformDragPosition?(o=(a=(l=this.options).getSiblingBoxes)===null||a===void 0?void 0:a.call(l))!==null&&o!==void 0?o:[]:[],p=$s();if(r&&typeof n=="number"&&typeof r.setPointerCapture=="function")try{r.setPointerCapture(n)}catch{}const f=()=>{K(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=be.NONE,this._onDidChangeEnd.fire()};this._dragMove.value=new ee({dispose:()=>{if(p.release(),r&&typeof n=="number"&&typeof r.releasePointerCapture=="function")try{r.releasePointerCapture(n)}catch{}}},J(globalThis.window,"pointermove",m=>{var g;if(this._dragCancelled)return;const _=this.options.container.getBoundingClientRect(),A=m.clientX-_.left,P=m.clientY-_.top;K(this._element,"dv-resize-container-dragging",!0);const E=this._element.getBoundingClientRect();(g=h)!==null&&g!==void 0||(h={x:m.clientX-E.left,y:m.clientY-E.top});const y=Math.max(0,this.getMinimumWidth(E.width)),T=Math.max(0,this.getMinimumHeight(E.height));let D=P-h.y,L=A-h.x;if(this.options.transformDragPosition){const x=this.options.transformDragPosition({proposed:{top:D,left:L,width:E.width,height:E.height},container:{width:_.width,height:_.height},others:u,modifiers:{altKey:m.altKey,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey}});x&&(D=x.top,L=x.left)}const G=Math.max(0,_.height-E.height+T),H=Math.max(0,_.width-E.width+y),M=Ee(D,-T,G),N=Ee(_.height-E.height-D,-T,G),C=Ee(L,-y,H),v=Ee(_.width-E.width-L,-y,H),S={};M<=N?S.top=M:S.bottom=N,C<=v?S.left=C:S.right=v,this.setBounds(S),d||(d=!0,this._onDidStartMoving.fire())}),J(globalThis.window,"pointerup",f),J(globalThis.window,"pointercancel",f))};this.addDisposables(J(t,"pointerdown",r=>{if(r.defaultPrevented){r.preventDefault();return}Fl(r)||s(t,r.pointerId)}),J(this.options.content,"pointerdown",r=>{r.defaultPrevented||Fl(r)||r.shiftKey&&s(this.options.content,r.pointerId)}),J(this.options.content,"pointerdown",()=>{hr.push(this._element)},!0)),i?.inDragMode&&s()}setupResize(t){const i=document.createElement("div");i.className=`dv-resize-handle-${t}`,this._element.appendChild(i);const s=new ze;this.addDisposables(s,J(i,"pointerdown",r=>{r.preventDefault();let n=null;const o=$s(),a=r.pointerId;if(typeof i.setPointerCapture=="function")try{i.setPointerCapture(a)}catch{}const l=()=>{s.dispose(),this._onDidChangeEnd.fire()};s.value=new ee(J(globalThis.window,"pointermove",h=>{var d;const u=this.options.container.getBoundingClientRect(),p=this._element.getBoundingClientRect(),f=h.clientY-u.top,m=h.clientX-u.left;(d=n)!==null&&d!==void 0||(n={originalY:f,originalHeight:p.height,originalX:m,originalWidth:p.width});let g,_,A,P,E,y;const T=()=>{const M=n.originalY+n.originalHeight>u.height?Math.max(0,u.height-Oi.MINIMUM_HEIGHT):Math.max(0,n.originalY+n.originalHeight-Oi.MINIMUM_HEIGHT);g=Ee(f,0,M),A=n.originalY+n.originalHeight-g,_=u.height-g-A},D=()=>{g=n.originalY-n.originalHeight;const M=g<0&&typeof this.options.minimumInViewportHeight=="number"?-g+this.options.minimumInViewportHeight:Oi.MINIMUM_HEIGHT,N=u.height-Math.max(0,g);A=Ee(f-g,M,N),_=u.height-g-A},L=()=>{const M=n.originalX+n.originalWidth>u.width?Math.max(0,u.width-Oi.MINIMUM_WIDTH):Math.max(0,n.originalX+n.originalWidth-Oi.MINIMUM_WIDTH);P=Ee(m,0,M),y=n.originalX+n.originalWidth-P,E=u.width-P-y},G=()=>{P=n.originalX-n.originalWidth;const M=P<0&&typeof this.options.minimumInViewportWidth=="number"?-P+this.options.minimumInViewportWidth:Oi.MINIMUM_WIDTH,N=u.width-Math.max(0,P);y=Ee(m-P,M,N),E=u.width-P-y};switch(t){case"top":T();break;case"bottom":D();break;case"left":L();break;case"right":G();break;case"topleft":T(),L();break;case"topright":T(),G();break;case"bottomleft":D(),L();break;case"bottomright":D(),G();break}const H={};g<=_?H.top=g:H.bottom=_,P<=E?H.left=P:H.right=E,H.height=A,H.width=y,this.setBounds(H)}),{dispose:()=>{if(o.release(),typeof i.releasePointerCapture=="function")try{i.releasePointerCapture(a)}catch{}}},J(globalThis.window,"pointerup",l),J(globalThis.window,"pointercancel",l))}))}getMinimumWidth(t){return typeof this.options.minimumInViewportWidth=="number"?t-this.options.minimumInViewportWidth:0}getMinimumHeight(t){return typeof this.options.minimumInViewportHeight=="number"?t-this.options.minimumInViewportHeight:0}dispose(){hr.destroy(this._element),this._element.remove(),super.dispose()}};Fa.MINIMUM_HEIGHT=20;Fa.MINIMUM_WIDTH=20;var Mb=class extends ee{get element(){return this._element}get group(){return this._group}setGroup(e){this._group=e}constructor(e,t){super(),this.accessor=e,this._onDragStart=new O,this.onDragStart=this._onDragStart.event,this._group=t,this._element=document.createElement("div"),this._element.className="dv-floating-titlebar",this.addDisposables(this._onDragStart,J(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this._group)}),J(this._element,"pointerdown",i=>{i.shiftKey&&Lc(i)},!0)),this.dragSource=new iu({element:this._element,accessor:this.accessor,group:()=>this._group}),this.addDisposables(this.dragSource,this.dragSource.onDragStart(i=>{this._onDragStart.fire(i)}))}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}};function ui(e){return{moduleName:e.name,options:e.options,services:{[e.serviceKey]:e.create},init:e.init?(t,i)=>e.init(t,i[e.serviceKey]):void 0,dependsOn:e.dependsOn}}const Nb=new Set(["AdvancedOverflow","AutoEdgeGroup","AutoHideEdgeGroup","ContextMenu","DndCompass","KeyboardDocking","KeyboardNavigation","LayoutHistory","License","MultiRowTabs","PinnedTabs","SmartGuides"]),Jl=new Set;function pu(e,t){const i=t===void 0?[]:[].concat(t),s=i.map(o=>`\`${o}\``).join(", "),r=i.length>1?"require":"requires",n=i.length?`${s} ${r} the "${e}" module`:`The "${e}" module is required`;return Nb.has(e)?`dockview: ${n}, which ships in dockview-enterprise.
|
|
4
4
|
|