lookatstudy-mobile 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.cjs +16716 -10339
- package/sql-wasm.wasm +0 -0
- package/web/assets/{CanvasStage-CCg0mR3C.js → CanvasStage-DcY9FglU.js} +1 -1
- package/web/assets/{CommandPalette-R5Ao1bZa.js → CommandPalette-tZMcQe5D.js} +1 -1
- package/web/assets/CompanionBotLab-4Juuhsy3.js +8 -0
- package/web/assets/{CourseSearchPanel-ZiNMRYeo.js → CourseSearchPanel-CmLns2yC.js} +1 -1
- package/web/assets/{ExamView-DiBjtPlN.js → ExamView-BlkV25Ym.js} +1 -1
- package/web/assets/{ReviewPanel-BS8bsZT9.js → ReviewPanel-BbZgIEOl.js} +1 -1
- package/web/assets/SettingsView-DOqz88aY.js +10 -0
- package/web/assets/{VoicePanel-BPABzLLX.js → VoicePanel-CF0yfV61.js} +1 -1
- package/web/assets/{abnfDiagram-N423BO3Z-D3qEZ3wx.js → abnfDiagram-VCTEODGH-B0h4WdfU.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-BBQ0ZYnF.js → abnfDiagram-VCTEODGH-ODA7YWAP-DeH5EHKO.js} +1 -1
- package/web/assets/alien-body-DXq5WJRs.png +0 -0
- package/web/assets/alien-happy-Ci3JfpxD.png +0 -0
- package/web/assets/alien-head-CS10QxqG.png +0 -0
- package/web/assets/alien-idle-D2VKjYsl.png +0 -0
- package/web/assets/alien-keyL-C_tZriGQ.png +0 -0
- package/web/assets/alien-thinking-gWKA2xDz.png +0 -0
- package/web/assets/api-web-BCzlfr07.js +1 -0
- package/web/assets/{arc-DIdxrd7q.js → arc-D2ssjz3E.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-BcPfzHrO.js → architectureDiagram-5GKGNRK7-C4PU3XN7-O1PH9ETp.js} +1 -1
- package/web/assets/{architectureDiagram-T3A2C74G-BetPhhJ_.js → architectureDiagram-5GKGNRK7-CZiwpSIU.js} +1 -1
- package/web/assets/{arrow-right-BW9yawWu.js → arrow-right-ZgwAB0Oh.js} +1 -1
- package/web/assets/blockDiagram-I7D4REHJ-CTJZJ9DU.js +129 -0
- package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-DZDS1Qrk.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-BiPblLkv.js} +1 -1
- package/web/assets/c4Diagram-7LVT6UL2-DZtg_M1W.js +38 -0
- package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-MNKifmBN.js → c4Diagram-UCG6FXSJ-75X3U2P3-DOkYNs1h.js} +1 -1
- package/web/assets/channel-DrISSLN6.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-C7xrI1z5.js → chunk-2Q5K7J3B-IVmUwOK1.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-DGzhNwYE.js → chunk-5VM5RSS4-Bla5V1Pf.js} +1 -1
- package/web/assets/{chunk-7XDTSPCN-BpaSrByV.js → chunk-7XDTSPCN-BYMWtS0E.js} +1 -1
- package/web/assets/{chunk-CTNIYPP6-D_psz8OE.js → chunk-CTNIYPP6-nIqkMlkE.js} +1 -1
- package/web/assets/{chunk-CXNFBKHE-B3NrBrh5.js → chunk-CXNFBKHE-DirLKmET.js} +1 -1
- package/web/assets/{chunk-2GRJ4B5K-MGdPJJSz.js → chunk-F27PBJKO-BccCnM-c.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-q7_wbM5v.js → chunk-IMKFNOWR-CDsGCjBj.js} +5 -5
- package/web/assets/{chunk-ISA7TJRJ-BWhRpuJG.js → chunk-ISA7TJRJ-B09GlFQg.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-Q9MkO98l.js → chunk-JWPE2WC7-Sk2NcwYc.js} +1 -1
- package/web/assets/{chunk-LV3HUYFY-BFhZlxBi.js → chunk-LV3HUYFY-jKoQr5jq.js} +1 -1
- package/web/assets/{chunk-M3IUQBOH-CAPsa3nq.js → chunk-M3IUQBOH-CCH88sXa.js} +1 -1
- package/web/assets/{chunk-NDIOYS4C-DKs52SAc.js → chunk-NDIOYS4C-B3NoU2ny.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-BnDJz0cn.js → chunk-POPQ4Y6H-Bc9BIobY.js} +1 -1
- package/web/assets/{chunk-RE4WF27V-BzaQ0kW3.js → chunk-RE4WF27V-DLkkBMn8.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-Bnx3pMW2.js → chunk-SVP7TREG-t5j2hDHP.js} +4 -4
- package/web/assets/{chunk-GF5L2VYU-DH4Xjup-.js → chunk-TICWLB2K-Cdq9enoK.js} +1 -1
- package/web/assets/{chunk-VII2H2IX-efS7Zm4t.js → chunk-VII2H2IX-Q-4hwzqf.js} +1 -1
- package/web/assets/{chunk-X5GNSKZ3-DYokAkhB.js → chunk-X5GNSKZ3-BduUzztZ.js} +1 -1
- package/web/assets/{chunk-XCWWM2C3-1jGJbVyZ.js → chunk-XCWWM2C3-CmRQ37Z-.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-BawDkI_V.js → chunk-XXDRQBXY-RDKru4S3.js} +1 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-S2GiED7x.js +1 -0
- package/web/assets/classDiagram-ZZMXUADV-B5J6aXSd.js +1 -0
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-S2GiED7x.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-B5J6aXSd.js +1 -0
- package/web/assets/{core-a88hYP2v.js → core-BlkiKd71.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-Jl-SkPuF.js → cose-bilkent-JH36ORCC-BZZNZOKT.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-CrbHDK16.js → cose-bilkent-JH36ORCC-OB24KH3T-CRxWxGSK.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-BjNU-j_h.js → cynefin-OW5HDTMX-DauOVu5M.js} +3 -3
- package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-B-NBQ_17.js → cynefin-OW5HDTMX-GVF3BKWE-BZOajRm7.js} +1 -1
- package/web/assets/{cynefinDiagram-MW4NZA55-B7Vbl8wF.js → cynefinDiagram-5FMLGOSQ-D10F66X6.js} +2 -2
- package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-C9I0D50W.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-Dqr0KtEd.js} +1 -1
- package/web/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
- package/web/assets/{dagre-3AP2YEHR-DCERTXHT-BDRZvdKj.js → dagre-3AP2YEHR-DCERTXHT-BZmv_lNf.js} +1 -1
- package/web/assets/dagre-GXQ25YYZ-CAfkzaky.js +4 -0
- package/web/assets/diagram-S7CK7UJ4-BxZibnHP.js +30 -0
- package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-Uwc94dO5.js → diagram-S7CK7UJ4-MULGZGEL-BzWEa8_M.js} +1 -1
- package/web/assets/diagram-UQ7AKVKN-CtR02u37.js +41 -0
- package/web/assets/{diagram-UQ7AKVKN-YQBY353J-DpKpMQdr.js → diagram-UQ7AKVKN-YQBY353J-wl0c7kCj.js} +1 -1
- package/web/assets/{diagram-B4RE2ZJO-C7Vyc_yD.js → diagram-VSXAHHWV-Dq1BcEBU.js} +3 -3
- package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-BvnZVqDy.js → diagram-VSXAHHWV-WLNH2ELY-DOJCtIW4.js} +1 -1
- package/web/assets/{diagram-Q27KOJAE-C-p9KRf2.js → diagram-VX7I27RA-BrcWQkLH.js} +11 -11
- package/web/assets/{diagram-VX7I27RA-XW6YQV5G-CRLosetY.js → diagram-VX7I27RA-XW6YQV5G-BecNjFp3.js} +1 -1
- package/web/assets/{diagram-LBJQPF4R-CmaGFdAR.js → diagram-Z3DM3KII--tkThfBF.js} +2 -2
- package/web/assets/{diagram-Z3DM3KII-HG7RF65D-CDhznfkR.js → diagram-Z3DM3KII-HG7RF65D-g1e7G_OT.js} +1 -1
- package/web/assets/{ebnfDiagram-BXEA7PRR-ClYHHpf3.js → ebnfDiagram-PWID7BFC-B3G4lmI1.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-SCAzhJFX.js → ebnfDiagram-PWID7BFC-OKY4VHYD-BDbAdCss.js} +1 -1
- package/web/assets/{elk.bundled-COEZiBRU.js → elk.bundled-Fo5ndUql.js} +1 -1
- package/web/assets/erDiagram-RLTQ6QDP-lqWxuCah.js +99 -0
- package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-Cic-rvYb.js → erDiagram-SSCWMZ5O-PIPKOIK7-DOocgi1s.js} +1 -1
- package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-Buf1q55B.js → flowDiagram-A5DVABFB-2Z4AVO5R-DsoAWMwn.js} +1 -1
- package/web/assets/flowDiagram-HODETNUW-B7yiOIev.js +168 -0
- package/web/assets/{ganttDiagram-PKOTCBZU-Cch79h3b.js → ganttDiagram-EL5Y4UJY-BR2TPWXk.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-4j9UxRRI.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-DfMon8k9.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-DEY2TMGz.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-_h9H6w3H.js} +1 -1
- package/web/assets/{gitGraphDiagram-DS77QQ5N-CE7GRTAT.js → gitGraphDiagram-WWUBYQGX-Xe6inQ3n.js} +3 -3
- package/web/assets/{index-Cid4nWeb.js → index-0xeLsfhf.js} +2 -2
- package/web/assets/index-CJuEfFQr.js +53 -0
- package/web/assets/index-CvvLDKMx.css +1 -0
- package/web/assets/{index-auPs2wIW.js → index-CzWz6k7C.js} +1 -1
- package/web/assets/{index-Cq6cgm2q.js → index-DkfK1JQF.js} +4 -4
- package/web/assets/{infoDiagram-6WML65LV-CLqRvjN1.js → infoDiagram-27XIBGKW-Czas8puL.js} +1 -1
- package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-B-gCpjUC.js → infoDiagram-RXCK75RN-HANS5KVC-Bd4OznzT.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-Bsci7xnu.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-aWLOSkwB.js} +1 -1
- package/web/assets/{ishikawaDiagram-WSZJBQD7-Br8hddHM.js → ishikawaDiagram-5VMMS53U-CeZO1ErN.js} +4 -4
- package/web/assets/{journeyDiagram-NVQOT4AX-q7oxzffp.js → journeyDiagram-3NMN7TZE-B5XAib_V.js} +2 -2
- package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-C3S3QJ0n.js → journeyDiagram-EYS64GPL-OAPELBT7-Dn52wrwC.js} +1 -1
- package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-DNpRVVuU.js → kanban-definition-3QL26DDD-I7RKWQQY-DTWgZ4ns.js} +1 -1
- package/web/assets/{kanban-definition-27J2QSJJ-Dx7aMk7V.js → kanban-definition-UXKFOSKX-Cr8AHjR-.js} +6 -6
- package/web/assets/{katex-N6JRN4PM-DUn2v_Up.js → katex-N6JRN4PM-Dln3Rh5X.js} +1 -1
- package/web/assets/layout-CeX8C-aT.js +1 -0
- package/web/assets/{linear-DQOfHiUP.js → linear-CZIIlCMp.js} +1 -1
- package/web/assets/main-B2MNBn0I.js +487 -0
- package/web/assets/{main-BXa7WYYr.css → main-D9IB7N5p.css} +1 -1
- package/web/assets/{mermaid-layout-elk.core-hmulpQUA.js → mermaid-layout-elk.core-BKrVBrjK.js} +2 -2
- package/web/assets/mermaid.core-CNNsXEoY.js +312 -0
- package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-DMlLaIf9.js → mindmap-definition-FBJOCRG2-KIYZG64Y-BIpsTY8k.js} +1 -1
- package/web/assets/{mindmap-definition-FAOFIHXS-HsDwfUOG.js → mindmap-definition-YA3MSWOX-Cja29reW.js} +1 -1
- package/web/assets/{pegDiagram-VL7TDLO6-B_CQxksA.js → pegDiagram-XKGWAZYB-B3qAKk82.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-CwSsFCw4.js → pegDiagram-XKGWAZYB-OIP57N6J-CP34Xvef.js} +1 -1
- package/web/assets/{pet-BqoPCJEd.js → pet-B9Zl6XGT.js} +1 -1
- package/web/assets/pie-CJLEE_I4.js +1 -0
- package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-DcGAFS18.js → pieDiagram-E7YTZNPT-2UOTW327-C5_WBzoz.js} +1 -1
- package/web/assets/{pieDiagram-7S7Q4E2Y-Dz7YO9kD.js → pieDiagram-E7YTZNPT-DwpSG9Do.js} +3 -3
- package/web/assets/{quadrantDiagram-CIZ2JOQS-C6bWSZMA.js → quadrantDiagram-AXDQQJYC-CY69Lp-F.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-CoF5reED.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-BeS0vZpN.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-Lt-SXGEJ.js → railroadDiagram-O6MQD6OU-34742W6X-Deq8Ji6H.js} +1 -1
- package/web/assets/{railroadDiagram-AXF67PYL-_W8MikWh.js → railroadDiagram-O6MQD6OU-DdoJc4aQ.js} +1 -1
- package/web/assets/{render-O7CIS3YK-DiJ-EmQM.js → render-O7CIS3YK-CisxaeMC.js} +7 -7
- package/web/assets/{requirementDiagram-LRYGKXZP-SrMwv2X8.js → requirementDiagram-BXWQKSXE-CB6o8-2g.js} +5 -5
- package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-BludraKW.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-R2ZtCsxF.js} +1 -1
- package/web/assets/{rotate-ccw-D1vRxSpM.js → rotate-ccw-xYwEt1kf.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-BlzAtbTK.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-DkJU_sJy.js} +1 -1
- package/web/assets/{sankeyDiagram-W5VNT64P-DdLeFYgz.js → sankeyDiagram-P5KCCOFB-DzuizYJo.js} +2 -2
- package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-CEylu1jV.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-ByCpQL9y.js} +1 -1
- package/web/assets/{sequenceDiagram-SI44F4Z6-BcQQ0nzP.js → sequenceDiagram-WJ2MYXX4-kvkeg1mw.js} +4 -4
- package/web/assets/{sizeCapture-X5ZJPWSS-DMJpw6x4.js → sizeCapture-INFHLROL-DoEjAEJr.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-DvxYnTjx.js → sizeCapture-X5ZJPWSS-PSGVOMYM-CRDCUOdd.js} +1 -1
- package/web/assets/stateDiagram-D77RDMKH-Cuc2acbM.js +1 -0
- package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-p_Muo_9t.js → stateDiagram-HBIQ2CUA-4M2S6MAN-CSW8qTg0.js} +1 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-BPPUyKbF.js +1 -0
- package/web/assets/stateDiagram-v2-MP3YSRHH-C35OyFlH.js +1 -0
- package/web/assets/swimlanes-42K2YHIH-CQXfgkU2.js +1 -0
- package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-CTQ-daQG.js → swimlanes-XN3QIQJK-N6N2CCQ6-nDo5GYiZ.js} +1 -1
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-C2TeCGZT.js +8 -0
- package/web/assets/swimlanesDiagram-VR7AAH4N-D8S-BG4u.js +8 -0
- package/web/assets/{time-BgujFIZT.js → time-C0TNQg6r.js} +1 -1
- package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-O8Yphry8.js → timeline-definition-24CTP7MA-KN7RSRVM-Xmb7Q8Oz.js} +1 -1
- package/web/assets/{timeline-definition-Z64GVDOM-CXw6-4p3.js → timeline-definition-24CTP7MA-xk2j2ZWi.js} +3 -3
- package/web/assets/{transform-B5_amWNh.js → transform-Bd_a5eGM.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-B4C2KaX_.js → vennDiagram-4TSXK5OY-AKJ7LXAN-B_XZ_176.js} +1 -1
- package/web/assets/{vennDiagram-T6HMQDX7-Cscv288S.js → vennDiagram-4TSXK5OY-CGG5uw42.js} +5 -5
- package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-DC6vVvzB.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-D65QOiaZ.js} +1 -1
- package/web/assets/{wardleyDiagram-T6FBY63Y-C6LZlU6j.js → wardleyDiagram-VM6X3IG4-CPVqnA6b.js} +1 -1
- package/web/assets/xychartDiagram-S5SC5T6Z-D_46oNsn.js +7 -0
- package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-Bj6wGGRd.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-D-tPJCW-.js} +1 -1
- package/web/index.html +4 -4
- package/web/pet.html +3 -3
- package/web/assets/SettingsView-DtRypHxS.js +0 -7
- package/web/assets/api-web-BUHi8j_m.js +0 -1
- package/web/assets/blockDiagram-VBNYF7ZC-CwbzWh4u.js +0 -132
- package/web/assets/c4Diagram-5PPSVZJV-CuoQiYnK.js +0 -10
- package/web/assets/channel-C4o9Ykyf.js +0 -1
- package/web/assets/chunk-RYQCIY6F-DB7ZT0W5.js +0 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-DqD8T9BT.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-BHZwOJ3M.js +0 -1
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-DqD8T9BT.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-BHZwOJ3M.js +0 -1
- package/web/assets/cytoscape.esm-DTSO7Bv0.js +0 -331
- package/web/assets/dagre-VZM6K2ZE-DBJln4b_.js +0 -4
- package/web/assets/diagram-7IWD3JNH-Dn2grKMm.js +0 -30
- package/web/assets/diagram-UB23O5K3-BeBC1pLd.js +0 -41
- package/web/assets/erDiagram-JOGREHBK-CQtxmkXJ.js +0 -85
- package/web/assets/flowDiagram-UKHOOZJN-DTNxUKXJ.js +0 -156
- package/web/assets/graph-C9eacEi8.js +0 -1
- package/web/assets/index-BlYQ3CxE.css +0 -1
- package/web/assets/index-DjO1zEnx.js +0 -53
- package/web/assets/layout-DEXfKzaS.js +0 -1
- package/web/assets/main-BbOwLoeH.js +0 -463
- package/web/assets/map-Czzmt4hB.js +0 -1
- package/web/assets/mermaid.core-DUsXuPYV.js +0 -314
- package/web/assets/pie-5VdQHRMI.js +0 -1
- package/web/assets/stateDiagram-OKZ733FA-B0IjuFEV.js +0 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-D1Y1O6zn.js +0 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-SKGW5UQZ.js +0 -1
- package/web/assets/swimlanes-SLNWSIFB-BODuryXb.js +0 -2
- package/web/assets/swimlanesDiagram-ULZ7WXOC-C0vv9__D.js +0 -8
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-DGgs8WcV.js +0 -8
- package/web/assets/xychartDiagram-ELKLHX3M-DZ07gv7H.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as mi,g as yi,o as li,n as bi,a as Ai,b as Ci,_ as n,l as ci,G as wi,d as Si,p as Ri,A as Mt,h as _i,C as gi,D as ki,I as Ti,J as Di}from"./render-O7CIS3YK-
|
|
1
|
+
import{s as mi,g as yi,o as li,n as bi,a as Ai,b as Ci,_ as n,l as ci,G as wi,d as Si,p as Ri,A as Mt,h as _i,C as gi,D as ki,I as Ti,J as Di}from"./render-O7CIS3YK-CisxaeMC.js";import{_ as r}from"./mermaid-layout-elk.core-BKrVBrjK.js";import{l as ai}from"./transform-Bd_a5eGM.js";import{b as ni}from"./band-dPffDWoQ.js";import{l as oi}from"./linear-CZIIlCMp.js";import"./main-B2MNBn0I.js";import"./index-CJuEfFQr.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./init-Gi6I4Gst.js";import"./ordinal-Cboi1Yqb.js";import"./defaultLocale-5voVPcsN.js";var It=(function(){var e=n(function(F,l,u,x){for(u=u||{},x=F.length;x--;u[F[x]]=l);return u},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],a=[1,5],h=[1,6],c=[1,7],b=[1,5,10,12,14,16,18,19,21,23,36,37,38],p=[1,25],m=[1,26],k=[1,28],T=[1,29],L=[1,30],W=[1,31],X=[1,32],E=[1,33],B=[1,34],A=[1,35],D=[1,36],g=[1,37],M=[1,43],V=[1,42],Y=[1,47],N=[1,50],R=[1,10,12,14,16,18,19,21,23,36,37,38],U=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],C=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],w=[1,65],z=[26,28],_={trace:n(r(function(){},"trace"),"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:n(r(function(l,u,x,d,S,o,ct){var f=o.length-1;switch(S){case 5:d.setOrientation(o[f]);break;case 9:d.setDiagramTitle(o[f].text.trim());break;case 12:d.setLineData({text:"",type:"text"},o[f]);break;case 13:d.setLineData(o[f-1],o[f]);break;case 14:d.setBarData({text:"",type:"text"},o[f]);break;case 15:d.setBarData(o[f-1],o[f]);break;case 16:this.$=o[f].trim(),d.setAccTitle(this.$);break;case 17:case 18:this.$=o[f].trim(),d.setAccDescription(this.$);break;case 19:this.$=o[f-1];break;case 20:case 30:this.$=[o[f-2],...o[f]];break;case 21:case 31:this.$=[o[f]];break;case 22:this.$={value:Number(o[f-1]),label:o[f]};break;case 23:this.$={value:Number(o[f]),label:""};break;case 24:d.setXAxisTitle(o[f]);break;case 25:d.setXAxisTitle(o[f-1]);break;case 26:d.setXAxisTitle({type:"text",text:""});break;case 27:d.setXAxisBand(o[f]);break;case 28:d.setXAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 29:this.$=o[f-1];break;case 32:d.setYAxisTitle(o[f]);break;case 33:d.setYAxisTitle(o[f-1]);break;case 34:d.setYAxisTitle({type:"text",text:""});break;case 35:d.setYAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 39:this.$={text:o[f],type:"text"};break;case 40:this.$={text:o[f],type:"text"};break;case 41:this.$={text:o[f],type:"markdown"};break;case 42:this.$=o[f];break;case 43:this.$=o[f-1]+""+o[f];break}},"anonymous"),"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:a,37:h,38:c}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:a,37:h,38:c}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:h,38:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(b,[2,36]),e(b,[2,37]),e(b,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:a,37:h,38:c}),{1:[2,3]},e(b,[2,5]),e(t,[2,7],{4:22,36:a,37:h,38:c}),{11:23,30:p,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},{11:39,13:38,24:M,29:V,30:p,31:40,32:41,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},{11:45,15:44,29:Y,30:p,35:46,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},{11:49,17:48,24:N,30:p,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},{11:52,17:51,24:N,30:p,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},{20:[1,53]},{22:[1,54]},e(R,[2,18]),{1:[2,2]},e(R,[2,8]),e(R,[2,9]),e(U,[2,39],{41:55,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g}),e(U,[2,40]),e(U,[2,41]),e(C,[2,42]),e(C,[2,44]),e(C,[2,45]),e(C,[2,46]),e(C,[2,47]),e(C,[2,48]),e(C,[2,49]),e(C,[2,50]),e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),e(R,[2,10]),e(R,[2,24],{32:41,31:56,24:M,29:V}),e(R,[2,26]),e(R,[2,27]),{33:[1,57]},{11:59,30:p,34:58,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},e(R,[2,11]),e(R,[2,32],{35:60,29:Y}),e(R,[2,34]),{33:[1,61]},e(R,[2,12]),{17:62,24:N},{25:63,27:64,29:w},e(R,[2,14]),{17:66,24:N},e(R,[2,16]),e(R,[2,17]),e(C,[2,43]),e(R,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(R,[2,33]),{29:[1,70]},e(R,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(z,[2,23],{30:[1,73]}),e(R,[2,15]),e(R,[2,28]),e(R,[2,29]),{11:59,30:p,34:74,39:24,40:m,41:27,42:k,43:T,44:L,45:W,46:X,47:E,48:B,49:A,50:D,51:g},e(R,[2,35]),e(R,[2,19]),{25:75,27:64,29:w},e(z,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:n(r(function(l,u){if(u.recoverable)this.trace(l);else{var x=new Error(l);throw x.hash=u,x}},"parseError"),"parseError"),parse:n(r(function(l){var u=this,x=[0],d=[],S=[null],o=[],ct=this.table,f="",ft=0,ti=0,di=2,ii=1,pi=o.slice.call(arguments,1),P=Object.create(this.lexer),q={yy:{}};for(var Dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Dt)&&(q.yy[Dt]=this.yy[Dt]);P.setInput(l,q.yy),q.yy.lexer=P,q.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var Pt=P.yylloc;o.push(Pt);var fi=P.options&&P.options.ranges;typeof q.yy.parseError=="function"?this.parseError=q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ei(I){x.length=x.length-2*I,S.length=S.length-I,o.length=o.length-I}r(ei,"popStack"),n(ei,"popStack");function Lt(){var I;return I=d.pop()||P.lex()||ii,typeof I!="number"&&(I instanceof Array&&(d=I,I=d.pop()),I=u.symbols_[I]||I),I}r(Lt,"lex"),n(Lt,"lex");for(var v,j,O,vt,rt={},mt,H,si,yt;;){if(j=x[x.length-1],this.defaultActions[j]?O=this.defaultActions[j]:((v===null||typeof v>"u")&&(v=Lt()),O=ct[j]&&ct[j][v]),typeof O>"u"||!O.length||!O[0]){var Et="";yt=[];for(mt in ct[j])this.terminals_[mt]&&mt>di&&yt.push("'"+this.terminals_[mt]+"'");P.showPosition?Et="Parse error on line "+(ft+1)+`:
|
|
2
2
|
`+P.showPosition()+`
|
|
3
3
|
Expecting `+yt.join(", ")+", got '"+(this.terminals_[v]||v)+"'":Et="Parse error on line "+(ft+1)+": Unexpected "+(v==ii?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(Et,{text:P.match,token:this.terminals_[v]||v,line:P.yylineno,loc:Pt,expected:yt})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+v);switch(O[0]){case 1:x.push(v),S.push(P.yytext),o.push(P.yylloc),x.push(O[1]),v=null,ti=P.yyleng,f=P.yytext,ft=P.yylineno,Pt=P.yylloc;break;case 2:if(H=this.productions_[O[1]][1],rt.$=S[S.length-H],rt._$={first_line:o[o.length-(H||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(H||1)].first_column,last_column:o[o.length-1].last_column},fi&&(rt._$.range=[o[o.length-(H||1)].range[0],o[o.length-1].range[1]]),vt=this.performAction.apply(rt,[f,ti,ft,q.yy,O[1],S,o].concat(pi)),typeof vt<"u")return vt;H&&(x=x.slice(0,-1*H*2),S=S.slice(0,-1*H),o=o.slice(0,-1*H)),x.push(this.productions_[O[1]][0]),S.push(rt.$),o.push(rt._$),si=ct[x[x.length-2]][x[x.length-1]],x.push(si);break;case 3:return!0}}return!0},"parse"),"parse")},lt=(function(){var F={EOF:1,parseError:n(r(function(u,x){if(this.yy.parser)this.yy.parser.parseError(u,x);else throw new Error(u)},"parseError"),"parseError"),setInput:n(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:n(function(l){var u=l.length,x=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===d.length?this.yylloc.first_column:0)+d[d.length-x.length].length-x[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(l){this.unput(this.match.slice(l))},"less"),pastInput:n(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+`
|
package/web/index.html
CHANGED
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
}
|
|
33
33
|
})();
|
|
34
34
|
</script>
|
|
35
|
-
<script type="module" crossorigin src="./assets/main-
|
|
36
|
-
<link rel="modulepreload" crossorigin href="./assets/index-
|
|
37
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
38
|
-
<link rel="stylesheet" crossorigin href="./assets/main-
|
|
35
|
+
<script type="module" crossorigin src="./assets/main-B2MNBn0I.js"></script>
|
|
36
|
+
<link rel="modulepreload" crossorigin href="./assets/index-CJuEfFQr.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CvvLDKMx.css">
|
|
38
|
+
<link rel="stylesheet" crossorigin href="./assets/main-D9IB7N5p.css">
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
41
41
|
<!-- 全局 SVG 滤镜定义:节点球积雪边缘的有机扭曲(feTurbulence fractalNoise + feDisplacementMap)。
|
package/web/pet.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' http://localhost:5173 ws://localhost:5173"
|
|
9
9
|
/>
|
|
10
10
|
<title>LookatStudy Pet</title>
|
|
11
|
-
<script type="module" crossorigin src="./assets/pet-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/index-
|
|
13
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/pet-B9Zl6XGT.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/index-CJuEfFQr.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CvvLDKMx.css">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./assets/pet-CTf4hJTR.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e,s as Ze,k as Qe,C as et,M as tt}from"./index-DjO1zEnx.js";import{c as st,u as ie,j as ne,k as he,a as i,W as $e,P as nt,l as ze,s as at,i as it,g as lt,m as ot,n as dt,o as rt}from"./main-BbOwLoeH.js";/**
|
|
2
|
-
* @license lucide-react v0.468.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ct=st("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),xe="bg-ink/[0.04] text-ink-strong text-label rounded-lg border border-transparent focus:border-accent focus:bg-ink/[0.06] transition-colors placeholder:text-ink-faint";function we({kind:t,showProtocol:x=!0,testPrefix:g="custom",titleKey:f="settings.custom.form_title",modelPhKey:c="settings.custom.model_ph",testOverride:r,onSaved:o,onCancel:u}){const m=ie(),[b,y]=a.useState(""),[p,w]=a.useState("openai-compatible"),[k,P]=a.useState(""),[d,_]=a.useState(""),[S,F]=a.useState(""),[G,I]=a.useState(!1),[V,D]=a.useState(!1),[A,z]=a.useState(null),L=async()=>{if(!(!k.trim()||!S.trim()||V)){D(!0),z(null);try{const l=r?await r({baseUrl:k.trim(),apiKey:d.trim(),model:S.trim()}):await i.testCustomProvider({label:b||m("settings.custom.test_label"),protocol:p,baseUrl:k.trim(),apiKey:d.trim()||void 0,defaultModel:S.trim()});z({ok:l.ok,detail:l.detail})}catch(l){z({ok:!1,detail:l instanceof Error?l.message:String(l)})}finally{D(!1)}}},N=async()=>{if(!(!b.trim()||!k.trim()||!S.trim()))try{const l=await i.createCustomProvider({label:b.trim(),kind:t,protocol:x?p:"openai-compatible",baseUrl:k.trim(),apiKey:d.trim()||void 0,defaultModel:S.trim(),vision:t==="llm"?G:void 0});o(l)}catch{}};return e.jsxs("div",{className:"space-y-2.5","data-testid":`${g}-provider-form`,children:[e.jsx("div",{className:"text-label font-bold text-ink-strong",children:m(f)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:b,onChange:l=>y(l.target.value),placeholder:m("settings.custom.label_ph"),"data-testid":`${g}-label`,className:`${xe} flex-1 px-2.5 py-1.5`}),x&&e.jsxs("select",{value:p,onChange:l=>w(l.target.value),"data-testid":`${g}-protocol`,className:`${xe} px-2 py-1.5`,children:[e.jsx("option",{value:"openai-compatible",children:m("settings.proto.openai")}),e.jsx("option",{value:"anthropic",children:"Anthropic"}),e.jsx("option",{value:"google",children:"Google"})]})]}),e.jsx("input",{type:"text",value:k,onChange:l=>P(l.target.value),placeholder:m("settings.custom.baseurl_ph"),"data-testid":`${g}-baseurl`,className:`${xe} w-full px-2.5 py-1.5 font-mono`}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:l=>F(l.target.value),placeholder:m(c),"data-testid":`${g}-model`,className:`${xe} flex-1 px-2.5 py-1.5 font-mono`}),e.jsx("input",{type:"password",value:d,onChange:l=>_(l.target.value),placeholder:m("settings.custom.apikey_ph"),"data-testid":`${g}-apikey`,className:`${xe} flex-1 px-2.5 py-1.5`})]}),t==="llm"&&e.jsxs("label",{className:"inline-flex items-center gap-2 text-label cursor-pointer select-none","data-testid":`${g}-vision`,children:[e.jsx("input",{type:"checkbox",checked:G,onChange:l=>I(l.target.checked),className:"w-4 h-4 rounded accent-brand"}),e.jsx("span",{className:"text-ink-strong",children:m("settings.custom.vision")}),e.jsx("span",{className:"text-ink-faint",children:m("settings.custom.visionHint")})]}),A&&e.jsxs("div",{className:`text-label rounded p-2 inline-flex items-start gap-1.5 ${A.ok?"bg-brand/10 text-brand":"bg-warning/10 text-warning"}`,children:[A.ok?e.jsx(ne,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}):e.jsx(he,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"break-words",children:A.detail})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>void L(),disabled:!k.trim()||!S.trim()||V,"data-testid":`${g}-test`,className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:m(V?"settings.testing":"settings.test")}),e.jsx("button",{onClick:()=>void N(),disabled:!b.trim()||!k.trim()||!S.trim(),"data-testid":`${g}-save`,className:"btn-3d-brand px-3 py-1.5 text-label disabled:opacity-40",children:m("settings.custom.save")}),u&&e.jsx("button",{onClick:u,className:"text-label text-ink-muted hover:text-ink-strong px-3 py-1.5 transition-colors",children:m("action.cancel")})]})]})}const Fe="lookatstudy-theme",Re="auto",Ke="(prefers-color-scheme: dark)";function Ce(){return typeof window>"u"||window.matchMedia(Ke).matches?"dark":"light"}function mt(){if(typeof localStorage>"u")return Re;const t=localStorage.getItem(Fe);return t==="auto"||t==="light"||t==="dark"?t:Re}function _e(t){const x=document.documentElement;x.classList.remove("dark","light"),x.classList.add(t),window.dispatchEvent(new CustomEvent("theme-changed",{detail:{resolved:t}}))}function ut(){const[t,x]=a.useState(()=>mt()),[g,f]=a.useState(()=>t==="auto"?Ce():t),c=a.useCallback(r=>{x(r),localStorage.setItem(Fe,r);const o=r==="auto"?Ce():r;f(o),_e(o)},[]);return a.useEffect(()=>{if(t!=="auto")return;const r=window.matchMedia(Ke),o=u=>{const m=u.matches?"dark":"light";f(m),_e(m)};return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),a.useEffect(()=>{const r=t==="auto"?Ce():t;f(r),_e(r)},[t]),{mode:t,resolved:g,setMode:c}}const xt="0.30.0",ht={version:xt};function ye(){window.dispatchEvent(new Event(rt))}const B="bg-surface-1 text-ink text-body rounded-lg border border-[var(--border)] focus:border-brand focus:outline-none transition-colors placeholder:text-ink-faint",W="bg-surface-3 text-ink-muted hover:bg-surface-3 hover:bg-surface-3 hover:text-ink-strong",U="bg-brand text-white shadow-sm";function j(t){return t?"px-4 py-3.5 border-t border-[var(--border-faint)]":"px-4 py-3.5"}function St(){const t=ie(),[x,g]=a.useState([]),[f,c]=a.useState([]),[r,o]=a.useState("glm"),[u,m]=a.useState(""),[b,y]=a.useState(""),[p,w]=a.useState(null),[k,P]=a.useState(!1),[d,_]=a.useState(null),[S,F]=a.useState(!1),[G,I]=a.useState(!1),[V,D]=a.useState([]),[A,z]=a.useState(!1),[L,N]=a.useState(null),[l,H]=a.useState(null),[Q,re]=a.useState(""),[ge,ce]=a.useState(!1),ee=ut(),le=async n=>{if(E)try{await i.updateCustomProvider(E.id,{vision:n}),await K()}catch{}},oe=async()=>{z(!0),N(null);try{const n=await i.discoverModels();n.ok&&n.models?D(n.models):N(n.error||t("settings.discover_failed"))}catch(n){N(n instanceof Error?n.message:String(n))}finally{z(!1)}},K=a.useCallback(async()=>{try{const[n,v,T,J]=await Promise.all([i.getProviderPresets(),i.listCustomProviders(),i.getSetting("active_provider"),i.getSetting("active_model")]);g(n),c(v);const M=T??"glm";if(o(M),M.startsWith("custom-")){const C=v.find($=>$.id===M);w(C!=null&&C.hasApiKey?t("settings.key.configured"):null)}else{const C=n.find($=>$.id===M);if(C){const $=await i.getSetting(C.apiKeySetting);w($?`${$.slice(0,4)}…${$.slice(-4)}`:null)}}if(M.startsWith("custom-")){const C=v.find($=>$.id===M);m(J??(C==null?void 0:C.defaultModel)??"")}else{const C=n.find($=>$.id===M);m(J??(C==null?void 0:C.defaultModel)??"")}}catch(n){console.error("[SettingsView] load() failed:",n)}},[t]);a.useEffect(()=>{K()},[K]);const me=async n=>{o(n),_(null),y("");const v=x.find(T=>T.id===n);if(v){const T=await i.getSetting(v.apiKeySetting);w(T?`${T.slice(0,4)}…${T.slice(-4)}`:null),m(u||v.defaultModel)}},pe=async()=>{F(!1);try{if(await i.setSetting("active_provider",r),await i.setSetting("active_model",u),b.trim()){const n=x.find(v=>v.id===r);n&&(await i.setSetting(n.apiKeySetting,b.trim()),w(`${b.trim().slice(0,4)}…${b.trim().slice(-4)}`),y(""))}F(!0),setTimeout(()=>F(!1),2e3),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},O=async()=>{P(!0),_(null);try{const n=await i.testLlmConnection();_(n)}catch(n){_({ok:!1,detail:n instanceof Error?n.message:String(n),errorKind:"unknown"})}finally{P(!1)}},fe=async n=>{await i.setSetting("active_provider",n.id),await i.setSetting("active_model",n.defaultModel),o(n.id),m(n.defaultModel),I(!1),await K(),window.dispatchEvent(new Event("llm-config-changed"))},te=async n=>{try{await i.deleteCustomProvider(n),r===n&&(await i.setSetting("active_provider","glm"),o("glm")),await K()}catch{}},E=r.startsWith("custom-")?f.find(n=>n.id===r):null;a.useEffect(()=>{if(!E)return;const n=E.models.find(v=>v.id===u);re(n!=null&&n.contextWindow?String(n.contextWindow):"")},[E,u]);const be=async()=>{var M,C;if(!E)return;const n=Q.trim().replace(/[,\s_]/g,""),v=/^(\d+)([km]?)$/i.exec(n);if(n!==""&&!v)return;const T=((M=v==null?void 0:v[2])==null?void 0:M.toLowerCase())==="k"?1e3:((C=v==null?void 0:v[2])==null?void 0:C.toLowerCase())==="m"?1e6:1,J=n===""||!v?null:Math.max(1,Math.round(parseInt(v[1],10)*T));ce(!0);try{const $=E.models.map(q=>q.id===u?{...q,contextWindow:J}:q);await i.updateCustomProvider(E.id,{models:$}),await K(),window.dispatchEvent(new Event("llm-config-changed"))}catch{}finally{ce(!1)}},Y=r.startsWith("custom-")?null:x.find(n=>n.id===r);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 pt-5 space-y-6",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.ai")}),e.jsxs("div",{className:"surface-card overflow-hidden",children:[e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.row.provider")}),e.jsxs("div",{className:"flex flex-wrap gap-1.5","data-testid":"provider-grid",children:[x.map(n=>e.jsx("button",{onClick:()=>me(n.id),"data-testid":`provider-card-${n.id}`,"aria-pressed":r===n.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors ${r===n.id?U:W}`,children:n.label},n.id)),f.filter(n=>n.kind==="llm").map(n=>e.jsxs("button",{onClick:()=>me(n.id),"data-testid":`provider-card-${n.id}`,"aria-pressed":r===n.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors inline-flex items-center gap-1 ${r===n.id?U:W}`,children:[e.jsx($e,{className:"w-3.5 h-3.5","aria-hidden":"true"}),n.label]},n.id)),e.jsxs("button",{onClick:()=>I(n=>!n),"data-testid":"add-custom-provider",className:"px-3 py-1.5 rounded-lg text-label whitespace-nowrap inline-flex items-center gap-1 border border-dashed border-[var(--border)] text-ink-muted hover:border-ink-muted hover:text-ink-strong transition-colors",children:[e.jsx(nt,{className:"w-3.5 h-3.5","aria-hidden":"true"}),t("settings.add_custom")]})]})]}),G&&e.jsx("div",{className:"px-4 py-3.5 bg-surface-1 border-t border-[var(--border-faint)]",children:e.jsx(we,{kind:"llm",testPrefix:"custom",onSaved:n=>void fe(n),onCancel:()=>I(!1)})}),f.length>0&&r.startsWith("custom-")&&e.jsx("div",{className:j(!0),children:e.jsx("button",{onClick:n=>{const v=n.currentTarget.getBoundingClientRect(),T=f.find(J=>J.id===r);T&&H({id:T.id,label:T.label,rect:v})},className:"text-label text-warning hover:underline",children:t("settings.delete_custom")})}),Y&&e.jsxs(e.Fragment,{children:[Y.baseUrl&&e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:"Base URL"}),e.jsx("code",{className:"text-label text-ink-faint font-mono break-all",children:Y.baseUrl})]}),e.jsxs("div",{className:j(!0),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:t("settings.model")}),e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[e.jsxs("select",{value:u,onChange:n=>m(n.target.value),"data-testid":"model-select",className:`${B} flex-1 px-2.5 py-1.5`,children:[Y.models.map(n=>e.jsx("option",{value:n.id,children:n.id},n.id)),r==="openrouter"&&V.map(n=>e.jsx("option",{value:n.id,children:n.id},n.id))]}),r==="openrouter"&&e.jsxs("button",{onClick:oe,disabled:A,"data-testid":"discover-models-btn",className:"text-label text-accent hover:underline disabled:opacity-40 whitespace-nowrap inline-flex items-center gap-1",children:[e.jsx(ct,{className:`w-3.5 h-3.5 ${A?"animate-spin":""}`,"aria-hidden":"true"}),t(A?"settings.discovering":"settings.refresh")]})]})]}),L&&e.jsx("div",{className:"text-label text-warning mt-1.5 ml-[68px]",children:L})]}),e.jsx("div",{className:j(!0),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:t("settings.apikey")}),e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[p&&e.jsxs("span",{className:"text-label text-brand shrink-0 inline-flex items-center gap-1",children:[e.jsx(ne,{className:"w-3.5 h-3.5","aria-hidden":"true"}),p]}),e.jsx("input",{type:"password",value:b,onChange:n=>y(n.target.value),placeholder:t(p?"settings.key.overwrite_ph":"settings.key.paste_ph"),"data-testid":"settings-key-input",className:`${B} flex-1 px-2.5 py-1.5`}),e.jsx("a",{href:Y.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-label text-brand hover:underline whitespace-nowrap",children:t("settings.key.get")})]})]})}),e.jsx("div",{className:j(!0),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 min-w-0",children:[e.jsx("button",{onClick:O,disabled:k,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:t(k?"settings.testing":"settings.test")}),d&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 min-w-0 break-words ${d.ok?"text-brand":"text-warning"}`,children:[d.ok?e.jsx(ne,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):e.jsx(he,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),d.detail]})]})})]}),E&&!Y&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:"Base URL"}),e.jsx("code",{className:"text-label text-ink-faint font-mono break-all",children:E.baseUrl})]}),e.jsx("div",{className:j(!0),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:t("settings.model")}),E.models.length>1?e.jsx("select",{value:u,onChange:n=>m(n.target.value),"data-testid":"model-select-custom",className:`${B} flex-1 px-2.5 py-1.5`,children:E.models.map(n=>e.jsx("option",{value:n.id,children:n.id},n.id))}):e.jsx("input",{type:"text",value:u,onChange:n=>m(n.target.value),placeholder:t("settings.custom.model_ph"),"data-testid":"model-input-custom",className:`${B} flex-1 px-2.5 py-1.5 font-mono`})]})}),e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.custom.windowLabel")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",inputMode:"numeric",value:Q,onChange:n=>re(n.target.value),placeholder:t("settings.custom.windowPh"),"data-testid":"context-window-input",className:`${B} flex-1 px-2.5 py-1.5 font-mono tabular-nums`}),e.jsx("button",{onClick:be,disabled:ge,"data-testid":"context-window-save",className:"btn-3d-neutral px-3 py-1.5 text-label shrink-0 disabled:opacity-40",children:t("settings.custom.save")})]}),e.jsx("div",{className:"text-caption text-ink-faint mt-1",children:t("settings.custom.windowHint")})]}),e.jsx("div",{className:j(!0),children:e.jsxs("label",{className:"inline-flex items-center gap-2 text-label cursor-pointer select-none","data-testid":"custom-vision-toggle",children:[e.jsx("input",{type:"checkbox",checked:E.vision,onChange:n=>void le(n.target.checked),className:"w-4 h-4 rounded accent-brand"}),e.jsx("span",{className:"text-ink-strong",children:t("settings.custom.vision")}),e.jsx("span",{className:"text-ink-faint",children:t("settings.custom.visionHint")})]})}),e.jsx("div",{className:j(!0),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 min-w-0",children:[e.jsx("button",{onClick:O,disabled:k,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:t(k?"settings.testing":"settings.test")}),d&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 min-w-0 break-words ${d.ok?"text-brand":"text-warning"}`,children:[d.ok?e.jsx(ne,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):e.jsx(he,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),d.detail]})]})})]})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.vision")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsx(pt,{activeProvider:r,activeModel:u,presets:x,customProviders:f})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.speech")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsx(Nt,{})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.memory")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsx(ft,{})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.companion")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsx(bt,{})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.appearance")}),e.jsxs("div",{className:"surface-card overflow-hidden",children:[e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.row.theme")}),e.jsx("div",{className:"flex gap-2",children:[{mode:"auto",label:t("settings.theme.auto")},{mode:"light",label:t("settings.theme.light")},{mode:"dark",label:t("settings.theme.dark")}].map(({mode:n,label:v})=>e.jsx("button",{onClick:()=>ee.setMode(n),"data-testid":`theme-${n}`,"aria-pressed":ee.mode===n,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${ee.mode===n?U:W}`,children:v},n))}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:ee.mode==="auto"?t("settings.theme.following",{mode:t(`settings.theme.${ee.resolved}`)}):null})]}),e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.row.interface_lang")}),e.jsx("div",{className:"flex gap-2",children:["zh-CN","en"].map(n=>e.jsx("button",{onClick:()=>at(n),"data-testid":`lang-${n}`,"aria-pressed":ze()===n,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${ze()===n?U:W}`,children:n==="zh-CN"?"中文":"English"},n))})]}),e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.row.import_lang")}),e.jsx(gt,{})]})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.data")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsx(kt,{})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-label font-bold text-ink-muted mb-2 px-1",children:t("settings.group.about")}),e.jsx("div",{className:"surface-card overflow-hidden",children:e.jsxs("div",{className:j(!1),children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong",children:t("settings.row.version")}),e.jsxs("a",{href:"https://github.com/Kaiji-Z/LookatStudy/releases",target:"_blank",rel:"noopener noreferrer",className:"text-label font-mono text-brand hover:underline","data-testid":"settings-version",children:["v",ht.version]})]}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.version.hint")})]})})]})]}),e.jsxs("div",{className:"sticky bottom-0 px-5 py-3 bg-surface-0 border-t border-[var(--border)] flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-label text-ink-muted",children:t("settings.footer.hint")}),e.jsxs("button",{onClick:pe,"data-testid":"settings-save",className:"btn-3d-brand px-5 py-2 text-body inline-flex items-center gap-1.5",children:[S&&e.jsx(it,{className:"w-4 h-4","aria-hidden":"true"}),t(S?"settings.saved_text":"settings.footer.save")]})]}),l&&e.jsx(lt,{anchorRect:l.rect,message:t("settings.delete_custom_confirm",{name:l.label}),danger:!0,confirmLabel:t("action.delete"),testid:"custom-provider-delete-confirm",onConfirm:()=>{te(l.id),H(null)},onCancel:()=>H(null)})]})}function gt(){const[t,x]=a.useState("en"),[g,f]=a.useState(!1);a.useEffect(()=>{i.getSetting("pref_lang").then(o=>{o&&x(o),f(!0)})},[]);const c=async o=>{x(o),await i.setSetting("pref_lang",o)},r=[{code:"en",label:"English"},{code:"zh-CN",label:"简体中文"},{code:"zh-TW",label:"繁體中文"}];return g?e.jsx("div",{className:"flex gap-2","data-testid":"pref-lang-options",children:r.map(o=>e.jsx("button",{onClick:()=>c(o.code),"data-testid":`pref-lang-${o.code}`,"aria-pressed":t===o.code,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${t===o.code?U:W}`,children:o.label},o.code))}):null}function pt({activeProvider:t,activeModel:x,presets:g,customProviders:f}){const c=ie(),[r,o]=a.useState(!1),[u,m]=a.useState(!1),[b,y]=a.useState(""),[p,w]=a.useState(!1),[k,P]=a.useState(!1),[d,_]=a.useState(null),[S,F]=a.useState(!1);a.useEffect(()=>{Promise.all([i.getSetting("flag_multimodal_import"),i.getSetting("vision_provider_override"),i.getSetting("vision_model_override"),i.getSetting("flag_math_vision")]).then(([l,H,Q])=>{o(l==="true"),y(H??""),F(Q==="true"),m(!0)})},[]);const G=async()=>{const l=!r;o(l),await i.setSetting("flag_multimodal_import",String(l))},I=async()=>{const l=!S;F(l),await i.setSetting("flag_math_vision",String(l))},V=async l=>{await i.setSetting("vision_provider_override",l.id),await i.setSetting("vision_model_override",l.defaultModel),y(l.id),w(!1)},D=async()=>{await i.setSetting("vision_provider_override",""),await i.setSetting("vision_model_override",""),y(""),w(!1)},A=async()=>{if(!k){P(!0),_(null);try{const l=await i.testLlmConnection({vision:!0});_({ok:l.ok,detail:l.detail})}catch(l){_({ok:!1,detail:l instanceof Error?l.message:String(l)})}finally{P(!1)}}},z=f.filter(l=>l.kind==="vision"),L=b.startsWith("custom-")?f.find(l=>l.id===b):null,N=b&&!b.startsWith("custom-")?g.find(l=>l.id===b):null;return u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[e.jsx(ae,{checked:r,onChange:G,label:c("settings.multimodal.toggle"),testid:"multimodal-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong",children:c("settings.multimodal.toggle")}),e.jsx("div",{className:"text-label text-ink-muted",children:c("settings.multimodal.toggle.desc")})]})]}),e.jsxs("div",{className:"px-4 py-3.5 border-t border-[var(--border-faint)] space-y-3",children:[e.jsxs("div",{className:"text-label text-ink-muted bg-ink/5 rounded-lg p-3",children:[e.jsx("div",{className:"font-medium mb-1",children:c("settings.multimodal.current_model",{model:x||c("settings.multimodal.not_selected")})}),e.jsx("div",{children:t.startsWith("custom-")?c("settings.multimodal.hint_custom"):c("settings.multimodal.hint_preset")})]}),e.jsxs("div",{className:"bg-ink/5 rounded-lg p-3",children:[e.jsx("div",{className:"text-label font-medium text-ink-muted mb-2",children:c("settings.multimodal.override_title")}),e.jsx("div",{className:"text-caption text-ink-muted mb-2",children:c("settings.multimodal.override_bridge_hint")}),e.jsxs("div",{className:"space-y-3 mt-1",children:[L&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx($e,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium text-ink-strong",children:L.label}),e.jsx("code",{className:"text-ink-faint font-mono break-all",children:L.defaultModel}),e.jsx("span",{className:"text-ink-faint break-all min-w-0",children:L.baseUrl})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{onClick:()=>void A(),disabled:k,"data-testid":"vision-override-test",className:"btn-3d-neutral px-4 py-1.5 text-label disabled:opacity-50",children:c(k?"settings.testing":"settings.multimodal.test_override")}),e.jsx("button",{onClick:()=>w(l=>!l),className:"text-label text-accent hover:underline",children:c("settings.multimodal.replace_custom")}),e.jsx("button",{onClick:()=>void D(),className:"text-label text-ink-muted hover:text-ink-strong",children:c("settings.multimodal.stop_override")}),d&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${d.ok?"text-brand":"text-warning"}`,children:[d.ok?e.jsx(ne,{className:"w-4 h-4","aria-hidden":"true"}):e.jsx(he,{className:"w-4 h-4","aria-hidden":"true"}),d.detail]})]})]}),N&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx("span",{className:"text-ink-muted",children:c("settings.multimodal.legacy_preset",{label:N.label})}),e.jsx("button",{onClick:()=>void D(),className:"text-label text-ink-muted hover:text-ink-strong underline",children:c("settings.multimodal.stop_override")})]}),!L&&!N&&e.jsxs(e.Fragment,{children:[z.map(l=>e.jsxs("button",{onClick:()=>void V(l),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`vision-pick-${l.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:l.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:l.defaultModel})]},l.id)),(p||z.length===0)&&e.jsx(we,{kind:"vision",testPrefix:"vision-custom",titleKey:"settings.custom.form_title_vision",modelPhKey:"settings.custom.model_ph_vision",onSaved:l=>void V(l),onCancel:()=>w(!1)}),z.length>0&&e.jsx("button",{onClick:()=>w(l=>!l),className:"text-label text-accent hover:underline",children:c(p?"action.cancel":"settings.custom.new")})]})]})]}),e.jsxs("div",{className:"bg-ink/5 rounded-lg p-3 flex items-center gap-3",children:[e.jsx(ae,{checked:S,onChange:I,label:c("settings.mathvision.toggle"),testid:"math-vision-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong",children:c("settings.mathvision.toggle")}),e.jsx("div",{className:"text-caption text-ink-muted",children:c("settings.mathvision.desc")})]})]})]})]}):null}function ft(){const t=ie(),[x,g]=a.useState(!1),[f,c]=a.useState(!1);a.useEffect(()=>{i.getSetting("flag_memory_system").then(o=>{g(o==="true"),c(!0)})},[]);const r=async()=>{const o=!x;g(o),await i.setSetting("flag_memory_system",String(o))};return f?e.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[e.jsx(ae,{checked:x,onChange:r,label:t("settings.memory.toggle"),testid:"memory-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong",children:t("settings.memory.toggle")}),e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.memory.toggle.desc")})]})]}):null}function bt(){const t=ie(),[x,g]=a.useState(!0),[f,c]=a.useState(!1),r=a.useSyncExternalStore(Ze,Qe),[o,u]=a.useState(!0),[m,b]=a.useState(!1),y=typeof window<"u"&&!!window.__lookatstudyWeb;a.useEffect(()=>{i.getSetting("companion_enabled").then(d=>{g(d!=="false"&&d!=="0"),c(!0)}),i.getSetting("companion_sfx").then(d=>{u(d!=="false"&&d!=="0")}),i.getSetting("companion_pet_mode").then(d=>{b(d==="1")})},[]);const p=async()=>{const d=!x;g(d),await i.setSetting("companion_enabled",String(d)),window.dispatchEvent(new Event("companion-config-changed"))},w=async()=>{const d=!o;u(d),await i.setSetting("companion_sfx",String(d)),window.dispatchEvent(new Event("companion-config-changed"))},k=async()=>{const d=!m;b(d),await i.setSetting("companion_pet_mode",d?"1":"0"),window.dispatchEvent(new Event("companion-config-changed"))},P=async d=>{d!==r.form&&(await i.setSetting("companion_form",d),window.dispatchEvent(new Event("companion-config-changed")))};return f?e.jsxs("div",{className:"px-4 py-3.5 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{checked:x,onChange:p,label:t("settings.companion.toggle"),testid:"companion-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong",children:t("settings.companion.toggle")}),e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.companion.toggle.desc")})]})]}),x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{checked:o,onChange:w,label:t("settings.companion.sfx"),testid:"companion-sfx-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong",children:t("settings.companion.sfx")}),e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.companion.sfx.desc")})]})]}),!y&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{checked:m,onChange:k,label:t("settings.companion.pet"),testid:"companion-pet-toggle"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong",children:t("settings.companion.pet")}),e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.companion.pet.desc")})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-muted mb-2",children:t("settings.companion.form")}),e.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":t("settings.companion.form"),children:et.map(d=>{const _=r.form===d;return e.jsxs("button",{type:"button",role:"radio","aria-checked":_,"data-testid":`companion-form-${d}`,onClick:()=>{P(d)},className:`flex flex-col items-center gap-0.5 rounded-xl p-1.5 border motion-safe:transition-colors
|
|
7
|
-
${_?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,title:t(`companion.form.${d}.desc`),children:[e.jsx(tt,{form:d,expression:"happy",pose:"float",size:64}),e.jsx("span",{className:`text-label ${_?"text-ink-strong font-medium":"text-ink-muted"}`,children:t(`companion.form.${d}.name`)})]},d)})})]})]})]}):null}function ae({checked:t,onChange:x,label:g,testid:f}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":g,onClick:x,"data-testid":f,className:`relative w-12 h-6 rounded-full transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/60 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)] ${t?"bg-brand":"bg-ink/20 hover:bg-ink/25"}`,children:e.jsx("span",{className:`absolute left-0.5 top-1/2 -translate-y-1/2 w-5 h-5 rounded-full bg-white shadow transition-transform ${t?"translate-x-6":""}`})})}const vt=[{id:"zh-CN-XiaoxiaoNeural",label:"zh-CN · 晓晓(女)"},{id:"zh-CN-XiaoyiNeural",label:"zh-CN · 晓伊(女)"},{id:"zh-CN-YunxiNeural",label:"zh-CN · 云希(男)"},{id:"zh-CN-YunyangNeural",label:"zh-CN · 云扬(男·新闻)"},{id:"zh-CN-liaoning-XiaobeiNeural",label:"zh-CN · 晓北(女·东北)"},{id:"zh-CN-shaanxi-XiaoniNeural",label:"zh-CN · 晓妮(女·陕西)"},{id:"en-US-AriaNeural",label:"en-US · Aria(女)"},{id:"en-US-GuyNeural",label:"en-US · Guy(男)"},{id:"en-US-JennyNeural",label:"en-US · Jenny(女)"}],jt=[{sid:"45",label:"zf_xiaobei(女)"},{sid:"46",label:"zf_xiaoni(女)"},{sid:"47",label:"zf_xiaoxiao(女)"},{sid:"48",label:"zf_xiaoyi(女·默认)"},{sid:"49",label:"zm_yunjian(男)"},{sid:"50",label:"zm_yunxi(男)"},{sid:"51",label:"zm_yunxia(男)"},{sid:"52",label:"zm_yunyang(男)"}];function Nt(){const t=ie(),[x,g]=a.useState([]),[f,c]=a.useState(null),[r,o]=a.useState(null),[u,m]=a.useState(null),[b,y]=a.useState(null),[p,w]=a.useState("edge"),[k,P]=a.useState("zh-CN-XiaoxiaoNeural"),[d,_]=a.useState("48"),[S,F]=a.useState("1.0"),[G,I]=a.useState(""),[V,D]=a.useState(""),[A,z]=a.useState([]),L=typeof window<"u"&&"speechSynthesis"in window,[N,l]=a.useState("local"),[H,Q]=a.useState("asr-whisper-turbo"),[re,ge]=a.useState(!0),[ce,ee]=a.useState([]),[le,oe]=a.useState(!1),[K,me]=a.useState(!1),[pe,O]=a.useState(!1),[fe,te]=a.useState(!1),[E,be]=a.useState(!1),[Y,n]=a.useState(null),[v,T]=a.useState(!1),[J,M]=a.useState(null),[C,$]=a.useState(null),q=a.useCallback(()=>{i.listCustomProviders().then(s=>ee(s.filter(h=>h.kind==="tts"||h.kind==="asr"))).catch(()=>{})},[]);a.useEffect(()=>{Promise.all([i.getSetting("tts_engine"),i.getSetting("tts_voice_edge"),i.getSetting("tts_sid_local"),i.getSetting("tts_speed"),i.getSetting("tts_custom_voice"),i.getSetting("tts_system_voice"),i.getSetting("asr_engine"),i.getSetting("asr_local_model"),i.getSetting("asr_auto_stop")]).then(([s,h,R,X,ke,Pe,Ae,Se,Je])=>{s&&w(s),h&&P(h),R&&_(R),X&&F(X),ke&&I(ke),Pe&&D(Pe),Ae&&l(Ae),(Se==="asr-whisper-turbo"||Se==="asr-whisper-small")&&Q(Se),ge(Je!=="0")}),q()},[q]),a.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const s=()=>z(dt(window.speechSynthesis.getVoices()));return s(),window.speechSynthesis.addEventListener("voiceschanged",s),()=>window.speechSynthesis.removeEventListener("voiceschanged",s)},[]);const ue=a.useCallback(()=>{window.api.getSpeechModelStatus().then(s=>g(s)).catch(()=>{})},[]);a.useEffect(()=>(ue(),window.api.on("speech:modelProgress",h=>{m({id:h.id,pct:Math.floor(h.progress*100),label:h.currentFile?h.currentFile.split("/").pop()??"":""})})),[ue]);const We=s=>{o(null),c(s),m({id:s,pct:0,label:""}),window.api.ensureSpeechModel(s).then(()=>{c(null),m(null),ue()}).catch(h=>{c(null),m(null),o(h instanceof Error?h.message:String(h)),ue()})},Ue=s=>{c(s),y(null),window.api.deleteSpeechModel(s).then(ue).catch(h=>o(h instanceof Error?h.message:String(h))).finally(()=>c(null))},Ie=s=>t(s==="tts-kokoro"?"settings.speech.model.tts":s==="asr-whisper-turbo"?"settings.speech.model.asr_turbo":"settings.speech.model.asr_small"),Ve=s=>t(s==="asr-whisper-turbo"?"settings.speech.model.turbo_short":"settings.speech.model.small_short"),De=s=>s.startsWith("asr-whisper")?t("settings.speech.license_mit"):t("settings.speech.license"),Ee=s=>t(s==="ready"?"settings.speech.state.ready":s==="error"?"settings.speech.state.error":"settings.speech.state.absent"),Te=s=>{var h;return((h=x.find(R=>R.id===s))==null?void 0:h.state)??"absent"},de=s=>{w(s),n(null),i.setSetting("tts_engine",s),ye()},Oe=s=>{D(s),i.setSetting("tts_system_voice",s),ye()},ve=s=>{l(s),M(null),i.setSetting("asr_engine",s)},je=ce.filter(s=>s.kind==="tts"),Ne=ce.filter(s=>s.kind==="asr"),Z=p.startsWith("custom-")?je.find(s=>s.id===p)??null:null,se=N.startsWith("custom-")?Ne.find(s=>s.id===N)??null:null,Be=p==="azure",Ge=N==="groq",qe=N==="azure",Xe=async()=>{if(!(!Z||E)){be(!0),n(null);try{n(await i.testCustomTts({providerId:Z.id}))}catch(s){n({ok:!1,detail:s instanceof Error?s.message:String(s)})}finally{be(!1)}}},He=async()=>{if(!(!se||v)){T(!0),M(null);try{M(await i.testCustomAsr({providerId:se.id}))}catch(s){M({ok:!1,detail:s instanceof Error?s.message:String(s)})}finally{T(!1)}}},Ye=async(s,h)=>{$(null);try{await i.deleteCustomProvider(s),h==="tts"&&p===s&&de("edge"),h==="asr"&&N===s&&ve("local"),q()}catch{}},Me=s=>{const h=x.find(X=>X.id===s),R=(h==null?void 0:h.state)??"absent";return e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong truncate",children:Ie(s)}),e.jsxs("div",{className:"text-caption text-ink-muted",children:[Ee(R)," · ",De(s)]}),f===s&&(u==null?void 0:u.id)===s&&e.jsx("div",{className:"mt-1.5 h-1.5 rounded-full bg-ink/[0.08] overflow-hidden","data-testid":`speech-dl-bar-${s}`,children:e.jsx("div",{className:"h-full bg-brand transition-all",style:{width:`${u.pct}%`}})}),f===s&&(u==null?void 0:u.id)===s&&e.jsxs("div",{className:"text-caption text-ink-faint mt-0.5","data-testid":`speech-dl-pct-${s}`,children:[u.pct,"%",u.label?` · ${u.label}`:""]})]}),R==="ready"?b===s?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-caption text-warning",children:t("settings.speech.confirm_del")}),e.jsx("button",{onClick:()=>Ue(s),className:"text-label text-warning hover:underline","data-testid":`speech-del-confirm-${s}`,children:t("settings.speech.delete")}),e.jsx("button",{onClick:()=>y(null),className:"text-label text-ink-muted hover:text-ink-strong",children:t("action.cancel")})]}):e.jsx("button",{onClick:()=>y(s),disabled:f===s,className:"text-label text-ink-muted hover:text-warning disabled:opacity-40","data-testid":`speech-del-${s}`,children:t("settings.speech.delete")}):e.jsx("button",{onClick:()=>We(s),disabled:f!=null||R==="downloading",className:"btn-3d-brand px-3 py-1 text-label disabled:opacity-40","data-testid":`speech-dl-${s}`,children:t(f===s||R==="downloading"?"settings.speech.downloading":"settings.speech.download")})]},s)},Le=(s,h,R,X,ke)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx($e,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium text-ink-strong",children:s.label}),e.jsx("code",{className:"text-ink-faint font-mono break-all",children:s.defaultModel}),e.jsx("span",{className:"text-ink-faint break-all min-w-0",children:s.baseUrl}),s.hasApiKey&&e.jsxs("span",{className:"text-brand shrink-0 inline-flex items-center gap-0.5",children:[e.jsx(ne,{className:"w-3.5 h-3.5","aria-hidden":"true"}),t("settings.speech.key_saved")]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{onClick:()=>void ke(),disabled:R,className:"btn-3d-neutral px-3 py-1 text-label disabled:opacity-40","data-testid":`${h}-custom-test`,children:t(R?"settings.testing":"settings.test")}),C===s.id?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-caption text-warning",children:t("settings.speech.confirm_del_custom")}),e.jsx("button",{onClick:()=>void Ye(s.id,h),className:"text-label text-warning hover:underline","data-testid":`${h}-custom-del-confirm`,children:t("settings.speech.delete")}),e.jsx("button",{onClick:()=>$(null),className:"text-label text-ink-muted hover:text-ink-strong",children:t("action.cancel")})]}):e.jsx("button",{onClick:()=>$(s.id),className:"text-label text-ink-muted hover:text-warning","data-testid":`${h}-custom-del`,children:t("settings.speech.delete")}),X&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${X.ok?"text-brand":"text-warning"}`,children:[X.ok?e.jsx(ne,{className:"w-4 h-4","aria-hidden":"true"}):e.jsx(he,{className:"w-4 h-4","aria-hidden":"true"}),X.detail]})]})]});return e.jsxs("div",{"data-testid":"settings-speech",children:[e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.speech.tts_title")}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("button",{onClick:()=>{de("edge"),oe(!1),O(!1)},"data-testid":"tts-engine-edge","aria-pressed":p==="edge",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${p==="edge"?U:W}`,children:t("settings.speech.engine.edge")}),e.jsxs("button",{onClick:()=>{de("local"),oe(!1),O(!1)},"data-testid":"tts-engine-local","aria-pressed":p==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${p==="local"?U:W}`,children:[t("settings.speech.engine.local"),Te("tts-kokoro")!=="ready"?` · ${t("settings.speech.state.absent")}`:""]}),e.jsx("button",{onClick:()=>{de("system"),oe(!1),O(!1)},disabled:!L,"data-testid":"tts-engine-system","aria-pressed":p==="system",title:L?void 0:t("settings.speech.engine.system_unavailable"),className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${p==="system"?U:W} ${L?"":"opacity-40 cursor-not-allowed"}`,children:t("settings.speech.engine.system")}),e.jsx("button",{onClick:()=>{oe(s=>!s),le||O(!1)},"data-testid":"tts-engine-custom","aria-pressed":p.startsWith("custom-")||le,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${p.startsWith("custom-")||le?U:W}`,children:t("settings.speech.engine.custom")}),Be&&e.jsxs("button",{disabled:!0,"data-testid":"tts-engine-azure",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Azure · ",t("settings.speech.legacy")]})]}),p==="edge"&&e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.engine.edge_note")})]}),p==="edge"&&e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.speech.voice")}),e.jsx("select",{value:k,onChange:s=>{P(s.target.value),i.setSetting("tts_voice_edge",s.target.value)},"data-testid":"tts-voice-select",className:`${B} w-full min-w-0 px-2.5 py-1.5`,children:vt.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]}),p==="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.speech.voice")}),e.jsx("select",{value:d,onChange:s=>{_(s.target.value),i.setSetting("tts_sid_local",s.target.value)},"data-testid":"tts-sid-select",className:`${B} w-full min-w-0 px-2.5 py-1.5`,children:jt.map(s=>e.jsx("option",{value:s.sid,children:s.label},s.sid))})]}),e.jsx("div",{className:j(!1),children:Me("tts-kokoro")})]}),p==="system"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.speech.voice")}),e.jsxs("select",{value:V,onChange:s=>Oe(s.target.value),"data-testid":"tts-system-voice-select",className:`${B} w-full min-w-0 px-2.5 py-1.5`,children:[e.jsx("option",{value:"",children:t("settings.speech.voice_auto")}),A.map(s=>e.jsx("option",{value:s.name,children:ot(s)},s.voiceURI))]}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.engine.system_note")})]})}),le&&e.jsx("div",{className:j(!1),children:e.jsxs("div",{className:"space-y-3",children:[Z&&Le(Z,"tts",E,Y,Xe),Z&&e.jsxs("div",{children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.speech.voice")}),e.jsx("input",{type:"text",value:G,onChange:s=>I(s.target.value),onBlur:()=>void i.setSetting("tts_custom_voice",G.trim()),placeholder:t("settings.speech.custom_voice_ph"),"data-testid":"tts-custom-voice",className:`${B} w-full min-w-0 px-2.5 py-1.5 font-mono`})]}),!Z&&je.map(s=>e.jsxs("button",{onClick:()=>de(s.id),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`tts-pick-${s.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:s.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:s.defaultModel})]},s.id)),(pe||!Z&&je.length===0)&&e.jsx(we,{kind:"tts",showProtocol:!1,testPrefix:"tts-custom",titleKey:"settings.custom.form_title_tts",modelPhKey:"settings.custom.model_ph_tts",testOverride:s=>i.testCustomTts({baseUrl:s.baseUrl,apiKey:s.apiKey||void 0,model:s.model}),onSaved:s=>{de(s.id),O(!1),q()},onCancel:()=>O(!1)}),(Z||je.length>0)&&e.jsx("button",{onClick:()=>O(s=>!s),className:"text-label text-accent hover:underline",children:t(pe?"action.cancel":"settings.custom.new")})]})}),e.jsx("div",{className:j(!0),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-label font-medium text-ink-strong shrink-0 w-14",children:t("settings.speech.speed")}),e.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.05",value:S,onChange:s=>F(s.target.value),onPointerUp:()=>{i.setSetting("tts_speed",S),ye()},onKeyUp:()=>{i.setSetting("tts_speed",S),ye()},"data-testid":"tts-speed-range",className:"flex-1 min-w-0 accent-[var(--brand)]"}),e.jsxs("span",{className:"text-label text-ink-muted tabular-nums w-10 text-right","data-testid":"tts-speed-value",children:[Number(S).toFixed(2),"x"]})]})}),e.jsxs("div",{className:j(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.speech.asr_title")}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("button",{onClick:()=>{ve("local"),me(!1),te(!1)},"data-testid":"asr-engine-local","aria-pressed":N==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${N==="local"?U:W}`,children:t("settings.speech.asr_engine.local")}),e.jsx("button",{onClick:()=>{me(s=>!s),K||te(!1)},"data-testid":"asr-engine-custom","aria-pressed":N.startsWith("custom-")||K,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${N.startsWith("custom-")||K?U:W}`,children:t("settings.speech.engine.custom")}),Ge&&e.jsxs("button",{disabled:!0,"data-testid":"asr-engine-groq",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Groq · ",t("settings.speech.legacy")]}),qe&&e.jsxs("button",{disabled:!0,"data-testid":"asr-engine-azure",className:"px-4 py-2 rounded-xl text-body font-bold opacity-50 cursor-not-allowed",children:["Azure · ",t("settings.speech.legacy")]})]}),N==="local"?e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.asr_engine.local_note")}):N.startsWith("custom-")&&e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.asr_engine.custom_note")})]}),N==="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:j(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.model")}),e.jsx("select",{value:H,onChange:s=>{Q(s.target.value),i.setSetting("asr_local_model",s.target.value)},"data-testid":"asr-model-select",className:`${B} w-full min-w-0 px-2.5 py-1.5`,children:["asr-whisper-turbo","asr-whisper-small"].map(s=>e.jsxs("option",{value:s,children:[Ve(s)," · ",Ee(Te(s))]},s))})]}),e.jsx("div",{className:j(!1),children:Me(H)})]}),K&&e.jsx("div",{className:j(!1),children:e.jsxs("div",{className:"space-y-3",children:[se&&Le(se,"asr",v,J,He),!se&&Ne.map(s=>e.jsxs("button",{onClick:()=>ve(s.id),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`asr-pick-${s.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:s.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:s.defaultModel})]},s.id)),(fe||!se&&Ne.length===0)&&e.jsx(we,{kind:"asr",showProtocol:!1,testPrefix:"asr-custom",titleKey:"settings.custom.form_title_asr",modelPhKey:"settings.custom.model_ph_asr",testOverride:s=>i.testCustomAsr({baseUrl:s.baseUrl,apiKey:s.apiKey||void 0,model:s.model}),onSaved:s=>{ve(s.id),te(!1),q()},onCancel:()=>te(!1)}),(se||Ne.length>0)&&e.jsx("button",{onClick:()=>te(s=>!s),className:"text-label text-accent hover:underline",children:t(fe?"action.cancel":"settings.custom.new")})]})}),e.jsxs("div",{className:j(!0),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{checked:re,onChange:()=>{const s=!re;ge(s),i.setSetting("asr_auto_stop",s?"1":"0")},label:t("settings.speech.asr_auto_stop"),testid:"asr-auto-stop-toggle"}),e.jsx("div",{className:"text-body font-medium text-ink-strong",children:t("settings.speech.asr_auto_stop")})]}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.asr_ux_note")})]}),r&&e.jsx("div",{className:"px-4 py-3 text-label text-warning break-all",role:"alert",children:r==="engine-unavailable"?t("chat.speech.engine_unavailable"):r})]})}function kt(){const t=ie(),x=a.useRef(null),[g,f]=a.useState(null),[c,r]=a.useState(!1),[o,u]=a.useState(null);a.useEffect(()=>{i.dshImportDetect().then(f).catch(()=>f({found:!1,path:null,version:null}))},[]);const m=b=>{r(!0),u(null),b.then(u).catch(y=>u({ok:!1,error:String(y)})).finally(()=>r(!1))};return e.jsxs("div",{className:"p-4 space-y-3","data-testid":"settings-dsh-import",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong",children:t("settings.dsh.title")}),e.jsx("p",{className:"text-label text-ink-muted leading-relaxed",children:t("settings.dsh.desc")}),g==null?null:g.found?e.jsxs("div",{className:"flex flex-wrap items-center gap-2","data-testid":"settings-dsh-detected",children:[e.jsx("span",{className:"text-label text-ink-strong",children:t("settings.dsh.detectFound",{v:g.version??"?"})}),e.jsx("button",{onClick:()=>m(i.dshImportFromPath(g.path??"")),disabled:c,"data-testid":"settings-dsh-import-btn",className:"px-3 py-1.5 rounded-xl text-label font-bold btn-3d-brand disabled:opacity-50",children:t(c?"settings.dsh.importing":"settings.dsh.import")})]}):e.jsx("div",{className:"text-label text-ink-muted","data-testid":"settings-dsh-none",children:t("settings.dsh.detectNone")}),e.jsxs("div",{children:[e.jsx("input",{ref:x,type:"file",accept:".json,application/json",className:"hidden","data-testid":"settings-dsh-file-input",onChange:b=>{var p;const y=(p=b.target.files)==null?void 0:p[0];y&&(y.text().then(w=>m(i.dshImportFromText(w))),b.target.value="")}}),e.jsx("button",{onClick:()=>{var b;return(b=x.current)==null?void 0:b.click()},disabled:c,className:"px-3 py-1.5 rounded-xl text-label font-bold btn-3d-neutral disabled:opacity-50",children:t("settings.dsh.pickFile")})]}),c&&!o?e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.dsh.importing")}):null,o!=null&&o.ok?e.jsxs("div",{className:"text-label text-brand leading-relaxed break-all",role:"status","data-testid":"settings-dsh-result",children:[t("settings.dsh.done",{courses:o.coursesCreated+o.coursesMapped+o.coursesRefreshed,nodes:o.nodes,progress:o.progressRows,srs:o.srsRows,xp:o.xpDelta}),o.skippedCourses.length>0?` · ${t("settings.dsh.skipped",{n:o.skippedCourses.length})}`:""]}):o?e.jsxs("div",{className:"text-label text-warning break-all",role:"alert","data-testid":"settings-dsh-error",children:[t("settings.dsh.failed"),": ",o.error??"unknown"]}):null]})}export{St as SettingsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var P=(s,e,t)=>e in s?f(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var g=(s,e,t)=>P(s,typeof e!="symbol"?e+"":e,t);const S={listCourses:"course:list",getCourseTree:"course:getTree",importCourseFromRepo:"course:importFromRepo",detectLanguages:"course:detectLanguages",getCourseLanguages:"course:getLanguages",setCourseLanguage:"course:setLanguage",getCourseLanguage:"course:getLanguage",analyzeRepo:"course:analyzeRepo",importAnalyzed:"course:importAnalyzed",importLocalFolder:"import:localFolder",importGithub:"import:github",importUrl:"import:url",importText:"import:text",importEpub:"import:epub",importAudio:"import:audio",importCancel:"import:cancel",importResume:"import:resume",importPack:"import:importPack",exportPack:"import:exportPack",generateCourseFromMarkdown:"course:generateFromMarkdown",deleteCourse:"course:delete",restructureCourse:"course:restructure",generateSummaries:"course:generateSummaries",getStarterPrompts:"course:getStarterPrompts",getNodeContent:"course:getNodeContent",getNodeSummary:"course:getNodeSummary",getPracticeForLesson:"course:getPracticeForLesson",getLessonForPractice:"course:getLessonForPractice",listAssetsByNode:"asset:listByNode",listAssetsByCourse:"asset:listByCourse",getAssetDataUrl:"asset:getDataUrl",repairMermaidDiagram:"artifact:repairMermaid",getProgress:"progress:get",updateProgress:"progress:update",markNodeAttempted:"progress:markAttempted",generateExercise:"exercise:generate",listExercises:"exercise:list",submitExerciseAnswer:"exercise:submit",examPrepare:"exam:prepare",examRegenerate:"exam:regenerate",examGetStatus:"exam:getStatus",examStartAttempt:"exam:startAttempt",examRecordAnswer:"exam:recordAnswer",examSubmitAttempt:"exam:submitAttempt",getDueReviews:"srs:getDue",getAllSrsItems:"srs:getAll",recordReview:"srs:record",getStreak:"streak:get",touchStreakToday:"streak:touchToday",listSouls:"soul:list",getSoul:"soul:get",createSoul:"soul:create",setActiveSoul:"soul:setActive",getActiveSoul:"soul:getActive",agentChat:"agent:chat",abortAgentChat:"agent:abort",getChatHistory:"agent:getHistory",clearChatHistory:"agent:clearHistory",agentChatThread:"agent:chatThread",abortAgentChatThread:"agent:abortThread",getContextUsage:"agent:getContextUsage",getSpeechModelStatus:"speech:getModelStatus",ensureSpeechModel:"speech:ensureModel",deleteSpeechModel:"speech:deleteModel",ttsSpeak:"speech:ttsSpeak",ttsStop:"speech:ttsStop",asrTranscribe:"speech:asrTranscribe",testCustomTts:"speech:testCustomTts",testCustomAsr:"speech:testCustomAsr",getAttachmentDataUrl:"attachment:getDataUrl",isAgentReady:"agent:isReady",getProviderPresets:"agent:getProviderPresets",testLlmConnection:"agent:testConnection",testCustomProvider:"agent:testCustomProvider",discoverModels:"agent:discoverModels",discoverProviderModels:"agent:discoverProviderModels",listCustomProviders:"customProvider:list",createCustomProvider:"customProvider:create",updateCustomProvider:"customProvider:update",deleteCustomProvider:"customProvider:delete",listPendingProposals:"proposal:listPending",applyProposal:"proposal:apply",rejectProposal:"proposal:reject",recordQuizAnswer:"quiz:recordAnswer",logFriction:"friction:log",getDashboard:"dashboard:get",searchContent:"search:content",updateMemory:"memory:update",getMemory:"memory:get",consolidateMemory:"consolidate:run",getSetting:"settings:get",setSetting:"settings:set",companionPetSetClickThrough:"companionPet:setClickThrough",dshImportDetect:"dsh:detect",dshImportFromPath:"dsh:importFromPath",dshImportFromText:"dsh:importFromText",getXpStatus:"xp:getStatus",exportCourse:"course:export",canvasList:"canvas:list",canvasSave:"canvas:save",canvasDelete:"canvas:delete",canvasTogglePin:"canvas:togglePin",canvasSaveUserNote:"canvas:saveUserNote",canvasRecordQuizResult:"canvas:recordQuizResult",canvasUpdateUserNoteComment:"canvas:updateUserNoteComment",threadList:"thread:list",threadCreate:"thread:create",threadUpdate:"thread:update",threadDelete:"thread:delete",threadGetMessages:"thread:getMessages",threadFindRecentByNode:"thread:findRecentByNode"},h=1,m="ls-serve-token";function y(){const s=new URLSearchParams(window.location.search).get("token");if(s){try{window.localStorage.setItem(m,s)}catch{}return s}try{return window.localStorage.getItem(m)??""}catch{return""}}class p{constructor(){g(this,"ws",null);g(this,"everOpened",!1);g(this,"pending",new Map);g(this,"listeners",new Map);g(this,"connectPromise",null)}connect(){return this.ws&&this.ws.readyState===WebSocket.OPEN?Promise.resolve(this.ws):this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((e,t)=>{const c=window.location.protocol==="https:"?"wss:":"ws:",o=y(),a=`${c}//${window.location.host}/?token=${encodeURIComponent(o)}`;let i=!1;const d=new WebSocket(a);this.ws=d;const l=window.setTimeout(()=>{i||(i=!0,this.connectPromise=null,t(new Error("连接学习服务超时(serve 未启动?)")))},5e3);d.addEventListener("open",()=>{this.everOpened=!0,window.clearTimeout(l),i||(i=!0,this.connectPromise=null,e(d))}),d.addEventListener("message",u=>{let r=null;try{r=JSON.parse(String(u.data))}catch{return}if(!(!r||r.v!==h)){if(r.type==="res"){const n=this.pending.get(r.id);if(!n)return;this.pending.delete(r.id),window.clearTimeout(n.timer),r.ok?n.resolve(r.result):n.reject(new Error(r.error))}else if(r.type==="event"){const n=this.listeners.get(r.channel);if(n)for(const v of n)v(...r.args)}}}),d.addEventListener("close",u=>{if(this.connectPromise=null,this.ws===d&&(this.ws=null),!i){i=!0,window.clearTimeout(l),t(new Error(T(u)));return}const r=u.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"与服务端的连接已断开";for(const[,n]of this.pending)window.clearTimeout(n.timer),n.reject(new Error(r));if(u.code===4001&&(this.everOpened=!1),this.pending.clear(),u.code===4001){window.dispatchEvent(new CustomEvent(C));return}this.everOpened&&window.setTimeout(()=>void this.connect().catch(()=>{}),2e3)}),d.addEventListener("error",()=>{})}),this.connectPromise)}static bytesToB64(e){const t=new Uint8Array(e);let c="";const o=32768;for(let a=0;a<t.length;a+=o)c+=String.fromCharCode(...t.subarray(a,a+o));return btoa(c)}async invoke(e,...t){var a,i;const c=await this.connect(),o=((i=(a=globalThis.crypto)==null?void 0:a.randomUUID)==null?void 0:i.call(a))??String(Math.random()).slice(2);return new Promise((d,l)=>{const u=window.setTimeout(()=>{this.pending.delete(o),l(new Error(`调用 ${e} 超时`))},3e5);this.pending.set(o,{resolve:d,reject:l,timer:u});const r=e==="speech:asrTranscribe"&&t[0]instanceof ArrayBuffer?[p.bytesToB64(t[0]),...t.slice(1)]:t;c.send(JSON.stringify({v:h,type:"req",id:o,channel:e,args:r}))})}on(e,t){const c=e==="speech:ttsAudio"?(...a)=>{const i=a[0];if(i&&typeof i.wavBase64=="string"){const d=atob(i.wavBase64),l=new Uint8Array(d.length);for(let n=0;n<d.length;n++)l[n]=d.charCodeAt(n);const{wavBase64:u,...r}=i;t({...r,wavBytes:l.buffer})}else t(...a)}:t;let o=this.listeners.get(e);return o||(o=new Set,this.listeners.set(e,o)),o.add(c),this.connect().catch(()=>{}),()=>{o.delete(c)}}}function b(){if(typeof window>"u")return!1;if(new URLSearchParams(window.location.search).get("token"))return!0;try{return!!window.localStorage.getItem(m)}catch{return!1}}function k(s){try{window.localStorage.setItem(m,s)}catch{}const e=new URL(window.location.href);e.searchParams.set("token",s),window.location.replace(e.toString())}const C="ls-web-token-rejected";function T(s){return s.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"无法连接学习服务(serve 未启动?)"}let w=!1;async function x(){if(w||window.api)return;w=!0;const s=new p,e={};for(const[t,c]of Object.entries(S))e[t]=(...o)=>s.invoke(c,...o);e.on=(t,c)=>s.on(t,c),window.api=e,window.__lookatstudyWeb=!0}function E(){return new p}export{C as TOKEN_REJECTED_EVENT,E as createWebTransportForTest,b as hasWebToken,x as installWebApi,k as setWebToken};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import{g as de}from"./chunk-5VM5RSS4-DGzhNwYE.js";import{ak as fe,al as Ut,am as pe,an as ye,ao as xe,ap as be,aq as we,ar as me,as as Se,at as Le,au as ve,av as Ee,aw as _e,ax as ke,ay as Te,az as De,aA as Ne,aB as Ie,aC as Ce,aD as Be,aE as Oe,aF as Re,aG as Ae,aH as ze,aI as Me,_ as u,y as nt,d as Pe,l as v,p as Fe,r as We,c as M,aJ as Ye,N as He,aK as Y,aL as Et,aM as rt,ad as Ke,x as at,j as Ue,aN as Xe,h as Ot,aO as Rt,aP as Ve}from"./mermaid.core-DUsXuPYV.js";import{s as O,l as je,n as Ge}from"./transform-B5_amWNh.js";import{G as Ze}from"./graph-C9eacEi8.js";import{c as qe}from"./channel-C4o9Ykyf.js";import"./main-BbOwLoeH.js";import"./index-DjO1zEnx.js";function Je(e){return Array.isArray(e)}function Qe(e){if(fe(e))return e;const t=Ut(e);if(!$e(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(pe(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?er(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return rr(a,e),xt(a,e),tr(a,e),a}function $e(e){switch(Ut(e)){case Me:case ze:case Ae:case Re:case Oe:case Be:case Ce:case Ie:case Ne:case De:case Te:case ke:case _e:case Ee:case ve:case Le:case Se:case me:case we:case be:case xe:case ye:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function tr(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s<a.length;s++){const i=a[s];Object.prototype.propertyIsEnumerable.call(t,i)&&(e[i]=t[i])}}function er(e,t){const a=t.valueOf().length;for(const s in t)Object.hasOwn(t,s)&&(Number.isNaN(Number(s))||Number(s)>=a)&&(e[s]=t[s])}function rr(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var wt=(function(){var e=u(function(N,b,d,y){for(d=d||{},y=N.length;y--;d[N[y]]=b);return d},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],g=[8,30],h=[8,10,21,28,29,30,31,39,43,46],p=[1,23],m=[1,24],x=[8,10,15,16,21,28,29,30,31,39,43,46],S=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={trace:u(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:u(function(b,d,y,w,D,o,k){var f=o.length-1;switch(D){case 4:w.getLogger().debug("Rule: separator (NL) ");break;case 5:w.getLogger().debug("Rule: separator (Space) ");break;case 6:w.getLogger().debug("Rule: separator (EOF) ");break;case 7:w.getLogger().debug("Rule: hierarchy: ",o[f-1]),w.setHierarchy(o[f-1]);break;case 8:w.getLogger().debug("Stop NL ");break;case 9:w.getLogger().debug("Stop EOF ");break;case 10:w.getLogger().debug("Stop NL2 ");break;case 11:w.getLogger().debug("Stop EOF2 ");break;case 12:w.getLogger().debug("Rule: statement: ",o[f]),typeof o[f].length=="number"?this.$=o[f]:this.$=[o[f]];break;case 13:w.getLogger().debug("Rule: statement #2: ",o[f-1]),this.$=[o[f-1]].concat(o[f]);break;case 14:w.getLogger().debug("Rule: link: ",o[f],b),this.$={edgeTypeStr:o[f],label:""};break;case 15:w.getLogger().debug("Rule: LABEL link: ",o[f-3],o[f-1],o[f]),this.$={edgeTypeStr:o[f],label:o[f-1]};break;case 18:const E=parseInt(o[f]),T=w.generateId();this.$={id:T,type:"space",label:"",width:E,children:[]};break;case 23:w.getLogger().debug("Rule: (nodeStatement link node) ",o[f-2],o[f-1],o[f]," typestr: ",o[f-1].edgeTypeStr);const z=w.edgeStrToEdgeData(o[f-1].edgeTypeStr),F=w.edgeStrToEdgeStartData(o[f-1].edgeTypeStr),q=w.edgeStrToThickness(o[f-1].edgeTypeStr),I=w.edgeStrToPattern(o[f-1].edgeTypeStr);this.$=[{id:o[f-2].id,label:o[f-2].label,type:o[f-2].type,directions:o[f-2].directions},{id:o[f-2].id+"-"+o[f].id,start:o[f-2].id,end:o[f].id,label:o[f-1].label,type:"edge",thickness:q,pattern:I,directions:o[f].directions,arrowTypeEnd:z,arrowTypeStart:F},{id:o[f].id,label:o[f].label,type:w.typeStr2Type(o[f].typeStr),directions:o[f].directions}];break;case 24:w.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[f-1],o[f]),this.$={id:o[f-1].id,label:o[f-1].label,type:w.typeStr2Type(o[f-1].typeStr),directions:o[f-1].directions,widthInColumns:parseInt(o[f],10)};break;case 25:w.getLogger().debug("Rule: nodeStatement (node) ",o[f]),this.$={id:o[f].id,label:o[f].label,type:w.typeStr2Type(o[f].typeStr),directions:o[f].directions,widthInColumns:1};break;case 26:w.getLogger().debug("APA123",this?this:"na"),w.getLogger().debug("COLUMNS: ",o[f]),this.$={type:"column-setting",columns:o[f]==="auto"?-1:parseInt(o[f])};break;case 27:w.getLogger().debug("Rule: id-block statement : ",o[f-2],o[f-1]),w.generateId(),this.$={...o[f-2],type:"composite",children:o[f-1]};break;case 28:w.getLogger().debug("Rule: blockStatement : ",o[f-2],o[f-1],o[f]);const K=w.generateId();this.$={id:K,type:"composite",label:"",children:o[f-1]};break;case 29:w.getLogger().debug("Rule: node (NODE_ID separator): ",o[f]),this.$={id:o[f]};break;case 30:w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[f-1],o[f]),this.$={id:o[f-1],label:o[f].label,typeStr:o[f].typeStr,directions:o[f].directions};break;case 31:w.getLogger().debug("Rule: dirList: ",o[f]),this.$=[o[f]];break;case 32:w.getLogger().debug("Rule: dirList: ",o[f-1],o[f]),this.$=[o[f-1]].concat(o[f]);break;case 33:w.getLogger().debug("Rule: nodeShapeNLabel: ",o[f-2],o[f-1],o[f]),this.$={typeStr:o[f-2]+o[f],label:o[f-1]};break;case 34:w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[f-3],o[f-2]," #3:",o[f-1],o[f]),this.$={typeStr:o[f-3]+o[f],label:o[f-2],directions:o[f-1]};break;case 35:case 36:this.$={type:"classDef",id:o[f-1].trim(),css:o[f].trim()};break;case 37:this.$={type:"applyClass",id:o[f-1].trim(),styleClass:o[f].trim()};break;case 38:this.$={type:"applyStyles",id:o[f-1].trim(),stylesStr:o[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(g,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(h,[2,16],{14:22,15:p,16:m}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(x,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(S,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(g,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(x,[2,24]),{10:t,11:37,13:4,14:22,15:p,16:m,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(S,[2,30]),{18:[1,43]},{18:[1,44]},e(x,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(h,[2,27]),e(S,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(S,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:u(function(b,d){if(d.recoverable)this.trace(b);else{var y=new Error(b);throw y.hash=d,y}},"parseError"),parse:u(function(b){var d=this,y=[0],w=[],D=[null],o=[],k=this.table,f="",E=0,T=0,z=2,F=1,q=o.slice.call(arguments,1),I=Object.create(this.lexer),K={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(K.yy[J]=this.yy[J]);I.setInput(b,K.yy),K.yy.lexer=I,K.yy.parser=this,typeof I.yylloc>"u"&&(I.yylloc={});var et=I.yylloc;o.push(et);var ft=I.options&&I.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ue(U){y.length=y.length-2*U,D.length=D.length-U,o.length=o.length-U}u(ue,"popStack");function Ct(){var U;return U=w.pop()||I.lex()||F,typeof U!="number"&&(U instanceof Array&&(w=U,U=w.pop()),U=d.symbols_[U]||U),U}u(Ct,"lex");for(var H,$,V,pt,tt={},ct,Q,Bt,lt;;){if($=y[y.length-1],this.defaultActions[$]?V=this.defaultActions[$]:((H===null||typeof H>"u")&&(H=Ct()),V=k[$]&&k[$][H]),typeof V>"u"||!V.length||!V[0]){var yt="";lt=[];for(ct in k[$])this.terminals_[ct]&&ct>z&<.push("'"+this.terminals_[ct]+"'");I.showPosition?yt="Parse error on line "+(E+1)+`:
|
|
2
|
-
`+I.showPosition()+`
|
|
3
|
-
Expecting `+lt.join(", ")+", got '"+(this.terminals_[H]||H)+"'":yt="Parse error on line "+(E+1)+": Unexpected "+(H==F?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(yt,{text:I.match,token:this.terminals_[H]||H,line:I.yylineno,loc:et,expected:lt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+H);switch(V[0]){case 1:y.push(H),D.push(I.yytext),o.push(I.yylloc),y.push(V[1]),H=null,T=I.yyleng,f=I.yytext,E=I.yylineno,et=I.yylloc;break;case 2:if(Q=this.productions_[V[1]][1],tt.$=D[D.length-Q],tt._$={first_line:o[o.length-(Q||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(Q||1)].first_column,last_column:o[o.length-1].last_column},ft&&(tt._$.range=[o[o.length-(Q||1)].range[0],o[o.length-1].range[1]]),pt=this.performAction.apply(tt,[f,T,E,K.yy,V[1],D,o].concat(q)),typeof pt<"u")return pt;Q&&(y=y.slice(0,-1*Q*2),D=D.slice(0,-1*Q),o=o.slice(0,-1*Q)),y.push(this.productions_[V[1]][0]),D.push(tt.$),o.push(tt._$),Bt=k[y[y.length-2]][y[y.length-1]],y.push(Bt);break;case 3:return!0}}return!0},"parse")},C=(function(){var N={EOF:1,parseError:u(function(d,y){if(this.yy.parser)this.yy.parser.parseError(d,y);else throw new Error(d)},"parseError"),setInput:u(function(b,d){return this.yy=d||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:u(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var d=b.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},"input"),unput:u(function(b){var d=b.length,y=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var w=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),y.length-1&&(this.yylineno-=y.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:y?(y.length===w.length?this.yylloc.first_column:0)+w[w.length-y.length].length-y[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:u(function(){return this._more=!0,this},"more"),reject:u(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:u(function(b){this.unput(this.match.slice(b))},"less"),pastInput:u(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:u(function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:u(function(){var b=this.pastInput(),d=new Array(b.length+1).join("-");return b+this.upcomingInput()+`
|
|
5
|
-
`+d+"^"},"showPosition"),test_match:u(function(b,d){var y,w,D;if(this.options.backtrack_lexer&&(D={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(D.yylloc.range=this.yylloc.range.slice(0))),w=b[0].match(/(?:\r\n?|\n).*/g),w&&(this.yylineno+=w.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:w?w[w.length-1].length-w[w.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],y=this.performAction.call(this,this.yy,this,d,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var o in D)this[o]=D[o];return!1}return!1},"test_match"),next:u(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var b,d,y,w;this._more||(this.yytext="",this.match="");for(var D=this._currentRules(),o=0;o<D.length;o++)if(y=this._input.match(this.rules[D[o]]),y&&(!d||y[0].length>d[0].length)){if(d=y,w=o,this.options.backtrack_lexer){if(b=this.test_match(y,D[o]),b!==!1)return b;if(this._backtrack){d=!1;continue}else return!1}else if(!this.options.flex)break}return d?(b=this.test_match(d,D[w]),b!==!1?b:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:u(function(){var d=this.next();return d||this.lex()},"lex"),begin:u(function(d){this.conditionStack.push(d)},"begin"),popState:u(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:u(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:u(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:u(function(d){this.begin(d)},"pushState"),stateStackSize:u(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:u(function(d,y,w,D){switch(w){case 0:return d.getLogger().debug("Found block-beta"),10;case 1:return d.getLogger().debug("Found id-block"),29;case 2:return d.getLogger().debug("Found block"),10;case 3:d.getLogger().debug(".",y.yytext);break;case 4:d.getLogger().debug("_",y.yytext);break;case 5:return 5;case 6:return y.yytext=-1,28;case 7:return y.yytext=y.yytext.replace(/columns\s+/,""),d.getLogger().debug("COLUMNS (LEX)",y.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:d.getLogger().debug("LEX: POPPING STR:",y.yytext),this.popState();break;case 13:return d.getLogger().debug("LEX: STR end:",y.yytext),"STR";case 14:return y.yytext=y.yytext.replace(/space\:/,""),d.getLogger().debug("SPACE NUM (LEX)",y.yytext),21;case 15:return y.yytext="1",d.getLogger().debug("COLUMNS (LEX)",y.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),d.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),d.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),d.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),d.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),d.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),d.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),d.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),d.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),d.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),d.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return d.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return d.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return d.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return d.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return d.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return d.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return d.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),d.getLogger().debug("LEX ARR START"),37;case 74:return d.getLogger().debug("Lex: NODE_ID",y.yytext),31;case 75:return d.getLogger().debug("Lex: EOF",y.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:d.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:d.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return d.getLogger().debug("LEX: NODE_DESCR:",y.yytext),"NODE_DESCR";case 83:d.getLogger().debug("LEX POPPING"),this.popState();break;case 84:d.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (right): dir:",y.yytext),"DIR";case 86:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (left):",y.yytext),"DIR";case 87:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (x):",y.yytext),"DIR";case 88:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (y):",y.yytext),"DIR";case 89:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (up):",y.yytext),"DIR";case 90:return y.yytext=y.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (down):",y.yytext),"DIR";case 91:return y.yytext="]>",d.getLogger().debug("Lex (ARROW_DIR end):",y.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return d.getLogger().debug("Lex: LINK","#"+y.yytext+"#"),15;case 93:return d.getLogger().debug("Lex: LINK",y.yytext),15;case 94:return d.getLogger().debug("Lex: LINK",y.yytext),15;case 95:return d.getLogger().debug("Lex: LINK",y.yytext),15;case 96:return d.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 97:return d.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 98:return d.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return d.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),d.getLogger().debug("Lex: LINK","#"+y.yytext+"#"),15;case 102:return this.popState(),d.getLogger().debug("Lex: LINK",y.yytext),15;case 103:return this.popState(),d.getLogger().debug("Lex: LINK",y.yytext),15;case 104:return d.getLogger().debug("Lex: COLON",y.yytext),y.yytext=y.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return N})();L.lexer=C;function B(){this.yy={}}return u(B,"Parser"),B.prototype=L,L.Parser=B,new B})();wt.parser=wt;var ar=wt,G=new Map,_t=[],mt=new Map,At="color",zt="fill",sr="bgFill",Xt=",",ht=new Map,kt="",ir=u(e=>Ue.sanitizeText(e,M()),"sanitizeText"),nr=u(function(e,t=""){let a=ht.get(e);a||(a={id:e,styles:[],textStyles:[]},ht.set(e,a)),t!=null&&t.split(Xt).forEach(s=>{const i=s.replace(/([^;]*);/,"$1").trim();if(RegExp(At).exec(s)){const r=i.replace(zt,sr).replace(At,zt);a.textStyles.push(r)}a.styles.push(i)})},"addStyleClass"),cr=u(function(e,t=""){const a=G.get(e);t!=null&&(a.styles=t.split(Xt))},"addStyle2Node"),lr=u(function(e,t){e.split(",").forEach(function(a){let s=G.get(a);if(s===void 0){const i=a.trim();s={id:i,type:"na",children:[]},G.set(i,s)}s.classes||(s.classes=[]),s.classes.push(t)})},"setCssClass"),Vt=u((e,t)=>{const a=e.flat(),s=[],i=a.find(r=>(r==null?void 0:r.type)==="column-setting"),c=(i==null?void 0:i.columns)??-1;for(const r of a){if(typeof c=="number"&&c>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>c&&v.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`),r.label&&(r.label=ir(r.label)),r.type==="classDef"){nr(r.id,r.css);continue}if(r.type==="applyClass"){lr(r.id,(r==null?void 0:r.styleClass)??"");continue}if(r.type==="applyStyles"){r!=null&&r.stylesStr&&cr(r.id,r==null?void 0:r.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(mt.get(r.id)??0)+1;mt.set(r.id,n),r.id=n+"-"+r.id,_t.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=G.get(r.id);if(n===void 0?G.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&Vt(r.children,r),r.type==="space"){const l=r.width??1;for(let g=0;g<l;g++){const h=Qe(r);h.id=h.id+"-"+g,G.set(h.id,h),s.push(h)}}else n===void 0&&s.push(r)}}t.children=s},"populateBlockDatabase"),Tt=[],it={id:"root",type:"composite",children:[],columns:-1},or=u(()=>{v.debug("Clear called"),Fe(),it={id:"root",type:"composite",children:[],columns:-1},G=new Map([["root",it]]),Tt=[],ht=new Map,_t=[],mt=new Map,kt=""},"clear");function jt(e){switch(v.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return v.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}u(jt,"typeStr2Type");function Gt(e){switch(v.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}u(Gt,"edgeTypeStr2Type");function Zt(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}u(Zt,"edgeStrToEdgeData");function qt(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}u(qt,"edgeStrToEdgeStartData");function Jt(e){return e.includes("==")?"thick":"normal"}u(Jt,"edgeStrToThickness");function Qt(e){return e.includes(".-")?"dotted":"solid"}u(Qt,"edgeStrToPattern");var Mt=0,hr=u(()=>(Mt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Mt),"generateId"),gr=u(e=>{it.children=e,Vt(e,it),Tt=it.children},"setHierarchy"),ur=u(e=>{const t=G.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),dr=u(()=>[...G.values()],"getBlocksFlat"),fr=u(()=>Tt||[],"getBlocks"),pr=u(()=>_t,"getEdges"),yr=u(e=>G.get(e),"getBlock"),xr=u(e=>{G.set(e.id,e)},"setBlock"),br=u(e=>{kt=e},"setDiagramId"),wr=u(()=>kt,"getDiagramId"),mr=u(()=>v,"getLogger"),Sr=u(function(){return ht},"getClasses"),Lr={getConfig:u(()=>nt().block,"getConfig"),typeStr2Type:jt,edgeTypeStr2Type:Gt,edgeStrToEdgeData:Zt,edgeStrToEdgeStartData:qt,edgeStrToThickness:Jt,edgeStrToPattern:Qt,getLogger:mr,getBlocksFlat:dr,getBlocks:fr,getEdges:pr,setHierarchy:gr,getBlock:yr,setBlock:xr,getColumns:ur,getClasses:Sr,clear:or,generateId:hr,setDiagramId:br,getDiagramId:wr},vr=Lr,bt=u((e,t)=>{const a=qe,s=a(e,"r"),i=a(e,"g"),c=a(e,"b");return We(s,i,c,t)},"fade"),Er=u(e=>`.label {
|
|
7
|
-
font-family: ${e.fontFamily};
|
|
8
|
-
color: ${e.nodeTextColor||e.textColor};
|
|
9
|
-
}
|
|
10
|
-
.cluster-label text {
|
|
11
|
-
fill: ${e.titleColor};
|
|
12
|
-
}
|
|
13
|
-
.cluster-label span,p {
|
|
14
|
-
color: ${e.titleColor};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.label text,span,p {
|
|
20
|
-
fill: ${e.nodeTextColor||e.textColor};
|
|
21
|
-
color: ${e.nodeTextColor||e.textColor};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.node rect,
|
|
25
|
-
.node circle,
|
|
26
|
-
.node ellipse,
|
|
27
|
-
.node polygon,
|
|
28
|
-
.node path {
|
|
29
|
-
fill: ${e.mainBkg};
|
|
30
|
-
stroke: ${e.nodeBorder};
|
|
31
|
-
stroke-width: 1px;
|
|
32
|
-
}
|
|
33
|
-
.flowchart-label text {
|
|
34
|
-
text-anchor: middle;
|
|
35
|
-
}
|
|
36
|
-
// .flowchart-label .text-outer-tspan {
|
|
37
|
-
// text-anchor: middle;
|
|
38
|
-
// }
|
|
39
|
-
// .flowchart-label .text-inner-tspan {
|
|
40
|
-
// text-anchor: start;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
.node .label {
|
|
44
|
-
text-align: center;
|
|
45
|
-
}
|
|
46
|
-
.node.clickable {
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.arrowheadPath {
|
|
51
|
-
fill: ${e.arrowheadColor};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.edgePath .path {
|
|
55
|
-
stroke: ${e.lineColor};
|
|
56
|
-
stroke-width: 2.0px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.flowchart-link {
|
|
60
|
-
stroke: ${e.lineColor};
|
|
61
|
-
fill: none;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.edgeLabel {
|
|
65
|
-
background-color: ${e.edgeLabelBackground};
|
|
66
|
-
/*
|
|
67
|
-
* This is for backward compatibility with existing code that didn't
|
|
68
|
-
* add a \`<p>\` around edge labels.
|
|
69
|
-
*
|
|
70
|
-
* TODO: We should probably remove this in a future release.
|
|
71
|
-
*/
|
|
72
|
-
p {
|
|
73
|
-
margin: 0;
|
|
74
|
-
padding: 0;
|
|
75
|
-
display: inline;
|
|
76
|
-
}
|
|
77
|
-
rect {
|
|
78
|
-
opacity: 0.5;
|
|
79
|
-
background-color: ${e.edgeLabelBackground};
|
|
80
|
-
fill: ${e.edgeLabelBackground};
|
|
81
|
-
}
|
|
82
|
-
text-align: center;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/* For html labels only */
|
|
86
|
-
.labelBkg {
|
|
87
|
-
background-color: ${e.edgeLabelBackground};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.node .cluster {
|
|
91
|
-
// fill: ${bt(e.mainBkg,.5)};
|
|
92
|
-
fill: ${bt(e.clusterBkg,.5)};
|
|
93
|
-
stroke: ${bt(e.clusterBorder,.2)};
|
|
94
|
-
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
|
95
|
-
stroke-width: 1px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.cluster text {
|
|
99
|
-
fill: ${e.titleColor};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.cluster span,p {
|
|
103
|
-
color: ${e.titleColor};
|
|
104
|
-
}
|
|
105
|
-
/* .cluster div {
|
|
106
|
-
color: ${e.titleColor};
|
|
107
|
-
} */
|
|
108
|
-
|
|
109
|
-
div.mermaidTooltip {
|
|
110
|
-
position: absolute;
|
|
111
|
-
text-align: center;
|
|
112
|
-
max-width: 200px;
|
|
113
|
-
padding: 2px;
|
|
114
|
-
font-family: ${e.fontFamily};
|
|
115
|
-
font-size: 12px;
|
|
116
|
-
background: ${e.tertiaryColor};
|
|
117
|
-
border: 1px solid ${e.border2};
|
|
118
|
-
border-radius: 2px;
|
|
119
|
-
pointer-events: none;
|
|
120
|
-
z-index: 100;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.flowchartTitleText {
|
|
124
|
-
text-anchor: middle;
|
|
125
|
-
font-size: 18px;
|
|
126
|
-
fill: ${e.textColor};
|
|
127
|
-
}
|
|
128
|
-
${de()}
|
|
129
|
-
`,"getStyles"),_r=Er,kr=u((e,t,a,s)=>{t.forEach(i=>{zr[i](e,a,s)})},"insertMarkers"),Tr=u((e,t,a)=>{v.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+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",a+"_"+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"),Dr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+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",a+"_"+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"),Nr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+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",a+"_"+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"),Ir=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+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",a+"_"+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"),Cr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+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",a+"_"+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"),Br=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).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",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).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"),Or=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+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",a+"_"+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"),Rr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+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",a+"_"+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"),Ar=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),zr={extension:Tr,composition:Dr,aggregation:Nr,dependency:Ir,lollipop:Cr,point:Br,circle:Or,cross:Rr,barb:Ar},Mr=kr;function St(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,s=Math.floor(t/e);return{px:a,py:s}}u(St,"calculateBlockPosition");var Pr=u(e=>{let t=0,a=0;for(const s of e.children){const{width:i,height:c,x:r,y:n}=s.size??{width:0,height:0,x:0,y:0};if(v.debug("getMaxChildSize abc95 child:",s.id,"width:",i,"height:",c,"x:",r,"y:",n,s.type),s.type==="space")continue;const l=i/(s.widthInColumns??1);l>t&&(t=l),c>a&&(a=c)}return{width:t,height:a}},"getMaxChildSize");function gt(e,t,a=0,s=0,i=8){var n,l,g,h,p,m,x,S,_,L,C;v.debug("setBlockSizes abc95 (start)",e.id,(n=e==null?void 0:e.size)==null?void 0:n.x,"block width =",e==null?void 0:e.size,"siblingWidth",a),(l=e==null?void 0:e.size)!=null&&l.width||(e.size={width:a,height:s,x:0,y:0});let c=0,r=0;if(((g=e.children)==null?void 0:g.length)>0){for(const o of e.children)gt(o,t,0,0,i);const B=Pr(e);c=B.width,r=B.height,v.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",c,r);for(const o of e.children)o.size&&(v.debug(`abc95 Setting size of children of ${e.id} id=${o.id} ${c} ${r} ${JSON.stringify(o.size)}`),o.size.width=c*(o.widthInColumns??1)+i*((o.widthInColumns??1)-1),o.size.height=r,o.size.x=0,o.size.y=0,v.debug(`abc95 updating size of ${e.id} children child:${o.id} maxWidth:${c} maxHeight:${r}`));for(const o of e.children)gt(o,t,c,r,i);const N=e.columns??-1;let b=0;for(const o of e.children)b+=o.widthInColumns??1;let d=e.children.length;N>0&&N<b&&(d=N);const y=Math.ceil(b/d);let w=d*(c+i)+i,D=y*(r+i)+i;if(w<a){v.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${w}`),w=a,D=s;const o=(a-d*i-i)/d,k=(s-y*i-i)/y;v.debug("Size indata abc88",e.id,"childWidth",o,"maxWidth",c),v.debug("Size indata abc88",e.id,"childHeight",k,"maxHeight",r),v.debug("Size indata abc88 xSize",d,"padding",i);for(const f of e.children)f.size&&(f.size.width=o,f.size.height=k,f.size.x=0,f.size.y=0)}if(v.debug(`abc95 (finale calc) ${e.id} xSize ${d} ySize ${y} columns ${N}${e.children.length} width=${Math.max(w,((h=e.size)==null?void 0:h.width)||0)}`),w<(((p=e==null?void 0:e.size)==null?void 0:p.width)||0)){w=((m=e==null?void 0:e.size)==null?void 0:m.width)||0;const o=N>0?Math.min(e.children.length,N):e.children.length;if(o>0){const k=(w-o*i-i)/o;v.debug("abc95 (growing to fit) width",e.id,w,(x=e.size)==null?void 0:x.width,k);for(const f of e.children)f.size&&(f.size.width=k)}}e.size={width:w,height:D,x:0,y:0}}v.debug("setBlockSizes abc94 (done)",e.id,(S=e==null?void 0:e.size)==null?void 0:S.x,(_=e==null?void 0:e.size)==null?void 0:_.width,(L=e==null?void 0:e.size)==null?void 0:L.y,(C=e==null?void 0:e.size)==null?void 0:C.height)}u(gt,"setBlockSizes");function Dt(e,t,a=8){var i,c,r,n,l,g,h,p,m,x,S,_,L,C,B,N,b;v.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(i=e==null?void 0:e.size)==null?void 0:i.x} y: ${(c=e==null?void 0:e.size)==null?void 0:c.y} width: ${(r=e==null?void 0:e.size)==null?void 0:r.width}`);const s=e.columns??-1;if(v.debug("layoutBlocks columns abc95",e.id,"=>",s,e),e.children&&e.children.length>0){const d=((l=(n=e==null?void 0:e.children[0])==null?void 0:n.size)==null?void 0:l.width)??0,y=e.children.length*d+(e.children.length-1)*a;v.debug("widthOfChildren 88",y,"posX");const w=new Map;{let E=0;for(const T of e.children){if(!T.size)continue;const{py:z}=St(s,E),F=w.get(z)??0;T.size.height>F&&w.set(z,T.size.height);let q=(T==null?void 0:T.widthInColumns)??1;s>0&&(q=Math.min(q,s-E%s)),E+=q}}const D=new Map;{let E=0;const T=[...w.keys()].sort((z,F)=>z-F);for(const z of T)D.set(z,E),E+=(w.get(z)??0)+a}let o=0;v.debug("abc91 block?.size?.x",e.id,(g=e==null?void 0:e.size)==null?void 0:g.x);let k=(h=e==null?void 0:e.size)!=null&&h.x?((p=e==null?void 0:e.size)==null?void 0:p.x)+(-((m=e==null?void 0:e.size)==null?void 0:m.width)/2||0):-a,f=0;for(const E of e.children){const T=e;if(!E.size)continue;const{width:z,height:F}=E.size,{px:q,py:I}=St(s,o);if(I!=f&&(f=I,k=(x=e==null?void 0:e.size)!=null&&x.x?((S=e==null?void 0:e.size)==null?void 0:S.x)+(-((_=e==null?void 0:e.size)==null?void 0:_.width)/2||0):-a,v.debug("New row in layout for block",e.id," and child ",E.id,f)),v.debug(`abc89 layout blocks (child) id: ${E.id} Pos: ${o} (px, py) ${q},${I} (${(L=T==null?void 0:T.size)==null?void 0:L.x},${(C=T==null?void 0:T.size)==null?void 0:C.y}) parent: ${T.id} width: ${z}${a}`),T.size){const J=z/2;E.size.x=k+a+J,v.debug(`abc91 layout blocks (calc) px, pyid:${E.id} startingPos=X${k} new startingPosX${E.size.x} ${J} padding=${a} width=${z} halfWidth=${J} => x:${E.size.x} y:${E.size.y} ${E.widthInColumns} (width * (child?.w || 1)) / 2 ${z*((E==null?void 0:E.widthInColumns)??1)/2}`),k=E.size.x+J;const et=D.get(I)??0,ft=w.get(I)??F;E.size.y=T.size.y-T.size.height/2+et+ft/2+a,v.debug(`abc88 layout blocks (calc) px, pyid:${E.id}startingPosX${k}${a}${J}=>x:${E.size.x}y:${E.size.y}${E.widthInColumns}(width * (child?.w || 1)) / 2${z*((E==null?void 0:E.widthInColumns)??1)/2}`)}E.children&&Dt(E,t,a);let K=(E==null?void 0:E.widthInColumns)??1;s>0&&(K=Math.min(K,s-o%s)),o+=K,v.debug("abc88 columnsPos",E,o)}}v.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(B=e==null?void 0:e.size)==null?void 0:B.x} y: ${(N=e==null?void 0:e.size)==null?void 0:N.y} width: ${(b=e==null?void 0:e.size)==null?void 0:b.width}`)}u(Dt,"layoutBlocks");function Nt(e,{minX:t,minY:a,maxX:s,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:c,y:r,width:n,height:l}=e.size;c-n/2<t&&(t=c-n/2),r-l/2<a&&(a=r-l/2),c+n/2>s&&(s=c+n/2),r+l/2>i&&(i=r+l/2)}if(e.children)for(const c of e.children)({minX:t,minY:a,maxX:s,maxY:i}=Nt(c,{minX:t,minY:a,maxX:s,maxY:i}));return{minX:t,minY:a,maxX:s,maxY:i}}u(Nt,"findBounds");function $t(e){var g,h;const t=e.getBlock("root");if(!t)return;const a=((h=(g=M())==null?void 0:g.block)==null?void 0:h.padding)??8;gt(t,e,0,0,a),Dt(t,e,a),v.debug("getBlocks",JSON.stringify(t,null,2));const{minX:s,minY:i,maxX:c,maxY:r}=Nt(t),n=r-i,l=c-s;return{x:s,y:i,width:l,height:n}}u($t,"layout");var Fr=u(async(e,t,a,s=!1,i=!1)=>{let c=t||"";typeof c=="object"&&(c=c[0]);const r=M(),n=Y(r);return await Et(e,c,{style:a,isTitle:s,useHtmlLabels:n,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},r)},"createLabel"),j=Fr,Wr=u((e,t,a,s,i)=>{t.arrowTypeStart&&Pt(e,"start",t.arrowTypeStart,a,s,i),t.arrowTypeEnd&&Pt(e,"end",t.arrowTypeEnd,a,s,i)},"addEdgeMarkers"),Yr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Pt=u((e,t,a,s,i,c)=>{const r=Yr[a];if(!r){v.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${s}#${i}_${c}-${r}${n})`)},"addEdgeMarker"),Lt={},W={},Hr=u(async(e,t)=>{const a=M(),s=Y(a),i=e.insert("g").attr("class","edgeLabel"),c=i.insert("g").attr("class","label"),r=t.labelType==="markdown",n=await Et(e,t.label,{style:t.labelStyle,useHtmlLabels:s,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);c.node().appendChild(n);let l=n.getBBox(),g=l;if(s){const p=n.children[0],m=O(n);l=p.getBoundingClientRect(),g=l,m.attr("width",l.width),m.attr("height",l.height)}else{const p=O(n).select("text").node();p&&typeof p.getBBox=="function"&&(g=p.getBBox())}c.attr("transform",rt(g,s)),Lt[t.id]=i,t.width=l.width,t.height=l.height;let h;if(t.startLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await j(m,t.startLabelLeft,t.labelStyle);h=x;let S=x.getBBox();if(s){const _=x.children[0],L=O(x);S=_.getBoundingClientRect(),L.attr("width",S.width),L.attr("height",S.height)}m.attr("transform",rt(S,s)),W[t.id]||(W[t.id]={}),W[t.id].startLeft=p,st(h,t.startLabelLeft)}if(t.startLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await j(m,t.startLabelRight,t.labelStyle);h=x;let S=x.getBBox();if(s){const _=x.children[0],L=O(x);S=_.getBoundingClientRect(),L.attr("width",S.width),L.attr("height",S.height)}m.attr("transform",rt(S,s)),W[t.id]||(W[t.id]={}),W[t.id].startRight=p,st(h,t.startLabelRight)}if(t.endLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await j(p,t.endLabelLeft,t.labelStyle);h=x;let S=x.getBBox();if(s){const _=x.children[0],L=O(x);S=_.getBoundingClientRect(),L.attr("width",S.width),L.attr("height",S.height)}m.attr("transform",rt(S,s)),W[t.id]||(W[t.id]={}),W[t.id].endLeft=p,st(h,t.endLabelLeft)}if(t.endLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await j(p,t.endLabelRight,t.labelStyle);h=x;let S=x.getBBox();if(s){const _=x.children[0],L=O(x);S=_.getBoundingClientRect(),L.attr("width",S.width),L.attr("height",S.height)}m.attr("transform",rt(S,s)),W[t.id]||(W[t.id]={}),W[t.id].endRight=p,st(h,t.endLabelRight)}return n},"insertEdgeLabel");function st(e,t){Y(M())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}u(st,"setTerminalWidth");var Kr=u((e,t)=>{v.debug("Moving label abc88 ",e.id,e.label,Lt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const s=M(),{subGraphTitleTotalMargin:i}=Ke(s);if(e.label){const c=Lt[e.id];let r=e.x,n=e.y;if(a){const l=at.calcLabelPosition(a);v.debug("Moving label "+e.label+" from (",r,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(r=l.x,n=l.y)}c.attr("transform",`translate(${r}, ${n+i/2})`)}if(e.startLabelLeft){const c=W[e.id].startLeft;let r=e.x,n=e.y;if(a){const l=at.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const c=W[e.id].startRight;let r=e.x,n=e.y;if(a){const l=at.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const c=W[e.id].endLeft;let r=e.x,n=e.y;if(a){const l=at.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const c=W[e.id].endRight;let r=e.x,n=e.y;if(a){const l=at.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),Ur=u((e,t)=>{const a=e.x,s=e.y,i=Math.abs(t.x-a),c=Math.abs(t.y-s),r=e.width/2,n=e.height/2;return i>=r||c>=n},"outsideNode"),Xr=u((e,t,a)=>{v.debug(`intersection calc abc89:
|
|
130
|
-
outsidePoint: ${JSON.stringify(t)}
|
|
131
|
-
insidePoint : ${JSON.stringify(a)}
|
|
132
|
-
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const s=e.x,i=e.y,c=Math.abs(s-a.x),r=e.width/2;let n=a.x<t.x?r-c:r+c;const l=e.height/2,g=Math.abs(t.y-a.y),h=Math.abs(t.x-a.x);if(Math.abs(i-t.y)*r>Math.abs(s-t.x)*l){let p=a.y<t.y?t.y-l-i:i-l-t.y;n=h*p/g;const m={x:a.x<t.x?a.x+n:a.x-h+n,y:a.y<t.y?a.y+g-p:a.y-g+p};return n===0&&(m.x=t.x,m.y=t.y),h===0&&(m.x=t.x),g===0&&(m.y=t.y),v.debug(`abc89 topp/bott calc, Q ${g}, q ${p}, R ${h}, r ${n}`,m),m}else{a.x<t.x?n=t.x-r-s:n=s-r-t.x;let p=g*n/h,m=a.x<t.x?a.x+h-n:a.x-h+n,x=a.y<t.y?a.y+p:a.y-p;return v.debug(`sides calc abc89, Q ${g}, q ${p}, R ${h}, r ${n}`,{_x:m,_y:x}),n===0&&(m=t.x,x=t.y),h===0&&(m=t.x),g===0&&(x=t.y),{x:m,y:x}}},"intersection"),Ft=u((e,t)=>{v.debug("abc88 cutPathAtIntersect",e,t);let a=[],s=e[0],i=!1;return e.forEach(c=>{if(!Ur(t,c)&&!i){const r=Xr(t,s,c);let n=!1;a.forEach(l=>{n=n||l.x===r.x&&l.y===r.y}),a.some(l=>l.x===r.x&&l.y===r.y)||a.push(r),i=!0}else s=c,i||a.push(c)}),a},"cutPathAtIntersect"),Vr=u(function(e,t,a,s,i,c,r){let n=a.points;v.debug("abc88 InsertEdge: edge=",a,"e=",t);let l=!1;const g=c.node(t.v);var h=c.node(t.w);h!=null&&h.intersect&&(g!=null&&g.intersect)&&(n=n.slice(1,a.points.length-1),n.unshift(g.intersect(n[0])),n.push(h.intersect(n[n.length-1]))),a.toCluster&&(v.debug("to cluster abc88",s[a.toCluster]),n=Ft(a.points,s[a.toCluster].node),l=!0),a.fromCluster&&(v.debug("from cluster abc88",s[a.fromCluster]),n=Ft(n.reverse(),s[a.fromCluster].node).reverse(),l=!0);const p=n.filter(b=>!Number.isNaN(b.y));let m=Ge;a.curve&&(i==="graph"||i==="flowchart")&&(m=a.curve);const{x,y:S}=Ye(a),_=je().x(x).y(S).curve(m);let L;switch(a.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-thick";break;default:L=""}switch(a.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break}const C=e.append("path").attr("d",_(p)).attr("id",a.id).attr("class"," "+L+(a.classes?" "+a.classes:"")).attr("style",a.style);let B="";(M().flowchart.arrowMarkerAbsolute||M().state.arrowMarkerAbsolute)&&(B=He(!0)),Wr(C,a,B,r,i);let N={};return l&&(N.updatedPath=n),N.originalPath=a.points,N},"insertEdge"),jr=u(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),Gr=u((e,t,a,s)=>{const i=jr(e),c=2,r=t.height+2*a.padding,n=r/c,l=s??t.width+2*n+a.padding,g=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:l/2,y:2*g},{x:l-n,y:0},{x:l,y:0},{x:l,y:-r/3},{x:l+2*g,y:-r/2},{x:l,y:-2*r/3},{x:l,y:-r},{x:l-n,y:-r},{x:l/2,y:-r-2*g},{x:n,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*g,y:-r/2},{x:0,y:-r/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:n,y:0},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:l-n,y:-r},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-n},{x:l,y:-r+n},{x:0,y:-r}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-n},{x:0,y:-r+n},{x:l,y:-r}]:i.has("right")&&i.has("left")?[{x:n,y:0},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-g},{x:n,y:-g},{x:n,y:-r+g},{x:0,y:-r+g},{x:l/2,y:-r},{x:l,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g},{x:l,y:-g}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-n},{x:0,y:-r}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-r}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-n},{x:l,y:-r}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-r}]:i.has("right")?[{x:n,y:-g},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r+g}]:i.has("left")?[{x:n,y:0},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")?[{x:n,y:-g},{x:n,y:-r+g},{x:0,y:-r+g},{x:l/2,y:-r},{x:l,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-g},{x:n,y:-g},{x:n,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g},{x:l,y:-g}]:[{x:0,y:0}]},"getArrowPoints");function te(e,t){return e.intersect(t)}u(te,"intersectNode");var Zr=te;function ee(e,t,a,s){var i=e.x,c=e.y,r=i-s.x,n=c-s.y,l=Math.sqrt(t*t*n*n+a*a*r*r),g=Math.abs(t*a*r/l);s.x<i&&(g=-g);var h=Math.abs(t*a*n/l);return s.y<c&&(h=-h),{x:i+g,y:c+h}}u(ee,"intersectEllipse");var re=ee;function ae(e,t,a){return re(e,t,t,a)}u(ae,"intersectCircle");var qr=ae;function se(e,t,a,s){var i,c,r,n,l,g,h,p,m,x,S,_,L,C,B;if(i=t.y-e.y,r=e.x-t.x,l=t.x*e.y-e.x*t.y,m=i*a.x+r*a.y+l,x=i*s.x+r*s.y+l,!(m!==0&&x!==0&&vt(m,x))&&(c=s.y-a.y,n=a.x-s.x,g=s.x*a.y-a.x*s.y,h=c*e.x+n*e.y+g,p=c*t.x+n*t.y+g,!(h!==0&&p!==0&&vt(h,p))&&(S=i*n-c*r,S!==0)))return _=Math.abs(S/2),L=r*g-n*l,C=L<0?(L-_)/S:(L+_)/S,L=c*l-i*g,B=L<0?(L-_)/S:(L+_)/S,{x:C,y:B}}u(se,"intersectLine");function vt(e,t){return e*t>0}u(vt,"sameSign");var Jr=se,Qr=ie;function ie(e,t,a){var s=e.x,i=e.y,c=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(S){r=Math.min(r,S.x),n=Math.min(n,S.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var l=s-e.width/2-r,g=i-e.height/2-n,h=0;h<t.length;h++){var p=t[h],m=t[h<t.length-1?h+1:0],x=Jr(e,a,{x:l+p.x,y:g+p.y},{x:l+m.x,y:g+m.y});x&&c.push(x)}return c.length?(c.length>1&&c.sort(function(S,_){var L=S.x-a.x,C=S.y-a.y,B=Math.sqrt(L*L+C*C),N=_.x-a.x,b=_.y-a.y,d=Math.sqrt(N*N+b*b);return B<d?-1:B===d?0:1}),c[0]):e}u(ie,"intersectPolygon");var $r=u((e,t)=>{var a=e.x,s=e.y,i=t.x-a,c=t.y-s,r=e.width/2,n=e.height/2,l,g;return Math.abs(c)*r>Math.abs(i)*n?(c<0&&(n=-n),l=c===0?0:n*i/c,g=n):(i<0&&(r=-r),l=r,g=i===0?0:r*c/i),{x:a+l,y:s+g}},"intersectRect"),ta=$r,R={node:Zr,circle:qr,ellipse:re,polygon:Qr,rect:ta},P=u(async(e,t,a,s)=>{const i=M();let c;const r=t.useHtmlLabels||Y(i);a?c=a:c="node default";const n=e.insert("g").attr("class",c).attr("id",t.domId||t.id),l=n.insert("g").attr("class","label").attr("style",t.labelStyle);let g;t.labelText===void 0?g="":g=typeof t.labelText=="string"?t.labelText:t.labelText[0];let h;t.labelType==="markdown"?h=Et(l,Ot(Rt(g),i),{useHtmlLabels:r,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):h=await j(l,Ot(Rt(g),i),t.labelStyle,!1,s);let p=h.getBBox();const m=t.padding/2;if(Y(i)){const x=h.children[0],S=O(h);await Ve(x,g),p=x.getBoundingClientRect(),S.attr("width",p.width),S.attr("height",p.height)}return r?l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"):l.attr("transform","translate(0, "+-p.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:p,halfPadding:m,label:l}},"labelHelper"),A=u((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function Z(e,t,a,s){return e.insert("polygon",":first-child").attr("points",s.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}u(Z,"insertPolygonShape");var ea=u(async(e,t)=>{t.useHtmlLabels||Y(M())||(t.centerLabel=!0);const{shapeSvg:s,bbox:i,halfPadding:c}=await P(e,t,"node "+t.classes,!0);v.info("Classes = ",t.classes);const r=s.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-c).attr("y",-i.height/2-c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),A(t,r),t.intersect=function(n){return R.rect(t,n)},s},"note"),ra=ea,Wt=u(e=>e?" "+e:"","formatClass"),X=u((e,t)=>`${t||"node default"}${Wt(e.classes)} ${Wt(e.class)}`,"getClassesFromNode"),Yt=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=i+c,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];v.info("Question main (Circle)");const l=Z(a,r,r,n);return l.attr("style",t.style),A(t,l),t.intersect=function(g){return v.warn("Intersect called"),R.polygon(t,n,g)},a},"question"),aa=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,i=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}];return a.insert("polygon",":first-child").attr("points",i.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return R.circle(t,14,r)},a},"choice"),sa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=4,c=t.positioned?t.height:s.height+t.padding,r=c/i,n=t.positioned?t.width:s.width+2*r+t.padding,l=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-c/2},{x:n-r,y:-c},{x:r,y:-c},{x:0,y:-c/2}],g=Z(a,n,c,l);return g.attr("style",t.style),A(t,g),t.intersect=function(h){return R.polygon(t,l,h)},a},"hexagon"),ia=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,void 0,!0),i=2,c=s.height+2*t.padding,r=c/i,n=s.width+2*r+t.padding,g=t.positioned&&(t.widthInColumns??1)>1&&t.width>n?t.width:n,h=Gr(t.directions,s,t,g),p=Z(a,g,c,h);return p.attr("style",t.style),A(t,p),t.intersect=function(m){return R.polygon(t,h,m)},a},"block_arrow"),na=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-c/2,y:0},{x:i,y:0},{x:i,y:-c},{x:-c/2,y:-c},{x:0,y:-c/2}];return Z(a,i,c,r).attr("style",t.style),t.width=i+c,t.height=c,t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_left_inv_arrow"),ca=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:c/6,y:-c}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_right"),la=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:2*c/6,y:0},{x:i+c/6,y:0},{x:i-2*c/6,y:-c},{x:-c/6,y:-c}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_left"),oa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i+2*c/6,y:0},{x:i-c/6,y:-c},{x:c/6,y:-c}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"trapezoid"),ha=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:-2*c/6,y:-c}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"inv_trapezoid"),ga=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i+c/2,y:0},{x:i,y:-c/2},{x:i+c/2,y:-c},{x:0,y:-c}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_right_inv_arrow"),ua=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=i/2,r=c/(2.5+i/50),n=s.height+r+t.padding,l="M 0,"+r+" a "+c+","+r+" 0,0,0 "+i+" 0 a "+c+","+r+" 0,0,0 "+-i+" 0 l 0,"+n+" a "+c+","+r+" 0,0,0 "+i+" 0 l 0,"+-n,g=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(n/2+r)+")");return A(t,g),t.intersect=function(h){const p=R.rect(t,h),m=p.x-t.x;if(c!=0&&(Math.abs(m)<t.width/2||Math.abs(m)==t.width/2&&Math.abs(p.y-t.y)>t.height/2-r)){let x=r*r*(1-m*m/(c*c));x!=0&&(x=Math.sqrt(x)),x=r-x,h.y-t.y>0&&(x=-x),p.y+=x}return p},a},"cylinder"),da=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes+" "+t.class,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,g=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",g).attr("width",r).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ut(c,t.props.borders,r,n),h.delete("borders")),h.forEach(p=>{v.warn(`Unknown node property ${p}`)})}return A(t,c),t.intersect=function(h){return R.rect(t,h)},a},"rect"),fa=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,g=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",g).attr("width",r).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ut(c,t.props.borders,r,n),h.delete("borders")),h.forEach(p=>{v.warn(`Unknown node property ${p}`)})}return A(t,c),t.intersect=function(h){return R.rect(t,h)},a},"composite"),pa=u(async(e,t)=>{const{shapeSvg:a}=await P(e,t,"label",!0);v.trace("Classes = ",t.class);const s=a.insert("rect",":first-child"),i=0,c=0;if(s.attr("width",i).attr("height",c),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ut(s,t.props.borders,i,c),r.delete("borders")),r.forEach(n=>{v.warn(`Unknown node property ${n}`)})}return A(t,s),t.intersect=function(r){return R.rect(t,r)},a},"labelRect");function ut(e,t,a,s){const i=[],c=u(n=>{i.push(n,0)},"addBorder"),r=u(n=>{i.push(0,n)},"skipBorder");t.includes("t")?(v.debug("add top border"),c(a)):r(a),t.includes("r")?(v.debug("add right border"),c(s)):r(s),t.includes("b")?(v.debug("add bottom border"),c(a)):r(a),t.includes("l")?(v.debug("add left border"),c(s)):r(s),e.attr("stroke-dasharray",i.join(" "))}u(ut,"applyNodePropertyBorders");var ya=u(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),i=s.insert("rect",":first-child"),c=s.insert("line"),r=s.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let l="";typeof n=="object"?l=n[0]:l=n,v.info("Label text abc79",l,n,typeof n=="object");const g=await j(r,l,t.labelStyle,!0,!0);let h={width:0,height:0};if(Y(M())){const _=g.children[0],L=O(g);h=_.getBoundingClientRect(),L.attr("width",h.width),L.attr("height",h.height)}v.info("Text 2",n);const p=n.slice(1,n.length);let m=g.getBBox();const x=await j(r,p.join?p.join("<br/>"):p,t.labelStyle,!0,!0);if(Y(M())){const _=x.children[0],L=O(x);h=_.getBoundingClientRect(),L.attr("width",h.width),L.attr("height",h.height)}const S=t.padding/2;return O(x).attr("transform","translate( "+(h.width>m.width?0:(m.width-h.width)/2)+", "+(m.height+S+5)+")"),O(g).attr("transform","translate( "+(h.width<m.width?0:-(m.width-h.width)/2)+", 0)"),h=r.node().getBBox(),r.attr("transform","translate("+-h.width/2+", "+(-h.height/2-S+3)+")"),i.attr("class","outer title-state").attr("x",-h.width/2-S).attr("y",-h.height/2-S).attr("width",h.width+t.padding).attr("height",h.height+t.padding),c.attr("class","divider").attr("x1",-h.width/2-S).attr("x2",h.width/2+S).attr("y1",-h.height/2-S+m.height+S).attr("y2",-h.height/2-S+m.height+S),A(t,i),t.intersect=function(_){return R.rect(t,_)},s},"rectWithTitle"),xa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.height+t.padding,c=s.width+i/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-c/2).attr("y",-i/2).attr("width",c).attr("height",i);return A(t,r),t.intersect=function(n){return R.rect(t,n)},a},"stadium"),ba=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,X(t,void 0),!0),c=a.insert("circle",":first-child");return c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("Circle main"),A(t,c),t.intersect=function(r){return v.info("Circle intersect",t,s.width/2+i,r),R.circle(t,s.width/2+i,r)},a},"circle"),wa=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,X(t,void 0),!0),c=5,r=a.insert("g",":first-child"),n=r.insert("circle"),l=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i+c).attr("width",s.width+t.padding+c*2).attr("height",s.height+t.padding+c*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("DoubleCircle main"),A(t,n),t.intersect=function(g){return v.info("DoubleCircle intersect",t,s.width/2+i+c,g),R.circle(t,s.width/2+i+c,g)},a},"doublecircle"),ma=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,X(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i,y:0},{x:i,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-c},{x:-8,y:-c},{x:-8,y:0}],n=Z(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"subroutine"),Sa=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),A(t,s),t.intersect=function(i){return R.circle(t,7,i)},a},"start"),Ht=u((e,t,a)=>{const s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i=70,c=10;a==="LR"&&(i=10,c=70);const r=s.append("rect").attr("x",-1*i/2).attr("y",-1*c/2).attr("width",i).attr("height",c).attr("class","fork-join");return A(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return R.rect(t,n)},s},"forkJoin"),La=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child"),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),s.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),A(t,i),t.intersect=function(c){return R.circle(t,7,c)},a},"end"),va=u(async(e,t)=>{var D;const a=t.padding/2,s=4,i=8;let c;t.classes?c="node "+t.classes:c="node default";const r=e.insert("g").attr("class",c).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),l=r.insert("line"),g=r.insert("line");let h=0,p=s;const m=r.insert("g").attr("class","label");let x=0;const S=(D=t.classData.annotations)==null?void 0:D[0],_=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",L=await j(m,_,t.labelStyle,!0,!0);let C=L.getBBox();if(Y(M())){const o=L.children[0],k=O(L);C=o.getBoundingClientRect(),k.attr("width",C.width),k.attr("height",C.height)}t.classData.annotations[0]&&(p+=C.height+s,h+=C.width);let B=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(Y(M())?B+="<"+t.classData.type+">":B+="<"+t.classData.type+">");const N=await j(m,B,t.labelStyle,!0,!0);O(N).attr("class","classTitle");let b=N.getBBox();if(Y(M())){const o=N.children[0],k=O(N);b=o.getBoundingClientRect(),k.attr("width",b.width),k.attr("height",b.height)}p+=b.height+s,b.width>h&&(h=b.width);const d=[];t.classData.members.forEach(async o=>{const k=o.getDisplayDetails();let f=k.displayText;Y(M())&&(f=f.replace(/</g,"<").replace(/>/g,">"));const E=await j(m,f,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let T=E.getBBox();if(Y(M())){const z=E.children[0],F=O(E);T=z.getBoundingClientRect(),F.attr("width",T.width),F.attr("height",T.height)}T.width>h&&(h=T.width),p+=T.height+s,d.push(E)}),p+=i;const y=[];if(t.classData.methods.forEach(async o=>{const k=o.getDisplayDetails();let f=k.displayText;Y(M())&&(f=f.replace(/</g,"<").replace(/>/g,">"));const E=await j(m,f,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let T=E.getBBox();if(Y(M())){const z=E.children[0],F=O(E);T=z.getBoundingClientRect(),F.attr("width",T.width),F.attr("height",T.height)}T.width>h&&(h=T.width),p+=T.height+s,y.push(E)}),p+=i,S){let o=(h-C.width)/2;O(L).attr("transform","translate( "+(-1*h/2+o)+", "+-1*p/2+")"),x=C.height+s}let w=(h-b.width)/2;return O(N).attr("transform","translate( "+(-1*h/2+w)+", "+(-1*p/2+x)+")"),x+=b.height+s,l.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-p/2-a+i+x).attr("y2",-p/2-a+i+x),x+=i,d.forEach(o=>{O(o).attr("transform","translate( "+-h/2+", "+(-1*p/2+x+i/2)+")");const k=o==null?void 0:o.getBBox();x+=((k==null?void 0:k.height)??0)+s}),x+=i,g.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-p/2-a+i+x).attr("y2",-p/2-a+i+x),x+=i,y.forEach(o=>{O(o).attr("transform","translate( "+-h/2+", "+(-1*p/2+x)+")");const k=o==null?void 0:o.getBBox();x+=((k==null?void 0:k.height)??0)+s}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-h/2-a).attr("y",-(p/2)-a).attr("width",h+t.padding).attr("height",p+t.padding),A(t,n),t.intersect=function(o){return R.rect(t,o)},r},"class_box"),Kt={rhombus:Yt,composite:fa,question:Yt,rect:da,labelRect:pa,rectWithTitle:ya,choice:aa,circle:ba,doublecircle:wa,stadium:xa,hexagon:sa,block_arrow:ia,rect_left_inv_arrow:na,lean_right:ca,lean_left:la,trapezoid:oa,inv_trapezoid:ha,rect_right_inv_arrow:ga,cylinder:ua,start:Sa,end:La,note:ra,subroutine:ma,fork:Ht,join:Ht,class_box:va},ot={},ne=u(async(e,t,a)=>{let s,i;if(t.link){let c;M().securityLevel==="sandbox"?c="_top":t.linkTarget&&(c=t.linkTarget||"_blank"),s=e.insert("svg:a").attr("xlink:href",t.link).attr("target",c),i=await Kt[t.shape](s,t,a)}else i=await Kt[t.shape](e,t,a),s=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),ot[t.id]=s,t.haveCallback&&ot[t.id].attr("class",ot[t.id].attr("class")+" clickable"),s},"insertNode"),Ea=u(e=>{const t=ot[e.id];v.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,s=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+s-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),s},"positionNode");function It(e,t,a=!1){var x,S,_;const s=e;let i="default";(((x=s==null?void 0:s.classes)==null?void 0:x.length)||0)>0&&(i=((s==null?void 0:s.classes)??[]).join(" ")),i=i+" flowchart-label";let c=0,r="",n;switch(s.type){case"round":c=5,r="rect";break;case"composite":c=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const l=Xe((s==null?void 0:s.styles)??[]),g=s.label,h=s.size??{width:0,height:0,x:0,y:0},p=t.getDiagramId();return{labelStyle:l.labelStyle,shape:r,labelText:g,rx:c,ry:c,class:i,style:l.style,id:s.id,domId:p?`${p}-${s.id}`:s.id,directions:s.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:a,intersect:void 0,type:s.type,padding:n??((_=(S=nt())==null?void 0:S.block)==null?void 0:_.padding)??0,widthInColumns:s.widthInColumns??1}}u(It,"getNodeFromBlock");async function ce(e,t,a){const s=It(t,a,!1);if(s.type==="group")return;const i=nt(),c=await ne(e,s,{config:i}),r=c.node().getBBox(),n=a.getBlock(s.id);n.size={width:r.width,height:r.height,x:0,y:0,node:c},a.setBlock(n),c.remove()}u(ce,"calculateBlockSize");async function le(e,t,a){const s=It(t,a,!0);if(a.getBlock(s.id).type!=="space"){const c=nt();await ne(e,s,{config:c}),t.intersect=s==null?void 0:s.intersect,Ea(s)}}u(le,"insertBlockPositioned");async function dt(e,t,a,s){for(const i of t)await s(e,i,a),i.children&&await dt(e,i.children,a,s)}u(dt,"performOperations");async function oe(e,t,a){await dt(e,t,a,ce)}u(oe,"calculateBlockSizes");async function he(e,t,a){await dt(e,t,a,le)}u(he,"insertBlocks");async function ge(e,t,a,s,i){const c=new Ze({multigraph:!0,compound:!0});c.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&c.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=s.getBlock(r.start),l=s.getBlock(r.end);if(n!=null&&n.size&&(l!=null&&l.size)){const g=n.size,h=l.size,p=[{x:g.x,y:g.y},{x:g.x+(h.x-g.x)/2,y:g.y+(h.y-g.y)/2},{x:h.x,y:h.y}],m=i?`${i}-${r.id}`:r.id,x=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",S=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",_=`${x} ${S} flowchart-link LS-a1 LE-b1`;Vr(e,{v:r.start,w:r.end,name:m},{...r,id:m,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:_},void 0,"block",c,i),r.label&&(await Hr(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:_}),Kr({...r,x:p[1].x,y:p[1].y},{originalPath:p}))}}}u(ge,"insertEdges");var _a=u(function(e,t){return t.db.getClasses()},"getClasses"),ka=u(async function(e,t,a,s){const{securityLevel:i,block:c}=nt(),r=s.db;r.setDiagramId(t);let n;i==="sandbox"&&(n=O("#i"+t));const l=i==="sandbox"?O(n.nodes()[0].contentDocument.body):O("body"),g=i==="sandbox"?l.select(`[id="${t}"]`):O(`[id="${t}"]`);Mr(g,["point","circle","cross"],s.type,t);const p=r.getBlocks(),m=r.getBlocksFlat(),x=r.getEdges(),S=g.insert("g").attr("class","block");await oe(S,p,r);const _=$t(r);if(await he(S,p,r),await ge(S,x,m,r,t),_){const L=_,C=Math.max(1,Math.round(.125*(L.width/L.height))),B=L.height+C+10,N=L.width+10,{useMaxWidth:b}=c;Pe(g,B,N,!!b),v.debug("Here Bounds",_,L),g.attr("viewBox",`${L.x-5} ${L.y-5} ${L.width+10} ${L.height+10}`)}},"draw"),Ta={draw:ka,getClasses:_a},Aa={parser:ar,db:vr,renderer:Ta,styles:_r};export{Aa as diagram};
|