lookatstudy-mobile 0.37.2 → 0.38.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.
Files changed (149) hide show
  1. package/model-catalog.json +9025 -0
  2. package/package.json +1 -1
  3. package/server.cjs +1075 -564
  4. package/web/assets/{CanvasStage-By84li0a.js → CanvasStage-BjmEt0UY.js} +1 -1
  5. package/web/assets/{CommandPalette-DJpv5YLk.js → CommandPalette-DTNMFUea.js} +1 -1
  6. package/web/assets/{CompanionBotLab-BrjON5X5.js → CompanionBotLab-DHmGbQJd.js} +1 -1
  7. package/web/assets/{CourseSearchPanel-Dp-83TJq.js → CourseSearchPanel-Dh3wEDsH.js} +2 -2
  8. package/web/assets/{ExamView-BiWyQCTQ.js → ExamView-Ce_t9n9N.js} +1 -1
  9. package/web/assets/{MermaidArtifact-C-9JGr1S.js → MermaidArtifact-CyXaq4AR.js} +3 -3
  10. package/web/assets/ModelManagerModal-C0b-oOcn.js +6 -0
  11. package/web/assets/{PersonalProfileModal-Bberh-21.js → PersonalProfileModal-CCUuVq38.js} +2 -2
  12. package/web/assets/{ReviewPanel-D52vKY80.js → ReviewPanel-N-e3bkWC.js} +1 -1
  13. package/web/assets/SettingsView-CZWKuAOS.js +15 -0
  14. package/web/assets/Toggle-fMmuR4RN.js +1 -0
  15. package/web/assets/{VoicePanel-Df6DgExP.js → VoicePanel-BhZjkbBn.js} +1 -1
  16. package/web/assets/{abnfDiagram-VCTEODGH-xWn5W_Em.js → abnfDiagram-VCTEODGH-DJZ92IQG.js} +1 -1
  17. package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-GEEhu7or.js → abnfDiagram-VCTEODGH-ODA7YWAP-CnOz9_ts.js} +1 -1
  18. package/web/assets/api-web-BhgWWd1h.js +1 -0
  19. package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-JmOGh5LH.js → architectureDiagram-5GKGNRK7-C4PU3XN7-Up7UX1_6.js} +1 -1
  20. package/web/assets/{architectureDiagram-5GKGNRK7-CvI35bTW.js → architectureDiagram-5GKGNRK7-DDFiDp0N.js} +1 -1
  21. package/web/assets/{blockDiagram-I7D4REHJ-BMKUeuF0.js → blockDiagram-I7D4REHJ-CvG84uPF.js} +1 -1
  22. package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-Dv4-Yiui.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-ByS9GD6j.js} +1 -1
  23. package/web/assets/{c4Diagram-7LVT6UL2-DNalANVV.js → c4Diagram-7LVT6UL2-Z4oqjV_s.js} +1 -1
  24. package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-BMz228D6.js → c4Diagram-UCG6FXSJ-75X3U2P3-JqYGaud4.js} +1 -1
  25. package/web/assets/channel-BVgQi2SB.js +1 -0
  26. package/web/assets/{chunk-2Q5K7J3B-M3FYrmxX.js → chunk-2Q5K7J3B-Bk7vR2OO.js} +1 -1
  27. package/web/assets/{chunk-5VM5RSS4-nbGREPjw.js → chunk-5VM5RSS4-CWyB6Ag5.js} +1 -1
  28. package/web/assets/{chunk-7XDTSPCN-rYhyRTOx.js → chunk-7XDTSPCN-D6Yc_Buh.js} +1 -1
  29. package/web/assets/{chunk-CTNIYPP6-BgXYMFW5.js → chunk-CTNIYPP6-Bkfc0YPS.js} +1 -1
  30. package/web/assets/{chunk-CXNFBKHE-CkmFhBAk.js → chunk-CXNFBKHE-DlVSTamJ.js} +1 -1
  31. package/web/assets/{chunk-F27PBJKO-CAqAYmMM.js → chunk-F27PBJKO-BVcD43e_.js} +1 -1
  32. package/web/assets/{chunk-IMKFNOWR-pDBbu4GI.js → chunk-IMKFNOWR-Zxym8xKJ.js} +1 -1
  33. package/web/assets/{chunk-ISA7TJRJ-CHl4BhBt.js → chunk-ISA7TJRJ-qHFg5Itc.js} +1 -1
  34. package/web/assets/{chunk-JWPE2WC7-DSVI_4gB.js → chunk-JWPE2WC7-DdTAe5_k.js} +1 -1
  35. package/web/assets/{chunk-LV3HUYFY-Doco33ZI.js → chunk-LV3HUYFY-ChgpGbar.js} +1 -1
  36. package/web/assets/{chunk-M3IUQBOH-RTAJkyza.js → chunk-M3IUQBOH-CtheRxQX.js} +1 -1
  37. package/web/assets/{chunk-NDIOYS4C-DcWvuy8G.js → chunk-NDIOYS4C-B27IOxo1.js} +1 -1
  38. package/web/assets/{chunk-POPQ4Y6H-yjjWWA8X.js → chunk-POPQ4Y6H-_s5H9Hu1.js} +1 -1
  39. package/web/assets/{chunk-RE4WF27V-C32wZGPA.js → chunk-RE4WF27V-uEsraMf5.js} +1 -1
  40. package/web/assets/{chunk-SVP7TREG-BdekvWAw.js → chunk-SVP7TREG-S8N2_Tii.js} +1 -1
  41. package/web/assets/{chunk-TICWLB2K-Cz68TTKA.js → chunk-TICWLB2K-DxCRITn1.js} +1 -1
  42. package/web/assets/{chunk-VII2H2IX-fTD7U-xL.js → chunk-VII2H2IX-qahGaA3g.js} +1 -1
  43. package/web/assets/{chunk-X5GNSKZ3-16RMlpb5.js → chunk-X5GNSKZ3-CRsLzrmL.js} +1 -1
  44. package/web/assets/{chunk-XCWWM2C3-CO-wuQPY.js → chunk-XCWWM2C3-gAY--_6y.js} +1 -1
  45. package/web/assets/{chunk-XXDRQBXY-DPkBKESf.js → chunk-XXDRQBXY-Dlodiy7w.js} +1 -1
  46. package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-BfnNr1df.js +1 -0
  47. package/web/assets/classDiagram-ZZMXUADV-A7yMYr-v.js +1 -0
  48. package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-BfnNr1df.js +1 -0
  49. package/web/assets/classDiagram-v2-VYDZK3BY-A7yMYr-v.js +1 -0
  50. package/web/assets/{core-CQhot3Yw.js → core-Ctwl1_u6.js} +1 -1
  51. package/web/assets/{cose-bilkent-JH36ORCC-NQkKxkmm.js → cose-bilkent-JH36ORCC-CPuRsyhX.js} +1 -1
  52. package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-71WGRXpy.js → cose-bilkent-JH36ORCC-OB24KH3T-DEty9Vjh.js} +1 -1
  53. package/web/assets/{cynefin-OW5HDTMX-Ycd8yaFB.js → cynefin-OW5HDTMX-BkB-LB8l.js} +1 -1
  54. package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-wLMpc-W6.js → cynefin-OW5HDTMX-GVF3BKWE-D0wGTJgs.js} +1 -1
  55. package/web/assets/{cynefinDiagram-5FMLGOSQ-qdatKGJp.js → cynefinDiagram-5FMLGOSQ-DNV9WdAS.js} +1 -1
  56. package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-BqUnto1I.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-D3Ij3Tc1.js} +1 -1
  57. package/web/assets/{dagre-3AP2YEHR-DCERTXHT-DU7hl9mL.js → dagre-3AP2YEHR-DCERTXHT-DtOlsda2.js} +1 -1
  58. package/web/assets/{dagre-GXQ25YYZ-DXBvPLCC.js → dagre-GXQ25YYZ-B0krUCV-.js} +1 -1
  59. package/web/assets/{diagram-S7CK7UJ4-CJndlA9d.js → diagram-S7CK7UJ4-CJPq3UX3.js} +1 -1
  60. package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-ChZOJtIr.js → diagram-S7CK7UJ4-MULGZGEL--apiqMq_.js} +1 -1
  61. package/web/assets/{diagram-UQ7AKVKN-ByEgUbMO.js → diagram-UQ7AKVKN-DN2fvIcQ.js} +1 -1
  62. package/web/assets/{diagram-UQ7AKVKN-YQBY353J-CBg1xAIv.js → diagram-UQ7AKVKN-YQBY353J-Dedl3cQE.js} +1 -1
  63. package/web/assets/{diagram-VSXAHHWV-DG9QiDXM.js → diagram-VSXAHHWV-B_3615az.js} +1 -1
  64. package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-BmmwN3nm.js → diagram-VSXAHHWV-WLNH2ELY-qPd_xBpx.js} +1 -1
  65. package/web/assets/{diagram-VX7I27RA-D5I8_1IH.js → diagram-VX7I27RA-BBdDfxTE.js} +1 -1
  66. package/web/assets/{diagram-VX7I27RA-XW6YQV5G-BpJ1XA39.js → diagram-VX7I27RA-XW6YQV5G-2NQmjTWZ.js} +1 -1
  67. package/web/assets/{diagram-Z3DM3KII-BgBYUzLO.js → diagram-Z3DM3KII-4-iFyExq.js} +1 -1
  68. package/web/assets/{diagram-Z3DM3KII-HG7RF65D-DvYaKe9o.js → diagram-Z3DM3KII-HG7RF65D-BdtXesk5.js} +1 -1
  69. package/web/assets/{ebnfDiagram-PWID7BFC-BvljgvDM.js → ebnfDiagram-PWID7BFC-DCkQga-4.js} +1 -1
  70. package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-Cnq_rs5C.js → ebnfDiagram-PWID7BFC-OKY4VHYD-BJhXk1ud.js} +1 -1
  71. package/web/assets/{elk.bundled-DuC4qO17.js → elk.bundled-Cez1bZui.js} +1 -1
  72. package/web/assets/{erDiagram-RLTQ6QDP-CuGCxm27.js → erDiagram-RLTQ6QDP-Cr9QaJ1v.js} +1 -1
  73. package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-DWea4HYD.js → erDiagram-SSCWMZ5O-PIPKOIK7-CCpUhFOK.js} +1 -1
  74. package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-Bt5oLSB0.js → flowDiagram-A5DVABFB-2Z4AVO5R-D9DlpmgO.js} +1 -1
  75. package/web/assets/{flowDiagram-HODETNUW-ChwXi3ep.js → flowDiagram-HODETNUW-Wol63Kv-.js} +1 -1
  76. package/web/assets/{ganttDiagram-EL5Y4UJY-Cip61aQW.js → ganttDiagram-EL5Y4UJY-CrNG_cdW.js} +1 -1
  77. package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-DIt3-EPi.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-DD6wgz29.js} +1 -1
  78. package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-CsyX4tkZ.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-DWe7BJRj.js} +1 -1
  79. package/web/assets/{gitGraphDiagram-WWUBYQGX-BGE_KKwm.js → gitGraphDiagram-WWUBYQGX-IMvPkTdS.js} +1 -1
  80. package/web/assets/index-B7WF2qJW.js +14 -0
  81. package/web/assets/{index-D3SI1A7X.js → index-CIZh7RMQ.js} +2 -2
  82. package/web/assets/index-CS4Wtfwl.css +1 -0
  83. package/web/assets/{index-CatQea2M.js → index-T02kICsr.js} +1 -1
  84. package/web/assets/{infoDiagram-27XIBGKW-CHFCryER.js → infoDiagram-27XIBGKW-BG6Y7L1i.js} +1 -1
  85. package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-ocLW6L6_.js → infoDiagram-RXCK75RN-HANS5KVC-CQgucjmb.js} +1 -1
  86. package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-BUo_yhnm.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-XjEpfVKy.js} +1 -1
  87. package/web/assets/{ishikawaDiagram-5VMMS53U-Bhg1TVZJ.js → ishikawaDiagram-5VMMS53U-DZqDGKJg.js} +1 -1
  88. package/web/assets/{journeyDiagram-3NMN7TZE-C3OfUgiV.js → journeyDiagram-3NMN7TZE-CRs3_-1Y.js} +1 -1
  89. package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-DQESZnLZ.js → journeyDiagram-EYS64GPL-OAPELBT7-Dw7bUcjI.js} +1 -1
  90. package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-BF-ZXqR5.js → kanban-definition-3QL26DDD-I7RKWQQY-BUnF1mWS.js} +1 -1
  91. package/web/assets/{kanban-definition-UXKFOSKX-CSI_GcJW.js → kanban-definition-UXKFOSKX-hGGkPiRw.js} +1 -1
  92. package/web/assets/{katex-N6JRN4PM-CxrguQd-.js → katex-N6JRN4PM-C6a-kx0O.js} +1 -1
  93. package/web/assets/{layout-CDbDCQeb.js → layout-BUbLYu8b.js} +1 -1
  94. package/web/assets/{main-jV_OilRs.js → main-Bwe-ngM3.js} +120 -120
  95. package/web/assets/{mermaid-layout-elk.core-B1-o2tyd.js → mermaid-layout-elk.core-B4Ud-kMJ.js} +2 -2
  96. package/web/assets/{mermaid.core-37_hzSNp.js → mermaid.core-DfcXYaBE.js} +5 -5
  97. package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-rppk7mo-.js → mindmap-definition-FBJOCRG2-KIYZG64Y-Bj-zHJUj.js} +1 -1
  98. package/web/assets/{mindmap-definition-YA3MSWOX-BUzaoDCs.js → mindmap-definition-YA3MSWOX-6CCGXEnY.js} +1 -1
  99. package/web/assets/{pegDiagram-XKGWAZYB-CQPL5MMj.js → pegDiagram-XKGWAZYB-CMNrdc9G.js} +1 -1
  100. package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-CngQPdjr.js → pegDiagram-XKGWAZYB-OIP57N6J-nEVXV8wL.js} +1 -1
  101. package/web/assets/{pet-xGooCXVY.js → pet-7_82JHov.js} +1 -1
  102. package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-DkHaDPtZ.js → pieDiagram-E7YTZNPT-2UOTW327-CVTkOJWh.js} +1 -1
  103. package/web/assets/{pieDiagram-E7YTZNPT-BDTdqFkm.js → pieDiagram-E7YTZNPT-D5EMeJ7m.js} +1 -1
  104. package/web/assets/{quadrantDiagram-AXDQQJYC-CXFhoJ1v.js → quadrantDiagram-AXDQQJYC-DzCvG7yn.js} +1 -1
  105. package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-KFKnY5SQ.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-C6_UC8pF.js} +1 -1
  106. package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-BMHll5kZ.js → railroadDiagram-O6MQD6OU-34742W6X-no51XOTx.js} +1 -1
  107. package/web/assets/{railroadDiagram-O6MQD6OU-DdZMZ3P-.js → railroadDiagram-O6MQD6OU-Dm_fovg0.js} +1 -1
  108. package/web/assets/{render-O7CIS3YK-BUZqrLRp.js → render-O7CIS3YK-BjDBnwGB.js} +7 -7
  109. package/web/assets/{requirementDiagram-BXWQKSXE-WrY_I6-V.js → requirementDiagram-BXWQKSXE-BfDo8qe9.js} +1 -1
  110. package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-CmLM20oA.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-9m84sd56.js} +1 -1
  111. package/web/assets/{rotate-ccw-DZE_kYZu.js → rotate-ccw-DjLv5683.js} +1 -1
  112. package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-RJsf4h9t.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-CTdzZoDY.js} +1 -1
  113. package/web/assets/{sankeyDiagram-P5KCCOFB-Bjyi_fcC.js → sankeyDiagram-P5KCCOFB-B4ZNqFX0.js} +1 -1
  114. package/web/assets/{sequenceDiagram-WJ2MYXX4-Co6SKGyz.js → sequenceDiagram-WJ2MYXX4-CE8SOZmY.js} +1 -1
  115. package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-B5nuUy2h.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-D0hSM0Rf.js} +1 -1
  116. package/web/assets/{sizeCapture-INFHLROL-CF0_wtm2.js → sizeCapture-INFHLROL-BoK_snCd.js} +1 -1
  117. package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-xWY2H6Me.js → sizeCapture-X5ZJPWSS-PSGVOMYM-DHFL989w.js} +1 -1
  118. package/web/assets/{stateDiagram-D77RDMKH-5V-346Qd.js → stateDiagram-D77RDMKH-DewCbTYT.js} +1 -1
  119. package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-B6gqxipM.js → stateDiagram-HBIQ2CUA-4M2S6MAN-1Iq-0t_T.js} +1 -1
  120. package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-BtlmMFv0.js +1 -0
  121. package/web/assets/stateDiagram-v2-MP3YSRHH-B81KSXVj.js +1 -0
  122. package/web/assets/{swimlanes-42K2YHIH-D9gzHPsn.js → swimlanes-42K2YHIH-B_ZemasQ.js} +1 -1
  123. package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-rlPeyqTj.js → swimlanes-XN3QIQJK-N6N2CCQ6-D7IZVohV.js} +1 -1
  124. package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-wm4Xp0xX.js +8 -0
  125. package/web/assets/swimlanesDiagram-VR7AAH4N-Dqjnb-t1.js +8 -0
  126. package/web/assets/{timeline-definition-24CTP7MA-B2GfJfmd.js → timeline-definition-24CTP7MA-Dl-MZgJm.js} +1 -1
  127. package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-CKXP2kGU.js → timeline-definition-24CTP7MA-KN7RSRVM-DKGhla1L.js} +1 -1
  128. package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-CybCMyEX.js → vennDiagram-4TSXK5OY-AKJ7LXAN-DJGD_zp2.js} +1 -1
  129. package/web/assets/{vennDiagram-4TSXK5OY-DkP-OS8t.js → vennDiagram-4TSXK5OY-BNIMMkc8.js} +1 -1
  130. package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-BdgAi1Gp.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-BWY4hoNl.js} +1 -1
  131. package/web/assets/{wardleyDiagram-VM6X3IG4-DvRT9ehw.js → wardleyDiagram-VM6X3IG4-C5iQnCkI.js} +1 -1
  132. package/web/assets/{xychartDiagram-S5SC5T6Z-D0gQ0QKw.js → xychartDiagram-S5SC5T6Z-KRAufNo2.js} +1 -1
  133. package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-23Q1AKCq.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-Bw4UIStv.js} +1 -1
  134. package/web/index.html +3 -3
  135. package/web/pet.html +3 -3
  136. package/web/assets/SettingsView-BE8J-BR5.js +0 -20
  137. package/web/assets/api-web-ChIPnpHO.js +0 -1
  138. package/web/assets/channel-BsRXIHWg.js +0 -1
  139. package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-BwnHfZhN.js +0 -1
  140. package/web/assets/classDiagram-ZZMXUADV-BBeyyi3H.js +0 -1
  141. package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-BwnHfZhN.js +0 -1
  142. package/web/assets/classDiagram-v2-VYDZK3BY-BBeyyi3H.js +0 -1
  143. package/web/assets/index-48coRDBX.js +0 -14
  144. package/web/assets/index-EInfxfl9.css +0 -1
  145. package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-DnphY6WO.js +0 -1
  146. package/web/assets/stateDiagram-v2-MP3YSRHH-DKtXGidN.js +0 -1
  147. package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-8pA5lT4C.js +0 -8
  148. package/web/assets/swimlanesDiagram-VR7AAH4N-B7BbPyRn.js +0 -8
  149. /package/web/assets/{index-C9fscARj.js → index-jKxnKPxh.js} +0 -0
