@shaykec/bridge 0.4.19 → 0.4.21
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/README.md +2 -2
- package/canvas-dist/assets/{_basePickBy-BOTBlJNd.js → _basePickBy-BovdgFIW.js} +1 -1
- package/canvas-dist/assets/_basePickBy-BtkHe2u_.js +1 -0
- package/canvas-dist/assets/_basePickBy-C0936578.js +1 -0
- package/canvas-dist/assets/_basePickBy-CE2Qvuh7.js +1 -0
- package/canvas-dist/assets/_basePickBy-DV6sX4CG.js +1 -0
- package/canvas-dist/assets/_basePickBy-DZX6ZNMT.js +1 -0
- package/canvas-dist/assets/{_baseUniq-EF6Y2_Wm.js → _baseUniq-B7dN28TM.js} +1 -1
- package/canvas-dist/assets/_baseUniq-Cl23fCdR.js +1 -0
- package/canvas-dist/assets/_baseUniq-CojWFw7B.js +1 -0
- package/canvas-dist/assets/_baseUniq-DA640BJl.js +1 -0
- package/canvas-dist/assets/_baseUniq-Ds-62CCj.js +1 -0
- package/canvas-dist/assets/_baseUniq-KG7SRw9H.js +1 -0
- package/canvas-dist/assets/{arc-C_vIirh2.js → arc-7E9FFKlC.js} +1 -1
- package/canvas-dist/assets/arc-BSMfRZtt.js +1 -0
- package/canvas-dist/assets/arc-C6nT-koR.js +1 -0
- package/canvas-dist/assets/arc-D_fOnjmo.js +1 -0
- package/canvas-dist/assets/arc-Khfvgkr3.js +1 -0
- package/canvas-dist/assets/arc-ieS-i42x.js +1 -0
- package/canvas-dist/assets/{architectureDiagram-VXUJARFQ-EvM6tQ7I.js → architectureDiagram-VXUJARFQ-DF4t6GQD.js} +1 -1
- package/canvas-dist/assets/architectureDiagram-VXUJARFQ-DXgSlsio.js +36 -0
- package/canvas-dist/assets/architectureDiagram-VXUJARFQ-DiomxPB4.js +36 -0
- package/canvas-dist/assets/architectureDiagram-VXUJARFQ-DnFaxvXD.js +36 -0
- package/canvas-dist/assets/architectureDiagram-VXUJARFQ-Dt38C0LJ.js +36 -0
- package/canvas-dist/assets/architectureDiagram-VXUJARFQ-egbtMwua.js +36 -0
- package/canvas-dist/assets/{blockDiagram-VD42YOAC-B_rbZyqc.js → blockDiagram-VD42YOAC-CUNKQd-b.js} +1 -1
- package/canvas-dist/assets/blockDiagram-VD42YOAC-D-NiLXxd.js +122 -0
- package/canvas-dist/assets/blockDiagram-VD42YOAC-Dx6Dh9gg.js +122 -0
- package/canvas-dist/assets/blockDiagram-VD42YOAC-_r-PmlQy.js +122 -0
- package/canvas-dist/assets/blockDiagram-VD42YOAC-bvYKZLMc.js +122 -0
- package/canvas-dist/assets/blockDiagram-VD42YOAC-l85QT9Ig.js +122 -0
- package/canvas-dist/assets/{c4Diagram-YG6GDRKO-J9PHecY3.js → c4Diagram-YG6GDRKO-BWKCTyQi.js} +1 -1
- package/canvas-dist/assets/c4Diagram-YG6GDRKO-CbXs2xzC.js +10 -0
- package/canvas-dist/assets/c4Diagram-YG6GDRKO-CjiS-GNK.js +10 -0
- package/canvas-dist/assets/c4Diagram-YG6GDRKO-D7SnLlHp.js +10 -0
- package/canvas-dist/assets/c4Diagram-YG6GDRKO-RTTCSVf2.js +10 -0
- package/canvas-dist/assets/c4Diagram-YG6GDRKO-yvqJ_AqX.js +10 -0
- package/canvas-dist/assets/channel-CSXq7GP6.js +1 -0
- package/canvas-dist/assets/channel-CvujjGiJ.js +1 -0
- package/canvas-dist/assets/channel-D959Iony.js +1 -0
- package/canvas-dist/assets/channel-DOSwCnrB.js +1 -0
- package/canvas-dist/assets/channel-sw61LzxF.js +1 -0
- package/canvas-dist/assets/channel-vZVnNhOK.js +1 -0
- package/canvas-dist/assets/{chunk-4BX2VUAB-DjcN96Mk.js → chunk-4BX2VUAB-BBjuAwXr.js} +1 -1
- package/canvas-dist/assets/chunk-4BX2VUAB-BXRNyucU.js +1 -0
- package/canvas-dist/assets/chunk-4BX2VUAB-Bgq5Z77T.js +1 -0
- package/canvas-dist/assets/chunk-4BX2VUAB-BuoMCMCr.js +1 -0
- package/canvas-dist/assets/chunk-4BX2VUAB-COD5n7vg.js +1 -0
- package/canvas-dist/assets/chunk-4BX2VUAB-K8DepKJO.js +1 -0
- package/canvas-dist/assets/{chunk-55IACEB6-CTdcUQSV.js → chunk-55IACEB6-Bic_bMrQ.js} +1 -1
- package/canvas-dist/assets/chunk-55IACEB6-DEy2QUDq.js +1 -0
- package/canvas-dist/assets/chunk-55IACEB6-Dcgbmfzg.js +1 -0
- package/canvas-dist/assets/chunk-55IACEB6-DfmuNm_E.js +1 -0
- package/canvas-dist/assets/chunk-55IACEB6-DlQRcczm.js +1 -0
- package/canvas-dist/assets/chunk-55IACEB6-p2qMY-fm.js +1 -0
- package/canvas-dist/assets/{chunk-B4BG7PRW-Dcov7eRi.js → chunk-B4BG7PRW-BpbyxBP2.js} +1 -1
- package/canvas-dist/assets/chunk-B4BG7PRW-CCPqvPrP.js +165 -0
- package/canvas-dist/assets/chunk-B4BG7PRW-CEeDPAki.js +165 -0
- package/canvas-dist/assets/chunk-B4BG7PRW-D2UFN_2M.js +165 -0
- package/canvas-dist/assets/chunk-B4BG7PRW-DFI5h6HC.js +165 -0
- package/canvas-dist/assets/chunk-B4BG7PRW-DKOiFGMU.js +165 -0
- package/canvas-dist/assets/{chunk-DI55MBZ5-DUJCBZzM.js → chunk-DI55MBZ5-BV6nHjNQ.js} +1 -1
- package/canvas-dist/assets/chunk-DI55MBZ5-CEZJmC0E.js +220 -0
- package/canvas-dist/assets/chunk-DI55MBZ5-DOZT99Ek.js +220 -0
- package/canvas-dist/assets/chunk-DI55MBZ5-DmC2LoG2.js +220 -0
- package/canvas-dist/assets/chunk-DI55MBZ5-DpkcJdZP.js +220 -0
- package/canvas-dist/assets/chunk-DI55MBZ5-fVTGx0zh.js +220 -0
- package/canvas-dist/assets/{chunk-FMBD7UC4-EfGA9ufe.js → chunk-FMBD7UC4-BOCyQpI7.js} +1 -1
- package/canvas-dist/assets/chunk-FMBD7UC4-C76FrRL8.js +15 -0
- package/canvas-dist/assets/chunk-FMBD7UC4-CAq-btWc.js +15 -0
- package/canvas-dist/assets/chunk-FMBD7UC4-CidVsej6.js +15 -0
- package/canvas-dist/assets/chunk-FMBD7UC4-DPpfskdX.js +15 -0
- package/canvas-dist/assets/chunk-FMBD7UC4-DnLtclge.js +15 -0
- package/canvas-dist/assets/{chunk-QN33PNHL-Cu6V1xBU.js → chunk-QN33PNHL-BclpCUi8.js} +1 -1
- package/canvas-dist/assets/chunk-QN33PNHL-DDUw8IU1.js +1 -0
- package/canvas-dist/assets/chunk-QN33PNHL-DdJFAUXw.js +1 -0
- package/canvas-dist/assets/chunk-QN33PNHL-DjV4jUn9.js +1 -0
- package/canvas-dist/assets/chunk-QN33PNHL-N-HTycqU.js +1 -0
- package/canvas-dist/assets/chunk-QN33PNHL-sd8p21DW.js +1 -0
- package/canvas-dist/assets/{chunk-QZHKN3VN-avF3sH_r.js → chunk-QZHKN3VN-B6mT-JkP.js} +1 -1
- package/canvas-dist/assets/chunk-QZHKN3VN-BCo8pc7x.js +1 -0
- package/canvas-dist/assets/chunk-QZHKN3VN-C8IIu6es.js +1 -0
- package/canvas-dist/assets/chunk-QZHKN3VN-D9FF492U.js +1 -0
- package/canvas-dist/assets/chunk-QZHKN3VN-DWMbUjXT.js +1 -0
- package/canvas-dist/assets/chunk-QZHKN3VN-l5FBJ77g.js +1 -0
- package/canvas-dist/assets/{chunk-TZMSLE5B-CkWW-qpk.js → chunk-TZMSLE5B-BASt-UWt.js} +1 -1
- package/canvas-dist/assets/chunk-TZMSLE5B-BCfaZWLT.js +1 -0
- package/canvas-dist/assets/chunk-TZMSLE5B-BKIk_hBR.js +1 -0
- package/canvas-dist/assets/chunk-TZMSLE5B-C4pt-Ir8.js +1 -0
- package/canvas-dist/assets/chunk-TZMSLE5B-DwGlELvo.js +1 -0
- package/canvas-dist/assets/chunk-TZMSLE5B-jJKG-WvJ.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-B7YQfPU4.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-BZ61MaHY.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-CGseYor2.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-CKzOc99J.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-Ce_LPjwW.js +1 -0
- package/canvas-dist/assets/classDiagram-2ON5EDUG-DorPdibv.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-B7YQfPU4.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-BZ61MaHY.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-CGseYor2.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-CKzOc99J.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-Ce_LPjwW.js +1 -0
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-DorPdibv.js +1 -0
- package/canvas-dist/assets/clone-74KSto7H.js +1 -0
- package/canvas-dist/assets/clone-CJQgAYVe.js +1 -0
- package/canvas-dist/assets/clone-DLeTuhHE.js +1 -0
- package/canvas-dist/assets/clone-D_IHK_lQ.js +1 -0
- package/canvas-dist/assets/clone-DxMUv1L9.js +1 -0
- package/canvas-dist/assets/clone-UNKf_nED.js +1 -0
- package/canvas-dist/assets/{cose-bilkent-S5V4N54A-DDE4zf7X.js → cose-bilkent-S5V4N54A-BTyQiCkr.js} +1 -1
- package/canvas-dist/assets/cose-bilkent-S5V4N54A-BtPAe24N.js +1 -0
- package/canvas-dist/assets/cose-bilkent-S5V4N54A-DIjE7V3m.js +1 -0
- package/canvas-dist/assets/cose-bilkent-S5V4N54A-DKL_BGvE.js +1 -0
- package/canvas-dist/assets/cose-bilkent-S5V4N54A-LZ4OsCLU.js +1 -0
- package/canvas-dist/assets/cose-bilkent-S5V4N54A-XWeJtgga.js +1 -0
- package/canvas-dist/assets/{dagre-6UL2VRFP-BD6MGb7B.js → dagre-6UL2VRFP-BJ2vcFwR.js} +1 -1
- package/canvas-dist/assets/dagre-6UL2VRFP-C1FlE5s8.js +4 -0
- package/canvas-dist/assets/dagre-6UL2VRFP-C3BWFgl6.js +4 -0
- package/canvas-dist/assets/dagre-6UL2VRFP-CUnx73Rf.js +4 -0
- package/canvas-dist/assets/dagre-6UL2VRFP-Do10BY1y.js +4 -0
- package/canvas-dist/assets/dagre-6UL2VRFP-rOZEkrsg.js +4 -0
- package/canvas-dist/assets/diagram-PSM6KHXK-BGi_qzbq.js +24 -0
- package/canvas-dist/assets/diagram-PSM6KHXK-C3Nv7h_j.js +24 -0
- package/canvas-dist/assets/diagram-PSM6KHXK-CsMy-r0n.js +24 -0
- package/canvas-dist/assets/diagram-PSM6KHXK-Dj8g7kGt.js +24 -0
- package/canvas-dist/assets/diagram-PSM6KHXK-Dxb1w_7r.js +24 -0
- package/canvas-dist/assets/{diagram-PSM6KHXK-yyu-ytzf.js → diagram-PSM6KHXK-kVMBkEyV.js} +1 -1
- package/canvas-dist/assets/{diagram-QEK2KX5R-B_H957Uf.js → diagram-QEK2KX5R-4bsrr1WZ.js} +1 -1
- package/canvas-dist/assets/diagram-QEK2KX5R-Bv7BmKfI.js +43 -0
- package/canvas-dist/assets/diagram-QEK2KX5R-C_FLN6hv.js +43 -0
- package/canvas-dist/assets/diagram-QEK2KX5R-Csuk5L3z.js +43 -0
- package/canvas-dist/assets/diagram-QEK2KX5R-D5Aszgz4.js +43 -0
- package/canvas-dist/assets/diagram-QEK2KX5R-DX58f87l.js +43 -0
- package/canvas-dist/assets/{diagram-S2PKOQOG-DuebuBVv.js → diagram-S2PKOQOG-1Q7hwiSd.js} +1 -1
- package/canvas-dist/assets/diagram-S2PKOQOG-Bz9Vxi5V.js +24 -0
- package/canvas-dist/assets/diagram-S2PKOQOG-CdWgZIIc.js +24 -0
- package/canvas-dist/assets/diagram-S2PKOQOG-DBicbKFU.js +24 -0
- package/canvas-dist/assets/diagram-S2PKOQOG-DsXKwPtU.js +24 -0
- package/canvas-dist/assets/diagram-S2PKOQOG-L_SMHLXs.js +24 -0
- package/canvas-dist/assets/{erDiagram-Q2GNP2WA-AxqPt6IZ.js → erDiagram-Q2GNP2WA-BYu7fh6H.js} +1 -1
- package/canvas-dist/assets/erDiagram-Q2GNP2WA-CvnQ69BF.js +60 -0
- package/canvas-dist/assets/erDiagram-Q2GNP2WA-D3xm-Tdm.js +60 -0
- package/canvas-dist/assets/erDiagram-Q2GNP2WA-DIPpD8sj.js +60 -0
- package/canvas-dist/assets/erDiagram-Q2GNP2WA-DNgu6dMd.js +60 -0
- package/canvas-dist/assets/erDiagram-Q2GNP2WA-Decm8aB4.js +60 -0
- package/canvas-dist/assets/{flowDiagram-NV44I4VS-mDhW3D3Q.js → flowDiagram-NV44I4VS-2ymk2kw2.js} +1 -1
- package/canvas-dist/assets/flowDiagram-NV44I4VS-BEPFOt6U.js +162 -0
- package/canvas-dist/assets/flowDiagram-NV44I4VS-BwqXYGfK.js +162 -0
- package/canvas-dist/assets/flowDiagram-NV44I4VS-CS1jax_z.js +162 -0
- package/canvas-dist/assets/flowDiagram-NV44I4VS-DQz5bf7r.js +162 -0
- package/canvas-dist/assets/flowDiagram-NV44I4VS-KW4T1sqF.js +162 -0
- package/canvas-dist/assets/{ganttDiagram-JELNMOA3-sA8pHJPp.js → ganttDiagram-JELNMOA3-B811prZt.js} +1 -1
- package/canvas-dist/assets/ganttDiagram-JELNMOA3-C75pWm7X.js +267 -0
- package/canvas-dist/assets/ganttDiagram-JELNMOA3-CWsbo0fn.js +267 -0
- package/canvas-dist/assets/ganttDiagram-JELNMOA3-CbJozPBN.js +267 -0
- package/canvas-dist/assets/ganttDiagram-JELNMOA3-Co0cFt4c.js +267 -0
- package/canvas-dist/assets/ganttDiagram-JELNMOA3-I4PDqrRh.js +267 -0
- package/canvas-dist/assets/{gitGraphDiagram-V2S2FVAM-CvLzvhKr.js → gitGraphDiagram-V2S2FVAM-B-z0cLPt.js} +1 -1
- package/canvas-dist/assets/gitGraphDiagram-V2S2FVAM-Be40z-LF.js +65 -0
- package/canvas-dist/assets/gitGraphDiagram-V2S2FVAM-BejNaAVm.js +65 -0
- package/canvas-dist/assets/gitGraphDiagram-V2S2FVAM-BqWDYr0X.js +65 -0
- package/canvas-dist/assets/gitGraphDiagram-V2S2FVAM-DSvWGY-e.js +65 -0
- package/canvas-dist/assets/gitGraphDiagram-V2S2FVAM-HLYbyNJ5.js +65 -0
- package/canvas-dist/assets/{graph-BVZqMrwW.js → graph-BE8KKsdf.js} +1 -1
- package/canvas-dist/assets/graph-D6DzzszU.js +1 -0
- package/canvas-dist/assets/graph-DFR8Y_8s.js +1 -0
- package/canvas-dist/assets/graph-Da385cDY.js +1 -0
- package/canvas-dist/assets/graph-MU7gZz2B.js +1 -0
- package/canvas-dist/assets/graph-wjSBJwnf.js +1 -0
- package/canvas-dist/assets/index--ztw-8Rw.js +647 -0
- package/canvas-dist/assets/{index-CF3qc2Xb.js → index-5TpIM6B1.js} +1 -1
- package/canvas-dist/assets/index-6GBZ9nXN.css +32 -0
- package/canvas-dist/assets/index-BSswTuBk.js +11 -0
- package/canvas-dist/assets/index-BVvhMmjs.js +11 -0
- package/canvas-dist/assets/index-BY92Mj5g.js +572 -0
- package/canvas-dist/assets/index-CV7palC3.js +572 -0
- package/canvas-dist/assets/index-D9bmQGsB.js +11 -0
- package/canvas-dist/assets/index-DDIKkGv8.js +592 -0
- package/canvas-dist/assets/index-Dyo0NkPb.js +574 -0
- package/canvas-dist/assets/index-iQWajCow.js +572 -0
- package/canvas-dist/assets/index-m68YlAMU.js +11 -0
- package/canvas-dist/assets/index-mEoP57az.js +11 -0
- package/canvas-dist/assets/{infoDiagram-HS3SLOUP-D1Kg3Q9d.js → infoDiagram-HS3SLOUP--9BirqgJ.js} +1 -1
- package/canvas-dist/assets/infoDiagram-HS3SLOUP-CSJVED2y.js +2 -0
- package/canvas-dist/assets/infoDiagram-HS3SLOUP-D68HIb2t.js +2 -0
- package/canvas-dist/assets/infoDiagram-HS3SLOUP-DK2VLGGz.js +2 -0
- package/canvas-dist/assets/infoDiagram-HS3SLOUP-PaFhn4yD.js +2 -0
- package/canvas-dist/assets/infoDiagram-HS3SLOUP-zLNG47sU.js +2 -0
- package/canvas-dist/assets/{journeyDiagram-XKPGCS4Q-D7ogbx9z.js → journeyDiagram-XKPGCS4Q-Bue2dR2X.js} +1 -1
- package/canvas-dist/assets/journeyDiagram-XKPGCS4Q-CrgZfpdU.js +139 -0
- package/canvas-dist/assets/journeyDiagram-XKPGCS4Q-DUxWmkkC.js +139 -0
- package/canvas-dist/assets/journeyDiagram-XKPGCS4Q-OTFkv4pd.js +139 -0
- package/canvas-dist/assets/journeyDiagram-XKPGCS4Q-eK2_Zuu3.js +139 -0
- package/canvas-dist/assets/journeyDiagram-XKPGCS4Q-uds5Tz8D.js +139 -0
- package/canvas-dist/assets/{kanban-definition-3W4ZIXB7-CDcnICM9.js → kanban-definition-3W4ZIXB7-BETdiI7I.js} +1 -1
- package/canvas-dist/assets/kanban-definition-3W4ZIXB7-BdVh7KdN.js +89 -0
- package/canvas-dist/assets/kanban-definition-3W4ZIXB7-Cxl8UM9S.js +89 -0
- package/canvas-dist/assets/kanban-definition-3W4ZIXB7-DVPlx3I2.js +89 -0
- package/canvas-dist/assets/kanban-definition-3W4ZIXB7-LtNWeoYB.js +89 -0
- package/canvas-dist/assets/kanban-definition-3W4ZIXB7-uvhEMvyE.js +89 -0
- package/canvas-dist/assets/{layout-CuaK7i3M.js → layout-1OzszN14.js} +1 -1
- package/canvas-dist/assets/layout-CJSupFcF.js +1 -0
- package/canvas-dist/assets/layout-DFRmxN_c.js +1 -0
- package/canvas-dist/assets/layout-DSu-zk7y.js +1 -0
- package/canvas-dist/assets/layout-TGcrvApd.js +1 -0
- package/canvas-dist/assets/layout-eStc8SYK.js +1 -0
- package/canvas-dist/assets/{linear-CLSTOJ0g.js → linear-9qlE6xa7.js} +1 -1
- package/canvas-dist/assets/linear-CBfFWnLD.js +1 -0
- package/canvas-dist/assets/linear-Cv4ai8Hq.js +1 -0
- package/canvas-dist/assets/linear-DDzz65E6.js +1 -0
- package/canvas-dist/assets/linear-wbIqhwDf.js +1 -0
- package/canvas-dist/assets/linear-wyNKl76F.js +1 -0
- package/canvas-dist/assets/{mindmap-definition-VGOIOE7T-TrK7CIKt.js → mindmap-definition-VGOIOE7T-3l4YzhEM.js} +1 -1
- package/canvas-dist/assets/mindmap-definition-VGOIOE7T-B-KkpNlw.js +68 -0
- package/canvas-dist/assets/mindmap-definition-VGOIOE7T-DHMHWgmT.js +68 -0
- package/canvas-dist/assets/mindmap-definition-VGOIOE7T-Dqfyg4Z2.js +68 -0
- package/canvas-dist/assets/mindmap-definition-VGOIOE7T-NeRYOzsq.js +68 -0
- package/canvas-dist/assets/mindmap-definition-VGOIOE7T-xyu628P9.js +68 -0
- package/canvas-dist/assets/{pieDiagram-ADFJNKIX-BcIKTRbi.js → pieDiagram-ADFJNKIX-BWNzVAGj.js} +1 -1
- package/canvas-dist/assets/pieDiagram-ADFJNKIX-Bm3PXYs-.js +30 -0
- package/canvas-dist/assets/pieDiagram-ADFJNKIX-BvvN7VvQ.js +30 -0
- package/canvas-dist/assets/pieDiagram-ADFJNKIX-BwU7AN7W.js +30 -0
- package/canvas-dist/assets/pieDiagram-ADFJNKIX-CHgwWCaM.js +30 -0
- package/canvas-dist/assets/pieDiagram-ADFJNKIX-DlZc8YOh.js +30 -0
- package/canvas-dist/assets/{quadrantDiagram-AYHSOK5B-EOHXFGoQ.js → quadrantDiagram-AYHSOK5B-B-Zd8OFp.js} +1 -1
- package/canvas-dist/assets/quadrantDiagram-AYHSOK5B-B1CnJyxI.js +7 -0
- package/canvas-dist/assets/quadrantDiagram-AYHSOK5B-C0Qo00b9.js +7 -0
- package/canvas-dist/assets/quadrantDiagram-AYHSOK5B-C9bx3nEJ.js +7 -0
- package/canvas-dist/assets/quadrantDiagram-AYHSOK5B-UHENkiRO.js +7 -0
- package/canvas-dist/assets/quadrantDiagram-AYHSOK5B-jKfurTPU.js +7 -0
- package/canvas-dist/assets/{requirementDiagram-UZGBJVZJ-CJ8lImGs.js → requirementDiagram-UZGBJVZJ-BPpNNusD.js} +1 -1
- package/canvas-dist/assets/requirementDiagram-UZGBJVZJ-BwZF1NIK.js +64 -0
- package/canvas-dist/assets/requirementDiagram-UZGBJVZJ-CaT3Frtk.js +64 -0
- package/canvas-dist/assets/requirementDiagram-UZGBJVZJ-Dfoz7R_7.js +64 -0
- package/canvas-dist/assets/requirementDiagram-UZGBJVZJ-DsrX4TT-.js +64 -0
- package/canvas-dist/assets/requirementDiagram-UZGBJVZJ-dmouSXOl.js +64 -0
- package/canvas-dist/assets/{sankeyDiagram-TZEHDZUN-4cANY87E.js → sankeyDiagram-TZEHDZUN-BEy-A1Fu.js} +1 -1
- package/canvas-dist/assets/sankeyDiagram-TZEHDZUN-BViMBiAQ.js +10 -0
- package/canvas-dist/assets/sankeyDiagram-TZEHDZUN-BqrM-qWN.js +10 -0
- package/canvas-dist/assets/sankeyDiagram-TZEHDZUN-DRkRC9qB.js +10 -0
- package/canvas-dist/assets/sankeyDiagram-TZEHDZUN-DbuzKCtn.js +10 -0
- package/canvas-dist/assets/sankeyDiagram-TZEHDZUN-_aHMKbpw.js +10 -0
- package/canvas-dist/assets/{sequenceDiagram-WL72ISMW-D9HrEsci.js → sequenceDiagram-WL72ISMW-B8FOaL2Q.js} +1 -1
- package/canvas-dist/assets/sequenceDiagram-WL72ISMW-C02NQwOB.js +145 -0
- package/canvas-dist/assets/sequenceDiagram-WL72ISMW-CgyHivPj.js +145 -0
- package/canvas-dist/assets/sequenceDiagram-WL72ISMW-CzW1WaEm.js +145 -0
- package/canvas-dist/assets/sequenceDiagram-WL72ISMW-DJhHI1pe.js +145 -0
- package/canvas-dist/assets/sequenceDiagram-WL72ISMW-VFkpAeoG.js +145 -0
- package/canvas-dist/assets/{stateDiagram-FKZM4ZOC-qVbMjauZ.js → stateDiagram-FKZM4ZOC-BSqFX4PJ.js} +1 -1
- package/canvas-dist/assets/stateDiagram-FKZM4ZOC-BnXhhxkN.js +1 -0
- package/canvas-dist/assets/stateDiagram-FKZM4ZOC-ClARVrvt.js +1 -0
- package/canvas-dist/assets/stateDiagram-FKZM4ZOC-CuC6xesY.js +1 -0
- package/canvas-dist/assets/stateDiagram-FKZM4ZOC-DcAiGjph.js +1 -0
- package/canvas-dist/assets/stateDiagram-FKZM4ZOC-aBg0hjTp.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-8fib9ftc.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-B-DO0ZqO.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-BksbsE4k.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-C2DJCNPK.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-CeA5jba6.js +1 -0
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-zsAyq0tK.js +1 -0
- package/canvas-dist/assets/{timeline-definition-IT6M3QCI-DDBlkydm.js → timeline-definition-IT6M3QCI-BaHdYD2h.js} +1 -1
- package/canvas-dist/assets/timeline-definition-IT6M3QCI-Bl2hg8IM.js +61 -0
- package/canvas-dist/assets/timeline-definition-IT6M3QCI-CrVwLiGm.js +61 -0
- package/canvas-dist/assets/timeline-definition-IT6M3QCI-DrXGRjnB.js +61 -0
- package/canvas-dist/assets/timeline-definition-IT6M3QCI-cYAwshf6.js +61 -0
- package/canvas-dist/assets/timeline-definition-IT6M3QCI-flyL0y-3.js +61 -0
- package/canvas-dist/assets/{treemap-GDKQZRPO-D4a8udjO.js → treemap-GDKQZRPO-C4Hg8kJ_.js} +1 -1
- package/canvas-dist/assets/treemap-GDKQZRPO-DVY2G9qY.js +162 -0
- package/canvas-dist/assets/treemap-GDKQZRPO-DpLWPA1z.js +162 -0
- package/canvas-dist/assets/treemap-GDKQZRPO-Ds86cUVw.js +162 -0
- package/canvas-dist/assets/treemap-GDKQZRPO-DwmoI6tH.js +162 -0
- package/canvas-dist/assets/treemap-GDKQZRPO-SsGFkgVd.js +162 -0
- package/canvas-dist/assets/{xychartDiagram-PRI3JC2R-DteXAAAu.js → xychartDiagram-PRI3JC2R-B9c1iLBf.js} +1 -1
- package/canvas-dist/assets/xychartDiagram-PRI3JC2R-BpX6MPWa.js +7 -0
- package/canvas-dist/assets/xychartDiagram-PRI3JC2R-CEgW_j0p.js +7 -0
- package/canvas-dist/assets/xychartDiagram-PRI3JC2R-CSEFGEQX.js +7 -0
- package/canvas-dist/assets/xychartDiagram-PRI3JC2R-CnG4XoMc.js +7 -0
- package/canvas-dist/assets/xychartDiagram-PRI3JC2R-Dftj3Bt3.js +7 -0
- package/canvas-dist/index.html +3 -2
- package/package.json +4 -2
- package/src/protocol.js +1 -1
- package/src/protocol.test.js +1 -1
- package/src/pty-manager.js +281 -0
- package/src/pty-manager.test.js +212 -0
- package/src/router.js +31 -1
- package/src/router.test.js +1 -1
- package/src/sdk-e2e.test.js +101 -0
- package/src/server.e2e.test.js +812 -177
- package/src/server.js +1516 -264
- package/src/session-store.js +260 -0
- package/src/session-store.test.js +235 -0
- package/src/templates.js +1 -1
- package/src/templates.test.js +1 -1
- package/src/terminal.js +3 -3
- package/src/terminal.test.js +12 -12
- package/src/visual-interceptor.js +450 -0
- package/src/visual-interceptor.test.js +943 -0
- package/src/workshop-parser.js +251 -0
- package/src/workshop-parser.test.js +179 -0
- package/templates/celebrate.html +1 -1
- package/templates/code-playground.html +1 -1
- package/templates/dashboard.html +7 -8
- package/templates/diagram-architecture.html +1 -1
- package/templates/diagram-flow.html +1 -1
- package/templates/diagram-mermaid.html +1 -1
- package/templates/game-speed-round.html +1 -1
- package/templates/quiz-drag-order.html +1 -1
- package/templates/quiz-fill-blank.html +1 -1
- package/templates/quiz-matching.html +1 -1
- package/templates/quiz-timed-choice.html +1 -1
- package/templates/welcome.html +7 -7
- package/canvas-dist/assets/channel-saCUO1KA.js +0 -1
- package/canvas-dist/assets/classDiagram-2ON5EDUG-CBLbQwHx.js +0 -1
- package/canvas-dist/assets/classDiagram-v2-WZHVMYZB-CBLbQwHx.js +0 -1
- package/canvas-dist/assets/clone-DXnda9BY.js +0 -1
- package/canvas-dist/assets/index-DYNtb52W.js +0 -426
- package/canvas-dist/assets/stateDiagram-v2-4FDKWEC3-MT16RLO4.js +0 -1
- package/src/claude-session.js +0 -414
- package/src/claude-session.test.js +0 -326
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-rOZEkrsg.js","assets/graph-D6DzzszU.js","assets/_baseUniq-Cl23fCdR.js","assets/layout-DSu-zk7y.js","assets/_basePickBy-DZX6ZNMT.js","assets/clone-D_IHK_lQ.js","assets/cose-bilkent-S5V4N54A-XWeJtgga.js","assets/cytoscape.esm-BQaXIfA_.js","assets/c4Diagram-YG6GDRKO-CbXs2xzC.js","assets/chunk-TZMSLE5B-BCfaZWLT.js","assets/flowDiagram-NV44I4VS-BEPFOt6U.js","assets/chunk-FMBD7UC4-CidVsej6.js","assets/chunk-55IACEB6-Dcgbmfzg.js","assets/chunk-QN33PNHL-DDUw8IU1.js","assets/channel-vZVnNhOK.js","assets/erDiagram-Q2GNP2WA-CvnQ69BF.js","assets/gitGraphDiagram-V2S2FVAM-HLYbyNJ5.js","assets/chunk-4BX2VUAB-COD5n7vg.js","assets/chunk-QZHKN3VN-DWMbUjXT.js","assets/treemap-GDKQZRPO-SsGFkgVd.js","assets/ganttDiagram-JELNMOA3-CWsbo0fn.js","assets/linear-9qlE6xa7.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-HS3SLOUP-D68HIb2t.js","assets/pieDiagram-ADFJNKIX-CHgwWCaM.js","assets/arc-ieS-i42x.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-B1CnJyxI.js","assets/xychartDiagram-PRI3JC2R-CSEFGEQX.js","assets/requirementDiagram-UZGBJVZJ-DsrX4TT-.js","assets/sequenceDiagram-WL72ISMW-CzW1WaEm.js","assets/classDiagram-2ON5EDUG-B7YQfPU4.js","assets/chunk-B4BG7PRW-DKOiFGMU.js","assets/classDiagram-v2-WZHVMYZB-B7YQfPU4.js","assets/stateDiagram-FKZM4ZOC-ClARVrvt.js","assets/chunk-DI55MBZ5-BV6nHjNQ.js","assets/stateDiagram-v2-4FDKWEC3-8fib9ftc.js","assets/journeyDiagram-XKPGCS4Q-Bue2dR2X.js","assets/timeline-definition-IT6M3QCI-cYAwshf6.js","assets/mindmap-definition-VGOIOE7T-NeRYOzsq.js","assets/kanban-definition-3W4ZIXB7-BETdiI7I.js","assets/sankeyDiagram-TZEHDZUN-DbuzKCtn.js","assets/diagram-S2PKOQOG-1Q7hwiSd.js","assets/diagram-QEK2KX5R-Csuk5L3z.js","assets/blockDiagram-VD42YOAC-D-NiLXxd.js","assets/architectureDiagram-VXUJARFQ-DF4t6GQD.js","assets/diagram-PSM6KHXK-kVMBkEyV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var sL=Object.defineProperty;var oL=(e,t,r)=>t in e?sL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var yt=(e,t,r)=>oL(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=r(n);fetch(n.href,s)}})();function yy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function AU(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}),r}var qp={exports:{}},Al={},Up={exports:{}},et={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var tv;function aL(){if(tv)return et;tv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;function m(I){return I===null||typeof I!="object"?null:(I=p&&I[p]||I["@@iterator"],typeof I=="function"?I:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,v={};function S(I,Z,oe){this.props=I,this.context=Z,this.refs=v,this.updater=oe||y}S.prototype.isReactComponent={},S.prototype.setState=function(I,Z){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,Z,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function C(){}C.prototype=S.prototype;function E(I,Z,oe){this.props=I,this.context=Z,this.refs=v,this.updater=oe||y}var L=E.prototype=new C;L.constructor=E,x(L,S.prototype),L.isPureReactComponent=!0;var B=Array.isArray,R=Object.prototype.hasOwnProperty,k={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function O(I,Z,oe){var X,ne={},he=null,ye=null;if(Z!=null)for(X in Z.ref!==void 0&&(ye=Z.ref),Z.key!==void 0&&(he=""+Z.key),Z)R.call(Z,X)&&!A.hasOwnProperty(X)&&(ne[X]=Z[X]);var ve=arguments.length-2;if(ve===1)ne.children=oe;else if(1<ve){for(var be=Array(ve),$e=0;$e<ve;$e++)be[$e]=arguments[$e+2];ne.children=be}if(I&&I.defaultProps)for(X in ve=I.defaultProps,ve)ne[X]===void 0&&(ne[X]=ve[X]);return{$$typeof:e,type:I,key:he,ref:ye,props:ne,_owner:k.current}}function V(I,Z){return{$$typeof:e,type:I.type,key:Z,ref:I.ref,props:I.props,_owner:I._owner}}function q(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function H(I){var Z={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(oe){return Z[oe]})}var Y=/\/+/g;function F(I,Z){return typeof I=="object"&&I!==null&&I.key!=null?H(""+I.key):Z.toString(36)}function z(I,Z,oe,X,ne){var he=typeof I;(he==="undefined"||he==="boolean")&&(I=null);var ye=!1;if(I===null)ye=!0;else switch(he){case"string":case"number":ye=!0;break;case"object":switch(I.$$typeof){case e:case t:ye=!0}}if(ye)return ye=I,ne=ne(ye),I=X===""?"."+F(ye,0):X,B(ne)?(oe="",I!=null&&(oe=I.replace(Y,"$&/")+"/"),z(ne,Z,oe,"",function($e){return $e})):ne!=null&&(q(ne)&&(ne=V(ne,oe+(!ne.key||ye&&ye.key===ne.key?"":(""+ne.key).replace(Y,"$&/")+"/")+I)),Z.push(ne)),1;if(ye=0,X=X===""?".":X+":",B(I))for(var ve=0;ve<I.length;ve++){he=I[ve];var be=X+F(he,ve);ye+=z(he,Z,oe,be,ne)}else if(be=m(I),typeof be=="function")for(I=be.call(I),ve=0;!(he=I.next()).done;)he=he.value,be=X+F(he,ve++),ye+=z(he,Z,oe,be,ne);else if(he==="object")throw Z=String(I),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return ye}function $(I,Z,oe){if(I==null)return I;var X=[],ne=0;return z(I,X,"","",function(he){return Z.call(oe,he,ne++)}),X}function j(I){if(I._status===-1){var Z=I._result;Z=Z(),Z.then(function(oe){(I._status===0||I._status===-1)&&(I._status=1,I._result=oe)},function(oe){(I._status===0||I._status===-1)&&(I._status=2,I._result=oe)}),I._status===-1&&(I._status=0,I._result=Z)}if(I._status===1)return I._result.default;throw I._result}var W={current:null},P={transition:null},Q={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:P,ReactCurrentOwner:k};function ee(){throw Error("act(...) is not supported in production builds of React.")}return et.Children={map:$,forEach:function(I,Z,oe){$(I,function(){Z.apply(this,arguments)},oe)},count:function(I){var Z=0;return $(I,function(){Z++}),Z},toArray:function(I){return $(I,function(Z){return Z})||[]},only:function(I){if(!q(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},et.Component=S,et.Fragment=r,et.Profiler=n,et.PureComponent=E,et.StrictMode=i,et.Suspense=u,et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,et.act=ee,et.cloneElement=function(I,Z,oe){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var X=x({},I.props),ne=I.key,he=I.ref,ye=I._owner;if(Z!=null){if(Z.ref!==void 0&&(he=Z.ref,ye=k.current),Z.key!==void 0&&(ne=""+Z.key),I.type&&I.type.defaultProps)var ve=I.type.defaultProps;for(be in Z)R.call(Z,be)&&!A.hasOwnProperty(be)&&(X[be]=Z[be]===void 0&&ve!==void 0?ve[be]:Z[be])}var be=arguments.length-2;if(be===1)X.children=oe;else if(1<be){ve=Array(be);for(var $e=0;$e<be;$e++)ve[$e]=arguments[$e+2];X.children=ve}return{$$typeof:e,type:I.type,key:ne,ref:he,props:X,_owner:ye}},et.createContext=function(I){return I={$$typeof:a,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:s,_context:I},I.Consumer=I},et.createElement=O,et.createFactory=function(I){var Z=O.bind(null,I);return Z.type=I,Z},et.createRef=function(){return{current:null}},et.forwardRef=function(I){return{$$typeof:l,render:I}},et.isValidElement=q,et.lazy=function(I){return{$$typeof:d,_payload:{_status:-1,_result:I},_init:j}},et.memo=function(I,Z){return{$$typeof:h,type:I,compare:Z===void 0?null:Z}},et.startTransition=function(I){var Z=P.transition;P.transition={};try{I()}finally{P.transition=Z}},et.unstable_act=ee,et.useCallback=function(I,Z){return W.current.useCallback(I,Z)},et.useContext=function(I){return W.current.useContext(I)},et.useDebugValue=function(){},et.useDeferredValue=function(I){return W.current.useDeferredValue(I)},et.useEffect=function(I,Z){return W.current.useEffect(I,Z)},et.useId=function(){return W.current.useId()},et.useImperativeHandle=function(I,Z,oe){return W.current.useImperativeHandle(I,Z,oe)},et.useInsertionEffect=function(I,Z){return W.current.useInsertionEffect(I,Z)},et.useLayoutEffect=function(I,Z){return W.current.useLayoutEffect(I,Z)},et.useMemo=function(I,Z){return W.current.useMemo(I,Z)},et.useReducer=function(I,Z,oe){return W.current.useReducer(I,Z,oe)},et.useRef=function(I){return W.current.useRef(I)},et.useState=function(I){return W.current.useState(I)},et.useSyncExternalStore=function(I,Z,oe){return W.current.useSyncExternalStore(I,Z,oe)},et.useTransition=function(){return W.current.useTransition()},et.version="18.3.1",et}var rv;function _y(){return rv||(rv=1,Up.exports=aL()),Up.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var iv;function lL(){if(iv)return Al;iv=1;var e=_y(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(l,u,h){var d,p={},m=null,y=null;h!==void 0&&(m=""+h),u.key!==void 0&&(m=""+u.key),u.ref!==void 0&&(y=u.ref);for(d in u)i.call(u,d)&&!s.hasOwnProperty(d)&&(p[d]=u[d]);if(l&&l.defaultProps)for(d in u=l.defaultProps,u)p[d]===void 0&&(p[d]=u[d]);return{$$typeof:t,type:l,key:m,ref:y,props:p,_owner:n.current}}return Al.Fragment=r,Al.jsx=a,Al.jsxs=a,Al}var nv;function cL(){return nv||(nv=1,qp.exports=lL()),qp.exports}var g=cL(),M=_y();const iS=yy(M);var Zh={},Vp={exports:{}},ii={},Gp={exports:{}},Yp={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.min.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var sv;function hL(){return sv||(sv=1,(function(e){function t(P,Q){var ee=P.length;P.push(Q);e:for(;0<ee;){var I=ee-1>>>1,Z=P[I];if(0<n(Z,Q))P[I]=Q,P[ee]=Z,ee=I;else break e}}function r(P){return P.length===0?null:P[0]}function i(P){if(P.length===0)return null;var Q=P[0],ee=P.pop();if(ee!==Q){P[0]=ee;e:for(var I=0,Z=P.length,oe=Z>>>1;I<oe;){var X=2*(I+1)-1,ne=P[X],he=X+1,ye=P[he];if(0>n(ne,ee))he<Z&&0>n(ye,ne)?(P[I]=ye,P[he]=ee,I=he):(P[I]=ne,P[X]=ee,I=X);else if(he<Z&&0>n(ye,ee))P[I]=ye,P[he]=ee,I=he;else break e}}return Q}function n(P,Q){var ee=P.sortIndex-Q.sortIndex;return ee!==0?ee:P.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var u=[],h=[],d=1,p=null,m=3,y=!1,x=!1,v=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(P){for(var Q=r(h);Q!==null;){if(Q.callback===null)i(h);else if(Q.startTime<=P)i(h),Q.sortIndex=Q.expirationTime,t(u,Q);else break;Q=r(h)}}function B(P){if(v=!1,L(P),!x)if(r(u)!==null)x=!0,j(R);else{var Q=r(h);Q!==null&&W(B,Q.startTime-P)}}function R(P,Q){x=!1,v&&(v=!1,C(O),O=-1),y=!0;var ee=m;try{for(L(Q),p=r(u);p!==null&&(!(p.expirationTime>Q)||P&&!H());){var I=p.callback;if(typeof I=="function"){p.callback=null,m=p.priorityLevel;var Z=I(p.expirationTime<=Q);Q=e.unstable_now(),typeof Z=="function"?p.callback=Z:p===r(u)&&i(u),L(Q)}else i(u);p=r(u)}if(p!==null)var oe=!0;else{var X=r(h);X!==null&&W(B,X.startTime-Q),oe=!1}return oe}finally{p=null,m=ee,y=!1}}var k=!1,A=null,O=-1,V=5,q=-1;function H(){return!(e.unstable_now()-q<V)}function Y(){if(A!==null){var P=e.unstable_now();q=P;var Q=!0;try{Q=A(!0,P)}finally{Q?F():(k=!1,A=null)}}else k=!1}var F;if(typeof E=="function")F=function(){E(Y)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,$=z.port2;z.port1.onmessage=Y,F=function(){$.postMessage(null)}}else F=function(){S(Y,0)};function j(P){A=P,k||(k=!0,F())}function W(P,Q){O=S(function(){P(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,j(R))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(P){switch(m){case 1:case 2:case 3:var Q=3;break;default:Q=m}var ee=m;m=Q;try{return P()}finally{m=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,Q){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ee=m;m=P;try{return Q()}finally{m=ee}},e.unstable_scheduleCallback=function(P,Q,ee){var I=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?I+ee:I):ee=I,P){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=ee+Z,P={id:d++,callback:Q,priorityLevel:P,startTime:ee,expirationTime:Z,sortIndex:-1},ee>I?(P.sortIndex=ee,t(h,P),r(u)===null&&P===r(h)&&(v?(C(O),O=-1):v=!0,W(B,ee-I))):(P.sortIndex=Z,t(u,P),x||y||(x=!0,j(R))),P},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(P){var Q=m;return function(){var ee=m;m=Q;try{return P.apply(this,arguments)}finally{m=ee}}}})(Yp)),Yp}var ov;function uL(){return ov||(ov=1,Gp.exports=hL()),Gp.exports}/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var av;function dL(){if(av)return ii;av=1;var e=_y(),t=uL();function r(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,f=1;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,n={};function s(o,c){a(o,c),a(o+"Capture",c)}function a(o,c){for(n[o]=c,o=0;o<c.length;o++)i.add(c[o])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},p={};function m(o){return u.call(p,o)?!0:u.call(d,o)?!1:h.test(o)?p[o]=!0:(d[o]=!0,!1)}function y(o,c,f,_){if(f!==null&&f.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return _?!1:f!==null?!f.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function x(o,c,f,_){if(c===null||typeof c>"u"||y(o,c,f,_))return!0;if(_)return!1;if(f!==null)switch(f.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function v(o,c,f,_,b,w,D){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=_,this.attributeNamespace=b,this.mustUseProperty=f,this.propertyName=o,this.type=c,this.sanitizeURL=w,this.removeEmptyString=D}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){S[o]=new v(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var c=o[0];S[c]=new v(c,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){S[o]=new v(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){S[o]=new v(o,2,!1,o,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){S[o]=new v(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){S[o]=new v(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){S[o]=new v(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){S[o]=new v(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){S[o]=new v(o,5,!1,o.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function E(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var c=o.replace(C,E);S[c]=new v(c,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var c=o.replace(C,E);S[c]=new v(c,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var c=o.replace(C,E);S[c]=new v(c,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){S[o]=new v(o,1,!1,o.toLowerCase(),null,!1,!1)}),S.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){S[o]=new v(o,1,!1,o.toLowerCase(),null,!0,!0)});function L(o,c,f,_){var b=S.hasOwnProperty(c)?S[c]:null;(b!==null?b.type!==0:_||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(x(c,f,b,_)&&(f=null),_||b===null?m(c)&&(f===null?o.removeAttribute(c):o.setAttribute(c,""+f)):b.mustUseProperty?o[b.propertyName]=f===null?b.type===3?!1:"":f:(c=b.attributeName,_=b.attributeNamespace,f===null?o.removeAttribute(c):(b=b.type,f=b===3||b===4&&f===!0?"":""+f,_?o.setAttributeNS(_,c,f):o.setAttribute(c,f))))}var B=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),k=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),H=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),P=Symbol.iterator;function Q(o){return o===null||typeof o!="object"?null:(o=P&&o[P]||o["@@iterator"],typeof o=="function"?o:null)}var ee=Object.assign,I;function Z(o){if(I===void 0)try{throw Error()}catch(f){var c=f.stack.trim().match(/\n( *(at )?)/);I=c&&c[1]||""}return`
|
|
35
|
+
`+I+o}var oe=!1;function X(o,c){if(!o||oe)return"";oe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(ie){var _=ie}Reflect.construct(o,[],c)}else{try{c.call()}catch(ie){_=ie}o.call(c.prototype)}else{try{throw Error()}catch(ie){_=ie}o()}}catch(ie){if(ie&&_&&typeof ie.stack=="string"){for(var b=ie.stack.split(`
|
|
36
|
+
`),w=_.stack.split(`
|
|
37
|
+
`),D=b.length-1,N=w.length-1;1<=D&&0<=N&&b[D]!==w[N];)N--;for(;1<=D&&0<=N;D--,N--)if(b[D]!==w[N]){if(D!==1||N!==1)do if(D--,N--,0>N||b[D]!==w[N]){var G=`
|
|
38
|
+
`+b[D].replace(" at new "," at ");return o.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",o.displayName)),G}while(1<=D&&0<=N);break}}}finally{oe=!1,Error.prepareStackTrace=f}return(o=o?o.displayName||o.name:"")?Z(o):""}function ne(o){switch(o.tag){case 5:return Z(o.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return o=X(o.type,!1),o;case 11:return o=X(o.type.render,!1),o;case 1:return o=X(o.type,!0),o;default:return""}}function he(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case k:return"Portal";case V:return"Profiler";case O:return"StrictMode";case F:return"Suspense";case z:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case H:return(o.displayName||"Context")+".Consumer";case q:return(o._context.displayName||"Context")+".Provider";case Y:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case $:return c=o.displayName||null,c!==null?c:he(o.type)||"Memo";case j:c=o._payload,o=o._init;try{return he(o(c))}catch{}}return null}function ye(o){var c=o.type;switch(o.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=c.render,o=o.displayName||o.name||"",c.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(c);case 8:return c===O?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ve(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function be(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function $e(o){var c=be(o)?"checked":"value",f=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),_=""+o[c];if(!o.hasOwnProperty(c)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var b=f.get,w=f.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return b.call(this)},set:function(D){_=""+D,w.call(this,D)}}),Object.defineProperty(o,c,{enumerable:f.enumerable}),{getValue:function(){return _},setValue:function(D){_=""+D},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function Xe(o){o._valueTracker||(o._valueTracker=$e(o))}function it(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var f=c.getValue(),_="";return o&&(_=be(o)?o.checked?"true":"false":o.value),o=_,o!==f?(c.setValue(o),!0):!1}function Oe(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function ht(o,c){var f=c.checked;return ee({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??o._wrapperState.initialChecked})}function Ft(o,c){var f=c.defaultValue==null?"":c.defaultValue,_=c.checked!=null?c.checked:c.defaultChecked;f=ve(c.value!=null?c.value:f),o._wrapperState={initialChecked:_,initialValue:f,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function le(o,c){c=c.checked,c!=null&&L(o,"checked",c,!1)}function Je(o,c){le(o,c);var f=ve(c.value),_=c.type;if(f!=null)_==="number"?(f===0&&o.value===""||o.value!=f)&&(o.value=""+f):o.value!==""+f&&(o.value=""+f);else if(_==="submit"||_==="reset"){o.removeAttribute("value");return}c.hasOwnProperty("value")?qt(o,c.type,f):c.hasOwnProperty("defaultValue")&&qt(o,c.type,ve(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(o.defaultChecked=!!c.defaultChecked)}function ut(o,c,f){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var _=c.type;if(!(_!=="submit"&&_!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+o._wrapperState.initialValue,f||c===o.value||(o.value=c),o.defaultValue=c}f=o.name,f!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,f!==""&&(o.name=f)}function qt(o,c,f){(c!=="number"||Oe(o.ownerDocument)!==o)&&(f==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+f&&(o.defaultValue=""+f))}var kr=Array.isArray;function ar(o,c,f,_){if(o=o.options,c){c={};for(var b=0;b<f.length;b++)c["$"+f[b]]=!0;for(f=0;f<o.length;f++)b=c.hasOwnProperty("$"+o[f].value),o[f].selected!==b&&(o[f].selected=b),b&&_&&(o[f].defaultSelected=!0)}else{for(f=""+ve(f),c=null,b=0;b<o.length;b++){if(o[b].value===f){o[b].selected=!0,_&&(o[b].defaultSelected=!0);return}c!==null||o[b].disabled||(c=o[b])}c!==null&&(c.selected=!0)}}function Fi(o,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return ee({},c,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function ls(o,c){var f=c.value;if(f==null){if(f=c.children,c=c.defaultValue,f!=null){if(c!=null)throw Error(r(92));if(kr(f)){if(1<f.length)throw Error(r(93));f=f[0]}c=f}c==null&&(c=""),f=c}o._wrapperState={initialValue:ve(f)}}function jn(o,c){var f=ve(c.value),_=ve(c.defaultValue);f!=null&&(f=""+f,f!==o.value&&(o.value=f),c.defaultValue==null&&o.defaultValue!==f&&(o.defaultValue=f)),_!=null&&(o.defaultValue=""+_)}function Ni(o){var c=o.textContent;c===o._wrapperState.initialValue&&c!==""&&c!==null&&(o.value=c)}function gt(o){switch(o){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Tr(o,c){return o==null||o==="http://www.w3.org/1999/xhtml"?gt(c):o==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var hn,Xs=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,f,_,b){MSApp.execUnsafeLocalFunction(function(){return o(c,f,_,b)})}:o})(function(o,c){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=c;else{for(hn=hn||document.createElement("div"),hn.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=hn.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;c.firstChild;)o.appendChild(c.firstChild)}});function vt(o,c){if(c){var f=o.firstChild;if(f&&f===o.lastChild&&f.nodeType===3){f.nodeValue=c;return}}o.textContent=c}var Wi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Uo=["Webkit","ms","Moz","O"];Object.keys(Wi).forEach(function(o){Uo.forEach(function(c){c=c+o.charAt(0).toUpperCase()+o.substring(1),Wi[c]=Wi[o]})});function un(o,c,f){return c==null||typeof c=="boolean"||c===""?"":f||typeof c!="number"||c===0||Wi.hasOwnProperty(o)&&Wi[o]?(""+c).trim():c+"px"}function lr(o,c){o=o.style;for(var f in c)if(c.hasOwnProperty(f)){var _=f.indexOf("--")===0,b=un(f,c[f],_);f==="float"&&(f="cssFloat"),_?o.setProperty(f,b):o[f]=b}}var ci=ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function wi(o,c){if(c){if(ci[o]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,o));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function hi(o,c){if(o.indexOf("-")===-1)return typeof c.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Hi=null;function dn(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var fn=null,ui=null,pn=null;function gn(o){if(o=yl(o)){if(typeof fn!="function")throw Error(r(280));var c=o.stateNode;c&&(c=fh(c),fn(o.stateNode,o.type,c))}}function Vo(o){ui?pn?pn.push(o):pn=[o]:ui=o}function Qs(){if(ui){var o=ui,c=pn;if(pn=ui=null,gn(o),c)for(o=0;o<c.length;o++)gn(c[o])}}function wt(o,c){return o(c)}function qi(){}var cs=!1;function zn(o,c,f){if(cs)return o(c,f);cs=!0;try{return wt(o,c,f)}finally{cs=!1,(ui!==null||pn!==null)&&(qi(),Qs())}}function Ci(o,c){var f=o.stateNode;if(f===null)return null;var _=fh(f);if(_===null)return null;f=_[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(_=!_.disabled)||(o=o.type,_=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!_;break e;default:o=!1}if(o)return null;if(f&&typeof f!="function")throw Error(r(231,c,typeof f));return f}var On=!1;if(l)try{var Ui={};Object.defineProperty(Ui,"passive",{get:function(){On=!0}}),window.addEventListener("test",Ui,Ui),window.removeEventListener("test",Ui,Ui)}catch{On=!1}function Qa(o,c,f,_,b,w,D,N,G){var ie=Array.prototype.slice.call(arguments,3);try{c.apply(f,ie)}catch(pe){this.onError(pe)}}var cr=!1,Qr=null,mn=!1,Fn=null,Xt={onError:function(o){cr=!0,Qr=o}};function Zs(o,c,f,_,b,w,D,N,G){cr=!1,Qr=null,Qa.apply(Xt,arguments)}function se(o,c,f,_,b,w,D,N,G){if(Zs.apply(this,arguments),cr){if(cr){var ie=Qr;cr=!1,Qr=null}else throw Error(r(198));mn||(mn=!0,Fn=ie)}}function Se(o){var c=o,f=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(f=c.return),o=c.return;while(o)}return c.tag===3?f:null}function mt(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function At(o){if(Se(o)!==o)throw Error(r(188))}function Qt(o){var c=o.alternate;if(!c){if(c=Se(o),c===null)throw Error(r(188));return c!==o?null:o}for(var f=o,_=c;;){var b=f.return;if(b===null)break;var w=b.alternate;if(w===null){if(_=b.return,_!==null){f=_;continue}break}if(b.child===w.child){for(w=b.child;w;){if(w===f)return At(b),o;if(w===_)return At(b),c;w=w.sibling}throw Error(r(188))}if(f.return!==_.return)f=b,_=w;else{for(var D=!1,N=b.child;N;){if(N===f){D=!0,f=b,_=w;break}if(N===_){D=!0,_=b,f=w;break}N=N.sibling}if(!D){for(N=w.child;N;){if(N===f){D=!0,f=w,_=b;break}if(N===_){D=!0,_=w,f=b;break}N=N.sibling}if(!D)throw Error(r(189))}}if(f.alternate!==_)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?o:c}function zr(o){return o=Qt(o),o!==null?Te(o):null}function Te(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var c=Te(o);if(c!==null)return c;o=o.sibling}return null}var U=t.unstable_scheduleCallback,fe=t.unstable_cancelCallback,Be=t.unstable_shouldYield,ft=t.unstable_requestPaint,Ke=t.unstable_now,Bt=t.unstable_getCurrentPriorityLevel,hr=t.unstable_ImmediatePriority,ki=t.unstable_UserBlockingPriority,Vi=t.unstable_NormalPriority,Za=t.unstable_LowPriority,Ut=t.unstable_IdlePriority,Js=null,di=null;function vB(o){if(di&&typeof di.onCommitFiberRoot=="function")try{di.onCommitFiberRoot(Js,o,void 0,(o.current.flags&128)===128)}catch{}}var Gi=Math.clz32?Math.clz32:wB,bB=Math.log,SB=Math.LN2;function wB(o){return o>>>=0,o===0?32:31-(bB(o)/SB|0)|0}var Kc=64,Xc=4194304;function Ja(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Qc(o,c){var f=o.pendingLanes;if(f===0)return 0;var _=0,b=o.suspendedLanes,w=o.pingedLanes,D=f&268435455;if(D!==0){var N=D&~b;N!==0?_=Ja(N):(w&=D,w!==0&&(_=Ja(w)))}else D=f&~b,D!==0?_=Ja(D):w!==0&&(_=Ja(w));if(_===0)return 0;if(c!==0&&c!==_&&(c&b)===0&&(b=_&-_,w=c&-c,b>=w||b===16&&(w&4194240)!==0))return c;if((_&4)!==0&&(_|=f&16),c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=_;0<c;)f=31-Gi(c),b=1<<f,_|=o[f],c&=~b;return _}function CB(o,c){switch(o){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kB(o,c){for(var f=o.suspendedLanes,_=o.pingedLanes,b=o.expirationTimes,w=o.pendingLanes;0<w;){var D=31-Gi(w),N=1<<D,G=b[D];G===-1?((N&f)===0||(N&_)!==0)&&(b[D]=CB(N,c)):G<=c&&(o.expiredLanes|=N),w&=~N}}function uf(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function A0(){var o=Kc;return Kc<<=1,(Kc&4194240)===0&&(Kc=64),o}function df(o){for(var c=[],f=0;31>f;f++)c.push(o);return c}function el(o,c,f){o.pendingLanes|=c,c!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,c=31-Gi(c),o[c]=f}function TB(o,c){var f=o.pendingLanes&~c;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=c,o.mutableReadLanes&=c,o.entangledLanes&=c,c=o.entanglements;var _=o.eventTimes;for(o=o.expirationTimes;0<f;){var b=31-Gi(f),w=1<<b;c[b]=0,_[b]=-1,o[b]=-1,f&=~w}}function ff(o,c){var f=o.entangledLanes|=c;for(o=o.entanglements;f;){var _=31-Gi(f),b=1<<_;b&c|o[_]&c&&(o[_]|=c),f&=~b}}var pt=0;function D0(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var P0,pf,I0,$0,j0,gf=!1,Zc=[],hs=null,us=null,ds=null,tl=new Map,rl=new Map,fs=[],EB="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function z0(o,c){switch(o){case"focusin":case"focusout":hs=null;break;case"dragenter":case"dragleave":us=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":tl.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":rl.delete(c.pointerId)}}function il(o,c,f,_,b,w){return o===null||o.nativeEvent!==w?(o={blockedOn:c,domEventName:f,eventSystemFlags:_,nativeEvent:w,targetContainers:[b]},c!==null&&(c=yl(c),c!==null&&pf(c)),o):(o.eventSystemFlags|=_,c=o.targetContainers,b!==null&&c.indexOf(b)===-1&&c.push(b),o)}function BB(o,c,f,_,b){switch(c){case"focusin":return hs=il(hs,o,c,f,_,b),!0;case"dragenter":return us=il(us,o,c,f,_,b),!0;case"mouseover":return ds=il(ds,o,c,f,_,b),!0;case"pointerover":var w=b.pointerId;return tl.set(w,il(tl.get(w)||null,o,c,f,_,b)),!0;case"gotpointercapture":return w=b.pointerId,rl.set(w,il(rl.get(w)||null,o,c,f,_,b)),!0}return!1}function O0(o){var c=eo(o.target);if(c!==null){var f=Se(c);if(f!==null){if(c=f.tag,c===13){if(c=mt(f),c!==null){o.blockedOn=c,j0(o.priority,function(){I0(f)});return}}else if(c===3&&f.stateNode.current.memoizedState.isDehydrated){o.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Jc(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var f=yf(o.domEventName,o.eventSystemFlags,c[0],o.nativeEvent);if(f===null){f=o.nativeEvent;var _=new f.constructor(f.type,f);Hi=_,f.target.dispatchEvent(_),Hi=null}else return c=yl(f),c!==null&&pf(c),o.blockedOn=f,!1;c.shift()}return!0}function F0(o,c,f){Jc(o)&&f.delete(c)}function MB(){gf=!1,hs!==null&&Jc(hs)&&(hs=null),us!==null&&Jc(us)&&(us=null),ds!==null&&Jc(ds)&&(ds=null),tl.forEach(F0),rl.forEach(F0)}function nl(o,c){o.blockedOn===c&&(o.blockedOn=null,gf||(gf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,MB)))}function sl(o){function c(b){return nl(b,o)}if(0<Zc.length){nl(Zc[0],o);for(var f=1;f<Zc.length;f++){var _=Zc[f];_.blockedOn===o&&(_.blockedOn=null)}}for(hs!==null&&nl(hs,o),us!==null&&nl(us,o),ds!==null&&nl(ds,o),tl.forEach(c),rl.forEach(c),f=0;f<fs.length;f++)_=fs[f],_.blockedOn===o&&(_.blockedOn=null);for(;0<fs.length&&(f=fs[0],f.blockedOn===null);)O0(f),f.blockedOn===null&&fs.shift()}var Go=B.ReactCurrentBatchConfig,eh=!0;function LB(o,c,f,_){var b=pt,w=Go.transition;Go.transition=null;try{pt=1,mf(o,c,f,_)}finally{pt=b,Go.transition=w}}function RB(o,c,f,_){var b=pt,w=Go.transition;Go.transition=null;try{pt=4,mf(o,c,f,_)}finally{pt=b,Go.transition=w}}function mf(o,c,f,_){if(eh){var b=yf(o,c,f,_);if(b===null)Pf(o,c,_,th,f),z0(o,_);else if(BB(b,o,c,f,_))_.stopPropagation();else if(z0(o,_),c&4&&-1<EB.indexOf(o)){for(;b!==null;){var w=yl(b);if(w!==null&&P0(w),w=yf(o,c,f,_),w===null&&Pf(o,c,_,th,f),w===b)break;b=w}b!==null&&_.stopPropagation()}else Pf(o,c,_,null,f)}}var th=null;function yf(o,c,f,_){if(th=null,o=dn(_),o=eo(o),o!==null)if(c=Se(o),c===null)o=null;else if(f=c.tag,f===13){if(o=mt(c),o!==null)return o;o=null}else if(f===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null);return th=o,null}function N0(o){switch(o){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Bt()){case hr:return 1;case ki:return 4;case Vi:case Za:return 16;case Ut:return 536870912;default:return 16}default:return 16}}var ps=null,_f=null,rh=null;function W0(){if(rh)return rh;var o,c=_f,f=c.length,_,b="value"in ps?ps.value:ps.textContent,w=b.length;for(o=0;o<f&&c[o]===b[o];o++);var D=f-o;for(_=1;_<=D&&c[f-_]===b[w-_];_++);return rh=b.slice(o,1<_?1-_:void 0)}function ih(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function nh(){return!0}function H0(){return!1}function fi(o){function c(f,_,b,w,D){this._reactName=f,this._targetInst=b,this.type=_,this.nativeEvent=w,this.target=D,this.currentTarget=null;for(var N in o)o.hasOwnProperty(N)&&(f=o[N],this[N]=f?f(w):w[N]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?nh:H0,this.isPropagationStopped=H0,this}return ee(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=nh)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=nh)},persist:function(){},isPersistent:nh}),c}var Yo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xf=fi(Yo),ol=ee({},Yo,{view:0,detail:0}),AB=fi(ol),vf,bf,al,sh=ee({},ol,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wf,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==al&&(al&&o.type==="mousemove"?(vf=o.screenX-al.screenX,bf=o.screenY-al.screenY):bf=vf=0,al=o),vf)},movementY:function(o){return"movementY"in o?o.movementY:bf}}),q0=fi(sh),DB=ee({},sh,{dataTransfer:0}),PB=fi(DB),IB=ee({},ol,{relatedTarget:0}),Sf=fi(IB),$B=ee({},Yo,{animationName:0,elapsedTime:0,pseudoElement:0}),jB=fi($B),zB=ee({},Yo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),OB=fi(zB),FB=ee({},Yo,{data:0}),U0=fi(FB),NB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WB={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},HB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qB(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=HB[o])?!!c[o]:!1}function wf(){return qB}var UB=ee({},ol,{key:function(o){if(o.key){var c=NB[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=ih(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?WB[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wf,charCode:function(o){return o.type==="keypress"?ih(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?ih(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),VB=fi(UB),GB=ee({},sh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),V0=fi(GB),YB=ee({},ol,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wf}),KB=fi(YB),XB=ee({},Yo,{propertyName:0,elapsedTime:0,pseudoElement:0}),QB=fi(XB),ZB=ee({},sh,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),JB=fi(ZB),eM=[9,13,27,32],Cf=l&&"CompositionEvent"in window,ll=null;l&&"documentMode"in document&&(ll=document.documentMode);var tM=l&&"TextEvent"in window&&!ll,G0=l&&(!Cf||ll&&8<ll&&11>=ll),Y0=" ",K0=!1;function X0(o,c){switch(o){case"keyup":return eM.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Q0(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ko=!1;function rM(o,c){switch(o){case"compositionend":return Q0(c);case"keypress":return c.which!==32?null:(K0=!0,Y0);case"textInput":return o=c.data,o===Y0&&K0?null:o;default:return null}}function iM(o,c){if(Ko)return o==="compositionend"||!Cf&&X0(o,c)?(o=W0(),rh=_f=ps=null,Ko=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return G0&&c.locale!=="ko"?null:c.data;default:return null}}var nM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Z0(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!nM[o.type]:c==="textarea"}function J0(o,c,f,_){Vo(_),c=hh(c,"onChange"),0<c.length&&(f=new xf("onChange","change",null,f,_),o.push({event:f,listeners:c}))}var cl=null,hl=null;function sM(o){y_(o,0)}function oh(o){var c=ea(o);if(it(c))return o}function oM(o,c){if(o==="change")return c}var e_=!1;if(l){var kf;if(l){var Tf="oninput"in document;if(!Tf){var t_=document.createElement("div");t_.setAttribute("oninput","return;"),Tf=typeof t_.oninput=="function"}kf=Tf}else kf=!1;e_=kf&&(!document.documentMode||9<document.documentMode)}function r_(){cl&&(cl.detachEvent("onpropertychange",i_),hl=cl=null)}function i_(o){if(o.propertyName==="value"&&oh(hl)){var c=[];J0(c,hl,o,dn(o)),zn(sM,c)}}function aM(o,c,f){o==="focusin"?(r_(),cl=c,hl=f,cl.attachEvent("onpropertychange",i_)):o==="focusout"&&r_()}function lM(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return oh(hl)}function cM(o,c){if(o==="click")return oh(c)}function hM(o,c){if(o==="input"||o==="change")return oh(c)}function uM(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Yi=typeof Object.is=="function"?Object.is:uM;function ul(o,c){if(Yi(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var f=Object.keys(o),_=Object.keys(c);if(f.length!==_.length)return!1;for(_=0;_<f.length;_++){var b=f[_];if(!u.call(c,b)||!Yi(o[b],c[b]))return!1}return!0}function n_(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function s_(o,c){var f=n_(o);o=0;for(var _;f;){if(f.nodeType===3){if(_=o+f.textContent.length,o<=c&&_>=c)return{node:f,offset:c-o};o=_}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=n_(f)}}function o_(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?o_(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function a_(){for(var o=window,c=Oe();c instanceof o.HTMLIFrameElement;){try{var f=typeof c.contentWindow.location.href=="string"}catch{f=!1}if(f)o=c.contentWindow;else break;c=Oe(o.document)}return c}function Ef(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}function dM(o){var c=a_(),f=o.focusedElem,_=o.selectionRange;if(c!==f&&f&&f.ownerDocument&&o_(f.ownerDocument.documentElement,f)){if(_!==null&&Ef(f)){if(c=_.start,o=_.end,o===void 0&&(o=c),"selectionStart"in f)f.selectionStart=c,f.selectionEnd=Math.min(o,f.value.length);else if(o=(c=f.ownerDocument||document)&&c.defaultView||window,o.getSelection){o=o.getSelection();var b=f.textContent.length,w=Math.min(_.start,b);_=_.end===void 0?w:Math.min(_.end,b),!o.extend&&w>_&&(b=_,_=w,w=b),b=s_(f,w);var D=s_(f,_);b&&D&&(o.rangeCount!==1||o.anchorNode!==b.node||o.anchorOffset!==b.offset||o.focusNode!==D.node||o.focusOffset!==D.offset)&&(c=c.createRange(),c.setStart(b.node,b.offset),o.removeAllRanges(),w>_?(o.addRange(c),o.extend(D.node,D.offset)):(c.setEnd(D.node,D.offset),o.addRange(c)))}}for(c=[],o=f;o=o.parentNode;)o.nodeType===1&&c.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<c.length;f++)o=c[f],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var fM=l&&"documentMode"in document&&11>=document.documentMode,Xo=null,Bf=null,dl=null,Mf=!1;function l_(o,c,f){var _=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;Mf||Xo==null||Xo!==Oe(_)||(_=Xo,"selectionStart"in _&&Ef(_)?_={start:_.selectionStart,end:_.selectionEnd}:(_=(_.ownerDocument&&_.ownerDocument.defaultView||window).getSelection(),_={anchorNode:_.anchorNode,anchorOffset:_.anchorOffset,focusNode:_.focusNode,focusOffset:_.focusOffset}),dl&&ul(dl,_)||(dl=_,_=hh(Bf,"onSelect"),0<_.length&&(c=new xf("onSelect","select",null,c,f),o.push({event:c,listeners:_}),c.target=Xo)))}function ah(o,c){var f={};return f[o.toLowerCase()]=c.toLowerCase(),f["Webkit"+o]="webkit"+c,f["Moz"+o]="moz"+c,f}var Qo={animationend:ah("Animation","AnimationEnd"),animationiteration:ah("Animation","AnimationIteration"),animationstart:ah("Animation","AnimationStart"),transitionend:ah("Transition","TransitionEnd")},Lf={},c_={};l&&(c_=document.createElement("div").style,"AnimationEvent"in window||(delete Qo.animationend.animation,delete Qo.animationiteration.animation,delete Qo.animationstart.animation),"TransitionEvent"in window||delete Qo.transitionend.transition);function lh(o){if(Lf[o])return Lf[o];if(!Qo[o])return o;var c=Qo[o],f;for(f in c)if(c.hasOwnProperty(f)&&f in c_)return Lf[o]=c[f];return o}var h_=lh("animationend"),u_=lh("animationiteration"),d_=lh("animationstart"),f_=lh("transitionend"),p_=new Map,g_="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function gs(o,c){p_.set(o,c),s(c,[o])}for(var Rf=0;Rf<g_.length;Rf++){var Af=g_[Rf],pM=Af.toLowerCase(),gM=Af[0].toUpperCase()+Af.slice(1);gs(pM,"on"+gM)}gs(h_,"onAnimationEnd"),gs(u_,"onAnimationIteration"),gs(d_,"onAnimationStart"),gs("dblclick","onDoubleClick"),gs("focusin","onFocus"),gs("focusout","onBlur"),gs(f_,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),mM=new Set("cancel close invalid load scroll toggle".split(" ").concat(fl));function m_(o,c,f){var _=o.type||"unknown-event";o.currentTarget=f,se(_,c,void 0,o),o.currentTarget=null}function y_(o,c){c=(c&4)!==0;for(var f=0;f<o.length;f++){var _=o[f],b=_.event;_=_.listeners;e:{var w=void 0;if(c)for(var D=_.length-1;0<=D;D--){var N=_[D],G=N.instance,ie=N.currentTarget;if(N=N.listener,G!==w&&b.isPropagationStopped())break e;m_(b,N,ie),w=G}else for(D=0;D<_.length;D++){if(N=_[D],G=N.instance,ie=N.currentTarget,N=N.listener,G!==w&&b.isPropagationStopped())break e;m_(b,N,ie),w=G}}}if(mn)throw o=Fn,mn=!1,Fn=null,o}function Ct(o,c){var f=c[Ff];f===void 0&&(f=c[Ff]=new Set);var _=o+"__bubble";f.has(_)||(__(c,o,2,!1),f.add(_))}function Df(o,c,f){var _=0;c&&(_|=4),__(f,o,_,c)}var ch="_reactListening"+Math.random().toString(36).slice(2);function pl(o){if(!o[ch]){o[ch]=!0,i.forEach(function(f){f!=="selectionchange"&&(mM.has(f)||Df(f,!1,o),Df(f,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[ch]||(c[ch]=!0,Df("selectionchange",!1,c))}}function __(o,c,f,_){switch(N0(c)){case 1:var b=LB;break;case 4:b=RB;break;default:b=mf}f=b.bind(null,c,f,o),b=void 0,!On||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(b=!0),_?b!==void 0?o.addEventListener(c,f,{capture:!0,passive:b}):o.addEventListener(c,f,!0):b!==void 0?o.addEventListener(c,f,{passive:b}):o.addEventListener(c,f,!1)}function Pf(o,c,f,_,b){var w=_;if((c&1)===0&&(c&2)===0&&_!==null)e:for(;;){if(_===null)return;var D=_.tag;if(D===3||D===4){var N=_.stateNode.containerInfo;if(N===b||N.nodeType===8&&N.parentNode===b)break;if(D===4)for(D=_.return;D!==null;){var G=D.tag;if((G===3||G===4)&&(G=D.stateNode.containerInfo,G===b||G.nodeType===8&&G.parentNode===b))return;D=D.return}for(;N!==null;){if(D=eo(N),D===null)return;if(G=D.tag,G===5||G===6){_=w=D;continue e}N=N.parentNode}}_=_.return}zn(function(){var ie=w,pe=dn(f),ge=[];e:{var de=p_.get(o);if(de!==void 0){var ke=xf,Me=o;switch(o){case"keypress":if(ih(f)===0)break e;case"keydown":case"keyup":ke=VB;break;case"focusin":Me="focus",ke=Sf;break;case"focusout":Me="blur",ke=Sf;break;case"beforeblur":case"afterblur":ke=Sf;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=q0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=PB;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=KB;break;case h_:case u_:case d_:ke=jB;break;case f_:ke=QB;break;case"scroll":ke=AB;break;case"wheel":ke=JB;break;case"copy":case"cut":case"paste":ke=OB;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=V0}var Pe=(c&4)!==0,Nt=!Pe&&o==="scroll",te=Pe?de!==null?de+"Capture":null:de;Pe=[];for(var K=ie,re;K!==null;){re=K;var me=re.stateNode;if(re.tag===5&&me!==null&&(re=me,te!==null&&(me=Ci(K,te),me!=null&&Pe.push(gl(K,me,re)))),Nt)break;K=K.return}0<Pe.length&&(de=new ke(de,Me,null,f,pe),ge.push({event:de,listeners:Pe}))}}if((c&7)===0){e:{if(de=o==="mouseover"||o==="pointerover",ke=o==="mouseout"||o==="pointerout",de&&f!==Hi&&(Me=f.relatedTarget||f.fromElement)&&(eo(Me)||Me[Nn]))break e;if((ke||de)&&(de=pe.window===pe?pe:(de=pe.ownerDocument)?de.defaultView||de.parentWindow:window,ke?(Me=f.relatedTarget||f.toElement,ke=ie,Me=Me?eo(Me):null,Me!==null&&(Nt=Se(Me),Me!==Nt||Me.tag!==5&&Me.tag!==6)&&(Me=null)):(ke=null,Me=ie),ke!==Me)){if(Pe=q0,me="onMouseLeave",te="onMouseEnter",K="mouse",(o==="pointerout"||o==="pointerover")&&(Pe=V0,me="onPointerLeave",te="onPointerEnter",K="pointer"),Nt=ke==null?de:ea(ke),re=Me==null?de:ea(Me),de=new Pe(me,K+"leave",ke,f,pe),de.target=Nt,de.relatedTarget=re,me=null,eo(pe)===ie&&(Pe=new Pe(te,K+"enter",Me,f,pe),Pe.target=re,Pe.relatedTarget=Nt,me=Pe),Nt=me,ke&&Me)t:{for(Pe=ke,te=Me,K=0,re=Pe;re;re=Zo(re))K++;for(re=0,me=te;me;me=Zo(me))re++;for(;0<K-re;)Pe=Zo(Pe),K--;for(;0<re-K;)te=Zo(te),re--;for(;K--;){if(Pe===te||te!==null&&Pe===te.alternate)break t;Pe=Zo(Pe),te=Zo(te)}Pe=null}else Pe=null;ke!==null&&x_(ge,de,ke,Pe,!1),Me!==null&&Nt!==null&&x_(ge,Nt,Me,Pe,!0)}}e:{if(de=ie?ea(ie):window,ke=de.nodeName&&de.nodeName.toLowerCase(),ke==="select"||ke==="input"&&de.type==="file")var je=oM;else if(Z0(de))if(e_)je=hM;else{je=lM;var We=aM}else(ke=de.nodeName)&&ke.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(je=cM);if(je&&(je=je(o,ie))){J0(ge,je,f,pe);break e}We&&We(o,de,ie),o==="focusout"&&(We=de._wrapperState)&&We.controlled&&de.type==="number"&&qt(de,"number",de.value)}switch(We=ie?ea(ie):window,o){case"focusin":(Z0(We)||We.contentEditable==="true")&&(Xo=We,Bf=ie,dl=null);break;case"focusout":dl=Bf=Xo=null;break;case"mousedown":Mf=!0;break;case"contextmenu":case"mouseup":case"dragend":Mf=!1,l_(ge,f,pe);break;case"selectionchange":if(fM)break;case"keydown":case"keyup":l_(ge,f,pe)}var He;if(Cf)e:{switch(o){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else Ko?X0(o,f)&&(Ve="onCompositionEnd"):o==="keydown"&&f.keyCode===229&&(Ve="onCompositionStart");Ve&&(G0&&f.locale!=="ko"&&(Ko||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Ko&&(He=W0()):(ps=pe,_f="value"in ps?ps.value:ps.textContent,Ko=!0)),We=hh(ie,Ve),0<We.length&&(Ve=new U0(Ve,o,null,f,pe),ge.push({event:Ve,listeners:We}),He?Ve.data=He:(He=Q0(f),He!==null&&(Ve.data=He)))),(He=tM?rM(o,f):iM(o,f))&&(ie=hh(ie,"onBeforeInput"),0<ie.length&&(pe=new U0("onBeforeInput","beforeinput",null,f,pe),ge.push({event:pe,listeners:ie}),pe.data=He))}y_(ge,c)})}function gl(o,c,f){return{instance:o,listener:c,currentTarget:f}}function hh(o,c){for(var f=c+"Capture",_=[];o!==null;){var b=o,w=b.stateNode;b.tag===5&&w!==null&&(b=w,w=Ci(o,f),w!=null&&_.unshift(gl(o,w,b)),w=Ci(o,c),w!=null&&_.push(gl(o,w,b))),o=o.return}return _}function Zo(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function x_(o,c,f,_,b){for(var w=c._reactName,D=[];f!==null&&f!==_;){var N=f,G=N.alternate,ie=N.stateNode;if(G!==null&&G===_)break;N.tag===5&&ie!==null&&(N=ie,b?(G=Ci(f,w),G!=null&&D.unshift(gl(f,G,N))):b||(G=Ci(f,w),G!=null&&D.push(gl(f,G,N)))),f=f.return}D.length!==0&&o.push({event:c,listeners:D})}var yM=/\r\n?/g,_M=/\u0000|\uFFFD/g;function v_(o){return(typeof o=="string"?o:""+o).replace(yM,`
|
|
39
|
+
`).replace(_M,"")}function uh(o,c,f){if(c=v_(c),v_(o)!==c&&f)throw Error(r(425))}function dh(){}var If=null,$f=null;function jf(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var zf=typeof setTimeout=="function"?setTimeout:void 0,xM=typeof clearTimeout=="function"?clearTimeout:void 0,b_=typeof Promise=="function"?Promise:void 0,vM=typeof queueMicrotask=="function"?queueMicrotask:typeof b_<"u"?function(o){return b_.resolve(null).then(o).catch(bM)}:zf;function bM(o){setTimeout(function(){throw o})}function Of(o,c){var f=c,_=0;do{var b=f.nextSibling;if(o.removeChild(f),b&&b.nodeType===8)if(f=b.data,f==="/$"){if(_===0){o.removeChild(b),sl(c);return}_--}else f!=="$"&&f!=="$?"&&f!=="$!"||_++;f=b}while(f);sl(c)}function ms(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return o}function S_(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var f=o.data;if(f==="$"||f==="$!"||f==="$?"){if(c===0)return o;c--}else f==="/$"&&c++}o=o.previousSibling}return null}var Jo=Math.random().toString(36).slice(2),yn="__reactFiber$"+Jo,ml="__reactProps$"+Jo,Nn="__reactContainer$"+Jo,Ff="__reactEvents$"+Jo,SM="__reactListeners$"+Jo,wM="__reactHandles$"+Jo;function eo(o){var c=o[yn];if(c)return c;for(var f=o.parentNode;f;){if(c=f[Nn]||f[yn]){if(f=c.alternate,c.child!==null||f!==null&&f.child!==null)for(o=S_(o);o!==null;){if(f=o[yn])return f;o=S_(o)}return c}o=f,f=o.parentNode}return null}function yl(o){return o=o[yn]||o[Nn],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function ea(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(r(33))}function fh(o){return o[ml]||null}var Nf=[],ta=-1;function ys(o){return{current:o}}function kt(o){0>ta||(o.current=Nf[ta],Nf[ta]=null,ta--)}function bt(o,c){ta++,Nf[ta]=o.current,o.current=c}var _s={},Er=ys(_s),Zr=ys(!1),to=_s;function ra(o,c){var f=o.type.contextTypes;if(!f)return _s;var _=o.stateNode;if(_&&_.__reactInternalMemoizedUnmaskedChildContext===c)return _.__reactInternalMemoizedMaskedChildContext;var b={},w;for(w in f)b[w]=c[w];return _&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=b),b}function Jr(o){return o=o.childContextTypes,o!=null}function ph(){kt(Zr),kt(Er)}function w_(o,c,f){if(Er.current!==_s)throw Error(r(168));bt(Er,c),bt(Zr,f)}function C_(o,c,f){var _=o.stateNode;if(c=c.childContextTypes,typeof _.getChildContext!="function")return f;_=_.getChildContext();for(var b in _)if(!(b in c))throw Error(r(108,ye(o)||"Unknown",b));return ee({},f,_)}function gh(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||_s,to=Er.current,bt(Er,o),bt(Zr,Zr.current),!0}function k_(o,c,f){var _=o.stateNode;if(!_)throw Error(r(169));f?(o=C_(o,c,to),_.__reactInternalMemoizedMergedChildContext=o,kt(Zr),kt(Er),bt(Er,o)):kt(Zr),bt(Zr,f)}var Wn=null,mh=!1,Wf=!1;function T_(o){Wn===null?Wn=[o]:Wn.push(o)}function CM(o){mh=!0,T_(o)}function xs(){if(!Wf&&Wn!==null){Wf=!0;var o=0,c=pt;try{var f=Wn;for(pt=1;o<f.length;o++){var _=f[o];do _=_(!0);while(_!==null)}Wn=null,mh=!1}catch(b){throw Wn!==null&&(Wn=Wn.slice(o+1)),U(hr,xs),b}finally{pt=c,Wf=!1}}return null}var ia=[],na=0,yh=null,_h=0,Ti=[],Ei=0,ro=null,Hn=1,qn="";function io(o,c){ia[na++]=_h,ia[na++]=yh,yh=o,_h=c}function E_(o,c,f){Ti[Ei++]=Hn,Ti[Ei++]=qn,Ti[Ei++]=ro,ro=o;var _=Hn;o=qn;var b=32-Gi(_)-1;_&=~(1<<b),f+=1;var w=32-Gi(c)+b;if(30<w){var D=b-b%5;w=(_&(1<<D)-1).toString(32),_>>=D,b-=D,Hn=1<<32-Gi(c)+b|f<<b|_,qn=w+o}else Hn=1<<w|f<<b|_,qn=o}function Hf(o){o.return!==null&&(io(o,1),E_(o,1,0))}function qf(o){for(;o===yh;)yh=ia[--na],ia[na]=null,_h=ia[--na],ia[na]=null;for(;o===ro;)ro=Ti[--Ei],Ti[Ei]=null,qn=Ti[--Ei],Ti[Ei]=null,Hn=Ti[--Ei],Ti[Ei]=null}var pi=null,gi=null,Mt=!1,Ki=null;function B_(o,c){var f=Ri(5,null,null,0);f.elementType="DELETED",f.stateNode=c,f.return=o,c=o.deletions,c===null?(o.deletions=[f],o.flags|=16):c.push(f)}function M_(o,c){switch(o.tag){case 5:var f=o.type;return c=c.nodeType!==1||f.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(o.stateNode=c,pi=o,gi=ms(c.firstChild),!0):!1;case 6:return c=o.pendingProps===""||c.nodeType!==3?null:c,c!==null?(o.stateNode=c,pi=o,gi=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(f=ro!==null?{id:Hn,overflow:qn}:null,o.memoizedState={dehydrated:c,treeContext:f,retryLane:1073741824},f=Ri(18,null,null,0),f.stateNode=c,f.return=o,o.child=f,pi=o,gi=null,!0):!1;default:return!1}}function Uf(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Vf(o){if(Mt){var c=gi;if(c){var f=c;if(!M_(o,c)){if(Uf(o))throw Error(r(418));c=ms(f.nextSibling);var _=pi;c&&M_(o,c)?B_(_,f):(o.flags=o.flags&-4097|2,Mt=!1,pi=o)}}else{if(Uf(o))throw Error(r(418));o.flags=o.flags&-4097|2,Mt=!1,pi=o}}}function L_(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;pi=o}function xh(o){if(o!==pi)return!1;if(!Mt)return L_(o),Mt=!0,!1;var c;if((c=o.tag!==3)&&!(c=o.tag!==5)&&(c=o.type,c=c!=="head"&&c!=="body"&&!jf(o.type,o.memoizedProps)),c&&(c=gi)){if(Uf(o))throw R_(),Error(r(418));for(;c;)B_(o,c),c=ms(c.nextSibling)}if(L_(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));e:{for(o=o.nextSibling,c=0;o;){if(o.nodeType===8){var f=o.data;if(f==="/$"){if(c===0){gi=ms(o.nextSibling);break e}c--}else f!=="$"&&f!=="$!"&&f!=="$?"||c++}o=o.nextSibling}gi=null}}else gi=pi?ms(o.stateNode.nextSibling):null;return!0}function R_(){for(var o=gi;o;)o=ms(o.nextSibling)}function sa(){gi=pi=null,Mt=!1}function Gf(o){Ki===null?Ki=[o]:Ki.push(o)}var kM=B.ReactCurrentBatchConfig;function _l(o,c,f){if(o=f.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(r(309));var _=f.stateNode}if(!_)throw Error(r(147,o));var b=_,w=""+o;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===w?c.ref:(c=function(D){var N=b.refs;D===null?delete N[w]:N[w]=D},c._stringRef=w,c)}if(typeof o!="string")throw Error(r(284));if(!f._owner)throw Error(r(290,o))}return o}function vh(o,c){throw o=Object.prototype.toString.call(c),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o))}function A_(o){var c=o._init;return c(o._payload)}function D_(o){function c(te,K){if(o){var re=te.deletions;re===null?(te.deletions=[K],te.flags|=16):re.push(K)}}function f(te,K){if(!o)return null;for(;K!==null;)c(te,K),K=K.sibling;return null}function _(te,K){for(te=new Map;K!==null;)K.key!==null?te.set(K.key,K):te.set(K.index,K),K=K.sibling;return te}function b(te,K){return te=Es(te,K),te.index=0,te.sibling=null,te}function w(te,K,re){return te.index=re,o?(re=te.alternate,re!==null?(re=re.index,re<K?(te.flags|=2,K):re):(te.flags|=2,K)):(te.flags|=1048576,K)}function D(te){return o&&te.alternate===null&&(te.flags|=2),te}function N(te,K,re,me){return K===null||K.tag!==6?(K=zp(re,te.mode,me),K.return=te,K):(K=b(K,re),K.return=te,K)}function G(te,K,re,me){var je=re.type;return je===A?pe(te,K,re.props.children,me,re.key):K!==null&&(K.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===j&&A_(je)===K.type)?(me=b(K,re.props),me.ref=_l(te,K,re),me.return=te,me):(me=qh(re.type,re.key,re.props,null,te.mode,me),me.ref=_l(te,K,re),me.return=te,me)}function ie(te,K,re,me){return K===null||K.tag!==4||K.stateNode.containerInfo!==re.containerInfo||K.stateNode.implementation!==re.implementation?(K=Op(re,te.mode,me),K.return=te,K):(K=b(K,re.children||[]),K.return=te,K)}function pe(te,K,re,me,je){return K===null||K.tag!==7?(K=uo(re,te.mode,me,je),K.return=te,K):(K=b(K,re),K.return=te,K)}function ge(te,K,re){if(typeof K=="string"&&K!==""||typeof K=="number")return K=zp(""+K,te.mode,re),K.return=te,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case R:return re=qh(K.type,K.key,K.props,null,te.mode,re),re.ref=_l(te,null,K),re.return=te,re;case k:return K=Op(K,te.mode,re),K.return=te,K;case j:var me=K._init;return ge(te,me(K._payload),re)}if(kr(K)||Q(K))return K=uo(K,te.mode,re,null),K.return=te,K;vh(te,K)}return null}function de(te,K,re,me){var je=K!==null?K.key:null;if(typeof re=="string"&&re!==""||typeof re=="number")return je!==null?null:N(te,K,""+re,me);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case R:return re.key===je?G(te,K,re,me):null;case k:return re.key===je?ie(te,K,re,me):null;case j:return je=re._init,de(te,K,je(re._payload),me)}if(kr(re)||Q(re))return je!==null?null:pe(te,K,re,me,null);vh(te,re)}return null}function ke(te,K,re,me,je){if(typeof me=="string"&&me!==""||typeof me=="number")return te=te.get(re)||null,N(K,te,""+me,je);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case R:return te=te.get(me.key===null?re:me.key)||null,G(K,te,me,je);case k:return te=te.get(me.key===null?re:me.key)||null,ie(K,te,me,je);case j:var We=me._init;return ke(te,K,re,We(me._payload),je)}if(kr(me)||Q(me))return te=te.get(re)||null,pe(K,te,me,je,null);vh(K,me)}return null}function Me(te,K,re,me){for(var je=null,We=null,He=K,Ve=K=0,fr=null;He!==null&&Ve<re.length;Ve++){He.index>Ve?(fr=He,He=null):fr=He.sibling;var at=de(te,He,re[Ve],me);if(at===null){He===null&&(He=fr);break}o&&He&&at.alternate===null&&c(te,He),K=w(at,K,Ve),We===null?je=at:We.sibling=at,We=at,He=fr}if(Ve===re.length)return f(te,He),Mt&&io(te,Ve),je;if(He===null){for(;Ve<re.length;Ve++)He=ge(te,re[Ve],me),He!==null&&(K=w(He,K,Ve),We===null?je=He:We.sibling=He,We=He);return Mt&&io(te,Ve),je}for(He=_(te,He);Ve<re.length;Ve++)fr=ke(He,te,Ve,re[Ve],me),fr!==null&&(o&&fr.alternate!==null&&He.delete(fr.key===null?Ve:fr.key),K=w(fr,K,Ve),We===null?je=fr:We.sibling=fr,We=fr);return o&&He.forEach(function(Bs){return c(te,Bs)}),Mt&&io(te,Ve),je}function Pe(te,K,re,me){var je=Q(re);if(typeof je!="function")throw Error(r(150));if(re=je.call(re),re==null)throw Error(r(151));for(var We=je=null,He=K,Ve=K=0,fr=null,at=re.next();He!==null&&!at.done;Ve++,at=re.next()){He.index>Ve?(fr=He,He=null):fr=He.sibling;var Bs=de(te,He,at.value,me);if(Bs===null){He===null&&(He=fr);break}o&&He&&Bs.alternate===null&&c(te,He),K=w(Bs,K,Ve),We===null?je=Bs:We.sibling=Bs,We=Bs,He=fr}if(at.done)return f(te,He),Mt&&io(te,Ve),je;if(He===null){for(;!at.done;Ve++,at=re.next())at=ge(te,at.value,me),at!==null&&(K=w(at,K,Ve),We===null?je=at:We.sibling=at,We=at);return Mt&&io(te,Ve),je}for(He=_(te,He);!at.done;Ve++,at=re.next())at=ke(He,te,Ve,at.value,me),at!==null&&(o&&at.alternate!==null&&He.delete(at.key===null?Ve:at.key),K=w(at,K,Ve),We===null?je=at:We.sibling=at,We=at);return o&&He.forEach(function(nL){return c(te,nL)}),Mt&&io(te,Ve),je}function Nt(te,K,re,me){if(typeof re=="object"&&re!==null&&re.type===A&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case R:e:{for(var je=re.key,We=K;We!==null;){if(We.key===je){if(je=re.type,je===A){if(We.tag===7){f(te,We.sibling),K=b(We,re.props.children),K.return=te,te=K;break e}}else if(We.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===j&&A_(je)===We.type){f(te,We.sibling),K=b(We,re.props),K.ref=_l(te,We,re),K.return=te,te=K;break e}f(te,We);break}else c(te,We);We=We.sibling}re.type===A?(K=uo(re.props.children,te.mode,me,re.key),K.return=te,te=K):(me=qh(re.type,re.key,re.props,null,te.mode,me),me.ref=_l(te,K,re),me.return=te,te=me)}return D(te);case k:e:{for(We=re.key;K!==null;){if(K.key===We)if(K.tag===4&&K.stateNode.containerInfo===re.containerInfo&&K.stateNode.implementation===re.implementation){f(te,K.sibling),K=b(K,re.children||[]),K.return=te,te=K;break e}else{f(te,K);break}else c(te,K);K=K.sibling}K=Op(re,te.mode,me),K.return=te,te=K}return D(te);case j:return We=re._init,Nt(te,K,We(re._payload),me)}if(kr(re))return Me(te,K,re,me);if(Q(re))return Pe(te,K,re,me);vh(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"?(re=""+re,K!==null&&K.tag===6?(f(te,K.sibling),K=b(K,re),K.return=te,te=K):(f(te,K),K=zp(re,te.mode,me),K.return=te,te=K),D(te)):f(te,K)}return Nt}var oa=D_(!0),P_=D_(!1),bh=ys(null),Sh=null,aa=null,Yf=null;function Kf(){Yf=aa=Sh=null}function Xf(o){var c=bh.current;kt(bh),o._currentValue=c}function Qf(o,c,f){for(;o!==null;){var _=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,_!==null&&(_.childLanes|=c)):_!==null&&(_.childLanes&c)!==c&&(_.childLanes|=c),o===f)break;o=o.return}}function la(o,c){Sh=o,Yf=aa=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&c)!==0&&(ei=!0),o.firstContext=null)}function Bi(o){var c=o._currentValue;if(Yf!==o)if(o={context:o,memoizedValue:c,next:null},aa===null){if(Sh===null)throw Error(r(308));aa=o,Sh.dependencies={lanes:0,firstContext:o}}else aa=aa.next=o;return c}var no=null;function Zf(o){no===null?no=[o]:no.push(o)}function I_(o,c,f,_){var b=c.interleaved;return b===null?(f.next=f,Zf(c)):(f.next=b.next,b.next=f),c.interleaved=f,Un(o,_)}function Un(o,c){o.lanes|=c;var f=o.alternate;for(f!==null&&(f.lanes|=c),f=o,o=o.return;o!==null;)o.childLanes|=c,f=o.alternate,f!==null&&(f.childLanes|=c),f=o,o=o.return;return f.tag===3?f.stateNode:null}var vs=!1;function Jf(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $_(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Vn(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function bs(o,c,f){var _=o.updateQueue;if(_===null)return null;if(_=_.shared,(ot&2)!==0){var b=_.pending;return b===null?c.next=c:(c.next=b.next,b.next=c),_.pending=c,Un(o,f)}return b=_.interleaved,b===null?(c.next=c,Zf(_)):(c.next=b.next,b.next=c),_.interleaved=c,Un(o,f)}function wh(o,c,f){if(c=c.updateQueue,c!==null&&(c=c.shared,(f&4194240)!==0)){var _=c.lanes;_&=o.pendingLanes,f|=_,c.lanes=f,ff(o,f)}}function j_(o,c){var f=o.updateQueue,_=o.alternate;if(_!==null&&(_=_.updateQueue,f===_)){var b=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var D={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};w===null?b=w=D:w=w.next=D,f=f.next}while(f!==null);w===null?b=w=c:w=w.next=c}else b=w=c;f={baseState:_.baseState,firstBaseUpdate:b,lastBaseUpdate:w,shared:_.shared,effects:_.effects},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=c:o.next=c,f.lastBaseUpdate=c}function Ch(o,c,f,_){var b=o.updateQueue;vs=!1;var w=b.firstBaseUpdate,D=b.lastBaseUpdate,N=b.shared.pending;if(N!==null){b.shared.pending=null;var G=N,ie=G.next;G.next=null,D===null?w=ie:D.next=ie,D=G;var pe=o.alternate;pe!==null&&(pe=pe.updateQueue,N=pe.lastBaseUpdate,N!==D&&(N===null?pe.firstBaseUpdate=ie:N.next=ie,pe.lastBaseUpdate=G))}if(w!==null){var ge=b.baseState;D=0,pe=ie=G=null,N=w;do{var de=N.lane,ke=N.eventTime;if((_&de)===de){pe!==null&&(pe=pe.next={eventTime:ke,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var Me=o,Pe=N;switch(de=c,ke=f,Pe.tag){case 1:if(Me=Pe.payload,typeof Me=="function"){ge=Me.call(ke,ge,de);break e}ge=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Pe.payload,de=typeof Me=="function"?Me.call(ke,ge,de):Me,de==null)break e;ge=ee({},ge,de);break e;case 2:vs=!0}}N.callback!==null&&N.lane!==0&&(o.flags|=64,de=b.effects,de===null?b.effects=[N]:de.push(N))}else ke={eventTime:ke,lane:de,tag:N.tag,payload:N.payload,callback:N.callback,next:null},pe===null?(ie=pe=ke,G=ge):pe=pe.next=ke,D|=de;if(N=N.next,N===null){if(N=b.shared.pending,N===null)break;de=N,N=de.next,de.next=null,b.lastBaseUpdate=de,b.shared.pending=null}}while(!0);if(pe===null&&(G=ge),b.baseState=G,b.firstBaseUpdate=ie,b.lastBaseUpdate=pe,c=b.shared.interleaved,c!==null){b=c;do D|=b.lane,b=b.next;while(b!==c)}else w===null&&(b.shared.lanes=0);ao|=D,o.lanes=D,o.memoizedState=ge}}function z_(o,c,f){if(o=c.effects,c.effects=null,o!==null)for(c=0;c<o.length;c++){var _=o[c],b=_.callback;if(b!==null){if(_.callback=null,_=f,typeof b!="function")throw Error(r(191,b));b.call(_)}}}var xl={},_n=ys(xl),vl=ys(xl),bl=ys(xl);function so(o){if(o===xl)throw Error(r(174));return o}function ep(o,c){switch(bt(bl,c),bt(vl,o),bt(_n,xl),o=c.nodeType,o){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:Tr(null,"");break;default:o=o===8?c.parentNode:c,c=o.namespaceURI||null,o=o.tagName,c=Tr(c,o)}kt(_n),bt(_n,c)}function ca(){kt(_n),kt(vl),kt(bl)}function O_(o){so(bl.current);var c=so(_n.current),f=Tr(c,o.type);c!==f&&(bt(vl,o),bt(_n,f))}function tp(o){vl.current===o&&(kt(_n),kt(vl))}var Dt=ys(0);function kh(o){for(var c=o;c!==null;){if(c.tag===13){var f=c.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var rp=[];function ip(){for(var o=0;o<rp.length;o++)rp[o]._workInProgressVersionPrimary=null;rp.length=0}var Th=B.ReactCurrentDispatcher,np=B.ReactCurrentBatchConfig,oo=0,Pt=null,Zt=null,ur=null,Eh=!1,Sl=!1,wl=0,TM=0;function Br(){throw Error(r(321))}function sp(o,c){if(c===null)return!1;for(var f=0;f<c.length&&f<o.length;f++)if(!Yi(o[f],c[f]))return!1;return!0}function op(o,c,f,_,b,w){if(oo=w,Pt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Th.current=o===null||o.memoizedState===null?LM:RM,o=f(_,b),Sl){w=0;do{if(Sl=!1,wl=0,25<=w)throw Error(r(301));w+=1,ur=Zt=null,c.updateQueue=null,Th.current=AM,o=f(_,b)}while(Sl)}if(Th.current=Lh,c=Zt!==null&&Zt.next!==null,oo=0,ur=Zt=Pt=null,Eh=!1,c)throw Error(r(300));return o}function ap(){var o=wl!==0;return wl=0,o}function xn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ur===null?Pt.memoizedState=ur=o:ur=ur.next=o,ur}function Mi(){if(Zt===null){var o=Pt.alternate;o=o!==null?o.memoizedState:null}else o=Zt.next;var c=ur===null?Pt.memoizedState:ur.next;if(c!==null)ur=c,Zt=o;else{if(o===null)throw Error(r(310));Zt=o,o={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},ur===null?Pt.memoizedState=ur=o:ur=ur.next=o}return ur}function Cl(o,c){return typeof c=="function"?c(o):c}function lp(o){var c=Mi(),f=c.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=o;var _=Zt,b=_.baseQueue,w=f.pending;if(w!==null){if(b!==null){var D=b.next;b.next=w.next,w.next=D}_.baseQueue=b=w,f.pending=null}if(b!==null){w=b.next,_=_.baseState;var N=D=null,G=null,ie=w;do{var pe=ie.lane;if((oo&pe)===pe)G!==null&&(G=G.next={lane:0,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),_=ie.hasEagerState?ie.eagerState:o(_,ie.action);else{var ge={lane:pe,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};G===null?(N=G=ge,D=_):G=G.next=ge,Pt.lanes|=pe,ao|=pe}ie=ie.next}while(ie!==null&&ie!==w);G===null?D=_:G.next=N,Yi(_,c.memoizedState)||(ei=!0),c.memoizedState=_,c.baseState=D,c.baseQueue=G,f.lastRenderedState=_}if(o=f.interleaved,o!==null){b=o;do w=b.lane,Pt.lanes|=w,ao|=w,b=b.next;while(b!==o)}else b===null&&(f.lanes=0);return[c.memoizedState,f.dispatch]}function cp(o){var c=Mi(),f=c.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=o;var _=f.dispatch,b=f.pending,w=c.memoizedState;if(b!==null){f.pending=null;var D=b=b.next;do w=o(w,D.action),D=D.next;while(D!==b);Yi(w,c.memoizedState)||(ei=!0),c.memoizedState=w,c.baseQueue===null&&(c.baseState=w),f.lastRenderedState=w}return[w,_]}function F_(){}function N_(o,c){var f=Pt,_=Mi(),b=c(),w=!Yi(_.memoizedState,b);if(w&&(_.memoizedState=b,ei=!0),_=_.queue,hp(q_.bind(null,f,_,o),[o]),_.getSnapshot!==c||w||ur!==null&&ur.memoizedState.tag&1){if(f.flags|=2048,kl(9,H_.bind(null,f,_,b,c),void 0,null),dr===null)throw Error(r(349));(oo&30)!==0||W_(f,c,b)}return b}function W_(o,c,f){o.flags|=16384,o={getSnapshot:c,value:f},c=Pt.updateQueue,c===null?(c={lastEffect:null,stores:null},Pt.updateQueue=c,c.stores=[o]):(f=c.stores,f===null?c.stores=[o]:f.push(o))}function H_(o,c,f,_){c.value=f,c.getSnapshot=_,U_(c)&&V_(o)}function q_(o,c,f){return f(function(){U_(c)&&V_(o)})}function U_(o){var c=o.getSnapshot;o=o.value;try{var f=c();return!Yi(o,f)}catch{return!0}}function V_(o){var c=Un(o,1);c!==null&&Ji(c,o,1,-1)}function G_(o){var c=xn();return typeof o=="function"&&(o=o()),c.memoizedState=c.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:o},c.queue=o,o=o.dispatch=MM.bind(null,Pt,o),[c.memoizedState,o]}function kl(o,c,f,_){return o={tag:o,create:c,destroy:f,deps:_,next:null},c=Pt.updateQueue,c===null?(c={lastEffect:null,stores:null},Pt.updateQueue=c,c.lastEffect=o.next=o):(f=c.lastEffect,f===null?c.lastEffect=o.next=o:(_=f.next,f.next=o,o.next=_,c.lastEffect=o)),o}function Y_(){return Mi().memoizedState}function Bh(o,c,f,_){var b=xn();Pt.flags|=o,b.memoizedState=kl(1|c,f,void 0,_===void 0?null:_)}function Mh(o,c,f,_){var b=Mi();_=_===void 0?null:_;var w=void 0;if(Zt!==null){var D=Zt.memoizedState;if(w=D.destroy,_!==null&&sp(_,D.deps)){b.memoizedState=kl(c,f,w,_);return}}Pt.flags|=o,b.memoizedState=kl(1|c,f,w,_)}function K_(o,c){return Bh(8390656,8,o,c)}function hp(o,c){return Mh(2048,8,o,c)}function X_(o,c){return Mh(4,2,o,c)}function Q_(o,c){return Mh(4,4,o,c)}function Z_(o,c){if(typeof c=="function")return o=o(),c(o),function(){c(null)};if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function J_(o,c,f){return f=f!=null?f.concat([o]):null,Mh(4,4,Z_.bind(null,c,o),f)}function up(){}function ex(o,c){var f=Mi();c=c===void 0?null:c;var _=f.memoizedState;return _!==null&&c!==null&&sp(c,_[1])?_[0]:(f.memoizedState=[o,c],o)}function tx(o,c){var f=Mi();c=c===void 0?null:c;var _=f.memoizedState;return _!==null&&c!==null&&sp(c,_[1])?_[0]:(o=o(),f.memoizedState=[o,c],o)}function rx(o,c,f){return(oo&21)===0?(o.baseState&&(o.baseState=!1,ei=!0),o.memoizedState=f):(Yi(f,c)||(f=A0(),Pt.lanes|=f,ao|=f,o.baseState=!0),c)}function EM(o,c){var f=pt;pt=f!==0&&4>f?f:4,o(!0);var _=np.transition;np.transition={};try{o(!1),c()}finally{pt=f,np.transition=_}}function ix(){return Mi().memoizedState}function BM(o,c,f){var _=ks(o);if(f={lane:_,action:f,hasEagerState:!1,eagerState:null,next:null},nx(o))sx(c,f);else if(f=I_(o,c,f,_),f!==null){var b=Fr();Ji(f,o,_,b),ox(f,c,_)}}function MM(o,c,f){var _=ks(o),b={lane:_,action:f,hasEagerState:!1,eagerState:null,next:null};if(nx(o))sx(c,b);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=c.lastRenderedReducer,w!==null))try{var D=c.lastRenderedState,N=w(D,f);if(b.hasEagerState=!0,b.eagerState=N,Yi(N,D)){var G=c.interleaved;G===null?(b.next=b,Zf(c)):(b.next=G.next,G.next=b),c.interleaved=b;return}}catch{}finally{}f=I_(o,c,b,_),f!==null&&(b=Fr(),Ji(f,o,_,b),ox(f,c,_))}}function nx(o){var c=o.alternate;return o===Pt||c!==null&&c===Pt}function sx(o,c){Sl=Eh=!0;var f=o.pending;f===null?c.next=c:(c.next=f.next,f.next=c),o.pending=c}function ox(o,c,f){if((f&4194240)!==0){var _=c.lanes;_&=o.pendingLanes,f|=_,c.lanes=f,ff(o,f)}}var Lh={readContext:Bi,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},LM={readContext:Bi,useCallback:function(o,c){return xn().memoizedState=[o,c===void 0?null:c],o},useContext:Bi,useEffect:K_,useImperativeHandle:function(o,c,f){return f=f!=null?f.concat([o]):null,Bh(4194308,4,Z_.bind(null,c,o),f)},useLayoutEffect:function(o,c){return Bh(4194308,4,o,c)},useInsertionEffect:function(o,c){return Bh(4,2,o,c)},useMemo:function(o,c){var f=xn();return c=c===void 0?null:c,o=o(),f.memoizedState=[o,c],o},useReducer:function(o,c,f){var _=xn();return c=f!==void 0?f(c):c,_.memoizedState=_.baseState=c,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},_.queue=o,o=o.dispatch=BM.bind(null,Pt,o),[_.memoizedState,o]},useRef:function(o){var c=xn();return o={current:o},c.memoizedState=o},useState:G_,useDebugValue:up,useDeferredValue:function(o){return xn().memoizedState=o},useTransition:function(){var o=G_(!1),c=o[0];return o=EM.bind(null,o[1]),xn().memoizedState=o,[c,o]},useMutableSource:function(){},useSyncExternalStore:function(o,c,f){var _=Pt,b=xn();if(Mt){if(f===void 0)throw Error(r(407));f=f()}else{if(f=c(),dr===null)throw Error(r(349));(oo&30)!==0||W_(_,c,f)}b.memoizedState=f;var w={value:f,getSnapshot:c};return b.queue=w,K_(q_.bind(null,_,w,o),[o]),_.flags|=2048,kl(9,H_.bind(null,_,w,f,c),void 0,null),f},useId:function(){var o=xn(),c=dr.identifierPrefix;if(Mt){var f=qn,_=Hn;f=(_&~(1<<32-Gi(_)-1)).toString(32)+f,c=":"+c+"R"+f,f=wl++,0<f&&(c+="H"+f.toString(32)),c+=":"}else f=TM++,c=":"+c+"r"+f.toString(32)+":";return o.memoizedState=c},unstable_isNewReconciler:!1},RM={readContext:Bi,useCallback:ex,useContext:Bi,useEffect:hp,useImperativeHandle:J_,useInsertionEffect:X_,useLayoutEffect:Q_,useMemo:tx,useReducer:lp,useRef:Y_,useState:function(){return lp(Cl)},useDebugValue:up,useDeferredValue:function(o){var c=Mi();return rx(c,Zt.memoizedState,o)},useTransition:function(){var o=lp(Cl)[0],c=Mi().memoizedState;return[o,c]},useMutableSource:F_,useSyncExternalStore:N_,useId:ix,unstable_isNewReconciler:!1},AM={readContext:Bi,useCallback:ex,useContext:Bi,useEffect:hp,useImperativeHandle:J_,useInsertionEffect:X_,useLayoutEffect:Q_,useMemo:tx,useReducer:cp,useRef:Y_,useState:function(){return cp(Cl)},useDebugValue:up,useDeferredValue:function(o){var c=Mi();return Zt===null?c.memoizedState=o:rx(c,Zt.memoizedState,o)},useTransition:function(){var o=cp(Cl)[0],c=Mi().memoizedState;return[o,c]},useMutableSource:F_,useSyncExternalStore:N_,useId:ix,unstable_isNewReconciler:!1};function Xi(o,c){if(o&&o.defaultProps){c=ee({},c),o=o.defaultProps;for(var f in o)c[f]===void 0&&(c[f]=o[f]);return c}return c}function dp(o,c,f,_){c=o.memoizedState,f=f(_,c),f=f==null?c:ee({},c,f),o.memoizedState=f,o.lanes===0&&(o.updateQueue.baseState=f)}var Rh={isMounted:function(o){return(o=o._reactInternals)?Se(o)===o:!1},enqueueSetState:function(o,c,f){o=o._reactInternals;var _=Fr(),b=ks(o),w=Vn(_,b);w.payload=c,f!=null&&(w.callback=f),c=bs(o,w,b),c!==null&&(Ji(c,o,b,_),wh(c,o,b))},enqueueReplaceState:function(o,c,f){o=o._reactInternals;var _=Fr(),b=ks(o),w=Vn(_,b);w.tag=1,w.payload=c,f!=null&&(w.callback=f),c=bs(o,w,b),c!==null&&(Ji(c,o,b,_),wh(c,o,b))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var f=Fr(),_=ks(o),b=Vn(f,_);b.tag=2,c!=null&&(b.callback=c),c=bs(o,b,_),c!==null&&(Ji(c,o,_,f),wh(c,o,_))}};function ax(o,c,f,_,b,w,D){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(_,w,D):c.prototype&&c.prototype.isPureReactComponent?!ul(f,_)||!ul(b,w):!0}function lx(o,c,f){var _=!1,b=_s,w=c.contextType;return typeof w=="object"&&w!==null?w=Bi(w):(b=Jr(c)?to:Er.current,_=c.contextTypes,w=(_=_!=null)?ra(o,b):_s),c=new c(f,w),o.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Rh,o.stateNode=c,c._reactInternals=o,_&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=b,o.__reactInternalMemoizedMaskedChildContext=w),c}function cx(o,c,f,_){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(f,_),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(f,_),c.state!==o&&Rh.enqueueReplaceState(c,c.state,null)}function fp(o,c,f,_){var b=o.stateNode;b.props=f,b.state=o.memoizedState,b.refs={},Jf(o);var w=c.contextType;typeof w=="object"&&w!==null?b.context=Bi(w):(w=Jr(c)?to:Er.current,b.context=ra(o,w)),b.state=o.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(dp(o,c,w,f),b.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(c=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),c!==b.state&&Rh.enqueueReplaceState(b,b.state,null),Ch(o,f,b,_),b.state=o.memoizedState),typeof b.componentDidMount=="function"&&(o.flags|=4194308)}function ha(o,c){try{var f="",_=c;do f+=ne(_),_=_.return;while(_);var b=f}catch(w){b=`
|
|
40
|
+
Error generating stack: `+w.message+`
|
|
41
|
+
`+w.stack}return{value:o,source:c,stack:b,digest:null}}function pp(o,c,f){return{value:o,source:null,stack:f??null,digest:c??null}}function gp(o,c){try{console.error(c.value)}catch(f){setTimeout(function(){throw f})}}var DM=typeof WeakMap=="function"?WeakMap:Map;function hx(o,c,f){f=Vn(-1,f),f.tag=3,f.payload={element:null};var _=c.value;return f.callback=function(){zh||(zh=!0,Lp=_),gp(o,c)},f}function ux(o,c,f){f=Vn(-1,f),f.tag=3;var _=o.type.getDerivedStateFromError;if(typeof _=="function"){var b=c.value;f.payload=function(){return _(b)},f.callback=function(){gp(o,c)}}var w=o.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(f.callback=function(){gp(o,c),typeof _!="function"&&(ws===null?ws=new Set([this]):ws.add(this));var D=c.stack;this.componentDidCatch(c.value,{componentStack:D!==null?D:""})}),f}function dx(o,c,f){var _=o.pingCache;if(_===null){_=o.pingCache=new DM;var b=new Set;_.set(c,b)}else b=_.get(c),b===void 0&&(b=new Set,_.set(c,b));b.has(f)||(b.add(f),o=GM.bind(null,o,c,f),c.then(o,o))}function fx(o){do{var c;if((c=o.tag===13)&&(c=o.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return o;o=o.return}while(o!==null);return null}function px(o,c,f,_,b){return(o.mode&1)===0?(o===c?o.flags|=65536:(o.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(c=Vn(-1,1),c.tag=2,bs(f,c,1))),f.lanes|=1),o):(o.flags|=65536,o.lanes=b,o)}var PM=B.ReactCurrentOwner,ei=!1;function Or(o,c,f,_){c.child=o===null?P_(c,null,f,_):oa(c,o.child,f,_)}function gx(o,c,f,_,b){f=f.render;var w=c.ref;return la(c,b),_=op(o,c,f,_,w,b),f=ap(),o!==null&&!ei?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~b,Gn(o,c,b)):(Mt&&f&&Hf(c),c.flags|=1,Or(o,c,_,b),c.child)}function mx(o,c,f,_,b){if(o===null){var w=f.type;return typeof w=="function"&&!jp(w)&&w.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(c.tag=15,c.type=w,yx(o,c,w,_,b)):(o=qh(f.type,null,_,c,c.mode,b),o.ref=c.ref,o.return=c,c.child=o)}if(w=o.child,(o.lanes&b)===0){var D=w.memoizedProps;if(f=f.compare,f=f!==null?f:ul,f(D,_)&&o.ref===c.ref)return Gn(o,c,b)}return c.flags|=1,o=Es(w,_),o.ref=c.ref,o.return=c,c.child=o}function yx(o,c,f,_,b){if(o!==null){var w=o.memoizedProps;if(ul(w,_)&&o.ref===c.ref)if(ei=!1,c.pendingProps=_=w,(o.lanes&b)!==0)(o.flags&131072)!==0&&(ei=!0);else return c.lanes=o.lanes,Gn(o,c,b)}return mp(o,c,f,_,b)}function _x(o,c,f){var _=c.pendingProps,b=_.children,w=o!==null?o.memoizedState:null;if(_.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},bt(da,mi),mi|=f;else{if((f&1073741824)===0)return o=w!==null?w.baseLanes|f:f,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:o,cachePool:null,transitions:null},c.updateQueue=null,bt(da,mi),mi|=o,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},_=w!==null?w.baseLanes:f,bt(da,mi),mi|=_}else w!==null?(_=w.baseLanes|f,c.memoizedState=null):_=f,bt(da,mi),mi|=_;return Or(o,c,b,f),c.child}function xx(o,c){var f=c.ref;(o===null&&f!==null||o!==null&&o.ref!==f)&&(c.flags|=512,c.flags|=2097152)}function mp(o,c,f,_,b){var w=Jr(f)?to:Er.current;return w=ra(c,w),la(c,b),f=op(o,c,f,_,w,b),_=ap(),o!==null&&!ei?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~b,Gn(o,c,b)):(Mt&&_&&Hf(c),c.flags|=1,Or(o,c,f,b),c.child)}function vx(o,c,f,_,b){if(Jr(f)){var w=!0;gh(c)}else w=!1;if(la(c,b),c.stateNode===null)Dh(o,c),lx(c,f,_),fp(c,f,_,b),_=!0;else if(o===null){var D=c.stateNode,N=c.memoizedProps;D.props=N;var G=D.context,ie=f.contextType;typeof ie=="object"&&ie!==null?ie=Bi(ie):(ie=Jr(f)?to:Er.current,ie=ra(c,ie));var pe=f.getDerivedStateFromProps,ge=typeof pe=="function"||typeof D.getSnapshotBeforeUpdate=="function";ge||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(N!==_||G!==ie)&&cx(c,D,_,ie),vs=!1;var de=c.memoizedState;D.state=de,Ch(c,_,D,b),G=c.memoizedState,N!==_||de!==G||Zr.current||vs?(typeof pe=="function"&&(dp(c,f,pe,_),G=c.memoizedState),(N=vs||ax(c,f,N,_,de,G,ie))?(ge||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(c.flags|=4194308)):(typeof D.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=_,c.memoizedState=G),D.props=_,D.state=G,D.context=ie,_=N):(typeof D.componentDidMount=="function"&&(c.flags|=4194308),_=!1)}else{D=c.stateNode,$_(o,c),N=c.memoizedProps,ie=c.type===c.elementType?N:Xi(c.type,N),D.props=ie,ge=c.pendingProps,de=D.context,G=f.contextType,typeof G=="object"&&G!==null?G=Bi(G):(G=Jr(f)?to:Er.current,G=ra(c,G));var ke=f.getDerivedStateFromProps;(pe=typeof ke=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(N!==ge||de!==G)&&cx(c,D,_,G),vs=!1,de=c.memoizedState,D.state=de,Ch(c,_,D,b);var Me=c.memoizedState;N!==ge||de!==Me||Zr.current||vs?(typeof ke=="function"&&(dp(c,f,ke,_),Me=c.memoizedState),(ie=vs||ax(c,f,ie,_,de,Me,G)||!1)?(pe||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(_,Me,G),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(_,Me,G)),typeof D.componentDidUpdate=="function"&&(c.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof D.componentDidUpdate!="function"||N===o.memoizedProps&&de===o.memoizedState||(c.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||N===o.memoizedProps&&de===o.memoizedState||(c.flags|=1024),c.memoizedProps=_,c.memoizedState=Me),D.props=_,D.state=Me,D.context=G,_=ie):(typeof D.componentDidUpdate!="function"||N===o.memoizedProps&&de===o.memoizedState||(c.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||N===o.memoizedProps&&de===o.memoizedState||(c.flags|=1024),_=!1)}return yp(o,c,f,_,w,b)}function yp(o,c,f,_,b,w){xx(o,c);var D=(c.flags&128)!==0;if(!_&&!D)return b&&k_(c,f,!1),Gn(o,c,w);_=c.stateNode,PM.current=c;var N=D&&typeof f.getDerivedStateFromError!="function"?null:_.render();return c.flags|=1,o!==null&&D?(c.child=oa(c,o.child,null,w),c.child=oa(c,null,N,w)):Or(o,c,N,w),c.memoizedState=_.state,b&&k_(c,f,!0),c.child}function bx(o){var c=o.stateNode;c.pendingContext?w_(o,c.pendingContext,c.pendingContext!==c.context):c.context&&w_(o,c.context,!1),ep(o,c.containerInfo)}function Sx(o,c,f,_,b){return sa(),Gf(b),c.flags|=256,Or(o,c,f,_),c.child}var _p={dehydrated:null,treeContext:null,retryLane:0};function xp(o){return{baseLanes:o,cachePool:null,transitions:null}}function wx(o,c,f){var _=c.pendingProps,b=Dt.current,w=!1,D=(c.flags&128)!==0,N;if((N=D)||(N=o!==null&&o.memoizedState===null?!1:(b&2)!==0),N?(w=!0,c.flags&=-129):(o===null||o.memoizedState!==null)&&(b|=1),bt(Dt,b&1),o===null)return Vf(c),o=c.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((c.mode&1)===0?c.lanes=1:o.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(D=_.children,o=_.fallback,w?(_=c.mode,w=c.child,D={mode:"hidden",children:D},(_&1)===0&&w!==null?(w.childLanes=0,w.pendingProps=D):w=Uh(D,_,0,null),o=uo(o,_,f,null),w.return=c,o.return=c,w.sibling=o,c.child=w,c.child.memoizedState=xp(f),c.memoizedState=_p,o):vp(c,D));if(b=o.memoizedState,b!==null&&(N=b.dehydrated,N!==null))return IM(o,c,D,_,N,b,f);if(w){w=_.fallback,D=c.mode,b=o.child,N=b.sibling;var G={mode:"hidden",children:_.children};return(D&1)===0&&c.child!==b?(_=c.child,_.childLanes=0,_.pendingProps=G,c.deletions=null):(_=Es(b,G),_.subtreeFlags=b.subtreeFlags&14680064),N!==null?w=Es(N,w):(w=uo(w,D,f,null),w.flags|=2),w.return=c,_.return=c,_.sibling=w,c.child=_,_=w,w=c.child,D=o.child.memoizedState,D=D===null?xp(f):{baseLanes:D.baseLanes|f,cachePool:null,transitions:D.transitions},w.memoizedState=D,w.childLanes=o.childLanes&~f,c.memoizedState=_p,_}return w=o.child,o=w.sibling,_=Es(w,{mode:"visible",children:_.children}),(c.mode&1)===0&&(_.lanes=f),_.return=c,_.sibling=null,o!==null&&(f=c.deletions,f===null?(c.deletions=[o],c.flags|=16):f.push(o)),c.child=_,c.memoizedState=null,_}function vp(o,c){return c=Uh({mode:"visible",children:c},o.mode,0,null),c.return=o,o.child=c}function Ah(o,c,f,_){return _!==null&&Gf(_),oa(c,o.child,null,f),o=vp(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function IM(o,c,f,_,b,w,D){if(f)return c.flags&256?(c.flags&=-257,_=pp(Error(r(422))),Ah(o,c,D,_)):c.memoizedState!==null?(c.child=o.child,c.flags|=128,null):(w=_.fallback,b=c.mode,_=Uh({mode:"visible",children:_.children},b,0,null),w=uo(w,b,D,null),w.flags|=2,_.return=c,w.return=c,_.sibling=w,c.child=_,(c.mode&1)!==0&&oa(c,o.child,null,D),c.child.memoizedState=xp(D),c.memoizedState=_p,w);if((c.mode&1)===0)return Ah(o,c,D,null);if(b.data==="$!"){if(_=b.nextSibling&&b.nextSibling.dataset,_)var N=_.dgst;return _=N,w=Error(r(419)),_=pp(w,_,void 0),Ah(o,c,D,_)}if(N=(D&o.childLanes)!==0,ei||N){if(_=dr,_!==null){switch(D&-D){case 4:b=2;break;case 16:b=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:b=32;break;case 536870912:b=268435456;break;default:b=0}b=(b&(_.suspendedLanes|D))!==0?0:b,b!==0&&b!==w.retryLane&&(w.retryLane=b,Un(o,b),Ji(_,o,b,-1))}return $p(),_=pp(Error(r(421))),Ah(o,c,D,_)}return b.data==="$?"?(c.flags|=128,c.child=o.child,c=YM.bind(null,o),b._reactRetry=c,null):(o=w.treeContext,gi=ms(b.nextSibling),pi=c,Mt=!0,Ki=null,o!==null&&(Ti[Ei++]=Hn,Ti[Ei++]=qn,Ti[Ei++]=ro,Hn=o.id,qn=o.overflow,ro=c),c=vp(c,_.children),c.flags|=4096,c)}function Cx(o,c,f){o.lanes|=c;var _=o.alternate;_!==null&&(_.lanes|=c),Qf(o.return,c,f)}function bp(o,c,f,_,b){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:_,tail:f,tailMode:b}:(w.isBackwards=c,w.rendering=null,w.renderingStartTime=0,w.last=_,w.tail=f,w.tailMode=b)}function kx(o,c,f){var _=c.pendingProps,b=_.revealOrder,w=_.tail;if(Or(o,c,_.children,f),_=Dt.current,(_&2)!==0)_=_&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Cx(o,f,c);else if(o.tag===19)Cx(o,f,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}_&=1}if(bt(Dt,_),(c.mode&1)===0)c.memoizedState=null;else switch(b){case"forwards":for(f=c.child,b=null;f!==null;)o=f.alternate,o!==null&&kh(o)===null&&(b=f),f=f.sibling;f=b,f===null?(b=c.child,c.child=null):(b=f.sibling,f.sibling=null),bp(c,!1,b,f,w);break;case"backwards":for(f=null,b=c.child,c.child=null;b!==null;){if(o=b.alternate,o!==null&&kh(o)===null){c.child=b;break}o=b.sibling,b.sibling=f,f=b,b=o}bp(c,!0,f,null,w);break;case"together":bp(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Dh(o,c){(c.mode&1)===0&&o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2)}function Gn(o,c,f){if(o!==null&&(c.dependencies=o.dependencies),ao|=c.lanes,(f&c.childLanes)===0)return null;if(o!==null&&c.child!==o.child)throw Error(r(153));if(c.child!==null){for(o=c.child,f=Es(o,o.pendingProps),c.child=f,f.return=c;o.sibling!==null;)o=o.sibling,f=f.sibling=Es(o,o.pendingProps),f.return=c;f.sibling=null}return c.child}function $M(o,c,f){switch(c.tag){case 3:bx(c),sa();break;case 5:O_(c);break;case 1:Jr(c.type)&&gh(c);break;case 4:ep(c,c.stateNode.containerInfo);break;case 10:var _=c.type._context,b=c.memoizedProps.value;bt(bh,_._currentValue),_._currentValue=b;break;case 13:if(_=c.memoizedState,_!==null)return _.dehydrated!==null?(bt(Dt,Dt.current&1),c.flags|=128,null):(f&c.child.childLanes)!==0?wx(o,c,f):(bt(Dt,Dt.current&1),o=Gn(o,c,f),o!==null?o.sibling:null);bt(Dt,Dt.current&1);break;case 19:if(_=(f&c.childLanes)!==0,(o.flags&128)!==0){if(_)return kx(o,c,f);c.flags|=128}if(b=c.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),bt(Dt,Dt.current),_)break;return null;case 22:case 23:return c.lanes=0,_x(o,c,f)}return Gn(o,c,f)}var Tx,Sp,Ex,Bx;Tx=function(o,c){for(var f=c.child;f!==null;){if(f.tag===5||f.tag===6)o.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},Sp=function(){},Ex=function(o,c,f,_){var b=o.memoizedProps;if(b!==_){o=c.stateNode,so(_n.current);var w=null;switch(f){case"input":b=ht(o,b),_=ht(o,_),w=[];break;case"select":b=ee({},b,{value:void 0}),_=ee({},_,{value:void 0}),w=[];break;case"textarea":b=Fi(o,b),_=Fi(o,_),w=[];break;default:typeof b.onClick!="function"&&typeof _.onClick=="function"&&(o.onclick=dh)}wi(f,_);var D;f=null;for(ie in b)if(!_.hasOwnProperty(ie)&&b.hasOwnProperty(ie)&&b[ie]!=null)if(ie==="style"){var N=b[ie];for(D in N)N.hasOwnProperty(D)&&(f||(f={}),f[D]="")}else ie!=="dangerouslySetInnerHTML"&&ie!=="children"&&ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&ie!=="autoFocus"&&(n.hasOwnProperty(ie)?w||(w=[]):(w=w||[]).push(ie,null));for(ie in _){var G=_[ie];if(N=b!=null?b[ie]:void 0,_.hasOwnProperty(ie)&&G!==N&&(G!=null||N!=null))if(ie==="style")if(N){for(D in N)!N.hasOwnProperty(D)||G&&G.hasOwnProperty(D)||(f||(f={}),f[D]="");for(D in G)G.hasOwnProperty(D)&&N[D]!==G[D]&&(f||(f={}),f[D]=G[D])}else f||(w||(w=[]),w.push(ie,f)),f=G;else ie==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,N=N?N.__html:void 0,G!=null&&N!==G&&(w=w||[]).push(ie,G)):ie==="children"?typeof G!="string"&&typeof G!="number"||(w=w||[]).push(ie,""+G):ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&(n.hasOwnProperty(ie)?(G!=null&&ie==="onScroll"&&Ct("scroll",o),w||N===G||(w=[])):(w=w||[]).push(ie,G))}f&&(w=w||[]).push("style",f);var ie=w;(c.updateQueue=ie)&&(c.flags|=4)}},Bx=function(o,c,f,_){f!==_&&(c.flags|=4)};function Tl(o,c){if(!Mt)switch(o.tailMode){case"hidden":c=o.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?o.tail=null:f.sibling=null;break;case"collapsed":f=o.tail;for(var _=null;f!==null;)f.alternate!==null&&(_=f),f=f.sibling;_===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:_.sibling=null}}function Mr(o){var c=o.alternate!==null&&o.alternate.child===o.child,f=0,_=0;if(c)for(var b=o.child;b!==null;)f|=b.lanes|b.childLanes,_|=b.subtreeFlags&14680064,_|=b.flags&14680064,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)f|=b.lanes|b.childLanes,_|=b.subtreeFlags,_|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=_,o.childLanes=f,c}function jM(o,c,f){var _=c.pendingProps;switch(qf(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(c),null;case 1:return Jr(c.type)&&ph(),Mr(c),null;case 3:return _=c.stateNode,ca(),kt(Zr),kt(Er),ip(),_.pendingContext&&(_.context=_.pendingContext,_.pendingContext=null),(o===null||o.child===null)&&(xh(c)?c.flags|=4:o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Ki!==null&&(Dp(Ki),Ki=null))),Sp(o,c),Mr(c),null;case 5:tp(c);var b=so(bl.current);if(f=c.type,o!==null&&c.stateNode!=null)Ex(o,c,f,_,b),o.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!_){if(c.stateNode===null)throw Error(r(166));return Mr(c),null}if(o=so(_n.current),xh(c)){_=c.stateNode,f=c.type;var w=c.memoizedProps;switch(_[yn]=c,_[ml]=w,o=(c.mode&1)!==0,f){case"dialog":Ct("cancel",_),Ct("close",_);break;case"iframe":case"object":case"embed":Ct("load",_);break;case"video":case"audio":for(b=0;b<fl.length;b++)Ct(fl[b],_);break;case"source":Ct("error",_);break;case"img":case"image":case"link":Ct("error",_),Ct("load",_);break;case"details":Ct("toggle",_);break;case"input":Ft(_,w),Ct("invalid",_);break;case"select":_._wrapperState={wasMultiple:!!w.multiple},Ct("invalid",_);break;case"textarea":ls(_,w),Ct("invalid",_)}wi(f,w),b=null;for(var D in w)if(w.hasOwnProperty(D)){var N=w[D];D==="children"?typeof N=="string"?_.textContent!==N&&(w.suppressHydrationWarning!==!0&&uh(_.textContent,N,o),b=["children",N]):typeof N=="number"&&_.textContent!==""+N&&(w.suppressHydrationWarning!==!0&&uh(_.textContent,N,o),b=["children",""+N]):n.hasOwnProperty(D)&&N!=null&&D==="onScroll"&&Ct("scroll",_)}switch(f){case"input":Xe(_),ut(_,w,!0);break;case"textarea":Xe(_),Ni(_);break;case"select":case"option":break;default:typeof w.onClick=="function"&&(_.onclick=dh)}_=b,c.updateQueue=_,_!==null&&(c.flags|=4)}else{D=b.nodeType===9?b:b.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=gt(f)),o==="http://www.w3.org/1999/xhtml"?f==="script"?(o=D.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof _.is=="string"?o=D.createElement(f,{is:_.is}):(o=D.createElement(f),f==="select"&&(D=o,_.multiple?D.multiple=!0:_.size&&(D.size=_.size))):o=D.createElementNS(o,f),o[yn]=c,o[ml]=_,Tx(o,c,!1,!1),c.stateNode=o;e:{switch(D=hi(f,_),f){case"dialog":Ct("cancel",o),Ct("close",o),b=_;break;case"iframe":case"object":case"embed":Ct("load",o),b=_;break;case"video":case"audio":for(b=0;b<fl.length;b++)Ct(fl[b],o);b=_;break;case"source":Ct("error",o),b=_;break;case"img":case"image":case"link":Ct("error",o),Ct("load",o),b=_;break;case"details":Ct("toggle",o),b=_;break;case"input":Ft(o,_),b=ht(o,_),Ct("invalid",o);break;case"option":b=_;break;case"select":o._wrapperState={wasMultiple:!!_.multiple},b=ee({},_,{value:void 0}),Ct("invalid",o);break;case"textarea":ls(o,_),b=Fi(o,_),Ct("invalid",o);break;default:b=_}wi(f,b),N=b;for(w in N)if(N.hasOwnProperty(w)){var G=N[w];w==="style"?lr(o,G):w==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,G!=null&&Xs(o,G)):w==="children"?typeof G=="string"?(f!=="textarea"||G!=="")&&vt(o,G):typeof G=="number"&&vt(o,""+G):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(n.hasOwnProperty(w)?G!=null&&w==="onScroll"&&Ct("scroll",o):G!=null&&L(o,w,G,D))}switch(f){case"input":Xe(o),ut(o,_,!1);break;case"textarea":Xe(o),Ni(o);break;case"option":_.value!=null&&o.setAttribute("value",""+ve(_.value));break;case"select":o.multiple=!!_.multiple,w=_.value,w!=null?ar(o,!!_.multiple,w,!1):_.defaultValue!=null&&ar(o,!!_.multiple,_.defaultValue,!0);break;default:typeof b.onClick=="function"&&(o.onclick=dh)}switch(f){case"button":case"input":case"select":case"textarea":_=!!_.autoFocus;break e;case"img":_=!0;break e;default:_=!1}}_&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Mr(c),null;case 6:if(o&&c.stateNode!=null)Bx(o,c,o.memoizedProps,_);else{if(typeof _!="string"&&c.stateNode===null)throw Error(r(166));if(f=so(bl.current),so(_n.current),xh(c)){if(_=c.stateNode,f=c.memoizedProps,_[yn]=c,(w=_.nodeValue!==f)&&(o=pi,o!==null))switch(o.tag){case 3:uh(_.nodeValue,f,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&uh(_.nodeValue,f,(o.mode&1)!==0)}w&&(c.flags|=4)}else _=(f.nodeType===9?f:f.ownerDocument).createTextNode(_),_[yn]=c,c.stateNode=_}return Mr(c),null;case 13:if(kt(Dt),_=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Mt&&gi!==null&&(c.mode&1)!==0&&(c.flags&128)===0)R_(),sa(),c.flags|=98560,w=!1;else if(w=xh(c),_!==null&&_.dehydrated!==null){if(o===null){if(!w)throw Error(r(318));if(w=c.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(r(317));w[yn]=c}else sa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Mr(c),w=!1}else Ki!==null&&(Dp(Ki),Ki=null),w=!0;if(!w)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=f,c):(_=_!==null,_!==(o!==null&&o.memoizedState!==null)&&_&&(c.child.flags|=8192,(c.mode&1)!==0&&(o===null||(Dt.current&1)!==0?Jt===0&&(Jt=3):$p())),c.updateQueue!==null&&(c.flags|=4),Mr(c),null);case 4:return ca(),Sp(o,c),o===null&&pl(c.stateNode.containerInfo),Mr(c),null;case 10:return Xf(c.type._context),Mr(c),null;case 17:return Jr(c.type)&&ph(),Mr(c),null;case 19:if(kt(Dt),w=c.memoizedState,w===null)return Mr(c),null;if(_=(c.flags&128)!==0,D=w.rendering,D===null)if(_)Tl(w,!1);else{if(Jt!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(D=kh(o),D!==null){for(c.flags|=128,Tl(w,!1),_=D.updateQueue,_!==null&&(c.updateQueue=_,c.flags|=4),c.subtreeFlags=0,_=f,f=c.child;f!==null;)w=f,o=_,w.flags&=14680066,D=w.alternate,D===null?(w.childLanes=0,w.lanes=o,w.child=null,w.subtreeFlags=0,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=D.childLanes,w.lanes=D.lanes,w.child=D.child,w.subtreeFlags=0,w.deletions=null,w.memoizedProps=D.memoizedProps,w.memoizedState=D.memoizedState,w.updateQueue=D.updateQueue,w.type=D.type,o=D.dependencies,w.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),f=f.sibling;return bt(Dt,Dt.current&1|2),c.child}o=o.sibling}w.tail!==null&&Ke()>fa&&(c.flags|=128,_=!0,Tl(w,!1),c.lanes=4194304)}else{if(!_)if(o=kh(D),o!==null){if(c.flags|=128,_=!0,f=o.updateQueue,f!==null&&(c.updateQueue=f,c.flags|=4),Tl(w,!0),w.tail===null&&w.tailMode==="hidden"&&!D.alternate&&!Mt)return Mr(c),null}else 2*Ke()-w.renderingStartTime>fa&&f!==1073741824&&(c.flags|=128,_=!0,Tl(w,!1),c.lanes=4194304);w.isBackwards?(D.sibling=c.child,c.child=D):(f=w.last,f!==null?f.sibling=D:c.child=D,w.last=D)}return w.tail!==null?(c=w.tail,w.rendering=c,w.tail=c.sibling,w.renderingStartTime=Ke(),c.sibling=null,f=Dt.current,bt(Dt,_?f&1|2:f&1),c):(Mr(c),null);case 22:case 23:return Ip(),_=c.memoizedState!==null,o!==null&&o.memoizedState!==null!==_&&(c.flags|=8192),_&&(c.mode&1)!==0?(mi&1073741824)!==0&&(Mr(c),c.subtreeFlags&6&&(c.flags|=8192)):Mr(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function zM(o,c){switch(qf(c),c.tag){case 1:return Jr(c.type)&&ph(),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return ca(),kt(Zr),kt(Er),ip(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 5:return tp(c),null;case 13:if(kt(Dt),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(r(340));sa()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return kt(Dt),null;case 4:return ca(),null;case 10:return Xf(c.type._context),null;case 22:case 23:return Ip(),null;case 24:return null;default:return null}}var Ph=!1,Lr=!1,OM=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function ua(o,c){var f=o.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(_){jt(o,c,_)}else f.current=null}function wp(o,c,f){try{f()}catch(_){jt(o,c,_)}}var Mx=!1;function FM(o,c){if(If=eh,o=a_(),Ef(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var _=f.getSelection&&f.getSelection();if(_&&_.rangeCount!==0){f=_.anchorNode;var b=_.anchorOffset,w=_.focusNode;_=_.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var D=0,N=-1,G=-1,ie=0,pe=0,ge=o,de=null;t:for(;;){for(var ke;ge!==f||b!==0&&ge.nodeType!==3||(N=D+b),ge!==w||_!==0&&ge.nodeType!==3||(G=D+_),ge.nodeType===3&&(D+=ge.nodeValue.length),(ke=ge.firstChild)!==null;)de=ge,ge=ke;for(;;){if(ge===o)break t;if(de===f&&++ie===b&&(N=D),de===w&&++pe===_&&(G=D),(ke=ge.nextSibling)!==null)break;ge=de,de=ge.parentNode}ge=ke}f=N===-1||G===-1?null:{start:N,end:G}}else f=null}f=f||{start:0,end:0}}else f=null;for($f={focusedElem:o,selectionRange:f},eh=!1,Ee=c;Ee!==null;)if(c=Ee,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,Ee=o;else for(;Ee!==null;){c=Ee;try{var Me=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Me!==null){var Pe=Me.memoizedProps,Nt=Me.memoizedState,te=c.stateNode,K=te.getSnapshotBeforeUpdate(c.elementType===c.type?Pe:Xi(c.type,Pe),Nt);te.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var re=c.stateNode.containerInfo;re.nodeType===1?re.textContent="":re.nodeType===9&&re.documentElement&&re.removeChild(re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(me){jt(c,c.return,me)}if(o=c.sibling,o!==null){o.return=c.return,Ee=o;break}Ee=c.return}return Me=Mx,Mx=!1,Me}function El(o,c,f){var _=c.updateQueue;if(_=_!==null?_.lastEffect:null,_!==null){var b=_=_.next;do{if((b.tag&o)===o){var w=b.destroy;b.destroy=void 0,w!==void 0&&wp(c,f,w)}b=b.next}while(b!==_)}}function Ih(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&o)===o){var _=f.create;f.destroy=_()}f=f.next}while(f!==c)}}function Cp(o){var c=o.ref;if(c!==null){var f=o.stateNode;switch(o.tag){case 5:o=f;break;default:o=f}typeof c=="function"?c(o):c.current=o}}function Lx(o){var c=o.alternate;c!==null&&(o.alternate=null,Lx(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&(delete c[yn],delete c[ml],delete c[Ff],delete c[SM],delete c[wM])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Rx(o){return o.tag===5||o.tag===3||o.tag===4}function Ax(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Rx(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function kp(o,c,f){var _=o.tag;if(_===5||_===6)o=o.stateNode,c?f.nodeType===8?f.parentNode.insertBefore(o,c):f.insertBefore(o,c):(f.nodeType===8?(c=f.parentNode,c.insertBefore(o,f)):(c=f,c.appendChild(o)),f=f._reactRootContainer,f!=null||c.onclick!==null||(c.onclick=dh));else if(_!==4&&(o=o.child,o!==null))for(kp(o,c,f),o=o.sibling;o!==null;)kp(o,c,f),o=o.sibling}function Tp(o,c,f){var _=o.tag;if(_===5||_===6)o=o.stateNode,c?f.insertBefore(o,c):f.appendChild(o);else if(_!==4&&(o=o.child,o!==null))for(Tp(o,c,f),o=o.sibling;o!==null;)Tp(o,c,f),o=o.sibling}var xr=null,Qi=!1;function Ss(o,c,f){for(f=f.child;f!==null;)Dx(o,c,f),f=f.sibling}function Dx(o,c,f){if(di&&typeof di.onCommitFiberUnmount=="function")try{di.onCommitFiberUnmount(Js,f)}catch{}switch(f.tag){case 5:Lr||ua(f,c);case 6:var _=xr,b=Qi;xr=null,Ss(o,c,f),xr=_,Qi=b,xr!==null&&(Qi?(o=xr,f=f.stateNode,o.nodeType===8?o.parentNode.removeChild(f):o.removeChild(f)):xr.removeChild(f.stateNode));break;case 18:xr!==null&&(Qi?(o=xr,f=f.stateNode,o.nodeType===8?Of(o.parentNode,f):o.nodeType===1&&Of(o,f),sl(o)):Of(xr,f.stateNode));break;case 4:_=xr,b=Qi,xr=f.stateNode.containerInfo,Qi=!0,Ss(o,c,f),xr=_,Qi=b;break;case 0:case 11:case 14:case 15:if(!Lr&&(_=f.updateQueue,_!==null&&(_=_.lastEffect,_!==null))){b=_=_.next;do{var w=b,D=w.destroy;w=w.tag,D!==void 0&&((w&2)!==0||(w&4)!==0)&&wp(f,c,D),b=b.next}while(b!==_)}Ss(o,c,f);break;case 1:if(!Lr&&(ua(f,c),_=f.stateNode,typeof _.componentWillUnmount=="function"))try{_.props=f.memoizedProps,_.state=f.memoizedState,_.componentWillUnmount()}catch(N){jt(f,c,N)}Ss(o,c,f);break;case 21:Ss(o,c,f);break;case 22:f.mode&1?(Lr=(_=Lr)||f.memoizedState!==null,Ss(o,c,f),Lr=_):Ss(o,c,f);break;default:Ss(o,c,f)}}function Px(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var f=o.stateNode;f===null&&(f=o.stateNode=new OM),c.forEach(function(_){var b=KM.bind(null,o,_);f.has(_)||(f.add(_),_.then(b,b))})}}function Zi(o,c){var f=c.deletions;if(f!==null)for(var _=0;_<f.length;_++){var b=f[_];try{var w=o,D=c,N=D;e:for(;N!==null;){switch(N.tag){case 5:xr=N.stateNode,Qi=!1;break e;case 3:xr=N.stateNode.containerInfo,Qi=!0;break e;case 4:xr=N.stateNode.containerInfo,Qi=!0;break e}N=N.return}if(xr===null)throw Error(r(160));Dx(w,D,b),xr=null,Qi=!1;var G=b.alternate;G!==null&&(G.return=null),b.return=null}catch(ie){jt(b,c,ie)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)Ix(c,o),c=c.sibling}function Ix(o,c){var f=o.alternate,_=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Zi(c,o),vn(o),_&4){try{El(3,o,o.return),Ih(3,o)}catch(Pe){jt(o,o.return,Pe)}try{El(5,o,o.return)}catch(Pe){jt(o,o.return,Pe)}}break;case 1:Zi(c,o),vn(o),_&512&&f!==null&&ua(f,f.return);break;case 5:if(Zi(c,o),vn(o),_&512&&f!==null&&ua(f,f.return),o.flags&32){var b=o.stateNode;try{vt(b,"")}catch(Pe){jt(o,o.return,Pe)}}if(_&4&&(b=o.stateNode,b!=null)){var w=o.memoizedProps,D=f!==null?f.memoizedProps:w,N=o.type,G=o.updateQueue;if(o.updateQueue=null,G!==null)try{N==="input"&&w.type==="radio"&&w.name!=null&&le(b,w),hi(N,D);var ie=hi(N,w);for(D=0;D<G.length;D+=2){var pe=G[D],ge=G[D+1];pe==="style"?lr(b,ge):pe==="dangerouslySetInnerHTML"?Xs(b,ge):pe==="children"?vt(b,ge):L(b,pe,ge,ie)}switch(N){case"input":Je(b,w);break;case"textarea":jn(b,w);break;case"select":var de=b._wrapperState.wasMultiple;b._wrapperState.wasMultiple=!!w.multiple;var ke=w.value;ke!=null?ar(b,!!w.multiple,ke,!1):de!==!!w.multiple&&(w.defaultValue!=null?ar(b,!!w.multiple,w.defaultValue,!0):ar(b,!!w.multiple,w.multiple?[]:"",!1))}b[ml]=w}catch(Pe){jt(o,o.return,Pe)}}break;case 6:if(Zi(c,o),vn(o),_&4){if(o.stateNode===null)throw Error(r(162));b=o.stateNode,w=o.memoizedProps;try{b.nodeValue=w}catch(Pe){jt(o,o.return,Pe)}}break;case 3:if(Zi(c,o),vn(o),_&4&&f!==null&&f.memoizedState.isDehydrated)try{sl(c.containerInfo)}catch(Pe){jt(o,o.return,Pe)}break;case 4:Zi(c,o),vn(o);break;case 13:Zi(c,o),vn(o),b=o.child,b.flags&8192&&(w=b.memoizedState!==null,b.stateNode.isHidden=w,!w||b.alternate!==null&&b.alternate.memoizedState!==null||(Mp=Ke())),_&4&&Px(o);break;case 22:if(pe=f!==null&&f.memoizedState!==null,o.mode&1?(Lr=(ie=Lr)||pe,Zi(c,o),Lr=ie):Zi(c,o),vn(o),_&8192){if(ie=o.memoizedState!==null,(o.stateNode.isHidden=ie)&&!pe&&(o.mode&1)!==0)for(Ee=o,pe=o.child;pe!==null;){for(ge=Ee=pe;Ee!==null;){switch(de=Ee,ke=de.child,de.tag){case 0:case 11:case 14:case 15:El(4,de,de.return);break;case 1:ua(de,de.return);var Me=de.stateNode;if(typeof Me.componentWillUnmount=="function"){_=de,f=de.return;try{c=_,Me.props=c.memoizedProps,Me.state=c.memoizedState,Me.componentWillUnmount()}catch(Pe){jt(_,f,Pe)}}break;case 5:ua(de,de.return);break;case 22:if(de.memoizedState!==null){zx(ge);continue}}ke!==null?(ke.return=de,Ee=ke):zx(ge)}pe=pe.sibling}e:for(pe=null,ge=o;;){if(ge.tag===5){if(pe===null){pe=ge;try{b=ge.stateNode,ie?(w=b.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none"):(N=ge.stateNode,G=ge.memoizedProps.style,D=G!=null&&G.hasOwnProperty("display")?G.display:null,N.style.display=un("display",D))}catch(Pe){jt(o,o.return,Pe)}}}else if(ge.tag===6){if(pe===null)try{ge.stateNode.nodeValue=ie?"":ge.memoizedProps}catch(Pe){jt(o,o.return,Pe)}}else if((ge.tag!==22&&ge.tag!==23||ge.memoizedState===null||ge===o)&&ge.child!==null){ge.child.return=ge,ge=ge.child;continue}if(ge===o)break e;for(;ge.sibling===null;){if(ge.return===null||ge.return===o)break e;pe===ge&&(pe=null),ge=ge.return}pe===ge&&(pe=null),ge.sibling.return=ge.return,ge=ge.sibling}}break;case 19:Zi(c,o),vn(o),_&4&&Px(o);break;case 21:break;default:Zi(c,o),vn(o)}}function vn(o){var c=o.flags;if(c&2){try{e:{for(var f=o.return;f!==null;){if(Rx(f)){var _=f;break e}f=f.return}throw Error(r(160))}switch(_.tag){case 5:var b=_.stateNode;_.flags&32&&(vt(b,""),_.flags&=-33);var w=Ax(o);Tp(o,w,b);break;case 3:case 4:var D=_.stateNode.containerInfo,N=Ax(o);kp(o,N,D);break;default:throw Error(r(161))}}catch(G){jt(o,o.return,G)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function NM(o,c,f){Ee=o,$x(o)}function $x(o,c,f){for(var _=(o.mode&1)!==0;Ee!==null;){var b=Ee,w=b.child;if(b.tag===22&&_){var D=b.memoizedState!==null||Ph;if(!D){var N=b.alternate,G=N!==null&&N.memoizedState!==null||Lr;N=Ph;var ie=Lr;if(Ph=D,(Lr=G)&&!ie)for(Ee=b;Ee!==null;)D=Ee,G=D.child,D.tag===22&&D.memoizedState!==null?Ox(b):G!==null?(G.return=D,Ee=G):Ox(b);for(;w!==null;)Ee=w,$x(w),w=w.sibling;Ee=b,Ph=N,Lr=ie}jx(o)}else(b.subtreeFlags&8772)!==0&&w!==null?(w.return=b,Ee=w):jx(o)}}function jx(o){for(;Ee!==null;){var c=Ee;if((c.flags&8772)!==0){var f=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Lr||Ih(5,c);break;case 1:var _=c.stateNode;if(c.flags&4&&!Lr)if(f===null)_.componentDidMount();else{var b=c.elementType===c.type?f.memoizedProps:Xi(c.type,f.memoizedProps);_.componentDidUpdate(b,f.memoizedState,_.__reactInternalSnapshotBeforeUpdate)}var w=c.updateQueue;w!==null&&z_(c,w,_);break;case 3:var D=c.updateQueue;if(D!==null){if(f=null,c.child!==null)switch(c.child.tag){case 5:f=c.child.stateNode;break;case 1:f=c.child.stateNode}z_(c,D,f)}break;case 5:var N=c.stateNode;if(f===null&&c.flags&4){f=N;var G=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":G.autoFocus&&f.focus();break;case"img":G.src&&(f.src=G.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var ie=c.alternate;if(ie!==null){var pe=ie.memoizedState;if(pe!==null){var ge=pe.dehydrated;ge!==null&&sl(ge)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Lr||c.flags&512&&Cp(c)}catch(de){jt(c,c.return,de)}}if(c===o){Ee=null;break}if(f=c.sibling,f!==null){f.return=c.return,Ee=f;break}Ee=c.return}}function zx(o){for(;Ee!==null;){var c=Ee;if(c===o){Ee=null;break}var f=c.sibling;if(f!==null){f.return=c.return,Ee=f;break}Ee=c.return}}function Ox(o){for(;Ee!==null;){var c=Ee;try{switch(c.tag){case 0:case 11:case 15:var f=c.return;try{Ih(4,c)}catch(G){jt(c,f,G)}break;case 1:var _=c.stateNode;if(typeof _.componentDidMount=="function"){var b=c.return;try{_.componentDidMount()}catch(G){jt(c,b,G)}}var w=c.return;try{Cp(c)}catch(G){jt(c,w,G)}break;case 5:var D=c.return;try{Cp(c)}catch(G){jt(c,D,G)}}}catch(G){jt(c,c.return,G)}if(c===o){Ee=null;break}var N=c.sibling;if(N!==null){N.return=c.return,Ee=N;break}Ee=c.return}}var WM=Math.ceil,$h=B.ReactCurrentDispatcher,Ep=B.ReactCurrentOwner,Li=B.ReactCurrentBatchConfig,ot=0,dr=null,Vt=null,vr=0,mi=0,da=ys(0),Jt=0,Bl=null,ao=0,jh=0,Bp=0,Ml=null,ti=null,Mp=0,fa=1/0,Yn=null,zh=!1,Lp=null,ws=null,Oh=!1,Cs=null,Fh=0,Ll=0,Rp=null,Nh=-1,Wh=0;function Fr(){return(ot&6)!==0?Ke():Nh!==-1?Nh:Nh=Ke()}function ks(o){return(o.mode&1)===0?1:(ot&2)!==0&&vr!==0?vr&-vr:kM.transition!==null?(Wh===0&&(Wh=A0()),Wh):(o=pt,o!==0||(o=window.event,o=o===void 0?16:N0(o.type)),o)}function Ji(o,c,f,_){if(50<Ll)throw Ll=0,Rp=null,Error(r(185));el(o,f,_),((ot&2)===0||o!==dr)&&(o===dr&&((ot&2)===0&&(jh|=f),Jt===4&&Ts(o,vr)),ri(o,_),f===1&&ot===0&&(c.mode&1)===0&&(fa=Ke()+500,mh&&xs()))}function ri(o,c){var f=o.callbackNode;kB(o,c);var _=Qc(o,o===dr?vr:0);if(_===0)f!==null&&fe(f),o.callbackNode=null,o.callbackPriority=0;else if(c=_&-_,o.callbackPriority!==c){if(f!=null&&fe(f),c===1)o.tag===0?CM(Nx.bind(null,o)):T_(Nx.bind(null,o)),vM(function(){(ot&6)===0&&xs()}),f=null;else{switch(D0(_)){case 1:f=hr;break;case 4:f=ki;break;case 16:f=Vi;break;case 536870912:f=Ut;break;default:f=Vi}f=Kx(f,Fx.bind(null,o))}o.callbackPriority=c,o.callbackNode=f}}function Fx(o,c){if(Nh=-1,Wh=0,(ot&6)!==0)throw Error(r(327));var f=o.callbackNode;if(pa()&&o.callbackNode!==f)return null;var _=Qc(o,o===dr?vr:0);if(_===0)return null;if((_&30)!==0||(_&o.expiredLanes)!==0||c)c=Hh(o,_);else{c=_;var b=ot;ot|=2;var w=Hx();(dr!==o||vr!==c)&&(Yn=null,fa=Ke()+500,co(o,c));do try{UM();break}catch(N){Wx(o,N)}while(!0);Kf(),$h.current=w,ot=b,Vt!==null?c=0:(dr=null,vr=0,c=Jt)}if(c!==0){if(c===2&&(b=uf(o),b!==0&&(_=b,c=Ap(o,b))),c===1)throw f=Bl,co(o,0),Ts(o,_),ri(o,Ke()),f;if(c===6)Ts(o,_);else{if(b=o.current.alternate,(_&30)===0&&!HM(b)&&(c=Hh(o,_),c===2&&(w=uf(o),w!==0&&(_=w,c=Ap(o,w))),c===1))throw f=Bl,co(o,0),Ts(o,_),ri(o,Ke()),f;switch(o.finishedWork=b,o.finishedLanes=_,c){case 0:case 1:throw Error(r(345));case 2:ho(o,ti,Yn);break;case 3:if(Ts(o,_),(_&130023424)===_&&(c=Mp+500-Ke(),10<c)){if(Qc(o,0)!==0)break;if(b=o.suspendedLanes,(b&_)!==_){Fr(),o.pingedLanes|=o.suspendedLanes&b;break}o.timeoutHandle=zf(ho.bind(null,o,ti,Yn),c);break}ho(o,ti,Yn);break;case 4:if(Ts(o,_),(_&4194240)===_)break;for(c=o.eventTimes,b=-1;0<_;){var D=31-Gi(_);w=1<<D,D=c[D],D>b&&(b=D),_&=~w}if(_=b,_=Ke()-_,_=(120>_?120:480>_?480:1080>_?1080:1920>_?1920:3e3>_?3e3:4320>_?4320:1960*WM(_/1960))-_,10<_){o.timeoutHandle=zf(ho.bind(null,o,ti,Yn),_);break}ho(o,ti,Yn);break;case 5:ho(o,ti,Yn);break;default:throw Error(r(329))}}}return ri(o,Ke()),o.callbackNode===f?Fx.bind(null,o):null}function Ap(o,c){var f=Ml;return o.current.memoizedState.isDehydrated&&(co(o,c).flags|=256),o=Hh(o,c),o!==2&&(c=ti,ti=f,c!==null&&Dp(c)),o}function Dp(o){ti===null?ti=o:ti.push.apply(ti,o)}function HM(o){for(var c=o;;){if(c.flags&16384){var f=c.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var _=0;_<f.length;_++){var b=f[_],w=b.getSnapshot;b=b.value;try{if(!Yi(w(),b))return!1}catch{return!1}}}if(f=c.child,c.subtreeFlags&16384&&f!==null)f.return=c,c=f;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Ts(o,c){for(c&=~Bp,c&=~jh,o.suspendedLanes|=c,o.pingedLanes&=~c,o=o.expirationTimes;0<c;){var f=31-Gi(c),_=1<<f;o[f]=-1,c&=~_}}function Nx(o){if((ot&6)!==0)throw Error(r(327));pa();var c=Qc(o,0);if((c&1)===0)return ri(o,Ke()),null;var f=Hh(o,c);if(o.tag!==0&&f===2){var _=uf(o);_!==0&&(c=_,f=Ap(o,_))}if(f===1)throw f=Bl,co(o,0),Ts(o,c),ri(o,Ke()),f;if(f===6)throw Error(r(345));return o.finishedWork=o.current.alternate,o.finishedLanes=c,ho(o,ti,Yn),ri(o,Ke()),null}function Pp(o,c){var f=ot;ot|=1;try{return o(c)}finally{ot=f,ot===0&&(fa=Ke()+500,mh&&xs())}}function lo(o){Cs!==null&&Cs.tag===0&&(ot&6)===0&&pa();var c=ot;ot|=1;var f=Li.transition,_=pt;try{if(Li.transition=null,pt=1,o)return o()}finally{pt=_,Li.transition=f,ot=c,(ot&6)===0&&xs()}}function Ip(){mi=da.current,kt(da)}function co(o,c){o.finishedWork=null,o.finishedLanes=0;var f=o.timeoutHandle;if(f!==-1&&(o.timeoutHandle=-1,xM(f)),Vt!==null)for(f=Vt.return;f!==null;){var _=f;switch(qf(_),_.tag){case 1:_=_.type.childContextTypes,_!=null&&ph();break;case 3:ca(),kt(Zr),kt(Er),ip();break;case 5:tp(_);break;case 4:ca();break;case 13:kt(Dt);break;case 19:kt(Dt);break;case 10:Xf(_.type._context);break;case 22:case 23:Ip()}f=f.return}if(dr=o,Vt=o=Es(o.current,null),vr=mi=c,Jt=0,Bl=null,Bp=jh=ao=0,ti=Ml=null,no!==null){for(c=0;c<no.length;c++)if(f=no[c],_=f.interleaved,_!==null){f.interleaved=null;var b=_.next,w=f.pending;if(w!==null){var D=w.next;w.next=b,_.next=D}f.pending=_}no=null}return o}function Wx(o,c){do{var f=Vt;try{if(Kf(),Th.current=Lh,Eh){for(var _=Pt.memoizedState;_!==null;){var b=_.queue;b!==null&&(b.pending=null),_=_.next}Eh=!1}if(oo=0,ur=Zt=Pt=null,Sl=!1,wl=0,Ep.current=null,f===null||f.return===null){Jt=1,Bl=c,Vt=null;break}e:{var w=o,D=f.return,N=f,G=c;if(c=vr,N.flags|=32768,G!==null&&typeof G=="object"&&typeof G.then=="function"){var ie=G,pe=N,ge=pe.tag;if((pe.mode&1)===0&&(ge===0||ge===11||ge===15)){var de=pe.alternate;de?(pe.updateQueue=de.updateQueue,pe.memoizedState=de.memoizedState,pe.lanes=de.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var ke=fx(D);if(ke!==null){ke.flags&=-257,px(ke,D,N,w,c),ke.mode&1&&dx(w,ie,c),c=ke,G=ie;var Me=c.updateQueue;if(Me===null){var Pe=new Set;Pe.add(G),c.updateQueue=Pe}else Me.add(G);break e}else{if((c&1)===0){dx(w,ie,c),$p();break e}G=Error(r(426))}}else if(Mt&&N.mode&1){var Nt=fx(D);if(Nt!==null){(Nt.flags&65536)===0&&(Nt.flags|=256),px(Nt,D,N,w,c),Gf(ha(G,N));break e}}w=G=ha(G,N),Jt!==4&&(Jt=2),Ml===null?Ml=[w]:Ml.push(w),w=D;do{switch(w.tag){case 3:w.flags|=65536,c&=-c,w.lanes|=c;var te=hx(w,G,c);j_(w,te);break e;case 1:N=G;var K=w.type,re=w.stateNode;if((w.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||re!==null&&typeof re.componentDidCatch=="function"&&(ws===null||!ws.has(re)))){w.flags|=65536,c&=-c,w.lanes|=c;var me=ux(w,N,c);j_(w,me);break e}}w=w.return}while(w!==null)}Ux(f)}catch(je){c=je,Vt===f&&f!==null&&(Vt=f=f.return);continue}break}while(!0)}function Hx(){var o=$h.current;return $h.current=Lh,o===null?Lh:o}function $p(){(Jt===0||Jt===3||Jt===2)&&(Jt=4),dr===null||(ao&268435455)===0&&(jh&268435455)===0||Ts(dr,vr)}function Hh(o,c){var f=ot;ot|=2;var _=Hx();(dr!==o||vr!==c)&&(Yn=null,co(o,c));do try{qM();break}catch(b){Wx(o,b)}while(!0);if(Kf(),ot=f,$h.current=_,Vt!==null)throw Error(r(261));return dr=null,vr=0,Jt}function qM(){for(;Vt!==null;)qx(Vt)}function UM(){for(;Vt!==null&&!Be();)qx(Vt)}function qx(o){var c=Yx(o.alternate,o,mi);o.memoizedProps=o.pendingProps,c===null?Ux(o):Vt=c,Ep.current=null}function Ux(o){var c=o;do{var f=c.alternate;if(o=c.return,(c.flags&32768)===0){if(f=jM(f,c,mi),f!==null){Vt=f;return}}else{if(f=zM(f,c),f!==null){f.flags&=32767,Vt=f;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{Jt=6,Vt=null;return}}if(c=c.sibling,c!==null){Vt=c;return}Vt=c=o}while(c!==null);Jt===0&&(Jt=5)}function ho(o,c,f){var _=pt,b=Li.transition;try{Li.transition=null,pt=1,VM(o,c,f,_)}finally{Li.transition=b,pt=_}return null}function VM(o,c,f,_){do pa();while(Cs!==null);if((ot&6)!==0)throw Error(r(327));f=o.finishedWork;var b=o.finishedLanes;if(f===null)return null;if(o.finishedWork=null,o.finishedLanes=0,f===o.current)throw Error(r(177));o.callbackNode=null,o.callbackPriority=0;var w=f.lanes|f.childLanes;if(TB(o,w),o===dr&&(Vt=dr=null,vr=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Oh||(Oh=!0,Kx(Vi,function(){return pa(),null})),w=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||w){w=Li.transition,Li.transition=null;var D=pt;pt=1;var N=ot;ot|=4,Ep.current=null,FM(o,f),Ix(f,o),dM($f),eh=!!If,$f=If=null,o.current=f,NM(f),ft(),ot=N,pt=D,Li.transition=w}else o.current=f;if(Oh&&(Oh=!1,Cs=o,Fh=b),w=o.pendingLanes,w===0&&(ws=null),vB(f.stateNode),ri(o,Ke()),c!==null)for(_=o.onRecoverableError,f=0;f<c.length;f++)b=c[f],_(b.value,{componentStack:b.stack,digest:b.digest});if(zh)throw zh=!1,o=Lp,Lp=null,o;return(Fh&1)!==0&&o.tag!==0&&pa(),w=o.pendingLanes,(w&1)!==0?o===Rp?Ll++:(Ll=0,Rp=o):Ll=0,xs(),null}function pa(){if(Cs!==null){var o=D0(Fh),c=Li.transition,f=pt;try{if(Li.transition=null,pt=16>o?16:o,Cs===null)var _=!1;else{if(o=Cs,Cs=null,Fh=0,(ot&6)!==0)throw Error(r(331));var b=ot;for(ot|=4,Ee=o.current;Ee!==null;){var w=Ee,D=w.child;if((Ee.flags&16)!==0){var N=w.deletions;if(N!==null){for(var G=0;G<N.length;G++){var ie=N[G];for(Ee=ie;Ee!==null;){var pe=Ee;switch(pe.tag){case 0:case 11:case 15:El(8,pe,w)}var ge=pe.child;if(ge!==null)ge.return=pe,Ee=ge;else for(;Ee!==null;){pe=Ee;var de=pe.sibling,ke=pe.return;if(Lx(pe),pe===ie){Ee=null;break}if(de!==null){de.return=ke,Ee=de;break}Ee=ke}}}var Me=w.alternate;if(Me!==null){var Pe=Me.child;if(Pe!==null){Me.child=null;do{var Nt=Pe.sibling;Pe.sibling=null,Pe=Nt}while(Pe!==null)}}Ee=w}}if((w.subtreeFlags&2064)!==0&&D!==null)D.return=w,Ee=D;else e:for(;Ee!==null;){if(w=Ee,(w.flags&2048)!==0)switch(w.tag){case 0:case 11:case 15:El(9,w,w.return)}var te=w.sibling;if(te!==null){te.return=w.return,Ee=te;break e}Ee=w.return}}var K=o.current;for(Ee=K;Ee!==null;){D=Ee;var re=D.child;if((D.subtreeFlags&2064)!==0&&re!==null)re.return=D,Ee=re;else e:for(D=K;Ee!==null;){if(N=Ee,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:Ih(9,N)}}catch(je){jt(N,N.return,je)}if(N===D){Ee=null;break e}var me=N.sibling;if(me!==null){me.return=N.return,Ee=me;break e}Ee=N.return}}if(ot=b,xs(),di&&typeof di.onPostCommitFiberRoot=="function")try{di.onPostCommitFiberRoot(Js,o)}catch{}_=!0}return _}finally{pt=f,Li.transition=c}}return!1}function Vx(o,c,f){c=ha(f,c),c=hx(o,c,1),o=bs(o,c,1),c=Fr(),o!==null&&(el(o,1,c),ri(o,c))}function jt(o,c,f){if(o.tag===3)Vx(o,o,f);else for(;c!==null;){if(c.tag===3){Vx(c,o,f);break}else if(c.tag===1){var _=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(ws===null||!ws.has(_))){o=ha(f,o),o=ux(c,o,1),c=bs(c,o,1),o=Fr(),c!==null&&(el(c,1,o),ri(c,o));break}}c=c.return}}function GM(o,c,f){var _=o.pingCache;_!==null&&_.delete(c),c=Fr(),o.pingedLanes|=o.suspendedLanes&f,dr===o&&(vr&f)===f&&(Jt===4||Jt===3&&(vr&130023424)===vr&&500>Ke()-Mp?co(o,0):Bp|=f),ri(o,c)}function Gx(o,c){c===0&&((o.mode&1)===0?c=1:(c=Xc,Xc<<=1,(Xc&130023424)===0&&(Xc=4194304)));var f=Fr();o=Un(o,c),o!==null&&(el(o,c,f),ri(o,f))}function YM(o){var c=o.memoizedState,f=0;c!==null&&(f=c.retryLane),Gx(o,f)}function KM(o,c){var f=0;switch(o.tag){case 13:var _=o.stateNode,b=o.memoizedState;b!==null&&(f=b.retryLane);break;case 19:_=o.stateNode;break;default:throw Error(r(314))}_!==null&&_.delete(c),Gx(o,f)}var Yx;Yx=function(o,c,f){if(o!==null)if(o.memoizedProps!==c.pendingProps||Zr.current)ei=!0;else{if((o.lanes&f)===0&&(c.flags&128)===0)return ei=!1,$M(o,c,f);ei=(o.flags&131072)!==0}else ei=!1,Mt&&(c.flags&1048576)!==0&&E_(c,_h,c.index);switch(c.lanes=0,c.tag){case 2:var _=c.type;Dh(o,c),o=c.pendingProps;var b=ra(c,Er.current);la(c,f),b=op(null,c,_,o,b,f);var w=ap();return c.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Jr(_)?(w=!0,gh(c)):w=!1,c.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,Jf(c),b.updater=Rh,c.stateNode=b,b._reactInternals=c,fp(c,_,o,f),c=yp(null,c,_,!0,w,f)):(c.tag=0,Mt&&w&&Hf(c),Or(null,c,b,f),c=c.child),c;case 16:_=c.elementType;e:{switch(Dh(o,c),o=c.pendingProps,b=_._init,_=b(_._payload),c.type=_,b=c.tag=QM(_),o=Xi(_,o),b){case 0:c=mp(null,c,_,o,f);break e;case 1:c=vx(null,c,_,o,f);break e;case 11:c=gx(null,c,_,o,f);break e;case 14:c=mx(null,c,_,Xi(_.type,o),f);break e}throw Error(r(306,_,""))}return c;case 0:return _=c.type,b=c.pendingProps,b=c.elementType===_?b:Xi(_,b),mp(o,c,_,b,f);case 1:return _=c.type,b=c.pendingProps,b=c.elementType===_?b:Xi(_,b),vx(o,c,_,b,f);case 3:e:{if(bx(c),o===null)throw Error(r(387));_=c.pendingProps,w=c.memoizedState,b=w.element,$_(o,c),Ch(c,_,null,f);var D=c.memoizedState;if(_=D.element,w.isDehydrated)if(w={element:_,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},c.updateQueue.baseState=w,c.memoizedState=w,c.flags&256){b=ha(Error(r(423)),c),c=Sx(o,c,_,f,b);break e}else if(_!==b){b=ha(Error(r(424)),c),c=Sx(o,c,_,f,b);break e}else for(gi=ms(c.stateNode.containerInfo.firstChild),pi=c,Mt=!0,Ki=null,f=P_(c,null,_,f),c.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(sa(),_===b){c=Gn(o,c,f);break e}Or(o,c,_,f)}c=c.child}return c;case 5:return O_(c),o===null&&Vf(c),_=c.type,b=c.pendingProps,w=o!==null?o.memoizedProps:null,D=b.children,jf(_,b)?D=null:w!==null&&jf(_,w)&&(c.flags|=32),xx(o,c),Or(o,c,D,f),c.child;case 6:return o===null&&Vf(c),null;case 13:return wx(o,c,f);case 4:return ep(c,c.stateNode.containerInfo),_=c.pendingProps,o===null?c.child=oa(c,null,_,f):Or(o,c,_,f),c.child;case 11:return _=c.type,b=c.pendingProps,b=c.elementType===_?b:Xi(_,b),gx(o,c,_,b,f);case 7:return Or(o,c,c.pendingProps,f),c.child;case 8:return Or(o,c,c.pendingProps.children,f),c.child;case 12:return Or(o,c,c.pendingProps.children,f),c.child;case 10:e:{if(_=c.type._context,b=c.pendingProps,w=c.memoizedProps,D=b.value,bt(bh,_._currentValue),_._currentValue=D,w!==null)if(Yi(w.value,D)){if(w.children===b.children&&!Zr.current){c=Gn(o,c,f);break e}}else for(w=c.child,w!==null&&(w.return=c);w!==null;){var N=w.dependencies;if(N!==null){D=w.child;for(var G=N.firstContext;G!==null;){if(G.context===_){if(w.tag===1){G=Vn(-1,f&-f),G.tag=2;var ie=w.updateQueue;if(ie!==null){ie=ie.shared;var pe=ie.pending;pe===null?G.next=G:(G.next=pe.next,pe.next=G),ie.pending=G}}w.lanes|=f,G=w.alternate,G!==null&&(G.lanes|=f),Qf(w.return,f,c),N.lanes|=f;break}G=G.next}}else if(w.tag===10)D=w.type===c.type?null:w.child;else if(w.tag===18){if(D=w.return,D===null)throw Error(r(341));D.lanes|=f,N=D.alternate,N!==null&&(N.lanes|=f),Qf(D,f,c),D=w.sibling}else D=w.child;if(D!==null)D.return=w;else for(D=w;D!==null;){if(D===c){D=null;break}if(w=D.sibling,w!==null){w.return=D.return,D=w;break}D=D.return}w=D}Or(o,c,b.children,f),c=c.child}return c;case 9:return b=c.type,_=c.pendingProps.children,la(c,f),b=Bi(b),_=_(b),c.flags|=1,Or(o,c,_,f),c.child;case 14:return _=c.type,b=Xi(_,c.pendingProps),b=Xi(_.type,b),mx(o,c,_,b,f);case 15:return yx(o,c,c.type,c.pendingProps,f);case 17:return _=c.type,b=c.pendingProps,b=c.elementType===_?b:Xi(_,b),Dh(o,c),c.tag=1,Jr(_)?(o=!0,gh(c)):o=!1,la(c,f),lx(c,_,b),fp(c,_,b,f),yp(null,c,_,!0,o,f);case 19:return kx(o,c,f);case 22:return _x(o,c,f)}throw Error(r(156,c.tag))};function Kx(o,c){return U(o,c)}function XM(o,c,f,_){this.tag=o,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(o,c,f,_){return new XM(o,c,f,_)}function jp(o){return o=o.prototype,!(!o||!o.isReactComponent)}function QM(o){if(typeof o=="function")return jp(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Y)return 11;if(o===$)return 14}return 2}function Es(o,c){var f=o.alternate;return f===null?(f=Ri(o.tag,c,o.key,o.mode),f.elementType=o.elementType,f.type=o.type,f.stateNode=o.stateNode,f.alternate=o,o.alternate=f):(f.pendingProps=c,f.type=o.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=o.flags&14680064,f.childLanes=o.childLanes,f.lanes=o.lanes,f.child=o.child,f.memoizedProps=o.memoizedProps,f.memoizedState=o.memoizedState,f.updateQueue=o.updateQueue,c=o.dependencies,f.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},f.sibling=o.sibling,f.index=o.index,f.ref=o.ref,f}function qh(o,c,f,_,b,w){var D=2;if(_=o,typeof o=="function")jp(o)&&(D=1);else if(typeof o=="string")D=5;else e:switch(o){case A:return uo(f.children,b,w,c);case O:D=8,b|=8;break;case V:return o=Ri(12,f,c,b|2),o.elementType=V,o.lanes=w,o;case F:return o=Ri(13,f,c,b),o.elementType=F,o.lanes=w,o;case z:return o=Ri(19,f,c,b),o.elementType=z,o.lanes=w,o;case W:return Uh(f,b,w,c);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case q:D=10;break e;case H:D=9;break e;case Y:D=11;break e;case $:D=14;break e;case j:D=16,_=null;break e}throw Error(r(130,o==null?o:typeof o,""))}return c=Ri(D,f,c,b),c.elementType=o,c.type=_,c.lanes=w,c}function uo(o,c,f,_){return o=Ri(7,o,_,c),o.lanes=f,o}function Uh(o,c,f,_){return o=Ri(22,o,_,c),o.elementType=W,o.lanes=f,o.stateNode={isHidden:!1},o}function zp(o,c,f){return o=Ri(6,o,null,c),o.lanes=f,o}function Op(o,c,f){return c=Ri(4,o.children!==null?o.children:[],o.key,c),c.lanes=f,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function ZM(o,c,f,_,b){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=df(0),this.expirationTimes=df(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=df(0),this.identifierPrefix=_,this.onRecoverableError=b,this.mutableSourceEagerHydrationData=null}function Fp(o,c,f,_,b,w,D,N,G){return o=new ZM(o,c,f,N,G),c===1?(c=1,w===!0&&(c|=8)):c=0,w=Ri(3,null,null,c),o.current=w,w.stateNode=o,w.memoizedState={element:_,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jf(w),o}function JM(o,c,f){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:k,key:_==null?null:""+_,children:o,containerInfo:c,implementation:f}}function Xx(o){if(!o)return _s;o=o._reactInternals;e:{if(Se(o)!==o||o.tag!==1)throw Error(r(170));var c=o;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Jr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(r(171))}if(o.tag===1){var f=o.type;if(Jr(f))return C_(o,f,c)}return c}function Qx(o,c,f,_,b,w,D,N,G){return o=Fp(f,_,!0,o,b,w,D,N,G),o.context=Xx(null),f=o.current,_=Fr(),b=ks(f),w=Vn(_,b),w.callback=c??null,bs(f,w,b),o.current.lanes=b,el(o,b,_),ri(o,_),o}function Vh(o,c,f,_){var b=c.current,w=Fr(),D=ks(b);return f=Xx(f),c.context===null?c.context=f:c.pendingContext=f,c=Vn(w,D),c.payload={element:o},_=_===void 0?null:_,_!==null&&(c.callback=_),o=bs(b,c,D),o!==null&&(Ji(o,b,D,w),wh(o,b,D)),D}function Gh(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function Zx(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var f=o.retryLane;o.retryLane=f!==0&&f<c?f:c}}function Np(o,c){Zx(o,c),(o=o.alternate)&&Zx(o,c)}function eL(){return null}var Jx=typeof reportError=="function"?reportError:function(o){console.error(o)};function Wp(o){this._internalRoot=o}Yh.prototype.render=Wp.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(r(409));Vh(o,c,null,null)},Yh.prototype.unmount=Wp.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;lo(function(){Vh(null,o,null,null)}),c[Nn]=null}};function Yh(o){this._internalRoot=o}Yh.prototype.unstable_scheduleHydration=function(o){if(o){var c=$0();o={blockedOn:null,target:o,priority:c};for(var f=0;f<fs.length&&c!==0&&c<fs[f].priority;f++);fs.splice(f,0,o),f===0&&O0(o)}};function Hp(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Kh(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function ev(){}function tL(o,c,f,_,b){if(b){if(typeof _=="function"){var w=_;_=function(){var ie=Gh(D);w.call(ie)}}var D=Qx(c,_,o,0,null,!1,!1,"",ev);return o._reactRootContainer=D,o[Nn]=D.current,pl(o.nodeType===8?o.parentNode:o),lo(),D}for(;b=o.lastChild;)o.removeChild(b);if(typeof _=="function"){var N=_;_=function(){var ie=Gh(G);N.call(ie)}}var G=Fp(o,0,!1,null,null,!1,!1,"",ev);return o._reactRootContainer=G,o[Nn]=G.current,pl(o.nodeType===8?o.parentNode:o),lo(function(){Vh(c,G,f,_)}),G}function Xh(o,c,f,_,b){var w=f._reactRootContainer;if(w){var D=w;if(typeof b=="function"){var N=b;b=function(){var G=Gh(D);N.call(G)}}Vh(c,D,o,b)}else D=tL(f,c,o,b,_);return Gh(D)}P0=function(o){switch(o.tag){case 3:var c=o.stateNode;if(c.current.memoizedState.isDehydrated){var f=Ja(c.pendingLanes);f!==0&&(ff(c,f|1),ri(c,Ke()),(ot&6)===0&&(fa=Ke()+500,xs()))}break;case 13:lo(function(){var _=Un(o,1);if(_!==null){var b=Fr();Ji(_,o,1,b)}}),Np(o,1)}},pf=function(o){if(o.tag===13){var c=Un(o,134217728);if(c!==null){var f=Fr();Ji(c,o,134217728,f)}Np(o,134217728)}},I0=function(o){if(o.tag===13){var c=ks(o),f=Un(o,c);if(f!==null){var _=Fr();Ji(f,o,c,_)}Np(o,c)}},$0=function(){return pt},j0=function(o,c){var f=pt;try{return pt=o,c()}finally{pt=f}},fn=function(o,c,f){switch(c){case"input":if(Je(o,f),c=f.name,f.type==="radio"&&c!=null){for(f=o;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<f.length;c++){var _=f[c];if(_!==o&&_.form===o.form){var b=fh(_);if(!b)throw Error(r(90));it(_),Je(_,b)}}}break;case"textarea":jn(o,f);break;case"select":c=f.value,c!=null&&ar(o,!!f.multiple,c,!1)}},wt=Pp,qi=lo;var rL={usingClientEntryPoint:!1,Events:[yl,ea,fh,Vo,Qs,Pp]},Rl={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},iL={bundleType:Rl.bundleType,version:Rl.version,rendererPackageName:Rl.rendererPackageName,rendererConfig:Rl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:B.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=zr(o),o===null?null:o.stateNode},findFiberByHostInstance:Rl.findFiberByHostInstance||eL,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qh.isDisabled&&Qh.supportsFiber)try{Js=Qh.inject(iL),di=Qh}catch{}}return ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rL,ii.createPortal=function(o,c){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hp(c))throw Error(r(200));return JM(o,c,null,f)},ii.createRoot=function(o,c){if(!Hp(o))throw Error(r(299));var f=!1,_="",b=Jx;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onRecoverableError!==void 0&&(b=c.onRecoverableError)),c=Fp(o,1,!1,null,null,f,!1,_,b),o[Nn]=c.current,pl(o.nodeType===8?o.parentNode:o),new Wp(c)},ii.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=zr(c),o=o===null?null:o.stateNode,o},ii.flushSync=function(o){return lo(o)},ii.hydrate=function(o,c,f){if(!Kh(c))throw Error(r(200));return Xh(null,o,c,!0,f)},ii.hydrateRoot=function(o,c,f){if(!Hp(o))throw Error(r(405));var _=f!=null&&f.hydratedSources||null,b=!1,w="",D=Jx;if(f!=null&&(f.unstable_strictMode===!0&&(b=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onRecoverableError!==void 0&&(D=f.onRecoverableError)),c=Qx(c,null,o,1,f??null,b,!1,w,D),o[Nn]=c.current,pl(o),_)for(o=0;o<_.length;o++)f=_[o],b=f._getVersion,b=b(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,b]:c.mutableSourceEagerHydrationData.push(f,b);return new Yh(c)},ii.render=function(o,c,f){if(!Kh(c))throw Error(r(200));return Xh(null,o,c,!1,f)},ii.unmountComponentAtNode=function(o){if(!Kh(o))throw Error(r(40));return o._reactRootContainer?(lo(function(){Xh(null,null,o,!1,function(){o._reactRootContainer=null,o[Nn]=null})}),!0):!1},ii.unstable_batchedUpdates=Pp,ii.unstable_renderSubtreeIntoContainer=function(o,c,f,_){if(!Kh(f))throw Error(r(200));if(o==null||o._reactInternals===void 0)throw Error(r(38));return Xh(o,c,f,!1,_)},ii.version="18.3.1-next-f1338f8080-20240426",ii}var lv;function fL(){if(lv)return Vp.exports;lv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Vp.exports=dL(),Vp.exports}var cv;function pL(){if(cv)return Zh;cv=1;var e=fL();return Zh.createRoot=e.createRoot,Zh.hydrateRoot=e.hydrateRoot,Zh}var gL=pL();const mL=yy(gL),yL="chat:stream",_L="chat:assistant",xL="chat:tool-use",vL="chat:tool-result",bL="chat:status",SL="chat:error",wL="chat:user",CL="session:created",kL="session:resumed",TL="sys:connect",Kp=1;function EL(e={}){const{url:t,onMessage:r,autoConnect:i=!0,handshake:n,wsPath:s="/ws",ssePath:a="/sse"}=e,[l,u]=M.useState("disconnected"),[h,d]=M.useState(null),p=M.useRef(null),m=M.useRef(null),y=M.useRef(0),x=M.useRef(null),v=M.useRef(!0),S=M.useRef(r);M.useEffect(()=>{S.current=r},[r]);const C=BL(t),E=ML(t),L=M.useCallback(()=>{p.current&&(p.current.onopen=null,p.current.onclose=null,p.current.onerror=null,p.current.onmessage=null,(p.current.readyState===1||p.current.readyState===0)&&p.current.close(),p.current=null),m.current&&(m.current.close(),m.current=null),x.current&&(clearTimeout(x.current),x.current=null)},[]),B=M.useCallback(H=>{try{const Y=typeof H=="string"?JSON.parse(H):H;S.current&&S.current(Y)}catch(Y){console.warn("[useConnection] Failed to parse message:",Y)}},[]),R=M.useRef(n);M.useEffect(()=>{R.current=n},[n]);const k=M.useCallback(H=>{var F;const Y={v:Kp,type:TL,payload:{clientType:"browser",protocolVersion:Kp,...R.current},source:"client",timestamp:Date.now()};H==="ws"&&((F=p.current)==null?void 0:F.readyState)===1&&p.current.send(JSON.stringify(Y))},[]),A=M.useCallback(()=>{if(!v.current)return;const H=Math.min(1e3*Math.pow(2,y.current),3e4);y.current+=1,u("disconnected"),x.current=setTimeout(()=>{v.current&&V()},H)},[]),O=M.useCallback(()=>{if(v.current){u("connecting");try{const H=new EventSource(`${E}${a}`);m.current=H,H.onopen=()=>{v.current&&(u("connected"),d("sse"),y.current=0)},H.onmessage=Y=>{v.current&&B(Y.data)},H.onerror=()=>{v.current&&(H.close(),m.current=null,d(null),A())}}catch{d(null),A()}}},[E,a,B,A]),V=M.useCallback(()=>{if(v.current){L(),u("connecting");try{const H=new WebSocket(`${C}${s}`);p.current=H,H.onopen=()=>{v.current&&(u("connected"),d("ws"),y.current=0,k("ws"))},H.onmessage=Y=>{v.current&&B(Y.data)},H.onclose=Y=>{v.current&&(p.current=null,d(null),Y.code===1e3||y.current===0?O():A())},H.onerror=()=>{v.current&&y.current===0&&(p.current=null,d(null),O())}}catch{O()}}},[C,s,L,B,k,O,A]),q=M.useCallback((H,Y,F)=>{var $;const z={v:Kp,type:H,payload:Y,source:"client",timestamp:Date.now()};F&&(z.sessionId=F),h==="ws"&&(($=p.current)==null?void 0:$.readyState)===1?p.current.send(JSON.stringify(z)):fetch(`${E}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:Y==null?void 0:Y.text,sessionId:F})}).catch(j=>{console.warn("[useConnection] REST fallback failed:",j)})},[h,E]);return M.useEffect(()=>(v.current=!0,i&&t&&V(),()=>{v.current=!1,L()}),[t]),{status:l,transport:h,sendEvent:q}}function BL(e){return e?e.startsWith("ws://")||e.startsWith("wss://")?e:e.replace(/^http/,"ws"):"ws://localhost:3456"}function ML(e){return e?e.startsWith("http://")||e.startsWith("https://")?e:e.replace(/^ws/,"http"):"http://localhost:3456"}const xy=M.createContext(null);function LL({url:e,config:t,onMessage:r,handshake:i,wsPath:n,ssePath:s,children:a}){const l=M.useRef(new Set),u=M.useRef(r);M.useEffect(()=>{u.current=r},[r]);const h=M.useCallback(C=>{if(u.current)try{u.current(C)}catch{}for(const E of l.current)try{E(C)}catch{}},[]),d=M.useMemo(()=>{const C={url:e,onMessage:h};return i&&(C.handshake=i),n&&(C.wsPath=n),s&&(C.ssePath=s),C},[e,h,i,n,s]),{status:p,transport:m,sendEvent:y}=EL(d),x=M.useCallback(C=>(l.current.add(C),()=>l.current.delete(C)),[]),v=M.useMemo(()=>e?e.startsWith("http")?e:e.replace(/^ws/,"http"):"http://localhost:3456",[e]),S=M.useMemo(()=>({httpUrl:v,wsUrl:e,config:t||{},status:p,transport:m,subscribe:x,sendEvent:y}),[v,e,t,p,m,x,y]);return g.jsx(xy.Provider,{value:S,children:a})}let RL=0;function fo(){return`msg-${Date.now()}-${++RL}`}function AL(e={}){const t=M.useContext(xy),[r,i]=M.useState([]),[n,s]=M.useState("idle"),[a,l]=M.useState(null),[u,h]=M.useState(null),[d,p]=M.useState(null),m=M.useRef(""),y=M.useRef(e);M.useEffect(()=>{y.current=e},[e]);const x=(t==null?void 0:t.httpUrl)||"http://localhost:3456",v=M.useCallback(k=>{if(!(k!=null&&k.type))return;const A=y.current;switch(k.type){case yL:{m.current=k.payload.fullText||"",i(O=>{const V=O[O.length-1];return V&&V.role==="assistant"&&V._streaming?[...O.slice(0,-1),{...V,text:m.current}]:[...O,{id:fo(),role:"assistant",text:k.payload.fullText||k.payload.delta||"",timestamp:k.timestamp,_streaming:!0}]}),s("streaming");break}case _L:{m.current="";const O=k.payload.buttons,V=k.payload.blocks;i(q=>{const H=q[q.length-1],Y={};return O!=null&&O.length&&(Y.buttons=O),V!=null&&V.length&&(Y.blocks=V),H&&H.role==="assistant"&&H._streaming?[...q.slice(0,-1),{...H,text:k.payload.text,_streaming:!1,...Y}]:[...q,{id:fo(),role:"assistant",text:k.payload.text,timestamp:k.timestamp,_streaming:!1,...Y}]});break}case xL:{const O={id:fo(),role:"tool-use",text:`Using ${k.payload.toolName}`,data:k.payload,timestamp:k.timestamp};i(V=>[...V,O]),A.onToolUse&&A.onToolUse(k.payload);break}case vL:{i(O=>[...O,{id:fo(),role:"tool-result",data:k.payload,timestamp:k.timestamp}]);break}case bL:{s(k.payload.status||"idle");break}case SL:{const O=k.payload.message||"Unknown error";p(O),i(V=>[...V,{id:fo(),role:"error",text:O,timestamp:k.timestamp}]),A.onError&&A.onError(k.payload);break}case wL:{if(k.source==="client")break;i(O=>[...O,{id:fo(),role:"user",text:k.payload.text,timestamp:k.timestamp}]);break}case CL:case kL:{l(k.payload.sessionId),k.payload.config&&h(k.payload.config);break}}A.onMessage&&A.onMessage(k)},[]);M.useEffect(()=>{if(t!=null&&t.subscribe)return t.subscribe(v)},[t,v]);const S=M.useCallback(async k=>{p(null);const A={...(t==null?void 0:t.config)||{},...e.config||{}};try{const O=await fetch(`${x}/chat/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:A})}),V=await O.json();if(!O.ok)throw new Error(V.error||"Failed to start session");return l(V.sessionId),V.config&&h(V.config),k&&await E(V.sessionId,k),V.sessionId}catch(O){throw p(O.message),O}},[x,t,e.config]),C=M.useCallback(async k=>{if(k!=null&&k.trim()){if(!a){await S(k);return}await E(a,k)}},[a,S,x]);async function E(k,A){i(O=>[...O,{id:fo(),role:"user",text:A,timestamp:Date.now()}]),p(null);try{const O=await fetch(`${x}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:k,text:A})});if(!O.ok){const V=await O.json().catch(()=>({}));throw new Error(V.error||"Failed to send message")}}catch(O){p(O.message)}}const L=M.useCallback(async()=>{if(a)try{await fetch(`${x}/chat/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a})})}catch{}},[a,x]),B=M.useCallback(()=>{i([]),m.current=""},[]);return{messages:r,send:C,stop:L,isStreaming:n==="streaming"||n==="thinking",status:n,sessionId:a,resolvedConfig:u,error:d,clearMessages:B,createSession:S}}function DL(){const e=M.useContext(xy),[t,r]=M.useState([]),[i,n]=M.useState(!1),[s,a]=M.useState(null),l=(e==null?void 0:e.httpUrl)||"http://localhost:3456",u=M.useCallback(async p=>{n(!0),a(null);try{const m=p?`?dir=${encodeURIComponent(p)}`:"",y=await fetch(`${l}/chat/sessions${m}`),x=await y.json();if(!y.ok)throw new Error(x.error||"Failed to list sessions");r(x.sessions||[])}catch(m){a(m.message)}finally{n(!1)}},[l]),h=M.useCallback(async p=>{a(null);try{const m={...(e==null?void 0:e.config)||{},...p||{}},y=await fetch(`${l}/chat/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:m})}),x=await y.json();if(!y.ok)throw new Error(x.error||"Failed to create session");return x}catch(m){throw a(m.message),m}},[l,e]),d=M.useCallback(async(p,m)=>{a(null);try{const y={...(e==null?void 0:e.config)||{},...m||{}},x=await fetch(`${l}/chat/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:p,config:y})}),v=await x.json();if(!x.ok)throw new Error(v.error||"Failed to resume session");return v}catch(y){throw a(y.message),y}},[l,e]);return M.useEffect(()=>{u()},[u]),{sessions:t,loading:i,error:s,refresh:u,create:h,resume:d}}const PL="ws://localhost:3456/ws",IL="http://localhost:3456/sse",hv="http://localhost:3456/api";function $L(e){const[t,r]=M.useState("disconnected"),[i,n]=M.useState(null),[s,a]=M.useState(null),l=M.useRef(null),u=M.useRef(null),h=M.useRef(0),d=M.useRef(null),p=M.useRef(!0),m=M.useRef(e);M.useEffect(()=>{m.current=e},[e]);const y=M.useCallback(()=>{l.current&&(l.current.onopen=null,l.current.onclose=null,l.current.onerror=null,l.current.onmessage=null,(l.current.readyState===WebSocket.OPEN||l.current.readyState===WebSocket.CONNECTING)&&l.current.close(),l.current=null),u.current&&(u.current.close(),u.current=null),d.current&&(clearTimeout(d.current),d.current=null)},[]),x=M.useCallback(B=>{var R;try{const k=typeof B=="string"?JSON.parse(B):B;k.type==="sys:connect"&&k.source==="bridge"&&((R=k.payload)!=null&&R.clientId)&&a(k.payload.clientId),m.current&&m.current(k)}catch(k){console.warn("[useConnection] Failed to parse message:",k)}},[]),v=M.useCallback(B=>{var k;const R={v:1,type:"sys:connect",payload:{clientType:"canvas",protocolVersion:1,capabilities:["dashboard","canvas","quiz","playground"]},source:"canvas",timestamp:Date.now()};B==="ws"&&((k=l.current)==null?void 0:k.readyState)===WebSocket.OPEN?l.current.send(JSON.stringify(R)):B==="sse"&&fetch(`${hv}/event`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)}).catch(A=>{console.warn("[useConnection] Failed to send connect handshake via REST:",A)})},[]),S=M.useCallback(()=>{if(!p.current)return;const B=Math.min(1e3*Math.pow(2,h.current),3e4);h.current+=1,console.log(`[useConnection] Reconnecting in ${B}ms (attempt ${h.current})`),r("disconnected"),d.current=setTimeout(()=>{p.current&&E()},B)},[]),C=M.useCallback(()=>{if(p.current){console.log("[useConnection] Falling back to SSE"),r("connecting");try{const B=new EventSource(IL);u.current=B,B.onopen=()=>{p.current&&(console.log("[useConnection] SSE connected"),r("connected"),n("sse"),h.current=0,v("sse"))},B.onmessage=R=>{p.current&&x(R.data)},B.onerror=()=>{p.current&&(console.warn("[useConnection] SSE error"),B.close(),u.current=null,n(null),S())}}catch(B){console.warn("[useConnection] SSE failed to connect:",B),n(null),S()}}},[x,v,S]),E=M.useCallback(()=>{if(p.current){y(),r("connecting");try{const B=new WebSocket(PL);l.current=B,B.onopen=()=>{p.current&&(console.log("[useConnection] WebSocket connected"),r("connected"),n("ws"),h.current=0,v("ws"))},B.onmessage=R=>{p.current&&x(R.data)},B.onclose=R=>{p.current&&(console.log("[useConnection] WebSocket closed:",R.code,R.reason),l.current=null,n(null),R.code===1e3||h.current===0?C():S())},B.onerror=()=>{p.current&&(console.warn("[useConnection] WebSocket error — will try SSE"),h.current===0&&(l.current=null,n(null),C()))}}catch(B){console.warn("[useConnection] WebSocket failed:",B),C()}}},[y,x,v,C,S]),L=M.useCallback((B,R)=>{var A;const k={v:1,type:B,payload:R,source:"canvas",timestamp:Date.now()};i==="ws"&&((A=l.current)==null?void 0:A.readyState)===WebSocket.OPEN?l.current.send(JSON.stringify(k)):fetch(`${hv}/event`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).catch(O=>{console.warn("[useConnection] Failed to send event via REST:",O)})},[i]);return M.useEffect(()=>(p.current=!0,E(),()=>{p.current=!1,y()}),[]),{status:t,transport:i,clientId:s,sendEvent:L}}const js={blue:{dark:"#58a6ff",light:"#0969da"},green:{dark:"#3fb950",light:"#1a7f37"},purple:{dark:"#bc8cff",light:"#8250df"},orange:{dark:"#f0883e",light:"#bc4c00"},red:{dark:"#f85149",light:"#cf222e"},yellow:{dark:"#d29922",light:"#9a6700"}},jL={id:"dark",bgPrimary:"#0d1117",bgSecondary:"#161b22",bgTertiary:"#21262d",border:"#30363d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#484f58",textBright:"#e6edf3",accent:"#58a6ff",success:"#3fb950",error:"#f85149",warning:"#d29922",purple:"#bc8cff",orange:"#f0883e",userBubble:"#1f6feb",errorBg:"#3d1416",errorButton:"#da3633"},zL={id:"light",bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgTertiary:"#eaeef2",border:"#d1d5db",textPrimary:"#1f2328",textSecondary:"#656d76",textMuted:"#8b949e",textBright:"#1f2328",accent:"#0969da",success:"#1a7f37",error:"#cf222e",warning:"#9a6700",purple:"#8250df",orange:"#bc4c00",userBubble:"#0969da",errorBg:"#ffebe9",errorButton:"#cf222e"},Ql={dark:jL,light:zL};function OL(e,t){const r=js[t];return r?{...e,accent:r[e.id]||r.dark}:e}function FL(e){var t;return e==="light"?Ql.light:e==="dark"?Ql.dark:typeof window<"u"&&((t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: light)").matches)?Ql.light:Ql.dark}const nS=M.createContext(null);function NL(e){const t=document.documentElement;t.setAttribute("data-theme",e.id),t.style.setProperty("--bg-primary",e.bgPrimary),t.style.setProperty("--bg-secondary",e.bgSecondary),t.style.setProperty("--border",e.border),t.style.setProperty("--text-primary",e.textPrimary),t.style.setProperty("--accent",e.accent),t.style.setProperty("--scrollbar-thumb",e.bgTertiary),t.style.setProperty("--scrollbar-track",e.bgPrimary)}function WL({children:e}){const[t,r]=M.useState("dark"),[i,n]=M.useState("blue"),s=M.useMemo(()=>FL(t),[t]),a=M.useMemo(()=>OL(s,i),[s,i]);M.useEffect(()=>{NL(a)},[a]),M.useEffect(()=>{if(t!=="system")return;const d=window.matchMedia("(prefers-color-scheme: light)"),p=()=>{r("system")};return d.addEventListener("change",p),()=>d.removeEventListener("change",p)},[t]),M.useEffect(()=>{fetch("http://localhost:3456/api/settings").then(d=>d.ok?d.json():null).then(d=>{d&&(d.theme&&["dark","light","system"].includes(d.theme)&&r(d.theme),d.accent&&js[d.accent]&&n(d.accent))}).catch(()=>{})},[]);const l=M.useCallback(d=>{r(d),fetch("http://localhost:3456/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:d})}).catch(()=>{})},[]),u=M.useCallback(d=>{js[d]&&(n(d),fetch("http://localhost:3456/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accent:d})}).catch(()=>{}))},[]),h=M.useMemo(()=>({theme:a,preference:t,accentName:i,setThemePreference:l,setAccent:u}),[a,t,i,l,u]);return g.jsx(nS.Provider,{value:h,children:e})}function St(){const e=M.useContext(nS);return e||{theme:Ql.dark,preference:"dark",accentName:"blue",setThemePreference:()=>{},setAccent:()=>{}}}function vy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oo=vy();function sS(e){Oo=e}var dc={exec:()=>null};function lt(e,t=""){let r=typeof e=="string"?e:e.source,i={replace:(n,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(qr.caret,"$1"),r=r.replace(n,a),i},getRegex:()=>new RegExp(r,t)};return i}var HL=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),qr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},qL=/^(?:[ \t]*(?:\n|$))+/,UL=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VL=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ic=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,GL=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,by=/(?:[*+-]|\d{1,9}[.)])/,oS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,aS=lt(oS).replace(/bull/g,by).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),YL=lt(oS).replace(/bull/g,by).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,KL=/^[^\n]+/,wy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,XL=lt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wy).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),QL=lt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,by).getRegex(),Dd="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ZL=lt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cy).replace("tag",Dd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lS=lt(Sy).replace("hr",Ic).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Dd).getRegex(),JL=lt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lS).getRegex(),ky={blockquote:JL,code:UL,def:XL,fences:VL,heading:GL,hr:Ic,html:ZL,lheading:aS,list:QL,newline:qL,paragraph:lS,table:dc,text:KL},uv=lt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ic).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Dd).getRegex(),eR={...ky,lheading:YL,table:uv,paragraph:lt(Sy).replace("hr",Ic).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Dd).getRegex()},tR={...ky,html:lt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cy).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:dc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:lt(Sy).replace("hr",Ic).replace("heading",` *#{1,6} *[^
|
|
42
|
+
]`).replace("lheading",aS).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rR=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,iR=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cS=/^( {2,}|\\)\n(?!\s*$)/,nR=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pd=/[\p{P}\p{S}]/u,Ty=/[\s\p{P}\p{S}]/u,hS=/[^\s\p{P}\p{S}]/u,sR=lt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ty).getRegex(),uS=/(?!~)[\p{P}\p{S}]/u,oR=/(?!~)[\s\p{P}\p{S}]/u,aR=/(?:[^\s\p{P}\p{S}]|~)/u,lR=lt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",HL?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dS=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,cR=lt(dS,"u").replace(/punct/g,Pd).getRegex(),hR=lt(dS,"u").replace(/punct/g,uS).getRegex(),fS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",uR=lt(fS,"gu").replace(/notPunctSpace/g,hS).replace(/punctSpace/g,Ty).replace(/punct/g,Pd).getRegex(),dR=lt(fS,"gu").replace(/notPunctSpace/g,aR).replace(/punctSpace/g,oR).replace(/punct/g,uS).getRegex(),fR=lt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hS).replace(/punctSpace/g,Ty).replace(/punct/g,Pd).getRegex(),pR=lt(/\\(punct)/,"gu").replace(/punct/g,Pd).getRegex(),gR=lt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),mR=lt(Cy).replace("(?:-->|$)","-->").getRegex(),yR=lt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",mR).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qu=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,_R=lt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pS=lt(/^!?\[(label)\]\[(ref)\]/).replace("label",qu).replace("ref",wy).getRegex(),gS=lt(/^!?\[(ref)\](?:\[\])?/).replace("ref",wy).getRegex(),xR=lt("reflink|nolink(?!\\()","g").replace("reflink",pS).replace("nolink",gS).getRegex(),dv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ey={_backpedal:dc,anyPunctuation:pR,autolink:gR,blockSkip:lR,br:cS,code:iR,del:dc,emStrongLDelim:cR,emStrongRDelimAst:uR,emStrongRDelimUnd:fR,escape:rR,link:_R,nolink:gS,punctuation:sR,reflink:pS,reflinkSearch:xR,tag:yR,text:nR,url:dc},vR={...Ey,link:lt(/^!?\[(label)\]\((.*?)\)/).replace("label",qu).getRegex(),reflink:lt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qu).getRegex()},Ig={...Ey,emStrongRDelimAst:dR,emStrongLDelim:hR,url:lt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dv).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:lt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",dv).getRegex()},bR={...Ig,br:lt(cS).replace("{2,}","*").getRegex(),text:lt(Ig.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Jh={normal:ky,gfm:eR,pedantic:tR},Dl={normal:Ey,gfm:Ig,breaks:bR,pedantic:vR},SR={"&":"&","<":"<",">":">",'"':""","'":"'"},fv=e=>SR[e];function Cn(e,t){if(t){if(qr.escapeTest.test(e))return e.replace(qr.escapeReplace,fv)}else if(qr.escapeTestNoEncode.test(e))return e.replace(qr.escapeReplaceNoEncode,fv);return e}function pv(e){try{e=encodeURI(e).replace(qr.percentDecode,"%")}catch{return null}return e}function gv(e,t){var s;let r=e.replace(qr.findPipe,(a,l,u)=>{let h=!1,d=l;for(;--d>=0&&u[d]==="\\";)h=!h;return h?"|":" |"}),i=r.split(qr.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!((s=i.at(-1))!=null&&s.trim())&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(qr.slashPipe,"|");return i}function Pl(e,t,r){let i=e.length;if(i===0)return"";let n=0;for(;n<i&&e.charAt(i-n-1)===t;)n++;return e.slice(0,i-n)}function wR(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])r++;else if(e[i]===t[1]&&(r--,r<0))return i;return r>0?-2:-1}function mv(e,t,r,i,n){let s=t.href,a=t.title||null,l=e[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:a,text:l,tokens:i.inlineTokens(l)};return i.state.inLink=!1,u}function CR(e,t,r){let i=e.match(r.other.indentCodeCompensation);if(i===null)return t;let n=i[1];return t.split(`
|
|
43
|
+
`).map(s=>{let a=s.match(r.other.beginningSpace);if(a===null)return s;let[l]=a;return l.length>=n.length?s.slice(n.length):s}).join(`
|
|
44
|
+
`)}var Uu=class{constructor(t){yt(this,"options");yt(this,"rules");yt(this,"lexer");this.options=t||Oo}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let i=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Pl(i,`
|
|
45
|
+
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let i=r[0],n=CR(i,r[3]||"",this.rules);return{type:"code",raw:i,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:n}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let i=r[2].trim();if(this.rules.other.endingHash.test(i)){let n=Pl(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:Pl(r[0],`
|
|
46
|
+
`)}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let i=Pl(r[0],`
|
|
47
|
+
`).split(`
|
|
48
|
+
`),n="",s="",a=[];for(;i.length>0;){let l=!1,u=[],h;for(h=0;h<i.length;h++)if(this.rules.other.blockquoteStart.test(i[h]))u.push(i[h]),l=!0;else if(!l)u.push(i[h]);else break;i=i.slice(h);let d=u.join(`
|
|
49
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
50
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
51
|
+
${d}`:d,s=s?`${s}
|
|
52
|
+
${p}`:p;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,a,!0),this.lexer.state.top=m,i.length===0)break;let y=a.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let x=y,v=x.raw+`
|
|
53
|
+
`+i.join(`
|
|
54
|
+
`),S=this.blockquote(v);a[a.length-1]=S,n=n.substring(0,n.length-x.raw.length)+S.raw,s=s.substring(0,s.length-x.text.length)+S.text;break}else if((y==null?void 0:y.type)==="list"){let x=y,v=x.raw+`
|
|
55
|
+
`+i.join(`
|
|
56
|
+
`),S=this.list(v);a[a.length-1]=S,n=n.substring(0,n.length-y.raw.length)+S.raw,s=s.substring(0,s.length-x.raw.length)+S.raw,i=v.substring(a.at(-1).raw.length).split(`
|
|
57
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:a,text:s}}}list(t){let r=this.rules.block.list.exec(t);if(r){let i=r[1].trim(),n=i.length>1,s={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let a=this.rules.other.listItemRegex(i),l=!1;for(;t;){let h=!1,d="",p="";if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;d=r[0],t=t.substring(d.length);let m=r[2].split(`
|
|
58
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,E=>" ".repeat(3*E.length)),y=t.split(`
|
|
59
|
+
`,1)[0],x=!m.trim(),v=0;if(this.options.pedantic?(v=2,p=m.trimStart()):x?v=r[1].length+1:(v=r[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,p=m.slice(v),v+=r[1].length),x&&this.rules.other.blankLine.test(y)&&(d+=y+`
|
|
60
|
+
`,t=t.substring(y.length+1),h=!0),!h){let E=this.rules.other.nextBulletRegex(v),L=this.rules.other.hrRegex(v),B=this.rules.other.fencesBeginRegex(v),R=this.rules.other.headingBeginRegex(v),k=this.rules.other.htmlBeginRegex(v);for(;t;){let A=t.split(`
|
|
61
|
+
`,1)[0],O;if(y=A,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),O=y):O=y.replace(this.rules.other.tabCharGlobal," "),B.test(y)||R.test(y)||k.test(y)||E.test(y)||L.test(y))break;if(O.search(this.rules.other.nonSpaceChar)>=v||!y.trim())p+=`
|
|
62
|
+
`+O.slice(v);else{if(x||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||B.test(m)||R.test(m)||L.test(m))break;p+=`
|
|
63
|
+
`+y}!x&&!y.trim()&&(x=!0),d+=A+`
|
|
64
|
+
`,t=t.substring(A.length+1),m=O.slice(v)}}s.loose||(l?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0));let S=null,C;this.options.gfm&&(S=this.rules.other.listIsTask.exec(p),S&&(C=S[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!S,checked:C,loose:!1,text:p,tokens:[]}),s.raw+=d}let u=s.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let h=0;h<s.items.length;h++)if(this.lexer.state.top=!1,s.items[h].tokens=this.lexer.blockTokens(s.items[h].text,[]),!s.loose){let d=s.items[h].tokens.filter(m=>m.type==="space"),p=d.length>0&&d.some(m=>this.rules.other.anyLine.test(m.raw));s.loose=p}if(s.loose)for(let h=0;h<s.items.length;h++)s.items[h].loose=!0;return s}}html(t){let r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){let r=this.rules.block.def.exec(t);if(r){let i=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:i,raw:r[0],href:n,title:s}}}table(t){var l;let r=this.rules.block.table.exec(t);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let i=gv(r[1]),n=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(l=r[3])!=null&&l.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
65
|
+
`):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(i.length===n.length){for(let u of n)this.rules.other.tableAlignRight.test(u)?a.align.push("right"):this.rules.other.tableAlignCenter.test(u)?a.align.push("center"):this.rules.other.tableAlignLeft.test(u)?a.align.push("left"):a.align.push(null);for(let u=0;u<i.length;u++)a.header.push({text:i[u],tokens:this.lexer.inline(i[u]),header:!0,align:a.align[u]});for(let u of s)a.rows.push(gv(u,a.header.length).map((h,d)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:a.align[d]})));return a}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let i=r[1].charAt(r[1].length-1)===`
|
|
66
|
+
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let i=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let a=Pl(i.slice(0,-1),"\\");if((i.length-a.length)%2===0)return}else{let a=wR(r[2],"()");if(a===-2)return;if(a>-1){let l=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,l).trim(),r[3]=""}}let n=r[2],s="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(n);a&&(n=a[1],s=a[3])}else s=r[3]?r[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),mv(r,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(t,r){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=r[n.toLowerCase()];if(!s){let a=i[0].charAt(0);return{type:"text",raw:a,text:a}}return mv(i,s,i[0],this.lexer,this.rules)}}emStrong(t,r,i=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||n[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!i||this.rules.inline.punctuation.exec(i))){let s=[...n[0]].length-1,a,l,u=s,h=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,r=r.slice(-1*t.length+s);(n=d.exec(r))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(l=[...a].length,n[3]||n[4]){u+=l;continue}else if((n[5]||n[6])&&s%3&&!((s+l)%3)){h+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+h);let p=[...n[0]][0].length,m=t.slice(0,s+n.index+p+l);if(Math.min(s,l)%2){let x=m.slice(1,-1);return{type:"em",raw:m,text:x,tokens:this.lexer.inlineTokens(x)}}let y=m.slice(2,-2);return{type:"strong",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let i=r[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),s=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&s&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:r[0],text:i}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let i,n;return r[2]==="@"?(i=r[1],n="mailto:"+i):(i=r[1],n=i),{type:"link",raw:r[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i;let r;if(r=this.rules.inline.url.exec(t)){let n,s;if(r[2]==="@")n=r[0],s="mailto:"+n;else{let a;do a=r[0],r[0]=((i=this.rules.inline._backpedal.exec(r[0]))==null?void 0:i[0])??"";while(a!==r[0]);n=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let i=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:i}}}},tn=class $g{constructor(t){yt(this,"tokens");yt(this,"options");yt(this,"state");yt(this,"tokenizer");yt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Oo,this.options.tokenizer=this.options.tokenizer||new Uu,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:qr,block:Jh.normal,inline:Dl.normal};this.options.pedantic?(r.block=Jh.pedantic,r.inline=Dl.pedantic):this.options.gfm&&(r.block=Jh.gfm,this.options.breaks?r.inline=Dl.breaks:r.inline=Dl.gfm),this.tokenizer.rules=r}static get rules(){return{block:Jh,inline:Dl}}static lex(t,r){return new $g(r).lex(t)}static lexInline(t,r){return new $g(r).inlineTokens(t)}lex(t){t=t.replace(qr.carriageReturn,`
|
|
67
|
+
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let i=this.inlineQueue[r];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],i=!1){var n,s,a;for(this.options.pedantic&&(t=t.replace(qr.tabCharGlobal," ").replace(qr.spaceLine,""));t;){let l;if((s=(n=this.options.extensions)==null?void 0:n.block)!=null&&s.some(h=>(l=h.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=r.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
|
|
68
|
+
`:r.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
69
|
+
`)?"":`
|
|
70
|
+
`)+l.raw,h.text+=`
|
|
71
|
+
`+l.text,this.inlineQueue.at(-1).src=h.text):r.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
72
|
+
`)?"":`
|
|
73
|
+
`)+l.raw,h.text+=`
|
|
74
|
+
`+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},r.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),r.push(l);continue}let u=t;if((a=this.options.extensions)!=null&&a.startBlock){let h=1/0,d=t.slice(1),p;this.options.extensions.startBlock.forEach(m=>{p=m.call({lexer:this},d),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=r.at(-1);i&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
75
|
+
`)?"":`
|
|
76
|
+
`)+l.raw,h.text+=`
|
|
77
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(l),i=u.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
78
|
+
`)?"":`
|
|
79
|
+
`)+l.raw,h.text+=`
|
|
80
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(l);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){var u,h,d,p,m;let i=t,n=null;if(this.tokens.links){let y=Object.keys(this.tokens.links);if(y.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)y.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)s=n[2]?n[2].length:0,i=i.slice(0,n.index+s)+"["+"a".repeat(n[0].length-s-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((h=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:h.call({lexer:this},i))??i;let a=!1,l="";for(;t;){a||(l=""),a=!1;let y;if((p=(d=this.options.extensions)==null?void 0:d.inline)!=null&&p.some(v=>(y=v.call({lexer:this},t,r))?(t=t.substring(y.raw.length),r.push(y),!0):!1))continue;if(y=this.tokenizer.escape(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.tag(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.link(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(y.raw.length);let v=r.at(-1);y.type==="text"&&(v==null?void 0:v.type)==="text"?(v.raw+=y.raw,v.text+=y.text):r.push(y);continue}if(y=this.tokenizer.emStrong(t,i,l)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.codespan(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.br(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.del(t)){t=t.substring(y.raw.length),r.push(y);continue}if(y=this.tokenizer.autolink(t)){t=t.substring(y.raw.length),r.push(y);continue}if(!this.state.inLink&&(y=this.tokenizer.url(t))){t=t.substring(y.raw.length),r.push(y);continue}let x=t;if((m=this.options.extensions)!=null&&m.startInline){let v=1/0,S=t.slice(1),C;this.options.extensions.startInline.forEach(E=>{C=E.call({lexer:this},S),typeof C=="number"&&C>=0&&(v=Math.min(v,C))}),v<1/0&&v>=0&&(x=t.substring(0,v+1))}if(y=this.tokenizer.inlineText(x)){t=t.substring(y.raw.length),y.raw.slice(-1)!=="_"&&(l=y.raw.slice(-1)),a=!0;let v=r.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=y.raw,v.text+=y.text):r.push(y);continue}if(t){let v="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(v);break}else throw new Error(v)}}return r}},Vu=class{constructor(t){yt(this,"options");yt(this,"parser");this.options=t||Oo}space(t){return""}code({text:t,lang:r,escaped:i}){var a;let n=(a=(r||"").match(qr.notSpaceStart))==null?void 0:a[0],s=t.replace(qr.endingNewline,"")+`
|
|
81
|
+
`;return n?'<pre><code class="language-'+Cn(n)+'">'+(i?s:Cn(s,!0))+`</code></pre>
|
|
82
|
+
`:"<pre><code>"+(i?s:Cn(s,!0))+`</code></pre>
|
|
83
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
84
|
+
${this.parser.parse(t)}</blockquote>
|
|
85
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:r}){return`<h${r}>${this.parser.parseInline(t)}</h${r}>
|
|
86
|
+
`}hr(t){return`<hr>
|
|
87
|
+
`}list(t){let r=t.ordered,i=t.start,n="";for(let l=0;l<t.items.length;l++){let u=t.items[l];n+=this.listitem(u)}let s=r?"ol":"ul",a=r&&i!==1?' start="'+i+'"':"";return"<"+s+a+`>
|
|
88
|
+
`+n+"</"+s+`>
|
|
89
|
+
`}listitem(t){var i;let r="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?((i=t.tokens[0])==null?void 0:i.type)==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+Cn(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):r+=n+" "}return r+=this.parser.parse(t.tokens,!!t.loose),`<li>${r}</li>
|
|
90
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
91
|
+
`}table(t){let r="",i="";for(let s=0;s<t.header.length;s++)i+=this.tablecell(t.header[s]);r+=this.tablerow({text:i});let n="";for(let s=0;s<t.rows.length;s++){let a=t.rows[s];i="";for(let l=0;l<a.length;l++)i+=this.tablecell(a[l]);n+=this.tablerow({text:i})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
92
|
+
<thead>
|
|
93
|
+
`+r+`</thead>
|
|
94
|
+
`+n+`</table>
|
|
95
|
+
`}tablerow({text:t}){return`<tr>
|
|
96
|
+
${t}</tr>
|
|
97
|
+
`}tablecell(t){let r=this.parser.parseInline(t.tokens),i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+r+`</${i}>
|
|
98
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Cn(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:i}){let n=this.parser.parseInline(i),s=pv(t);if(s===null)return n;t=s;let a='<a href="'+t+'"';return r&&(a+=' title="'+Cn(r)+'"'),a+=">"+n+"</a>",a}image({href:t,title:r,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let s=pv(t);if(s===null)return Cn(i);t=s;let a=`<img src="${t}" alt="${i}"`;return r&&(a+=` title="${Cn(r)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Cn(t.text)}},By=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},rn=class jg{constructor(t){yt(this,"options");yt(this,"renderer");yt(this,"textRenderer");this.options=t||Oo,this.options.renderer=this.options.renderer||new Vu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new By}static parse(t,r){return new jg(r).parse(t)}static parseInline(t,r){return new jg(r).parseInline(t)}parse(t,r=!0){var n,s;let i="";for(let a=0;a<t.length;a++){let l=t[a];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[l.type]){let h=l,d=this.options.extensions.renderers[h.type].call({parser:this},h);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){i+=d||"";continue}}let u=l;switch(u.type){case"space":{i+=this.renderer.space(u);continue}case"hr":{i+=this.renderer.hr(u);continue}case"heading":{i+=this.renderer.heading(u);continue}case"code":{i+=this.renderer.code(u);continue}case"table":{i+=this.renderer.table(u);continue}case"blockquote":{i+=this.renderer.blockquote(u);continue}case"list":{i+=this.renderer.list(u);continue}case"html":{i+=this.renderer.html(u);continue}case"def":{i+=this.renderer.def(u);continue}case"paragraph":{i+=this.renderer.paragraph(u);continue}case"text":{let h=u,d=this.renderer.text(h);for(;a+1<t.length&&t[a+1].type==="text";)h=t[++a],d+=`
|
|
99
|
+
`+this.renderer.text(h);r?i+=this.renderer.paragraph({type:"paragraph",raw:d,text:d,tokens:[{type:"text",raw:d,text:d,escaped:!0}]}):i+=d;continue}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(t,r=this.renderer){var n,s;let i="";for(let a=0;a<t.length;a++){let l=t[a];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){i+=h||"";continue}}let u=l;switch(u.type){case"escape":{i+=r.text(u);break}case"html":{i+=r.html(u);break}case"link":{i+=r.link(u);break}case"image":{i+=r.image(u);break}case"strong":{i+=r.strong(u);break}case"em":{i+=r.em(u);break}case"codespan":{i+=r.codespan(u);break}case"br":{i+=r.br(u);break}case"del":{i+=r.del(u);break}case"text":{i+=r.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},xu,Zl=(xu=class{constructor(t){yt(this,"options");yt(this,"block");this.options=t||Oo}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?tn.lex:tn.lexInline}provideParser(){return this.block?rn.parse:rn.parseInline}},yt(xu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),yt(xu,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),xu),kR=class{constructor(...t){yt(this,"defaults",vy());yt(this,"options",this.setOptions);yt(this,"parse",this.parseMarkdown(!0));yt(this,"parseInline",this.parseMarkdown(!1));yt(this,"Parser",rn);yt(this,"Renderer",Vu);yt(this,"TextRenderer",By);yt(this,"Lexer",tn);yt(this,"Tokenizer",Uu);yt(this,"Hooks",Zl);this.use(...t)}walkTokens(t,r){var n,s;let i=[];for(let a of t)switch(i=i.concat(r.call(this,a)),a.type){case"table":{let l=a;for(let u of l.header)i=i.concat(this.walkTokens(u.tokens,r));for(let u of l.rows)for(let h of u)i=i.concat(this.walkTokens(h.tokens,r));break}case"list":{let l=a;i=i.concat(this.walkTokens(l.items,r));break}default:{let l=a;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[l.type]?this.defaults.extensions.childTokens[l.type].forEach(u=>{let h=l[u].flat(1/0);i=i.concat(this.walkTokens(h,r))}):l.tokens&&(i=i.concat(this.walkTokens(l.tokens,r)))}}return i}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let a=r.renderers[s.name];a?r.renderers[s.name]=function(...l){let u=s.renderer.apply(this,l);return u===!1&&(u=a.apply(this,l)),u}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=r[s.level];a?a.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),n.extensions=r),i.renderer){let s=this.defaults.renderer||new Vu(this.defaults);for(let a in i.renderer){if(!(a in s))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let l=a,u=i.renderer[l],h=s[l];s[l]=(...d)=>{let p=u.apply(s,d);return p===!1&&(p=h.apply(s,d)),p||""}}n.renderer=s}if(i.tokenizer){let s=this.defaults.tokenizer||new Uu(this.defaults);for(let a in i.tokenizer){if(!(a in s))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let l=a,u=i.tokenizer[l],h=s[l];s[l]=(...d)=>{let p=u.apply(s,d);return p===!1&&(p=h.apply(s,d)),p}}n.tokenizer=s}if(i.hooks){let s=this.defaults.hooks||new Zl;for(let a in i.hooks){if(!(a in s))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let l=a,u=i.hooks[l],h=s[l];Zl.passThroughHooks.has(a)?s[l]=d=>{if(this.defaults.async&&Zl.passThroughHooksRespectAsync.has(a))return(async()=>{let m=await u.call(s,d);return h.call(s,m)})();let p=u.call(s,d);return h.call(s,p)}:s[l]=(...d)=>{if(this.defaults.async)return(async()=>{let m=await u.apply(s,d);return m===!1&&(m=await h.apply(s,d)),m})();let p=u.apply(s,d);return p===!1&&(p=h.apply(s,d)),p}}n.hooks=s}if(i.walkTokens){let s=this.defaults.walkTokens,a=i.walkTokens;n.walkTokens=function(l){let u=[];return u.push(a.call(this,l)),s&&(u=u.concat(s.call(this,l))),u}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return tn.lex(t,r??this.defaults)}parser(t,r){return rn.parse(t,r??this.defaults)}parseMarkdown(t){return(r,i)=>{let n={...i},s={...this.defaults,...n},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(r):r,u=await(s.hooks?await s.hooks.provideLexer():t?tn.lex:tn.lexInline)(l,s),h=s.hooks?await s.hooks.processAllTokens(u):u;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser():t?rn.parse:rn.parseInline)(h,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(a);try{s.hooks&&(r=s.hooks.preprocess(r));let l=(s.hooks?s.hooks.provideLexer():t?tn.lex:tn.lexInline)(r,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let u=(s.hooks?s.hooks.provideParser():t?rn.parse:rn.parseInline)(l,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(l){return a(l)}}}onError(t,r){return i=>{if(i.message+=`
|
|
100
|
+
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+Cn(i.message+"",!0)+"</pre>";return r?Promise.resolve(n):n}if(r)return Promise.reject(i);throw i}}},Lo=new kR;function st(e,t){return Lo.parse(e,t)}st.options=st.setOptions=function(e){return Lo.setOptions(e),st.defaults=Lo.defaults,sS(st.defaults),st};st.getDefaults=vy;st.defaults=Oo;st.use=function(...e){return Lo.use(...e),st.defaults=Lo.defaults,sS(st.defaults),st};st.walkTokens=function(e,t){return Lo.walkTokens(e,t)};st.parseInline=Lo.parseInline;st.Parser=rn;st.parser=rn.parse;st.Renderer=Vu;st.TextRenderer=By;st.Lexer=tn;st.lexer=tn.lex;st.Tokenizer=Uu;st.Hooks=Zl;st.parse=st;st.options;st.setOptions;st.use;st.walkTokens;st.parseInline;rn.parse;tn.lex;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:mS,setPrototypeOf:yv,isFrozen:TR,getPrototypeOf:ER,getOwnPropertyDescriptor:BR}=Object;let{freeze:Gr,seal:ji,create:vu}=Object,{apply:zg,construct:Og}=typeof Reflect<"u"&&Reflect;Gr||(Gr=function(t){return t});ji||(ji=function(t){return t});zg||(zg=function(t,r){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];return t.apply(r,n)});Og||(Og=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return new t(...i)});const eu=Yr(Array.prototype.forEach),MR=Yr(Array.prototype.lastIndexOf),_v=Yr(Array.prototype.pop),Il=Yr(Array.prototype.push),LR=Yr(Array.prototype.splice),bu=Yr(String.prototype.toLowerCase),Xp=Yr(String.prototype.toString),Qp=Yr(String.prototype.match),$l=Yr(String.prototype.replace),RR=Yr(String.prototype.indexOf),AR=Yr(String.prototype.trim),vi=Yr(Object.prototype.hasOwnProperty),Nr=Yr(RegExp.prototype.test),jl=DR(TypeError);function Yr(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return zg(e,t,i)}}function DR(e){return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Og(e,r)}}function tt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bu;yv&&yv(e,null);let i=t.length;for(;i--;){let n=t[i];if(typeof n=="string"){const s=r(n);s!==n&&(TR(t)||(t[i]=s),n=s)}e[n]=!0}return e}function PR(e){for(let t=0;t<e.length;t++)vi(e,t)||(e[t]=null);return e}function kn(e){const t=vu(null);for(const[r,i]of mS(e))vi(e,r)&&(Array.isArray(i)?t[r]=PR(i):i&&typeof i=="object"&&i.constructor===Object?t[r]=kn(i):t[r]=i);return t}function zl(e,t){for(;e!==null;){const i=BR(e,t);if(i){if(i.get)return Yr(i.get);if(typeof i.value=="function")return Yr(i.value)}e=ER(e)}function r(){return null}return r}const xv=Gr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zp=Gr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Jp=Gr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),IR=Gr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),eg=Gr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$R=Gr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vv=Gr(["#text"]),bv=Gr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),tg=Gr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Sv=Gr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),tu=Gr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jR=ji(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zR=ji(/<%[\w\W]*|[\w\W]*%>/gm),OR=ji(/\$\{[\w\W]*/gm),FR=ji(/^data-[\-\w.\u00B7-\uFFFF]+$/),NR=ji(/^aria-[\-\w]+$/),yS=ji(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WR=ji(/^(?:\w+script|data):/i),HR=ji(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_S=ji(/^html$/i),qR=ji(/^[a-z][.\w]*(-[.\w]+)+$/i);var wv=Object.freeze({__proto__:null,ARIA_ATTR:NR,ATTR_WHITESPACE:HR,CUSTOM_ELEMENT:qR,DATA_ATTR:FR,DOCTYPE_NAME:_S,ERB_EXPR:zR,IS_ALLOWED_URI:yS,IS_SCRIPT_OR_DATA:WR,MUSTACHE_EXPR:jR,TMPLIT_EXPR:OR});const Ol={element:1,text:3,progressingInstruction:7,comment:8,document:9},UR=function(){return typeof window>"u"?null:window},VR=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";r&&r.hasAttribute(n)&&(i=r.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Cv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xS(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UR();const t=Te=>xS(Te);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Ol.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const i=r,n=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:u,NodeFilter:h,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:y}=e,x=u.prototype,v=zl(x,"cloneNode"),S=zl(x,"remove"),C=zl(x,"nextSibling"),E=zl(x,"childNodes"),L=zl(x,"parentNode");if(typeof a=="function"){const Te=r.createElement("template");Te.content&&Te.content.ownerDocument&&(r=Te.content.ownerDocument)}let B,R="";const{implementation:k,createNodeIterator:A,createDocumentFragment:O,getElementsByTagName:V}=r,{importNode:q}=i;let H=Cv();t.isSupported=typeof mS=="function"&&typeof L=="function"&&k&&k.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:F,TMPLIT_EXPR:z,DATA_ATTR:$,ARIA_ATTR:j,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:Q}=wv;let{IS_ALLOWED_URI:ee}=wv,I=null;const Z=tt({},[...xv,...Zp,...Jp,...eg,...vv]);let oe=null;const X=tt({},[...bv,...tg,...Sv,...tu]);let ne=Object.seal(vu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ye=null;const ve=Object.seal(vu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let be=!0,$e=!0,Xe=!1,it=!0,Oe=!1,ht=!0,Ft=!1,le=!1,Je=!1,ut=!1,qt=!1,kr=!1,ar=!0,Fi=!1;const ls="user-content-";let jn=!0,Ni=!1,gt={},Tr=null;const hn=tt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Xs=null;const vt=tt({},["audio","video","img","source","image","track"]);let Wi=null;const Uo=tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),un="http://www.w3.org/1998/Math/MathML",lr="http://www.w3.org/2000/svg",ci="http://www.w3.org/1999/xhtml";let wi=ci,hi=!1,Hi=null;const dn=tt({},[un,lr,ci],Xp);let fn=tt({},["mi","mo","mn","ms","mtext"]),ui=tt({},["annotation-xml"]);const pn=tt({},["title","style","font","a","script"]);let gn=null;const Vo=["application/xhtml+xml","text/html"],Qs="text/html";let wt=null,qi=null;const cs=r.createElement("form"),zn=function(U){return U instanceof RegExp||U instanceof Function},Ci=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(qi&&qi===U)){if((!U||typeof U!="object")&&(U={}),U=kn(U),gn=Vo.indexOf(U.PARSER_MEDIA_TYPE)===-1?Qs:U.PARSER_MEDIA_TYPE,wt=gn==="application/xhtml+xml"?Xp:bu,I=vi(U,"ALLOWED_TAGS")?tt({},U.ALLOWED_TAGS,wt):Z,oe=vi(U,"ALLOWED_ATTR")?tt({},U.ALLOWED_ATTR,wt):X,Hi=vi(U,"ALLOWED_NAMESPACES")?tt({},U.ALLOWED_NAMESPACES,Xp):dn,Wi=vi(U,"ADD_URI_SAFE_ATTR")?tt(kn(Uo),U.ADD_URI_SAFE_ATTR,wt):Uo,Xs=vi(U,"ADD_DATA_URI_TAGS")?tt(kn(vt),U.ADD_DATA_URI_TAGS,wt):vt,Tr=vi(U,"FORBID_CONTENTS")?tt({},U.FORBID_CONTENTS,wt):hn,he=vi(U,"FORBID_TAGS")?tt({},U.FORBID_TAGS,wt):kn({}),ye=vi(U,"FORBID_ATTR")?tt({},U.FORBID_ATTR,wt):kn({}),gt=vi(U,"USE_PROFILES")?U.USE_PROFILES:!1,be=U.ALLOW_ARIA_ATTR!==!1,$e=U.ALLOW_DATA_ATTR!==!1,Xe=U.ALLOW_UNKNOWN_PROTOCOLS||!1,it=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Oe=U.SAFE_FOR_TEMPLATES||!1,ht=U.SAFE_FOR_XML!==!1,Ft=U.WHOLE_DOCUMENT||!1,ut=U.RETURN_DOM||!1,qt=U.RETURN_DOM_FRAGMENT||!1,kr=U.RETURN_TRUSTED_TYPE||!1,Je=U.FORCE_BODY||!1,ar=U.SANITIZE_DOM!==!1,Fi=U.SANITIZE_NAMED_PROPS||!1,jn=U.KEEP_CONTENT!==!1,Ni=U.IN_PLACE||!1,ee=U.ALLOWED_URI_REGEXP||yS,wi=U.NAMESPACE||ci,fn=U.MATHML_TEXT_INTEGRATION_POINTS||fn,ui=U.HTML_INTEGRATION_POINTS||ui,ne=U.CUSTOM_ELEMENT_HANDLING||{},U.CUSTOM_ELEMENT_HANDLING&&zn(U.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=U.CUSTOM_ELEMENT_HANDLING.tagNameCheck),U.CUSTOM_ELEMENT_HANDLING&&zn(U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ne.attributeNameCheck=U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&($e=!1),qt&&(ut=!0),gt&&(I=tt({},vv),oe=vu(null),gt.html===!0&&(tt(I,xv),tt(oe,bv)),gt.svg===!0&&(tt(I,Zp),tt(oe,tg),tt(oe,tu)),gt.svgFilters===!0&&(tt(I,Jp),tt(oe,tg),tt(oe,tu)),gt.mathMl===!0&&(tt(I,eg),tt(oe,Sv),tt(oe,tu))),vi(U,"ADD_TAGS")||(ve.tagCheck=null),vi(U,"ADD_ATTR")||(ve.attributeCheck=null),U.ADD_TAGS&&(typeof U.ADD_TAGS=="function"?ve.tagCheck=U.ADD_TAGS:(I===Z&&(I=kn(I)),tt(I,U.ADD_TAGS,wt))),U.ADD_ATTR&&(typeof U.ADD_ATTR=="function"?ve.attributeCheck=U.ADD_ATTR:(oe===X&&(oe=kn(oe)),tt(oe,U.ADD_ATTR,wt))),U.ADD_URI_SAFE_ATTR&&tt(Wi,U.ADD_URI_SAFE_ATTR,wt),U.FORBID_CONTENTS&&(Tr===hn&&(Tr=kn(Tr)),tt(Tr,U.FORBID_CONTENTS,wt)),U.ADD_FORBID_CONTENTS&&(Tr===hn&&(Tr=kn(Tr)),tt(Tr,U.ADD_FORBID_CONTENTS,wt)),jn&&(I["#text"]=!0),Ft&&tt(I,["html","head","body"]),I.table&&(tt(I,["tbody"]),delete he.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw jl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');B=U.TRUSTED_TYPES_POLICY,R=B.createHTML("")}else B===void 0&&(B=VR(y,n)),B!==null&&typeof R=="string"&&(R=B.createHTML(""));Gr&&Gr(U),qi=U}},On=tt({},[...Zp,...Jp,...IR]),Ui=tt({},[...eg,...$R]),Qa=function(U){let fe=L(U);(!fe||!fe.tagName)&&(fe={namespaceURI:wi,tagName:"template"});const Be=bu(U.tagName),ft=bu(fe.tagName);return Hi[U.namespaceURI]?U.namespaceURI===lr?fe.namespaceURI===ci?Be==="svg":fe.namespaceURI===un?Be==="svg"&&(ft==="annotation-xml"||fn[ft]):!!On[Be]:U.namespaceURI===un?fe.namespaceURI===ci?Be==="math":fe.namespaceURI===lr?Be==="math"&&ui[ft]:!!Ui[Be]:U.namespaceURI===ci?fe.namespaceURI===lr&&!ui[ft]||fe.namespaceURI===un&&!fn[ft]?!1:!Ui[Be]&&(pn[Be]||!On[Be]):!!(gn==="application/xhtml+xml"&&Hi[U.namespaceURI]):!1},cr=function(U){Il(t.removed,{element:U});try{L(U).removeChild(U)}catch{S(U)}},Qr=function(U,fe){try{Il(t.removed,{attribute:fe.getAttributeNode(U),from:fe})}catch{Il(t.removed,{attribute:null,from:fe})}if(fe.removeAttribute(U),U==="is")if(ut||qt)try{cr(fe)}catch{}else try{fe.setAttribute(U,"")}catch{}},mn=function(U){let fe=null,Be=null;if(Je)U="<remove></remove>"+U;else{const Bt=Qp(U,/^[\r\n\t ]+/);Be=Bt&&Bt[0]}gn==="application/xhtml+xml"&&wi===ci&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const ft=B?B.createHTML(U):U;if(wi===ci)try{fe=new m().parseFromString(ft,gn)}catch{}if(!fe||!fe.documentElement){fe=k.createDocument(wi,"template",null);try{fe.documentElement.innerHTML=hi?R:ft}catch{}}const Ke=fe.body||fe.documentElement;return U&&Be&&Ke.insertBefore(r.createTextNode(Be),Ke.childNodes[0]||null),wi===ci?V.call(fe,Ft?"html":"body")[0]:Ft?fe.documentElement:Ke},Fn=function(U){return A.call(U.ownerDocument||U,U,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Xt=function(U){return U instanceof p&&(typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||!(U.attributes instanceof d)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function")},Zs=function(U){return typeof l=="function"&&U instanceof l};function se(Te,U,fe){eu(Te,Be=>{Be.call(t,U,fe,qi)})}const Se=function(U){let fe=null;if(se(H.beforeSanitizeElements,U,null),Xt(U))return cr(U),!0;const Be=wt(U.nodeName);if(se(H.uponSanitizeElement,U,{tagName:Be,allowedTags:I}),ht&&U.hasChildNodes()&&!Zs(U.firstElementChild)&&Nr(/<[/\w!]/g,U.innerHTML)&&Nr(/<[/\w!]/g,U.textContent)||U.nodeType===Ol.progressingInstruction||ht&&U.nodeType===Ol.comment&&Nr(/<[/\w]/g,U.data))return cr(U),!0;if(!(ve.tagCheck instanceof Function&&ve.tagCheck(Be))&&(!I[Be]||he[Be])){if(!he[Be]&&At(Be)&&(ne.tagNameCheck instanceof RegExp&&Nr(ne.tagNameCheck,Be)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(Be)))return!1;if(jn&&!Tr[Be]){const ft=L(U)||U.parentNode,Ke=E(U)||U.childNodes;if(Ke&&ft){const Bt=Ke.length;for(let hr=Bt-1;hr>=0;--hr){const ki=v(Ke[hr],!0);ki.__removalCount=(U.__removalCount||0)+1,ft.insertBefore(ki,C(U))}}}return cr(U),!0}return U instanceof u&&!Qa(U)||(Be==="noscript"||Be==="noembed"||Be==="noframes")&&Nr(/<\/no(script|embed|frames)/i,U.innerHTML)?(cr(U),!0):(Oe&&U.nodeType===Ol.text&&(fe=U.textContent,eu([Y,F,z],ft=>{fe=$l(fe,ft," ")}),U.textContent!==fe&&(Il(t.removed,{element:U.cloneNode()}),U.textContent=fe)),se(H.afterSanitizeElements,U,null),!1)},mt=function(U,fe,Be){if(ye[fe]||ar&&(fe==="id"||fe==="name")&&(Be in r||Be in cs))return!1;if(!($e&&!ye[fe]&&Nr($,fe))){if(!(be&&Nr(j,fe))){if(!(ve.attributeCheck instanceof Function&&ve.attributeCheck(fe,U))){if(!oe[fe]||ye[fe]){if(!(At(U)&&(ne.tagNameCheck instanceof RegExp&&Nr(ne.tagNameCheck,U)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(U))&&(ne.attributeNameCheck instanceof RegExp&&Nr(ne.attributeNameCheck,fe)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(fe,U))||fe==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&Nr(ne.tagNameCheck,Be)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(Be))))return!1}else if(!Wi[fe]){if(!Nr(ee,$l(Be,P,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&U!=="script"&&RR(Be,"data:")===0&&Xs[U])){if(!(Xe&&!Nr(W,$l(Be,P,"")))){if(Be)return!1}}}}}}}return!0},At=function(U){return U!=="annotation-xml"&&Qp(U,Q)},Qt=function(U){se(H.beforeSanitizeAttributes,U,null);const{attributes:fe}=U;if(!fe||Xt(U))return;const Be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let ft=fe.length;for(;ft--;){const Ke=fe[ft],{name:Bt,namespaceURI:hr,value:ki}=Ke,Vi=wt(Bt),Za=ki;let Ut=Bt==="value"?Za:AR(Za);if(Be.attrName=Vi,Be.attrValue=Ut,Be.keepAttr=!0,Be.forceKeepAttr=void 0,se(H.uponSanitizeAttribute,U,Be),Ut=Be.attrValue,Fi&&(Vi==="id"||Vi==="name")&&(Qr(Bt,U),Ut=ls+Ut),ht&&Nr(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ut)){Qr(Bt,U);continue}if(Vi==="attributename"&&Qp(Ut,"href")){Qr(Bt,U);continue}if(Be.forceKeepAttr)continue;if(!Be.keepAttr){Qr(Bt,U);continue}if(!it&&Nr(/\/>/i,Ut)){Qr(Bt,U);continue}Oe&&eu([Y,F,z],di=>{Ut=$l(Ut,di," ")});const Js=wt(U.nodeName);if(!mt(Js,Vi,Ut)){Qr(Bt,U);continue}if(B&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!hr)switch(y.getAttributeType(Js,Vi)){case"TrustedHTML":{Ut=B.createHTML(Ut);break}case"TrustedScriptURL":{Ut=B.createScriptURL(Ut);break}}if(Ut!==Za)try{hr?U.setAttributeNS(hr,Bt,Ut):U.setAttribute(Bt,Ut),Xt(U)?cr(U):_v(t.removed)}catch{Qr(Bt,U)}}se(H.afterSanitizeAttributes,U,null)},zr=function Te(U){let fe=null;const Be=Fn(U);for(se(H.beforeSanitizeShadowDOM,U,null);fe=Be.nextNode();)se(H.uponSanitizeShadowNode,fe,null),Se(fe),Qt(fe),fe.content instanceof s&&Te(fe.content);se(H.afterSanitizeShadowDOM,U,null)};return t.sanitize=function(Te){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Be=null,ft=null,Ke=null;if(hi=!Te,hi&&(Te="<!-->"),typeof Te!="string"&&!Zs(Te))if(typeof Te.toString=="function"){if(Te=Te.toString(),typeof Te!="string")throw jl("dirty is not a string, aborting")}else throw jl("toString is not a function");if(!t.isSupported)return Te;if(le||Ci(U),t.removed=[],typeof Te=="string"&&(Ni=!1),Ni){if(Te.nodeName){const ki=wt(Te.nodeName);if(!I[ki]||he[ki])throw jl("root node is forbidden and cannot be sanitized in-place")}}else if(Te instanceof l)fe=mn("<!---->"),Be=fe.ownerDocument.importNode(Te,!0),Be.nodeType===Ol.element&&Be.nodeName==="BODY"||Be.nodeName==="HTML"?fe=Be:fe.appendChild(Be);else{if(!ut&&!Oe&&!Ft&&Te.indexOf("<")===-1)return B&&kr?B.createHTML(Te):Te;if(fe=mn(Te),!fe)return ut?null:kr?R:""}fe&&Je&&cr(fe.firstChild);const Bt=Fn(Ni?Te:fe);for(;ft=Bt.nextNode();)Se(ft),Qt(ft),ft.content instanceof s&&zr(ft.content);if(Ni)return Te;if(ut){if(qt)for(Ke=O.call(fe.ownerDocument);fe.firstChild;)Ke.appendChild(fe.firstChild);else Ke=fe;return(oe.shadowroot||oe.shadowrootmode)&&(Ke=q.call(i,Ke,!0)),Ke}let hr=Ft?fe.outerHTML:fe.innerHTML;return Ft&&I["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&Nr(_S,fe.ownerDocument.doctype.name)&&(hr="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
|
|
101
|
+
`+hr),Oe&&eu([Y,F,z],ki=>{hr=$l(hr,ki," ")}),B&&kr?B.createHTML(hr):hr},t.setConfig=function(){let Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ci(Te),le=!0},t.clearConfig=function(){qi=null,le=!1},t.isValidAttribute=function(Te,U,fe){qi||Ci({});const Be=wt(Te),ft=wt(U);return mt(Be,ft,fe)},t.addHook=function(Te,U){typeof U=="function"&&Il(H[Te],U)},t.removeHook=function(Te,U){if(U!==void 0){const fe=MR(H[Te],U);return fe===-1?void 0:LR(H[Te],fe,1)[0]}return _v(H[Te])},t.removeHooks=function(Te){H[Te]=[]},t.removeAllHooks=function(){H=Cv()},t}var ln=xS();const rg={learn:{label:"Learn",order:0},progress:{label:"Progress",order:1},visual:{label:"Visual",order:2},author:{label:"Author",order:3}},kv=[{command:"/teach",description:"Continue current lesson",category:"learn",hasArg:!0,argPlaceholder:"<module>"},{command:"/teach --quick",description:"Quick reference for current module",category:"learn"},{command:"/teach --quiz-only",description:"Quiz only",category:"learn"},{command:"/teach --game",description:"Play an interactive game",category:"learn"},{command:"/teach --status",description:"Check lesson progress",category:"learn"},{command:"/learn",description:"Learn any topic (auto-generate module)",category:"learn",hasArg:!0,argPlaceholder:"<topic>"},{command:"/ask",description:"Ask a question about module content",category:"learn",hasArg:!0,argPlaceholder:"<question>"},{command:"/stats",description:"XP, belt, and progress dashboard",category:"progress"},{command:"/level-up",description:"Belt roadmap & next steps",category:"progress"},{command:"/journey",description:"Browse learning journeys",category:"progress"},{command:"/canvas",description:"Open the visual canvas",category:"visual"},{command:"/author",description:"Create a learning module",category:"author"},{command:"/author-pack",description:"Create a module pack",category:"author"}];function GR(e){if(!e||e==="/")return kv;const t=e.toLowerCase();return kv.filter(r=>r.command.toLowerCase().startsWith(t))}function YR(e,t){if(!t)return e;const r=t.toLowerCase();return e.filter(i=>i.slug.toLowerCase().includes(r)||i.title.toLowerCase().includes(r))}function KR(e){const t=e.match(/^\/teach\s+(?!--)(.*)$/i);return t?t[1]:null}const vS=8,XR=M.forwardRef(function({input:t,modules:r,onSelect:i,theme:n},s){const[a,l]=M.useState(0),u=M.useRef(null),h=M.useMemo(()=>KR(t),[t]),d=h!==null,p=M.useMemo(()=>{var E;if(d)return YR(r,h).map(B=>({key:`mod-${B.slug}`,primary:B.slug,secondary:B.title,badge:B.difficulty||B.category,value:`/teach ${B.slug}`,isModule:!0}));const x=GR(t),v=new Map;for(const L of x){const B=L.category||"learn";v.has(B)||v.set(B,[]),v.get(B).push(L)}const S=[],C=[...v.entries()].sort((L,B)=>{var R,k;return(((R=rg[L[0]])==null?void 0:R.order)??99)-(((k=rg[B[0]])==null?void 0:k.order)??99)});for(const[L,B]of C)for(const R of B)S.push({key:R.command,primary:R.command,secondary:R.description,badge:((E=rg[L])==null?void 0:E.label)||L,value:R.hasArg?R.command+" ":R.command,hasArg:R.hasArg});return S},[t,d,h,r]);M.useEffect(()=>{l(0)},[t]),M.useEffect(()=>{if(u.current){const x=u.current.querySelector('[data-active="true"]');x&&x.scrollIntoView({block:"nearest"})}},[a]);const m=M.useCallback(x=>{const v=p[x];v&&i(v.value,v.hasArg)},[p,i]);if(M.useImperativeHandle(s,()=>({handleKeyDown(x){return p.length===0?!1:x.key==="ArrowDown"?(x.preventDefault(),l(v=>(v+1)%p.length),!0):x.key==="ArrowUp"?(x.preventDefault(),l(v=>(v-1+p.length)%p.length),!0):x.key==="Enter"||x.key==="Tab"?(x.preventDefault(),m(a),!0):x.key==="Escape"?(x.preventDefault(),!0):!1}}),[p,a,m]),p.length===0)return null;const y=QR(n);return g.jsxs("div",{style:y.container,ref:u,children:[d&&g.jsx("div",{style:y.header,children:"Modules"}),p.slice(0,vS*2).map((x,v)=>g.jsxs("div",{"data-active":v===a?"true":"false",style:{...y.item,backgroundColor:v===a?n.bgTertiary||"#21262d":"transparent"},onMouseEnter:()=>l(v),onMouseDown:S=>{S.preventDefault(),m(v)},children:[g.jsxs("div",{style:y.itemLeft,children:[g.jsx("span",{style:y.primary,children:x.primary}),g.jsx("span",{style:y.secondary,children:x.secondary})]}),g.jsx("span",{style:y.badge,children:x.badge})]},x.key))]})});function QR(e){return{container:{position:"absolute",bottom:"100%",left:0,right:0,marginBottom:4,maxHeight:vS*40,overflowY:"auto",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,boxShadow:"0 -4px 16px rgba(0,0,0,0.3)",zIndex:100,scrollbarWidth:"thin"},header:{padding:"6px 12px 2px",fontSize:11,fontWeight:600,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.05em"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"7px 12px",cursor:"pointer",transition:"background-color 0.08s ease",gap:8},itemLeft:{display:"flex",alignItems:"center",gap:8,minWidth:0,flex:1},primary:{fontSize:13,fontWeight:600,color:e.textPrimary,fontFamily:"monospace",whiteSpace:"nowrap"},secondary:{fontSize:12,color:e.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},badge:{fontSize:10,fontWeight:600,color:e.accent,backgroundColor:`${e.accent}18`,padding:"2px 7px",borderRadius:8,whiteSpace:"nowrap",flexShrink:0,textTransform:"capitalize"}}}const ZR=/<!--\s*buttons:\s*(\{[\s\S]*?\})\s*-->/g,JR=["single","multi","rating"],e3=/<!--\s*suggestions:\s*(\[[\s\S]*?\])\s*-->/,t3=[{re:/<!--\s*list:\s*(\{[\s\S]*?\})\s*-->/g,type:"list",required:["items"]},{re:/<!--\s*progress:\s*(\{[\s\S]*?\})\s*-->/g,type:"progress",required:["current","total"]},{re:/<!--\s*card:\s*(\{[\s\S]*?\})\s*-->/g,type:"card",required:["content"]},{re:/<!--\s*code:\s*(\{[\s\S]*?\})\s*-->/g,type:"code",required:["code"]},{re:/<!--\s*steps:\s*(\{[\s\S]*?\})\s*-->/g,type:"steps",required:["steps"]}];function r3(e){if(!e)return{cleanText:"",buttons:[]};const t=[];let r=e;for(const i of[...e.matchAll(ZR)]){let n;try{n=JSON.parse(i[1])}catch{continue}if(!n||typeof n!="object"||typeof n.id!="string"||!n.id||!JR.includes(n.type)||!Array.isArray(n.options)||n.options.length===0)continue;const s=n.options.filter(a=>a&&typeof a.label=="string"&&typeof a.value=="string");s.length!==0&&(t.push({id:n.id,type:n.type,prompt:typeof n.prompt=="string"?n.prompt:void 0,options:s}),r=r.replace(i[0],""))}return{cleanText:r.trim(),buttons:t}}function i3(e){if(!e)return{cleanText:"",blocks:[]};const t=[];let r=e;for(const{re:i,type:n,required:s}of t3){i.lastIndex=0;for(const a of[...e.matchAll(i)]){let l;try{l=JSON.parse(a[1])}catch{continue}!l||typeof l!="object"||typeof l.id!="string"||!l.id||s.some(u=>l[u]==null)||(t.push({blockType:n,...l}),r=r.replace(a[0],""))}}return{cleanText:r.trim(),blocks:t}}const n3=/<!--\s*canvas:\w[\w-]*:\s*\{[\s\S]*?\}\s*-->/g;function s3(e){return e&&e.replace(e3,"").replace(n3,"").replace(/\n{3,}/g,`
|
|
102
|
+
|
|
103
|
+
`).trim()}st.setOptions({breaks:!0,gfm:!0});function o3(e){return e.replace(/^[•●∙◦‣⁃]\s+/gm,"- ").replace(/^(\d+)\)\s+/gm,"$1. ")}function bS(e){try{return{__html:ln.sanitize(st.parse(o3(e)))}}catch{return{__html:ln.sanitize(e)}}}const a3=[{label:"▶ Continue lesson",text:"/teach"},{label:"🎮 Quick game",text:"/teach --game"},{label:"📝 Quiz me",text:"/teach --quiz-only"},{label:"📖 Learn something new",text:"/learn"},{label:"🗺 Browse Journeys",text:"/teach:journey"}],l3=[{label:"▶ Continue",text:"Continue"},{label:"📝 Quiz me",text:"/teach --quiz-only"},{label:"💡 Hint",text:"Give me a hint"},{label:"📖 Quick ref",text:"/teach --quick"}];function c3({buttons:e,onSend:t,isGenerating:r,theme:i}){const[n,s]=M.useState({});if(!e||e.length===0)return null;const a=(u,h)=>{n[u]||r||(s(d=>({...d,[u]:h})),t(h))},l=(u,h)=>{if(n[u]||r)return;const d=h.join(", ");s(p=>({...p,[u]:d})),t(d)};return e.map(u=>g.jsx(h3,{btn:u,selectedValue:n[u.id],isGenerating:r,onSingleClick:h=>a(u.id,h),onMultiSubmit:h=>l(u.id,h),theme:i},u.id))}function h3({btn:e,selectedValue:t,isGenerating:r,onSingleClick:i,onMultiSubmit:n,theme:s}){const[a,l]=M.useState([]),u=t!==void 0,h=u||r,d=v=>{h||l(S=>S.includes(v)?S.filter(C=>C!==v):[...S,v])},p={padding:"6px 14px",fontSize:13,fontFamily:"inherit",borderRadius:8,cursor:h?"default":"pointer",transition:"background-color 0.15s ease, border-color 0.15s ease",borderWidth:1,borderStyle:"solid",borderColor:s.border,backgroundColor:s.bgTertiary||"#21262d",color:s.textPrimary,opacity:h?.55:1},m={...p,backgroundColor:s.success||"#238636",borderColor:s.success||"#238636",color:"#fff",opacity:1},y={...p,backgroundColor:`${s.accent}22`,borderColor:s.accent,color:s.accent};if(e.type==="rating"){const v=e.options||[1,2,3,4,5].map(S=>({label:`${S} ⭐`,value:String(S)}));return g.jsxs("div",{style:{marginTop:10},children:[e.prompt&&g.jsx("div",{style:{fontSize:12,color:s.textSecondary,marginBottom:6},children:e.prompt}),g.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:v.map(S=>g.jsx("button",{style:t===S.value?m:p,onClick:()=>i(S.value),disabled:h,children:S.label},S.value))})]})}if(e.type==="multi"){const v=e.options||[];return g.jsxs("div",{style:{marginTop:10},children:[e.prompt&&g.jsx("div",{style:{fontSize:12,color:s.textSecondary,marginBottom:6},children:e.prompt}),g.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",alignItems:"center"},children:[v.map(S=>{const C=a.includes(S.value);return g.jsxs("button",{style:u&&(t!=null&&t.includes(S.value))?m:C?y:p,onClick:()=>d(S.value),disabled:h,children:[C&&!u?"✓ ":"",S.label]},S.value)}),!u&&g.jsx("button",{style:{...p,backgroundColor:a.length>0?s.success||"#238636":s.bgTertiary||"#21262d",color:a.length>0?"#fff":s.textSecondary,borderColor:a.length>0?s.success||"#238636":s.border,opacity:a.length>0&&!r?1:.55,cursor:a.length>0&&!r?"pointer":"default"},onClick:()=>a.length>0&&n(a),disabled:a.length===0||r,children:"Submit"})]})]})}const x=e.options||[];return g.jsxs("div",{style:{marginTop:10},children:[e.prompt&&g.jsx("div",{style:{fontSize:12,color:s.textSecondary,marginBottom:6},children:e.prompt}),g.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:x.map(v=>g.jsx("button",{style:t===v.value?m:p,onClick:()=>i(v.value),disabled:h,children:v.label},v.value))})]})}const Tv={book:"📖",code:"💻",rocket:"🚀",star:"⭐",check:"✅",warning:"⚠️",bulb:"💡",gear:"⚙️",puzzle:"🧩",target:"🎯",fire:"🔥",trophy:"🏆",heart:"❤️",flag:"🚩",pin:"📌",zap:"⚡"};function u3({block:e,onSend:t,theme:r}){const{style:i="cards",items:n=[]}=e;return i==="checklist"?g.jsx("div",{style:{marginTop:10,display:"flex",flexDirection:"column",gap:6},children:n.map((s,a)=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:6,backgroundColor:`${r.bgTertiary||"#21262d"}88`,cursor:s.action?"pointer":"default"},onClick:()=>s.action&&t(s.action),children:[g.jsx("span",{style:{fontSize:14,flexShrink:0,marginTop:1},children:"☐"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:13,color:r.textPrimary,fontWeight:500},children:s.title}),s.description&&g.jsx("div",{style:{fontSize:12,color:r.textSecondary,marginTop:2},children:s.description})]})]},a))}):i==="numbered"?g.jsx("div",{style:{marginTop:10,display:"flex",flexDirection:"column",gap:6},children:n.map((s,a)=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"6px 10px",cursor:s.action?"pointer":"default"},onClick:()=>s.action&&t(s.action),children:[g.jsx("span",{style:{width:22,height:22,borderRadius:"50%",backgroundColor:r.accent,color:"#fff",fontSize:12,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:a+1}),g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:13,color:r.textPrimary,fontWeight:500},children:s.title}),s.description&&g.jsx("div",{style:{fontSize:12,color:r.textSecondary,marginTop:2},children:s.description})]})]},a))}):i==="compact"?g.jsx("div",{style:{marginTop:10,display:"flex",flexDirection:"column",gap:4},children:n.map((s,a)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",borderRadius:4,cursor:s.action?"pointer":"default",fontSize:13,color:r.textPrimary},onClick:()=>s.action&&t(s.action),children:[s.icon&&g.jsx("span",{style:{fontSize:14},children:Tv[s.icon]||s.icon}),g.jsx("span",{style:{fontWeight:500},children:s.title}),s.description&&g.jsxs("span",{style:{color:r.textSecondary,marginLeft:4},children:["—"," ",s.description]})]},a))}):g.jsx("div",{style:{marginTop:10,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:8},children:n.map((s,a)=>g.jsxs("div",{style:{padding:"10px 12px",borderRadius:8,border:`1px solid ${r.border}`,backgroundColor:r.bgPrimary,cursor:s.action?"pointer":"default",transition:"border-color 0.15s ease"},onClick:()=>s.action&&t(s.action),children:[s.icon&&g.jsx("div",{style:{fontSize:20,marginBottom:4},children:Tv[s.icon]||s.icon}),g.jsx("div",{style:{fontSize:13,fontWeight:600,color:r.textPrimary},children:s.title}),s.description&&g.jsx("div",{style:{fontSize:12,color:r.textSecondary,marginTop:3},children:s.description})]},a))})}function d3({block:e,theme:t}){const{label:r,current:i=0,total:n=1,style:s="bar"}=e,a=Math.min(100,Math.round(i/n*100));if(s==="ring"){const h=2*Math.PI*28,d=h-a/100*h;return g.jsxs("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:12},children:[g.jsxs("svg",{width:70,height:70,viewBox:"0 0 70 70",children:[g.jsx("circle",{cx:"35",cy:"35",r:28,fill:"none",stroke:t.border,strokeWidth:5}),g.jsx("circle",{cx:"35",cy:"35",r:28,fill:"none",stroke:t.accent,strokeWidth:5,strokeDasharray:h,strokeDashoffset:d,strokeLinecap:"round",transform:"rotate(-90 35 35)",style:{transition:"stroke-dashoffset 0.4s ease"}}),g.jsxs("text",{x:"35",y:"38",textAnchor:"middle",fontSize:"14",fontWeight:"700",fill:t.textPrimary,children:[a,"%"]})]}),r&&g.jsx("div",{style:{fontSize:13,color:t.textSecondary},children:r})]})}return s==="steps"?g.jsxs("div",{style:{marginTop:10},children:[r&&g.jsx("div",{style:{fontSize:12,color:t.textSecondary,marginBottom:6},children:r}),g.jsx("div",{style:{display:"flex",alignItems:"center",gap:4},children:Array.from({length:n},(l,u)=>g.jsxs(iS.Fragment,{children:[g.jsx("div",{style:{width:24,height:24,borderRadius:"50%",fontSize:11,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:u<i?t.accent:u===i?`${t.accent}44`:t.bgTertiary||"#21262d",color:u<i?"#fff":u===i?t.accent:t.textSecondary,border:u===i?`2px solid ${t.accent}`:"2px solid transparent"},children:u+1}),u<n-1&&g.jsx("div",{style:{flex:1,height:2,minWidth:12,backgroundColor:u<i?t.accent:t.border}})]},u))})]}):g.jsxs("div",{style:{marginTop:10},children:[r&&g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:t.textSecondary,marginBottom:4},children:[g.jsx("span",{children:r}),g.jsxs("span",{children:[i,"/",n]})]}),g.jsx("div",{style:{height:8,borderRadius:4,backgroundColor:t.bgTertiary||"#21262d",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",borderRadius:4,backgroundColor:t.accent,width:`${a}%`,transition:"width 0.4s ease"}})})]})}const Ev={tip:{border:"#58a6ff",bg:"#58a6ff15",icon:"💡"},warning:{border:"#d29922",bg:"#d2992215",icon:"⚠️"},error:{border:"#f85149",bg:"#f8514915",icon:"❌"},success:{border:"#3fb950",bg:"#3fb95015",icon:"✅"},concept:{border:"#bc8cff",bg:"#bc8cff15",icon:"🧠"}};function f3({block:e,theme:t}){const{type:r="tip",title:i,content:n}=e,s=Ev[r]||Ev.tip;return g.jsxs("div",{style:{marginTop:10,padding:"10px 14px",borderRadius:8,borderLeft:`4px solid ${s.border}`,backgroundColor:s.bg},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:i?6:0},children:[g.jsx("span",{style:{fontSize:16},children:s.icon}),i&&g.jsx("span",{style:{fontSize:13,fontWeight:600,color:t.textPrimary},children:i})]}),g.jsx("div",{className:"chat-markdown",style:{fontSize:13,color:t.textPrimary,lineHeight:1.5},dangerouslySetInnerHTML:bS(n)})]})}function p3({block:e,theme:t}){const{language:r="text",filename:i,code:n,highlight:s=[]}=e,[a,l]=M.useState(!1),u=n.split(`
|
|
104
|
+
`),h=()=>{navigator.clipboard.writeText(n).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})};return g.jsxs("div",{style:{marginTop:10,borderRadius:8,border:`1px solid ${t.border}`,overflow:"hidden"},children:[g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 12px",backgroundColor:t.bgTertiary||"#21262d",borderBottom:`1px solid ${t.border}`},children:[g.jsx("span",{style:{fontSize:12,color:t.textSecondary,fontFamily:"monospace"},children:i||r}),g.jsx("button",{onClick:h,style:{background:"none",border:"none",color:t.textSecondary,cursor:"pointer",fontSize:12,padding:"2px 6px",borderRadius:4},children:a?"✓ Copied":"Copy"})]}),g.jsx("pre",{style:{margin:0,padding:"10px 12px",fontSize:13,fontFamily:"monospace",color:t.textPrimary,backgroundColor:t.bgPrimary,overflow:"auto",lineHeight:1.6},children:u.map((d,p)=>g.jsx("div",{style:{padding:"0 4px",backgroundColor:s.includes(p+1)?`${t.accent}22`:"transparent",borderLeft:s.includes(p+1)?`3px solid ${t.accent}`:"3px solid transparent"},children:d||" "},p))})]})}function g3({block:e,theme:t}){const{steps:r=[]}=e,i={done:{color:t.success||"#3fb950",icon:"✓",bg:`${t.success||"#3fb950"}22`},active:{color:t.accent,icon:"▶",bg:`${t.accent}22`},pending:{color:t.textSecondary,icon:"○",bg:"transparent"}};return g.jsx("div",{style:{marginTop:10,display:"flex",flexDirection:"column",gap:0},children:r.map((n,s)=>{const a=i[n.status]||i.pending,l=s===r.length-1;return g.jsxs("div",{style:{display:"flex",gap:10,minHeight:36},children:[g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:24},children:[g.jsx("div",{style:{width:24,height:24,borderRadius:"50%",fontSize:12,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:a.bg,color:a.color,border:n.status==="active"?`2px solid ${a.color}`:"2px solid transparent"},children:a.icon}),!l&&g.jsx("div",{style:{flex:1,width:2,minHeight:12,backgroundColor:n.status==="done"?t.success||"#3fb950":t.border}})]}),g.jsx("div",{style:{fontSize:13,paddingTop:3,color:n.status==="pending"?t.textSecondary:t.textPrimary,fontWeight:n.status==="active"?600:400},children:n.label})]},s)})})}function m3({blocks:e,onSend:t,theme:r}){return!e||e.length===0?null:e.map((i,n)=>{switch(i.blockType){case"list":return g.jsx(u3,{block:i,onSend:t,theme:r},i.id||n);case"progress":return g.jsx(d3,{block:i,theme:r},i.id||n);case"card":return g.jsx(f3,{block:i,theme:r},i.id||n);case"code":return g.jsx(p3,{block:i,theme:r},i.id||n);case"steps":return g.jsx(g3,{block:i,theme:r},i.id||n);default:return null}})}function y3({tool:e,theme:t}){const[r,i]=M.useState(!1);if(!e)return null;const n=typeof e.input=="string"?e.input:JSON.stringify(e.input,null,2);return g.jsxs("div",{style:{maxWidth:"90%",border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden",marginTop:4},children:[g.jsxs("button",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",fontSize:12,color:t.textSecondary,backgroundColor:t.bgPrimary,border:"none",cursor:"pointer",textAlign:"left"},onClick:()=>i(!r),children:[g.jsx("span",{style:{fontSize:10,width:12},children:r?"▼":"▶"}),g.jsx("span",{style:{fontFamily:"monospace",color:t.purple},children:e.toolName}),e.output!==void 0&&g.jsx("span",{style:{color:t.success,marginLeft:"auto"},children:"✓"})]}),r&&g.jsxs("div",{style:{padding:"8px 12px",backgroundColor:t.bgPrimary,borderTop:`1px solid ${t.bgTertiary}`},children:[n&&g.jsx("pre",{style:{margin:0,padding:8,fontSize:12,fontFamily:"monospace",color:t.textPrimary,backgroundColor:t.bgSecondary,borderRadius:4,overflow:"auto",maxHeight:200,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:n}),e.output!==void 0&&g.jsxs(g.Fragment,{children:[g.jsx("div",{style:{fontSize:11,color:t.textSecondary,marginTop:8,marginBottom:4},children:"Output"}),g.jsx("pre",{style:{margin:0,padding:8,fontSize:12,fontFamily:"monospace",color:t.textPrimary,backgroundColor:t.bgSecondary,borderRadius:4,overflow:"auto",maxHeight:200,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)})]})]})]})}function _3({messages:e,isStreaming:t,status:r,onSend:i,onStop:n,onNewChat:s,onResume:a,sessions:l,sessionId:u,compact:h,suggestions:d,onMediaClick:p,sessionTitle:m,onToggleDrawer:y,drawerOpen:x}){const{theme:v}=St(),S=M.useMemo(()=>x3(v),[v]),[C,E]=M.useState(""),[L,B]=M.useState([]),[R,k]=M.useState(!1),A=M.useRef(null),O=M.useRef(null),V=M.useRef(null),q=M.useMemo(()=>e.map(X=>{if(X.role!=="assistant"||X._streaming||X.buttons||X.blocks||!X.text||!/<!--\s*(buttons|list|progress|card|code|steps|suggestions):/.test(X.text))return X;const{cleanText:he,buttons:ye}=r3(X.text),{cleanText:ve,blocks:be}=i3(he),$e=s3(ve),Xe={...X,text:$e};return ye.length>0&&(Xe.buttons=ye),be.length>0&&(Xe.blocks=be),Xe}),[e]);M.useEffect(()=>{fetch("http://localhost:3456/api/modules").then(X=>X.ok?X.json():null).then(X=>{X!=null&&X.modules&&B(X.modules)}).catch(()=>{})},[]);const H=M.useCallback(X=>{if(!p)return;const ne=X.target.closest("img");if(ne){X.preventDefault(),X.stopPropagation(),p({type:"image",url:ne.src,alt:ne.alt});return}const he=X.target.closest("a");he!=null&&he.href&&(X.preventDefault(),X.stopPropagation(),p({type:"link",url:he.href,title:he.textContent}))},[p]),Y=M.useCallback(()=>{var X;(X=A.current)==null||X.scrollIntoView({behavior:"smooth"})},[]);M.useEffect(()=>{Y()},[e,Y]);const F=M.useCallback(()=>{const X=C.trim();!X||t||(i(X),E(""),k(!1))},[C,t,i]),z=M.useCallback(X=>{if(R&&V.current){if(X.key==="Escape"){X.preventDefault(),k(!1);return}if(V.current.handleKeyDown(X))return}X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),F())},[F,R]),$=M.useCallback(X=>{const ne=X.target.value;E(ne),k(ne.startsWith("/")&&ne.length>0)},[]),j=M.useCallback((X,ne)=>{var he;E(X),k(!!ne),(he=O.current)==null||he.focus()},[]),W=M.useCallback(X=>{r==="thinking"||r==="streaming"||i(X)},[r,i]),P=r==="thinking"||r==="streaming",Q=q.length===0,ee=C.trim().length>0,I=d&&d.length>0?d:l3,Z=d&&d.length>0,oe=(u||Z)&&!P&&!ee&&!h;return g.jsxs("div",{style:S.container,children:[g.jsx("style",{children:`
|
|
105
|
+
.chat-markdown ol, .chat-markdown ul {
|
|
106
|
+
padding-left: 1.5em;
|
|
107
|
+
margin: 4px 0;
|
|
108
|
+
}
|
|
109
|
+
.chat-markdown ol { list-style-type: decimal; }
|
|
110
|
+
.chat-markdown ul { list-style-type: disc; }
|
|
111
|
+
.chat-markdown li { margin: 2px 0; }
|
|
112
|
+
.chat-markdown li > ol, .chat-markdown li > ul { margin: 2px 0; }
|
|
113
|
+
.chat-markdown p { margin: 4px 0; }
|
|
114
|
+
.chat-markdown p:first-child { margin-top: 0; }
|
|
115
|
+
.chat-markdown p:last-child { margin-bottom: 0; }
|
|
116
|
+
.chat-markdown blockquote {
|
|
117
|
+
border-left: 3px solid rgba(255,255,255,0.2);
|
|
118
|
+
padding-left: 12px;
|
|
119
|
+
margin: 6px 0;
|
|
120
|
+
opacity: 0.85;
|
|
121
|
+
}
|
|
122
|
+
`}),g.jsxs("div",{style:S.sessionHeader,children:[g.jsx("button",{onClick:y,style:S.drawerToggle,title:x?"Close sessions":"View sessions",children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[g.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"}),g.jsx("line",{x1:"14",y1:"4",x2:"21",y2:"4"}),g.jsx("line",{x1:"14",y1:"9",x2:"21",y2:"9"}),g.jsx("line",{x1:"14",y1:"14",x2:"19",y2:"14"})]})}),m&&g.jsx("span",{style:S.sessionTitle,children:m})]}),g.jsxs("div",{style:S.messageList,children:[Q&&g.jsxs("div",{style:S.welcome,children:[g.jsx("div",{style:S.welcomeTitle,children:"Socrates"}),g.jsx("div",{style:S.welcomeSubtitle,children:"Ask me anything, or try a command:"}),g.jsx("div",{style:S.welcomeCommands,children:["/teach git","/teach react-fundamentals","/stats"].map(X=>g.jsx("button",{style:S.commandChip,onClick:()=>{var ne;E(X),(ne=O.current)==null||ne.focus()},children:X},X))})]}),q.map(X=>{var ne,he;return X.role==="user"?g.jsxs("div",{style:S.userRow,children:[!h&&g.jsx("div",{style:S.roleLabel,children:"You"}),g.jsx("div",{style:S.userBubble,children:X.text})]},X.id):X.role==="assistant"?g.jsxs("div",{style:S.assistantRow,children:[!h&&g.jsx("div",{style:S.roleLabel,children:"Claude"}),g.jsxs("div",{style:S.assistantBubble,children:[g.jsx("div",{className:"chat-markdown",style:S.markdown,dangerouslySetInnerHTML:bS(X.text||""),onClick:H}),X._streaming&&g.jsx("span",{style:S.cursor,children:"|"}),X.blocks&&X.blocks.length>0&&!X._streaming&&g.jsx(m3,{blocks:X.blocks,onSend:i,theme:v}),X.buttons&&X.buttons.length>0&&!X._streaming&&g.jsx(c3,{buttons:X.buttons,onSend:i,isGenerating:P,theme:v})]})]},X.id):X.role==="tool-use"?g.jsx(y3,{tool:X.data,theme:v},X.id):X.role==="tool-result"?g.jsx("div",{style:S.assistantRow,children:g.jsx("div",{style:{maxWidth:"90%",border:`1px solid ${v.border}`,borderRadius:8,overflow:"hidden",marginTop:4},children:g.jsxs("div",{style:{padding:"8px 12px",backgroundColor:v.bgPrimary},children:[g.jsx("div",{style:{fontSize:11,color:v.textSecondary,marginBottom:4},children:"Tool Result"}),g.jsx("pre",{style:{margin:0,padding:8,fontSize:12,fontFamily:"monospace",color:v.textPrimary,backgroundColor:v.bgSecondary,borderRadius:4,overflow:"auto",maxHeight:200,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:typeof((ne=X.data)==null?void 0:ne.output)=="string"?X.data.output:JSON.stringify((he=X.data)==null?void 0:he.output,null,2)})]})})},X.id):X.role==="error"?g.jsx("div",{style:S.assistantRow,children:g.jsx("div",{style:{...S.assistantBubble,borderColor:v.error},children:g.jsx("span",{style:{color:v.error},children:X.text})})},X.id):null}),r==="thinking"&&g.jsxs("div",{style:S.statusRow,children:[g.jsx("span",{style:S.statusDot}),"Thinking..."]}),g.jsx("div",{ref:A})]}),Q&&!h&&g.jsx("div",{style:S.quickActions,children:a3.map(X=>g.jsx("button",{style:S.quickActionChip,onClick:()=>W(X.text),disabled:P,children:X.label},X.text))}),!Q&&oe&&g.jsx("div",{style:S.suggestionStrip,children:I.map(X=>g.jsx("button",{style:S.suggestionChip,onClick:()=>W(X.text),children:X.label},X.text))}),g.jsxs("div",{style:S.inputArea,children:[R&&g.jsx(XR,{ref:V,input:C,modules:L,onSelect:j,theme:v}),g.jsx("textarea",{ref:O,value:C,onChange:$,onKeyDown:z,placeholder:"Type a message or / for commands...",style:S.textarea,rows:1}),t?g.jsx("button",{style:S.stopButton,onClick:n,children:"Stop"}):g.jsx("button",{style:{...S.sendButton,opacity:C.trim()?1:.4},onClick:F,disabled:!C.trim(),children:"Send"})]})]})}function x3(e){return{container:{display:"flex",flexDirection:"column",height:"100%",minWidth:0},sessionHeader:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:`1px solid ${e.border}`,flexShrink:0,minHeight:36},drawerToggle:{background:"none",border:"none",color:e.textSecondary,cursor:"pointer",padding:4,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},sessionTitle:{fontSize:13,fontWeight:500,color:e.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},messageList:{flex:1,overflowY:"auto",padding:"16px 20px",display:"flex",flexDirection:"column",gap:16},welcome:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1,gap:12,paddingTop:80},welcomeTitle:{fontSize:28,fontWeight:700,color:e.accent},welcomeSubtitle:{fontSize:15,color:e.textSecondary},welcomeCommands:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap",justifyContent:"center"},commandChip:{padding:"6px 14px",fontSize:13,color:e.accent,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:16,cursor:"pointer",fontFamily:"inherit"},userRow:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},assistantRow:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},roleLabel:{fontSize:11,fontWeight:600,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.04em"},userBubble:{maxWidth:"80%",padding:"10px 14px",backgroundColor:e.userBubble,color:"#fff",borderRadius:"16px 16px 4px 16px",fontSize:14,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},assistantBubble:{maxWidth:"90%",padding:"10px 14px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:"16px 16px 16px 4px",fontSize:14,lineHeight:1.6},markdown:{color:e.textPrimary,wordBreak:"break-word"},cursor:{color:e.accent,animation:"blink 1s step-end infinite"},statusRow:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:e.textSecondary,padding:"4px 0"},statusDot:{width:8,height:8,borderRadius:"50%",backgroundColor:e.warning,animation:"pulse 1.5s ease-in-out infinite"},quickActions:{display:"flex",gap:6,padding:"8px 20px",flexWrap:"wrap"},quickActionChip:{padding:"6px 12px",fontSize:12,color:e.accent,backgroundColor:`${e.accent}11`,border:`1px solid ${e.accent}33`,borderRadius:16,cursor:"pointer",fontFamily:"inherit",transition:"background-color 0.15s ease"},suggestionStrip:{display:"flex",gap:6,padding:"6px 20px",overflowX:"auto",flexShrink:0,scrollbarWidth:"none"},suggestionChip:{padding:"5px 12px",fontSize:12,color:e.accent,backgroundColor:`${e.accent}0d`,border:`1px solid ${e.accent}26`,borderRadius:16,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap",flexShrink:0,transition:"background-color 0.15s ease, border-color 0.15s ease"},inputArea:{position:"relative",display:"flex",alignItems:"flex-end",gap:8,padding:"12px 20px",borderTop:`1px solid ${e.border}`,backgroundColor:e.bgPrimary},textarea:{flex:1,padding:"10px 14px",fontSize:14,color:e.textPrimary,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,resize:"none",outline:"none",fontFamily:"inherit",lineHeight:1.5,maxHeight:120,overflow:"auto"},sendButton:{padding:"10px 20px",fontSize:14,fontWeight:600,color:"#fff",backgroundColor:e.userBubble,border:"none",borderRadius:12,cursor:"pointer",flexShrink:0},stopButton:{padding:"10px 20px",fontSize:14,fontWeight:600,color:"#fff",backgroundColor:e.errorButton,border:"none",borderRadius:12,cursor:"pointer",flexShrink:0}}}const v3="http://localhost:3456";function b3({data:e,getBelt:t,getNextBelt:r,BELTS:i}){var L;const{theme:n}=St(),s=M.useMemo(()=>k3(n),[n]),a=(e==null?void 0:e.progress)||{xp:0,modules:[],streak:0},l=(e==null?void 0:e.achievements)||{unlocked:[],near:[]},u=a.xp||0,h=a.streak||0,d=M.useMemo(()=>t(u),[u,t]),p=M.useMemo(()=>r(u),[u,r]),m=a.modules||[],y=a.continueModule||null,x=m.filter(B=>B.status==="completed").length,v=a.totalCount||m.length||0,S=M.useMemo(()=>{if(!p)return 100;const B=d.minXP,R=p.minXP;return Math.min(100,Math.max(0,(u-B)/(R-B)*100))},[u,d,p]),C=((L=l.unlocked)==null?void 0:L.slice(-3).reverse())||[],E=(l.near||[]).slice(0,4);return g.jsxs("div",{style:s.container,children:[g.jsxs("div",{style:s.heroSection,children:[g.jsxs("div",{style:{...s.beltCard,background:`linear-gradient(135deg, ${d.color}15, ${d.color}08)`,border:`1px solid ${d.color}33`},children:[g.jsx("div",{style:{...s.beltIcon,borderColor:d.color,boxShadow:`0 0 20px ${d.color}25`},children:g.jsx("span",{style:s.beltEmoji,children:d.badge})}),g.jsxs("div",{style:s.beltInfo,children:[g.jsxs("h2",{style:s.beltName,children:[d.name," Belt"]}),g.jsxs("p",{style:s.xpText,children:[u.toLocaleString()," XP"]})]}),g.jsx("span",{style:{...s.beltWatermark,color:d.color},children:d.badge})]}),g.jsxs("div",{style:s.progressCard,children:[g.jsxs("div",{style:s.progressHeader,children:[g.jsx("span",{style:s.progressLabel,children:p?`Next: ${p.badge} ${p.name} Belt`:"Max Level!"}),g.jsx("span",{style:s.progressValue,children:p?`${(p.minXP-u).toLocaleString()} XP to go`:""})]}),g.jsx("div",{style:s.progressBar,children:g.jsx("div",{style:{...s.progressFill,width:`${S}%`,background:`linear-gradient(90deg, ${d.color}, ${(p==null?void 0:p.color)||d.color})`}})}),g.jsxs("div",{style:s.statsRow,children:[g.jsxs("div",{style:s.statItem,children:[g.jsx("span",{style:{color:n.success,fontWeight:700},children:x}),g.jsx("span",{style:{color:n.textSecondary,fontSize:11},children:"Completed"})]}),g.jsxs("div",{style:s.statItem,children:[g.jsx("span",{style:{color:n.accent,fontWeight:700},children:v}),g.jsx("span",{style:{color:n.textSecondary,fontSize:11},children:"Total"})]})]})]}),g.jsxs("div",{style:s.streakCard,children:[g.jsx("span",{style:s.streakIcon,children:h>0?"🔥":"❄️"}),g.jsxs("div",{children:[g.jsxs("p",{style:s.streakCount,children:[h," day streak"]}),g.jsx("p",{style:s.streakSubtext,children:h>0?"Keep it going!":"Start learning today!"})]})]})]}),y&&g.jsx("div",{style:s.section,children:g.jsxs("div",{style:s.continueCard,children:[g.jsx("span",{style:s.continueIcon,children:y.icon||"📖"}),g.jsxs("div",{style:s.continueInfo,children:[g.jsx("h4",{style:s.continueTitle,children:y.title||y.slug}),g.jsxs("p",{style:s.continueStep,children:["Step ",y.step," of ",y.totalSteps]}),g.jsx("div",{style:s.continueProgressBar,children:g.jsx("div",{style:{...s.continueProgressFill,width:`${y.step/y.totalSteps*100}%`}})})]}),g.jsx("div",{style:s.continueCta,children:"Continue →"})]})}),g.jsx(S3,{theme:n}),g.jsxs("div",{style:s.section,children:[g.jsx("div",{style:s.sectionHeader,children:g.jsx("h3",{style:s.sectionTitle,children:"Achievements"})}),C.length>0?g.jsxs("div",{style:s.achievementGrid,children:[C.map(B=>g.jsx(Bv,{achievement:B,state:"unlocked",theme:n},B.id)),E.map(B=>g.jsx(Bv,{achievement:B,state:"near",theme:n},B.id))]}):g.jsxs("div",{style:s.achievementEmpty,children:[g.jsx("span",{style:{fontSize:32,opacity:.4},children:"🏆"}),g.jsx("p",{style:{color:n.textSecondary,fontSize:13,margin:0},children:"Complete activities to earn achievements"})]})]}),g.jsxs("div",{style:s.section,children:[g.jsx("h3",{style:s.sectionTitle,children:"Belt Roadmap"}),g.jsx("div",{style:s.roadmap,children:i.map((B,R)=>{const k=u>=B.minXP,A=d.name===B.name;return g.jsxs("div",{style:{...s.roadmapItem,opacity:k?1:.35},children:[g.jsx("div",{style:{...s.roadmapDot,backgroundColor:k?`${B.color}22`:n.bgTertiary,border:A?`2px solid ${B.color}`:`2px solid ${k?B.color+"66":n.border}`,boxShadow:A?`0 0 12px ${B.color}40`:"none"},children:g.jsx("span",{style:{fontSize:14},children:B.badge})}),g.jsx("span",{style:{...s.roadmapLabel,color:A?n.textPrimary:n.textSecondary,fontWeight:A?600:400},children:B.name}),g.jsxs("span",{style:s.roadmapXP,children:[B.minXP," XP"]}),R<i.length-1&&g.jsx("div",{style:{...s.roadmapLine,backgroundColor:u>=i[R+1].minXP?B.color:n.border}})]},B.name)})})]}),g.jsxs("div",{style:s.section,children:[g.jsx("h3",{style:s.sectionTitle,children:"Modules"}),m.length===0?g.jsxs("div",{style:s.emptyState,children:[g.jsx("p",{style:s.emptyTitle,children:"No modules yet"}),g.jsxs("p",{style:s.emptySubtext,children:["Start a lesson with ",g.jsx("code",{style:s.code,children:"/teach"})," to begin learning"]})]}):g.jsx("div",{style:s.moduleGrid,children:m.map(B=>g.jsx(w3,{module:B,theme:n},B.slug))})]})]})}function S3({theme:e}){var a;const[t,r]=M.useState(null);if(M.useEffect(()=>{fetch(`${v3}/api/journeys`).then(l=>l.ok?l.json():null).then(l=>{if(!(l!=null&&l.activeJourney)||!(l!=null&&l.journeys))return;const u=l.journeys.find(h=>h.slug===l.activeJourney);u&&r(u)}).catch(()=>{})},[]),!t)return null;const{stats:i}=t,n=t.stages[i.currentStageIndex],s=(a=n==null?void 0:n.modules)==null?void 0:a.find(l=>l.status==="available"||l.status==="in_progress");return g.jsxs("div",{style:{padding:16,backgroundColor:`${e.accent}10`,border:`1px solid ${e.accent}33`,borderRadius:12,marginBottom:16},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[g.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:g.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.accent,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Active Journey"})}),g.jsxs("span",{style:{fontSize:11,color:e.textSecondary},children:["Stage ",i.currentStageIndex+1,"/",i.totalStages]})]}),g.jsx("h4",{style:{fontSize:15,fontWeight:600,color:e.textPrimary,margin:"0 0 4px 0"},children:t.title}),n&&g.jsx("p",{style:{fontSize:12,color:e.textSecondary,margin:"0 0 8px 0"},children:n.name}),g.jsx("div",{style:{height:4,borderRadius:2,backgroundColor:`${e.accent}22`,overflow:"hidden",marginBottom:6},children:g.jsx("div",{style:{height:"100%",borderRadius:2,backgroundColor:e.success||"#3fb950",width:`${i.progressPercent}%`}})}),g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[g.jsxs("span",{style:{fontSize:10,color:e.textSecondary},children:[i.completedModules,"/",i.availableModules," modules (",i.progressPercent,"%)"]}),s&&g.jsxs("span",{style:{fontSize:11,color:e.accent},children:["Next: ",s.title]})]})]})}function Bv({achievement:e,state:t,theme:r}){const i=t==="unlocked",n=t==="near",s=C3(e.category,r),a=i?{background:`linear-gradient(135deg, ${s}22, ${s}11)`,border:`1px solid ${s}44`}:{background:r.bgSecondary,border:`1px solid ${r.border}`};return g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,padding:"14px 10px",borderRadius:12,textAlign:"center",position:"relative",...a},children:[g.jsx("span",{style:{fontSize:28,filter:i?"none":"grayscale(100%)",opacity:i?1:.4},children:e.icon}),g.jsx("span",{style:{fontSize:11,fontWeight:600,color:i?r.textPrimary:r.textSecondary},children:e.name}),i&&e.isNew&&g.jsx("span",{style:{position:"absolute",top:6,right:6,fontSize:9,fontWeight:700,color:r.warning,backgroundColor:`${r.warning}22`,padding:"1px 5px",borderRadius:4},children:"NEW"}),n&&e.current!==void 0&&g.jsxs("div",{style:{width:"80%"},children:[g.jsx("div",{style:{height:3,backgroundColor:r.bgTertiary,borderRadius:2,overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",width:`${Math.min(100,e.current/e.target*100)}%`,backgroundColor:s,borderRadius:2}})}),g.jsxs("span",{style:{fontSize:9,color:r.textMuted},children:[e.current,"/",e.target]})]}),e.rare&&g.jsx("span",{style:{position:"absolute",top:6,left:6,fontSize:8,fontWeight:700,color:r.purple,backgroundColor:`${r.purple}22`,padding:"1px 4px",borderRadius:3},children:"RARE"})]})}function w3({module:e,theme:t}){const{slug:r,title:i,status:n,xp_earned:s,quiz_score:a,walkthrough_step:l}=e,u=n==="completed",h=n==="in-progress",d=n==="locked",p=u?t.success:h?t.accent:t.border;return g.jsxs("div",{style:{padding:"16px 20px",backgroundColor:t.bgSecondary,border:`2px solid ${p}`,borderRadius:10,display:"flex",flexDirection:"column",gap:10,opacity:d?.5:1},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g.jsx("span",{style:{fontSize:16},children:u?"✅":h?"🟦":"🔒"}),g.jsx("h4",{style:{fontSize:14,fontWeight:600,color:t.textPrimary,margin:0},children:i||r})]}),g.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[s>0&&g.jsxs("span",{style:{fontSize:12,color:t.accent,backgroundColor:`${t.accent}18`,padding:"2px 8px",borderRadius:4},children:[s," XP"]}),a&&g.jsxs("span",{style:{fontSize:12,color:t.success,backgroundColor:`${t.success}18`,padding:"2px 8px",borderRadius:4},children:["Quiz: ",a]}),h&&l&&g.jsxs("span",{style:{fontSize:12,color:t.warning,backgroundColor:`${t.warning}18`,padding:"2px 8px",borderRadius:4},children:["Step ",l]})]}),d&&g.jsx("p",{style:{fontSize:12,color:t.textMuted,fontStyle:"italic",margin:0},children:"Complete prerequisites to unlock"})]})}function C3(e,t){switch(e){case"learning":return t.success;case"quizzes-games":return t.accent;case"streaks":return t.orange;case"belts":return t.purple;default:return t.accent}}function k3(e){return{container:{maxWidth:900,margin:"0 auto",display:"flex",flexDirection:"column",gap:28},heroSection:{display:"flex",gap:16,flexWrap:"wrap"},beltCard:{display:"flex",alignItems:"center",gap:16,padding:"20px 24px",borderRadius:12,flex:"1 1 200px",position:"relative",overflow:"hidden"},beltIcon:{width:56,height:56,borderRadius:"50%",border:"3px solid",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.bgTertiary,flexShrink:0},beltEmoji:{fontSize:28},beltInfo:{display:"flex",flexDirection:"column",gap:4,zIndex:1},beltWatermark:{position:"absolute",right:12,bottom:-8,fontSize:64,opacity:.08,pointerEvents:"none"},beltName:{fontSize:20,fontWeight:700,color:e.textPrimary,margin:0},xpText:{fontSize:14,color:e.textSecondary,margin:0},progressCard:{flex:"2 1 300px",padding:"20px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,display:"flex",flexDirection:"column",justifyContent:"center",gap:10},progressHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},progressLabel:{fontSize:14,color:e.textPrimary,fontWeight:500},progressValue:{fontSize:13,color:e.textSecondary},progressBar:{height:10,backgroundColor:e.bgTertiary,borderRadius:5,overflow:"hidden"},progressFill:{height:"100%",borderRadius:5,transition:"width 0.6s cubic-bezier(0.22, 1, 0.36, 1)"},statsRow:{display:"flex",gap:20,marginTop:2},statItem:{display:"flex",gap:4,alignItems:"center",fontSize:13},streakCard:{display:"flex",alignItems:"center",gap:12,padding:"20px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,flex:"0 1 180px"},streakIcon:{fontSize:28},streakCount:{fontSize:16,fontWeight:700,color:e.textPrimary,margin:0},streakSubtext:{fontSize:12,color:e.textSecondary,margin:0},section:{display:"flex",flexDirection:"column",gap:12},sectionHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},sectionTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:0},continueCard:{display:"flex",alignItems:"center",gap:16,padding:"16px 20px",backgroundColor:e.bgSecondary,border:`1px solid ${e.accent}44`,borderRadius:12},continueIcon:{fontSize:32,flexShrink:0},continueInfo:{flex:1,display:"flex",flexDirection:"column",gap:4},continueTitle:{fontSize:15,fontWeight:600,color:e.textPrimary,margin:0},continueStep:{fontSize:12,color:e.textSecondary,margin:0},continueProgressBar:{height:4,backgroundColor:e.bgTertiary,borderRadius:2,overflow:"hidden",marginTop:4},continueProgressFill:{height:"100%",backgroundColor:e.accent,borderRadius:2,transition:"width 0.3s ease"},continueCta:{fontSize:14,fontWeight:600,color:e.accent,flexShrink:0},achievementGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(110px, 1fr))",gap:10},achievementEmpty:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"32px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12},roadmap:{display:"flex",gap:0,padding:"16px 0",overflowX:"auto"},roadmapItem:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,position:"relative",flex:"1 1 0",minWidth:70},roadmapDot:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1},roadmapLabel:{fontSize:12},roadmapXP:{fontSize:10,color:e.textMuted},roadmapLine:{position:"absolute",top:18,left:"55%",right:"-45%",height:2,zIndex:0},moduleGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:12},emptyState:{textAlign:"center",padding:"48px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12},emptyTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:"0 0 8px"},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0},code:{backgroundColor:e.bgTertiary,padding:"2px 6px",borderRadius:4,fontSize:13,fontFamily:"monospace",color:e.accent}}}const T3="modulepreload",E3=function(e){return"/"+e},Mv={},ct=function(t,r,i){let n=Promise.resolve();if(r&&r.length>0){let a=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=a(r.map(h=>{if(h=E3(h),h in Mv)return;Mv[h]=!0;const d=h.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":T3,d||(m.as="script"),m.crossOrigin="",m.href=h,u&&m.setAttribute("nonce",u),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return n.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var Lv={name:"mermaid",version:"11.12.3",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.23",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},Su={exports:{}},B3=Su.exports,Rv;function M3(){return Rv||(Rv=1,(function(e,t){(function(r,i){e.exports=i()})(B3,(function(){var r=1e3,i=6e4,n=36e5,s="millisecond",a="second",l="minute",u="hour",h="day",d="week",p="month",m="quarter",y="year",x="date",v="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var $=["th","st","nd","rd"],j=z%100;return"["+z+($[(j-20)%10]||$[j]||$[0])+"]"}},L=function(z,$,j){var W=String(z);return!W||W.length>=$?z:""+Array($+1-W.length).join(j)+z},B={s:L,z:function(z){var $=-z.utcOffset(),j=Math.abs($),W=Math.floor(j/60),P=j%60;return($<=0?"+":"-")+L(W,2,"0")+":"+L(P,2,"0")},m:function z($,j){if($.date()<j.date())return-z(j,$);var W=12*(j.year()-$.year())+(j.month()-$.month()),P=$.clone().add(W,p),Q=j-P<0,ee=$.clone().add(W+(Q?-1:1),p);return+(-(W+(j-P)/(Q?P-ee:ee-P))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:p,y,w:d,d:h,D:x,h:u,m:l,s:a,ms:s,Q:m}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},R="en",k={};k[R]=E;var A="$isDayjsObject",O=function(z){return z instanceof Y||!(!z||!z[A])},V=function z($,j,W){var P;if(!$)return R;if(typeof $=="string"){var Q=$.toLowerCase();k[Q]&&(P=Q),j&&(k[Q]=j,P=Q);var ee=$.split("-");if(!P&&ee.length>1)return z(ee[0])}else{var I=$.name;k[I]=$,P=I}return!W&&P&&(R=P),P||!W&&R},q=function(z,$){if(O(z))return z.clone();var j=typeof $=="object"?$:{};return j.date=z,j.args=arguments,new Y(j)},H=B;H.l=V,H.i=O,H.w=function(z,$){return q(z,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var Y=(function(){function z(j){this.$L=V(j.locale,null,!0),this.parse(j),this.$x=this.$x||j.x||{},this[A]=!0}var $=z.prototype;return $.parse=function(j){this.$d=(function(W){var P=W.date,Q=W.utc;if(P===null)return new Date(NaN);if(H.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var ee=P.match(S);if(ee){var I=ee[2]-1||0,Z=(ee[7]||"0").substring(0,3);return Q?new Date(Date.UTC(ee[1],I,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Z)):new Date(ee[1],I,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Z)}}return new Date(P)})(j),this.init()},$.init=function(){var j=this.$d;this.$y=j.getFullYear(),this.$M=j.getMonth(),this.$D=j.getDate(),this.$W=j.getDay(),this.$H=j.getHours(),this.$m=j.getMinutes(),this.$s=j.getSeconds(),this.$ms=j.getMilliseconds()},$.$utils=function(){return H},$.isValid=function(){return this.$d.toString()!==v},$.isSame=function(j,W){var P=q(j);return this.startOf(W)<=P&&P<=this.endOf(W)},$.isAfter=function(j,W){return q(j)<this.startOf(W)},$.isBefore=function(j,W){return this.endOf(W)<q(j)},$.$g=function(j,W,P){return H.u(j)?this[W]:this.set(P,j)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(j,W){var P=this,Q=!!H.u(W)||W,ee=H.p(j),I=function(be,$e){var Xe=H.w(P.$u?Date.UTC(P.$y,$e,be):new Date(P.$y,$e,be),P);return Q?Xe:Xe.endOf(h)},Z=function(be,$e){return H.w(P.toDate()[be].apply(P.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice($e)),P)},oe=this.$W,X=this.$M,ne=this.$D,he="set"+(this.$u?"UTC":"");switch(ee){case y:return Q?I(1,0):I(31,11);case p:return Q?I(1,X):I(0,X+1);case d:var ye=this.$locale().weekStart||0,ve=(oe<ye?oe+7:oe)-ye;return I(Q?ne-ve:ne+(6-ve),X);case h:case x:return Z(he+"Hours",0);case u:return Z(he+"Minutes",1);case l:return Z(he+"Seconds",2);case a:return Z(he+"Milliseconds",3);default:return this.clone()}},$.endOf=function(j){return this.startOf(j,!1)},$.$set=function(j,W){var P,Q=H.p(j),ee="set"+(this.$u?"UTC":""),I=(P={},P[h]=ee+"Date",P[x]=ee+"Date",P[p]=ee+"Month",P[y]=ee+"FullYear",P[u]=ee+"Hours",P[l]=ee+"Minutes",P[a]=ee+"Seconds",P[s]=ee+"Milliseconds",P)[Q],Z=Q===h?this.$D+(W-this.$W):W;if(Q===p||Q===y){var oe=this.clone().set(x,1);oe.$d[I](Z),oe.init(),this.$d=oe.set(x,Math.min(this.$D,oe.daysInMonth())).$d}else I&&this.$d[I](Z);return this.init(),this},$.set=function(j,W){return this.clone().$set(j,W)},$.get=function(j){return this[H.p(j)]()},$.add=function(j,W){var P,Q=this;j=Number(j);var ee=H.p(W),I=function(X){var ne=q(Q);return H.w(ne.date(ne.date()+Math.round(X*j)),Q)};if(ee===p)return this.set(p,this.$M+j);if(ee===y)return this.set(y,this.$y+j);if(ee===h)return I(1);if(ee===d)return I(7);var Z=(P={},P[l]=i,P[u]=n,P[a]=r,P)[ee]||1,oe=this.$d.getTime()+j*Z;return H.w(oe,this)},$.subtract=function(j,W){return this.add(-1*j,W)},$.format=function(j){var W=this,P=this.$locale();if(!this.isValid())return P.invalidDate||v;var Q=j||"YYYY-MM-DDTHH:mm:ssZ",ee=H.z(this),I=this.$H,Z=this.$m,oe=this.$M,X=P.weekdays,ne=P.months,he=P.meridiem,ye=function($e,Xe,it,Oe){return $e&&($e[Xe]||$e(W,Q))||it[Xe].slice(0,Oe)},ve=function($e){return H.s(I%12||12,$e,"0")},be=he||function($e,Xe,it){var Oe=$e<12?"AM":"PM";return it?Oe.toLowerCase():Oe};return Q.replace(C,(function($e,Xe){return Xe||(function(it){switch(it){case"YY":return String(W.$y).slice(-2);case"YYYY":return H.s(W.$y,4,"0");case"M":return oe+1;case"MM":return H.s(oe+1,2,"0");case"MMM":return ye(P.monthsShort,oe,ne,3);case"MMMM":return ye(ne,oe);case"D":return W.$D;case"DD":return H.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return ye(P.weekdaysMin,W.$W,X,2);case"ddd":return ye(P.weekdaysShort,W.$W,X,3);case"dddd":return X[W.$W];case"H":return String(I);case"HH":return H.s(I,2,"0");case"h":return ve(1);case"hh":return ve(2);case"a":return be(I,Z,!0);case"A":return be(I,Z,!1);case"m":return String(Z);case"mm":return H.s(Z,2,"0");case"s":return String(W.$s);case"ss":return H.s(W.$s,2,"0");case"SSS":return H.s(W.$ms,3,"0");case"Z":return ee}return null})($e)||ee.replace(":","")}))},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(j,W,P){var Q,ee=this,I=H.p(W),Z=q(j),oe=(Z.utcOffset()-this.utcOffset())*i,X=this-Z,ne=function(){return H.m(ee,Z)};switch(I){case y:Q=ne()/12;break;case p:Q=ne();break;case m:Q=ne()/3;break;case d:Q=(X-oe)/6048e5;break;case h:Q=(X-oe)/864e5;break;case u:Q=X/n;break;case l:Q=X/i;break;case a:Q=X/r;break;default:Q=X}return P?Q:H.a(Q)},$.daysInMonth=function(){return this.endOf(p).$D},$.$locale=function(){return k[this.$L]},$.locale=function(j,W){if(!j)return this.$L;var P=this.clone(),Q=V(j,W,!0);return Q&&(P.$L=Q),P},$.clone=function(){return H.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},z})(),F=Y.prototype;return q.prototype=F,[["$ms",s],["$s",a],["$m",l],["$H",u],["$W",h],["$M",p],["$y",y],["$D",x]].forEach((function(z){F[z[1]]=function($){return this.$g($,z[0],z[1])}})),q.extend=function(z,$){return z.$i||(z($,Y,q),z.$i=!0),q},q.locale=V,q.isDayjs=O,q.unix=function(z){return q(1e3*z)},q.en=k[R],q.Ls=k,q.p={},q}))})(Su)),Su.exports}var L3=M3();const R3=yy(L3);var SS=Object.defineProperty,T=(e,t)=>SS(e,"name",{value:t,configurable:!0}),A3=(e,t)=>{for(var r in t)SS(e,r,{get:t[r],enumerable:!0})},Kn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},ue={trace:T((...e)=>{},"trace"),debug:T((...e)=>{},"debug"),info:T((...e)=>{},"info"),warn:T((...e)=>{},"warn"),error:T((...e)=>{},"error"),fatal:T((...e)=>{},"fatal")},My=T(function(e="fatal"){let t=Kn.fatal;typeof e=="string"?e.toLowerCase()in Kn&&(t=Kn[e]):typeof e=="number"&&(t=e),ue.trace=()=>{},ue.debug=()=>{},ue.info=()=>{},ue.warn=()=>{},ue.error=()=>{},ue.fatal=()=>{},t<=Kn.fatal&&(ue.fatal=console.error?console.error.bind(console,Ai("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Ai("FATAL"))),t<=Kn.error&&(ue.error=console.error?console.error.bind(console,Ai("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Ai("ERROR"))),t<=Kn.warn&&(ue.warn=console.warn?console.warn.bind(console,Ai("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Ai("WARN"))),t<=Kn.info&&(ue.info=console.info?console.info.bind(console,Ai("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Ai("INFO"))),t<=Kn.debug&&(ue.debug=console.debug?console.debug.bind(console,Ai("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Ai("DEBUG"))),t<=Kn.trace&&(ue.trace=console.debug?console.debug.bind(console,Ai("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Ai("TRACE")))},"setLogLevel"),Ai=T(e=>`%c${R3().format("ss.SSS")} : ${e} : `,"format");const wu={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;switch(i){case"r":return wu.hue2rgb(s,n,e+1/3)*255;case"g":return wu.hue2rgb(s,n,e)*255;case"b":return wu.hue2rgb(s,n,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const n=Math.max(e,t,r),s=Math.min(e,t,r),a=(n+s)/2;if(i==="l")return a*100;if(n===s)return 0;const l=n-s,u=a>.5?l/(2-n-s):l/(n+s);if(i==="s")return u*100;switch(n){case e:return((t-r)/l+(t<r?6:0))*60;case t:return((r-e)/l+2)*60;case r:return((e-t)/l+4)*60;default:return-1}}},D3={clamp:(e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},P3={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Ye={channel:wu,lang:D3,unit:P3},Ds={};for(let e=0;e<=255;e++)Ds[e]=Ye.unit.dec2hex(e);const Ar={ALL:0,RGB:1,HSL:2};class I3{constructor(){this.type=Ar.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Ar.ALL}is(t){return this.type===t}}class $3{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new I3}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Ar.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:n}=t;r===void 0&&(t.h=Ye.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=Ye.channel.rgb2hsl(t,"s")),n===void 0&&(t.l=Ye.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:n}=t;r===void 0&&(t.r=Ye.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=Ye.channel.hsl2rgb(t,"g")),n===void 0&&(t.b=Ye.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Ar.HSL)&&r!==void 0?r:(this._ensureHSL(),Ye.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Ar.HSL)&&r!==void 0?r:(this._ensureHSL(),Ye.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Ar.HSL)&&r!==void 0?r:(this._ensureHSL(),Ye.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Ar.RGB)&&r!==void 0?r:(this._ensureRGB(),Ye.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Ar.RGB)&&r!==void 0?r:(this._ensureRGB(),Ye.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Ar.RGB)&&r!==void 0?r:(this._ensureRGB(),Ye.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Ar.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Ar.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Ar.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Ar.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Ar.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Ar.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Id=new $3({r:0,g:0,b:0,a:0},"transparent"),wa={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(wa.re);if(!t)return;const r=t[1],i=parseInt(r,16),n=r.length,s=n%4===0,a=n>4,l=a?1:17,u=a?8:4,h=s?0:-1,d=a?255:15;return Id.set({r:(i>>u*(h+3)&d)*l,g:(i>>u*(h+2)&d)*l,b:(i>>u*(h+1)&d)*l,a:s?(i&d)*l/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:n}=e;return n<1?`#${Ds[Math.round(t)]}${Ds[Math.round(r)]}${Ds[Math.round(i)]}${Ds[Math.round(n*255)]}`:`#${Ds[Math.round(t)]}${Ds[Math.round(r)]}${Ds[Math.round(i)]}`}},bo={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(bo.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return Ye.channel.clamp.h(parseFloat(r)*.9);case"rad":return Ye.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Ye.channel.clamp.h(parseFloat(r)*360)}}return Ye.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(bo.re);if(!r)return;const[,i,n,s,a,l]=r;return Id.set({h:bo._hue2deg(i),s:Ye.channel.clamp.s(parseFloat(n)),l:Ye.channel.clamp.l(parseFloat(s)),a:a?Ye.channel.clamp.a(l?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:n}=e;return n<1?`hsla(${Ye.lang.round(t)}, ${Ye.lang.round(r)}%, ${Ye.lang.round(i)}%, ${n})`:`hsl(${Ye.lang.round(t)}, ${Ye.lang.round(r)}%, ${Ye.lang.round(i)}%)`}},fc={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=fc.colors[e];if(t)return wa.parse(t)},stringify:e=>{const t=wa.stringify(e);for(const r in fc.colors)if(fc.colors[r]===t)return r}},Jl={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Jl.re);if(!r)return;const[,i,n,s,a,l,u,h,d]=r;return Id.set({r:Ye.channel.clamp.r(n?parseFloat(i)*2.55:parseFloat(i)),g:Ye.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:Ye.channel.clamp.b(u?parseFloat(l)*2.55:parseFloat(l)),a:h?Ye.channel.clamp.a(d?parseFloat(h)/100:parseFloat(h)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:n}=e;return n<1?`rgba(${Ye.lang.round(t)}, ${Ye.lang.round(r)}, ${Ye.lang.round(i)}, ${Ye.lang.round(n)})`:`rgb(${Ye.lang.round(t)}, ${Ye.lang.round(r)}, ${Ye.lang.round(i)})`}},An={format:{keyword:fc,hex:wa,rgb:Jl,rgba:Jl,hsl:bo,hsla:bo},parse:e=>{if(typeof e!="string")return e;const t=wa.parse(e)||Jl.parse(e)||bo.parse(e)||fc.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Ar.HSL)||e.data.r===void 0?bo.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Jl.stringify(e):wa.stringify(e)},wS=(e,t)=>{const r=An.parse(e);for(const i in t)r[i]=Ye.channel.clamp[i](t[i]);return An.stringify(r)},pc=(e,t,r=0,i=1)=>{if(typeof e!="number")return wS(e,{a:t});const n=Id.set({r:Ye.channel.clamp.r(e),g:Ye.channel.clamp.g(t),b:Ye.channel.clamp.b(r),a:Ye.channel.clamp.a(i)});return An.stringify(n)},j3=e=>{const{r:t,g:r,b:i}=An.parse(e),n=.2126*Ye.channel.toLinear(t)+.7152*Ye.channel.toLinear(r)+.0722*Ye.channel.toLinear(i);return Ye.lang.round(n)},z3=e=>j3(e)>=.5,$c=e=>!z3(e),CS=(e,t,r)=>{const i=An.parse(e),n=i[t],s=Ye.channel.clamp[t](n+r);return n!==s&&(i[t]=s),An.stringify(i)},Le=(e,t)=>CS(e,"l",t),Fe=(e,t)=>CS(e,"l",-t),J=(e,t)=>{const r=An.parse(e),i={};for(const n in t)t[n]&&(i[n]=r[n]+t[n]);return wS(e,i)},O3=(e,t,r=50)=>{const{r:i,g:n,b:s,a}=An.parse(e),{r:l,g:u,b:h,a:d}=An.parse(t),p=r/100,m=p*2-1,y=a-d,v=((m*y===-1?m:(m+y)/(1+m*y))+1)/2,S=1-v,C=i*v+l*S,E=n*v+u*S,L=s*v+h*S,B=a*p+d*(1-p);return pc(C,E,L,B)},xe=(e,t=100)=>{const r=An.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,O3(r,e,t)};var kS=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,gc=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,F3=/\s*%%.*\n/gm,Ta,TS=(Ta=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},T(Ta,"UnknownDiagramError"),Ta),Ro={},Ly=T(function(e,t){e=e.replace(kS,"").replace(gc,"").replace(F3,`
|
|
123
|
+
`);for(const[r,{detector:i}]of Object.entries(Ro))if(i(e,t))return r;throw new TS(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),Fg=T((...e)=>{for(const{id:t,detector:r,loader:i}of e)ES(t,r,i)},"registerLazyLoadedDiagrams"),ES=T((e,t,r)=>{Ro[e]&&ue.warn(`Detector with key ${e} already exists. Overwriting.`),Ro[e]={detector:t,loader:r},ue.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),N3=T(e=>Ro[e].loader,"getDiagramLoader"),Ng=T((e,t,{depth:r=2,clobber:i=!1}={})=>{const n={depth:r,clobber:i};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(s=>Ng(e,s,n)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(s=>{e.includes(s)||e.push(s)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(s=>{typeof t[s]=="object"&&(e[s]===void 0||typeof e[s]=="object")?(e[s]===void 0&&(e[s]=Array.isArray(t[s])?[]:{}),e[s]=Ng(e[s],t[s],{depth:r-1,clobber:i})):(i||typeof e[s]!="object"&&typeof t[s]!="object")&&(e[s]=t[s])}),e)},"assignWithDepth"),ir=Ng,$d="#ffffff",jd="#f2f2f2",Ur=T((e,t)=>t?J(e,{s:-40,l:10}):J(e,{s:-40,l:-10}),"mkBorder"),Ea,W3=(Ea=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){var r,i,n,s,a,l,u,h,d,p,m,y,x,v,S,C,E,L,B,R,k;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||J(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||J(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Ur(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Ur(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Ur(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Ur(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||xe(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||xe(this.tertiaryColor),this.lineColor=this.lineColor||xe(this.background),this.arrowheadColor=this.arrowheadColor||xe(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Fe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Fe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||xe(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Le(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||Fe(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Fe(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Le(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Le(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||J(this.primaryColor,{h:30}),this.cScale4=this.cScale4||J(this.primaryColor,{h:60}),this.cScale5=this.cScale5||J(this.primaryColor,{h:90}),this.cScale6=this.cScale6||J(this.primaryColor,{h:120}),this.cScale7=this.cScale7||J(this.primaryColor,{h:150}),this.cScale8=this.cScale8||J(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||J(this.primaryColor,{h:270}),this.cScale10=this.cScale10||J(this.primaryColor,{h:300}),this.cScale11=this.cScale11||J(this.primaryColor,{h:330}),this.darkMode)for(let A=0;A<this.THEME_COLOR_LIMIT;A++)this["cScale"+A]=Fe(this["cScale"+A],75);else for(let A=0;A<this.THEME_COLOR_LIMIT;A++)this["cScale"+A]=Fe(this["cScale"+A],25);for(let A=0;A<this.THEME_COLOR_LIMIT;A++)this["cScaleInv"+A]=this["cScaleInv"+A]||xe(this["cScale"+A]);for(let A=0;A<this.THEME_COLOR_LIMIT;A++)this.darkMode?this["cScalePeer"+A]=this["cScalePeer"+A]||Le(this["cScale"+A],10):this["cScalePeer"+A]=this["cScalePeer"+A]||Fe(this["cScale"+A],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let A=0;A<this.THEME_COLOR_LIMIT;A++)this["cScaleLabel"+A]=this["cScaleLabel"+A]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let A=0;A<5;A++)this["surface"+A]=this["surface"+A]||J(this.mainBkg,{h:180,s:-15,l:t*(5+A*3)}),this["surfacePeer"+A]=this["surfacePeer"+A]||J(this.mainBkg,{h:180,s:-15,l:t*(8+A*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||J(this.primaryColor,{h:64}),this.fillType3=this.fillType3||J(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||J(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||J(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||J(this.primaryColor,{h:128}),this.fillType7=this.fillType7||J(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||J(this.primaryColor,{l:-10}),this.pie5=this.pie5||J(this.secondaryColor,{l:-10}),this.pie6=this.pie6||J(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||J(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||J(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||J(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||J(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||J(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||J(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:((r=this.radar)==null?void 0:r.axisColor)||this.lineColor,axisStrokeWidth:((i=this.radar)==null?void 0:i.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((s=this.radar)==null?void 0:s.curveOpacity)||.5,curveStrokeWidth:((a=this.radar)==null?void 0:a.curveStrokeWidth)||2,graticuleColor:((l=this.radar)==null?void 0:l.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((u=this.radar)==null?void 0:u.graticuleStrokeWidth)||1,graticuleOpacity:((h=this.radar)==null?void 0:h.graticuleOpacity)||.3,legendBoxSize:((d=this.radar)==null?void 0:d.legendBoxSize)||12,legendFontSize:((p=this.radar)==null?void 0:p.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||J(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||J(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||J(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||J(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||J(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||J(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||$c(this.quadrant1Fill)?Le(this.quadrant1Fill):Fe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((m=this.xyChart)==null?void 0:m.backgroundColor)||this.background,titleColor:((y=this.xyChart)==null?void 0:y.titleColor)||this.primaryTextColor,xAxisTitleColor:((x=this.xyChart)==null?void 0:x.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((v=this.xyChart)==null?void 0:v.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((S=this.xyChart)==null?void 0:S.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((C=this.xyChart)==null?void 0:C.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((E=this.xyChart)==null?void 0:E.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((L=this.xyChart)==null?void 0:L.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((B=this.xyChart)==null?void 0:B.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((R=this.xyChart)==null?void 0:R.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((k=this.xyChart)==null?void 0:k.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Fe(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||J(this.primaryColor,{h:-30}),this.git4=this.git4||J(this.primaryColor,{h:-60}),this.git5=this.git5||J(this.primaryColor,{h:-90}),this.git6=this.git6||J(this.primaryColor,{h:60}),this.git7=this.git7||J(this.primaryColor,{h:120}),this.darkMode?(this.git0=Le(this.git0,25),this.git1=Le(this.git1,25),this.git2=Le(this.git2,25),this.git3=Le(this.git3,25),this.git4=Le(this.git4,25),this.git5=Le(this.git5,25),this.git6=Le(this.git6,25),this.git7=Le(this.git7,25)):(this.git0=Fe(this.git0,25),this.git1=Fe(this.git1,25),this.git2=Fe(this.git2,25),this.git3=Fe(this.git3,25),this.git4=Fe(this.git4,25),this.git5=Fe(this.git5,25),this.git6=Fe(this.git6,25),this.git7=Fe(this.git7,25)),this.gitInv0=this.gitInv0||xe(this.git0),this.gitInv1=this.gitInv1||xe(this.git1),this.gitInv2=this.gitInv2||xe(this.git2),this.gitInv3=this.gitInv3||xe(this.git3),this.gitInv4=this.gitInv4||xe(this.git4),this.gitInv5=this.gitInv5||xe(this.git5),this.gitInv6=this.gitInv6||xe(this.git6),this.gitInv7=this.gitInv7||xe(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||$d,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||jd}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},T(Ea,"Theme"),Ea),H3=T(e=>{const t=new W3;return t.calculate(e),t},"getThemeVariables"),Ba,q3=(Ba=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Le(this.primaryColor,16),this.tertiaryColor=J(this.primaryColor,{h:-160}),this.primaryBorderColor=xe(this.background),this.secondaryBorderColor=Ur(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ur(this.tertiaryColor,this.darkMode),this.primaryTextColor=xe(this.primaryColor),this.secondaryTextColor=xe(this.secondaryColor),this.tertiaryTextColor=xe(this.tertiaryColor),this.lineColor=xe(this.background),this.textColor=xe(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Le(xe("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=pc(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=Fe("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Fe(this.sectionBkgColor,10),this.taskBorderColor=pc(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=pc(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Le(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Fe(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){var t,r,i,n,s,a,l,u,h,d,p,m,y,x,v,S,C,E,L,B,R;this.secondBkg=Le(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Le(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Le(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=J(this.primaryColor,{h:64}),this.fillType3=J(this.secondaryColor,{h:64}),this.fillType4=J(this.primaryColor,{h:-64}),this.fillType5=J(this.secondaryColor,{h:-64}),this.fillType6=J(this.primaryColor,{h:128}),this.fillType7=J(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||J(this.primaryColor,{h:30}),this.cScale4=this.cScale4||J(this.primaryColor,{h:60}),this.cScale5=this.cScale5||J(this.primaryColor,{h:90}),this.cScale6=this.cScale6||J(this.primaryColor,{h:120}),this.cScale7=this.cScale7||J(this.primaryColor,{h:150}),this.cScale8=this.cScale8||J(this.primaryColor,{h:210}),this.cScale9=this.cScale9||J(this.primaryColor,{h:270}),this.cScale10=this.cScale10||J(this.primaryColor,{h:300}),this.cScale11=this.cScale11||J(this.primaryColor,{h:330});for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleInv"+k]=this["cScaleInv"+k]||xe(this["cScale"+k]);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScalePeer"+k]=this["cScalePeer"+k]||Le(this["cScale"+k],10);for(let k=0;k<5;k++)this["surface"+k]=this["surface"+k]||J(this.mainBkg,{h:30,s:-30,l:-(-10+k*4)}),this["surfacePeer"+k]=this["surfacePeer"+k]||J(this.mainBkg,{h:30,s:-30,l:-(-7+k*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleLabel"+k]=this["cScaleLabel"+k]||this.scaleLabelColor;for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["pie"+k]=this["cScale"+k];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||J(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||J(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||J(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||J(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||J(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||J(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||$c(this.quadrant1Fill)?Le(this.quadrant1Fill):Fe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((n=this.xyChart)==null?void 0:n.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((s=this.xyChart)==null?void 0:s.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((u=this.xyChart)==null?void 0:u.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((h=this.xyChart)==null?void 0:h.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((m=this.radar)==null?void 0:m.axisColor)||this.lineColor,axisStrokeWidth:((y=this.radar)==null?void 0:y.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((v=this.radar)==null?void 0:v.curveOpacity)||.5,curveStrokeWidth:((S=this.radar)==null?void 0:S.curveStrokeWidth)||2,graticuleColor:((C=this.radar)==null?void 0:C.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((E=this.radar)==null?void 0:E.graticuleStrokeWidth)||1,graticuleOpacity:((L=this.radar)==null?void 0:L.graticuleOpacity)||.3,legendBoxSize:((B=this.radar)==null?void 0:B.legendBoxSize)||12,legendFontSize:((R=this.radar)==null?void 0:R.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Fe(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Le(this.secondaryColor,20),this.git1=Le(this.pie2||this.secondaryColor,20),this.git2=Le(this.pie3||this.tertiaryColor,20),this.git3=Le(this.pie4||J(this.primaryColor,{h:-30}),20),this.git4=Le(this.pie5||J(this.primaryColor,{h:-60}),20),this.git5=Le(this.pie6||J(this.primaryColor,{h:-90}),10),this.git6=Le(this.pie7||J(this.primaryColor,{h:60}),10),this.git7=Le(this.pie8||J(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||xe(this.git0),this.gitInv1=this.gitInv1||xe(this.git1),this.gitInv2=this.gitInv2||xe(this.git2),this.gitInv3=this.gitInv3||xe(this.git3),this.gitInv4=this.gitInv4||xe(this.git4),this.gitInv5=this.gitInv5||xe(this.git5),this.gitInv6=this.gitInv6||xe(this.git6),this.gitInv7=this.gitInv7||xe(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||xe(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||xe(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Le(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Le(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},T(Ba,"Theme"),Ba),U3=T(e=>{const t=new q3;return t.calculate(e),t},"getThemeVariables"),Ma,V3=(Ma=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=J(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=J(this.primaryColor,{h:-160}),this.primaryBorderColor=Ur(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ur(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ur(this.tertiaryColor,this.darkMode),this.primaryTextColor=xe(this.primaryColor),this.secondaryTextColor=xe(this.secondaryColor),this.tertiaryTextColor=xe(this.tertiaryColor),this.lineColor=xe(this.background),this.textColor=xe(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=pc(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){var t,r,i,n,s,a,l,u,h,d,p,m,y,x,v,S,C,E,L,B,R;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||J(this.primaryColor,{h:30}),this.cScale4=this.cScale4||J(this.primaryColor,{h:60}),this.cScale5=this.cScale5||J(this.primaryColor,{h:90}),this.cScale6=this.cScale6||J(this.primaryColor,{h:120}),this.cScale7=this.cScale7||J(this.primaryColor,{h:150}),this.cScale8=this.cScale8||J(this.primaryColor,{h:210}),this.cScale9=this.cScale9||J(this.primaryColor,{h:270}),this.cScale10=this.cScale10||J(this.primaryColor,{h:300}),this.cScale11=this.cScale11||J(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Fe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Fe(this.tertiaryColor,40);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScale"+k]=Fe(this["cScale"+k],10),this["cScalePeer"+k]=this["cScalePeer"+k]||Fe(this["cScale"+k],25);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleInv"+k]=this["cScaleInv"+k]||J(this["cScale"+k],{h:180});for(let k=0;k<5;k++)this["surface"+k]=this["surface"+k]||J(this.mainBkg,{h:30,l:-(5+k*5)}),this["surfacePeer"+k]=this["surfacePeer"+k]||J(this.mainBkg,{h:30,l:-(7+k*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||xe(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||xe(this.labelTextColor);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleLabel"+k]=this["cScaleLabel"+k]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=Le(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Le(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Le(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=J(this.primaryColor,{h:64}),this.fillType3=J(this.secondaryColor,{h:64}),this.fillType4=J(this.primaryColor,{h:-64}),this.fillType5=J(this.secondaryColor,{h:-64}),this.fillType6=J(this.primaryColor,{h:128}),this.fillType7=J(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||J(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||J(this.primaryColor,{l:-10}),this.pie5=this.pie5||J(this.secondaryColor,{l:-30}),this.pie6=this.pie6||J(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||J(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||J(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||J(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||J(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||J(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||J(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||J(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||J(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||J(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||J(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||J(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||J(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||$c(this.quadrant1Fill)?Le(this.quadrant1Fill):Fe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((i=this.radar)==null?void 0:i.axisLabelFontSize)||12,curveOpacity:((n=this.radar)==null?void 0:n.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((a=this.radar)==null?void 0:a.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((u=this.radar)==null?void 0:u.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.xyChart={backgroundColor:((p=this.xyChart)==null?void 0:p.backgroundColor)||this.background,titleColor:((m=this.xyChart)==null?void 0:m.titleColor)||this.primaryTextColor,xAxisTitleColor:((y=this.xyChart)==null?void 0:y.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((v=this.xyChart)==null?void 0:v.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((S=this.xyChart)==null?void 0:S.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((C=this.xyChart)==null?void 0:C.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((E=this.xyChart)==null?void 0:E.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((L=this.xyChart)==null?void 0:L.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((B=this.xyChart)==null?void 0:B.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||J(this.primaryColor,{h:-30}),this.git4=this.git4||J(this.primaryColor,{h:-60}),this.git5=this.git5||J(this.primaryColor,{h:-90}),this.git6=this.git6||J(this.primaryColor,{h:60}),this.git7=this.git7||J(this.primaryColor,{h:120}),this.darkMode?(this.git0=Le(this.git0,25),this.git1=Le(this.git1,25),this.git2=Le(this.git2,25),this.git3=Le(this.git3,25),this.git4=Le(this.git4,25),this.git5=Le(this.git5,25),this.git6=Le(this.git6,25),this.git7=Le(this.git7,25)):(this.git0=Fe(this.git0,25),this.git1=Fe(this.git1,25),this.git2=Fe(this.git2,25),this.git3=Fe(this.git3,25),this.git4=Fe(this.git4,25),this.git5=Fe(this.git5,25),this.git6=Fe(this.git6,25),this.git7=Fe(this.git7,25)),this.gitInv0=this.gitInv0||Fe(xe(this.git0),25),this.gitInv1=this.gitInv1||xe(this.git1),this.gitInv2=this.gitInv2||xe(this.git2),this.gitInv3=this.gitInv3||xe(this.git3),this.gitInv4=this.gitInv4||xe(this.git4),this.gitInv5=this.gitInv5||xe(this.git5),this.gitInv6=this.gitInv6||xe(this.git6),this.gitInv7=this.gitInv7||xe(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||xe(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||xe(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||$d,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||jd}calculate(t){if(Object.keys(this).forEach(i=>{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},T(Ma,"Theme"),Ma),G3=T(e=>{const t=new V3;return t.calculate(e),t},"getThemeVariables"),La,Y3=(La=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Le("#cde498",10),this.primaryBorderColor=Ur(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ur(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ur(this.tertiaryColor,this.darkMode),this.primaryTextColor=xe(this.primaryColor),this.secondaryTextColor=xe(this.secondaryColor),this.tertiaryTextColor=xe(this.primaryColor),this.lineColor=xe(this.background),this.textColor=xe(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,r,i,n,s,a,l,u,h,d,p,m,y,x,v,S,C,E,L,B,R;this.actorBorder=Fe(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||J(this.primaryColor,{h:30}),this.cScale4=this.cScale4||J(this.primaryColor,{h:60}),this.cScale5=this.cScale5||J(this.primaryColor,{h:90}),this.cScale6=this.cScale6||J(this.primaryColor,{h:120}),this.cScale7=this.cScale7||J(this.primaryColor,{h:150}),this.cScale8=this.cScale8||J(this.primaryColor,{h:210}),this.cScale9=this.cScale9||J(this.primaryColor,{h:270}),this.cScale10=this.cScale10||J(this.primaryColor,{h:300}),this.cScale11=this.cScale11||J(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Fe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Fe(this.tertiaryColor,40);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScale"+k]=Fe(this["cScale"+k],10),this["cScalePeer"+k]=this["cScalePeer"+k]||Fe(this["cScale"+k],25);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleInv"+k]=this["cScaleInv"+k]||J(this["cScale"+k],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleLabel"+k]=this["cScaleLabel"+k]||this.scaleLabelColor;for(let k=0;k<5;k++)this["surface"+k]=this["surface"+k]||J(this.mainBkg,{h:30,s:-30,l:-(5+k*5)}),this["surfacePeer"+k]=this["surfacePeer"+k]||J(this.mainBkg,{h:30,s:-30,l:-(8+k*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Le(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Le(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=J(this.primaryColor,{h:64}),this.fillType3=J(this.secondaryColor,{h:64}),this.fillType4=J(this.primaryColor,{h:-64}),this.fillType5=J(this.secondaryColor,{h:-64}),this.fillType6=J(this.primaryColor,{h:128}),this.fillType7=J(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||J(this.primaryColor,{l:-30}),this.pie5=this.pie5||J(this.secondaryColor,{l:-30}),this.pie6=this.pie6||J(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||J(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||J(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||J(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||J(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||J(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||J(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||J(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||J(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||J(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||J(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||J(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||J(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||$c(this.quadrant1Fill)?Le(this.quadrant1Fill):Fe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((t=this.radar)==null?void 0:t.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((i=this.radar)==null?void 0:i.axisLabelFontSize)||12,curveOpacity:((n=this.radar)==null?void 0:n.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((a=this.radar)==null?void 0:a.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((u=this.radar)==null?void 0:u.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.xyChart={backgroundColor:((p=this.xyChart)==null?void 0:p.backgroundColor)||this.background,titleColor:((m=this.xyChart)==null?void 0:m.titleColor)||this.primaryTextColor,xAxisTitleColor:((y=this.xyChart)==null?void 0:y.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((v=this.xyChart)==null?void 0:v.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((S=this.xyChart)==null?void 0:S.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((C=this.xyChart)==null?void 0:C.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((E=this.xyChart)==null?void 0:E.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((L=this.xyChart)==null?void 0:L.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((B=this.xyChart)==null?void 0:B.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||J(this.primaryColor,{h:-30}),this.git4=this.git4||J(this.primaryColor,{h:-60}),this.git5=this.git5||J(this.primaryColor,{h:-90}),this.git6=this.git6||J(this.primaryColor,{h:60}),this.git7=this.git7||J(this.primaryColor,{h:120}),this.darkMode?(this.git0=Le(this.git0,25),this.git1=Le(this.git1,25),this.git2=Le(this.git2,25),this.git3=Le(this.git3,25),this.git4=Le(this.git4,25),this.git5=Le(this.git5,25),this.git6=Le(this.git6,25),this.git7=Le(this.git7,25)):(this.git0=Fe(this.git0,25),this.git1=Fe(this.git1,25),this.git2=Fe(this.git2,25),this.git3=Fe(this.git3,25),this.git4=Fe(this.git4,25),this.git5=Fe(this.git5,25),this.git6=Fe(this.git6,25),this.git7=Fe(this.git7,25)),this.gitInv0=this.gitInv0||xe(this.git0),this.gitInv1=this.gitInv1||xe(this.git1),this.gitInv2=this.gitInv2||xe(this.git2),this.gitInv3=this.gitInv3||xe(this.git3),this.gitInv4=this.gitInv4||xe(this.git4),this.gitInv5=this.gitInv5||xe(this.git5),this.gitInv6=this.gitInv6||xe(this.git6),this.gitInv7=this.gitInv7||xe(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||xe(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||xe(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||$d,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||jd}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},T(La,"Theme"),La),K3=T(e=>{const t=new Y3;return t.calculate(e),t},"getThemeVariables"),Ra,X3=(Ra=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Le(this.contrast,55),this.background="#ffffff",this.tertiaryColor=J(this.primaryColor,{h:-160}),this.primaryBorderColor=Ur(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ur(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ur(this.tertiaryColor,this.darkMode),this.primaryTextColor=xe(this.primaryColor),this.secondaryTextColor=xe(this.secondaryColor),this.tertiaryTextColor=xe(this.tertiaryColor),this.lineColor=xe(this.background),this.textColor=xe(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Le(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var t,r,i,n,s,a,l,u,h,d,p,m,y,x,v,S,C,E,L,B,R;this.secondBkg=Le(this.contrast,55),this.border2=this.contrast,this.actorBorder=Le(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleInv"+k]=this["cScaleInv"+k]||xe(this["cScale"+k]);for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this.darkMode?this["cScalePeer"+k]=this["cScalePeer"+k]||Le(this["cScale"+k],10):this["cScalePeer"+k]=this["cScalePeer"+k]||Fe(this["cScale"+k],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["cScaleLabel"+k]=this["cScaleLabel"+k]||this.scaleLabelColor;for(let k=0;k<5;k++)this["surface"+k]=this["surface"+k]||J(this.mainBkg,{l:-(5+k*5)}),this["surfacePeer"+k]=this["surfacePeer"+k]||J(this.mainBkg,{l:-(8+k*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Le(this.contrast,30),this.sectionBkgColor2=Le(this.contrast,30),this.taskBorderColor=Fe(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Le(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=Fe(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=J(this.primaryColor,{h:64}),this.fillType3=J(this.secondaryColor,{h:64}),this.fillType4=J(this.primaryColor,{h:-64}),this.fillType5=J(this.secondaryColor,{h:-64}),this.fillType6=J(this.primaryColor,{h:128}),this.fillType7=J(this.secondaryColor,{h:128});for(let k=0;k<this.THEME_COLOR_LIMIT;k++)this["pie"+k]=this["cScale"+k];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||J(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||J(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||J(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||J(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||J(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||J(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||$c(this.quadrant1Fill)?Le(this.quadrant1Fill):Fe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((t=this.xyChart)==null?void 0:t.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((n=this.xyChart)==null?void 0:n.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((s=this.xyChart)==null?void 0:s.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((u=this.xyChart)==null?void 0:u.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((h=this.xyChart)==null?void 0:h.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((m=this.radar)==null?void 0:m.axisColor)||this.lineColor,axisStrokeWidth:((y=this.radar)==null?void 0:y.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((v=this.radar)==null?void 0:v.curveOpacity)||.5,curveStrokeWidth:((S=this.radar)==null?void 0:S.curveStrokeWidth)||2,graticuleColor:((C=this.radar)==null?void 0:C.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((E=this.radar)==null?void 0:E.graticuleStrokeWidth)||1,graticuleOpacity:((L=this.radar)==null?void 0:L.graticuleOpacity)||.3,legendBoxSize:((B=this.radar)==null?void 0:B.legendBoxSize)||12,legendFontSize:((R=this.radar)==null?void 0:R.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Fe(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||J(this.primaryColor,{h:-30}),this.git4=this.pie5||J(this.primaryColor,{h:-60}),this.git5=this.pie6||J(this.primaryColor,{h:-90}),this.git6=this.pie7||J(this.primaryColor,{h:60}),this.git7=this.pie8||J(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||xe(this.git0),this.gitInv1=this.gitInv1||xe(this.git1),this.gitInv2=this.gitInv2||xe(this.git2),this.gitInv3=this.gitInv3||xe(this.git3),this.gitInv4=this.gitInv4||xe(this.git4),this.gitInv5=this.gitInv5||xe(this.git5),this.gitInv6=this.gitInv6||xe(this.git6),this.gitInv7=this.gitInv7||xe(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||$d,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||jd}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},T(Ra,"Theme"),Ra),Q3=T(e=>{const t=new X3;return t.calculate(e),t},"getThemeVariables"),ts={base:{getThemeVariables:H3},dark:{getThemeVariables:U3},default:{getThemeVariables:G3},forest:{getThemeVariables:K3},neutral:{getThemeVariables:Q3}},bn={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},BS={...bn,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:ts.default.getThemeVariables(),sequence:{...bn.sequence,messageFont:T(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:T(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:T(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...bn.gantt,tickInterval:void 0,useWidth:void 0},c4:{...bn.c4,useWidth:void 0,personFont:T(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...bn.flowchart,inheritDir:!1},external_personFont:T(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:T(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:T(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:T(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:T(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:T(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:T(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:T(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:T(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:T(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:T(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:T(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:T(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:T(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:T(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:T(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:T(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:T(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:T(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:T(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:T(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...bn.pie,useWidth:984},xyChart:{...bn.xyChart,useWidth:void 0},requirement:{...bn.requirement,useWidth:void 0},packet:{...bn.packet},radar:{...bn.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},MS=T((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...MS(e[i],"")]:[...r,t+i],[]),"keyify"),Z3=new Set(MS(BS,"")),LS=BS,Gu=T(e=>{if(ue.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Gu(t));return}for(const t of Object.keys(e)){if(ue.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Z3.has(t)||e[t]==null){ue.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){ue.debug("sanitizing object",t),Gu(e[t]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(ue.debug("sanitizing css option",t),e[t]=J3(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}ue.debug("After sanitization",e)}},"sanitizeDirective"),J3=T(e=>{let t=0,r=0;for(const i of e){if(t<r)return"{ /* ERROR: Unbalanced CSS */ }";i==="{"?t++:i==="}"&&r++}return t!==r?"{ /* ERROR: Unbalanced CSS */ }":e},"sanitizeCss"),Pa=Object.freeze(LS),oi=ir({},Pa),Yu,Ao=[],mc=ir({},Pa),zd=T((e,t)=>{let r=ir({},e),i={};for(const n of t)DS(n),i=ir(i,n);if(r=ir(r,i),i.theme&&i.theme in ts){const n=ir({},Yu),s=ir(n.themeVariables||{},i.themeVariables);r.theme&&r.theme in ts&&(r.themeVariables=ts[r.theme].getThemeVariables(s))}return mc=r,PS(mc),mc},"updateCurrentConfig"),eA=T(e=>(oi=ir({},Pa),oi=ir(oi,e),e.theme&&ts[e.theme]&&(oi.themeVariables=ts[e.theme].getThemeVariables(e.themeVariables)),zd(oi,Ao),oi),"setSiteConfig"),tA=T(e=>{Yu=ir({},e)},"saveConfigFromInitialize"),rA=T(e=>(oi=ir(oi,e),zd(oi,Ao),oi),"updateSiteConfig"),RS=T(()=>ir({},oi),"getSiteConfig"),AS=T(e=>(PS(e),ir(mc,e),Pr()),"setConfig"),Pr=T(()=>ir({},mc),"getConfig"),DS=T(e=>{e&&(["secure",...oi.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(ue.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&DS(e[t])}))},"sanitize"),iA=T(e=>{var t;Gu(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Ao.push(e),zd(oi,Ao)},"addDirective"),Ku=T((e=oi)=>{Ao=[],zd(e,Ao)},"reset"),nA={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},Av={},sA=T(e=>{Av[e]||(ue.warn(nA[e]),Av[e]=!0)},"issueWarning"),PS=T(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&sA("LAZY_LOAD_DEPRECATED")},"checkConfig"),zU=T(()=>{let e={};Yu&&(e=ir(e,Yu));for(const t of Ao)e=ir(e,t);return e},"getUserDefinedConfig"),jc=/<br\s*\/?>/gi,oA=T(e=>e?jS(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),aA=(()=>{let e=!1;return()=>{e||(IS(),e=!0)}})();function IS(){const e="data-temp-href-target";ln.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),ln.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}T(IS,"setupDompurifyHooks");var $S=T(e=>(aA(),ln.sanitize(e)),"removeScript"),Dv=T((e,t)=>{var r;if(((r=t.flowchart)==null?void 0:r.htmlLabels)!==!1){const i=t.securityLevel;i==="antiscript"||i==="strict"?e=$S(e):i!=="loose"&&(e=jS(e),e=e.replace(/</g,"<").replace(/>/g,">"),e=e.replace(/=/g,"="),e=uA(e))}return e},"sanitizeMore"),zi=T((e,t)=>e&&(t.dompurifyConfig?e=ln.sanitize(Dv(e,t),t.dompurifyConfig).toString():e=ln.sanitize(Dv(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),lA=T((e,t)=>typeof e=="string"?zi(e,t):e.flat().map(r=>zi(r,t)),"sanitizeTextOrArray"),cA=T(e=>jc.test(e),"hasBreaks"),hA=T(e=>e.split(jc),"splitBreaks"),uA=T(e=>e.replace(/#br#/g,"<br/>"),"placeholderToBreak"),jS=T(e=>e.replace(jc,"#br#"),"breakToPlaceholder"),dA=T(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),sr=T(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),fA=T(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),pA=T(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),Pv=T(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i<t.length;i++){let n=t[i];if(n===","&&i>0&&i+1<t.length){const s=t[i-1],a=t[i+1];gA(s,a)&&(n=s+","+a,i++,r.pop())}r.push(mA(n))}return r.join("")},"parseGenericTypes"),Wg=T((e,t)=>Math.max(0,e.split(t).length-1),"countOccurrence"),gA=T((e,t)=>{const r=Wg(e,"~"),i=Wg(t,"~");return r===1&&i===1},"shouldCombineSets"),mA=T(e=>{const t=Wg(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let n=i.indexOf("~"),s=i.lastIndexOf("~");for(;n!==-1&&s!==-1&&n!==s;)i[n]="<",i[s]=">",n=i.indexOf("~"),s=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),Iv=T(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Hg=/\$\$(.*)\$\$/g,Ia=T(e=>{var t;return(((t=e.match(Hg))==null?void 0:t.length)??0)>0},"hasKatex"),OU=T(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await Ry(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const i=document.querySelector("body");i==null||i.insertAdjacentElement("beforeend",r);const n={width:r.clientWidth,height:r.clientHeight};return r.remove(),n},"calculateMathMLDimensions"),yA=T(async(e,t)=>{if(!Ia(e))return e;if(!(Iv()||t.legacyMathML||t.forceLegacyMathML))return e.replace(Hg,"MathML is unsupported in this environment.");{const{default:r}=await ct(async()=>{const{default:n}=await import("./katex-BlHpptmG.js");return{default:n}},[]),i=t.forceLegacyMathML||!Iv()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(jc).map(n=>Ia(n)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${n}</div>`:`<div>${n}</div>`).join("").replace(Hg,(n,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Ry=T(async(e,t)=>zi(await yA(e,t),t),"renderKatexSanitized"),Ha={getRows:oA,sanitizeText:zi,sanitizeTextOrArray:lA,hasBreaks:cA,splitBreaks:hA,lineBreakRegex:jc,removeScript:$S,getUrl:dA,evaluate:sr,getMax:fA,getMin:pA},_A=T(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),xA=T(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),zS=T(function(e,t,r,i){const n=xA(t,r,i);_A(e,n)},"configureSvgSize"),vA=T(function(e,t,r,i){const n=t.node().getBBox(),s=n.width,a=n.height;ue.info(`SVG bounds: ${s}x${a}`,n);let l=0,u=0;ue.info(`Graph bounds: ${l}x${u}`,e),l=s+r*2,u=a+r*2,ue.info(`Calculated bounds: ${l}x${u}`),zS(t,u,l,i);const h=`${n.x-r} ${n.y-r} ${n.width+2*r} ${n.height+2*r}`;t.attr("viewBox",h)},"setupGraphViewbox"),Cu={},bA=T((e,t,r)=>{let i="";return e in Cu&&Cu[e]?i=Cu[e](r):ue.warn(`No theme found for ${e}`),` & {
|
|
124
|
+
font-family: ${r.fontFamily};
|
|
125
|
+
font-size: ${r.fontSize};
|
|
126
|
+
fill: ${r.textColor}
|
|
127
|
+
}
|
|
128
|
+
@keyframes edge-animation-frame {
|
|
129
|
+
from {
|
|
130
|
+
stroke-dashoffset: 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
@keyframes dash {
|
|
134
|
+
to {
|
|
135
|
+
stroke-dashoffset: 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
& .edge-animation-slow {
|
|
139
|
+
stroke-dasharray: 9,5 !important;
|
|
140
|
+
stroke-dashoffset: 900;
|
|
141
|
+
animation: dash 50s linear infinite;
|
|
142
|
+
stroke-linecap: round;
|
|
143
|
+
}
|
|
144
|
+
& .edge-animation-fast {
|
|
145
|
+
stroke-dasharray: 9,5 !important;
|
|
146
|
+
stroke-dashoffset: 900;
|
|
147
|
+
animation: dash 20s linear infinite;
|
|
148
|
+
stroke-linecap: round;
|
|
149
|
+
}
|
|
150
|
+
/* Classes common for multiple diagrams */
|
|
151
|
+
|
|
152
|
+
& .error-icon {
|
|
153
|
+
fill: ${r.errorBkgColor};
|
|
154
|
+
}
|
|
155
|
+
& .error-text {
|
|
156
|
+
fill: ${r.errorTextColor};
|
|
157
|
+
stroke: ${r.errorTextColor};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
& .edge-thickness-normal {
|
|
161
|
+
stroke-width: 1px;
|
|
162
|
+
}
|
|
163
|
+
& .edge-thickness-thick {
|
|
164
|
+
stroke-width: 3.5px
|
|
165
|
+
}
|
|
166
|
+
& .edge-pattern-solid {
|
|
167
|
+
stroke-dasharray: 0;
|
|
168
|
+
}
|
|
169
|
+
& .edge-thickness-invisible {
|
|
170
|
+
stroke-width: 0;
|
|
171
|
+
fill: none;
|
|
172
|
+
}
|
|
173
|
+
& .edge-pattern-dashed{
|
|
174
|
+
stroke-dasharray: 3;
|
|
175
|
+
}
|
|
176
|
+
.edge-pattern-dotted {
|
|
177
|
+
stroke-dasharray: 2;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
& .marker {
|
|
181
|
+
fill: ${r.lineColor};
|
|
182
|
+
stroke: ${r.lineColor};
|
|
183
|
+
}
|
|
184
|
+
& .marker.cross {
|
|
185
|
+
stroke: ${r.lineColor};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
& svg {
|
|
189
|
+
font-family: ${r.fontFamily};
|
|
190
|
+
font-size: ${r.fontSize};
|
|
191
|
+
}
|
|
192
|
+
& p {
|
|
193
|
+
margin: 0
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
${i}
|
|
197
|
+
|
|
198
|
+
${t}
|
|
199
|
+
`},"getStyles"),SA=T((e,t)=>{t!==void 0&&(Cu[e]=t)},"addStylesForDiagram"),wA=bA,OS={};A3(OS,{clear:()=>CA,getAccDescription:()=>BA,getAccTitle:()=>TA,getDiagramTitle:()=>LA,setAccDescription:()=>EA,setAccTitle:()=>kA,setDiagramTitle:()=>MA});var Ay="",Dy="",Py="",Iy=T(e=>zi(e,Pr()),"sanitizeText"),CA=T(()=>{Ay="",Py="",Dy=""},"clear"),kA=T(e=>{Ay=Iy(e).replace(/^\s+/g,"")},"setAccTitle"),TA=T(()=>Ay,"getAccTitle"),EA=T(e=>{Py=Iy(e).replace(/\n\s+/g,`
|
|
200
|
+
`)},"setAccDescription"),BA=T(()=>Py,"getAccDescription"),MA=T(e=>{Dy=Iy(e)},"setDiagramTitle"),LA=T(()=>Dy,"getDiagramTitle"),$v=ue,RA=My,dt=Pr,FU=AS,NU=Pa,$y=T(e=>zi(e,dt()),"sanitizeText"),AA=vA,DA=T(()=>OS,"getCommonDb"),Xu={},Qu=T((e,t,r)=>{var i;Xu[e]&&$v.warn(`Diagram with id ${e} already registered. Overwriting.`),Xu[e]=t,r&&ES(e,r),SA(e,t.styles),(i=t.injectUtils)==null||i.call(t,$v,RA,dt,$y,AA,DA(),()=>{})},"registerDiagram"),qg=T(e=>{if(e in Xu)return Xu[e];throw new PA(e)},"getDiagram"),Aa,PA=(Aa=class extends Error{constructor(t){super(`Diagram ${t} not found.`)}},T(Aa,"DiagramNotFoundError"),Aa),IA={value:()=>{}};function FS(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new ku(r)}function ku(e){this._=e}function $A(e,t){return e.trim().split(/^|\s+/).map(function(r){var i="",n=r.indexOf(".");if(n>=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}ku.prototype=FS.prototype={constructor:ku,on:function(e,t){var r=this._,i=$A(e+"",r),n,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((n=(e=i[s]).type)&&(n=jA(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=jv(r[n],e.name,t);else if(t==null)for(n in r)r[n]=jv(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new ku(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),i=0,n,s;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,n=s.length;i<n;++i)s[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],n=0,s=i.length;n<s;++n)i[n].value.apply(t,r)}};function jA(e,t){for(var r=0,i=e.length,n;r<i;++r)if((n=e[r]).name===t)return n.value}function jv(e,t,r){for(var i=0,n=e.length;i<n;++i)if(e[i].name===t){e[i]=IA,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var Ug="http://www.w3.org/1999/xhtml";const zv={svg:"http://www.w3.org/2000/svg",xhtml:Ug,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Od(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),zv.hasOwnProperty(t)?{space:zv[t],local:e}:e}function zA(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Ug&&t.documentElement.namespaceURI===Ug?t.createElement(e):t.createElementNS(r,e)}}function OA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function NS(e){var t=Od(e);return(t.local?OA:zA)(t)}function FA(){}function jy(e){return e==null?FA:function(){return this.querySelector(e)}}function NA(e){typeof e!="function"&&(e=jy(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var s=t[n],a=s.length,l=i[n]=new Array(a),u,h,d=0;d<a;++d)(u=s[d])&&(h=e.call(u,u.__data__,d,s))&&("__data__"in u&&(h.__data__=u.__data__),l[d]=h);return new Si(i,this._parents)}function WA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function HA(){return[]}function WS(e){return e==null?HA:function(){return this.querySelectorAll(e)}}function qA(e){return function(){return WA(e.apply(this,arguments))}}function UA(e){typeof e=="function"?e=qA(e):e=WS(e);for(var t=this._groups,r=t.length,i=[],n=[],s=0;s<r;++s)for(var a=t[s],l=a.length,u,h=0;h<l;++h)(u=a[h])&&(i.push(e.call(u,u.__data__,h,a)),n.push(u));return new Si(i,n)}function HS(e){return function(){return this.matches(e)}}function qS(e){return function(t){return t.matches(e)}}var VA=Array.prototype.find;function GA(e){return function(){return VA.call(this.children,e)}}function YA(){return this.firstElementChild}function KA(e){return this.select(e==null?YA:GA(typeof e=="function"?e:qS(e)))}var XA=Array.prototype.filter;function QA(){return Array.from(this.children)}function ZA(e){return function(){return XA.call(this.children,e)}}function JA(e){return this.selectAll(e==null?QA:ZA(typeof e=="function"?e:qS(e)))}function e5(e){typeof e!="function"&&(e=HS(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var s=t[n],a=s.length,l=i[n]=[],u,h=0;h<a;++h)(u=s[h])&&e.call(u,u.__data__,h,s)&&l.push(u);return new Si(i,this._parents)}function US(e){return new Array(e.length)}function t5(){return new Si(this._enter||this._groups.map(US),this._parents)}function Zu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Zu.prototype={constructor:Zu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function r5(e){return function(){return e}}function i5(e,t,r,i,n,s){for(var a=0,l,u=t.length,h=s.length;a<h;++a)(l=t[a])?(l.__data__=s[a],i[a]=l):r[a]=new Zu(e,s[a]);for(;a<u;++a)(l=t[a])&&(n[a]=l)}function n5(e,t,r,i,n,s,a){var l,u,h=new Map,d=t.length,p=s.length,m=new Array(d),y;for(l=0;l<d;++l)(u=t[l])&&(m[l]=y=a.call(u,u.__data__,l,t)+"",h.has(y)?n[l]=u:h.set(y,u));for(l=0;l<p;++l)y=a.call(e,s[l],l,s)+"",(u=h.get(y))?(i[l]=u,u.__data__=s[l],h.delete(y)):r[l]=new Zu(e,s[l]);for(l=0;l<d;++l)(u=t[l])&&h.get(m[l])===u&&(n[l]=u)}function s5(e){return e.__data__}function o5(e,t){if(!arguments.length)return Array.from(this,s5);var r=t?n5:i5,i=this._parents,n=this._groups;typeof e!="function"&&(e=r5(e));for(var s=n.length,a=new Array(s),l=new Array(s),u=new Array(s),h=0;h<s;++h){var d=i[h],p=n[h],m=p.length,y=a5(e.call(d,d&&d.__data__,h,i)),x=y.length,v=l[h]=new Array(x),S=a[h]=new Array(x),C=u[h]=new Array(m);r(d,p,v,S,C,y,t);for(var E=0,L=0,B,R;E<x;++E)if(B=v[E]){for(E>=L&&(L=E+1);!(R=S[L])&&++L<x;);B._next=R||null}}return a=new Si(a,i),a._enter=l,a._exit=u,a}function a5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function l5(){return new Si(this._exit||this._groups.map(US),this._parents)}function c5(e,t,r){var i=this.enter(),n=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?s.remove():r(s),i&&n?i.merge(n).order():n}function h5(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,n=r.length,s=i.length,a=Math.min(n,s),l=new Array(n),u=0;u<a;++u)for(var h=r[u],d=i[u],p=h.length,m=l[u]=new Array(p),y,x=0;x<p;++x)(y=h[x]||d[x])&&(m[x]=y);for(;u<n;++u)l[u]=r[u];return new Si(l,this._parents)}function u5(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],n=i.length-1,s=i[n],a;--n>=0;)(a=i[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function d5(e){e||(e=f5);function t(p,m){return p&&m?e(p.__data__,m.__data__):!p-!m}for(var r=this._groups,i=r.length,n=new Array(i),s=0;s<i;++s){for(var a=r[s],l=a.length,u=n[s]=new Array(l),h,d=0;d<l;++d)(h=a[d])&&(u[d]=h);u.sort(t)}return new Si(n,this._parents).order()}function f5(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function p5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function g5(){return Array.from(this)}function m5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],n=0,s=i.length;n<s;++n){var a=i[n];if(a)return a}return null}function y5(){let e=0;for(const t of this)++e;return e}function _5(){return!this.node()}function x5(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var n=t[r],s=0,a=n.length,l;s<a;++s)(l=n[s])&&e.call(l,l.__data__,s,n);return this}function v5(e){return function(){this.removeAttribute(e)}}function b5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function S5(e,t){return function(){this.setAttribute(e,t)}}function w5(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function C5(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function k5(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function T5(e,t){var r=Od(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?b5:v5:typeof t=="function"?r.local?k5:C5:r.local?w5:S5)(r,t))}function VS(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function E5(e){return function(){this.style.removeProperty(e)}}function B5(e,t,r){return function(){this.style.setProperty(e,t,r)}}function M5(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function L5(e,t,r){return arguments.length>1?this.each((t==null?E5:typeof t=="function"?M5:B5)(e,t,r??"")):$a(this.node(),e)}function $a(e,t){return e.style.getPropertyValue(t)||VS(e).getComputedStyle(e,null).getPropertyValue(t)}function R5(e){return function(){delete this[e]}}function A5(e,t){return function(){this[e]=t}}function D5(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function P5(e,t){return arguments.length>1?this.each((t==null?R5:typeof t=="function"?D5:A5)(e,t)):this.node()[e]}function GS(e){return e.trim().split(/^|\s+/)}function zy(e){return e.classList||new YS(e)}function YS(e){this._node=e,this._names=GS(e.getAttribute("class")||"")}YS.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function KS(e,t){for(var r=zy(e),i=-1,n=t.length;++i<n;)r.add(t[i])}function XS(e,t){for(var r=zy(e),i=-1,n=t.length;++i<n;)r.remove(t[i])}function I5(e){return function(){KS(this,e)}}function $5(e){return function(){XS(this,e)}}function j5(e,t){return function(){(t.apply(this,arguments)?KS:XS)(this,e)}}function z5(e,t){var r=GS(e+"");if(arguments.length<2){for(var i=zy(this.node()),n=-1,s=r.length;++n<s;)if(!i.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?j5:t?I5:$5)(r,t))}function O5(){this.textContent=""}function F5(e){return function(){this.textContent=e}}function N5(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function W5(e){return arguments.length?this.each(e==null?O5:(typeof e=="function"?N5:F5)(e)):this.node().textContent}function H5(){this.innerHTML=""}function q5(e){return function(){this.innerHTML=e}}function U5(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function V5(e){return arguments.length?this.each(e==null?H5:(typeof e=="function"?U5:q5)(e)):this.node().innerHTML}function G5(){this.nextSibling&&this.parentNode.appendChild(this)}function Y5(){return this.each(G5)}function K5(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function X5(){return this.each(K5)}function Q5(e){var t=typeof e=="function"?e:NS(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Z5(){return null}function J5(e,t){var r=typeof e=="function"?e:NS(e),i=t==null?Z5:typeof t=="function"?t:jy(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function eD(){var e=this.parentNode;e&&e.removeChild(this)}function tD(){return this.each(eD)}function rD(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function iD(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nD(e){return this.select(e?iD:rD)}function sD(e){return arguments.length?this.property("__data__",e):this.node().__data__}function oD(e){return function(t){e.call(this,t,this.__data__)}}function aD(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function lD(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,n=t.length,s;r<n;++r)s=t[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++i]=s;++i?t.length=i:delete this.__on}}}function cD(e,t,r){return function(){var i=this.__on,n,s=oD(t);if(i){for(var a=0,l=i.length;a<l;++a)if((n=i[a]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=t;return}}this.addEventListener(e.type,s,r),n={type:e.type,name:e.name,value:t,listener:s,options:r},i?i.push(n):this.__on=[n]}}function hD(e,t,r){var i=aD(e+""),n,s=i.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,h=l.length,d;u<h;++u)for(n=0,d=l[u];n<s;++n)if((a=i[n]).type===d.type&&a.name===d.name)return d.value}return}for(l=t?cD:lD,n=0;n<s;++n)this.each(l(i[n],t,r));return this}function QS(e,t,r){var i=VS(e),n=i.CustomEvent;typeof n=="function"?n=new n(t,r):(n=i.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function uD(e,t){return function(){return QS(this,e,t)}}function dD(e,t){return function(){return QS(this,e,t.apply(this,arguments))}}function fD(e,t){return this.each((typeof t=="function"?dD:uD)(e,t))}function*pD(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],n=0,s=i.length,a;n<s;++n)(a=i[n])&&(yield a)}var ZS=[null];function Si(e,t){this._groups=e,this._parents=t}function zc(){return new Si([[document.documentElement]],ZS)}function gD(){return this}Si.prototype=zc.prototype={constructor:Si,select:NA,selectAll:UA,selectChild:KA,selectChildren:JA,filter:e5,data:o5,enter:t5,exit:l5,join:c5,merge:h5,selection:gD,order:u5,sort:d5,call:p5,nodes:g5,node:m5,size:y5,empty:_5,each:x5,attr:T5,style:L5,property:P5,classed:z5,text:W5,html:V5,raise:Y5,lower:X5,append:Q5,insert:J5,remove:tD,clone:nD,datum:sD,on:hD,dispatch:fD,[Symbol.iterator]:pD};function nt(e){return typeof e=="string"?new Si([[document.querySelector(e)]],[document.documentElement]):new Si([[e]],ZS)}function Oy(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function JS(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Oc(){}var xc=.7,Ju=1/xc,Ca="\\s*([+-]?\\d+)\\s*",vc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mD=/^#([0-9a-f]{3,8})$/,yD=new RegExp(`^rgb\\(${Ca},${Ca},${Ca}\\)$`),_D=new RegExp(`^rgb\\(${Ln},${Ln},${Ln}\\)$`),xD=new RegExp(`^rgba\\(${Ca},${Ca},${Ca},${vc}\\)$`),vD=new RegExp(`^rgba\\(${Ln},${Ln},${Ln},${vc}\\)$`),bD=new RegExp(`^hsl\\(${vc},${Ln},${Ln}\\)$`),SD=new RegExp(`^hsla\\(${vc},${Ln},${Ln},${vc}\\)$`),Ov={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Oy(Oc,bc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fv,formatHex:Fv,formatHex8:wD,formatHsl:CD,formatRgb:Nv,toString:Nv});function Fv(){return this.rgb().formatHex()}function wD(){return this.rgb().formatHex8()}function CD(){return ew(this).formatHsl()}function Nv(){return this.rgb().formatRgb()}function bc(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=mD.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Wv(t):r===3?new li(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ru(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ru(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yD.exec(e))?new li(t[1],t[2],t[3],1):(t=_D.exec(e))?new li(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xD.exec(e))?ru(t[1],t[2],t[3],t[4]):(t=vD.exec(e))?ru(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bD.exec(e))?Uv(t[1],t[2]/100,t[3]/100,1):(t=SD.exec(e))?Uv(t[1],t[2]/100,t[3]/100,t[4]):Ov.hasOwnProperty(e)?Wv(Ov[e]):e==="transparent"?new li(NaN,NaN,NaN,0):null}function Wv(e){return new li(e>>16&255,e>>8&255,e&255,1)}function ru(e,t,r,i){return i<=0&&(e=t=r=NaN),new li(e,t,r,i)}function kD(e){return e instanceof Oc||(e=bc(e)),e?(e=e.rgb(),new li(e.r,e.g,e.b,e.opacity)):new li}function Vg(e,t,r,i){return arguments.length===1?kD(e):new li(e,t,r,i??1)}function li(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}Oy(li,Vg,JS(Oc,{brighter(e){return e=e==null?Ju:Math.pow(Ju,e),new li(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xc:Math.pow(xc,e),new li(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new li(Eo(this.r),Eo(this.g),Eo(this.b),ed(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Hv,formatHex:Hv,formatHex8:TD,formatRgb:qv,toString:qv}));function Hv(){return`#${So(this.r)}${So(this.g)}${So(this.b)}`}function TD(){return`#${So(this.r)}${So(this.g)}${So(this.b)}${So((isNaN(this.opacity)?1:this.opacity)*255)}`}function qv(){const e=ed(this.opacity);return`${e===1?"rgb(":"rgba("}${Eo(this.r)}, ${Eo(this.g)}, ${Eo(this.b)}${e===1?")":`, ${e})`}`}function ed(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Eo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function So(e){return e=Eo(e),(e<16?"0":"")+e.toString(16)}function Uv(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new nn(e,t,r,i)}function ew(e){if(e instanceof nn)return new nn(e.h,e.s,e.l,e.opacity);if(e instanceof Oc||(e=bc(e)),!e)return new nn;if(e instanceof nn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,n=Math.min(t,r,i),s=Math.max(t,r,i),a=NaN,l=s-n,u=(s+n)/2;return l?(t===s?a=(r-i)/l+(r<i)*6:r===s?a=(i-t)/l+2:a=(t-r)/l+4,l/=u<.5?s+n:2-s-n,a*=60):l=u>0&&u<1?0:a,new nn(a,l,u,e.opacity)}function ED(e,t,r,i){return arguments.length===1?ew(e):new nn(e,t,r,i??1)}function nn(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}Oy(nn,ED,JS(Oc,{brighter(e){return e=e==null?Ju:Math.pow(Ju,e),new nn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xc:Math.pow(xc,e),new nn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,n=2*r-i;return new li(ig(e>=240?e-240:e+120,n,i),ig(e,n,i),ig(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new nn(Vv(this.h),iu(this.s),iu(this.l),ed(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ed(this.opacity);return`${e===1?"hsl(":"hsla("}${Vv(this.h)}, ${iu(this.s)*100}%, ${iu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vv(e){return e=(e||0)%360,e<0?e+360:e}function iu(e){return Math.max(0,Math.min(1,e||0))}function ig(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Fy=e=>()=>e;function tw(e,t){return function(r){return e+r*t}}function BD(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function WU(e,t){var r=t-e;return r?tw(e,r>180||r<-180?r-360*Math.round(r/360):r):Fy(isNaN(e)?t:e)}function MD(e){return(e=+e)==1?rw:function(t,r){return r-t?BD(t,r,e):Fy(isNaN(t)?r:t)}}function rw(e,t){var r=t-e;return r?tw(e,r):Fy(isNaN(e)?t:e)}const Gv=(function e(t){var r=MD(t);function i(n,s){var a=r((n=Vg(n)).r,(s=Vg(s)).r),l=r(n.g,s.g),u=r(n.b,s.b),h=rw(n.opacity,s.opacity);return function(d){return n.r=a(d),n.g=l(d),n.b=u(d),n.opacity=h(d),n+""}}return i.gamma=e,i})(1);function Ps(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Gg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ng=new RegExp(Gg.source,"g");function LD(e){return function(){return e}}function RD(e){return function(t){return e(t)+""}}function AD(e,t){var r=Gg.lastIndex=ng.lastIndex=0,i,n,s,a=-1,l=[],u=[];for(e=e+"",t=t+"";(i=Gg.exec(e))&&(n=ng.exec(t));)(s=n.index)>r&&(s=t.slice(r,s),l[a]?l[a]+=s:l[++a]=s),(i=i[0])===(n=n[0])?l[a]?l[a]+=n:l[++a]=n:(l[++a]=null,u.push({i:a,x:Ps(i,n)})),r=ng.lastIndex;return r<t.length&&(s=t.slice(r),l[a]?l[a]+=s:l[++a]=s),l.length<2?u[0]?RD(u[0].x):LD(t):(t=u.length,function(h){for(var d=0,p;d<t;++d)l[(p=u[d]).i]=p.x(h);return l.join("")})}var Yv=180/Math.PI,Yg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iw(e,t,r,i,n,s){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*r+t*i)&&(r-=e*u,i-=t*u),(l=Math.sqrt(r*r+i*i))&&(r/=l,i/=l,u/=l),e*i<t*r&&(e=-e,t=-t,u=-u,a=-a),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*Yv,skewX:Math.atan(u)*Yv,scaleX:a,scaleY:l}}var nu;function DD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yg:iw(t.a,t.b,t.c,t.d,t.e,t.f)}function PD(e){return e==null||(nu||(nu=document.createElementNS("http://www.w3.org/2000/svg","g")),nu.setAttribute("transform",e),!(e=nu.transform.baseVal.consolidate()))?Yg:(e=e.matrix,iw(e.a,e.b,e.c,e.d,e.e,e.f))}function nw(e,t,r,i){function n(h){return h.length?h.pop()+" ":""}function s(h,d,p,m,y,x){if(h!==p||d!==m){var v=y.push("translate(",null,t,null,r);x.push({i:v-4,x:Ps(h,p)},{i:v-2,x:Ps(d,m)})}else(p||m)&&y.push("translate("+p+t+m+r)}function a(h,d,p,m){h!==d?(h-d>180?d+=360:d-h>180&&(h+=360),m.push({i:p.push(n(p)+"rotate(",null,i)-2,x:Ps(h,d)})):d&&p.push(n(p)+"rotate("+d+i)}function l(h,d,p,m){h!==d?m.push({i:p.push(n(p)+"skewX(",null,i)-2,x:Ps(h,d)}):d&&p.push(n(p)+"skewX("+d+i)}function u(h,d,p,m,y,x){if(h!==p||d!==m){var v=y.push(n(y)+"scale(",null,",",null,")");x.push({i:v-4,x:Ps(h,p)},{i:v-2,x:Ps(d,m)})}else(p!==1||m!==1)&&y.push(n(y)+"scale("+p+","+m+")")}return function(h,d){var p=[],m=[];return h=e(h),d=e(d),s(h.translateX,h.translateY,d.translateX,d.translateY,p,m),a(h.rotate,d.rotate,p,m),l(h.skewX,d.skewX,p,m),u(h.scaleX,h.scaleY,d.scaleX,d.scaleY,p,m),h=d=null,function(y){for(var x=-1,v=m.length,S;++x<v;)p[(S=m[x]).i]=S.x(y);return p.join("")}}}var ID=nw(DD,"px, ","px)","deg)"),$D=nw(PD,", ",")",")"),ja=0,ec=0,Fl=0,sw=1e3,td,tc,rd=0,Do=0,Fd=0,Sc=typeof performance=="object"&&performance.now?performance:Date,ow=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ny(){return Do||(ow(jD),Do=Sc.now()+Fd)}function jD(){Do=0}function id(){this._call=this._time=this._next=null}id.prototype=aw.prototype={constructor:id,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Ny():+r)+(t==null?0:+t),!this._next&&tc!==this&&(tc?tc._next=this:td=this,tc=this),this._call=e,this._time=r,Kg()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kg())}};function aw(e,t,r){var i=new id;return i.restart(e,t,r),i}function zD(){Ny(),++ja;for(var e=td,t;e;)(t=Do-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ja}function Kv(){Do=(rd=Sc.now())+Fd,ja=ec=0;try{zD()}finally{ja=0,FD(),Do=0}}function OD(){var e=Sc.now(),t=e-rd;t>sw&&(Fd-=t,rd=e)}function FD(){for(var e,t=td,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:td=r);tc=e,Kg(i)}function Kg(e){if(!ja){ec&&(ec=clearTimeout(ec));var t=e-Do;t>24?(e<1/0&&(ec=setTimeout(Kv,e-Sc.now()-Fd)),Fl&&(Fl=clearInterval(Fl))):(Fl||(rd=Sc.now(),Fl=setInterval(OD,sw)),ja=1,ow(Kv))}}function Xv(e,t,r){var i=new id;return t=t==null?0:+t,i.restart(n=>{i.stop(),e(n+t)},t,r),i}var ND=FS("start","end","cancel","interrupt"),WD=[],lw=0,Qv=1,Xg=2,Tu=3,Zv=4,Qg=5,Eu=6;function Nd(e,t,r,i,n,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;HD(e,r,{name:t,index:i,group:n,on:ND,tween:WD,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:lw})}function Wy(e,t){var r=cn(e,t);if(r.state>lw)throw new Error("too late; already scheduled");return r}function In(e,t){var r=cn(e,t);if(r.state>Tu)throw new Error("too late; already running");return r}function cn(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function HD(e,t,r){var i=e.__transition,n;i[t]=r,r.timer=aw(s,0,r.time);function s(h){r.state=Qv,r.timer.restart(a,r.delay,r.time),r.delay<=h&&a(h-r.delay)}function a(h){var d,p,m,y;if(r.state!==Qv)return u();for(d in i)if(y=i[d],y.name===r.name){if(y.state===Tu)return Xv(a);y.state===Zv?(y.state=Eu,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete i[d]):+d<t&&(y.state=Eu,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete i[d])}if(Xv(function(){r.state===Tu&&(r.state=Zv,r.timer.restart(l,r.delay,r.time),l(h))}),r.state=Xg,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Xg){for(r.state=Tu,n=new Array(m=r.tween.length),d=0,p=-1;d<m;++d)(y=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(n[++p]=y);n.length=p+1}}function l(h){for(var d=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(u),r.state=Qg,1),p=-1,m=n.length;++p<m;)n[p].call(e,d);r.state===Qg&&(r.on.call("end",e,e.__data__,r.index,r.group),u())}function u(){r.state=Eu,r.timer.stop(),delete i[t];for(var h in i)return;delete e.__transition}}function qD(e,t){var r=e.__transition,i,n,s=!0,a;if(r){t=t==null?null:t+"";for(a in r){if((i=r[a]).name!==t){s=!1;continue}n=i.state>Xg&&i.state<Qg,i.state=Eu,i.timer.stop(),i.on.call(n?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[a]}s&&delete e.__transition}}function UD(e){return this.each(function(){qD(this,e)})}function VD(e,t){var r,i;return function(){var n=In(this,e),s=n.tween;if(s!==r){i=r=s;for(var a=0,l=i.length;a<l;++a)if(i[a].name===t){i=i.slice(),i.splice(a,1);break}}n.tween=i}}function GD(e,t,r){var i,n;if(typeof r!="function")throw new Error;return function(){var s=In(this,e),a=s.tween;if(a!==i){n=(i=a).slice();for(var l={name:t,value:r},u=0,h=n.length;u<h;++u)if(n[u].name===t){n[u]=l;break}u===h&&n.push(l)}s.tween=n}}function YD(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=cn(this.node(),r).tween,n=0,s=i.length,a;n<s;++n)if((a=i[n]).name===e)return a.value;return null}return this.each((t==null?VD:GD)(r,e,t))}function Hy(e,t,r){var i=e._id;return e.each(function(){var n=In(this,i);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return cn(n,i).value[t]}}function cw(e,t){var r;return(typeof t=="number"?Ps:t instanceof bc?Gv:(r=bc(t))?(t=r,Gv):AD)(e,t)}function KD(e){return function(){this.removeAttribute(e)}}function XD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QD(e,t,r){var i,n=r+"",s;return function(){var a=this.getAttribute(e);return a===n?null:a===i?s:s=t(i=a,r)}}function ZD(e,t,r){var i,n=r+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===n?null:a===i?s:s=t(i=a,r)}}function JD(e,t,r){var i,n,s;return function(){var a,l=r(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===i&&u===n?s:(n=u,s=t(i=a,l)))}}function eP(e,t,r){var i,n,s;return function(){var a,l=r(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===i&&u===n?s:(n=u,s=t(i=a,l)))}}function tP(e,t){var r=Od(e),i=r==="transform"?$D:cw;return this.attrTween(e,typeof t=="function"?(r.local?eP:JD)(r,i,Hy(this,"attr."+e,t)):t==null?(r.local?XD:KD)(r):(r.local?ZD:QD)(r,i,t))}function rP(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function iP(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function nP(e,t){var r,i;function n(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&iP(e,s)),r}return n._value=t,n}function sP(e,t){var r,i;function n(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&rP(e,s)),r}return n._value=t,n}function oP(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=Od(e);return this.tween(r,(i.local?nP:sP)(i,t))}function aP(e,t){return function(){Wy(this,e).delay=+t.apply(this,arguments)}}function lP(e,t){return t=+t,function(){Wy(this,e).delay=t}}function cP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aP:lP)(t,e)):cn(this.node(),t).delay}function hP(e,t){return function(){In(this,e).duration=+t.apply(this,arguments)}}function uP(e,t){return t=+t,function(){In(this,e).duration=t}}function dP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hP:uP)(t,e)):cn(this.node(),t).duration}function fP(e,t){if(typeof t!="function")throw new Error;return function(){In(this,e).ease=t}}function pP(e){var t=this._id;return arguments.length?this.each(fP(t,e)):cn(this.node(),t).ease}function gP(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;In(this,e).ease=r}}function mP(e){if(typeof e!="function")throw new Error;return this.each(gP(this._id,e))}function yP(e){typeof e!="function"&&(e=HS(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n<r;++n)for(var s=t[n],a=s.length,l=i[n]=[],u,h=0;h<a;++h)(u=s[h])&&e.call(u,u.__data__,h,s)&&l.push(u);return new is(i,this._parents,this._name,this._id)}function _P(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,n=r.length,s=Math.min(i,n),a=new Array(i),l=0;l<s;++l)for(var u=t[l],h=r[l],d=u.length,p=a[l]=new Array(d),m,y=0;y<d;++y)(m=u[y]||h[y])&&(p[y]=m);for(;l<i;++l)a[l]=t[l];return new is(a,this._parents,this._name,this._id)}function xP(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function vP(e,t,r){var i,n,s=xP(t)?Wy:In;return function(){var a=s(this,e),l=a.on;l!==i&&(n=(i=l).copy()).on(t,r),a.on=n}}function bP(e,t){var r=this._id;return arguments.length<2?cn(this.node(),r).on.on(e):this.each(vP(r,e,t))}function SP(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function wP(){return this.on("end.remove",SP(this._id))}function CP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=jy(e));for(var i=this._groups,n=i.length,s=new Array(n),a=0;a<n;++a)for(var l=i[a],u=l.length,h=s[a]=new Array(u),d,p,m=0;m<u;++m)(d=l[m])&&(p=e.call(d,d.__data__,m,l))&&("__data__"in d&&(p.__data__=d.__data__),h[m]=p,Nd(h[m],t,r,m,h,cn(d,r)));return new is(s,this._parents,t,r)}function kP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=WS(e));for(var i=this._groups,n=i.length,s=[],a=[],l=0;l<n;++l)for(var u=i[l],h=u.length,d,p=0;p<h;++p)if(d=u[p]){for(var m=e.call(d,d.__data__,p,u),y,x=cn(d,r),v=0,S=m.length;v<S;++v)(y=m[v])&&Nd(y,t,r,v,m,x);s.push(m),a.push(d)}return new is(s,a,t,r)}var TP=zc.prototype.constructor;function EP(){return new TP(this._groups,this._parents)}function BP(e,t){var r,i,n;return function(){var s=$a(this,e),a=(this.style.removeProperty(e),$a(this,e));return s===a?null:s===r&&a===i?n:n=t(r=s,i=a)}}function hw(e){return function(){this.style.removeProperty(e)}}function MP(e,t,r){var i,n=r+"",s;return function(){var a=$a(this,e);return a===n?null:a===i?s:s=t(i=a,r)}}function LP(e,t,r){var i,n,s;return function(){var a=$a(this,e),l=r(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),$a(this,e))),a===u?null:a===i&&u===n?s:(n=u,s=t(i=a,l))}}function RP(e,t){var r,i,n,s="style."+t,a="end."+s,l;return function(){var u=In(this,e),h=u.on,d=u.value[s]==null?l||(l=hw(t)):void 0;(h!==r||n!==d)&&(i=(r=h).copy()).on(a,n=d),u.on=i}}function AP(e,t,r){var i=(e+="")=="transform"?ID:cw;return t==null?this.styleTween(e,BP(e,i)).on("end.style."+e,hw(e)):typeof t=="function"?this.styleTween(e,LP(e,i,Hy(this,"style."+e,t))).each(RP(this._id,e)):this.styleTween(e,MP(e,i,t),r).on("end.style."+e,null)}function DP(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function PP(e,t,r){var i,n;function s(){var a=t.apply(this,arguments);return a!==n&&(i=(n=a)&&DP(e,a,r)),i}return s._value=t,s}function IP(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,PP(e,t,r??""))}function $P(e){return function(){this.textContent=e}}function jP(e){return function(){var t=e(this);this.textContent=t??""}}function zP(e){return this.tween("text",typeof e=="function"?jP(Hy(this,"text",e)):$P(e==null?"":e+""))}function OP(e){return function(t){this.textContent=e.call(this,t)}}function FP(e){var t,r;function i(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&OP(n)),t}return i._value=e,i}function NP(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,FP(e))}function WP(){for(var e=this._name,t=this._id,r=uw(),i=this._groups,n=i.length,s=0;s<n;++s)for(var a=i[s],l=a.length,u,h=0;h<l;++h)if(u=a[h]){var d=cn(u,t);Nd(u,e,r,h,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new is(i,this._parents,e,r)}function HP(){var e,t,r=this,i=r._id,n=r.size();return new Promise(function(s,a){var l={value:a},u={value:function(){--n===0&&s()}};r.each(function(){var h=In(this,i),d=h.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),h.on=t}),n===0&&s()})}var qP=0;function is(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function uw(){return++qP}var Xn=zc.prototype;is.prototype={constructor:is,select:CP,selectAll:kP,selectChild:Xn.selectChild,selectChildren:Xn.selectChildren,filter:yP,merge:_P,selection:EP,transition:WP,call:Xn.call,nodes:Xn.nodes,node:Xn.node,size:Xn.size,empty:Xn.empty,each:Xn.each,on:bP,attr:tP,attrTween:oP,style:AP,styleTween:IP,text:zP,textTween:NP,remove:wP,tween:YD,delay:cP,duration:dP,ease:pP,easeVarying:mP,end:HP,[Symbol.iterator]:Xn[Symbol.iterator]};function UP(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var VP={time:null,delay:0,duration:250,ease:UP};function GP(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function YP(e){var t,r;e instanceof is?(t=e._id,e=e._name):(t=uw(),(r=VP).time=Ny(),e=e==null?null:e+"");for(var i=this._groups,n=i.length,s=0;s<n;++s)for(var a=i[s],l=a.length,u,h=0;h<l;++h)(u=a[h])&&Nd(u,e,t,h,a,r||GP(u,t));return new is(i,this._parents,e,t)}zc.prototype.interrupt=UD;zc.prototype.transition=YP;const Zg=Math.PI,Jg=2*Zg,mo=1e-6,KP=Jg-mo;function dw(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function XP(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return dw;const r=10**t;return function(i){this._+=i[0];for(let n=1,s=i.length;n<s;++n)this._+=Math.round(arguments[n]*r)/r+i[n]}}class QP{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?dw:XP(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,i,n){this._append`Q${+t},${+r},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(t,r,i,n,s,a){this._append`C${+t},${+r},${+i},${+n},${this._x1=+s},${this._y1=+a}`}arcTo(t,r,i,n,s){if(t=+t,r=+r,i=+i,n=+n,s=+s,s<0)throw new Error(`negative radius: ${s}`);let a=this._x1,l=this._y1,u=i-t,h=n-r,d=a-t,p=l-r,m=d*d+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(m>mo)if(!(Math.abs(p*u-h*d)>mo)||!s)this._append`L${this._x1=t},${this._y1=r}`;else{let y=i-a,x=n-l,v=u*u+h*h,S=y*y+x*x,C=Math.sqrt(v),E=Math.sqrt(m),L=s*Math.tan((Zg-Math.acos((v+m-S)/(2*C*E)))/2),B=L/E,R=L/C;Math.abs(B-1)>mo&&this._append`L${t+B*d},${r+B*p}`,this._append`A${s},${s},0,0,${+(p*y>d*x)},${this._x1=t+R*u},${this._y1=r+R*h}`}}arc(t,r,i,n,s,a){if(t=+t,r=+r,i=+i,a=!!a,i<0)throw new Error(`negative radius: ${i}`);let l=i*Math.cos(n),u=i*Math.sin(n),h=t+l,d=r+u,p=1^a,m=a?n-s:s-n;this._x1===null?this._append`M${h},${d}`:(Math.abs(this._x1-h)>mo||Math.abs(this._y1-d)>mo)&&this._append`L${h},${d}`,i&&(m<0&&(m=m%Jg+Jg),m>KP?this._append`A${i},${i},0,1,${p},${t-l},${r-u}A${i},${i},0,1,${p},${this._x1=h},${this._y1=d}`:m>mo&&this._append`A${i},${i},0,${+(m>=Zg)},${p},${this._x1=t+i*Math.cos(s)},${this._y1=r+i*Math.sin(s)}`)}rect(t,r,i,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${i=+i}v${+n}h${-i}Z`}toString(){return this._}}function ga(e){return function(){return e}}const HU=Math.abs,qU=Math.atan2,UU=Math.cos,VU=Math.max,GU=Math.min,YU=Math.sin,KU=Math.sqrt,Jv=1e-12,qy=Math.PI,e1=qy/2,XU=2*qy;function QU(e){return e>1?0:e<-1?qy:Math.acos(e)}function ZU(e){return e>=1?e1:e<=-1?-e1:Math.asin(e)}function ZP(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const i=Math.floor(r);if(!(i>=0))throw new RangeError(`invalid digits: ${r}`);t=i}return e},()=>new QP(t)}function JP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fw(e){this._context=e}fw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function nd(e){return new fw(e)}function e4(e){return e[0]}function t4(e){return e[1]}function r4(e,t){var r=ga(!0),i=null,n=nd,s=null,a=ZP(l);e=typeof e=="function"?e:e===void 0?e4:ga(e),t=typeof t=="function"?t:t===void 0?t4:ga(t);function l(u){var h,d=(u=JP(u)).length,p,m=!1,y;for(i==null&&(s=n(y=a())),h=0;h<=d;++h)!(h<d&&r(p=u[h],h,u))===m&&((m=!m)?s.lineStart():s.lineEnd()),m&&s.point(+e(p,h,u),+t(p,h,u));if(y)return s=null,y+""||null}return l.x=function(u){return arguments.length?(e=typeof u=="function"?u:ga(+u),l):e},l.y=function(u){return arguments.length?(t=typeof u=="function"?u:ga(+u),l):t},l.defined=function(u){return arguments.length?(r=typeof u=="function"?u:ga(!!u),l):r},l.curve=function(u){return arguments.length?(n=u,i!=null&&(s=n(i)),l):n},l.context=function(u){return arguments.length?(u==null?i=s=null:s=n(i=u),l):i},l}class pw{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function gw(e){return new pw(e,!0)}function mw(e){return new pw(e,!1)}function Ws(){}function sd(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Wd(e){this._context=e}Wd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:sd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:sd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bu(e){return new Wd(e)}function yw(e){this._context=e}yw.prototype={areaStart:Ws,areaEnd:Ws,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function i4(e){return new yw(e)}function _w(e){this._context=e}_w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,i):this._context.moveTo(r,i);break;case 3:this._point=4;default:sd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function n4(e){return new _w(e)}function xw(e,t){this._basis=new Wd(e),this._beta=t}xw.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var i=e[0],n=t[0],s=e[r]-i,a=t[r]-n,l=-1,u;++l<=r;)u=l/r,this._basis.point(this._beta*e[l]+(1-this._beta)*(i+u*s),this._beta*t[l]+(1-this._beta)*(n+u*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const s4=(function e(t){function r(i){return t===1?new Wd(i):new xw(i,t)}return r.beta=function(i){return e(+i)},r})(.85);function od(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function Uy(e,t){this._context=e,this._k=(1-t)/6}Uy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:od(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:od(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const vw=(function e(t){function r(i){return new Uy(i,t)}return r.tension=function(i){return e(+i)},r})(0);function Vy(e,t){this._context=e,this._k=(1-t)/6}Vy.prototype={areaStart:Ws,areaEnd:Ws,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:od(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const o4=(function e(t){function r(i){return new Vy(i,t)}return r.tension=function(i){return e(+i)},r})(0);function Gy(e,t){this._context=e,this._k=(1-t)/6}Gy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:od(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const a4=(function e(t){function r(i){return new Gy(i,t)}return r.tension=function(i){return e(+i)},r})(0);function Yy(e,t,r){var i=e._x1,n=e._y1,s=e._x2,a=e._y2;if(e._l01_a>Jv){var l=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*l-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,n=(n*l-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>Jv){var h=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,d=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*h+e._x1*e._l23_2a-t*e._l12_2a)/d,a=(a*h+e._y1*e._l23_2a-r*e._l12_2a)/d}e._context.bezierCurveTo(i,n,s,a,e._x2,e._y2)}function bw(e,t){this._context=e,this._alpha=t}bw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Yy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Sw=(function e(t){function r(i){return t?new bw(i,t):new Uy(i,0)}return r.alpha=function(i){return e(+i)},r})(.5);function ww(e,t){this._context=e,this._alpha=t}ww.prototype={areaStart:Ws,areaEnd:Ws,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Yy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const l4=(function e(t){function r(i){return t?new ww(i,t):new Vy(i,0)}return r.alpha=function(i){return e(+i)},r})(.5);function Cw(e,t){this._context=e,this._alpha=t}Cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Yy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const c4=(function e(t){function r(i){return t?new Cw(i,t):new Gy(i,0)}return r.alpha=function(i){return e(+i)},r})(.5);function kw(e){this._context=e}kw.prototype={areaStart:Ws,areaEnd:Ws,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function h4(e){return new kw(e)}function t1(e){return e<0?-1:1}function r1(e,t,r){var i=e._x1-e._x0,n=t-e._x1,s=(e._y1-e._y0)/(i||n<0&&-0),a=(r-e._y1)/(n||i<0&&-0),l=(s*n+a*i)/(i+n);return(t1(s)+t1(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(l))||0}function i1(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function sg(e,t,r){var i=e._x0,n=e._y0,s=e._x1,a=e._y1,l=(s-i)/3;e._context.bezierCurveTo(i+l,n+l*t,s-l,a-l*r,s,a)}function ad(e){this._context=e}ad.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sg(this,this._t0,i1(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,sg(this,i1(this,r=r1(this,e,t)),r);break;default:sg(this,this._t0,r=r1(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Tw(e){this._context=new Ew(e)}(Tw.prototype=Object.create(ad.prototype)).point=function(e,t){ad.prototype.point.call(this,t,e)};function Ew(e){this._context=e}Ew.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,i,n,s){this._context.bezierCurveTo(t,e,i,r,s,n)}};function Bw(e){return new ad(e)}function Mw(e){return new Tw(e)}function Lw(e){this._context=e}Lw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var i=n1(e),n=n1(t),s=0,a=1;a<r;++s,++a)this._context.bezierCurveTo(i[0][s],n[0][s],i[1][s],n[1][s],e[a],t[a]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function n1(e){var t,r=e.length-1,i,n=new Array(r),s=new Array(r),a=new Array(r);for(n[0]=0,s[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)n[t]=1,s[t]=4,a[t]=4*e[t]+2*e[t+1];for(n[r-1]=2,s[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)i=n[t]/s[t-1],s[t]-=i,a[t]-=i*a[t-1];for(n[r-1]=a[r-1]/s[r-1],t=r-2;t>=0;--t)n[t]=(a[t]-n[t+1])/s[t];for(s[r-1]=(e[r]+n[r-1])/2,t=0;t<r-1;++t)s[t]=2*e[t+1]-n[t+1];return[n,s]}function Rw(e){return new Lw(e)}function Hd(e,t){this._context=e,this._t=t}Hd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Aw(e){return new Hd(e,.5)}function Dw(e){return new Hd(e,0)}function Pw(e){return new Hd(e,1)}function rc(e,t,r){this.k=e,this.x=t,this.y=r}rc.prototype={constructor:rc,scale:function(e){return e===1?this:new rc(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new rc(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};rc.prototype;var u4=T(e=>{var n;const{securityLevel:t}=dt();let r=nt("body");if(t==="sandbox"){const a=((n=nt(`#i${e}`).node())==null?void 0:n.contentDocument)??document;r=nt(a.body)}return r.select(`#${e}`)},"selectSvgElement");function Ky(e){return typeof e>"u"||e===null}T(Ky,"isNothing");function Iw(e){return typeof e=="object"&&e!==null}T(Iw,"isObject");function $w(e){return Array.isArray(e)?e:Ky(e)?[]:[e]}T($w,"toArray");function jw(e,t){var r,i,n,s;if(t)for(s=Object.keys(t),r=0,i=s.length;r<i;r+=1)n=s[r],e[n]=t[n];return e}T(jw,"extend");function zw(e,t){var r="",i;for(i=0;i<t;i+=1)r+=e;return r}T(zw,"repeat");function Ow(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}T(Ow,"isNegativeZero");var d4=Ky,f4=Iw,p4=$w,g4=zw,m4=Ow,y4=jw,nr={isNothing:d4,isObject:f4,toArray:p4,repeat:g4,isNegativeZero:m4,extend:y4};function Xy(e,t){var r="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
201
|
+
|
|
202
|
+
`+e.mark.snippet),i+" "+r):i}T(Xy,"formatError");function za(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Xy(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}T(za,"YAMLException$1");za.prototype=Object.create(Error.prototype);za.prototype.constructor=za;za.prototype.toString=T(function(t){return this.name+": "+Xy(this,t)},"toString");var ai=za;function Mu(e,t,r,i,n){var s="",a="",l=Math.floor(n/2)-1;return i-t>l&&(s=" ... ",t=i-l+s.length),r-i>l&&(a=" ...",r=i+l-a.length),{str:s+e.slice(t,r).replace(/\t/g,"→")+a,pos:i-t+s.length}}T(Mu,"getLine");function Lu(e,t){return nr.repeat(" ",t-e.length)+e}T(Lu,"padStart");function Fw(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],n=[],s,a=-1;s=r.exec(e.buffer);)n.push(s.index),i.push(s.index+s[0].length),e.position<=s.index&&a<0&&(a=i.length-2);a<0&&(a=i.length-1);var l="",u,h,d=Math.min(e.line+t.linesAfter,n.length).toString().length,p=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(a-u<0);u++)h=Mu(e.buffer,i[a-u],n[a-u],e.position-(i[a]-i[a-u]),p),l=nr.repeat(" ",t.indent)+Lu((e.line-u+1).toString(),d)+" | "+h.str+`
|
|
203
|
+
`+l;for(h=Mu(e.buffer,i[a],n[a],e.position,p),l+=nr.repeat(" ",t.indent)+Lu((e.line+1).toString(),d)+" | "+h.str+`
|
|
204
|
+
`,l+=nr.repeat("-",t.indent+d+3+h.pos)+`^
|
|
205
|
+
`,u=1;u<=t.linesAfter&&!(a+u>=n.length);u++)h=Mu(e.buffer,i[a+u],n[a+u],e.position-(i[a]-i[a+u]),p),l+=nr.repeat(" ",t.indent)+Lu((e.line+u+1).toString(),d)+" | "+h.str+`
|
|
206
|
+
`;return l.replace(/\n$/,"")}T(Fw,"makeSnippet");var _4=Fw,x4=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],v4=["scalar","sequence","mapping"];function Nw(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){t[String(i)]=r})}),t}T(Nw,"compileStyleAliases");function Ww(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(x4.indexOf(r)===-1)throw new ai('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Nw(t.styleAliases||null),v4.indexOf(this.kind)===-1)throw new ai('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}T(Ww,"Type$1");var Ir=Ww;function em(e,t){var r=[];return e[t].forEach(function(i){var n=r.length;r.forEach(function(s,a){s.tag===i.tag&&s.kind===i.kind&&s.multi===i.multi&&(n=a)}),r[n]=i}),r}T(em,"compileList");function Hw(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function i(n){n.multi?(e.multi[n.kind].push(n),e.multi.fallback.push(n)):e[n.kind][n.tag]=e.fallback[n.tag]=n}for(T(i,"collectType"),t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(i);return e}T(Hw,"compileMap");function ld(e){return this.extend(e)}T(ld,"Schema$1");ld.prototype.extend=T(function(t){var r=[],i=[];if(t instanceof Ir)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new ai("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ir))throw new ai("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ai("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new ai("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(s){if(!(s instanceof Ir))throw new ai("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var n=Object.create(ld.prototype);return n.implicit=(this.implicit||[]).concat(r),n.explicit=(this.explicit||[]).concat(i),n.compiledImplicit=em(n,"implicit"),n.compiledExplicit=em(n,"explicit"),n.compiledTypeMap=Hw(n.compiledImplicit,n.compiledExplicit),n},"extend");var b4=ld,S4=new Ir("tag:yaml.org,2002:str",{kind:"scalar",construct:T(function(e){return e!==null?e:""},"construct")}),w4=new Ir("tag:yaml.org,2002:seq",{kind:"sequence",construct:T(function(e){return e!==null?e:[]},"construct")}),C4=new Ir("tag:yaml.org,2002:map",{kind:"mapping",construct:T(function(e){return e!==null?e:{}},"construct")}),k4=new b4({explicit:[S4,w4,C4]});function qw(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}T(qw,"resolveYamlNull");function Uw(){return null}T(Uw,"constructYamlNull");function Vw(e){return e===null}T(Vw,"isNull");var T4=new Ir("tag:yaml.org,2002:null",{kind:"scalar",resolve:qw,construct:Uw,predicate:Vw,represent:{canonical:T(function(){return"~"},"canonical"),lowercase:T(function(){return"null"},"lowercase"),uppercase:T(function(){return"NULL"},"uppercase"),camelcase:T(function(){return"Null"},"camelcase"),empty:T(function(){return""},"empty")},defaultStyle:"lowercase"});function Gw(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}T(Gw,"resolveYamlBoolean");function Yw(e){return e==="true"||e==="True"||e==="TRUE"}T(Yw,"constructYamlBoolean");function Kw(e){return Object.prototype.toString.call(e)==="[object Boolean]"}T(Kw,"isBoolean");var E4=new Ir("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Gw,construct:Yw,predicate:Kw,represent:{lowercase:T(function(e){return e?"true":"false"},"lowercase"),uppercase:T(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:T(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function Xw(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}T(Xw,"isHexCode");function Qw(e){return 48<=e&&e<=55}T(Qw,"isOctCode");function Zw(e){return 48<=e&&e<=57}T(Zw,"isDecCode");function Jw(e){if(e===null)return!1;var t=e.length,r=0,i=!1,n;if(!t)return!1;if(n=e[r],(n==="-"||n==="+")&&(n=e[++r]),n==="0"){if(r+1===t)return!0;if(n=e[++r],n==="b"){for(r++;r<t;r++)if(n=e[r],n!=="_"){if(n!=="0"&&n!=="1")return!1;i=!0}return i&&n!=="_"}if(n==="x"){for(r++;r<t;r++)if(n=e[r],n!=="_"){if(!Xw(e.charCodeAt(r)))return!1;i=!0}return i&&n!=="_"}if(n==="o"){for(r++;r<t;r++)if(n=e[r],n!=="_"){if(!Qw(e.charCodeAt(r)))return!1;i=!0}return i&&n!=="_"}}if(n==="_")return!1;for(;r<t;r++)if(n=e[r],n!=="_"){if(!Zw(e.charCodeAt(r)))return!1;i=!0}return!(!i||n==="_")}T(Jw,"resolveYamlInteger");function eC(e){var t=e,r=1,i;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),i=t[0],(i==="-"||i==="+")&&(i==="-"&&(r=-1),t=t.slice(1),i=t[0]),t==="0")return 0;if(i==="0"){if(t[1]==="b")return r*parseInt(t.slice(2),2);if(t[1]==="x")return r*parseInt(t.slice(2),16);if(t[1]==="o")return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}T(eC,"constructYamlInteger");function tC(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!nr.isNegativeZero(e)}T(tC,"isInteger");var B4=new Ir("tag:yaml.org,2002:int",{kind:"scalar",resolve:Jw,construct:eC,predicate:tC,represent:{binary:T(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:T(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:T(function(e){return e.toString(10)},"decimal"),hexadecimal:T(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),M4=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function rC(e){return!(e===null||!M4.test(e)||e[e.length-1]==="_")}T(rC,"resolveYamlFloat");function iC(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}T(iC,"constructYamlFloat");var L4=/^[-+]?[0-9]+e/;function nC(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(nr.isNegativeZero(e))return"-0.0";return r=e.toString(10),L4.test(r)?r.replace("e",".e"):r}T(nC,"representYamlFloat");function sC(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||nr.isNegativeZero(e))}T(sC,"isFloat");var R4=new Ir("tag:yaml.org,2002:float",{kind:"scalar",resolve:rC,construct:iC,predicate:sC,represent:nC,defaultStyle:"lowercase"}),oC=k4.extend({implicit:[T4,E4,B4,R4]}),A4=oC,aC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),lC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function cC(e){return e===null?!1:aC.exec(e)!==null||lC.exec(e)!==null}T(cC,"resolveYamlTimestamp");function hC(e){var t,r,i,n,s,a,l,u=0,h=null,d,p,m;if(t=aC.exec(e),t===null&&(t=lC.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],i=+t[2]-1,n=+t[3],!t[4])return new Date(Date.UTC(r,i,n));if(s=+t[4],a=+t[5],l=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(d=+t[10],p=+(t[11]||0),h=(d*60+p)*6e4,t[9]==="-"&&(h=-h)),m=new Date(Date.UTC(r,i,n,s,a,l,u)),h&&m.setTime(m.getTime()-h),m}T(hC,"constructYamlTimestamp");function uC(e){return e.toISOString()}T(uC,"representYamlTimestamp");var D4=new Ir("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:cC,construct:hC,instanceOf:Date,represent:uC});function dC(e){return e==="<<"||e===null}T(dC,"resolveYamlMerge");var P4=new Ir("tag:yaml.org,2002:merge",{kind:"scalar",resolve:dC}),Qy=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
207
|
+
\r`;function fC(e){if(e===null)return!1;var t,r,i=0,n=e.length,s=Qy;for(r=0;r<n;r++)if(t=s.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;i+=6}return i%8===0}T(fC,"resolveYamlBinary");function pC(e){var t,r,i=e.replace(/[\r\n=]/g,""),n=i.length,s=Qy,a=0,l=[];for(t=0;t<n;t++)t%4===0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|s.indexOf(i.charAt(t));return r=n%4*6,r===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):r===18?(l.push(a>>10&255),l.push(a>>2&255)):r===12&&l.push(a>>4&255),new Uint8Array(l)}T(pC,"constructYamlBinary");function gC(e){var t="",r=0,i,n,s=e.length,a=Qy;for(i=0;i<s;i++)i%3===0&&i&&(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]),r=(r<<8)+e[i];return n=s%3,n===0?(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]):n===2?(t+=a[r>>10&63],t+=a[r>>4&63],t+=a[r<<2&63],t+=a[64]):n===1&&(t+=a[r>>2&63],t+=a[r<<4&63],t+=a[64],t+=a[64]),t}T(gC,"representYamlBinary");function mC(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}T(mC,"isBinary");var I4=new Ir("tag:yaml.org,2002:binary",{kind:"scalar",resolve:fC,construct:pC,predicate:mC,represent:gC}),$4=Object.prototype.hasOwnProperty,j4=Object.prototype.toString;function yC(e){if(e===null)return!0;var t=[],r,i,n,s,a,l=e;for(r=0,i=l.length;r<i;r+=1){if(n=l[r],a=!1,j4.call(n)!=="[object Object]")return!1;for(s in n)if($4.call(n,s))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}T(yC,"resolveYamlOmap");function _C(e){return e!==null?e:[]}T(_C,"constructYamlOmap");var z4=new Ir("tag:yaml.org,2002:omap",{kind:"sequence",resolve:yC,construct:_C}),O4=Object.prototype.toString;function xC(e){if(e===null)return!0;var t,r,i,n,s,a=e;for(s=new Array(a.length),t=0,r=a.length;t<r;t+=1){if(i=a[t],O4.call(i)!=="[object Object]"||(n=Object.keys(i),n.length!==1))return!1;s[t]=[n[0],i[n[0]]]}return!0}T(xC,"resolveYamlPairs");function vC(e){if(e===null)return[];var t,r,i,n,s,a=e;for(s=new Array(a.length),t=0,r=a.length;t<r;t+=1)i=a[t],n=Object.keys(i),s[t]=[n[0],i[n[0]]];return s}T(vC,"constructYamlPairs");var F4=new Ir("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:xC,construct:vC}),N4=Object.prototype.hasOwnProperty;function bC(e){if(e===null)return!0;var t,r=e;for(t in r)if(N4.call(r,t)&&r[t]!==null)return!1;return!0}T(bC,"resolveYamlSet");function SC(e){return e!==null?e:{}}T(SC,"constructYamlSet");var W4=new Ir("tag:yaml.org,2002:set",{kind:"mapping",resolve:bC,construct:SC}),wC=A4.extend({implicit:[D4,P4],explicit:[I4,z4,F4,W4]}),Hs=Object.prototype.hasOwnProperty,cd=1,CC=2,kC=3,hd=4,og=1,H4=2,s1=3,q4=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,U4=/[\x85\u2028\u2029]/,V4=/[,\[\]\{\}]/,TC=/^(?:!|!!|![a-z\-]+!)$/i,EC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function tm(e){return Object.prototype.toString.call(e)}T(tm,"_class");function on(e){return e===10||e===13}T(on,"is_EOL");function Fs(e){return e===9||e===32}T(Fs,"is_WHITE_SPACE");function Vr(e){return e===9||e===32||e===10||e===13}T(Vr,"is_WS_OR_EOL");function wo(e){return e===44||e===91||e===93||e===123||e===125}T(wo,"is_FLOW_INDICATOR");function BC(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}T(BC,"fromHexCode");function MC(e){return e===120?2:e===117?4:e===85?8:0}T(MC,"escapedHexLen");function LC(e){return 48<=e&&e<=57?e-48:-1}T(LC,"fromDecimalCode");function rm(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
208
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}T(rm,"simpleEscapeSequence");function RC(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}T(RC,"charFromCodepoint");var AC=new Array(256),DC=new Array(256);for(po=0;po<256;po++)AC[po]=rm(po)?1:0,DC[po]=rm(po);var po;function PC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}T(PC,"State$1");function Zy(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=_4(r),new ai(t,r)}T(Zy,"generateError");function ze(e,t){throw Zy(e,t)}T(ze,"throwError");function wc(e,t){e.onWarning&&e.onWarning.call(null,Zy(e,t))}T(wc,"throwWarning");var o1={YAML:T(function(t,r,i){var n,s,a;t.version!==null&&ze(t,"duplication of %YAML directive"),i.length!==1&&ze(t,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&ze(t,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),a=parseInt(n[2],10),s!==1&&ze(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&wc(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:T(function(t,r,i){var n,s;i.length!==2&&ze(t,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],TC.test(n)||ze(t,"ill-formed tag handle (first argument) of the TAG directive"),Hs.call(t.tagMap,n)&&ze(t,'there is a previously declared suffix for "'+n+'" tag handle'),EC.test(s)||ze(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ze(t,"tag prefix is malformed: "+s)}t.tagMap[n]=s},"handleTagDirective")};function rs(e,t,r,i){var n,s,a,l;if(t<r){if(l=e.input.slice(t,r),i)for(n=0,s=l.length;n<s;n+=1)a=l.charCodeAt(n),a===9||32<=a&&a<=1114111||ze(e,"expected valid JSON character");else q4.test(l)&&ze(e,"the stream contains non-printable characters");e.result+=l}}T(rs,"captureSegment");function im(e,t,r,i){var n,s,a,l;for(nr.isObject(r)||ze(e,"cannot merge mappings; the provided source object is unacceptable"),n=Object.keys(r),a=0,l=n.length;a<l;a+=1)s=n[a],Hs.call(t,s)||(t[s]=r[s],i[s]=!0)}T(im,"mergeMappings");function Co(e,t,r,i,n,s,a,l,u){var h,d;if(Array.isArray(n))for(n=Array.prototype.slice.call(n),h=0,d=n.length;h<d;h+=1)Array.isArray(n[h])&&ze(e,"nested arrays are not supported inside keys"),typeof n=="object"&&tm(n[h])==="[object Object]"&&(n[h]="[object Object]");if(typeof n=="object"&&tm(n)==="[object Object]"&&(n="[object Object]"),n=String(n),t===null&&(t={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(h=0,d=s.length;h<d;h+=1)im(e,t,s[h],r);else im(e,t,s,r);else!e.json&&!Hs.call(r,n)&&Hs.call(t,n)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,ze(e,"duplicated mapping key")),n==="__proto__"?Object.defineProperty(t,n,{configurable:!0,enumerable:!0,writable:!0,value:s}):t[n]=s,delete r[n];return t}T(Co,"storeMappingPair");function qd(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):ze(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}T(qd,"readLineBreak");function Ht(e,t,r){for(var i=0,n=e.input.charCodeAt(e.position);n!==0;){for(;Fs(n);)n===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),n=e.input.charCodeAt(++e.position);if(t&&n===35)do n=e.input.charCodeAt(++e.position);while(n!==10&&n!==13&&n!==0);if(on(n))for(qd(e),n=e.input.charCodeAt(e.position),i++,e.lineIndent=0;n===32;)e.lineIndent++,n=e.input.charCodeAt(++e.position);else break}return r!==-1&&i!==0&&e.lineIndent<r&&wc(e,"deficient indentation"),i}T(Ht,"skipSeparationSpace");function Fc(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||Vr(r)))}T(Fc,"testDocumentSeparator");function Ud(e,t){t===1?e.result+=" ":t>1&&(e.result+=nr.repeat(`
|
|
209
|
+
`,t-1))}T(Ud,"writeFoldedLines");function IC(e,t,r){var i,n,s,a,l,u,h,d,p=e.kind,m=e.result,y;if(y=e.input.charCodeAt(e.position),Vr(y)||wo(y)||y===35||y===38||y===42||y===33||y===124||y===62||y===39||y===34||y===37||y===64||y===96||(y===63||y===45)&&(n=e.input.charCodeAt(e.position+1),Vr(n)||r&&wo(n)))return!1;for(e.kind="scalar",e.result="",s=a=e.position,l=!1;y!==0;){if(y===58){if(n=e.input.charCodeAt(e.position+1),Vr(n)||r&&wo(n))break}else if(y===35){if(i=e.input.charCodeAt(e.position-1),Vr(i))break}else{if(e.position===e.lineStart&&Fc(e)||r&&wo(y))break;if(on(y))if(u=e.line,h=e.lineStart,d=e.lineIndent,Ht(e,!1,-1),e.lineIndent>=t){l=!0,y=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=u,e.lineStart=h,e.lineIndent=d;break}}l&&(rs(e,s,a,!1),Ud(e,e.line-u),s=a=e.position,l=!1),Fs(y)||(a=e.position+1),y=e.input.charCodeAt(++e.position)}return rs(e,s,a,!1),e.result?!0:(e.kind=p,e.result=m,!1)}T(IC,"readPlainScalar");function $C(e,t){var r,i,n;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(rs(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,n=e.position;else return!0;else on(r)?(rs(e,i,n,!0),Ud(e,Ht(e,!1,t)),i=n=e.position):e.position===e.lineStart&&Fc(e)?ze(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);ze(e,"unexpected end of the stream within a single quoted scalar")}T($C,"readSingleQuotedScalar");function jC(e,t){var r,i,n,s,a,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return rs(e,r,e.position,!0),e.position++,!0;if(l===92){if(rs(e,r,e.position,!0),l=e.input.charCodeAt(++e.position),on(l))Ht(e,!1,t);else if(l<256&&AC[l])e.result+=DC[l],e.position++;else if((a=MC(l))>0){for(n=a,s=0;n>0;n--)l=e.input.charCodeAt(++e.position),(a=BC(l))>=0?s=(s<<4)+a:ze(e,"expected hexadecimal character");e.result+=RC(s),e.position++}else ze(e,"unknown escape sequence");r=i=e.position}else on(l)?(rs(e,r,i,!0),Ud(e,Ht(e,!1,t)),r=i=e.position):e.position===e.lineStart&&Fc(e)?ze(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ze(e,"unexpected end of the stream within a double quoted scalar")}T(jC,"readDoubleQuotedScalar");function zC(e,t){var r=!0,i,n,s,a=e.tag,l,u=e.anchor,h,d,p,m,y,x=Object.create(null),v,S,C,E;if(E=e.input.charCodeAt(e.position),E===91)d=93,y=!1,l=[];else if(E===123)d=125,y=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),E=e.input.charCodeAt(++e.position);E!==0;){if(Ht(e,!0,t),E=e.input.charCodeAt(e.position),E===d)return e.position++,e.tag=a,e.anchor=u,e.kind=y?"mapping":"sequence",e.result=l,!0;r?E===44&&ze(e,"expected the node content, but found ','"):ze(e,"missed comma between flow collection entries"),S=v=C=null,p=m=!1,E===63&&(h=e.input.charCodeAt(e.position+1),Vr(h)&&(p=m=!0,e.position++,Ht(e,!0,t))),i=e.line,n=e.lineStart,s=e.position,Po(e,t,cd,!1,!0),S=e.tag,v=e.result,Ht(e,!0,t),E=e.input.charCodeAt(e.position),(m||e.line===i)&&E===58&&(p=!0,E=e.input.charCodeAt(++e.position),Ht(e,!0,t),Po(e,t,cd,!1,!0),C=e.result),y?Co(e,l,x,S,v,C,i,n,s):p?l.push(Co(e,null,x,S,v,C,i,n,s)):l.push(v),Ht(e,!0,t),E=e.input.charCodeAt(e.position),E===44?(r=!0,E=e.input.charCodeAt(++e.position)):r=!1}ze(e,"unexpected end of the stream within a flow collection")}T(zC,"readFlowCollection");function OC(e,t){var r,i,n=og,s=!1,a=!1,l=t,u=0,h=!1,d,p;if(p=e.input.charCodeAt(e.position),p===124)i=!1;else if(p===62)i=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)og===n?n=p===43?s1:H4:ze(e,"repeat of a chomping mode identifier");else if((d=LC(p))>=0)d===0?ze(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?ze(e,"repeat of an indentation width identifier"):(l=t+d-1,a=!0);else break;if(Fs(p)){do p=e.input.charCodeAt(++e.position);while(Fs(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!on(p)&&p!==0)}for(;p!==0;){for(qd(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),on(p)){u++;continue}if(e.lineIndent<l){n===s1?e.result+=nr.repeat(`
|
|
210
|
+
`,s?1+u:u):n===og&&s&&(e.result+=`
|
|
211
|
+
`);break}for(i?Fs(p)?(h=!0,e.result+=nr.repeat(`
|
|
212
|
+
`,s?1+u:u)):h?(h=!1,e.result+=nr.repeat(`
|
|
213
|
+
`,u+1)):u===0?s&&(e.result+=" "):e.result+=nr.repeat(`
|
|
214
|
+
`,u):e.result+=nr.repeat(`
|
|
215
|
+
`,s?1+u:u),s=!0,a=!0,u=0,r=e.position;!on(p)&&p!==0;)p=e.input.charCodeAt(++e.position);rs(e,r,e.position,!1)}return!0}T(OC,"readBlockScalar");function nm(e,t){var r,i=e.tag,n=e.anchor,s=[],a,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ze(e,"tab characters must not be used in indentation")),!(u!==45||(a=e.input.charCodeAt(e.position+1),!Vr(a))));){if(l=!0,e.position++,Ht(e,!0,-1)&&e.lineIndent<=t){s.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,Po(e,t,kC,!1,!0),s.push(e.result),Ht(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&u!==0)ze(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=i,e.anchor=n,e.kind="sequence",e.result=s,!0):!1}T(nm,"readBlockSequence");function FC(e,t,r){var i,n,s,a,l,u,h=e.tag,d=e.anchor,p={},m=Object.create(null),y=null,x=null,v=null,S=!1,C=!1,E;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),E=e.input.charCodeAt(e.position);E!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ze(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),s=e.line,(E===63||E===58)&&Vr(i))E===63?(S&&(Co(e,p,m,y,x,null,a,l,u),y=x=v=null),C=!0,S=!0,n=!0):S?(S=!1,n=!0):ze(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,E=i;else{if(a=e.line,l=e.lineStart,u=e.position,!Po(e,r,CC,!1,!0))break;if(e.line===s){for(E=e.input.charCodeAt(e.position);Fs(E);)E=e.input.charCodeAt(++e.position);if(E===58)E=e.input.charCodeAt(++e.position),Vr(E)||ze(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(Co(e,p,m,y,x,null,a,l,u),y=x=v=null),C=!0,S=!1,n=!1,y=e.tag,x=e.result;else if(C)ze(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=h,e.anchor=d,!0}else if(C)ze(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=h,e.anchor=d,!0}if((e.line===s||e.lineIndent>t)&&(S&&(a=e.line,l=e.lineStart,u=e.position),Po(e,t,hd,!0,n)&&(S?x=e.result:v=e.result),S||(Co(e,p,m,y,x,v,a,l,u),y=x=v=null),Ht(e,!0,-1),E=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&E!==0)ze(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return S&&Co(e,p,m,y,x,null,a,l,u),C&&(e.tag=h,e.anchor=d,e.kind="mapping",e.result=p),C}T(FC,"readBlockMapping");function NC(e){var t,r=!1,i=!1,n,s,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&ze(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(i=!0,n="!!",a=e.input.charCodeAt(++e.position)):n="!",t=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(s=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):ze(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Vr(a);)a===33&&(i?ze(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),TC.test(n)||ze(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),V4.test(s)&&ze(e,"tag suffix cannot contain flow indicator characters")}s&&!EC.test(s)&&ze(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ze(e,"tag name is malformed: "+s)}return r?e.tag=s:Hs.call(e.tagMap,n)?e.tag=e.tagMap[n]+s:n==="!"?e.tag="!"+s:n==="!!"?e.tag="tag:yaml.org,2002:"+s:ze(e,'undeclared tag handle "'+n+'"'),!0}T(NC,"readTagProperty");function WC(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&ze(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Vr(r)&&!wo(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ze(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}T(WC,"readAnchorProperty");function HC(e){var t,r,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!Vr(i)&&!wo(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&ze(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),Hs.call(e.anchorMap,r)||ze(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],Ht(e,!0,-1),!0}T(HC,"readAlias");function Po(e,t,r,i,n){var s,a,l,u=1,h=!1,d=!1,p,m,y,x,v,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=a=l=hd===r||kC===r,i&&Ht(e,!0,-1)&&(h=!0,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)),u===1)for(;NC(e)||WC(e);)Ht(e,!0,-1)?(h=!0,l=s,e.lineIndent>t?u=1:e.lineIndent===t?u=0:e.lineIndent<t&&(u=-1)):l=!1;if(l&&(l=h||n),(u===1||hd===r)&&(cd===r||CC===r?v=t:v=t+1,S=e.position-e.lineStart,u===1?l&&(nm(e,S)||FC(e,S,v))||zC(e,v)?d=!0:(a&&OC(e,v)||$C(e,v)||jC(e,v)?d=!0:HC(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&ze(e,"alias node should not have any properties")):IC(e,v,cd===r)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(d=l&&nm(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ze(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,m=e.implicitTypes.length;p<m;p+=1)if(x=e.implicitTypes[p],x.resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Hs.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,y=e.typeMap.multi[e.kind||"fallback"],p=0,m=y.length;p<m;p+=1)if(e.tag.slice(0,y[p].tag.length)===y[p].tag){x=y[p];break}x||ze(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&ze(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result,e.tag)?(e.result=x.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ze(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}T(Po,"composeNode");function qC(e){var t=e.position,r,i,n,s=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(Ht(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(s=!0,a=e.input.charCodeAt(++e.position),r=e.position;a!==0&&!Vr(a);)a=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),n=[],i.length<1&&ze(e,"directive name must not be less than one character in length");a!==0;){for(;Fs(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!on(a));break}if(on(a))break;for(r=e.position;a!==0&&!Vr(a);)a=e.input.charCodeAt(++e.position);n.push(e.input.slice(r,e.position))}a!==0&&qd(e),Hs.call(o1,i)?o1[i](e,i,n):wc(e,'unknown document directive "'+i+'"')}if(Ht(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Ht(e,!0,-1)):s&&ze(e,"directives end mark is expected"),Po(e,e.lineIndent-1,hd,!1,!0),Ht(e,!0,-1),e.checkLineBreaks&&U4.test(e.input.slice(t,e.position))&&wc(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Fc(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Ht(e,!0,-1));return}if(e.position<e.length-1)ze(e,"end of the stream or a document separator is expected");else return}T(qC,"readDocument");function Jy(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
216
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new PC(e,t),i=e.indexOf("\0");for(i!==-1&&(r.position=i,ze(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)qC(r);return r.documents}T(Jy,"loadDocuments");function G4(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var i=Jy(e,r);if(typeof t!="function")return i;for(var n=0,s=i.length;n<s;n+=1)t(i[n])}T(G4,"loadAll$1");function UC(e,t){var r=Jy(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new ai("expected a single document in the stream, but found more")}}T(UC,"load$1");var Y4=UC,K4={load:Y4},VC=Object.prototype.toString,GC=Object.prototype.hasOwnProperty,e0=65279,X4=9,Cc=10,Q4=13,Z4=32,J4=33,eI=34,sm=35,tI=37,rI=38,iI=39,nI=42,YC=44,sI=45,ud=58,oI=61,aI=62,lI=63,cI=64,KC=91,XC=93,hI=96,QC=123,uI=124,ZC=125,jr={};jr[0]="\\0";jr[7]="\\a";jr[8]="\\b";jr[9]="\\t";jr[10]="\\n";jr[11]="\\v";jr[12]="\\f";jr[13]="\\r";jr[27]="\\e";jr[34]='\\"';jr[92]="\\\\";jr[133]="\\N";jr[160]="\\_";jr[8232]="\\L";jr[8233]="\\P";var dI=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],fI=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function JC(e,t){var r,i,n,s,a,l,u;if(t===null)return{};for(r={},i=Object.keys(t),n=0,s=i.length;n<s;n+=1)a=i[n],l=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),u=e.compiledTypeMap.fallback[a],u&&GC.call(u.styleAliases,l)&&(l=u.styleAliases[l]),r[a]=l;return r}T(JC,"compileStyleMap");function ek(e){var t,r,i;if(t=e.toString(16).toUpperCase(),e<=255)r="x",i=2;else if(e<=65535)r="u",i=4;else if(e<=4294967295)r="U",i=8;else throw new ai("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+nr.repeat("0",i-t.length)+t}T(ek,"encodeHex");var pI=1,kc=2;function tk(e){this.schema=e.schema||wC,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=nr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=JC(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?kc:pI,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}T(tk,"State");function om(e,t){for(var r=nr.repeat(" ",t),i=0,n=-1,s="",a,l=e.length;i<l;)n=e.indexOf(`
|
|
217
|
+
`,i),n===-1?(a=e.slice(i),i=l):(a=e.slice(i,n+1),i=n+1),a.length&&a!==`
|
|
218
|
+
`&&(s+=r),s+=a;return s}T(om,"indentString");function dd(e,t){return`
|
|
219
|
+
`+nr.repeat(" ",e.indent*t)}T(dd,"generateNextLine");function rk(e,t){var r,i,n;for(r=0,i=e.implicitTypes.length;r<i;r+=1)if(n=e.implicitTypes[r],n.resolve(t))return!0;return!1}T(rk,"testImplicitResolving");function Tc(e){return e===Z4||e===X4}T(Tc,"isWhitespace");function Oa(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==e0||65536<=e&&e<=1114111}T(Oa,"isPrintable");function am(e){return Oa(e)&&e!==e0&&e!==Q4&&e!==Cc}T(am,"isNsCharOrWhitespace");function lm(e,t,r){var i=am(e),n=i&&!Tc(e);return(r?i:i&&e!==YC&&e!==KC&&e!==XC&&e!==QC&&e!==ZC)&&e!==sm&&!(t===ud&&!n)||am(t)&&!Tc(t)&&e===sm||t===ud&&n}T(lm,"isPlainSafe");function ik(e){return Oa(e)&&e!==e0&&!Tc(e)&&e!==sI&&e!==lI&&e!==ud&&e!==YC&&e!==KC&&e!==XC&&e!==QC&&e!==ZC&&e!==sm&&e!==rI&&e!==nI&&e!==J4&&e!==uI&&e!==oI&&e!==aI&&e!==iI&&e!==eI&&e!==tI&&e!==cI&&e!==hI}T(ik,"isPlainSafeFirst");function nk(e){return!Tc(e)&&e!==ud}T(nk,"isPlainSafeLast");function ba(e,t){var r=e.charCodeAt(t),i;return r>=55296&&r<=56319&&t+1<e.length&&(i=e.charCodeAt(t+1),i>=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}T(ba,"codePointAt");function t0(e){var t=/^\n* /;return t.test(e)}T(t0,"needIndentIndicator");var sk=1,cm=2,ok=3,ak=4,xa=5;function lk(e,t,r,i,n,s,a,l){var u,h=0,d=null,p=!1,m=!1,y=i!==-1,x=-1,v=ik(ba(e,0))&&nk(ba(e,e.length-1));if(t||a)for(u=0;u<e.length;h>=65536?u+=2:u++){if(h=ba(e,u),!Oa(h))return xa;v=v&&lm(h,d,l),d=h}else{for(u=0;u<e.length;h>=65536?u+=2:u++){if(h=ba(e,u),h===Cc)p=!0,y&&(m=m||u-x-1>i&&e[x+1]!==" ",x=u);else if(!Oa(h))return xa;v=v&&lm(h,d,l),d=h}m=m||y&&u-x-1>i&&e[x+1]!==" "}return!p&&!m?v&&!a&&!n(e)?sk:s===kc?xa:cm:r>9&&t0(e)?xa:a?s===kc?xa:cm:m?ak:ok}T(lk,"chooseScalarStyle");function ck(e,t,r,i,n){e.dump=(function(){if(t.length===0)return e.quotingType===kc?'""':"''";if(!e.noCompatMode&&(dI.indexOf(t)!==-1||fI.test(t)))return e.quotingType===kc?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),l=i||e.flowLevel>-1&&r>=e.flowLevel;function u(h){return rk(e,h)}switch(T(u,"testAmbiguity"),lk(t,l,e.indent,a,u,e.quotingType,e.forceQuotes&&!i,n)){case sk:return t;case cm:return"'"+t.replace(/'/g,"''")+"'";case ok:return"|"+hm(t,e.indent)+um(om(t,s));case ak:return">"+hm(t,e.indent)+um(om(hk(t,a),s));case xa:return'"'+uk(t)+'"';default:throw new ai("impossible error: invalid scalar style")}})()}T(ck,"writeScalar");function hm(e,t){var r=t0(e)?String(t):"",i=e[e.length-1]===`
|
|
220
|
+
`,n=i&&(e[e.length-2]===`
|
|
221
|
+
`||e===`
|
|
222
|
+
`),s=n?"+":i?"":"-";return r+s+`
|
|
223
|
+
`}T(hm,"blockHeader");function um(e){return e[e.length-1]===`
|
|
224
|
+
`?e.slice(0,-1):e}T(um,"dropEndingNewline");function hk(e,t){for(var r=/(\n+)([^\n]*)/g,i=(function(){var h=e.indexOf(`
|
|
225
|
+
`);return h=h!==-1?h:e.length,r.lastIndex=h,dm(e.slice(0,h),t)})(),n=e[0]===`
|
|
226
|
+
`||e[0]===" ",s,a;a=r.exec(e);){var l=a[1],u=a[2];s=u[0]===" ",i+=l+(!n&&!s&&u!==""?`
|
|
227
|
+
`:"")+dm(u,t),n=s}return i}T(hk,"foldString");function dm(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,n=0,s,a=0,l=0,u="";i=r.exec(e);)l=i.index,l-n>t&&(s=a>n?a:l,u+=`
|
|
228
|
+
`+e.slice(n,s),n=s+1),a=l;return u+=`
|
|
229
|
+
`,e.length-n>t&&a>n?u+=e.slice(n,a)+`
|
|
230
|
+
`+e.slice(a+1):u+=e.slice(n),u.slice(1)}T(dm,"foldLine");function uk(e){for(var t="",r=0,i,n=0;n<e.length;r>=65536?n+=2:n++)r=ba(e,n),i=jr[r],!i&&Oa(r)?(t+=e[n],r>=65536&&(t+=e[n+1])):t+=i||ek(r);return t}T(uk,"escapeString");function dk(e,t,r){var i="",n=e.tag,s,a,l;for(s=0,a=r.length;s<a;s+=1)l=r[s],e.replacer&&(l=e.replacer.call(r,String(s),l)),(Dn(e,t,l,!1,!1)||typeof l>"u"&&Dn(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=n,e.dump="["+i+"]"}T(dk,"writeFlowSequence");function fm(e,t,r,i){var n="",s=e.tag,a,l,u;for(a=0,l=r.length;a<l;a+=1)u=r[a],e.replacer&&(u=e.replacer.call(r,String(a),u)),(Dn(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&Dn(e,t+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=dd(e,t)),e.dump&&Cc===e.dump.charCodeAt(0)?n+="-":n+="- ",n+=e.dump);e.tag=s,e.dump=n||"[]"}T(fm,"writeBlockSequence");function fk(e,t,r){var i="",n=e.tag,s=Object.keys(r),a,l,u,h,d;for(a=0,l=s.length;a<l;a+=1)d="",i!==""&&(d+=", "),e.condenseFlow&&(d+='"'),u=s[a],h=r[u],e.replacer&&(h=e.replacer.call(r,u,h)),Dn(e,t,u,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Dn(e,t,h,!1,!1)&&(d+=e.dump,i+=d));e.tag=n,e.dump="{"+i+"}"}T(fk,"writeFlowMapping");function pk(e,t,r,i){var n="",s=e.tag,a=Object.keys(r),l,u,h,d,p,m;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new ai("sortKeys must be a boolean or a function");for(l=0,u=a.length;l<u;l+=1)m="",(!i||n!=="")&&(m+=dd(e,t)),h=a[l],d=r[h],e.replacer&&(d=e.replacer.call(r,h,d)),Dn(e,t+1,h,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&Cc===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,p&&(m+=dd(e,t)),Dn(e,t+1,d,!0,p)&&(e.dump&&Cc===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,n+=m));e.tag=s,e.dump=n||"{}"}T(pk,"writeBlockMapping");function pm(e,t,r){var i,n,s,a,l,u;for(n=r?e.explicitTypes:e.implicitTypes,s=0,a=n.length;s<a;s+=1)if(l=n[s],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(r?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(u=e.styleMap[l.tag]||l.defaultStyle,VC.call(l.represent)==="[object Function]")i=l.represent(t,u);else if(GC.call(l.represent,u))i=l.represent[u](t,u);else throw new ai("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=i}return!0}return!1}T(pm,"detectType");function Dn(e,t,r,i,n,s,a){e.tag=null,e.dump=r,pm(e,r,!1)||pm(e,r,!0);var l=VC.call(e.dump),u=i,h;i&&(i=e.flowLevel<0||e.flowLevel>t);var d=l==="[object Object]"||l==="[object Array]",p,m;if(d&&(p=e.duplicates.indexOf(r),m=p!==-1),(e.tag!==null&&e.tag!=="?"||m||e.indent!==2&&t>0)&&(n=!1),m&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&m&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(pk(e,t,e.dump,n),m&&(e.dump="&ref_"+p+e.dump)):(fk(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?fm(e,t-1,e.dump,n):fm(e,t,e.dump,n),m&&(e.dump="&ref_"+p+e.dump)):(dk(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&ck(e,e.dump,t,s,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ai("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(h=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?h="!"+h:h.slice(0,18)==="tag:yaml.org,2002:"?h="!!"+h.slice(18):h="!<"+h+">",e.dump=h+" "+e.dump)}return!0}T(Dn,"writeNode");function gk(e,t){var r=[],i=[],n,s;for(fd(e,r,i),n=0,s=i.length;n<s;n+=1)t.duplicates.push(r[i[n]]);t.usedDuplicates=new Array(s)}T(gk,"getDuplicateReferences");function fd(e,t,r){var i,n,s;if(e!==null&&typeof e=="object")if(n=t.indexOf(e),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(t.push(e),Array.isArray(e))for(n=0,s=e.length;n<s;n+=1)fd(e[n],t,r);else for(i=Object.keys(e),n=0,s=i.length;n<s;n+=1)fd(e[i[n]],t,r)}T(fd,"inspectNode");function gI(e,t){t=t||{};var r=new tk(t);r.noRefs||gk(e,r);var i=e;return r.replacer&&(i=r.replacer.call({"":i},"",i)),Dn(r,0,i,!0,!0)?r.dump+`
|
|
231
|
+
`:""}T(gI,"dump$1");function mI(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}T(mI,"renamed");var yI=oC,_I=K4.load;/*! Bundled license information:
|
|
232
|
+
|
|
233
|
+
js-yaml/dist/js-yaml.mjs:
|
|
234
|
+
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
235
|
+
*/var Dr={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4},a1={arrow_point:9,arrow_cross:12.5,arrow_circle:12.5};function ic(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=Lt(e),t=Lt(t);const[r,i]=[e.x,e.y],[n,s]=[t.x,t.y],a=n-r,l=s-i;return{angle:Math.atan(l/a),deltaX:a,deltaY:l}}T(ic,"calculateDeltaAndAngle");var Lt=T(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),xI=T(e=>({x:T(function(t,r,i){let n=0;const s=Lt(i[0]).x<Lt(i[i.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Dr,e.arrowTypeStart)){const{angle:y,deltaX:x}=ic(i[0],i[1]);n=Dr[e.arrowTypeStart]*Math.cos(y)*(x>=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(Dr,e.arrowTypeEnd)){const{angle:y,deltaX:x}=ic(i[i.length-1],i[i.length-2]);n=Dr[e.arrowTypeEnd]*Math.cos(y)*(x>=0?1:-1)}const a=Math.abs(Lt(t).x-Lt(i[i.length-1]).x),l=Math.abs(Lt(t).y-Lt(i[i.length-1]).y),u=Math.abs(Lt(t).x-Lt(i[0]).x),h=Math.abs(Lt(t).y-Lt(i[0]).y),d=Dr[e.arrowTypeStart],p=Dr[e.arrowTypeEnd],m=1;if(a<p&&a>0&&l<p){let y=p+m-a;y*=s==="right"?-1:1,n-=y}if(u<d&&u>0&&h<d){let y=d+m-u;y*=s==="right"?-1:1,n+=y}return Lt(t).x+n},"x"),y:T(function(t,r,i){let n=0;const s=Lt(i[0]).y<Lt(i[i.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Dr,e.arrowTypeStart)){const{angle:y,deltaY:x}=ic(i[0],i[1]);n=Dr[e.arrowTypeStart]*Math.abs(Math.sin(y))*(x>=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(Dr,e.arrowTypeEnd)){const{angle:y,deltaY:x}=ic(i[i.length-1],i[i.length-2]);n=Dr[e.arrowTypeEnd]*Math.abs(Math.sin(y))*(x>=0?1:-1)}const a=Math.abs(Lt(t).y-Lt(i[i.length-1]).y),l=Math.abs(Lt(t).x-Lt(i[i.length-1]).x),u=Math.abs(Lt(t).y-Lt(i[0]).y),h=Math.abs(Lt(t).x-Lt(i[0]).x),d=Dr[e.arrowTypeStart],p=Dr[e.arrowTypeEnd],m=1;if(a<p&&a>0&&l<p){let y=p+m-a;y*=s==="up"?-1:1,n-=y}if(u<d&&u>0&&h<d){let y=d+m-u;y*=s==="up"?-1:1,n+=y}return Lt(t).y+n},"y")}),"getLineFunctionsWithOffset"),r0=T(({flowchart:e})=>{var n,s;const t=((n=e==null?void 0:e.subGraphTitleMargin)==null?void 0:n.top)??0,r=((s=e==null?void 0:e.subGraphTitleMargin)==null?void 0:s.bottom)??0,i=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:i}},"getSubGraphTitleMargins"),vI=T(e=>{const{handDrawnSeed:t}=dt();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),qa=T(e=>{const t=bI([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),bI=T(e=>{const t=new Map;return e.forEach(r=>{const[i,n]=r.split(":");t.set(i.trim(),n==null?void 0:n.trim())}),t},"styles2Map"),mk=T(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),De=T(e=>{const{stylesArray:t}=qa(e),r=[],i=[],n=[],s=[];return t.forEach(a=>{const l=a[0];mk(l)?r.push(a.join(":")+" !important"):(i.push(a.join(":")+" !important"),l.includes("stroke")&&n.push(a.join(":")+" !important"),l==="fill"&&s.push(a.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:i.join(";"),stylesArray:t,borderStyles:n,backgroundStyles:s}},"styles2String"),Ae=T((e,t)=>{var u;const{themeVariables:r,handDrawnSeed:i}=dt(),{nodeBorder:n,mainBkg:s}=r,{stylesMap:a}=qa(e);return Object.assign({roughness:.7,fill:a.get("fill")||s,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:a.get("stroke")||n,seed:i,strokeWidth:((u=a.get("stroke-width"))==null?void 0:u.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:SI(a.get("stroke-dasharray"))},t)},"userNodeOverrides"),SI=T(e=>{if(!e)return[0,0];const t=e.trim().split(/\s+/).map(Number);if(t.length===1){const n=isNaN(t[0])?0:t[0];return[n,n]}const r=isNaN(t[0])?0:t[0],i=isNaN(t[1])?0:t[1];return[r,i]},"getStrokeDashArray"),su={},er={},l1;function wI(){return l1||(l1=1,Object.defineProperty(er,"__esModule",{value:!0}),er.BLANK_URL=er.relativeFirstCharacters=er.whitespaceEscapeCharsRegex=er.urlSchemeRegex=er.ctrlCharactersRegex=er.htmlCtrlEntityRegex=er.htmlEntitiesRegex=er.invalidProtocolRegex=void 0,er.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,er.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,er.htmlCtrlEntityRegex=/&(newline|tab);/gi,er.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,er.urlSchemeRegex=/^.+(:|:)/gim,er.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,er.relativeFirstCharacters=[".","/"],er.BLANK_URL="about:blank"),er}var c1;function CI(){if(c1)return su;c1=1,Object.defineProperty(su,"__esModule",{value:!0}),su.sanitizeUrl=s;var e=wI();function t(a){return e.relativeFirstCharacters.indexOf(a[0])>-1}function r(a){var l=a.replace(e.ctrlCharactersRegex,"");return l.replace(e.htmlEntitiesRegex,function(u,h){return String.fromCharCode(h)})}function i(a){return URL.canParse(a)}function n(a){try{return decodeURIComponent(a)}catch{return a}}function s(a){if(!a)return e.BLANK_URL;var l,u=n(a.trim());do u=r(u).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),u=n(u),l=u.match(e.ctrlCharactersRegex)||u.match(e.htmlEntitiesRegex)||u.match(e.htmlCtrlEntityRegex)||u.match(e.whitespaceEscapeCharsRegex);while(l&&l.length>0);var h=u;if(!h)return e.BLANK_URL;if(t(h))return h;var d=h.trimStart(),p=d.match(e.urlSchemeRegex);if(!p)return h;var m=p[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(m))return e.BLANK_URL;var y=d.replace(/\\/g,"/");if(m==="mailto:"||m.includes("://"))return y;if(m==="http:"||m==="https:"){if(!i(y))return e.BLANK_URL;var x=new URL(y);return x.protocol=x.protocol.toLowerCase(),x.hostname=x.hostname.toLowerCase(),x.toString()}return y}return su}var kI=CI(),yk=typeof global=="object"&&global&&global.Object===Object&&global,TI=typeof self=="object"&&self&&self.Object===Object&&self,$n=yk||TI||Function("return this")(),pd=$n.Symbol,_k=Object.prototype,EI=_k.hasOwnProperty,BI=_k.toString,Nl=pd?pd.toStringTag:void 0;function MI(e){var t=EI.call(e,Nl),r=e[Nl];try{e[Nl]=void 0;var i=!0}catch{}var n=BI.call(e);return i&&(t?e[Nl]=r:delete e[Nl]),n}var LI=Object.prototype,RI=LI.toString;function AI(e){return RI.call(e)}var DI="[object Null]",PI="[object Undefined]",h1=pd?pd.toStringTag:void 0;function Ua(e){return e==null?e===void 0?PI:DI:h1&&h1 in Object(e)?MI(e):AI(e)}function Fo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var II="[object AsyncFunction]",$I="[object Function]",jI="[object GeneratorFunction]",zI="[object Proxy]";function i0(e){if(!Fo(e))return!1;var t=Ua(e);return t==$I||t==jI||t==II||t==zI}var ag=$n["__core-js_shared__"],u1=(function(){var e=/[^.]+$/.exec(ag&&ag.keys&&ag.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function OI(e){return!!u1&&u1 in e}var FI=Function.prototype,NI=FI.toString;function No(e){if(e!=null){try{return NI.call(e)}catch{}try{return e+""}catch{}}return""}var WI=/[\\^$.*+?()[\]{}|]/g,HI=/^\[object .+?Constructor\]$/,qI=Function.prototype,UI=Object.prototype,VI=qI.toString,GI=UI.hasOwnProperty,YI=RegExp("^"+VI.call(GI).replace(WI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function KI(e){if(!Fo(e)||OI(e))return!1;var t=i0(e)?YI:HI;return t.test(No(e))}function XI(e,t){return e==null?void 0:e[t]}function Wo(e,t){var r=XI(e,t);return KI(r)?r:void 0}var Ec=Wo(Object,"create");function QI(){this.__data__=Ec?Ec(null):{},this.size=0}function ZI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var JI="__lodash_hash_undefined__",e6=Object.prototype,t6=e6.hasOwnProperty;function r6(e){var t=this.__data__;if(Ec){var r=t[e];return r===JI?void 0:r}return t6.call(t,e)?t[e]:void 0}var i6=Object.prototype,n6=i6.hasOwnProperty;function s6(e){var t=this.__data__;return Ec?t[e]!==void 0:n6.call(t,e)}var o6="__lodash_hash_undefined__";function a6(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ec&&t===void 0?o6:t,this}function Io(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Io.prototype.clear=QI;Io.prototype.delete=ZI;Io.prototype.get=r6;Io.prototype.has=s6;Io.prototype.set=a6;function l6(){this.__data__=[],this.size=0}function Vd(e,t){return e===t||e!==e&&t!==t}function Gd(e,t){for(var r=e.length;r--;)if(Vd(e[r][0],t))return r;return-1}var c6=Array.prototype,h6=c6.splice;function u6(e){var t=this.__data__,r=Gd(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():h6.call(t,r,1),--this.size,!0}function d6(e){var t=this.__data__,r=Gd(t,e);return r<0?void 0:t[r][1]}function f6(e){return Gd(this.__data__,e)>-1}function p6(e,t){var r=this.__data__,i=Gd(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function ss(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}ss.prototype.clear=l6;ss.prototype.delete=u6;ss.prototype.get=d6;ss.prototype.has=f6;ss.prototype.set=p6;var Bc=Wo($n,"Map");function g6(){this.size=0,this.__data__={hash:new Io,map:new(Bc||ss),string:new Io}}function m6(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yd(e,t){var r=e.__data__;return m6(t)?r[typeof t=="string"?"string":"hash"]:r.map}function y6(e){var t=Yd(this,e).delete(e);return this.size-=t?1:0,t}function _6(e){return Yd(this,e).get(e)}function x6(e){return Yd(this,e).has(e)}function v6(e,t){var r=Yd(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}function Vs(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Vs.prototype.clear=g6;Vs.prototype.delete=y6;Vs.prototype.get=_6;Vs.prototype.has=x6;Vs.prototype.set=v6;var b6="Expected a function";function Nc(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(b6);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],s=r.cache;if(s.has(n))return s.get(n);var a=e.apply(this,i);return r.cache=s.set(n,a)||s,a};return r.cache=new(Nc.Cache||Vs),r}Nc.Cache=Vs;function S6(){this.__data__=new ss,this.size=0}function w6(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function C6(e){return this.__data__.get(e)}function k6(e){return this.__data__.has(e)}var T6=200;function E6(e,t){var r=this.__data__;if(r instanceof ss){var i=r.__data__;if(!Bc||i.length<T6-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Vs(i)}return r.set(e,t),this.size=r.size,this}function Va(e){var t=this.__data__=new ss(e);this.size=t.size}Va.prototype.clear=S6;Va.prototype.delete=w6;Va.prototype.get=C6;Va.prototype.has=k6;Va.prototype.set=E6;var gd=(function(){try{var e=Wo(Object,"defineProperty");return e({},"",{}),e}catch{}})();function n0(e,t,r){t=="__proto__"&&gd?gd(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function gm(e,t,r){(r!==void 0&&!Vd(e[t],r)||r===void 0&&!(t in e))&&n0(e,t,r)}function B6(e){return function(t,r,i){for(var n=-1,s=Object(t),a=i(t),l=a.length;l--;){var u=a[++n];if(r(s[u],u,s)===!1)break}return t}}var M6=B6(),xk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,d1=xk&&typeof module=="object"&&module&&!module.nodeType&&module,L6=d1&&d1.exports===xk,f1=L6?$n.Buffer:void 0,p1=f1?f1.allocUnsafe:void 0;function R6(e,t){if(t)return e.slice();var r=e.length,i=p1?p1(r):new e.constructor(r);return e.copy(i),i}var g1=$n.Uint8Array;function A6(e){var t=new e.constructor(e.byteLength);return new g1(t).set(new g1(e)),t}function D6(e,t){var r=t?A6(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function P6(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t}var m1=Object.create,I6=(function(){function e(){}return function(t){if(!Fo(t))return{};if(m1)return m1(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();function vk(e,t){return function(r){return e(t(r))}}var bk=vk(Object.getPrototypeOf,Object),$6=Object.prototype;function Kd(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||$6;return e===r}function j6(e){return typeof e.constructor=="function"&&!Kd(e)?I6(bk(e)):{}}function Wc(e){return e!=null&&typeof e=="object"}var z6="[object Arguments]";function y1(e){return Wc(e)&&Ua(e)==z6}var Sk=Object.prototype,O6=Sk.hasOwnProperty,F6=Sk.propertyIsEnumerable,md=y1((function(){return arguments})())?y1:function(e){return Wc(e)&&O6.call(e,"callee")&&!F6.call(e,"callee")},yd=Array.isArray,N6=9007199254740991;function wk(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=N6}function Xd(e){return e!=null&&wk(e.length)&&!i0(e)}function W6(e){return Wc(e)&&Xd(e)}function H6(){return!1}var Ck=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_1=Ck&&typeof module=="object"&&module&&!module.nodeType&&module,q6=_1&&_1.exports===Ck,x1=q6?$n.Buffer:void 0,U6=x1?x1.isBuffer:void 0,s0=U6||H6,V6="[object Object]",G6=Function.prototype,Y6=Object.prototype,kk=G6.toString,K6=Y6.hasOwnProperty,X6=kk.call(Object);function Q6(e){if(!Wc(e)||Ua(e)!=V6)return!1;var t=bk(e);if(t===null)return!0;var r=K6.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&kk.call(r)==X6}var Z6="[object Arguments]",J6="[object Array]",e$="[object Boolean]",t$="[object Date]",r$="[object Error]",i$="[object Function]",n$="[object Map]",s$="[object Number]",o$="[object Object]",a$="[object RegExp]",l$="[object Set]",c$="[object String]",h$="[object WeakMap]",u$="[object ArrayBuffer]",d$="[object DataView]",f$="[object Float32Array]",p$="[object Float64Array]",g$="[object Int8Array]",m$="[object Int16Array]",y$="[object Int32Array]",_$="[object Uint8Array]",x$="[object Uint8ClampedArray]",v$="[object Uint16Array]",b$="[object Uint32Array]",Et={};Et[f$]=Et[p$]=Et[g$]=Et[m$]=Et[y$]=Et[_$]=Et[x$]=Et[v$]=Et[b$]=!0;Et[Z6]=Et[J6]=Et[u$]=Et[e$]=Et[d$]=Et[t$]=Et[r$]=Et[i$]=Et[n$]=Et[s$]=Et[o$]=Et[a$]=Et[l$]=Et[c$]=Et[h$]=!1;function S$(e){return Wc(e)&&wk(e.length)&&!!Et[Ua(e)]}function w$(e){return function(t){return e(t)}}var Tk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yc=Tk&&typeof module=="object"&&module&&!module.nodeType&&module,C$=yc&&yc.exports===Tk,lg=C$&&yk.process,v1=(function(){try{var e=yc&&yc.require&&yc.require("util").types;return e||lg&&lg.binding&&lg.binding("util")}catch{}})(),b1=v1&&v1.isTypedArray,o0=b1?w$(b1):S$;function mm(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var k$=Object.prototype,T$=k$.hasOwnProperty;function E$(e,t,r){var i=e[t];(!(T$.call(e,t)&&Vd(i,r))||r===void 0&&!(t in e))&&n0(e,t,r)}function B$(e,t,r,i){var n=!r;r||(r={});for(var s=-1,a=t.length;++s<a;){var l=t[s],u=void 0;u===void 0&&(u=e[l]),n?n0(r,l,u):E$(r,l,u)}return r}function M$(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}var L$=9007199254740991,R$=/^(?:0|[1-9]\d*)$/;function Ek(e,t){var r=typeof e;return t=t??L$,!!t&&(r=="number"||r!="symbol"&&R$.test(e))&&e>-1&&e%1==0&&e<t}var A$=Object.prototype,D$=A$.hasOwnProperty;function P$(e,t){var r=yd(e),i=!r&&md(e),n=!r&&!i&&s0(e),s=!r&&!i&&!n&&o0(e),a=r||i||n||s,l=a?M$(e.length,String):[],u=l.length;for(var h in e)(t||D$.call(e,h))&&!(a&&(h=="length"||n&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Ek(h,u)))&&l.push(h);return l}function I$(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var $$=Object.prototype,j$=$$.hasOwnProperty;function z$(e){if(!Fo(e))return I$(e);var t=Kd(e),r=[];for(var i in e)i=="constructor"&&(t||!j$.call(e,i))||r.push(i);return r}function Bk(e){return Xd(e)?P$(e,!0):z$(e)}function O$(e){return B$(e,Bk(e))}function F$(e,t,r,i,n,s,a){var l=mm(e,r),u=mm(t,r),h=a.get(u);if(h){gm(e,r,h);return}var d=s?s(l,u,r+"",e,t,a):void 0,p=d===void 0;if(p){var m=yd(u),y=!m&&s0(u),x=!m&&!y&&o0(u);d=u,m||y||x?yd(l)?d=l:W6(l)?d=P6(l):y?(p=!1,d=R6(u,!0)):x?(p=!1,d=D6(u,!0)):d=[]:Q6(u)||md(u)?(d=l,md(l)?d=O$(l):(!Fo(l)||i0(l))&&(d=j6(u))):p=!1}p&&(a.set(u,d),n(d,u,i,s,a),a.delete(u)),gm(e,r,d)}function Mk(e,t,r,i,n){e!==t&&M6(t,function(s,a){if(n||(n=new Va),Fo(s))F$(e,t,a,r,Mk,i,n);else{var l=i?i(mm(e,a),s,a+"",e,t,n):void 0;l===void 0&&(l=s),gm(e,a,l)}},Bk)}function Lk(e){return e}function N$(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var S1=Math.max;function W$(e,t,r){return t=S1(t===void 0?e.length-1:t,0),function(){for(var i=arguments,n=-1,s=S1(i.length-t,0),a=Array(s);++n<s;)a[n]=i[t+n];n=-1;for(var l=Array(t+1);++n<t;)l[n]=i[n];return l[t]=r(a),N$(e,this,l)}}function H$(e){return function(){return e}}var q$=gd?function(e,t){return gd(e,"toString",{configurable:!0,enumerable:!1,value:H$(t),writable:!0})}:Lk,U$=800,V$=16,G$=Date.now;function Y$(e){var t=0,r=0;return function(){var i=G$(),n=V$-(i-r);if(r=i,n>0){if(++t>=U$)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var K$=Y$(q$);function X$(e,t){return K$(W$(e,t,Lk),e+"")}function Q$(e,t,r){if(!Fo(r))return!1;var i=typeof t;return(i=="number"?Xd(r)&&Ek(t,r.length):i=="string"&&t in r)?Vd(r[t],e):!1}function Z$(e){return X$(function(t,r){var i=-1,n=r.length,s=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(s=e.length>3&&typeof s=="function"?(n--,s):void 0,a&&Q$(r[0],r[1],a)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var l=r[i];l&&e(t,l,i,s)}return t})}var J$=Z$(function(e,t,r){Mk(e,t,r)}),ej="",tj={curveBasis:Bu,curveBasisClosed:i4,curveBasisOpen:n4,curveBumpX:gw,curveBumpY:mw,curveBundle:s4,curveCardinalClosed:o4,curveCardinalOpen:a4,curveCardinal:vw,curveCatmullRomClosed:l4,curveCatmullRomOpen:c4,curveCatmullRom:Sw,curveLinear:nd,curveLinearClosed:h4,curveMonotoneX:Bw,curveMonotoneY:Mw,curveNatural:Rw,curveStep:Aw,curveStepAfter:Pw,curveStepBefore:Dw},rj=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,ij=T(function(e,t){const r=Rk(e,/(?:init\b)|(?:initialize\b)/);let i={};if(Array.isArray(r)){const a=r.map(l=>l.args);Gu(a),i=ir(i,[...a])}else i=r.args;if(!i)return;let n=Ly(e,t);const s="config";return i[s]!==void 0&&(n==="flowchart-v2"&&(n="flowchart"),i[n]=i[s],delete i[s]),i},"detectInit"),Rk=T(function(e,t=null){var r,i;try{const n=new RegExp(`[%]{2}(?![{]${rj.source})(?=[}][%]{2}).*
|
|
236
|
+
`,"ig");e=e.trim().replace(n,"").replace(/'/gm,'"'),ue.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let s;const a=[];for(;(s=gc.exec(e))!==null;)if(s.index===gc.lastIndex&&gc.lastIndex++,s&&!t||t&&((r=s[1])!=null&&r.match(t))||t&&((i=s[2])!=null&&i.match(t))){const l=s[1]?s[1]:s[2],u=s[3]?s[3].trim():s[4]?JSON.parse(s[4].trim()):null;a.push({type:l,args:u})}return a.length===0?{type:e,args:null}:a.length===1?a[0]:a}catch(n){return ue.error(`ERROR: ${n.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),nj=T(function(e){return e.replace(gc,"")},"removeDirectives"),sj=T(function(e,t){for(const[r,i]of t.entries())if(i.match(e))return r;return-1},"isSubstringInArray");function a0(e,t){if(!e)return t;const r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return tj[r]??t}T(a0,"interpolateToCurve");function Ak(e,t){const r=e.trim();if(r)return t.securityLevel!=="loose"?kI.sanitizeUrl(r):r}T(Ak,"formatUrl");var oj=T((e,...t)=>{const r=e.split("."),i=r.length-1,n=r[i];let s=window;for(let a=0;a<i;a++)if(s=s[r[a]],!s){ue.error(`Function name: ${e} not found in window`);return}s[n](...t)},"runFunc");function l0(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}T(l0,"distance");function Dk(e){let t,r=0;e.forEach(n=>{r+=l0(n,t),t=n});const i=r/2;return c0(e,i)}T(Dk,"traverseEdge");function Pk(e){return e.length===1?e[0]:Dk(e)}T(Pk,"calcLabelPosition");var w1=T((e,t=2)=>{const r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),c0=T((e,t)=>{let r,i=t;for(const n of e){if(r){const s=l0(n,r);if(s===0)return r;if(s<i)i-=s;else{const a=i/s;if(a<=0)return r;if(a>=1)return{x:n.x,y:n.y};if(a>0&&a<1)return{x:w1((1-a)*r.x+a*n.x,5),y:w1((1-a)*r.y+a*n.y,5)}}}r=n}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),aj=T((e,t,r)=>{ue.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());const n=c0(t,25),s=e?10:5,a=Math.atan2(t[0].y-n.y,t[0].x-n.x),l={x:0,y:0};return l.x=Math.sin(a)*s+(t[0].x+n.x)/2,l.y=-Math.cos(a)*s+(t[0].y+n.y)/2,l},"calcCardinalityPosition");function Ik(e,t,r){const i=structuredClone(r);ue.info("our points",i),t!=="start_left"&&t!=="start_right"&&i.reverse();const n=25+e,s=c0(i,n),a=10+e*.5,l=Math.atan2(i[0].y-s.y,i[0].x-s.x),u={x:0,y:0};return t==="start_left"?(u.x=Math.sin(l+Math.PI)*a+(i[0].x+s.x)/2,u.y=-Math.cos(l+Math.PI)*a+(i[0].y+s.y)/2):t==="end_right"?(u.x=Math.sin(l-Math.PI)*a+(i[0].x+s.x)/2-5,u.y=-Math.cos(l-Math.PI)*a+(i[0].y+s.y)/2-5):t==="end_left"?(u.x=Math.sin(l)*a+(i[0].x+s.x)/2-5,u.y=-Math.cos(l)*a+(i[0].y+s.y)/2-5):(u.x=Math.sin(l)*a+(i[0].x+s.x)/2,u.y=-Math.cos(l)*a+(i[0].y+s.y)/2),u}T(Ik,"calcTerminalLabelPosition");function $k(e){let t="",r="";for(const i of e)i!==void 0&&(i.startsWith("color:")||i.startsWith("text-align:")?r=r+i+";":t=t+i+";");return{style:t,labelStyle:r}}T($k,"getStylesFromArray");var C1=0,lj=T(()=>(C1++,"id-"+Math.random().toString(36).substr(2,12)+"-"+C1),"generateId");function jk(e){let t="";const r="0123456789abcdef",i=r.length;for(let n=0;n<e;n++)t+=r.charAt(Math.floor(Math.random()*i));return t}T(jk,"makeRandomHex");var cj=T(e=>jk(e.length),"random"),hj=T(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),uj=T(function(e,t){const r=t.text.replace(Ha.lineBreakRegex," "),[,i]=Qd(t.fontSize),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.style("text-anchor",t.anchor),n.style("font-family",t.fontFamily),n.style("font-size",i),n.style("font-weight",t.fontWeight),n.attr("fill",t.fill),t.class!==void 0&&n.attr("class",t.class);const s=n.append("tspan");return s.attr("x",t.x+t.textMargin*2),s.attr("fill",t.fill),s.text(r),n},"drawSimpleText"),dj=Nc((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),Ha.lineBreakRegex.test(e)))return e;const i=e.split(" ").filter(Boolean),n=[];let s="";return i.forEach((a,l)=>{const u=ns(`${a} `,r),h=ns(s,r);if(u>t){const{hyphenatedStrings:m,remainingWord:y}=fj(a,t,"-",r);n.push(s,...m),s=y}else h+u>=t?(n.push(s),s=a):s=[s,a].filter(Boolean).join(" ");l+1===i.length&&n.push(s)}),n.filter(a=>a!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),fj=Nc((e,t,r="-",i)=>{i=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},i);const n=[...e],s=[];let a="";return n.forEach((l,u)=>{const h=`${a}${l}`;if(ns(h,i)>=t){const p=u+1,m=n.length===p,y=`${h}${r}`;s.push(m?h:y),a=""}else a=h}),{hyphenatedStrings:s,remainingWord:a}},(e,t,r="-",i)=>`${e}${t}${r}${i.fontSize}${i.fontWeight}${i.fontFamily}`);function zk(e,t){return h0(e,t).height}T(zk,"calculateTextHeight");function ns(e,t){return h0(e,t).width}T(ns,"calculateTextWidth");var h0=Nc((e,t)=>{const{fontSize:r=12,fontFamily:i="Arial",fontWeight:n=400}=t;if(!e)return{width:0,height:0};const[,s]=Qd(r),a=["sans-serif",i],l=e.split(Ha.lineBreakRegex),u=[],h=nt("body");if(!h.remove)return{width:0,height:0,lineHeight:0};const d=h.append("svg");for(const m of a){let y=0;const x={width:0,height:0,lineHeight:0};for(const v of l){const S=hj();S.text=v||ej;const C=uj(d,S).style("font-size",s).style("font-weight",n).style("font-family",m),E=(C._groups||C)[0][0].getBBox();if(E.width===0&&E.height===0)throw new Error("svg element not in render tree");x.width=Math.round(Math.max(x.width,E.width)),y=Math.round(E.height),x.height+=y,x.lineHeight=Math.round(Math.max(x.lineHeight,y))}u.push(x)}d.remove();const p=isNaN(u[1].height)||isNaN(u[1].width)||isNaN(u[1].lineHeight)||u[0].height>u[1].height&&u[0].width>u[1].width&&u[0].lineHeight>u[1].lineHeight?0:1;return u[p]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),Da,pj=(Da=class{constructor(t=!1,r){this.count=0,this.count=r?r.length:0,this.next=t?()=>this.count++:()=>Date.now()}},T(Da,"InitIDGenerator"),Da),ou,gj=T(function(e){return ou=ou||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),ou.innerHTML=e,unescape(ou.textContent)},"entityDecode");function u0(e){return"str"in e}T(u0,"isDetailedError");var mj=T((e,t,r,i)=>{var s;if(!i)return;const n=(s=e.node())==null?void 0:s.getBBox();n&&e.append("text").text(i).attr("text-anchor","middle").attr("x",n.x+n.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Qd=T(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function d0(e,t){return J$({},e,t)}T(d0,"cleanAndMerge");var sn={assignWithDepth:ir,wrapLabel:dj,calculateTextHeight:zk,calculateTextWidth:ns,calculateTextDimensions:h0,cleanAndMerge:d0,detectInit:ij,detectDirective:Rk,isSubstringInArray:sj,interpolateToCurve:a0,calcLabelPosition:Pk,calcCardinalityPosition:aj,calcTerminalLabelPosition:Ik,formatUrl:Ak,getStylesFromArray:$k,generateId:lj,random:cj,runFunc:oj,entityDecode:gj,insertTitle:mj,isLabelCoordinateInPath:Ok,parseFontSize:Qd,InitIDGenerator:pj},yj=T(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){const i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"fl°°"+i+"¶ß":"fl°"+i+"¶ß"}),t},"encodeEntities"),Ho=T(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),JU=T((e,t,{counter:r=0,prefix:i,suffix:n},s)=>s||`${i?`${i}_`:""}${e}_${t}_${r}${n?`_${n}`:""}`,"getEdgeId");function $r(e){return e??null}T($r,"handleUndefinedAttr");function Ok(e,t){const r=Math.round(e.x),i=Math.round(e.y),n=t.replace(/(\d+\.\d+)/g,s=>Math.round(parseFloat(s)).toString());return n.includes(r.toString())||n.includes(i.toString())}T(Ok,"isLabelCoordinateInPath");const _j=Object.freeze({left:0,top:0,width:16,height:16}),_d=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Fk=Object.freeze({..._j,..._d}),xj=Object.freeze({...Fk,body:"",hidden:!1}),vj=Object.freeze({width:null,height:null}),bj=Object.freeze({...vj,..._d}),Sj=(e,t,r,i="")=>{const n=e.split(":");if(e.slice(0,1)==="@"){if(n.length<2||n.length>3)return null;i=n.shift().slice(1)}if(n.length>3||!n.length)return null;if(n.length>1){const l=n.pop(),u=n.pop(),h={provider:n.length>0?n[0]:i,prefix:u,name:l};return cg(h)?h:null}const s=n[0],a=s.split("-");if(a.length>1){const l={provider:i,prefix:a.shift(),name:a.join("-")};return cg(l)?l:null}if(r&&i===""){const l={provider:i,prefix:"",name:s};return cg(l,r)?l:null}return null},cg=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function wj(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const i=((e.rotate||0)+(t.rotate||0))%4;return i&&(r.rotate=i),r}function k1(e,t){const r=wj(e,t);for(const i in xj)i in _d?i in e&&!(i in r)&&(r[i]=_d[i]):i in t?r[i]=t[i]:i in e&&(r[i]=e[i]);return r}function Cj(e,t){const r=e.icons,i=e.aliases||Object.create(null),n=Object.create(null);function s(a){if(r[a])return n[a]=[];if(!(a in n)){n[a]=null;const l=i[a]&&i[a].parent,u=l&&s(l);u&&(n[a]=[l].concat(u))}return n[a]}return(t||Object.keys(r).concat(Object.keys(i))).forEach(s),n}function T1(e,t,r){const i=e.icons,n=e.aliases||Object.create(null);let s={};function a(l){s=k1(i[l]||n[l],s)}return a(t),r.forEach(a),k1(e,s)}function kj(e,t){if(e.icons[t])return T1(e,t,[]);const r=Cj(e,[t])[t];return r?T1(e,t,r):null}const Tj=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ej=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function E1(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const i=e.split(Tj);if(i===null||!i.length)return e;const n=[];let s=i.shift(),a=Ej.test(s);for(;;){if(a){const l=parseFloat(s);isNaN(l)?n.push(s):n.push(Math.ceil(l*t*r)/r)}else n.push(s);if(s=i.shift(),s===void 0)return n.join("");a=!a}}function Bj(e,t="defs"){let r="";const i=e.indexOf("<"+t);for(;i>=0;){const n=e.indexOf(">",i),s=e.indexOf("</"+t);if(n===-1||s===-1)break;const a=e.indexOf(">",s);if(a===-1)break;r+=e.slice(n+1,s).trim(),e=e.slice(0,i).trim()+e.slice(a+1)}return{defs:r,content:e}}function Mj(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Lj(e,t,r){const i=Bj(e);return Mj(i.defs,t+i.content+r)}const Rj=e=>e==="unset"||e==="undefined"||e==="none";function Aj(e,t){const r={...Fk,...e},i={...bj,...t},n={left:r.left,top:r.top,width:r.width,height:r.height};let s=r.body;[r,i].forEach(v=>{const S=[],C=v.hFlip,E=v.vFlip;let L=v.rotate;C?E?L+=2:(S.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),S.push("scale(-1 1)"),n.top=n.left=0):E&&(S.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),S.push("scale(1 -1)"),n.top=n.left=0);let B;switch(L<0&&(L-=Math.floor(L/4)*4),L=L%4,L){case 1:B=n.height/2+n.top,S.unshift("rotate(90 "+B.toString()+" "+B.toString()+")");break;case 2:S.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:B=n.width/2+n.left,S.unshift("rotate(-90 "+B.toString()+" "+B.toString()+")");break}L%2===1&&(n.left!==n.top&&(B=n.left,n.left=n.top,n.top=B),n.width!==n.height&&(B=n.width,n.width=n.height,n.height=B)),S.length&&(s=Lj(s,'<g transform="'+S.join(" ")+'">',"</g>"))});const a=i.width,l=i.height,u=n.width,h=n.height;let d,p;a===null?(p=l===null?"1em":l==="auto"?h:l,d=E1(p,u/h)):(d=a==="auto"?u:a,p=l===null?E1(d,h/u):l==="auto"?h:l);const m={},y=(v,S)=>{Rj(S)||(m[v]=S.toString())};y("width",d),y("height",p);const x=[n.left,n.top,u,h];return m.viewBox=x.join(" "),{attributes:m,viewBox:x,body:s}}const Dj=/\sid="(\S+)"/g,B1=new Map;function Pj(e){e=e.replace(/[0-9]+$/,"")||"a";const t=B1.get(e)||0;return B1.set(e,t+1),t?`${e}${t}`:e}function Ij(e){const t=[];let r;for(;r=Dj.exec(e);)t.push(r[1]);if(!t.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(n=>{const s=Pj(n),a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}function $j(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in t)r+=" "+i+'="'+t[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Nk(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=Array.from(typeof e=="string"?[e]:e);i[i.length-1]=i[i.length-1].replace(/\r?\n([\t ]*)$/,"");var n=i.reduce(function(l,u){var h=u.match(/\n([\t ]+|(?!\s).)/g);return h?l.concat(h.map(function(d){var p,m;return(m=(p=d.match(/[\t ]/g))===null||p===void 0?void 0:p.length)!==null&&m!==void 0?m:0})):l},[]);if(n.length){var s=new RegExp(`
|
|
237
|
+
[ ]{`+Math.min.apply(Math,n)+"}","g");i=i.map(function(l){return l.replace(s,`
|
|
238
|
+
`)})}i[0]=i[0].replace(/^\r?\n/,"");var a=i[0];return t.forEach(function(l,u){var h=a.match(/(?:^|\n)( *)$/),d=h?h[1]:"",p=l;typeof l=="string"&&l.includes(`
|
|
239
|
+
`)&&(p=String(l).split(`
|
|
240
|
+
`).map(function(m,y){return y===0?m:""+d+m}).join(`
|
|
241
|
+
`)),a+=p+i[u+1]}),a}var jj={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},ym=new Map,Wk=new Map,zj=T(e=>{for(const t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(ue.debug("Registering icon pack:",t.name),"loader"in t)Wk.set(t.name,t.loader);else if("icons"in t)ym.set(t.name,t.icons);else throw ue.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Hk=T(async(e,t)=>{const r=Sj(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);const i=r.prefix||t;if(!i)throw new Error(`Icon name must contain a prefix: ${e}`);let n=ym.get(i);if(!n){const a=Wk.get(i);if(!a)throw new Error(`Icon set not found: ${r.prefix}`);try{n={...await a(),prefix:i},ym.set(i,n)}catch(l){throw ue.error(l),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=kj(n,r.name);if(!s)throw new Error(`Icon not found: ${e}`);return s},"getRegisteredIconData"),Oj=T(async e=>{try{return await Hk(e),!0}catch{return!1}},"isIconAvailable"),Hc=T(async(e,t,r)=>{let i;try{i=await Hk(e,t==null?void 0:t.fallbackPrefix)}catch(a){ue.error(a),i=jj}const n=Aj(i,t),s=$j(Ij(n.body),{...n.attributes,...r});return zi(s,Pr())},"getIconSVG");function qk(e,{markdownAutoWrap:t}){const i=e.replace(/<br\/>/g,`
|
|
242
|
+
`).replace(/\n{2,}/g,`
|
|
243
|
+
`),n=Nk(i);return t===!1?n.replace(/ /g," "):n}T(qk,"preprocessMarkdown");function Uk(e,t={}){const r=qk(e,t),i=st.lexer(r),n=[[]];let s=0;function a(l,u="normal"){l.type==="text"?l.text.split(`
|
|
244
|
+
`).forEach((d,p)=>{p!==0&&(s++,n.push([])),d.split(" ").forEach(m=>{m=m.replace(/'/g,"'"),m&&n[s].push({content:m,type:u})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(h=>{a(h,l.type)}):l.type==="html"&&n[s].push({content:l.text,type:"normal"})}return T(a,"processNode"),i.forEach(l=>{var u;l.type==="paragraph"?(u=l.tokens)==null||u.forEach(h=>{a(h)}):l.type==="html"?n[s].push({content:l.text,type:"normal"}):n[s].push({content:l.raw,type:"normal"})}),n}T(Uk,"markdownToLines");function Vk(e,{markdownAutoWrap:t}={}){const r=st.lexer(e);function i(n){var s,a,l;return n.type==="text"?t===!1?n.text.replace(/\n */g,"<br/>").replace(/ /g," "):n.text.replace(/\n */g,"<br/>"):n.type==="strong"?`<strong>${(s=n.tokens)==null?void 0:s.map(i).join("")}</strong>`:n.type==="em"?`<em>${(a=n.tokens)==null?void 0:a.map(i).join("")}</em>`:n.type==="paragraph"?`<p>${(l=n.tokens)==null?void 0:l.map(i).join("")}</p>`:n.type==="space"?"":n.type==="html"?`${n.text}`:n.type==="escape"?n.text:(ue.warn(`Unsupported markdown: ${n.type}`),n.raw)}return T(i,"output"),r.map(i).join("")}T(Vk,"markdownToHTML");function Gk(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}T(Gk,"splitTextToChars");function Yk(e,t){const r=Gk(t.content);return f0(e,[],r,t.type)}T(Yk,"splitWordToFitWidth");function f0(e,t,r,i){if(r.length===0)return[{content:t.join(""),type:i},{content:"",type:i}];const[n,...s]=r,a=[...t,n];return e([{content:a.join(""),type:i}])?f0(e,a,s,i):(t.length===0&&n&&(t.push(n),r.shift()),[{content:t.join(""),type:i},{content:r.join(""),type:i}])}T(f0,"splitWordToFitWidthRecursion");function Kk(e,t){if(e.some(({content:r})=>r.includes(`
|
|
245
|
+
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return xd(e,t)}T(Kk,"splitLineToFitWidth");function xd(e,t,r=[],i=[]){if(e.length===0)return i.length>0&&r.push(i),r.length>0?r:[];let n="";e[0].content===" "&&(n=" ",e.shift());const s=e.shift()??{content:" ",type:"normal"},a=[...i];if(n!==""&&a.push({content:n,type:"normal"}),a.push(s),t(a))return xd(e,t,r,a);if(i.length>0)r.push(i),e.unshift(s);else if(s.content){const[l,u]=Yk(t,s);r.push([l]),u.content&&e.unshift(u)}return xd(e,t,r)}T(xd,"splitLineToFitWidthRecursion");function _m(e,t){t&&e.attr("style",t)}T(_m,"applyStyle");async function Xk(e,t,r,i,n=!1,s=Pr()){const a=e.append("foreignObject");a.attr("width",`${10*r}px`),a.attr("height",`${10*r}px`);const l=a.append("xhtml:div"),u=Ia(t.label)?await Ry(t.label.replace(Ha.lineBreakRegex,`
|
|
246
|
+
`),s):zi(t.label,s),h=t.isNode?"nodeLabel":"edgeLabel",d=l.append("span");d.html(u),_m(d,t.labelStyle),d.attr("class",`${h} ${i}`),_m(l,t.labelStyle),l.style("display","table-cell"),l.style("white-space","nowrap"),l.style("line-height","1.5"),l.style("max-width",r+"px"),l.style("text-align","center"),l.attr("xmlns","http://www.w3.org/1999/xhtml"),n&&l.attr("class","labelBkg");let p=l.node().getBoundingClientRect();return p.width===r&&(l.style("display","table"),l.style("white-space","break-spaces"),l.style("width",r+"px"),p=l.node().getBoundingClientRect()),a.node()}T(Xk,"addHtmlSpan");function Zd(e,t,r){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em")}T(Zd,"createTspan");function Qk(e,t,r){const i=e.append("text"),n=Zd(i,1,t);Jd(n,r);const s=n.node().getComputedTextLength();return i.remove(),s}T(Qk,"computeWidthOfText");function Fj(e,t,r){var a;const i=e.append("text"),n=Zd(i,1,t);Jd(n,[{content:r,type:"normal"}]);const s=(a=n.node())==null?void 0:a.getBoundingClientRect();return s&&i.remove(),s}T(Fj,"computeDimensionOfText");function Zk(e,t,r,i=!1){const s=t.append("g"),a=s.insert("rect").attr("class","background").attr("style","stroke: none"),l=s.append("text").attr("y","-10.1");let u=0;for(const h of r){const d=T(m=>Qk(s,1.1,m)<=e,"checkWidth"),p=d(h)?[h]:Kk(h,d);for(const m of p){const y=Zd(l,u,1.1);Jd(y,m),u++}}if(i){const h=l.node().getBBox(),d=2;return a.attr("x",h.x-d).attr("y",h.y-d).attr("width",h.width+2*d).attr("height",h.height+2*d),s.node()}else return l.node()}T(Zk,"createFormattedText");function Jd(e,t){e.text(""),t.forEach((r,i)=>{const n=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");i===0?n.text(r.content):n.text(" "+r.content)})}T(Jd,"updateTextContentAndStyles");async function Jk(e,t={}){const r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(n,s,a)=>(r.push((async()=>{const l=`${s}:${a}`;return await Oj(l)?await Hc(l,void 0,{class:"label-icon"}):`<i class='${zi(n,t).replace(":"," ")}'></i>`})()),n));const i=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>i.shift()??"")}T(Jk,"replaceIconSubstring");var Gs=T(async(e,t="",{style:r="",isTitle:i=!1,classes:n="",useHtmlLabels:s=!0,isNode:a=!0,width:l=200,addSvgBackground:u=!1}={},h)=>{if(ue.debug("XYZ createText",t,r,i,n,s,a,"addSvgBackground: ",u),s){const d=Vk(t,h),p=await Jk(Ho(d),h),m=t.replace(/\\\\/g,"\\"),y={isNode:a,label:Ia(t)?m:p,labelStyle:r.replace("fill:","color:")};return await Xk(e,y,l,n,u,h)}else{const d=t.replace(/<br\s*\/?>/g,"<br/>"),p=Uk(d.replace("<br>","<br/>"),h),m=Zk(l,e,p,t?u:!1);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const y=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");nt(m).attr("style",y)}else{const y=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");nt(m).select("rect").attr("style",y.replace(/background:/g,"fill:"));const x=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");nt(m).select("text").attr("style",x)}return m}},"createText");function hg(e,t,r){if(e&&e.length){const[i,n]=t,s=Math.PI/180*r,a=Math.cos(s),l=Math.sin(s);for(const u of e){const[h,d]=u;u[0]=(h-i)*a-(d-n)*l+i,u[1]=(h-i)*l+(d-n)*a+n}}}function Nj(e,t){return e[0]===t[0]&&e[1]===t[1]}function Wj(e,t,r,i=1){const n=r,s=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,l=[0,0];if(n)for(const h of a)hg(h,l,n);const u=(function(h,d,p){const m=[];for(const E of h){const L=[...E];Nj(L[0],L[L.length-1])||L.push([L[0][0],L[0][1]]),L.length>2&&m.push(L)}const y=[];d=Math.max(d,.1);const x=[];for(const E of m)for(let L=0;L<E.length-1;L++){const B=E[L],R=E[L+1];if(B[1]!==R[1]){const k=Math.min(B[1],R[1]);x.push({ymin:k,ymax:Math.max(B[1],R[1]),x:k===B[1]?B[0]:R[0],islope:(R[0]-B[0])/(R[1]-B[1])})}}if(x.sort(((E,L)=>E.ymin<L.ymin?-1:E.ymin>L.ymin?1:E.x<L.x?-1:E.x>L.x?1:E.ymax===L.ymax?0:(E.ymax-L.ymax)/Math.abs(E.ymax-L.ymax))),!x.length)return y;let v=[],S=x[0].ymin,C=0;for(;v.length||x.length;){if(x.length){let E=-1;for(let L=0;L<x.length&&!(x[L].ymin>S);L++)E=L;x.splice(0,E+1).forEach((L=>{v.push({s:S,edge:L})}))}if(v=v.filter((E=>!(E.edge.ymax<=S))),v.sort(((E,L)=>E.edge.x===L.edge.x?0:(E.edge.x-L.edge.x)/Math.abs(E.edge.x-L.edge.x))),(p!==1||C%d==0)&&v.length>1)for(let E=0;E<v.length;E+=2){const L=E+1;if(L>=v.length)break;const B=v[E].edge,R=v[L].edge;y.push([[Math.round(B.x),S],[Math.round(R.x),S]])}S+=p,v.forEach((E=>{E.edge.x=E.edge.x+p*E.edge.islope})),C++}return y})(a,s,i);if(n){for(const h of a)hg(h,l,-n);(function(h,d,p){const m=[];h.forEach((y=>m.push(...y))),hg(m,d,p)})(u,l,-n)}return u}function qc(e,t){var r;const i=t.hachureAngle+90;let n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.round(Math.max(n,.1));let s=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(s=n),Wj(e,n,i,s||1)}let p0=class{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){const i=qc(t,r);return{type:"fillSketch",ops:this.renderLines(i,r)}}renderLines(t,r){const i=[];for(const n of t)i.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],r));return i}};function ef(e){const t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}let Hj=class extends p0{fillPolygons(t,r){let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);const n=qc(t,Object.assign({},r,{hachureGap:i})),s=Math.PI/180*r.hachureAngle,a=[],l=.5*i*Math.cos(s),u=.5*i*Math.sin(s);for(const[h,d]of n)ef([h,d])&&a.push([[h[0]-l,h[1]+u],[...d]],[[h[0]+l,h[1]-u],[...d]]);return{type:"fillSketch",ops:this.renderLines(a,r)}}};class qj extends p0{fillPolygons(t,r){const i=this._fillPolygons(t,r),n=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),s=this._fillPolygons(t,n);return i.ops=i.ops.concat(s.ops),i}}class Uj{constructor(t){this.helper=t}fillPolygons(t,r){const i=qc(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(i,r)}dotsOnLines(t,r){const i=[];let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);const a=n/4;for(const l of t){const u=ef(l),h=u/n,d=Math.ceil(h)-1,p=u-d*n,m=(l[0][0]+l[1][0])/2-n/4,y=Math.min(l[0][1],l[1][1]);for(let x=0;x<d;x++){const v=y+p+x*n,S=m-a+2*Math.random()*a,C=v-a+2*Math.random()*a,E=this.helper.ellipse(S,C,s,s,r);i.push(...E.ops)}}return{type:"fillSketch",ops:i}}}class Vj{constructor(t){this.helper=t}fillPolygons(t,r){const i=qc(t,r);return{type:"fillSketch",ops:this.dashedLine(i,r)}}dashedLine(t,r){const i=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,n=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,s=[];return t.forEach((a=>{const l=ef(a),u=Math.floor(l/(i+n)),h=(l+n-u*(i+n))/2;let d=a[0],p=a[1];d[0]>p[0]&&(d=a[1],p=a[0]);const m=Math.atan((p[1]-d[1])/(p[0]-d[0]));for(let y=0;y<u;y++){const x=y*(i+n),v=x+i,S=[d[0]+x*Math.cos(m)+h*Math.cos(m),d[1]+x*Math.sin(m)+h*Math.sin(m)],C=[d[0]+v*Math.cos(m)+h*Math.cos(m),d[1]+v*Math.sin(m)+h*Math.sin(m)];s.push(...this.helper.doubleLineOps(S[0],S[1],C[0],C[1],r))}})),s}}class Gj{constructor(t){this.helper=t}fillPolygons(t,r){const i=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,n=r.zigzagOffset<0?i:r.zigzagOffset,s=qc(t,r=Object.assign({},r,{hachureGap:i+n}));return{type:"fillSketch",ops:this.zigzagLines(s,n,r)}}zigzagLines(t,r,i){const n=[];return t.forEach((s=>{const a=ef(s),l=Math.round(a/(2*r));let u=s[0],h=s[1];u[0]>h[0]&&(u=s[1],h=s[0]);const d=Math.atan((h[1]-u[1])/(h[0]-u[0]));for(let p=0;p<l;p++){const m=2*p*r,y=2*(p+1)*r,x=Math.sqrt(2*Math.pow(r,2)),v=[u[0]+m*Math.cos(d),u[1]+m*Math.sin(d)],S=[u[0]+y*Math.cos(d),u[1]+y*Math.sin(d)],C=[v[0]+x*Math.cos(d+Math.PI/4),v[1]+x*Math.sin(d+Math.PI/4)];n.push(...this.helper.doubleLineOps(v[0],v[1],C[0],C[1],i),...this.helper.doubleLineOps(C[0],C[1],S[0],S[1],i))}})),n}}const ni={};class Yj{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const Kj=0,ug=1,M1=2,au={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function dg(e,t){return e.type===t}function g0(e){const t=[],r=(function(a){const l=new Array;for(;a!=="";)if(a.match(/^([ \t\r\n,]+)/))a=a.substr(RegExp.$1.length);else if(a.match(/^([aAcChHlLmMqQsStTvVzZ])/))l[l.length]={type:Kj,text:RegExp.$1},a=a.substr(RegExp.$1.length);else{if(!a.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];l[l.length]={type:ug,text:`${parseFloat(RegExp.$1)}`},a=a.substr(RegExp.$1.length)}return l[l.length]={type:M1,text:""},l})(e);let i="BOD",n=0,s=r[n];for(;!dg(s,M1);){let a=0;const l=[];if(i==="BOD"){if(s.text!=="M"&&s.text!=="m")return g0("M0,0"+e);n++,a=au[s.text],i=s.text}else dg(s,ug)?a=au[i]:(n++,a=au[s.text],i=s.text);if(!(n+a<r.length))throw new Error("Path data ended short");for(let u=n;u<n+a;u++){const h=r[u];if(!dg(h,ug))throw new Error("Param not a number: "+i+","+h.text);l[l.length]=+h.text}if(typeof au[i]!="number")throw new Error("Bad segment: "+i);{const u={key:i,data:l};t.push(u),n+=a,s=r[n],i==="M"&&(i="L"),i==="m"&&(i="l")}}return t}function e2(e){let t=0,r=0,i=0,n=0;const s=[];for(const{key:a,data:l}of e)switch(a){case"M":s.push({key:"M",data:[...l]}),[t,r]=l,[i,n]=l;break;case"m":t+=l[0],r+=l[1],s.push({key:"M",data:[t,r]}),i=t,n=r;break;case"L":s.push({key:"L",data:[...l]}),[t,r]=l;break;case"l":t+=l[0],r+=l[1],s.push({key:"L",data:[t,r]});break;case"C":s.push({key:"C",data:[...l]}),t=l[4],r=l[5];break;case"c":{const u=l.map(((h,d)=>d%2?h+r:h+t));s.push({key:"C",data:u}),t=u[4],r=u[5];break}case"Q":s.push({key:"Q",data:[...l]}),t=l[2],r=l[3];break;case"q":{const u=l.map(((h,d)=>d%2?h+r:h+t));s.push({key:"Q",data:u}),t=u[2],r=u[3];break}case"A":s.push({key:"A",data:[...l]}),t=l[5],r=l[6];break;case"a":t+=l[5],r+=l[6],s.push({key:"A",data:[l[0],l[1],l[2],l[3],l[4],t,r]});break;case"H":s.push({key:"H",data:[...l]}),t=l[0];break;case"h":t+=l[0],s.push({key:"H",data:[t]});break;case"V":s.push({key:"V",data:[...l]}),r=l[0];break;case"v":r+=l[0],s.push({key:"V",data:[r]});break;case"S":s.push({key:"S",data:[...l]}),t=l[2],r=l[3];break;case"s":{const u=l.map(((h,d)=>d%2?h+r:h+t));s.push({key:"S",data:u}),t=u[2],r=u[3];break}case"T":s.push({key:"T",data:[...l]}),t=l[0],r=l[1];break;case"t":t+=l[0],r+=l[1],s.push({key:"T",data:[t,r]});break;case"Z":case"z":s.push({key:"Z",data:[]}),t=i,r=n}return s}function t2(e){const t=[];let r="",i=0,n=0,s=0,a=0,l=0,u=0;for(const{key:h,data:d}of e){switch(h){case"M":t.push({key:"M",data:[...d]}),[i,n]=d,[s,a]=d;break;case"C":t.push({key:"C",data:[...d]}),i=d[4],n=d[5],l=d[2],u=d[3];break;case"L":t.push({key:"L",data:[...d]}),[i,n]=d;break;case"H":i=d[0],t.push({key:"L",data:[i,n]});break;case"V":n=d[0],t.push({key:"L",data:[i,n]});break;case"S":{let p=0,m=0;r==="C"||r==="S"?(p=i+(i-l),m=n+(n-u)):(p=i,m=n),t.push({key:"C",data:[p,m,...d]}),l=d[0],u=d[1],i=d[2],n=d[3];break}case"T":{const[p,m]=d;let y=0,x=0;r==="Q"||r==="T"?(y=i+(i-l),x=n+(n-u)):(y=i,x=n);const v=i+2*(y-i)/3,S=n+2*(x-n)/3,C=p+2*(y-p)/3,E=m+2*(x-m)/3;t.push({key:"C",data:[v,S,C,E,p,m]}),l=y,u=x,i=p,n=m;break}case"Q":{const[p,m,y,x]=d,v=i+2*(p-i)/3,S=n+2*(m-n)/3,C=y+2*(p-y)/3,E=x+2*(m-x)/3;t.push({key:"C",data:[v,S,C,E,y,x]}),l=p,u=m,i=y,n=x;break}case"A":{const p=Math.abs(d[0]),m=Math.abs(d[1]),y=d[2],x=d[3],v=d[4],S=d[5],C=d[6];p===0||m===0?(t.push({key:"C",data:[i,n,S,C,S,C]}),i=S,n=C):(i!==S||n!==C)&&(r2(i,n,S,C,p,m,y,x,v).forEach((function(E){t.push({key:"C",data:E})})),i=S,n=C);break}case"Z":t.push({key:"Z",data:[]}),i=s,n=a}r=h}return t}function Wl(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function r2(e,t,r,i,n,s,a,l,u,h){const d=(p=a,Math.PI*p/180);var p;let m=[],y=0,x=0,v=0,S=0;if(h)[y,x,v,S]=h;else{[e,t]=Wl(e,t,-d),[r,i]=Wl(r,i,-d);const F=(e-r)/2,z=(t-i)/2;let $=F*F/(n*n)+z*z/(s*s);$>1&&($=Math.sqrt($),n*=$,s*=$);const j=n*n,W=s*s,P=j*W-j*z*z-W*F*F,Q=j*z*z+W*F*F,ee=(l===u?-1:1)*Math.sqrt(Math.abs(P/Q));v=ee*n*z/s+(e+r)/2,S=ee*-s*F/n+(t+i)/2,y=Math.asin(parseFloat(((t-S)/s).toFixed(9))),x=Math.asin(parseFloat(((i-S)/s).toFixed(9))),e<v&&(y=Math.PI-y),r<v&&(x=Math.PI-x),y<0&&(y=2*Math.PI+y),x<0&&(x=2*Math.PI+x),u&&y>x&&(y-=2*Math.PI),!u&&x>y&&(x-=2*Math.PI)}let C=x-y;if(Math.abs(C)>120*Math.PI/180){const F=x,z=r,$=i;x=u&&x>y?y+120*Math.PI/180*1:y+120*Math.PI/180*-1,m=r2(r=v+n*Math.cos(x),i=S+s*Math.sin(x),z,$,n,s,a,0,u,[x,F,v,S])}C=x-y;const E=Math.cos(y),L=Math.sin(y),B=Math.cos(x),R=Math.sin(x),k=Math.tan(C/4),A=4/3*n*k,O=4/3*s*k,V=[e,t],q=[e+A*L,t-O*E],H=[r+A*R,i-O*B],Y=[r,i];if(q[0]=2*V[0]-q[0],q[1]=2*V[1]-q[1],h)return[q,H,Y].concat(m);{m=[q,H,Y].concat(m);const F=[];for(let z=0;z<m.length;z+=3){const $=Wl(m[z][0],m[z][1],d),j=Wl(m[z+1][0],m[z+1][1],d),W=Wl(m[z+2][0],m[z+2][1],d);F.push([$[0],$[1],j[0],j[1],W[0],W[1]])}return F}}const Xj={randOffset:function(e,t){return Ue(e,t)},randOffsetWithRange:function(e,t,r){return vd(e,t,r)},ellipse:function(e,t,r,i,n){const s=n2(r,i,n);return xm(e,t,n,s).opset},doubleLineOps:function(e,t,r,i,n){return qs(e,t,r,i,n,!0)}};function i2(e,t,r,i,n){return{type:"path",ops:qs(e,t,r,i,n)}}function Ru(e,t,r){const i=(e||[]).length;if(i>2){const n=[];for(let s=0;s<i-1;s++)n.push(...qs(e[s][0],e[s][1],e[s+1][0],e[s+1][1],r));return t&&n.push(...qs(e[i-1][0],e[i-1][1],e[0][0],e[0][1],r)),{type:"path",ops:n}}return i===2?i2(e[0][0],e[0][1],e[1][0],e[1][1],r):{type:"path",ops:[]}}function Qj(e,t,r,i,n){return(function(s,a){return Ru(s,!0,a)})([[e,t],[e+r,t],[e+r,t+i],[e,t+i]],n)}function L1(e,t){if(e.length){const r=typeof e[0][0]=="number"?[e]:e,i=lu(r[0],1*(1+.2*t.roughness),t),n=t.disableMultiStroke?[]:lu(r[0],1.5*(1+.22*t.roughness),D1(t));for(let s=1;s<r.length;s++){const a=r[s];if(a.length){const l=lu(a,1*(1+.2*t.roughness),t),u=t.disableMultiStroke?[]:lu(a,1.5*(1+.22*t.roughness),D1(t));for(const h of l)h.op!=="move"&&i.push(h);for(const h of u)h.op!=="move"&&n.push(h)}}return{type:"path",ops:i.concat(n)}}return{type:"path",ops:[]}}function n2(e,t,r){const i=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),n=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*i)),s=2*Math.PI/n;let a=Math.abs(e/2),l=Math.abs(t/2);const u=1-r.curveFitting;return a+=Ue(a*u,r),l+=Ue(l*u,r),{increment:s,rx:a,ry:l}}function xm(e,t,r,i){const[n,s]=P1(i.increment,e,t,i.rx,i.ry,1,i.increment*vd(.1,vd(.4,1,r),r),r);let a=bd(n,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[l]=P1(i.increment,e,t,i.rx,i.ry,1.5,0,r),u=bd(l,null,r);a=a.concat(u)}return{estimatedPoints:s,opset:{type:"path",ops:a}}}function R1(e,t,r,i,n,s,a,l,u){const h=e,d=t;let p=Math.abs(r/2),m=Math.abs(i/2);p+=Ue(.01*p,u),m+=Ue(.01*m,u);let y=n,x=s;for(;y<0;)y+=2*Math.PI,x+=2*Math.PI;x-y>2*Math.PI&&(y=0,x=2*Math.PI);const v=2*Math.PI/u.curveStepCount,S=Math.min(v/2,(x-y)/2),C=I1(S,h,d,p,m,y,x,1,u);if(!u.disableMultiStroke){const E=I1(S,h,d,p,m,y,x,1.5,u);C.push(...E)}return a&&(l?C.push(...qs(h,d,h+p*Math.cos(y),d+m*Math.sin(y),u),...qs(h,d,h+p*Math.cos(x),d+m*Math.sin(x),u)):C.push({op:"lineTo",data:[h,d]},{op:"lineTo",data:[h+p*Math.cos(y),d+m*Math.sin(y)]})),{type:"path",ops:C}}function A1(e,t){const r=t2(e2(g0(e))),i=[];let n=[0,0],s=[0,0];for(const{key:a,data:l}of r)switch(a){case"M":s=[l[0],l[1]],n=[l[0],l[1]];break;case"L":i.push(...qs(s[0],s[1],l[0],l[1],t)),s=[l[0],l[1]];break;case"C":{const[u,h,d,p,m,y]=l;i.push(...Zj(u,h,d,p,m,y,s,t)),s=[m,y];break}case"Z":i.push(...qs(s[0],s[1],n[0],n[1],t)),s=[n[0],n[1]]}return{type:"path",ops:i}}function fg(e,t){const r=[];for(const i of e)if(i.length){const n=t.maxRandomnessOffset||0,s=i.length;if(s>2){r.push({op:"move",data:[i[0][0]+Ue(n,t),i[0][1]+Ue(n,t)]});for(let a=1;a<s;a++)r.push({op:"lineTo",data:[i[a][0]+Ue(n,t),i[a][1]+Ue(n,t)]})}}return{type:"fillPath",ops:r}}function ma(e,t){return(function(r,i){let n=r.fillStyle||"hachure";if(!ni[n])switch(n){case"zigzag":ni[n]||(ni[n]=new Hj(i));break;case"cross-hatch":ni[n]||(ni[n]=new qj(i));break;case"dots":ni[n]||(ni[n]=new Uj(i));break;case"dashed":ni[n]||(ni[n]=new Vj(i));break;case"zigzag-line":ni[n]||(ni[n]=new Gj(i));break;default:n="hachure",ni[n]||(ni[n]=new p0(i))}return ni[n]})(t,Xj).fillPolygons(e,t)}function D1(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function s2(e){return e.randomizer||(e.randomizer=new Yj(e.seed||0)),e.randomizer.next()}function vd(e,t,r,i=1){return r.roughness*i*(s2(r)*(t-e)+e)}function Ue(e,t,r=1){return vd(-e,e,t,r)}function qs(e,t,r,i,n,s=!1){const a=s?n.disableMultiStrokeFill:n.disableMultiStroke,l=vm(e,t,r,i,n,!0,!1);if(a)return l;const u=vm(e,t,r,i,n,!0,!0);return l.concat(u)}function vm(e,t,r,i,n,s,a){const l=Math.pow(e-r,2)+Math.pow(t-i,2),u=Math.sqrt(l);let h=1;h=u<200?1:u>500?.4:-.0016668*u+1.233334;let d=n.maxRandomnessOffset||0;d*d*100>l&&(d=u/10);const p=d/2,m=.2+.2*s2(n);let y=n.bowing*n.maxRandomnessOffset*(i-t)/200,x=n.bowing*n.maxRandomnessOffset*(e-r)/200;y=Ue(y,n,h),x=Ue(x,n,h);const v=[],S=()=>Ue(p,n,h),C=()=>Ue(d,n,h),E=n.preserveVertices;return a?v.push({op:"move",data:[e+(E?0:S()),t+(E?0:S())]}):v.push({op:"move",data:[e+(E?0:Ue(d,n,h)),t+(E?0:Ue(d,n,h))]}),a?v.push({op:"bcurveTo",data:[y+e+(r-e)*m+S(),x+t+(i-t)*m+S(),y+e+2*(r-e)*m+S(),x+t+2*(i-t)*m+S(),r+(E?0:S()),i+(E?0:S())]}):v.push({op:"bcurveTo",data:[y+e+(r-e)*m+C(),x+t+(i-t)*m+C(),y+e+2*(r-e)*m+C(),x+t+2*(i-t)*m+C(),r+(E?0:C()),i+(E?0:C())]}),v}function lu(e,t,r){if(!e.length)return[];const i=[];i.push([e[0][0]+Ue(t,r),e[0][1]+Ue(t,r)]),i.push([e[0][0]+Ue(t,r),e[0][1]+Ue(t,r)]);for(let n=1;n<e.length;n++)i.push([e[n][0]+Ue(t,r),e[n][1]+Ue(t,r)]),n===e.length-1&&i.push([e[n][0]+Ue(t,r),e[n][1]+Ue(t,r)]);return bd(i,null,r)}function bd(e,t,r){const i=e.length,n=[];if(i>3){const s=[],a=1-r.curveTightness;n.push({op:"move",data:[e[1][0],e[1][1]]});for(let l=1;l+2<i;l++){const u=e[l];s[0]=[u[0],u[1]],s[1]=[u[0]+(a*e[l+1][0]-a*e[l-1][0])/6,u[1]+(a*e[l+1][1]-a*e[l-1][1])/6],s[2]=[e[l+1][0]+(a*e[l][0]-a*e[l+2][0])/6,e[l+1][1]+(a*e[l][1]-a*e[l+2][1])/6],s[3]=[e[l+1][0],e[l+1][1]],n.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else i===3?(n.push({op:"move",data:[e[1][0],e[1][1]]}),n.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):i===2&&n.push(...vm(e[0][0],e[0][1],e[1][0],e[1][1],r,!0,!0));return n}function P1(e,t,r,i,n,s,a,l){const u=[],h=[];if(l.roughness===0){e/=4,h.push([t+i*Math.cos(-e),r+n*Math.sin(-e)]);for(let d=0;d<=2*Math.PI;d+=e){const p=[t+i*Math.cos(d),r+n*Math.sin(d)];u.push(p),h.push(p)}h.push([t+i*Math.cos(0),r+n*Math.sin(0)]),h.push([t+i*Math.cos(e),r+n*Math.sin(e)])}else{const d=Ue(.5,l)-Math.PI/2;h.push([Ue(s,l)+t+.9*i*Math.cos(d-e),Ue(s,l)+r+.9*n*Math.sin(d-e)]);const p=2*Math.PI+d-.01;for(let m=d;m<p;m+=e){const y=[Ue(s,l)+t+i*Math.cos(m),Ue(s,l)+r+n*Math.sin(m)];u.push(y),h.push(y)}h.push([Ue(s,l)+t+i*Math.cos(d+2*Math.PI+.5*a),Ue(s,l)+r+n*Math.sin(d+2*Math.PI+.5*a)]),h.push([Ue(s,l)+t+.98*i*Math.cos(d+a),Ue(s,l)+r+.98*n*Math.sin(d+a)]),h.push([Ue(s,l)+t+.9*i*Math.cos(d+.5*a),Ue(s,l)+r+.9*n*Math.sin(d+.5*a)])}return[h,u]}function I1(e,t,r,i,n,s,a,l,u){const h=s+Ue(.1,u),d=[];d.push([Ue(l,u)+t+.9*i*Math.cos(h-e),Ue(l,u)+r+.9*n*Math.sin(h-e)]);for(let p=h;p<=a;p+=e)d.push([Ue(l,u)+t+i*Math.cos(p),Ue(l,u)+r+n*Math.sin(p)]);return d.push([t+i*Math.cos(a),r+n*Math.sin(a)]),d.push([t+i*Math.cos(a),r+n*Math.sin(a)]),bd(d,null,u)}function Zj(e,t,r,i,n,s,a,l){const u=[],h=[l.maxRandomnessOffset||1,(l.maxRandomnessOffset||1)+.3];let d=[0,0];const p=l.disableMultiStroke?1:2,m=l.preserveVertices;for(let y=0;y<p;y++)y===0?u.push({op:"move",data:[a[0],a[1]]}):u.push({op:"move",data:[a[0]+(m?0:Ue(h[0],l)),a[1]+(m?0:Ue(h[0],l))]}),d=m?[n,s]:[n+Ue(h[y],l),s+Ue(h[y],l)],u.push({op:"bcurveTo",data:[e+Ue(h[y],l),t+Ue(h[y],l),r+Ue(h[y],l),i+Ue(h[y],l),d[0],d[1]]});return u}function Hl(e){return[...e]}function $1(e,t=0){const r=e.length;if(r<3)throw new Error("A curve must have at least three points.");const i=[];if(r===3)i.push(Hl(e[0]),Hl(e[1]),Hl(e[2]),Hl(e[2]));else{const n=[];n.push(e[0],e[0]);for(let l=1;l<e.length;l++)n.push(e[l]),l===e.length-1&&n.push(e[l]);const s=[],a=1-t;i.push(Hl(n[0]));for(let l=1;l+2<n.length;l++){const u=n[l];s[0]=[u[0],u[1]],s[1]=[u[0]+(a*n[l+1][0]-a*n[l-1][0])/6,u[1]+(a*n[l+1][1]-a*n[l-1][1])/6],s[2]=[n[l+1][0]+(a*n[l][0]-a*n[l+2][0])/6,n[l+1][1]+(a*n[l][1]-a*n[l+2][1])/6],s[3]=[n[l+1][0],n[l+1][1]],i.push(s[1],s[2],s[3])}}return i}function Au(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function Jj(e,t,r){const i=Au(t,r);if(i===0)return Au(e,t);let n=((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/i;return n=Math.max(0,Math.min(1,n)),Au(e,yo(t,r,n))}function yo(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function bm(e,t,r,i){const n=i||[];if((function(l,u){const h=l[u+0],d=l[u+1],p=l[u+2],m=l[u+3];let y=3*d[0]-2*h[0]-m[0];y*=y;let x=3*d[1]-2*h[1]-m[1];x*=x;let v=3*p[0]-2*m[0]-h[0];v*=v;let S=3*p[1]-2*m[1]-h[1];return S*=S,y<v&&(y=v),x<S&&(x=S),y+x})(e,t)<r){const l=e[t+0];n.length?(s=n[n.length-1],a=l,Math.sqrt(Au(s,a))>1&&n.push(l)):n.push(l),n.push(e[t+3])}else{const u=e[t+0],h=e[t+1],d=e[t+2],p=e[t+3],m=yo(u,h,.5),y=yo(h,d,.5),x=yo(d,p,.5),v=yo(m,y,.5),S=yo(y,x,.5),C=yo(v,S,.5);bm([u,m,v,C],0,r,n),bm([C,S,x,p],0,r,n)}var s,a;return n}function ez(e,t){return Sd(e,0,e.length,t)}function Sd(e,t,r,i,n){const s=n||[],a=e[t],l=e[r-1];let u=0,h=1;for(let d=t+1;d<r-1;++d){const p=Jj(e[d],a,l);p>u&&(u=p,h=d)}return Math.sqrt(u)>i?(Sd(e,t,h+1,i,s),Sd(e,h,r,i,s)):(s.length||s.push(a),s.push(l)),s}function pg(e,t=.15,r){const i=[],n=(e.length-1)/3;for(let s=0;s<n;s++)bm(e,3*s,t,i);return r&&r>0?Sd(i,0,i.length,r):i}const yi="none";class wd{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,i){return{shape:t,sets:r||[],options:i||this.defaultOptions}}line(t,r,i,n,s){const a=this._o(s);return this._d("line",[i2(t,r,i,n,a)],a)}rectangle(t,r,i,n,s){const a=this._o(s),l=[],u=Qj(t,r,i,n,a);if(a.fill){const h=[[t,r],[t+i,r],[t+i,r+n],[t,r+n]];a.fillStyle==="solid"?l.push(fg([h],a)):l.push(ma([h],a))}return a.stroke!==yi&&l.push(u),this._d("rectangle",l,a)}ellipse(t,r,i,n,s){const a=this._o(s),l=[],u=n2(i,n,a),h=xm(t,r,a,u);if(a.fill)if(a.fillStyle==="solid"){const d=xm(t,r,a,u).opset;d.type="fillPath",l.push(d)}else l.push(ma([h.estimatedPoints],a));return a.stroke!==yi&&l.push(h.opset),this._d("ellipse",l,a)}circle(t,r,i,n){const s=this.ellipse(t,r,i,i,n);return s.shape="circle",s}linearPath(t,r){const i=this._o(r);return this._d("linearPath",[Ru(t,!1,i)],i)}arc(t,r,i,n,s,a,l=!1,u){const h=this._o(u),d=[],p=R1(t,r,i,n,s,a,l,!0,h);if(l&&h.fill)if(h.fillStyle==="solid"){const m=Object.assign({},h);m.disableMultiStroke=!0;const y=R1(t,r,i,n,s,a,!0,!1,m);y.type="fillPath",d.push(y)}else d.push((function(m,y,x,v,S,C,E){const L=m,B=y;let R=Math.abs(x/2),k=Math.abs(v/2);R+=Ue(.01*R,E),k+=Ue(.01*k,E);let A=S,O=C;for(;A<0;)A+=2*Math.PI,O+=2*Math.PI;O-A>2*Math.PI&&(A=0,O=2*Math.PI);const V=(O-A)/E.curveStepCount,q=[];for(let H=A;H<=O;H+=V)q.push([L+R*Math.cos(H),B+k*Math.sin(H)]);return q.push([L+R*Math.cos(O),B+k*Math.sin(O)]),q.push([L,B]),ma([q],E)})(t,r,i,n,s,a,h));return h.stroke!==yi&&d.push(p),this._d("arc",d,h)}curve(t,r){const i=this._o(r),n=[],s=L1(t,i);if(i.fill&&i.fill!==yi)if(i.fillStyle==="solid"){const a=L1(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{const a=[],l=t;if(l.length){const u=typeof l[0][0]=="number"?[l]:l;for(const h of u)h.length<3?a.push(...h):h.length===3?a.push(...pg($1([h[0],h[0],h[1],h[2]]),10,(1+i.roughness)/2)):a.push(...pg($1(h),10,(1+i.roughness)/2))}a.length&&n.push(ma([a],i))}return i.stroke!==yi&&n.push(s),this._d("curve",n,i)}polygon(t,r){const i=this._o(r),n=[],s=Ru(t,!0,i);return i.fill&&(i.fillStyle==="solid"?n.push(fg([t],i)):n.push(ma([t],i))),i.stroke!==yi&&n.push(s),this._d("polygon",n,i)}path(t,r){const i=this._o(r),n=[];if(!t)return this._d("path",n,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=i.fill&&i.fill!=="transparent"&&i.fill!==yi,a=i.stroke!==yi,l=!!(i.simplification&&i.simplification<1),u=(function(d,p,m){const y=t2(e2(g0(d))),x=[];let v=[],S=[0,0],C=[];const E=()=>{C.length>=4&&v.push(...pg(C,p)),C=[]},L=()=>{E(),v.length&&(x.push(v),v=[])};for(const{key:R,data:k}of y)switch(R){case"M":L(),S=[k[0],k[1]],v.push(S);break;case"L":E(),v.push([k[0],k[1]]);break;case"C":if(!C.length){const A=v.length?v[v.length-1]:S;C.push([A[0],A[1]])}C.push([k[0],k[1]]),C.push([k[2],k[3]]),C.push([k[4],k[5]]);break;case"Z":E(),v.push([S[0],S[1]])}if(L(),!m)return x;const B=[];for(const R of x){const k=ez(R,m);k.length&&B.push(k)}return B})(t,1,l?4-4*(i.simplification||1):(1+i.roughness)/2),h=A1(t,i);if(s)if(i.fillStyle==="solid")if(u.length===1){const d=A1(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(d.ops)})}else n.push(fg(u,i));else n.push(ma(u,i));return a&&(l?u.forEach((d=>{n.push(Ru(d,!1,i))})):n.push(h)),this._d("path",n,i)}opsToPath(t,r){let i="";for(const n of t.ops){const s=typeof r=="number"&&r>=0?n.data.map((a=>+a.toFixed(r))):n.data;switch(n.op){case"move":i+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":i+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":i+=`L${s[0]} ${s[1]} `}}return i.trim()}toPaths(t){const r=t.sets||[],i=t.options||this.defaultOptions,n=[];for(const s of r){let a=null;switch(s.type){case"path":a={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:yi};break;case"fillPath":a={d:this.opsToPath(s),stroke:yi,strokeWidth:0,fill:i.fill||yi};break;case"fillSketch":a=this.fillSketch(s,i)}a&&n.push(a)}return n}fillSketch(t,r){let i=r.fillWeight;return i<0&&(i=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||yi,strokeWidth:i,fill:yi}}_mergedShape(t){return t.filter(((r,i)=>i===0||r.op!=="move"))}}let tz=class{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new wd(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.ctx,s=t.options.fixedDecimalPlaceDigits;for(const a of r)switch(a.type){case"path":n.save(),n.strokeStyle=i.stroke==="none"?"transparent":i.stroke,n.lineWidth=i.strokeWidth,i.strokeLineDash&&n.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(n.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(n,a,s),n.restore();break;case"fillPath":{n.save(),n.fillStyle=i.fill||"";const l=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,a,s,l),n.restore();break}case"fillSketch":this.fillSketch(n,a,i)}}fillSketch(t,r,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=n,this._drawToContext(t,r,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,i,n="nonzero"){t.beginPath();for(const s of r.ops){const a=typeof i=="number"&&i>=0?s.data.map((l=>+l.toFixed(i))):s.data;switch(s.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1])}}r.type==="fillPath"?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,i,n,s){const a=this.gen.line(t,r,i,n,s);return this.draw(a),a}rectangle(t,r,i,n,s){const a=this.gen.rectangle(t,r,i,n,s);return this.draw(a),a}ellipse(t,r,i,n,s){const a=this.gen.ellipse(t,r,i,n,s);return this.draw(a),a}circle(t,r,i,n){const s=this.gen.circle(t,r,i,n);return this.draw(s),s}linearPath(t,r){const i=this.gen.linearPath(t,r);return this.draw(i),i}polygon(t,r){const i=this.gen.polygon(t,r);return this.draw(i),i}arc(t,r,i,n,s,a,l=!1,u){const h=this.gen.arc(t,r,i,n,s,a,l,u);return this.draw(h),h}curve(t,r){const i=this.gen.curve(t,r);return this.draw(i),i}path(t,r){const i=this.gen.path(t,r);return this.draw(i),i}};const cu="http://www.w3.org/2000/svg";let rz=class{constructor(t,r){this.svg=t,this.gen=new wd(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,s=n.createElementNS(cu,"g"),a=t.options.fixedDecimalPlaceDigits;for(const l of r){let u=null;switch(l.type){case"path":u=n.createElementNS(cu,"path"),u.setAttribute("d",this.opsToPath(l,a)),u.setAttribute("stroke",i.stroke),u.setAttribute("stroke-width",i.strokeWidth+""),u.setAttribute("fill","none"),i.strokeLineDash&&u.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&u.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break;case"fillPath":u=n.createElementNS(cu,"path"),u.setAttribute("d",this.opsToPath(l,a)),u.setAttribute("stroke","none"),u.setAttribute("stroke-width","0"),u.setAttribute("fill",i.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||u.setAttribute("fill-rule","evenodd");break;case"fillSketch":u=this.fillSketch(n,l,i)}u&&s.appendChild(u)}return s}fillSketch(t,r,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2);const s=t.createElementNS(cu,"path");return s.setAttribute("d",this.opsToPath(r,i.fixedDecimalPlaceDigits)),s.setAttribute("stroke",i.fill||""),s.setAttribute("stroke-width",n+""),s.setAttribute("fill","none"),i.fillLineDash&&s.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,i,n,s){const a=this.gen.line(t,r,i,n,s);return this.draw(a)}rectangle(t,r,i,n,s){const a=this.gen.rectangle(t,r,i,n,s);return this.draw(a)}ellipse(t,r,i,n,s){const a=this.gen.ellipse(t,r,i,n,s);return this.draw(a)}circle(t,r,i,n){const s=this.gen.circle(t,r,i,n);return this.draw(s)}linearPath(t,r){const i=this.gen.linearPath(t,r);return this.draw(i)}polygon(t,r){const i=this.gen.polygon(t,r);return this.draw(i)}arc(t,r,i,n,s,a,l=!1,u){const h=this.gen.arc(t,r,i,n,s,a,l,u);return this.draw(h)}curve(t,r){const i=this.gen.curve(t,r);return this.draw(i)}path(t,r){const i=this.gen.path(t,r);return this.draw(i)}};var Re={canvas:(e,t)=>new tz(e,t),svg:(e,t)=>new rz(e,t),generator:e=>new wd(e),newSeed:()=>wd.newSeed()},qe=T(async(e,t,r)=>{var p,m;let i;const n=t.useHtmlLabels||sr((p=dt())==null?void 0:p.htmlLabels);r?i=r:i="node default";const s=e.insert("g").attr("class",i).attr("id",t.domId||t.id),a=s.insert("g").attr("class","label").attr("style",$r(t.labelStyle));let l;t.label===void 0?l="":l=typeof t.label=="string"?t.label:t.label[0];const u=await Gs(a,zi(Ho(l),dt()),{useHtmlLabels:n,width:t.width||((m=dt().flowchart)==null?void 0:m.wrappingWidth),cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img});let h=u.getBBox();const d=((t==null?void 0:t.padding)??0)/2;if(n){const y=u.children[0],x=nt(u),v=y.getElementsByTagName("img");if(v){const S=l.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...v].map(C=>new Promise(E=>{function L(){if(C.style.display="flex",C.style.flexDirection="column",S){const B=dt().fontSize?dt().fontSize:window.getComputedStyle(document.body).fontSize,R=5,[k=LS.fontSize]=Qd(B),A=k*R+"px";C.style.minWidth=A,C.style.maxWidth=A}else C.style.width="100%";E(C)}T(L,"setupImage"),setTimeout(()=>{C.complete&&L()}),C.addEventListener("error",L),C.addEventListener("load",L)})))}h=y.getBoundingClientRect(),x.attr("width",h.width),x.attr("height",h.height)}return n?a.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"):a.attr("transform","translate(0, "+-h.height/2+")"),t.centerLabel&&a.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:s,bbox:h,halfPadding:d,label:a}},"labelHelper"),gg=T(async(e,t,r)=>{var u,h,d,p,m,y;const i=r.useHtmlLabels||sr((h=(u=dt())==null?void 0:u.flowchart)==null?void 0:h.htmlLabels),n=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await Gs(n,zi(Ho(t),dt()),{useHtmlLabels:i,width:r.width||((p=(d=dt())==null?void 0:d.flowchart)==null?void 0:p.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let a=s.getBBox();const l=r.padding/2;if(sr((y=(m=dt())==null?void 0:m.flowchart)==null?void 0:y.htmlLabels)){const x=s.children[0],v=nt(s);a=x.getBoundingClientRect(),v.attr("width",a.width),v.attr("height",a.height)}return i?n.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"):n.attr("transform","translate(0, "+-a.height/2+")"),r.centerLabel&&n.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"),n.insert("rect",":first-child"),{shapeSvg:e,bbox:a,halfPadding:l,label:n}},"insertLabel"),Ie=T((e,t)=>{const r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),Ne=T((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function rt(e){const t=e.map((r,i)=>`${i===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}T(rt,"createPathFromPoints");function Us(e,t,r,i,n,s){const a=[],u=r-e,h=i-t,d=u/s,p=2*Math.PI/d,m=t+h/2;for(let y=0;y<=50;y++){const x=y/50,v=e+x*u,S=m+n*Math.sin(p*(v-e));a.push({x:v,y:S})}return a}T(Us,"generateFullSineWavePoints");function Mc(e,t,r,i,n,s){const a=[],l=n*Math.PI/180,d=(s*Math.PI/180-l)/(i-1);for(let p=0;p<i;p++){const m=l+p*d,y=e+r*Math.cos(m),x=t+r*Math.sin(m);a.push({x:-y,y:-x})}return a}T(Mc,"generateCirclePoints");var iz=T((e,t)=>{var r=e.x,i=e.y,n=t.x-r,s=t.y-i,a=e.width/2,l=e.height/2,u,h;return Math.abs(s)*a>Math.abs(n)*l?(s<0&&(l=-l),u=s===0?0:l*n/s,h=l):(n<0&&(a=-a),u=a,h=n===0?0:a*s/n),{x:r+u,y:i+h}},"intersectRect"),Ga=iz;function o2(e,t){t&&e.attr("style",t)}T(o2,"applyStyle");async function a2(e){const t=nt(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=t.append("xhtml:div"),i=dt();let n=e.label;e.label&&Ia(e.label)&&(n=await Ry(e.label.replace(Ha.lineBreakRegex,`
|
|
247
|
+
`),i));const a='<span class="'+(e.isNode?"nodeLabel":"edgeLabel")+'" '+(e.labelStyle?'style="'+e.labelStyle+'"':"")+">"+n+"</span>";return r.html(zi(a,i)),o2(r,e.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}T(a2,"addHtmlLabel");var nz=T(async(e,t,r,i)=>{let n=e||"";if(typeof n=="object"&&(n=n[0]),sr(dt().flowchart.htmlLabels)){n=n.replace(/\\n|\n/g,"<br />"),ue.info("vertexText"+n);const s={isNode:i,label:Ho(n).replace(/fa[blrs]?:fa-[\w-]+/g,l=>`<i class='${l.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await a2(s)}else{const s=document.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("style",t.replace("color:","fill:"));let a=[];typeof n=="string"?a=n.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(n)?a=n:a=[];for(const l of a){const u=document.createElementNS("http://www.w3.org/2000/svg","tspan");u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),u.setAttribute("dy","1em"),u.setAttribute("x","0"),r?u.setAttribute("class","title-row"):u.setAttribute("class","row"),u.textContent=l.trim(),s.appendChild(u)}return s}},"createLabel"),ko=nz,Ys=T((e,t,r,i,n)=>["M",e+n,t,"H",e+r-n,"A",n,n,0,0,1,e+r,t+n,"V",t+i-n,"A",n,n,0,0,1,e+r-n,t+i,"H",e+n,"A",n,n,0,0,1,e,t+i-n,"V",t+n,"A",n,n,0,0,1,e+n,t,"Z"].join(" "),"createRoundedRectPathD"),l2=T(async(e,t)=>{ue.info("Creating subgraph rect for ",t.id,t);const r=dt(),{themeVariables:i,handDrawnSeed:n}=r,{clusterBkg:s,clusterBorder:a}=i,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:d}=De(t),p=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),m=sr(r.flowchart.htmlLabels),y=p.insert("g").attr("class","cluster-label "),x=await Gs(y,t.label,{style:t.labelStyle,useHtmlLabels:m,isNode:!0});let v=x.getBBox();if(sr(r.flowchart.htmlLabels)){const A=x.children[0],O=nt(x);v=A.getBoundingClientRect(),O.attr("width",v.width),O.attr("height",v.height)}const S=t.width<=v.width+t.padding?v.width+t.padding:t.width;t.width<=v.width+t.padding?t.diff=(S-t.width)/2-t.padding:t.diff=-t.padding;const C=t.height,E=t.x-S/2,L=t.y-C/2;ue.trace("Data ",t,JSON.stringify(t));let B;if(t.look==="handDrawn"){const A=Re.svg(p),O=Ae(t,{roughness:.7,fill:s,stroke:a,fillWeight:3,seed:n}),V=A.path(Ys(E,L,S,C,0),O);B=p.insert(()=>(ue.debug("Rough node insert CXC",V),V),":first-child"),B.select("path:nth-child(2)").attr("style",h.join(";")),B.select("path").attr("style",d.join(";").replace("fill","stroke"))}else B=p.insert("rect",":first-child"),B.attr("style",u).attr("rx",t.rx).attr("ry",t.ry).attr("x",E).attr("y",L).attr("width",S).attr("height",C);const{subGraphTitleTopMargin:R}=r0(r);if(y.attr("transform",`translate(${t.x-v.width/2}, ${t.y-t.height/2+R})`),l){const A=y.select("span");A&&A.attr("style",l)}const k=B.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=v.height-t.padding/2,t.intersect=function(A){return Ga(t,A)},{cluster:p,labelBBox:v}},"rect"),sz=T((e,t)=>{const r=e.insert("g").attr("class","note-cluster").attr("id",t.id),i=r.insert("rect",":first-child"),n=0*t.padding,s=n/2;i.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-s).attr("y",t.y-t.height/2-s).attr("width",t.width+n).attr("height",t.height+n).attr("fill","none");const a=i.node().getBBox();return t.width=a.width,t.height=a.height,t.intersect=function(l){return Ga(t,l)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),oz=T(async(e,t)=>{const r=dt(),{themeVariables:i,handDrawnSeed:n}=r,{altBackground:s,compositeBackground:a,compositeTitleBackground:l,nodeBorder:u}=i,h=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),d=h.insert("g",":first-child"),p=h.insert("g").attr("class","cluster-label");let m=h.append("rect");const y=p.node().appendChild(await ko(t.label,t.labelStyle,void 0,!0));let x=y.getBBox();if(sr(r.flowchart.htmlLabels)){const V=y.children[0],q=nt(y);x=V.getBoundingClientRect(),q.attr("width",x.width),q.attr("height",x.height)}const v=0*t.padding,S=v/2,C=(t.width<=x.width+t.padding?x.width+t.padding:t.width)+v;t.width<=x.width+t.padding?t.diff=(C-t.width)/2-t.padding:t.diff=-t.padding;const E=t.height+v,L=t.height+v-x.height-6,B=t.x-C/2,R=t.y-E/2;t.width=C;const k=t.y-t.height/2-S+x.height+2;let A;if(t.look==="handDrawn"){const V=t.cssClasses.includes("statediagram-cluster-alt"),q=Re.svg(h),H=t.rx||t.ry?q.path(Ys(B,R,C,E,10),{roughness:.7,fill:l,fillStyle:"solid",stroke:u,seed:n}):q.rectangle(B,R,C,E,{seed:n});A=h.insert(()=>H,":first-child");const Y=q.rectangle(B,k,C,L,{fill:V?s:a,fillStyle:V?"hachure":"solid",stroke:u,seed:n});A=h.insert(()=>H,":first-child"),m=h.insert(()=>Y)}else A=d.insert("rect",":first-child"),A.attr("class","outer").attr("x",B).attr("y",R).attr("width",C).attr("height",E).attr("data-look",t.look),m.attr("class","inner").attr("x",B).attr("y",k).attr("width",C).attr("height",L);p.attr("transform",`translate(${t.x-x.width/2}, ${R+1-(sr(r.flowchart.htmlLabels)?0:3)})`);const O=A.node().getBBox();return t.height=O.height,t.offsetX=0,t.offsetY=x.height-t.padding/2,t.labelBBox=x,t.intersect=function(V){return Ga(t,V)},{cluster:h,labelBBox:x}},"roundedWithTitle"),az=T(async(e,t)=>{ue.info("Creating subgraph rect for ",t.id,t);const r=dt(),{themeVariables:i,handDrawnSeed:n}=r,{clusterBkg:s,clusterBorder:a}=i,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:d}=De(t),p=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),m=sr(r.flowchart.htmlLabels),y=p.insert("g").attr("class","cluster-label "),x=await Gs(y,t.label,{style:t.labelStyle,useHtmlLabels:m,isNode:!0,width:t.width});let v=x.getBBox();if(sr(r.flowchart.htmlLabels)){const A=x.children[0],O=nt(x);v=A.getBoundingClientRect(),O.attr("width",v.width),O.attr("height",v.height)}const S=t.width<=v.width+t.padding?v.width+t.padding:t.width;t.width<=v.width+t.padding?t.diff=(S-t.width)/2-t.padding:t.diff=-t.padding;const C=t.height,E=t.x-S/2,L=t.y-C/2;ue.trace("Data ",t,JSON.stringify(t));let B;if(t.look==="handDrawn"){const A=Re.svg(p),O=Ae(t,{roughness:.7,fill:s,stroke:a,fillWeight:4,seed:n}),V=A.path(Ys(E,L,S,C,t.rx),O);B=p.insert(()=>(ue.debug("Rough node insert CXC",V),V),":first-child"),B.select("path:nth-child(2)").attr("style",h.join(";")),B.select("path").attr("style",d.join(";").replace("fill","stroke"))}else B=p.insert("rect",":first-child"),B.attr("style",u).attr("rx",t.rx).attr("ry",t.ry).attr("x",E).attr("y",L).attr("width",S).attr("height",C);const{subGraphTitleTopMargin:R}=r0(r);if(y.attr("transform",`translate(${t.x-v.width/2}, ${t.y-t.height/2+R})`),l){const A=y.select("span");A&&A.attr("style",l)}const k=B.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=v.height-t.padding/2,t.intersect=function(A){return Ga(t,A)},{cluster:p,labelBBox:v}},"kanbanSection"),lz=T((e,t)=>{const r=dt(),{themeVariables:i,handDrawnSeed:n}=r,{nodeBorder:s}=i,a=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),l=a.insert("g",":first-child"),u=0*t.padding,h=t.width+u;t.diff=-t.padding;const d=t.height+u,p=t.x-h/2,m=t.y-d/2;t.width=h;let y;if(t.look==="handDrawn"){const S=Re.svg(a).rectangle(p,m,h,d,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:n});y=a.insert(()=>S,":first-child")}else y=l.insert("rect",":first-child"),y.attr("class","divider").attr("x",p).attr("y",m).attr("width",h).attr("height",d).attr("data-look",t.look);const x=y.node().getBBox();return t.height=x.height,t.offsetX=0,t.offsetY=0,t.intersect=function(v){return Ga(t,v)},{cluster:a,labelBBox:{}}},"divider"),cz=l2,hz={rect:l2,squareRect:cz,roundedWithTitle:oz,noteGroup:sz,divider:lz,kanbanSection:az},c2=new Map,uz=T(async(e,t)=>{const r=t.shape||"rect",i=await hz[r](e,t);return c2.set(t.id,i),i},"insertCluster"),nV=T(()=>{c2=new Map},"clear");function h2(e,t){return e.intersect(t)}T(h2,"intersectNode");var dz=h2;function u2(e,t,r,i){var n=e.x,s=e.y,a=n-i.x,l=s-i.y,u=Math.sqrt(t*t*l*l+r*r*a*a),h=Math.abs(t*r*a/u);i.x<n&&(h=-h);var d=Math.abs(t*r*l/u);return i.y<s&&(d=-d),{x:n+h,y:s+d}}T(u2,"intersectEllipse");var d2=u2;function f2(e,t,r){return d2(e,t,t,r)}T(f2,"intersectCircle");var fz=f2;function p2(e,t,r,i){{const n=t.y-e.y,s=e.x-t.x,a=t.x*e.y-e.x*t.y,l=n*r.x+s*r.y+a,u=n*i.x+s*i.y+a,h=1e-6;if(l!==0&&u!==0&&Sm(l,u))return;const d=i.y-r.y,p=r.x-i.x,m=i.x*r.y-r.x*i.y,y=d*e.x+p*e.y+m,x=d*t.x+p*t.y+m;if(Math.abs(y)<h&&Math.abs(x)<h&&Sm(y,x))return;const v=n*p-d*s;if(v===0)return;const S=Math.abs(v/2);let C=s*m-p*a;const E=C<0?(C-S)/v:(C+S)/v;C=d*a-n*m;const L=C<0?(C-S)/v:(C+S)/v;return{x:E,y:L}}}T(p2,"intersectLine");function Sm(e,t){return e*t>0}T(Sm,"sameSign");var pz=p2;function g2(e,t,r){let i=e.x,n=e.y,s=[],a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(d){a=Math.min(a,d.x),l=Math.min(l,d.y)}):(a=Math.min(a,t.x),l=Math.min(l,t.y));let u=i-e.width/2-a,h=n-e.height/2-l;for(let d=0;d<t.length;d++){let p=t[d],m=t[d<t.length-1?d+1:0],y=pz(e,r,{x:u+p.x,y:h+p.y},{x:u+m.x,y:h+m.y});y&&s.push(y)}return s.length?(s.length>1&&s.sort(function(d,p){let m=d.x-r.x,y=d.y-r.y,x=Math.sqrt(m*m+y*y),v=p.x-r.x,S=p.y-r.y,C=Math.sqrt(v*v+S*S);return x<C?-1:x===C?0:1}),s[0]):e}T(g2,"intersectPolygon");var gz=g2,Ce={node:dz,circle:fz,ellipse:d2,polygon:gz,rect:Ga};function m2(e,t){const{labelStyles:r}=De(t);t.labelStyle=r;const i=Ne(t);let n=i;i||(n="anchor");const s=e.insert("g").attr("class",n).attr("id",t.domId||t.id),a=1,{cssStyles:l}=t,u=Re.svg(s),h=Ae(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);const d=u.circle(0,0,a*2,h),p=s.insert(()=>d,":first-child");return p.attr("class","anchor").attr("style",$r(l)),Ie(t,p),t.intersect=function(m){return ue.info("Circle intersect",t,a,m),Ce.circle(t,a,m)},s}T(m2,"anchor");function wm(e,t,r,i,n,s,a){const u=(e+r)/2,h=(t+i)/2,d=Math.atan2(i-t,r-e),p=(r-e)/2,m=(i-t)/2,y=p/n,x=m/s,v=Math.sqrt(y**2+x**2);if(v>1)throw new Error("The given radii are too small to create an arc between the points.");const S=Math.sqrt(1-v**2),C=u+S*s*Math.sin(d)*(a?-1:1),E=h-S*n*Math.cos(d)*(a?-1:1),L=Math.atan2((t-E)/s,(e-C)/n);let R=Math.atan2((i-E)/s,(r-C)/n)-L;a&&R<0&&(R+=2*Math.PI),!a&&R>0&&(R-=2*Math.PI);const k=[];for(let A=0;A<20;A++){const O=A/19,V=L+O*R,q=C+n*Math.cos(V),H=E+s*Math.sin(V);k.push({x:q,y:H})}return k}T(wm,"generateArcPoints");async function y2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.width+t.padding+20,l=s.height+t.padding,u=l/2,h=u/(2.5+l/50),{cssStyles:d}=t,p=[{x:a/2,y:-l/2},{x:-a/2,y:-l/2},...wm(-a/2,-l/2,-a/2,l/2,h,u,!1),{x:a/2,y:l/2},...wm(a/2,l/2,a/2,-l/2,h,u,!0)],m=Re.svg(n),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=rt(p),v=m.path(x,y),S=n.insert(()=>v,":first-child");return S.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),S.attr("transform",`translate(${h/2}, 0)`),Ie(t,S),t.intersect=function(C){return Ce.polygon(t,p,C)},n}T(y2,"bowTieRect");function Ks(e,t,r,i){return e.insert("polygon",":first-child").attr("points",i.map(function(n){return n.x+","+n.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}T(Ks,"insertPolygonShape");async function _2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.height+t.padding,l=12,u=s.width+t.padding+l,h=0,d=u,p=-a,m=0,y=[{x:h+l,y:p},{x:d,y:p},{x:d,y:m},{x:h,y:m},{x:h,y:p+l},{x:h+l,y:p}];let x;const{cssStyles:v}=t;if(t.look==="handDrawn"){const S=Re.svg(n),C=Ae(t,{}),E=rt(y),L=S.path(E,C);x=n.insert(()=>L,":first-child").attr("transform",`translate(${-u/2}, ${a/2})`),v&&x.attr("style",v)}else x=Ks(n,u,a,y);return i&&x.attr("style",i),Ie(t,x),t.intersect=function(S){return Ce.polygon(t,y,S)},n}T(_2,"card");function x2(e,t){const{nodeStyles:r}=De(t);t.label="";const i=e.insert("g").attr("class",Ne(t)).attr("id",t.domId??t.id),{cssStyles:n}=t,s=Math.max(28,t.width??0),a=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}],l=Re.svg(i),u=Ae(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const h=rt(a),d=l.path(h,u),p=i.insert(()=>d,":first-child");return n&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(m){return Ce.polygon(t,a,m)},i}T(x2,"choice");async function m0(e,t,r){const{labelStyles:i,nodeStyles:n}=De(t);t.labelStyle=i;const{shapeSvg:s,bbox:a,halfPadding:l}=await qe(e,t,Ne(t)),u=(r==null?void 0:r.padding)??l,h=a.width/2+u;let d;const{cssStyles:p}=t;if(t.look==="handDrawn"){const m=Re.svg(s),y=Ae(t,{}),x=m.circle(0,0,h*2,y);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",$r(p))}else d=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",n).attr("r",h).attr("cx",0).attr("cy",0);return Ie(t,d),t.calcIntersect=function(m,y){const x=m.width/2;return Ce.circle(m,x,y)},t.intersect=function(m){return ue.info("Circle intersect",t,h,m),Ce.circle(t,h,m)},s}T(m0,"circle");function v2(e){const t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=e*2,n={x:i/2*t,y:i/2*r},s={x:-(i/2)*t,y:i/2*r},a={x:-(i/2)*t,y:-(i/2)*r},l={x:i/2*t,y:-(i/2)*r};return`M ${s.x},${s.y} L ${l.x},${l.y}
|
|
248
|
+
M ${n.x},${n.y} L ${a.x},${a.y}`}T(v2,"createLine");function b2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r,t.label="";const n=e.insert("g").attr("class",Ne(t)).attr("id",t.domId??t.id),s=Math.max(30,(t==null?void 0:t.width)??0),{cssStyles:a}=t,l=Re.svg(n),u=Ae(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const h=l.circle(0,0,s*2,u),d=v2(s),p=l.path(d,u),m=n.insert(()=>h,":first-child");return m.insert(()=>p),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),i&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",i),Ie(t,m),t.intersect=function(y){return ue.info("crossedCircle intersect",t,{radius:s,point:y}),Ce.circle(t,s,y)},n}T(b2,"crossedCircle");function Zn(e,t,r,i=100,n=0,s=180){const a=[],l=n*Math.PI/180,d=(s*Math.PI/180-l)/(i-1);for(let p=0;p<i;p++){const m=l+p*d,y=e+r*Math.cos(m),x=t+r*Math.sin(m);a.push({x:-y,y:-x})}return a}T(Zn,"generateCirclePoints");async function S2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=s.width+(t.padding??0),u=s.height+(t.padding??0),h=Math.max(5,u*.1),{cssStyles:d}=t,p=[...Zn(l/2,-u/2,h,30,-90,0),{x:-l/2-h,y:h},...Zn(l/2+h*2,-h,h,20,-180,-270),...Zn(l/2+h*2,h,h,20,-90,-180),{x:-l/2-h,y:-u/2},...Zn(l/2,u/2,h,20,0,90)],m=[{x:l/2,y:-u/2-h},{x:-l/2,y:-u/2-h},...Zn(l/2,-u/2,h,20,-90,0),{x:-l/2-h,y:-h},...Zn(l/2+l*.1,-h,h,20,-180,-270),...Zn(l/2+l*.1,h,h,20,-90,-180),{x:-l/2-h,y:u/2},...Zn(l/2,u/2,h,20,0,90),{x:-l/2,y:u/2+h},{x:l/2,y:u/2+h}],y=Re.svg(n),x=Ae(t,{fill:"none"});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const S=rt(p).replace("Z",""),C=y.path(S,x),E=rt(m),L=y.path(E,{...x}),B=n.insert("g",":first-child");return B.insert(()=>L,":first-child").attr("stroke-opacity",0),B.insert(()=>C,":first-child"),B.attr("class","text"),d&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",i),B.attr("transform",`translate(${h}, 0)`),a.attr("transform",`translate(${-l/2+h-(s.x-(s.left??0))},${-u/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Ie(t,B),t.intersect=function(R){return Ce.polygon(t,m,R)},n}T(S2,"curlyBraceLeft");function Jn(e,t,r,i=100,n=0,s=180){const a=[],l=n*Math.PI/180,d=(s*Math.PI/180-l)/(i-1);for(let p=0;p<i;p++){const m=l+p*d,y=e+r*Math.cos(m),x=t+r*Math.sin(m);a.push({x:y,y:x})}return a}T(Jn,"generateCirclePoints");async function w2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=s.width+(t.padding??0),u=s.height+(t.padding??0),h=Math.max(5,u*.1),{cssStyles:d}=t,p=[...Jn(l/2,-u/2,h,20,-90,0),{x:l/2+h,y:-h},...Jn(l/2+h*2,-h,h,20,-180,-270),...Jn(l/2+h*2,h,h,20,-90,-180),{x:l/2+h,y:u/2},...Jn(l/2,u/2,h,20,0,90)],m=[{x:-l/2,y:-u/2-h},{x:l/2,y:-u/2-h},...Jn(l/2,-u/2,h,20,-90,0),{x:l/2+h,y:-h},...Jn(l/2+h*2,-h,h,20,-180,-270),...Jn(l/2+h*2,h,h,20,-90,-180),{x:l/2+h,y:u/2},...Jn(l/2,u/2,h,20,0,90),{x:l/2,y:u/2+h},{x:-l/2,y:u/2+h}],y=Re.svg(n),x=Ae(t,{fill:"none"});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const S=rt(p).replace("Z",""),C=y.path(S,x),E=rt(m),L=y.path(E,{...x}),B=n.insert("g",":first-child");return B.insert(()=>L,":first-child").attr("stroke-opacity",0),B.insert(()=>C,":first-child"),B.attr("class","text"),d&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",i),B.attr("transform",`translate(${-h}, 0)`),a.attr("transform",`translate(${-l/2+(t.padding??0)/2-(s.x-(s.left??0))},${-u/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Ie(t,B),t.intersect=function(R){return Ce.polygon(t,m,R)},n}T(w2,"curlyBraceRight");function br(e,t,r,i=100,n=0,s=180){const a=[],l=n*Math.PI/180,d=(s*Math.PI/180-l)/(i-1);for(let p=0;p<i;p++){const m=l+p*d,y=e+r*Math.cos(m),x=t+r*Math.sin(m);a.push({x:-y,y:-x})}return a}T(br,"generateCirclePoints");async function C2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=s.width+(t.padding??0),u=s.height+(t.padding??0),h=Math.max(5,u*.1),{cssStyles:d}=t,p=[...br(l/2,-u/2,h,30,-90,0),{x:-l/2-h,y:h},...br(l/2+h*2,-h,h,20,-180,-270),...br(l/2+h*2,h,h,20,-90,-180),{x:-l/2-h,y:-u/2},...br(l/2,u/2,h,20,0,90)],m=[...br(-l/2+h+h/2,-u/2,h,20,-90,-180),{x:l/2-h/2,y:h},...br(-l/2-h/2,-h,h,20,0,90),...br(-l/2-h/2,h,h,20,-90,0),{x:l/2-h/2,y:-h},...br(-l/2+h+h/2,u/2,h,30,-180,-270)],y=[{x:l/2,y:-u/2-h},{x:-l/2,y:-u/2-h},...br(l/2,-u/2,h,20,-90,0),{x:-l/2-h,y:-h},...br(l/2+h*2,-h,h,20,-180,-270),...br(l/2+h*2,h,h,20,-90,-180),{x:-l/2-h,y:u/2},...br(l/2,u/2,h,20,0,90),{x:-l/2,y:u/2+h},{x:l/2-h-h/2,y:u/2+h},...br(-l/2+h+h/2,-u/2,h,20,-90,-180),{x:l/2-h/2,y:h},...br(-l/2-h/2,-h,h,20,0,90),...br(-l/2-h/2,h,h,20,-90,0),{x:l/2-h/2,y:-h},...br(-l/2+h+h/2,u/2,h,30,-180,-270)],x=Re.svg(n),v=Ae(t,{fill:"none"});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const C=rt(p).replace("Z",""),E=x.path(C,v),B=rt(m).replace("Z",""),R=x.path(B,v),k=rt(y),A=x.path(k,{...v}),O=n.insert("g",":first-child");return O.insert(()=>A,":first-child").attr("stroke-opacity",0),O.insert(()=>E,":first-child"),O.insert(()=>R,":first-child"),O.attr("class","text"),d&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",i),O.attr("transform",`translate(${h-h/4}, 0)`),a.attr("transform",`translate(${-l/2+(t.padding??0)/2-(s.x-(s.left??0))},${-u/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Ie(t,O),t.intersect=function(V){return Ce.polygon(t,y,V)},n}T(C2,"curlyBraces");async function k2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=80,l=20,u=Math.max(a,(s.width+(t.padding??0)*2)*1.25,(t==null?void 0:t.width)??0),h=Math.max(l,s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),d=h/2,{cssStyles:p}=t,m=Re.svg(n),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=u,v=h,S=x-d,C=v/4,E=[{x:S,y:0},{x:C,y:0},{x:0,y:v/2},{x:C,y:v},{x:S,y:v},...Mc(-S,-v/2,d,50,270,90)],L=rt(E),B=m.path(L,y),R=n.insert(()=>B,":first-child");return R.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&R.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&R.selectChildren("path").attr("style",i),R.attr("transform",`translate(${-u/2}, ${-h/2})`),Ie(t,R),t.intersect=function(k){return Ce.polygon(t,E,k)},n}T(k2,"curvedTrapezoid");var mz=T((e,t,r,i,n,s)=>[`M${e},${t+s}`,`a${n},${s} 0,0,0 ${r},0`,`a${n},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${s} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),yz=T((e,t,r,i,n,s)=>[`M${e},${t+s}`,`M${e+r},${t+s}`,`a${n},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${s} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),_z=T((e,t,r,i,n,s)=>[`M${e-r/2},${-i/2}`,`a${n},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function T2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+t.padding,t.width??0),u=l/2,h=u/(2.5+l/50),d=Math.max(s.height+h+t.padding,t.height??0);let p;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=Re.svg(n),x=yz(0,0,l,d,u,h),v=_z(0,h,l,d,u,h),S=y.path(x,Ae(t,{})),C=y.path(v,Ae(t,{fill:"none"}));p=n.insert(()=>C,":first-child"),p=n.insert(()=>S,":first-child"),p.attr("class","basic label-container"),m&&p.attr("style",m)}else{const y=mz(0,0,l,d,u,h);p=n.insert("path",":first-child").attr("d",y).attr("class","basic label-container").attr("style",$r(m)).attr("style",i)}return p.attr("label-offset-y",h),p.attr("transform",`translate(${-l/2}, ${-(d/2+h)})`),Ie(t,p),a.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+(t.padding??0)/1.5-(s.y-(s.top??0))})`),t.intersect=function(y){const x=Ce.rect(t,y),v=x.x-(t.x??0);if(u!=0&&(Math.abs(v)<(t.width??0)/2||Math.abs(v)==(t.width??0)/2&&Math.abs(x.y-(t.y??0))>(t.height??0)/2-h)){let S=h*h*(1-v*v/(u*u));S>0&&(S=Math.sqrt(S)),S=h-S,y.y-(t.y??0)>0&&(S=-S),x.y+=S}return x},n}T(T2,"cylinder");async function E2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=s.width+t.padding,u=s.height+t.padding,h=u*.2,d=-l/2,p=-u/2-h/2,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const v=[{x:d,y:p+h},{x:-d,y:p+h},{x:-d,y:-p},{x:d,y:-p},{x:d,y:p},{x:-d,y:p},{x:-d,y:p+h}],S=y.polygon(v.map(E=>[E.x,E.y]),x),C=n.insert(()=>S,":first-child");return C.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),a.attr("transform",`translate(${d+(t.padding??0)/2-(s.x-(s.left??0))}, ${p+h+(t.padding??0)/2-(s.y-(s.top??0))})`),Ie(t,C),t.intersect=function(E){return Ce.rect(t,E)},n}T(E2,"dividedRectangle");async function B2(e,t){var m,y;const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,halfPadding:a}=await qe(e,t,Ne(t)),u=s.width/2+a+5,h=s.width/2+a;let d;const{cssStyles:p}=t;if(t.look==="handDrawn"){const x=Re.svg(n),v=Ae(t,{roughness:.2,strokeWidth:2.5}),S=Ae(t,{roughness:.2,strokeWidth:1.5}),C=x.circle(0,0,u*2,v),E=x.circle(0,0,h*2,S);d=n.insert("g",":first-child"),d.attr("class",$r(t.cssClasses)).attr("style",$r(p)),(m=d.node())==null||m.appendChild(C),(y=d.node())==null||y.appendChild(E)}else{d=n.insert("g",":first-child");const x=d.insert("circle",":first-child"),v=d.insert("circle");d.attr("class","basic label-container").attr("style",i),x.attr("class","outer-circle").attr("style",i).attr("r",u).attr("cx",0).attr("cy",0),v.attr("class","inner-circle").attr("style",i).attr("r",h).attr("cx",0).attr("cy",0)}return Ie(t,d),t.intersect=function(x){return ue.info("DoubleCircle intersect",t,u,x),Ce.circle(t,u,x)},n}T(B2,"doublecircle");function M2(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:n}=De(t);t.label="",t.labelStyle=i;const s=e.insert("g").attr("class",Ne(t)).attr("id",t.domId??t.id),a=7,{cssStyles:l}=t,u=Re.svg(s),{nodeBorder:h}=r,d=Ae(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(d.roughness=0);const p=u.circle(0,0,a*2,d),m=s.insert(()=>p,":first-child");return m.selectAll("path").attr("style",`fill: ${h} !important;`),l&&l.length>0&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",l),n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),Ie(t,m),t.intersect=function(y){return ue.info("filledCircle intersect",t,{radius:a,point:y}),Ce.circle(t,a,y)},s}T(M2,"filledCircle");async function L2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=s.width+(t.padding??0),u=l+s.height,h=l+s.height,d=[{x:0,y:-u},{x:h,y:-u},{x:h/2,y:0}],{cssStyles:p}=t,m=Re.svg(n),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=rt(d),v=m.path(x,y),S=n.insert(()=>v,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`);return p&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",i),t.width=l,t.height=u,Ie(t,S),a.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${-u/2+(t.padding??0)/2+(s.y-(s.top??0))})`),t.intersect=function(C){return ue.info("Triangle intersect",t,d,C),Ce.polygon(t,d,C)},n}T(L2,"flippedTriangle");function R2(e,t,{dir:r,config:{state:i,themeVariables:n}}){const{nodeStyles:s}=De(t);t.label="";const a=e.insert("g").attr("class",Ne(t)).attr("id",t.domId??t.id),{cssStyles:l}=t;let u=Math.max(70,(t==null?void 0:t.width)??0),h=Math.max(10,(t==null?void 0:t.height)??0);r==="LR"&&(u=Math.max(10,(t==null?void 0:t.width)??0),h=Math.max(70,(t==null?void 0:t.height)??0));const d=-1*u/2,p=-1*h/2,m=Re.svg(a),y=Ae(t,{stroke:n.lineColor,fill:n.lineColor});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=m.rectangle(d,p,u,h,y),v=a.insert(()=>x,":first-child");l&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",l),s&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",s),Ie(t,v);const S=(i==null?void 0:i.padding)??0;return t.width&&t.height&&(t.width+=S/2||0,t.height+=S/2||0),t.intersect=function(C){return Ce.rect(t,C)},a}T(R2,"forkJoin");async function A2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const n=80,s=50,{shapeSvg:a,bbox:l}=await qe(e,t,Ne(t)),u=Math.max(n,l.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),h=Math.max(s,l.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),d=h/2,{cssStyles:p}=t,m=Re.svg(a),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-u/2,y:-h/2},{x:u/2-d,y:-h/2},...Mc(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},{x:-u/2,y:h/2}],v=rt(x),S=m.path(v,y),C=a.insert(()=>S,":first-child");return C.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",i),Ie(t,C),t.intersect=function(E){return ue.info("Pill intersect",t,{radius:d,point:E}),Ce.polygon(t,x,E)},a}T(A2,"halfRoundedRectangle");async function D2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.height+(t.padding??0),l=s.width+(t.padding??0)*2.5,{cssStyles:u}=t,h=Re.svg(n),d=Ae(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let p=l/2;const m=p/6;p=p+m;const y=a/2,x=y/2,v=p-x,S=[{x:-v,y:-y},{x:0,y:-y},{x:v,y:-y},{x:p,y:0},{x:v,y},{x:0,y},{x:-v,y},{x:-p,y:0}],C=rt(S),E=h.path(C,d),L=n.insert(()=>E,":first-child");return L.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&L.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&L.selectChildren("path").attr("style",i),t.width=l,t.height=a,Ie(t,L),t.intersect=function(B){return Ce.polygon(t,S,B)},n}T(D2,"hexagon");async function P2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.label="",t.labelStyle=r;const{shapeSvg:n}=await qe(e,t,Ne(t)),s=Math.max(30,(t==null?void 0:t.width)??0),a=Math.max(30,(t==null?void 0:t.height)??0),{cssStyles:l}=t,u=Re.svg(n),h=Ae(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const d=[{x:0,y:0},{x:s,y:0},{x:0,y:a},{x:s,y:a}],p=rt(d),m=u.path(p,h),y=n.insert(()=>m,":first-child");return y.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",l),i&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",i),y.attr("transform",`translate(${-s/2}, ${-a/2})`),Ie(t,y),t.intersect=function(x){return ue.info("Pill intersect",t,{points:d}),Ce.polygon(t,d,x)},n}T(P2,"hourglass");async function I2(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:n}=De(t);t.labelStyle=n;const s=t.assetHeight??48,a=t.assetWidth??48,l=Math.max(s,a),u=i==null?void 0:i.wrappingWidth;t.width=Math.max(l,u??0);const{shapeSvg:h,bbox:d,label:p}=await qe(e,t,"icon-shape default"),m=t.pos==="t",y=l,x=l,{nodeBorder:v}=r,{stylesMap:S}=qa(t),C=-x/2,E=-y/2,L=t.label?8:0,B=Re.svg(h),R=Ae(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(R.roughness=0,R.fillStyle="solid");const k=B.rectangle(C,E,x,y,R),A=Math.max(x,d.width),O=y+d.height+L,V=B.rectangle(-A/2,-O/2,A,O,{...R,fill:"transparent",stroke:"none"}),q=h.insert(()=>k,":first-child"),H=h.insert(()=>V);if(t.icon){const Y=h.append("g");Y.html(`<g>${await Hc(t.icon,{height:l,width:l,fallbackPrefix:""})}</g>`);const F=Y.node().getBBox(),z=F.width,$=F.height,j=F.x,W=F.y;Y.attr("transform",`translate(${-z/2-j},${m?d.height/2+L/2-$/2-W:-d.height/2-L/2-$/2-W})`),Y.attr("style",`color: ${S.get("stroke")??v};`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${m?-O/2:O/2-d.height})`),q.attr("transform",`translate(0,${m?d.height/2+L/2:-d.height/2-L/2})`),Ie(t,H),t.intersect=function(Y){if(ue.info("iconSquare intersect",t,Y),!t.label)return Ce.rect(t,Y);const F=t.x??0,z=t.y??0,$=t.height??0;let j=[];return m?j=[{x:F-d.width/2,y:z-$/2},{x:F+d.width/2,y:z-$/2},{x:F+d.width/2,y:z-$/2+d.height+L},{x:F+x/2,y:z-$/2+d.height+L},{x:F+x/2,y:z+$/2},{x:F-x/2,y:z+$/2},{x:F-x/2,y:z-$/2+d.height+L},{x:F-d.width/2,y:z-$/2+d.height+L}]:j=[{x:F-x/2,y:z-$/2},{x:F+x/2,y:z-$/2},{x:F+x/2,y:z-$/2+y},{x:F+d.width/2,y:z-$/2+y},{x:F+d.width/2/2,y:z+$/2},{x:F-d.width/2,y:z+$/2},{x:F-d.width/2,y:z-$/2+y},{x:F-x/2,y:z-$/2+y}],Ce.polygon(t,j,Y)},h}T(I2,"icon");async function $2(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:n}=De(t);t.labelStyle=n;const s=t.assetHeight??48,a=t.assetWidth??48,l=Math.max(s,a),u=i==null?void 0:i.wrappingWidth;t.width=Math.max(l,u??0);const{shapeSvg:h,bbox:d,label:p}=await qe(e,t,"icon-shape default"),m=20,y=t.label?8:0,x=t.pos==="t",{nodeBorder:v,mainBkg:S}=r,{stylesMap:C}=qa(t),E=Re.svg(h),L=Ae(t,{});t.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const B=C.get("fill");L.stroke=B??S;const R=h.append("g");t.icon&&R.html(`<g>${await Hc(t.icon,{height:l,width:l,fallbackPrefix:""})}</g>`);const k=R.node().getBBox(),A=k.width,O=k.height,V=k.x,q=k.y,H=Math.max(A,O)*Math.SQRT2+m*2,Y=E.circle(0,0,H,L),F=Math.max(H,d.width),z=H+d.height+y,$=E.rectangle(-F/2,-z/2,F,z,{...L,fill:"transparent",stroke:"none"}),j=h.insert(()=>Y,":first-child"),W=h.insert(()=>$);return R.attr("transform",`translate(${-A/2-V},${x?d.height/2+y/2-O/2-q:-d.height/2-y/2-O/2-q})`),R.attr("style",`color: ${C.get("stroke")??v};`),p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${x?-z/2:z/2-d.height})`),j.attr("transform",`translate(0,${x?d.height/2+y/2:-d.height/2-y/2})`),Ie(t,W),t.intersect=function(P){return ue.info("iconSquare intersect",t,P),Ce.rect(t,P)},h}T($2,"iconCircle");async function j2(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:n}=De(t);t.labelStyle=n;const s=t.assetHeight??48,a=t.assetWidth??48,l=Math.max(s,a),u=i==null?void 0:i.wrappingWidth;t.width=Math.max(l,u??0);const{shapeSvg:h,bbox:d,halfPadding:p,label:m}=await qe(e,t,"icon-shape default"),y=t.pos==="t",x=l+p*2,v=l+p*2,{nodeBorder:S,mainBkg:C}=r,{stylesMap:E}=qa(t),L=-v/2,B=-x/2,R=t.label?8:0,k=Re.svg(h),A=Ae(t,{});t.look!=="handDrawn"&&(A.roughness=0,A.fillStyle="solid");const O=E.get("fill");A.stroke=O??C;const V=k.path(Ys(L,B,v,x,5),A),q=Math.max(v,d.width),H=x+d.height+R,Y=k.rectangle(-q/2,-H/2,q,H,{...A,fill:"transparent",stroke:"none"}),F=h.insert(()=>V,":first-child").attr("class","icon-shape2"),z=h.insert(()=>Y);if(t.icon){const $=h.append("g");$.html(`<g>${await Hc(t.icon,{height:l,width:l,fallbackPrefix:""})}</g>`);const j=$.node().getBBox(),W=j.width,P=j.height,Q=j.x,ee=j.y;$.attr("transform",`translate(${-W/2-Q},${y?d.height/2+R/2-P/2-ee:-d.height/2-R/2-P/2-ee})`),$.attr("style",`color: ${E.get("stroke")??S};`)}return m.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${y?-H/2:H/2-d.height})`),F.attr("transform",`translate(0,${y?d.height/2+R/2:-d.height/2-R/2})`),Ie(t,z),t.intersect=function($){if(ue.info("iconSquare intersect",t,$),!t.label)return Ce.rect(t,$);const j=t.x??0,W=t.y??0,P=t.height??0;let Q=[];return y?Q=[{x:j-d.width/2,y:W-P/2},{x:j+d.width/2,y:W-P/2},{x:j+d.width/2,y:W-P/2+d.height+R},{x:j+v/2,y:W-P/2+d.height+R},{x:j+v/2,y:W+P/2},{x:j-v/2,y:W+P/2},{x:j-v/2,y:W-P/2+d.height+R},{x:j-d.width/2,y:W-P/2+d.height+R}]:Q=[{x:j-v/2,y:W-P/2},{x:j+v/2,y:W-P/2},{x:j+v/2,y:W-P/2+x},{x:j+d.width/2,y:W-P/2+x},{x:j+d.width/2/2,y:W+P/2},{x:j-d.width/2,y:W+P/2},{x:j-d.width/2,y:W-P/2+x},{x:j-v/2,y:W-P/2+x}],Ce.polygon(t,Q,$)},h}T(j2,"iconRounded");async function z2(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:n}=De(t);t.labelStyle=n;const s=t.assetHeight??48,a=t.assetWidth??48,l=Math.max(s,a),u=i==null?void 0:i.wrappingWidth;t.width=Math.max(l,u??0);const{shapeSvg:h,bbox:d,halfPadding:p,label:m}=await qe(e,t,"icon-shape default"),y=t.pos==="t",x=l+p*2,v=l+p*2,{nodeBorder:S,mainBkg:C}=r,{stylesMap:E}=qa(t),L=-v/2,B=-x/2,R=t.label?8:0,k=Re.svg(h),A=Ae(t,{});t.look!=="handDrawn"&&(A.roughness=0,A.fillStyle="solid");const O=E.get("fill");A.stroke=O??C;const V=k.path(Ys(L,B,v,x,.1),A),q=Math.max(v,d.width),H=x+d.height+R,Y=k.rectangle(-q/2,-H/2,q,H,{...A,fill:"transparent",stroke:"none"}),F=h.insert(()=>V,":first-child"),z=h.insert(()=>Y);if(t.icon){const $=h.append("g");$.html(`<g>${await Hc(t.icon,{height:l,width:l,fallbackPrefix:""})}</g>`);const j=$.node().getBBox(),W=j.width,P=j.height,Q=j.x,ee=j.y;$.attr("transform",`translate(${-W/2-Q},${y?d.height/2+R/2-P/2-ee:-d.height/2-R/2-P/2-ee})`),$.attr("style",`color: ${E.get("stroke")??S};`)}return m.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${y?-H/2:H/2-d.height})`),F.attr("transform",`translate(0,${y?d.height/2+R/2:-d.height/2-R/2})`),Ie(t,z),t.intersect=function($){if(ue.info("iconSquare intersect",t,$),!t.label)return Ce.rect(t,$);const j=t.x??0,W=t.y??0,P=t.height??0;let Q=[];return y?Q=[{x:j-d.width/2,y:W-P/2},{x:j+d.width/2,y:W-P/2},{x:j+d.width/2,y:W-P/2+d.height+R},{x:j+v/2,y:W-P/2+d.height+R},{x:j+v/2,y:W+P/2},{x:j-v/2,y:W+P/2},{x:j-v/2,y:W-P/2+d.height+R},{x:j-d.width/2,y:W-P/2+d.height+R}]:Q=[{x:j-v/2,y:W-P/2},{x:j+v/2,y:W-P/2},{x:j+v/2,y:W-P/2+x},{x:j+d.width/2,y:W-P/2+x},{x:j+d.width/2/2,y:W+P/2},{x:j-d.width/2,y:W+P/2},{x:j-d.width/2,y:W-P/2+x},{x:j-v/2,y:W-P/2+x}],Ce.polygon(t,Q,$)},h}T(z2,"iconSquare");async function O2(e,t,{config:{flowchart:r}}){const i=new Image;i.src=(t==null?void 0:t.img)??"",await i.decode();const n=Number(i.naturalWidth.toString().replace("px","")),s=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=n/s;const{labelStyles:a}=De(t);t.labelStyle=a;const l=r==null?void 0:r.wrappingWidth;t.defaultWidth=r==null?void 0:r.wrappingWidth;const u=Math.max(t.label?l??0:0,(t==null?void 0:t.assetWidth)??n),h=t.constraint==="on"&&t!=null&&t.assetHeight?t.assetHeight*t.imageAspectRatio:u,d=t.constraint==="on"?h/t.imageAspectRatio:(t==null?void 0:t.assetHeight)??s;t.width=Math.max(h,l??0);const{shapeSvg:p,bbox:m,label:y}=await qe(e,t,"image-shape default"),x=t.pos==="t",v=-h/2,S=-d/2,C=t.label?8:0,E=Re.svg(p),L=Ae(t,{});t.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const B=E.rectangle(v,S,h,d,L),R=Math.max(h,m.width),k=d+m.height+C,A=E.rectangle(-R/2,-k/2,R,k,{...L,fill:"none",stroke:"none"}),O=p.insert(()=>B,":first-child"),V=p.insert(()=>A);if(t.img){const q=p.append("image");q.attr("href",t.img),q.attr("width",h),q.attr("height",d),q.attr("preserveAspectRatio","none"),q.attr("transform",`translate(${-h/2},${x?k/2-d:-k/2})`)}return y.attr("transform",`translate(${-m.width/2-(m.x-(m.left??0))},${x?-d/2-m.height/2-C/2:d/2-m.height/2+C/2})`),O.attr("transform",`translate(0,${x?m.height/2+C/2:-m.height/2-C/2})`),Ie(t,V),t.intersect=function(q){if(ue.info("iconSquare intersect",t,q),!t.label)return Ce.rect(t,q);const H=t.x??0,Y=t.y??0,F=t.height??0;let z=[];return x?z=[{x:H-m.width/2,y:Y-F/2},{x:H+m.width/2,y:Y-F/2},{x:H+m.width/2,y:Y-F/2+m.height+C},{x:H+h/2,y:Y-F/2+m.height+C},{x:H+h/2,y:Y+F/2},{x:H-h/2,y:Y+F/2},{x:H-h/2,y:Y-F/2+m.height+C},{x:H-m.width/2,y:Y-F/2+m.height+C}]:z=[{x:H-h/2,y:Y-F/2},{x:H+h/2,y:Y-F/2},{x:H+h/2,y:Y-F/2+d},{x:H+m.width/2,y:Y-F/2+d},{x:H+m.width/2/2,y:Y+F/2},{x:H-m.width/2,y:Y+F/2},{x:H-m.width/2,y:Y-F/2+d},{x:H-h/2,y:Y-F/2+d}],Ce.polygon(t,z,q)},p}T(O2,"imageSquare");async function F2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=[{x:0,y:0},{x:a,y:0},{x:a+3*l/6,y:-l},{x:-3*l/6,y:-l}];let h;const{cssStyles:d}=t;if(t.look==="handDrawn"){const p=Re.svg(n),m=Ae(t,{}),y=rt(u),x=p.path(y,m);h=n.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${l/2})`),d&&h.attr("style",d)}else h=Ks(n,a,l,u);return i&&h.attr("style",i),t.width=a,t.height=l,Ie(t,h),t.intersect=function(p){return Ce.polygon(t,u,p)},n}T(F2,"inv_trapezoid");async function tf(e,t,r){const{labelStyles:i,nodeStyles:n}=De(t);t.labelStyle=i;const{shapeSvg:s,bbox:a}=await qe(e,t,Ne(t)),l=Math.max(a.width+r.labelPaddingX*2,(t==null?void 0:t.width)||0),u=Math.max(a.height+r.labelPaddingY*2,(t==null?void 0:t.height)||0),h=-l/2,d=-u/2;let p,{rx:m,ry:y}=t;const{cssStyles:x}=t;if(r!=null&&r.rx&&r.ry&&(m=r.rx,y=r.ry),t.look==="handDrawn"){const v=Re.svg(s),S=Ae(t,{}),C=m||y?v.path(Ys(h,d,l,u,m||0),S):v.rectangle(h,d,l,u,S);p=s.insert(()=>C,":first-child"),p.attr("class","basic label-container").attr("style",$r(x))}else p=s.insert("rect",":first-child"),p.attr("class","basic label-container").attr("style",n).attr("rx",$r(m)).attr("ry",$r(y)).attr("x",h).attr("y",d).attr("width",l).attr("height",u);return Ie(t,p),t.calcIntersect=function(v,S){return Ce.rect(v,S)},t.intersect=function(v){return Ce.rect(t,v)},s}T(tf,"drawRect");async function N2(e,t){const{shapeSvg:r,bbox:i,label:n}=await qe(e,t,"label"),s=r.insert("rect",":first-child");return s.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),n.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),Ie(t,s),t.intersect=function(u){return Ce.rect(t,u)},r}T(N2,"labelRect");async function W2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),u=[{x:0,y:0},{x:a+3*l/6,y:0},{x:a,y:-l},{x:-(3*l)/6,y:-l}];let h;const{cssStyles:d}=t;if(t.look==="handDrawn"){const p=Re.svg(n),m=Ae(t,{}),y=rt(u),x=p.path(y,m);h=n.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${l/2})`),d&&h.attr("style",d)}else h=Ks(n,a,l,u);return i&&h.attr("style",i),t.width=a,t.height=l,Ie(t,h),t.intersect=function(p){return Ce.polygon(t,u,p)},n}T(W2,"lean_left");async function H2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),u=[{x:-3*l/6,y:0},{x:a,y:0},{x:a+3*l/6,y:-l},{x:0,y:-l}];let h;const{cssStyles:d}=t;if(t.look==="handDrawn"){const p=Re.svg(n),m=Ae(t,{}),y=rt(u),x=p.path(y,m);h=n.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${l/2})`),d&&h.attr("style",d)}else h=Ks(n,a,l,u);return i&&h.attr("style",i),t.width=a,t.height=l,Ie(t,h),t.intersect=function(p){return Ce.polygon(t,u,p)},n}T(H2,"lean_right");function q2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.label="",t.labelStyle=r;const n=e.insert("g").attr("class",Ne(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,a=Math.max(35,(t==null?void 0:t.width)??0),l=Math.max(35,(t==null?void 0:t.height)??0),u=7,h=[{x:a,y:0},{x:0,y:l+u/2},{x:a-2*u,y:l+u/2},{x:0,y:2*l},{x:a,y:l-u/2},{x:2*u,y:l-u/2}],d=Re.svg(n),p=Ae(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=rt(h),y=d.path(m,p),x=n.insert(()=>y,":first-child");return s&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),x.attr("transform",`translate(-${a/2},${-l})`),Ie(t,x),t.intersect=function(v){return ue.info("lightningBolt intersect",t,v),Ce.polygon(t,h,v)},n}T(q2,"lightningBolt");var xz=T((e,t,r,i,n,s,a)=>[`M${e},${t+s}`,`a${n},${s} 0,0,0 ${r},0`,`a${n},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${s} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+s+a}`,`a${n},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),vz=T((e,t,r,i,n,s,a)=>[`M${e},${t+s}`,`M${e+r},${t+s}`,`a${n},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${s} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+s+a}`,`a${n},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),bz=T((e,t,r,i,n,s)=>[`M${e-r/2},${-i/2}`,`a${n},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function U2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0),t.width??0),u=l/2,h=u/(2.5+l/50),d=Math.max(s.height+h+(t.padding??0),t.height??0),p=d*.1;let m;const{cssStyles:y}=t;if(t.look==="handDrawn"){const x=Re.svg(n),v=vz(0,0,l,d,u,h,p),S=bz(0,h,l,d,u,h),C=Ae(t,{}),E=x.path(v,C),L=x.path(S,C);n.insert(()=>L,":first-child").attr("class","line"),m=n.insert(()=>E,":first-child"),m.attr("class","basic label-container"),y&&m.attr("style",y)}else{const x=xz(0,0,l,d,u,h,p);m=n.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",$r(y)).attr("style",i)}return m.attr("label-offset-y",h),m.attr("transform",`translate(${-l/2}, ${-(d/2+h)})`),Ie(t,m),a.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+h-(s.y-(s.top??0))})`),t.intersect=function(x){const v=Ce.rect(t,x),S=v.x-(t.x??0);if(u!=0&&(Math.abs(S)<(t.width??0)/2||Math.abs(S)==(t.width??0)/2&&Math.abs(v.y-(t.y??0))>(t.height??0)/2-h)){let C=h*h*(1-S*S/(u*u));C>0&&(C=Math.sqrt(C)),C=h-C,x.y-(t.y??0)>0&&(C=-C),v.y+=C}return v},n}T(U2,"linedCylinder");async function V2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=u/4,d=u+h,{cssStyles:p}=t,m=Re.svg(n),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-l/2-l/2*.1,y:-d/2},{x:-l/2-l/2*.1,y:d/2},...Us(-l/2-l/2*.1,d/2,l/2+l/2*.1,d/2,h,.8),{x:l/2+l/2*.1,y:-d/2},{x:-l/2-l/2*.1,y:-d/2},{x:-l/2,y:-d/2},{x:-l/2,y:d/2*1.1},{x:-l/2,y:-d/2}],v=m.polygon(x.map(C=>[C.x,C.y]),y),S=n.insert(()=>v,":first-child");return S.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),S.attr("transform",`translate(0,${-h/2})`),a.attr("transform",`translate(${-l/2+(t.padding??0)+l/2*.1/2-(s.x-(s.left??0))},${-u/2+(t.padding??0)-h/2-(s.y-(s.top??0))})`),Ie(t,S),t.intersect=function(C){return Ce.polygon(t,x,C)},n}T(V2,"linedWaveEdgedRect");async function G2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=5,d=-l/2,p=-u/2,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{}),v=[{x:d-h,y:p+h},{x:d-h,y:p+u+h},{x:d+l-h,y:p+u+h},{x:d+l-h,y:p+u},{x:d+l,y:p+u},{x:d+l,y:p+u-h},{x:d+l+h,y:p+u-h},{x:d+l+h,y:p-h},{x:d+h,y:p-h},{x:d+h,y:p},{x:d,y:p},{x:d,y:p+h}],S=[{x:d,y:p+h},{x:d+l-h,y:p+h},{x:d+l-h,y:p+u},{x:d+l,y:p+u},{x:d+l,y:p},{x:d,y:p}];t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const C=rt(v),E=y.path(C,x),L=rt(S),B=y.path(L,{...x,fill:"none"}),R=n.insert(()=>B,":first-child");return R.insert(()=>E,":first-child"),R.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",i),a.attr("transform",`translate(${-(s.width/2)-h-(s.x-(s.left??0))}, ${-(s.height/2)+h-(s.y-(s.top??0))})`),Ie(t,R),t.intersect=function(k){return Ce.polygon(t,v,k)},n}T(G2,"multiRect");async function Y2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=u/4,d=u+h,p=-l/2,m=-d/2,y=5,{cssStyles:x}=t,v=Us(p-y,m+d+y,p+l-y,m+d+y,h,.8),S=v==null?void 0:v[v.length-1],C=[{x:p-y,y:m+y},{x:p-y,y:m+d+y},...v,{x:p+l-y,y:S.y-y},{x:p+l,y:S.y-y},{x:p+l,y:S.y-2*y},{x:p+l+y,y:S.y-2*y},{x:p+l+y,y:m-y},{x:p+y,y:m-y},{x:p+y,y:m},{x:p,y:m},{x:p,y:m+y}],E=[{x:p,y:m+y},{x:p+l-y,y:m+y},{x:p+l-y,y:S.y-y},{x:p+l,y:S.y-y},{x:p+l,y:m},{x:p,y:m}],L=Re.svg(n),B=Ae(t,{});t.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");const R=rt(C),k=L.path(R,B),A=rt(E),O=L.path(A,B),V=n.insert(()=>k,":first-child");return V.insert(()=>O),V.attr("class","basic label-container"),x&&t.look!=="handDrawn"&&V.selectAll("path").attr("style",x),i&&t.look!=="handDrawn"&&V.selectAll("path").attr("style",i),V.attr("transform",`translate(0,${-h/2})`),a.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-h/2-(s.y-(s.top??0))})`),Ie(t,V),t.intersect=function(q){return Ce.polygon(t,C,q)},n}T(Y2,"multiWaveEdgedRectangle");async function K2(e,t,{config:{themeVariables:r}}){var E;const{labelStyles:i,nodeStyles:n}=De(t);t.labelStyle=i,t.useHtmlLabels||((E=Pr().flowchart)==null?void 0:E.htmlLabels)!==!1||(t.centerLabel=!0);const{shapeSvg:a,bbox:l,label:u}=await qe(e,t,Ne(t)),h=Math.max(l.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),d=Math.max(l.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),p=-h/2,m=-d/2,{cssStyles:y}=t,x=Re.svg(a),v=Ae(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const S=x.rectangle(p,m,h,d,v),C=a.insert(()=>S,":first-child");return C.attr("class","basic label-container"),y&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",y),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),u.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),Ie(t,C),t.intersect=function(L){return Ce.rect(t,L)},a}T(K2,"note");var Sz=T((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function X2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.width+t.padding,l=s.height+t.padding,u=a+l,h=.5,d=[{x:u/2,y:0},{x:u,y:-u/2},{x:u/2,y:-u},{x:0,y:-u/2}];let p;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=Re.svg(n),x=Ae(t,{}),v=Sz(0,0,u),S=y.path(v,x);p=n.insert(()=>S,":first-child").attr("transform",`translate(${-u/2+h}, ${u/2})`),m&&p.attr("style",m)}else p=Ks(n,u,u,d),p.attr("transform",`translate(${-u/2+h}, ${u/2})`);return i&&p.attr("style",i),Ie(t,p),t.calcIntersect=function(y,x){const v=y.width,S=[{x:v/2,y:0},{x:v,y:-v/2},{x:v/2,y:-v},{x:0,y:-v/2}],C=Ce.polygon(y,S,x);return{x:C.x-.5,y:C.y-.5}},t.intersect=function(y){return this.calcIntersect(t,y)},n}T(X2,"question");async function Q2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),h=-l/2,d=-u/2,p=d/2,m=[{x:h+p,y:d},{x:h,y:0},{x:h+p,y:-d},{x:-h,y:-d},{x:-h,y:d}],{cssStyles:y}=t,x=Re.svg(n),v=Ae(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const S=rt(m),C=x.path(S,v),E=n.insert(()=>C,":first-child");return E.attr("class","basic label-container"),y&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",i),E.attr("transform",`translate(${-p/2},0)`),a.attr("transform",`translate(${-p/2-s.width/2-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),Ie(t,E),t.intersect=function(L){return Ce.polygon(t,m,L)},n}T(Q2,"rect_left_inv_arrow");async function Z2(e,t){var O,V;const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;let n;t.cssClasses?n="node "+t.cssClasses:n="node default";const s=e.insert("g").attr("class",n).attr("id",t.domId||t.id),a=s.insert("g"),l=s.insert("g").attr("class","label").attr("style",i),u=t.description,h=t.label,d=l.node().appendChild(await ko(h,t.labelStyle,!0,!0));let p={width:0,height:0};if(sr((V=(O=dt())==null?void 0:O.flowchart)==null?void 0:V.htmlLabels)){const q=d.children[0],H=nt(d);p=q.getBoundingClientRect(),H.attr("width",p.width),H.attr("height",p.height)}ue.info("Text 2",u);const m=u||[],y=d.getBBox(),x=l.node().appendChild(await ko(m.join?m.join("<br/>"):m,t.labelStyle,!0,!0)),v=x.children[0],S=nt(x);p=v.getBoundingClientRect(),S.attr("width",p.width),S.attr("height",p.height);const C=(t.padding||0)/2;nt(x).attr("transform","translate( "+(p.width>y.width?0:(y.width-p.width)/2)+", "+(y.height+C+5)+")"),nt(d).attr("transform","translate( "+(p.width<y.width?0:-(y.width-p.width)/2)+", 0)"),p=l.node().getBBox(),l.attr("transform","translate("+-p.width/2+", "+(-p.height/2-C+3)+")");const E=p.width+(t.padding||0),L=p.height+(t.padding||0),B=-p.width/2-C,R=-p.height/2-C;let k,A;if(t.look==="handDrawn"){const q=Re.svg(s),H=Ae(t,{}),Y=q.path(Ys(B,R,E,L,t.rx||0),H),F=q.line(-p.width/2-C,-p.height/2-C+y.height+C,p.width/2+C,-p.height/2-C+y.height+C,H);A=s.insert(()=>(ue.debug("Rough node insert CXC",Y),F),":first-child"),k=s.insert(()=>(ue.debug("Rough node insert CXC",Y),Y),":first-child")}else k=a.insert("rect",":first-child"),A=a.insert("line"),k.attr("class","outer title-state").attr("style",i).attr("x",-p.width/2-C).attr("y",-p.height/2-C).attr("width",p.width+(t.padding||0)).attr("height",p.height+(t.padding||0)),A.attr("class","divider").attr("x1",-p.width/2-C).attr("x2",p.width/2+C).attr("y1",-p.height/2-C+y.height+C).attr("y2",-p.height/2-C+y.height+C);return Ie(t,k),t.intersect=function(q){return Ce.rect(t,q)},s}T(Z2,"rectWithTitle");function nc(e,t,r,i,n,s,a){const u=(e+r)/2,h=(t+i)/2,d=Math.atan2(i-t,r-e),p=(r-e)/2,m=(i-t)/2,y=p/n,x=m/s,v=Math.sqrt(y**2+x**2);if(v>1)throw new Error("The given radii are too small to create an arc between the points.");const S=Math.sqrt(1-v**2),C=u+S*s*Math.sin(d)*(a?-1:1),E=h-S*n*Math.cos(d)*(a?-1:1),L=Math.atan2((t-E)/s,(e-C)/n);let R=Math.atan2((i-E)/s,(r-C)/n)-L;a&&R<0&&(R+=2*Math.PI),!a&&R>0&&(R-=2*Math.PI);const k=[];for(let A=0;A<20;A++){const O=A/19,V=L+O*R,q=C+n*Math.cos(V),H=E+s*Math.sin(V);k.push({x:q,y:H})}return k}T(nc,"generateArcPoints");async function J2(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=(t==null?void 0:t.padding)??0,l=(t==null?void 0:t.padding)??0,u=(t!=null&&t.width?t==null?void 0:t.width:s.width)+a*2,h=(t!=null&&t.height?t==null?void 0:t.height:s.height)+l*2,d=t.radius||5,p=t.taper||5,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{});t.stroke&&(x.stroke=t.stroke),t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const v=[{x:-u/2+p,y:-h/2},{x:u/2-p,y:-h/2},...nc(u/2-p,-h/2,u/2,-h/2+p,d,d,!0),{x:u/2,y:-h/2+p},{x:u/2,y:h/2-p},...nc(u/2,h/2-p,u/2-p,h/2,d,d,!0),{x:u/2-p,y:h/2},{x:-u/2+p,y:h/2},...nc(-u/2+p,h/2,-u/2,h/2-p,d,d,!0),{x:-u/2,y:h/2-p},{x:-u/2,y:-h/2+p},...nc(-u/2,-h/2+p,-u/2+p,-h/2,d,d,!0)],S=rt(v),C=y.path(S,x),E=n.insert(()=>C,":first-child");return E.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",i),Ie(t,E),t.intersect=function(L){return Ce.polygon(t,v,L)},n}T(J2,"roundedRect");async function eT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=(t==null?void 0:t.padding)??0,u=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),h=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),d=-s.width/2-l,p=-s.height/2-l,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const v=[{x:d,y:p},{x:d+u+8,y:p},{x:d+u+8,y:p+h},{x:d-8,y:p+h},{x:d-8,y:p},{x:d,y:p},{x:d,y:p+h}],S=y.polygon(v.map(E=>[E.x,E.y]),x),C=n.insert(()=>S,":first-child");return C.attr("class","basic label-container").attr("style",$r(m)),i&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),m&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),a.attr("transform",`translate(${-u/2+4+(t.padding??0)-(s.x-(s.left??0))},${-h/2+(t.padding??0)-(s.y-(s.top??0))})`),Ie(t,C),t.intersect=function(E){return Ce.rect(t,E)},n}T(eT,"shadedProcess");async function tT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=-l/2,d=-u/2,{cssStyles:p}=t,m=Re.svg(n),y=Ae(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:h,y:d},{x:h,y:d+u},{x:h+l,y:d+u},{x:h+l,y:d-u/2}],v=rt(x),S=m.path(v,y),C=n.insert(()=>S,":first-child");return C.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",i),C.attr("transform",`translate(0, ${u/4})`),a.attr("transform",`translate(${-l/2+(t.padding??0)-(s.x-(s.left??0))}, ${-u/4+(t.padding??0)-(s.y-(s.top??0))})`),Ie(t,C),t.intersect=function(E){return Ce.polygon(t,x,E)},n}T(tT,"slopedRect");async function rT(e,t){const r={rx:0,ry:0,labelPaddingX:t.labelPaddingX??((t==null?void 0:t.padding)||0)*2,labelPaddingY:((t==null?void 0:t.padding)||0)*1};return tf(e,t,r)}T(rT,"squareRect");async function iT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.height+t.padding,l=s.width+a/4+t.padding,u=a/2,{cssStyles:h}=t,d=Re.svg(n),p=Ae(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:-l/2+u,y:-a/2},{x:l/2-u,y:-a/2},...Mc(-l/2+u,0,u,50,90,270),{x:l/2-u,y:a/2},...Mc(l/2-u,0,u,50,270,450)],y=rt(m),x=d.path(y,p),v=n.insert(()=>x,":first-child");return v.attr("class","basic label-container outer-path"),h&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",h),i&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",i),Ie(t,v),t.intersect=function(S){return Ce.polygon(t,m,S)},n}T(iT,"stadium");async function nT(e,t){return tf(e,t,{rx:5,ry:5})}T(nT,"state");function sT(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:n}=De(t);t.labelStyle=i;const{cssStyles:s}=t,{lineColor:a,stateBorder:l,nodeBorder:u}=r,h=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),d=Re.svg(h),p=Ae(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=d.circle(0,0,14,{...p,stroke:a,strokeWidth:2}),y=l??u,x=d.circle(0,0,5,{...p,fill:y,stroke:y,strokeWidth:2,fillStyle:"solid"}),v=h.insert(()=>m,":first-child");return v.insert(()=>x),s&&v.selectAll("path").attr("style",s),n&&v.selectAll("path").attr("style",n),Ie(t,v),t.intersect=function(S){return Ce.circle(t,7,S)},h}T(sT,"stateEnd");function oT(e,t,{config:{themeVariables:r}}){const{lineColor:i}=r,n=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let s;if(t.look==="handDrawn"){const l=Re.svg(n).circle(0,0,14,vI(i));s=n.insert(()=>l),s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else s=n.insert("circle",":first-child"),s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return Ie(t,s),t.intersect=function(a){return Ce.circle(t,7,a)},n}T(oT,"stateStart");async function aT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=((t==null?void 0:t.padding)||0)/2,l=s.width+t.padding,u=s.height+t.padding,h=-s.width/2-a,d=-s.height/2-a,p=[{x:0,y:0},{x:l,y:0},{x:l,y:-u},{x:0,y:-u},{x:0,y:0},{x:-8,y:0},{x:l+8,y:0},{x:l+8,y:-u},{x:-8,y:-u},{x:-8,y:0}];if(t.look==="handDrawn"){const m=Re.svg(n),y=Ae(t,{}),x=m.rectangle(h-8,d,l+16,u,y),v=m.line(h,d,h,d+u,y),S=m.line(h+l,d,h+l,d+u,y);n.insert(()=>v,":first-child"),n.insert(()=>S,":first-child");const C=n.insert(()=>x,":first-child"),{cssStyles:E}=t;C.attr("class","basic label-container").attr("style",$r(E)),Ie(t,C)}else{const m=Ks(n,l,u,p);i&&m.attr("style",i),Ie(t,m)}return t.intersect=function(m){return Ce.polygon(t,p,m)},n}T(aT,"subroutine");async function lT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=-a/2,h=-l/2,d=.2*l,p=.2*l,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{}),v=[{x:u-d/2,y:h},{x:u+a+d/2,y:h},{x:u+a+d/2,y:h+l},{x:u-d/2,y:h+l}],S=[{x:u+a-d/2,y:h+l},{x:u+a+d/2,y:h+l},{x:u+a+d/2,y:h+l-p}];t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const C=rt(v),E=y.path(C,x),L=rt(S),B=y.path(L,{...x,fillStyle:"solid"}),R=n.insert(()=>B,":first-child");return R.insert(()=>E,":first-child"),R.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",i),Ie(t,R),t.intersect=function(k){return Ce.polygon(t,v,k)},n}T(lT,"taggedRect");async function cT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=u/4,d=.2*l,p=.2*u,m=u+h,{cssStyles:y}=t,x=Re.svg(n),v=Ae(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const S=[{x:-l/2-l/2*.1,y:m/2},...Us(-l/2-l/2*.1,m/2,l/2+l/2*.1,m/2,h,.8),{x:l/2+l/2*.1,y:-m/2},{x:-l/2-l/2*.1,y:-m/2}],C=-l/2+l/2*.1,E=-m/2-p*.4,L=[{x:C+l-d,y:(E+u)*1.4},{x:C+l,y:E+u-p},{x:C+l,y:(E+u)*.9},...Us(C+l,(E+u)*1.3,C+l-d,(E+u)*1.5,-u*.03,.5)],B=rt(S),R=x.path(B,v),k=rt(L),A=x.path(k,{...v,fillStyle:"solid"}),O=n.insert(()=>A,":first-child");return O.insert(()=>R,":first-child"),O.attr("class","basic label-container"),y&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",i),O.attr("transform",`translate(0,${-h/2})`),a.attr("transform",`translate(${-l/2+(t.padding??0)-(s.x-(s.left??0))},${-u/2+(t.padding??0)-h/2-(s.y-(s.top??0))})`),Ie(t,O),t.intersect=function(V){return Ce.polygon(t,S,V)},n}T(cT,"taggedWaveEdgedRectangle");async function hT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=Math.max(s.width+t.padding,(t==null?void 0:t.width)||0),l=Math.max(s.height+t.padding,(t==null?void 0:t.height)||0),u=-a/2,h=-l/2,d=n.insert("rect",":first-child");return d.attr("class","text").attr("style",i).attr("rx",0).attr("ry",0).attr("x",u).attr("y",h).attr("width",a).attr("height",l),Ie(t,d),t.intersect=function(p){return Ce.rect(t,p)},n}T(hT,"text");var wz=T((e,t,r,i,n,s)=>`M${e},${t}
|
|
249
|
+
a${n},${s} 0,0,1 0,${-i}
|
|
250
|
+
l${r},0
|
|
251
|
+
a${n},${s} 0,0,1 0,${i}
|
|
252
|
+
M${r},${-i}
|
|
253
|
+
a${n},${s} 0,0,0 0,${i}
|
|
254
|
+
l${-r},0`,"createCylinderPathD"),Cz=T((e,t,r,i,n,s)=>[`M${e},${t}`,`M${e+r},${t}`,`a${n},${s} 0,0,0 0,${-i}`,`l${-r},0`,`a${n},${s} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),kz=T((e,t,r,i,n,s)=>[`M${e+r/2},${-i/2}`,`a${n},${s} 0,0,0 0,${i}`].join(" "),"createInnerCylinderPathD");async function uT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a,halfPadding:l}=await qe(e,t,Ne(t)),u=t.look==="neo"?l*2:l,h=s.height+u,d=h/2,p=d/(2.5+h/50),m=s.width+p+u,{cssStyles:y}=t;let x;if(t.look==="handDrawn"){const v=Re.svg(n),S=Cz(0,0,m,h,p,d),C=kz(0,0,m,h,p,d),E=v.path(S,Ae(t,{})),L=v.path(C,Ae(t,{fill:"none"}));x=n.insert(()=>L,":first-child"),x=n.insert(()=>E,":first-child"),x.attr("class","basic label-container"),y&&x.attr("style",y)}else{const v=wz(0,0,m,h,p,d);x=n.insert("path",":first-child").attr("d",v).attr("class","basic label-container").attr("style",$r(y)).attr("style",i),x.attr("class","basic label-container"),y&&x.selectAll("path").attr("style",y),i&&x.selectAll("path").attr("style",i)}return x.attr("label-offset-x",p),x.attr("transform",`translate(${-m/2}, ${h/2} )`),a.attr("transform",`translate(${-(s.width/2)-p-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),Ie(t,x),t.intersect=function(v){const S=Ce.rect(t,v),C=S.y-(t.y??0);if(d!=0&&(Math.abs(C)<(t.height??0)/2||Math.abs(C)==(t.height??0)/2&&Math.abs(S.x-(t.x??0))>(t.width??0)/2-p)){let E=p*p*(1-C*C/(d*d));E!=0&&(E=Math.sqrt(Math.abs(E))),E=p-E,v.x-(t.x??0)>0&&(E=-E),S.x+=E}return S},n}T(uT,"tiltedCylinder");async function dT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=s.width+t.padding,l=s.height+t.padding,u=[{x:-3*l/6,y:0},{x:a+3*l/6,y:0},{x:a,y:-l},{x:0,y:-l}];let h;const{cssStyles:d}=t;if(t.look==="handDrawn"){const p=Re.svg(n),m=Ae(t,{}),y=rt(u),x=p.path(y,m);h=n.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${l/2})`),d&&h.attr("style",d)}else h=Ks(n,a,l,u);return i&&h.attr("style",i),t.width=a,t.height=l,Ie(t,h),t.intersect=function(p){return Ce.polygon(t,u,p)},n}T(dT,"trapezoid");async function fT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=60,l=20,u=Math.max(a,s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),h=Math.max(l,s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),{cssStyles:d}=t,p=Re.svg(n),m=Ae(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=[{x:-u/2*.8,y:-h/2},{x:u/2*.8,y:-h/2},{x:u/2,y:-h/2*.6},{x:u/2,y:h/2},{x:-u/2,y:h/2},{x:-u/2,y:-h/2*.6}],x=rt(y),v=p.path(x,m),S=n.insert(()=>v,":first-child");return S.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",d),i&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",i),Ie(t,S),t.intersect=function(C){return Ce.polygon(t,y,C)},n}T(fT,"trapezoidalPentagon");async function pT(e,t){var E;const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=sr((E=dt().flowchart)==null?void 0:E.htmlLabels),u=s.width+(t.padding??0),h=u+s.height,d=u+s.height,p=[{x:0,y:0},{x:d,y:0},{x:d/2,y:-h}],{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const v=rt(p),S=y.path(v,x),C=n.insert(()=>S,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`);return m&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",i),t.width=u,t.height=h,Ie(t,C),a.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${h/2-(s.height+(t.padding??0)/(l?2:1)-(s.y-(s.top??0)))})`),t.intersect=function(L){return ue.info("Triangle intersect",t,p,L),Ce.polygon(t,p,L)},n}T(pT,"triangle");async function gT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=u/8,d=u+h,{cssStyles:p}=t,y=70-l,x=y>0?y/2:0,v=Re.svg(n),S=Ae(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const C=[{x:-l/2-x,y:d/2},...Us(-l/2-x,d/2,l/2+x,d/2,h,.8),{x:l/2+x,y:-d/2},{x:-l/2-x,y:-d/2}],E=rt(C),L=v.path(E,S),B=n.insert(()=>L,":first-child");return B.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",i),B.attr("transform",`translate(0,${-h/2})`),a.attr("transform",`translate(${-l/2+(t.padding??0)-(s.x-(s.left??0))},${-u/2+(t.padding??0)-h-(s.y-(s.top??0))})`),Ie(t,B),t.intersect=function(R){return Ce.polygon(t,C,R)},n}T(gT,"waveEdgedRectangle");async function mT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s}=await qe(e,t,Ne(t)),a=100,l=50,u=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),h=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),d=u/h;let p=u,m=h;p>m*d?m=p/d:p=m*d,p=Math.max(p,a),m=Math.max(m,l);const y=Math.min(m*.2,m/4),x=m+y*2,{cssStyles:v}=t,S=Re.svg(n),C=Ae(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const E=[{x:-p/2,y:x/2},...Us(-p/2,x/2,p/2,x/2,y,1),{x:p/2,y:-x/2},...Us(p/2,-x/2,-p/2,-x/2,y,-1)],L=rt(E),B=S.path(L,C),R=n.insert(()=>B,":first-child");return R.attr("class","basic label-container"),v&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",v),i&&t.look!=="handDrawn"&&R.selectAll("path").attr("style",i),Ie(t,R),t.intersect=function(k){return Ce.polygon(t,E,k)},n}T(mT,"waveRectangle");async function yT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,label:a}=await qe(e,t,Ne(t)),l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),u=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=5,d=-l/2,p=-u/2,{cssStyles:m}=t,y=Re.svg(n),x=Ae(t,{}),v=[{x:d-h,y:p-h},{x:d-h,y:p+u},{x:d+l,y:p+u},{x:d+l,y:p-h}],S=`M${d-h},${p-h} L${d+l},${p-h} L${d+l},${p+u} L${d-h},${p+u} L${d-h},${p-h}
|
|
255
|
+
M${d-h},${p} L${d+l},${p}
|
|
256
|
+
M${d},${p-h} L${d},${p+u}`;t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const C=y.path(S,x),E=n.insert(()=>C,":first-child");return E.attr("transform",`translate(${h/2}, ${h/2})`),E.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",i),a.attr("transform",`translate(${-(s.width/2)+h/2-(s.x-(s.left??0))}, ${-(s.height/2)+h/2-(s.y-(s.top??0))})`),Ie(t,E),t.intersect=function(L){return Ce.polygon(t,v,L)},n}T(yT,"windowPane");async function y0(e,t){var Z,oe,X,ne;const r=t;if(r.alias&&(t.label=r.alias),t.look==="handDrawn"){const{themeVariables:he}=Pr(),{background:ye}=he,ve={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${ye}`]};await y0(e,ve)}const i=Pr();t.useHtmlLabels=i.htmlLabels;let n=((Z=i.er)==null?void 0:Z.diagramPadding)??10,s=((oe=i.er)==null?void 0:oe.entityPadding)??6;const{cssStyles:a}=t,{labelStyles:l,nodeStyles:u}=De(t);if(r.attributes.length===0&&t.label){const he={rx:0,ry:0,labelPaddingX:n,labelPaddingY:n*1.5};ns(t.label,i)+he.labelPaddingX*2<i.er.minEntityWidth&&(t.width=i.er.minEntityWidth);const ye=await tf(e,t,he);if(!sr(i.htmlLabels)){const ve=ye.select("text"),be=(X=ve.node())==null?void 0:X.getBBox();ve.attr("transform",`translate(${-be.width/2}, 0)`)}return ye}i.htmlLabels||(n*=1.25,s*=1.25);let h=Ne(t);h||(h="node default");const d=e.insert("g").attr("class",h).attr("id",t.domId||t.id),p=await va(d,t.label??"",i,0,0,["name"],l);p.height+=s;let m=0;const y=[],x=[];let v=0,S=0,C=0,E=0,L=!0,B=!0;for(const he of r.attributes){const ye=await va(d,he.type,i,0,m,["attribute-type"],l);v=Math.max(v,ye.width+n);const ve=await va(d,he.name,i,0,m,["attribute-name"],l);S=Math.max(S,ve.width+n);const be=await va(d,he.keys.join(),i,0,m,["attribute-keys"],l);C=Math.max(C,be.width+n);const $e=await va(d,he.comment,i,0,m,["attribute-comment"],l);E=Math.max(E,$e.width+n);const Xe=Math.max(ye.height,ve.height,be.height,$e.height)+s;x.push({yOffset:m,rowHeight:Xe}),m+=Xe}let R=4;C<=n&&(L=!1,C=0,R--),E<=n&&(B=!1,E=0,R--);const k=d.node().getBBox();if(p.width+n*2-(v+S+C+E)>0){const he=p.width+n*2-(v+S+C+E);v+=he/R,S+=he/R,C>0&&(C+=he/R),E>0&&(E+=he/R)}const A=v+S+C+E,O=Re.svg(d),V=Ae(t,{});t.look!=="handDrawn"&&(V.roughness=0,V.fillStyle="solid");let q=0;x.length>0&&(q=x.reduce((he,ye)=>he+((ye==null?void 0:ye.rowHeight)??0),0));const H=Math.max(k.width+n*2,(t==null?void 0:t.width)||0,A),Y=Math.max((q??0)+p.height,(t==null?void 0:t.height)||0),F=-H/2,z=-Y/2;d.selectAll("g:not(:first-child)").each((he,ye,ve)=>{const be=nt(ve[ye]),$e=be.attr("transform");let Xe=0,it=0;if($e){const ht=RegExp(/translate\(([^,]+),([^)]+)\)/).exec($e);ht&&(Xe=parseFloat(ht[1]),it=parseFloat(ht[2]),be.attr("class").includes("attribute-name")?Xe+=v:be.attr("class").includes("attribute-keys")?Xe+=v+S:be.attr("class").includes("attribute-comment")&&(Xe+=v+S+C))}be.attr("transform",`translate(${F+n/2+Xe}, ${it+z+p.height+s/2})`)}),d.select(".name").attr("transform","translate("+-p.width/2+", "+(z+s/2)+")");const $=O.rectangle(F,z,H,Y,V),j=d.insert(()=>$,":first-child").attr("style",a.join("")),{themeVariables:W}=Pr(),{rowEven:P,rowOdd:Q,nodeBorder:ee}=W;y.push(0);for(const[he,ye]of x.entries()){const be=(he+1)%2===0&&ye.yOffset!==0,$e=O.rectangle(F,p.height+z+(ye==null?void 0:ye.yOffset),H,ye==null?void 0:ye.rowHeight,{...V,fill:be?P:Q,stroke:ee});d.insert(()=>$e,"g.label").attr("style",a.join("")).attr("class",`row-rect-${be?"even":"odd"}`)}let I=O.line(F,p.height+z,H+F,p.height+z,V);d.insert(()=>I).attr("class","divider"),I=O.line(v+F,p.height+z,v+F,Y+z,V),d.insert(()=>I).attr("class","divider"),L&&(I=O.line(v+S+F,p.height+z,v+S+F,Y+z,V),d.insert(()=>I).attr("class","divider")),B&&(I=O.line(v+S+C+F,p.height+z,v+S+C+F,Y+z,V),d.insert(()=>I).attr("class","divider"));for(const he of y)I=O.line(F,p.height+z+he,H+F,p.height+z+he,V),d.insert(()=>I).attr("class","divider");if(Ie(t,j),u&&t.look!=="handDrawn"){const he=u.split(";"),ye=(ne=he==null?void 0:he.filter(ve=>ve.includes("stroke")))==null?void 0:ne.map(ve=>`${ve}`).join("; ");d.selectAll("path").attr("style",ye??""),d.selectAll(".row-rect-even path").attr("style",u)}return t.intersect=function(he){return Ce.rect(t,he)},d}T(y0,"erBox");async function va(e,t,r,i=0,n=0,s=[],a=""){const l=e.insert("g").attr("class",`label ${s.join(" ")}`).attr("transform",`translate(${i}, ${n})`).attr("style",a);t!==Pv(t)&&(t=Pv(t),t=t.replaceAll("<","<").replaceAll(">",">"));const u=l.node().appendChild(await Gs(l,t,{width:ns(t,r)+100,style:a,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let d=u.children[0];for(d.textContent=d.textContent.replaceAll("<","<").replaceAll(">",">");d.childNodes[0];)d=d.childNodes[0],d.textContent=d.textContent.replaceAll("<","<").replaceAll(">",">")}let h=u.getBBox();if(sr(r.htmlLabels)){const d=u.children[0];d.style.textAlign="start";const p=nt(u);h=d.getBoundingClientRect(),p.attr("width",h.width),p.attr("height",h.height)}return h}T(va,"addText");async function _T(e,t,r,i,n=r.class.padding??12){const s=i?0:3,a=e.insert("g").attr("class",Ne(t)).attr("id",t.domId||t.id);let l=null,u=null,h=null,d=null,p=0,m=0,y=0;if(l=a.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const E=t.annotations[0];await sc(l,{text:`«${E}»`},0),p=l.node().getBBox().height}u=a.insert("g").attr("class","label-group text"),await sc(u,t,0,["font-weight: bolder"]);const x=u.node().getBBox();m=x.height,h=a.insert("g").attr("class","members-group text");let v=0;for(const E of t.members){const L=await sc(h,E,v,[E.parseClassifier()]);v+=L+s}y=h.node().getBBox().height,y<=0&&(y=n/2),d=a.insert("g").attr("class","methods-group text");let S=0;for(const E of t.methods){const L=await sc(d,E,S,[E.parseClassifier()]);S+=L+s}let C=a.node().getBBox();if(l!==null){const E=l.node().getBBox();l.attr("transform",`translate(${-E.width/2})`)}return u.attr("transform",`translate(${-x.width/2}, ${p})`),C=a.node().getBBox(),h.attr("transform",`translate(0, ${p+m+n*2})`),C=a.node().getBBox(),d.attr("transform",`translate(0, ${p+m+(y?y+n*4:n*2)})`),C=a.node().getBBox(),{shapeSvg:a,bbox:C}}T(_T,"textHelper");async function sc(e,t,r,i=[]){const n=e.insert("g").attr("class","label").attr("style",i.join("; ")),s=Pr();let a="useHtmlLabels"in t?t.useHtmlLabels:sr(s.htmlLabels)??!0,l="";"text"in t?l=t.text:l=t.label,!a&&l.startsWith("\\")&&(l=l.substring(1)),Ia(l)&&(a=!0);const u=await Gs(n,$y(Ho(l)),{width:ns(l,s)+50,classes:"markdown-node-label",useHtmlLabels:a},s);let h,d=1;if(a){const p=u.children[0],m=nt(u);d=p.innerHTML.split("<br>").length,p.innerHTML.includes("</math>")&&(d+=p.innerHTML.split("<mrow>").length-1);const y=p.getElementsByTagName("img");if(y){const x=l.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...y].map(v=>new Promise(S=>{function C(){var E;if(v.style.display="flex",v.style.flexDirection="column",x){const L=((E=s.fontSize)==null?void 0:E.toString())??window.getComputedStyle(document.body).fontSize,R=parseInt(L,10)*5+"px";v.style.minWidth=R,v.style.maxWidth=R}else v.style.width="100%";S(v)}T(C,"setupImage"),setTimeout(()=>{v.complete&&C()}),v.addEventListener("error",C),v.addEventListener("load",C)})))}h=p.getBoundingClientRect(),m.attr("width",h.width),m.attr("height",h.height)}else{i.includes("font-weight: bolder")&&nt(u).selectAll("tspan").attr("font-weight",""),d=u.children.length;const p=u.children[0];(u.textContent===""||u.textContent.includes(">"))&&(p.textContent=l[0]+l.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),l[1]===" "&&(p.textContent=p.textContent[0]+" "+p.textContent.substring(1))),p.textContent==="undefined"&&(p.textContent=""),h=u.getBBox()}return n.attr("transform","translate(0,"+(-h.height/(2*d)+r)+")"),h.height}T(sc,"addText");async function xT(e,t){var V,q;const r=dt(),i=r.class.padding??12,n=i,s=t.useHtmlLabels??sr(r.htmlLabels)??!0,a=t;a.annotations=a.annotations??[],a.members=a.members??[],a.methods=a.methods??[];const{shapeSvg:l,bbox:u}=await _T(e,t,r,s,n),{labelStyles:h,nodeStyles:d}=De(t);t.labelStyle=h,t.cssStyles=a.styles||"";const p=((V=a.styles)==null?void 0:V.join(";"))||d||"";t.cssStyles||(t.cssStyles=p.replaceAll("!important","").split(";"));const m=a.members.length===0&&a.methods.length===0&&!((q=r.class)!=null&&q.hideEmptyMembersBox),y=Re.svg(l),x=Ae(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const v=u.width;let S=u.height;a.members.length===0&&a.methods.length===0?S+=n:a.members.length>0&&a.methods.length===0&&(S+=n*2);const C=-v/2,E=-S/2,L=y.rectangle(C-i,E-i-(m?i:a.members.length===0&&a.methods.length===0?-i/2:0),v+2*i,S+2*i+(m?i*2:a.members.length===0&&a.methods.length===0?-i:0),x),B=l.insert(()=>L,":first-child");B.attr("class","basic label-container");const R=B.node().getBBox();l.selectAll(".text").each((H,Y,F)=>{var Q;const z=nt(F[Y]),$=z.attr("transform");let j=0;if($){const I=RegExp(/translate\(([^,]+),([^)]+)\)/).exec($);I&&(j=parseFloat(I[2]))}let W=j+E+i-(m?i:a.members.length===0&&a.methods.length===0?-i/2:0);s||(W-=4);let P=C;(z.attr("class").includes("label-group")||z.attr("class").includes("annotation-group"))&&(P=-((Q=z.node())==null?void 0:Q.getBBox().width)/2||0,l.selectAll("text").each(function(ee,I,Z){window.getComputedStyle(Z[I]).textAnchor==="middle"&&(P=0)})),z.attr("transform",`translate(${P}, ${W})`)});const k=l.select(".annotation-group").node().getBBox().height-(m?i/2:0)||0,A=l.select(".label-group").node().getBBox().height-(m?i/2:0)||0,O=l.select(".members-group").node().getBBox().height-(m?i/2:0)||0;if(a.members.length>0||a.methods.length>0||m){const H=y.line(R.x,k+A+E+i,R.x+R.width,k+A+E+i,x);l.insert(()=>H).attr("class","divider").attr("style",p)}if(m||a.members.length>0||a.methods.length>0){const H=y.line(R.x,k+A+O+E+n*2+i,R.x+R.width,k+A+O+E+i+n*2,x);l.insert(()=>H).attr("class","divider").attr("style",p)}if(a.look!=="handDrawn"&&l.selectAll("path").attr("style",p),B.select(":nth-child(2)").attr("style",p),l.selectAll(".divider").select("path").attr("style",p),t.labelStyle?l.selectAll("span").attr("style",t.labelStyle):l.selectAll("span").attr("style",p),!s){const H=RegExp(/color\s*:\s*([^;]*)/),Y=H.exec(p);if(Y){const F=Y[0].replace("color","fill");l.selectAll("tspan").attr("style",F)}else if(h){const F=H.exec(h);if(F){const z=F[0].replace("color","fill");l.selectAll("tspan").attr("style",z)}}}return Ie(t,B),t.intersect=function(H){return Ce.rect(t,H)},l}T(xT,"classBox");async function vT(e,t){var k,A;const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const n=t,s=t,a=20,l=20,u="verifyMethod"in t,h=Ne(t),d=e.insert("g").attr("class",h).attr("id",t.domId??t.id);let p;u?p=await Tn(d,`<<${n.type}>>`,0,t.labelStyle):p=await Tn(d,"<<Element>>",0,t.labelStyle);let m=p;const y=await Tn(d,n.name,m,t.labelStyle+"; font-weight: bold;");if(m+=y+l,u){const O=await Tn(d,`${n.requirementId?`ID: ${n.requirementId}`:""}`,m,t.labelStyle);m+=O;const V=await Tn(d,`${n.text?`Text: ${n.text}`:""}`,m,t.labelStyle);m+=V;const q=await Tn(d,`${n.risk?`Risk: ${n.risk}`:""}`,m,t.labelStyle);m+=q,await Tn(d,`${n.verifyMethod?`Verification: ${n.verifyMethod}`:""}`,m,t.labelStyle)}else{const O=await Tn(d,`${s.type?`Type: ${s.type}`:""}`,m,t.labelStyle);m+=O,await Tn(d,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,m,t.labelStyle)}const x=(((k=d.node())==null?void 0:k.getBBox().width)??200)+a,v=(((A=d.node())==null?void 0:A.getBBox().height)??200)+a,S=-x/2,C=-v/2,E=Re.svg(d),L=Ae(t,{});t.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const B=E.rectangle(S,C,x,v,L),R=d.insert(()=>B,":first-child");if(R.attr("class","basic label-container").attr("style",i),d.selectAll(".label").each((O,V,q)=>{const H=nt(q[V]),Y=H.attr("transform");let F=0,z=0;if(Y){const P=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Y);P&&(F=parseFloat(P[1]),z=parseFloat(P[2]))}const $=z-v/2;let j=S+a/2;(V===0||V===1)&&(j=F),H.attr("transform",`translate(${j}, ${$+a})`)}),m>p+y+l){const O=E.line(S,C+p+y+l,S+x,C+p+y+l,L);d.insert(()=>O).attr("style",i)}return Ie(t,R),t.intersect=function(O){return Ce.rect(t,O)},d}T(vT,"requirementBox");async function Tn(e,t,r,i=""){if(t==="")return 0;const n=e.insert("g").attr("class","label").attr("style",i),s=dt(),a=s.htmlLabels??!0,l=await Gs(n,$y(Ho(t)),{width:ns(t,s)+50,classes:"markdown-node-label",useHtmlLabels:a,style:i},s);let u;if(a){const h=l.children[0],d=nt(l);u=h.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}else{const h=l.children[0];for(const d of h.children)d.textContent=d.textContent.replaceAll(">",">").replaceAll("<","<"),i&&d.setAttribute("style",i);u=l.getBBox(),u.height+=6}return n.attr("transform",`translate(${-u.width/2},${-u.height/2+r})`),u.height}T(Tn,"addText");var Tz=T(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function bT(e,t,{config:r}){var Y,F;const{labelStyles:i,nodeStyles:n}=De(t);t.labelStyle=i||"";const s=10,a=t.width;t.width=(t.width??200)-10;const{shapeSvg:l,bbox:u,label:h}=await qe(e,t,Ne(t)),d=t.padding||10;let p="",m;"ticket"in t&&t.ticket&&((Y=r==null?void 0:r.kanban)!=null&&Y.ticketBaseUrl)&&(p=(F=r==null?void 0:r.kanban)==null?void 0:F.ticketBaseUrl.replace("#TICKET#",t.ticket),m=l.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",p).attr("target","_blank"));const y={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let x,v;m?{label:x,bbox:v}=await gg(m,"ticket"in t&&t.ticket||"",y):{label:x,bbox:v}=await gg(l,"ticket"in t&&t.ticket||"",y);const{label:S,bbox:C}=await gg(l,"assigned"in t&&t.assigned||"",y);t.width=a;const E=10,L=(t==null?void 0:t.width)||0,B=Math.max(v.height,C.height)/2,R=Math.max(u.height+E*2,(t==null?void 0:t.height)||0)+B,k=-L/2,A=-R/2;h.attr("transform","translate("+(d-L/2)+", "+(-B-u.height/2)+")"),x.attr("transform","translate("+(d-L/2)+", "+(-B+u.height/2)+")"),S.attr("transform","translate("+(d+L/2-C.width-2*s)+", "+(-B+u.height/2)+")");let O;const{rx:V,ry:q}=t,{cssStyles:H}=t;if(t.look==="handDrawn"){const z=Re.svg(l),$=Ae(t,{}),j=V||q?z.path(Ys(k,A,L,R,V||0),$):z.rectangle(k,A,L,R,$);O=l.insert(()=>j,":first-child"),O.attr("class","basic label-container").attr("style",H||null)}else{O=l.insert("rect",":first-child"),O.attr("class","basic label-container __APA__").attr("style",n).attr("rx",V??5).attr("ry",q??5).attr("x",k).attr("y",A).attr("width",L).attr("height",R);const z="priority"in t&&t.priority;if(z){const $=l.append("line"),j=k+2,W=A+Math.floor((V??0)/2),P=A+R-Math.floor((V??0)/2);$.attr("x1",j).attr("y1",W).attr("x2",j).attr("y2",P).attr("stroke-width","4").attr("stroke",Tz(z))}}return Ie(t,O),t.height=R,t.intersect=function(z){return Ce.rect(t,z)},l}T(bT,"kanbanItem");async function ST(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,halfPadding:a,label:l}=await qe(e,t,Ne(t)),u=s.width+10*a,h=s.height+8*a,d=.15*u,{cssStyles:p}=t,m=s.width+20,y=s.height+20,x=Math.max(u,m),v=Math.max(h,y);l.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let S;const C=`M0 0
|
|
257
|
+
a${d},${d} 1 0,0 ${x*.25},${-1*v*.1}
|
|
258
|
+
a${d},${d} 1 0,0 ${x*.25},0
|
|
259
|
+
a${d},${d} 1 0,0 ${x*.25},0
|
|
260
|
+
a${d},${d} 1 0,0 ${x*.25},${v*.1}
|
|
261
|
+
|
|
262
|
+
a${d},${d} 1 0,0 ${x*.15},${v*.33}
|
|
263
|
+
a${d*.8},${d*.8} 1 0,0 0,${v*.34}
|
|
264
|
+
a${d},${d} 1 0,0 ${-1*x*.15},${v*.33}
|
|
265
|
+
|
|
266
|
+
a${d},${d} 1 0,0 ${-1*x*.25},${v*.15}
|
|
267
|
+
a${d},${d} 1 0,0 ${-1*x*.25},0
|
|
268
|
+
a${d},${d} 1 0,0 ${-1*x*.25},0
|
|
269
|
+
a${d},${d} 1 0,0 ${-1*x*.25},${-1*v*.15}
|
|
270
|
+
|
|
271
|
+
a${d},${d} 1 0,0 ${-1*x*.1},${-1*v*.33}
|
|
272
|
+
a${d*.8},${d*.8} 1 0,0 0,${-1*v*.34}
|
|
273
|
+
a${d},${d} 1 0,0 ${x*.1},${-1*v*.33}
|
|
274
|
+
H0 V0 Z`;if(t.look==="handDrawn"){const E=Re.svg(n),L=Ae(t,{}),B=E.path(C,L);S=n.insert(()=>B,":first-child"),S.attr("class","basic label-container").attr("style",$r(p))}else S=n.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",C);return S.attr("transform",`translate(${-x/2}, ${-v/2})`),Ie(t,S),t.calcIntersect=function(E,L){return Ce.rect(E,L)},t.intersect=function(E){return ue.info("Bang intersect",t,E),Ce.rect(t,E)},n}T(ST,"bang");async function wT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,halfPadding:a,label:l}=await qe(e,t,Ne(t)),u=s.width+2*a,h=s.height+2*a,d=.15*u,p=.25*u,m=.35*u,y=.2*u,{cssStyles:x}=t;let v;const S=`M0 0
|
|
275
|
+
a${d},${d} 0 0,1 ${u*.25},${-1*u*.1}
|
|
276
|
+
a${m},${m} 1 0,1 ${u*.4},${-1*u*.1}
|
|
277
|
+
a${p},${p} 1 0,1 ${u*.35},${u*.2}
|
|
278
|
+
|
|
279
|
+
a${d},${d} 1 0,1 ${u*.15},${h*.35}
|
|
280
|
+
a${y},${y} 1 0,1 ${-1*u*.15},${h*.65}
|
|
281
|
+
|
|
282
|
+
a${p},${d} 1 0,1 ${-1*u*.25},${u*.15}
|
|
283
|
+
a${m},${m} 1 0,1 ${-1*u*.5},0
|
|
284
|
+
a${d},${d} 1 0,1 ${-1*u*.25},${-1*u*.15}
|
|
285
|
+
|
|
286
|
+
a${d},${d} 1 0,1 ${-1*u*.1},${-1*h*.35}
|
|
287
|
+
a${y},${y} 1 0,1 ${u*.1},${-1*h*.65}
|
|
288
|
+
H0 V0 Z`;if(t.look==="handDrawn"){const C=Re.svg(n),E=Ae(t,{}),L=C.path(S,E);v=n.insert(()=>L,":first-child"),v.attr("class","basic label-container").attr("style",$r(x))}else v=n.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",S);return l.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),v.attr("transform",`translate(${-u/2}, ${-h/2})`),Ie(t,v),t.calcIntersect=function(C,E){return Ce.rect(C,E)},t.intersect=function(C){return ue.info("Cloud intersect",t,C),Ce.rect(t,C)},n}T(wT,"cloud");async function CT(e,t){const{labelStyles:r,nodeStyles:i}=De(t);t.labelStyle=r;const{shapeSvg:n,bbox:s,halfPadding:a,label:l}=await qe(e,t,Ne(t)),u=s.width+8*a,h=s.height+2*a,d=5,p=`
|
|
289
|
+
M${-u/2} ${h/2-d}
|
|
290
|
+
v${-h+2*d}
|
|
291
|
+
q0,-${d} ${d},-${d}
|
|
292
|
+
h${u-2*d}
|
|
293
|
+
q${d},0 ${d},${d}
|
|
294
|
+
v${h-2*d}
|
|
295
|
+
q0,${d} -${d},${d}
|
|
296
|
+
h${-u+2*d}
|
|
297
|
+
q-${d},0 -${d},-${d}
|
|
298
|
+
Z
|
|
299
|
+
`,m=n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",i).attr("d",p);return n.append("line").attr("class","node-line-").attr("x1",-u/2).attr("y1",h/2).attr("x2",u/2).attr("y2",h/2),l.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),n.append(()=>l.node()),Ie(t,m),t.calcIntersect=function(y,x){return Ce.rect(y,x)},t.intersect=function(y){return Ce.rect(t,y)},n}T(CT,"defaultMindmapNode");async function kT(e,t){const r={padding:t.padding??0};return m0(e,t,r)}T(kT,"mindmapCircle");var Ez=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:rT},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:J2},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:iT},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:aT},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:T2},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:m0},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:ST},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:wT},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:X2},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:D2},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:H2},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:W2},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:dT},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:F2},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:B2},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:hT},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:_2},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:eT},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:oT},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:sT},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:R2},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:P2},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:S2},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:w2},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:C2},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:q2},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:gT},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:A2},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:uT},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:U2},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:k2},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:E2},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:pT},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:yT},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:M2},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:fT},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:L2},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:tT},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Y2},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:G2},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:y2},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:b2},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:cT},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:lT},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:mT},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Q2},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:V2}],Bz=T(()=>{const t=[...Object.entries({state:nT,choice:x2,note:K2,rectWithTitle:Z2,labelRect:N2,iconSquare:z2,iconCircle:$2,icon:I2,iconRounded:j2,imageSquare:O2,anchor:m2,kanbanItem:bT,mindmapCircle:kT,defaultMindmapNode:CT,classBox:xT,erBox:y0,requirementBox:vT}),...Ez.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(n=>[n,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),TT=Bz();function Mz(e){return e in TT}T(Mz,"isValidShape");var rf=new Map;async function ET(e,t,r){let i,n;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const s=t.shape?TT[t.shape]:void 0;if(!s)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let a;r.config.securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a??null),n=await s(i,t,r)}else n=await s(e,t,r),i=n;return t.tooltip&&n.attr("title",t.tooltip),rf.set(t.id,i),t.haveCallback&&i.attr("class",i.attr("class")+" clickable"),i}T(ET,"insertNode");var sV=T((e,t)=>{rf.set(t.id,e)},"setNodeElem"),oV=T(()=>{rf.clear()},"clear"),aV=T(e=>{const t=rf.get(e.id);ue.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const r=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode"),Lz=T((e,t,r,i,n,s)=>{t.arrowTypeStart&&j1(e,"start",t.arrowTypeStart,r,i,n,s),t.arrowTypeEnd&&j1(e,"end",t.arrowTypeEnd,r,i,n,s)},"addEdgeMarkers"),Rz={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},j1=T((e,t,r,i,n,s,a)=>{var p;const l=Rz[r];if(!l){ue.warn(`Unknown arrow type: ${r}`);return}const u=l.type,d=`${n}_${s}-${u}${t==="start"?"Start":"End"}`;if(a&&a.trim()!==""){const m=a.replace(/[^\dA-Za-z]/g,"_"),y=`${d}_${m}`;if(!document.getElementById(y)){const x=document.getElementById(d);if(x){const v=x.cloneNode(!0);v.id=y,v.querySelectorAll("path, circle, line").forEach(C=>{C.setAttribute("stroke",a),l.fill&&C.setAttribute("fill",a)}),(p=x.parentNode)==null||p.appendChild(v)}}e.attr(`marker-${t}`,`url(${i}#${y})`)}else e.attr(`marker-${t}`,`url(${i}#${d})`)},"addEdgeMarker"),Cd=new Map,Sr=new Map,lV=T(()=>{Cd.clear(),Sr.clear()},"clear"),hu=T(e=>e?e.reduce((r,i)=>r+";"+i,""):"","getLabelStyles"),Az=T(async(e,t)=>{let r=sr(dt().flowchart.htmlLabels);const{labelStyles:i}=De(t);t.labelStyle=i;const n=await Gs(e,t.label,{style:t.labelStyle,useHtmlLabels:r,addSvgBackground:!0,isNode:!1});ue.info("abc82",t,t.labelType);const s=e.insert("g").attr("class","edgeLabel"),a=s.insert("g").attr("class","label").attr("data-id",t.id);a.node().appendChild(n);let l=n.getBBox();if(r){const h=n.children[0],d=nt(n);l=h.getBoundingClientRect(),d.attr("width",l.width),d.attr("height",l.height)}a.attr("transform","translate("+-l.width/2+", "+-l.height/2+")"),Cd.set(t.id,s),t.width=l.width,t.height=l.height;let u;if(t.startLabelLeft){const h=await ko(t.startLabelLeft,hu(t.labelStyle)),d=e.insert("g").attr("class","edgeTerminals"),p=d.insert("g").attr("class","inner");u=p.node().appendChild(h);const m=h.getBBox();p.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),Sr.get(t.id)||Sr.set(t.id,{}),Sr.get(t.id).startLeft=d,oc(u,t.startLabelLeft)}if(t.startLabelRight){const h=await ko(t.startLabelRight,hu(t.labelStyle)),d=e.insert("g").attr("class","edgeTerminals"),p=d.insert("g").attr("class","inner");u=d.node().appendChild(h),p.node().appendChild(h);const m=h.getBBox();p.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),Sr.get(t.id)||Sr.set(t.id,{}),Sr.get(t.id).startRight=d,oc(u,t.startLabelRight)}if(t.endLabelLeft){const h=await ko(t.endLabelLeft,hu(t.labelStyle)),d=e.insert("g").attr("class","edgeTerminals"),p=d.insert("g").attr("class","inner");u=p.node().appendChild(h);const m=h.getBBox();p.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),d.node().appendChild(h),Sr.get(t.id)||Sr.set(t.id,{}),Sr.get(t.id).endLeft=d,oc(u,t.endLabelLeft)}if(t.endLabelRight){const h=await ko(t.endLabelRight,hu(t.labelStyle)),d=e.insert("g").attr("class","edgeTerminals"),p=d.insert("g").attr("class","inner");u=p.node().appendChild(h);const m=h.getBBox();p.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),d.node().appendChild(h),Sr.get(t.id)||Sr.set(t.id,{}),Sr.get(t.id).endRight=d,oc(u,t.endLabelRight)}return n},"insertEdgeLabel");function oc(e,t){dt().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}T(oc,"setTerminalWidth");var Dz=T((e,t)=>{ue.debug("Moving label abc88 ",e.id,e.label,Cd.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath;const i=dt(),{subGraphTitleTotalMargin:n}=r0(i);if(e.label){const s=Cd.get(e.id);let a=e.x,l=e.y;if(r){const u=sn.calcLabelPosition(r);ue.debug("Moving label "+e.label+" from (",a,",",l,") to (",u.x,",",u.y,") abc88"),t.updatedPath&&(a=u.x,l=u.y)}s.attr("transform",`translate(${a}, ${l+n/2})`)}if(e.startLabelLeft){const s=Sr.get(e.id).startLeft;let a=e.x,l=e.y;if(r){const u=sn.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);a=u.x,l=u.y}s.attr("transform",`translate(${a}, ${l})`)}if(e.startLabelRight){const s=Sr.get(e.id).startRight;let a=e.x,l=e.y;if(r){const u=sn.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);a=u.x,l=u.y}s.attr("transform",`translate(${a}, ${l})`)}if(e.endLabelLeft){const s=Sr.get(e.id).endLeft;let a=e.x,l=e.y;if(r){const u=sn.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);a=u.x,l=u.y}s.attr("transform",`translate(${a}, ${l})`)}if(e.endLabelRight){const s=Sr.get(e.id).endRight;let a=e.x,l=e.y;if(r){const u=sn.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);a=u.x,l=u.y}s.attr("transform",`translate(${a}, ${l})`)}},"positionEdgeLabel"),Pz=T((e,t)=>{const r=e.x,i=e.y,n=Math.abs(t.x-r),s=Math.abs(t.y-i),a=e.width/2,l=e.height/2;return n>=a||s>=l},"outsideNode"),Iz=T((e,t,r)=>{ue.debug(`intersection calc abc89:
|
|
300
|
+
outsidePoint: ${JSON.stringify(t)}
|
|
301
|
+
insidePoint : ${JSON.stringify(r)}
|
|
302
|
+
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,n=e.y,s=Math.abs(i-r.x),a=e.width/2;let l=r.x<t.x?a-s:a+s;const u=e.height/2,h=Math.abs(t.y-r.y),d=Math.abs(t.x-r.x);if(Math.abs(n-t.y)*a>Math.abs(i-t.x)*u){let p=r.y<t.y?t.y-u-n:n-u-t.y;l=d*p/h;const m={x:r.x<t.x?r.x+l:r.x-d+l,y:r.y<t.y?r.y+h-p:r.y-h+p};return l===0&&(m.x=t.x,m.y=t.y),d===0&&(m.x=t.x),h===0&&(m.y=t.y),ue.debug(`abc89 top/bottom calc, Q ${h}, q ${p}, R ${d}, r ${l}`,m),m}else{r.x<t.x?l=t.x-a-i:l=i-a-t.x;let p=h*l/d,m=r.x<t.x?r.x+d-l:r.x-d+l,y=r.y<t.y?r.y+p:r.y-p;return ue.debug(`sides calc abc89, Q ${h}, q ${p}, R ${d}, r ${l}`,{_x:m,_y:y}),l===0&&(m=t.x,y=t.y),d===0&&(m=t.x),h===0&&(y=t.y),{x:m,y}}},"intersection"),z1=T((e,t)=>{ue.warn("abc88 cutPathAtIntersect",e,t);let r=[],i=e[0],n=!1;return e.forEach(s=>{if(ue.info("abc88 checking point",s,t),!Pz(t,s)&&!n){const a=Iz(t,i,s);ue.debug("abc88 inside",s,i,a),ue.debug("abc88 intersection",a,t);let l=!1;r.forEach(u=>{l=l||u.x===a.x&&u.y===a.y}),r.some(u=>u.x===a.x&&u.y===a.y)?ue.warn("abc88 no intersect",a,r):r.push(a),n=!0}else ue.warn("abc88 outside",s,i),i=s,n||r.push(s)}),ue.debug("returning points",r),r},"cutPathAtIntersect");function BT(e){const t=[],r=[];for(let i=1;i<e.length-1;i++){const n=e[i-1],s=e[i],a=e[i+1];(n.x===s.x&&s.y===a.y&&Math.abs(s.x-a.x)>5&&Math.abs(s.y-n.y)>5||n.y===s.y&&s.x===a.x&&Math.abs(s.x-n.x)>5&&Math.abs(s.y-a.y)>5)&&(t.push(s),r.push(i))}return{cornerPoints:t,cornerPointPositions:r}}T(BT,"extractCornerPoints");var O1=T(function(e,t,r){const i=t.x-e.x,n=t.y-e.y,s=Math.sqrt(i*i+n*n),a=r/s;return{x:t.x-a*i,y:t.y-a*n}},"findAdjacentPoint"),$z=T(function(e){const{cornerPointPositions:t}=BT(e),r=[];for(let i=0;i<e.length;i++)if(t.includes(i)){const n=e[i-1],s=e[i+1],a=e[i],l=O1(n,a,5),u=O1(s,a,5),h=u.x-l.x,d=u.y-l.y;r.push(l);const p=Math.sqrt(2)*2;let m={x:a.x,y:a.y};if(Math.abs(s.x-n.x)>10&&Math.abs(s.y-n.y)>=10){ue.debug("Corner point fixing",Math.abs(s.x-n.x),Math.abs(s.y-n.y));const y=5;a.x===l.x?m={x:h<0?l.x-y+p:l.x+y-p,y:d<0?l.y-p:l.y+p}:m={x:h<0?l.x-p:l.x+p,y:d<0?l.y-y+p:l.y+y-p}}else ue.debug("Corner point skipping fixing",Math.abs(s.x-n.x),Math.abs(s.y-n.y));r.push(m,u)}else r.push(e[i]);return r},"fixCorners"),jz=T((e,t,r)=>{const i=e-t-r,n=2,s=2,a=n+s,l=Math.floor(i/a),u=Array(l).fill(`${n} ${s}`).join(" ");return`0 ${t} ${u} ${r}`},"generateDashArray"),zz=T(function(e,t,r,i,n,s,a,l=!1){var z;const{handDrawnSeed:u}=dt();let h=t.points,d=!1;const p=n;var m=s;const y=[];for(const $ in t.cssCompiledStyles)mk($)||y.push(t.cssCompiledStyles[$]);ue.debug("UIO intersect check",t.points,m.x,p.x),m.intersect&&p.intersect&&!l&&(h=h.slice(1,t.points.length-1),h.unshift(p.intersect(h[0])),ue.debug("Last point UIO",t.start,"-->",t.end,h[h.length-1],m,m.intersect(h[h.length-1])),h.push(m.intersect(h[h.length-1])));const x=btoa(JSON.stringify(h));t.toCluster&&(ue.info("to cluster abc88",r.get(t.toCluster)),h=z1(t.points,r.get(t.toCluster).node),d=!0),t.fromCluster&&(ue.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(h,null,2)),h=z1(h.reverse(),r.get(t.fromCluster).node).reverse(),d=!0);let v=h.filter($=>!Number.isNaN($.y));v=$z(v);let S=Bu;switch(S=nd,t.curve){case"linear":S=nd;break;case"basis":S=Bu;break;case"cardinal":S=vw;break;case"bumpX":S=gw;break;case"bumpY":S=mw;break;case"catmullRom":S=Sw;break;case"monotoneX":S=Bw;break;case"monotoneY":S=Mw;break;case"natural":S=Rw;break;case"step":S=Aw;break;case"stepAfter":S=Pw;break;case"stepBefore":S=Dw;break;default:S=Bu}const{x:C,y:E}=xI(t),L=r4().x(C).y(E).curve(S);let B;switch(t.thickness){case"normal":B="edge-thickness-normal";break;case"thick":B="edge-thickness-thick";break;case"invisible":B="edge-thickness-invisible";break;default:B="edge-thickness-normal"}switch(t.pattern){case"solid":B+=" edge-pattern-solid";break;case"dotted":B+=" edge-pattern-dotted";break;case"dashed":B+=" edge-pattern-dashed";break;default:B+=" edge-pattern-solid"}let R,k=t.curve==="rounded"?MT(LT(v,t),5):L(v);const A=Array.isArray(t.style)?t.style:[t.style];let O=A.find($=>$==null?void 0:$.startsWith("stroke:")),V=!1;if(t.look==="handDrawn"){const $=Re.svg(e);Object.assign([],v);const j=$.path(k,{roughness:.3,seed:u});B+=" transition",R=nt(j).select("path").attr("id",t.id).attr("class"," "+B+(t.classes?" "+t.classes:"")).attr("style",A?A.reduce((P,Q)=>P+";"+Q,""):"");let W=R.attr("d");R.attr("d",W),e.node().appendChild(R.node())}else{const $=y.join(";"),j=A?A.reduce((oe,X)=>oe+X+";",""):"";let W="";t.animate&&(W=" edge-animation-fast"),t.animation&&(W=" edge-animation-"+t.animation);const P=($?$+";"+j+";":j)+";"+(A?A.reduce((oe,X)=>oe+";"+X,""):"");R=e.append("path").attr("d",k).attr("id",t.id).attr("class"," "+B+(t.classes?" "+t.classes:"")+(W??"")).attr("style",P),O=(z=P.match(/stroke:([^;]+)/))==null?void 0:z[1],V=t.animate===!0||!!t.animation||$.includes("animation");const Q=R.node(),ee=typeof Q.getTotalLength=="function"?Q.getTotalLength():0,I=a1[t.arrowTypeStart]||0,Z=a1[t.arrowTypeEnd]||0;if(t.look==="neo"&&!V){const X=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?jz(ee,I,Z):`0 ${I} ${ee-I-Z} ${Z}`}; stroke-dashoffset: 0;`;R.attr("style",X+R.attr("style"))}}R.attr("data-edge",!0),R.attr("data-et","edge"),R.attr("data-id",t.id),R.attr("data-points",x),t.showPoints&&v.forEach($=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let q="";(dt().flowchart.arrowMarkerAbsolute||dt().state.arrowMarkerAbsolute)&&(q=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,q=q.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),ue.info("arrowTypeStart",t.arrowTypeStart),ue.info("arrowTypeEnd",t.arrowTypeEnd),Lz(R,t,q,a,i,O);const H=Math.floor(h.length/2),Y=h[H];sn.isLabelCoordinateInPath(Y,R.attr("d"))||(d=!0);let F={};return d&&(F.updatedPath=h),F.originalPath=t.points,F},"insertEdge");function MT(e,t){if(e.length<2)return"";let r="";const i=e.length,n=1e-5;for(let s=0;s<i;s++){const a=e[s],l=e[s-1],u=e[s+1];if(s===0)r+=`M${a.x},${a.y}`;else if(s===i-1)r+=`L${a.x},${a.y}`;else{const h=a.x-l.x,d=a.y-l.y,p=u.x-a.x,m=u.y-a.y,y=Math.hypot(h,d),x=Math.hypot(p,m);if(y<n||x<n){r+=`L${a.x},${a.y}`;continue}const v=h/y,S=d/y,C=p/x,E=m/x,L=v*C+S*E,B=Math.max(-1,Math.min(1,L)),R=Math.acos(B);if(R<n||Math.abs(Math.PI-R)<n){r+=`L${a.x},${a.y}`;continue}const k=Math.min(t/Math.sin(R/2),y/2,x/2),A=a.x-v*k,O=a.y-S*k,V=a.x+C*k,q=a.y+E*k;r+=`L${A},${O}`,r+=`Q${a.x},${a.y} ${V},${q}`}}return r}T(MT,"generateRoundedPath");function Cm(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const r=t.x-e.x,i=t.y-e.y;return{angle:Math.atan2(i,r),deltaX:r,deltaY:i}}T(Cm,"calculateDeltaAndAngle");function LT(e,t){const r=e.map(n=>({...n}));if(e.length>=2&&Dr[t.arrowTypeStart]){const n=Dr[t.arrowTypeStart],s=e[0],a=e[1],{angle:l}=Cm(s,a),u=n*Math.cos(l),h=n*Math.sin(l);r[0].x=s.x+u,r[0].y=s.y+h}const i=e.length;if(i>=2&&Dr[t.arrowTypeEnd]){const n=Dr[t.arrowTypeEnd],s=e[i-1],a=e[i-2],{angle:l}=Cm(a,s),u=n*Math.cos(l),h=n*Math.sin(l);r[i-1].x=s.x-u,r[i-1].y=s.y-h}return r}T(LT,"applyMarkerOffsetsToPoints");var Oz=T((e,t,r,i)=>{t.forEach(n=>{tO[n](e,r,i)})},"insertMarkers"),Fz=T((e,t,r)=>{ue.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Nz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Wz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Hz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),qz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Uz=T((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Vz=T((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Gz=T((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),Yz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Kz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),Xz=T((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),n.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),Qz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),Zz=T((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),n.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),Jz=T((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
303
|
+
L20,10
|
|
304
|
+
M20,10
|
|
305
|
+
L0,20`)},"requirement_arrow"),eO=T((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),tO={extension:Fz,composition:Nz,aggregation:Wz,dependency:Hz,lollipop:qz,point:Uz,circle:Vz,cross:Gz,barb:Yz,only_one:Kz,zero_or_one:Xz,one_or_more:Qz,zero_or_more:Zz,requirement_arrow:Jz,requirement_contains:eO},rO=Oz,iO={common:Ha,getConfig:Pr,insertCluster:uz,insertEdge:zz,insertEdgeLabel:Az,insertMarkers:rO,insertNode:ET,interpolateToCurve:a0,labelHelper:qe,log:ue,positionEdgeLabel:Dz},Lc={},RT=T(e=>{for(const t of e)Lc[t.name]=t},"registerLayoutLoaders"),nO=T(()=>{RT([{name:"dagre",loader:T(async()=>await ct(()=>import("./dagre-6UL2VRFP-rOZEkrsg.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:T(async()=>await ct(()=>import("./cose-bilkent-S5V4N54A-XWeJtgga.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");nO();var cV=T(async(e,t)=>{if(!(e.layoutAlgorithm in Lc))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=Lc[e.layoutAlgorithm];return(await r.loader()).render(e,t,iO,{algorithm:r.algorithm})},"render"),hV=T((e="",{fallback:t="dagre"}={})=>{if(e in Lc)return e;if(t in Lc)return ue.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),AT="comm",DT="rule",PT="decl",sO="@import",oO="@namespace",aO="@keyframes",lO="@layer",IT=Math.abs,_0=String.fromCharCode;function $T(e){return e.trim()}function Du(e,t,r){return e.replace(t,r)}function cO(e,t,r){return e.indexOf(t,r)}function ka(e,t){return e.charCodeAt(t)|0}function Fa(e,t,r){return e.slice(t,r)}function Bn(e){return e.length}function hO(e){return e.length}function uu(e,t){return t.push(e),e}var nf=1,Na=1,jT=0,Oi=0,Yt=0,Ya="";function x0(e,t,r,i,n,s,a,l){return{value:e,root:t,parent:r,type:i,props:n,children:s,line:nf,column:Na,length:a,return:"",siblings:l}}function uO(){return Yt}function dO(){return Yt=Oi>0?ka(Ya,--Oi):0,Na--,Yt===10&&(Na=1,nf--),Yt}function an(){return Yt=Oi<jT?ka(Ya,Oi++):0,Na++,Yt===10&&(Na=1,nf++),Yt}function zs(){return ka(Ya,Oi)}function Pu(){return Oi}function sf(e,t){return Fa(Ya,e,t)}function Rc(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function fO(e){return nf=Na=1,jT=Bn(Ya=e),Oi=0,[]}function pO(e){return Ya="",e}function mg(e){return $T(sf(Oi-1,km(e===91?e+2:e===40?e+1:e)))}function gO(e){for(;(Yt=zs())&&Yt<33;)an();return Rc(e)>2||Rc(Yt)>3?"":" "}function mO(e,t){for(;--t&&an()&&!(Yt<48||Yt>102||Yt>57&&Yt<65||Yt>70&&Yt<97););return sf(e,Pu()+(t<6&&zs()==32&&an()==32))}function km(e){for(;an();)switch(Yt){case e:return Oi;case 34:case 39:e!==34&&e!==39&&km(Yt);break;case 40:e===41&&km(e);break;case 92:an();break}return Oi}function yO(e,t){for(;an()&&e+Yt!==57;)if(e+Yt===84&&zs()===47)break;return"/*"+sf(t,Oi-1)+"*"+_0(e===47?e:an())}function _O(e){for(;!Rc(zs());)an();return sf(e,Oi)}function xO(e){return pO(Iu("",null,null,null,[""],e=fO(e),0,[0],e))}function Iu(e,t,r,i,n,s,a,l,u){for(var h=0,d=0,p=a,m=0,y=0,x=0,v=1,S=1,C=1,E=0,L="",B=n,R=s,k=i,A=L;S;)switch(x=E,E=an()){case 40:if(x!=108&&ka(A,p-1)==58){cO(A+=Du(mg(E),"&","&\f"),"&\f",IT(h?l[h-1]:0))!=-1&&(C=-1);break}case 34:case 39:case 91:A+=mg(E);break;case 9:case 10:case 13:case 32:A+=gO(x);break;case 92:A+=mO(Pu()-1,7);continue;case 47:switch(zs()){case 42:case 47:uu(vO(yO(an(),Pu()),t,r,u),u),(Rc(x||1)==5||Rc(zs()||1)==5)&&Bn(A)&&Fa(A,-1,void 0)!==" "&&(A+=" ");break;default:A+="/"}break;case 123*v:l[h++]=Bn(A)*C;case 125*v:case 59:case 0:switch(E){case 0:case 125:S=0;case 59+d:C==-1&&(A=Du(A,/\f/g,"")),y>0&&(Bn(A)-p||v===0&&x===47)&&uu(y>32?N1(A+";",i,r,p-1,u):N1(Du(A," ","")+";",i,r,p-2,u),u);break;case 59:A+=";";default:if(uu(k=F1(A,t,r,h,d,n,l,L,B=[],R=[],p,s),s),E===123)if(d===0)Iu(A,t,k,k,B,s,p,l,R);else{switch(m){case 99:if(ka(A,3)===110)break;case 108:if(ka(A,2)===97)break;default:d=0;case 100:case 109:case 115:}d?Iu(e,k,k,i&&uu(F1(e,k,k,0,0,n,l,L,n,B=[],p,R),R),n,R,p,l,i?B:R):Iu(A,k,k,k,[""],R,0,l,R)}}h=d=y=0,v=C=1,L=A="",p=a;break;case 58:p=1+Bn(A),y=x;default:if(v<1){if(E==123)--v;else if(E==125&&v++==0&&dO()==125)continue}switch(A+=_0(E),E*v){case 38:C=d>0?1:(A+="\f",-1);break;case 44:l[h++]=(Bn(A)-1)*C,C=1;break;case 64:zs()===45&&(A+=mg(an())),m=zs(),d=p=Bn(L=A+=_O(Pu())),E++;break;case 45:x===45&&Bn(A)==2&&(v=0)}}return s}function F1(e,t,r,i,n,s,a,l,u,h,d,p){for(var m=n-1,y=n===0?s:[""],x=hO(y),v=0,S=0,C=0;v<i;++v)for(var E=0,L=Fa(e,m+1,m=IT(S=a[v])),B=e;E<x;++E)(B=$T(S>0?y[E]+" "+L:Du(L,/&\f/g,y[E])))&&(u[C++]=B);return x0(e,t,r,n===0?DT:l,u,h,d,p)}function vO(e,t,r,i){return x0(e,t,r,AT,_0(uO()),Fa(e,2,-2),0,i)}function N1(e,t,r,i,n){return x0(e,t,r,PT,Fa(e,0,i),Fa(e,i+1,-1),i,n)}function Tm(e,t){for(var r="",i=0;i<e.length;i++)r+=t(e[i],i,e,t)||"";return r}function bO(e,t,r,i){switch(e.type){case lO:if(e.children.length)break;case sO:case oO:case PT:return e.return=e.return||e.value;case AT:return"";case aO:return e.return=e.value+"{"+Tm(e.children,i)+"}";case DT:if(!Bn(e.value=e.props.join(",")))return""}return Bn(r=Tm(e.children,i))?e.return=e.value+"{"+r+"}":""}var SO=vk(Object.keys,Object),wO=Object.prototype,CO=wO.hasOwnProperty;function kO(e){if(!Kd(e))return SO(e);var t=[];for(var r in Object(e))CO.call(e,r)&&r!="constructor"&&t.push(r);return t}var Em=Wo($n,"DataView"),Bm=Wo($n,"Promise"),Mm=Wo($n,"Set"),Lm=Wo($n,"WeakMap"),W1="[object Map]",TO="[object Object]",H1="[object Promise]",q1="[object Set]",U1="[object WeakMap]",V1="[object DataView]",EO=No(Em),BO=No(Bc),MO=No(Bm),LO=No(Mm),RO=No(Lm),_o=Ua;(Em&&_o(new Em(new ArrayBuffer(1)))!=V1||Bc&&_o(new Bc)!=W1||Bm&&_o(Bm.resolve())!=H1||Mm&&_o(new Mm)!=q1||Lm&&_o(new Lm)!=U1)&&(_o=function(e){var t=Ua(e),r=t==TO?e.constructor:void 0,i=r?No(r):"";if(i)switch(i){case EO:return V1;case BO:return W1;case MO:return H1;case LO:return q1;case RO:return U1}return t});var AO="[object Map]",DO="[object Set]",PO=Object.prototype,IO=PO.hasOwnProperty;function G1(e){if(e==null)return!0;if(Xd(e)&&(yd(e)||typeof e=="string"||typeof e.splice=="function"||s0(e)||o0(e)||md(e)))return!e.length;var t=_o(e);if(t==AO||t==DO)return!e.size;if(Kd(e))return!kO(e).length;for(var r in e)if(IO.call(e,r))return!1;return!0}var zT="c4",$O=T(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),jO=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-CbXs2xzC.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:zT,diagram:e}},"loader"),zO={id:zT,detector:$O,loader:jO},OO=zO,OT="flowchart",FO=T((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),NO=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BEPFOt6U.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:OT,diagram:e}},"loader"),WO={id:OT,detector:FO,loader:NO},HO=WO,FT="flowchart-v2",qO=T((e,t)=>{var r,i,n;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),UO=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BEPFOt6U.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:FT,diagram:e}},"loader"),VO={id:FT,detector:qO,loader:UO},GO=VO,NT="er",YO=T(e=>/^\s*erDiagram/.test(e),"detector"),KO=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-CvnQ69BF.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:NT,diagram:e}},"loader"),XO={id:NT,detector:YO,loader:KO},QO=XO,WT="gitGraph",ZO=T(e=>/^\s*gitGraph/.test(e),"detector"),JO=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./gitGraphDiagram-V2S2FVAM-HLYbyNJ5.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,2,4,5]));return{id:WT,diagram:e}},"loader"),eF={id:WT,detector:ZO,loader:JO},tF=eF,HT="gantt",rF=T(e=>/^\s*gantt/.test(e),"detector"),iF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-CWsbo0fn.js");return{diagram:t}},__vite__mapDeps([20,21,22,23]));return{id:HT,diagram:e}},"loader"),nF={id:HT,detector:rF,loader:iF},sF=nF,qT="info",oF=T(e=>/^\s*info/.test(e),"detector"),aF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./infoDiagram-HS3SLOUP-D68HIb2t.js");return{diagram:t}},__vite__mapDeps([24,19,2,4,5]));return{id:qT,diagram:e}},"loader"),lF={id:qT,detector:oF,loader:aF},UT="pie",cF=T(e=>/^\s*pie/.test(e),"detector"),hF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-CHgwWCaM.js");return{diagram:t}},__vite__mapDeps([25,17,19,2,4,5,26,27,22]));return{id:UT,diagram:e}},"loader"),uF={id:UT,detector:cF,loader:hF},VT="quadrantChart",dF=T(e=>/^\s*quadrantChart/.test(e),"detector"),fF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-B1CnJyxI.js");return{diagram:t}},__vite__mapDeps([28,21,22,23]));return{id:VT,diagram:e}},"loader"),pF={id:VT,detector:dF,loader:fF},gF=pF,GT="xychart",mF=T(e=>/^\s*xychart(-beta)?/.test(e),"detector"),yF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-CSEFGEQX.js");return{diagram:t}},__vite__mapDeps([29,22,27,21,23]));return{id:GT,diagram:e}},"loader"),_F={id:GT,detector:mF,loader:yF},xF=_F,YT="requirement",vF=T(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),bF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-DsrX4TT-.js");return{diagram:t}},__vite__mapDeps([30,12,13]));return{id:YT,diagram:e}},"loader"),SF={id:YT,detector:vF,loader:bF},wF=SF,KT="sequence",CF=T(e=>/^\s*sequenceDiagram/.test(e),"detector"),kF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-CzW1WaEm.js");return{diagram:t}},__vite__mapDeps([31,9,18]));return{id:KT,diagram:e}},"loader"),TF={id:KT,detector:CF,loader:kF},EF=TF,XT="class",BF=T((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),MF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-B7YQfPU4.js");return{diagram:t}},__vite__mapDeps([32,33,11,12,13]));return{id:XT,diagram:e}},"loader"),LF={id:XT,detector:BF,loader:MF},RF=LF,QT="classDiagram",AF=T((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),DF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-B7YQfPU4.js");return{diagram:t}},__vite__mapDeps([34,33,11,12,13]));return{id:QT,diagram:e}},"loader"),PF={id:QT,detector:AF,loader:DF},IF=PF,ZT="state",$F=T((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),jF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-ClARVrvt.js");return{diagram:t}},__vite__mapDeps([35,36,12,13,1,2,3,4]));return{id:ZT,diagram:e}},"loader"),zF={id:ZT,detector:$F,loader:jF},OF=zF,JT="stateDiagram",FF=T((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),NF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-8fib9ftc.js");return{diagram:t}},__vite__mapDeps([37,36,12,13]));return{id:JT,diagram:e}},"loader"),WF={id:JT,detector:FF,loader:NF},HF=WF,eE="journey",qF=T(e=>/^\s*journey/.test(e),"detector"),UF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-Bue2dR2X.js");return{diagram:t}},__vite__mapDeps([38,9,11,26]));return{id:eE,diagram:e}},"loader"),VF={id:eE,detector:qF,loader:UF},GF=VF,YF=T((e,t,r)=>{ue.debug(`rendering svg for syntax error
|
|
306
|
+
`);const i=u4(t),n=i.append("g");i.attr("viewBox","0 0 2412 512"),zS(i,100,512,!0),n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),tE={draw:YF},KF=tE,XF={db:{},renderer:tE,parser:{parse:T(()=>{},"parse")}},QF=XF,rE="flowchart-elk",ZF=T((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),JF=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BEPFOt6U.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:rE,diagram:e}},"loader"),e8={id:rE,detector:ZF,loader:JF},t8=e8,iE="timeline",r8=T(e=>/^\s*timeline/.test(e),"detector"),i8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-cYAwshf6.js");return{diagram:t}},__vite__mapDeps([39,26]));return{id:iE,diagram:e}},"loader"),n8={id:iE,detector:r8,loader:i8},s8=n8,nE="mindmap",o8=T(e=>/^\s*mindmap/.test(e),"detector"),a8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-NeRYOzsq.js");return{diagram:t}},__vite__mapDeps([40,12,13]));return{id:nE,diagram:e}},"loader"),l8={id:nE,detector:o8,loader:a8},c8=l8,sE="kanban",h8=T(e=>/^\s*kanban/.test(e),"detector"),u8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-BETdiI7I.js");return{diagram:t}},__vite__mapDeps([41,11]));return{id:sE,diagram:e}},"loader"),d8={id:sE,detector:h8,loader:u8},f8=d8,oE="sankey",p8=T(e=>/^\s*sankey(-beta)?/.test(e),"detector"),g8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-DbuzKCtn.js");return{diagram:t}},__vite__mapDeps([42,27,22]));return{id:oE,diagram:e}},"loader"),m8={id:oE,detector:p8,loader:g8},y8=m8,aE="packet",_8=T(e=>/^\s*packet(-beta)?/.test(e),"detector"),x8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-1Q7hwiSd.js");return{diagram:t}},__vite__mapDeps([43,17,19,2,4,5]));return{id:aE,diagram:e}},"loader"),v8={id:aE,detector:_8,loader:x8},lE="radar",b8=T(e=>/^\s*radar-beta/.test(e),"detector"),S8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-Csuk5L3z.js");return{diagram:t}},__vite__mapDeps([44,17,19,2,4,5]));return{id:lE,diagram:e}},"loader"),w8={id:lE,detector:b8,loader:S8},cE="block",C8=T(e=>/^\s*block(-beta)?/.test(e),"detector"),k8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-D-NiLXxd.js");return{diagram:t}},__vite__mapDeps([45,11,5,2,1,14]));return{id:cE,diagram:e}},"loader"),T8={id:cE,detector:C8,loader:k8},E8=T8,hE="architecture",B8=T(e=>/^\s*architecture/.test(e),"detector"),M8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-DF4t6GQD.js");return{diagram:t}},__vite__mapDeps([46,17,19,2,4,5,7]));return{id:hE,diagram:e}},"loader"),L8={id:hE,detector:B8,loader:M8},R8=L8,uE="treemap",A8=T(e=>/^\s*treemap/.test(e),"detector"),D8=T(async()=>{const{diagram:e}=await ct(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-kVMBkEyV.js");return{diagram:t}},__vite__mapDeps([47,13,17,19,2,4,5,23,27,22]));return{id:uE,diagram:e}},"loader"),P8={id:uE,detector:A8,loader:D8},Y1=!1,of=T(()=>{Y1||(Y1=!0,Qu("error",QF,e=>e.toLowerCase().trim()==="error"),Qu("---",{db:{clear:T(()=>{},"clear")},styles:{},renderer:{draw:T(()=>{},"draw")},parser:{parse:T(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:T(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Fg(t8,c8,R8),Fg(OO,f8,IF,RF,QO,sF,lF,uF,wF,EF,GO,HO,s8,tF,HF,OF,GF,gF,y8,v8,xF,E8,w8,P8))},"addDiagrams"),I8=T(async()=>{ue.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Ro).map(async([r,{detector:i,loader:n}])=>{if(n)try{qg(r)}catch{try{const{diagram:s,id:a}=await n();Qu(a,s,i)}catch(s){throw ue.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Ro[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){ue.error(`Failed to load ${t.length} external diagrams`);for(const r of t)ue.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),$8="graphics-document document";function dE(e,t){e.attr("role",$8),t!==""&&e.attr("aria-roledescription",t)}T(dE,"setA11yDiagramInfo");function fE(e,t,r,i){if(e.insert!==void 0){if(r){const n=`chart-desc-${i}`;e.attr("aria-describedby",n),e.insert("desc",":first-child").attr("id",n).text(r)}if(t){const n=`chart-title-${i}`;e.attr("aria-labelledby",n),e.insert("title",":first-child").attr("id",n).text(t)}}}T(fE,"addSVGa11yTitleDescription");var Mo,Rm=(Mo=class{constructor(t,r,i,n,s){this.type=t,this.text=r,this.db=i,this.parser=n,this.renderer=s}static async fromText(t,r={}){var h,d;const i=Pr(),n=Ly(t,i);t=yj(t)+`
|
|
307
|
+
`;try{qg(n)}catch{const p=N3(n);if(!p)throw new TS(`Diagram ${n} not found.`);const{id:m,diagram:y}=await p();Qu(m,y)}const{db:s,parser:a,renderer:l,init:u}=qg(n);return a.parser&&(a.parser.yy=s),(h=s.clear)==null||h.call(s),u==null||u(i),r.title&&((d=s.setDiagramTitle)==null||d.call(s,r.title)),await a.parse(t),new Mo(n,t,s,a,l)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},T(Mo,"Diagram"),Mo),K1=[],j8=T(()=>{K1.forEach(e=>{e()}),K1=[]},"attachFunctions"),z8=T(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function pE(e){const t=e.match(kS);if(!t)return{text:e,metadata:{}};let r=_I(t[1],{schema:yI})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:e.slice(t[0].length),metadata:i}}T(pE,"extractFrontMatter");var O8=T(e=>e.replace(/\r\n?/g,`
|
|
308
|
+
`).replace(/<(\w+)([^>]*)>/g,(t,r,i)=>"<"+r+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),F8=T(e=>{const{text:t,metadata:r}=pE(e),{displayMode:i,title:n,config:s={}}=r;return i&&(s.gantt||(s.gantt={}),s.gantt.displayMode=i),{title:n,config:s,text:t}},"processFrontmatter"),N8=T(e=>{const t=sn.detectInit(e)??{},r=sn.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:i})=>i==="wrap"):(r==null?void 0:r.type)==="wrap"&&(t.wrap=!0),{text:nj(e),directive:t}},"processDirectives");function v0(e){const t=O8(e),r=F8(t),i=N8(r.text),n=d0(r.config,i.directive);return e=z8(i.text),{code:e,title:r.title,config:n}}T(v0,"preprocessDiagram");function gE(e){const t=new TextEncoder().encode(e),r=Array.from(t,i=>String.fromCodePoint(i)).join("");return btoa(r)}T(gE,"toBase64");var W8=5e4,H8="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",q8="sandbox",U8="loose",V8="http://www.w3.org/2000/svg",G8="http://www.w3.org/1999/xlink",Y8="http://www.w3.org/1999/xhtml",K8="100%",X8="100%",Q8="border:0;margin:0;",Z8="margin:0",J8="allow-top-navigation-by-user-activation allow-popups",eN='The "iframe" tag is not supported by your browser.',tN=["foreignobject"],rN=["dominant-baseline"];function b0(e){const t=v0(e);return Ku(),iA(t.config??{}),t}T(b0,"processAndSetConfigs");async function mE(e,t){of();try{const{code:r,config:i}=b0(e);return{diagramType:(await _E(r)).type,config:i}}catch(r){if(t!=null&&t.suppressErrors)return!1;throw r}}T(mE,"parse");var X1=T((e,t,r=[])=>`
|
|
309
|
+
.${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),iN=T((e,t=new Map)=>{var i;let r="";if(e.themeCSS!==void 0&&(r+=`
|
|
310
|
+
${e.themeCSS}`),e.fontFamily!==void 0&&(r+=`
|
|
311
|
+
:root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(r+=`
|
|
312
|
+
:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){const l=e.htmlLabels??((i=e.flowchart)==null?void 0:i.htmlLabels)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(u=>{G1(u.styles)||l.forEach(h=>{r+=X1(u.id,h,u.styles)}),G1(u.textStyles)||(r+=X1(u.id,"tspan",((u==null?void 0:u.textStyles)||[]).map(h=>h.replace("color","fill"))))})}return r},"createCssStyles"),nN=T((e,t,r,i)=>{const n=iN(e,r),s=wA(t,n,e.themeVariables);return Tm(xO(`${i}{${s}}`),bO)},"createUserStyles"),sN=T((e="",t,r)=>{let i=e;return!r&&!t&&(i=i.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),i=Ho(i),i=i.replace(/<br>/g,"<br/>"),i},"cleanUpSvgCode"),oN=T((e="",t)=>{var n,s;const r=(s=(n=t==null?void 0:t.viewBox)==null?void 0:n.baseVal)!=null&&s.height?t.viewBox.baseVal.height+"px":X8,i=gE(`<body style="${Z8}">${e}</body>`);return`<iframe style="width:${K8};height:${r};${Q8}" src="data:text/html;charset=UTF-8;base64,${i}" sandbox="${J8}">
|
|
313
|
+
${eN}
|
|
314
|
+
</iframe>`},"putIntoIFrame"),Q1=T((e,t,r,i,n)=>{const s=e.append("div");s.attr("id",r),i&&s.attr("style",i);const a=s.append("svg").attr("id",t).attr("width","100%").attr("xmlns",V8);return n&&a.attr("xmlns:xlink",n),a.append("g"),e},"appendDivSvgG");function Am(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}T(Am,"sandboxedIframe");var aN=T((e,t,r,i)=>{var n,s,a;(n=e.getElementById(t))==null||n.remove(),(s=e.getElementById(r))==null||s.remove(),(a=e.getElementById(i))==null||a.remove()},"removeExistingElements"),lN=T(async function(e,t,r){var Y,F,z,$,j,W;of();const i=b0(t);t=i.code;const n=Pr();ue.debug(n),t.length>((n==null?void 0:n.maxTextSize)??W8)&&(t=H8);const s="#"+e,a="i"+e,l="#"+a,u="d"+e,h="#"+u,d=T(()=>{const Q=nt(m?l:h).node();Q&&"remove"in Q&&Q.remove()},"removeTempElements");let p=nt("body");const m=n.securityLevel===q8,y=n.securityLevel===U8,x=n.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),m){const P=Am(nt(r),a);p=nt(P.nodes()[0].contentDocument.body),p.node().style.margin=0}else p=nt(r);Q1(p,e,u,`font-family: ${x}`,G8)}else{if(aN(document,e,u,a),m){const P=Am(nt("body"),a);p=nt(P.nodes()[0].contentDocument.body),p.node().style.margin=0}else p=nt("body");Q1(p,e,u)}let v,S;try{v=await Rm.fromText(t,{title:i.title})}catch(P){if(n.suppressErrorRendering)throw d(),P;v=await Rm.fromText("error"),S=P}const C=p.select(h).node(),E=v.type,L=C.firstChild,B=L.firstChild,R=(F=(Y=v.renderer).getClasses)==null?void 0:F.call(Y,t,v),k=nN(n,E,R,s),A=document.createElement("style");A.innerHTML=k,L.insertBefore(A,B);try{await v.renderer.draw(t,e,Lv.version,v)}catch(P){throw n.suppressErrorRendering?d():KF.draw(t,e,Lv.version),P}const O=p.select(`${h} svg`),V=($=(z=v.db).getAccTitle)==null?void 0:$.call(z),q=(W=(j=v.db).getAccDescription)==null?void 0:W.call(j);xE(E,O,V,q),p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",Y8);let H=p.select(h).node().innerHTML;if(ue.debug("config.arrowMarkerAbsolute",n.arrowMarkerAbsolute),H=sN(H,m,sr(n.arrowMarkerAbsolute)),m){const P=p.select(h+" svg").node();H=oN(H,P)}else y||(H=ln.sanitize(H,{ADD_TAGS:tN,ADD_ATTR:rN,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(j8(),S)throw S;return d(),{diagramType:E,svg:H,bindFunctions:v.db.bindFunctions}},"render");function yE(e={}){var i;const t=ir({},e);t!=null&&t.fontFamily&&!((i=t.themeVariables)!=null&&i.fontFamily)&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),tA(t),t!=null&&t.theme&&t.theme in ts?t.themeVariables=ts[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=ts.default.getThemeVariables(t.themeVariables));const r=typeof t=="object"?eA(t):RS();My(r.logLevel),of()}T(yE,"initialize");var _E=T((e,t={})=>{const{code:r}=v0(e);return Rm.fromText(r,t)},"getDiagramFromText");function xE(e,t,r,i){dE(t,e),fE(t,r,i,t.attr("id"))}T(xE,"addA11yInfo");var $o=Object.freeze({render:lN,parse:mE,getDiagramFromText:_E,initialize:yE,getConfig:Pr,setConfig:AS,getSiteConfig:RS,updateSiteConfig:rA,reset:T(()=>{Ku()},"reset"),globalReset:T(()=>{Ku(Pa)},"globalReset"),defaultConfig:Pa});My(Pr().logLevel);Ku(Pr());var cN=T((e,t,r)=>{ue.warn(e),u0(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),vE=T(async function(e={querySelector:".mermaid"}){try{await hN(e)}catch(t){if(u0(t)&&ue.error(t.str),bi.parseError&&bi.parseError(t),!e.suppressErrors)throw ue.error("Use the suppressErrors option to suppress these errors"),t}},"run"),hN=T(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){const i=$o.getConfig();ue.debug(`${e?"":"No "}Callback function found`);let n;if(r)n=r;else if(t)n=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");ue.debug(`Found ${n.length} diagrams`),(i==null?void 0:i.startOnLoad)!==void 0&&(ue.debug("Start On Load: "+(i==null?void 0:i.startOnLoad)),$o.updateSiteConfig({startOnLoad:i==null?void 0:i.startOnLoad}));const s=new sn.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed);let a;const l=[];for(const u of Array.from(n)){if(ue.info("Rendering diagram: "+u.id),u.getAttribute("data-processed"))continue;u.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;a=u.innerHTML,a=Nk(sn.entityDecode(a)).trim().replace(/<br\s*\/?>/gi,"<br/>");const d=sn.detectInit(a);d&&ue.debug("Detected early reinit: ",d);try{const{svg:p,bindFunctions:m}=await CE(h,a,u);u.innerHTML=p,e&&await e(h),m&&m(u)}catch(p){cN(p,l,bi.parseError)}}if(l.length>0)throw l[0]},"runThrowsErrors"),bE=T(function(e){$o.initialize(e)},"initialize"),uN=T(async function(e,t,r){ue.warn("mermaid.init is deprecated. Please use run instead."),e&&bE(e);const i={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?i.querySelector=t:t&&(t instanceof HTMLElement?i.nodes=[t]:i.nodes=t),await vE(i)},"init"),dN=T(async(e,{lazyLoad:t=!0}={})=>{of(),Fg(...e),t===!1&&await I8()},"registerExternalDiagrams"),SE=T(function(){if(bi.startOnLoad){const{startOnLoad:e}=$o.getConfig();e&&bi.run().catch(t=>ue.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",SE,!1);var fN=T(function(e){bi.parseError=e},"setParseErrorHandler"),kd=[],yg=!1,wE=T(async()=>{if(!yg){for(yg=!0;kd.length>0;){const e=kd.shift();if(e)try{await e()}catch(t){ue.error("Error executing queue",t)}}yg=!1}},"executeQueue"),pN=T(async(e,t)=>new Promise((r,i)=>{const n=T(()=>new Promise((s,a)=>{$o.parse(e,t).then(l=>{s(l),r(l)},l=>{var u;ue.error("Error parsing",l),(u=bi.parseError)==null||u.call(bi,l),a(l),i(l)})}),"performCall");kd.push(n),wE().catch(i)}),"parse"),CE=T((e,t,r)=>new Promise((i,n)=>{const s=T(()=>new Promise((a,l)=>{$o.render(e,t,r).then(u=>{a(u),i(u)},u=>{var h;ue.error("Error parsing",u),(h=bi.parseError)==null||h.call(bi,u),l(u),n(u)})}),"performCall");kd.push(s),wE().catch(n)}),"render"),gN=T(()=>Object.keys(Ro).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),bi={startOnLoad:!0,mermaidAPI:$o,parse:pN,render:CE,init:uN,run:vE,registerExternalDiagrams:dN,registerLayoutLoaders:RT,initialize:bE,parseError:void 0,contentLoaded:SE,setParseErrorHandler:fN,detectType:Ly,registerIconPacks:zj,getRegisteredDiagramsMetadata:gN},kE=bi;/*! Check if previously processed *//*!
|
|
315
|
+
* Wait for document loaded before starting the execution
|
|
316
|
+
*/let mN=0;function TE(e){kE.initialize({startOnLoad:!1,theme:"dark",themeVariables:{darkMode:e.id==="dark",background:e.bgSecondary,primaryColor:e.bgTertiary,primaryTextColor:e.textPrimary,primaryBorderColor:e.border,lineColor:e.accent,secondaryColor:e.bgTertiary,tertiaryColor:e.bgSecondary,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif',fontSize:"14px",nodeBorder:e.accent,mainBkg:e.bgTertiary,nodeTextColor:e.textPrimary,edgeLabelBackground:e.bgSecondary},flowchart:{htmlLabels:!0,curve:"basis"}})}async function EE(e,t){e.innerHTML="";const r=`mermaid-${++mN}`;try{const{svg:i}=await kE.render(r,t);return e.innerHTML=i,i}catch(i){const n=document.getElementById(r);throw n&&n.remove(),i}}const _g=.2,xg=4,Z1=.15,yN=.002;function _N({data:e}){const{theme:t}=St(),r=M.useMemo(()=>xN(t),[t]),i=M.useRef(null),n=M.useRef(null),[s,a]=M.useState(0),[l,u]=M.useState(!1),[h,d]=M.useState(null),[p,m]=M.useState(1),[y,x]=M.useState({x:0,y:0}),v=M.useRef(!1),S=M.useRef({x:0,y:0}),C=M.useRef({x:0,y:0}),E=(e==null?void 0:e.format)||"mermaid",L=(e==null?void 0:e.content)||"",B=(e==null?void 0:e.steps)||[],R=(e==null?void 0:e.animate)&&B.length>0,k=(e==null?void 0:e.module)||null,A=(e==null?void 0:e.step)||null;M.useEffect(()=>{TE(t)},[t]),M.useEffect(()=>{!L&&B.length===0||(d(null),a(0),R?Q():j(L,E).then(()=>{requestAnimationFrame(()=>O())}))},[L,E,B.length]);const O=M.useCallback(()=>{var Ft,le,Je,ut,qt,kr,ar,Fi;const I=n.current,Z=i.current;if(!I||!Z)return;const oe=Z.querySelector("svg");if(!oe)return;const X=I.getBoundingClientRect(),ne=oe.getAttribute("width")?parseFloat(oe.getAttribute("width")):((le=(Ft=oe.getBBox)==null?void 0:Ft.call(oe))==null?void 0:le.width)||((ut=(Je=oe.viewBox)==null?void 0:Je.baseVal)==null?void 0:ut.width)||0,he=oe.getAttribute("height")?parseFloat(oe.getAttribute("height")):((kr=(qt=oe.getBBox)==null?void 0:qt.call(oe))==null?void 0:kr.height)||((Fi=(ar=oe.viewBox)==null?void 0:ar.baseVal)==null?void 0:Fi.height)||0;if(!ne||!he)return;const ye=48,ve=48,be=X.width-ye,$e=X.height-ve;if(be<=0||$e<=0)return;const Xe=be/ne,it=$e/he,Oe=Math.min(Xe,it,xg),ht=Math.max(_g,Oe);m(ht),x({x:0,y:0})},[]);function V(){m(I=>Math.min(I+Z1,xg))}function q(){m(I=>Math.max(I-Z1,_g))}function H(){m(1),x({x:0,y:0})}function Y(I){I.preventDefault();const Z=-I.deltaY*yN;m(oe=>{const X=oe+Z*oe;return Math.min(Math.max(X,_g),xg)})}function F(I){I.button===0&&(v.current=!0,S.current={x:I.clientX,y:I.clientY},C.current={...y},I.currentTarget.setPointerCapture(I.pointerId))}function z(I){if(!v.current)return;const Z=I.clientX-S.current.x,oe=I.clientY-S.current.y;x({x:C.current.x+Z,y:C.current.y+oe})}function $(){v.current=!1}async function j(I,Z){const oe=i.current;if(oe)try{Z==="mermaid"?await W(oe,I):Z==="svg"?P(oe,I):Z==="d3"?oe.innerHTML=`
|
|
317
|
+
<div style="text-align:center; padding:40px; color:${t.textSecondary};">
|
|
318
|
+
<p>D3 visualization support coming soon</p>
|
|
319
|
+
</div>
|
|
320
|
+
`:d(`Unsupported diagram format: ${Z}`)}catch(X){console.error("[Canvas] Render error:",X),d(X.message||"Failed to render diagram")}}async function W(I,Z){await EE(I,Z)}function P(I,Z){I.innerHTML=Z}async function Q(){u(!0);for(let I=0;I<B.length;I++){a(I);const Z=B[I],oe=Z.content||Z,X=Z.format||E;if(await j(oe,X),I<B.length-1){const ne=Z.delay||1500;await new Promise(he=>setTimeout(he,ne))}}u(!1)}function ee(I){if(l||I<0||I>=B.length)return;a(I);const Z=B[I],oe=Z.content||Z,X=Z.format||E;j(oe,X)}return e?g.jsxs("div",{style:r.container,children:[(k||A)&&g.jsxs("div",{style:r.breadcrumb,children:[k&&g.jsx("span",{style:r.breadcrumbModule,children:k}),k&&A&&g.jsx("span",{style:r.breadcrumbSep,children:"/"}),A&&g.jsx("span",{style:r.breadcrumbStep,children:A})]}),g.jsxs("div",{style:r.zoomControls,children:[g.jsx("button",{onClick:q,style:r.zoomButton,title:"Zoom out","aria-label":"Zoom out",children:"−"}),g.jsxs("span",{style:r.zoomLevel,children:[Math.round(p*100),"%"]}),g.jsx("button",{onClick:V,style:r.zoomButton,title:"Zoom in","aria-label":"Zoom in",children:"+"}),g.jsx("div",{style:r.zoomDivider}),g.jsx("button",{onClick:O,style:r.zoomButton,title:"Fit to canvas","aria-label":"Fit to canvas",children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[g.jsx("polyline",{points:"1,5 1,1 5,1"}),g.jsx("polyline",{points:"9,1 13,1 13,5"}),g.jsx("polyline",{points:"13,9 13,13 9,13"}),g.jsx("polyline",{points:"5,13 1,13 1,9"})]})}),g.jsx("button",{onClick:H,style:r.zoomButton,title:"Reset zoom (100%)","aria-label":"Reset zoom",children:"1:1"})]}),g.jsx("div",{ref:n,style:r.diagramWrapper,onWheel:Y,onPointerDown:F,onPointerMove:z,onPointerUp:$,onPointerCancel:$,children:h?g.jsxs("div",{style:r.errorBox,children:[g.jsx("p",{style:r.errorTitle,children:"Render Error"}),g.jsx("pre",{style:r.errorMessage,children:h}),g.jsx("p",{style:r.errorHint,children:"The diagram syntax may be invalid."})]}):g.jsx("div",{ref:i,style:{...r.diagram,transform:`translate(${y.x}px, ${y.y}px) scale(${p})`,cursor:v.current?"grabbing":"grab"}})}),B.length>0&&g.jsxs("div",{style:r.stepControls,children:[g.jsxs("button",{onClick:()=>ee(s-1),disabled:s===0||l,style:{...r.stepButton,opacity:s===0||l?.4:1},children:["◀"," Prev"]}),g.jsx("div",{style:r.stepIndicators,children:B.map((I,Z)=>g.jsx("button",{onClick:()=>ee(Z),disabled:l,style:{...r.stepDot,backgroundColor:Z===s?t.accent:t.border}},Z))}),g.jsx("span",{style:r.stepLabel,children:l?"Animating...":`Step ${s+1} of ${B.length}`}),g.jsxs("button",{onClick:()=>ee(s+1),disabled:s>=B.length-1||l,style:{...r.stepButton,opacity:s>=B.length-1||l?.4:1},children:["Next ","▶"]})]}),(e==null?void 0:e.awaitingAnswer)&&g.jsxs("div",{style:r.answerPrompt,children:[g.jsx("span",{style:r.promptIcon,children:"💬"}),g.jsx("span",{children:"Answer in the terminal"})]})]}):g.jsxs("div",{style:r.empty,children:[g.jsx("div",{style:r.emptyIcon,children:"🎨"}),g.jsx("p",{style:r.emptyTitle,children:"Canvas Ready"}),g.jsx("p",{style:r.emptySubtext,children:"Diagrams and visualizations will appear here during lessons."})]})}function xN(e){return{container:{display:"flex",flexDirection:"column",gap:8,height:"100%",minHeight:0},breadcrumb:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:e.textSecondary,flexShrink:0},breadcrumbModule:{color:e.accent,fontWeight:500},breadcrumbSep:{color:e.textMuted},breadcrumbStep:{color:e.textPrimary},zoomControls:{display:"flex",alignItems:"center",gap:4,flexShrink:0},zoomButton:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:28,fontSize:14,fontWeight:500,color:e.textSecondary,backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",transition:"background-color 0.15s ease, color 0.15s ease",padding:0,lineHeight:1},zoomLevel:{fontSize:12,color:e.textSecondary,minWidth:42,textAlign:"center",fontVariantNumeric:"tabular-nums"},zoomDivider:{width:1,height:16,backgroundColor:e.border,margin:"0 4px"},diagramWrapper:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,flex:1,minHeight:300,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative",touchAction:"none",userSelect:"none"},diagram:{transformOrigin:"center center",transition:"none",display:"inline-flex",alignItems:"center",justifyContent:"center"},stepControls:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 0",flexShrink:0},stepButton:{padding:"6px 14px",fontSize:13,fontWeight:500,color:e.textPrimary,backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",transition:"opacity 0.15s ease"},stepIndicators:{display:"flex",gap:6},stepDot:{width:10,height:10,borderRadius:"50%",border:"none",cursor:"pointer",transition:"background-color 0.2s ease"},stepLabel:{fontSize:12,color:e.textSecondary,minWidth:100,textAlign:"center"},answerPrompt:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,padding:"14px 20px",backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:10,fontSize:14,color:e.textPrimary,animation:"pulse 2s infinite",flexShrink:0},promptIcon:{fontSize:18},errorBox:{textAlign:"center",padding:24,color:e.error},errorTitle:{fontSize:16,fontWeight:600,margin:"0 0 8px"},errorMessage:{fontSize:13,fontFamily:"monospace",backgroundColor:e.bgTertiary,padding:"8px 12px",borderRadius:6,margin:"0 0 8px",whiteSpace:"pre-wrap",textAlign:"left",color:e.error},errorHint:{fontSize:13,color:e.textSecondary,margin:0},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}function vN({data:e,sendEvent:t}){const{theme:r}=St(),i=M.useMemo(()=>kN(r),[r]);if(!e)return g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:"🧠"}),g.jsx("p",{style:i.emptyTitle,children:"Quiz Mode"}),g.jsx("p",{style:i.emptySubtext,children:"Interactive quizzes will appear here during lessons."})]});const{quizType:n,question:s,items:a,timeLimit:l,options:u,pairs:h,code:d,blanks:p,correctIndex:m,correctAnswer:y}=e;switch(n){case"drag-order":return g.jsx(bN,{question:s,items:a||[],sendEvent:t,theme:r,s:i});case"timed-choice":return g.jsx(SN,{question:s,options:u||a||[],timeLimit:l||30,correctIndex:m,correctAnswer:y,sendEvent:t,theme:r,s:i});case"matching":return g.jsx(wN,{question:s,pairs:h||a||[],sendEvent:t,theme:r,s:i});case"fill-blank":return g.jsx(CN,{question:s,code:d||"",blanks:p||[],sendEvent:t,theme:r,s:i});default:return g.jsx("div",{style:i.errorBox,children:g.jsxs("p",{children:["Unknown quiz type: ",n]})})}}function bN({question:e,items:t,sendEvent:r,theme:i,s:n}){const[s,a]=M.useState(t),[l,u]=M.useState(null),[h,d]=M.useState(null),[p,m]=M.useState(!1),[y,x]=M.useState(null);M.useEffect(()=>{a(t),m(!1),x(null)},[t]);function v(B,R){u(R),B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R.toString()),B.target&&(B.target.style.opacity="0.5")}function S(B){B.target&&(B.target.style.opacity="1"),u(null),d(null)}function C(B,R){B.preventDefault(),B.dataTransfer.dropEffect="move",R!==h&&d(R)}function E(B,R){B.preventDefault();const k=l;if(k===null||k===R)return;const A=[...s],[O]=A.splice(k,1);A.splice(R,0,O),a(A),u(null),d(null)}function L(){m(!0);const B=s.map(A=>typeof A=="string"?A:A.id||A.label),R=t.map(A=>typeof A=="string"?A:A.id||A.label),k=B.length===R.length&&B.every((A,O)=>A===R[O]);r("event:quiz-answer",{quizType:"drag-order",answer:B,correct:k}),x(k?"correct":"wrong")}return g.jsxs("div",{style:n.quizContainer,children:[g.jsx("h2",{style:n.question,children:e}),g.jsx("p",{style:n.hint,children:"Drag items to reorder them"}),g.jsx("div",{style:n.dragList,children:s.map((B,R)=>{const k=typeof B=="string"?B:B.label||B.text||B.id,A=h===R,O=l===R,V=t[R]?typeof t[R]=="string"?t[R]:t[R].id||t[R].label:null,q=typeof B=="string"?B:B.id||B.label,H=p&&V===q,Y=p&&V!==q;return g.jsxs("div",{draggable:!p,onDragStart:F=>v(F,R),onDragEnd:S,onDragOver:F=>C(F,R),onDrop:F=>E(F,R),style:{...n.dragItem,borderColor:p?H?i.success:i.error:A?i.accent:i.border,backgroundColor:O?i.bgTertiary:i.bgSecondary,transform:A?"scale(1.01)":"scale(1)",opacity:p&&Y?.7:1,cursor:p?"default":"grab"},children:[g.jsx("span",{style:n.dragHandle,children:"☰"}),g.jsx("span",{style:n.dragIndex,children:R+1}),g.jsx("span",{style:n.dragLabel,children:k}),p&&H&&g.jsx("span",{style:{marginLeft:"auto"},children:"✅"}),p&&Y&&g.jsx("span",{style:{marginLeft:"auto"},children:"❌"})]},`${k}-${R}`)})}),!p&&g.jsx("button",{onClick:L,style:n.submitButton,children:"Submit Order"}),p&&g.jsx("div",{style:{...n.pendingResult,color:y==="correct"?i.success:i.error},children:y==="correct"?"✅ Correct order!":"❌ Not quite right. Check the highlighted items."})]})}function SN({question:e,options:t,timeLimit:r,correctIndex:i,correctAnswer:n,sendEvent:s,theme:a,s:l}){const[u,h]=M.useState(null),[d,p]=M.useState(!1),[m,y]=M.useState(r),[x,v]=M.useState(null),S=M.useRef(null),C=M.useMemo(()=>{if(typeof i=="number")return i;if(n!=null){const k=t.findIndex(A=>(typeof A=="string"?A:A.id||A.label||A.text)===n);return k>=0?k:null}return null},[i,n,t]);M.useEffect(()=>(h(null),p(!1),y(r),v(null),S.current=setInterval(()=>{y(k=>k<=1?(clearInterval(S.current),0):k-1)},1e3),()=>{S.current&&clearInterval(S.current)}),[e,r]),M.useEffect(()=>{m===0&&!d&&E(null)},[m,d]);function E(k){if(d)return;p(!0),h(k),S.current&&clearInterval(S.current);const A=k!==null?typeof k=="string"?k:k.id||k.label||k:null;let O=!1;k===null?v("timeout"):C!=null?(O=t.indexOf(k)===C,v(O?"correct":"wrong")):v("pending"),s("event:quiz-answer",{quizType:"timed-choice",answer:A,correct:C!=null?O:void 0,timeMs:(r-m)*1e3})}const L=m/r*100,B=m>r*.5?a.success:m>r*.2?a.warning:a.error,R=C!=null&&t[C]?typeof t[C]=="string"?t[C]:t[C].label||t[C].text:null;return g.jsxs("div",{style:l.quizContainer,children:[g.jsx("div",{style:l.timerBar,children:g.jsx("div",{style:{...l.timerFill,width:`${L}%`,backgroundColor:B}})}),g.jsx("div",{style:l.timerLabel,children:g.jsxs("span",{children:["⏱"," ",m,"s"]})}),g.jsx("h2",{style:l.question,children:e}),g.jsx("div",{style:l.choiceGrid,children:t.map((k,A)=>{const O=typeof k=="string"?k:k.label||k.text,V=typeof k=="string"?k:k.id||k.label,q=u!==null&&(typeof u=="string"?u:u.id||u.label)===V,H=d&&C===A,Y=d&&q&&x==="wrong";let F=a.border,z=a.bgSecondary;return d&&H?(F=a.success,z=`${a.success}18`):Y?(F=a.error,z=`${a.error}18`):q&&(F=a.accent,z=`${a.accent}18`),g.jsxs("button",{onClick:()=>!d&&E(k),disabled:d,style:{...l.choiceButton,borderColor:F,backgroundColor:z,cursor:d?"default":"pointer",opacity:d&&!q&&!H?.5:1},children:[g.jsx("span",{style:l.choiceLetter,children:String.fromCharCode(65+A)}),g.jsx("span",{style:l.choiceText,children:O}),d&&H&&g.jsx("span",{style:{marginLeft:"auto",fontSize:18},children:"✅"}),Y&&g.jsx("span",{style:{marginLeft:"auto",fontSize:18},children:"❌"})]},`${V}-${A}`)})}),d&&g.jsxs("div",{style:{...l.pendingResult,color:x==="correct"?a.success:x==="wrong"?a.error:x==="timeout"?a.warning:a.textSecondary},children:[x==="correct"&&"✅ Correct!",x==="wrong"&&(R?`❌ Incorrect. The answer was: ${R}`:"❌ Incorrect."),x==="timeout"&&(R?`⏰ Time's up! The answer was: ${R}`:"⏰ Time's up! No answer submitted."),x==="pending"&&"Checking your answer..."]})]})}function wN({question:e,pairs:t,sendEvent:r,theme:i,s:n}){const[s]=M.useState(()=>t.map(L=>L.left||L.a||L.term)),[a]=M.useState(()=>[...t.map(B=>B.right||B.b||B.definition)].sort(()=>Math.random()-.5)),[l,u]=M.useState({}),[h,d]=M.useState(null),[p,m]=M.useState(!1);M.useEffect(()=>{u({}),d(null),m(!1)},[e]);function y(L){p||d(h===L?null:L)}function x(L){if(p||!h)return;const B={...l};delete B[h];for(const[R,k]of Object.entries(B))k===L&&delete B[R];B[h]=L,u(B),d(null)}const v=M.useMemo(()=>{const L={};for(const B of t){const R=B.left||B.a||B.term,k=B.right||B.b||B.definition;L[R]=k}return L},[t]);function S(){m(!0);const L=s.filter(B=>l[B]===v[B]).length;r("event:quiz-answer",{quizType:"matching",answer:l,correct:L===s.length,score:L})}const C=Object.keys(l).length===s.length,E=new Set(Object.values(l));return g.jsxs("div",{style:n.quizContainer,children:[g.jsx("h2",{style:n.question,children:e}),g.jsx("p",{style:n.hint,children:"Click a left item, then click its match on the right"}),g.jsxs("div",{style:n.matchingContainer,children:[g.jsx("div",{style:n.matchingColumn,children:s.map((L,B)=>{const R=h===L,k=L in l;return g.jsxs("button",{onClick:()=>y(L),disabled:p,style:{...n.matchItem,borderColor:R?i.accent:k?i.success:i.border,backgroundColor:R?`${i.accent}18`:k?`${i.success}10`:i.bgSecondary,cursor:p?"default":"pointer"},children:[L,k&&g.jsx("span",{style:n.matchCheck,children:"✔"})]},`left-${B}`)})}),g.jsx("div",{style:n.matchingArrows,children:s.map((L,B)=>g.jsx("div",{style:n.arrowRow,children:l[L]?g.jsx("span",{style:n.arrowConnected,children:"──▶"}):g.jsx("span",{style:n.arrowEmpty,children:"···"})},B))}),g.jsx("div",{style:n.matchingColumn,children:a.map((L,B)=>{const R=E.has(L);return g.jsx("button",{onClick:()=>x(L),disabled:p||!h,style:{...n.matchItem,borderColor:R?i.success:i.border,backgroundColor:R?`${i.success}10`:i.bgSecondary,cursor:p||!h?"default":"pointer",opacity:p&&!R?.5:1},children:L},`right-${B}`)})})]}),!p&&g.jsx("button",{onClick:S,disabled:!C,style:{...n.submitButton,opacity:C?1:.5,cursor:C?"pointer":"not-allowed"},children:"Submit Matches"}),p&&(()=>{const L=s.filter(R=>l[R]===v[R]).length,B=L===s.length;return g.jsx("div",{style:{...n.pendingResult,color:B?i.success:i.error},children:B?"✅ All matches correct!":`❌ ${L} of ${s.length} correct.`})})()]})}function CN({question:e,code:t,blanks:r,sendEvent:i,theme:n,s}){const[a,l]=M.useState(()=>r.map(()=>"")),[u,h]=M.useState(!1);M.useEffect(()=>{l(r.map(()=>"")),h(!1)},[e,t]);function d(v,S){if(u)return;const C=[...a];C[v]=S,l(C)}function p(){return r.map((v,S)=>{const C=(a[S]||"").trim().toLowerCase();return(Array.isArray(v.answer)?v.answer.map(L=>L.toLowerCase()):[String(v.answer||"").toLowerCase()]).includes(C)})}function m(){h(!0);const S=p().filter(Boolean).length;i("event:quiz-answer",{quizType:"fill-blank",answer:a,correct:S===r.length,score:S})}function y(){const v=t.split(/(___\d+___)/g),S=u?p():[];return v.map((C,E)=>{var B,R;const L=C.match(/___(\d+)___/);if(L){const k=parseInt(L[1],10),A=r[k]||{},O=u&&S[k],V=u&&!S[k];return g.jsxs("span",{style:{display:"inline-block",position:"relative"},children:[g.jsx("input",{type:"text",value:a[k]||"",onChange:q=>d(k,q.target.value),disabled:u,placeholder:A.placeholder||"...",style:{...s.blankInput,width:Math.max(80,(((B=a[k])==null?void 0:B.length)||((R=A.placeholder)==null?void 0:R.length)||3)*9+20),borderColor:O?"#3fb950":V?"#f85149":void 0}}),V&&A.answer&&g.jsxs("span",{style:{display:"block",fontSize:11,color:"#f85149",marginTop:2},children:["Expected: ",Array.isArray(A.answer)?A.answer[0]:A.answer]})]},`blank-${E}`)}return g.jsx("span",{children:C},`code-${E}`)})}const x=a.every(v=>v.trim().length>0);return g.jsxs("div",{style:s.quizContainer,children:[g.jsx("h2",{style:s.question,children:e}),g.jsx("pre",{style:s.codeBlock,children:g.jsx("code",{children:y()})}),!u&&g.jsx("button",{onClick:m,disabled:!x,style:{...s.submitButton,opacity:x?1:.5,cursor:x?"pointer":"not-allowed"},children:"Submit Answer"}),u&&(()=>{const S=p().filter(Boolean).length,C=S===r.length;return g.jsx("div",{style:{...s.pendingResult,color:C?"#3fb950":"#f85149"},children:C?"✅ All blanks correct!":`❌ ${S} of ${r.length} correct.`})})()]})}function kN(e){return{quizContainer:{maxWidth:700,margin:"0 auto",display:"flex",flexDirection:"column",gap:20},question:{fontSize:22,fontWeight:700,color:e.textBright,margin:0,lineHeight:1.4},hint:{fontSize:13,color:e.textSecondary,margin:0},submitButton:{alignSelf:"center",padding:"10px 28px",fontSize:14,fontWeight:600,color:"#ffffff",backgroundColor:e.success,border:`1px solid ${e.success}`,borderRadius:8,cursor:"pointer",transition:"background-color 0.15s ease"},pendingResult:{textAlign:"center",padding:"12px 20px",backgroundColor:e.bgTertiary,borderRadius:8,fontSize:14,color:e.textSecondary},errorBox:{textAlign:"center",padding:40,color:e.error,fontSize:16},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0},dragList:{display:"flex",flexDirection:"column",gap:8},dragItem:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid",borderRadius:8,transition:"border-color 0.15s ease, transform 0.1s ease, background-color 0.15s ease",userSelect:"none"},dragHandle:{fontSize:16,color:e.textMuted,cursor:"grab"},dragIndex:{width:24,height:24,borderRadius:"50%",backgroundColor:e.bgTertiary,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:e.textSecondary,flexShrink:0},dragLabel:{fontSize:14,color:e.textPrimary},timerBar:{height:4,backgroundColor:e.bgTertiary,borderRadius:2,overflow:"hidden"},timerFill:{height:"100%",borderRadius:2,transition:"width 1s linear, background-color 0.3s ease"},timerLabel:{textAlign:"right",fontSize:13,color:e.textSecondary},choiceGrid:{display:"flex",flexDirection:"column",gap:10},choiceButton:{display:"flex",alignItems:"center",gap:14,padding:"14px 18px",border:"1px solid",borderRadius:10,textAlign:"left",transition:"border-color 0.15s ease, background-color 0.15s ease",width:"100%",fontSize:14,color:e.textPrimary,fontFamily:"inherit"},choiceLetter:{width:28,height:28,borderRadius:"50%",backgroundColor:e.bgTertiary,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:e.textSecondary,flexShrink:0},choiceText:{flex:1},matchingContainer:{display:"flex",gap:16,alignItems:"flex-start"},matchingColumn:{flex:1,display:"flex",flexDirection:"column",gap:8},matchingArrows:{display:"flex",flexDirection:"column",gap:8,justifyContent:"flex-start",paddingTop:0},arrowRow:{height:46,display:"flex",alignItems:"center",justifyContent:"center"},arrowConnected:{color:e.success,fontFamily:"monospace",fontSize:14},arrowEmpty:{color:e.border,fontFamily:"monospace",fontSize:14},matchItem:{padding:"10px 16px",border:"1px solid",borderRadius:8,fontSize:14,color:e.textPrimary,backgroundColor:e.bgSecondary,fontFamily:"inherit",width:"100%",textAlign:"left",transition:"border-color 0.15s ease, background-color 0.15s ease",display:"flex",alignItems:"center",justifyContent:"space-between"},matchCheck:{color:e.success,marginLeft:8},codeBlock:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,padding:"20px 24px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:14,lineHeight:1.7,color:e.textPrimary,overflow:"auto",whiteSpace:"pre-wrap"},blankInput:{display:"inline-block",padding:"2px 8px",fontSize:14,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',color:e.accent,backgroundColor:e.bgPrimary,border:`1px solid ${e.accent}`,borderRadius:4,outline:"none",verticalAlign:"baseline"}}}const TN=M.lazy(()=>ct(()=>import("./index-mEoP57az.js"),[]));function EN({data:e,sendEvent:t}){const{theme:r}=St(),i=M.useMemo(()=>MN(r),[r]),[n,s]=M.useState(""),[a,l]=M.useState(""),[u,h]=M.useState(""),[d,p]=M.useState(!1),[m,y]=M.useState("javascript");M.useEffect(()=>{if(!e)return;const L=e.starter||"";l(L),s(L),h(""),y(e.language||"javascript"),p(!1)},[e]);const x=M.useCallback(async()=>{if(!d){p(!0),h("Running..."),t("event:code-run",{code:n,language:m});try{const B=await(await fetch("http://localhost:3456/api/playground/exec",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n,language:m})})).json();B.error?h(B.error):h(B.output||"(no output)")}catch{h("Error: Could not connect to bridge server.")}finally{p(!1)}}},[n,m,d,t]),v=M.useCallback(()=>{s(a),h("")},[a]),S=M.useCallback(()=>{t("event:click",{element:"hint",data:{language:m,code:n}})},[m,n,t]),C={bash:"shell",sh:"shell",javascript:"javascript",js:"javascript",python:"python",py:"python",typescript:"typescript",ts:"typescript"}[m]||m,E=r.id==="light"?"light":"vs-dark";return e?g.jsxs("div",{style:i.container,children:[g.jsxs("div",{style:i.header,children:[g.jsxs("div",{style:i.headerLeft,children:[g.jsx("span",{style:i.langBadge,children:m}),e.instructions&&g.jsx("span",{style:i.instructions,children:e.instructions})]}),g.jsxs("div",{style:i.headerRight,children:[g.jsxs("button",{onClick:S,style:i.hintButton,children:["💡"," Hint"]}),g.jsxs("button",{onClick:v,style:i.resetButton,children:["↺"," Reset"]}),g.jsx("button",{onClick:x,disabled:d,style:{...i.runButton,opacity:d?.7:1},children:d?"⏳ Running...":"▶ Run"})]})]}),g.jsx("div",{style:i.editorContainer,children:g.jsx(M.Suspense,{fallback:g.jsx(BN,{code:n,onChange:s,theme:r,s:i}),children:g.jsx(TN,{height:"350px",language:C,value:n,onChange:L=>s(L||""),theme:E,options:{minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on",padding:{top:12},renderLineHighlight:"none",overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8}}})})}),g.jsxs("div",{style:i.outputContainer,children:[g.jsxs("div",{style:i.outputHeader,children:[g.jsx("span",{style:i.outputTitle,children:"Output"}),u&&g.jsx("button",{onClick:()=>h(""),style:i.clearButton,children:"Clear"})]}),g.jsx("pre",{style:i.outputContent,children:u||"Run your code to see output here."})]})]}):g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:"💻"}),g.jsx("p",{style:i.emptyTitle,children:"Code Playground"}),g.jsx("p",{style:i.emptySubtext,children:"Interactive code exercises will appear here during lessons."})]})}function BN({code:e,onChange:t,theme:r,s:i}){return g.jsxs("div",{style:i.fallbackContainer,children:[g.jsx("div",{style:i.fallbackLoading,children:"Loading editor..."}),g.jsx("textarea",{value:e,onChange:n=>t(n.target.value),style:i.fallbackTextarea,spellCheck:!1})]})}function MN(e){return{container:{display:"flex",flexDirection:"column",gap:0,maxWidth:900,margin:"0 auto",border:`1px solid ${e.border}`,borderRadius:12,overflow:"hidden"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexWrap:"wrap",gap:8},headerLeft:{display:"flex",alignItems:"center",gap:12},langBadge:{fontSize:12,fontWeight:600,color:e.textPrimary,backgroundColor:e.bgTertiary,padding:"3px 10px",borderRadius:12,textTransform:"uppercase",letterSpacing:"0.05em"},instructions:{fontSize:13,color:e.textSecondary},headerRight:{display:"flex",alignItems:"center",gap:8},hintButton:{padding:"5px 12px",fontSize:13,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}40`,borderRadius:6,cursor:"pointer",transition:"background-color 0.15s ease"},resetButton:{padding:"5px 12px",fontSize:13,color:e.textSecondary,backgroundColor:"transparent",border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",transition:"background-color 0.15s ease"},runButton:{padding:"5px 16px",fontSize:13,fontWeight:600,color:"#ffffff",backgroundColor:e.success,border:`1px solid ${e.success}`,borderRadius:6,cursor:"pointer",transition:"opacity 0.15s ease"},editorContainer:{backgroundColor:e.id==="light"?"#ffffff":"#1e1e1e",minHeight:350},outputContainer:{backgroundColor:e.bgPrimary,borderTop:`1px solid ${e.border}`},outputHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:`1px solid ${e.bgTertiary}`},outputTitle:{fontSize:12,fontWeight:600,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.05em"},clearButton:{fontSize:11,color:e.textMuted,backgroundColor:"transparent",border:"none",cursor:"pointer"},outputContent:{padding:"12px 16px",margin:0,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:13,lineHeight:1.6,color:e.textSecondary,minHeight:80,maxHeight:200,overflow:"auto",whiteSpace:"pre-wrap"},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0},fallbackContainer:{position:"relative",height:350},fallbackLoading:{position:"absolute",top:12,right:16,fontSize:12,color:e.textMuted,zIndex:1},fallbackTextarea:{width:"100%",height:"100%",padding:"12px 16px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:14,lineHeight:1.6,color:e.textPrimary,backgroundColor:e.id==="light"?"#ffffff":"#1e1e1e",border:"none",outline:"none",resize:"none"}}}const LN="http://localhost:3456";function RN({data:e,sendEvent:t}){const{theme:r}=St(),i=M.useMemo(()=>DN(r),[r]),[n,s]=M.useState([]),[a,l]=M.useState("~"),[u,h]=M.useState(""),[d,p]=M.useState(!1),[m,y]=M.useState(null),[x,v]=M.useState([]),[S,C]=M.useState(-1),E=M.useRef(null),L=M.useRef(null);M.useEffect(()=>{e&&(e.cwd&&l(e.cwd),e.resetHistory&&(s([]),y(null),v([]),C(-1)))},[e]),M.useEffect(()=>{E.current&&typeof E.current.scrollIntoView=="function"&&E.current.scrollIntoView({behavior:"smooth"})},[n]),M.useEffect(()=>{var q;d||(q=L.current)==null||q.focus()},[d,e]);const B=M.useCallback(async q=>{if(q.trim()){p(!0),s(H=>[...H,{type:"command",cwd:a,text:q}]),v(H=>[...H,q]),C(-1);try{const Y=await(await fetch(`${LN}/api/terminal/exec`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:q,sessionId:m,cwd:e==null?void 0:e.cwd})})).json();!m&&Y.sessionId&&y(Y.sessionId),Y.cwd&&l(Y.cwd),Y.output&&s(F=>[...F,{type:"output",text:Y.output,exitCode:Y.exitCode}])}catch{s(Y=>[...Y,{type:"output",text:"Error: Could not connect to bridge server. Is it running?",exitCode:1}])}finally{p(!1)}}},[a,m,e==null?void 0:e.cwd]),R=M.useCallback(q=>{if(q.key==="Enter"&&!d){q.preventDefault();const H=u.trim();H&&(B(H),h(""))}else if(q.key==="ArrowUp"){if(q.preventDefault(),x.length===0)return;const H=S===-1?x.length-1:Math.max(0,S-1);C(H),h(x[H])}else if(q.key==="ArrowDown"){if(q.preventDefault(),S===-1)return;const H=S+1;H>=x.length?(C(-1),h("")):(C(H),h(x[H]))}else q.key==="l"&&q.ctrlKey&&(q.preventDefault(),s([]))},[u,d,B,x,S]),k=J1(a);if(!e)return g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:">_"}),g.jsx("p",{style:i.emptyTitle,children:"Practice Terminal"}),g.jsx("p",{style:i.emptySubtext,children:"A hands-on terminal will appear here during lessons."})]});const A=e.validations||[],O=A.filter(q=>q.passed).length,V=A.length>0&&O===A.length;return g.jsxs("div",{style:i.container,children:[g.jsxs("div",{style:i.taskPanel,children:[g.jsxs("div",{style:i.taskHeader,children:[g.jsx("span",{style:i.taskLabel,children:"Task"}),e.module&&g.jsx("span",{style:i.moduleBadge,children:e.module}),A.length>0&&g.jsxs("span",{style:{...i.progressBadge,color:V?r.success:r.warning},children:[O,"/",A.length]})]}),g.jsx("p",{style:i.taskText,children:e.task}),A.length>0&&g.jsx("div",{style:i.validations,children:A.map((q,H)=>g.jsxs("div",{style:i.validationRow,children:[g.jsx("span",{style:{...i.validationCheck,color:q.passed?r.success:r.textMuted},children:q.passed?"✓":"○"}),g.jsx("span",{style:{...i.validationLabel,color:q.passed?r.textSecondary:r.textPrimary,textDecoration:q.passed?"line-through":"none"},children:q.label})]},H))}),e.feedback&&g.jsxs("div",{style:i.feedbackBox,children:[g.jsx("span",{style:i.feedbackIcon,children:V?"✓":"→"}),g.jsx("span",{style:i.feedbackText,children:e.feedback})]}),e.hints&&e.hints.length>0&&g.jsx(AN,{hints:e.hints,theme:r,s:i})]}),g.jsxs("div",{style:i.terminalArea,onClick:()=>{var q;return(q=L.current)==null?void 0:q.focus()},children:[g.jsxs("div",{style:i.terminalHeader,children:[g.jsxs("div",{style:i.terminalDots,children:[g.jsx("span",{style:{...i.dot,backgroundColor:r.error}}),g.jsx("span",{style:{...i.dot,backgroundColor:r.warning}}),g.jsx("span",{style:{...i.dot,backgroundColor:r.success}})]}),g.jsx("span",{style:i.terminalTitle,children:k})]}),g.jsxs("div",{style:i.terminalBody,children:[n.map((q,H)=>g.jsx("div",{children:q.type==="command"?g.jsxs("div",{style:i.cmdLine,children:[g.jsxs("span",{style:i.prompt,children:[J1(q.cwd)," $"]}),g.jsx("span",{style:i.cmdText,children:q.text})]}):g.jsx("pre",{style:{...i.outputText,color:q.exitCode!==0?r.error:r.textSecondary},children:q.text})},H)),g.jsxs("div",{style:i.cmdLine,children:[g.jsxs("span",{style:i.prompt,children:[k," $"]}),g.jsx("input",{ref:L,type:"text",value:u,onChange:q=>h(q.target.value),onKeyDown:R,disabled:d,style:i.cmdInput,spellCheck:!1,autoComplete:"off",placeholder:d?"Running...":"Type a command..."})]}),g.jsx("div",{ref:E})]})]})]})}function AN({hints:e,theme:t,s:r}){const[i,n]=M.useState(!1),[s,a]=M.useState(0);return g.jsx("div",{style:r.hintSection,children:i?g.jsxs("div",{children:[g.jsx("p",{style:r.hintText,children:e[s]}),g.jsx("div",{style:r.hintNav,children:s<e.length-1&&g.jsxs("button",{onClick:()=>a(l=>l+1),style:r.hintButton,children:["Next hint (",s+1,"/",e.length,")"]})})]}):g.jsx("button",{onClick:()=>n(!0),style:r.hintButton,children:"Show hint"})})}function J1(e){if(!e)return"~";const t=e.replace(/^\/Users\/[^/]+/,"~").replace(/^\/home\/[^/]+/,"~"),r=t.split("/");return r.length<=3?t:r[0]+"/.../"+r.slice(-2).join("/")}function DN(e){return{container:{display:"flex",flexDirection:"column",gap:0,maxWidth:900,margin:"0 auto",border:`1px solid ${e.border}`,borderRadius:12,overflow:"hidden",height:"calc(100vh - 120px)"},taskPanel:{padding:"16px 20px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexShrink:0},taskHeader:{display:"flex",alignItems:"center",gap:10,marginBottom:8},taskLabel:{fontSize:11,fontWeight:700,color:e.accent,textTransform:"uppercase",letterSpacing:"0.08em"},moduleBadge:{fontSize:11,color:e.textSecondary,backgroundColor:e.bgTertiary,padding:"2px 8px",borderRadius:8},progressBadge:{fontSize:11,fontWeight:600,marginLeft:"auto"},taskText:{fontSize:14,lineHeight:1.6,color:e.textBright,margin:0},validations:{marginTop:12,display:"flex",flexDirection:"column",gap:4},validationRow:{display:"flex",alignItems:"center",gap:8},validationCheck:{fontSize:14,fontWeight:700,width:18,textAlign:"center"},validationLabel:{fontSize:13},feedbackBox:{marginTop:12,padding:"10px 14px",backgroundColor:e.bgPrimary,border:`1px solid ${e.border}`,borderRadius:8,display:"flex",alignItems:"flex-start",gap:10},feedbackIcon:{color:e.accent,fontSize:14,fontWeight:700,flexShrink:0,marginTop:1},feedbackText:{fontSize:13,lineHeight:1.5,color:e.textPrimary},hintSection:{marginTop:10},hintButton:{fontSize:12,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}40`,borderRadius:6,padding:"4px 10px",cursor:"pointer"},hintText:{fontSize:13,color:e.warning,margin:"6px 0",lineHeight:1.5},hintNav:{display:"flex",gap:8},terminalArea:{flex:1,display:"flex",flexDirection:"column",backgroundColor:e.bgPrimary,overflow:"hidden",cursor:"text"},terminalHeader:{display:"flex",alignItems:"center",gap:10,padding:"8px 14px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.bgTertiary}`,flexShrink:0},terminalDots:{display:"flex",gap:6},dot:{width:10,height:10,borderRadius:"50%"},terminalTitle:{fontSize:12,color:e.textMuted,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'},terminalBody:{flex:1,overflow:"auto",padding:"12px 14px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:13,lineHeight:1.6},cmdLine:{display:"flex",alignItems:"baseline",gap:8,minHeight:22},prompt:{color:e.success,fontWeight:600,whiteSpace:"nowrap",flexShrink:0},cmdText:{color:e.textBright},outputText:{margin:"2px 0 8px 0",fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",whiteSpace:"pre-wrap",wordBreak:"break-word"},cmdInput:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",color:e.textBright,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:13,lineHeight:1.6,padding:0,caretColor:e.accent},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',color:e.success},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}function PN({data:e,getBelt:t}){const{theme:r}=St(),i=M.useMemo(()=>IN(r),[r]),[n,s]=M.useState(!1),[a,l]=M.useState([]),u=(e==null?void 0:e.type)||(e==null?void 0:e.celebrationType)||"xp",h=(e==null?void 0:e.xpAwarded)??(e==null?void 0:e.xp)??(e==null?void 0:e.points)??0,d=(e==null?void 0:e.newBelt)??(e==null?void 0:e.belt)??null;M.useMemo(()=>d&&t?t(d==="string"?0:99999):null,[d,t]);const p={white:{badge:"⬜",color:"#e6e6e6"},yellow:{badge:"🟨",color:"#f0c040"},green:{badge:"🟩",color:r.success},blue:{badge:"🟦",color:r.accent},purple:{badge:"🟪",color:r.purple},brown:{badge:"🟫",color:"#a0522d"},black:{badge:"⬛",color:r.textMuted}},m=d&&p[d.toLowerCase()]||null;return M.useEffect(()=>{s(!0);const y=[r.accent,r.success,r.warning,r.purple,r.error,r.orange,r.textBright],v=Array.from({length:u==="perfect-score"?80:u==="level-up"?60:40},(S,C)=>({id:C,x:Math.random()*100,delay:Math.random()*.8,duration:1.5+Math.random()*2,color:y[Math.floor(Math.random()*y.length)],size:4+Math.random()*8,shape:Math.random()>.5?"square":"circle",rotation:Math.random()*360,drift:(Math.random()-.5)*40}));l(v)},[u]),g.jsxs("div",{style:{...i.overlay,opacity:n?1:0},children:[g.jsx("div",{style:i.confettiContainer,children:a.map(y=>g.jsx("div",{style:{position:"absolute",left:`${y.x}%`,top:"-10px",width:y.size,height:y.shape==="circle"?y.size:y.size*1.5,backgroundColor:y.color,borderRadius:y.shape==="circle"?"50%":"2px",transform:`rotate(${y.rotation}deg)`,animation:`confettiFall ${y.duration}s ${y.delay}s ease-in forwards`,opacity:0}},y.id))}),g.jsxs("div",{style:i.content,children:[h>0&&g.jsxs("div",{style:i.xpAward,children:["+",h," XP"]},`xp-${h}`),u==="level-up"&&m&&g.jsxs("div",{style:i.levelUp,children:[g.jsx("div",{style:{...i.beltGlow,boxShadow:`0 0 40px ${m.color}60, 0 0 80px ${m.color}30`,borderColor:m.color},children:g.jsx("span",{style:i.beltEmoji,children:m.badge})}),g.jsxs("h2",{style:i.levelUpTitle,children:["You earned ",d.charAt(0).toUpperCase()+d.slice(1)," Belt!"]})]}),u==="perfect-score"&&g.jsxs("div",{style:i.perfectScore,children:[g.jsx("span",{style:i.perfectIcon,children:"⭐"}),g.jsx("h2",{style:i.perfectTitle,children:"Perfect Score!"})]}),u==="xp"&&!d&&g.jsxs("div",{style:i.simpleXP,children:[g.jsx("span",{style:i.checkIcon,children:"✅"}),(e==null?void 0:e.title)&&g.jsx("h2",{style:{color:r.textBright,fontSize:20,fontWeight:700,margin:"8px 0 0"},children:e.title}),(e==null?void 0:e.subtitle)&&g.jsx("p",{style:{color:r.textSecondary,fontSize:14,margin:"4px 0 0"},children:e.subtitle})]})]}),g.jsx("style",{children:`
|
|
321
|
+
@keyframes confettiFall {
|
|
322
|
+
0% {
|
|
323
|
+
opacity: 1;
|
|
324
|
+
transform: translateY(0) rotate(0deg);
|
|
325
|
+
}
|
|
326
|
+
100% {
|
|
327
|
+
opacity: 0;
|
|
328
|
+
transform: translateY(100vh) rotate(720deg);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
@keyframes floatUp {
|
|
332
|
+
0% {
|
|
333
|
+
opacity: 0;
|
|
334
|
+
transform: translateY(20px) scale(0.8);
|
|
335
|
+
}
|
|
336
|
+
20% {
|
|
337
|
+
opacity: 1;
|
|
338
|
+
transform: translateY(0) scale(1.1);
|
|
339
|
+
}
|
|
340
|
+
40% {
|
|
341
|
+
transform: translateY(-10px) scale(1);
|
|
342
|
+
}
|
|
343
|
+
100% {
|
|
344
|
+
opacity: 0;
|
|
345
|
+
transform: translateY(-60px) scale(0.9);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
@keyframes pulseGlow {
|
|
349
|
+
0%, 100% {
|
|
350
|
+
transform: scale(1);
|
|
351
|
+
}
|
|
352
|
+
50% {
|
|
353
|
+
transform: scale(1.1);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
@keyframes bounceIn {
|
|
357
|
+
0% {
|
|
358
|
+
opacity: 0;
|
|
359
|
+
transform: scale(0.3);
|
|
360
|
+
}
|
|
361
|
+
50% {
|
|
362
|
+
opacity: 1;
|
|
363
|
+
transform: scale(1.05);
|
|
364
|
+
}
|
|
365
|
+
70% {
|
|
366
|
+
transform: scale(0.95);
|
|
367
|
+
}
|
|
368
|
+
100% {
|
|
369
|
+
transform: scale(1);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
`})]})}function IN(e){return{overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:`${e.bgPrimary}bf`,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,transition:"opacity 0.3s ease",pointerEvents:"none"},confettiContainer:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden",pointerEvents:"none"},content:{display:"flex",flexDirection:"column",alignItems:"center",gap:20,zIndex:1},xpAward:{fontSize:48,fontWeight:800,color:e.success,textShadow:`0 0 20px ${e.success}60`,animation:"floatUp 2.5s ease-out forwards"},levelUp:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,animation:"bounceIn 0.6s ease-out"},beltGlow:{width:100,height:100,borderRadius:"50%",border:"3px solid",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.bgTertiary,animation:"pulseGlow 1.5s ease-in-out infinite"},beltEmoji:{fontSize:48},levelUpTitle:{fontSize:28,fontWeight:800,color:e.textBright,margin:0,textAlign:"center"},perfectScore:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,animation:"bounceIn 0.6s ease-out"},perfectIcon:{fontSize:64,animation:"pulseGlow 1s ease-in-out infinite"},perfectTitle:{fontSize:28,fontWeight:800,color:e.warning,margin:0,textShadow:`0 0 20px ${e.warning}60`},simpleXP:{animation:"bounceIn 0.5s ease-out"},checkIcon:{fontSize:64}}}function $N({data:e,onLinkClick:t}){const{theme:r}=St(),i=M.useMemo(()=>jN(r),[r]),n=M.useRef(null),[s,a]=M.useState(300),l=(e==null?void 0:e.html)||"",u=(e==null?void 0:e.title)||"",h=(e==null?void 0:e.module)||null,d=`<!DOCTYPE html>
|
|
373
|
+
<html>
|
|
374
|
+
<head>
|
|
375
|
+
<meta charset="utf-8">
|
|
376
|
+
<style>
|
|
377
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
378
|
+
body {
|
|
379
|
+
margin: 0;
|
|
380
|
+
padding: 16px;
|
|
381
|
+
background: ${r.bgPrimary};
|
|
382
|
+
color: ${r.textPrimary};
|
|
383
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
384
|
+
font-size: 14px;
|
|
385
|
+
line-height: 1.6;
|
|
386
|
+
overflow-x: hidden;
|
|
387
|
+
}
|
|
388
|
+
img {
|
|
389
|
+
max-width: 100%;
|
|
390
|
+
height: auto;
|
|
391
|
+
border-radius: 8px;
|
|
392
|
+
}
|
|
393
|
+
video, audio {
|
|
394
|
+
max-width: 100%;
|
|
395
|
+
border-radius: 8px;
|
|
396
|
+
}
|
|
397
|
+
iframe {
|
|
398
|
+
border: 0;
|
|
399
|
+
border-radius: 8px;
|
|
400
|
+
}
|
|
401
|
+
a {
|
|
402
|
+
color: ${r.accent};
|
|
403
|
+
text-decoration: none;
|
|
404
|
+
}
|
|
405
|
+
a:hover {
|
|
406
|
+
text-decoration: underline;
|
|
407
|
+
}
|
|
408
|
+
h1, h2, h3 {
|
|
409
|
+
color: ${r.textBright};
|
|
410
|
+
margin-top: 0;
|
|
411
|
+
}
|
|
412
|
+
p {
|
|
413
|
+
margin: 8px 0;
|
|
414
|
+
}
|
|
415
|
+
.card {
|
|
416
|
+
background: ${r.bgSecondary};
|
|
417
|
+
border: 1px solid ${r.border};
|
|
418
|
+
border-radius: 10px;
|
|
419
|
+
padding: 16px;
|
|
420
|
+
margin: 8px 0;
|
|
421
|
+
}
|
|
422
|
+
.caption {
|
|
423
|
+
color: ${r.textSecondary};
|
|
424
|
+
font-size: 13px;
|
|
425
|
+
margin-top: 8px;
|
|
426
|
+
text-align: center;
|
|
427
|
+
}
|
|
428
|
+
</style>
|
|
429
|
+
</head>
|
|
430
|
+
<body>
|
|
431
|
+
${l}
|
|
432
|
+
<script>
|
|
433
|
+
// Send height to parent for auto-resize
|
|
434
|
+
function sendHeight() {
|
|
435
|
+
const h = document.documentElement.scrollHeight;
|
|
436
|
+
window.parent.postMessage({ type: 'iframe-resize', height: h }, '*');
|
|
437
|
+
}
|
|
438
|
+
const ro = new ResizeObserver(sendHeight);
|
|
439
|
+
ro.observe(document.body);
|
|
440
|
+
window.addEventListener('load', sendHeight);
|
|
441
|
+
sendHeight();
|
|
442
|
+
|
|
443
|
+
// Intercept link clicks — route to parent for internal display
|
|
444
|
+
document.addEventListener('click', function(e) {
|
|
445
|
+
const anchor = e.target.closest('a');
|
|
446
|
+
if (!anchor || !anchor.href) return;
|
|
447
|
+
// Skip non-http links (mailto:, javascript:, etc.)
|
|
448
|
+
if (!anchor.href.startsWith('http')) return;
|
|
449
|
+
e.preventDefault();
|
|
450
|
+
e.stopPropagation();
|
|
451
|
+
window.parent.postMessage({
|
|
452
|
+
type: 'iframe-link-click',
|
|
453
|
+
url: anchor.href,
|
|
454
|
+
title: anchor.textContent || '',
|
|
455
|
+
}, '*');
|
|
456
|
+
}, true);
|
|
457
|
+
<\/script>
|
|
458
|
+
</body>
|
|
459
|
+
</html>`;return M.useEffect(()=>{function p(m){var y,x;((y=m.data)==null?void 0:y.type)==="iframe-resize"&&typeof m.data.height=="number"&&a(Math.max(100,Math.min(m.data.height+32,2e3))),((x=m.data)==null?void 0:x.type)==="iframe-link-click"&&m.data.url&&t&&t({url:m.data.url,title:m.data.title})}return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[t]),e?g.jsxs("div",{style:i.container,children:[(h||u)&&g.jsxs("div",{style:i.breadcrumb,children:[h&&g.jsx("span",{style:i.breadcrumbModule,children:h}),h&&u&&g.jsx("span",{style:i.breadcrumbSep,children:"/"}),u&&g.jsx("span",{style:i.breadcrumbTitle,children:u})]}),g.jsx("div",{style:i.iframeWrapper,children:g.jsx("iframe",{ref:n,srcDoc:d,sandbox:"allow-scripts allow-same-origin",style:{...i.iframe,height:s},title:u||"Rich content"})})]}):g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:"</>"}),g.jsx("p",{style:i.emptyTitle,children:"HTML Content"}),g.jsx("p",{style:i.emptySubtext,children:"Rich media and custom content will appear here during lessons."})]})}function jN(e){return{container:{display:"flex",flexDirection:"column",gap:16,maxWidth:1e3,margin:"0 auto"},breadcrumb:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:e.textSecondary},breadcrumbModule:{color:e.accent,fontWeight:500},breadcrumbSep:{color:e.textMuted},breadcrumbTitle:{color:e.textPrimary},iframeWrapper:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,overflow:"hidden"},iframe:{width:"100%",border:"none",display:"block",transition:"height 0.2s ease"},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.accent},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}function zN(e){if(!(e!=null&&e.gameType))return e;const t={...e};switch(t.gameType){case"speed-round":!t.rounds&&t.questions&&(t.rounds=t.questions);break;case"bug-hunt":!t.snippets&&t.bugs&&(t.snippets=t.bugs),!t.snippets&&t.code&&(t.snippets=t.code);break;case"classify":!t.categories&&t.buckets&&(t.categories=t.buckets),!t.items&&t.cards&&(t.items=t.cards);break;case"scenario":!t.steps&&t.scenarios&&(t.steps=t.scenarios),!t.steps&&t.story&&(t.steps=t.story),!t.steps&&t.choices&&(t.steps=[{id:"start",situation:t.scenario||t.description||t.title,choices:t.choices}]);break;case"command-sprint":!t.challenges&&t.commands&&(t.challenges=t.commands),!t.challenges&&t.prompts&&(t.challenges=t.prompts),!t.challenges&&t.tasks&&(t.challenges=t.tasks);break;case"memory-match":if(!t.pairs&&t.cards){const r=t.cards;if(r.length>0&&r[0].match!=null){const i=new Map;for(const n of r){const s=n.match??n.id;i.has(s)?i.get(s).push(n):i.set(s,[n])}t.pairs=[...i.values()].filter(n=>n.length>=2).map(n=>({front:n[0].text||n[0].label,back:n[1].text||n[1].label}))}}break}return t}function ON({data:e,sendEvent:t}){const{theme:r}=St(),i=M.useMemo(()=>GN(r),[r]),[n,s]=M.useState(!1),[a,l]=M.useState(null);M.useEffect(()=>{s(!1),l(null)},[e]);const u=M.useCallback(m=>{const y=m.accuracy>=1?3:m.accuracy>=.7?2:m.accuracy>=.4?1:0,x={...m,stars:y};l(x),s(!0),t("event:game-result",x)},[t]),h=M.useCallback(()=>{s(!1),l(null)},[]);if(!e)return g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:"🎮"}),g.jsx("p",{style:i.emptyTitle,children:"Game Mode"}),g.jsx("p",{style:i.emptySubtext,children:"Interactive games will appear here to practice module topics."})]});if(n&&a)return g.jsx(VN,{result:a,gameTitle:e.title,onPlayAgain:h,theme:r,s:i});const d=zN(e),{gameType:p}=d;switch(p){case"speed-round":return g.jsx(FN,{data:d,onEnd:u,theme:r,s:i});case"bug-hunt":return g.jsx(NN,{data:d,onEnd:u,theme:r,s:i});case"classify":return g.jsx(WN,{data:d,onEnd:u,theme:r,s:i});case"scenario":return g.jsx(HN,{data:d,onEnd:u,theme:r,s:i});case"command-sprint":return g.jsx(qN,{data:d,onEnd:u,theme:r,s:i});case"memory-match":return g.jsx(UN,{data:d,onEnd:u,theme:r,s:i});default:return g.jsx("div",{style:i.errorBox,children:g.jsxs("p",{children:["Unknown game type: ",p]})})}}function FN({data:e,onEnd:t,theme:r,s:i}){var Y;const{rounds:n=[],title:s}=e,[a,l]=M.useState(0),[u,h]=M.useState(3),[d,p]=M.useState(0),[m,y]=M.useState(0),[x,v]=M.useState(0),[S,C]=M.useState(((Y=n[0])==null?void 0:Y.timeLimit)||15),[E,L]=M.useState(null),[B,R]=M.useState(null),[k]=M.useState(Date.now()),A=M.useRef(null),O=n[a];M.useEffect(()=>{if(!(!O||u<=0))return C(O.timeLimit||15),L(null),R(null),A.current=setInterval(()=>{C(F=>F<=1?(clearInterval(A.current),0):F-1)},1e3),()=>clearInterval(A.current)},[a,O,u]),M.useEffect(()=>{S===0&&E===null&&O&&V(-1)},[S]);function V(F){if(E!==null)return;L(F),clearInterval(A.current);const z=F===O.answer;R(z?"correct":"wrong");const $=z?m+1:0,j=$>=5?3:$>=3?2:1,W=z?100*j:0,P=z?u:u-1;p(Q=>Q+W),y($),v(Q=>Math.max(Q,$)),h(P),setTimeout(()=>{if(P<=0){const Q=a+(z?1:0);t({gameType:"speed-round",score:d+W,maxScore:n.length*300,accuracy:Q/n.length,timeMs:Date.now()-k,streakMax:Math.max(x,$),correct:Q,total:n.length});return}if(a+1>=n.length){const Q=a+(z?1:0);t({gameType:"speed-round",score:d+W,maxScore:n.length*300,accuracy:Q/n.length,timeMs:Date.now()-k,streakMax:Math.max(x,$),correct:Q,total:n.length});return}l(Q=>Q+1)},800)}if(!O)return null;const q=S/(O.timeLimit||15)*100,H=S>10?r.success:S>5?r.warning:r.error;return g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:s||"Speed Round"}),g.jsxs("span",{style:i.roundCounter,children:[a+1," / ",n.length]})]}),g.jsxs("div",{style:i.statusBar,children:[g.jsx("div",{style:i.livesDisplay,children:Array.from({length:3},(F,z)=>g.jsx("span",{style:{opacity:z<u?1:.2,fontSize:20},children:"❤️"},z))}),m>=3&&g.jsxs("span",{style:i.streakBadge,children:[m>=5?"3x":"2x"," streak!"]}),g.jsxs("span",{style:i.scoreDisplay,children:[d," pts"]})]}),g.jsx("div",{style:i.timerBar,children:g.jsx("div",{style:{...i.timerFill,width:`${q}%`,backgroundColor:H}})}),g.jsx("h2",{style:i.question,children:O.question}),g.jsx("div",{style:i.choiceGrid,children:(O.options||[]).map((F,z)=>{const $=typeof F=="string"?F:F.label,j=E===z,W=z===O.answer,P=E!==null;let Q=r.border,ee=r.bgSecondary;return P&&W?(Q=r.success,ee=`${r.success}18`):P&&j&&!W?(Q=r.error,ee=`${r.error}18`):j&&(Q=r.accent),g.jsxs("button",{onClick:()=>V(z),disabled:E!==null,style:{...i.choiceButton,borderColor:Q,backgroundColor:ee,cursor:E!==null?"default":"pointer",opacity:P&&!j&&!W?.4:1,animation:P&&j&&!W?"shake 0.3s ease":void 0},children:[g.jsx("span",{style:i.choiceLetter,children:String.fromCharCode(65+z)}),g.jsx("span",{style:i.choiceText,children:$})]},z)})})]})}function NN({data:e,onEnd:t,theme:r,s:i}){const{snippets:n=[],title:s}=e,[a,l]=M.useState(0),[u,h]=M.useState(null),[d,p]=M.useState(!1),[m,y]=M.useState(!1),x=M.useRef(0),[v]=M.useState(Date.now()),S=n[a];function C(B){u===null&&(h(B),B===S.bugLine&&(x.current+=1),p(!0))}function E(){const B=x.current;if(a+1>=n.length){t({gameType:"bug-hunt",score:B,maxScore:n.length,accuracy:B/n.length,timeMs:Date.now()-v,streakMax:0,correct:B,total:n.length});return}l(R=>R+1),h(null),p(!1),y(!1)}if(!S||!S.code)return g.jsxs("div",{style:i.errorBox,children:[g.jsx("p",{children:"Bug Hunt: no code snippets provided."}),g.jsx("p",{style:{fontSize:12,color:r.textMuted},children:"Expected: snippets array with code, bugLine, hint"})]});const L=S.code.split(`
|
|
460
|
+
`);return g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:s||"Bug Hunt"}),g.jsxs("span",{style:i.roundCounter,children:[a+1," / ",n.length]})]}),g.jsx("p",{style:i.hint,children:"Find the buggy line. Click to select."}),!m&&u===null&&S.hint&&g.jsx("button",{onClick:()=>y(!0),style:i.hintButton,children:"Show Hint"}),m&&u===null&&g.jsx("div",{style:i.hintBox,children:g.jsx("p",{style:i.hintText,children:S.hint})}),g.jsx("div",{style:i.codeBlock,children:L.map((B,R)=>{const k=R+1,A=u===k,O=k===S.bugLine,V=u!==null;let q="transparent";return V&&O?q=`${r.success}20`:V&&A&&!O&&(q=`${r.error}20`),g.jsxs("div",{onClick:()=>C(k),style:{...i.codeLine,backgroundColor:q,cursor:u!==null?"default":"pointer",borderLeft:A?"3px solid "+(O?r.success:r.error):V&&O?`3px solid ${r.success}`:"3px solid transparent"},children:[g.jsx("span",{style:i.lineNumber,children:k}),g.jsx("span",{style:i.lineContent,children:B||" "})]},R)})}),d&&g.jsxs("div",{style:{...i.explanationBox,borderColor:u===S.bugLine?r.success:r.error},children:[g.jsx("p",{style:i.explanationLabel,children:u===S.bugLine?"Correct!":`Wrong — the bug is on line ${S.bugLine}`}),g.jsx("p",{style:i.explanationText,children:S.explanation}),g.jsx("button",{onClick:E,style:i.nextButton,children:a+1>=n.length?"See Results":"Next Snippet"})]})]})}function WN({data:e,onEnd:t,theme:r,s:i}){const{categories:n=[],items:s=[],title:a}=e,[l]=M.useState(()=>[...s].sort(()=>Math.random()-.5)),[u,h]=M.useState(0),[d,p]=M.useState(3),[m,y]=M.useState(0),[x,v]=M.useState(null),[S]=M.useState(Date.now()),C=l[u];function E(B){if(!C||x)return;const R=C.category===B;v({category:B,correct:R}),R?y(k=>k+1):p(k=>k-1),setTimeout(()=>{if(v(null),(R?d:d-1)<=0||u+1>=l.length){const A=m+(R?1:0);t({gameType:"classify",score:A,maxScore:l.length,accuracy:A/l.length,timeMs:Date.now()-S,streakMax:0,correct:A,total:l.length});return}h(A=>A+1)},600)}if(!C)return g.jsxs("div",{style:i.errorBox,children:[g.jsx("p",{children:"Classify: no items to sort."}),g.jsx("p",{style:{fontSize:12,color:r.textMuted},children:"Expected: categories and items arrays"})]});const L=[r.accent,r.success,r.warning,r.purple];return g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:a||"Classify"}),g.jsxs("span",{style:i.roundCounter,children:[u+1," / ",l.length]})]}),g.jsxs("div",{style:i.statusBar,children:[g.jsx("div",{style:i.livesDisplay,children:Array.from({length:3},(B,R)=>g.jsx("span",{style:{opacity:R<d?1:.2,fontSize:20},children:"❤️"},R))}),g.jsxs("span",{style:i.scoreDisplay,children:[m," / ",l.length]})]}),g.jsx("div",{style:i.bucketsRow,children:n.map((B,R)=>{const k=typeof B=="string"?B:B.name,A=typeof B=="object"&&B.color||L[R%L.length],O=x&&x.category===k,V=O?x.correct?`${r.success}30`:`${r.error}30`:`${A}10`;return g.jsx("button",{onClick:()=>E(k),style:{...i.bucket,borderColor:A,backgroundColor:V,transform:O&&!x.correct?"translateX(4px)":"none",transition:"all 0.2s ease"},children:g.jsx("span",{style:{color:A,fontWeight:700,fontSize:14},children:k})},k)})}),g.jsx("div",{style:i.itemCard,children:g.jsx("p",{style:i.itemText,children:C.text})})]})}function HN({data:e,onEnd:t,theme:r,s:i}){var k;const{steps:n=[],title:s,startHealth:a=5}=e,[l,u]=M.useState(((k=n[0])==null?void 0:k.id)||0),[h,d]=M.useState(a),[p,m]=M.useState(null),[y,x]=M.useState(0),[v,S]=M.useState(0),[C]=M.useState(Date.now()),E=n.find(A=>A.id===l)||n[y];function L(A,O){if(p!==null)return;m(O);const V=Math.max(0,h+(A.health||0));d(V),A.health>=0&&S(q=>q+1),setTimeout(()=>{if(V<=0||!A.next||A.next==="end"){const q=y+1;t({gameType:"scenario",score:v+(A.health>=0?1:0),maxScore:q,accuracy:(v+(A.health>=0?1:0))/q,timeMs:Date.now()-C,streakMax:0,correct:v+(A.health>=0?1:0),total:q,healthRemaining:V});return}u(A.next),x(q=>q+1),m(null)},1800)}if(!E)return g.jsxs("div",{style:i.errorBox,children:[g.jsx("p",{children:"Scenario game: no steps data provided."}),g.jsx("p",{style:{fontSize:12,color:r.textMuted},children:"Expected: steps array with id, situation, choices"})]});const B=h/a*100,R=B>60?r.success:B>30?r.warning:r.error;return g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:s||"Scenario"}),g.jsxs("span",{style:i.roundCounter,children:["Step ",y+1]})]}),g.jsx("div",{style:i.healthBarOuter,children:g.jsx("div",{style:{...i.healthBarInner,width:`${B}%`,backgroundColor:R}})}),g.jsxs("div",{style:{textAlign:"right",fontSize:12,color:r.textSecondary,marginBottom:16},children:["Health: ",h," / ",a]}),g.jsx("div",{style:i.scenarioPanel,children:g.jsx("p",{style:i.situationText,children:E.situation})}),g.jsx("div",{style:i.choiceGrid,children:(E.choices||[]).map((A,O)=>{const V=p===O;return g.jsxs("div",{children:[g.jsx("button",{onClick:()=>L(A,O),disabled:p!==null,style:{...i.scenarioChoice,borderColor:V?r.accent:r.border,backgroundColor:V?`${r.accent}18`:r.bgSecondary,cursor:p!==null?"default":"pointer",opacity:p!==null&&!V?.4:1},children:A.text}),V&&g.jsxs("div",{style:{...i.consequenceBox,borderColor:A.health>=0?r.success:r.error},children:[g.jsx("p",{style:i.consequenceText,children:A.consequence}),A.health!==0&&g.jsxs("span",{style:{color:A.health>0?r.success:r.error,fontWeight:700,fontSize:13},children:[A.health>0?"+":"",A.health," health"]})]})]},O)})})]})}function qN({data:e,onEnd:t,theme:r,s:i}){var R;const{challenges:n=[],title:s}=e,[a,l]=M.useState(0),[u,h]=M.useState(""),[d,p]=M.useState(null),[m,y]=M.useState(0),[x]=M.useState(Date.now()),[v,S]=M.useState(((R=n[0])==null?void 0:R.timeLimit)||30),C=M.useRef(null),E=M.useRef(null),L=n[a];M.useEffect(()=>(h(""),p(null),S((L==null?void 0:L.timeLimit)||30),C.current&&C.current.focus(),E.current=setInterval(()=>{S(k=>k<=1?(clearInterval(E.current),0):k-1)},1e3),()=>clearInterval(E.current)),[a]),M.useEffect(()=>{v===0&&d===null&&L&&(clearInterval(E.current),p("wrong"),setTimeout(()=>{if(a+1>=n.length){t({gameType:"command-sprint",score:m,maxScore:n.length,accuracy:m/n.length,timeMs:Date.now()-x,streakMax:0,correct:m,total:n.length});return}l(k=>k+1)},1e3))},[v]);function B(k){if(k.preventDefault(),d!==null||!L)return;clearInterval(E.current);const A=u.trim(),V=[L.answer,...L.alternates||[]].some(q=>q.toLowerCase()===A.toLowerCase());p(V?"correct":"wrong"),V&&y(q=>q+1),setTimeout(()=>{if(a+1>=n.length){const q=m+(V?1:0);t({gameType:"command-sprint",score:q,maxScore:n.length,accuracy:q/n.length,timeMs:Date.now()-x,streakMax:0,correct:q,total:n.length});return}l(q=>q+1)},1e3)}return L?g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:s||"Command Sprint"}),g.jsxs("span",{style:i.roundCounter,children:[a+1," / ",n.length]})]}),g.jsx("div",{style:i.timerBar,children:g.jsx("div",{style:{...i.timerFill,width:`${v/(L.timeLimit||30)*100}%`,backgroundColor:v>10?r.success:v>5?r.warning:r.error}})}),g.jsx("div",{style:i.sprintPrompt,children:g.jsx("p",{style:i.sprintTask,children:L.prompt})}),g.jsxs("form",{onSubmit:B,style:i.sprintForm,children:[g.jsxs("div",{style:{...i.sprintInputWrapper,borderColor:d==="correct"?r.success:d==="wrong"?r.error:r.accent},children:[g.jsx("span",{style:i.sprintCaret,children:">"}),g.jsx("input",{ref:C,type:"text",value:u,onChange:k=>h(k.target.value),disabled:d!==null,placeholder:"Type your command...",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,style:i.sprintInput})]}),d===null&&g.jsx("button",{type:"submit",style:i.submitButton,children:"Submit"})]}),d==="wrong"&&g.jsxs("div",{style:i.sprintAnswer,children:[g.jsx("span",{style:{color:r.error},children:"Expected: "}),g.jsx("code",{style:i.sprintCode,children:L.answer})]}),d==="correct"&&g.jsx("div",{style:{...i.sprintAnswer,borderColor:r.success},children:g.jsx("span",{style:{color:r.success},children:"Correct!"})})]}):g.jsxs("div",{style:i.errorBox,children:[g.jsx("p",{children:"Command Sprint: no challenges data provided."}),g.jsx("p",{style:{fontSize:12,color:r.textMuted},children:"Expected: challenges array with prompt, answer, timeLimit"})]})}function UN({data:e,onEnd:t,theme:r,s:i}){const{pairs:n=[],title:s}=e,[a,l]=M.useState([]),[u,h]=M.useState([]),[d,p]=M.useState(new Set),[m,y]=M.useState(0),[x]=M.useState(Date.now()),v=M.useRef(!1);M.useEffect(()=>{const E=[];n.forEach((L,B)=>{E.push({id:`t-${B}`,pairId:B,text:L.term,side:"term"}),E.push({id:`d-${B}`,pairId:B,text:L.definition,side:"def"})});for(let L=E.length-1;L>0;L--){const B=Math.floor(Math.random()*(L+1));[E[L],E[B]]=[E[B],E[L]]}l(E),h([]),p(new Set),y(0)},[n]);function S(E){if(v.current||u.includes(E)||d.has(a[E].pairId))return;const L=[...u,E];if(h(L),L.length===2){y(k=>k+1),v.current=!0;const[B,R]=L;if(a[B].pairId===a[R].pairId){const k=new Set(d);k.add(a[B].pairId),setTimeout(()=>{if(p(k),h([]),v.current=!1,k.size===n.length){const A=m+1,O=n.length;t({gameType:"memory-match",score:Math.max(0,O*2-A),maxScore:O,accuracy:Math.min(1,O/A),timeMs:Date.now()-x,streakMax:0,correct:k.size,total:n.length,moves:A})}},500)}else setTimeout(()=>{h([]),v.current=!1},800)}}const C=a.length<=12?4:6;return g.jsxs("div",{style:i.gameContainer,children:[g.jsxs("div",{style:i.gameHeader,children:[g.jsx("span",{style:i.gameTitle,children:s||"Memory Match"}),g.jsxs("span",{style:i.roundCounter,children:["Moves: ",m]})]}),g.jsx("p",{style:i.hint,children:"Flip cards to find matching term-definition pairs"}),g.jsx("div",{style:{...i.cardGrid,gridTemplateColumns:`repeat(${C}, 1fr)`},children:a.map((E,L)=>{const B=u.includes(L),R=d.has(E.pairId),k=B||R;return g.jsx("button",{onClick:()=>S(L),disabled:R,style:{...i.memoryCard,backgroundColor:R?`${r.success}15`:k?r.bgSecondary:r.bgTertiary,borderColor:R?r.success:k?r.accent:r.border,cursor:R?"default":"pointer",transform:"rotateY(0deg)"},children:k?g.jsx("span",{style:{...i.cardText,color:E.side==="term"?r.accent:r.textPrimary,fontSize:E.text.length>30?11:13},children:E.text}):g.jsx("span",{style:i.cardBack,children:"?"})},E.id)})}),g.jsxs("div",{style:{textAlign:"center",marginTop:16,fontSize:13,color:r.textSecondary},children:[d.size," / ",n.length," pairs found"]})]})}function VN({result:e,gameTitle:t,onPlayAgain:r,theme:i,s:n}){const{score:s=0,maxScore:a=1,accuracy:l=0,timeMs:u=0,streakMax:h=0,stars:d=0,correct:p=0,total:m=0,moves:y}=e,x=Math.round(u/1e3),v=Math.floor(x/60),S=x%60,C=v>0?`${v}m ${S}s`:`${S}s`,E=Math.round(l*100),L=Array.from({length:3},(B,R)=>R<d?"⭐":"☆").join(" ");return g.jsx("div",{style:n.gameContainer,children:g.jsxs("div",{style:n.resultsCard,children:[g.jsx("h2",{style:n.resultsTitle,children:t||"Game Complete"}),g.jsx("div",{style:n.starsRow,children:L}),g.jsxs("div",{style:n.resultsGrid,children:[g.jsxs("div",{style:n.resultStat,children:[g.jsxs("span",{style:n.resultValue,children:[E,"%"]}),g.jsx("span",{style:n.resultLabel,children:"Accuracy"})]}),g.jsxs("div",{style:n.resultStat,children:[g.jsxs("span",{style:n.resultValue,children:[p,"/",m]}),g.jsx("span",{style:n.resultLabel,children:"Correct"})]}),g.jsxs("div",{style:n.resultStat,children:[g.jsx("span",{style:n.resultValue,children:C}),g.jsx("span",{style:n.resultLabel,children:"Time"})]}),h>0&&g.jsxs("div",{style:n.resultStat,children:[g.jsx("span",{style:n.resultValue,children:h}),g.jsx("span",{style:n.resultLabel,children:"Best Streak"})]}),y!==void 0&&g.jsxs("div",{style:n.resultStat,children:[g.jsx("span",{style:n.resultValue,children:y}),g.jsx("span",{style:n.resultLabel,children:"Moves"})]})]}),g.jsxs("div",{style:n.xpEarned,children:["+",d===3?40:25," XP"]}),g.jsx("button",{onClick:r,style:n.playAgainButton,children:"Play Again"})]})})}function GN(e){return{gameContainer:{maxWidth:700,margin:"0 auto",display:"flex",flexDirection:"column",gap:16},gameHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},gameTitle:{fontSize:20,fontWeight:700,color:e.textBright},roundCounter:{fontSize:14,color:e.textSecondary,padding:"4px 10px",backgroundColor:e.bgTertiary,borderRadius:6},statusBar:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},livesDisplay:{display:"flex",gap:4},streakBadge:{fontSize:13,fontWeight:700,color:e.warning,padding:"2px 8px",backgroundColor:`${e.warning}18`,borderRadius:4},scoreDisplay:{fontSize:16,fontWeight:700,color:e.accent},timerBar:{height:4,backgroundColor:e.bgTertiary,borderRadius:2,overflow:"hidden"},timerFill:{height:"100%",borderRadius:2,transition:"width 1s linear, background-color 0.3s ease"},question:{fontSize:20,fontWeight:700,color:e.textBright,margin:0,lineHeight:1.4},hint:{fontSize:13,color:e.textSecondary,margin:0},choiceGrid:{display:"flex",flexDirection:"column",gap:10},choiceButton:{display:"flex",alignItems:"center",gap:14,padding:"14px 18px",border:"1px solid",borderRadius:10,textAlign:"left",transition:"border-color 0.15s ease, background-color 0.15s ease, opacity 0.3s ease",width:"100%",fontSize:14,color:e.textPrimary,fontFamily:"inherit",cursor:"pointer"},choiceLetter:{width:28,height:28,borderRadius:"50%",backgroundColor:e.bgTertiary,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:e.textSecondary,flexShrink:0},choiceText:{flex:1},submitButton:{alignSelf:"center",padding:"10px 28px",fontSize:14,fontWeight:600,color:"#ffffff",backgroundColor:e.success,border:`1px solid ${e.success}`,borderRadius:8,cursor:"pointer"},nextButton:{padding:"8px 20px",fontSize:13,fontWeight:600,color:"#ffffff",backgroundColor:e.success,border:`1px solid ${e.success}`,borderRadius:6,cursor:"pointer",marginTop:8},errorBox:{textAlign:"center",padding:40,color:e.error,fontSize:16},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0},hintButton:{alignSelf:"flex-start",padding:"6px 14px",fontSize:13,fontWeight:600,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}`,borderRadius:6,cursor:"pointer",fontFamily:"inherit"},hintBox:{padding:"12px 16px",border:`1px solid ${e.warning}`,borderRadius:8,backgroundColor:`${e.warning}10`},hintText:{color:e.warning,fontSize:14,margin:0,lineHeight:1.5},codeBlock:{backgroundColor:e.bgPrimary,border:`1px solid ${e.border}`,borderRadius:10,overflow:"hidden",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:14,lineHeight:1.6},codeLine:{display:"flex",alignItems:"flex-start",padding:"2px 12px 2px 0",transition:"background-color 0.15s ease"},lineNumber:{width:40,textAlign:"right",paddingRight:12,color:e.textMuted,userSelect:"none",flexShrink:0},lineContent:{color:e.textPrimary,whiteSpace:"pre"},explanationBox:{padding:"16px 20px",border:"1px solid",borderRadius:8,backgroundColor:e.bgSecondary},explanationLabel:{fontSize:15,fontWeight:700,color:e.textBright,margin:"0 0 8px 0"},explanationText:{fontSize:14,color:e.textSecondary,margin:0,lineHeight:1.5},bucketsRow:{display:"flex",gap:10,justifyContent:"center",flexWrap:"wrap"},bucket:{flex:"1 1 120px",maxWidth:200,padding:"16px 12px",border:"2px solid",borderRadius:10,backgroundColor:"transparent",cursor:"pointer",textAlign:"center",fontFamily:"inherit",transition:"all 0.2s ease"},itemCard:{padding:"24px 20px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,textAlign:"center"},itemText:{fontSize:16,color:e.textBright,margin:0,lineHeight:1.5},healthBarOuter:{height:8,backgroundColor:e.bgTertiary,borderRadius:4,overflow:"hidden"},healthBarInner:{height:"100%",borderRadius:4,transition:"width 0.5s ease, background-color 0.3s ease"},scenarioPanel:{padding:"24px 20px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10},situationText:{fontSize:16,color:e.textBright,margin:0,lineHeight:1.6},scenarioChoice:{display:"block",width:"100%",padding:"14px 18px",border:"1px solid",borderRadius:10,fontSize:14,color:e.textPrimary,fontFamily:"inherit",textAlign:"left",transition:"border-color 0.15s ease, background-color 0.15s ease, opacity 0.3s ease"},consequenceBox:{margin:"8px 0 0 16px",padding:"12px 16px",border:"1px solid",borderRadius:8,backgroundColor:e.bgPrimary},consequenceText:{fontSize:14,color:e.textPrimary,margin:0,lineHeight:1.5},sprintPrompt:{padding:"20px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,textAlign:"center"},sprintTask:{fontSize:18,fontWeight:600,color:e.textBright,margin:0,lineHeight:1.4},sprintForm:{display:"flex",flexDirection:"column",gap:12,alignItems:"center"},sprintInputWrapper:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"12px 16px",backgroundColor:e.bgPrimary,border:"2px solid",borderRadius:8,transition:"border-color 0.2s ease"},sprintCaret:{color:e.success,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontWeight:700,fontSize:16,flexShrink:0},sprintInput:{flex:1,background:"none",border:"none",outline:"none",color:e.textPrimary,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',fontSize:15},sprintAnswer:{padding:"12px 16px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:8,fontSize:14,textAlign:"center"},sprintCode:{fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',color:e.accent},cardGrid:{display:"grid",gap:10,justifyContent:"center"},memoryCard:{aspectRatio:"1 / 1",minHeight:80,display:"flex",alignItems:"center",justifyContent:"center",padding:8,border:"2px solid",borderRadius:10,fontFamily:"inherit",transition:"all 0.2s ease",cursor:"pointer"},cardText:{textAlign:"center",lineHeight:1.3,wordBreak:"break-word"},cardBack:{fontSize:24,fontWeight:700,color:e.textMuted},resultsCard:{maxWidth:500,margin:"40px auto 0",padding:"40px 32px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:16,textAlign:"center",display:"flex",flexDirection:"column",gap:20},resultsTitle:{fontSize:24,fontWeight:700,color:e.textBright,margin:0},starsRow:{fontSize:32,letterSpacing:8},resultsGrid:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:24},resultStat:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},resultValue:{fontSize:28,fontWeight:700,color:e.accent},resultLabel:{fontSize:12,color:e.textSecondary,textTransform:"uppercase",letterSpacing:1},xpEarned:{fontSize:20,fontWeight:700,color:e.success,padding:"8px 16px",backgroundColor:`${e.success}15`,borderRadius:8,alignSelf:"center"},playAgainButton:{padding:"12px 32px",fontSize:15,fontWeight:600,color:"#ffffff",backgroundColor:e.success,border:`1px solid ${e.success}`,borderRadius:8,cursor:"pointer",alignSelf:"center"}}}const YN=[{id:"home",label:"Home",icon:"🏠"},{id:"modules",label:"Modules",icon:"📚"},{id:"journeys",label:"Journeys",icon:"🗺"},{id:"achievements",label:"Achievements",icon:"🏆"},{id:"about",label:"About",icon:"ℹ"},{id:"playground",label:"Playground",icon:"🧪"},{id:"settings",label:"Settings",icon:"⚙"}];function KN({activeNav:e,onNavClick:t,belt:r,xp:i,streak:n,onNewChat:s}){const{theme:a}=St(),l=M.useMemo(()=>XN(a),[a]);return g.jsxs("nav",{style:l.nav,children:[g.jsxs("div",{style:l.left,children:[g.jsx("span",{style:l.logo,children:"⬡ Socrates"}),g.jsx("div",{style:l.navItems,children:YN.map(u=>g.jsxs("button",{style:e===u.id?l.navItemActive:l.navItem,onClick:()=>t(u.id),children:[u.icon," ",u.label]},u.id))})]}),g.jsxs("div",{style:l.right,children:[r&&g.jsxs("div",{style:{...l.beltBadge,background:`linear-gradient(135deg, ${r.color}22, ${r.color}11)`,border:`1px solid ${r.color}44`},children:[g.jsx("span",{children:r.badge}),g.jsxs("span",{style:{color:r.color,fontWeight:600},children:[r.name," Belt"]}),g.jsx("span",{style:{color:a.textSecondary},children:"·"}),g.jsxs("span",{style:{color:a.textPrimary},children:[i," XP"]})]}),n>0&&g.jsxs("div",{style:l.streakBadge,children:[g.jsx("span",{children:"🔥"}),g.jsx("span",{style:{color:a.orange,fontWeight:600},children:n})]})]})]})}function XN(e){return{nav:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",height:48,backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexShrink:0},left:{display:"flex",alignItems:"center",gap:16},logo:{fontSize:14,fontWeight:800,color:e.accent,letterSpacing:"-0.5px"},navItems:{display:"flex",gap:2,marginLeft:8},navItem:{padding:"4px 10px",fontSize:11,color:e.textSecondary,backgroundColor:"transparent",border:"none",borderRadius:6,cursor:"pointer",fontFamily:"inherit"},navItemActive:{padding:"4px 10px",fontSize:11,color:e.textPrimary,backgroundColor:e.bgTertiary,border:"none",borderRadius:6,cursor:"pointer",fontFamily:"inherit"},right:{display:"flex",alignItems:"center",gap:8},beltBadge:{display:"flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:16,fontSize:10},streakBadge:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:16,fontSize:11,background:`${e.orange}22`,border:`1px solid ${e.orange}44`}}}function QN({onClick:e}){const{theme:t}=St(),r=M.useMemo(()=>ZN(t),[t]);return g.jsx("button",{style:r.bubble,onClick:e,title:"Open chat",children:g.jsx("span",{style:r.icon,children:"💬"})})}function ZN(e){return{bubble:{position:"fixed",bottom:16,right:16,width:44,height:44,borderRadius:"50%",background:`linear-gradient(135deg, ${e.userBubble}, ${e.accent})`,border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:`0 2px 12px ${e.accent}33`,zIndex:100,transition:"transform 0.15s ease"},icon:{fontSize:18,lineHeight:1}}}const JN="canvas:diagram",eW="canvas:quiz",tW="canvas:code",rW="canvas:dashboard",iW="canvas:html",nW="canvas:celebrate",sW="canvas:terminal",oW="canvas:game",aW="canvas:settings",lW="canvas:workshop",cW="canvas:workshop-update",hW="canvas:code-result",uW="canvas:journey-browser",dW="canvas:journey-map",fW="canvas:web-embed",pW="canvas:slides",gW="event:quiz-answer",mW="event:code-run",yW="event:click",_W="event:drag-complete",xW="event:terminal-command",vW="event:game-result",bW="event:pty-output",SW="event:file-save",wW="event:workshop-done",CW="event:terminal-share",kW="event:slide-change",TW="capture:text",EW="capture:page",BW="context:topic",MW="context:match",LW="chat:send",RW="chat:assistant",AW="chat:stream",DW="chat:tool-use",PW="chat:tool-result",IW="chat:status",$W="chat:stop",jW="chat:suggestions",zW="session:list",OW="session:update",FW="sys:connect",NW="sys:disconnect",WW="sys:tier-change",HW="sys:heartbeat",qW={canvas:[JN,eW,tW,rW,iW,nW,sW,oW,aW,lW,cW,hW,uW,dW,fW,pW],event:[gW,mW,yW,_W,xW,vW,bW,SW,wW,CW,kW],capture:[TW,EW],context:[BW,MW],chat:[LW,RW,AW,DW,PW,IW,$W,jW],session:[zW,OW],system:[FW,NW,WW,HW]};new Set(Object.values(qW).flat());const du={LEARNING:"learning",QUIZZES_GAMES:"quizzes-games",STREAKS:"streaks",BELTS:"belts"},vg=[{id:"first-steps",icon:"🌱",name:"First Steps",description:"Complete your first module",category:"learning",criteria:{type:"modules-completed",target:1}},{id:"bookworm",icon:"📚",name:"Bookworm",description:"Complete 5 modules",category:"learning",criteria:{type:"modules-completed",target:5}},{id:"scholar",icon:"🎓",name:"Scholar",description:"Complete 20 modules",category:"learning",criteria:{type:"modules-completed",target:20}},{id:"encyclopedist",icon:"🏛",name:"Encyclopedist",description:"Complete all modules",category:"learning",criteria:{type:"modules-completed-all"}},{id:"deep-diver",icon:"🧠",name:"Deep Diver",description:"Complete 3 advanced modules",category:"learning",criteria:{type:"advanced-completed",target:3}},{id:"author",icon:"✍️",name:"Author",description:"Create a custom module",category:"learning",criteria:{type:"modules-authored",target:1}},{id:"speed-demon",icon:"⚡",name:"Speed Demon",description:"5 quizzes under 10s each",category:"quizzes-games",criteria:{type:"fast-quizzes",target:5}},{id:"perfect-score",icon:"🎯",name:"Perfect Score",description:"100% on any quiz",category:"quizzes-games",criteria:{type:"quiz-perfect",target:1}},{id:"bug-squasher",icon:"🐛",name:"Bug Squasher",description:"Win 10 Bug Hunt games",category:"quizzes-games",criteria:{type:"bug-hunt-wins",target:10}},{id:"memory-master",icon:"🧩",name:"Memory Master",description:"Perfect memory match 5 times",category:"quizzes-games",criteria:{type:"memory-perfect",target:5}},{id:"command-racer",icon:"🏘",name:"Command Racer",description:"100% on Command Sprint",category:"quizzes-games",criteria:{type:"command-sprint-perfect",target:1}},{id:"game-night",icon:"🎲",name:"Game Night",description:"Play all 6 game types",category:"quizzes-games",criteria:{type:"game-types-played",target:6}},{id:"streak-breaker",icon:"🔥",name:"Streak Breaker",description:"5x streak multiplier in Speed Round",category:"quizzes-games",criteria:{type:"speed-streak",target:5}},{id:"triple-crown",icon:"👑",name:"Triple Crown",description:"3 stars on 10 different games",category:"quizzes-games",criteria:{type:"three-star-games",target:10}},{id:"on-fire",icon:"🔥",name:"On Fire",description:"5-day learning streak",category:"streaks",criteria:{type:"streak-days",target:5}},{id:"marathon",icon:"🏃",name:"Marathon",description:"30-day learning streak",category:"streaks",criteria:{type:"streak-days",target:30}},{id:"night-owl",icon:"🦉",name:"Night Owl",description:"Study after midnight",category:"streaks",criteria:{type:"time-of-day",target:"night"},rare:!0},{id:"early-bird",icon:"☀️",name:"Early Bird",description:"Study before 7am",category:"streaks",criteria:{type:"time-of-day",target:"morning"},rare:!0},{id:"consistent",icon:"📅",name:"Consistent",description:"Learn something every day for a week",category:"streaks",criteria:{type:"streak-days",target:7}},{id:"belt-white",icon:"⚪",name:"White Belt",description:"Earn the White Belt",category:"belts",criteria:{type:"belt-earned",target:"White"}},{id:"belt-yellow",icon:"🟡",name:"Yellow Belt",description:"Earn the Yellow Belt",category:"belts",criteria:{type:"belt-earned",target:"Yellow"}},{id:"belt-green",icon:"🟢",name:"Green Belt",description:"Earn the Green Belt",category:"belts",criteria:{type:"belt-earned",target:"Green"}},{id:"belt-blue",icon:"🔵",name:"Blue Belt",description:"Earn the Blue Belt",category:"belts",criteria:{type:"belt-earned",target:"Blue"}},{id:"belt-purple",icon:"🟣",name:"Purple Belt",description:"Earn the Purple Belt",category:"belts",criteria:{type:"belt-earned",target:"Purple"}},{id:"belt-brown",icon:"🟤",name:"Brown Belt",description:"Earn the Brown Belt",category:"belts",criteria:{type:"belt-earned",target:"Brown"}},{id:"belt-black",icon:"⚫",name:"Black Belt",description:"Earn the Black Belt",category:"belts",criteria:{type:"belt-earned",target:"Black"}},{id:"pathfinder",icon:"🧭",name:"Pathfinder",description:"Start your first learning journey",category:"journeys",criteria:{type:"journeys-started",target:1}},{id:"stage-clear",icon:"🏁",name:"Stage Clear",description:"Complete a journey stage",category:"journeys",criteria:{type:"journey-stages-completed",target:1}},{id:"journey-complete",icon:"🏆",name:"Journey Complete",description:"Complete an entire learning journey",category:"journeys",criteria:{type:"journeys-completed",target:1}},{id:"multi-path",icon:"🛤",name:"Multi-Path",description:"Complete 3 different journeys",category:"journeys",criteria:{type:"journeys-completed",target:3}}],UW=[{id:"claude-haiku-4-5",label:"Haiku",description:"Fastest responses, lower cost"},{id:"claude-sonnet-4-6",label:"Sonnet",description:"Balanced speed and quality"},{id:"claude-opus-4-6",label:"Opus",description:"Most capable, best for complex tasks"}],VW="claude-sonnet-4-6",GW=50,eb=[{key:du.LEARNING,label:"Learning Milestones",icon:"📖"},{key:du.QUIZZES_GAMES,label:"Quizzes & Games",icon:"🎮"},{key:du.STREAKS,label:"Streaks & Dedication",icon:"🔥"},{key:du.BELTS,label:"Belt Milestones",icon:"🥋"}];function YW(e,t){switch(e){case"learning":return t.success;case"quizzes-games":return t.accent;case"streaks":return t.orange;case"belts":return t.purple;default:return t.accent}}function KW({data:e}){var d;const{theme:t}=St(),r=M.useMemo(()=>XW(t),[t]),i=(e==null?void 0:e.achievements)||{unlocked:[],near:[]},n=M.useMemo(()=>{const p=new Map;for(const m of i.unlocked||[])p.set(m.id,m);return p},[i.unlocked]),s=M.useMemo(()=>{const p=new Map;for(const m of i.near||[])p.set(m.id,m);return p},[i.near]),a=((d=i.unlocked)==null?void 0:d.length)||0,l=vg.length-a,u=vg.filter(p=>p.rare&&n.has(p.id)).length,h=M.useMemo(()=>{const p={};for(const m of eb)p[m.key]=[];for(const m of vg)p[m.category]&&p[m.category].push(m);return p},[]);return g.jsxs("div",{style:r.container,children:[g.jsxs("div",{style:r.statsBar,children:[g.jsxs("div",{style:{...r.statCard,border:`1px solid ${t.warning}44`},children:[g.jsx("span",{style:{fontSize:24},children:"🏆"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:22,fontWeight:700,color:t.warning},children:a}),g.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:"Unlocked"})]})]}),g.jsxs("div",{style:{...r.statCard,border:`1px solid ${t.border}`},children:[g.jsx("span",{style:{fontSize:24},children:"🔒"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:22,fontWeight:700,color:t.textSecondary},children:l}),g.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:"Locked"})]})]}),g.jsxs("div",{style:{...r.statCard,border:`1px solid ${t.purple}44`},children:[g.jsx("span",{style:{fontSize:24},children:"✨"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:22,fontWeight:700,color:t.purple},children:u}),g.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:"Rare"})]})]})]}),eb.map(p=>{const m=h[p.key]||[],y=YW(p.key,t);return g.jsxs("div",{style:r.categorySection,children:[g.jsxs("div",{style:r.categoryHeader,children:[g.jsx("span",{children:p.icon}),g.jsx("h3",{style:r.categoryTitle,children:p.label}),g.jsxs("span",{style:{fontSize:11,color:t.textMuted,marginLeft:"auto"},children:[m.filter(x=>n.has(x.id)).length,"/",m.length]})]}),g.jsx("div",{style:r.badgeGrid,children:m.map(x=>{const v=n.get(x.id),S=s.get(x.id),C=!!v,E=!C&&!!S;return g.jsxs("div",{style:{...r.badge,background:C?`linear-gradient(135deg, ${y}22, ${y}11)`:t.bgSecondary,border:C?`1px solid ${y}44`:`1px solid ${t.border}`,boxShadow:C?`0 0 12px ${y}15`:"none"},children:[x.rare&&g.jsx("span",{style:{position:"absolute",top:6,right:6,fontSize:8,fontWeight:700,color:t.purple,backgroundColor:`${t.purple}22`,padding:"1px 4px",borderRadius:3},children:"RARE"}),C&&v.isNew&&g.jsx("span",{style:{position:"absolute",top:6,left:6,fontSize:8,fontWeight:700,color:t.warning,backgroundColor:`${t.warning}22`,padding:"1px 4px",borderRadius:3},children:"NEW"}),g.jsx("span",{style:{fontSize:32,filter:C?"none":"grayscale(100%)",opacity:C?1:.4},children:x.icon}),g.jsx("span",{style:{fontSize:12,fontWeight:600,color:C?t.textPrimary:t.textSecondary},children:x.name}),g.jsx("span",{style:{fontSize:10,color:t.textMuted,textAlign:"center",lineHeight:1.3},children:x.description}),C&&v.date&&g.jsx("span",{style:{fontSize:9,color:t.textMuted},children:v.date}),!C&&g.jsx("span",{style:{fontSize:9,color:t.textMuted},children:"???"}),E&&S.current!==void 0&&g.jsxs("div",{style:{width:"80%",marginTop:2},children:[g.jsx("div",{style:{height:3,backgroundColor:t.bgTertiary,borderRadius:2,overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",width:`${Math.min(100,S.current/S.target*100)}%`,backgroundColor:y,borderRadius:2}})}),g.jsxs("span",{style:{fontSize:9,color:t.textMuted},children:[S.current,"/",S.target]})]})]},x.id)})})]},p.key)})]})}function XW(e){return{container:{maxWidth:900,margin:"0 auto",display:"flex",flexDirection:"column",gap:28},statsBar:{display:"flex",gap:12,flexWrap:"wrap"},statCard:{flex:"1 1 140px",display:"flex",alignItems:"center",gap:12,padding:"16px 20px",backgroundColor:e.bgSecondary,borderRadius:12},categorySection:{display:"flex",flexDirection:"column",gap:12},categoryHeader:{display:"flex",alignItems:"center",gap:8},categoryTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:0},badgeGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(130px, 1fr))",gap:10},badge:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,padding:"16px 10px",borderRadius:12,textAlign:"center",position:"relative",transition:"transform 0.15s ease",cursor:"default"}}}const QW=["All","Developer","Leadership","AI","Product","Testing","General"],ZW={developer:["developer-skills","fundamentals","frameworks","languages","claude-code","data"],leadership:["leadership"],ai:["ai-and-llm"],product:["product-management","project-management","ux-design"],testing:["quality-assurance"],general:["general","architecture"]};function JW({data:e,onStartLearning:t,onSelectModule:r}){var R;const{theme:i}=St(),n=M.useMemo(()=>eH(i),[i]),[s,a]=M.useState([]),[l,u]=M.useState(""),[h,d]=M.useState("All"),[p,m]=M.useState(null),y=((R=e==null?void 0:e.progress)==null?void 0:R.modules)||[];M.useEffect(()=>{fetch("http://localhost:3456/api/modules").then(k=>k.ok?k.json():[]).then(k=>{const A=Array.isArray(k)?k:k.modules||[];a(A)}).catch(()=>a([]))},[]);const x=M.useMemo(()=>{const k=new Map;for(const A of y)k.set(A.slug,A);return s.map(A=>({...A,...k.get(A.slug)||{}}))},[s,y]),v=M.useMemo(()=>{let k=x;if(l.trim()){const A=l.toLowerCase();k=k.filter(O=>(O.title||"").toLowerCase().includes(A)||(O.description||"").toLowerCase().includes(A)||(O.slug||"").toLowerCase().includes(A))}if(h!=="All"){const A=h.toLowerCase(),O=ZW[A];O?k=k.filter(V=>O.includes((V.category||"general").toLowerCase())):k=k.filter(V=>(V.category||"general").toLowerCase()===A)}return k},[x,l,h]),S=v.filter(k=>k.status&&k.status!=="completed"),C=v.filter(k=>k.status==="completed"),E=v,L=k=>{switch((k||"").toLowerCase()){case"beginner":return i.success;case"intermediate":return i.warning;case"advanced":return i.error;default:return i.textMuted}},B=(k,A)=>{const O=p===k.slug;return g.jsxs("div",{style:{...n.card,borderColor:A||i.border,transform:O?"translateY(-2px)":"none",boxShadow:O?`0 6px 20px ${i.bgPrimary}80`:"none",cursor:"pointer"},onClick:()=>r?r(k):null,onMouseEnter:()=>m(k.slug),onMouseLeave:()=>m(null),children:[g.jsxs("div",{style:n.cardHeader,children:[g.jsx("span",{style:n.cardIcon,children:k.icon||"📘"}),g.jsxs("div",{style:n.cardTitleWrap,children:[g.jsx("h4",{style:n.cardTitle,children:k.title||k.slug}),k.category&&g.jsx("span",{style:n.categoryBadge,children:k.category})]})]}),k.description&&g.jsx("p",{style:n.cardDescription,children:k.description}),g.jsxs("div",{style:n.cardFooter,children:[k.difficulty&&g.jsx("span",{style:{...n.difficultyBadge,color:L(k.difficulty),backgroundColor:`${L(k.difficulty)}18`},children:k.difficulty}),k.status==="completed"&&g.jsxs("span",{style:n.completedBadge,children:["✓"," Done"]}),k.status&&k.status!=="completed"&&k.walkthroughStep!=null&&g.jsxs("span",{style:n.progressBadge,children:["Step ",k.walkthroughStep,"/",k.totalSteps||"?"]}),k.xpEarned>0&&g.jsxs("span",{style:n.xpBadge,children:[k.xpEarned," XP"]}),t&&g.jsx("button",{style:n.startButton,onClick:V=>{V.stopPropagation(),t(k.slug)},children:k.status==="completed"?"Review":k.status?"Continue":"Start Learning"})]})]},k.slug)};return g.jsxs("div",{style:n.container,children:[g.jsxs("div",{style:n.toolbar,children:[g.jsx("input",{type:"text",placeholder:"Search modules...",value:l,onChange:k=>u(k.target.value),style:n.searchInput}),g.jsx("div",{style:n.chips,children:QW.map(k=>g.jsx("button",{"data-testid":`filter-${k.toLowerCase()}`,onClick:()=>d(k),style:{...n.chip,backgroundColor:h===k?i.accent:i.bgTertiary,color:h===k?i.bgPrimary:i.textSecondary,fontWeight:h===k?600:400},children:k},k))})]}),S.length>0&&g.jsxs("div",{style:n.section,children:[g.jsx("h3",{style:n.sectionTitle,children:"In Progress"}),g.jsx("div",{style:n.grid,children:S.map(k=>B(k,i.accent))})]}),C.length>0&&g.jsxs("div",{style:n.section,children:[g.jsx("h3",{style:n.sectionTitle,children:"Completed"}),g.jsx("div",{style:n.grid,children:C.map(k=>B(k,i.success))})]}),g.jsxs("div",{style:n.section,children:[g.jsx("h3",{style:n.sectionTitle,children:"All Modules"}),E.length>0?g.jsx("div",{style:n.grid,children:E.map(k=>B(k,null))}):g.jsxs("div",{style:n.emptyState,children:[g.jsx("span",{style:n.emptyIcon,children:"🔍"}),g.jsx("p",{style:n.emptyTitle,children:"No modules found"}),g.jsx("p",{style:n.emptySubtext,children:l?`No results for "${l}". Try a different search term.`:"No modules available in this category yet."})]})]})]})}function eH(e){return{container:{maxWidth:960,margin:"0 auto",display:"flex",flexDirection:"column",gap:28},toolbar:{display:"flex",flexDirection:"column",gap:12},searchInput:{width:"100%",padding:"10px 14px",fontSize:14,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:8,color:e.textPrimary,outline:"none",boxSizing:"border-box"},chips:{display:"flex",gap:8,flexWrap:"wrap"},chip:{padding:"5px 14px",fontSize:13,border:"none",borderRadius:16,cursor:"pointer",transition:"background-color 0.15s ease, color 0.15s ease"},section:{display:"flex",flexDirection:"column",gap:12},sectionTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:0},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:14},card:{padding:16,backgroundColor:e.bgSecondary,border:"1px solid",borderRadius:10,display:"flex",flexDirection:"column",gap:10,transition:"transform 0.15s ease, box-shadow 0.15s ease"},cardHeader:{display:"flex",alignItems:"flex-start",gap:10},cardIcon:{fontSize:32,lineHeight:1,flexShrink:0},cardTitleWrap:{display:"flex",flexDirection:"column",gap:4,minWidth:0},cardTitle:{fontSize:14,fontWeight:600,color:e.textPrimary,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},categoryBadge:{fontSize:11,color:e.textMuted,textTransform:"capitalize"},cardDescription:{fontSize:13,color:e.textSecondary,margin:0,lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},cardFooter:{display:"flex",gap:8,flexWrap:"wrap",marginTop:"auto"},difficultyBadge:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:4,textTransform:"capitalize"},completedBadge:{fontSize:11,fontWeight:600,color:e.success,backgroundColor:`${e.success}18`,padding:"2px 8px",borderRadius:4},progressBadge:{fontSize:11,fontWeight:600,color:e.accent,backgroundColor:`${e.accent}18`,padding:"2px 8px",borderRadius:4},xpBadge:{fontSize:11,fontWeight:600,color:e.warning,backgroundColor:`${e.warning}18`,padding:"2px 8px",borderRadius:4},startButton:{marginLeft:"auto",padding:"4px 12px",fontSize:11,fontWeight:600,color:e.bgPrimary,backgroundColor:e.accent,border:"none",borderRadius:6,cursor:"pointer"},emptyState:{textAlign:"center",padding:"48px 24px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,display:"flex",flexDirection:"column",alignItems:"center",gap:8},emptyIcon:{fontSize:36,opacity:.4},emptyTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0,maxWidth:320}}}const tH=["Appearance","Learning","Notifications","Connections","Data"],rH={Appearance:"✨",Learning:"📚",Notifications:"🔔",Connections:"🔗",Data:"💾"},iH=["beginner","intermediate","advanced"],nH=["gentle","standard","strict"],BE="http://localhost:3456/api/settings";function ql(e){return fetch(BE,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})}function sH(){const{theme:e,preference:t,accentName:r,setThemePreference:i,setAccent:n}=St(),s=M.useMemo(()=>oH(e),[e]),[a,l]=M.useState("Appearance"),[u,h]=M.useState(14),[d,p]=M.useState(!0),[m,y]=M.useState(!0),[x,v]=M.useState(!0),[S,C]=M.useState(VW),[E,L]=M.useState("intermediate"),[B,R]=M.useState(!0),[k,A]=M.useState("standard"),[O,V]=M.useState(!0),[q,H]=M.useState(!0),[Y,F]=M.useState(!1),[z]=M.useState("http://localhost:3456"),[$,j]=M.useState("unknown"),[W,P]=M.useState("FULL"),[Q,ee]=M.useState({modules:0,quizzes:0,xp:0}),[I,Z]=M.useState(!1),[oe,X]=M.useState(0),[ne,he]=M.useState(0),[ye,ve]=M.useState(!1);M.useEffect(()=>{fetch(BE).then(le=>le.ok?le.json():null).then(le=>{le&&(le.fontSize&&h(le.fontSize),le.confetti!==void 0&&p(le.confetti),le.transitions!==void 0&&y(le.transitions),le.diagrams!==void 0&&v(le.diagrams),le.model&&C(le.model),le.difficulty&&L(le.difficulty),le.quizTimer!==void 0&&R(le.quizTimer),le.strictness&&A(le.strictness),le.streakReminders!==void 0&&V(le.streakReminders),le.achievementPopups!==void 0&&H(le.achievementPopups),le.soundEffects!==void 0&&F(le.soundEffects),le.extensionStatus&&j(le.extensionStatus),le.tier&&P(le.tier),le.history&&ee(le.history))}).catch(()=>{}),fetch("http://localhost:3456/api/sessions").then(le=>le.ok?le.json():null).then(le=>{le!=null&&le.sessions&&(X(le.sessions.length),he(le.sessions.reduce((Je,ut)=>Je+(ut.messageCount||0),0)))}).catch(()=>{})},[]);const be=M.useCallback(le=>{h(Je=>{const ut=Math.max(12,Math.min(18,Je+le));return ql({fontSize:ut}),ut})},[]),$e=M.useCallback((le,Je)=>{le(ut=>(ql({[Je]:!ut}),!ut))},[]),Xe=M.useCallback(()=>{fetch("http://localhost:3456/api/progress").then(le=>le.json()).then(le=>{const Je=new Blob([JSON.stringify(le,null,2)],{type:"application/json"}),ut=document.createElement("a");ut.href=URL.createObjectURL(Je),ut.download="claudeteach-progress.json",ut.click()}).catch(()=>{})},[]),it=M.useCallback(()=>{if(!I){Z(!0);return}fetch("http://localhost:3456/api/progress",{method:"DELETE"}).then(()=>{ee({modules:0,quizzes:0,xp:0}),Z(!1)}).catch(()=>{})},[I]),Oe=M.useCallback(()=>{if(!ye){ve(!0);return}fetch("http://localhost:3456/api/sessions",{method:"DELETE"}).then(()=>{X(0),he(0),ve(!1)}).catch(()=>{})},[ye]),ht=(le,Je,ut)=>g.jsxs("div",{style:s.toggleRow,children:[g.jsx("span",{style:s.toggleLabel,children:le}),g.jsx("button",{style:{...s.toggleTrack,background:Je?e.accent:e.bgTertiary},onClick:ut,children:g.jsx("span",{style:{...s.toggleThumb,transform:Je?"translateX(18px)":"translateX(2px)"}})})]}),Ft=(le,Je,ut,qt)=>g.jsxs("button",{onClick:ut,style:{...s.selectionCard,borderColor:Je?e.accent:e.border,background:Je?`${e.accent}12`:e.bgSecondary},children:[g.jsx("span",{style:{...s.cardLabel,color:Je?e.accent:e.textPrimary},children:le}),qt&&g.jsx("span",{style:s.cardSub,children:qt})]},le);return g.jsxs("div",{style:s.wrapper,children:[g.jsxs("nav",{style:s.sidebar,children:[g.jsx("h2",{style:s.sidebarTitle,children:"Settings"}),tH.map(le=>g.jsxs("button",{onClick:()=>l(le),style:{...s.tabBtn,background:a===le?`${e.accent}18`:"transparent",color:a===le?e.accent:e.textSecondary,borderLeft:a===le?`3px solid ${e.accent}`:"3px solid transparent"},children:[g.jsx("span",{style:s.tabIcon,children:rH[le]}),le]},le))]}),g.jsxs("main",{style:s.content,children:[a==="Appearance"&&g.jsxs(g.Fragment,{children:[g.jsx(Wr,{title:"Theme",s,children:g.jsx("div",{style:s.cardRow,children:["dark","light","system"].map(le=>Ft(le.charAt(0).toUpperCase()+le.slice(1),t===le,()=>i(le),le==="dark"?"Easy on the eyes":le==="light"?"Bright & clean":"Match OS setting"))})}),g.jsx(Wr,{title:"Accent Color",s,children:g.jsx("div",{style:s.colorRow,children:Object.keys(js).map(le=>g.jsx("button",{onClick:()=>n(le),style:{...s.colorCircle,background:js[le][e.id]||js[le].dark,boxShadow:r===le?`0 0 0 3px ${e.bgPrimary}, 0 0 0 5px ${js[le][e.id]||js[le].dark}`:"none",transform:r===le?"scale(1.15)":"scale(1)"},title:le},le))})}),g.jsx(Wr,{title:"Font Size",s,children:g.jsxs("div",{style:s.fontRow,children:[g.jsx("button",{style:s.fontBtn,onClick:()=>be(-1),disabled:u<=12,children:"-"}),g.jsxs("span",{style:s.fontValue,children:[u,"px"]}),g.jsx("button",{style:s.fontBtn,onClick:()=>be(1),disabled:u>=18,children:"+"})]})}),g.jsxs(Wr,{title:"Animations",s,children:[ht("Confetti celebrations",d,()=>$e(p,"confetti")),ht("UI transitions",m,()=>$e(y,"transitions")),ht("Diagram animations",x,()=>$e(v,"diagrams"))]})]}),a==="Learning"&&g.jsxs(g.Fragment,{children:[g.jsxs(Wr,{title:"AI Model",s,children:[g.jsx("div",{style:s.cardRow,children:UW.map(le=>Ft(le.label,S===le.id,()=>{C(le.id),ql({model:le.id}),window.dispatchEvent(new CustomEvent("settings:model-changed",{detail:le.id}))},le.description))}),g.jsx("p",{style:{fontSize:12,color:e.textMuted,marginTop:8},children:"Applies to new chat sessions"})]}),g.jsx(Wr,{title:"Default Difficulty",s,children:g.jsx("select",{value:E,onChange:le=>{L(le.target.value),ql({difficulty:le.target.value})},style:s.select,children:iH.map(le=>g.jsx("option",{value:le,children:le.charAt(0).toUpperCase()+le.slice(1)},le))})}),g.jsx(Wr,{title:"Quiz Timer",s,children:ht("Enable countdown timer on quizzes",B,()=>$e(R,"quizTimer"))}),g.jsx(Wr,{title:"Socratic Strictness",s,children:g.jsx("div",{style:s.cardRow,children:nH.map(le=>Ft(le.charAt(0).toUpperCase()+le.slice(1),k===le,()=>{A(le),ql({strictness:le})},le==="gentle"?"More hints & guidance":le==="standard"?"Balanced approach":"Minimal hand-holding"))})})]}),a==="Notifications"&&g.jsx(g.Fragment,{children:g.jsxs(Wr,{title:"Alerts",s,children:[ht("Streak reminders",O,()=>$e(V,"streakReminders")),ht("Achievement popups",q,()=>$e(H,"achievementPopups")),ht("Sound effects",Y,()=>$e(F,"soundEffects"))]})}),a==="Connections"&&g.jsxs(g.Fragment,{children:[g.jsx(Wr,{title:"Bridge Server",s,children:g.jsxs("div",{style:s.infoRow,children:[g.jsx("span",{style:s.infoLabel,children:"URL"}),g.jsx("span",{style:s.infoValue,children:z})]})}),g.jsx(Wr,{title:"Extension",s,children:g.jsxs("div",{style:s.infoRow,children:[g.jsx("span",{style:s.infoLabel,children:"Status"}),g.jsx("span",{style:{...s.statusBadge,background:$==="connected"?`${e.success}22`:`${e.warning}22`,color:$==="connected"?e.success:e.warning},children:$==="connected"?"Connected":$==="unknown"?"Checking...":"Disconnected"})]})}),g.jsx(Wr,{title:"Tier",s,children:g.jsxs("div",{style:s.infoRow,children:[g.jsx("span",{style:s.infoLabel,children:"Enhancement level"}),g.jsx("span",{style:{...s.statusBadge,background:`${e.accent}22`,color:e.accent},children:W})]})})]}),a==="Data"&&g.jsxs(g.Fragment,{children:[g.jsx(Wr,{title:"Learning History",s,children:g.jsxs("div",{style:s.statGrid,children:[g.jsxs("div",{style:s.statCell,children:[g.jsx("span",{style:s.statNum,children:Q.modules}),g.jsx("span",{style:s.statLabel,children:"Modules"})]}),g.jsxs("div",{style:s.statCell,children:[g.jsx("span",{style:s.statNum,children:Q.quizzes}),g.jsx("span",{style:s.statLabel,children:"Quizzes"})]}),g.jsxs("div",{style:s.statCell,children:[g.jsx("span",{style:s.statNum,children:Q.xp}),g.jsx("span",{style:s.statLabel,children:"Total XP"})]})]})}),g.jsxs(Wr,{title:"Session History",s,children:[g.jsxs("p",{style:{fontSize:13,color:e.textSecondary,margin:"0 0 10px"},children:[oe," saved session",oe!==1?"s":""," with ",ne," total message",ne!==1?"s":""]}),g.jsx("div",{style:s.btnRow,children:g.jsx("button",{style:{...s.dangerBtn,background:ye?e.error:"transparent",color:ye?"#fff":e.error},onClick:Oe,children:ye?"Confirm Purge":"Purge Session History"})}),ye&&g.jsx("p",{style:s.warnText,children:"This will permanently delete all conversation history. Click again to confirm."})]}),g.jsxs(Wr,{title:"Export & Reset",s,children:[g.jsxs("div",{style:s.btnRow,children:[g.jsx("button",{style:s.primaryBtn,onClick:Xe,children:"Export Progress"}),g.jsx("button",{style:{...s.dangerBtn,background:I?e.error:"transparent"},onClick:it,children:I?"Confirm Reset":"Reset Progress"})]}),I&&g.jsx("p",{style:s.warnText,children:"This will permanently erase all progress. Click again to confirm."})]})]})]})]})}function Wr({title:e,s:t,children:r}){return g.jsxs("div",{style:t.section,children:[g.jsx("h3",{style:t.sectionTitle,children:e}),r]})}function oH(e){return{wrapper:{display:"flex",height:"100%",minHeight:0,background:e.bgPrimary,color:e.textPrimary},sidebar:{width:220,minWidth:220,background:e.bgSecondary,borderRight:`1px solid ${e.border}`,padding:"24px 0",display:"flex",flexDirection:"column",gap:2},sidebarTitle:{fontSize:18,fontWeight:700,color:e.textBright,padding:"0 20px 16px",margin:0,letterSpacing:"-0.02em"},tabBtn:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 20px",border:"none",cursor:"pointer",fontSize:14,fontWeight:500,fontFamily:"inherit",textAlign:"left",transition:"all 0.15s"},tabIcon:{fontSize:16,width:22,textAlign:"center"},content:{flex:1,overflow:"auto",padding:"32px 40px",display:"flex",flexDirection:"column",gap:8},section:{marginBottom:24},sectionTitle:{fontSize:13,fontWeight:600,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.06em",margin:"0 0 12px"},cardRow:{display:"flex",gap:12},selectionCard:{flex:1,padding:"14px 16px",borderRadius:10,border:"2px solid",cursor:"pointer",background:"none",fontFamily:"inherit",textAlign:"left",transition:"all 0.15s",display:"flex",flexDirection:"column",gap:4},cardLabel:{fontSize:14,fontWeight:600},cardSub:{fontSize:12,color:e.textMuted},colorRow:{display:"flex",gap:14,alignItems:"center"},colorCircle:{width:32,height:32,borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s"},fontRow:{display:"flex",alignItems:"center",gap:16},fontBtn:{width:36,height:36,borderRadius:8,border:`1px solid ${e.border}`,background:e.bgSecondary,color:e.textPrimary,fontSize:18,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit"},fontValue:{fontSize:16,fontWeight:600,color:e.textBright,minWidth:48,textAlign:"center"},toggleRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0"},toggleLabel:{fontSize:14,color:e.textPrimary},toggleTrack:{width:42,height:24,borderRadius:12,border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},toggleThumb:{width:20,height:20,borderRadius:"50%",background:"#fff",position:"absolute",top:2,transition:"transform 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},select:{padding:"8px 12px",borderRadius:8,border:`1px solid ${e.border}`,background:e.bgSecondary,color:e.textPrimary,fontSize:14,fontFamily:"inherit",cursor:"pointer",minWidth:200},infoRow:{display:"flex",alignItems:"center",gap:12,padding:"8px 0"},infoLabel:{fontSize:13,color:e.textSecondary,minWidth:120},infoValue:{fontSize:14,color:e.textPrimary,fontFamily:"monospace",background:e.bgTertiary,padding:"4px 10px",borderRadius:6},statusBadge:{fontSize:13,fontWeight:600,padding:"4px 12px",borderRadius:20},statGrid:{display:"flex",gap:16},statCell:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:4,padding:16,background:e.bgSecondary,borderRadius:10,border:`1px solid ${e.border}`},statNum:{fontSize:24,fontWeight:700,color:e.textBright},statLabel:{fontSize:12,color:e.textSecondary},btnRow:{display:"flex",gap:12},primaryBtn:{padding:"10px 20px",borderRadius:8,border:"none",background:e.accent,color:"#fff",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},dangerBtn:{padding:"10px 20px",borderRadius:8,border:`1px solid ${e.error}`,color:e.error,fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},warnText:{fontSize:13,color:e.error,marginTop:8}}}/**
|
|
461
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
462
|
+
* @license MIT
|
|
463
|
+
*
|
|
464
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
465
|
+
* @license MIT
|
|
466
|
+
*
|
|
467
|
+
* Originally forked from (with the author's permission):
|
|
468
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
469
|
+
* http://bellard.org/jslinux/
|
|
470
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
471
|
+
*/var ME=Object.defineProperty,aH=Object.getOwnPropertyDescriptor,lH=(e,t)=>{for(var r in t)ME(e,r,{get:t[r],enumerable:!0})},Ot=(e,t,r,i)=>{for(var n=i>1?void 0:i?aH(t,r):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(n=(i?a(t,r,n):a(n))||n);return i&&n&&ME(t,r,n),n},we=(e,t)=>(r,i)=>t(r,i,e),tb="Terminal input",Dm={get:()=>tb,set:e=>tb=e},rb="Too much output to announce, navigate to rows manually to read",Pm={get:()=>rb,set:e=>rb=e};function cH(e){return e.replace(/\r?\n/g,"\r")}function hH(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function uH(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dH(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let n=e.clipboardData.getData("text/plain");LE(n,t,r,i)}}function LE(e,t,r,i){e=cH(e),e=hH(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function RE(e,t,r){let i=r.getBoundingClientRect(),n=e.clientX-i.left-10,s=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function ib(e,t,r,i,n){RE(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Is(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function af(e,t=0,r=e.length){let i="";for(let n=t;n<r;++n){let s=e[n];s>65535?(s-=65536,i+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):i+=String.fromCharCode(s)}return i}var fH=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,n=0;if(this._interim){let s=e.charCodeAt(n++);56320<=s&&s<=57343?t[i++]=(this._interim-55296)*1024+s-56320+65536:(t[i++]=this._interim,t[i++]=s),this._interim=0}for(let s=n;s<r;++s){let a=e.charCodeAt(s);if(55296<=a&&a<=56319){if(++s>=r)return this._interim=a,i;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[i++]=(a-55296)*1024+l-56320+65536:(t[i++]=a,t[i++]=l);continue}a!==65279&&(t[i++]=a)}return i}},pH=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,n,s,a,l,u=0,h=0;if(this.interim[0]){let m=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,v;for(;(v=this.interim[++x]&63)&&x<4;)y<<=6,y|=v;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=S-x;for(;h<C;){if(h>=r)return 0;if(v=e[h++],(v&192)!==128){h--,m=!0;break}else this.interim[x++]=v,y<<=6,y|=v&63}m||(S===2?y<128?h--:t[i++]=y:S===3?y<2048||y>=55296&&y<=57343||y===65279||(t[i++]=y):y<65536||y>1114111||(t[i++]=y)),this.interim.fill(0)}let d=r-4,p=h;for(;p<r;){for(;p<d&&!((n=e[p])&128)&&!((s=e[p+1])&128)&&!((a=e[p+2])&128)&&!((l=e[p+3])&128);)t[i++]=n,t[i++]=s,t[i++]=a,t[i++]=l,p+=4;if(n=e[p++],n<128)t[i++]=n;else if((n&224)===192){if(p>=r)return this.interim[0]=n,i;if(s=e[p++],(s&192)!==128){p--;continue}if(u=(n&31)<<6|s&63,u<128){p--;continue}t[i++]=u}else if((n&240)===224){if(p>=r)return this.interim[0]=n,i;if(s=e[p++],(s&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=s,i;if(a=e[p++],(a&192)!==128){p--;continue}if(u=(n&15)<<12|(s&63)<<6|a&63,u<2048||u>=55296&&u<=57343||u===65279)continue;t[i++]=u}else if((n&248)===240){if(p>=r)return this.interim[0]=n,i;if(s=e[p++],(s&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=s,i;if(a=e[p++],(a&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=s,this.interim[2]=a,i;if(l=e[p++],(l&192)!==128){p--;continue}if(u=(n&7)<<18|(s&63)<<12|(a&63)<<6|l&63,u<65536||u>1114111)continue;t[i++]=u}}return i}},AE="",Os=" ",Uc=class DE{constructor(){this.fg=0,this.bg=0,this.extended=new Td}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new DE;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Td=class PE{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new PE(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},$i=class IE extends Uc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Td,this.combinedData=""}static fromCharData(t){let r=new IE;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Is(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},nb="di$target",Im="di$dependencies",bg=new Map;function gH(e){return e[Im]||[]}function _r(e){if(bg.has(e))return bg.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");mH(t,r,n)};return t._id=e,bg.set(e,t),t}function mH(e,t,r){t[nb]===t?t[Im].push({id:e,index:r}):(t[Im]=[{id:e,index:r}],t[nb]=t)}var Kr=_r("BufferService"),$E=_r("CoreMouseService"),qo=_r("CoreService"),yH=_r("CharsetService"),S0=_r("InstantiationService"),jE=_r("LogService"),Xr=_r("OptionsService"),zE=_r("OscLinkService"),_H=_r("UnicodeService"),Vc=_r("DecorationService"),$m=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var d;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],n=this._optionsService.rawOptions.linkHandler,s=new $i,a=r.getTrimmedLength(),l=-1,u=-1,h=!1;for(let p=0;p<a;p++)if(!(u===-1&&!r.hasContent(p))){if(r.loadCell(p,s),s.hasExtendedAttrs()&&s.extended.urlId)if(u===-1){u=p,l=s.extended.urlId;continue}else h=s.extended.urlId!==l;else u!==-1&&(h=!0);if(h||u!==-1&&p===a-1){let m=(d=this._oscLinkService.getLinkData(l))==null?void 0:d.uri;if(m){let y={start:{x:u+1,y:e},end:{x:p+(!h&&p===a-1?1:0),y:e}},x=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let v=new URL(m);["http:","https:"].includes(v.protocol)||(x=!0)}catch{x=!0}x||i.push({text:m,range:y,activate:(v,S)=>n?n.activate(v,S,y):xH(v,S),hover:(v,S)=>{var C;return(C=n==null?void 0:n.hover)==null?void 0:C.call(n,v,S,y)},leave:(v,S)=>{var C;return(C=n==null?void 0:n.leave)==null?void 0:C.call(n,v,S,y)}})}h=!1,s.hasExtendedAttrs()&&s.extended.urlId?(u=p,l=s.extended.urlId):(u=-1,l=-1)}}t(i)}};$m=Ot([we(0,Kr),we(1,Xr),we(2,zE)],$m);function xH(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
472
|
+
|
|
473
|
+
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var lf=_r("CharSizeService"),os=_r("CoreBrowserService"),w0=_r("MouseService"),as=_r("RenderService"),vH=_r("SelectionService"),OE=_r("CharacterJoinerService"),Ka=_r("ThemeService"),FE=_r("LinkProviderService"),bH=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sb.isErrorNoTelemetry(e)?new sb(e.message+`
|
|
474
|
+
|
|
475
|
+
`+e.stack):new Error(e.message+`
|
|
476
|
+
|
|
477
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},SH=new bH;function $u(e){wH(e)||SH.onUnexpectedError(e)}var jm="Canceled";function wH(e){return e instanceof CH?!0:e instanceof Error&&e.name===jm&&e.message===jm}var CH=class extends Error{constructor(){super(jm),this.name=this.message}};function kH(e){return new Error(`Illegal argument: ${e}`)}var sb=class zm extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof zm)return t;let r=new zm;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Om=class NE extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,NE.prototype)}};function _i(e,t=0){return e[e.length-(1+t)]}var TH;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function n(s){return s===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(TH||(TH={}));function EH(e,t){let r=this,i=!1,n;return function(){return i||(i=!0,t||(n=e.apply(r,arguments))),n}}var WE;(e=>{function t(B){return B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(B){yield B}e.single=n;function s(B){return t(B)?B:n(B)}e.wrap=s;function a(B){return B||r}e.from=a;function*l(B){for(let R=B.length-1;R>=0;R--)yield B[R]}e.reverse=l;function u(B){return!B||B[Symbol.iterator]().next().done===!0}e.isEmpty=u;function h(B){return B[Symbol.iterator]().next().value}e.first=h;function d(B,R){let k=0;for(let A of B)if(R(A,k++))return!0;return!1}e.some=d;function p(B,R){for(let k of B)if(R(k))return k}e.find=p;function*m(B,R){for(let k of B)R(k)&&(yield k)}e.filter=m;function*y(B,R){let k=0;for(let A of B)yield R(A,k++)}e.map=y;function*x(B,R){let k=0;for(let A of B)yield*R(A,k++)}e.flatMap=x;function*v(...B){for(let R of B)yield*R}e.concat=v;function S(B,R,k){let A=k;for(let O of B)A=R(A,O);return A}e.reduce=S;function*C(B,R,k=B.length){for(R<0&&(R+=B.length),k<0?k+=B.length:k>B.length&&(k=B.length);R<k;R++)yield B[R]}e.slice=C;function E(B,R=Number.POSITIVE_INFINITY){let k=[];if(R===0)return[k,B];let A=B[Symbol.iterator]();for(let O=0;O<R;O++){let V=A.next();if(V.done)return[k,e.empty()];k.push(V.value)}return[k,{[Symbol.iterator](){return A}}]}e.consume=E;async function L(B){let R=[];for await(let k of B)R.push(k);return Promise.resolve(R)}e.asyncToArray=L})(WE||(WE={}));function jo(e){if(WE.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function BH(...e){return Rt(()=>jo(e))}function Rt(e){return{dispose:EH(()=>{e()})}}var HE=class qE{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{jo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?qE.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};HE.DISABLE_DISPOSED_WARNING=!1;var Ns=HE,Ze=class{constructor(){this._store=new Ns,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ze.None=Object.freeze({dispose(){}});var Wa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},es=typeof window=="object"?window:globalThis,Fm=class Nm{constructor(t){this.element=t,this.next=Nm.Undefined,this.prev=Nm.Undefined}};Fm.Undefined=new Fm(void 0);var It=Fm,ob=class{constructor(){this._first=It.Undefined,this._last=It.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===It.Undefined}clear(){let e=this._first;for(;e!==It.Undefined;){let t=e.next;e.prev=It.Undefined,e.next=It.Undefined,e=t}this._first=It.Undefined,this._last=It.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new It(e);if(this._first===It.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==It.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==It.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==It.Undefined&&e.next!==It.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===It.Undefined&&e.next===It.Undefined?(this._first=It.Undefined,this._last=It.Undefined):e.next===It.Undefined?(this._last=this._last.prev,this._last.next=It.Undefined):e.prev===It.Undefined&&(this._first=this._first.next,this._first.prev=It.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==It.Undefined;)yield e.element,e=e.next}},MH=globalThis.performance&&typeof globalThis.performance.now=="function",LH=class UE{static create(t){return new UE(t)}constructor(t){this._now=MH&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Cr;(e=>{e.None=()=>Ze.None;function t(Y,F){return p(Y,()=>{},0,void 0,!0,void 0,F)}e.defer=t;function r(Y){return(F,z=null,$)=>{let j=!1,W;return W=Y(P=>{if(!j)return W?W.dispose():j=!0,F.call(z,P)},null,$),j&&W.dispose(),W}}e.once=r;function i(Y,F,z){return h(($,j=null,W)=>Y(P=>$.call(j,F(P)),null,W),z)}e.map=i;function n(Y,F,z){return h(($,j=null,W)=>Y(P=>{F(P),$.call(j,P)},null,W),z)}e.forEach=n;function s(Y,F,z){return h(($,j=null,W)=>Y(P=>F(P)&&$.call(j,P),null,W),z)}e.filter=s;function a(Y){return Y}e.signal=a;function l(...Y){return(F,z=null,$)=>{let j=BH(...Y.map(W=>W(P=>F.call(z,P))));return d(j,$)}}e.any=l;function u(Y,F,z,$){let j=z;return i(Y,W=>(j=F(j,W),j),$)}e.reduce=u;function h(Y,F){let z,$={onWillAddFirstListener(){z=Y(j.fire,j)},onDidRemoveLastListener(){z==null||z.dispose()}},j=new _e($);return F==null||F.add(j),j.event}function d(Y,F){return F instanceof Array?F.push(Y):F&&F.add(Y),Y}function p(Y,F,z=100,$=!1,j=!1,W,P){let Q,ee,I,Z=0,oe,X={leakWarningThreshold:W,onWillAddFirstListener(){Q=Y(he=>{Z++,ee=F(ee,he),$&&!I&&(ne.fire(ee),ee=void 0),oe=()=>{let ye=ee;ee=void 0,I=void 0,(!$||Z>1)&&ne.fire(ye),Z=0},typeof z=="number"?(clearTimeout(I),I=setTimeout(oe,z)):I===void 0&&(I=0,queueMicrotask(oe))})},onWillRemoveListener(){j&&Z>0&&(oe==null||oe())},onDidRemoveLastListener(){oe=void 0,Q.dispose()}},ne=new _e(X);return P==null||P.add(ne),ne.event}e.debounce=p;function m(Y,F=0,z){return e.debounce(Y,($,j)=>$?($.push(j),$):[j],F,void 0,!0,void 0,z)}e.accumulate=m;function y(Y,F=($,j)=>$===j,z){let $=!0,j;return s(Y,W=>{let P=$||!F(W,j);return $=!1,j=W,P},z)}e.latch=y;function x(Y,F,z){return[e.filter(Y,F,z),e.filter(Y,$=>!F($),z)]}e.split=x;function v(Y,F=!1,z=[],$){let j=z.slice(),W=Y(ee=>{j?j.push(ee):Q.fire(ee)});$&&$.add(W);let P=()=>{j==null||j.forEach(ee=>Q.fire(ee)),j=null},Q=new _e({onWillAddFirstListener(){W||(W=Y(ee=>Q.fire(ee)),$&&$.add(W))},onDidAddFirstListener(){j&&(F?setTimeout(P):P())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return $&&$.add(Q),Q.event}e.buffer=v;function S(Y,F){return(z,$,j)=>{let W=F(new E);return Y(function(P){let Q=W.evaluate(P);Q!==C&&z.call($,Q)},void 0,j)}}e.chain=S;let C=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(F){return this.steps.push(F),this}forEach(F){return this.steps.push(z=>(F(z),z)),this}filter(F){return this.steps.push(z=>F(z)?z:C),this}reduce(F,z){let $=z;return this.steps.push(j=>($=F($,j),$)),this}latch(F=(z,$)=>z===$){let z=!0,$;return this.steps.push(j=>{let W=z||!F(j,$);return z=!1,$=j,W?j:C}),this}evaluate(F){for(let z of this.steps)if(F=z(F),F===C)break;return F}}function L(Y,F,z=$=>$){let $=(...Q)=>P.fire(z(...Q)),j=()=>Y.on(F,$),W=()=>Y.removeListener(F,$),P=new _e({onWillAddFirstListener:j,onDidRemoveLastListener:W});return P.event}e.fromNodeEventEmitter=L;function B(Y,F,z=$=>$){let $=(...Q)=>P.fire(z(...Q)),j=()=>Y.addEventListener(F,$),W=()=>Y.removeEventListener(F,$),P=new _e({onWillAddFirstListener:j,onDidRemoveLastListener:W});return P.event}e.fromDOMEventEmitter=B;function R(Y){return new Promise(F=>r(Y)(F))}e.toPromise=R;function k(Y){let F=new _e;return Y.then(z=>{F.fire(z)},()=>{F.fire(void 0)}).finally(()=>{F.dispose()}),F.event}e.fromPromise=k;function A(Y,F){return Y(z=>F.fire(z))}e.forward=A;function O(Y,F,z){return F(z),Y($=>F($))}e.runAndSubscribe=O;class V{constructor(F,z){this._observable=F,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{F.addObserver(this)},onDidRemoveLastListener:()=>{F.removeObserver(this)}};this.emitter=new _e($),z&&z.add(this.emitter)}beginUpdate(F){this._counter++}handlePossibleChange(F){}handleChange(F,z){this._hasChanged=!0}endUpdate(F){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function q(Y,F){return new V(Y,F).emitter.event}e.fromObservable=q;function H(Y){return(F,z,$)=>{let j=0,W=!1,P={beginUpdate(){j++},endUpdate(){j--,j===0&&(Y.reportChanges(),W&&(W=!1,F.call(z)))},handlePossibleChange(){},handleChange(){W=!0}};Y.addObserver(P),Y.reportChanges();let Q={dispose(){Y.removeObserver(P)}};return $ instanceof Ns?$.add(Q):Array.isArray($)&&$.push(Q),Q}}e.fromObservableLight=H})(Cr||(Cr={}));var Wm=class Hm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hm._idPool++}`,Hm.all.add(this)}start(t){this._stopWatch=new LH,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Wm.all=new Set,Wm._idPool=0;var RH=Wm,AH=-1,VE=class GE{constructor(t,r,i=(GE._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,a]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${a}):`;console.warn(l),console.warn(s);let u=new IH(l,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};VE._idPool=1;var DH=VE,PH=class YE{constructor(t){this.value=t}static create(){let t=new Error;return new YE(t.stack??"")}print(){console.warn(this.value.split(`
|
|
478
|
+
`).slice(2).join(`
|
|
479
|
+
`))}},IH=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},$H=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jH=0,Sg=class{constructor(e){this.value=e,this.id=jH++}},zH=2,OH,_e=class{constructor(t){var r,i,n,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new DH((t==null?void 0:t.onListenerError)??$u,((i=this._options)==null?void 0:i.leakWarningThreshold)??AH):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new RH(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,i,n;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var l,u,h,d,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let m=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(m);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new $H(`${m}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((l=this._options)==null?void 0:l.onListenerError)||$u)(x),Ze.None}if(this._disposed)return Ze.None;r&&(t=t.bind(r));let n=new Sg(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=PH.create(),s=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Sg?(this._deliveryQueue??(this._deliveryQueue=new FH),this._listeners=[this._listeners,n]):this._listeners.push(n):((h=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||h.call(u,this),this._listeners=n,(p=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||p.call(d,this)),this._size++;let a=Rt(()=>{s==null||s(),this._removeListener(n)});return i instanceof Ns?i.add(a):Array.isArray(i)&&i.push(a),a}),this._event}_removeListener(t){var s,a,l,u;if((a=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||a.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||u.call(l,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*zH<=r.length){let h=0;for(let d=0;d<r.length;d++)r[d]?r[h++]=r[d]:n&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=h}}_deliver(t,r){var n;if(!t)return;let i=((n=this._options)==null?void 0:n.onListenerError)||$u;if(!i){t.value(r);return}try{t.value(r)}catch(s){i(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,n,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Sg)this._deliver(this._listeners,t);else{let a=this._deliveryQueue;a.enqueue(this,t,this._listeners.length),this._deliverQueue(a)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},FH=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},qm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};qm.INSTANCE=new qm;var C0=qm;function NH(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}C0.INSTANCE.onDidChangeZoomLevel;function WH(e){return C0.INSTANCE.getZoomFactor(e)}C0.INSTANCE.onDidChangeFullscreen;var Xa=typeof navigator=="object"?navigator.userAgent:"",Um=Xa.indexOf("Firefox")>=0,HH=Xa.indexOf("AppleWebKit")>=0,k0=Xa.indexOf("Chrome")>=0,qH=!k0&&Xa.indexOf("Safari")>=0;Xa.indexOf("Electron/")>=0;Xa.indexOf("Android")>=0;var wg=!1;if(typeof es.matchMedia=="function"){let e=es.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=es.matchMedia("(display-mode: fullscreen)");wg=e.matches,NH(es,e,({matches:r})=>{wg&&t.matches||(wg=r)})}var Sa="en",Vm=!1,Gm=!1,ju=!1,KE=!1,fu,zu=Sa,ab=Sa,UH,en,Bo=globalThis,wr,eS;typeof Bo.vscode<"u"&&typeof Bo.vscode.process<"u"?wr=Bo.vscode.process:typeof process<"u"&&typeof((eS=process==null?void 0:process.versions)==null?void 0:eS.node)=="string"&&(wr=process);var tS,VH=typeof((tS=wr==null?void 0:wr.versions)==null?void 0:tS.electron)=="string",GH=VH&&(wr==null?void 0:wr.type)==="renderer",rS;if(typeof wr=="object"){Vm=wr.platform==="win32",Gm=wr.platform==="darwin",ju=wr.platform==="linux",ju&&wr.env.SNAP&&wr.env.SNAP_REVISION,wr.env.CI||wr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fu=Sa,zu=Sa;let e=wr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);fu=t.userLocale,ab=t.osLocale,zu=t.resolvedLanguage||Sa,UH=(rS=t.languagePack)==null?void 0:rS.translationsConfigFile}catch{}KE=!0}else typeof navigator=="object"&&!GH?(en=navigator.userAgent,Vm=en.indexOf("Windows")>=0,Gm=en.indexOf("Macintosh")>=0,(en.indexOf("Macintosh")>=0||en.indexOf("iPad")>=0||en.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ju=en.indexOf("Linux")>=0,(en==null?void 0:en.indexOf("Mobi"))>=0,zu=globalThis._VSCODE_NLS_LANGUAGE||Sa,fu=navigator.language.toLowerCase(),ab=fu):console.error("Unable to resolve platform.");var XE=Vm,Rn=Gm,YH=ju,lb=KE,Pn=en,Ms=zu,KH;(e=>{function t(){return Ms}e.value=t;function r(){return Ms.length===2?Ms==="en":Ms.length>=3?Ms[0]==="e"&&Ms[1]==="n"&&Ms[2]==="-":!1}e.isDefaultVariant=r;function i(){return Ms==="en"}e.isDefault=i})(KH||(KH={}));var XH=typeof Bo.postMessage=="function"&&!Bo.importScripts;(()=>{if(XH){let e=[];Bo.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Bo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var QH=!!(Pn&&Pn.indexOf("Chrome")>=0);Pn&&Pn.indexOf("Firefox")>=0;!QH&&Pn&&Pn.indexOf("Safari")>=0;Pn&&Pn.indexOf("Edg/")>=0;Pn&&Pn.indexOf("Android")>=0;var ya=typeof navigator=="object"?navigator:{};lb||document.queryCommandSupported&&document.queryCommandSupported("copy")||ya&&ya.clipboard&&ya.clipboard.writeText,lb||ya&&ya.clipboard&&ya.clipboard.readText;var T0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Cg=new T0,cb=new T0,hb=new T0,ZH=new Array(230),QE;(e=>{function t(l){return Cg.keyCodeToStr(l)}e.toString=t;function r(l){return Cg.strToKeyCode(l)}e.fromString=r;function i(l){return cb.keyCodeToStr(l)}e.toUserSettingsUS=i;function n(l){return hb.keyCodeToStr(l)}e.toUserSettingsGeneral=n;function s(l){return cb.strToKeyCode(l)||hb.strToKeyCode(l)}e.fromUserSettings=s;function a(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Cg.keyCodeToStr(l)}e.toElectronAccelerator=a})(QE||(QE={}));var JH=class ZE{constructor(t,r,i,n,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=n,this.keyCode=s}equals(t){return t instanceof ZE&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${t}${r}${i}${n}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new e9([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},e9=class{constructor(e){if(e.length===0)throw kH("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function t9(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return QE.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Um)switch(t){case 59:return 85;case 60:if(YH)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Rn)return 57;break}else if(HH&&(Rn&&t===93||!Rn&&t===92))return 57;return ZH[t]||0}var r9=Rn?256:2048,i9=512,n9=1024,s9=Rn?2048:256,ub=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=t9(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=r9),this.altKey&&(t|=i9),this.shiftKey&&(t|=n9),this.metaKey&&(t|=s9),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new JH(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},db=new WeakMap;function o9(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var a9=class{static getSameOriginWindowChain(e){let t=db.get(e);if(!t){t=[],db.set(e,t);let r=e,i;do i=o9(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,i=0,n=this.getSameOriginWindowChain(e);for(let s of n){let a=s.window.deref();if(r+=(a==null?void 0:a.scrollY)??0,i+=(a==null?void 0:a.scrollX)??0,a===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,i+=l.left}return{top:r,left:i}}},pu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=a9.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},fb=class{constructor(e,t=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(k0){let s=navigator.userAgent.match(/Chrome\/(\d+)/);i=(s?parseInt(s[1]):123)<=122}if(e){let s=e,a=e,l=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")i?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof a.VERTICAL_AXIS<"u"&&a.axis===a.VERTICAL_AXIS)this.deltaY=-a.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Um&&!Rn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")qH&&XE?this.deltaX=-(s.wheelDeltaX/120):i?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof a.HORIZONTAL_AXIS<"u"&&a.axis===a.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Um&&!Rn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},JE=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),l9;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof c9?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Cr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:JE})})(l9||(l9={}));var c9=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?JE:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},E0=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Om("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Om("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},h9=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Om("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=Rt(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},u9;(e=>{async function t(i){let n,s=await Promise.all(i.map(a=>a.then(l=>l,l=>{n||(n=l)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(a){s(a)}})}e.withAsyncBody=r})(u9||(u9={}));var pb=class Pi{static fromArray(t){return new Pi(r=>{r.emitMany(t)})}static fromPromise(t){return new Pi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Pi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Pi(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new _e,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Cr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Pi(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return Pi.map(this,t)}static filter(t,r){return new Pi(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return Pi.filter(this,t)}static coalesce(t){return Pi.filter(t,r=>!!r)}coalesce(){return Pi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Pi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};pb.EMPTY=pb.fromArray([]);var{getWindow:Mn,getWindowId:d9,onDidRegisterWindow:f9}=(function(){let e=new Map,t={window:es,disposables:new Ns};e.set(es.vscodeWindowId,t);let r=new _e,i=new _e,n=new _e;function s(a,l){return(typeof a=="number"?e.get(a):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(a){if(e.has(a.vscodeWindowId))return Ze.None;let l=new Ns,u={window:a,disposables:l.add(new Ns)};return e.set(a.vscodeWindowId,u),l.add(Rt(()=>{e.delete(a.vscodeWindowId),i.fire(a)})),l.add(Ge(a,pr.BEFORE_UNLOAD,()=>{n.fire(a)})),r.fire(u),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(a){return a.vscodeWindowId},hasWindow(a){return e.has(a)},getWindowById:s,getWindow(a){var h;let l=a;if((h=l==null?void 0:l.ownerDocument)!=null&&h.defaultView)return l.ownerDocument.defaultView.window;let u=a;return u!=null&&u.view?u.view.window:es},getDocument(a){return Mn(a).document}}})(),p9=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ge(e,t,r,i){return new p9(e,t,r,i)}var gb=function(e,t,r,i){return Ge(e,t,r,i)},B0,g9=class extends h9{constructor(e){super(),this.defaultTarget=e&&Mn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},mb=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){$u(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,n=s=>{r.set(s,!1);let a=e.get(s)??[];for(t.set(s,a),e.set(s,[]),i.set(s,!0);a.length>0;)a.sort(mb.sort),a.shift().execute();i.set(s,!1)};B0=(s,a,l=0)=>{let u=d9(s),h=new mb(a,l),d=e.get(u);return d||(d=[],e.set(u,d)),d.push(h),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>n(u))),h}})();function m9(e){let t=e.getBoundingClientRect(),r=Mn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var pr={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},y9=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=si(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=si(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=si(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=si(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=si(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=si(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=si(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=si(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=si(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=si(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=si(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=si(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=si(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=si(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function si(e){return typeof e=="number"?`${e}px`:e}function _c(e){return new y9(e)}var eB=class{constructor(){this._hooks=new Ns,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=n;let s=e;try{e.setPointerCapture(t),this._hooks.add(Rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Mn(e)}this._hooks.add(Ge(s,pr.POINTER_MOVE,a=>{if(a.buttons!==r){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Ge(s,pr.POINTER_UP,a=>this.stopMonitoring(!0)))}};function _9(e,t,r){let i=null,n=null;if(typeof r.value=="function"?(i="value",n=r.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",n=r.get),!n)throw new Error("not supported");let s=`$memoize$${t}`;r[i]=function(...a){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,a)}),this[s]}}var En;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(En||(En={}));var ac=class Rr extends Ze{constructor(){super(),this.dispatched=!1,this.targets=new ob,this.ignoreTargets=new ob,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Cr.runAndSubscribe(f9,({window:t,disposables:r})=>{r.add(Ge(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(Ge(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(Ge(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:es,disposables:this._store}))}static addTarget(t){if(!Rr.isTouchDevice())return Ze.None;Rr.INSTANCE||(Rr.INSTANCE=new Rr);let r=Rr.INSTANCE.targets.push(t);return Rt(r)}static ignoreTarget(t){if(!Rr.isTouchDevice())return Ze.None;Rr.INSTANCE||(Rr.INSTANCE=new Rr);let r=Rr.INSTANCE.ignoreTargets.push(t);return Rt(r)}static isTouchDevice(){return"ontouchstart"in es||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=t.targetTouches.length;i<n;i++){let s=t.targetTouches.item(i);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let a=this.newGestureEvent(En.Start,s.target);a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),n=Object.keys(this.activeTouches).length;for(let s=0,a=r.changedTouches.length;s<a;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=Date.now()-u.initialTimeStamp;if(h<Rr.HOLD_DELAY&&Math.abs(u.initialPageX-_i(u.rollingPageX))<30&&Math.abs(u.initialPageY-_i(u.rollingPageY))<30){let d=this.newGestureEvent(En.Tap,u.initialTarget);d.pageX=_i(u.rollingPageX),d.pageY=_i(u.rollingPageY),this.dispatchEvent(d)}else if(h>=Rr.HOLD_DELAY&&Math.abs(u.initialPageX-_i(u.rollingPageX))<30&&Math.abs(u.initialPageY-_i(u.rollingPageY))<30){let d=this.newGestureEvent(En.Contextmenu,u.initialTarget);d.pageX=_i(u.rollingPageX),d.pageY=_i(u.rollingPageY),this.dispatchEvent(d)}else if(n===1){let d=_i(u.rollingPageX),p=_i(u.rollingPageY),m=_i(u.rollingTimestamps)-u.rollingTimestamps[0],y=d-u.rollingPageX[0],x=p-u.rollingPageY[0],v=[...this.targets].filter(S=>u.initialTarget instanceof Node&&S.contains(u.initialTarget));this.inertia(t,v,i,Math.abs(y)/m,y>0?1:-1,d,Math.abs(x)/m,x>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(En.End,u.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===En.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Rr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===En.Change||t.type===En.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let n=0,s=t.initialTarget;for(;s&&s!==i;)n++,s=s.parentElement;r.push([n,i])}r.sort((i,n)=>i[0]-n[0]);for(let[i,n]of r)n.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,n,s,a,l,u,h){this.handle=B0(t,()=>{let d=Date.now(),p=d-i,m=0,y=0,x=!0;n+=Rr.SCROLL_FRICTION*p,l+=Rr.SCROLL_FRICTION*p,n>0&&(x=!1,m=s*n*p),l>0&&(x=!1,y=u*l*p);let v=this.newGestureEvent(En.Change);v.translationX=m,v.translationY=y,r.forEach(S=>S.dispatchEvent(v)),x||this.inertia(t,r,d,n,s,a+m,l,u,h+y)})}onTouchMove(t){let r=Date.now();for(let i=0,n=t.changedTouches.length;i<n;i++){let s=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let a=this.activeTouches[s.identifier],l=this.newGestureEvent(En.Change,a.initialTarget);l.translationX=s.pageX-_i(a.rollingPageX),l.translationY=s.pageY-_i(a.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),a.rollingPageX.length>3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(s.pageX),a.rollingPageY.push(s.pageY),a.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ac.SCROLL_FRICTION=-.005,ac.HOLD_DELAY=700,ac.CLEAR_TAP_COUNT_TIME=400,Ot([_9],ac,"isTouchDevice",1);var x9=ac,M0=class extends Ze{onclick(e,t){this._register(Ge(e,pr.CLICK,r=>t(new pu(Mn(e),r))))}onmousedown(e,t){this._register(Ge(e,pr.MOUSE_DOWN,r=>t(new pu(Mn(e),r))))}onmouseover(e,t){this._register(Ge(e,pr.MOUSE_OVER,r=>t(new pu(Mn(e),r))))}onmouseleave(e,t){this._register(Ge(e,pr.MOUSE_LEAVE,r=>t(new pu(Mn(e),r))))}onkeydown(e,t){this._register(Ge(e,pr.KEY_DOWN,r=>t(new ub(r))))}onkeyup(e,t){this._register(Ge(e,pr.KEY_UP,r=>t(new ub(r))))}oninput(e,t){this._register(Ge(e,pr.INPUT,t))}onblur(e,t){this._register(Ge(e,pr.BLUR,t))}onfocus(e,t){this._register(Ge(e,pr.FOCUS,t))}onchange(e,t){this._register(Ge(e,pr.CHANGE,t))}ignoreGesture(e){return x9.ignoreTarget(e)}},yb=11,v9=class extends M0{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=yb+"px",this.domNode.style.height=yb+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new eB),this._register(gb(this.bgDomNode,pr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(gb(this.domNode,pr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new g9),this._pointerdownScheduleRepeatTimer=this._register(new E0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Mn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},b9=class Ym{constructor(t,r,i,n,s,a,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,n=n|0,s=s|0,a=a|0,l=l|0),this.rawScrollLeft=n,this.rawScrollTop=l,r<0&&(r=0),n+r>i&&(n=i-r),n<0&&(n=0),s<0&&(s=0),l+s>a&&(l=a-s),l<0&&(l=0),this.width=r,this.scrollWidth=i,this.scrollLeft=n,this.height=s,this.scrollHeight=a,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Ym(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ym(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,n=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,a=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,u=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:a,scrollHeightChanged:l,scrollTopChanged:u}}},S9=class extends Ze{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new b9(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new xb(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=xb.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},_b=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function kg(e,t){let r=t-e;return function(i){return e+r*k9(i)}}function w9(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var xb=class Km{constructor(t,r,i,n){this.from=t,this.to=r,this.duration=n,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,i){if(Math.abs(t-r)>2.5*i){let n,s;return t<r?(n=t+.75*i,s=r-.75*i):(n=t-.75*i,s=r+.75*i),w9(kg(t,n),kg(s,r),.33)}return kg(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),n=this.scrollTop(r);return new _b(i,n,!1)}return new _b(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return Km.start(t,r,i)}static start(t,r,i){i=i+10;let n=Date.now()-10;return new Km(t,r,n,i)}};function C9(e){return Math.pow(e,3)}function k9(e){return 1-C9(1-e)}var T9=class extends Ze{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new E0)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},E9=140,tB=class extends M0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new T9(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new eB),this._shouldRender=!0,this.domNode=_c(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ge(this.domNode.domNode,pr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new v9(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=_c(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ge(this.slider.domNode,pr.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let n=m9(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let s=this._sliderOrthogonalPointerPosition(n),a=Math.abs(s-r);if(XE&&a>E9){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let l=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},rB=class Xm{constructor(t,r,i,n,s,a){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Xm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,n,s){let a=Math.max(0,i-t),l=Math.max(0,a-2*r),u=n>0&&n>i;if(!u)return{computedAvailableSize:Math.round(a),computedIsNeeded:u,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(i*l/n))),d=(l-h)/(n-i),p=s*d;return{computedAvailableSize:Math.round(a),computedIsNeeded:u,computedSliderSize:Math.round(h),computedSliderRatio:d,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=Xm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},B9=class extends tB{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new rB(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,n.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},M9=class extends tB{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new rB(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,n.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},L9=500,vb=50,R9=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Qm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,n=this._rear;do{let s=n===this._front?t:Math.pow(2,-i);if(t-=s,r+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(k0){let r=Mn(t.browserEvent),i=WH(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let n=null,s=new R9(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,n)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let n=Math.abs(t.deltaX),s=Math.abs(t.deltaY),a=Math.abs(r.deltaX),l=Math.abs(r.deltaY),u=Math.max(Math.min(n,a),1),h=Math.max(Math.min(s,l),1),d=Math.max(n,a),p=Math.max(s,l);d%u===0&&p%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Qm.INSTANCE=new Qm;var A9=Qm,D9=class extends M0{constructor(e,t,r){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=I9(t),this._scrollable=r,this._register(this._scrollable.onScroll(n=>{this._onWillScroll.fire(n),this._onDidScroll(n),this._onScroll.fire(n)}));let i={onMouseWheel:n=>this._onMouseWheel(n),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new M9(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new B9(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=_c(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=_c(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=_c(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,n=>this._onMouseOver(n)),this.onmouseleave(this._listenOnDomNode,n=>this._onMouseLeave(n)),this._hideTimeout=this._register(new E0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=jo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Rn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new fb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=jo(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new fb(r))};this._mouseWheelToDispose.push(Ge(this._listenOnDomNode,pr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var n;if((n=e.browserEvent)!=null&&n.defaultPrevented)return;let t=A9.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,a=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&a+s===0?a=s=0:Math.abs(s)>=Math.abs(a)?a=0:s=0),this._options.flipAxes&&([s,a]=[a,s]);let l=!Rn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!a&&(a=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(a=a*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),h={};if(s){let d=vb*s,p=u.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(h,p)}if(a){let d=vb*a,p=u.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(h,p)}h=this._scrollable.validateScrollPosition(h),(u.scrollLeft!==h.scrollLeft||u.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",n=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${n}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),L9)}},P9=class extends D9{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function I9(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Rn&&(t.className+=" mac"),t}var Zm=class extends Ze{constructor(e,t,r,i,n,s,a,l){super(),this._bufferService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new S9({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>B0(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new P9(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Cr.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Rt(()=>this._styleElement.remove())),this._register(Cr.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
480
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Zm=Ot([we(2,Kr),we(3,os),we(4,$E),we(5,Ka),we(6,Xr),we(7,as)],Zm);var Jm=class extends Ze{constructor(e,t,r,i,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(Rt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Jm=Ot([we(1,Kr),we(2,os),we(3,Vc),we(4,as)],Jm);var $9=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Sn={full:0,left:0,center:0,right:0},Ls={full:0,left:0,center:0,right:0},Ul={full:0,left:0,center:0,right:0},Ed=class extends Ze{constructor(e,t,r,i,n,s,a,l){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=n,this._optionsService=s,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new $9,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(Rt(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ls.full=this._canvas.width,Ls.left=e,Ls.center=t,Ls.right=e,this._refreshDrawHeightConstants(),Ul.full=1,Ul.left=1,Ul.center=1+Ls.left,Ul.right=1+Ls.left+Ls.center}_refreshDrawHeightConstants(){Sn.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Sn.left=t,Sn.center=t,Sn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sn.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ul[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Sn[e.position||"full"]/2),Ls[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Sn[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ed=Ot([we(2,Kr),we(3,Vc),we(4,as),we(5,Xr),we(6,Ka),we(7,os)],Ed);var ce;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
481
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ce||(ce={}));var Ou;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Ou||(Ou={}));var iB;(e=>e.ST=`${ce.ESC}\\`)(iB||(iB={}));var ey=class{constructor(e,t,r,i,n,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ce.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ey=Ot([we(2,Kr),we(3,Xr),we(4,qo),we(5,as)],ey);var gr=0,mr=0,yr=0,zt=0,bb={css:"#00000000",rgba:0},Kt;(e=>{function t(n,s,a,l){return l!==void 0?`#${go(n)}${go(s)}${go(a)}${go(l)}`:`#${go(n)}${go(s)}${go(a)}`}e.toCss=t;function r(n,s,a,l=255){return(n<<24|s<<16|a<<8|l)>>>0}e.toRgba=r;function i(n,s,a,l){return{css:e.toCss(n,s,a,l),rgba:e.toRgba(n,s,a,l)}}e.toColor=i})(Kt||(Kt={}));var Tt;(e=>{function t(u,h){if(zt=(h.rgba&255)/255,zt===1)return{css:h.css,rgba:h.rgba};let d=h.rgba>>24&255,p=h.rgba>>16&255,m=h.rgba>>8&255,y=u.rgba>>24&255,x=u.rgba>>16&255,v=u.rgba>>8&255;gr=y+Math.round((d-y)*zt),mr=x+Math.round((p-x)*zt),yr=v+Math.round((m-v)*zt);let S=Kt.toCss(gr,mr,yr),C=Kt.toRgba(gr,mr,yr);return{css:S,rgba:C}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,h,d){let p=Fu.ensureContrastRatio(u.rgba,h.rgba,d);if(p)return Kt.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function n(u){let h=(u.rgba|255)>>>0;return[gr,mr,yr]=Fu.toChannels(h),{css:Kt.toCss(gr,mr,yr),rgba:h}}e.opaque=n;function s(u,h){return zt=Math.round(h*255),[gr,mr,yr]=Fu.toChannels(u.rgba),{css:Kt.toCss(gr,mr,yr,zt),rgba:Kt.toRgba(gr,mr,yr,zt)}}e.opacity=s;function a(u,h){return zt=u.rgba&255,s(u,zt*h/255)}e.multiplyOpacity=a;function l(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=l})(Tt||(Tt={}));var $t;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let s=n.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return gr=parseInt(n.slice(1,2).repeat(2),16),mr=parseInt(n.slice(2,3).repeat(2),16),yr=parseInt(n.slice(3,4).repeat(2),16),Kt.toColor(gr,mr,yr);case 5:return gr=parseInt(n.slice(1,2).repeat(2),16),mr=parseInt(n.slice(2,3).repeat(2),16),yr=parseInt(n.slice(3,4).repeat(2),16),zt=parseInt(n.slice(4,5).repeat(2),16),Kt.toColor(gr,mr,yr,zt);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let s=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return gr=parseInt(s[1]),mr=parseInt(s[2]),yr=parseInt(s[3]),zt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Kt.toColor(gr,mr,yr,zt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gr,mr,yr,zt]=t.getImageData(0,0,1,1).data,zt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Kt.toRgba(gr,mr,yr,zt),css:n}}e.toColor=i})($t||($t={}));var Hr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,s){let a=i/255,l=n/255,u=s/255,h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return h*.2126+d*.7152+p*.0722}e.relativeLuminance2=r})(Hr||(Hr={}));var Fu;(e=>{function t(a,l){if(zt=(l&255)/255,zt===1)return l;let u=l>>24&255,h=l>>16&255,d=l>>8&255,p=a>>24&255,m=a>>16&255,y=a>>8&255;return gr=p+Math.round((u-p)*zt),mr=m+Math.round((h-m)*zt),yr=y+Math.round((d-y)*zt),Kt.toRgba(gr,mr,yr)}e.blend=t;function r(a,l,u){let h=Hr.relativeLuminance(a>>8),d=Hr.relativeLuminance(l>>8);if(Qn(h,d)<u){if(d<h){let y=i(a,l,u),x=Qn(h,Hr.relativeLuminance(y>>8));if(x<u){let v=n(a,l,u),S=Qn(h,Hr.relativeLuminance(v>>8));return x>S?y:v}return y}let p=n(a,l,u),m=Qn(h,Hr.relativeLuminance(p>>8));if(m<u){let y=i(a,l,u),x=Qn(h,Hr.relativeLuminance(y>>8));return m>x?p:y}return p}}e.ensureContrastRatio=r;function i(a,l,u){let h=a>>24&255,d=a>>16&255,p=a>>8&255,m=l>>24&255,y=l>>16&255,x=l>>8&255,v=Qn(Hr.relativeLuminance2(m,y,x),Hr.relativeLuminance2(h,d,p));for(;v<u&&(m>0||y>0||x>0);)m-=Math.max(0,Math.ceil(m*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),v=Qn(Hr.relativeLuminance2(m,y,x),Hr.relativeLuminance2(h,d,p));return(m<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=i;function n(a,l,u){let h=a>>24&255,d=a>>16&255,p=a>>8&255,m=l>>24&255,y=l>>16&255,x=l>>8&255,v=Qn(Hr.relativeLuminance2(m,y,x),Hr.relativeLuminance2(h,d,p));for(;v<u&&(m<255||y<255||x<255);)m=Math.min(255,m+Math.ceil((255-m)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),v=Qn(Hr.relativeLuminance2(m,y,x),Hr.relativeLuminance2(h,d,p));return(m<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=n;function s(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=s})(Fu||(Fu={}));function go(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Qn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var j9=class extends Uc{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Bd=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new $i}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),n=0,s=0,a=0,l=t.getFg(0),u=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==u){if(h-n>1){let d=this._getJoinedRanges(i,a,s,t,n);for(let p=0;p<d.length;p++)r.push(d[p])}n=h,a=s,l=this._workCell.fg,u=this._workCell.bg}s+=this._workCell.getChars().length||Os.length}if(this._bufferService.cols-n>1){let h=this._getJoinedRanges(i,a,s,t,n);for(let d=0;d<h.length;d++)r.push(h[d])}return r}_getJoinedRanges(e,t,r,i,n){let s=e.substring(t,r),a=[];try{a=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let u=this._characterJoiners[l].handler(s);for(let h=0;h<u.length;h++)Bd._mergeRanges(a,u[h])}catch(u){console.error(u)}return this._stringRangesToCellRanges(a,i,n),a}_stringRangesToCellRanges(e,t,r){let i=0,n=!1,s=0,a=e[i];if(a){for(let l=r;l<this._bufferService.cols;l++){let u=t.getWidth(l),h=t.getString(l).length||Os.length;if(u!==0){if(!n&&a[0]<=s&&(a[0]=l,n=!0),a[1]<=s){if(a[1]=l,a=e[++i],!a)break;a[0]<=s?(a[0]=l,n=!0):n=!1}s+=h}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let n=e[i];if(r){if(t[1]<=n[0])return e[i-1][1]=t[1],e;if(t[1]<=n[1])return e[i-1][1]=Math.max(t[1],n[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=n[0])return e.splice(i,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Bd=Ot([we(0,Kr)],Bd);function z9(e){return 57508<=e&&e<=57558}function O9(e){return 9472<=e&&e<=9631}function F9(e){return z9(e)||O9(e)}function N9(){return{css:{canvas:gu(),cell:gu()},device:{canvas:gu(),cell:gu(),char:{width:0,height:0,left:0,top:0}}}}function gu(){return{width:0,height:0}}var ty=class{constructor(e,t,r,i,n,s,a){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=n,this._decorationService=s,this._themeService=a,this._workCell=new $i,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,n,s,a,l,u,h,d){let p=[],m=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,x=e.getNoBgTrimmedLength();r&&x<s+1&&(x=s+1);let v,S=0,C="",E=0,L=0,B=0,R=0,k=!1,A=0,O=!1,V=0,q=0,H=[],Y=h!==-1&&d!==-1;for(let F=0;F<x;F++){e.loadCell(F,this._workCell);let z=this._workCell.getWidth();if(z===0)continue;let $=!1,j=F>=q,W=F,P=this._workCell;if(m.length>0&&F===m[0][0]&&j){let Oe=m.shift(),ht=this._isCellInSelection(Oe[0],t);for(E=Oe[0]+1;E<Oe[1];E++)j&&(j=ht===this._isCellInSelection(E,t));j&&(j=!r||s<Oe[0]||s>=Oe[1]),j?($=!0,P=new j9(this._workCell,e.translateToString(!0,Oe[0],Oe[1]),Oe[1]-Oe[0]),W=Oe[1]-1,z=P.getWidth()):q=Oe[1]}let Q=this._isCellInSelection(F,t),ee=r&&F===s,I=Y&&F>=h&&F<=d,Z=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,Oe=>{Z=!0});let oe=P.getChars()||Os;if(oe===" "&&(P.isUnderline()||P.isOverline())&&(oe=" "),V=z*l-u.get(oe,P.isBold(),P.isItalic()),!v)v=this._document.createElement("span");else if(S&&(Q&&O||!Q&&!O&&P.bg===L)&&(Q&&O&&y.selectionForeground||P.fg===B)&&P.extended.ext===R&&I===k&&V===A&&!ee&&!$&&!Z&&j){P.isInvisible()?C+=Os:C+=oe,S++;continue}else S&&(v.textContent=C),v=this._document.createElement("span"),S=0,C="";if(L=P.bg,B=P.fg,R=P.extended.ext,k=I,A=V,O=Q,$&&s>=F&&s<=W&&(s=F),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(H.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&H.push("xterm-cursor-blink"),H.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":H.push("xterm-cursor-outline");break;case"block":H.push("xterm-cursor-block");break;case"bar":H.push("xterm-cursor-bar");break;case"underline":H.push("xterm-cursor-underline");break}}if(P.isBold()&&H.push("xterm-bold"),P.isItalic()&&H.push("xterm-italic"),P.isDim()&&H.push("xterm-dim"),P.isInvisible()?C=Os:C=P.getChars()||Os,P.isUnderline()&&(H.push(`xterm-underline-${P.extended.underlineStyle}`),C===" "&&(C=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())v.style.textDecorationColor=`rgb(${Uc.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let Oe=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&Oe<8&&(Oe+=8),v.style.textDecorationColor=y.ansi[Oe].css}P.isOverline()&&(H.push("xterm-overline"),C===" "&&(C=" ")),P.isStrikethrough()&&H.push("xterm-strikethrough"),I&&(v.style.textDecoration="underline");let X=P.getFgColor(),ne=P.getFgColorMode(),he=P.getBgColor(),ye=P.getBgColorMode(),ve=!!P.isInverse();if(ve){let Oe=X;X=he,he=Oe;let ht=ne;ne=ye,ye=ht}let be,$e,Xe=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,Oe=>{Oe.options.layer!=="top"&&Xe||(Oe.backgroundColorRGB&&(ye=50331648,he=Oe.backgroundColorRGB.rgba>>8&16777215,be=Oe.backgroundColorRGB),Oe.foregroundColorRGB&&(ne=50331648,X=Oe.foregroundColorRGB.rgba>>8&16777215,$e=Oe.foregroundColorRGB),Xe=Oe.options.layer==="top")}),!Xe&&Q&&(be=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=be.rgba>>8&16777215,ye=50331648,Xe=!0,y.selectionForeground&&(ne=50331648,X=y.selectionForeground.rgba>>8&16777215,$e=y.selectionForeground)),Xe&&H.push("xterm-decoration-top");let it;switch(ye){case 16777216:case 33554432:it=y.ansi[he],H.push(`xterm-bg-${he}`);break;case 50331648:it=Kt.toColor(he>>16,he>>8&255,he&255),this._addStyle(v,`background-color:#${Sb((he>>>0).toString(16),"0",6)}`);break;case 0:default:ve?(it=y.foreground,H.push("xterm-bg-257")):it=y.background}switch(be||P.isDim()&&(be=Tt.multiplyOpacity(it,.5)),ne){case 16777216:case 33554432:P.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(v,it,y.ansi[X],P,be,void 0)||H.push(`xterm-fg-${X}`);break;case 50331648:let Oe=Kt.toColor(X>>16&255,X>>8&255,X&255);this._applyMinimumContrast(v,it,Oe,P,be,$e)||this._addStyle(v,`color:#${Sb(X.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(v,it,y.foreground,P,be,$e)||ve&&H.push("xterm-fg-257")}H.length&&(v.className=H.join(" "),H.length=0),!ee&&!$&&!Z&&j?S++:v.textContent=C,V!==this.defaultSpacing&&(v.style.letterSpacing=`${V}px`),p.push(v),F=W}return v&&S&&(v.textContent=C),p}_applyMinimumContrast(e,t,r,i,n,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||F9(i.getCode()))return!1;let a=this._getContrastCache(i),l;if(!n&&!s&&(l=a.getColor(t.rgba,r.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);l=Tt.ensureContrastRatio(n||t,s||r,u),a.setColor((n||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};ty=Ot([we(1,OE),we(2,Xr),we(3,os),we(4,qo),we(5,Vc),we(6,Ka)],ty);function Sb(e,t,r){for(;e.length<r;)e=t+e;return e}var W9=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,i,n,s],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let a=this._measure(e,0);return a>0&&(this._flat[i]=a),a}let n=e;t&&(n+="B"),r&&(n+="I");let s=this._holey.get(n);if(s===void 0){let a=0;t&&(a|=1),r&&(a|=2),s=this._measure(e,a),s>0&&this._holey.set(n,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},H9=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,s=t[1]-n,a=r[1]-n,l=Math.max(s,0),u=Math.min(a,e.rows-1);if(l>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function q9(){return new H9}var Tg="xterm-dom-renderer-owner-",Di="xterm-rows",mu="xterm-fg-",wb="xterm-bg-",Vl="xterm-focus",yu="xterm-selection",U9=1,ry=class extends Ze{constructor(e,t,r,i,n,s,a,l,u,h,d,p,m,y){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=n,this._helperContainer=s,this._linkifier2=a,this._charSizeService=u,this._optionsService=h,this._bufferService=d,this._coreService=p,this._coreBrowserService=m,this._themeService=y,this._terminalClass=U9++,this._rowElements=[],this._selectionRenderModel=q9(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Di),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(yu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=N9(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(ty,document),this._element.classList.add(Tg+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(Rt(()=>{this._element.classList.remove(Tg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new W9(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Di} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Di} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Di} .xterm-dim { color: ${Tt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Di}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Di}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Di}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${yu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${yu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${yu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,a]of e.ansi.entries())t+=`${this._terminalSelector} .${mu}${s} { color: ${a.css}; }${this._terminalSelector} .${mu}${s}.xterm-dim { color: ${Tt.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${wb}${s} { background-color: ${a.css}; }`;t+=`${this._terminalSelector} .${mu}257 { color: ${Tt.opaque(e.background).css}; }${this._terminalSelector} .${mu}257.xterm-dim { color: ${Tt.multiplyOpacity(Tt.opaque(e.background),.5).css}; }${this._terminalSelector} .${wb}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let u=e[0]>t[0];l.appendChild(this._createSelectionElement(s,u?t[0]:e[0],u?e[0]:t[0],a-s+1))}else{let u=i===s?e[0]:0,h=s===n?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,u,h));let d=a-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==a){let p=n===a?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,p))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,i=1){let n=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-t);return s+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-s),n.style.height=`${i*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${s}px`,n.style.width=`${a}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,i=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=t;u++){let h=u+r.ydisp,d=this._rowElements[u],p=r.lines.get(h);if(!d||!p)break;d.replaceChildren(...this._rowFactory.createRow(p,h,h===i,a,l,n,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Tg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,i,n,s){r<0&&(e=0),i<0&&(t=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),i=Math.max(Math.min(i,a),0),n=Math.min(n,this._bufferService.cols);let l=this._bufferService.buffer,u=l.ybase+l.y,h=Math.min(l.x,n-1),d=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,m=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=r;y<=i;++y){let x=y+l.ydisp,v=this._rowElements[y],S=l.lines.get(x);if(!v||!S)break;v.replaceChildren(...this._rowFactory.createRow(S,x,x===u,p,m,h,d,this.dimensions.css.cell.width,this._widthCache,s?y===r?e:0:-1,s?(y===i?t:n)-1:-1))}}};ry=Ot([we(7,S0),we(8,lf),we(9,Xr),we(10,Kr),we(11,qo),we(12,os),we(13,Ka)],ry);var iy=class extends Ze{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new G9(this._optionsService))}catch{this._measureStrategy=this._register(new V9(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};iy=Ot([we(2,Xr)],iy);var nB=class extends Ze{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},V9=class extends nB{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},G9=class extends nB{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Y9=class extends Ze{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new K9(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Cr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ge(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ge(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},K9=class extends Ze{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Wa),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ge(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},X9=class extends Ze{constructor(){super(),this.linkProviders=[],this._register(Rt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function L0(e,t,r){let i=r.getBoundingClientRect(),n=e.getComputedStyle(r),s=parseInt(n.getPropertyValue("padding-left")),a=parseInt(n.getPropertyValue("padding-top"));return[t.clientX-i.left-s,t.clientY-i.top-a]}function Q9(e,t,r,i,n,s,a,l,u){if(!s)return;let h=L0(e,t,r);if(h)return h[0]=Math.ceil((h[0]+(u?a/2:0))/a),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),i+(u?1:0)),h[1]=Math.min(Math.max(h[1],1),n),h}var ny=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,n){return Q9(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=L0(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};ny=Ot([we(0,as),we(1,lf)],ny);var Z9=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},sB={};lH(sB,{getSafariVersion:()=>e7,isChromeOS:()=>cB,isFirefox:()=>oB,isIpad:()=>t7,isIphone:()=>r7,isLegacyEdge:()=>J9,isLinux:()=>R0,isMac:()=>Md,isNode:()=>cf,isSafari:()=>aB,isWindows:()=>lB});var cf=typeof process<"u"&&"title"in process,Gc=cf?"node":navigator.userAgent,Yc=cf?"node":navigator.platform,oB=Gc.includes("Firefox"),J9=Gc.includes("Edge"),aB=/^((?!chrome|android).)*safari/i.test(Gc);function e7(){if(!aB)return 0;let e=Gc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Md=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yc),t7=Yc==="iPad",r7=Yc==="iPhone",lB=["Windows","Win16","Win32","WinCE"].includes(Yc),R0=Yc.indexOf("Linux")>=0,cB=/\bCrOS\b/.test(Gc),hB=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},i7=class extends hB{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},n7=class extends hB{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ld=!cf&&"requestIdleCallback"in window?n7:i7,s7=class{constructor(){this._queue=new Ld}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sy=class extends Ze{constructor(e,t,r,i,n,s,a,l,u){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=n,this._coreBrowserService=l,this._renderer=this._register(new Wa),this._pausedResizeTask=new s7,this._observerDisposable=this._register(new Wa),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Z9((h,d)=>this._renderRows(h,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new o7(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Rt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};sy=Ot([we(2,Xr),we(3,lf),we(4,qo),we(5,Vc),we(6,Kr),we(7,os),we(8,Ka)],sy);var o7=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function a7(e,t,r,i){let n=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return h7(n,s,e,t,r,i)+hf(s,t,r,i)+u7(n,s,e,t,r,i);let a;if(s===t)return a=n>e?"D":"C",Dc(Math.abs(n-e),Ac(a,i));a=s>t?"D":"C";let l=Math.abs(s-t),u=c7(s>t?e:n,r)+(l-1)*r.cols+1+l7(s>t?n:e);return Dc(u,Ac(a,i))}function l7(e,t){return e-1}function c7(e,t){return t.cols-e}function h7(e,t,r,i,n,s){return hf(t,i,n,s).length===0?"":Dc(dB(e,t,e,t-zo(t,n),!1,n).length,Ac("D",s))}function hf(e,t,r,i){let n=e-zo(e,r),s=t-zo(t,r),a=Math.abs(n-s)-d7(e,t,r);return Dc(a,Ac(uB(e,t),i))}function u7(e,t,r,i,n,s){let a;hf(t,i,n,s).length>0?a=i-zo(i,n):a=t;let l=i,u=f7(e,t,r,i,n,s);return Dc(dB(e,a,r,l,u==="C",n).length,Ac(u,s))}function d7(e,t,r){var a;let i=0,n=e-zo(e,r),s=t-zo(t,r);for(let l=0;l<Math.abs(n-s);l++){let u=uB(e,t)==="A"?-1:1;(a=r.buffer.lines.get(n+u*l))!=null&&a.isWrapped&&i++}return i}function zo(e,t){let r=0,i=t.buffer.lines.get(e),n=i==null?void 0:i.isWrapped;for(;n&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),n=i==null?void 0:i.isWrapped;return r}function f7(e,t,r,i,n,s){let a;return hf(r,i,n,s).length>0?a=i-zo(i,n):a=t,e<r&&a<=i||e>=r&&a<i?"C":"D"}function uB(e,t){return e>t?"A":"B"}function dB(e,t,r,i,n,s){let a=e,l=t,u="";for(;(a!==r||l!==i)&&l>=0&&l<s.buffer.lines.length;)a+=n?1:-1,n&&a>s.cols-1?(u+=s.buffer.translateBufferLineToString(l,!1,e,a),a=0,e=0,l++):!n&&a<0&&(u+=s.buffer.translateBufferLineToString(l,!1,0,e+1),a=s.cols-1,e=a,l--);return u+s.buffer.translateBufferLineToString(l,!1,e,a)}function Ac(e,t){let r=t?"O":"[";return ce.ESC+r+e}function Dc(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var p7=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Cb(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Eg=50,g7=15,m7=50,y7=500,_7=" ",x7=new RegExp(_7,"g"),oy=class extends Ze{constructor(e,t,r,i,n,s,a,l,u){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=n,this._mouseService=s,this._optionsService=a,this._renderService=l,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new $i,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new p7(this._bufferService),this._activeSelectionMode=0,this._register(Rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let a=e[1];a<=t[1];a++){let l=r.translateBufferLineToString(a,!0,n,s);i.push(l)}}else{let n=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let s=e[1]+1;s<=t[1]-1;s++){let a=r.lines.get(s),l=r.translateBufferLineToString(s,!0);a!=null&&a.isWrapped?i[i.length-1]+=l:i.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),a=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?i[i.length-1]+=a:i.push(a)}}return i.map(n=>n.replace(x7," ")).join(lB?`\r
|
|
482
|
+
`:`
|
|
483
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),R0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,s;let r=(s=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Cb(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=L0(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Eg),Eg),t/=Eg,t/Math.abs(t)+Math.round(t*(g7-1)))}shouldForceSelection(e){return Md?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),m7)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Md&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<y7&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=a7(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let n=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==i&&(r+=n-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,s=n.lines.get(e[1]);if(!s)return;let a=n.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),u=l,h=e[0]-l,d=0,p=0,m=0,y=0;if(a.charAt(l)===" "){for(;l>0&&a.charAt(l-1)===" ";)l--;for(;u<a.length&&a.charAt(u+1)===" ";)u++}else{let S=e[0],C=e[0];s.getWidth(S)===0&&(d++,S--),s.getWidth(C)===2&&(p++,C++);let E=s.getString(C).length;for(E>1&&(y+=E-1,u+=E-1);S>0&&l>0&&!this._isCharWordSeparator(s.loadCell(S-1,this._workCell));){s.loadCell(S-1,this._workCell);let L=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,S--):L>1&&(m+=L-1,l-=L-1),l--,S--}for(;C<s.length&&u+1<a.length&&!this._isCharWordSeparator(s.loadCell(C+1,this._workCell));){s.loadCell(C+1,this._workCell);let L=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,C++):L>1&&(y+=L-1,u+=L-1),u++,C++}}u++;let x=l+h-d+m,v=Math.min(this._bufferService.cols,u-l+d+p-m-y);if(!(!t&&a.slice(l,u).trim()==="")){if(r&&x===0&&s.getCodePoint(0)!==32){let S=n.lines.get(e[1]-1);if(S&&s.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let E=this._bufferService.cols-C.start;x-=E,v+=E}}}if(i&&x+v===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let S=n.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(v+=C.length)}}return{start:x,length:v}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Cb(r,this._bufferService.cols)}};oy=Ot([we(3,Kr),we(4,qo),we(5,w0),we(6,Xr),we(7,as),we(8,os)],oy);var kb=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Tb=class{constructor(){this._color=new kb,this._css=new kb}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},tr=Object.freeze((()=>{let e=[$t.toColor("#2e3436"),$t.toColor("#cc0000"),$t.toColor("#4e9a06"),$t.toColor("#c4a000"),$t.toColor("#3465a4"),$t.toColor("#75507b"),$t.toColor("#06989a"),$t.toColor("#d3d7cf"),$t.toColor("#555753"),$t.toColor("#ef2929"),$t.toColor("#8ae234"),$t.toColor("#fce94f"),$t.toColor("#729fcf"),$t.toColor("#ad7fa8"),$t.toColor("#34e2e2"),$t.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],n=t[r/6%6|0],s=t[r%6];e.push({css:Kt.toCss(i,n,s),rgba:Kt.toRgba(i,n,s)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Kt.toCss(i,i,i),rgba:Kt.toRgba(i,i,i)})}return e})()),xo=$t.toColor("#ffffff"),lc=$t.toColor("#000000"),Eb=$t.toColor("#ffffff"),Bb=lc,Gl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},v7=xo,ay=class extends Ze{constructor(e){super(),this._optionsService=e,this._contrastCache=new Tb,this._halfContrastCache=new Tb,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xo,background:lc,cursor:Eb,cursorAccent:Bb,selectionForeground:void 0,selectionBackgroundTransparent:Gl,selectionBackgroundOpaque:Tt.blend(lc,Gl),selectionInactiveBackgroundTransparent:Gl,selectionInactiveBackgroundOpaque:Tt.blend(lc,Gl),scrollbarSliderBackground:Tt.opacity(xo,.2),scrollbarSliderHoverBackground:Tt.opacity(xo,.4),scrollbarSliderActiveBackground:Tt.opacity(xo,.5),overviewRulerBorder:xo,ansi:tr.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=_t(e.foreground,xo),t.background=_t(e.background,lc),t.cursor=Tt.blend(t.background,_t(e.cursor,Eb)),t.cursorAccent=Tt.blend(t.background,_t(e.cursorAccent,Bb)),t.selectionBackgroundTransparent=_t(e.selectionBackground,Gl),t.selectionBackgroundOpaque=Tt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=_t(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Tt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?_t(e.selectionForeground,bb):void 0,t.selectionForeground===bb&&(t.selectionForeground=void 0),Tt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Tt.opacity(t.selectionBackgroundTransparent,.3)),Tt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Tt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=_t(e.scrollbarSliderBackground,Tt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=_t(e.scrollbarSliderHoverBackground,Tt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=_t(e.scrollbarSliderActiveBackground,Tt.opacity(t.foreground,.5)),t.overviewRulerBorder=_t(e.overviewRulerBorder,v7),t.ansi=tr.slice(),t.ansi[0]=_t(e.black,tr[0]),t.ansi[1]=_t(e.red,tr[1]),t.ansi[2]=_t(e.green,tr[2]),t.ansi[3]=_t(e.yellow,tr[3]),t.ansi[4]=_t(e.blue,tr[4]),t.ansi[5]=_t(e.magenta,tr[5]),t.ansi[6]=_t(e.cyan,tr[6]),t.ansi[7]=_t(e.white,tr[7]),t.ansi[8]=_t(e.brightBlack,tr[8]),t.ansi[9]=_t(e.brightRed,tr[9]),t.ansi[10]=_t(e.brightGreen,tr[10]),t.ansi[11]=_t(e.brightYellow,tr[11]),t.ansi[12]=_t(e.brightBlue,tr[12]),t.ansi[13]=_t(e.brightMagenta,tr[13]),t.ansi[14]=_t(e.brightCyan,tr[14]),t.ansi[15]=_t(e.brightWhite,tr[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=_t(e.extendedAnsi[i],tr[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};ay=Ot([we(0,Xr)],ay);function _t(e,t){if(e!==void 0)try{return $t.toColor(e)}catch{}return t}var b7=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},S7=class{constructor(){this._services=new b7,this._services.set(S0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=gH(e).sort((s,a)=>s.index-a.index),i=[];for(let s of r){let a=this._services.get(s.id);if(!a)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);i.push(a)}let n=r.length>0?r[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},w7={trace:0,debug:1,info:2,warn:3,error:4,off:5},C7="xterm.js: ",ly=class extends Ze{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=w7[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":C7)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};ly=Ot([we(0,Xr)],ly);var Mb=class extends Ze{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Qe=3,Gt=Object.freeze(new Uc),_u=0,Bg=2,cc=class fB{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Qe);let n=r||$i.fromCharData([0,AE,1,0]);for(let s=0;s<t;++s)this.setCell(s,n);this.length=t}get(t){let r=this._data[t*Qe+0],i=r&2097151;return[this._data[t*Qe+1],r&2097152?this._combined[t]:i?Is(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*Qe+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Qe+0]=t|2097152|r[2]<<22):this._data[t*Qe+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Qe+0]>>22}hasWidth(t){return this._data[t*Qe+0]&12582912}getFg(t){return this._data[t*Qe+1]}getBg(t){return this._data[t*Qe+2]}hasContent(t){return this._data[t*Qe+0]&4194303}getCodePoint(t){let r=this._data[t*Qe+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Qe+0]&2097152}getString(t){let r=this._data[t*Qe+0];return r&2097152?this._combined[t]:r&2097151?Is(r&2097151):""}isProtected(t){return this._data[t*Qe+2]&536870912}loadCell(t,r){return _u=t*Qe,r.content=this._data[_u+0],r.fg=this._data[_u+1],r.bg=this._data[_u+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Qe+0]=r.content,this._data[t*Qe+1]=r.fg,this._data[t*Qe+2]=r.bg}setCellFromCodepoint(t,r,i,n){n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Qe+0]=r|i<<22,this._data[t*Qe+1]=n.fg,this._data[t*Qe+2]=n.bg}addCodepointToCell(t,r,i){let n=this._data[t*Qe+0];n&2097152?this._combined[t]+=Is(r):n&2097151?(this._combined[t]=Is(n&2097151)+Is(r),n&=-2097152,n|=2097152):n=r|1<<22,i&&(n&=-12582913,n|=i<<22),this._data[t*Qe+0]=n}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let n=new $i;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,n));for(let s=0;s<r;++s)this.setCell(t+s,i)}else for(let n=t;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let n=new $i;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,n));for(let s=this.length-r;s<this.length;++s)this.setCell(s,i)}else for(let n=t;n<this.length;++n)this.setCell(n,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,n=!1){if(n){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*Bg<this._data.buffer.byteLength;let i=t*Qe;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);let n=Object.keys(this._combined);for(let a=0;a<n.length;a++){let l=parseInt(n[a],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let a=0;a<s.length;a++){let l=parseInt(s[a],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,i*4*Bg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Bg<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new fB(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Qe+0]&4194303)return t+(this._data[t*Qe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Qe+0]&4194303||this._data[t*Qe+2]&50331648)return t+(this._data[t*Qe+0]>>22);return 0}copyCellsFrom(t,r,i,n,s){let a=t._data;if(s)for(let u=n-1;u>=0;u--){for(let h=0;h<Qe;h++)this._data[(i+u)*Qe+h]=a[(r+u)*Qe+h];a[(r+u)*Qe+2]&268435456&&(this._extendedAttrs[i+u]=t._extendedAttrs[r+u])}else for(let u=0;u<n;u++){for(let h=0;h<Qe;h++)this._data[(i+u)*Qe+h]=a[(r+u)*Qe+h];a[(r+u)*Qe+2]&268435456&&(this._extendedAttrs[i+u]=t._extendedAttrs[r+u])}let l=Object.keys(t._combined);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=r&&(this._combined[h-r+i]=t._combined[h])}}translateToString(t,r,i,n){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let s="";for(;r<i;){let a=this._data[r*Qe+0],l=a&2097151,u=a&2097152?this._combined[r]:l?Is(l):Os;if(s+=u,n)for(let h=0;h<u.length;++h)n.push(r);r+=a>>22||1}return n&&n.push(r),s}};function k7(e,t,r,i,n,s){let a=[];for(let l=0;l<e.length-1;l++){let u=l,h=e.get(++u);if(!h.isWrapped)continue;let d=[e.get(l)];for(;u<e.length&&h.isWrapped;)d.push(h),h=e.get(++u);if(!s&&i>=l&&i<u){l+=d.length-1;continue}let p=0,m=Pc(d,p,t),y=1,x=0;for(;y<d.length;){let S=Pc(d,y,t),C=S-x,E=r-m,L=Math.min(C,E);d[p].copyCellsFrom(d[y],x,m,L,!1),m+=L,m===r&&(p++,m=0),x+=L,x===S&&(y++,x=0),m===0&&p!==0&&d[p-1].getWidth(r-1)===2&&(d[p].copyCellsFrom(d[p-1],r-1,m++,1,!1),d[p-1].setCell(r-1,n))}d[p].replaceCells(m,r,n);let v=0;for(let S=d.length-1;S>0&&(S>p||d[S].getTrimmedLength()===0);S--)v++;v>0&&(a.push(l+d.length-v),a.push(v)),l+=d.length-1}return a}function T7(e,t){let r=[],i=0,n=t[i],s=0;for(let a=0;a<e.length;a++)if(n===a){let l=t[++i];e.onDeleteEmitter.fire({index:a-s,amount:l}),a+=l-1,s+=l,n=t[++i]}else r.push(a);return{layout:r,countRemoved:s}}function E7(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function B7(e,t,r){let i=[],n=e.map((u,h)=>Pc(e,h,t)).reduce((u,h)=>u+h),s=0,a=0,l=0;for(;l<n;){if(n-l<r){i.push(n-l);break}s+=r;let u=Pc(e,a,t);s>u&&(s-=u,a++);let h=e[a].getWidth(s-1)===2;h&&s--;let d=h?r-1:r;i.push(d),l+=d}return i}function Pc(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,n=e[t+1].getWidth(0)===2;return i&&n?r-1:r}var pB=class gB{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=gB._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),jo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};pB._nextId=1;var M7=pB,or={},vo=or.B;or[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};or.A={"#":"£"};or.B=void 0;or[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};or.C=or[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};or.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};or.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};or.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};or.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};or.E=or[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};or.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};or.H=or[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};or["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Lb=4294967295,Rb=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Gt.clone(),this.savedCharset=vo,this.markers=[],this._nullCell=$i.fromCharData([0,AE,1,0]),this._whitespaceCell=$i.fromCharData([0,Os,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ld,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Mb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Td),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Td),this._whitespaceCell}getBlankLine(e,t){return new cc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Lb?Lb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Gt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Mb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(Gt),i=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let a=0;a<this.lines.length;a++)i+=+this.lines.get(a).resize(e,r);let s=0;if(this._rows<t)for(let a=this._rows;a<t;a++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new cc(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new cc(e,r)));else for(let a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let a=this.lines.length-n;a>0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)i+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=k7(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Gt),r);if(i.length>0){let n=T7(this.lines,i);E7(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(Gt),n=r;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new cc(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Gt),n=[],s=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let u=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),u.unshift(l);if(!r){let L=this.ybase+this.y;if(L>=a&&L<a+u.length)continue}let h=u[u.length-1].getTrimmedLength(),d=B7(u,this._cols,e),p=d.length-u.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+p):m=Math.max(0,this.lines.length-this.lines.maxLength+p);let y=[];for(let L=0;L<p;L++){let B=this.getBlankLine(Gt,!0);y.push(B)}y.length>0&&(n.push({start:a+u.length+s,newLines:y}),s+=y.length),u.push(...y);let x=d.length-1,v=d[x];v===0&&(x--,v=d[x]);let S=u.length-p-1,C=h;for(;S>=0;){let L=Math.min(C,v);if(u[x]===void 0)break;if(u[x].copyCellsFrom(u[S],C-L,v-L,L,!0),v-=L,v===0&&(x--,v=d[x]),C-=L,C===0){S--;let B=Math.max(S,0);C=Pc(u,B,this._cols)}}for(let L=0;L<u.length;L++)d[L]<e&&u[L].setCell(d[L],i);let E=p-m;for(;E-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(n.length>0){let a=[],l=[];for(let v=0;v<this.lines.length;v++)l.push(this.lines.get(v));let u=this.lines.length,h=u-1,d=0,p=n[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let m=0;for(let v=Math.min(this.lines.maxLength-1,u+s-1);v>=0;v--)if(p&&p.start>h+m){for(let S=p.newLines.length-1;S>=0;S--)this.lines.set(v--,p.newLines[S]);v++,a.push({index:h+1,amount:p.newLines.length}),m+=p.newLines.length,p=n[++d]}else this.lines.set(v,l[h--]);let y=0;for(let v=a.length-1;v>=0;v--)a[v].index+=y,this.lines.onInsertEmitter.fire(a[v]),y+=a[v].amount;let x=Math.max(0,u+s-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,r=0,i){let n=this.lines.get(e);return n?n.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new M7(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},L7=class extends Ze{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Rb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Rb(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},mB=2,yB=1,cy=class extends Ze{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,mB),this.rows=Math.max(e.rawOptions.rows||0,yB),this.buffers=this._register(new L7(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let n=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let a=r.lines.isFull;s===r.lines.length-1?a?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(s+1,0,i.clone()),a?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let a=s-n+1;r.lines.shiftElements(n+1,a-1,-1),r.lines.set(s,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};cy=Ot([we(0,Xr)],cy);var _a={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Md,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},R7=["normal","bold","100","200","300","400","500","600","700","800","900"],A7=class extends Ze{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={..._a};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in _a))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in _a))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=_a[e]),!D7(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_a[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=R7.includes(t)?t:_a[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function D7(e){return e==="block"||e==="underline"||e==="bar"}function hc(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&hc(e[i],t-1);return r}var Ab=Object.freeze({insertMode:!1}),Db=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hy=class extends Ze{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=hc(Ab),this.decPrivateModes=hc(Db)}reset(){this.modes=hc(Ab),this.decPrivateModes=hc(Db)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};hy=Ot([we(0,Kr),we(1,jE),we(2,Xr)],hy);var Pb={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Mg(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Lg=String.fromCharCode,Ib={DEFAULT:e=>{let t=[Mg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Lg(t[0])}${Lg(t[1])}${Lg(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mg(e,!0)};${e.x};${e.y}${t}`}},uy=class extends Ze{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(Pb))this.addProtocol(i,Pb[i]);for(let i of Object.keys(Ib))this.addEncoding(i,Ib[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};uy=Ot([we(0,Kr),we(1,qo),we(2,Xr)],uy);var Rg=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],P7=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],rr;function I7(e,t){let r=0,i=t.length-1,n;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else if(e<t[n][0])i=n-1;else return!0;return!1}var $7=class{constructor(){if(this.version="6",!rr){rr=new Uint8Array(65536),rr.fill(1),rr[0]=0,rr.fill(0,1,32),rr.fill(0,127,160),rr.fill(2,4352,4448),rr[9001]=2,rr[9002]=2,rr.fill(2,11904,42192),rr[12351]=1,rr.fill(2,44032,55204),rr.fill(2,63744,64256),rr.fill(2,65040,65050),rr.fill(2,65072,65136),rr.fill(2,65280,65377),rr.fill(2,65504,65511);for(let e=0;e<Rg.length;++e)rr.fill(0,Rg[e][0],Rg[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?rr[e]:I7(e,P7)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let n=To.extractWidth(t);n===0?i=!1:n>r&&(r=n)}return To.createPropertyValue(0,r,i)}},To=class Nu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new $7;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,n=t.length;for(let s=0;s<n;++s){let a=t.charCodeAt(s);if(55296<=a&&a<=56319){if(++s>=n)return r+this.wcwidth(a);let h=t.charCodeAt(s);56320<=h&&h<=57343?a=(a-55296)*1024+h-56320+65536:r+=this.wcwidth(h)}let l=this.charProperties(a,i),u=Nu.extractWidth(l);Nu.extractShouldJoin(l)&&(u-=Nu.extractWidth(i)),r+=u,i=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},j7=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function $b(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Yl=2147483647,z7=256,_B=class dy{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>z7)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new dy;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let n=t[i];if(Array.isArray(n))for(let s=0;s<n.length;++s)r.addSubParam(n[s]);else r.addParam(n)}return r}clone(){let t=new dy(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,n))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Yl?Yl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Yl?Yl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-i>0&&(t[r]=this._subParams.slice(i,n))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,n=i[r-1];i[r-1]=~n?Math.min(n*10+t,Yl):t}},Kl=[],O7=class{constructor(){this._state=0,this._active=Kl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Kl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Kl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",af(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Kl,this._id=-1,this._state=0}}},xi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=af(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Xl=[],F7=class{constructor(){this._handlers=Object.create(null),this._active=Xl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Xl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Xl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Xl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",af(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Xl,this._ident=0}},uc=new _B;uc.addParam(0);var jb=class{constructor(e){this._handler=e,this._data="",this._params=uc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():uc,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=af(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=uc,this._data="",this._hitLimit=!1,r));return this._params=uc,this._data="",this._hitLimit=!1,t}},N7=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|i}},Ii=160,W7=(function(){let e=new N7(4095),t=Array.apply(null,Array(256)).map((l,u)=>u),r=(l,u)=>t.slice(l,u),i=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let s=r(0,14),a;e.setDefault(1,0),e.addMany(i,0,2,0);for(a in s)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ii,0,2,0),e.add(Ii,8,5,8),e.add(Ii,6,0,6),e.add(Ii,11,0,11),e.add(Ii,13,13,13),e})(),H7=class extends Ze{constructor(e=W7){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _B,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new O7),this._dcsParser=this._register(new F7),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;n<e.intermediates.length;++n){let s=e.intermediates.charCodeAt(n);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=n}parse(e,t,r){let i=0,n=0,s=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&u>-1){for(;u>=0&&(a=l[u](this._params),a!==!0);u--)if(a instanceof Promise)return this._parseStack.handlerPos=u,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&u>-1){for(;u>=0&&(a=l[u](),a!==!0);u--)if(a instanceof Promise)return this._parseStack.handlerPos=u,a}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(i!==24&&i!==26,r),a)return a;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],a=this._oscParser.end(i!==24&&i!==26,r),a)return a;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(i=e[l],n=this._transitions.table[this.currentState<<8|(i<160?i:Ii)],n>>4){case 2:for(let m=l+1;;++m){if(m>=t||(i=e[m])<32||i>126&&i<Ii){this._printHandler(e,l,m),l=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Ii){this._printHandler(e,l,m),l=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Ii){this._printHandler(e,l,m),l=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Ii){this._printHandler(e,l,m),l=m-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|i],h=u?u.length-1:-1;for(;h>=0&&(a=u[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._preserveStack(3,u,h,n,l),a;h<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++l<t&&(i=e[l])>47&&i<60);l--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let d=this._escHandlers[this._collect<<8|i],p=d?d.length-1:-1;for(;p>=0&&(a=d[p](),a!==!0);p--)if(a instanceof Promise)return this._preserveStack(4,d,p,n,l),a;p<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let m=l+1;;++m)if(m>=t||(i=e[m])===24||i===26||i===27||i>127&&i<Ii){this._dcsParser.put(e,l,m),l=m-1;break}break;case 14:if(a=this._dcsParser.unhook(i!==24&&i!==26),a)return this._preserveStack(6,[],0,n,l),a;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=l+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<Ii){this._oscParser.put(e,l,m),l=m-1;break}break;case 6:if(a=this._oscParser.end(i!==24&&i!==26),a)return this._preserveStack(5,[],0,n,l),a;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},q7=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,U7=/^[\da-f]+$/;function zb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=q7.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),U7.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let n=0;n<3;++n){let s=parseInt(t.slice(r*n,r*n+r),16);i[n]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return i}}function Ag(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function V7(e,t=16){let[r,i,n]=e;return`rgb:${Ag(r,t)}/${Ag(i,t)}/${Ag(n,t)}`}var G7={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Rs=131072,Ob=10;function Fb(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Nb=5e3,Wb=0,Y7=class extends Ze{constructor(e,t,r,i,n,s,a,l,u=new H7){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=n,this._oscLinkService=s,this._coreMouseService=a,this._unicodeService=l,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new fH,this._utf8Decoder=new pH,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Gt.clone(),this._eraseAttrDataInternal=Gt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new fy(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:d.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,d,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:d,data:p})}),this._parser.setDcsHandlerFallback((h,d,p)=>{d==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:d,payload:p})}),this._parser.setPrintHandler((h,d,p)=>this.print(h,d,p)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ce.BEL,()=>this.bell()),this._parser.setExecuteHandler(ce.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ce.BS,()=>this.backspace()),this._parser.setExecuteHandler(ce.HT,()=>this.tab()),this._parser.setExecuteHandler(ce.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ce.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ou.IND,()=>this.index()),this._parser.setExecuteHandler(Ou.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ou.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new xi(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new xi(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new xi(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new xi(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new xi(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new xi(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new xi(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new xi(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new xi(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new xi(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new xi(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new xi(h=>this.restoreCursorColor(h))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let h in or)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new jb((h,d)=>this.requestStatusString(h,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),Nb))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Nb} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,n=this._activeBuffer.y,s=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Rs&&(s=this._parseStack.position+Rs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Rs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Rs))),a||this._dirtyRowTracker.clearRange(),e.length>Rs)for(let h=s;h<e.length;h+=Rs){let d=h+Rs<e.length?h+Rs:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(h,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,d),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,n,p,h),this._logSlowResolvingAsync(r),r}else if(!a){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,n,h,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),u=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);u<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(u,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let i,n,s=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,u=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,d=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let m=this._parser.precedingJoinState;for(let y=t;y<r;++y){if(i=e[y],i<127&&s){let C=s[String.fromCharCode(i)];C&&(i=C.charCodeAt(0))}let x=this._unicodeService.charProperties(i,m);n=To.extractWidth(x);let v=To.extractShouldJoin(x),S=v?To.extractWidth(m):0;if(m=x,a&&this._onA11yChar.fire(Is(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-S>l){if(u){let C=p,E=this._activeBuffer.x-S;for(this._activeBuffer.x=S,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&p instanceof cc&&p.copyCellsFrom(C,E,0,S,!1);E<l;)C.setCellFromCodepoint(E++,0,1,d)}else if(this._activeBuffer.x=l-1,n===2)continue}if(v&&this._activeBuffer.x){let C=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-C,i,n);for(let E=n-S;--E>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(h&&(p.insertCells(this._activeBuffer.x,n-S,this._activeBuffer.getNullCell(d)),p.getWidth(l-1)===2&&p.setCellFromCodepoint(l-1,0,1,d)),p.setCellFromCodepoint(this._activeBuffer.x++,i,n,d),n>0)for(;--n;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=m,this._activeBuffer.x<l&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Fb(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new jb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new xi(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,n=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),i&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Gt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,i=To.extractWidth(t),n=this._activeBuffer.x-i,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),a=new Uint32Array(s.length*r),l=0;for(let h=0;h<s.length;){let d=s.codePointAt(h)||0;a[l++]=d,h+=d>65535?2:1}let u=l;for(let h=1;h<r;++h)a.copyWithin(u,0,l),u+=l;return this.print(a,0,u),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ce.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ce.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ce.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ce.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ce.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,vo),this._charsetService.setgCharset(1,vo),this._charsetService.setgCharset(2,vo),this._charsetService.setgCharset(3,vo);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(v=>(v[v.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",v[v.SET=1]="SET",v[v.RESET=2]="RESET",v[v.PERMANENTLY_SET=3]="PERMANENTLY_SET",v[v.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:s}=this._coreMouseService,a=this._coreService,{buffers:l,cols:u}=this._bufferService,{active:h,alt:d}=l,p=this._optionsService.rawOptions,m=(v,S)=>(a.triggerDataEvent(`${ce.ESC}[${t?"":"?"}${v};${S}$y`),!0),y=v=>v?1:2,x=e.params[0];return t?x===2?m(x,4):x===4?m(x,y(a.modes.insertMode)):x===12?m(x,3):x===20?m(x,y(p.convertEol)):m(x,0):x===1?m(x,y(i.applicationCursorKeys)):x===3?m(x,p.windowOptions.setWinLines?u===80?2:u===132?1:0:0):x===6?m(x,y(i.origin)):x===7?m(x,y(i.wraparound)):x===8?m(x,3):x===9?m(x,y(n==="X10")):x===12?m(x,y(p.cursorBlink)):x===25?m(x,y(!a.isCursorHidden)):x===45?m(x,y(i.reverseWraparound)):x===66?m(x,y(i.applicationKeypad)):x===67?m(x,4):x===1e3?m(x,y(n==="VT200")):x===1002?m(x,y(n==="DRAG")):x===1003?m(x,y(n==="ANY")):x===1004?m(x,y(i.sendFocus)):x===1005?m(x,4):x===1006?m(x,y(s==="SGR")):x===1015?m(x,4):x===1016?m(x,y(s==="SGR_PIXELS")):x===1048?m(x,1):x===47||x===1047||x===1049?m(x,y(h===d)):x===2004?m(x,y(i.bracketedPasteMode)):x===2026?m(x,y(i.synchronizedOutput)):m(x,0)}_updateAttrColor(e,t,r,i,n){return t===2?(e|=50331648,e&=-16777216,e|=Uc.fromColorRGB([r,i,n])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],n=0,s=0;do{if(i[s+n]=e.params[t+s],e.hasSubParams(t+s)){let a=e.getSubParams(t+s),l=0;do i[1]===5&&(n=1),i[s+l+1+n]=a[l];while(++l<a.length&&l+s+1+n<i.length);break}if(i[1]===5&&s+n>=2||i[1]===2&&s+n>=5)break;i[1]&&(n=1)}while(++s+t<e.length&&s+n<i.length);for(let a=2;a<i.length;++a)i[a]===-1&&(i[a]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Gt.fg,e.bg=Gt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let n=0;n<t;n++)r=e.params[n],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=Gt.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=Gt.bg&16777215):r===38||r===48||r===58?n+=this._extractColor(e,n,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=Gt.fg&16777215,i.bg&=-67108864,i.bg|=Gt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ce.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ce.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ce.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Gt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Fb(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ce.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ob&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ob&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),n=r.shift();if(/^\d+$/.exec(i)){let s=parseInt(i);if(Hb(s))if(n==="?")t.push({type:0,index:s});else{let a=zb(n);a&&t.push({type:1,index:s,color:a})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,n=r.findIndex(s=>s.startsWith("id="));return n!==-1&&(i=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let n=zb(r[i]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let n=parseInt(r[i]);Hb(n)&&t.push({type:2,index:n})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,vo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(G7[e[0]],or[e[1]]||vo),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Gt.clone(),this._eraseAttrDataInternal=Gt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new $i;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=a=>(this._coreService.triggerDataEvent(`${ce.ESC}${a}${ce.ESC}\\`),!0),i=this._bufferService.buffer,n=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},fy=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Wb=e,e=t,t=Wb),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};fy=Ot([we(0,Kr)],fy);function Hb(e){return 0<=e&&e<256}var K7=5e7,qb=12,X7=50,Q7=class extends Ze{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>K7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],n=this._action(i,t);if(n){let a=l=>performance.now()-r>=qb?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);n.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(a);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=qb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>X7&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},py=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),u={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._dataByLinkId.set(u.id,u),u.id}let r=e,i=this._getEntryIdKey(r),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let s=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(a,s)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};py=Ot([we(0,Kr)],py);var Ub=!1,Z7=class extends Ze{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Wa),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new S7,this.optionsService=this._register(new A7(e)),this._instantiationService.setService(Xr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(cy)),this._instantiationService.setService(Kr,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ly)),this._instantiationService.setService(jE,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hy)),this._instantiationService.setService(qo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(uy)),this._instantiationService.setService($E,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(To)),this._instantiationService.setService(_H,this.unicodeService),this._charsetService=this._instantiationService.createInstance(j7),this._instantiationService.setService(yH,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(py),this._instantiationService.setService(zE,this._oscLinkService),this._inputHandler=this._register(new Y7(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Cr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Cr.forward(this._bufferService.onResize,this._onResize)),this._register(Cr.forward(this.coreService.onData,this._onData)),this._register(Cr.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Q7((t,r)=>this._inputHandler.parse(t,r))),this._register(Cr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Ub&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Ub=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,mB),t=Math.max(t,yB),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed($b.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>($b(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Rt(()=>{for(let t of e)t.dispose()})}}},J7={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function eq(e,t,r,i){var a;let n={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?n.key=ce.ESC+"OA":n.key=ce.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?n.key=ce.ESC+"OD":n.key=ce.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?n.key=ce.ESC+"OC":n.key=ce.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?n.key=ce.ESC+"OB":n.key=ce.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":ce.DEL,e.altKey&&(n.key=ce.ESC+n.key);break;case 9:if(e.shiftKey){n.key=ce.ESC+"[Z";break}n.key=ce.HT,n.cancel=!0;break;case 13:n.key=e.altKey?ce.ESC+ce.CR:ce.CR,n.cancel=!0;break;case 27:n.key=ce.ESC,e.altKey&&(n.key=ce.ESC+ce.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;s?n.key=ce.ESC+"[1;"+(s+1)+"D":t?n.key=ce.ESC+"OD":n.key=ce.ESC+"[D";break;case 39:if(e.metaKey)break;s?n.key=ce.ESC+"[1;"+(s+1)+"C":t?n.key=ce.ESC+"OC":n.key=ce.ESC+"[C";break;case 38:if(e.metaKey)break;s?n.key=ce.ESC+"[1;"+(s+1)+"A":t?n.key=ce.ESC+"OA":n.key=ce.ESC+"[A";break;case 40:if(e.metaKey)break;s?n.key=ce.ESC+"[1;"+(s+1)+"B":t?n.key=ce.ESC+"OB":n.key=ce.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=ce.ESC+"[2~");break;case 46:s?n.key=ce.ESC+"[3;"+(s+1)+"~":n.key=ce.ESC+"[3~";break;case 36:s?n.key=ce.ESC+"[1;"+(s+1)+"H":t?n.key=ce.ESC+"OH":n.key=ce.ESC+"[H";break;case 35:s?n.key=ce.ESC+"[1;"+(s+1)+"F":t?n.key=ce.ESC+"OF":n.key=ce.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=ce.ESC+"[5;"+(s+1)+"~":n.key=ce.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=ce.ESC+"[6;"+(s+1)+"~":n.key=ce.ESC+"[6~";break;case 112:s?n.key=ce.ESC+"[1;"+(s+1)+"P":n.key=ce.ESC+"OP";break;case 113:s?n.key=ce.ESC+"[1;"+(s+1)+"Q":n.key=ce.ESC+"OQ";break;case 114:s?n.key=ce.ESC+"[1;"+(s+1)+"R":n.key=ce.ESC+"OR";break;case 115:s?n.key=ce.ESC+"[1;"+(s+1)+"S":n.key=ce.ESC+"OS";break;case 116:s?n.key=ce.ESC+"[15;"+(s+1)+"~":n.key=ce.ESC+"[15~";break;case 117:s?n.key=ce.ESC+"[17;"+(s+1)+"~":n.key=ce.ESC+"[17~";break;case 118:s?n.key=ce.ESC+"[18;"+(s+1)+"~":n.key=ce.ESC+"[18~";break;case 119:s?n.key=ce.ESC+"[19;"+(s+1)+"~":n.key=ce.ESC+"[19~";break;case 120:s?n.key=ce.ESC+"[20;"+(s+1)+"~":n.key=ce.ESC+"[20~";break;case 121:s?n.key=ce.ESC+"[21;"+(s+1)+"~":n.key=ce.ESC+"[21~";break;case 122:s?n.key=ce.ESC+"[23;"+(s+1)+"~":n.key=ce.ESC+"[23~";break;case 123:s?n.key=ce.ESC+"[24;"+(s+1)+"~":n.key=ce.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?n.key=ce.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?n.key=ce.DEL:e.keyCode===219?n.key=ce.ESC:e.keyCode===220?n.key=ce.FS:e.keyCode===221&&(n.key=ce.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let l=(a=J7[e.keyCode])==null?void 0:a[e.shiftKey?1:0];if(l)n.key=ce.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(u);e.shiftKey&&(h=h.toUpperCase()),n.key=ce.ESC+h}else if(e.keyCode===32)n.key=ce.ESC+(e.ctrlKey?ce.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),n.key=ce.ESC+u,n.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(n.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?n.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(n.key=ce.US),e.key==="@"&&(n.key=ce.NUL));break}return n}var Wt=0,tq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ld,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ld,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,s)=>this._getKey(n)-this._getKey(s)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<i.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[n]=e[t],t++):i[n]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Wt=this._search(t),Wt===-1)||this._getKey(this._array[Wt])!==t)return!1;do if(this._array[Wt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Wt),!0;while(++Wt<this._array.length&&this._getKey(this._array[Wt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,s)=>n-s),t=0,r=new Array(this._array.length-e.length),i=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:r[i++]=this._array[n];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do yield this._array[Wt];while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do t(this._array[Wt]);while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,n=this._getKey(this._array[i]);if(n>e)r=i-1;else if(n<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},Dg=0,Vb=0,rq=class extends Ze{constructor(){super(),this._decorations=new tq(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new iq(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let i=0,n=0;for(let s of this._decorations.getKeyIterator(t))i=s.options.x??0,n=i+(s.options.width??1),e>=i&&e<n&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,n=>{Dg=n.options.x??0,Vb=Dg+(n.options.width??1),e>=Dg&&e<Vb&&(!r||(n.options.layer??"bottom")===r)&&i(n)})}},iq=class extends Ns{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=$t.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=$t.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},nq=1e3,sq=class{constructor(e,t=nq){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=i-this._lastRefreshMs,s=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Gb=20,Rd=class extends Ze{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new sq(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
484
|
+
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ge(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Rt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Gb+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
485
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Gb+1&&(this._liveRegion.textContent+=Pm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let n=e;n<=t;n++){let s=r.lines.get(r.ydisp+n),a=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,a))||"",u=(r.ydisp+n+1).toString(),h=this._rowElements[n];h&&(l.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=l,this._rowColumns.set(h,a)),h.setAttribute("aria-posinset",u),h.setAttribute("aria-setsize",i),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],n=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(n===s||e.relatedTarget!==i)return;let a,l;if(t===0?(a=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(a=this._rowElements.shift(),l=r,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((l=i.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:u,offset:h})=>{let d=u instanceof Text?u.parentNode:u,p=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let m=this._rowColumns.get(d);if(!m)return console.warn("columns is null. Race condition?"),null;let y=h<m.length?m[h]:m.slice(-1)[0]+1;return y>=this._terminal.cols&&(++p,y=0),{row:p,column:y}},s=n(t),a=n(r);if(!(!s||!a)){if(s.row>a.row||s.row===a.row&&s.column>=a.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(a.row-s.row)*this._terminal.cols-s.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var n,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(n=this._rowColumns.get(e))==null?void 0:n.slice(-1))==null?void 0:s[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Rd=Ot([we(1,S0),we(2,os),we(3,as)],Rd);var gy=class extends Ze{constructor(e,t,r,i,n){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Rt(()=>{var s;jo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ge(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ge(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ge(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ge(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let n=r[i];if(n.classList.contains("xterm"))break;if(n.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,n;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(s=>{s==null||s.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,a]of this._linkProviderService.linkProviders.entries())t?(n=this._activeProviderReplies)!=null&&n.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):a.provideLinks(e.y,l=>{var h,d;if(this._isMouseOut)return;let u=l==null?void 0:l.map(p=>({link:p}));(h=this._activeProviderReplies)==null||h.set(s,u),r=this._checkLinkProviderResult(s,e,r),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let n=t.get(i);if(n)for(let s=0;s<n.length;s++){let a=n[s],l=a.link.range.start.y<e?0:a.link.range.start.x,u=a.link.range.end.y>e?this._bufferService.cols:a.link.range.end.x;for(let h=l;h<=u;h++){if(r.has(h)){n.splice(s--,1);break}r.add(h)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),n=!1;for(let a=0;a<e;a++)(!this._activeProviderReplies.has(a)||this._activeProviderReplies.get(a))&&(n=!0);if(!n&&i){let a=i.find(l=>this._linkAtPosition(l.link,t));a&&(r=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let a=0;a<this._activeProviderReplies.size;a++){let l=(s=this._activeProviderReplies.get(a))==null?void 0:s.find(u=>this._linkAtPosition(u.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&oq(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,jo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,n,s;(i=this._currentLink)!=null&&i.state&&((s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(i,n),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,n=t.y*this._bufferService.cols+t.x;return r<=n&&n<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}}};gy=Ot([we(1,w0),we(2,as),we(3,Kr),we(4,FE)],gy);function oq(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var aq=class extends Z7{constructor(e={}){super(e),this._linkifier=this._register(new Wa),this.browser=sB,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Wa),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(rq),this._instantiationService.setService(Vc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(X9),this._instantiationService.setService(FE,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance($m)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Cr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Cr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Cr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Cr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Rt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let n=Tt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ce.ESC}]${i};${V7(n)}${iB.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Kt.toColor(...t.color));else{let s=r;this._themeService.modifyColors(a=>a[s]=Kt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ce.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ce.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,n=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=s+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ge(this.element,"copy",t=>{this.hasSelection()&&uH(t,this._selectionService)}));let e=t=>dH(t,this.textarea,this.coreService,this.optionsService);this._register(Ge(this.textarea,"paste",e)),this._register(Ge(this.element,"paste",e)),oB?this._register(Ge(this.element,"mousedown",t=>{t.button===2&&ib(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ge(this.element,"contextmenu",t=>{ib(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),R0&&this._register(Ge(this.element,"auxclick",t=>{t.button===1&&RE(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ge(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ge(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ge(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ge(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ge(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ge(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ge(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((n=this.element)==null?void 0:n.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ge(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Dm.get()),cB||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Y9,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(os,this._coreBrowserService),this._register(Ge(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Ge(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(iy,this._document,this._helperContainer),this._instantiationService.setService(lf,this._charSizeService),this._themeService=this._instantiationService.createInstance(ay),this._instantiationService.setService(Ka,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Bd),this._instantiationService.setService(OE,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sy,this.rows,this.screenElement)),this._instantiationService.setService(as,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ey,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ny),this._instantiationService.setService(w0,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(gy,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Zm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(oy,this.element,this.screenElement,i)),this._instantiationService.setService(vH,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Cr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Jm,this.screenElement)),this._register(Ge(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ed,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ed,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ry,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var h,d,p,m,y;let a=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!a)return!1;let l,u;switch(s.overrideType||s.type){case"mousemove":u=32,s.buttons===void 0?(l=3,s.button!==void 0&&(l=s.button<3?s.button:3)):l=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":u=0,l=s.button<3?s.button:3;break;case"mousedown":u=1,l=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let x=s.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(s,(m=(p=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:p.cell)==null?void 0:m.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;u=x<0?0:1,l=4;break;default:return!1}return u===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:l,action:u,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?i.mousemove||(t.addEventListener("mousemove",n.mousemove),i.mousemove=n.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),s&16?i.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),i.wheel=n.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),s&2?i.mouseup||(i.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),s&4?i.mousedrag||(i.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ge(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(s)})),this._register(Ge(t,"wheel",s=>{var a,l,u,h,d;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(h=(u=(l=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:l.device)==null?void 0:u.cell)==null?void 0:h.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let p=ce.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){LE(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=eq(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ce.ETX||r.key===ce.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(lq(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Gt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ce.ESC+"[I"):this.coreService.triggerDataEvent(ce.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ce.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ce.ESC}[6;${n};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function lq(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var cq=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},hq=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new $i)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Yb=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new hq(t)}getNullCell(){return new $i}},uq=class extends Ze{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new Yb(this._core.buffers.normal,"normal"),this._alternate=new Yb(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},dq=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},fq=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},pq=["cols","rows"],wn=0,gq=class extends Ze{constructor(e){super(),this._core=this._register(new aq(e)),this._addonManager=this._register(new cq),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,n)=>{this._checkReadonlyOptions(i),this._core.options[i]=n};for(let i in this._core.options){let n={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,n)}}_checkReadonlyOptions(e){if(pq.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new dq(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new fq(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new uq(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
486
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Dm.get()},set promptLabel(e){Dm.set(e)},get tooMuchOutput(){return Pm.get()},set tooMuchOutput(e){Pm.set(e)}}}_verifyIntegers(...e){for(wn of e)if(wn===1/0||isNaN(wn)||wn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(wn of e)if(wn&&(wn===1/0||isNaN(wn)||wn%1!==0||wn<0))throw new Error("This API only accepts positive integers")}};/**
|
|
487
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
488
|
+
* @license MIT
|
|
489
|
+
*
|
|
490
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
491
|
+
* @license MIT
|
|
492
|
+
*
|
|
493
|
+
* Originally forked from (with the author's permission):
|
|
494
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
495
|
+
* http://bellard.org/jslinux/
|
|
496
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
497
|
+
*/var mq=2,yq=1,_q=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var p;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=a.top+a.bottom,u=a.right+a.left,h=i-l,d=n-u-t;return{cols:Math.max(mq,Math.floor(d/e.css.cell.width)),rows:Math.max(yq,Math.floor(h/e.css.cell.height))}}};/**
|
|
498
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
499
|
+
* @license MIT
|
|
500
|
+
*
|
|
501
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
502
|
+
* @license MIT
|
|
503
|
+
*
|
|
504
|
+
* Originally forked from (with the author's permission):
|
|
505
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
506
|
+
* http://bellard.org/jslinux/
|
|
507
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
508
|
+
*/var xq=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=bq.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:n}=t;this._options.hover(r,i,n)}},t))}};function vq(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var bq=class Wu{static computeLink(t,r,i,n){let s=new RegExp(r.source,(r.flags||"")+"g"),[a,l]=Wu._getWindowedLineStrings(t-1,i),u=a.join(""),h,d=[];for(;h=s.exec(u);){let p=h[0];if(!vq(p))continue;let[m,y]=Wu._mapStrIdx(i,l,0,h.index),[x,v]=Wu._mapStrIdx(i,m,y,p.length);if(m===-1||y===-1||x===-1||v===-1)continue;let S={start:{x:y+1,y:m+1},end:{x:v,y:x+1}};d.push({range:S,text:p,activate:n})}return d}static _getWindowedLineStrings(t,r){let i,n=t,s=t,a=0,l="",u=[];if(i=r.buffer.active.getLine(t)){let h=i.translateToString(!0);if(i.isWrapped&&h[0]!==" "){for(a=0;(i=r.buffer.active.getLine(--n))&&a<2048&&(l=i.translateToString(!0),a+=l.length,u.push(l),!(!i.isWrapped||l.indexOf(" ")!==-1)););u.reverse()}for(u.push(h),a=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&a<2048&&(l=i.translateToString(!0),a+=l.length,u.push(l),l.indexOf(" ")===-1););}return[u,n]}static _mapStrIdx(t,r,i,n){let s=t.buffer.active,a=s.getNullCell(),l=i;for(;n;){let u=s.getLine(r);if(!u)return[-1,-1];for(let h=l;h<u.length;++h){u.getCell(h,a);let d=a.getChars();if(a.getWidth()&&(n-=d.length||1,h===u.length-1&&d==="")){let p=s.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,a),a.getWidth()===2&&(n+=1))}if(n<0)return[r,h]}r++,l=0}return[r,l]}},Sq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function wq(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Cq=class{constructor(e=wq,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||Sq;this._linkProvider=this._terminal.registerLinkProvider(new xq(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const kq="http://localhost:3456",Tq="ws://localhost:3456";function Hu(e,t=GW){var a;if(!((a=e==null?void 0:e.buffer)!=null&&a.active))return"";const r=e.buffer.active,i=r.length,n=Math.max(0,i-t),s=[];for(let l=n;l<i;l++){const u=r.getLine(l);u&&s.push(u.translateToString(!0))}for(;s.length&&!s[s.length-1].trim();)s.pop();return s.join(`
|
|
509
|
+
`)}function xB({data:e,sendEvent:t,onSendToChat:r,embedded:i,sessionId:n,onSessionReady:s,onTerminalReady:a}){const{theme:l}=St(),u=M.useMemo(()=>Bq(l),[l]),h=M.useRef(null),d=M.useRef(null),p=M.useRef(null),m=M.useRef(null),[y,x]=M.useState(!1),[v,S]=M.useState(n||null);M.useEffect(()=>{if(n){S(n);return}let R=!1;async function k(){var A,O,V,q,H,Y;try{const z=await(await fetch(`${kq}/api/pty/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e==null?void 0:e.cwd,cols:((V=(O=(A=p.current)==null?void 0:A.proposeDimensions)==null?void 0:O.call(A))==null?void 0:V.cols)||120,rows:((Y=(H=(q=p.current)==null?void 0:q.proposeDimensions)==null?void 0:H.call(q))==null?void 0:Y.rows)||30})})).json();!R&&z.sessionId&&(S(z.sessionId),s&&s(z.sessionId))}catch{}}return k(),()=>{R=!0}},[e==null?void 0:e.cwd,n,s]),M.useEffect(()=>{if(!h.current)return;const R=new gq({cursorBlink:!0,cursorStyle:"bar",fontSize:14,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',lineHeight:1.4,theme:{background:l.bgPrimary,foreground:l.textBright||"#c9d1d9",cursor:l.accent||"#58a6ff",cursorAccent:l.bgPrimary,selectionBackground:(l.accent||"#58a6ff")+"40",black:"#484f58",red:l.error||"#f85149",green:l.success||"#3fb950",yellow:l.warning||"#d29922",blue:l.accent||"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:l.textPrimary||"#c9d1d9",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"},allowTransparency:!1,scrollback:5e3}),k=new _q,A=new Cq;R.loadAddon(k),R.loadAddon(A),R.open(h.current),k.fit(),d.current=R,p.current=k,a&&a(R);const O=new ResizeObserver(()=>{try{k.fit()}catch{}});return O.observe(h.current),()=>{O.disconnect(),R.dispose(),d.current=null,p.current=null}},[l]),M.useEffect(()=>{if(!v||!d.current)return;const R=d.current,k=new WebSocket(`${Tq}/ws/terminal/${v}`);m.current=k,k.onopen=()=>{if(x(!0),p.current){const V=p.current.proposeDimensions();V&&k.send(JSON.stringify({type:"resize",cols:V.cols,rows:V.rows}))}},k.onmessage=V=>{try{const q=JSON.parse(V.data);q.type==="data"?R.write(q.data):q.type==="exit"&&(R.writeln(`\r
|
|
510
|
+
\x1B[90m[Process exited with code ${q.exitCode}]\x1B[0m`),x(!1))}catch{}},k.onclose=()=>x(!1),k.onerror=()=>x(!1);const A=R.onData(V=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"input",data:V}))}),O=R.onResize(({cols:V,rows:q})=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"resize",cols:V,rows:q}))});return()=>{A.dispose(),O.dispose(),k.close(),m.current=null,x(!1)}},[v]),M.useCallback(()=>{if(p.current)try{p.current.fit()}catch{}},[]);const C=M.useCallback(()=>{if(!d.current)return;const R=Hu(d.current);if(R.trim()){if(r){const k=`**Terminal Output**
|
|
511
|
+
\`\`\`
|
|
512
|
+
${R}
|
|
513
|
+
\`\`\``;r(k)}t&&t("event:terminal-share",{sessionId:v,output:R,lineCount:R.split(`
|
|
514
|
+
`).length})}},[v,r,t]);if(i)return g.jsxs("div",{style:u.embeddedContainer,children:[g.jsxs("div",{style:u.terminalHeader,children:[g.jsxs("div",{style:u.terminalDots,children:[g.jsx("span",{style:{...u.dot,backgroundColor:l.error}}),g.jsx("span",{style:{...u.dot,backgroundColor:l.warning}}),g.jsx("span",{style:{...u.dot,backgroundColor:l.success}})]}),g.jsx("span",{style:u.terminalTitle,children:"Terminal"}),r&&y&&g.jsx("button",{onClick:C,style:u.sendToChatBtn,children:"Send to Chat"}),g.jsx("span",{style:{...u.statusDot,backgroundColor:y?l.success:l.textMuted}})]}),g.jsx("div",{ref:h,style:u.terminalBody})]});if(!e&&!n)return g.jsxs("div",{style:u.empty,children:[g.jsx("div",{style:u.emptyIcon,children:">_"}),g.jsx("p",{style:u.emptyTitle,children:"Interactive Terminal"}),g.jsx("p",{style:u.emptySubtext,children:"A real terminal with full shell access will appear here during lessons."})]});const E=(e==null?void 0:e.validations)||[],L=E.filter(R=>R.passed).length,B=E.length>0&&L===E.length;return g.jsxs("div",{style:u.container,children:[(e==null?void 0:e.task)&&g.jsxs("div",{style:u.taskPanel,children:[g.jsxs("div",{style:u.taskHeader,children:[g.jsx("span",{style:u.taskLabel,children:"Task"}),e.module&&g.jsx("span",{style:u.moduleBadge,children:e.module}),E.length>0&&g.jsxs("span",{style:{...u.progressBadge,color:B?l.success:l.warning},children:[L,"/",E.length]})]}),g.jsx("p",{style:u.taskText,children:e.task}),E.length>0&&g.jsx("div",{style:u.validations,children:E.map((R,k)=>g.jsxs("div",{style:u.validationRow,children:[g.jsx("span",{style:{...u.validationCheck,color:R.passed?l.success:l.textMuted},children:R.passed?"✓":"○"}),g.jsx("span",{style:{...u.validationLabel,color:R.passed?l.textSecondary:l.textPrimary,textDecoration:R.passed?"line-through":"none"},children:R.label})]},k))}),e.hints&&e.hints.length>0&&g.jsx(Eq,{hints:e.hints,theme:l,s:u})]}),g.jsxs("div",{style:u.terminalArea,children:[g.jsxs("div",{style:u.terminalHeader,children:[g.jsxs("div",{style:u.terminalDots,children:[g.jsx("span",{style:{...u.dot,backgroundColor:l.error}}),g.jsx("span",{style:{...u.dot,backgroundColor:l.warning}}),g.jsx("span",{style:{...u.dot,backgroundColor:l.success}})]}),g.jsx("span",{style:u.terminalTitle,children:"Terminal"}),r&&y&&g.jsx("button",{onClick:C,style:u.sendToChatBtn,children:"Send to Chat"}),g.jsx("span",{style:{...u.statusDot,backgroundColor:y?l.success:l.textMuted}})]}),g.jsx("div",{ref:h,style:u.terminalBody})]})]})}function Eq({hints:e,theme:t,s:r}){const[i,n]=M.useState(!1),[s,a]=M.useState(0);return g.jsx("div",{style:r.hintSection,children:i?g.jsxs("div",{children:[g.jsx("p",{style:r.hintText,children:e[s]}),g.jsx("div",{style:r.hintNav,children:s<e.length-1&&g.jsxs("button",{onClick:()=>a(l=>l+1),style:r.hintButton,children:["Next hint (",s+1,"/",e.length,")"]})})]}):g.jsx("button",{onClick:()=>n(!0),style:r.hintButton,children:"Show hint"})})}function Bq(e){return{container:{display:"flex",flexDirection:"column",gap:0,maxWidth:900,margin:"0 auto",border:`1px solid ${e.border}`,borderRadius:12,overflow:"hidden",height:"calc(100vh - 120px)"},embeddedContainer:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},taskPanel:{padding:"16px 20px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexShrink:0},taskHeader:{display:"flex",alignItems:"center",gap:10,marginBottom:8},taskLabel:{fontSize:11,fontWeight:700,color:e.accent,textTransform:"uppercase",letterSpacing:"0.08em"},moduleBadge:{fontSize:11,color:e.textSecondary,backgroundColor:e.bgTertiary,padding:"2px 8px",borderRadius:8},progressBadge:{fontSize:11,fontWeight:600,marginLeft:"auto"},taskText:{fontSize:14,lineHeight:1.6,color:e.textBright,margin:0},validations:{marginTop:12,display:"flex",flexDirection:"column",gap:4},validationRow:{display:"flex",alignItems:"center",gap:8},validationCheck:{fontSize:14,fontWeight:700,width:18,textAlign:"center"},validationLabel:{fontSize:13},hintSection:{marginTop:10},hintButton:{fontSize:12,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}40`,borderRadius:6,padding:"4px 10px",cursor:"pointer"},hintText:{fontSize:13,color:e.warning,margin:"6px 0",lineHeight:1.5},hintNav:{display:"flex",gap:8},terminalArea:{flex:1,display:"flex",flexDirection:"column",backgroundColor:e.bgPrimary,overflow:"hidden"},terminalHeader:{display:"flex",alignItems:"center",gap:10,padding:"8px 14px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.bgTertiary}`,flexShrink:0},terminalDots:{display:"flex",gap:6},dot:{width:10,height:10,borderRadius:"50%"},terminalTitle:{fontSize:12,color:e.textMuted,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'},sendToChatBtn:{fontSize:11,color:e.accent,backgroundColor:"transparent",border:`1px solid ${e.accent}40`,borderRadius:4,padding:"2px 8px",cursor:"pointer",marginLeft:"auto",whiteSpace:"nowrap"},statusDot:{width:6,height:6,borderRadius:"50%"},terminalBody:{flex:1,padding:"4px 8px",overflow:"hidden"},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5,fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',color:e.success},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}const Mq=M.lazy(()=>ct(()=>import("./index-mEoP57az.js"),[])),Kb="http://localhost:3456";function Lq({data:e,sendEvent:t,onSendToChat:r}){const{theme:i}=St(),n=M.useMemo(()=>Aq(i),[i]),[s,a]=M.useState(null),[l,u]=M.useState(0),[h,d]=M.useState([]),[p,m]=M.useState([]),[y,x]=M.useState(50),[v,S]=M.useState(!1),C=M.useRef(null),E=M.useRef(null),L=M.useCallback($=>{E.current=$},[]),B=M.useCallback($=>{const j=E.current?Hu(E.current):"",W=h.filter(I=>I.modified).map(I=>I.name),P=p.filter(I=>I.passed).length;let ee=`${$?"**Workshop Complete**":"**Workshop Progress**"}
|
|
515
|
+
Task: ${(e==null?void 0:e.task)||"N/A"}
|
|
516
|
+
Validations: ${P}/${p.length} passed`;return W.length>0&&(ee+=`
|
|
517
|
+
Files: ${W.join(", ")}`),j.trim()&&(ee+=`
|
|
518
|
+
|
|
519
|
+
\`\`\`terminal
|
|
520
|
+
${j}
|
|
521
|
+
\`\`\``),ee},[h,p,e==null?void 0:e.task]),R=M.useCallback(()=>{const $=B(!0);if(r&&r($),t){const j=E.current?Hu(E.current):"";t("event:workshop-done",{sessionId:s,completed:!0,task:e==null?void 0:e.task,validations:p.map(W=>({label:W.label,passed:W.passed})),files:h.filter(W=>W.modified).map(W=>W.name),output:j})}},[B,r,t,s,e==null?void 0:e.task,p,h]),k=M.useCallback(()=>{const $=B(!1);if(r&&r($),t){const j=E.current?Hu(E.current):"";t("event:workshop-done",{sessionId:s,completed:!1,task:e==null?void 0:e.task,validations:p.map(W=>({label:W.label,passed:W.passed})),files:h.filter(W=>W.modified).map(W=>W.name),output:j})}},[B,r,t,s,e==null?void 0:e.task,p,h]);M.useEffect(()=>{if(!e)return;d((e.files||[]).map(j=>({...j,modified:!1,savedContent:j.content}))),m((e.validations||[]).map(j=>({...j,passed:!1}))),u(0),a(null);async function $(){try{const W=await(await fetch(`${Kb}/api/workshop/setup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.cwd,files:e.files,setup:e.setup})})).json();W.sessionId&&a(W.sessionId)}catch{}}$()},[e]),M.useEffect(()=>{e!=null&&e.validations&&m(e.validations.map($=>({...$})))},[e==null?void 0:e.validations]);const A=M.useCallback($=>{d(j=>j.map((W,P)=>P===l?{...W,content:$||"",modified:!0}:W))},[l]),O=M.useCallback(async()=>{const $=h[l];if(!(!$||!s))try{await fetch(`${Kb}/api/workshop/setup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:null,files:[{name:$.name,content:$.content}]})}),d(j=>j.map((W,P)=>P===l?{...W,modified:!1,savedContent:W.content}:W)),t("event:file-save",{file:$.name,sessionId:s})}catch{}},[h,l,s,t]);M.useEffect(()=>{const $=j=>{(j.metaKey||j.ctrlKey)&&j.key==="s"&&(j.preventDefault(),O())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[O]);const V=M.useCallback($=>{$.preventDefault(),S(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const j=P=>{if(!C.current)return;const Q=C.current.getBoundingClientRect(),ee=(P.clientX-Q.left)/Q.width*100;x(Math.min(Math.max(ee,20),80))},W=()=>{S(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",W)};window.addEventListener("mousemove",j),window.addEventListener("mouseup",W)},[]),q=h[l],H=q&&({bash:"shell",sh:"shell",js:"javascript",py:"python",ts:"typescript"}[q.language]||q.language)||"javascript",Y=i.id==="light"?"light":"vs-dark",F=p.filter($=>$.passed).length,z=p.length>0&&F===p.length;return e?g.jsxs("div",{style:n.container,children:[g.jsxs("div",{style:n.taskBar,children:[g.jsxs("div",{style:n.taskBarLeft,children:[g.jsx("span",{style:n.taskLabel,children:"Workshop"}),e.module&&g.jsx("span",{style:n.moduleBadge,children:e.module})]}),g.jsx("p",{style:n.taskText,children:e.task}),g.jsxs("div",{style:n.taskBarRight,children:[p.length>0&&g.jsx("div",{style:n.validationRow,children:p.map(($,j)=>g.jsxs("span",{style:{...n.validationPill,backgroundColor:$.passed?i.success+"20":i.bgTertiary,color:$.passed?i.success:i.textSecondary,borderColor:$.passed?i.success+"40":i.border},children:[$.passed?"✓":"○"," ",$.label]},j))}),e.hints&&e.hints.length>0&&g.jsx(Rq,{hints:e.hints,theme:i,s:n}),r&&g.jsx("button",{onClick:k,style:n.sendToChatBtn,children:"Send to Chat"}),z&&r&&g.jsx("button",{onClick:R,style:n.doneBtn,children:"Done"})]})]}),g.jsxs("div",{style:n.workspace,ref:C,children:[g.jsxs("div",{style:{...n.editorPane,width:`${y}%`},children:[h.length>1&&g.jsx("div",{style:n.fileTabs,children:h.map(($,j)=>g.jsxs("button",{onClick:()=>u(j),style:{...n.fileTab,backgroundColor:j===l?i.bgPrimary:"transparent",color:j===l?i.textBright:i.textSecondary,borderBottomColor:j===l?i.accent:"transparent"},children:[$.name,$.modified&&g.jsx("span",{style:n.modifiedDot,children:"●"})]},$.name))}),g.jsx("div",{style:n.editorBody,children:q&&g.jsx(M.Suspense,{fallback:g.jsx("div",{style:n.editorLoading,children:"Loading editor..."}),children:g.jsx(Mq,{height:"100%",language:H,value:q.content,onChange:A,theme:Y,options:{minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on",padding:{top:8},renderLineHighlight:"none",overviewRulerBorder:!1,readOnly:q.readonly||!1,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8}}})})}),g.jsxs("div",{style:n.editorFooter,children:[g.jsx("span",{style:n.footerLang,children:H}),(q==null?void 0:q.modified)&&g.jsxs("button",{onClick:O,style:n.saveButton,children:["Save (",navigator.platform.includes("Mac")?"⌘":"Ctrl","+S)"]}),(q==null?void 0:q.readonly)&&g.jsx("span",{style:n.readonlyBadge,children:"read-only"})]})]}),g.jsx("div",{style:{...n.resizeHandle,cursor:"col-resize"},onMouseDown:V,children:g.jsx("div",{style:n.resizeGrip})}),g.jsx("div",{style:{...n.terminalPane,width:`${100-y}%`},children:g.jsx(xB,{embedded:!0,sessionId:s,sendEvent:t,onSendToChat:r,onTerminalReady:L})})]})]}):g.jsxs("div",{style:n.empty,children:[g.jsx("div",{style:n.emptyIcon,children:"🛠"}),g.jsx("p",{style:n.emptyTitle,children:"Workshop"}),g.jsx("p",{style:n.emptySubtext,children:"Interactive coding workshops with editor + terminal will appear here."})]})}function Rq({hints:e,theme:t,s:r}){const[i,n]=M.useState(!1),[s,a]=M.useState(0);return g.jsxs("div",{style:r.hintContainer,children:[g.jsx("button",{onClick:()=>n(!i),style:r.hintToggle,children:i?"Hide hints":"Show hint"}),i&&g.jsxs("div",{style:r.hintPopup,children:[g.jsx("p",{style:r.hintText,children:e[s]}),s<e.length-1&&g.jsxs("button",{onClick:()=>a(l=>l+1),style:r.hintNext,children:["Next hint (",s+1,"/",e.length,")"]})]})]})}function Aq(e){return{container:{display:"flex",flexDirection:"column",height:"calc(100vh - 80px)",overflow:"hidden",border:`1px solid ${e.border}`,borderRadius:12},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0},taskBar:{padding:"12px 20px",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexShrink:0,display:"flex",flexDirection:"column",gap:6},taskBarLeft:{display:"flex",alignItems:"center",gap:10},taskLabel:{fontSize:11,fontWeight:700,color:e.accent,textTransform:"uppercase",letterSpacing:"0.08em"},moduleBadge:{fontSize:11,color:e.textSecondary,backgroundColor:e.bgTertiary,padding:"2px 8px",borderRadius:8},taskText:{fontSize:14,lineHeight:1.5,color:e.textBright,margin:0},taskBarRight:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},validationRow:{display:"flex",gap:6,flexWrap:"wrap"},validationPill:{fontSize:12,padding:"3px 10px",borderRadius:12,border:"1px solid",whiteSpace:"nowrap"},workspace:{flex:1,display:"flex",overflow:"hidden"},editorPane:{display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},terminalPane:{display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},resizeHandle:{width:6,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:e.border,position:"relative",zIndex:5},resizeGrip:{width:3,height:32,borderRadius:2,background:e.textMuted||e.border,opacity:.5},fileTabs:{display:"flex",backgroundColor:e.bgSecondary,borderBottom:`1px solid ${e.border}`,flexShrink:0,overflow:"auto"},fileTab:{padding:"8px 16px",fontSize:13,border:"none",borderBottom:"2px solid transparent",cursor:"pointer",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6,fontFamily:'"SFMono-Regular", Consolas, monospace'},modifiedDot:{fontSize:8,color:e.warning},editorBody:{flex:1,overflow:"hidden",backgroundColor:e.id==="light"?"#ffffff":"#1e1e1e"},editorLoading:{padding:20,color:e.textMuted,fontSize:13},editorFooter:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 12px",backgroundColor:e.bgSecondary,borderTop:`1px solid ${e.border}`,flexShrink:0},footerLang:{fontSize:11,color:e.textMuted,textTransform:"uppercase"},saveButton:{fontSize:12,color:e.accent,backgroundColor:"transparent",border:`1px solid ${e.accent}40`,borderRadius:4,padding:"2px 8px",cursor:"pointer"},readonlyBadge:{fontSize:11,color:e.textMuted,fontStyle:"italic"},hintContainer:{position:"relative",marginLeft:"auto"},hintToggle:{fontSize:12,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}40`,borderRadius:6,padding:"4px 10px",cursor:"pointer"},hintPopup:{position:"absolute",top:"100%",right:0,marginTop:6,padding:"10px 14px",backgroundColor:e.bgPrimary,border:`1px solid ${e.border}`,borderRadius:8,boxShadow:`0 4px 12px ${e.bgPrimary}80`,zIndex:20,minWidth:240,maxWidth:360},hintText:{fontSize:13,color:e.warning,margin:"0 0 8px 0",lineHeight:1.5},hintNext:{fontSize:12,color:e.warning,backgroundColor:"transparent",border:`1px solid ${e.warning}40`,borderRadius:4,padding:"2px 8px",cursor:"pointer"},sendToChatBtn:{fontSize:12,color:e.accent,backgroundColor:"transparent",border:`1px solid ${e.accent}40`,borderRadius:6,padding:"4px 12px",cursor:"pointer",whiteSpace:"nowrap"},doneBtn:{fontSize:12,fontWeight:600,color:"#fff",backgroundColor:e.success,border:"none",borderRadius:6,padding:"5px 16px",cursor:"pointer",whiteSpace:"nowrap"}}}function Xb(e){if(!e||typeof e!="string")return!1;try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}}function Dq({data:e,sendEvent:t,onReportBack:r}){const{theme:i}=St(),n=M.useMemo(()=>Pq(i),[i]),s=M.useRef(null),a=M.useRef(null),[l,u]=M.useState(!1),[h,d]=M.useState(!0),p=(e==null?void 0:e.url)||"",m=(e==null?void 0:e.title)||"",y=(e==null?void 0:e.module)||null,x=(e==null?void 0:e.annotations)||[],v=(e==null?void 0:e.splitUrl)||null,S=Xb(p),C=v?Xb(v):!1;M.useEffect(()=>{u(!1)},[p]);const E=M.useCallback(()=>{u(!0)},[]),L=M.useCallback(()=>{p&&window.open(p,"_blank","noopener,noreferrer")},[p]),B=M.useCallback(()=>{v&&window.open(v,"_blank","noopener,noreferrer")},[v]),R=M.useCallback(()=>{s.current&&(u(!1),s.current.src=p)},[p]),k=M.useCallback(()=>{r&&r(`I'm looking at: ${p}`)},[p,r]);if(!e)return g.jsxs("div",{style:n.empty,children:[g.jsx("div",{style:n.emptyIcon,children:"🌐"}),g.jsx("p",{style:n.emptyTitle,children:"Web Embed"}),g.jsx("p",{style:n.emptySubtext,children:"Real websites will appear here during lessons for inspection and exploration."})]});if(!S)return g.jsxs("div",{style:n.empty,children:[g.jsx("div",{style:n.emptyIcon,children:"⚠️"}),g.jsx("p",{style:n.emptyTitle,children:"Invalid URL"}),g.jsxs("p",{style:n.emptySubtext,children:["The provided URL is not valid for embedding: ",p]})]});const A=v&&C;return g.jsxs("div",{style:n.container,children:[(y||m)&&g.jsxs("div",{style:n.breadcrumb,children:[y&&g.jsx("span",{style:n.breadcrumbModule,children:y}),y&&m&&g.jsx("span",{style:n.breadcrumbSep,children:"/"}),m&&g.jsx("span",{style:n.breadcrumbTitle,children:m})]}),g.jsxs("div",{style:n.toolbar,children:[g.jsxs("div",{style:n.urlBar,children:[g.jsx("span",{style:n.urlIcon,children:"🔒"}),g.jsx("span",{style:n.urlText,title:p,children:p})]}),g.jsxs("div",{style:n.toolbarActions,children:[g.jsx("button",{style:n.toolbarBtn,onClick:R,title:"Refresh",children:"↻"}),x.length>0&&g.jsx("button",{style:{...n.toolbarBtn,...h?n.toolbarBtnActive:{}},onClick:()=>d(O=>!O),title:h?"Hide annotations":"Show annotations",children:"📌"}),r&&g.jsx("button",{style:n.toolbarBtn,onClick:k,title:"Report back to chat",children:"💬"}),g.jsx("button",{style:n.toolbarBtn,onClick:L,title:"Open in new tab",children:"↗"})]})]}),g.jsxs("div",{style:A?n.splitWrapper:n.iframeWrapper,children:[g.jsx("div",{style:A?n.splitPane:n.fullPane,children:l?g.jsxs("div",{style:n.errorFallback,children:[g.jsx("p",{style:n.errorTitle,children:"This site blocks embedding"}),g.jsx("p",{style:n.errorSubtext,children:"Some websites set security headers that prevent them from being displayed in an iframe."}),g.jsx("button",{style:n.openTabBtn,onClick:L,children:"Open in new tab ↗"})]}):g.jsxs("div",{style:n.iframeContainer,children:[g.jsx("iframe",{ref:s,src:p,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",style:n.iframe,title:m||"Embedded website",onError:E}),h&&x.length>0&&g.jsx("div",{style:n.annotationOverlay,children:x.map((O,V)=>g.jsxs("div",{style:{...n.annotation,top:`${O.y??10}%`,left:`${O.x??10}%`},title:O.text||"",children:[g.jsx("span",{style:n.annotationNumber,children:V+1}),O.text&&g.jsx("span",{style:n.annotationText,children:O.text})]},V))})]})}),A&&g.jsxs(g.Fragment,{children:[g.jsx("div",{style:n.splitDivider}),g.jsxs("div",{style:n.splitPane,children:[g.jsxs("div",{style:n.splitUrlBar,children:[g.jsx("span",{style:n.urlIcon,children:"🔒"}),g.jsx("span",{style:n.urlText,title:v,children:v}),g.jsx("button",{style:n.toolbarBtn,onClick:B,title:"Open in new tab",children:"↗"})]}),g.jsx("div",{style:n.iframeContainer,children:g.jsx("iframe",{ref:a,src:v,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",style:n.iframe,title:"Comparison site"})})]})]})]})]})}function Pq(e){return{container:{display:"flex",flexDirection:"column",flex:1,height:"100%",minHeight:0,gap:8},breadcrumb:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:e.textSecondary,flexShrink:0},breadcrumbModule:{color:e.accent,fontWeight:500},breadcrumbSep:{color:e.textMuted},breadcrumbTitle:{color:e.textPrimary},toolbar:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,flexShrink:0},urlBar:{flex:1,display:"flex",alignItems:"center",gap:6,minWidth:0,padding:"4px 8px",backgroundColor:e.bgTertiary,borderRadius:6,overflow:"hidden"},urlIcon:{fontSize:12,flexShrink:0},urlText:{fontSize:12,color:e.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'},toolbarActions:{display:"flex",alignItems:"center",gap:4,flexShrink:0},toolbarBtn:{width:30,height:30,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,color:e.textSecondary,backgroundColor:"transparent",border:"1px solid transparent",borderRadius:6,cursor:"pointer",transition:"background 0.15s ease, border-color 0.15s ease"},toolbarBtnActive:{backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`},iframeWrapper:{flex:1,display:"flex",flexDirection:"column",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,overflow:"hidden",minHeight:0},splitWrapper:{flex:1,display:"flex",flexDirection:"row",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,overflow:"hidden",minHeight:0},fullPane:{flex:1,display:"flex",flexDirection:"column",minHeight:0},splitPane:{flex:1,display:"flex",flexDirection:"column",minWidth:0,minHeight:0},splitDivider:{width:3,backgroundColor:e.border,flexShrink:0},splitUrlBar:{display:"flex",alignItems:"center",gap:6,padding:"4px 10px",borderBottom:`1px solid ${e.border}`,flexShrink:0},iframeContainer:{position:"relative",flex:1,minHeight:0},iframe:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",display:"block"},annotationOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:5},annotation:{position:"absolute",display:"flex",alignItems:"center",gap:6,pointerEvents:"auto",cursor:"default",transform:"translate(-50%, -50%)"},annotationNumber:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,color:"#fff",backgroundColor:e.accent,borderRadius:"50%",boxShadow:"0 2px 8px rgba(0,0,0,0.4)",flexShrink:0},annotationText:{fontSize:12,fontWeight:500,color:e.textBright,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:6,padding:"4px 8px",boxShadow:"0 2px 8px rgba(0,0,0,0.3)",maxWidth:200,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},errorFallback:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:12,padding:32},errorTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},errorSubtext:{fontSize:14,color:e.textSecondary,margin:0,textAlign:"center",maxWidth:400},openTabBtn:{padding:"8px 20px",fontSize:14,fontWeight:500,color:"#fff",backgroundColor:e.accent,border:"none",borderRadius:8,cursor:"pointer",marginTop:8},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}function Iq(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3);if(r<60)return"just now";const i=Math.floor(r/60);if(i<60)return`${i}m ago`;const n=Math.floor(i/60);if(n<24)return`${n}h ago`;const s=Math.floor(n/24);return s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function $q(e){const t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=new Date(r-864e5),n=new Date(r-7*864e5),s={Today:[],Yesterday:[],"This Week":[],Older:[]};for(const a of e){const l=new Date(a.lastActive);l>=r?s.Today.push(a):l>=i?s.Yesterday.push(a):l>=n?s["This Week"].push(a):s.Older.push(a)}return s}function jq({session:e,isActive:t,onSelect:r,onDelete:i,onRename:n,onTogglePin:s}){const{theme:a}=St(),[l,u]=M.useState(!1),[h,d]=M.useState(!1),[p,m]=M.useState(e.title),y=M.useRef(null),x=M.useRef(null);M.useEffect(()=>{h&&x.current&&x.current.focus()},[h]),M.useEffect(()=>{if(!l)return;const S=C=>{y.current&&!y.current.contains(C.target)&&u(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]);const v=()=>{const S=p.trim();S&&S!==e.title&&n(e.sessionId,S),d(!1)};return g.jsxs("div",{onClick:()=>!h&&r(e.sessionId),style:{padding:"10px 12px",borderRadius:8,cursor:"pointer",background:t?`${a.accent}18`:"transparent",borderLeft:t?`3px solid ${a.accent}`:"3px solid transparent",transition:"background 0.15s",position:"relative"},onMouseEnter:S=>{t||(S.currentTarget.style.background=`${a.textPrimary}08`)},onMouseLeave:S=>{t||(S.currentTarget.style.background="transparent")},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[h?g.jsx("input",{ref:x,value:p,onChange:S=>m(S.target.value),onBlur:v,onKeyDown:S=>{S.key==="Enter"&&v(),S.key==="Escape"&&d(!1)},onClick:S=>S.stopPropagation(),style:{flex:1,background:a.bgPrimary,border:`1px solid ${a.accent}`,borderRadius:4,padding:"2px 6px",color:a.textPrimary,fontSize:13,fontFamily:"inherit",outline:"none",minWidth:0}}):g.jsxs("span",{style:{fontSize:13,fontWeight:500,color:t?a.accent:a.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:[e.pinned?"📌 ":"",e.title]}),g.jsx("button",{onClick:S=>{S.stopPropagation(),u(!l)},style:{background:"none",border:"none",color:a.textSecondary,cursor:"pointer",padding:"2px 4px",fontSize:14,lineHeight:1,opacity:.6,flexShrink:0},children:"⋮"})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:3},children:[e.module&&g.jsx("span",{style:{fontSize:10,fontWeight:600,color:a.success,background:`${a.success}18`,padding:"1px 6px",borderRadius:10},children:e.module}),e.topic&&!e.module&&g.jsx("span",{style:{fontSize:10,fontWeight:600,color:a.accent,background:`${a.accent}18`,padding:"1px 6px",borderRadius:10},children:e.topic.slice(0,20)}),g.jsx("span",{style:{fontSize:11,color:a.textSecondary,marginLeft:"auto"},children:Iq(e.lastActive)})]}),e.firstMessage&&g.jsx("div",{style:{fontSize:11,color:a.textSecondary,marginTop:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",opacity:.7},children:e.firstMessage}),l&&g.jsx("div",{ref:y,style:{position:"absolute",top:8,right:8,background:a.bgSecondary,border:`1px solid ${a.border}`,borderRadius:8,padding:4,boxShadow:"0 4px 12px rgba(0,0,0,0.3)",zIndex:100,minWidth:130},children:[{label:"Rename",action:()=>{d(!0),u(!1)}},{label:e.pinned?"Unpin":"Pin",action:()=>{s(e.sessionId,!e.pinned),u(!1)}},{label:"Delete",action:()=>{i(e.sessionId),u(!1)},danger:!0}].map(S=>g.jsx("button",{onClick:C=>{C.stopPropagation(),S.action()},style:{display:"block",width:"100%",padding:"6px 12px",border:"none",borderRadius:4,background:"none",color:S.danger?a.error:a.textPrimary,fontSize:12,cursor:"pointer",textAlign:"left",fontFamily:"inherit"},onMouseEnter:C=>{C.currentTarget.style.background=`${a.textPrimary}10`},onMouseLeave:C=>{C.currentTarget.style.background="none"},children:S.label},S.label))})]})}function zq({open:e,sessions:t,activeSessionId:r,onSelect:i,onNewChat:n,onDelete:s,onRename:a,onTogglePin:l,onClose:u}){const{theme:h}=St(),[d,p]=M.useState(""),m=M.useMemo(()=>{if(!d.trim())return t;const x=d.toLowerCase();return t.filter(v=>{var S,C,E;return((S=v.title)==null?void 0:S.toLowerCase().includes(x))||((C=v.module)==null?void 0:C.toLowerCase().includes(x))||((E=v.topic)==null?void 0:E.toLowerCase().includes(x))})},[t,d]),y=M.useMemo(()=>$q(m),[m]);return e?g.jsxs("div",{style:{width:280,height:"100%",background:h.bgSecondary,borderRight:`1px solid ${h.border}`,display:"flex",flexDirection:"column",position:"relative",zIndex:50,flexShrink:0},children:[g.jsxs("div",{style:{padding:"16px 14px 12px",borderBottom:`1px solid ${h.border}`,display:"flex",alignItems:"center",gap:8},children:[g.jsx("span",{style:{fontSize:15,fontWeight:700,color:h.textBright,flex:1},children:"Sessions"}),g.jsx("button",{onClick:n,style:{background:h.accent,color:"#fff",border:"none",borderRadius:6,padding:"5px 12px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},children:"+ New"}),g.jsx("button",{onClick:u,style:{background:"none",border:"none",color:h.textSecondary,cursor:"pointer",fontSize:16,padding:"2px 4px",lineHeight:1},children:"✕"})]}),g.jsx("div",{style:{padding:"8px 14px"},children:g.jsx("input",{value:d,onChange:x=>p(x.target.value),placeholder:"Search sessions...",style:{width:"100%",padding:"7px 10px",borderRadius:6,border:`1px solid ${h.border}`,background:h.bgPrimary,color:h.textPrimary,fontSize:12,fontFamily:"inherit",outline:"none",boxSizing:"border-box"}})}),g.jsx("div",{style:{flex:1,overflow:"auto",padding:"4px 8px 8px"},children:t.length===0?g.jsx("div",{style:{padding:20,textAlign:"center",color:h.textSecondary,fontSize:13},children:"Start a conversation to create your first session"}):m.length===0?g.jsxs("div",{style:{padding:20,textAlign:"center",color:h.textSecondary,fontSize:13},children:['No sessions match "',d,'"']}):Object.entries(y).map(([x,v])=>v.length===0?null:g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:11,fontWeight:600,color:h.textSecondary,textTransform:"uppercase",letterSpacing:"0.05em",padding:"10px 6px 4px"},children:x}),v.map(S=>g.jsx(jq,{session:S,isActive:S.sessionId===r,onSelect:i,onDelete:s,onRename:a,onTogglePin:l},S.sessionId))]},x))})]}):null}const Oq=[{icon:"🎓",name:"Socratic Teaching",desc:"Guided dialogue that asks questions instead of giving answers — you discover concepts yourself"},{icon:"📚",name:"Module Library",desc:"Browse, install, and search a growing library of learning modules across categories and difficulty levels"},{icon:"🧠",name:"Free-Style Learning",desc:"Ask to learn any topic — the system auto-generates a full module with walkthrough, quiz, and resources on the fly"},{icon:"🗺",name:"Learning Journeys",desc:"Multi-module paths that guide you through a subject in the right order, tracking prerequisites and progress"},{icon:"💬",name:"Q&A from Modules",desc:"Ask questions about any installed module and get answers grounded in the module content"},{icon:"🖥",name:"Visual Canvas",desc:"Rich browser UI with diagrams, quizzes, code playgrounds, terminals, and games — side by side with chat"},{icon:"📟",name:"Terminal Mode",desc:"Full teaching experience in the CLI — no browser needed, with real PTY terminal sessions"},{icon:"🧩",name:"Chrome Extension",desc:"Detects what you're reading and suggests relevant modules — privacy-first, reads only page title and meta tags"},{icon:"🏆",name:"Gamification",desc:"XP, belt ranks, streaks, and 26 achievements to keep you motivated and track your growth"},{icon:"✍",name:"Module Authoring",desc:"Create your own modules with guided step-by-step authoring, or build full module packs"},{icon:"💾",name:"Progress Tracking",desc:"All progress saved locally in .socrates-progress.yaml — resume any session exactly where you left off"},{icon:"🔄",name:"Session Management",desc:"Multiple chat sessions with history, pinning, renaming, and resume support"}],Fq=[{category:"Interactive Lessons",items:[{icon:"🚶",name:"Walkthrough",desc:"Step-by-step guided lesson with Task / Question / Checkpoint pattern",cmd:"/teach <module>"},{icon:"⚡",name:"Quick Reference",desc:"Concise cheat sheet — key commands, syntax, and patterns at a glance",cmd:"/teach <module> --quick"},{icon:"🤖",name:"Implement Mode",desc:"AI implements and explains as it goes — watch and learn from working code",cmd:"/teach <module> --implement"}]},{category:"Quizzes",items:[{icon:"🎯",name:"Timed Choice",desc:"Multiple-choice questions with a countdown timer — test speed and recall"},{icon:"🔀",name:"Drag & Order",desc:"Arrange items in the correct sequence — great for learning workflows and pipelines"},{icon:"🔗",name:"Matching",desc:"Connect related concepts — pair commands with descriptions, terms with definitions"},{icon:"✏",name:"Fill in the Blank",desc:"Complete code snippets or commands from memory — tests precise recall"}]},{category:"Games",items:[{icon:"⌨",name:"Command Sprint",desc:"Type the correct command as fast as you can — timed challenges with alternates accepted"},{icon:"🎭",name:"Scenario",desc:"Choose-your-own-adventure with health points — make decisions and face consequences"},{icon:"🐛",name:"Bug Hunt",desc:"Find and fix bugs in code snippets before time runs out"},{icon:"⚡",name:"Speed Round",desc:"Rapid-fire questions — answer as many as you can in the time limit"},{icon:"🏷",name:"Classify",desc:"Sort items into the correct categories — drag and drop under pressure"},{icon:"🧠",name:"Memory Match",desc:"Flip cards to find matching pairs — reinforce associations between concepts"}]},{category:"Hands-On Practice",items:[{icon:"💻",name:"Code Playground",desc:"Write and run code (Bash, JavaScript, Python) with instant feedback in a sandboxed environment"},{icon:"📟",name:"Real Terminal",desc:"Full PTY terminal session — run real commands with Socratic guidance and validation"},{icon:"🔧",name:"Workshop",desc:"Split-pane terminal + code editor — build real projects with step-by-step scenarios"},{icon:"💪",name:"Exercises",desc:"Practice tasks with validation checklists and progressive hints — verify your own work"}]},{category:"Visual Learning",items:[{icon:"📊",name:"Mermaid Diagrams",desc:"Auto-generated flowcharts, sequence diagrams, and architecture views rendered live"},{icon:"🔀",name:"Flow Diagrams",desc:"Step-by-step visual flows that animate concepts like Git branching or data pipelines"},{icon:"🏗",name:"Architecture Diagrams",desc:"System architecture views showing how components connect and communicate"},{icon:"🌐",name:"HTML Content",desc:"Rich media — embedded videos, interactive demos, and curated visual resources"}]}],Nq=[{file:"module.yaml",desc:"Metadata — title, XP values, difficulty, prerequisites, trigger phrases, visual types",icon:"⚙"},{file:"content.md",desc:"Core reading material that covers the topic in depth",icon:"📖"},{file:"walkthrough.md",desc:"Step-by-step guided lesson using the Task → Question → Checkpoint pattern",icon:"🚶"},{file:"quiz.md",desc:"Multiple-choice assessment with hidden answers and explanations",icon:"❓"},{file:"exercises.md",desc:"Hands-on practice tasks with validation checklists and progressive hints",icon:"💪"},{file:"resources.md",desc:"Curated external links — docs, videos, interactive tools",icon:"🔗"},{file:"game.yaml",desc:"Interactive games — command sprints, scenario-based challenges",icon:"🎮"},{file:"workshop.yaml",desc:"Live terminal + code editor sessions with real-time validation",icon:"🔧"}],Qb=[{label:"Resolve Module",detail:"Find the module in registries (built-in, local, generated)"},{label:"Resume Progress",detail:"Load .socrates-progress.yaml to pick up where you left off"},{label:"Present Task",detail:"Show the next walkthrough step with a concrete task to perform"},{label:"Ask Question",detail:"Pose a Socratic question — make the learner think before acting"},{label:"Wait & Observe",detail:"Watch terminal commands, code runs, or quiz answers in real time"},{label:"Socratic Feedback",detail:"Guide with follow-up questions, not just right/wrong"},{label:"Confirm Checkpoint",detail:"Verify understanding before advancing to the next step"},{label:"Award XP",detail:"Grant experience points and update belt progress"}],Wq=[{name:"Full",badge:"⬡",desc:"Canvas + Chat — visual diagrams, interactive quizzes, code playgrounds, and guided chat side by side",color:"accent"},{name:"Canvas",badge:"◧",desc:"Visual-only — all canvas features work standalone when no chat is available",color:"success"},{name:"Terminal",badge:"▣",desc:"CLI-only — the complete teaching experience runs in your terminal, no browser needed",color:"warning"}],Hq=[{name:"White",xp:0,color:"#e6e6e6"},{name:"Yellow",xp:50,color:"#f0c040"},{name:"Green",xp:150,color:"#3fb950"},{name:"Blue",xp:300,color:"#58a6ff"},{name:"Purple",xp:500,color:"#bc8cff"},{name:"Brown",xp:800,color:"#a0522d"},{name:"Black",xp:1200,color:"#484f58"}],qq=[{activity:"Walkthrough step",xp:10},{activity:"Quiz complete",xp:20},{activity:"Quiz perfect score",xp:30},{activity:"Exercise complete",xp:15},{activity:"Game complete",xp:25},{activity:"Game perfect score",xp:40},{activity:"Module complete",xp:50},{activity:"Code run (correct)",xp:15}];function Uq(){const{theme:e}=St(),t=M.useMemo(()=>Vq(e),[e]);return g.jsxs("div",{style:t.container,children:[g.jsx("h1",{style:t.title,children:"How Socrates Works"}),g.jsx("p",{style:t.subtitle,children:"A Socratic AI teaching platform that combines guided dialogue, hands-on practice, and gamification to help you truly understand — not just memorize."}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"The Socratic Method"}),g.jsxs("div",{style:t.card,children:[g.jsxs("p",{style:t.text,children:["Socrates follows one core principle: ",g.jsx("strong",{style:t.strong,children:"ask, don't tell."})," Instead of lecturing, the system guides you to discover answers through carefully crafted questions. You write all the code, run all the commands, and arrive at understanding on your own terms."]}),g.jsxs("div",{style:t.patternBox,children:[g.jsx("div",{style:t.patternTitle,children:"Every walkthrough step follows this pattern:"}),g.jsxs("div",{style:t.patternSteps,children:[g.jsxs("div",{style:t.patternStep,children:[g.jsx("span",{style:t.patternIcon,children:"📋"}),g.jsxs("div",{children:[g.jsx("div",{style:t.patternLabel,children:"Task"}),g.jsx("div",{style:t.patternDesc,children:"A concrete action to perform"})]})]}),g.jsx("div",{style:t.patternArrow,children:"→"}),g.jsxs("div",{style:t.patternStep,children:[g.jsx("span",{style:t.patternIcon,children:"🤔"}),g.jsxs("div",{children:[g.jsx("div",{style:t.patternLabel,children:"Question"}),g.jsx("div",{style:t.patternDesc,children:"Think before you act — predict the outcome"})]})]}),g.jsx("div",{style:t.patternArrow,children:"→"}),g.jsxs("div",{style:t.patternStep,children:[g.jsx("span",{style:t.patternIcon,children:"✅"}),g.jsxs("div",{children:[g.jsx("div",{style:t.patternLabel,children:"Checkpoint"}),g.jsx("div",{style:t.patternDesc,children:"Verify understanding before moving on"})]})]})]})]}),g.jsx("p",{style:t.text,children:`When you answer, the system doesn't just say "correct" or "wrong." It responds with follow-up questions that deepen your understanding or gently redirect your thinking.`})]})]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"Features"}),g.jsx("div",{style:t.featureGrid,children:Oq.map(r=>g.jsxs("div",{style:t.featureCard,children:[g.jsx("span",{style:t.featureIcon,children:r.icon}),g.jsxs("div",{children:[g.jsx("div",{style:t.featureName,children:r.name}),g.jsx("div",{style:t.featureDesc,children:r.desc})]})]},r.name))})]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"Lesson Types"}),g.jsx("p",{style:t.text,children:"Modules combine multiple activity types to create a rich, varied learning experience. Each type targets a different way of learning."}),Fq.map(r=>g.jsxs("div",{style:t.lessonGroup,children:[g.jsx("h3",{style:t.lessonGroupTitle,children:r.category}),g.jsx("div",{style:t.lessonGrid,children:r.items.map(i=>g.jsxs("div",{style:t.lessonCard,children:[g.jsxs("div",{style:t.lessonHeader,children:[g.jsx("span",{style:t.lessonIcon,children:i.icon}),g.jsx("span",{style:t.lessonName,children:i.name}),i.cmd&&g.jsx("code",{style:t.lessonCmd,children:i.cmd})]}),g.jsx("div",{style:t.lessonDesc,children:i.desc})]},i.name))})]},r.category))]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"Anatomy of a Module"}),g.jsx("p",{style:t.text,children:"Each learning module is a folder of plain-text files. Together they form a complete learning experience — from reading to practice to assessment."}),g.jsx("div",{style:t.fileGrid,children:Nq.map(r=>g.jsxs("div",{style:t.fileCard,children:[g.jsxs("div",{style:t.fileHeader,children:[g.jsx("span",{style:t.fileIcon,children:r.icon}),g.jsx("code",{style:t.fileName,children:r.file})]}),g.jsx("div",{style:t.fileDesc,children:r.desc})]},r.file))}),g.jsxs("div",{style:t.card,children:[g.jsx("div",{style:t.patternTitle,children:"Example: walkthrough.md step"}),g.jsx("pre",{style:t.codeBlock,children:`## Step 1: Your First Repository
|
|
522
|
+
|
|
523
|
+
**Task:** Create a new directory and initialize it as a Git repository.
|
|
524
|
+
|
|
525
|
+
**Question:** Before we run any commands — what do you think
|
|
526
|
+
\`git init\` actually creates? What would you expect to find
|
|
527
|
+
in the directory afterward?
|
|
528
|
+
|
|
529
|
+
**Checkpoint:** The user should mention the .git hidden directory
|
|
530
|
+
and understand it stores Git's internal data.`})]})]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"The Learning Flow"}),g.jsx("p",{style:t.text,children:"When you start a teaching session, the system orchestrates a feedback loop that adapts to your pace and understanding."}),g.jsx("div",{style:t.flowContainer,children:Qb.map((r,i)=>g.jsxs("div",{style:t.flowStep,children:[g.jsx("div",{style:t.flowNumber,children:i+1}),g.jsxs("div",{style:t.flowContent,children:[g.jsx("div",{style:t.flowLabel,children:r.label}),g.jsx("div",{style:t.flowDetail,children:r.detail})]}),i<Qb.length-1&&g.jsx("div",{style:t.flowConnector})]},i))}),g.jsx("p",{style:{...t.text,...t.textMuted},children:"Steps 3–7 repeat for each walkthrough step, creating a continuous Socratic dialogue until the module is complete."})]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"Three Tiers of Experience"}),g.jsx("p",{style:t.text,children:"Socrates uses progressive enhancement — the teaching experience works everywhere, from a rich visual canvas down to a plain terminal."}),g.jsx("div",{style:t.tierGrid,children:Wq.map(r=>g.jsxs("div",{style:t.tierCard,children:[g.jsx("div",{style:{...t.tierBadge,color:e[r.color]},children:r.badge}),g.jsx("div",{style:{...t.tierName,color:e[r.color]},children:r.name}),g.jsx("div",{style:t.tierDesc,children:r.desc})]},r.name))})]}),g.jsxs("section",{style:t.section,children:[g.jsx("h2",{style:t.sectionTitle,children:"Gamification"}),g.jsxs("div",{style:t.gamifRow,children:[g.jsxs("div",{style:t.gamifCard,children:[g.jsx("h3",{style:t.gamifTitle,children:"Belt System"}),g.jsx("p",{style:t.textSmall,children:"Earn XP to advance through belts — from White to Black."}),g.jsx("div",{style:t.beltList,children:Hq.map(r=>g.jsxs("div",{style:t.beltItem,children:[g.jsx("div",{style:{...t.beltDot,backgroundColor:r.color}}),g.jsx("span",{style:t.beltName,children:r.name}),g.jsxs("span",{style:t.beltXp,children:[r.xp," XP"]})]},r.name))})]}),g.jsxs("div",{style:t.gamifCard,children:[g.jsx("h3",{style:t.gamifTitle,children:"XP Awards"}),g.jsx("p",{style:t.textSmall,children:"Every activity earns experience points."}),g.jsx("div",{style:t.xpTable,children:qq.map(r=>g.jsxs("div",{style:t.xpRow,children:[g.jsx("span",{style:t.xpActivity,children:r.activity}),g.jsxs("span",{style:t.xpValue,children:["+",r.xp," XP"]})]},r.activity))})]}),g.jsxs("div",{style:t.gamifCard,children:[g.jsx("h3",{style:t.gamifTitle,children:"Streaks & Achievements"}),g.jsx("p",{style:t.textSmall,children:"Maintain a daily learning streak to build momentum. Unlock achievements for milestones like completing your first module, earning a perfect quiz score, or reaching a new belt."}),g.jsxs("div",{style:t.achievementExamples,children:[g.jsx("div",{style:t.achievementItem,children:"🔥 Daily streak counter"}),g.jsx("div",{style:t.achievementItem,children:"🎯 Perfect quiz scores"}),g.jsx("div",{style:t.achievementItem,children:"🏅 Belt promotions"}),g.jsx("div",{style:t.achievementItem,children:"📚 Module completions"}),g.jsx("div",{style:t.achievementItem,children:"⚡ Speed challenges"})]})]})]})]}),g.jsxs("footer",{style:t.footer,children:["Start learning with ",g.jsx("code",{style:t.inlineCode,children:"/teach <module>"})," or browse available modules in the Modules tab."]})]})}function Vq(e){const t={backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:10,padding:20};return{container:{maxWidth:900,margin:"0 auto",padding:"8px 0 40px",fontFamily:"inherit"},title:{fontSize:26,fontWeight:700,color:e.textBright,margin:"0 0 6px"},subtitle:{fontSize:14,color:e.textSecondary,lineHeight:1.6,margin:"0 0 28px",maxWidth:640},section:{marginBottom:32},sectionTitle:{fontSize:18,fontWeight:700,color:e.accent,margin:"0 0 10px"},card:t,text:{fontSize:13,lineHeight:1.7,color:e.textPrimary,margin:"0 0 12px"},textMuted:{color:e.textSecondary,fontStyle:"italic"},textSmall:{fontSize:12,color:e.textSecondary,lineHeight:1.5,margin:"0 0 12px"},strong:{color:e.accent,fontWeight:600},patternBox:{...t,margin:"14px 0"},patternTitle:{fontSize:11,fontWeight:600,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12},patternSteps:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},patternStep:{display:"flex",alignItems:"flex-start",gap:8,flex:"1 1 140px",minWidth:140},patternIcon:{fontSize:20,flexShrink:0,marginTop:1},patternLabel:{fontSize:13,fontWeight:600,color:e.textBright},patternDesc:{fontSize:11,color:e.textSecondary,lineHeight:1.4},patternArrow:{fontSize:18,color:e.textMuted,flexShrink:0},featureGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:10,margin:"12px 0"},featureCard:{...t,padding:14,display:"flex",alignItems:"flex-start",gap:10},featureIcon:{fontSize:20,flexShrink:0,marginTop:1},featureName:{fontSize:13,fontWeight:600,color:e.textBright,marginBottom:2},featureDesc:{fontSize:11,color:e.textSecondary,lineHeight:1.5},lessonGroup:{marginBottom:16},lessonGroupTitle:{fontSize:13,fontWeight:700,color:e.textBright,margin:"0 0 8px",paddingLeft:2},lessonGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:10},lessonCard:{...t,padding:14},lessonHeader:{display:"flex",alignItems:"center",gap:6,marginBottom:6,flexWrap:"wrap"},lessonIcon:{fontSize:16,flexShrink:0},lessonName:{fontSize:13,fontWeight:600,color:e.textBright},lessonCmd:{fontSize:10,fontFamily:"monospace",color:e.accent,backgroundColor:e.bgTertiary,padding:"1px 6px",borderRadius:4,marginLeft:"auto"},lessonDesc:{fontSize:11,color:e.textSecondary,lineHeight:1.5},fileGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:10,margin:"12px 0 16px"},fileCard:{...t,padding:14},fileHeader:{display:"flex",alignItems:"center",gap:8,marginBottom:6},fileIcon:{fontSize:16},fileName:{fontSize:12,fontFamily:"monospace",color:e.accent,fontWeight:600},fileDesc:{fontSize:11,color:e.textSecondary,lineHeight:1.5},codeBlock:{backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,padding:14,fontSize:11,fontFamily:"monospace",color:e.textPrimary,lineHeight:1.6,overflowX:"auto",margin:"8px 0 0",whiteSpace:"pre-wrap"},flowContainer:{position:"relative",margin:"12px 0"},flowStep:{display:"flex",alignItems:"flex-start",gap:12,position:"relative",paddingBottom:8},flowNumber:{width:28,height:28,borderRadius:"50%",backgroundColor:e.accent,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,flexShrink:0,zIndex:1},flowContent:{paddingTop:3,flex:1},flowLabel:{fontSize:13,fontWeight:600,color:e.textBright},flowDetail:{fontSize:11,color:e.textSecondary,lineHeight:1.4,marginTop:2},flowConnector:{position:"absolute",left:13,top:28,width:2,height:"calc(100% - 20px)",backgroundColor:e.border},tierGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:12,margin:"12px 0"},tierCard:{...t,padding:18,textAlign:"center"},tierBadge:{fontSize:28,marginBottom:6},tierName:{fontSize:15,fontWeight:700,marginBottom:6},tierDesc:{fontSize:11,color:e.textSecondary,lineHeight:1.5},gamifRow:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:12,margin:"12px 0"},gamifCard:{...t,padding:18},gamifTitle:{fontSize:14,fontWeight:700,color:e.textBright,margin:"0 0 4px"},beltList:{display:"flex",flexDirection:"column",gap:6},beltItem:{display:"flex",alignItems:"center",gap:8,fontSize:12},beltDot:{width:10,height:10,borderRadius:"50%",flexShrink:0},beltName:{color:e.textPrimary,fontWeight:500,flex:1},beltXp:{color:e.textSecondary,fontSize:11,fontFamily:"monospace"},xpTable:{display:"flex",flexDirection:"column",gap:4},xpRow:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12,padding:"3px 0",borderBottom:`1px solid ${e.border}`},xpActivity:{color:e.textPrimary},xpValue:{color:e.success,fontWeight:600,fontFamily:"monospace",fontSize:11},achievementExamples:{display:"flex",flexDirection:"column",gap:6},achievementItem:{fontSize:12,color:e.textPrimary,padding:"4px 8px",backgroundColor:e.bgTertiary,borderRadius:6},footer:{textAlign:"center",fontSize:13,color:e.textSecondary,padding:"20px 0 0",borderTop:`1px solid ${e.border}`},inlineCode:{fontSize:12,fontFamily:"monospace",color:e.accent,backgroundColor:e.bgTertiary,padding:"2px 6px",borderRadius:4}}}const Gq="http://localhost:3456",Yq={code:"💻",server:"🖥",layers:"📦",smartphone:"📱",users:"👥","shield-check":"🛡",brain:"🧠",target:"🎯","bar-chart":"📊",palette:"🎨",terminal:"⌨",book:"📖"};function Kq({onSelectJourney:e,onStartModule:t}){const{theme:r}=St(),[i,n]=M.useState([]),[s,a]=M.useState(null),[l,u]=M.useState(!0),h=M.useMemo(()=>Xq(r),[r]);return M.useEffect(()=>{fetch(`${Gq}/api/journeys`).then(d=>d.ok?d.json():{journeys:[]}).then(d=>{n(d.journeys||[]),a(d.activeJourney||null),u(!1)}).catch(()=>u(!1))},[]),l?g.jsx("div",{style:h.container,children:g.jsx("div",{style:h.loading,children:"Loading journeys..."})}):g.jsxs("div",{style:h.container,children:[g.jsxs("div",{style:h.header,children:[g.jsx("h2",{style:h.title,children:"Learning Journeys"}),g.jsx("p",{style:h.subtitle,children:"Choose a career path to guide your learning"})]}),g.jsx("div",{style:h.grid,children:i.map(d=>{const p=s===d.slug,m=Yq[d.icon]||"📖",{stats:y}=d;return g.jsxs("div",{style:{...h.card,...p?h.cardActive:{}},onClick:()=>e(d),children:[p&&g.jsx("div",{style:h.activeBadge,children:"Active"}),g.jsx("div",{style:h.cardIcon,children:m}),g.jsx("h3",{style:h.cardTitle,children:d.title}),g.jsx("p",{style:h.cardDesc,children:d.description}),g.jsxs("div",{style:h.cardMeta,children:[g.jsxs("span",{style:h.metaItem,children:[y.totalStages," stages"]}),g.jsx("span",{style:h.metaDot,children:"·"}),g.jsxs("span",{style:h.metaItem,children:[y.availableModules," modules"]}),y.comingSoonModules>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{style:h.metaDot,children:"·"}),g.jsxs("span",{style:h.metaComingSoon,children:["+",y.comingSoonModules," coming"]})]})]}),y.estimatedHours&&g.jsxs("div",{style:h.cardTime,children:["~",d.estimatedHours,"h estimated"]}),y.completedModules>0?g.jsxs("div",{style:h.progressSection,children:[g.jsx("div",{style:h.progressBar,children:g.jsx("div",{style:{...h.progressFill,width:`${y.progressPercent}%`}})}),g.jsxs("span",{style:h.progressText,children:[y.completedModules,"/",y.availableModules," modules · ",y.progressPercent,"%"]})]}):g.jsx("div",{style:h.difficultyBadge,children:d.difficulty})]},d.slug)})})]})}function Xq(e){return{container:{maxWidth:960,margin:"0 auto"},loading:{textAlign:"center",padding:40,color:e.textSecondary,fontSize:14},header:{marginBottom:24},title:{fontSize:22,fontWeight:700,color:e.textPrimary,margin:0},subtitle:{fontSize:13,color:e.textSecondary,margin:"6px 0 0 0"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:16},card:{position:"relative",padding:20,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,cursor:"pointer",transition:"border-color 0.15s ease, transform 0.15s ease"},cardActive:{borderColor:e.accent,boxShadow:`0 0 0 1px ${e.accent}44`},activeBadge:{position:"absolute",top:12,right:12,padding:"2px 8px",fontSize:10,fontWeight:600,color:e.accent,backgroundColor:`${e.accent}22`,borderRadius:10,textTransform:"uppercase",letterSpacing:"0.5px"},cardIcon:{fontSize:28,marginBottom:8},cardTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:"0 0 6px 0"},cardDesc:{fontSize:12,color:e.textSecondary,margin:"0 0 12px 0",lineHeight:1.4},cardMeta:{display:"flex",alignItems:"center",gap:4,fontSize:11,color:e.textSecondary,marginBottom:8},metaItem:{color:e.textSecondary},metaDot:{color:e.border},metaComingSoon:{color:e.orange||"#f0883e",fontStyle:"italic"},cardTime:{fontSize:11,color:e.textMuted||e.textSecondary,marginBottom:12},progressSection:{marginTop:8},progressBar:{height:4,borderRadius:2,backgroundColor:e.bgTertiary||e.border,overflow:"hidden",marginBottom:4},progressFill:{height:"100%",borderRadius:2,backgroundColor:e.success||"#3fb950",transition:"width 0.3s ease"},progressText:{fontSize:10,color:e.textSecondary},difficultyBadge:{display:"inline-block",marginTop:8,padding:"2px 8px",fontSize:10,color:e.textSecondary,backgroundColor:e.bgTertiary||`${e.border}66`,borderRadius:10,textTransform:"capitalize"}}}const Qq={code:"💻",server:"🖥",layers:"📦",smartphone:"📱",users:"👥","shield-check":"🛡",brain:"🧠",target:"🎯","bar-chart":"📊",palette:"🎨",terminal:"⌨",book:"📖"},Zq={completed:"✓",in_progress:"●",available:"○",locked:"🔒"};function Jq({journey:e,onBack:t,onStartModule:r,onActivate:i}){const{theme:n}=St(),s=M.useMemo(()=>eU(n),[n]);if(!e)return g.jsxs("div",{style:s.empty,children:[g.jsx("p",{style:s.emptyTitle,children:"No journey selected"}),t&&g.jsx("button",{style:s.backBtn,onClick:t,children:"Browse journeys"})]});const{stages:a=[],stats:l={}}=e,u=Qq[e.icon]||"📖",h=!!e.isActive;return g.jsxs("div",{style:s.container,children:[g.jsx("div",{style:s.header,children:t&&g.jsx("button",{style:s.backBtn,onClick:t,children:"← Back to Journeys"})}),g.jsxs("div",{style:s.heroSection,children:[g.jsx("div",{style:s.heroIcon,children:u}),g.jsxs("div",{style:s.heroInfo,children:[g.jsx("h2",{style:s.heroTitle,children:e.title}),g.jsx("p",{style:s.heroDesc,children:e.description}),g.jsxs("div",{style:s.heroMeta,children:[g.jsx("span",{style:s.metaBadge,children:e.difficulty}),g.jsx("span",{style:s.metaSep,children:"·"}),g.jsxs("span",{style:s.metaText,children:[l.totalStages," stages"]}),g.jsx("span",{style:s.metaSep,children:"·"}),g.jsxs("span",{style:s.metaText,children:[l.availableModules," modules"]}),l.comingSoonModules>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{style:s.metaSep,children:"·"}),g.jsxs("span",{style:s.metaComingSoon,children:["+",l.comingSoonModules," coming"]})]}),e.estimatedHours&&g.jsxs(g.Fragment,{children:[g.jsx("span",{style:s.metaSep,children:"·"}),g.jsxs("span",{style:s.metaText,children:["~",e.estimatedHours,"h"]})]})]})]})]}),l.availableModules>0&&g.jsxs("div",{style:s.progressSection,children:[g.jsxs("div",{style:s.progressHeader,children:[g.jsx("span",{style:s.progressLabel,children:"Progress"}),g.jsxs("span",{style:s.progressValue,children:[l.completedModules,"/",l.availableModules," modules · ",l.progressPercent,"%"]})]}),g.jsx("div",{style:s.progressTrack,children:g.jsx("div",{style:{...s.progressFill,width:`${l.progressPercent}%`}})})]}),i&&!h&&g.jsx("button",{style:s.activateBtn,onClick:()=>i(e),children:l.completedModules>0?"Set as Active Journey":"Start Journey"}),h&&g.jsx("div",{style:s.activeBadge,children:"Active Journey"}),g.jsx("div",{style:s.timeline,children:a.map((d,p)=>{const m=p===a.length-1,y=Zq[d.status]||"○",x=d.status==="completed",v=d.status==="in_progress",S=d.status==="locked";return g.jsxs("div",{style:s.stageBlock,children:[g.jsxs("div",{style:s.stageHeader,children:[g.jsx("div",{style:{...s.stageIconCircle,...x?s.stageIconCompleted:{},...v?s.stageIconActive:{},...S?s.stageIconLocked:{}},children:g.jsx("span",{style:s.stageIconText,children:y})}),g.jsxs("div",{style:s.stageInfo,children:[g.jsxs("div",{style:s.stageNameRow,children:[g.jsxs("span",{style:{...s.stageName,...S?s.stageNameLocked:{}},children:["Stage ",p+1," — ",d.name]}),v&&g.jsx("span",{style:s.stageStatusBadge,children:"In Progress"}),x&&g.jsx("span",{style:s.stageCompletedBadge,children:"Complete"})]}),d.description&&g.jsx("p",{style:{...s.stageDesc,...S?s.stageDescLocked:{}},children:d.description})]})]}),g.jsxs("div",{style:s.stageBody,children:[!m&&g.jsx("div",{style:{...s.connectorLine,...x?s.connectorCompleted:{}}}),g.jsx("div",{style:s.moduleList,children:(d.modules||[]).map((C,E)=>{const L=S&&C.status!=="coming_soon"?"locked":C.status,B=L==="available"||L==="in_progress",R=L==="completed",k=L==="coming_soon",A=L==="locked";return g.jsxs("div",{style:{...s.moduleCard,...B?s.moduleCardClickable:{},...A?s.moduleCardLocked:{},...k?s.moduleCardComingSoon:{}},onClick:B&&r?()=>r(C.slug):void 0,children:[g.jsxs("div",{style:s.moduleLeft,children:[g.jsx("span",{style:{...s.moduleIcon,...R?s.moduleIconCompleted:{},...B?s.moduleIconActive:{},...A?s.moduleIconLocked:{},...k?s.moduleIconComingSoon:{}},children:R?"✓":k?"◌":A?"·":"▸"}),g.jsxs("div",{children:[g.jsx("span",{style:{...s.moduleTitle,...A?s.moduleTitleLocked:{},...k?s.moduleTitleComingSoon:{}},children:C.title}),C.difficulty&&!k&&g.jsx("span",{style:s.moduleDifficulty,children:C.difficulty})]})]}),g.jsxs("div",{style:s.moduleRight,children:[B&&g.jsx("span",{style:s.moduleAction,children:C.status==="in_progress"?"Continue →":"Start →"}),R&&g.jsx("span",{style:s.moduleCompleted,children:"✓ Done"}),k&&g.jsx("span",{style:s.moduleComingSoonLabel,children:"Coming Soon"})]})]},C.slug||E)})})]})]},p)})})]})}function eU(e){const t=e.accent||"#58a6ff",r=e.success||"#3fb950",i=e.orange||"#f0883e",n=e.textMuted||e.textSecondary;return{container:{maxWidth:720,margin:"0 auto",paddingBottom:48},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:300,gap:12},emptyTitle:{fontSize:16,color:e.textSecondary,margin:0},header:{marginBottom:8},backBtn:{padding:"6px 14px",fontSize:13,color:e.textSecondary,backgroundColor:"transparent",border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",fontFamily:"inherit",transition:"border-color 0.15s"},heroSection:{display:"flex",gap:16,alignItems:"flex-start",marginBottom:20},heroIcon:{fontSize:40,lineHeight:1,flexShrink:0,marginTop:2},heroInfo:{flex:1},heroTitle:{margin:0,fontSize:24,fontWeight:700,color:e.textBright||e.textPrimary},heroDesc:{margin:"6px 0 10px",fontSize:13,color:e.textSecondary,lineHeight:1.5},heroMeta:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,fontSize:12},metaBadge:{padding:"2px 8px",fontSize:10,fontWeight:600,color:e.textSecondary,backgroundColor:e.bgTertiary||`${e.border}66`,borderRadius:10,textTransform:"capitalize"},metaSep:{color:e.border},metaText:{color:e.textSecondary},metaComingSoon:{color:i,fontStyle:"italic"},progressSection:{marginBottom:16,padding:"12px 16px",backgroundColor:e.bgSecondary,borderRadius:8,border:`1px solid ${e.border}`},progressHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},progressLabel:{fontSize:12,fontWeight:600,color:e.textSecondary},progressValue:{fontSize:12,color:e.textSecondary},progressTrack:{height:6,borderRadius:3,backgroundColor:e.bgTertiary||e.border,overflow:"hidden"},progressFill:{height:"100%",borderRadius:3,backgroundColor:r,transition:"width 0.4s ease"},activateBtn:{marginBottom:24,padding:"10px 24px",fontSize:14,fontWeight:600,color:"#fff",backgroundColor:t,border:"none",borderRadius:8,cursor:"pointer",fontFamily:"inherit",transition:"opacity 0.15s"},activeBadge:{display:"inline-block",marginBottom:24,padding:"4px 12px",fontSize:11,fontWeight:600,color:r,backgroundColor:`${r}18`,borderRadius:10,textTransform:"uppercase",letterSpacing:"0.5px"},timeline:{position:"relative"},stageBlock:{position:"relative"},stageHeader:{display:"flex",gap:12,alignItems:"flex-start"},stageIconCircle:{width:32,height:32,borderRadius:"50%",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.bgTertiary||e.border,border:`2px solid ${e.border}`,fontSize:14,zIndex:1},stageIconCompleted:{backgroundColor:`${r}22`,borderColor:r},stageIconActive:{backgroundColor:`${t}22`,borderColor:t},stageIconLocked:{opacity:.5},stageIconText:{fontSize:13,lineHeight:1},stageInfo:{flex:1,paddingTop:4},stageNameRow:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},stageName:{fontSize:15,fontWeight:600,color:e.textBright||e.textPrimary},stageNameLocked:{color:n,opacity:.6},stageStatusBadge:{padding:"1px 8px",fontSize:10,fontWeight:600,color:t,backgroundColor:`${t}18`,borderRadius:10,textTransform:"uppercase",letterSpacing:"0.3px"},stageCompletedBadge:{padding:"1px 8px",fontSize:10,fontWeight:600,color:r,backgroundColor:`${r}18`,borderRadius:10,textTransform:"uppercase",letterSpacing:"0.3px"},stageDesc:{margin:"4px 0 0",fontSize:12,color:e.textSecondary,lineHeight:1.4},stageDescLocked:{opacity:.5},stageBody:{position:"relative",marginLeft:15,paddingLeft:28,paddingTop:10,paddingBottom:8},connectorLine:{position:"absolute",left:0,top:0,bottom:0,width:2,backgroundColor:e.border},connectorCompleted:{backgroundColor:r},moduleList:{display:"flex",flexDirection:"column",gap:6},moduleCard:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 14px",borderRadius:8,backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,transition:"border-color 0.15s, background-color 0.15s"},moduleCardClickable:{cursor:"pointer",borderColor:`${t}44`},moduleCardLocked:{opacity:.45},moduleCardComingSoon:{opacity:.55,borderStyle:"dashed"},moduleLeft:{display:"flex",alignItems:"center",gap:10,minWidth:0},moduleIcon:{fontSize:14,width:20,textAlign:"center",flexShrink:0,color:e.textSecondary},moduleIconCompleted:{color:r},moduleIconActive:{color:t},moduleIconLocked:{color:n,opacity:.5},moduleIconComingSoon:{color:i},moduleTitle:{fontSize:13,fontWeight:500,color:e.textPrimary},moduleTitleLocked:{color:n},moduleTitleComingSoon:{color:n,fontStyle:"italic"},moduleDifficulty:{display:"inline-block",marginLeft:8,padding:"1px 6px",fontSize:10,color:e.textSecondary,backgroundColor:e.bgTertiary||`${e.border}44`,borderRadius:8,textTransform:"capitalize",verticalAlign:"middle"},moduleRight:{flexShrink:0,marginLeft:12},moduleAction:{fontSize:12,fontWeight:600,color:t},moduleCompleted:{fontSize:11,color:r,fontWeight:500},moduleComingSoonLabel:{fontSize:11,color:i,fontStyle:"italic"}}}const Zb=[{key:"content.md",label:"Content",icon:"📖"},{key:"walkthrough.md",label:"Walkthrough",icon:"🚶"},{key:"exercises.md",label:"Exercises",icon:"📝"},{key:"quiz.md",label:"Quiz",icon:"❓"},{key:"quick-ref.md",label:"Quick Ref",icon:"⚡"},{key:"resources.md",label:"Resources",icon:"🔗"}];function tU(e,t){if(!e)return null;const r=e.split(`
|
|
531
|
+
`),i=[];let n=0,s=0;for(;n<r.length;){const a=r[n];if(a.trimStart().startsWith("```")){const u=a.trimStart().slice(3).trim(),h=[];for(n++;n<r.length&&!r[n].trimStart().startsWith("```");)h.push(r[n]),n++;n++,i.push(g.jsxs("pre",{style:{backgroundColor:t.bgTertiary,border:`1px solid ${t.border}`,borderRadius:6,padding:"12px 16px",margin:"8px 0",overflowX:"auto",fontSize:13,lineHeight:1.5,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:t.textPrimary},children:[u&&g.jsx("div",{style:{fontSize:11,color:t.textMuted,marginBottom:6},children:u}),g.jsx("code",{children:h.join(`
|
|
532
|
+
`)})]},s++));continue}if(a.trim()===""){n++;continue}const l=a.match(/^(#{1,6})\s+(.+)$/);if(l){const u=l[1].length,h=l[2],d={1:24,2:20,3:17,4:15,5:14,6:13};i.push(g.jsx("div",{style:{fontSize:d[u]||14,fontWeight:u<=2?700:600,color:u<=2?t.textBright:t.textPrimary,marginTop:u<=2?24:16,marginBottom:8,paddingBottom:u<=2?6:0,borderBottom:u<=2?`1px solid ${t.border}`:"none"},children:As(h,t)},s++)),n++;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(a.trim())){i.push(g.jsx("hr",{style:{border:"none",borderTop:`1px solid ${t.border}`,margin:"16px 0"}},s++)),n++;continue}if(a.trim().startsWith("<!--")){for(;n<r.length&&!r[n].includes("-->");)n++;n++;continue}if(a.includes("|")&&n+1<r.length&&/^\s*\|[\s\-:|]+\|\s*$/.test(r[n+1])){const u=[],h=a.split("|").map(d=>d.trim()).filter(Boolean);for(n+=2;n<r.length&&r[n].includes("|")&&r[n].trim()!=="";)u.push(r[n].split("|").map(d=>d.trim()).filter(Boolean)),n++;i.push(g.jsx("div",{style:{overflowX:"auto",margin:"8px 0"},children:g.jsxs("table",{style:{borderCollapse:"collapse",width:"100%",fontSize:13},children:[g.jsx("thead",{children:g.jsx("tr",{children:h.map((d,p)=>g.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`2px solid ${t.border}`,color:t.textBright,fontWeight:600,whiteSpace:"nowrap"},children:As(d,t)},p))})}),g.jsx("tbody",{children:u.map((d,p)=>g.jsx("tr",{children:d.map((m,y)=>g.jsx("td",{style:{padding:"6px 12px",borderBottom:`1px solid ${t.border}`,color:t.textPrimary},children:As(m,t)},y))},p))})]})},s++));continue}if(/^(\s*)[-*+]\s/.test(a)){const u=[];for(;n<r.length&&/^(\s*)[-*+]\s/.test(r[n]);){const h=r[n].match(/^(\s*)[-*+]\s+(.+)$/);h&&u.push({text:h[2],indent:h[1].length}),n++}i.push(g.jsx("ul",{style:{margin:"6px 0",paddingLeft:24,color:t.textPrimary,fontSize:14,lineHeight:1.7},children:u.map((h,d)=>g.jsx("li",{style:{marginLeft:h.indent>0?16:0},children:As(h.text,t)},d))},s++));continue}if(/^\s*\d+[.)]\s/.test(a)){const u=[];for(;n<r.length&&/^\s*\d+[.)]\s/.test(r[n]);){const h=r[n].match(/^\s*\d+[.)]\s+(.+)$/);h&&u.push(h[1]),n++}i.push(g.jsx("ol",{style:{margin:"6px 0",paddingLeft:24,color:t.textPrimary,fontSize:14,lineHeight:1.7},children:u.map((h,d)=>g.jsx("li",{children:As(h,t)},d))},s++));continue}if(a.startsWith(">")){const u=[];for(;n<r.length&&r[n].startsWith(">");)u.push(r[n].replace(/^>\s?/,"")),n++;i.push(g.jsx("blockquote",{style:{borderLeft:`3px solid ${t.accent}`,paddingLeft:14,margin:"8px 0",color:t.textSecondary,fontSize:14,lineHeight:1.6,fontStyle:"italic"},children:u.map((h,d)=>g.jsx("div",{children:As(h,t)},d))},s++));continue}if(/^- \[[ x]\]\s/.test(a)){const u=[];for(;n<r.length&&/^- \[[ x]\]\s/.test(r[n]);){const h=r[n].includes("[x]"),d=r[n].replace(/^- \[[ x]\]\s+/,"");u.push({checked:h,text:d}),n++}i.push(g.jsx("ul",{style:{listStyle:"none",margin:"6px 0",paddingLeft:4,color:t.textPrimary,fontSize:14,lineHeight:1.7},children:u.map((h,d)=>g.jsxs("li",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[g.jsx("span",{style:{color:h.checked?t.success:t.textMuted,flexShrink:0},children:h.checked?"☑":"☐"}),g.jsx("span",{style:{color:h.checked?t.textSecondary:t.textPrimary},children:As(h.text,t)})]},d))},s++));continue}i.push(g.jsx("p",{style:{margin:"6px 0",color:t.textPrimary,fontSize:14,lineHeight:1.7},children:As(a,t)},s++)),n++}return i}function As(e,t){if(!e)return e;const r=[];let i=e,n=0;for(;i.length>0;){let s=i.match(/^(.*?)`([^`]+)`/);if(s){s[1]&&r.push(s[1]),r.push(g.jsx("code",{style:{backgroundColor:t.bgTertiary,padding:"1px 6px",borderRadius:4,fontSize:"0.9em",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:t.accent},children:s[2]},n++)),i=i.slice(s[0].length);continue}if(s=i.match(/^(.*?)\*\*(.+?)\*\*/),s){s[1]&&r.push(s[1]),r.push(g.jsx("strong",{style:{color:t.textBright,fontWeight:600},children:s[2]},n++)),i=i.slice(s[0].length);continue}if(s=i.match(/^(.*?)\*(.+?)\*/),s){s[1]&&r.push(s[1]),r.push(g.jsx("em",{children:s[2]},n++)),i=i.slice(s[0].length);continue}if(s=i.match(/^(.*?)\[([^\]]+)\]\(([^)]+)\)/),s){s[1]&&r.push(s[1]),r.push(g.jsx("a",{href:s[3],target:"_blank",rel:"noopener noreferrer",style:{color:t.accent,textDecoration:"none"},onMouseEnter:a=>a.target.style.textDecoration="underline",onMouseLeave:a=>a.target.style.textDecoration="none",children:s[2]},n++)),i=i.slice(s[0].length);continue}r.push(i);break}return r.length===1?r[0]:r}function rU({moduleData:e,onBack:t,onStartLearning:r}){const{theme:i}=St(),n=M.useMemo(()=>iU(i),[i]),s=M.useRef(null),[a,l]=M.useState(null),[u,h]=M.useState(null),[d,p]=M.useState(!0),[m,y]=M.useState(null),[x,v]=M.useState(null),[S,C]=M.useState(null),[E,L]=M.useState(!1),B=e==null?void 0:e.slug;M.useEffect(()=>{B&&(p(!0),y(null),fetch(`http://localhost:3456/api/module/${encodeURIComponent(B)}`).then(z=>{if(!z.ok)throw new Error("Module not found");return z.json()}).then(z=>{l(z.files||{}),h(z.meta||{});const $=Zb.find(j=>{var W;return(W=z.files)==null?void 0:W[j.key]});v(($==null?void 0:$.key)||null),p(!1)}).catch(z=>{y(z.message),p(!1)}))},[B]),M.useEffect(()=>{s.current&&(s.current.scrollTop=0)},[x]);const R=M.useMemo(()=>a?Zb.filter(z=>a[z.key]):[],[a]),k=(u==null?void 0:u.title)||(e==null?void 0:e.title)||B,A=(e==null?void 0:e.icon)||"📘",O=(e==null?void 0:e.category)||(u==null?void 0:u.category)||"",V=(e==null?void 0:e.difficulty)||(u==null?void 0:u.difficulty)||"",q=(u==null?void 0:u.description)||(e==null?void 0:e.description)||"",H=a&&x?a[x]:null,Y=z=>{switch((z||"").toLowerCase()){case"beginner":return i.success;case"intermediate":return i.warning;case"advanced":return i.error;default:return i.textMuted}},F=(e==null?void 0:e.status)==="completed"?"Review":e!=null&&e.status?"Continue":"Start Learning";return g.jsxs("div",{style:n.container,children:[g.jsxs("div",{style:n.header,children:[g.jsxs("button",{style:n.backButton,onClick:t,children:["←"," Modules"]}),g.jsxs("div",{style:n.headerContent,children:[g.jsxs("div",{style:n.headerTop,children:[g.jsx("span",{style:n.icon,children:A}),g.jsxs("div",{style:n.headerInfo,children:[g.jsx("h2",{style:n.title,children:k}),g.jsxs("div",{style:n.badges,children:[O&&g.jsx("span",{style:n.categoryBadge,children:O}),V&&g.jsx("span",{style:{...n.difficultyBadge,color:Y(V),backgroundColor:`${Y(V)}18`},children:V}),(e==null?void 0:e.status)==="completed"&&g.jsxs("span",{style:n.completedBadge,children:["✓"," Completed"]}),(e==null?void 0:e.status)&&e.status!=="completed"&&e.walkthroughStep!=null&&g.jsxs("span",{style:n.progressBadge,children:["Step ",e.walkthroughStep,"/",e.totalSteps||"?"]}),(e==null?void 0:e.xpEarned)>0&&g.jsxs("span",{style:n.xpBadge,children:[e.xpEarned," XP"]})]})]}),r&&g.jsx("button",{style:{...n.startButton,backgroundColor:E?i.accentHover||"#4b9eff":i.accent},onClick:()=>r(B),onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),children:F})]}),q&&g.jsx("p",{style:n.description,children:q})]})]}),d?g.jsxs("div",{style:n.loadingState,children:[g.jsx("div",{style:n.spinner}),g.jsx("p",{style:n.loadingText,children:"Loading materials..."})]}):m?g.jsxs("div",{style:n.errorState,children:[g.jsx("span",{style:n.errorIcon,children:"⚠️"}),g.jsx("p",{style:n.errorTitle,children:"Failed to load module"}),g.jsx("p",{style:n.errorSubtext,children:m})]}):R.length===0?g.jsxs("div",{style:n.errorState,children:[g.jsx("span",{style:n.errorIcon,children:"📚"}),g.jsx("p",{style:n.errorTitle,children:"No materials available"}),g.jsx("p",{style:n.errorSubtext,children:"This module doesn't have any readable content files yet."})]}):g.jsxs("div",{style:n.body,children:[g.jsx("div",{style:n.tabBar,children:R.map(z=>g.jsxs("button",{onClick:()=>v(z.key),onMouseEnter:()=>C(z.key),onMouseLeave:()=>C(null),style:{...n.tab,backgroundColor:x===z.key?`${i.accent}18`:S===z.key?i.bgTertiary:"transparent",color:x===z.key?i.accent:i.textSecondary,borderBottom:x===z.key?`2px solid ${i.accent}`:"2px solid transparent"},children:[g.jsx("span",{style:n.tabIcon,children:z.icon}),g.jsx("span",{children:z.label})]},z.key))}),g.jsx("div",{style:n.content,ref:s,children:H?tU(H,i):g.jsx("p",{style:{color:i.textMuted},children:"Select a tab to view content."})})]}),g.jsx("style",{children:`
|
|
533
|
+
@keyframes spin {
|
|
534
|
+
from { transform: rotate(0deg); }
|
|
535
|
+
to { transform: rotate(360deg); }
|
|
536
|
+
}
|
|
537
|
+
`})]})}function iU(e){return{container:{display:"flex",flexDirection:"column",height:"100%",maxWidth:960,margin:"0 auto",width:"100%"},header:{display:"flex",flexDirection:"column",gap:12,paddingBottom:16,borderBottom:`1px solid ${e.border}`,flexShrink:0},backButton:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 0",background:"none",border:"none",color:e.accent,fontSize:13,fontWeight:500,cursor:"pointer",fontFamily:"inherit",alignSelf:"flex-start"},headerContent:{display:"flex",flexDirection:"column",gap:8},headerTop:{display:"flex",alignItems:"center",gap:14},icon:{fontSize:36,lineHeight:1,flexShrink:0},headerInfo:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},title:{fontSize:20,fontWeight:700,color:e.textBright,margin:0},badges:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},categoryBadge:{fontSize:11,color:e.textMuted,textTransform:"capitalize"},difficultyBadge:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:4,textTransform:"capitalize"},completedBadge:{fontSize:11,fontWeight:600,color:e.success,backgroundColor:`${e.success}18`,padding:"2px 8px",borderRadius:4},progressBadge:{fontSize:11,fontWeight:600,color:e.accent,backgroundColor:`${e.accent}18`,padding:"2px 8px",borderRadius:4},xpBadge:{fontSize:11,fontWeight:600,color:e.warning,backgroundColor:`${e.warning}18`,padding:"2px 8px",borderRadius:4},startButton:{flexShrink:0,padding:"8px 20px",fontSize:13,fontWeight:600,color:e.bgPrimary,backgroundColor:e.accent,border:"none",borderRadius:8,cursor:"pointer",transition:"background-color 0.15s ease"},description:{fontSize:14,color:e.textSecondary,margin:0,lineHeight:1.5},body:{display:"flex",flexDirection:"column",flex:1,minHeight:0},tabBar:{display:"flex",gap:0,borderBottom:`1px solid ${e.border}`,flexShrink:0,marginTop:12,overflowX:"auto"},tab:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:13,fontWeight:500,whiteSpace:"nowrap",transition:"background-color 0.12s ease, color 0.12s ease",fontFamily:"inherit"},tabIcon:{fontSize:14,flexShrink:0},content:{flex:1,overflowY:"auto",paddingTop:16,paddingBottom:32,minHeight:0},loadingState:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16},spinner:{width:32,height:32,border:`3px solid ${e.border}`,borderTop:`3px solid ${e.accent}`,borderRadius:"50%",animation:"spin 0.8s linear infinite"},loadingText:{fontSize:14,color:e.textSecondary,margin:0},errorState:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:24},errorIcon:{fontSize:36,opacity:.5},errorTitle:{fontSize:16,fontWeight:600,color:e.textPrimary,margin:0},errorSubtext:{fontSize:14,color:e.textSecondary,margin:0,textAlign:"center",maxWidth:320}}}const nU="http://localhost:3456";function sU(e,t){return fetch(`${nU}/api/canvas`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({v:1,type:e,payload:t,source:"playground",timestamp:Date.now()})}).then(r=>r.json())}const Jb=[{category:"Diagrams",icon:"📊",items:[{label:"Mermaid Flowchart",desc:"Animated step-through diagram",type:"canvas:diagram",payload:{format:"mermaid",content:`graph TD
|
|
538
|
+
A[Working Directory] -->|git add| B[Staging Area]
|
|
539
|
+
B -->|git commit| C[Local Repo]
|
|
540
|
+
C -->|git push| D[Remote Repo]`,animate:!0}},{label:"Sequence Diagram",desc:"Client-server interaction",type:"canvas:diagram",payload:{format:"mermaid",content:`sequenceDiagram
|
|
541
|
+
participant Client
|
|
542
|
+
participant Server
|
|
543
|
+
participant DB
|
|
544
|
+
Client->>Server: POST /api/users
|
|
545
|
+
Server->>DB: INSERT INTO users
|
|
546
|
+
DB-->>Server: OK
|
|
547
|
+
Server-->>Client: 201 Created`}}]},{category:"Quizzes",icon:"📝",items:[{label:"Timed Choice",desc:"Multiple choice with timer",type:"canvas:quiz",payload:{quizType:"timed-choice",question:"What does git add do?",options:["Stage changes for commit","Push to remote","Create a branch","Delete a file"],correctIndex:0,timeLimit:30}},{label:"Drag Order",desc:"Sort items in correct order",type:"canvas:quiz",payload:{quizType:"drag-order",question:"Put these git steps in order:",options:["git add .",'git commit -m "msg"',"git push origin main"],correctIndex:0}},{label:"Matching",desc:"Match terms to definitions",type:"canvas:quiz",payload:{quizType:"matching",question:"Match the command to its purpose:",pairs:[{left:"git add",right:"Stage changes"},{left:"git commit",right:"Save snapshot"},{left:"git push",right:"Upload to remote"}]}},{label:"Fill in the Blank",desc:"Complete the code",type:"canvas:quiz",payload:{quizType:"fill-blank",question:"Complete the command to stage all files:",code:"git ___0___ .",blanks:[{index:0,answer:"add"}]}}]},{category:"Games",icon:"🎮",items:[{label:"Speed Round",desc:"Quick-fire Q&A",type:"canvas:game",payload:{gameType:"speed-round",title:"Git Command Sprint",module:"demo",rounds:[{question:"Stage changes?",answer:"git add",options:["git add","git commit","git push"]},{question:"Save snapshot?",answer:"git commit",options:["git add","git commit","git push"]},{question:"Upload to remote?",answer:"git push",options:["git add","git commit","git push"]}]}},{label:"Memory Match",desc:"Match pairs from memory",type:"canvas:game",payload:{gameType:"memory-match",title:"Git Memory Match",module:"demo",pairs:[{term:"git add",definition:"Stage changes"},{term:"git commit",definition:"Save snapshot"},{term:"git push",definition:"Upload to remote"}]}},{label:"Classify",desc:"Sort items into categories",type:"canvas:game",payload:{gameType:"classify",title:"Local vs Remote",module:"demo",categories:["Local","Remote"],items:[{text:"git add",category:"Local"},{text:"git commit",category:"Local"},{text:"git push",category:"Remote"},{text:"git pull",category:"Remote"}]}}]},{category:"Terminal",icon:"💻",items:[{label:"Practice Terminal",desc:"Task with validations and hints",type:"canvas:terminal",payload:{task:'Create a new directory called "my-project" and initialize it as a Git repository.',validations:[{label:"my-project directory created",passed:!1},{label:".git directory exists",passed:!1}],hints:["Use mkdir to create a directory","Use git init inside the directory"],module:"demo",cwd:"/tmp"}}]},{category:"Code Editor",icon:"⌨️",items:[{label:"Code Playground",desc:"Interactive code editor with run",type:"canvas:code",payload:{language:"javascript",code:`// Write a function that returns the sum of two numbers
|
|
548
|
+
function add(a, b) {
|
|
549
|
+
// your code here
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
console.log(add(2, 3)); // should print 5`,tests:[{input:"add(2, 3)",expected:"5"},{input:"add(-1, 1)",expected:"0"}],hints:["Use the + operator","Return the result of a + b"]}}]},{category:"HTML Content",icon:"🖼️",items:[{label:"Image Card",desc:"Styled image with caption",type:"canvas:html",payload:{html:'<div style="text-align:center;padding:20px"><img src="https://picsum.photos/600/300" alt="Random landscape" style="max-width:100%;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.3)"><p style="color:#8b949e;margin-top:12px;font-size:14px">A beautiful random landscape from Picsum</p></div>'}},{label:"Further Reading",desc:"Link card with dark theme",type:"canvas:html",payload:{html:'<div style="background:#161b22;border:1px solid #30363d;border-radius:10px;padding:20px"><h3 style="color:#e6edf3;margin:0 0 12px">Further Reading</h3><div style="display:flex;flex-direction:column;gap:8px"><a href="https://git-scm.com/doc" target="_blank" style="display:block;padding:10px 14px;background:#21262d;border-radius:8px;color:#58a6ff;text-decoration:none"><strong>Git Documentation</strong><br><span style="color:#8b949e;font-size:13px">Official reference manual</span></a><a href="https://learngitbranching.js.org" target="_blank" style="display:block;padding:10px 14px;background:#21262d;border-radius:8px;color:#58a6ff;text-decoration:none"><strong>Learn Git Branching</strong><br><span style="color:#8b949e;font-size:13px">Interactive visual tutorial</span></a></div></div>',title:"Further Reading"}},{label:"Video Embed",desc:"YouTube video player",type:"canvas:html",payload:{html:'<div style="position:relative;padding-bottom:56.25%;height:0"><iframe src="https://www.youtube.com/embed/HVsySz-h9r4" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0;border-radius:8px" allowfullscreen></iframe></div><p style="color:#c9d1d9;margin-top:12px;font-size:14px">Git Tutorial for Beginners (12:34)</p>'}}]},{category:"Web Embed",icon:"🌐",items:[{label:"Basic Embed",desc:"Embed a website in an iframe",type:"canvas:web-embed",payload:{url:"https://httpbin.org",title:"httpbin — HTTP testing",module:"demo"}},{label:"With Annotations",desc:"Embed with overlay annotations",type:"canvas:web-embed",payload:{url:"https://httpbin.org",title:"Annotated httpbin",annotations:[{x:20,y:10,text:"Navigation area"},{x:50,y:50,text:"Main content"}]}},{label:"Split View",desc:"Side-by-side comparison",type:"canvas:web-embed",payload:{url:"https://httpbin.org",splitUrl:"https://httpbin.org/html",title:"Compare layouts"}}]},{category:"Dashboard",icon:"📈",items:[{label:"Progress Dashboard",desc:"XP, belt, modules, achievements",type:"canvas:dashboard",payload:{progress:{xp:275,belt:"green",modules:[{slug:"git",status:"completed",xp:120},{slug:"react-hooks",status:"in-progress",step:5,xp:85},{slug:"testing",status:"not-started",xp:0}],streak:3,completedCount:1,totalCount:3},achievements:{unlocked:[],near:[]}}}]},{category:"Celebrations",icon:"🎉",items:[{label:"XP Award",desc:"Confetti with XP amount",type:"canvas:celebrate",payload:{type:"xp",xpAwarded:25}},{label:"Level Up",desc:"Belt promotion celebration",type:"canvas:celebrate",payload:{type:"level-up",xpAwarded:50,newBelt:"green"}},{label:"Perfect Score",desc:"Extra confetti for perfection",type:"canvas:celebrate",payload:{type:"perfect-score",xpAwarded:30}}]},{category:"Real Terminal",icon:"🖥️",items:[{label:"PTY Terminal",desc:"Full interactive shell via WebSocket",type:"canvas:real-terminal",payload:{cwd:"/tmp",module:"demo"}}]},{category:"Workshop",icon:"🔧",items:[{label:"Code Workshop",desc:"Editor + terminal + task bar",type:"canvas:workshop",payload:{task:"Implement the add function and make the tests pass.",files:[{name:"utils.js",content:`function add(a, b) {
|
|
553
|
+
// TODO: implement
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
module.exports = { add };`,language:"javascript"},{name:"test.js",content:`const { add } = require("./utils");
|
|
557
|
+
console.log(add(2, 3) === 5 ? "PASS" : "FAIL");
|
|
558
|
+
console.log(add(-1, 1) === 0 ? "PASS" : "FAIL");`,language:"javascript"}],validations:[{label:"add(2, 3) returns 5",passed:!1},{label:"add(-1, 1) returns 0",passed:!1}],hints:["Use the + operator","Return a + b"],cwd:"/tmp/workshop",module:"demo"}}]},{category:"Lists & Controls",icon:"📋",items:[{label:"Smart List (Cards)",desc:"Card grid with icons and actions",type:"chat:send",payload:{role:"assistant",content:`Here are some topics to explore:
|
|
559
|
+
|
|
560
|
+
<!-- list: {"id":"topics-demo","style":"cards","items":[{"icon":"book","title":"Variables","description":"Store and manage data","action":"Teach me about variables"},{"icon":"code","title":"Functions","description":"Reusable blocks of logic","action":"Teach me about functions"},{"icon":"rocket","title":"Async/Await","description":"Handle asynchronous operations","action":"Teach me about async/await"},{"icon":"puzzle","title":"Closures","description":"Functions that remember scope","action":"Teach me about closures"}]} -->`}},{label:"Smart List (Numbered)",desc:"Ordered step list",type:"chat:send",payload:{role:"assistant",content:`Follow these steps to set up your project:
|
|
561
|
+
|
|
562
|
+
<!-- list: {"id":"setup-steps","style":"numbered","items":[{"title":"Install Node.js","description":"Download from nodejs.org"},{"title":"Clone the repository","description":"git clone https://github.com/example/repo"},{"title":"Install dependencies","description":"Run npm install in the project root"},{"title":"Start the dev server","description":"Run npm run dev"}]} -->`}},{label:"Smart List (Checklist)",desc:"Checkable task list",type:"chat:send",payload:{role:"assistant",content:`Your exercise checklist:
|
|
563
|
+
|
|
564
|
+
<!-- list: {"id":"checklist-demo","style":"checklist","items":[{"title":"Create a new branch","description":"Use git checkout -b feature/my-feature"},{"title":"Write the function","description":"Implement the add() function"},{"title":"Add unit tests","description":"Cover edge cases"},{"title":"Submit a pull request"}]} -->`}},{label:"Smart List (Compact)",desc:"Dense inline list",type:"chat:send",payload:{role:"assistant",content:`Quick reference:
|
|
565
|
+
|
|
566
|
+
<!-- list: {"id":"compact-demo","style":"compact","items":[{"icon":"zap","title":"git add","description":"Stage changes"},{"icon":"check","title":"git commit","description":"Save snapshot"},{"icon":"rocket","title":"git push","description":"Upload to remote"},{"icon":"target","title":"git pull","description":"Download updates"}]} -->`}},{label:"Progress Bar",desc:"Horizontal fill bar",type:"chat:send",payload:{role:"assistant",content:`You're making great progress!
|
|
567
|
+
|
|
568
|
+
<!-- progress: {"id":"progress-bar","label":"Walkthrough Progress","current":3,"total":7,"style":"bar"} -->`}},{label:"Progress Steps",desc:"Step dots like a wizard",type:"chat:send",payload:{role:"assistant",content:`Module progress:
|
|
569
|
+
|
|
570
|
+
<!-- progress: {"id":"progress-steps","label":"React Hooks","current":4,"total":6,"style":"steps"} -->`}},{label:"Progress Ring",desc:"Circular percentage",type:"chat:send",payload:{role:"assistant",content:`Overall completion:
|
|
571
|
+
|
|
572
|
+
<!-- progress: {"id":"progress-ring","label":"Course Completion","current":7,"total":10,"style":"ring"} -->`}},{label:"Info Card (Tip)",desc:"Blue tip callout",type:"chat:send",payload:{role:"assistant",content:'Here\'s something useful:\n\n<!-- card: {"id":"tip-demo","type":"tip","title":"Pro Tip","content":"Use `const` by default, switch to `let` only when you need reassignment. Never use `var` in modern JavaScript."} -->'}},{label:"Info Card (Warning)",desc:"Yellow warning callout",type:"chat:send",payload:{role:"assistant",content:`Watch out for this:
|
|
573
|
+
|
|
574
|
+
<!-- card: {"id":"warn-demo","type":"warning","title":"Common Mistake","content":"Don't forget to \`await\` your async functions — otherwise you'll get a Promise object instead of the actual value."} -->`}},{label:"Info Card (Concept)",desc:"Purple concept highlight",type:"chat:send",payload:{role:"assistant",content:`Key concept:
|
|
575
|
+
|
|
576
|
+
<!-- card: {"id":"concept-demo","type":"concept","title":"Closure","content":"A **closure** is a function that has access to variables from its outer (enclosing) scope, even after the outer function has returned."} -->`}},{label:"Code Snippet",desc:"Highlighted code with copy button",type:"chat:send",payload:{role:"assistant",content:`Here's the implementation:
|
|
577
|
+
|
|
578
|
+
<!-- code: {"id":"code-demo","language":"javascript","filename":"utils.js","code":"function debounce(fn, delay) {\\n let timer;\\n return function (...args) {\\n clearTimeout(timer);\\n timer = setTimeout(() => fn.apply(this, args), delay);\\n };\\n}","highlight":[3,4]} -->`}},{label:"Step Tracker",desc:"Visual step-by-step progress",type:"chat:send",payload:{role:"assistant",content:`Exercise progress:
|
|
579
|
+
|
|
580
|
+
<!-- steps: {"id":"steps-demo","current":2,"steps":[{"label":"Create file","status":"done"},{"label":"Write function","status":"done"},{"label":"Add tests","status":"active"},{"label":"Run tests","status":"pending"},{"label":"Submit PR","status":"pending"}]} -->`}}]},{category:"Chat Actions",icon:"💬",items:[{label:"Assistant Message",desc:"Send a markdown chat message",type:"chat:send",payload:{role:"assistant",content:`**Great question!** Git has three main areas:
|
|
581
|
+
|
|
582
|
+
1. **Working Directory** — where you edit files
|
|
583
|
+
2. **Staging Area** — where you prepare commits
|
|
584
|
+
3. **Repository** — where commits are stored
|
|
585
|
+
|
|
586
|
+
Which area do you think \`git add\` moves files to?`}},{label:"Update Suggestion Chips",desc:"Change the bottom suggestion strip",type:"chat:suggestions",payload:{suggestions:[{label:"🧪 Run tests",text:"npm test"},{label:"📊 Show diagram",text:"Show me a diagram"},{label:"🎮 Play game",text:"/teach --game"},{label:"💡 Give hint",text:"Give me a hint"}]}},{label:"Smart Buttons (Single)",desc:"Single-choice inline buttons",type:"chat:send",payload:{role:"assistant",content:`What would you like to learn about?
|
|
587
|
+
|
|
588
|
+
<!-- buttons: {"id":"topic-demo","type":"single","prompt":"Pick a topic:","options":[{"label":"Variables","value":"Teach me about variables"},{"label":"Functions","value":"Teach me about functions"},{"label":"Loops","value":"Teach me about loops"}]} -->`}},{label:"Smart Buttons (Multi)",desc:"Multi-select with submit",type:"chat:send",payload:{role:"assistant",content:`Which of these have you used before?
|
|
589
|
+
|
|
590
|
+
<!-- buttons: {"id":"prereqs-demo","type":"multi","prompt":"Select all that apply:","options":[{"label":"Git","value":"Git"},{"label":"npm","value":"npm"},{"label":"VS Code","value":"VS Code"},{"label":"Docker","value":"Docker"}]} -->`}},{label:"Smart Buttons (Rating)",desc:"1-5 difficulty rating",type:"chat:send",payload:{role:"assistant",content:`How difficult was that exercise?
|
|
591
|
+
|
|
592
|
+
<!-- buttons: {"id":"rating-demo","type":"rating","prompt":"Rate the difficulty:","options":[{"label":"1 - Easy","value":"Difficulty: 1/5"},{"label":"2","value":"Difficulty: 2/5"},{"label":"3","value":"Difficulty: 3/5"},{"label":"4","value":"Difficulty: 4/5"},{"label":"5 - Hard","value":"Difficulty: 5/5"}]} -->`}}]}];function oU({item:e,theme:t,onPreview:r}){const[i,n]=M.useState(null),[s,a]=M.useState(!1),l=e.type.startsWith("canvas:")&&e.type!=="canvas:celebrate",u=M.useCallback(async()=>{n("sending");try{const d=await sU(e.type,e.payload);n(d.ok?"sent":"error")}catch{n("error")}setTimeout(()=>n(null),4e3)},[e]),h=aU(t);return g.jsxs("div",{style:h.card,children:[g.jsxs("div",{style:h.cardHeader,children:[g.jsxs("div",{children:[g.jsx("div",{style:h.cardLabel,children:e.label}),g.jsx("div",{style:h.cardDesc,children:e.desc})]}),g.jsxs("div",{style:h.cardActions,children:[g.jsxs("button",{style:h.toggleBtn,onClick:()=>a(d=>!d),title:s?"Hide payload":"Show payload",children:[s?"▾":"▸"," JSON"]}),g.jsx("button",{style:{...h.sendBtn,...i==="sent"?h.sendBtnSent:{},...i==="error"?h.sendBtnError:{}},onClick:u,disabled:i==="sending",children:i==="sending"?"...":i==="sent"?"✓ Sent":i==="error"?"✗ Error":"▶ Send"}),i==="sent"&&l&&r&&g.jsx("button",{style:h.previewBtn,onClick:()=>r(e.type),title:"View the rendered component",children:"👁 View"})]})]}),s&&g.jsx("pre",{style:h.payload,children:JSON.stringify(e.payload,null,2)}),g.jsx("div",{style:h.typeBadge,children:e.type})]})}function aU(e){return{card:{background:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:10,padding:"14px 16px",position:"relative"},cardHeader:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12},cardLabel:{fontSize:14,fontWeight:600,color:e.textPrimary},cardDesc:{fontSize:12,color:e.textSecondary,marginTop:2},cardActions:{display:"flex",gap:6,flexShrink:0},toggleBtn:{padding:"4px 10px",fontSize:11,color:e.textSecondary,background:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",fontFamily:"monospace"},sendBtn:{padding:"4px 14px",fontSize:12,fontWeight:600,color:"#fff",background:e.accent,border:"none",borderRadius:6,cursor:"pointer",minWidth:72,transition:"background 0.2s"},sendBtnSent:{background:e.success||"#3fb950"},sendBtnError:{background:e.error||"#f85149"},previewBtn:{padding:"4px 10px",fontSize:12,fontWeight:600,color:"#fff",background:"#8b5cf6",border:"none",borderRadius:6,cursor:"pointer",minWidth:60},payload:{marginTop:10,padding:12,background:e.bgPrimary,border:`1px solid ${e.border}`,borderRadius:8,fontSize:11,lineHeight:1.5,color:e.textSecondary,overflow:"auto",maxHeight:300,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},typeBadge:{position:"absolute",bottom:8,right:10,fontSize:10,color:e.accent,fontFamily:"monospace",opacity:.6}}}function lU({onPreview:e}){const{theme:t}=St(),[r,i]=M.useState(()=>{const a={};return Jb.forEach(l=>{a[l.category]=!0}),a}),n=M.useCallback(a=>{i(l=>({...l,[a]:!l[a]}))},[]),s=M.useMemo(()=>cU(t),[t]);return g.jsxs("div",{style:s.container,children:[g.jsxs("div",{style:s.header,children:[g.jsx("h1",{style:s.title,children:"Canvas Playground"}),g.jsxs("p",{style:s.subtitle,children:["Interactive demo of every canvas component and chat action. Click ",g.jsx("strong",{children:"Send"})," to fire, then ",g.jsx("strong",{children:"View"})," to see the result. Chat actions appear in the chat pane. Use ",g.jsx("strong",{children:"Back"})," to return here."]})]}),g.jsx("div",{style:s.grid,children:Jb.map(a=>g.jsxs("div",{style:s.section,children:[g.jsxs("button",{style:s.sectionHeader,onClick:()=>n(a.category),children:[g.jsx("span",{style:s.sectionIcon,children:a.icon}),g.jsx("span",{style:s.sectionTitle,children:a.category}),g.jsx("span",{style:s.sectionCount,children:a.items.length}),g.jsx("span",{style:s.sectionChevron,children:r[a.category]?"▾":"▸"})]}),r[a.category]&&g.jsx("div",{style:s.sectionBody,children:a.items.map((l,u)=>g.jsx(oU,{item:l,theme:t,onPreview:e},u))})]},a.category))})]})}function cU(e){return{container:{maxWidth:900,margin:"0 auto",padding:"0 0 40px"},header:{marginBottom:24},title:{fontSize:24,fontWeight:700,color:e.textPrimary,margin:0},subtitle:{fontSize:13,color:e.textSecondary,marginTop:6,lineHeight:1.5},grid:{display:"flex",flexDirection:"column",gap:16},section:{background:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,overflow:"hidden"},sectionHeader:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"12px 16px",background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",textAlign:"left"},sectionIcon:{fontSize:18},sectionTitle:{fontSize:15,fontWeight:600,color:e.textPrimary,flex:1},sectionCount:{fontSize:11,color:e.textMuted||e.textSecondary,background:e.bgTertiary,padding:"2px 8px",borderRadius:10},sectionChevron:{fontSize:12,color:e.textSecondary},sectionBody:{display:"flex",flexDirection:"column",gap:8,padding:"0 12px 12px"}}}st.setOptions({breaks:!0,gfm:!0});function hU(e){return e.replace(/^[•●∙◦‣⁃]\s+/gm,"- ").replace(/^(\d+)\)\s+/gm,"$1. ")}function uU(e){try{return{__html:ln.sanitize(st.parse(hU(e)))}}catch{return{__html:ln.sanitize(e)}}}function dU({content:e,theme:t}){const r=M.useRef(null),[i,n]=M.useState(null);return M.useEffect(()=>{!r.current||!e||(n(null),TE(t),EE(r.current,e).catch(s=>{n(s.message||"Failed to render diagram")}))},[e,t]),i?g.jsxs("div",{style:{color:t.error,fontSize:13,padding:"8px 12px",background:t.bgTertiary,borderRadius:6},children:[g.jsx("strong",{children:"Diagram error:"})," ",g.jsx("code",{children:i})]}):g.jsx("div",{ref:r,style:{display:"flex",justifyContent:"center",overflow:"auto"}})}function fU({content:e,language:t,theme:r}){return g.jsxs("pre",{style:{background:r.bgTertiary,border:`1px solid ${r.border}`,borderRadius:8,padding:"14px 18px",margin:0,overflow:"auto",fontSize:13,lineHeight:1.6,fontFamily:'"SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace',color:r.textPrimary},children:[t&&g.jsx("span",{style:{display:"block",fontSize:11,color:r.textMuted,marginBottom:8,textTransform:"uppercase",letterSpacing:"0.5px"},children:t}),g.jsx("code",{children:e})]})}function pU({src:e,alt:t,theme:r}){return g.jsxs("div",{style:{textAlign:"center"},children:[g.jsx("img",{src:e,alt:t||"",style:{maxWidth:"100%",height:"auto",borderRadius:8,border:`1px solid ${r.border}`}}),t&&g.jsx("p",{style:{color:r.textSecondary,fontSize:13,marginTop:8},children:t})]})}function gU({content:e,theme:t}){const r=ln.sanitize(e);return g.jsx("div",{dangerouslySetInnerHTML:{__html:r},style:{color:t.textPrimary,lineHeight:1.6}})}function mU({content:e,theme:t}){return g.jsx("div",{dangerouslySetInnerHTML:uU(e),style:{color:t.textPrimary,lineHeight:1.7,fontSize:15},className:"slides-markdown"})}function yU({block:e,theme:t}){switch(e.type){case"mermaid":return g.jsx(dU,{content:e.content,theme:t});case"code":return g.jsx(fU,{content:e.content,language:e.language,theme:t});case"image":return g.jsx(pU,{src:e.src||e.content,alt:e.alt,theme:t});case"html":return g.jsx(gU,{content:e.content,theme:t});case"markdown":default:return g.jsx(mU,{content:e.content,theme:t})}}function _U({data:e,sendEvent:t}){const{theme:r}=St(),i=M.useMemo(()=>xU(r),[r]),[n,s]=M.useState((e==null?void 0:e.startSlide)||0),[a,l]=M.useState(0),u=M.useRef(null),h=(e==null?void 0:e.slides)||[],d=h.length,p=n<d?n:0,m=h[p]||null;M.useEffect(()=>{s((e==null?void 0:e.startSlide)||0),l(0)},[e]);const y=M.useCallback(E=>{var L;E<0||E>=d||(l(E>n?1:-1),s(E),t&&t("event:slide-change",{slide:E,total:d,title:(L=h[E])==null?void 0:L.title}))},[n,d,h,t]),x=M.useCallback(()=>y(n+1),[y,n]),v=M.useCallback(()=>y(n-1),[y,n]);if(M.useEffect(()=>{function E(L){L.key==="ArrowRight"||L.key===" "?(L.preventDefault(),x()):L.key==="ArrowLeft"&&(L.preventDefault(),v())}return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[x,v]),!e||!h.length||!m)return g.jsxs("div",{style:i.empty,children:[g.jsx("div",{style:i.emptyIcon,children:"📝"}),g.jsx("p",{style:i.emptyTitle,children:"Slides Ready"}),g.jsx("p",{style:i.emptySubtext,children:"Slide presentations will appear here during lessons."})]});const S=m.layout||"center",C=m.blocks||[];return g.jsxs("div",{style:i.container,children:[g.jsxs("div",{style:i.header,children:[g.jsxs("div",{style:i.headerLeft,children:[e.module&&g.jsx("span",{style:i.module,children:e.module}),e.module&&e.title&&g.jsx("span",{style:i.headerSep,children:"/"}),e.title&&g.jsx("span",{style:i.deckTitle,children:e.title})]}),g.jsx("div",{style:i.headerRight,children:g.jsxs("span",{style:i.counter,children:[p+1," / ",d]})})]}),m.title&&g.jsx("div",{style:i.slideTitle,children:m.title}),g.jsx("div",{ref:u,style:{...i.slideArea,animation:a!==0?`slideIn${a>0?"Right":"Left"} 0.25s ease-out`:void 0},children:g.jsx("div",{style:{...i.blocksContainer,...S==="split"?i.layoutSplit:{},...S==="top-bottom"?i.layoutTopBottom:{}},children:C.map((E,L)=>g.jsx("div",{style:i.blockWrapper,children:g.jsx(yU,{block:E,theme:r})},L))})},p),g.jsxs("div",{style:i.nav,children:[g.jsxs("button",{onClick:v,disabled:p===0,style:{...i.navButton,opacity:p===0?.35:1},"aria-label":"Previous slide",children:["◀"," Prev"]}),g.jsx("div",{style:i.dots,children:h.map((E,L)=>g.jsx("button",{onClick:()=>y(L),style:{...i.dot,backgroundColor:L===p?r.accent:r.border,transform:L===p?"scale(1.3)":"scale(1)"},"aria-label":`Go to slide ${L+1}`},L))}),g.jsxs("button",{onClick:x,disabled:p>=d-1,style:{...i.navButton,opacity:p>=d-1?.35:1},"aria-label":"Next slide",children:["Next ","▶"]})]}),g.jsx("style",{children:`
|
|
593
|
+
@keyframes slideInRight {
|
|
594
|
+
from { opacity: 0; transform: translateX(40px); }
|
|
595
|
+
to { opacity: 1; transform: translateX(0); }
|
|
596
|
+
}
|
|
597
|
+
@keyframes slideInLeft {
|
|
598
|
+
from { opacity: 0; transform: translateX(-40px); }
|
|
599
|
+
to { opacity: 1; transform: translateX(0); }
|
|
600
|
+
}
|
|
601
|
+
.slides-markdown h1, .slides-markdown h2, .slides-markdown h3 {
|
|
602
|
+
color: ${r.textBright};
|
|
603
|
+
margin: 0 0 12px;
|
|
604
|
+
}
|
|
605
|
+
.slides-markdown h1 { font-size: 28px; }
|
|
606
|
+
.slides-markdown h2 { font-size: 22px; }
|
|
607
|
+
.slides-markdown h3 { font-size: 18px; }
|
|
608
|
+
.slides-markdown p { margin: 0 0 12px; }
|
|
609
|
+
.slides-markdown ul, .slides-markdown ol { margin: 0 0 12px; padding-left: 24px; }
|
|
610
|
+
.slides-markdown li { margin-bottom: 4px; }
|
|
611
|
+
.slides-markdown code {
|
|
612
|
+
background: ${r.bgTertiary};
|
|
613
|
+
padding: 2px 6px;
|
|
614
|
+
border-radius: 4px;
|
|
615
|
+
font-size: 13px;
|
|
616
|
+
font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
|
|
617
|
+
}
|
|
618
|
+
.slides-markdown pre {
|
|
619
|
+
background: ${r.bgTertiary};
|
|
620
|
+
padding: 14px 18px;
|
|
621
|
+
border-radius: 8px;
|
|
622
|
+
overflow: auto;
|
|
623
|
+
font-size: 13px;
|
|
624
|
+
line-height: 1.6;
|
|
625
|
+
}
|
|
626
|
+
.slides-markdown pre code {
|
|
627
|
+
background: none;
|
|
628
|
+
padding: 0;
|
|
629
|
+
}
|
|
630
|
+
.slides-markdown a {
|
|
631
|
+
color: ${r.accent};
|
|
632
|
+
text-decoration: none;
|
|
633
|
+
}
|
|
634
|
+
.slides-markdown a:hover {
|
|
635
|
+
text-decoration: underline;
|
|
636
|
+
}
|
|
637
|
+
.slides-markdown blockquote {
|
|
638
|
+
border-left: 3px solid ${r.accent};
|
|
639
|
+
margin: 0 0 12px;
|
|
640
|
+
padding: 8px 16px;
|
|
641
|
+
color: ${r.textSecondary};
|
|
642
|
+
background: ${r.bgTertiary};
|
|
643
|
+
border-radius: 0 6px 6px 0;
|
|
644
|
+
}
|
|
645
|
+
.slides-markdown strong { color: ${r.textBright}; }
|
|
646
|
+
.slides-markdown img { max-width: 100%; border-radius: 8px; }
|
|
647
|
+
`})]})}function xU(e){return{container:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:0},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 0 12px",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:8,fontSize:13,minWidth:0},module:{color:e.accent,fontWeight:500},headerSep:{color:e.textMuted},deckTitle:{color:e.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},headerRight:{flexShrink:0},counter:{fontSize:12,color:e.textSecondary,fontVariantNumeric:"tabular-nums",background:e.bgTertiary,padding:"3px 10px",borderRadius:12,border:`1px solid ${e.border}`},slideTitle:{fontSize:22,fontWeight:600,color:e.textBright,padding:"0 0 16px",flexShrink:0},slideArea:{flex:1,minHeight:0,overflow:"auto",backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,borderRadius:12,padding:28},blocksContainer:{display:"flex",flexDirection:"column",gap:20,height:"100%"},layoutSplit:{flexDirection:"row",alignItems:"flex-start"},layoutTopBottom:{flexDirection:"column"},blockWrapper:{flex:1,minWidth:0,minHeight:0},nav:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"14px 0 0",flexShrink:0},navButton:{padding:"7px 16px",fontSize:13,fontWeight:500,color:e.textPrimary,backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",transition:"opacity 0.15s ease",fontFamily:"inherit"},dots:{display:"flex",gap:6,alignItems:"center"},dot:{width:10,height:10,borderRadius:"50%",border:"none",cursor:"pointer",transition:"background-color 0.2s ease, transform 0.2s ease",padding:0},empty:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:400,gap:12},emptyIcon:{fontSize:48,opacity:.5},emptyTitle:{fontSize:18,fontWeight:600,color:e.textBright,margin:0},emptySubtext:{fontSize:14,color:e.textSecondary,margin:0}}}const $s="http://localhost:3456",my=`${$s}/api`,vU=/<!--\s*buttons:\s*(\{[\s\S]*?\})\s*-->/g,bU=["single","multi","rating"];function SU(e){if(!e||typeof e!="string")return{cleanText:"",buttons:[]};const t=[];let r=e;for(const i of[...e.matchAll(vU)]){let n;try{n=JSON.parse(i[1])}catch{continue}if(!n||typeof n!="object"||typeof n.id!="string"||!n.id||!bU.includes(n.type)||!Array.isArray(n.options)||n.options.length===0)continue;const s=n.options.filter(a=>a&&typeof a.label=="string"&&typeof a.value=="string");s.length!==0&&(t.push({id:n.id,type:n.type,prompt:typeof n.prompt=="string"?n.prompt:void 0,options:s}),r=r.replace(i[0],""))}return{cleanText:r.trim(),buttons:t}}const wU=[{re:/<!--\s*list:\s*(\{[\s\S]*?\})\s*-->/g,type:"list",required:["items"]},{re:/<!--\s*progress:\s*(\{[\s\S]*?\})\s*-->/g,type:"progress",required:["current","total"]},{re:/<!--\s*card:\s*(\{[\s\S]*?\})\s*-->/g,type:"card",required:["content"]},{re:/<!--\s*code:\s*(\{[\s\S]*?\})\s*-->/g,type:"code",required:["code"]},{re:/<!--\s*steps:\s*(\{[\s\S]*?\})\s*-->/g,type:"steps",required:["steps"]}];function CU(e){if(!e||typeof e!="string")return{cleanText:"",blocks:[]};const t=[];let r=e;for(const{re:i,type:n,required:s}of wU){i.lastIndex=0;for(const a of[...e.matchAll(i)]){let l;try{l=JSON.parse(a[1])}catch{continue}!l||typeof l!="object"||typeof l.id!="string"||!l.id||s.some(u=>l[u]==null)||(t.push({blockType:n,...l}),r=r.replace(a[0],""))}}return{cleanText:r.trim(),blocks:t}}const ae={dashboard:"dashboard",canvas:"canvas",quiz:"quiz",playground:"playground",terminal:"terminal",realTerminal:"real-terminal",workshop:"workshop",game:"game",html:"html",webEmbed:"web-embed",modules:"modules",achievements:"achievements",settings:"settings",journeys:"journeys",journeyMap:"journey-map",moduleDetail:"module-detail",about:"about",playgroundDemo:"playground-demo",slides:"slides"},xt={chat:"chat",visual:"visual",immersive:"immersive"};function kU(e,t){if(e===xt.chat)return"100%";if(e===xt.immersive)return"0%";switch(t){case ae.quiz:return"30%";case ae.playground:case ae.terminal:case ae.realTerminal:case ae.canvas:case ae.settings:return"35%";case ae.workshop:case ae.webEmbed:return"25%";case ae.achievements:return"38%";default:return"40%"}}const TU=new Set([ae.terminal,ae.realTerminal,ae.workshop,ae.playground,ae.game,ae.settings,ae.achievements,ae.modules,ae.moduleDetail,ae.journeys,ae.journeyMap,ae.about,ae.webEmbed,ae.playgroundDemo,ae.canvas,ae.html,ae.slides]),Ad=[{name:"White",minXP:0,badge:"⬜",color:"#e6e6e6"},{name:"Yellow",minXP:50,badge:"🟨",color:"#f0c040"},{name:"Green",minXP:150,badge:"🟩",color:"#3fb950"},{name:"Blue",minXP:400,badge:"🟦",color:"#58a6ff"},{name:"Purple",minXP:800,badge:"🟦a",color:"#bc8cff"},{name:"Brown",minXP:1500,badge:"🟫",color:"#a0522d"},{name:"Black",minXP:3e3,badge:"⬛",color:"#484f58"}];function Pg(e){let t=Ad[0];for(const r of Ad)e>=r.minXP&&(t=r);return t}function EU(e){for(const t of Ad)if(e<t.minXP)return t;return null}function BU(){var Zs;const{theme:e}=St(),[t,r]=M.useState(xt.chat),[i,n]=M.useState("home"),[s,a]=M.useState(null),[l,u]=M.useState(null),[h,d]=M.useState(null),[p,m]=M.useState(null),[y,x]=M.useState(null),[v,S]=M.useState(null),[C,E]=M.useState(null),[L,B]=M.useState(null),[R,k]=M.useState(null),[A,O]=M.useState(null),[V,q]=M.useState(null),[H,Y]=M.useState(null),[F,z]=M.useState(null),[$,j]=M.useState(null),[W,P]=M.useState(null),[Q,ee]=M.useState(null),[I,Z]=M.useState(0),[oe,X]=M.useState(null),ne=AL(),{sessions:he}=DL(),[ye,ve]=M.useState(!1),[be,$e]=M.useState([]),[Xe,it]=M.useState(null),[Oe,ht]=M.useState([]),[Ft,le]=M.useState([]),Je=M.useCallback(()=>{fetch(`${$s}/api/sessions`).then(se=>se.ok?se.json():null).then(se=>{se!=null&&se.sessions&&$e(se.sessions)}).catch(()=>{})},[]);M.useEffect(()=>{Je()},[Je,ne.sessionId]);const ut=M.useMemo(()=>{const se=Oe.length===0?ne.messages:ne.messages.length===0?Oe:[...Oe,...ne.messages];return Ft.length===0?se:[...se,...Ft]},[Oe,ne.messages,Ft]);M.useEffect(()=>{if(!ne.sessionId||be.length===0){it(null);return}const se=be.find(Se=>Se.sessionId===ne.sessionId);it((se==null?void 0:se.title)||null)},[ne.sessionId,be]);const qt=M.useRef(null),kr=M.useRef(!1),ar=M.useRef([]),[Fi,ls]=M.useState(!1),jn=M.useCallback(se=>{switch(se){case ae.dashboard:return l;case ae.canvas:return h;case ae.quiz:return p;case ae.playground:return y;case ae.terminal:return v;case ae.game:return C;case ae.html:return L;case ae.realTerminal:return R;case ae.workshop:return A;case ae.webEmbed:return V;case ae.slides:return H;default:return null}},[l,h,p,y,v,C,L,R,A,V,H]),Ni=M.useCallback((se,Se)=>{switch(se){case ae.dashboard:u(Se);break;case ae.canvas:d(Se);break;case ae.quiz:m(Se);break;case ae.playground:x(Se);break;case ae.terminal:S(Se);break;case ae.game:E(Se);break;case ae.html:B(Se);break;case ae.realTerminal:k(Se);break;case ae.workshop:O(Se);break;case ae.webEmbed:q(Se);break;case ae.slides:Y(Se);break}},[u,d,m,x,S,E,B,k,O,q,Y]),gt=M.useCallback(se=>{a(Se=>{if(Se&&Se!==se){const mt=jn(Se);ar.current=[...ar.current,{mode:Se,data:mt}].slice(-20),ls(!0)}return se}),se===ae.game?r(xt.immersive):r(xt.visual)},[jn]),Tr=M.useCallback(()=>{const se=ar.current;if(se.length===0)return;const Se=se[se.length-1];ar.current=se.slice(0,-1),ls(se.length>1),Ni(Se.mode,Se.data),a(Se.mode),Se.mode===ae.game?r(xt.immersive):r(xt.visual)},[Ni]),hn=M.useCallback(()=>{a(null),r(xt.chat),n(null),ar.current=[],ls(!1)},[]),Xs=M.useCallback(()=>{r(xt.visual)},[]),vt=M.useCallback(()=>{qt.current&&clearTimeout(qt.current),qt.current=setTimeout(()=>{a(se=>TU.has(se)?se:ae.dashboard),r(xt.visual),n("home")},6e4)},[]),Wi=M.useCallback(se=>{switch(n(se),se){case"home":a(ae.dashboard),r(xt.visual);break;case"modules":a(ae.modules),r(xt.visual);break;case"achievements":a(ae.achievements),r(xt.visual);break;case"settings":a(ae.settings),r(xt.visual);break;case"journeys":a(ae.journeys),r(xt.visual);break;case"about":a(ae.about),r(xt.visual);break;case"playground":a(ae.playgroundDemo),r(xt.visual);break}vt()},[vt]),Uo=M.useCallback(se=>{var mt,At,Qt,zr,Te;if(!se||!se.type)return;const Se=se.source==="playground";switch(se.type){case"canvas:dashboard":u(se.payload),Se||(a(U=>{const fe=U&&U!==ae.dashboard;return se.source==="bridge"&&fe?U:(n("home"),ae.dashboard)}),r(xt.visual)),vt();break;case"canvas:diagram":d(se.payload),Se||(gt(ae.canvas),n(null)),vt();break;case"canvas:quiz":m(se.payload),Se||(gt(ae.quiz),n(null)),vt();break;case"canvas:code":x(se.payload),Se||(gt(ae.playground),n(null)),vt();break;case"canvas:terminal":S(se.payload),Se||(gt(ae.terminal),n(null)),vt();break;case"canvas:game":E(se.payload),Se||(gt(ae.game),n(null));break;case"canvas:html":B(se.payload),Se||(gt(ae.html),n(null)),vt();break;case"canvas:web-embed":q(se.payload),Se||(gt(ae.webEmbed),n(null));break;case"canvas:slides":Y(se.payload),Se||(gt(ae.slides),n(null)),vt();break;case"canvas:real-terminal":k(se.payload),Se||(gt(ae.realTerminal),n(null)),vt();break;case"canvas:workshop":O(se.payload),Se||(gt(ae.workshop),n(null)),vt();break;case"canvas:journey-browser":gt(ae.journeys),n("journeys"),vt();break;case"canvas:journey-map":z(se.payload),gt(ae.journeyMap),n("journeys"),vt();break;case"canvas:workshop-update":O(U=>U?{...U,...se.payload}:se.payload),vt();break;case"canvas:celebrate":P(se.payload),t===xt.immersive&&(r(xt.visual),a(ae.dashboard),n("home")),setTimeout(()=>P(null),5e3);break;case"event:game-result":r(xt.visual),a(ae.dashboard),n("home"),vt();break;case"chat:send":if((mt=se.payload)!=null&&mt.role&&((At=se.payload)!=null&&At.content)){const{cleanText:U,buttons:fe}=SU(se.payload.content),{cleanText:Be,blocks:ft}=CU(U),Ke={role:se.payload.role,text:Be,id:`injected-${Date.now()}`};fe.length>0&&(Ke.buttons=fe),ft.length>0&&(Ke.blocks=ft),le(Bt=>[...Bt,Ke])}break;case"chat:suggestions":X(((Qt=se.payload)==null?void 0:Qt.suggestions)||null);break}(zr=se.payload)!=null&&zr.module&&ee(se.payload.module),((Te=se.payload)==null?void 0:Te.streak)!==void 0&&Z(se.payload.streak)},[gt,vt,t]),{status:un,sendEvent:lr}=$L(Uo),ci=M.useCallback(({type:se,url:Se,alt:mt,title:At})=>{if(!Se)return;const Qt=At||mt||Se,zr=se==="image"?`<img src="${Se}" alt="${mt||""}" style="max-width:100%;height:auto;" />`:`<a href="${Se}" target="_blank">${Qt}</a>`;B({html:zr,title:Qt,module:Q}),gt(ae.html),n(null),vt(),lr("event:click",{element:se,data:{url:Se,alt:mt,title:At}})},[gt,vt,Q,lr]),wi=M.useCallback(({url:se,title:Se})=>{if(!se)return;q({url:se,title:Se||se,module:Q}),gt(ae.webEmbed),n(null)},[gt,Q]),hi=M.useCallback(se=>{X(null),ne.send(se)},[ne]),Hi=M.useCallback(se=>{ne.send(se)},[ne]),dn=M.useCallback(()=>{X(null),ne.clearMessages(),ht([]),le([]),it(null),ve(!1),setTimeout(Je,500)},[ne,Je]),fn=M.useCallback(async se=>{var Se;if(se===ne.sessionId){ve(!1);return}ne.clearMessages(),ht([]),X(null),ve(!1);try{const mt=await fetch(`${$s}/api/sessions/${se}`);if(mt.ok){const At=await mt.json();(Se=At.messages)!=null&&Se.length&&ht(At.messages),it(At.title||null)}}catch{}try{await fetch(`${my}/chat/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:se})})}catch{}Je()},[ne,Je]),ui=M.useCallback(async se=>{ne.clearMessages();try{await fetch(`${my}/chat/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:se})})}catch{}},[ne]),pn=M.useCallback(async se=>{try{await fetch(`${$s}/api/sessions/${se}`,{method:"DELETE"})}catch{}se===ne.sessionId&&(ne.clearMessages(),it(null)),Je()},[ne,Je]),gn=M.useCallback(async(se,Se)=>{try{await fetch(`${$s}/api/sessions/${se}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:Se})})}catch{}se===ne.sessionId&&it(Se),Je()},[ne.sessionId,Je]),Vo=M.useCallback(async(se,Se)=>{try{await fetch(`${$s}/api/sessions/${se}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:Se})})}catch{}Je()},[Je]);M.useEffect(()=>{un!=="connected"||kr.current||(kr.current=!0,fetch(`${$s}/api/progress`).then(se=>se.ok?se.json():null).then(se=>{var At,Qt,zr,Te;if(!se)return;const Se=Object.entries(se.modules||{}).map(([U,fe])=>({slug:U,...fe})),mt={progress:{xp:((At=se.user)==null?void 0:At.xp)||0,belt:(Qt=se.user)==null?void 0:Qt.belt,modules:Se,streak:((zr=se.user)==null?void 0:zr.streak)||0,completedCount:Se.filter(U=>U.status==="completed").length,totalCount:Se.length},achievements:se.achievements||{unlocked:[],near:[]}};u(mt),a(U=>U&&U!==ae.dashboard?U:(r(xt.visual),n("home"),ae.dashboard)),(Te=se.user)!=null&&Te.streak&&Z(se.user.streak)}).catch(()=>{}))},[un]),M.useEffect(()=>()=>{qt.current&&clearTimeout(qt.current)},[]);const[Qs,wt]=M.useState(()=>{try{return localStorage.getItem("socrates-chat-width")}catch{return null}}),[qi,cs]=M.useState(!1),zn=M.useRef(null),Ci=M.useCallback(se=>{const Se=`${Math.min(Math.max(se,15),70)}%`;wt(Se);try{localStorage.setItem("socrates-chat-width",Se)}catch{}},[]),On=M.useCallback(se=>{se.preventDefault(),cs(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Se=Qt=>Qt.touches?Qt.touches[0].clientX:Qt.clientX,mt=Qt=>{if(!zn.current)return;const zr=zn.current.getBoundingClientRect(),Te=(Se(Qt)-zr.left)/zr.width*100;Ci(Te)},At=()=>{cs(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",mt),window.removeEventListener("mouseup",At),window.removeEventListener("touchmove",mt),window.removeEventListener("touchend",At)};window.addEventListener("mousemove",mt),window.addEventListener("mouseup",At),window.addEventListener("touchmove",mt,{passive:!1}),window.addEventListener("touchend",At)},[Ci]),Ui=((Zs=l==null?void 0:l.progress)==null?void 0:Zs.xp)??0,Qa=Pg(Ui),cr=kU(t,s),Qr=t===xt.visual&&Qs?Qs:cr,mn=t!==xt.chat,Fn=t!==xt.immersive,Xt=M.useMemo(()=>MU(e),[e]);return g.jsxs("div",{style:Xt.container,children:[g.jsx(KN,{activeNav:i,onNavClick:Wi,belt:Qa,xp:Ui,streak:I,onNewChat:dn}),ne.error&&g.jsxs("div",{style:Xt.errorBanner,children:[g.jsxs("span",{children:["Connection to Claude lost: ",ne.error]}),g.jsx("button",{style:Xt.reconnectButton,onClick:()=>dn(),children:"Reconnect"})]}),g.jsxs("div",{style:Xt.splitPane,ref:zn,children:[Fn&&g.jsxs("div",{style:{...Xt.chatPane,width:Qr,transition:qi?"none":Xt.chatPane.transition,display:"flex",flexDirection:"row"},children:[g.jsx(zq,{open:ye,sessions:be,activeSessionId:ne.sessionId,onSelect:fn,onNewChat:dn,onDelete:pn,onRename:gn,onTogglePin:Vo,onClose:()=>ve(!1)}),g.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:g.jsx(_3,{messages:ut,isStreaming:ne.isStreaming,status:ne.status,onSend:hi,onStop:ne.stop,onNewChat:dn,onResume:ui,sessions:he,sessionId:ne.sessionId,compact:t===xt.visual&&["quiz","playground","terminal","real-terminal","workshop","canvas","settings","web-embed","slides"].includes(s),onMediaClick:ci,suggestions:oe,sessionTitle:Xe,onToggleDrawer:()=>ve(se=>!se),drawerOpen:ye})})]}),Fn&&mn&&g.jsx("div",{style:Xt.resizeHandle,onMouseDown:On,onTouchStart:On,onDoubleClick:()=>{wt(null);try{localStorage.removeItem("socrates-chat-width")}catch{}},title:"Drag to resize · Double-click to reset",children:g.jsx("div",{style:Xt.resizeGrip})}),mn&&g.jsxs("div",{style:Xt.visualPane,children:[t!==xt.immersive&&g.jsxs("div",{style:Xt.canvasControls,children:[Fi&&g.jsx("button",{style:Xt.backButton,onClick:Tr,title:"Go back",children:"← Back"}),g.jsx("button",{style:Xt.closeVisual,onClick:hn,children:"✕"})]}),g.jsxs("div",{style:{...Xt.visualContent,padding:s===ae.workshop||s===ae.realTerminal||s===ae.webEmbed?0:24,...s===ae.webEmbed?{overflow:"hidden",display:"flex",flexDirection:"column"}:{}},children:[s===ae.dashboard&&g.jsx(b3,{data:l,getBelt:Pg,getNextBelt:EU,BELTS:Ad}),s===ae.canvas&&g.jsx(_N,{data:h}),s===ae.quiz&&g.jsx(vN,{data:p,sendEvent:lr}),s===ae.playground&&g.jsx(EN,{data:y,sendEvent:lr}),s===ae.terminal&&g.jsx(RN,{data:v,sendEvent:lr}),s===ae.game&&g.jsx(ON,{data:C,sendEvent:lr}),s===ae.html&&g.jsx($N,{data:L,onLinkClick:wi}),s===ae.webEmbed&&g.jsx(Dq,{data:V,sendEvent:lr,onReportBack:Hi}),s===ae.slides&&g.jsx(_U,{data:H,sendEvent:lr}),s===ae.realTerminal&&g.jsx(xB,{data:R,sendEvent:lr,onSendToChat:Hi}),s===ae.workshop&&g.jsx(Lq,{data:A,sendEvent:lr,onSendToChat:Hi}),s===ae.modules&&g.jsx(JW,{data:l,onStartLearning:se=>hi("/teach "+se),onSelectModule:se=>{j(se),a(ae.moduleDetail)}}),s===ae.moduleDetail&&$&&g.jsx(rU,{moduleData:$,onBack:()=>a(ae.modules),onStartLearning:se=>hi("/teach "+se)}),s===ae.achievements&&g.jsx(KW,{data:l}),s===ae.settings&&g.jsx(sH,{}),s===ae.journeys&&g.jsx(Kq,{onSelectJourney:se=>{z(se),a(ae.journeyMap)},onStartModule:se=>hi("/teach "+se)}),s===ae.journeyMap&&g.jsx(Jq,{journey:F,onBack:()=>a(ae.journeys),onStartModule:se=>hi("/teach "+se),onActivate:se=>{fetch("http://localhost:3456/api/journeys/activate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:se.slug})}).then(()=>a(ae.journeys))}}),s===ae.about&&g.jsx(Uq,{}),s===ae.playgroundDemo&&g.jsx(lU,{onPreview:se=>{const mt={"canvas:diagram":ae.canvas,"canvas:quiz":ae.quiz,"canvas:code":ae.playground,"canvas:terminal":ae.terminal,"canvas:real-terminal":ae.realTerminal,"canvas:workshop":ae.workshop,"canvas:game":ae.game,"canvas:html":ae.html,"canvas:web-embed":ae.webEmbed,"canvas:slides":ae.slides,"canvas:dashboard":ae.dashboard}[se];mt&>(mt)}})]})]})]}),t===xt.immersive&&g.jsx(QN,{onClick:Xs}),W&&g.jsx(PN,{data:W,getBelt:Pg})]})}function MU(e){return{container:{display:"flex",flexDirection:"column",height:"100vh",backgroundColor:e.bgPrimary,color:e.textPrimary},errorBanner:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",backgroundColor:e.errorBg,borderBottom:`1px solid ${e.error}`,fontSize:13,color:e.error,flexShrink:0},reconnectButton:{padding:"4px 12px",fontSize:12,color:"#fff",backgroundColor:e.errorButton,border:"none",borderRadius:6,cursor:"pointer"},splitPane:{display:"flex",flex:1,overflow:"hidden"},chatPane:{display:"flex",flexDirection:"column",transition:"width 0.3s ease, opacity 0.3s ease",minWidth:0,overflow:"hidden"},resizeHandle:{width:6,cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:e.border,transition:"background 0.15s ease",position:"relative",zIndex:5},resizeGrip:{width:3,height:32,borderRadius:2,background:e.textMuted||e.border,opacity:.5,transition:"opacity 0.15s ease"},visualPane:{flex:1,display:"flex",flexDirection:"column",position:"relative",minWidth:0,overflow:"hidden"},canvasControls:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",alignItems:"center",gap:4},backButton:{height:28,padding:"0 10px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:500,color:e.textSecondary,backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer",fontFamily:"inherit"},closeVisual:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,color:e.textSecondary,backgroundColor:e.bgTertiary,border:`1px solid ${e.border}`,borderRadius:6,cursor:"pointer"},visualContent:{flex:1,overflow:"auto",padding:24},placeholder:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:12,color:e.textPrimary}}}function LU(){const[e,t]=M.useState(null);M.useEffect(()=>{fetch(`${$s}/api/settings`).then(i=>i.ok?i.json():null).then(i=>{i!=null&&i.model&&t(i.model)}).catch(()=>{})},[]),M.useEffect(()=>{const i=n=>t(n.detail);return window.addEventListener("settings:model-changed",i),()=>window.removeEventListener("settings:model-changed",i)},[]);const r=M.useMemo(()=>e?{model:e}:{},[e]);return g.jsx(LL,{url:my,config:r,children:g.jsx(BU,{})})}mL.createRoot(document.getElementById("root")).render(g.jsx(iS.StrictMode,{children:g.jsx(WL,{children:g.jsx(LU,{})})}));export{OS as $,pc as A,A3 as B,AA as C,d0 as D,LS as E,Pr as F,cj as G,u4 as H,Lv as I,yI as J,G3 as K,Ia as L,OU as M,Qd as N,dA as O,Ry as P,Pv as Q,r4 as R,Bu as S,lj as T,jc as U,vA as V,$c as W,Le as X,Fe as Y,ej as Z,T as _,TA as a,E$ as a$,ZP as a0,e1 as a1,Jv as a2,XU as a3,UU as a4,YU as a5,GU as a6,HU as a7,qy as a8,KU as a9,X$ as aA,W6 as aB,H$ as aC,i0 as aD,G1 as aE,Fj as aF,JP as aG,zU as aH,yy as aI,Hc as aJ,zj as aK,jj as aL,M as aM,iS as aN,Fy as aO,Ps as aP,bc as aQ,Gv as aR,AD as aS,Fo as aT,Q$ as aU,Bk as aV,Vd as aW,Xd as aX,yd as aY,Lk as aZ,Ek as a_,qU as aa,ga as ab,ZU as ac,QU as ad,VU as ae,uz as af,ET as ag,aV as ah,xI as ai,sr as aj,Gs as ak,r0 as al,Jk as am,Ho as an,$k as ao,Ye as ap,An as aq,rO as ar,oV as as,lV as at,nV as au,Ie as av,sV as aw,zz as ax,Dz as ay,Az as az,kA as b,De as b0,mk as b1,li as b2,kD as b3,Oy as b4,JS as b5,Oc as b6,rw as b7,WU as b8,R3 as b9,o0 as bA,wk as bB,Mm as bC,Z$ as bD,Kd as bE,AU as bF,ct as bG,K$ as ba,W$ as bb,M6 as bc,n0 as bd,w$ as be,J$ as bf,Wc as bg,Ua as bh,pd as bi,P$ as bj,kO as bk,Nc as bl,md as bm,B$ as bn,bk as bo,A6 as bp,D6 as bq,_o as br,v1 as bs,P6 as bt,s0 as bu,R6 as bv,j6 as bw,Va as bx,Vs as by,g1 as bz,dt as c,nt as d,zS as e,ir as f,BA as g,ns as h,zi as i,kI as j,Ha as k,ue as l,zk as m,FU as n,hV as o,MA as p,LA as q,cV as r,EA as s,_I as t,sn as u,Mz as v,dj as w,JU as x,CA as y,NU as z};
|