@@ -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-BUZqrLRp.js";import{_ as r}from"./mermaid-layout-elk.core-B1-o2tyd.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-jV_OilRs.js";import"./index-C9fscARj.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)+`:
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-BjDBnwGB.js";import{_ as r}from"./mermaid-layout-elk.core-B4Ud-kMJ.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-Bwe-ngM3.js";import"./index-jKxnKPxh.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
@@ -16,9 +16,9 @@
16
16
  <!-- FOUC 脚本外联化:script-src 已去掉 'unsafe-inline'(2026-09-13 审计,
17
17
  该指令曾把任何 HTML 注入点直接升级为脚本执行) -->
18
18
  <script src="./fouc.js"></script>
19
- <script type="module" crossorigin src="./assets/main-jV_OilRs.js"></script>
20
- <link rel="modulepreload" crossorigin href="./assets/index-C9fscARj.js">
21
- <link rel="stylesheet" crossorigin href="./assets/index-EInfxfl9.css">
19
+ <script type="module" crossorigin src="./assets/main-Bwe-ngM3.js"></script>
20
+ <link rel="modulepreload" crossorigin href="./assets/index-jKxnKPxh.js">
21
+ <link rel="stylesheet" crossorigin href="./assets/index-CS4Wtfwl.css">
22
22
  <link rel="stylesheet" crossorigin href="./assets/main-D9IB7N5p.css">
23
23
  </head>
24
24
  <body>
package/web/pet.html CHANGED
@@ -8,9 +8,9 @@
8
8
  content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' http://localhost:5173 ws://localhost:5173; base-uri 'none'; form-action 'none'"
9
9
  />
10
10
  <title>LookatStudy Pet</title>
11
- <script type="module" crossorigin src="./assets/pet-xGooCXVY.js"></script>
12
- <link rel="modulepreload" crossorigin href="./assets/index-C9fscARj.js">
13
- <link rel="stylesheet" crossorigin href="./assets/index-EInfxfl9.css">
11
+ <script type="module" crossorigin src="./assets/pet-7_82JHov.js"></script>
12
+ <link rel="modulepreload" crossorigin href="./assets/index-jKxnKPxh.js">
13
+ <link rel="stylesheet" crossorigin href="./assets/index-CS4Wtfwl.css">
14
14
  <link rel="stylesheet" crossorigin href="./assets/pet-CTf4hJTR.css">
15
15
  </head>
16
16
  <body>
@@ -1,20 +0,0 @@
1
- import{r as n,j as e,V as Te,k as be,l as Me,m as Ce,s as ot,n as rt,C as ct,M as dt}from"./index-C9fscARj.js";import{c as We,u as ce,b as Oe,y as mt,X as ve,f as ut,k as xe,N as je,a as r,W as Le,r as Ue,O as De,Q as xt,q as ht,m as _e,R as pt,V as gt,Y as ft}from"./main-jV_OilRs.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 bt=We("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
7
- * @license lucide-react v0.468.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const vt=We("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"}]]),jt={vision:"companion.custom.routeVision",geometric:"companion.custom.routeGeometric",l1:"companion.custom.routeL1"};function wt(t){let x="";for(let b=0;b<t.length;b+=32768)x+=String.fromCharCode(...t.subarray(b,b+32768));return btoa(x)}async function kt(t){try{return await navigator.clipboard.writeText(t),!0}catch{}const x=document.createElement("textarea");x.value=t,x.style.position="fixed",x.style.opacity="0",document.body.appendChild(x),x.focus(),x.select();let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return x.remove(),o}function Nt({onClose:t,onSaved:x}){const o=ce(),[b,N]=n.useState(!1),[l,c]=n.useState(!1),[v,p]=n.useState(0),[g,S]=n.useState(null),[j,T]=n.useState(null),[$,h]=n.useState(""),[f,z]=n.useState(""),[y,A]=n.useState("ember"),R=n.useRef(null),M=n.useRef(null);Oe(M,!0),n.useEffect(()=>{if(!l)return;p(0);const m=Date.now(),E=window.setInterval(()=>p(Math.floor((Date.now()-m)/1e3)),500);return()=>window.clearInterval(E)},[l]);const q=async()=>{const m=await kt(o("companion.wizard.prompt"));N(m),m?setTimeout(()=>N(!1),2400):T(o("companion.wizard.copyFail"))},V=async m=>{if(m){c(!0),T(null),S(null),h(m.name.replace(/\.png$/i,""));try{const E=wt(new Uint8Array(await m.arrayBuffer())),_=await window.api.companionPackCutFromImage({pngBase64:E});S(_),_.visionError?T(`${o("companion.custom.visionFallback")} · ${_.visionError}`):T(`${o("companion.custom.cutDone")} · ${o(jt[_.route]??"companion.custom.routeL1")}`)}catch(E){T(`${o("companion.custom.fail")}: ${String(E)}`)}finally{c(!1)}}},B=async()=>{if(g){c(!0);try{await window.api.companionPackApplyPack({name:f.trim()||$||"My Bot",manifest:{...g.manifest,vehicle:y},parts:g.parts.map(m=>({name:m.name,pngBase64:m.pngBase64}))}),await Me(),await window.api.setSetting("companion_form","custom"),window.dispatchEvent(new Event("companion-config-changed")),x()}catch(m){T(`${o("companion.custom.fail")}: ${String(m)}`)}finally{c(!1)}}};return mt.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":o("companion.wizard.title"),onClick:t,children:e.jsxs("div",{ref:M,onClick:m=>m.stopPropagation(),className:"w-full max-w-xl max-h-[86vh] overflow-y-auto rounded-2xl bg-surface-1 shadow-pop p-4","data-testid":"companion-wizard",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-body font-bold text-ink-strong",children:o("companion.wizard.title")}),e.jsx("button",{onClick:t,"aria-label":o("action.close"),className:"text-ink-muted hover:text-ink-strong w-8 h-8 flex items-center justify-center rounded-lg hover:bg-surface-2",children:e.jsx(ve,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"rounded-xl border border-[var(--border-faint)] p-3 mb-2",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1",children:o("companion.wizard.s1")}),e.jsx("p",{className:"text-caption text-ink-muted leading-relaxed",children:o("companion.wizard.s1body")})]}),e.jsxs("div",{className:"rounded-xl border border-[var(--border-faint)] p-3 mb-2",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1",children:o("companion.wizard.s2")}),e.jsx("p",{className:"text-caption text-ink-muted leading-relaxed mb-2",children:o("companion.wizard.s2body")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("a",{href:"https://www.doubao.com/chat/",target:"_blank",rel:"noreferrer",className:"rounded-lg border border-[var(--border-faint)] px-3 py-1.5 text-label hover:bg-surface-2",children:o("companion.wizard.s2doubao")}),e.jsx("a",{href:"https://jimeng.jianying.com/",target:"_blank",rel:"noreferrer",className:"rounded-lg border border-[var(--border-faint)] px-3 py-1.5 text-label hover:bg-surface-2",children:o("companion.wizard.s2jimeng")}),e.jsx("a",{href:"https://chatgpt.com/",target:"_blank",rel:"noreferrer",className:"rounded-lg border border-[var(--border-faint)] px-3 py-1.5 text-label hover:bg-surface-2",children:o("companion.wizard.s2chatgpt")}),e.jsx("button",{type:"button",onClick:()=>void q(),"data-testid":"companion-wizard-copy",className:"rounded-lg bg-accent px-3 py-1.5 text-label text-white hover:opacity-90",children:o(b?"companion.wizard.copied":"companion.wizard.copy")})]}),e.jsx("textarea",{readOnly:!0,value:o("companion.wizard.prompt"),rows:6,className:"w-full rounded-lg bg-surface-2 border border-[var(--border-faint)] p-2 text-caption text-ink-muted font-mono resize-y select-all",onFocus:m=>m.currentTarget.select()})]}),e.jsxs("div",{className:"rounded-xl border border-[var(--border-faint)] p-3",children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1",children:o("companion.wizard.s3")}),e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"text-caption text-ink-muted mb-1",children:o("companion.wizard.vehicle")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":o("companion.wizard.vehicle"),children:Te.map(m=>{const E=y===m;return e.jsxs("button",{type:"button",role:"radio","aria-checked":E,"data-testid":`companion-wizard-veh-${m}`,onClick:()=>A(m),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-label motion-safe:transition-colors
12
- ${E?"border-[var(--accent)] bg-surface-2 text-ink-strong font-medium":"border-[var(--border-faint)] hover:bg-surface-2 text-ink-muted"}`,children:[e.jsx("span",{"aria-hidden":"true",className:"w-3 h-3 rounded-full border border-black/20",style:{background:be[m].dot}}),o(`companion.form.${m}.name`)]},m)})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("input",{ref:R,type:"file",accept:"image/png",className:"hidden","data-testid":"companion-custom-file",onChange:m=>{var E;return void V((E=m.target.files)==null?void 0:E[0])}}),e.jsx("button",{type:"button",disabled:l,onClick:()=>{var m;return(m=R.current)==null?void 0:m.click()},"data-testid":"companion-wizard-pick",className:"rounded-lg border border-[var(--border-faint)] px-3 py-1.5 text-label hover:bg-surface-2 disabled:opacity-50",children:o("companion.wizard.pick")}),l&&e.jsxs("span",{className:"flex items-center gap-1.5 text-label text-ink-muted","data-testid":"companion-custom-busy",children:[e.jsx(ut,{size:14,className:"animate-spin"}),o(g?"companion.custom.applying":"companion.custom.locating"),e.jsxs("span",{className:"tabular-nums",children:[v,"s"]})]}),j&&e.jsx("span",{className:"text-caption text-ink-muted","data-testid":"companion-custom-msg",children:j})]}),g&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2","data-testid":"companion-custom-preview",children:[g.parts.map(m=>e.jsx("img",{src:`data:image/png;base64,${m.pngBase64}`,alt:m.name,title:m.name,className:"h-14 w-14 object-contain rounded-lg bg-surface-2"},m.name)),e.jsx("input",{value:f,onChange:m=>z(m.target.value),placeholder:o("companion.wizard.namePh"),"data-testid":"companion-wizard-name",className:"rounded-lg border border-[var(--border-faint)] bg-surface-0 px-2.5 py-1.5 text-label text-ink-strong placeholder:text-ink-muted w-36"}),e.jsx("button",{type:"button",disabled:l,onClick:()=>void B(),"data-testid":"companion-custom-apply",className:"rounded-lg bg-brand px-3 py-1.5 text-label text-white hover:opacity-90 disabled:opacity-50",children:o("companion.wizard.save")})]})]})]})}),document.body)}const yt=[{id:"shimejiorg",label:"shimeji.org",url:"https://shimeji.org/"},{id:"shimejisxyz",label:"shimejis.xyz",url:"https://shimejis.xyz/"},{id:"cachomon",label:"Cachomon",url:"https://cachomon.com/"},{id:"deviantart",label:"DeviantArt",url:"https://www.deviantart.com/search?q=shimeji"}];function St({onClose:t,onImported:x}){const o=ce(),b=n.useRef(null),N=n.useRef(null);Oe(b,!0);const[l,c]=n.useState(!1),[v,p]=n.useState(null),[g,S]=n.useState(null),j=async h=>{var z;const f=(z=h.target.files)==null?void 0:z[0];if(h.target.value="",!!f){c(!0),p(null);try{const y=new Uint8Array(await f.arrayBuffer());let A="";for(let M=0;M<y.length;M+=32768)A+=String.fromCharCode(...y.subarray(M,M+32768));const R=await window.api.shimejiImportZip({zipBase64:btoa(A)});S({importId:R.importId,characters:R.characters,selected:new Set(R.characters.map(M=>M.ref))})}catch(y){p(String(y.message??y).slice(0,160))}finally{c(!1)}}},T=h=>{S(f=>{if(!f)return f;const z=new Set(f.selected);return z.has(h)?z.delete(h):z.add(h),{...f,selected:z}})},$=async()=>{if(g){c(!0);try{await window.api.shimejiConfirmImport({importId:g.importId,characterRefs:[...g.selected]}),S(null),await Ce(),await x(),t()}catch(h){p(String(h.message??h).slice(0,160))}finally{c(!1)}}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":o("settings.shimeji.dialog.title"),onClick:t,children:e.jsxs("div",{ref:b,onClick:h=>h.stopPropagation(),className:"relative w-full max-w-md max-h-[85dvh] flex flex-col rounded-2xl bg-surface-0 border border-[var(--border)] shadow-elevated p-4","data-testid":"shimeji-dialog",children:[e.jsx("button",{type:"button","aria-label":o("action.close"),"data-testid":"shimeji-dialog-close",onClick:t,className:"absolute top-2.5 right-2.5 w-7 h-7 rounded-lg flex items-center justify-center text-ink-muted hover:text-ink-strong hover:bg-surface-2",children:e.jsx(ve,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-h-0 overflow-y-auto",children:[e.jsx("div",{className:"text-body font-medium text-ink-strong mb-1",children:o("settings.shimeji.dialog.title")}),e.jsx("p",{className:"text-label text-ink-muted mb-3",children:o("settings.shimeji.desc")}),!g&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button","data-testid":"shimeji-import",disabled:l,onClick:()=>{var h;return(h=N.current)==null?void 0:h.click()},className:"w-full rounded-xl border border-dashed border-[var(--border)] py-6 flex flex-col items-center gap-1.5 text-ink-faint hover:text-ink-muted hover:bg-surface-2 disabled:opacity-50",children:[e.jsx("span",{className:"text-label font-medium",children:o(l?"settings.shimeji.importing":"settings.shimeji.import")}),e.jsx("span",{className:"text-caption",children:o("settings.shimeji.guide")})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2","data-testid":"shimeji-download-links",children:yt.map(h=>e.jsxs("a",{href:h.url,target:"_blank",rel:"noopener noreferrer","data-testid":`shimeji-link-${h.id}`,className:"inline-flex items-center gap-1 rounded-lg border border-[var(--border-faint)] px-2 py-1 text-caption text-ink-muted hover:text-ink-strong hover:bg-surface-2 motion-safe:transition-colors",children:[e.jsx(bt,{className:"w-3 h-3 shrink-0","aria-hidden":"true"}),h.label]},h.id))})]}),e.jsx("input",{ref:N,type:"file",accept:".zip",className:"hidden",onChange:h=>void j(h)}),v&&e.jsx("p",{className:"text-caption text-warning mt-2",role:"alert",children:v}),g&&e.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-surface-1 p-3","data-testid":"shimeji-character-picker",children:[e.jsx("div",{className:"text-body text-ink-strong mb-2",children:o("settings.shimeji.pick.title")}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:g.characters.map(h=>{const f=g.selected.has(h.ref);return e.jsxs("button",{type:"button","aria-pressed":f,onClick:()=>T(h.ref),className:`flex items-center gap-2 rounded-xl border p-2 text-left ${f?"border-[var(--accent)] bg-surface-2":"border-[var(--border-faint)]"}`,children:[h.iconBase64?e.jsx("img",{src:`data:image/png;base64,${h.iconBase64}`,alt:"",className:"w-9 h-9 rounded-lg object-contain bg-surface-2"}):e.jsx("div",{className:"w-9 h-9 rounded-lg bg-surface-2"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-body text-ink-strong",children:h.name}),e.jsxs("span",{className:"text-caption text-ink-muted",children:[h.format," · ",h.frameCount,"f · ",h.actionCount]})]})]},h.ref)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button","data-testid":"shimeji-confirm-import",className:"btn-3d-brand px-3 py-1.5 text-label",disabled:l||g.selected.size===0,onClick:()=>void $(),children:o("settings.shimeji.pick.confirm",{count:g.selected.size})}),e.jsx("button",{type:"button",className:"btn-3d-neutral px-3 py-1.5 text-label",onClick:t,children:o("action.cancel")})]})]})]})]})})}const fe="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 $e({kind:t,showProtocol:x=!0,testPrefix:o="custom",titleKey:b="settings.custom.form_title",modelPhKey:N="settings.custom.model_ph",testOverride:l,onSaved:c,onCancel:v}){const p=ce(),[g,S]=n.useState(""),[j,T]=n.useState("openai-compatible"),[$,h]=n.useState(""),[f,z]=n.useState(""),[y,A]=n.useState(""),[R,M]=n.useState(!1),[q,V]=n.useState(!1),[B,m]=n.useState(null),E=async()=>{if(!(!$.trim()||!y.trim()||q)){V(!0),m(null);try{const w=l?await l({baseUrl:$.trim(),apiKey:f.trim(),model:y.trim()}):await r.testCustomProvider({label:g||p("settings.custom.test_label"),protocol:j,baseUrl:$.trim(),apiKey:f.trim()||void 0,defaultModel:y.trim()});m({ok:w.ok,detail:w.detail})}catch(w){m({ok:!1,detail:w instanceof Error?w.message:String(w)})}finally{V(!1)}}},_=async()=>{if(!(!g.trim()||!$.trim()||!y.trim()))try{const w=await r.createCustomProvider({label:g.trim(),kind:t,protocol:x?j:"openai-compatible",baseUrl:$.trim(),apiKey:f.trim()||void 0,defaultModel:y.trim(),vision:t==="llm"?R:void 0});c(w)}catch{}};return e.jsxs("div",{className:"space-y-2.5","data-testid":`${o}-provider-form`,children:[e.jsx("div",{className:"text-label font-bold text-ink-strong",children:p(b)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:g,onChange:w=>S(w.target.value),placeholder:p("settings.custom.label_ph"),"data-testid":`${o}-label`,className:`${fe} min-w-0 flex-1 px-2.5 py-1.5`}),x&&e.jsxs("select",{value:j,onChange:w=>T(w.target.value),"data-testid":`${o}-protocol`,className:`${fe} px-2 py-1.5`,children:[e.jsx("option",{value:"openai-compatible",children:p("settings.proto.openai")}),e.jsx("option",{value:"anthropic",children:"Anthropic"}),e.jsx("option",{value:"google",children:"Google"})]})]}),e.jsx("input",{type:"text",value:$,onChange:w=>h(w.target.value),placeholder:p("settings.custom.baseurl_ph"),"data-testid":`${o}-baseurl`,className:`${fe} w-full px-2.5 py-1.5 font-mono`}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:y,onChange:w=>A(w.target.value),placeholder:p(N),"data-testid":`${o}-model`,className:`${fe} min-w-0 flex-1 px-2.5 py-1.5 font-mono`}),e.jsx("input",{type:"password",value:f,onChange:w=>z(w.target.value),placeholder:p("settings.custom.apikey_ph"),"data-testid":`${o}-apikey`,className:`${fe} min-w-0 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":`${o}-vision`,children:[e.jsx("input",{type:"checkbox",checked:R,onChange:w=>M(w.target.checked),className:"w-4 h-4 rounded accent-brand"}),e.jsx("span",{className:"text-ink-strong",children:p("settings.custom.vision")}),e.jsx("span",{className:"text-ink-faint",children:p("settings.custom.visionHint")})]}),B&&e.jsxs("div",{className:`text-label rounded p-2 inline-flex items-start gap-1.5 ${B.ok?"bg-brand/10 text-brand":"bg-warning/10 text-warning"}`,children:[B.ok?e.jsx(xe,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}):e.jsx(je,{className:"w-4 h-4 mt-px shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"break-words",children:B.detail})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>void E(),disabled:!$.trim()||!y.trim()||q,"data-testid":`${o}-test`,className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:p(q?"settings.testing":"settings.test")}),e.jsx("button",{onClick:()=>void _(),disabled:!g.trim()||!$.trim()||!y.trim(),"data-testid":`${o}-save`,className:"btn-3d-brand px-3 py-1.5 text-label disabled:opacity-40",children:p("settings.custom.save")}),v&&e.jsx("button",{onClick:v,className:"text-label text-ink-muted hover:text-ink-strong px-3 py-1.5 transition-colors",children:p("action.cancel")})]})]})}const He="lookatstudy-theme",Ke="auto",qe="(prefers-color-scheme: dark)";function Pe(){return typeof window>"u"||window.matchMedia(qe).matches?"dark":"light"}function Ct(){if(typeof localStorage>"u")return Ke;const t=localStorage.getItem(He);return t==="auto"||t==="light"||t==="dark"?t:Ke}function ze(t){const x=document.documentElement;x.classList.remove("dark","light"),x.classList.add(t),window.dispatchEvent(new CustomEvent("theme-changed",{detail:{resolved:t}}))}function _t(){const[t,x]=n.useState(()=>Ct()),[o,b]=n.useState(()=>t==="auto"?Pe():t),N=n.useCallback(l=>{x(l),localStorage.setItem(He,l);const c=l==="auto"?Pe():l;b(c),ze(c)},[]);return n.useEffect(()=>{if(t!=="auto")return;const l=window.matchMedia(qe),c=v=>{const p=v.matches?"dark":"light";b(p),ze(p)};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[t]),n.useEffect(()=>{const l=t==="auto"?Pe():t;b(l),ze(l)},[t]),{mode:t,resolved:o,setMode:N}}const $t="0.37.2",Et={version:$t};function Se(){window.dispatchEvent(new Event(ft))}const ie="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",ee="bg-surface-3 text-ink-muted hover:bg-surface-3 hover:bg-surface-3 hover:text-ink-strong",te="bg-brand text-white shadow-sm";function P(t){return t?"px-4 py-3.5 border-t border-[var(--border-faint)]":"px-4 py-3.5"}function Bt(){const t=ce(),[x,o]=n.useState([]),[b,N]=n.useState([]),[l,c]=n.useState("glm"),[v,p]=n.useState(""),[g,S]=n.useState(""),[j,T]=n.useState(null),[$,h]=n.useState(!1),[f,z]=n.useState(null),[y,A]=n.useState(!1),[R,M]=n.useState(!1),[q,V]=n.useState([]),[B,m]=n.useState(!1),[E,_]=n.useState(null),[w,O]=n.useState(null),[W,G]=n.useState(""),[d,X]=n.useState(!1),U=_t(),se=async i=>{if(I)try{await r.updateCustomProvider(I.id,{vision:i}),await H()}catch{}},ae=async()=>{m(!0),_(null);try{const i=await r.discoverModels();i.ok&&i.models?V(i.models):_(i.error||t("settings.discover_failed"))}catch(i){_(i instanceof Error?i.message:String(i))}finally{m(!1)}},H=n.useCallback(async()=>{try{const[i,C,K,Z]=await Promise.all([r.getProviderPresets(),r.listCustomProviders(),r.getSetting("active_provider"),r.getSetting("active_model")]);o(i),N(C);const F=K??"glm";if(c(F),F.startsWith("custom-")){const s=C.find(u=>u.id===F);T(s!=null&&s.hasApiKey?t("settings.key.configured"):null)}else{const s=i.find(u=>u.id===F);if(s){const u=await r.hasSetting(s.apiKeySetting);T(u?t("settings.key.configured"):null)}}if(F.startsWith("custom-")){const s=C.find(u=>u.id===F);p(Z??(s==null?void 0:s.defaultModel)??"")}else{const s=i.find(u=>u.id===F);p(Z??(s==null?void 0:s.defaultModel)??"")}}catch(i){console.error("[SettingsView] load() failed:",i)}},[t]);n.useEffect(()=>{H()},[H]);const le=async i=>{c(i),z(null),S("");const C=x.find(K=>K.id===i);if(C){const K=await r.hasSetting(C.apiKeySetting);T(K?t("settings.key.configured"):null),p(v||C.defaultModel)}},me=async()=>{A(!1);try{if(await r.setSetting("active_provider",l),await r.setSetting("active_model",v),g.trim()){const i=x.find(C=>C.id===l);i&&(await r.setSetting(i.apiKeySetting,g.trim()),T(`${g.trim().slice(0,4)}…${g.trim().slice(-4)}`),S(""))}A(!0),setTimeout(()=>A(!1),2e3),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},D=async()=>{h(!0),z(null);try{const i=await r.testLlmConnection();z(i)}catch(i){z({ok:!1,detail:i instanceof Error?i.message:String(i),errorKind:"unknown"})}finally{h(!1)}},Y=async i=>{await r.setSetting("active_provider",i.id),await r.setSetting("active_model",i.defaultModel),c(i.id),p(i.defaultModel),M(!1),await H(),window.dispatchEvent(new Event("llm-config-changed"))},oe=async i=>{try{await r.deleteCustomProvider(i),l===i&&(await r.setSetting("active_provider","glm"),c("glm")),await H()}catch{}},I=l.startsWith("custom-")?b.find(i=>i.id===l):null;n.useEffect(()=>{if(!I)return;const i=I.models.find(C=>C.id===v);G(i!=null&&i.contextWindow?String(i.contextWindow):"")},[I,v]);const pe=async()=>{var F,s;if(!I)return;const i=W.trim().replace(/[,\s_]/g,""),C=/^(\d+)([km]?)$/i.exec(i);if(i!==""&&!C)return;const K=((F=C==null?void 0:C[2])==null?void 0:F.toLowerCase())==="k"?1e3:((s=C==null?void 0:C[2])==null?void 0:s.toLowerCase())==="m"?1e6:1,Z=i===""||!C?null:Math.max(1,Math.round(parseInt(C[1],10)*K));X(!0);try{const u=I.models.map(L=>L.id===v?{...L,contextWindow:Z}:L);await r.updateCustomProvider(I.id,{models:u}),await H(),window.dispatchEvent(new Event("llm-config-changed"))}catch{}finally{X(!1)}},ne=l.startsWith("custom-")?null:x.find(i=>i.id===l);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:P(!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(i=>e.jsx("button",{onClick:()=>le(i.id),"data-testid":`provider-card-${i.id}`,"aria-pressed":l===i.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors ${l===i.id?te:ee}`,children:i.label},i.id)),b.filter(i=>i.kind==="llm").map(i=>e.jsxs("button",{onClick:()=>le(i.id),"data-testid":`provider-card-${i.id}`,"aria-pressed":l===i.id,className:`px-3 py-1.5 rounded-lg text-label font-medium whitespace-nowrap transition-colors inline-flex items-center gap-1 ${l===i.id?te:ee}`,children:[e.jsx(Le,{className:"w-3.5 h-3.5","aria-hidden":"true"}),i.label]},i.id)),e.jsxs("button",{onClick:()=>M(i=>!i),"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(Ue,{className:"w-3.5 h-3.5","aria-hidden":"true"}),t("settings.add_custom")]})]})]}),R&&e.jsx("div",{className:"px-4 py-3.5 bg-surface-1 border-t border-[var(--border-faint)]",children:e.jsx($e,{kind:"llm",testPrefix:"custom",onSaved:i=>void Y(i),onCancel:()=>M(!1)})}),b.length>0&&l.startsWith("custom-")&&e.jsx("div",{className:P(!0),children:e.jsx("button",{onClick:i=>{const C=i.currentTarget.getBoundingClientRect(),K=b.find(Z=>Z.id===l);K&&O({id:K.id,label:K.label,rect:C})},className:"text-label text-warning hover:underline",children:t("settings.delete_custom")})}),ne&&e.jsxs(e.Fragment,{children:[ne.baseUrl&&e.jsxs("div",{className:P(!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:ne.baseUrl})]}),e.jsxs("div",{className:P(!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:v,onChange:i=>p(i.target.value),"data-testid":"model-select",className:`${ie} flex-1 px-2.5 py-1.5`,children:[ne.models.map(i=>e.jsx("option",{value:i.id,children:i.id},i.id)),l==="openrouter"&&q.map(i=>e.jsx("option",{value:i.id,children:i.id},i.id))]}),l==="openrouter"&&e.jsxs("button",{onClick:ae,disabled:B,"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(vt,{className:`w-3.5 h-3.5 ${B?"animate-spin":""}`,"aria-hidden":"true"}),t(B?"settings.discovering":"settings.refresh")]})]})]}),E&&e.jsx("div",{className:"text-label text-warning mt-1.5 ml-[68px]",children:E})]}),e.jsx("div",{className:P(!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:[j&&e.jsxs("span",{className:"text-label text-brand shrink-0 inline-flex items-center gap-1",children:[e.jsx(xe,{className:"w-3.5 h-3.5","aria-hidden":"true"}),j]}),e.jsx("input",{type:"password",value:g,onChange:i=>S(i.target.value),placeholder:t(j?"settings.key.overwrite_ph":"settings.key.paste_ph"),"data-testid":"settings-key-input",className:`${ie} flex-1 px-2.5 py-1.5`}),e.jsx("a",{href:ne.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-label text-brand hover:underline whitespace-nowrap",children:t("settings.key.get")})]})]})}),e.jsx("div",{className:P(!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:D,disabled:$,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:t($?"settings.testing":"settings.test")}),f&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 min-w-0 break-words ${f.ok?"text-brand":"text-warning"}`,children:[f.ok?e.jsx(xe,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):e.jsx(je,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),f.detail]})]})})]}),I&&!ne&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P(!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:I.baseUrl})]}),e.jsx("div",{className:P(!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")}),I.models.length>1?e.jsx("select",{value:v,onChange:i=>p(i.target.value),"data-testid":"model-select-custom",className:`${ie} flex-1 px-2.5 py-1.5`,children:I.models.map(i=>e.jsx("option",{value:i.id,children:i.id},i.id))}):e.jsx("input",{type:"text",value:v,onChange:i=>p(i.target.value),placeholder:t("settings.custom.model_ph"),"data-testid":"model-input-custom",className:`${ie} flex-1 px-2.5 py-1.5 font-mono`})]})}),e.jsxs("div",{className:P(!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:W,onChange:i=>G(i.target.value),placeholder:t("settings.custom.windowPh"),"data-testid":"context-window-input",className:`${ie} flex-1 px-2.5 py-1.5 font-mono tabular-nums`}),e.jsx("button",{onClick:pe,disabled:d,"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:P(!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:I.vision,onChange:i=>void se(i.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:P(!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:D,disabled:$,"data-testid":"test-connection-btn",className:"btn-3d-neutral px-3 py-1.5 text-label disabled:opacity-40",children:t($?"settings.testing":"settings.test")}),f&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 min-w-0 break-words ${f.ok?"text-brand":"text-warning"}`,children:[f.ok?e.jsx(xe,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):e.jsx(je,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),f.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(zt,{activeProvider:l,activeModel:v,presets:x,customProviders:b,onProvidersChanged:()=>void H()})})]}),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(At,{})})]}),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(Tt,{})})]}),e.jsxs("section",{id:"settings-section-companion",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(Mt,{})})]}),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:P(!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:i,label:C})=>e.jsx("button",{onClick:()=>U.setMode(i),"data-testid":`theme-${i}`,"aria-pressed":U.mode===i,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${U.mode===i?te:ee}`,children:C},i))}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:U.mode==="auto"?t("settings.theme.following",{mode:t(`settings.theme.${U.resolved}`)}):null})]}),e.jsxs("div",{className:P(!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(i=>e.jsx("button",{onClick:()=>xt(i),"data-testid":`lang-${i}`,"aria-pressed":De()===i,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${De()===i?te:ee}`,children:i==="zh-CN"?"中文":"English"},i))})]}),e.jsxs("div",{className:P(!0),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-2",children:t("settings.row.import_lang")}),e.jsx(Pt,{})]})]})]}),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(It,{})})]}),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:P(!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",Et.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:me,"data-testid":"settings-save",className:"btn-3d-brand px-5 py-2 text-body inline-flex items-center gap-1.5",children:[y&&e.jsx(ht,{className:"w-4 h-4","aria-hidden":"true"}),t(y?"settings.saved_text":"settings.footer.save")]})]}),w&&e.jsx(_e,{anchorRect:w.rect,message:t("settings.delete_custom_confirm",{name:w.label}),danger:!0,confirmLabel:t("action.delete"),testid:"custom-provider-delete-confirm",onConfirm:()=>{oe(w.id),O(null)},onCancel:()=>O(null)})]})}function Pt(){const[t,x]=n.useState("en"),[o,b]=n.useState(!1);n.useEffect(()=>{r.getSetting("pref_lang").then(c=>{c&&x(c),b(!0)})},[]);const N=async c=>{x(c),await r.setSetting("pref_lang",c)},l=[{code:"en",label:"English"},{code:"zh-CN",label:"简体中文"},{code:"zh-TW",label:"繁體中文"}];return o?e.jsx("div",{className:"flex gap-2","data-testid":"pref-lang-options",children:l.map(c=>e.jsx("button",{onClick:()=>N(c.code),"data-testid":`pref-lang-${c.code}`,"aria-pressed":t===c.code,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${t===c.code?te:ee}`,children:c.label},c.code))}):null}function zt({activeProvider:t,activeModel:x,presets:o,customProviders:b,onProvidersChanged:N}){const l=ce(),[c,v]=n.useState(!1),[p,g]=n.useState(!1),[S,j]=n.useState(""),[T,$]=n.useState(!1),[h,f]=n.useState(!1),[z,y]=n.useState(null),[A,R]=n.useState(!1);n.useEffect(()=>{Promise.all([r.getSetting("flag_multimodal_import"),r.getSetting("vision_provider_override"),r.getSetting("vision_model_override"),r.getSetting("flag_math_vision")]).then(([d,X,U])=>{v(d==="true"),j(X??""),R(U==="true"),g(!0)})},[]);const M=async()=>{const d=!c;v(d),await r.setSetting("flag_multimodal_import",String(d))},q=async()=>{const d=!A;R(d),await r.setSetting("flag_math_vision",String(d))},V=async d=>{await r.setSetting("vision_provider_override",d.id),await r.setSetting("vision_model_override",d.defaultModel),j(d.id),$(!1)},B=async()=>{await r.setSetting("vision_provider_override",""),await r.setSetting("vision_model_override",""),j(""),$(!1)},[m,E]=n.useState(null),_=async d=>{try{S===d&&(await r.setSetting("vision_provider_override",""),await r.setSetting("vision_model_override",""),j("")),await r.deleteCustomProvider(d)}catch{}finally{N==null||N()}},w=async()=>{if(!h){f(!0),y(null);try{const d=await r.testLlmConnection({vision:!0});y({ok:d.ok,detail:d.detail})}catch(d){y({ok:!1,detail:d instanceof Error?d.message:String(d)})}finally{f(!1)}}},O=b.filter(d=>d.kind==="vision"),W=S.startsWith("custom-")?b.find(d=>d.id===S):null,G=S&&!S.startsWith("custom-")?o.find(d=>d.id===S):null;return p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[e.jsx(he,{checked:c,onChange:M,label:l("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:l("settings.multimodal.toggle")}),e.jsx("div",{className:"text-label text-ink-muted",children:l("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:l("settings.multimodal.current_model",{model:x||l("settings.multimodal.not_selected")})}),e.jsx("div",{children:t.startsWith("custom-")?l("settings.multimodal.hint_custom"):l("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:l("settings.multimodal.override_title")}),e.jsx("div",{className:"text-caption text-ink-muted mb-2",children:l("settings.multimodal.override_bridge_hint")}),e.jsxs("div",{className:"space-y-3 mt-1",children:[W&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx(Le,{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:W.label}),e.jsx("code",{className:"text-ink-faint font-mono break-all",children:W.defaultModel}),e.jsx("span",{className:"text-ink-faint break-all min-w-0",children:W.baseUrl})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{onClick:()=>void w(),disabled:h,"data-testid":"vision-override-test",className:"btn-3d-neutral px-4 py-1.5 text-label disabled:opacity-50",children:l(h?"settings.testing":"settings.multimodal.test_override")}),e.jsx("button",{onClick:()=>$(d=>!d),className:"text-label text-accent hover:underline",children:l("settings.multimodal.replace_custom")}),e.jsx("button",{onClick:()=>void B(),className:"text-label text-ink-muted hover:text-ink-strong",children:l("settings.multimodal.stop_override")}),e.jsx("button",{onClick:d=>{d.stopPropagation(),E({id:W.id,label:W.label,rect:d.currentTarget.getBoundingClientRect()})},"data-testid":`vision-delete-${W.id}`,className:"text-label text-ink-muted hover:text-warning",children:l("action.delete")}),z&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${z.ok?"text-brand":"text-warning"}`,children:[z.ok?e.jsx(xe,{className:"w-4 h-4","aria-hidden":"true"}):e.jsx(je,{className:"w-4 h-4","aria-hidden":"true"}),z.detail]})]})]}),G&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx("span",{className:"text-ink-muted",children:l("settings.multimodal.legacy_preset",{label:G.label})}),e.jsx("button",{onClick:()=>void B(),className:"text-label text-ink-muted hover:text-ink-strong underline",children:l("settings.multimodal.stop_override")})]}),!W&&!G&&e.jsxs(e.Fragment,{children:[O.map(d=>e.jsxs("span",{className:"relative block",children:[e.jsxs("button",{onClick:()=>void V(d),className:"w-full text-left px-3 py-2 rounded-lg bg-surface-1 hover:bg-surface-3 transition-colors","data-testid":`vision-pick-${d.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:d.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:d.defaultModel})]}),e.jsx("button",{type:"button","aria-label":l("action.delete"),"data-tooltip":l("action.delete"),"data-testid":`vision-delete-${d.id}`,onClick:X=>{X.stopPropagation(),E({id:d.id,label:d.label,rect:X.currentTarget.getBoundingClientRect()})},className:"absolute top-1.5 right-1.5 w-6 h-6 rounded-full text-ink-muted hover:text-warning flex items-center justify-center hover:bg-surface-2",children:e.jsx(ve,{className:"w-3.5 h-3.5"})})]},d.id)),(T||O.length===0)&&e.jsx($e,{kind:"vision",testPrefix:"vision-custom",titleKey:"settings.custom.form_title_vision",modelPhKey:"settings.custom.model_ph_vision",onSaved:d=>void V(d),onCancel:()=>$(!1)}),O.length>0&&e.jsx("button",{onClick:()=>$(d=>!d),className:"text-label text-accent hover:underline",children:l(T?"action.cancel":"settings.custom.new")})]})]})]}),e.jsxs("div",{className:"bg-ink/5 rounded-lg p-3 flex items-center gap-3",children:[e.jsx(he,{checked:A,onChange:q,label:l("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:l("settings.mathvision.toggle")}),e.jsx("div",{className:"text-caption text-ink-muted",children:l("settings.mathvision.desc")})]})]})]}),m&&e.jsx(_e,{anchorRect:m.rect,message:l("settings.delete_custom_confirm",{name:m.label}),danger:!0,confirmLabel:l("action.delete"),testid:"vision-provider-delete-confirm",onConfirm:()=>{_(m.id),E(null)},onCancel:()=>E(null)})]}):null}function Tt(){const t=ce(),[x,o]=n.useState(!1),[b,N]=n.useState(!1);n.useEffect(()=>{r.getSetting("flag_memory_system").then(c=>{o(c==="true"),N(!0)})},[]);const l=async()=>{const c=!x;o(c),await r.setSetting("flag_memory_system",String(c))};return b?e.jsxs("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[e.jsx(he,{checked:x,onChange:l,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 Mt(){var K,Z,F;const t=ce(),[x,o]=n.useState(!0),[b,N]=n.useState(!1),l=n.useSyncExternalStore(ot,rt),[c,v]=n.useState(!0),[p,g]=n.useState(!1),S=typeof window<"u"&&!!window.__lookatstudyWeb;n.useEffect(()=>{r.getSetting("companion_enabled").then(s=>{o(s!=="false"&&s!=="0"),N(!0)}),r.getSetting("companion_sfx").then(s=>{v(s!=="false"&&s!=="0")}),r.getSetting("companion_pet_mode").then(s=>{g(s==="1")})},[]);const j=async()=>{const s=!x;o(s),await r.setSetting("companion_enabled",String(s)),window.dispatchEvent(new Event("companion-config-changed"))},T=async()=>{const s=!c;v(s),await r.setSetting("companion_sfx",String(s)),window.dispatchEvent(new Event("companion-config-changed"))},$=async()=>{const s=!p;g(s),await r.setSetting("companion_pet_mode",s?"1":"0"),window.dispatchEvent(new Event("companion-config-changed"))},h=async s=>{s!==l.form&&(await r.setSetting("companion_form",s),window.dispatchEvent(new Event("companion-config-changed")))},[f,z]=n.useState([]),[y,A]=n.useState(!1),[R,M]=n.useState(null),[q,V]=n.useState(!1),[B,m]=n.useState(!1),[E,_]=n.useState(!1),[w,O]=n.useState(null),[W,G]=n.useState(!1),[d,X]=n.useState([]),[U,se]=n.useState(null),[ae,H]=n.useState(null),[le,me]=n.useState(null),D=n.useCallback(async()=>{try{z((await window.api.companionPackList()).packs)}catch{}},[]),Y=n.useCallback(async()=>{try{X((await window.api.shimejiList()).packs)}catch{}},[]);n.useEffect(()=>{D(),Y();const s=()=>{D(),Y()};return window.addEventListener("companion-config-changed",s),()=>window.removeEventListener("companion-config-changed",s)},[D,Y]);const oe=async s=>{await r.shimejiActivate({id:s}),l.form!=="shimeji"&&await r.setSetting("companion_form","shimeji"),window.dispatchEvent(new Event("companion-config-changed")),await Y(),await Ce()},I=async(s,u)=>{await window.api.shimejiSetVehicle({id:s,vehicle:u}),await Y(),await Ce()},pe=async s=>{await window.api.shimejiDelete({id:s}),se(null),await Y(),await Ce()},ne=async s=>{await window.api.companionPackActivate({id:s}),l.form!=="custom"&&await r.setSetting("companion_form","custom"),await Me(),window.dispatchEvent(new Event("companion-config-changed"))},i=async s=>{(await window.api.companionPackDelete({id:s})).formReset&&window.dispatchEvent(new Event("companion-config-changed")),M(null),me(null),D()},C=async(s,u)=>{var L;await window.api.companionPackSetVehicle({id:s,vehicle:u}),await D(),(L=f.find(Q=>Q.id===s))!=null&&L.active&&(await Me(),window.dispatchEvent(new Event("companion-config-changed")))};return b?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(he,{checked:x,onChange:j,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(he,{checked:c,onChange:T,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")})]})]}),!S&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{checked:p,onChange:$,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.jsxs("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":t("settings.companion.form"),children:[ct.filter(s=>s!=="custom"&&s!=="shimeji").map(s=>{const u=l.form===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":u,"data-testid":`companion-form-${s}`,onClick:()=>{h(s)},className:`flex flex-col items-center gap-0.5 rounded-xl p-1.5 border motion-safe:transition-colors
13
- ${u?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,title:t(`companion.form.${s}.desc`),children:[e.jsx(dt,{form:s,expression:"happy",pose:"float",size:64}),e.jsx("span",{className:`text-label ${u?"text-ink-strong font-medium":"text-ink-muted"}`,children:t(`companion.form.${s}.name`)})]},s)}),e.jsxs("button",{type:"button",role:"radio","aria-checked":l.form==="custom"&&f.some(s=>s.active),"data-testid":"companion-card-custom",onClick:()=>m(!0),title:t("companion.pick.custom.title"),className:`flex flex-col items-center gap-0.5 rounded-xl p-1.5 border motion-safe:transition-colors
14
- ${l.form==="custom"&&f.some(s=>s.active)?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,children:[(()=>{const s=f.find(u=>u.active);return s!=null&&s.thumb?e.jsx("img",{src:s.thumb,alt:"",className:"h-14 w-14 object-contain"}):e.jsx("span",{className:"h-14 w-14 flex items-center justify-center",children:e.jsx("span",{className:"h-9 w-9 rounded-full bg-[#c8a06e]"})})})(),e.jsx("span",{className:`text-label max-w-20 truncate ${l.form==="custom"&&f.some(s=>s.active)?"text-ink-strong font-medium":"text-ink-muted"}`,children:((K=f.find(s=>s.active))==null?void 0:K.name)??t("companion.create.self.name")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":l.form==="shimeji"&&d.some(s=>s.active),"data-testid":"companion-card-shimeji",onClick:()=>_(!0),title:t("companion.pick.shimeji.title"),className:`flex flex-col items-center gap-0.5 rounded-xl p-1.5 border motion-safe:transition-colors
15
- ${l.form==="shimeji"&&d.some(s=>s.active)?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,children:[(()=>{const s=d.find(u=>u.active);return s!=null&&s.iconBase64?e.jsx("img",{src:`data:image/png;base64,${s.iconBase64}`,alt:"",className:"h-14 w-14 object-contain"}):e.jsx("span",{className:"h-14 w-14 flex items-center justify-center text-caption text-ink-muted",children:"Shimeji"})})(),e.jsx("span",{className:`text-label max-w-20 truncate ${l.form==="shimeji"&&d.some(s=>s.active)?"text-ink-strong font-medium":"text-ink-muted"}`,children:((Z=d.find(s=>s.active))==null?void 0:Z.name)??"Shimeji"})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":!1,"data-testid":"companion-form-add","aria-label":t("companion.bots.add"),onClick:()=>V(!0),className:"flex flex-col items-center gap-0.5 rounded-xl p-1.5 border border-dashed border-[var(--border-faint)] hover:bg-surface-2",children:[e.jsx("span",{className:"h-14 w-14 flex items-center justify-center text-ink-muted",children:e.jsx(Ue,{className:"w-6 h-6"})}),e.jsx("span",{className:"text-label text-ink-muted",children:t("companion.bots.add")})]})]}),R&&e.jsx(_e,{anchorRect:R.rect,message:t("companion.bots.deleteConfirm"),danger:!0,testid:"companion-pack-delete-confirm",onConfirm:()=>void i(R.id),onCancel:()=>M(null)}),B&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":t("companion.pick.custom.title"),onClick:()=>m(!1),children:e.jsxs("div",{className:"relative w-full max-w-md max-h-[85dvh] flex flex-col rounded-2xl bg-surface-0 border border-[var(--border)] shadow-elevated p-4","data-testid":"custom-pack-list",onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"text-body font-medium text-ink-strong mb-3",children:t("companion.pick.custom.title")}),e.jsxs("div",{className:"min-h-0 overflow-y-auto",children:[f.length===0?e.jsx("p",{className:"text-label text-ink-muted py-4 text-center",children:t("companion.pick.empty.custom")}):e.jsx("div",{className:"flex flex-col gap-1.5",children:f.map(s=>e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button","data-testid":`custom-pack-option-${s.id}`,onClick:()=>{ne(s.id),m(!1)},className:`w-full flex items-center gap-2.5 rounded-xl border p-2 text-left motion-safe:transition-colors
16
- ${s.active&&l.form==="custom"?"border-[var(--accent)] bg-surface-2":"border-[var(--border-faint)] hover:bg-surface-2"}`,children:[s.thumb?e.jsx("img",{src:s.thumb,alt:"",className:"w-10 h-10 rounded-lg object-contain bg-surface-2"}):e.jsx("span",{className:"w-10 h-10 rounded-lg bg-surface-2 inline-block"}),e.jsx("span",{className:"text-body text-ink-strong flex-1 truncate",children:s.name}),s.active&&l.form==="custom"&&e.jsx("span",{className:"text-caption text-brand font-medium",children:t("settings.shimeji.active")})]}),e.jsx("button",{type:"button","aria-label":t("companion.bots.veh"),"data-tooltip":t("companion.bots.veh"),"data-testid":`companion-pack-veh-${s.id}`,onClick:u=>{u.stopPropagation(),me(L=>L===s.id?null:s.id)},className:"absolute top-1.5 -left-1.5 w-5 h-5 rounded-full border border-black/25 shadow-card hover:scale-110 motion-safe:transition-transform",style:{background:be[s.vehicle??"silver"].dot}}),e.jsx("button",{type:"button","aria-label":t("companion.custom.delete"),onClick:u=>{u.stopPropagation(),M({id:s.id,rect:u.currentTarget.getBoundingClientRect()})},className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full flex items-center justify-center text-ink-faint hover:text-warning",children:e.jsx(ve,{className:"w-3.5 h-3.5"})})]},s.id))}),le&&e.jsxs("div",{className:"mt-2.5 rounded-xl border border-[var(--border-faint)] bg-surface-0 p-2.5","data-testid":"companion-veh-picker",children:[e.jsx("div",{className:"text-caption text-ink-muted mb-1.5",children:t("companion.wizard.vehicle")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5",role:"radiogroup","aria-label":t("companion.wizard.vehicle"),children:["silver",...Te].map(s=>{var L;const u=(((L=f.find(Q=>Q.id===le))==null?void 0:L.vehicle)??"silver")===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":u,"data-testid":`companion-veh-pick-${s}`,onClick:()=>void C(le,s),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-label motion-safe:transition-colors
17
- ${u?"border-[var(--accent)] bg-surface-2 text-ink-strong font-medium":"border-[var(--border-faint)] hover:bg-surface-2 text-ink-muted"}`,children:[e.jsx("span",{"aria-hidden":"true",className:"w-3 h-3 rounded-full border border-black/20",style:{background:be[s].dot}}),t(s==="silver"?"companion.veh.silver":`companion.form.${s}.name`)]},s)})})]})]})]})}),E&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":t("companion.pick.shimeji.title"),onClick:()=>_(!1),children:e.jsxs("div",{className:"relative w-full max-w-md max-h-[85dvh] flex flex-col rounded-2xl bg-surface-0 border border-[var(--border)] shadow-elevated p-4","data-testid":"shimeji-pack-list",onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"text-body font-medium text-ink-strong mb-3",children:t("companion.pick.shimeji.title")}),e.jsxs("div",{className:"min-h-0 overflow-y-auto",children:[d.length===0?e.jsx("p",{className:"text-label text-ink-muted py-4 text-center",children:t("companion.pick.empty.shimeji")}):e.jsx("div",{className:"flex flex-col gap-1.5",children:d.map(s=>e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button","data-testid":`shimeji-pack-option-${s.id}`,onClick:()=>{oe(s.id),_(!1)},className:`w-full flex items-center gap-2.5 rounded-xl border p-2 text-left motion-safe:transition-colors
18
- ${s.active&&l.form==="shimeji"?"border-[var(--accent)] bg-surface-2":"border-[var(--border-faint)] hover:bg-surface-2"}`,children:[s.iconBase64?e.jsx("img",{src:`data:image/png;base64,${s.iconBase64}`,alt:"",className:"w-10 h-10 rounded-lg object-contain bg-surface-2"}):e.jsx("span",{className:"w-10 h-10 rounded-lg bg-surface-2 inline-block"}),e.jsxs("span",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("span",{className:"text-body text-ink-strong truncate",children:s.name}),e.jsxs("span",{className:"text-caption text-ink-muted",children:[s.format," · ",s.frameCount,"f · ",s.actionCount]})]}),s.active&&l.form==="shimeji"&&e.jsx("span",{className:"text-caption text-brand font-medium",children:t("settings.shimeji.active")})]}),e.jsx("button",{type:"button","aria-label":t("companion.bots.veh"),"data-tooltip":t("companion.bots.veh"),"data-testid":`shimeji-pack-veh-${s.id}`,onClick:u=>{u.stopPropagation(),H(L=>L===s.id?null:s.id)},className:"absolute top-1.5 -left-1.5 w-5 h-5 rounded-full border border-black/25 shadow-card hover:scale-110 motion-safe:transition-transform",style:{background:be[s.vehicle??"silver"].dot}}),e.jsx("button",{type:"button","aria-label":t("settings.shimeji.delete"),onClick:u=>{u.stopPropagation(),se({id:s.id,rect:u.currentTarget.getBoundingClientRect()})},className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full flex items-center justify-center text-ink-faint hover:text-warning",children:e.jsx(ve,{className:"w-3.5 h-3.5"})})]},s.id))}),ae&&e.jsxs("div",{className:"mt-2.5 rounded-xl border border-[var(--border-faint)] bg-surface-0 p-2.5","data-testid":"shimeji-veh-picker",children:[e.jsx("div",{className:"text-caption text-ink-muted mb-1.5",children:t("companion.wizard.vehicle")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5",role:"radiogroup","aria-label":t("companion.wizard.vehicle"),children:["silver",...Te].map(s=>{var L;const u=(((L=d.find(Q=>Q.id===ae))==null?void 0:L.vehicle)??"silver")===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":u,"data-testid":`shimeji-veh-pick-${s}`,onClick:()=>void I(ae,s),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-label motion-safe:transition-colors
19
- ${u?"border-[var(--accent)] bg-surface-2 text-ink-strong font-medium":"border-[var(--border-faint)] hover:bg-surface-2 text-ink-muted"}`,children:[e.jsx("span",{"aria-hidden":"true",className:"w-3 h-3 rounded-full border border-black/20",style:{background:be[s].dot}}),t(s==="silver"?"companion.veh.silver":`companion.form.${s}.name`)]},s)})})]})]})]})}),q&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4","data-noswipe":"",role:"dialog","aria-modal":"true","aria-label":t("companion.create.title"),onClick:()=>V(!1),children:e.jsxs("div",{className:"relative w-full max-w-md rounded-2xl bg-surface-0 border border-[var(--border)] shadow-elevated p-4",onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"text-body font-medium text-ink-strong mb-3",children:t("companion.create.title")}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:[{key:"self",testid:"companion-create-self",name:t("companion.create.self.name"),hover:t("companion.create.self.hover"),open:()=>{V(!1),A(!0)}},{key:"shimeji",testid:"companion-create-shimeji",name:t("companion.create.shimeji.name"),hover:t("companion.create.shimeji.hover"),open:()=>{V(!1),G(!0)}}].map(s=>e.jsxs("button",{type:"button","data-testid":s.testid,onMouseEnter:()=>O(s.key),onMouseLeave:()=>O(u=>u===s.key?null:u),onFocus:()=>O(s.key),onBlur:()=>O(u=>u===s.key?null:u),onClick:s.open,className:`flex flex-col items-center gap-1.5 rounded-xl border p-4 motion-safe:transition-colors
20
- ${w===s.key?"border-[var(--accent)] bg-surface-2 shadow-card":"border-[var(--border-faint)] hover:bg-surface-2"}`,children:[e.jsx("span",{className:"text-body font-medium text-ink-strong",children:s.name}),e.jsx("span",{className:`text-caption text-ink-muted text-center leading-snug ${w===s.key?"":"opacity-0 h-0 overflow-hidden"} motion-safe:transition-all`,children:s.hover})]},s.key))}),e.jsx("p",{className:"text-caption text-ink-faint mt-3 text-center",children:t("companion.create.hint")})]})}),W&&e.jsx(St,{onClose:()=>G(!1),onImported:async()=>{await Y()}}),U&&e.jsx(_e,{anchorRect:U.rect,message:t("settings.shimeji.deleteConfirm",{name:((F=d.find(s=>s.id===U.id))==null?void 0:F.name)??""}),danger:!0,testid:"shimeji-delete-confirm",onConfirm:()=>void pe(U.id),onCancel:()=>se(null)}),y&&e.jsx(Nt,{onClose:()=>A(!1),onSaved:()=>{A(!1),D()}})]})]})]}):null}function he({checked:t,onChange:x,label:o,testid:b}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":o,onClick:x,"data-testid":b,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 Lt=[{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(女)"}],Rt=[{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 At(){const t=ce(),[x,o]=n.useState([]),[b,N]=n.useState(null),[l,c]=n.useState(null),[v,p]=n.useState(null),[g,S]=n.useState(null),[j,T]=n.useState("edge"),[$,h]=n.useState("zh-CN-XiaoxiaoNeural"),[f,z]=n.useState("48"),[y,A]=n.useState("1.0"),[R,M]=n.useState(""),[q,V]=n.useState(""),[B,m]=n.useState([]),E=typeof window<"u"&&"speechSynthesis"in window,[_,w]=n.useState("local"),[O,W]=n.useState("asr-whisper-turbo"),[G,d]=n.useState(!0),[X,U]=n.useState([]),[se,ae]=n.useState(!1),[H,le]=n.useState(!1),[me,D]=n.useState(!1),[Y,oe]=n.useState(!1),[I,pe]=n.useState(!1),[ne,i]=n.useState(null),[C,K]=n.useState(!1),[Z,F]=n.useState(null),[s,u]=n.useState(null),L=n.useCallback(()=>{r.listCustomProviders().then(a=>U(a.filter(k=>k.kind==="tts"||k.kind==="asr"))).catch(()=>{})},[]);n.useEffect(()=>{Promise.all([r.getSetting("tts_engine"),r.getSetting("tts_voice_edge"),r.getSetting("tts_sid_local"),r.getSetting("tts_speed"),r.getSetting("tts_custom_voice"),r.getSetting("tts_system_voice"),r.getSetting("asr_engine"),r.getSetting("asr_local_model"),r.getSetting("asr_auto_stop")]).then(([a,k,J,re,ye,Ve,Be,Ee,lt])=>{a&&T(a),k&&h(k),J&&z(J),re&&A(re),ye&&M(ye),Ve&&V(Ve),Be&&w(Be),(Ee==="asr-whisper-turbo"||Ee==="asr-whisper-small")&&W(Ee),d(lt!=="0")}),L()},[L]),n.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const a=()=>m(gt(window.speechSynthesis.getVoices()));return a(),window.speechSynthesis.addEventListener("voiceschanged",a),()=>window.speechSynthesis.removeEventListener("voiceschanged",a)},[]);const Q=n.useCallback(()=>{window.api.getSpeechModelStatus().then(a=>o(a)).catch(()=>{})},[]);n.useEffect(()=>(Q(),window.api.on("speech:modelProgress",k=>{p({id:k.id,pct:Math.floor(k.progress*100),label:k.currentFile?k.currentFile.split("/").pop()??"":""})})),[Q]);const Ge=a=>{c(null),N(a),p({id:a,pct:0,label:""}),window.api.ensureSpeechModel(a).then(()=>{N(null),p(null),Q()}).catch(k=>{N(null),p(null),c(k instanceof Error?k.message:String(k)),Q()})},Xe=a=>{N(a),S(null),window.api.deleteSpeechModel(a).then(Q).catch(k=>c(k instanceof Error?k.message:String(k))).finally(()=>N(null))},Ye=a=>t(a==="tts-kokoro"?"settings.speech.model.tts":a==="asr-whisper-turbo"?"settings.speech.model.asr_turbo":"settings.speech.model.asr_small"),Je=a=>t(a==="asr-whisper-turbo"?"settings.speech.model.turbo_short":"settings.speech.model.small_short"),Ze=a=>a.startsWith("asr-whisper")?t("settings.speech.license_mit"):t("settings.speech.license"),Re=a=>t(a==="ready"?"settings.speech.state.ready":a==="error"?"settings.speech.state.error":"settings.speech.state.absent"),Ae=a=>{var k;return((k=x.find(J=>J.id===a))==null?void 0:k.state)??"absent"},ge=a=>{T(a),i(null),r.setSetting("tts_engine",a),Se()},Qe=a=>{V(a),r.setSetting("tts_system_voice",a),Se()},we=a=>{w(a),F(null),r.setSetting("asr_engine",a)},ke=X.filter(a=>a.kind==="tts"),Ne=X.filter(a=>a.kind==="asr"),de=j.startsWith("custom-")?ke.find(a=>a.id===j)??null:null,ue=_.startsWith("custom-")?Ne.find(a=>a.id===_)??null:null,et=j==="azure",tt=_==="groq",st=_==="azure",at=async()=>{if(!(!de||I)){pe(!0),i(null);try{i(await r.testCustomTts({providerId:de.id}))}catch(a){i({ok:!1,detail:a instanceof Error?a.message:String(a)})}finally{pe(!1)}}},nt=async()=>{if(!(!ue||C)){K(!0),F(null);try{F(await r.testCustomAsr({providerId:ue.id}))}catch(a){F({ok:!1,detail:a instanceof Error?a.message:String(a)})}finally{K(!1)}}},it=async(a,k)=>{u(null);try{await r.deleteCustomProvider(a),k==="tts"&&j===a&&ge("edge"),k==="asr"&&_===a&&we("local"),L()}catch{}},Ie=a=>{const k=x.find(re=>re.id===a),J=(k==null?void 0:k.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:Ye(a)}),e.jsxs("div",{className:"text-caption text-ink-muted",children:[Re(J)," · ",Ze(a)]}),b===a&&(v==null?void 0:v.id)===a&&e.jsx("div",{className:"mt-1.5 h-1.5 rounded-full bg-ink/[0.08] overflow-hidden","data-testid":`speech-dl-bar-${a}`,children:e.jsx("div",{className:"h-full bg-brand transition-all",style:{width:`${v.pct}%`}})}),b===a&&(v==null?void 0:v.id)===a&&e.jsxs("div",{className:"text-caption text-ink-faint mt-0.5","data-testid":`speech-dl-pct-${a}`,children:[v.pct,"%",v.label?` · ${v.label}`:""]})]}),J==="ready"?g===a?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:()=>Xe(a),className:"text-label text-warning hover:underline","data-testid":`speech-del-confirm-${a}`,children:t("settings.speech.delete")}),e.jsx("button",{onClick:()=>S(null),className:"text-label text-ink-muted hover:text-ink-strong",children:t("action.cancel")})]}):e.jsx("button",{onClick:()=>S(a),disabled:b===a,className:"text-label text-ink-muted hover:text-warning disabled:opacity-40","data-testid":`speech-del-${a}`,children:t("settings.speech.delete")}):e.jsx("button",{onClick:()=>Ge(a),disabled:b!=null||J==="downloading",className:"btn-3d-brand px-3 py-1 text-label disabled:opacity-40","data-testid":`speech-dl-${a}`,children:t(b===a||J==="downloading"?"settings.speech.downloading":"settings.speech.download")})]},a)},Fe=(a,k,J,re,ye)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-label",children:[e.jsx(Le,{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:a.label}),e.jsx("code",{className:"text-ink-faint font-mono break-all",children:a.defaultModel}),e.jsx("span",{className:"text-ink-faint break-all min-w-0",children:a.baseUrl}),a.hasApiKey&&e.jsxs("span",{className:"text-brand shrink-0 inline-flex items-center gap-0.5",children:[e.jsx(xe,{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 ye(),disabled:J,className:"btn-3d-neutral px-3 py-1 text-label disabled:opacity-40","data-testid":`${k}-custom-test`,children:t(J?"settings.testing":"settings.test")}),s===a.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 it(a.id,k),className:"text-label text-warning hover:underline","data-testid":`${k}-custom-del-confirm`,children:t("settings.speech.delete")}),e.jsx("button",{onClick:()=>u(null),className:"text-label text-ink-muted hover:text-ink-strong",children:t("action.cancel")})]}):e.jsx("button",{onClick:()=>u(a.id),className:"text-label text-ink-muted hover:text-warning","data-testid":`${k}-custom-del`,children:t("settings.speech.delete")}),re&&e.jsxs("span",{className:`text-label inline-flex items-center gap-1 ${re.ok?"text-brand":"text-warning"}`,children:[re.ok?e.jsx(xe,{className:"w-4 h-4","aria-hidden":"true"}):e.jsx(je,{className:"w-4 h-4","aria-hidden":"true"}),re.detail]})]})]});return e.jsxs("div",{"data-testid":"settings-speech",children:[e.jsxs("div",{className:P(!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:()=>{ge("edge"),ae(!1),D(!1)},"data-testid":"tts-engine-edge","aria-pressed":j==="edge",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${j==="edge"?te:ee}`,children:t("settings.speech.engine.edge")}),e.jsxs("button",{onClick:()=>{ge("local"),ae(!1),D(!1)},"data-testid":"tts-engine-local","aria-pressed":j==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${j==="local"?te:ee}`,children:[t("settings.speech.engine.local"),Ae("tts-kokoro")!=="ready"?` · ${t("settings.speech.state.absent")}`:""]}),e.jsx("button",{onClick:()=>{ge("system"),ae(!1),D(!1)},disabled:!E,"data-testid":"tts-engine-system","aria-pressed":j==="system",title:E?void 0:t("settings.speech.engine.system_unavailable"),className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${j==="system"?te:ee} ${E?"":"opacity-40 cursor-not-allowed"}`,children:t("settings.speech.engine.system")}),e.jsx("button",{onClick:()=>{ae(a=>!a),se||D(!1)},"data-testid":"tts-engine-custom","aria-pressed":j.startsWith("custom-")||se,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${j.startsWith("custom-")||se?te:ee}`,children:t("settings.speech.engine.custom")}),et&&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")]})]}),j==="edge"&&e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.engine.edge_note")})]}),j==="edge"&&e.jsxs("div",{className:P(!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:$,onChange:a=>{h(a.target.value),r.setSetting("tts_voice_edge",a.target.value)},"data-testid":"tts-voice-select",className:`${ie} w-full min-w-0 px-2.5 py-1.5`,children:Lt.map(a=>e.jsx("option",{value:a.id,children:a.label},a.id))})]}),j==="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P(!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:f,onChange:a=>{z(a.target.value),r.setSetting("tts_sid_local",a.target.value)},"data-testid":"tts-sid-select",className:`${ie} w-full min-w-0 px-2.5 py-1.5`,children:Rt.map(a=>e.jsx("option",{value:a.sid,children:a.label},a.sid))})]}),e.jsx("div",{className:P(!1),children:Ie("tts-kokoro")})]}),j==="system"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:P(!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:q,onChange:a=>Qe(a.target.value),"data-testid":"tts-system-voice-select",className:`${ie} w-full min-w-0 px-2.5 py-1.5`,children:[e.jsx("option",{value:"",children:t("settings.speech.voice_auto")}),B.map(a=>e.jsx("option",{value:a.name,children:pt(a)},a.voiceURI))]}),e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.engine.system_note")})]})}),se&&e.jsx("div",{className:P(!1),children:e.jsxs("div",{className:"space-y-3",children:[de&&Fe(de,"tts",I,ne,at),de&&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:R,onChange:a=>M(a.target.value),onBlur:()=>void r.setSetting("tts_custom_voice",R.trim()),placeholder:t("settings.speech.custom_voice_ph"),"data-testid":"tts-custom-voice",className:`${ie} w-full min-w-0 px-2.5 py-1.5 font-mono`})]}),!de&&ke.map(a=>e.jsxs("button",{onClick:()=>ge(a.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-${a.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:a.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:a.defaultModel})]},a.id)),(me||!de&&ke.length===0)&&e.jsx($e,{kind:"tts",showProtocol:!1,testPrefix:"tts-custom",titleKey:"settings.custom.form_title_tts",modelPhKey:"settings.custom.model_ph_tts",testOverride:a=>r.testCustomTts({baseUrl:a.baseUrl,apiKey:a.apiKey||void 0,model:a.model}),onSaved:a=>{ge(a.id),D(!1),L()},onCancel:()=>D(!1)}),(de||ke.length>0)&&e.jsx("button",{onClick:()=>D(a=>!a),className:"text-label text-accent hover:underline",children:t(me?"action.cancel":"settings.custom.new")})]})}),e.jsx("div",{className:P(!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:y,onChange:a=>A(a.target.value),onPointerUp:()=>{r.setSetting("tts_speed",y),Se()},onKeyUp:()=>{r.setSetting("tts_speed",y),Se()},"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(y).toFixed(2),"x"]})]})}),e.jsxs("div",{className:P(!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:()=>{we("local"),le(!1),oe(!1)},"data-testid":"asr-engine-local","aria-pressed":_==="local",className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${_==="local"?te:ee}`,children:t("settings.speech.asr_engine.local")}),e.jsx("button",{onClick:()=>{le(a=>!a),H||oe(!1)},"data-testid":"asr-engine-custom","aria-pressed":_.startsWith("custom-")||H,className:`px-4 py-2 rounded-xl text-body font-bold transition-all ${_.startsWith("custom-")||H?te:ee}`,children:t("settings.speech.engine.custom")}),tt&&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")]}),st&&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")]})]}),_==="local"?e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.asr_engine.local_note")}):_.startsWith("custom-")&&e.jsx("p",{className:"text-label text-ink-muted mt-2",children:t("settings.speech.asr_engine.custom_note")})]}),_==="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P(!1),children:[e.jsx("div",{className:"text-label font-medium text-ink-strong mb-1.5",children:t("settings.model")}),e.jsx("select",{value:O,onChange:a=>{W(a.target.value),r.setSetting("asr_local_model",a.target.value)},"data-testid":"asr-model-select",className:`${ie} w-full min-w-0 px-2.5 py-1.5`,children:["asr-whisper-turbo","asr-whisper-small"].map(a=>e.jsxs("option",{value:a,children:[Je(a)," · ",Re(Ae(a))]},a))})]}),e.jsx("div",{className:P(!1),children:Ie(O)})]}),H&&e.jsx("div",{className:P(!1),children:e.jsxs("div",{className:"space-y-3",children:[ue&&Fe(ue,"asr",C,Z,nt),!ue&&Ne.map(a=>e.jsxs("button",{onClick:()=>we(a.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-${a.id}`,children:[e.jsx("span",{className:"text-label font-medium text-ink-strong",children:a.label}),e.jsx("span",{className:"text-label text-ink-faint font-mono break-all ml-2",children:a.defaultModel})]},a.id)),(Y||!ue&&Ne.length===0)&&e.jsx($e,{kind:"asr",showProtocol:!1,testPrefix:"asr-custom",titleKey:"settings.custom.form_title_asr",modelPhKey:"settings.custom.model_ph_asr",testOverride:a=>r.testCustomAsr({baseUrl:a.baseUrl,apiKey:a.apiKey||void 0,model:a.model}),onSaved:a=>{we(a.id),oe(!1),L()},onCancel:()=>oe(!1)}),(ue||Ne.length>0)&&e.jsx("button",{onClick:()=>oe(a=>!a),className:"text-label text-accent hover:underline",children:t(Y?"action.cancel":"settings.custom.new")})]})}),e.jsxs("div",{className:P(!0),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{checked:G,onChange:()=>{const a=!G;d(a),r.setSetting("asr_auto_stop",a?"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")})]}),l&&e.jsx("div",{className:"px-4 py-3 text-label text-warning break-all",role:"alert",children:l==="engine-unavailable"?t("chat.speech.engine_unavailable"):l})]})}function It(){const t=ce(),x=n.useRef(null),[o,b]=n.useState(null),[N,l]=n.useState(!1),[c,v]=n.useState(null);n.useEffect(()=>{r.dshImportDetect().then(b).catch(()=>b({found:!1,path:null,version:null}))},[]);const p=g=>{l(!0),v(null),g.then(v).catch(S=>v({ok:!1,error:String(S)})).finally(()=>l(!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")}),o==null?null:o.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:o.version??"?"})}),e.jsx("button",{onClick:()=>p(r.dshImportFromPath(o.path??"")),disabled:N,"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(N?"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:g=>{var j;const S=(j=g.target.files)==null?void 0:j[0];S&&(S.text().then(T=>p(r.dshImportFromText(T))),g.target.value="")}}),e.jsx("button",{onClick:()=>{var g;return(g=x.current)==null?void 0:g.click()},disabled:N,className:"px-3 py-1.5 rounded-xl text-label font-bold btn-3d-neutral disabled:opacity-50",children:t("settings.dsh.pickFile")})]}),N&&!c?e.jsx("div",{className:"text-label text-ink-muted",children:t("settings.dsh.importing")}):null,c!=null&&c.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:c.coursesCreated+c.coursesMapped+c.coursesRefreshed,nodes:c.nodes,progress:c.progressRows,srs:c.srsRows,xp:c.xpDelta}),c.skippedCourses.length>0?` · ${t("settings.dsh.skipped",{n:c.skippedCourses.length})}`:""]}):c?e.jsxs("div",{className:"text-label text-warning break-all",role:"alert","data-testid":"settings-dsh-error",children:[t("settings.dsh.failed"),": ",c.error??"unknown"]}):null]})}export{Bt as SettingsView};
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var f=(o,t,e)=>t in o?v(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var u=(o,t,e)=>f(o,typeof t!="symbol"?t+"":t,e);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",hasSetting:"settings:has",setSetting:"settings:set",profileGet:"profile:get",profileSet:"profile:set",bootGetState:"boot:getState",profileListProposals:"profile:listProposals",memoryListAll:"memory:listAll",memoryDeleteSlot:"memory:deleteSlot",companionPetSetClickThrough:"companionPet:setClickThrough",getUpdateInfo:"app:getUpdateInfo",dshImportDetect:"dsh:detect",dshImportFromPath:"dsh:importFromPath",dshImportFromText:"dsh:importFromText",companionPackCutFromImage:"companionPack:cutFromImage",companionPackApplyPack:"companionPack:applyPack",companionPackGetActive:"companionPack:getActive",companionPackList:"companionPack:list",companionPackActivate:"companionPack:activate",companionPackDelete:"companionPack:delete",shimejiImportZip:"shimeji:importZip",shimejiConfirmImport:"shimeji:confirmImport",shimejiList:"shimeji:list",shimejiGetActive:"shimeji:getActive",shimejiGetFrame:"shimeji:getFrame",shimejiActivate:"shimeji:activate",shimejiDelete:"shimeji:delete",shimejiSetVehicle:"shimeji:setVehicle",companionPackSetVehicle:"companionPack:setVehicle",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,p="ls-serve-token";function y(){const o=new URLSearchParams(window.location.search).get("token");if(o){try{window.localStorage.setItem(p,o)}catch{}return o}try{return window.localStorage.getItem(p)??""}catch{return""}}class g{constructor(){u(this,"ws",null);u(this,"everOpened",!1);u(this,"pending",new Map);u(this,"listeners",new Map);u(this,"connectPromise",null)}connect(){return this.ws&&this.ws.readyState===WebSocket.OPEN?Promise.resolve(this.ws):this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((t,e)=>{const c=window.location.protocol==="https:"?"wss:":"ws:",s=y(),i=`${c}//${window.location.host}/?token=${encodeURIComponent(s)}`;let n=!1;const l=new WebSocket(i);this.ws=l;const d=window.setTimeout(()=>{n||(n=!0,this.connectPromise=null,e(new Error("连接学习服务超时(serve 未启动?)")))},5e3);l.addEventListener("open",()=>{this.everOpened=!0,window.clearTimeout(d),n||(n=!0,this.connectPromise=null,t(l))}),l.addEventListener("message",m=>{let r=null;try{r=JSON.parse(String(m.data))}catch{return}if(!(!r||r.v!==h)){if(r.type==="res"){const a=this.pending.get(r.id);if(!a)return;this.pending.delete(r.id),window.clearTimeout(a.timer),r.ok?a.resolve(r.result):a.reject(new Error(r.error))}else if(r.type==="event"){const a=this.listeners.get(r.channel);if(a)for(const P of a)P(...r.args)}}}),l.addEventListener("close",m=>{if(this.connectPromise=null,this.ws===l&&(this.ws=null),!n){n=!0,window.clearTimeout(d),e(new Error(C(m)));return}const r=m.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"与服务端的连接已断开";for(const[,a]of this.pending)window.clearTimeout(a.timer),a.reject(new Error(r));if(m.code===4001&&(this.everOpened=!1),this.pending.clear(),m.code===4001){window.dispatchEvent(new CustomEvent(k));return}this.everOpened&&window.setTimeout(()=>void this.connect().catch(()=>{}),2e3)}),l.addEventListener("error",()=>{})}),this.connectPromise)}static bytesToB64(t){const e=new Uint8Array(t);let c="";const s=32768;for(let i=0;i<e.length;i+=s)c+=String.fromCharCode(...e.subarray(i,i+s));return btoa(c)}async invoke(t,...e){var i,n;const c=await this.connect(),s=((n=(i=globalThis.crypto)==null?void 0:i.randomUUID)==null?void 0:n.call(i))??String(Math.random()).slice(2);return new Promise((l,d)=>{const m=window.setTimeout(()=>{this.pending.delete(s),d(new Error(`调用 ${t} 超时`))},3e5);this.pending.set(s,{resolve:l,reject:d,timer:m});const r=t==="speech:asrTranscribe"&&e[0]instanceof ArrayBuffer?[g.bytesToB64(e[0]),...e.slice(1)]:e;c.send(JSON.stringify({v:h,type:"req",id:s,channel:t,args:r}))})}on(t,e){const c=t==="speech:ttsAudio"?(...i)=>{const n=i[0];if(n&&typeof n.wavBase64=="string"){const l=atob(n.wavBase64),d=new Uint8Array(l.length);for(let a=0;a<l.length;a++)d[a]=l.charCodeAt(a);const{wavBase64:m,...r}=n;e({...r,wavBytes:d.buffer})}else e(...i)}:e;let s=this.listeners.get(t);return s||(s=new Set,this.listeners.set(t,s)),s.add(c),this.connect().catch(()=>{}),()=>{s.delete(c)}}}function T(){if(typeof window>"u")return!1;if(new URLSearchParams(window.location.search).get("token"))return!0;try{return!!window.localStorage.getItem(p)}catch{return!1}}function b(o){let t=!0;try{window.localStorage.setItem(p,o)}catch{t=!1}const e=new URL(window.location.href);t?e.searchParams.delete("token"):e.searchParams.set("token",o),window.history.replaceState(null,"",e.toString())}const k="ls-web-token-rejected";function C(o){return o.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"无法连接学习服务(serve 未启动?)"}let w=!1;async function x(){if(w||window.api)return;w=!0;const o=new g,t={};for(const[e,c]of Object.entries(S))t[e]=(...s)=>o.invoke(c,...s);t.on=(e,c)=>o.on(e,c),window.api=t,window.__lookatstudyWeb=!0}function L(){return new g}export{k as TOKEN_REJECTED_EVENT,L as createWebTransportForTest,T as hasWebToken,x as installWebApi,b as setWebToken};
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-37_hzSNp.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as t,C as e}from"./chunk-X5GNSKZ3-16RMlpb5.js";import{_ as i}from"./render-O7CIS3YK-BUZqrLRp.js";import"./transform-Bd_a5eGM.js";import"./chunk-LV3HUYFY-Doco33ZI.js";import"./chunk-CXNFBKHE-CkmFhBAk.js";import"./chunk-NDIOYS4C-DcWvuy8G.js";import"./chunk-ISA7TJRJ-CHl4BhBt.js";import"./mermaid-layout-elk.core-B1-o2tyd.js";import"./main-jV_OilRs.js";import"./index-C9fscARj.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-Cz68TTKA.js";import{_ as i}from"./mermaid.core-37_hzSNp.js";import"./transform-Bd_a5eGM.js";import"./chunk-5VM5RSS4-nbGREPjw.js";import"./chunk-XXDRQBXY-DPkBKESf.js";import"./chunk-POPQ4Y6H-yjjWWA8X.js";import"./chunk-F27PBJKO-CAqAYmMM.js";import"./main-jV_OilRs.js";import"./index-C9fscARj.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as t,C as e}from"./chunk-X5GNSKZ3-16RMlpb5.js";import{_ as i}from"./render-O7CIS3YK-BUZqrLRp.js";import"./transform-Bd_a5eGM.js";import"./chunk-LV3HUYFY-Doco33ZI.js";import"./chunk-CXNFBKHE-CkmFhBAk.js";import"./chunk-NDIOYS4C-DcWvuy8G.js";import"./chunk-ISA7TJRJ-CHl4BhBt.js";import"./mermaid-layout-elk.core-B1-o2tyd.js";import"./main-jV_OilRs.js";import"./index-C9fscARj.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-Cz68TTKA.js";import{_ as i}from"./mermaid.core-37_hzSNp.js";import"./transform-Bd_a5eGM.js";import"./chunk-5VM5RSS4-nbGREPjw.js";import"./chunk-XXDRQBXY-DPkBKESf.js";import"./chunk-POPQ4Y6H-yjjWWA8X.js";import"./chunk-F27PBJKO-CAqAYmMM.js";import"./main-jV_OilRs.js";import"./index-C9fscARj.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1,14 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./elk.bundled-DuC4qO17.js","./index-C9fscARj.js","./index-EInfxfl9.css","./_commonjs-dynamic-modules-TDtrdbi3.js"])))=>i.map(i=>d[i]);
2
- import{r as g,j as e,c as Q}from"./index-C9fscARj.js";import{c as Z,_ as ee,u as R,Z as te,z as T,$ as se,a0 as ne,A as ae,k as re,j as ie,a1 as oe,q as D,X as G,a2 as ce,a3 as le,a4 as de,a5 as he}from"./main-jV_OilRs.js";import{D as H,M as ue}from"./MermaidArtifact-C-9JGr1S.js";import{M as K,C as B}from"./CanvasStage-By84li0a.js";import{R as xe}from"./rotate-ccw-DZE_kYZu.js";/**
3
- * @license lucide-react v0.468.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const fe=Z("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
8
- * @license lucide-react v0.468.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const me=Z("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);function z(s,t=13){let n=0;for(const a of s)n+=/[\u2e80-\u9fff\uf900-\ufaff\uff00-\uffef\u3000-\u303f]/.test(a)?t:t*.58;return n}const q=118;function ge(s){if(z(s)<=q)return[s];const t=[];for(let d=0;d<s.length;d++)/[\s/\-—·]/.test(s[d]??"")&&t.push(d);const n=s.length/2;let a=-1,r=1/0;for(const d of t){const f=Math.abs(d+1-n);f<r&&(r=f,a=d)}let i,c;if(a>=0)i=s.slice(0,a+1).trim(),c=s.slice(a+1).trim();else{let d=0,f=0;for(const b of s)if(d+=z(b),f++,d>=z(s)/2)break;i=s.slice(0,f),c=s.slice(f)}if(z(i)<=q&&z(c)<=q)return[i,c];const o=d=>{let f="";for(const b of d){if(z(f+b+"…")>q)break;f+=b}return f+"…"};return[z(i)>q?o(i):i,z(c)>q?o(c):c]}function J(s,t){const n=ge(s),a=t?14:13,r=Math.max(...n.map(d=>z(d,a))),i=t?30:24,c=17,o=t?18:14;return{width:Math.min(t?200:180,Math.max(t?92:76,r+i)),height:o+n.length*c,lines:n}}function pe(s,t,n){const a=new Set(s.map(r=>r.id));if(Array.isArray(n)&&n.length>0){const r=new Set,i=[];for(const c of n){if(!c||typeof c.id!="string"||!c.id)continue;const o=Array.isArray(c.nodeIds)?[...new Set(c.nodeIds.filter(d=>typeof d=="string"&&a.has(d)&&!r.has(d)))]:[];o.length<2||(o.forEach(d=>r.add(d)),i.push({id:c.id,label:typeof c.label=="string"&&c.label?c.label:"分组",nodeIds:o}))}if(i.length>0&&!(i.length===1&&r.size===s.length&&s.length>2))return{groups:i,fallback:!1}}return{groups:be(s,t),fallback:!0}}function be(s,t){if(s.length<4)return[];const n=new Map(s.map((h,l)=>[h.id,l])),a=new Map;for(const h of s)a.set(h.id,[]);const r=new Set;for(const h of t){if(!n.has(h.from)||!n.has(h.to)||h.from===h.to)continue;const l=[h.from,h.to].sort().join("→");r.has(l)||(r.add(l),a.get(h.from).push(h.to),a.get(h.to).push(h.from))}const i=[...s].sort((h,l)=>{const x=a.get(h.id).length,k=a.get(l.id).length;return x!==k?k-x:(n.get(h.id)??0)-(n.get(l.id)??0)}),c=Math.min(3,Math.max(1,Math.ceil(s.length/4))),o=i.slice(0,c).filter(h=>{var l;return(((l=a.get(h.id))==null?void 0:l.length)??0)>0});if(o.length===0)return[];const d=new Map;o.forEach((h,l)=>d.set(h.id,l));const f=o.map(h=>h.id);for(;f.length;){const h=f.shift(),l=d.get(h);for(const x of a.get(h)??[])d.has(x)||(d.set(x,l),f.push(x))}const b=[];return o.forEach((h,l)=>{const x=s.filter(k=>d.get(k.id)===l).map(k=>k.id);x.length<2||b.push({id:`grp-${h.id}`,label:h.label.length<=5?`${h.label}相关`:h.label,nodeIds:x})}),b}const O=34;function we(s,t,n){var h;const a=new Set(s.map(l=>l.id)),r=new Map;for(const l of s)r.set(l.id,0);const i=new Set,c=[];for(const l of t){if(!a.has(l.from)||!a.has(l.to)||l.from===l.to)continue;const x=[l.from,l.to].sort().join("→");i.has(x)||(i.add(x),c.push(l),r.set(l.from,r.get(l.from)+1),r.set(l.to,r.get(l.to)+1))}let o=((h=s[0])==null?void 0:h.id)??"";for(const l of s)(r.get(l.id)??0)>(r.get(o)??0)&&(o=l.id);const d=new Map;for(const l of n)for(const x of l.nodeIds)a.has(x)&&!d.has(x)&&d.set(x,l.id);const f=l=>{const x=J(l.label,l.id===o||(r.get(l.id)??0)>=4);return{id:l.id,width:Math.ceil(x.width),height:Math.ceil(x.height)}},b=[];for(const l of n){const x=l.nodeIds.filter(k=>d.get(k)===l.id&&a.has(k));x.length!==0&&b.push({id:`g:${l.id}`,layoutOptions:{"elk.padding":`[top=${O},left=14,bottom=12,right=14]`},children:x.map(k=>f(s.find(p=>p.id===k)))})}for(const l of s)d.has(l.id)||b.push(f(l));return{id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":"34","elk.spacing.edgeNode":"26","elk.spacing.componentComponent":"48","elk.layered.spacing.nodeNodeBetweenLayers":"56"},children:b,edges:c.map((l,x)=>({id:`e${x}`,sources:[l.from],targets:[l.to]}))}}function je(s){if(s.length===0)return{x:0,y:0};if(s.length===1)return s[0];const t=[];let n=0;for(let r=1;r<s.length;r++){const i=Math.hypot(s[r].x-s[r-1].x,s[r].y-s[r-1].y);t.push(i),n+=i}let a=n/2;for(let r=0;r<t.length;r++){if(a<=t[r]||r===t.length-1){const i=t[r]===0?0:a/t[r];return{x:s[r].x+(s[r+1].x-s[r].x)*i,y:s[r].y+(s[r+1].y-s[r].y)*i}}a-=t[r]}return s[s.length-1]}function ye(s,t,n,a,r,i){var y;const c=new Map(t.map(u=>[u.id,u])),o=new Map;a.forEach((u,m)=>o.set(u.id,m%5));const d=new Map(a.map(u=>[u.id,u])),f=new Map;for(const u of a)for(const m of u.nodeIds)f.has(m)||f.set(m,u.id);const b=[],h=[],l=[],x=new Map([["root",{x:0,y:0}]]),k=[],p=(u,m,v,S)=>{var M;for(const N of u.children??[]){const C=m+(N.x??0),$=v+(N.y??0);if((M=N.children)!=null&&M.length){const w=N.id.startsWith("g:")?N.id.slice(2):N.id,j=d.get(w);h.push({id:w,label:(j==null?void 0:j.label)??"分组",x:C,y:$,w:N.width??0,h:N.height??0,colorIdx:o.get(w)??0}),x.set(N.id,{x:C,y:$}),p(N,C,$,w)}else{const w=c.get(N.id);if(!w)continue;const j=J(w.label,w.id===i),E=f.get(w.id)??null;b.push({id:w.id,x:C,y:$,w:N.width??Math.ceil(j.width),h:N.height??Math.ceil(j.height),lines:j.lines,hub:w.id===i,groupId:S,colorIdx:E!=null?o.get(E)??0:-1})}}for(const N of u.edges??[])k.push({e:N,fallback:{x:m,y:v}})};p(s,0,0,null);for(const{e:u,fallback:m}of k){const v=(y=u.sections)==null?void 0:y[0];if(!v)continue;const S=(u.container!=null?x.get(u.container):void 0)??m,M=[v.startPoint,...v.bendPoints??[],v.endPoint].map($=>({x:$.x+S.x,y:$.y+S.y})),N=Number(u.id.slice(1)),C=n[N];C&&l.push({from:C.from,to:C.to,label:C.label,pts:M,labelPt:C.label?je(M):null})}return{width:Math.ceil(s.width??0),height:Math.ceil(s.height??0),nodes:b,groups:h,edges:l,hubId:i,groupsFallback:r}}let X=null;function ke(){return X??(X=ee(()=>import("./elk.bundled-DuC4qO17.js").then(s=>s.e),__vite__mapDeps([0,1,2,3]),import.meta.url).then(s=>{const t=s,n=t.default??t;return new n})),X}async function ve(s,t,n){const a=pe(s,t,n),r=we(s,t,a.groups),i=Ne(s,t),o=await(await ke()).layout(r);return ye(o,s,t,a.groups,a.fallback,i)}function Ne(s,t){var c;const n=new Set(s.map(o=>o.id)),a=new Map;for(const o of s)a.set(o.id,0);const r=new Set;for(const o of t){if(!n.has(o.from)||!n.has(o.to)||o.from===o.to)continue;const d=[o.from,o.to].sort().join("→");r.has(d)||(r.add(d),a.set(o.from,a.get(o.from)+1),a.set(o.to,a.get(o.to)+1))}let i=((c=s[0])==null?void 0:c.id)??"";for(const o of s)(a.get(o.id)??0)>(a.get(i)??0)&&(i=o.id);return i}const L=.4,W=2.5,_=.2;function Me(s){return s.map((t,n)=>`${n===0?"M":"L"} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`).join(" ")}function P({layout:s}){return e.jsxs("svg",{width:s.width,height:s.height,viewBox:`0 0 ${s.width} ${s.height}`,style:{display:"block"},"data-testid":"conceptmap-svg",children:[e.jsx("defs",{children:e.jsx("marker",{id:"cm-arrow",viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:6.5,markerHeight:6.5,orient:"auto-start-reverse",children:e.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-ink-faint"})})}),s.groups.map((t,n)=>e.jsxs("g",{className:"cm-enter",style:{animationDelay:`${n*60}ms`},children:[e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,rx:14,className:"cm-group-box",style:{fill:`var(--cm-c${t.colorIdx}-fill)`,stroke:`var(--cm-c${t.colorIdx}-line)`}}),e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:O,rx:14,className:"cm-group-head",style:{fill:`var(--cm-c${t.colorIdx}-line)`}}),e.jsx("rect",{x:t.x,y:t.y+O/2,width:t.w,height:O/2,className:"cm-group-head",style:{fill:`var(--cm-c${t.colorIdx}-line)`}}),e.jsx("text",{x:t.x+14,y:t.y+22,fontSize:12,fontWeight:600,fill:`var(--cm-c${t.colorIdx}-line)`,"data-testid":"conceptmap-group-label",children:t.label})]},`g-${t.id}`)),s.edges.map((t,n)=>{const a=t.label?{width:z(t.label,12)+16,height:19}:null;return e.jsxs("g",{className:"cm-enter",style:{animationDelay:`${(s.groups.length+1)*60+n*30}ms`},children:[e.jsx("path",{d:Me(t.pts),className:"fill-none stroke-ink-faint/80",strokeWidth:1.6,markerEnd:"url(#cm-arrow)"}),t.label&&a&&t.labelPt&&e.jsxs("g",{children:[e.jsx("rect",{x:t.labelPt.x-a.width/2,y:t.labelPt.y-a.height/2,width:a.width,height:a.height,rx:a.height/2,className:"fill-surface-0/95 stroke-[var(--border-faint)]",strokeWidth:1}),e.jsx("text",{x:t.labelPt.x,y:t.labelPt.y+3.5,textAnchor:"middle",fontSize:12,className:"fill-ink-muted font-medium",style:{paintOrder:"stroke"},stroke:"var(--surface-0)",strokeWidth:3,children:t.label})]})]},`e-${n}`)}),s.nodes.map((t,n)=>{const a=t.colorIdx>=0?`var(--cm-c${t.colorIdx}-fill)`:"var(--surface-3)",r=t.colorIdx>=0?`var(--cm-c${t.colorIdx}-line)`:"var(--border)",i=t.hub?14:13;return e.jsxs("g",{className:"cm-enter",style:{animationDelay:`${(s.groups.length+2)*60+n*35}ms`},children:[e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,rx:t.hub?12:10,fill:a,stroke:r,strokeWidth:t.hub?1.8:1.4}),t.lines.map((c,o)=>e.jsx("text",{x:t.x+t.w/2,y:t.y+t.h/2+(o-(t.lines.length-1)/2)*17+4.5,textAnchor:"middle",fontSize:i,className:t.hub?"fill-ink-strong font-bold":"fill-ink",children:c},o))]},t.id)})]})}function Se({data:s,variant:t="card"}){const n=s,a=R(),r=g.useMemo(()=>JSON.stringify({n:n.nodes,e:n.edges,g:n.groups??null}),[n.nodes,n.edges,n.groups]),[i,c]=g.useState(null);g.useEffect(()=>{let y=!0;return c(null),ve(n.nodes,n.edges,n.groups??null).then(u=>{y&&c(u)}).catch(()=>{}),()=>{y=!1}},[r]);const[o,d]=g.useState(1),[f,b]=g.useState(!1),h=g.useRef(null);g.useEffect(()=>{const y=h.current;if(!y||!i)return;const u=()=>{const v=(y.clientWidth-16)/i.width;v<1&&d(Math.max(L,+v.toFixed(2)))};u();const m=new ResizeObserver(u);return m.observe(y),()=>m.disconnect()},[i==null?void 0:i.width,i]);const l=g.useCallback(()=>d(y=>Math.min(W,+(y+_).toFixed(2))),[]),x=g.useCallback(()=>d(y=>Math.max(L,+(y-_).toFixed(2))),[]),k=g.useCallback(()=>d(1),[]),p=g.useCallback(y=>{if(!y.ctrlKey&&!y.metaKey)return;y.preventDefault();const u=y.deltaY>0?-_:_;d(m=>Math.min(W,Math.max(L,+(m+u).toFixed(2))))},[]);return t==="canvas"?e.jsx("div",{"data-testid":"conceptmap-canvas-content",children:i?e.jsx(P,{layout:i}):e.jsx("div",{style:{minWidth:320,minHeight:160}})}):e.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-concept-map",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(te,{className:"w-4 h-4 text-ink-muted shrink-0"}),e.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1","data-testid":"conceptmap-zoom-controls",children:[e.jsx("button",{onClick:x,disabled:o<=L,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:a("artifact.zoomOut"),children:"−"}),e.jsxs("button",{onClick:k,className:"px-1.5 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 text-caption font-bold tabular-nums",title:a("artifact.zoomReset"),children:[Math.round(o*100),"%"]}),e.jsx("button",{onClick:l,disabled:o>=W,className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 disabled:opacity-30 text-label font-bold flex items-center justify-center",title:a("artifact.zoomIn"),children:"+"})]}),e.jsx("button",{onClick:()=>b(!0),"data-testid":"conceptmap-expand","aria-label":a("artifact.viewer.open"),"data-tooltip":a("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center",children:e.jsx(K,{className:"w-3.5 h-3.5"})})]})]}),e.jsx("div",{ref:h,onClick:()=>b(!0),onWheel:p,className:"bg-surface-0/40 rounded-lg p-2 overflow-auto min-h-[160px] max-h-[500px] select-none",style:{touchAction:"pan-x pan-y"},"data-testid":"conceptmap-render-area","data-noswipe":"",children:i?e.jsx("div",{style:{width:i.width*o,height:i.height*o,margin:"0 auto"},children:e.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:i.width,height:i.height},children:e.jsx(P,{layout:i})})}):e.jsx("div",{className:"h-[152px] flex items-center justify-center text-caption text-ink-muted","data-testid":"conceptmap-loading",children:"…"})}),e.jsx("div",{className:"mt-1.5 flex items-center justify-between text-caption text-ink-muted",children:e.jsx("span",{children:a("artifact.conceptmap.stats",{nodes:n.nodes.length,edges:n.edges.length})})}),n.warnings&&n.warnings.length>0&&e.jsxs("div",{className:"mt-1 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[e.jsx(T,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:n.warnings.join("; ")})]}),f&&e.jsx(H,{title:n.title,onClose:()=>b(!1),children:e.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:e.jsx(B,{testid:"conceptmap-modal-stage",children:i?e.jsx(P,{layout:i}):e.jsx("div",{className:"min-w-[320px] min-h-[160px]"})})})})]})}function Ce(s,t){const{correct:n,total:a}=s,r=a>0&&n===a,i=a>0&&n<a,c=t!=null&&t>=se,o=t!=null&&t>=ne;return i?[{id:"explain-wrong"},{id:"retry"}]:r&&c?[{id:"next-topic"},{id:"go-deeper"}]:r&&o?[{id:"mark-mastered",advancesMastery:!0},{id:"next-topic"},{id:"go-deeper"}]:[{id:"go-deeper"},{id:"retry"}]}const ze="ls-quiz-progress:";function $e(s){const t=s.questions.map(a=>`${a.prompt}|${(a.options??[]).join("/")}#${a.answer??""}`).join(`
13
- `);let n=2166136261;for(let a=0;a<t.length;a++)n^=t.charCodeAt(a),n=Math.imul(n,16777619);return`${ze}${(n>>>0).toString(36)}`}function Ee(s){var t,n;try{const a=localStorage.getItem(s);if(!a)return null;const r=JSON.parse(a);return typeof(r==null?void 0:r.current)=="number"&&r.current>=0&&typeof((t=r==null?void 0:r.score)==null?void 0:t.correct)=="number"&&typeof((n=r==null?void 0:r.score)==null?void 0:n.total)=="number"?r:null}catch{return null}}function Ie(s,t){try{localStorage.setItem(s,JSON.stringify(t))}catch{}}const qe={"explain-wrong":{icon:fe,labelKey:"quiz.action.explainWrong",message:"我刚才有题答错了,帮我讲讲为什么错、正确的思路是什么。"},retry:{icon:xe,labelKey:"quiz.action.retry",message:"再来一组类似的题巩固一下。"},"go-deeper":{icon:ie,labelKey:"quiz.action.goDeeper",message:"这组我答得不错,帮我深入讲讲背后的原理和容易混淆的地方。"},"mark-mastered":{icon:re,labelKey:"quiz.action.markMastered",message:"这课我觉得掌握了,帮我确认一下——出个综合题检验,通过了就标记为掌握。"},"next-topic":{icon:ae,labelKey:"quiz.action.nextTopic",message:"进入下一个知识点。"}};function Re({data:s,onAnswered:t,quizMastery:n,onPickAction:a,onQuizCompleted:r}){const i=s,c=R(),o=g.useMemo(()=>$e(i),[i]),d=g.useMemo(()=>Ee(o),[o]),[f,b]=g.useState((d==null?void 0:d.current)??0),[h,l]=g.useState(null),[x,k]=g.useState(!1),[p,y]=g.useState((d==null?void 0:d.score)??{correct:0,total:0}),u=g.useRef([]),m=g.useRef(null);g.useEffect(()=>{Ie(o,{current:f,score:p})},[o,f,p]);const[v,S]=g.useState(!1);if(f>=i.questions.length){const w=!!a&&!r;if(r)return e.jsxs("div",{className:"surface-card p-4 text-center","data-testid":"artifact-quiz-done",children:[e.jsx("div",{className:"text-2xl mb-2",children:p.correct===p.total?"🎉":"📚"}),e.jsx("div",{className:"text-body font-bold text-ink",children:c("quiz.scoreSummary",{correct:p.correct,total:p.total})}),v?e.jsx("div",{className:"text-label text-ink-muted mt-1","data-testid":"quiz-hook-sent",children:c("quiz.hook.sent")}):e.jsx("button",{onClick:()=>{S(!0),r({title:i.title??"",correct:p.correct,total:p.total,detail:[...u.current]})},"data-testid":"quiz-hook-finish",className:"btn-3d-brand mt-3 px-5 py-2 text-body",children:c("quiz.hook.finish")})]});const j=w?Ce(p,n??null):[];return e.jsxs("div",{className:"surface-card p-4 text-center","data-testid":"artifact-quiz-done",children:[e.jsx("div",{className:"text-2xl mb-2",children:p.correct===p.total?"🎉":"📚"}),e.jsx("div",{className:"text-body font-bold text-ink",children:c("quiz.scoreSummary",{correct:p.correct,total:p.total})}),e.jsx("div",{className:"text-label text-ink-muted mt-1",children:p.correct===p.total?c("quiz.allCorrectHint"):c("quiz.tryAgainHint")}),j.length>0&&e.jsxs("div",{className:"mt-3 space-y-2 text-left","data-testid":"quiz-next-actions",children:[e.jsx("div",{className:"text-label text-ink-muted",children:c("quiz.action.nextPrompt")}),j.map((E,A)=>{const I=qe[E.id],Y=I.icon;return e.jsxs("button",{onClick:()=>a==null?void 0:a(I.message),"data-testid":`quiz-action-${E.id}`,className:`${A===0?"btn-3d-brand":"btn-3d-neutral"} w-full py-2 text-body flex items-center justify-center gap-1.5`,children:[e.jsx(Y,{className:"w-4 h-4"}),c(I.labelKey)]},E.id)})]})]})}const M=i.questions[f],N=x&&h===M.answer,C=()=>{if(h===null)return;k(!0);const w=h===M.answer;y(j=>({correct:j.correct+(w?1:0),total:j.total+1})),t==null||t(M,h,w),u.current.push({prompt:M.prompt,chosen:M.options[h]??"?",answerText:M.options[M.answer]??"?",correct:w}),Q(w?"correct":"wrong",{origin:w&&m.current?(()=>{const j=m.current.getBoundingClientRect();return{x:j.right-48,y:j.top+24}})():void 0})},$=()=>{f===i.questions.length-1&&r&&!v&&(S(!0),r({title:i.title??"",correct:p.correct,total:p.total,detail:[...u.current]})),b(w=>w+1),l(null),k(!1)};return e.jsxs("div",{ref:m,className:"surface-card p-4","data-testid":"artifact-quiz",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4 text-brand"}),e.jsx("span",{className:"text-label font-bold text-brand",children:c("quiz.questionProgress",{cur:f+1,total:i.questions.length})})]}),e.jsx("span",{className:"text-label text-ink-muted",children:c("quiz.answeredCorrect",{n:p.correct})})]}),e.jsx("div",{className:"text-body text-ink font-medium mb-3 leading-relaxed",children:M.prompt}),e.jsx("div",{className:"space-y-2 mb-3",children:M.options.map((w,j)=>{const E=h===j,A=x&&j===M.answer,I=x&&E&&!A;return e.jsxs("button",{onClick:()=>!x&&l(j),disabled:x,"data-testid":`quiz-option-${j}`,className:`w-full text-left text-body p-2.5 rounded-lg border-2 font-medium transition-colors ${A?"border-brand bg-brand/10 text-brand animate-answer-correct":I?"border-warning bg-warning/10 text-warning animate-answer-wrong":E?"border-accent bg-accent/10 text-accent":"border-[var(--border)] text-ink-muted hover:border-[var(--border)]"} ${x?"cursor-default":"cursor-pointer"}`,children:[e.jsx("span",{className:"font-bold mr-2",children:String.fromCharCode(65+j)}),w,A&&e.jsx("span",{className:"float-right",children:e.jsx(D,{className:"w-4 h-4 inline-block"})}),I&&e.jsx("span",{className:"float-right",children:e.jsx(G,{className:"w-4 h-4 inline-block"})})]},j)})}),x&&e.jsxs("div",{className:`rounded-lg p-3 mb-3 text-body leading-relaxed animate-artifact-render ${N?"bg-brand/10 border border-brand/30 text-brand":"bg-warning/10 border border-warning/30 text-warning"}`,"data-testid":"quiz-explanation",children:[e.jsxs("div",{className:"font-bold mb-1 flex items-center gap-1.5",children:[N?e.jsx(D,{className:"w-4 h-4"}):e.jsx(G,{className:"w-4 h-4"}),e.jsx("span",{children:c(N?"quiz.correct":"quiz.wrong")})]}),e.jsx("div",{className:"text-ink-muted",children:M.explanation})]}),x?e.jsx("button",{onClick:$,"data-testid":"quiz-next",className:"btn-3d-brand w-full py-2 text-body",children:f+1<i.questions.length?c("exercise.next"):c("quiz.finish")}):e.jsx("button",{onClick:C,disabled:h===null,"data-testid":"quiz-submit",className:"btn-3d-brand w-full py-2 text-body disabled:opacity-40",children:c("exercise.submit")}),i.warnings&&i.warnings.length>0&&e.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[e.jsx(T,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:i.warnings.join("; ")})]})]})}function U({data:s,variant:t="card"}){const n=s,a=R(),[r,i]=g.useState(!1),c=e.jsxs("table",{className:"text-body",style:{width:"max-content",minWidth:"100%"},children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-surface-3/60",children:n.headers.map((o,d)=>e.jsx("th",{className:`px-3 py-2.5 text-left font-bold border-b border-[var(--border)] ${d===0?"text-ink-strong":"text-ink"}`,children:o},d))})}),e.jsx("tbody",{children:n.rows.map((o,d)=>e.jsx("tr",{className:d%2===0?"bg-surface-0/40":"",children:o.map((f,b)=>e.jsx("td",{className:`px-3 py-2.5 border-b border-[var(--border-faint)] align-top leading-relaxed ${b===0?"font-bold text-ink-strong whitespace-nowrap bg-surface-1/40":"text-ink-muted"}`,style:b===0?void 0:{maxWidth:260,overflowWrap:"anywhere"},children:f},b))},d))})]});return t==="canvas"?e.jsx("div",{className:"w-fit","data-testid":"comparetable-canvas-content",children:c}):e.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-compare-table",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(ce,{className:"w-4 h-4 text-ink-muted shrink-0"}),e.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title})]}),e.jsx("button",{onClick:()=>i(!0),"data-testid":"comparetable-expand","aria-label":a("artifact.viewer.open"),"data-tooltip":a("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center shrink-0",children:e.jsx(K,{className:"w-3.5 h-3.5"})})]}),e.jsx("div",{className:"overflow-x-auto rounded-lg border border-[var(--border-faint)]",onClick:()=>i(!0),style:{touchAction:"pan-x pan-y"},"data-noswipe":"",children:c}),n.warnings&&n.warnings.length>0&&e.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[e.jsx(T,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:n.warnings.join("; ")})]}),r&&e.jsx(H,{title:n.title,onClose:()=>i(!1),children:e.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:e.jsx(B,{testid:"comparetable-modal-stage",children:e.jsx("div",{className:"p-2 surface-card",children:e.jsx(U,{data:s,variant:"canvas"})})})})})]})}function V({data:s,variant:t="card"}){const n=s,a=R(),[r,i]=g.useState(null),[c,o]=g.useState(!1),d=g.useRef([]),f=g.useRef([]),b=n.code.split(`
14
- `),[h,l]=g.useState(null);g.useEffect(()=>{let u=!0;return le(n.code,n.language).then(m=>{u&&m&&l(m)}),()=>{u=!1}},[n.code,n.language]);const x=u=>{if(r===null)return!1;const m=n.annotations[r];return m&&u>=m.lineStart&&u<=m.lineEnd},k=u=>{const m=r===u?null:u;if(i(m),m!==null){const v=n.annotations[m],S=(c?f:d).current[v.lineStart-1];S==null||S.scrollIntoView({behavior:"smooth",block:"center"})}},p=u=>e.jsx("div",{className:"bg-neutral-950 rounded-lg overflow-hidden border border-neutral-800 max-h-[420px] overflow-y-auto",children:e.jsx("pre",{className:"text-label font-mono leading-relaxed overflow-x-auto",children:e.jsx("code",{children:b.map((m,v)=>{const S=v+1;return e.jsxs("div",{ref:M=>{u.current[v]=M},className:`flex ${x(S)?"bg-brand/15":""}`,children:[e.jsx("span",{className:"select-none text-neutral-600 pr-3 pl-3 text-right w-10 shrink-0 border-r border-neutral-800 tabular-nums",children:S}),h&&h[v]!=null?e.jsx("span",{className:"pl-3 whitespace-pre text-neutral-200","data-testid":"walk-shiki-line",dangerouslySetInnerHTML:{__html:h[v]||" "}}):e.jsx("span",{className:"text-neutral-200 pl-3 whitespace-pre",children:m||" "})]},v)})})})}),y=e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-caption font-bold text-ink-muted",children:a("artifact.codewalk.sectionLabel")}),n.annotations.map((u,m)=>e.jsxs("button",{onClick:()=>k(m),"data-testid":`annotation-${m}`,className:`w-full text-left p-2.5 rounded-lg border transition-colors ${r===m?"border-brand bg-brand/10":"border-[var(--border-faint)] hover:border-[var(--border)]"}`,children:[e.jsx("div",{className:"text-caption font-bold text-brand mb-0.5",children:u.lineEnd!==u.lineStart?a("artifact.codewalk.lineRange",{a:u.lineStart,b:u.lineEnd}):a("artifact.codewalk.lineSingle",{n:u.lineStart})}),e.jsx("div",{className:"text-body text-ink-muted leading-relaxed",children:u.note})]},m))]});return t==="canvas"?e.jsx("div",{className:"w-fit","data-testid":"codewalk-canvas-content",children:p(f)}):e.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-code-walkthrough",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{className:"w-4 h-4 text-ink-muted shrink-0"}),e.jsx("h3",{className:"text-body font-bold text-ink truncate",children:n.title}),e.jsx("span",{className:"text-caption font-bold px-1.5 py-0.5 rounded bg-surface-3 text-ink-muted font-mono shrink-0",children:n.language})]}),e.jsx("button",{onClick:()=>o(!0),"data-testid":"codewalk-expand","aria-label":a("artifact.viewer.open"),"data-tooltip":a("artifact.viewer.open"),className:"w-6 h-6 rounded border border-[var(--border)] text-ink-muted hover:bg-surface-3 flex items-center justify-center shrink-0",children:e.jsx(K,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[e.jsx("div",{onClick:()=>{c||o(!0)},style:{touchAction:"pan-x pan-y"},"data-noswipe":"",children:p(d)}),y]}),n.warnings&&n.warnings.length>0&&e.jsxs("div",{className:"mt-2 text-caption text-warning flex items-start gap-1","data-testid":"artifact-warnings",children:[e.jsx(T,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:n.warnings.join("; ")})]}),c&&e.jsx(H,{title:n.title,onClose:()=>o(!1),children:e.jsx("div",{className:"h-full w-full rounded-xl overflow-hidden bg-surface-0/60",children:e.jsx(B,{testid:"codewalk-modal-stage",children:e.jsx(V,{data:s,variant:"canvas"})})})})]})}function Ae({data:s,onPickAction:t}){const n=s,a=R(),[r,i]=g.useState(null),c=o=>{r||(i(o.id),t==null||t(`${a("guess.pickedPrefix")}${o.label}`))};return e.jsxs("div",{className:"surface-card p-4","data-testid":"artifact-guess",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(me,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-label font-bold text-accent",children:a("guess.header")})]}),e.jsx("div",{className:"text-body text-ink font-medium mb-3 leading-relaxed",children:n.prompt}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mb-2",children:n.options.map(o=>{const d=r===o.id,f=r!==null;return e.jsxs("button",{onClick:()=>c(o),disabled:f,"data-testid":`guess-option-${o.id}`,className:`text-body p-2.5 rounded-lg border-2 font-medium transition-colors text-left flex items-center justify-between gap-2 ${d?"border-accent bg-accent/10 text-accent":f?"border-[var(--border-faint)] text-ink-faint cursor-default":"border-[var(--border)] text-ink-muted hover:border-accent hover:text-accent cursor-pointer"}`,children:[e.jsx("span",{children:o.label}),d&&e.jsx(D,{className:"w-4 h-4 shrink-0"})]},o.id)})}),r&&e.jsx("div",{className:"text-label text-ink-muted mt-1","data-testid":"guess-picked-hint",children:a("guess.waitReveal")}),n.warnings&&n.warnings.length>0&&e.jsx("div",{className:"mt-2 text-caption text-warning","data-testid":"artifact-warnings",children:n.warnings.join("; ")})]})}function Pe({data:s,onQuizAnswered:t,quizMastery:n,onPickAction:a,onQuizCompleted:r,variant:i="card"}){const c=s;if(!c||!c.artifactType)return e.jsx(F,{data:s});switch(c.artifactType){case"concept_map":return e.jsx(Se,{data:s,variant:i});case"quiz":return e.jsx(Re,{data:s,onAnswered:t,quizMastery:n,onPickAction:a,onQuizCompleted:r});case"compare_table":return e.jsx(U,{data:s,variant:i});case"diagram":return e.jsx(ue,{data:s,variant:i});case"code_walkthrough":return e.jsx(V,{data:s,variant:i});case"guess":return e.jsx(Ae,{data:s,onPickAction:a});default:return e.jsx(F,{data:s})}}function F({data:s}){var n;const t=R();return e.jsxs("div",{className:"surface-card p-4 text-body text-ink-muted","data-testid":"artifact-unknown",children:[e.jsxs("div",{className:"font-bold mb-1 flex items-center gap-1.5",children:[e.jsx(he,{className:"w-4 h-4"}),t("artifact.unknownHeader")]}),e.jsx("pre",{className:"text-caption overflow-x-auto text-ink-muted",children:(n=JSON.stringify(s,null,2))==null?void 0:n.slice(0,200)})]})}export{Pe as ArtifactRenderer,V as CodeWalkthroughArtifact,U as CompareTableArtifact,Se as ConceptMapArtifact,Ae as GuessArtifact,ue as MermaidArtifact,Re as QuizArtifact};