lookatstudy-mobile 0.37.2 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/model-catalog.json +9025 -0
- package/package.json +1 -1
- package/server.cjs +1075 -564
- package/web/assets/{CanvasStage-By84li0a.js → CanvasStage-vallbGco.js} +1 -1
- package/web/assets/{CommandPalette-DJpv5YLk.js → CommandPalette-Kyu6mhyt.js} +1 -1
- package/web/assets/{CompanionBotLab-BrjON5X5.js → CompanionBotLab-DHmGbQJd.js} +1 -1
- package/web/assets/{CourseSearchPanel-Dp-83TJq.js → CourseSearchPanel-CrpFIaU8.js} +2 -2
- package/web/assets/{ExamView-BiWyQCTQ.js → ExamView-BBwDRS1g.js} +1 -1
- package/web/assets/{MermaidArtifact-C-9JGr1S.js → MermaidArtifact-x5kLLb52.js} +3 -3
- package/web/assets/ModelManagerModal-CHz1i5v2.js +6 -0
- package/web/assets/{PersonalProfileModal-Bberh-21.js → PersonalProfileModal-DJdHOMH9.js} +2 -2
- package/web/assets/{ReviewPanel-D52vKY80.js → ReviewPanel-BJhoJAOK.js} +1 -1
- package/web/assets/SettingsView-COw_GSOo.js +15 -0
- package/web/assets/Toggle-Bkokw_WS.js +1 -0
- package/web/assets/{VoicePanel-Df6DgExP.js → VoicePanel-DPrlBZ48.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-xWn5W_Em.js → abnfDiagram-VCTEODGH-DXAHXtdM.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-GEEhu7or.js → abnfDiagram-VCTEODGH-ODA7YWAP-BdHlSP1w.js} +1 -1
- package/web/assets/api-web-BhgWWd1h.js +1 -0
- package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-JmOGh5LH.js → architectureDiagram-5GKGNRK7-C4PU3XN7-B4RCVI81.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-CvI35bTW.js → architectureDiagram-5GKGNRK7-DViQRgRS.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-BMKUeuF0.js → blockDiagram-I7D4REHJ-Bm4Jv7XO.js} +1 -1
- package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-Dv4-Yiui.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-dOUZFc-F.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-DNalANVV.js → c4Diagram-7LVT6UL2-Cn_bbm4P.js} +1 -1
- package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-BMz228D6.js → c4Diagram-UCG6FXSJ-75X3U2P3-DgytixUD.js} +1 -1
- package/web/assets/channel-D_-re5YU.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-M3FYrmxX.js → chunk-2Q5K7J3B-hNQuZg4_.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-nbGREPjw.js → chunk-5VM5RSS4-DwAMOseZ.js} +1 -1
- package/web/assets/{chunk-7XDTSPCN-rYhyRTOx.js → chunk-7XDTSPCN-COFFwjaS.js} +1 -1
- package/web/assets/{chunk-CTNIYPP6-BgXYMFW5.js → chunk-CTNIYPP6-B3zyRQW8.js} +1 -1
- package/web/assets/{chunk-CXNFBKHE-CkmFhBAk.js → chunk-CXNFBKHE-C91q6lvg.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-CAqAYmMM.js → chunk-F27PBJKO-ia4EagnF.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-pDBbu4GI.js → chunk-IMKFNOWR-vd22BhM5.js} +1 -1
- package/web/assets/{chunk-ISA7TJRJ-CHl4BhBt.js → chunk-ISA7TJRJ-BReqmCMw.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-DSVI_4gB.js → chunk-JWPE2WC7-Cjsal04r.js} +1 -1
- package/web/assets/{chunk-LV3HUYFY-Doco33ZI.js → chunk-LV3HUYFY-D2A9VNi8.js} +1 -1
- package/web/assets/{chunk-M3IUQBOH-RTAJkyza.js → chunk-M3IUQBOH-DZWUYlu1.js} +1 -1
- package/web/assets/{chunk-NDIOYS4C-DcWvuy8G.js → chunk-NDIOYS4C-Cg_gB3IQ.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-yjjWWA8X.js → chunk-POPQ4Y6H-CpFBYm4R.js} +1 -1
- package/web/assets/{chunk-RE4WF27V-C32wZGPA.js → chunk-RE4WF27V-DJhALSJZ.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BdekvWAw.js → chunk-SVP7TREG-CLk3nYlu.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-Cz68TTKA.js → chunk-TICWLB2K-CAAm7rEI.js} +1 -1
- package/web/assets/{chunk-VII2H2IX-fTD7U-xL.js → chunk-VII2H2IX-D9ZFtXPz.js} +1 -1
- package/web/assets/{chunk-X5GNSKZ3-16RMlpb5.js → chunk-X5GNSKZ3-BRpQXOuk.js} +1 -1
- package/web/assets/{chunk-XCWWM2C3-CO-wuQPY.js → chunk-XCWWM2C3-CGZOunzF.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DPkBKESf.js → chunk-XXDRQBXY-IwMJhHxA.js} +1 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-DsXVuA3q.js +1 -0
- package/web/assets/classDiagram-ZZMXUADV-mIT3v2vU.js +1 -0
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-DsXVuA3q.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-mIT3v2vU.js +1 -0
- package/web/assets/{core-CQhot3Yw.js → core-KfkXlXB0.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-NQkKxkmm.js → cose-bilkent-JH36ORCC-CvvDvDJy.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-71WGRXpy.js → cose-bilkent-JH36ORCC-OB24KH3T-C0vuvt-a.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-Ycd8yaFB.js → cynefin-OW5HDTMX-BnU7sKRp.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-wLMpc-W6.js → cynefin-OW5HDTMX-GVF3BKWE-C0Fp61PQ.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-qdatKGJp.js → cynefinDiagram-5FMLGOSQ-Ci7ijXRa.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-BqUnto1I.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-BG1dQkD8.js} +1 -1
- package/web/assets/{dagre-3AP2YEHR-DCERTXHT-DU7hl9mL.js → dagre-3AP2YEHR-DCERTXHT-SRdJ45ZG.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-DXBvPLCC.js → dagre-GXQ25YYZ-a6zLLMCL.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-CJndlA9d.js → diagram-S7CK7UJ4-DwGQoHs5.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-ChZOJtIr.js → diagram-S7CK7UJ4-MULGZGEL-DFbcMEGe.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-ByEgUbMO.js → diagram-UQ7AKVKN-DObuhRvP.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-YQBY353J-CBg1xAIv.js → diagram-UQ7AKVKN-YQBY353J-f7iJnEEP.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-DG9QiDXM.js → diagram-VSXAHHWV-Ctso7LL9.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-BmmwN3nm.js → diagram-VSXAHHWV-WLNH2ELY-DwsW9ccQ.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-D5I8_1IH.js → diagram-VX7I27RA-B1-W9xu6.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-XW6YQV5G-BpJ1XA39.js → diagram-VX7I27RA-XW6YQV5G-DckTcRvE.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-BgBYUzLO.js → diagram-Z3DM3KII-CvmndeRP.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-HG7RF65D-DvYaKe9o.js → diagram-Z3DM3KII-HG7RF65D-Cg1XNNOC.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-BvljgvDM.js → ebnfDiagram-PWID7BFC-Cs9GSL14.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-Cnq_rs5C.js → ebnfDiagram-PWID7BFC-OKY4VHYD-C0q6BGVW.js} +1 -1
- package/web/assets/{elk.bundled-DuC4qO17.js → elk.bundled-Cez1bZui.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-CuGCxm27.js → erDiagram-RLTQ6QDP-CvYV5Bmu.js} +1 -1
- package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-DWea4HYD.js → erDiagram-SSCWMZ5O-PIPKOIK7-Di0McTkf.js} +1 -1
- package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-Bt5oLSB0.js → flowDiagram-A5DVABFB-2Z4AVO5R-C_7fHJVS.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-ChwXi3ep.js → flowDiagram-HODETNUW-CEwpjqJR.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-Cip61aQW.js → ganttDiagram-EL5Y4UJY-Bjj2P85p.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-DIt3-EPi.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-BWxHKrFA.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-CsyX4tkZ.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-D4hn_rGb.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-BGE_KKwm.js → gitGraphDiagram-WWUBYQGX-DhH7fsJW.js} +1 -1
- package/web/assets/index-CS4Wtfwl.css +1 -0
- package/web/assets/{index-D3SI1A7X.js → index-DcWGv1Ix.js} +2 -2
- package/web/assets/{index-48coRDBX.js → index-eHVYJyBS.js} +4 -4
- package/web/assets/{index-CatQea2M.js → index-nwyPdk23.js} +1 -1
- package/web/assets/{infoDiagram-27XIBGKW-CHFCryER.js → infoDiagram-27XIBGKW-DDm2aahL.js} +1 -1
- package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-ocLW6L6_.js → infoDiagram-RXCK75RN-HANS5KVC-CwBcehVD.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-BUo_yhnm.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-CBAcnlnt.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-Bhg1TVZJ.js → ishikawaDiagram-5VMMS53U-BViel9G3.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-C3OfUgiV.js → journeyDiagram-3NMN7TZE-CO3lCO75.js} +1 -1
- package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-DQESZnLZ.js → journeyDiagram-EYS64GPL-OAPELBT7-sBJrBBzK.js} +1 -1
- package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-BF-ZXqR5.js → kanban-definition-3QL26DDD-I7RKWQQY-hit6oZsH.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-CSI_GcJW.js → kanban-definition-UXKFOSKX-CKgCw87L.js} +1 -1
- package/web/assets/{katex-N6JRN4PM-CxrguQd-.js → katex-N6JRN4PM-D81co42V.js} +1 -1
- package/web/assets/{layout-CDbDCQeb.js → layout-Gnf9u57J.js} +1 -1
- package/web/assets/{main-jV_OilRs.js → main-C7vIrKEC.js} +120 -120
- package/web/assets/{mermaid-layout-elk.core-B1-o2tyd.js → mermaid-layout-elk.core-DfOj66Qv.js} +2 -2
- package/web/assets/{mermaid.core-37_hzSNp.js → mermaid.core-B8uFE6gu.js} +5 -5
- package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-rppk7mo-.js → mindmap-definition-FBJOCRG2-KIYZG64Y-DdU7WsWK.js} +1 -1
- package/web/assets/{mindmap-definition-YA3MSWOX-BUzaoDCs.js → mindmap-definition-YA3MSWOX-Dlr3j6bz.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-CQPL5MMj.js → pegDiagram-XKGWAZYB-DUukoOjY.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-CngQPdjr.js → pegDiagram-XKGWAZYB-OIP57N6J-ClyIfOjy.js} +1 -1
- package/web/assets/{pet-xGooCXVY.js → pet-7_82JHov.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-DkHaDPtZ.js → pieDiagram-E7YTZNPT-2UOTW327-CXr_-LKy.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-BDTdqFkm.js → pieDiagram-E7YTZNPT-BoX73GVV.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-KFKnY5SQ.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-BfJPVLX8.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-CXFhoJ1v.js → quadrantDiagram-AXDQQJYC-fWVY4hSA.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-BMHll5kZ.js → railroadDiagram-O6MQD6OU-34742W6X-LEvRYv_-.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-DdZMZ3P-.js → railroadDiagram-O6MQD6OU-BtJHgxH_.js} +1 -1
- package/web/assets/{render-O7CIS3YK-BUZqrLRp.js → render-O7CIS3YK-DU3B_ERD.js} +7 -7
- package/web/assets/{requirementDiagram-BXWQKSXE-WrY_I6-V.js → requirementDiagram-BXWQKSXE-DeBI9tYJ.js} +1 -1
- package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-CmLM20oA.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-DDu5KaVc.js} +1 -1
- package/web/assets/{rotate-ccw-DZE_kYZu.js → rotate-ccw-DHjeGlQd.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-RJsf4h9t.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-CuAwPvR9.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-Bjyi_fcC.js → sankeyDiagram-P5KCCOFB-Cn7EgJJg.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-Co6SKGyz.js → sequenceDiagram-WJ2MYXX4-Cc4unhAQ.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-B5nuUy2h.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-Bhw9XiPP.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-CF0_wtm2.js → sizeCapture-INFHLROL-D5ATuvis.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-xWY2H6Me.js → sizeCapture-X5ZJPWSS-PSGVOMYM-pk47pQ9r.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-5V-346Qd.js → stateDiagram-D77RDMKH-CQSVKJos.js} +1 -1
- package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-B6gqxipM.js → stateDiagram-HBIQ2CUA-4M2S6MAN-CtK20myG.js} +1 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-z3Zfnb5n.js +1 -0
- package/web/assets/stateDiagram-v2-MP3YSRHH-BEw4hFwV.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-D9gzHPsn.js → swimlanes-42K2YHIH-C_TtTWTU.js} +1 -1
- package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-rlPeyqTj.js → swimlanes-XN3QIQJK-N6N2CCQ6-BcUMswQj.js} +1 -1
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-D6SdGCA2.js +8 -0
- package/web/assets/swimlanesDiagram-VR7AAH4N-BCgYwpZp.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-B2GfJfmd.js → timeline-definition-24CTP7MA-DUWrxPBR.js} +1 -1
- package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-CKXP2kGU.js → timeline-definition-24CTP7MA-KN7RSRVM-guNGP5k9.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-CybCMyEX.js → vennDiagram-4TSXK5OY-AKJ7LXAN-CqrpJGZz.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-DkP-OS8t.js → vennDiagram-4TSXK5OY-DpAMU-X3.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-BdgAi1Gp.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-CvLFmNdB.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-DvRT9ehw.js → wardleyDiagram-VM6X3IG4-CwLky2tH.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-D0gQ0QKw.js → xychartDiagram-S5SC5T6Z-C0uS7jlH.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-23Q1AKCq.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-DUua3NqS.js} +1 -1
- package/web/index.html +3 -3
- package/web/pet.html +3 -3
- package/web/assets/SettingsView-BE8J-BR5.js +0 -20
- package/web/assets/api-web-ChIPnpHO.js +0 -1
- package/web/assets/channel-BsRXIHWg.js +0 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-BwnHfZhN.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-BBeyyi3H.js +0 -1
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-BwnHfZhN.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-BBeyyi3H.js +0 -1
- package/web/assets/index-EInfxfl9.css +0 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-DnphY6WO.js +0 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-DKtXGidN.js +0 -1
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-8pA5lT4C.js +0 -8
- package/web/assets/swimlanesDiagram-VR7AAH4N-B7BbPyRn.js +0 -8
- /package/web/assets/{index-C9fscARj.js → index-jKxnKPxh.js} +0 -0
package/server.cjs
CHANGED
|
@@ -6312,9 +6312,9 @@ var init_table = __esm({
|
|
|
6312
6312
|
[IsDrizzleTable] = true;
|
|
6313
6313
|
/** @internal */
|
|
6314
6314
|
[ExtraConfigBuilder] = void 0;
|
|
6315
|
-
constructor(name19,
|
|
6315
|
+
constructor(name19, schema34, baseName) {
|
|
6316
6316
|
this[TableName] = this[OriginalName] = name19;
|
|
6317
|
-
this[Schema] =
|
|
6317
|
+
this[Schema] = schema34;
|
|
6318
6318
|
this[BaseName] = baseName;
|
|
6319
6319
|
}
|
|
6320
6320
|
};
|
|
@@ -7378,7 +7378,7 @@ var init_sql = __esm({
|
|
|
7378
7378
|
return new SQL([new StringChunk(str3)]);
|
|
7379
7379
|
}
|
|
7380
7380
|
sql2.raw = raw;
|
|
7381
|
-
function
|
|
7381
|
+
function join17(chunks, separator) {
|
|
7382
7382
|
const result = [];
|
|
7383
7383
|
for (const [i, chunk] of chunks.entries()) {
|
|
7384
7384
|
if (i > 0 && separator !== void 0) {
|
|
@@ -7388,7 +7388,7 @@ var init_sql = __esm({
|
|
|
7388
7388
|
}
|
|
7389
7389
|
return new SQL(result);
|
|
7390
7390
|
}
|
|
7391
|
-
sql2.join =
|
|
7391
|
+
sql2.join = join17;
|
|
7392
7392
|
function identifier(value) {
|
|
7393
7393
|
return new Name(value);
|
|
7394
7394
|
}
|
|
@@ -7437,11 +7437,11 @@ var init_sql = __esm({
|
|
|
7437
7437
|
[ViewBaseConfig];
|
|
7438
7438
|
/** @internal */
|
|
7439
7439
|
[IsDrizzleView] = true;
|
|
7440
|
-
constructor({ name: name26, schema:
|
|
7440
|
+
constructor({ name: name26, schema: schema34, selectedFields, query: query2 }) {
|
|
7441
7441
|
this[ViewBaseConfig] = {
|
|
7442
7442
|
name: name26,
|
|
7443
7443
|
originalName: name26,
|
|
7444
|
-
schema:
|
|
7444
|
+
schema: schema34,
|
|
7445
7445
|
selectedFields,
|
|
7446
7446
|
query: query2,
|
|
7447
7447
|
isExisting: !query2,
|
|
@@ -7912,14 +7912,14 @@ function getOrderByOperators() {
|
|
|
7912
7912
|
desc
|
|
7913
7913
|
};
|
|
7914
7914
|
}
|
|
7915
|
-
function extractTablesRelationalConfig(
|
|
7916
|
-
if (Object.keys(
|
|
7917
|
-
|
|
7915
|
+
function extractTablesRelationalConfig(schema34, configHelpers) {
|
|
7916
|
+
if (Object.keys(schema34).length === 1 && "default" in schema34 && !is(schema34["default"], Table)) {
|
|
7917
|
+
schema34 = schema34["default"];
|
|
7918
7918
|
}
|
|
7919
7919
|
const tableNamesMap = {};
|
|
7920
7920
|
const relationsBuffer = {};
|
|
7921
7921
|
const tablesConfig = {};
|
|
7922
|
-
for (const [key2, value] of Object.entries(
|
|
7922
|
+
for (const [key2, value] of Object.entries(schema34)) {
|
|
7923
7923
|
if (is(value, Table)) {
|
|
7924
7924
|
const dbName = getTableUniqueName(value);
|
|
7925
7925
|
const bufferedRelations = relationsBuffer[dbName];
|
|
@@ -8001,7 +8001,7 @@ function createMany(sourceTable) {
|
|
|
8001
8001
|
return new Many(sourceTable, referencedTable, config2);
|
|
8002
8002
|
};
|
|
8003
8003
|
}
|
|
8004
|
-
function normalizeRelation(
|
|
8004
|
+
function normalizeRelation(schema34, tableNamesMap, relation) {
|
|
8005
8005
|
if (is(relation, One) && relation.config) {
|
|
8006
8006
|
return {
|
|
8007
8007
|
fields: relation.config.fields,
|
|
@@ -8014,7 +8014,7 @@ function normalizeRelation(schema32, tableNamesMap, relation) {
|
|
|
8014
8014
|
`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
|
|
8015
8015
|
);
|
|
8016
8016
|
}
|
|
8017
|
-
const referencedTableConfig =
|
|
8017
|
+
const referencedTableConfig = schema34[referencedTableTsName];
|
|
8018
8018
|
if (!referencedTableConfig) {
|
|
8019
8019
|
throw new Error(`Table "${referencedTableTsName}" not found in schema`);
|
|
8020
8020
|
}
|
|
@@ -9028,8 +9028,8 @@ var init_all = __esm({
|
|
|
9028
9028
|
});
|
|
9029
9029
|
|
|
9030
9030
|
// node_modules/drizzle-orm/sqlite-core/table.js
|
|
9031
|
-
function sqliteTableBase(name19, columns, extraConfig,
|
|
9032
|
-
const rawTable = new SQLiteTable(name19,
|
|
9031
|
+
function sqliteTableBase(name19, columns, extraConfig, schema34, baseName = name19) {
|
|
9032
|
+
const rawTable = new SQLiteTable(name19, schema34, baseName);
|
|
9033
9033
|
const parsedColumns = typeof columns === "function" ? columns(getSQLiteColumnBuilders()) : columns;
|
|
9034
9034
|
const builtColumns = Object.fromEntries(
|
|
9035
9035
|
Object.entries(parsedColumns).map(([name26, colBuilderBase]) => {
|
|
@@ -9373,18 +9373,18 @@ var init_casing = __esm({
|
|
|
9373
9373
|
getColumnCasing(column) {
|
|
9374
9374
|
if (!column.keyAsName)
|
|
9375
9375
|
return column.name;
|
|
9376
|
-
const
|
|
9376
|
+
const schema34 = column.table[Table.Symbol.Schema] ?? "public";
|
|
9377
9377
|
const tableName = column.table[Table.Symbol.OriginalName];
|
|
9378
|
-
const key2 = `${
|
|
9378
|
+
const key2 = `${schema34}.${tableName}.${column.name}`;
|
|
9379
9379
|
if (!this.cache[key2]) {
|
|
9380
9380
|
this.cacheTable(column.table);
|
|
9381
9381
|
}
|
|
9382
9382
|
return this.cache[key2];
|
|
9383
9383
|
}
|
|
9384
9384
|
cacheTable(table) {
|
|
9385
|
-
const
|
|
9385
|
+
const schema34 = table[Table.Symbol.Schema] ?? "public";
|
|
9386
9386
|
const tableName = table[Table.Symbol.OriginalName];
|
|
9387
|
-
const tableKey = `${
|
|
9387
|
+
const tableKey = `${schema34}.${tableName}`;
|
|
9388
9388
|
if (!this.cachedTables[tableKey]) {
|
|
9389
9389
|
for (const column of Object.values(table[Table.Symbol.Columns])) {
|
|
9390
9390
|
const columnKey = `${tableKey}.${column.name}`;
|
|
@@ -9960,7 +9960,7 @@ var init_dialect = __esm({
|
|
|
9960
9960
|
}
|
|
9961
9961
|
buildRelationalQuery({
|
|
9962
9962
|
fullSchema,
|
|
9963
|
-
schema:
|
|
9963
|
+
schema: schema34,
|
|
9964
9964
|
tableNamesMap,
|
|
9965
9965
|
table,
|
|
9966
9966
|
tableConfig,
|
|
@@ -10068,7 +10068,7 @@ var init_dialect = __esm({
|
|
|
10068
10068
|
relation
|
|
10069
10069
|
} of selectedRelations) {
|
|
10070
10070
|
const normalizedRelation = normalizeRelation(
|
|
10071
|
-
|
|
10071
|
+
schema34,
|
|
10072
10072
|
tableNamesMap,
|
|
10073
10073
|
relation
|
|
10074
10074
|
);
|
|
@@ -10088,10 +10088,10 @@ var init_dialect = __esm({
|
|
|
10088
10088
|
);
|
|
10089
10089
|
const builtRelation = this.buildRelationalQuery({
|
|
10090
10090
|
fullSchema,
|
|
10091
|
-
schema:
|
|
10091
|
+
schema: schema34,
|
|
10092
10092
|
tableNamesMap,
|
|
10093
10093
|
table: fullSchema[relationTableTsName],
|
|
10094
|
-
tableConfig:
|
|
10094
|
+
tableConfig: schema34[relationTableTsName],
|
|
10095
10095
|
queryConfig: is(relation, One) ? selectedRelationConfigValue === true ? { limit: 1 } : { ...selectedRelationConfigValue, limit: 1 } : selectedRelationConfigValue,
|
|
10096
10096
|
tableAlias: relationTableAlias,
|
|
10097
10097
|
joinOn: joinOn2,
|
|
@@ -10399,7 +10399,7 @@ var init_select2 = __esm({
|
|
|
10399
10399
|
const tableName = getTableLikeName(table);
|
|
10400
10400
|
for (const item of extractUsedTable(table))
|
|
10401
10401
|
this.usedTables.add(item);
|
|
10402
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
10402
|
+
if (typeof tableName === "string" && this.config.joins?.some((join17) => join17.alias === tableName)) {
|
|
10403
10403
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
10404
10404
|
}
|
|
10405
10405
|
if (!this.isPartialSelect) {
|
|
@@ -11288,7 +11288,7 @@ var init_update = __esm({
|
|
|
11288
11288
|
createJoin(joinType) {
|
|
11289
11289
|
return (table, on) => {
|
|
11290
11290
|
const tableName = getTableLikeName(table);
|
|
11291
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
11291
|
+
if (typeof tableName === "string" && this.config.joins.some((join17) => join17.alias === tableName)) {
|
|
11292
11292
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
11293
11293
|
}
|
|
11294
11294
|
if (typeof on === "function") {
|
|
@@ -11491,10 +11491,10 @@ var init_query = __esm({
|
|
|
11491
11491
|
init_query_promise();
|
|
11492
11492
|
init_relations();
|
|
11493
11493
|
RelationalQueryBuilder = class {
|
|
11494
|
-
constructor(mode, fullSchema,
|
|
11494
|
+
constructor(mode, fullSchema, schema34, tableNamesMap, table, tableConfig, dialect, session) {
|
|
11495
11495
|
this.mode = mode;
|
|
11496
11496
|
this.fullSchema = fullSchema;
|
|
11497
|
-
this.schema =
|
|
11497
|
+
this.schema = schema34;
|
|
11498
11498
|
this.tableNamesMap = tableNamesMap;
|
|
11499
11499
|
this.table = table;
|
|
11500
11500
|
this.tableConfig = tableConfig;
|
|
@@ -11550,10 +11550,10 @@ var init_query = __esm({
|
|
|
11550
11550
|
}
|
|
11551
11551
|
};
|
|
11552
11552
|
SQLiteRelationalQuery = class extends QueryPromise {
|
|
11553
|
-
constructor(fullSchema,
|
|
11553
|
+
constructor(fullSchema, schema34, tableNamesMap, table, tableConfig, dialect, session, config2, mode) {
|
|
11554
11554
|
super();
|
|
11555
11555
|
this.fullSchema = fullSchema;
|
|
11556
|
-
this.schema =
|
|
11556
|
+
this.schema = schema34;
|
|
11557
11557
|
this.tableNamesMap = tableNamesMap;
|
|
11558
11558
|
this.table = table;
|
|
11559
11559
|
this.tableConfig = tableConfig;
|
|
@@ -11683,14 +11683,14 @@ var init_db = __esm({
|
|
|
11683
11683
|
init_query();
|
|
11684
11684
|
init_raw();
|
|
11685
11685
|
BaseSQLiteDatabase = class {
|
|
11686
|
-
constructor(resultKind, dialect, session,
|
|
11686
|
+
constructor(resultKind, dialect, session, schema34) {
|
|
11687
11687
|
this.resultKind = resultKind;
|
|
11688
11688
|
this.dialect = dialect;
|
|
11689
11689
|
this.session = session;
|
|
11690
|
-
this._ =
|
|
11691
|
-
schema:
|
|
11692
|
-
fullSchema:
|
|
11693
|
-
tableNamesMap:
|
|
11690
|
+
this._ = schema34 ? {
|
|
11691
|
+
schema: schema34.schema,
|
|
11692
|
+
fullSchema: schema34.fullSchema,
|
|
11693
|
+
tableNamesMap: schema34.tableNamesMap
|
|
11694
11694
|
} : {
|
|
11695
11695
|
schema: void 0,
|
|
11696
11696
|
fullSchema: {},
|
|
@@ -11702,10 +11702,10 @@ var init_db = __esm({
|
|
|
11702
11702
|
for (const [tableName, columns] of Object.entries(this._.schema)) {
|
|
11703
11703
|
query2[tableName] = new RelationalQueryBuilder(
|
|
11704
11704
|
resultKind,
|
|
11705
|
-
|
|
11705
|
+
schema34.fullSchema,
|
|
11706
11706
|
this._.schema,
|
|
11707
11707
|
this._.tableNamesMap,
|
|
11708
|
-
|
|
11708
|
+
schema34.fullSchema[tableName],
|
|
11709
11709
|
columns,
|
|
11710
11710
|
dialect,
|
|
11711
11711
|
session
|
|
@@ -12206,9 +12206,9 @@ var init_session = __esm({
|
|
|
12206
12206
|
}
|
|
12207
12207
|
};
|
|
12208
12208
|
SQLiteTransaction = class extends BaseSQLiteDatabase {
|
|
12209
|
-
constructor(resultType, dialect, session,
|
|
12210
|
-
super(resultType, dialect, session,
|
|
12211
|
-
this.schema =
|
|
12209
|
+
constructor(resultType, dialect, session, schema34, nestedIndex = 0) {
|
|
12210
|
+
super(resultType, dialect, session, schema34);
|
|
12211
|
+
this.schema = schema34;
|
|
12212
12212
|
this.nestedIndex = nestedIndex;
|
|
12213
12213
|
}
|
|
12214
12214
|
static [entityKind] = "SQLiteTransaction";
|
|
@@ -12369,10 +12369,10 @@ var init_session2 = __esm({
|
|
|
12369
12369
|
init_session();
|
|
12370
12370
|
init_utils();
|
|
12371
12371
|
SQLJsSession = class extends SQLiteSession {
|
|
12372
|
-
constructor(client, dialect,
|
|
12372
|
+
constructor(client, dialect, schema34, options = {}) {
|
|
12373
12373
|
super(dialect);
|
|
12374
12374
|
this.client = client;
|
|
12375
|
-
this.schema =
|
|
12375
|
+
this.schema = schema34;
|
|
12376
12376
|
this.logger = options.logger ?? new NoopLogger();
|
|
12377
12377
|
}
|
|
12378
12378
|
static [entityKind] = "SQLJsSession";
|
|
@@ -12496,20 +12496,20 @@ function drizzle(client, config2 = {}) {
|
|
|
12496
12496
|
} else if (config2.logger !== false) {
|
|
12497
12497
|
logger = config2.logger;
|
|
12498
12498
|
}
|
|
12499
|
-
let
|
|
12499
|
+
let schema34;
|
|
12500
12500
|
if (config2.schema) {
|
|
12501
12501
|
const tablesConfig = extractTablesRelationalConfig(
|
|
12502
12502
|
config2.schema,
|
|
12503
12503
|
createTableRelationsHelpers
|
|
12504
12504
|
);
|
|
12505
|
-
|
|
12505
|
+
schema34 = {
|
|
12506
12506
|
fullSchema: config2.schema,
|
|
12507
12507
|
schema: tablesConfig.tables,
|
|
12508
12508
|
tableNamesMap: tablesConfig.tableNamesMap
|
|
12509
12509
|
};
|
|
12510
12510
|
}
|
|
12511
|
-
const session = new SQLJsSession(client, dialect,
|
|
12512
|
-
return new BaseSQLiteDatabase("sync", dialect, session,
|
|
12511
|
+
const session = new SQLJsSession(client, dialect, schema34, { logger });
|
|
12512
|
+
return new BaseSQLiteDatabase("sync", dialect, session, schema34);
|
|
12513
12513
|
}
|
|
12514
12514
|
var init_driver = __esm({
|
|
12515
12515
|
"node_modules/drizzle-orm/sql-js/driver.js"() {
|
|
@@ -14156,8 +14156,8 @@ async function inlineImages(content, sourceFile, source, imageCache, _send) {
|
|
|
14156
14156
|
if (src.startsWith("http://") || src.startsWith("https://") || src.startsWith("data:")) {
|
|
14157
14157
|
return src;
|
|
14158
14158
|
}
|
|
14159
|
-
const
|
|
14160
|
-
if (!IMAGE_EXTS.some((ext) =>
|
|
14159
|
+
const lower2 = src.toLowerCase();
|
|
14160
|
+
if (!IMAGE_EXTS.some((ext) => lower2.endsWith(ext)))
|
|
14161
14161
|
return src;
|
|
14162
14162
|
let imgPath = src.replace(/^\.\//, "").replace(/^\.\.\//g, (m) => m);
|
|
14163
14163
|
if (imgPath.startsWith("../")) {
|
|
@@ -15159,9 +15159,9 @@ function optionalKeys(shape) {
|
|
|
15159
15159
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
15160
15160
|
});
|
|
15161
15161
|
}
|
|
15162
|
-
function pick(
|
|
15162
|
+
function pick(schema34, mask) {
|
|
15163
15163
|
const newShape = {};
|
|
15164
|
-
const currDef =
|
|
15164
|
+
const currDef = schema34._zod.def;
|
|
15165
15165
|
for (const key2 in mask) {
|
|
15166
15166
|
if (!(key2 in currDef.shape)) {
|
|
15167
15167
|
throw new Error(`Unrecognized key: "${key2}"`);
|
|
@@ -15170,15 +15170,15 @@ function pick(schema32, mask) {
|
|
|
15170
15170
|
continue;
|
|
15171
15171
|
newShape[key2] = currDef.shape[key2];
|
|
15172
15172
|
}
|
|
15173
|
-
return clone(
|
|
15174
|
-
...
|
|
15173
|
+
return clone(schema34, {
|
|
15174
|
+
...schema34._zod.def,
|
|
15175
15175
|
shape: newShape,
|
|
15176
15176
|
checks: []
|
|
15177
15177
|
});
|
|
15178
15178
|
}
|
|
15179
|
-
function omit(
|
|
15180
|
-
const newShape = { ...
|
|
15181
|
-
const currDef =
|
|
15179
|
+
function omit(schema34, mask) {
|
|
15180
|
+
const newShape = { ...schema34._zod.def.shape };
|
|
15181
|
+
const currDef = schema34._zod.def;
|
|
15182
15182
|
for (const key2 in mask) {
|
|
15183
15183
|
if (!(key2 in currDef.shape)) {
|
|
15184
15184
|
throw new Error(`Unrecognized key: "${key2}"`);
|
|
@@ -15187,27 +15187,27 @@ function omit(schema32, mask) {
|
|
|
15187
15187
|
continue;
|
|
15188
15188
|
delete newShape[key2];
|
|
15189
15189
|
}
|
|
15190
|
-
return clone(
|
|
15191
|
-
...
|
|
15190
|
+
return clone(schema34, {
|
|
15191
|
+
...schema34._zod.def,
|
|
15192
15192
|
shape: newShape,
|
|
15193
15193
|
checks: []
|
|
15194
15194
|
});
|
|
15195
15195
|
}
|
|
15196
|
-
function extend(
|
|
15196
|
+
function extend(schema34, shape) {
|
|
15197
15197
|
if (!isPlainObject(shape)) {
|
|
15198
15198
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
15199
15199
|
}
|
|
15200
15200
|
const def = {
|
|
15201
|
-
...
|
|
15201
|
+
...schema34._zod.def,
|
|
15202
15202
|
get shape() {
|
|
15203
|
-
const _shape = { ...
|
|
15203
|
+
const _shape = { ...schema34._zod.def.shape, ...shape };
|
|
15204
15204
|
assignProp(this, "shape", _shape);
|
|
15205
15205
|
return _shape;
|
|
15206
15206
|
},
|
|
15207
15207
|
checks: []
|
|
15208
15208
|
// delete existing checks
|
|
15209
15209
|
};
|
|
15210
|
-
return clone(
|
|
15210
|
+
return clone(schema34, def);
|
|
15211
15211
|
}
|
|
15212
15212
|
function merge(a, b) {
|
|
15213
15213
|
return clone(a, {
|
|
@@ -15222,8 +15222,8 @@ function merge(a, b) {
|
|
|
15222
15222
|
// delete existing checks
|
|
15223
15223
|
});
|
|
15224
15224
|
}
|
|
15225
|
-
function partial(Class2,
|
|
15226
|
-
const oldShape =
|
|
15225
|
+
function partial(Class2, schema34, mask) {
|
|
15226
|
+
const oldShape = schema34._zod.def.shape;
|
|
15227
15227
|
const shape = { ...oldShape };
|
|
15228
15228
|
if (mask) {
|
|
15229
15229
|
for (const key2 in mask) {
|
|
@@ -15245,14 +15245,14 @@ function partial(Class2, schema32, mask) {
|
|
|
15245
15245
|
}) : oldShape[key2];
|
|
15246
15246
|
}
|
|
15247
15247
|
}
|
|
15248
|
-
return clone(
|
|
15249
|
-
...
|
|
15248
|
+
return clone(schema34, {
|
|
15249
|
+
...schema34._zod.def,
|
|
15250
15250
|
shape,
|
|
15251
15251
|
checks: []
|
|
15252
15252
|
});
|
|
15253
15253
|
}
|
|
15254
|
-
function required(Class2,
|
|
15255
|
-
const oldShape =
|
|
15254
|
+
function required(Class2, schema34, mask) {
|
|
15255
|
+
const oldShape = schema34._zod.def.shape;
|
|
15256
15256
|
const shape = { ...oldShape };
|
|
15257
15257
|
if (mask) {
|
|
15258
15258
|
for (const key2 in mask) {
|
|
@@ -15274,8 +15274,8 @@ function required(Class2, schema32, mask) {
|
|
|
15274
15274
|
});
|
|
15275
15275
|
}
|
|
15276
15276
|
}
|
|
15277
|
-
return clone(
|
|
15278
|
-
...
|
|
15277
|
+
return clone(schema34, {
|
|
15278
|
+
...schema34._zod.def,
|
|
15279
15279
|
shape,
|
|
15280
15280
|
// optional: [],
|
|
15281
15281
|
checks: []
|
|
@@ -15587,9 +15587,9 @@ var init_parse = __esm({
|
|
|
15587
15587
|
init_core();
|
|
15588
15588
|
init_errors2();
|
|
15589
15589
|
init_util();
|
|
15590
|
-
_parse = (_Err) => (
|
|
15590
|
+
_parse = (_Err) => (schema34, value, _ctx, _params) => {
|
|
15591
15591
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
15592
|
-
const result =
|
|
15592
|
+
const result = schema34._zod.run({ value, issues: [] }, ctx);
|
|
15593
15593
|
if (result instanceof Promise) {
|
|
15594
15594
|
throw new $ZodAsyncError();
|
|
15595
15595
|
}
|
|
@@ -15601,9 +15601,9 @@ var init_parse = __esm({
|
|
|
15601
15601
|
return result.value;
|
|
15602
15602
|
};
|
|
15603
15603
|
parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
15604
|
-
_parseAsync = (_Err) => async (
|
|
15604
|
+
_parseAsync = (_Err) => async (schema34, value, _ctx, params) => {
|
|
15605
15605
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
15606
|
-
let result =
|
|
15606
|
+
let result = schema34._zod.run({ value, issues: [] }, ctx);
|
|
15607
15607
|
if (result instanceof Promise)
|
|
15608
15608
|
result = await result;
|
|
15609
15609
|
if (result.issues.length) {
|
|
@@ -15614,9 +15614,9 @@ var init_parse = __esm({
|
|
|
15614
15614
|
return result.value;
|
|
15615
15615
|
};
|
|
15616
15616
|
parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
15617
|
-
_safeParse = (_Err) => (
|
|
15617
|
+
_safeParse = (_Err) => (schema34, value, _ctx) => {
|
|
15618
15618
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
15619
|
-
const result =
|
|
15619
|
+
const result = schema34._zod.run({ value, issues: [] }, ctx);
|
|
15620
15620
|
if (result instanceof Promise) {
|
|
15621
15621
|
throw new $ZodAsyncError();
|
|
15622
15622
|
}
|
|
@@ -15626,9 +15626,9 @@ var init_parse = __esm({
|
|
|
15626
15626
|
} : { success: true, data: result.value };
|
|
15627
15627
|
};
|
|
15628
15628
|
safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
15629
|
-
_safeParseAsync = (_Err) => async (
|
|
15629
|
+
_safeParseAsync = (_Err) => async (schema34, value, _ctx) => {
|
|
15630
15630
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
15631
|
-
let result =
|
|
15631
|
+
let result = schema34._zod.run({ value, issues: [] }, ctx);
|
|
15632
15632
|
if (result instanceof Promise)
|
|
15633
15633
|
result = await result;
|
|
15634
15634
|
return result.issues.length ? {
|
|
@@ -23044,14 +23044,14 @@ var init_registries = __esm({
|
|
|
23044
23044
|
this._map = /* @__PURE__ */ new Map();
|
|
23045
23045
|
this._idmap = /* @__PURE__ */ new Map();
|
|
23046
23046
|
}
|
|
23047
|
-
add(
|
|
23047
|
+
add(schema34, ..._meta) {
|
|
23048
23048
|
const meta = _meta[0];
|
|
23049
|
-
this._map.set(
|
|
23049
|
+
this._map.set(schema34, meta);
|
|
23050
23050
|
if (meta && typeof meta === "object" && "id" in meta) {
|
|
23051
23051
|
if (this._idmap.has(meta.id)) {
|
|
23052
23052
|
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
23053
23053
|
}
|
|
23054
|
-
this._idmap.set(meta.id,
|
|
23054
|
+
this._idmap.set(meta.id, schema34);
|
|
23055
23055
|
}
|
|
23056
23056
|
return this;
|
|
23057
23057
|
}
|
|
@@ -23060,25 +23060,25 @@ var init_registries = __esm({
|
|
|
23060
23060
|
this._idmap = /* @__PURE__ */ new Map();
|
|
23061
23061
|
return this;
|
|
23062
23062
|
}
|
|
23063
|
-
remove(
|
|
23064
|
-
const meta = this._map.get(
|
|
23063
|
+
remove(schema34) {
|
|
23064
|
+
const meta = this._map.get(schema34);
|
|
23065
23065
|
if (meta && typeof meta === "object" && "id" in meta) {
|
|
23066
23066
|
this._idmap.delete(meta.id);
|
|
23067
23067
|
}
|
|
23068
|
-
this._map.delete(
|
|
23068
|
+
this._map.delete(schema34);
|
|
23069
23069
|
return this;
|
|
23070
23070
|
}
|
|
23071
|
-
get(
|
|
23072
|
-
const p =
|
|
23071
|
+
get(schema34) {
|
|
23072
|
+
const p = schema34._zod.parent;
|
|
23073
23073
|
if (p) {
|
|
23074
23074
|
const pm = { ...this.get(p) ?? {} };
|
|
23075
23075
|
delete pm.id;
|
|
23076
|
-
return { ...pm, ...this._map.get(
|
|
23076
|
+
return { ...pm, ...this._map.get(schema34) };
|
|
23077
23077
|
}
|
|
23078
|
-
return this._map.get(
|
|
23078
|
+
return this._map.get(schema34);
|
|
23079
23079
|
}
|
|
23080
|
-
has(
|
|
23081
|
-
return this._map.has(
|
|
23080
|
+
has(schema34) {
|
|
23081
|
+
return this._map.has(schema34);
|
|
23082
23082
|
}
|
|
23083
23083
|
};
|
|
23084
23084
|
globalRegistry = /* @__PURE__ */ registry();
|
|
@@ -23639,11 +23639,11 @@ function _endsWith(suffix, params) {
|
|
|
23639
23639
|
suffix
|
|
23640
23640
|
});
|
|
23641
23641
|
}
|
|
23642
|
-
function _property(property,
|
|
23642
|
+
function _property(property, schema34, params) {
|
|
23643
23643
|
return new $ZodCheckProperty({
|
|
23644
23644
|
check: "property",
|
|
23645
23645
|
property,
|
|
23646
|
-
schema:
|
|
23646
|
+
schema: schema34,
|
|
23647
23647
|
...normalizeParams(params)
|
|
23648
23648
|
});
|
|
23649
23649
|
}
|
|
@@ -23848,22 +23848,22 @@ function _promise(Class2, innerType) {
|
|
|
23848
23848
|
function _custom(Class2, fn, _params) {
|
|
23849
23849
|
const norm = normalizeParams(_params);
|
|
23850
23850
|
norm.abort ?? (norm.abort = true);
|
|
23851
|
-
const
|
|
23851
|
+
const schema34 = new Class2({
|
|
23852
23852
|
type: "custom",
|
|
23853
23853
|
check: "custom",
|
|
23854
23854
|
fn,
|
|
23855
23855
|
...norm
|
|
23856
23856
|
});
|
|
23857
|
-
return
|
|
23857
|
+
return schema34;
|
|
23858
23858
|
}
|
|
23859
23859
|
function _refine(Class2, fn, _params) {
|
|
23860
|
-
const
|
|
23860
|
+
const schema34 = new Class2({
|
|
23861
23861
|
type: "custom",
|
|
23862
23862
|
check: "custom",
|
|
23863
23863
|
fn,
|
|
23864
23864
|
...normalizeParams(_params)
|
|
23865
23865
|
});
|
|
23866
|
-
return
|
|
23866
|
+
return schema34;
|
|
23867
23867
|
}
|
|
23868
23868
|
function _stringbool(Classes2, _params) {
|
|
23869
23869
|
const params = normalizeParams(_params);
|
|
@@ -24036,8 +24036,8 @@ function toJSONSchema(input, _params) {
|
|
|
24036
24036
|
const gen2 = new JSONSchemaGenerator(_params);
|
|
24037
24037
|
const defs = {};
|
|
24038
24038
|
for (const entry of input._idmap.entries()) {
|
|
24039
|
-
const [_,
|
|
24040
|
-
gen2.process(
|
|
24039
|
+
const [_, schema34] = entry;
|
|
24040
|
+
gen2.process(schema34);
|
|
24041
24041
|
}
|
|
24042
24042
|
const schemas = {};
|
|
24043
24043
|
const external = {
|
|
@@ -24046,8 +24046,8 @@ function toJSONSchema(input, _params) {
|
|
|
24046
24046
|
defs
|
|
24047
24047
|
};
|
|
24048
24048
|
for (const entry of input._idmap.entries()) {
|
|
24049
|
-
const [key2,
|
|
24050
|
-
schemas[key2] = gen2.emit(
|
|
24049
|
+
const [key2, schema34] = entry;
|
|
24050
|
+
schemas[key2] = gen2.emit(schema34, {
|
|
24051
24051
|
..._params,
|
|
24052
24052
|
external
|
|
24053
24053
|
});
|
|
@@ -24069,8 +24069,8 @@ function isTransforming(_schema, _ctx) {
|
|
|
24069
24069
|
if (ctx.seen.has(_schema))
|
|
24070
24070
|
return false;
|
|
24071
24071
|
ctx.seen.add(_schema);
|
|
24072
|
-
const
|
|
24073
|
-
const def =
|
|
24072
|
+
const schema34 = _schema;
|
|
24073
|
+
const def = schema34._zod.def;
|
|
24074
24074
|
switch (def.type) {
|
|
24075
24075
|
case "string":
|
|
24076
24076
|
case "number":
|
|
@@ -24178,9 +24178,9 @@ var init_to_json_schema = __esm({
|
|
|
24178
24178
|
this.io = params?.io ?? "output";
|
|
24179
24179
|
this.seen = /* @__PURE__ */ new Map();
|
|
24180
24180
|
}
|
|
24181
|
-
process(
|
|
24181
|
+
process(schema34, _params = { path: [], schemaPath: [] }) {
|
|
24182
24182
|
var _a27;
|
|
24183
|
-
const def =
|
|
24183
|
+
const def = schema34._zod.def;
|
|
24184
24184
|
const formatMap = {
|
|
24185
24185
|
guid: "uuid",
|
|
24186
24186
|
url: "uri",
|
|
@@ -24189,27 +24189,27 @@ var init_to_json_schema = __esm({
|
|
|
24189
24189
|
regex: ""
|
|
24190
24190
|
// do not set
|
|
24191
24191
|
};
|
|
24192
|
-
const seen = this.seen.get(
|
|
24192
|
+
const seen = this.seen.get(schema34);
|
|
24193
24193
|
if (seen) {
|
|
24194
24194
|
seen.count++;
|
|
24195
|
-
const isCycle = _params.schemaPath.includes(
|
|
24195
|
+
const isCycle = _params.schemaPath.includes(schema34);
|
|
24196
24196
|
if (isCycle) {
|
|
24197
24197
|
seen.cycle = _params.path;
|
|
24198
24198
|
}
|
|
24199
24199
|
return seen.schema;
|
|
24200
24200
|
}
|
|
24201
24201
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
24202
|
-
this.seen.set(
|
|
24203
|
-
const overrideSchema =
|
|
24202
|
+
this.seen.set(schema34, result);
|
|
24203
|
+
const overrideSchema = schema34._zod.toJSONSchema?.();
|
|
24204
24204
|
if (overrideSchema) {
|
|
24205
24205
|
result.schema = overrideSchema;
|
|
24206
24206
|
} else {
|
|
24207
24207
|
const params = {
|
|
24208
24208
|
..._params,
|
|
24209
|
-
schemaPath: [..._params.schemaPath,
|
|
24209
|
+
schemaPath: [..._params.schemaPath, schema34],
|
|
24210
24210
|
path: _params.path
|
|
24211
24211
|
};
|
|
24212
|
-
const parent =
|
|
24212
|
+
const parent = schema34._zod.parent;
|
|
24213
24213
|
if (parent) {
|
|
24214
24214
|
result.ref = parent;
|
|
24215
24215
|
this.process(parent, params);
|
|
@@ -24220,7 +24220,7 @@ var init_to_json_schema = __esm({
|
|
|
24220
24220
|
case "string": {
|
|
24221
24221
|
const json2 = _json;
|
|
24222
24222
|
json2.type = "string";
|
|
24223
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
24223
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema34._zod.bag;
|
|
24224
24224
|
if (typeof minimum === "number")
|
|
24225
24225
|
json2.minLength = minimum;
|
|
24226
24226
|
if (typeof maximum === "number")
|
|
@@ -24249,7 +24249,7 @@ var init_to_json_schema = __esm({
|
|
|
24249
24249
|
}
|
|
24250
24250
|
case "number": {
|
|
24251
24251
|
const json2 = _json;
|
|
24252
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
24252
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema34._zod.bag;
|
|
24253
24253
|
if (typeof format === "string" && format.includes("int"))
|
|
24254
24254
|
json2.type = "integer";
|
|
24255
24255
|
else
|
|
@@ -24331,7 +24331,7 @@ var init_to_json_schema = __esm({
|
|
|
24331
24331
|
}
|
|
24332
24332
|
case "array": {
|
|
24333
24333
|
const json2 = _json;
|
|
24334
|
-
const { minimum, maximum } =
|
|
24334
|
+
const { minimum, maximum } = schema34._zod.bag;
|
|
24335
24335
|
if (typeof minimum === "number")
|
|
24336
24336
|
json2.minItems = minimum;
|
|
24337
24337
|
if (typeof maximum === "number")
|
|
@@ -24428,7 +24428,7 @@ var init_to_json_schema = __esm({
|
|
|
24428
24428
|
path: [...params.path, "items"]
|
|
24429
24429
|
});
|
|
24430
24430
|
}
|
|
24431
|
-
const { minimum, maximum } =
|
|
24431
|
+
const { minimum, maximum } = schema34._zod.bag;
|
|
24432
24432
|
if (typeof minimum === "number")
|
|
24433
24433
|
json2.minItems = minimum;
|
|
24434
24434
|
if (typeof maximum === "number")
|
|
@@ -24511,7 +24511,7 @@ var init_to_json_schema = __esm({
|
|
|
24511
24511
|
format: "binary",
|
|
24512
24512
|
contentEncoding: "binary"
|
|
24513
24513
|
};
|
|
24514
|
-
const { minimum, maximum, mime } =
|
|
24514
|
+
const { minimum, maximum, mime } = schema34._zod.bag;
|
|
24515
24515
|
if (minimum !== void 0)
|
|
24516
24516
|
file2.minLength = minimum;
|
|
24517
24517
|
if (maximum !== void 0)
|
|
@@ -24585,7 +24585,7 @@ var init_to_json_schema = __esm({
|
|
|
24585
24585
|
}
|
|
24586
24586
|
case "template_literal": {
|
|
24587
24587
|
const json2 = _json;
|
|
24588
|
-
const pattern =
|
|
24588
|
+
const pattern = schema34._zod.pattern;
|
|
24589
24589
|
if (!pattern)
|
|
24590
24590
|
throw new Error("Pattern not found in template literal");
|
|
24591
24591
|
json2.type = "string";
|
|
@@ -24615,7 +24615,7 @@ var init_to_json_schema = __esm({
|
|
|
24615
24615
|
break;
|
|
24616
24616
|
}
|
|
24617
24617
|
case "lazy": {
|
|
24618
|
-
const innerType =
|
|
24618
|
+
const innerType = schema34._zod.innerType;
|
|
24619
24619
|
this.process(innerType, params);
|
|
24620
24620
|
result.ref = innerType;
|
|
24621
24621
|
break;
|
|
@@ -24632,20 +24632,20 @@ var init_to_json_schema = __esm({
|
|
|
24632
24632
|
}
|
|
24633
24633
|
}
|
|
24634
24634
|
}
|
|
24635
|
-
const meta = this.metadataRegistry.get(
|
|
24635
|
+
const meta = this.metadataRegistry.get(schema34);
|
|
24636
24636
|
if (meta)
|
|
24637
24637
|
Object.assign(result.schema, meta);
|
|
24638
|
-
if (this.io === "input" && isTransforming(
|
|
24638
|
+
if (this.io === "input" && isTransforming(schema34)) {
|
|
24639
24639
|
delete result.schema.examples;
|
|
24640
24640
|
delete result.schema.default;
|
|
24641
24641
|
}
|
|
24642
24642
|
if (this.io === "input" && result.schema._prefault)
|
|
24643
24643
|
(_a27 = result.schema).default ?? (_a27.default = result.schema._prefault);
|
|
24644
24644
|
delete result.schema._prefault;
|
|
24645
|
-
const _result = this.seen.get(
|
|
24645
|
+
const _result = this.seen.get(schema34);
|
|
24646
24646
|
return _result.schema;
|
|
24647
24647
|
}
|
|
24648
|
-
emit(
|
|
24648
|
+
emit(schema34, _params) {
|
|
24649
24649
|
const params = {
|
|
24650
24650
|
cycles: _params?.cycles ?? "ref",
|
|
24651
24651
|
reused: _params?.reused ?? "inline",
|
|
@@ -24653,7 +24653,7 @@ var init_to_json_schema = __esm({
|
|
|
24653
24653
|
// uri: _params?.uri ?? ((id) => `${id}`),
|
|
24654
24654
|
external: _params?.external ?? void 0
|
|
24655
24655
|
};
|
|
24656
|
-
const root = this.seen.get(
|
|
24656
|
+
const root = this.seen.get(schema34);
|
|
24657
24657
|
if (!root)
|
|
24658
24658
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
24659
24659
|
const makeURI = (entry) => {
|
|
@@ -24685,11 +24685,11 @@ var init_to_json_schema = __esm({
|
|
|
24685
24685
|
seen.def = { ...seen.schema };
|
|
24686
24686
|
if (defId)
|
|
24687
24687
|
seen.defId = defId;
|
|
24688
|
-
const
|
|
24689
|
-
for (const key2 in
|
|
24690
|
-
delete
|
|
24688
|
+
const schema35 = seen.schema;
|
|
24689
|
+
for (const key2 in schema35) {
|
|
24690
|
+
delete schema35[key2];
|
|
24691
24691
|
}
|
|
24692
|
-
|
|
24692
|
+
schema35.$ref = ref;
|
|
24693
24693
|
};
|
|
24694
24694
|
if (params.cycles === "throw") {
|
|
24695
24695
|
for (const entry of this.seen.entries()) {
|
|
@@ -24703,13 +24703,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24703
24703
|
}
|
|
24704
24704
|
for (const entry of this.seen.entries()) {
|
|
24705
24705
|
const seen = entry[1];
|
|
24706
|
-
if (
|
|
24706
|
+
if (schema34 === entry[0]) {
|
|
24707
24707
|
extractToDef(entry);
|
|
24708
24708
|
continue;
|
|
24709
24709
|
}
|
|
24710
24710
|
if (params.external) {
|
|
24711
24711
|
const ext = params.external.registry.get(entry[0])?.id;
|
|
24712
|
-
if (
|
|
24712
|
+
if (schema34 !== entry[0] && ext) {
|
|
24713
24713
|
extractToDef(entry);
|
|
24714
24714
|
continue;
|
|
24715
24715
|
}
|
|
@@ -24732,8 +24732,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24732
24732
|
}
|
|
24733
24733
|
const flattenRef = (zodSchema2, params2) => {
|
|
24734
24734
|
const seen = this.seen.get(zodSchema2);
|
|
24735
|
-
const
|
|
24736
|
-
const _cached = { ...
|
|
24735
|
+
const schema35 = seen.def ?? seen.schema;
|
|
24736
|
+
const _cached = { ...schema35 };
|
|
24737
24737
|
if (seen.ref === null) {
|
|
24738
24738
|
return;
|
|
24739
24739
|
}
|
|
@@ -24743,17 +24743,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24743
24743
|
flattenRef(ref, params2);
|
|
24744
24744
|
const refSchema = this.seen.get(ref).schema;
|
|
24745
24745
|
if (refSchema.$ref && params2.target === "draft-7") {
|
|
24746
|
-
|
|
24747
|
-
|
|
24746
|
+
schema35.allOf = schema35.allOf ?? [];
|
|
24747
|
+
schema35.allOf.push(refSchema);
|
|
24748
24748
|
} else {
|
|
24749
|
-
Object.assign(
|
|
24750
|
-
Object.assign(
|
|
24749
|
+
Object.assign(schema35, refSchema);
|
|
24750
|
+
Object.assign(schema35, _cached);
|
|
24751
24751
|
}
|
|
24752
24752
|
}
|
|
24753
24753
|
if (!seen.isParent)
|
|
24754
24754
|
this.override({
|
|
24755
24755
|
zodSchema: zodSchema2,
|
|
24756
|
-
jsonSchema:
|
|
24756
|
+
jsonSchema: schema35,
|
|
24757
24757
|
path: seen.path ?? []
|
|
24758
24758
|
});
|
|
24759
24759
|
};
|
|
@@ -24769,7 +24769,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24769
24769
|
console.warn(`Invalid target: ${this.target}`);
|
|
24770
24770
|
}
|
|
24771
24771
|
if (params.external?.uri) {
|
|
24772
|
-
const id = params.external.registry.get(
|
|
24772
|
+
const id = params.external.registry.get(schema34)?.id;
|
|
24773
24773
|
if (!id)
|
|
24774
24774
|
throw new Error("Schema is missing an `id` property");
|
|
24775
24775
|
result.$id = params.external.uri(id);
|
|
@@ -25311,8 +25311,8 @@ function date3(params) {
|
|
|
25311
25311
|
function array(element, params) {
|
|
25312
25312
|
return _array(ZodArray, element, params);
|
|
25313
25313
|
}
|
|
25314
|
-
function keyof(
|
|
25315
|
-
const shape =
|
|
25314
|
+
function keyof(schema34) {
|
|
25315
|
+
const shape = schema34._zod.def.shape;
|
|
25316
25316
|
return literal(Object.keys(shape));
|
|
25317
25317
|
}
|
|
25318
25318
|
function object(shape, params) {
|
|
@@ -25585,8 +25585,8 @@ function json(params) {
|
|
|
25585
25585
|
});
|
|
25586
25586
|
return jsonSchema2;
|
|
25587
25587
|
}
|
|
25588
|
-
function preprocess(fn,
|
|
25589
|
-
return pipe(transform(fn),
|
|
25588
|
+
function preprocess(fn, schema34) {
|
|
25589
|
+
return pipe(transform(fn), schema34);
|
|
25590
25590
|
}
|
|
25591
25591
|
var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodCustomStringFormat, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodBigIntFormat, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodEnum, ZodLiteral, ZodFile, ZodTransform, ZodOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodSuccess, ZodCatch, ZodNaN, ZodPipe, ZodReadonly, ZodTemplateLiteral, ZodLazy, ZodPromise, ZodCustom, stringbool;
|
|
25592
25592
|
var init_schemas2 = __esm({
|
|
@@ -27047,30 +27047,30 @@ function floatSafeRemainder2(val, step) {
|
|
|
27047
27047
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
27048
27048
|
return valInt % stepInt / 10 ** decCount;
|
|
27049
27049
|
}
|
|
27050
|
-
function deepPartialify(
|
|
27051
|
-
if (
|
|
27050
|
+
function deepPartialify(schema34) {
|
|
27051
|
+
if (schema34 instanceof ZodObject2) {
|
|
27052
27052
|
const newShape = {};
|
|
27053
|
-
for (const key2 in
|
|
27054
|
-
const fieldSchema =
|
|
27053
|
+
for (const key2 in schema34.shape) {
|
|
27054
|
+
const fieldSchema = schema34.shape[key2];
|
|
27055
27055
|
newShape[key2] = ZodOptional2.create(deepPartialify(fieldSchema));
|
|
27056
27056
|
}
|
|
27057
27057
|
return new ZodObject2({
|
|
27058
|
-
...
|
|
27058
|
+
...schema34._def,
|
|
27059
27059
|
shape: () => newShape
|
|
27060
27060
|
});
|
|
27061
|
-
} else if (
|
|
27061
|
+
} else if (schema34 instanceof ZodArray2) {
|
|
27062
27062
|
return new ZodArray2({
|
|
27063
|
-
...
|
|
27064
|
-
type: deepPartialify(
|
|
27063
|
+
...schema34._def,
|
|
27064
|
+
type: deepPartialify(schema34.element)
|
|
27065
27065
|
});
|
|
27066
|
-
} else if (
|
|
27067
|
-
return ZodOptional2.create(deepPartialify(
|
|
27068
|
-
} else if (
|
|
27069
|
-
return ZodNullable2.create(deepPartialify(
|
|
27070
|
-
} else if (
|
|
27071
|
-
return ZodTuple2.create(
|
|
27066
|
+
} else if (schema34 instanceof ZodOptional2) {
|
|
27067
|
+
return ZodOptional2.create(deepPartialify(schema34.unwrap()));
|
|
27068
|
+
} else if (schema34 instanceof ZodNullable2) {
|
|
27069
|
+
return ZodNullable2.create(deepPartialify(schema34.unwrap()));
|
|
27070
|
+
} else if (schema34 instanceof ZodTuple2) {
|
|
27071
|
+
return ZodTuple2.create(schema34.items.map((item) => deepPartialify(item)));
|
|
27072
27072
|
} else {
|
|
27073
|
-
return
|
|
27073
|
+
return schema34;
|
|
27074
27074
|
}
|
|
27075
27075
|
}
|
|
27076
27076
|
function mergeValues2(a, b) {
|
|
@@ -28797,9 +28797,9 @@ var init_types = __esm({
|
|
|
28797
28797
|
return this.min(1, message);
|
|
28798
28798
|
}
|
|
28799
28799
|
};
|
|
28800
|
-
ZodArray2.create = (
|
|
28800
|
+
ZodArray2.create = (schema34, params) => {
|
|
28801
28801
|
return new ZodArray2({
|
|
28802
|
-
type:
|
|
28802
|
+
type: schema34,
|
|
28803
28803
|
minLength: null,
|
|
28804
28804
|
maxLength: null,
|
|
28805
28805
|
exactLength: null,
|
|
@@ -29020,8 +29020,8 @@ var init_types = __esm({
|
|
|
29020
29020
|
// }) as any;
|
|
29021
29021
|
// return merged;
|
|
29022
29022
|
// }
|
|
29023
|
-
setKey(key2,
|
|
29024
|
-
return this.augment({ [key2]:
|
|
29023
|
+
setKey(key2, schema34) {
|
|
29024
|
+
return this.augment({ [key2]: schema34 });
|
|
29025
29025
|
}
|
|
29026
29026
|
// merge<Incoming extends AnyZodObject>(
|
|
29027
29027
|
// merging: Incoming
|
|
@@ -29429,10 +29429,10 @@ var init_types = __esm({
|
|
|
29429
29429
|
status.dirty();
|
|
29430
29430
|
}
|
|
29431
29431
|
const items = [...ctx.data].map((item, itemIndex) => {
|
|
29432
|
-
const
|
|
29433
|
-
if (!
|
|
29432
|
+
const schema34 = this._def.items[itemIndex] || this._def.rest;
|
|
29433
|
+
if (!schema34)
|
|
29434
29434
|
return null;
|
|
29435
|
-
return
|
|
29435
|
+
return schema34._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
29436
29436
|
}).filter((x) => !!x);
|
|
29437
29437
|
if (ctx.common.async) {
|
|
29438
29438
|
return Promise.all(items).then((results) => {
|
|
@@ -29939,9 +29939,9 @@ var init_types = __esm({
|
|
|
29939
29939
|
}));
|
|
29940
29940
|
}
|
|
29941
29941
|
};
|
|
29942
|
-
ZodPromise2.create = (
|
|
29942
|
+
ZodPromise2.create = (schema34, params) => {
|
|
29943
29943
|
return new ZodPromise2({
|
|
29944
|
-
type:
|
|
29944
|
+
type: schema34,
|
|
29945
29945
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
29946
29946
|
...processCreateParams(params)
|
|
29947
29947
|
});
|
|
@@ -30069,17 +30069,17 @@ var init_types = __esm({
|
|
|
30069
30069
|
util.assertNever(effect);
|
|
30070
30070
|
}
|
|
30071
30071
|
};
|
|
30072
|
-
ZodEffects.create = (
|
|
30072
|
+
ZodEffects.create = (schema34, effect, params) => {
|
|
30073
30073
|
return new ZodEffects({
|
|
30074
|
-
schema:
|
|
30074
|
+
schema: schema34,
|
|
30075
30075
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
30076
30076
|
effect,
|
|
30077
30077
|
...processCreateParams(params)
|
|
30078
30078
|
});
|
|
30079
30079
|
};
|
|
30080
|
-
ZodEffects.createWithPreprocess = (preprocess2,
|
|
30080
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema34, params) => {
|
|
30081
30081
|
return new ZodEffects({
|
|
30082
|
-
schema:
|
|
30082
|
+
schema: schema34,
|
|
30083
30083
|
effect: { type: "preprocess", transform: preprocess2 },
|
|
30084
30084
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
30085
30085
|
...processCreateParams(params)
|
|
@@ -31228,9 +31228,9 @@ function standardSchemaValidator(standardSchema) {
|
|
|
31228
31228
|
}
|
|
31229
31229
|
async function validateTypes({
|
|
31230
31230
|
value,
|
|
31231
|
-
schema:
|
|
31231
|
+
schema: schema34
|
|
31232
31232
|
}) {
|
|
31233
|
-
const result = await safeValidateTypes({ value, schema:
|
|
31233
|
+
const result = await safeValidateTypes({ value, schema: schema34 });
|
|
31234
31234
|
if (!result.success) {
|
|
31235
31235
|
throw TypeValidationError.wrap({ value, cause: result.error });
|
|
31236
31236
|
}
|
|
@@ -31238,9 +31238,9 @@ async function validateTypes({
|
|
|
31238
31238
|
}
|
|
31239
31239
|
async function safeValidateTypes({
|
|
31240
31240
|
value,
|
|
31241
|
-
schema:
|
|
31241
|
+
schema: schema34
|
|
31242
31242
|
}) {
|
|
31243
|
-
const validator22 = asValidator(
|
|
31243
|
+
const validator22 = asValidator(schema34);
|
|
31244
31244
|
try {
|
|
31245
31245
|
if (validator22.validate == null) {
|
|
31246
31246
|
return { success: true, value, rawValue: value };
|
|
@@ -31264,14 +31264,14 @@ async function safeValidateTypes({
|
|
|
31264
31264
|
}
|
|
31265
31265
|
async function parseJSON({
|
|
31266
31266
|
text: text3,
|
|
31267
|
-
schema:
|
|
31267
|
+
schema: schema34
|
|
31268
31268
|
}) {
|
|
31269
31269
|
try {
|
|
31270
31270
|
const value = secureJsonParse(text3);
|
|
31271
|
-
if (
|
|
31271
|
+
if (schema34 == null) {
|
|
31272
31272
|
return value;
|
|
31273
31273
|
}
|
|
31274
|
-
return validateTypes({ value, schema:
|
|
31274
|
+
return validateTypes({ value, schema: schema34 });
|
|
31275
31275
|
} catch (error40) {
|
|
31276
31276
|
if (JSONParseError.isInstance(error40) || TypeValidationError.isInstance(error40)) {
|
|
31277
31277
|
throw error40;
|
|
@@ -31281,14 +31281,14 @@ async function parseJSON({
|
|
|
31281
31281
|
}
|
|
31282
31282
|
async function safeParseJSON({
|
|
31283
31283
|
text: text3,
|
|
31284
|
-
schema:
|
|
31284
|
+
schema: schema34
|
|
31285
31285
|
}) {
|
|
31286
31286
|
try {
|
|
31287
31287
|
const value = secureJsonParse(text3);
|
|
31288
|
-
if (
|
|
31288
|
+
if (schema34 == null) {
|
|
31289
31289
|
return { success: true, value, rawValue: value };
|
|
31290
31290
|
}
|
|
31291
|
-
return await safeValidateTypes({ value, schema:
|
|
31291
|
+
return await safeValidateTypes({ value, schema: schema34 });
|
|
31292
31292
|
} catch (error40) {
|
|
31293
31293
|
return {
|
|
31294
31294
|
success: false,
|
|
@@ -31307,7 +31307,7 @@ function isParsableJson(input) {
|
|
|
31307
31307
|
}
|
|
31308
31308
|
function parseJsonEventStream({
|
|
31309
31309
|
stream,
|
|
31310
|
-
schema:
|
|
31310
|
+
schema: schema34
|
|
31311
31311
|
}) {
|
|
31312
31312
|
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
31313
31313
|
new TransformStream({
|
|
@@ -31315,7 +31315,7 @@ function parseJsonEventStream({
|
|
|
31315
31315
|
if (data === "[DONE]") {
|
|
31316
31316
|
return;
|
|
31317
31317
|
}
|
|
31318
|
-
controller.enqueue(await safeParseJSON({ text: data, schema:
|
|
31318
|
+
controller.enqueue(await safeParseJSON({ text: data, schema: schema34 }));
|
|
31319
31319
|
}
|
|
31320
31320
|
})
|
|
31321
31321
|
);
|
|
@@ -31323,14 +31323,14 @@ function parseJsonEventStream({
|
|
|
31323
31323
|
async function parseProviderOptions({
|
|
31324
31324
|
provider,
|
|
31325
31325
|
providerOptions,
|
|
31326
|
-
schema:
|
|
31326
|
+
schema: schema34
|
|
31327
31327
|
}) {
|
|
31328
31328
|
if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
|
|
31329
31329
|
return void 0;
|
|
31330
31330
|
}
|
|
31331
31331
|
const parsedProviderOptions = await safeValidateTypes({
|
|
31332
31332
|
value: providerOptions[provider],
|
|
31333
|
-
schema:
|
|
31333
|
+
schema: schema34
|
|
31334
31334
|
});
|
|
31335
31335
|
if (!parsedProviderOptions.success) {
|
|
31336
31336
|
throw new InvalidArgumentError({
|
|
@@ -31472,12 +31472,12 @@ async function readResponseBodyAsText({
|
|
|
31472
31472
|
);
|
|
31473
31473
|
}
|
|
31474
31474
|
function lazySchema(createSchema) {
|
|
31475
|
-
let
|
|
31475
|
+
let schema34;
|
|
31476
31476
|
return () => {
|
|
31477
|
-
if (
|
|
31478
|
-
|
|
31477
|
+
if (schema34 == null) {
|
|
31478
|
+
schema34 = createSchema();
|
|
31479
31479
|
}
|
|
31480
|
-
return
|
|
31480
|
+
return schema34;
|
|
31481
31481
|
};
|
|
31482
31482
|
}
|
|
31483
31483
|
function jsonSchema(jsonSchema2, {
|
|
@@ -31635,13 +31635,13 @@ function parseIntersectionDef(def, refs3) {
|
|
|
31635
31635
|
})
|
|
31636
31636
|
].filter((x) => !!x);
|
|
31637
31637
|
const mergedAllOf = [];
|
|
31638
|
-
allOf.forEach((
|
|
31639
|
-
if (isJsonSchema7AllOfType(
|
|
31640
|
-
mergedAllOf.push(...
|
|
31638
|
+
allOf.forEach((schema34) => {
|
|
31639
|
+
if (isJsonSchema7AllOfType(schema34)) {
|
|
31640
|
+
mergedAllOf.push(...schema34.allOf);
|
|
31641
31641
|
} else {
|
|
31642
|
-
let nestedSchema =
|
|
31643
|
-
if ("additionalProperties" in
|
|
31644
|
-
const { additionalProperties, ...rest } =
|
|
31642
|
+
let nestedSchema = schema34;
|
|
31643
|
+
if ("additionalProperties" in schema34 && schema34.additionalProperties === false) {
|
|
31644
|
+
const { additionalProperties, ...rest } = schema34;
|
|
31645
31645
|
nestedSchema = rest;
|
|
31646
31646
|
}
|
|
31647
31647
|
mergedAllOf.push(nestedSchema);
|
|
@@ -31819,44 +31819,44 @@ function escapeNonAlphaNumeric(source) {
|
|
|
31819
31819
|
}
|
|
31820
31820
|
return result;
|
|
31821
31821
|
}
|
|
31822
|
-
function addFormat(
|
|
31822
|
+
function addFormat(schema34, value, message, refs3) {
|
|
31823
31823
|
var _a27;
|
|
31824
|
-
if (
|
|
31825
|
-
if (!
|
|
31826
|
-
|
|
31824
|
+
if (schema34.format || ((_a27 = schema34.anyOf) == null ? void 0 : _a27.some((x) => x.format))) {
|
|
31825
|
+
if (!schema34.anyOf) {
|
|
31826
|
+
schema34.anyOf = [];
|
|
31827
31827
|
}
|
|
31828
|
-
if (
|
|
31829
|
-
|
|
31830
|
-
format:
|
|
31828
|
+
if (schema34.format) {
|
|
31829
|
+
schema34.anyOf.push({
|
|
31830
|
+
format: schema34.format
|
|
31831
31831
|
});
|
|
31832
|
-
delete
|
|
31832
|
+
delete schema34.format;
|
|
31833
31833
|
}
|
|
31834
|
-
|
|
31834
|
+
schema34.anyOf.push({
|
|
31835
31835
|
format: value,
|
|
31836
31836
|
...message && refs3.errorMessages && { errorMessage: { format: message } }
|
|
31837
31837
|
});
|
|
31838
31838
|
} else {
|
|
31839
|
-
|
|
31839
|
+
schema34.format = value;
|
|
31840
31840
|
}
|
|
31841
31841
|
}
|
|
31842
|
-
function addPattern(
|
|
31842
|
+
function addPattern(schema34, regex, message, refs3) {
|
|
31843
31843
|
var _a27;
|
|
31844
|
-
if (
|
|
31845
|
-
if (!
|
|
31846
|
-
|
|
31844
|
+
if (schema34.pattern || ((_a27 = schema34.allOf) == null ? void 0 : _a27.some((x) => x.pattern))) {
|
|
31845
|
+
if (!schema34.allOf) {
|
|
31846
|
+
schema34.allOf = [];
|
|
31847
31847
|
}
|
|
31848
|
-
if (
|
|
31849
|
-
|
|
31850
|
-
pattern:
|
|
31848
|
+
if (schema34.pattern) {
|
|
31849
|
+
schema34.allOf.push({
|
|
31850
|
+
pattern: schema34.pattern
|
|
31851
31851
|
});
|
|
31852
|
-
delete
|
|
31852
|
+
delete schema34.pattern;
|
|
31853
31853
|
}
|
|
31854
|
-
|
|
31854
|
+
schema34.allOf.push({
|
|
31855
31855
|
pattern: stringifyRegExpWithFlags(regex, refs3),
|
|
31856
31856
|
...message && refs3.errorMessages && { errorMessage: { pattern: message } }
|
|
31857
31857
|
});
|
|
31858
31858
|
} else {
|
|
31859
|
-
|
|
31859
|
+
schema34.pattern = stringifyRegExpWithFlags(regex, refs3);
|
|
31860
31860
|
}
|
|
31861
31861
|
}
|
|
31862
31862
|
function stringifyRegExpWithFlags(regex, refs3) {
|
|
@@ -31943,7 +31943,7 @@ function stringifyRegExpWithFlags(regex, refs3) {
|
|
|
31943
31943
|
}
|
|
31944
31944
|
function parseRecordDef(def, refs3) {
|
|
31945
31945
|
var _a27, _b24, _c, _d, _e, _f;
|
|
31946
|
-
const
|
|
31946
|
+
const schema34 = {
|
|
31947
31947
|
type: "object",
|
|
31948
31948
|
additionalProperties: (_a27 = parseDef(def.valueType._def, {
|
|
31949
31949
|
...refs3,
|
|
@@ -31953,12 +31953,12 @@ function parseRecordDef(def, refs3) {
|
|
|
31953
31953
|
if (((_b24 = def.keyType) == null ? void 0 : _b24._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
31954
31954
|
const { type, ...keyType } = parseStringDef(def.keyType._def, refs3);
|
|
31955
31955
|
return {
|
|
31956
|
-
...
|
|
31956
|
+
...schema34,
|
|
31957
31957
|
propertyNames: keyType
|
|
31958
31958
|
};
|
|
31959
31959
|
} else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
|
|
31960
31960
|
return {
|
|
31961
|
-
...
|
|
31961
|
+
...schema34,
|
|
31962
31962
|
propertyNames: {
|
|
31963
31963
|
enum: def.keyType._def.values
|
|
31964
31964
|
}
|
|
@@ -31969,11 +31969,11 @@ function parseRecordDef(def, refs3) {
|
|
|
31969
31969
|
refs3
|
|
31970
31970
|
);
|
|
31971
31971
|
return {
|
|
31972
|
-
...
|
|
31972
|
+
...schema34,
|
|
31973
31973
|
propertyNames: keyType
|
|
31974
31974
|
};
|
|
31975
31975
|
}
|
|
31976
|
-
return
|
|
31976
|
+
return schema34;
|
|
31977
31977
|
}
|
|
31978
31978
|
function parseMapDef(def, refs3) {
|
|
31979
31979
|
if (refs3.mapStrategy === "record") {
|
|
@@ -32181,9 +32181,9 @@ function decideAdditionalProperties(def, refs3) {
|
|
|
32181
32181
|
return refs3.removeAdditionalStrategy === "strict" ? refs3.allowedAdditionalProperties : refs3.rejectedAdditionalProperties;
|
|
32182
32182
|
}
|
|
32183
32183
|
}
|
|
32184
|
-
function safeIsOptional(
|
|
32184
|
+
function safeIsOptional(schema34) {
|
|
32185
32185
|
try {
|
|
32186
|
-
return
|
|
32186
|
+
return schema34.isOptional();
|
|
32187
32187
|
} catch (e) {
|
|
32188
32188
|
return true;
|
|
32189
32189
|
}
|
|
@@ -32196,18 +32196,18 @@ function parseSetDef(def, refs3) {
|
|
|
32196
32196
|
...refs3,
|
|
32197
32197
|
currentPath: [...refs3.currentPath, "items"]
|
|
32198
32198
|
});
|
|
32199
|
-
const
|
|
32199
|
+
const schema34 = {
|
|
32200
32200
|
type: "array",
|
|
32201
32201
|
uniqueItems: true,
|
|
32202
32202
|
items
|
|
32203
32203
|
};
|
|
32204
32204
|
if (def.minSize) {
|
|
32205
|
-
|
|
32205
|
+
schema34.minItems = def.minSize.value;
|
|
32206
32206
|
}
|
|
32207
32207
|
if (def.maxSize) {
|
|
32208
|
-
|
|
32208
|
+
schema34.maxItems = def.maxSize.value;
|
|
32209
32209
|
}
|
|
32210
|
-
return
|
|
32210
|
+
return schema34;
|
|
32211
32211
|
}
|
|
32212
32212
|
function parseTupleDef(def, refs3) {
|
|
32213
32213
|
if (def.rest) {
|
|
@@ -32338,11 +32338,11 @@ function zodSchema(zodSchema2, options) {
|
|
|
32338
32338
|
function isSchema(value) {
|
|
32339
32339
|
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
|
|
32340
32340
|
}
|
|
32341
|
-
function asSchema(
|
|
32342
|
-
return
|
|
32341
|
+
function asSchema(schema34) {
|
|
32342
|
+
return schema34 == null ? jsonSchema({
|
|
32343
32343
|
properties: {},
|
|
32344
32344
|
additionalProperties: false
|
|
32345
|
-
}) : isSchema(
|
|
32345
|
+
}) : isSchema(schema34) ? schema34 : typeof schema34 === "function" ? schema34() : zodSchema(schema34);
|
|
32346
32346
|
}
|
|
32347
32347
|
function convertBase64ToUint8Array(base64String) {
|
|
32348
32348
|
const base64Url = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -33118,7 +33118,7 @@ var init_dist4 = __esm({
|
|
|
33118
33118
|
)
|
|
33119
33119
|
};
|
|
33120
33120
|
};
|
|
33121
|
-
zodToJsonSchema = (
|
|
33121
|
+
zodToJsonSchema = (schema34, options) => {
|
|
33122
33122
|
var _a27;
|
|
33123
33123
|
const refs3 = getRefs(options);
|
|
33124
33124
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
@@ -33140,7 +33140,7 @@ var init_dist4 = __esm({
|
|
|
33140
33140
|
) : void 0;
|
|
33141
33141
|
const name26 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
33142
33142
|
const main2 = (_a27 = parseDef(
|
|
33143
|
-
|
|
33143
|
+
schema34._def,
|
|
33144
33144
|
name26 === void 0 ? refs3 : {
|
|
33145
33145
|
...refs3,
|
|
33146
33146
|
currentPath: [...refs3.basePath, refs3.definitionPath, name26]
|
|
@@ -37167,8 +37167,8 @@ async function doParseToolCall({
|
|
|
37167
37167
|
availableTools: Object.keys(tools)
|
|
37168
37168
|
});
|
|
37169
37169
|
}
|
|
37170
|
-
const
|
|
37171
|
-
const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema:
|
|
37170
|
+
const schema34 = asSchema(tool2.inputSchema);
|
|
37171
|
+
const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema: schema34 }) : await safeParseJSON({ text: toolCall.input, schema: schema34 });
|
|
37172
37172
|
if (parseResult.success === false) {
|
|
37173
37173
|
throw new InvalidToolInputError({
|
|
37174
37174
|
toolName,
|
|
@@ -41879,12 +41879,12 @@ var init_dist6 = __esm({
|
|
|
41879
41879
|
object2 = ({
|
|
41880
41880
|
schema: inputSchema
|
|
41881
41881
|
}) => {
|
|
41882
|
-
const
|
|
41882
|
+
const schema34 = asSchema(inputSchema);
|
|
41883
41883
|
return {
|
|
41884
41884
|
type: "object",
|
|
41885
41885
|
responseFormat: {
|
|
41886
41886
|
type: "json",
|
|
41887
|
-
schema:
|
|
41887
|
+
schema: schema34.jsonSchema
|
|
41888
41888
|
},
|
|
41889
41889
|
async parsePartial({ text: text22 }) {
|
|
41890
41890
|
const result = await parsePartialJson(text22);
|
|
@@ -41918,7 +41918,7 @@ var init_dist6 = __esm({
|
|
|
41918
41918
|
}
|
|
41919
41919
|
const validationResult = await safeValidateTypes({
|
|
41920
41920
|
value: parseResult.value,
|
|
41921
|
-
schema:
|
|
41921
|
+
schema: schema34
|
|
41922
41922
|
});
|
|
41923
41923
|
if (!validationResult.success) {
|
|
41924
41924
|
throw new NoObjectGeneratedError({
|
|
@@ -47788,9 +47788,9 @@ function standardSchemaValidator2(standardSchema) {
|
|
|
47788
47788
|
}
|
|
47789
47789
|
async function validateTypes2({
|
|
47790
47790
|
value,
|
|
47791
|
-
schema:
|
|
47791
|
+
schema: schema34
|
|
47792
47792
|
}) {
|
|
47793
|
-
const result = await safeValidateTypes2({ value, schema:
|
|
47793
|
+
const result = await safeValidateTypes2({ value, schema: schema34 });
|
|
47794
47794
|
if (!result.success) {
|
|
47795
47795
|
throw TypeValidationError2.wrap({ value, cause: result.error });
|
|
47796
47796
|
}
|
|
@@ -47798,9 +47798,9 @@ async function validateTypes2({
|
|
|
47798
47798
|
}
|
|
47799
47799
|
async function safeValidateTypes2({
|
|
47800
47800
|
value,
|
|
47801
|
-
schema:
|
|
47801
|
+
schema: schema34
|
|
47802
47802
|
}) {
|
|
47803
|
-
const validator22 = asValidator2(
|
|
47803
|
+
const validator22 = asValidator2(schema34);
|
|
47804
47804
|
try {
|
|
47805
47805
|
if (validator22.validate == null) {
|
|
47806
47806
|
return { success: true, value, rawValue: value };
|
|
@@ -47824,14 +47824,14 @@ async function safeValidateTypes2({
|
|
|
47824
47824
|
}
|
|
47825
47825
|
async function parseJSON2({
|
|
47826
47826
|
text: text3,
|
|
47827
|
-
schema:
|
|
47827
|
+
schema: schema34
|
|
47828
47828
|
}) {
|
|
47829
47829
|
try {
|
|
47830
47830
|
const value = secureJsonParse2(text3);
|
|
47831
|
-
if (
|
|
47831
|
+
if (schema34 == null) {
|
|
47832
47832
|
return value;
|
|
47833
47833
|
}
|
|
47834
|
-
return validateTypes2({ value, schema:
|
|
47834
|
+
return validateTypes2({ value, schema: schema34 });
|
|
47835
47835
|
} catch (error40) {
|
|
47836
47836
|
if (JSONParseError2.isInstance(error40) || TypeValidationError2.isInstance(error40)) {
|
|
47837
47837
|
throw error40;
|
|
@@ -47841,14 +47841,14 @@ async function parseJSON2({
|
|
|
47841
47841
|
}
|
|
47842
47842
|
async function safeParseJSON2({
|
|
47843
47843
|
text: text3,
|
|
47844
|
-
schema:
|
|
47844
|
+
schema: schema34
|
|
47845
47845
|
}) {
|
|
47846
47846
|
try {
|
|
47847
47847
|
const value = secureJsonParse2(text3);
|
|
47848
|
-
if (
|
|
47848
|
+
if (schema34 == null) {
|
|
47849
47849
|
return { success: true, value, rawValue: value };
|
|
47850
47850
|
}
|
|
47851
|
-
return await safeValidateTypes2({ value, schema:
|
|
47851
|
+
return await safeValidateTypes2({ value, schema: schema34 });
|
|
47852
47852
|
} catch (error40) {
|
|
47853
47853
|
return {
|
|
47854
47854
|
success: false,
|
|
@@ -47867,7 +47867,7 @@ function isParsableJson2(input) {
|
|
|
47867
47867
|
}
|
|
47868
47868
|
function parseJsonEventStream2({
|
|
47869
47869
|
stream,
|
|
47870
|
-
schema:
|
|
47870
|
+
schema: schema34
|
|
47871
47871
|
}) {
|
|
47872
47872
|
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
47873
47873
|
new TransformStream({
|
|
@@ -47875,7 +47875,7 @@ function parseJsonEventStream2({
|
|
|
47875
47875
|
if (data === "[DONE]") {
|
|
47876
47876
|
return;
|
|
47877
47877
|
}
|
|
47878
|
-
controller.enqueue(await safeParseJSON2({ text: data, schema:
|
|
47878
|
+
controller.enqueue(await safeParseJSON2({ text: data, schema: schema34 }));
|
|
47879
47879
|
}
|
|
47880
47880
|
})
|
|
47881
47881
|
);
|
|
@@ -47883,14 +47883,14 @@ function parseJsonEventStream2({
|
|
|
47883
47883
|
async function parseProviderOptions2({
|
|
47884
47884
|
provider,
|
|
47885
47885
|
providerOptions,
|
|
47886
|
-
schema:
|
|
47886
|
+
schema: schema34
|
|
47887
47887
|
}) {
|
|
47888
47888
|
if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
|
|
47889
47889
|
return void 0;
|
|
47890
47890
|
}
|
|
47891
47891
|
const parsedProviderOptions = await safeValidateTypes2({
|
|
47892
47892
|
value: providerOptions[provider],
|
|
47893
|
-
schema:
|
|
47893
|
+
schema: schema34
|
|
47894
47894
|
});
|
|
47895
47895
|
if (!parsedProviderOptions.success) {
|
|
47896
47896
|
throw new InvalidArgumentError3({
|
|
@@ -50500,8 +50500,8 @@ function mapAnthropicStopReason({
|
|
|
50500
50500
|
return "unknown";
|
|
50501
50501
|
}
|
|
50502
50502
|
}
|
|
50503
|
-
function sanitizeJsonSchema(
|
|
50504
|
-
return sanitizeSchema(
|
|
50503
|
+
function sanitizeJsonSchema(schema34) {
|
|
50504
|
+
return sanitizeSchema(schema34);
|
|
50505
50505
|
}
|
|
50506
50506
|
function sanitizeDefinition(definition) {
|
|
50507
50507
|
if (typeof definition === "boolean" || !isPlainObject2(definition)) {
|
|
@@ -50509,47 +50509,47 @@ function sanitizeDefinition(definition) {
|
|
|
50509
50509
|
}
|
|
50510
50510
|
return sanitizeSchema(definition);
|
|
50511
50511
|
}
|
|
50512
|
-
function sanitizeSchema(
|
|
50512
|
+
function sanitizeSchema(schema34) {
|
|
50513
50513
|
const result = {};
|
|
50514
|
-
const schemaWithDefs =
|
|
50515
|
-
if (
|
|
50516
|
-
return { $ref:
|
|
50514
|
+
const schemaWithDefs = schema34;
|
|
50515
|
+
if (schema34.$ref != null) {
|
|
50516
|
+
return { $ref: schema34.$ref };
|
|
50517
50517
|
}
|
|
50518
|
-
if (
|
|
50519
|
-
result.$schema =
|
|
50518
|
+
if (schema34.$schema != null) {
|
|
50519
|
+
result.$schema = schema34.$schema;
|
|
50520
50520
|
}
|
|
50521
|
-
if (
|
|
50522
|
-
result.$id =
|
|
50521
|
+
if (schema34.$id != null) {
|
|
50522
|
+
result.$id = schema34.$id;
|
|
50523
50523
|
}
|
|
50524
|
-
if (
|
|
50525
|
-
result.title =
|
|
50524
|
+
if (schema34.title != null) {
|
|
50525
|
+
result.title = schema34.title;
|
|
50526
50526
|
}
|
|
50527
|
-
if (
|
|
50528
|
-
result.description =
|
|
50527
|
+
if (schema34.description != null) {
|
|
50528
|
+
result.description = schema34.description;
|
|
50529
50529
|
}
|
|
50530
|
-
if (
|
|
50531
|
-
result.default =
|
|
50530
|
+
if (schema34.default !== void 0) {
|
|
50531
|
+
result.default = schema34.default;
|
|
50532
50532
|
}
|
|
50533
|
-
if (
|
|
50534
|
-
result.const =
|
|
50533
|
+
if (schema34.const !== void 0) {
|
|
50534
|
+
result.const = schema34.const;
|
|
50535
50535
|
}
|
|
50536
|
-
if (
|
|
50537
|
-
result.enum =
|
|
50536
|
+
if (schema34.enum != null) {
|
|
50537
|
+
result.enum = schema34.enum;
|
|
50538
50538
|
}
|
|
50539
|
-
if (
|
|
50540
|
-
result.type =
|
|
50539
|
+
if (schema34.type != null) {
|
|
50540
|
+
result.type = schema34.type;
|
|
50541
50541
|
}
|
|
50542
|
-
if (
|
|
50543
|
-
result.anyOf =
|
|
50544
|
-
} else if (
|
|
50545
|
-
result.anyOf =
|
|
50542
|
+
if (schema34.anyOf != null) {
|
|
50543
|
+
result.anyOf = schema34.anyOf.map(sanitizeDefinition);
|
|
50544
|
+
} else if (schema34.oneOf != null) {
|
|
50545
|
+
result.anyOf = schema34.oneOf.map(sanitizeDefinition);
|
|
50546
50546
|
}
|
|
50547
|
-
if (
|
|
50548
|
-
result.allOf =
|
|
50547
|
+
if (schema34.allOf != null) {
|
|
50548
|
+
result.allOf = schema34.allOf.map(sanitizeDefinition);
|
|
50549
50549
|
}
|
|
50550
|
-
if (
|
|
50550
|
+
if (schema34.definitions != null) {
|
|
50551
50551
|
result.definitions = Object.fromEntries(
|
|
50552
|
-
Object.entries(
|
|
50552
|
+
Object.entries(schema34.definitions).map(([name19, definition]) => [
|
|
50553
50553
|
name19,
|
|
50554
50554
|
sanitizeDefinition(definition)
|
|
50555
50555
|
])
|
|
@@ -50564,43 +50564,43 @@ function sanitizeSchema(schema32) {
|
|
|
50564
50564
|
])
|
|
50565
50565
|
);
|
|
50566
50566
|
}
|
|
50567
|
-
if (
|
|
50568
|
-
if (
|
|
50567
|
+
if (schema34.type === "object" || schema34.properties != null) {
|
|
50568
|
+
if (schema34.properties != null) {
|
|
50569
50569
|
result.properties = Object.fromEntries(
|
|
50570
|
-
Object.entries(
|
|
50570
|
+
Object.entries(schema34.properties).map(([name19, definition]) => [
|
|
50571
50571
|
name19,
|
|
50572
50572
|
sanitizeDefinition(definition)
|
|
50573
50573
|
])
|
|
50574
50574
|
);
|
|
50575
50575
|
}
|
|
50576
50576
|
result.additionalProperties = false;
|
|
50577
|
-
if (
|
|
50578
|
-
result.required =
|
|
50577
|
+
if (schema34.required != null) {
|
|
50578
|
+
result.required = schema34.required;
|
|
50579
50579
|
}
|
|
50580
50580
|
}
|
|
50581
|
-
if (
|
|
50582
|
-
result.items = Array.isArray(
|
|
50581
|
+
if (schema34.items != null) {
|
|
50582
|
+
result.items = Array.isArray(schema34.items) ? schema34.items.map(sanitizeDefinition) : sanitizeDefinition(schema34.items);
|
|
50583
50583
|
}
|
|
50584
|
-
if (typeof
|
|
50585
|
-
result.format =
|
|
50584
|
+
if (typeof schema34.format === "string" && SUPPORTED_STRING_FORMATS.has(schema34.format)) {
|
|
50585
|
+
result.format = schema34.format;
|
|
50586
50586
|
}
|
|
50587
|
-
const constraintDescription = getConstraintDescription(
|
|
50587
|
+
const constraintDescription = getConstraintDescription(schema34);
|
|
50588
50588
|
if (constraintDescription != null) {
|
|
50589
50589
|
result.description = result.description == null ? constraintDescription : `${result.description}
|
|
50590
50590
|
${constraintDescription}`;
|
|
50591
50591
|
}
|
|
50592
50592
|
return result;
|
|
50593
50593
|
}
|
|
50594
|
-
function getConstraintDescription(
|
|
50594
|
+
function getConstraintDescription(schema34) {
|
|
50595
50595
|
const descriptions = DESCRIPTION_CONSTRAINT_KEYS.flatMap((key2) => {
|
|
50596
|
-
const value =
|
|
50596
|
+
const value = schema34[key2];
|
|
50597
50597
|
if (value == null || value === false) {
|
|
50598
50598
|
return [];
|
|
50599
50599
|
}
|
|
50600
50600
|
return `${formatConstraintName(key2)}: ${formatConstraintValue(value)}`;
|
|
50601
50601
|
});
|
|
50602
|
-
if (typeof
|
|
50603
|
-
descriptions.push(`format: ${
|
|
50602
|
+
if (typeof schema34.format === "string" && !SUPPORTED_STRING_FORMATS.has(schema34.format)) {
|
|
50603
|
+
descriptions.push(`format: ${schema34.format}`);
|
|
50604
50604
|
}
|
|
50605
50605
|
return descriptions.length === 0 ? void 0 : `${descriptions.join("; ")}.`;
|
|
50606
50606
|
}
|
|
@@ -54039,10 +54039,10 @@ function convertJSONSchemaDefinition(jsonSchema2, isRoot, referenceContext) {
|
|
|
54039
54039
|
}
|
|
54040
54040
|
if (anyOf) {
|
|
54041
54041
|
if (anyOf.some(
|
|
54042
|
-
(
|
|
54042
|
+
(schema34) => typeof schema34 === "object" && (schema34 == null ? void 0 : schema34.type) === "null"
|
|
54043
54043
|
)) {
|
|
54044
54044
|
const nonNullSchemas = anyOf.filter(
|
|
54045
|
-
(
|
|
54045
|
+
(schema34) => !(typeof schema34 === "object" && (schema34 == null ? void 0 : schema34.type) === "null")
|
|
54046
54046
|
);
|
|
54047
54047
|
if (nonNullSchemas.length === 1) {
|
|
54048
54048
|
const converted = convertJSONSchemaDefinition(
|
|
@@ -56291,12 +56291,6 @@ function resolveProviderConfig(settings2) {
|
|
|
56291
56291
|
const model = settings2.active_model ?? preset.defaultModel;
|
|
56292
56292
|
return { ready: true, provider: preset, model, apiKey };
|
|
56293
56293
|
}
|
|
56294
|
-
function resolveModelContextWindow(models, model) {
|
|
56295
|
-
if (!models || !model)
|
|
56296
|
-
return null;
|
|
56297
|
-
const entry = models.find((m) => m.id === model || m.id.toLowerCase() === model.toLowerCase());
|
|
56298
|
-
return entry?.contextWindow ?? null;
|
|
56299
|
-
}
|
|
56300
56294
|
var PROVIDER_PRESETS;
|
|
56301
56295
|
var init_llm_presets = __esm({
|
|
56302
56296
|
"src/main/services/agent/llm-presets.ts"() {
|
|
@@ -56770,6 +56764,276 @@ var init_custom_provider_service = __esm({
|
|
|
56770
56764
|
}
|
|
56771
56765
|
});
|
|
56772
56766
|
|
|
56767
|
+
// src/main/services/agent/model-overlay.ts
|
|
56768
|
+
function parseOverlay(raw) {
|
|
56769
|
+
if (!raw)
|
|
56770
|
+
return {};
|
|
56771
|
+
try {
|
|
56772
|
+
return normalizeOverlay(JSON.parse(raw));
|
|
56773
|
+
} catch {
|
|
56774
|
+
return {};
|
|
56775
|
+
}
|
|
56776
|
+
}
|
|
56777
|
+
function normalizeOverlay(input) {
|
|
56778
|
+
const known = new Set(PROVIDER_PRESETS.map((p) => p.id));
|
|
56779
|
+
const out = {};
|
|
56780
|
+
if (!input || typeof input !== "object")
|
|
56781
|
+
return out;
|
|
56782
|
+
for (const [presetId, entry] of Object.entries(input)) {
|
|
56783
|
+
if (!known.has(presetId))
|
|
56784
|
+
continue;
|
|
56785
|
+
if (!entry || typeof entry !== "object")
|
|
56786
|
+
continue;
|
|
56787
|
+
const e = entry;
|
|
56788
|
+
const added = normalizeOverlayModels(e.added);
|
|
56789
|
+
if (added.length === 0)
|
|
56790
|
+
continue;
|
|
56791
|
+
out[presetId] = {
|
|
56792
|
+
added,
|
|
56793
|
+
...typeof e.fetchedAt === "string" && e.fetchedAt ? { fetchedAt: e.fetchedAt } : {}
|
|
56794
|
+
};
|
|
56795
|
+
}
|
|
56796
|
+
return out;
|
|
56797
|
+
}
|
|
56798
|
+
function normalizeOverlayModels(input) {
|
|
56799
|
+
if (!Array.isArray(input))
|
|
56800
|
+
return [];
|
|
56801
|
+
const out = [];
|
|
56802
|
+
for (const item of input.slice(0, 200)) {
|
|
56803
|
+
if (!item || typeof item !== "object")
|
|
56804
|
+
continue;
|
|
56805
|
+
const m = item;
|
|
56806
|
+
if (typeof m.id !== "string" || !m.id.trim())
|
|
56807
|
+
continue;
|
|
56808
|
+
const id = m.id.trim().slice(0, 200);
|
|
56809
|
+
const label = typeof m.label === "string" && m.label.trim() ? m.label.trim().slice(0, 200) : id;
|
|
56810
|
+
const contextWindow = typeof m.contextWindow === "number" && Number.isFinite(m.contextWindow) ? Math.max(0, Math.round(m.contextWindow)) : null;
|
|
56811
|
+
const capabilities = Array.isArray(m.capabilities) ? m.capabilities.filter((c) => typeof c === "string" && /^[a-z-]{1,24}$/.test(c)).slice(0, 12) : void 0;
|
|
56812
|
+
const pricingRaw = m.pricing;
|
|
56813
|
+
const pricing = pricingRaw && typeof pricingRaw === "object" && (typeof pricingRaw.input === "number" || typeof pricingRaw.output === "number") ? {
|
|
56814
|
+
input: typeof pricingRaw.input === "number" && Number.isFinite(pricingRaw.input) ? pricingRaw.input : null,
|
|
56815
|
+
output: typeof pricingRaw.output === "number" && Number.isFinite(pricingRaw.output) ? pricingRaw.output : null
|
|
56816
|
+
} : void 0;
|
|
56817
|
+
out.push({
|
|
56818
|
+
id,
|
|
56819
|
+
label,
|
|
56820
|
+
contextWindow,
|
|
56821
|
+
...capabilities && capabilities.length > 0 ? { capabilities } : {},
|
|
56822
|
+
...pricing !== void 0 ? { pricing } : {},
|
|
56823
|
+
...m.reasoning === true ? { reasoning: true } : {},
|
|
56824
|
+
...m.free === true ? { free: true } : {},
|
|
56825
|
+
...typeof m.status === "string" && m.status ? { status: m.status.slice(0, 24) } : {}
|
|
56826
|
+
});
|
|
56827
|
+
}
|
|
56828
|
+
return out;
|
|
56829
|
+
}
|
|
56830
|
+
function getOverlay(db) {
|
|
56831
|
+
const row = db.select().from(settings).where(eq(settings.key, MODEL_OVERLAY_SETTING_KEY)).get();
|
|
56832
|
+
return parseOverlay(row?.value ?? null);
|
|
56833
|
+
}
|
|
56834
|
+
function setOverlay(db, overlay) {
|
|
56835
|
+
const normalized = normalizeOverlay(overlay);
|
|
56836
|
+
const value = JSON.stringify(normalized);
|
|
56837
|
+
db.insert(settings).values({ key: MODEL_OVERLAY_SETTING_KEY, value, isSecret: false }).onConflictDoUpdate({ target: settings.key, set: { value, isSecret: false } }).run();
|
|
56838
|
+
}
|
|
56839
|
+
function mergePresetModelList(preset, overlayEntry) {
|
|
56840
|
+
const merged = [...preset.models];
|
|
56841
|
+
const seen = new Set(preset.models.map((m) => m.id.toLowerCase()));
|
|
56842
|
+
for (const m of overlayEntry?.added ?? []) {
|
|
56843
|
+
const key2 = m.id.toLowerCase();
|
|
56844
|
+
if (seen.has(key2))
|
|
56845
|
+
continue;
|
|
56846
|
+
seen.add(key2);
|
|
56847
|
+
merged.push({
|
|
56848
|
+
id: m.id,
|
|
56849
|
+
label: m.label,
|
|
56850
|
+
contextWindow: m.contextWindow,
|
|
56851
|
+
...m.capabilities ? { capabilities: m.capabilities } : {},
|
|
56852
|
+
...m.pricing ? { pricing: m.pricing } : {},
|
|
56853
|
+
...m.free !== void 0 ? { free: m.free } : {}
|
|
56854
|
+
});
|
|
56855
|
+
}
|
|
56856
|
+
return merged;
|
|
56857
|
+
}
|
|
56858
|
+
var MODEL_OVERLAY_SETTING_KEY;
|
|
56859
|
+
var init_model_overlay = __esm({
|
|
56860
|
+
"src/main/services/agent/model-overlay.ts"() {
|
|
56861
|
+
"use strict";
|
|
56862
|
+
init_drizzle_orm();
|
|
56863
|
+
init_schema();
|
|
56864
|
+
init_schema();
|
|
56865
|
+
init_llm_presets();
|
|
56866
|
+
MODEL_OVERLAY_SETTING_KEY = "model_overlay_json";
|
|
56867
|
+
}
|
|
56868
|
+
});
|
|
56869
|
+
|
|
56870
|
+
// src/main/services/agent/model-catalog.ts
|
|
56871
|
+
function loadSnapshotCatalog() {
|
|
56872
|
+
if (snapshotCache !== void 0)
|
|
56873
|
+
return snapshotCache;
|
|
56874
|
+
const fileName = "model-catalog.json";
|
|
56875
|
+
const candidates = [
|
|
56876
|
+
(0, import_node_path4.join)(__dirname, fileName),
|
|
56877
|
+
(0, import_node_path4.join)(__dirname, "..", "..", "assets", fileName),
|
|
56878
|
+
(0, import_node_path4.join)(__dirname, "..", "..", "src", "main", "assets", fileName),
|
|
56879
|
+
(0, import_node_path4.join)(__dirname, "assets", fileName)
|
|
56880
|
+
];
|
|
56881
|
+
let lastErr = null;
|
|
56882
|
+
for (const p of candidates) {
|
|
56883
|
+
try {
|
|
56884
|
+
const parsed = coerceCatalog(JSON.parse((0, import_node_fs4.readFileSync)(p, "utf8")));
|
|
56885
|
+
if (parsed) {
|
|
56886
|
+
snapshotCache = parsed;
|
|
56887
|
+
return parsed;
|
|
56888
|
+
}
|
|
56889
|
+
} catch (e) {
|
|
56890
|
+
lastErr = e;
|
|
56891
|
+
}
|
|
56892
|
+
}
|
|
56893
|
+
try {
|
|
56894
|
+
const here = (0, import_node_path4.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
56895
|
+
const parsed = coerceCatalog(
|
|
56896
|
+
JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path4.join)(here, "..", "..", "assets", fileName), "utf8"))
|
|
56897
|
+
);
|
|
56898
|
+
if (parsed) {
|
|
56899
|
+
snapshotCache = parsed;
|
|
56900
|
+
return parsed;
|
|
56901
|
+
}
|
|
56902
|
+
} catch {
|
|
56903
|
+
}
|
|
56904
|
+
console.warn(`[model-catalog] \u5FEB\u7167\u672A\u627E\u5230\u6216\u4E0D\u53EF\u89E3\u6790(\u5019\u9009: ${candidates.join("; ")}) \u2014 \u4EE5\u7A7A\u76EE\u5F55\u8FD0\u884C\u3002lastErr=${String(lastErr)}`);
|
|
56905
|
+
snapshotCache = { fetchedAt: "", providers: {} };
|
|
56906
|
+
return snapshotCache;
|
|
56907
|
+
}
|
|
56908
|
+
function coerceCatalog(v) {
|
|
56909
|
+
if (!v || typeof v !== "object")
|
|
56910
|
+
return null;
|
|
56911
|
+
const c = v;
|
|
56912
|
+
if (!c.providers || typeof c.providers !== "object")
|
|
56913
|
+
return null;
|
|
56914
|
+
return { fetchedAt: typeof c.fetchedAt === "string" ? c.fetchedAt : "", providers: c.providers };
|
|
56915
|
+
}
|
|
56916
|
+
function getActiveCatalog(db) {
|
|
56917
|
+
const snapshot = loadSnapshotCatalog();
|
|
56918
|
+
try {
|
|
56919
|
+
const row = db.select().from(settings).where(eq(settings.key, MODEL_CATALOG_CACHE_KEY)).get();
|
|
56920
|
+
if (row?.value) {
|
|
56921
|
+
const parsed = JSON.parse(row.value);
|
|
56922
|
+
const cached2 = coerceCatalog(parsed?.payload);
|
|
56923
|
+
if (cached2 && cached2.fetchedAt && (!snapshot.fetchedAt || cached2.fetchedAt > snapshot.fetchedAt)) {
|
|
56924
|
+
return cached2;
|
|
56925
|
+
}
|
|
56926
|
+
}
|
|
56927
|
+
} catch {
|
|
56928
|
+
}
|
|
56929
|
+
return snapshot;
|
|
56930
|
+
}
|
|
56931
|
+
function catalogEntryFor(catalog, presetId, modelId) {
|
|
56932
|
+
return catalog.providers[presetId]?.models[lower(modelId)] ?? null;
|
|
56933
|
+
}
|
|
56934
|
+
function catalogEntryGlobal(catalog, modelId) {
|
|
56935
|
+
const key2 = lower(modelId);
|
|
56936
|
+
for (const p of Object.values(catalog.providers)) {
|
|
56937
|
+
const hit = p.models[key2];
|
|
56938
|
+
if (hit)
|
|
56939
|
+
return hit;
|
|
56940
|
+
}
|
|
56941
|
+
return null;
|
|
56942
|
+
}
|
|
56943
|
+
function mergeModelMeta(input) {
|
|
56944
|
+
const { user, preset, catalog } = input;
|
|
56945
|
+
const contextWindow = user?.contextWindow ?? preset?.contextWindow ?? catalog?.contextWindow ?? null;
|
|
56946
|
+
const pricing = user?.pricing ?? preset?.pricing ?? catalog?.pricing ?? null;
|
|
56947
|
+
let capabilities = null;
|
|
56948
|
+
if (preset) {
|
|
56949
|
+
capabilities = preset.capabilities ?? null;
|
|
56950
|
+
} else if (user?.capabilities && user.capabilities.length > 0) {
|
|
56951
|
+
capabilities = user.capabilities;
|
|
56952
|
+
} else {
|
|
56953
|
+
const caps = ["chat"];
|
|
56954
|
+
if (catalog?.tools)
|
|
56955
|
+
caps.push("tools");
|
|
56956
|
+
if (catalog?.reasoning || user?.reasoning)
|
|
56957
|
+
caps.push("reasoning");
|
|
56958
|
+
if (catalog?.vision)
|
|
56959
|
+
caps.push("vision");
|
|
56960
|
+
capabilities = caps;
|
|
56961
|
+
}
|
|
56962
|
+
const reasoning = preset ? preset.capabilities?.includes("reasoning") ?? null : user?.reasoning ?? catalog?.reasoning ?? null;
|
|
56963
|
+
const free = preset?.free ?? user?.free ?? (pricing !== null && pricing.input === 0 && pricing.output === 0 ? true : null);
|
|
56964
|
+
const status = catalog?.status ?? user?.status ?? null;
|
|
56965
|
+
const source = user ? "user" : preset ? "preset" : catalog ? "catalog" : "none";
|
|
56966
|
+
return { contextWindow, pricing, capabilities, reasoning, free, status, source };
|
|
56967
|
+
}
|
|
56968
|
+
function resolveModelMeta(db, providerId, modelId) {
|
|
56969
|
+
if (!providerId || !modelId)
|
|
56970
|
+
return null;
|
|
56971
|
+
const catalog = getActiveCatalog(db);
|
|
56972
|
+
if (providerId.startsWith("custom-")) {
|
|
56973
|
+
const cp2 = getCustomProvider(db, providerId);
|
|
56974
|
+
const user2 = cp2 ? findByModelId(cp2.models, modelId) : null;
|
|
56975
|
+
const meta2 = mergeModelMeta({ user: user2, catalog: catalogEntryGlobal(catalog, modelId) });
|
|
56976
|
+
return meta2.source === "none" ? null : meta2;
|
|
56977
|
+
}
|
|
56978
|
+
const preset = getProviderPreset(providerId);
|
|
56979
|
+
if (!preset)
|
|
56980
|
+
return null;
|
|
56981
|
+
const curated = findByModelId(preset.models, modelId);
|
|
56982
|
+
const overlayEntry = getOverlay(db)[providerId];
|
|
56983
|
+
const user = curated ? null : overlayEntry ? findByModelId(overlayEntry.added, modelId) : null;
|
|
56984
|
+
const meta = mergeModelMeta({ user, preset: curated, catalog: catalogEntryFor(catalog, providerId, modelId) });
|
|
56985
|
+
return meta.source === "none" ? null : meta;
|
|
56986
|
+
}
|
|
56987
|
+
function effectivePresetModels(db, preset) {
|
|
56988
|
+
const catalog = getActiveCatalog(db);
|
|
56989
|
+
const overlayEntry = getOverlay(db)[preset.id];
|
|
56990
|
+
const merged = mergePresetModelList(preset, overlayEntry);
|
|
56991
|
+
return merged.map((entry) => {
|
|
56992
|
+
const curated = findByModelId(preset.models, entry.id) !== null;
|
|
56993
|
+
const user = curated ? null : overlayEntry ? findByModelId(overlayEntry.added, entry.id) : null;
|
|
56994
|
+
const meta = mergeModelMeta({
|
|
56995
|
+
user,
|
|
56996
|
+
preset: curated ? entry : null,
|
|
56997
|
+
catalog: catalogEntryFor(catalog, preset.id, entry.id)
|
|
56998
|
+
});
|
|
56999
|
+
return {
|
|
57000
|
+
id: entry.id,
|
|
57001
|
+
label: entry.label,
|
|
57002
|
+
contextWindow: meta.contextWindow,
|
|
57003
|
+
...meta.capabilities ? { capabilities: meta.capabilities } : {},
|
|
57004
|
+
...meta.pricing ? { pricing: meta.pricing } : {},
|
|
57005
|
+
...meta.reasoning !== null ? { reasoning: meta.reasoning } : {},
|
|
57006
|
+
...meta.free !== null ? { free: meta.free } : {},
|
|
57007
|
+
...meta.status ? { status: meta.status } : {}
|
|
57008
|
+
};
|
|
57009
|
+
});
|
|
57010
|
+
}
|
|
57011
|
+
function presetWithOverlay(db, preset) {
|
|
57012
|
+
const overlayEntry = getOverlay(db)[preset.id];
|
|
57013
|
+
if (!overlayEntry || overlayEntry.added.length === 0)
|
|
57014
|
+
return preset;
|
|
57015
|
+
return { ...preset, models: mergePresetModelList(preset, overlayEntry) };
|
|
57016
|
+
}
|
|
57017
|
+
var import_node_fs4, import_node_path4, import_node_url, import_meta, MODEL_CATALOG_CACHE_KEY, snapshotCache, lower, findByModelId;
|
|
57018
|
+
var init_model_catalog = __esm({
|
|
57019
|
+
"src/main/services/agent/model-catalog.ts"() {
|
|
57020
|
+
"use strict";
|
|
57021
|
+
import_node_fs4 = require("node:fs");
|
|
57022
|
+
import_node_path4 = require("node:path");
|
|
57023
|
+
import_node_url = require("node:url");
|
|
57024
|
+
init_drizzle_orm();
|
|
57025
|
+
init_schema();
|
|
57026
|
+
init_schema();
|
|
57027
|
+
init_llm_presets();
|
|
57028
|
+
init_model_overlay();
|
|
57029
|
+
init_custom_provider_service();
|
|
57030
|
+
import_meta = {};
|
|
57031
|
+
MODEL_CATALOG_CACHE_KEY = "model_catalog_cache";
|
|
57032
|
+
lower = (s) => s.toLowerCase();
|
|
57033
|
+
findByModelId = (models, modelId) => models.find((m) => m.id === modelId || lower(m.id) === lower(modelId)) ?? null;
|
|
57034
|
+
}
|
|
57035
|
+
});
|
|
57036
|
+
|
|
56773
57037
|
// src/main/services/agent/llm-client.ts
|
|
56774
57038
|
function isOfficialOpenAiBase(baseUrl) {
|
|
56775
57039
|
try {
|
|
@@ -56790,14 +57054,7 @@ function resolveActiveContextWindow(db) {
|
|
|
56790
57054
|
const providerId = settings2.active_provider ?? "glm";
|
|
56791
57055
|
const preset = getProviderPreset(providerId);
|
|
56792
57056
|
const model = settings2.active_model ?? preset?.defaultModel ?? "";
|
|
56793
|
-
|
|
56794
|
-
return resolveModelContextWindow(preset.models, model);
|
|
56795
|
-
if (providerId.startsWith("custom-")) {
|
|
56796
|
-
const cp2 = getCustomProvider(db, providerId);
|
|
56797
|
-
if (cp2)
|
|
56798
|
-
return resolveModelContextWindow(cp2.models, model);
|
|
56799
|
-
}
|
|
56800
|
-
return null;
|
|
57057
|
+
return resolveModelMeta(db, providerId, model)?.contextWindow ?? null;
|
|
56801
57058
|
}
|
|
56802
57059
|
function buildLanguageModel(protocol, baseUrl, apiKey, model, fetchFn) {
|
|
56803
57060
|
switch (protocol) {
|
|
@@ -56872,13 +57129,14 @@ function resolveLlm(db) {
|
|
|
56872
57129
|
if (!cfg.ready || !cfg.provider || !cfg.apiKey || !cfg.model) {
|
|
56873
57130
|
throw new Error(cfg.missing ?? "LLM provider \u672A\u5C31\u7EEA");
|
|
56874
57131
|
}
|
|
57132
|
+
const provider = presetWithOverlay(db, cfg.provider);
|
|
56875
57133
|
return {
|
|
56876
|
-
provider
|
|
57134
|
+
provider,
|
|
56877
57135
|
model: cfg.model,
|
|
56878
57136
|
apiKey: cfg.apiKey,
|
|
56879
57137
|
languageModel: buildLanguageModel(
|
|
56880
|
-
|
|
56881
|
-
|
|
57138
|
+
provider.protocol,
|
|
57139
|
+
provider.baseUrl,
|
|
56882
57140
|
cfg.apiKey,
|
|
56883
57141
|
cfg.model
|
|
56884
57142
|
)
|
|
@@ -56990,7 +57248,32 @@ async function testCustomProvider(input) {
|
|
|
56990
57248
|
);
|
|
56991
57249
|
return result;
|
|
56992
57250
|
}
|
|
57251
|
+
async function testProviderById(db, providerId, modelId) {
|
|
57252
|
+
if (providerId.startsWith("custom-")) {
|
|
57253
|
+
const raw = getCustomProviderRaw(db, providerId);
|
|
57254
|
+
if (!raw) {
|
|
57255
|
+
return { ok: false, detail: `\u81EA\u5B9A\u4E49 provider \u4E0D\u5B58\u5728: ${providerId}`, errorKind: "not-configured" };
|
|
57256
|
+
}
|
|
57257
|
+
return testLlmDirect(
|
|
57258
|
+
raw.protocol,
|
|
57259
|
+
raw.baseUrl,
|
|
57260
|
+
raw.apiKey || "no-key-needed",
|
|
57261
|
+
modelId || raw.defaultModel,
|
|
57262
|
+
raw.id
|
|
57263
|
+
);
|
|
57264
|
+
}
|
|
57265
|
+
const preset = getProviderPreset(providerId);
|
|
57266
|
+
if (!preset) {
|
|
57267
|
+
return { ok: false, detail: `\u672A\u77E5 provider: ${providerId}`, errorKind: "not-configured" };
|
|
57268
|
+
}
|
|
57269
|
+
const apiKey = readSettingsMap(db)[preset.apiKeySetting] ?? null;
|
|
57270
|
+
if (!apiKey) {
|
|
57271
|
+
return { ok: false, detail: `\u672A\u914D\u7F6E API key\uFF08${preset.label}\uFF09`, errorKind: "not-configured" };
|
|
57272
|
+
}
|
|
57273
|
+
return testLlmDirect(preset.protocol, preset.baseUrl, apiKey, modelId || preset.defaultModel, preset.label);
|
|
57274
|
+
}
|
|
56993
57275
|
async function testLlmDirect(protocol, baseUrl, apiKey, model, label) {
|
|
57276
|
+
const startedAt = Date.now();
|
|
56994
57277
|
try {
|
|
56995
57278
|
const languageModel = buildLanguageModel(protocol, baseUrl, apiKey, model);
|
|
56996
57279
|
const result = await generateText({
|
|
@@ -56998,9 +57281,11 @@ async function testLlmDirect(protocol, baseUrl, apiKey, model, label) {
|
|
|
56998
57281
|
prompt: "ping"
|
|
56999
57282
|
});
|
|
57000
57283
|
const text3 = (result.text ?? "").trim().slice(0, 50);
|
|
57284
|
+
const latencyMs = Date.now() - startedAt;
|
|
57001
57285
|
return {
|
|
57002
57286
|
ok: true,
|
|
57003
|
-
|
|
57287
|
+
latencyMs,
|
|
57288
|
+
detail: `\u8FDE\u63A5\u6210\u529F\uFF08${label} \xB7 ${model}${text3 ? ` \xB7 \u56DE\u58F0: ${text3}` : ""} \xB7 ${latencyMs}ms\uFF09`
|
|
57004
57289
|
};
|
|
57005
57290
|
} catch (e) {
|
|
57006
57291
|
const classified = classifyLlmError(e);
|
|
@@ -57009,23 +57294,23 @@ async function testLlmDirect(protocol, baseUrl, apiKey, model, label) {
|
|
|
57009
57294
|
}
|
|
57010
57295
|
function classifyLlmError(e) {
|
|
57011
57296
|
const msg = e instanceof Error ? e.message : String(e);
|
|
57012
|
-
const
|
|
57013
|
-
if (/\b401\b/.test(msg) || /\b403\b/.test(msg) ||
|
|
57297
|
+
const lower2 = msg.toLowerCase();
|
|
57298
|
+
if (/\b401\b/.test(msg) || /\b403\b/.test(msg) || lower2.includes("unauthorized") || lower2.includes("invalid api key") || lower2.includes("invalid_api_key") || lower2.includes("authentication") || lower2.includes("permission_denied")) {
|
|
57014
57299
|
return {
|
|
57015
57300
|
kind: "auth",
|
|
57016
57301
|
detail: `API key \u65E0\u6548\u6216\u6743\u9650\u4E0D\u8DB3\uFF08401/403\uFF09\u3002\u8BF7\u68C0\u67E5 key \u662F\u5426\u6B63\u786E\u3001\u662F\u5426\u8FC7\u671F\u3002`
|
|
57017
57302
|
};
|
|
57018
57303
|
}
|
|
57019
|
-
if (/\b429\b/.test(msg) ||
|
|
57304
|
+
if (/\b429\b/.test(msg) || lower2.includes("rate limit") || lower2.includes("rate_limit") || lower2.includes("quota") || lower2.includes("too many requests")) {
|
|
57020
57305
|
return {
|
|
57021
57306
|
kind: "rate-limit",
|
|
57022
57307
|
detail: `\u8BF7\u6C42\u592A\u9891\u7E41\u6216\u989D\u5EA6\u7528\u5B8C\uFF08429\uFF09\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF0C\u6216\u68C0\u67E5\u8D26\u53F7\u4F59\u989D\u3002`
|
|
57023
57308
|
};
|
|
57024
57309
|
}
|
|
57025
|
-
if (
|
|
57310
|
+
if (lower2.includes("enotfound") || lower2.includes("econnrefused") || lower2.includes("etimedout") || lower2.includes("econnreset") || lower2.includes("fetch failed") || lower2.includes("network") || lower2.includes("getaddrinfo") || lower2.includes("socket hang up")) {
|
|
57026
57311
|
return {
|
|
57027
57312
|
kind: "network",
|
|
57028
|
-
detail: `\u7F51\u7EDC\u9519\u8BEF\uFF1A\u65E0\u6CD5\u8FDE\u63A5\u5230 ${
|
|
57313
|
+
detail: `\u7F51\u7EDC\u9519\u8BEF\uFF1A\u65E0\u6CD5\u8FDE\u63A5\u5230 ${lower2.includes("enotfound") ? "\uFF08DNS \u89E3\u6790\u5931\u8D25\uFF0C\u68C0\u67E5\u7F51\u7EDC/\u4EE3\u7406\uFF09" : "\u670D\u52A1\u7AEF"}\u3002`
|
|
57029
57314
|
};
|
|
57030
57315
|
}
|
|
57031
57316
|
return { kind: "unknown", detail: msg };
|
|
@@ -57099,6 +57384,7 @@ var init_llm_client = __esm({
|
|
|
57099
57384
|
init_schema();
|
|
57100
57385
|
init_llm_presets();
|
|
57101
57386
|
init_custom_provider_service();
|
|
57387
|
+
init_model_catalog();
|
|
57102
57388
|
}
|
|
57103
57389
|
});
|
|
57104
57390
|
|
|
@@ -57364,9 +57650,9 @@ function parseMarkdownToCourse(md) {
|
|
|
57364
57650
|
return { title, sections };
|
|
57365
57651
|
}
|
|
57366
57652
|
function detectLabType(md) {
|
|
57367
|
-
const
|
|
57653
|
+
const lower2 = md.toLowerCase();
|
|
57368
57654
|
const codeBlockCount = (md.match(/```/g) || []).length / 2;
|
|
57369
|
-
if (codeBlockCount >= 3 && /\.ipynb|jupyter\s*notebook|colab notebook/.test(
|
|
57655
|
+
if (codeBlockCount >= 3 && /\.ipynb|jupyter\s*notebook|colab notebook/.test(lower2)) {
|
|
57370
57656
|
return "notebook";
|
|
57371
57657
|
}
|
|
57372
57658
|
if (codeBlockCount >= 5) {
|
|
@@ -58326,29 +58612,29 @@ function pathsToDiscoveredFiles(paths) {
|
|
|
58326
58612
|
const files = [];
|
|
58327
58613
|
const seen = /* @__PURE__ */ new Set();
|
|
58328
58614
|
for (const p of paths) {
|
|
58329
|
-
const
|
|
58615
|
+
const lower2 = p.toLowerCase();
|
|
58330
58616
|
if (seen.has(p))
|
|
58331
58617
|
continue;
|
|
58332
58618
|
let kind = "other";
|
|
58333
|
-
if (
|
|
58619
|
+
if (lower2.endsWith(".md") || lower2.endsWith(".mdx"))
|
|
58334
58620
|
kind = "md";
|
|
58335
|
-
else if (
|
|
58621
|
+
else if (lower2.endsWith(".ipynb"))
|
|
58336
58622
|
kind = "ipynb";
|
|
58337
|
-
else if (
|
|
58623
|
+
else if (lower2.endsWith(".rst"))
|
|
58338
58624
|
kind = "rst";
|
|
58339
|
-
else if (
|
|
58625
|
+
else if (lower2.endsWith(".rmd"))
|
|
58340
58626
|
kind = "rmd";
|
|
58341
|
-
else if (
|
|
58627
|
+
else if (lower2.endsWith(".org"))
|
|
58342
58628
|
kind = "org";
|
|
58343
|
-
else if (
|
|
58629
|
+
else if (lower2.endsWith(".adoc") || lower2.endsWith(".asciidoc"))
|
|
58344
58630
|
kind = "adoc";
|
|
58345
|
-
else if (CODE_EXTENSIONS.some((ext) =>
|
|
58631
|
+
else if (CODE_EXTENSIONS.some((ext) => lower2.endsWith(ext)))
|
|
58346
58632
|
kind = "code";
|
|
58347
58633
|
else
|
|
58348
58634
|
continue;
|
|
58349
|
-
if (
|
|
58635
|
+
if (lower2.includes("node_modules/") || lower2.startsWith(".git/") || lower2.includes("translations/"))
|
|
58350
58636
|
continue;
|
|
58351
|
-
if (
|
|
58637
|
+
if (lower2.endsWith("license.md") || lower2.endsWith("contributing.md") || lower2.endsWith("code_of_conduct.md"))
|
|
58352
58638
|
continue;
|
|
58353
58639
|
seen.add(p);
|
|
58354
58640
|
const parts = p.split("/").filter(Boolean);
|
|
@@ -58927,32 +59213,32 @@ async function fetchSingleFileContent(filePath, owner, repo, branch, fetchFn) {
|
|
|
58927
59213
|
const r = await fetchFn(url2);
|
|
58928
59214
|
if (!r.ok)
|
|
58929
59215
|
return null;
|
|
58930
|
-
const
|
|
58931
|
-
if (
|
|
59216
|
+
const lower2 = filePath.toLowerCase();
|
|
59217
|
+
if (lower2.endsWith(".ipynb")) {
|
|
58932
59218
|
const { parseNotebook: parseNotebook2 } = await Promise.resolve().then(() => (init_notebook_parser(), notebook_parser_exports));
|
|
58933
59219
|
const jsonText = await r.text();
|
|
58934
59220
|
const nbResult = parseNotebook2(jsonText);
|
|
58935
59221
|
return nbResult.markdown;
|
|
58936
59222
|
}
|
|
58937
59223
|
const text3 = await r.text();
|
|
58938
|
-
if (
|
|
59224
|
+
if (lower2.endsWith(".rst")) {
|
|
58939
59225
|
const { parseRst: parseRst2 } = await Promise.resolve().then(() => (init_rst_parser(), rst_parser_exports));
|
|
58940
59226
|
return parseRst2(text3).markdown;
|
|
58941
59227
|
}
|
|
58942
|
-
if (
|
|
59228
|
+
if (lower2.endsWith(".rmd")) {
|
|
58943
59229
|
const { parseRmd: parseRmd2 } = await Promise.resolve().then(() => (init_rmd_parser(), rmd_parser_exports));
|
|
58944
59230
|
return parseRmd2(text3).markdown;
|
|
58945
59231
|
}
|
|
58946
|
-
if (
|
|
59232
|
+
if (lower2.endsWith(".org")) {
|
|
58947
59233
|
const { parseOrg: parseOrg2 } = await Promise.resolve().then(() => (init_org_parser(), org_parser_exports));
|
|
58948
59234
|
return parseOrg2(text3).markdown;
|
|
58949
59235
|
}
|
|
58950
|
-
if (
|
|
59236
|
+
if (lower2.endsWith(".adoc")) {
|
|
58951
59237
|
const { parseAdoc: parseAdoc2 } = await Promise.resolve().then(() => (init_adoc_parser(), adoc_parser_exports));
|
|
58952
59238
|
return parseAdoc2(text3).markdown;
|
|
58953
59239
|
}
|
|
58954
|
-
if (CODE_EXTENSIONS.some((ext) =>
|
|
58955
|
-
const ext =
|
|
59240
|
+
if (CODE_EXTENSIONS.some((ext) => lower2.endsWith(ext))) {
|
|
59241
|
+
const ext = lower2.split(".").pop() ?? "";
|
|
58956
59242
|
const { parseCode: parseCode2 } = await Promise.resolve().then(() => (init_code_parser(), code_parser_exports));
|
|
58957
59243
|
return parseCode2(text3, ext).markdown;
|
|
58958
59244
|
}
|
|
@@ -61321,10 +61607,10 @@ function getRectDims(rect) {
|
|
|
61321
61607
|
height: rect[3] - rect[1]
|
|
61322
61608
|
};
|
|
61323
61609
|
}
|
|
61324
|
-
var
|
|
61610
|
+
var import_meta2, __webpack_require__, __webpack_exports__, isNodeJS, IDENTITY_MATRIX, FONT_IDENTITY_MATRIX, MAX_IMAGE_SIZE_TO_CACHE, LINE_FACTOR, LINE_DESCENT_FACTOR, BASELINE_FACTOR, RenderingIntentFlag, AnnotationMode, AnnotationEditorPrefix, AnnotationEditorType, AnnotationEditorParamsType, PermissionFlag, TextRenderingMode, util_ImageKind, AnnotationType, AnnotationBorderStyleType, VerbosityLevel, OPS, PasswordResponses, verbosity, BaseException, PasswordException, UnknownErrorException, InvalidPDFException, MissingPDFException, UnexpectedResponseException, FormatError, AbortException, util_FeatureTest, hexNumbers, Util, NormalizeRegex, NormalizationMap, AnnotationPrefix, SVG_NS, PixelsPerInch, PageViewport, RenderingCancelledException, StatTimer, PDFDateString, OutputScale, EditorToolbar, HighlightToolbar, IdManager, ImageManager, CommandManager, KeyboardManager, ColorManager, AnnotationEditorUIManager, AltText, TouchManager, AnnotationEditor, FakeEditor, SEED, MASK_HIGH, MASK_LOW, MurmurHash3_64, SerializableEmpty, AnnotationStorage, PrintAnnotationStorage, FontLoader, FontFaceObject, CallbackKind, StreamKind, MessageHandler, BaseCanvasFactory, DOMCanvasFactory, BaseCMapReaderFactory, DOMCMapReaderFactory, BaseFilterFactory, DOMFilterFactory, BaseStandardFontDataFactory, DOMStandardFontDataFactory, NodeFilterFactory, NodeCanvasFactory, NodeCMapReaderFactory, NodeStandardFontDataFactory, PathType, BaseShadingPattern, RadialAxialShadingPattern, MeshShadingPattern, DummyShadingPattern, PaintType, TilingPattern, MIN_FONT_SIZE, MAX_FONT_SIZE, EXECUTION_TIME, EXECUTION_STEPS, MAX_SIZE_TO_COMPILE, FULL_CHUNK_HEIGHT, CachedCanvases, CanvasExtraState, LINE_CAP_STYLES, LINE_JOIN_STYLES, NORMAL_CLIP, EO_CLIP, CanvasGraphics, GlobalWorkerOptions, Metadata, INTERNAL, OptionalContentGroup, OptionalContentConfig, PDFDataTransportStream, PDFDataTransportStreamReader, PDFDataTransportStreamRangeReader, PDFFetchStream, PDFFetchStreamReader, PDFFetchStreamRangeReader, OK_RESPONSE, PARTIAL_CONTENT_RESPONSE, NetworkManager, PDFNetworkStream, PDFNetworkStreamFullRequestReader, PDFNetworkStreamRangeRequestReader, urlRegex, PDFNodeStream, PDFNodeStreamFsFullReader, PDFNodeStreamFsRangeReader, MAX_TEXT_DIVS_TO_RENDER, DEFAULT_FONT_SIZE, DEFAULT_FONT_ASCENT, TextLayer, XfaText, DEFAULT_RANGE_CHUNK_SIZE, RENDERING_CANCELLED_TIMEOUT, DELAYED_CLEANUP_TIMEOUT, DefaultCanvasFactory, DefaultCMapReaderFactory, DefaultFilterFactory, DefaultStandardFontDataFactory, PDFDocumentLoadingTask, PDFDataRangeTransport, PDFDocumentProxy, PDFPageProxy, LoopbackPort, PDFWorker, WorkerTransport, INITIAL_DATA, PDFObjects, RenderTask, InternalRenderTask, version4, build, ColorConverters, BaseSVGFactory, DOMSVGFactory, XfaLayer, DEFAULT_TAB_INDEX, annotation_layer_DEFAULT_FONT_SIZE, GetElementsByNameSet, AnnotationElementFactory, AnnotationElement, LinkAnnotationElement, TextAnnotationElement, WidgetAnnotationElement, TextWidgetAnnotationElement, SignatureWidgetAnnotationElement, CheckboxWidgetAnnotationElement, RadioButtonWidgetAnnotationElement, PushButtonWidgetAnnotationElement, ChoiceWidgetAnnotationElement, PopupAnnotationElement, PopupElement, FreeTextAnnotationElement, LineAnnotationElement, SquareAnnotationElement, CircleAnnotationElement, PolylineAnnotationElement, PolygonAnnotationElement, CaretAnnotationElement, InkAnnotationElement, HighlightAnnotationElement, UnderlineAnnotationElement, SquigglyAnnotationElement, StrikeOutAnnotationElement, StampAnnotationElement, FileAttachmentAnnotationElement, AnnotationLayer, EOL_PATTERN, FreeTextEditor, Outline, FreeDrawOutliner, FreeDrawOutline, HighlightOutliner, HighlightOutline, FreeHighlightOutliner, FreeHighlightOutline, ColorPicker, HighlightEditor, DrawingOptions, DrawingEditor, InkDrawOutliner, InkDrawOutline, InkDrawingOptions, InkEditor, StampEditor, AnnotationEditorLayer, DrawLayer, __webpack_exports__AbortException, __webpack_exports__AnnotationEditorLayer, __webpack_exports__AnnotationEditorParamsType, __webpack_exports__AnnotationEditorType, __webpack_exports__AnnotationEditorUIManager, __webpack_exports__AnnotationLayer, __webpack_exports__AnnotationMode, __webpack_exports__ColorPicker, __webpack_exports__DOMSVGFactory, __webpack_exports__DrawLayer, __webpack_exports__FeatureTest, __webpack_exports__GlobalWorkerOptions, __webpack_exports__ImageKind, __webpack_exports__InvalidPDFException, __webpack_exports__MissingPDFException, __webpack_exports__OPS, __webpack_exports__OutputScale, __webpack_exports__PDFDataRangeTransport, __webpack_exports__PDFDateString, __webpack_exports__PDFWorker, __webpack_exports__PasswordResponses, __webpack_exports__PermissionFlag, __webpack_exports__PixelsPerInch, __webpack_exports__RenderingCancelledException, __webpack_exports__TextLayer, __webpack_exports__TouchManager, __webpack_exports__UnexpectedResponseException, __webpack_exports__Util, __webpack_exports__VerbosityLevel, __webpack_exports__XfaLayer, __webpack_exports__build, __webpack_exports__createValidAbsoluteUrl, __webpack_exports__fetchData, __webpack_exports__getDocument, __webpack_exports__getFilenameFromUrl, __webpack_exports__getPdfFilenameFromUrl, __webpack_exports__getXfaPageViewport, __webpack_exports__isDataScheme, __webpack_exports__isPdfFile, __webpack_exports__noContextMenu, __webpack_exports__normalizeUnicode, __webpack_exports__setLayerDimensions, __webpack_exports__shadow, __webpack_exports__stopEvent, __webpack_exports__version;
|
|
61325
61611
|
var init_pdf = __esm({
|
|
61326
61612
|
"node_modules/pdfjs-dist/build/pdf.mjs"() {
|
|
61327
|
-
|
|
61613
|
+
import_meta2 = {};
|
|
61328
61614
|
__webpack_require__ = {};
|
|
61329
61615
|
(() => {
|
|
61330
61616
|
__webpack_require__.d = (exports2, definition) => {
|
|
@@ -67301,7 +67587,7 @@ var init_pdf = __esm({
|
|
|
67301
67587
|
};
|
|
67302
67588
|
NodeCanvasFactory = class extends BaseCanvasFactory {
|
|
67303
67589
|
_createCanvas(width, height) {
|
|
67304
|
-
const require3 = process.getBuiltinModule("module").createRequire(
|
|
67590
|
+
const require3 = process.getBuiltinModule("module").createRequire(import_meta2.url);
|
|
67305
67591
|
const canvas = require3("@napi-rs/canvas");
|
|
67306
67592
|
return canvas.createCanvas(width, height);
|
|
67307
67593
|
}
|
|
@@ -112985,10 +113271,10 @@ function normalizeEdgeBoundary(container, offset, textLayer) {
|
|
|
112985
113271
|
function percentage(value) {
|
|
112986
113272
|
return `${(value * 100).toFixed(2)}%`;
|
|
112987
113273
|
}
|
|
112988
|
-
var
|
|
113274
|
+
var import_meta3, __webpack_modules__, __webpack_module_cache__, es_array_includes, es_array_push, es_iterator_constructor, es_iterator_filter, es_map_get_or_insert, es_map_get_or_insert_computed, es_set_difference_v2, es_set_intersection_v2, es_set_is_disjoint_from_v2, es_set_is_subset_of_v2, es_set_is_superset_of_v2, es_set_symmetric_difference_v2, es_set_union_v2, es_typed_array_with, es_uint8_array_set_from_base64, es_uint8_array_set_from_hex, es_uint8_array_to_base64, es_uint8_array_to_hex, web_url_parse, isNodeJS2, BBOX_INIT, F32_BBOX_INIT, FONT_IDENTITY_MATRIX2, SVG_NS2, RenderingIntentFlag2, AnnotationMode2, AnnotationPrefix2, AnnotationEditorPrefix2, AnnotationEditorType2, AnnotationEditorParamsType2, PermissionFlag2, TextRenderingMode2, ImageKind2, AnnotationType2, AnnotationBorderStyleType2, VerbosityLevel2, OPS2, DrawOPS, PasswordResponses2, verbosity2, BaseException2, PasswordException2, UnknownErrorException2, InvalidPDFException2, ResponseException, FormatError2, AbortException2, FeatureTest2, Util2, NormalizeRegex2, NormalizationMap2, makeArr, makeMap, makeObj, makeSet, es_iterator_map, PageViewport2, XfaText2, disallowedRichTextStyleRegExp, disallowedEventHandlerAttrRegExp, XfaLayer2, PixelsPerInch2, RenderingCancelledException2, StatTimer2, PDFDateString2, OutputScale2, SupportedImageMimeTypes, ColorScheme, CSSConstants, contrastCache, es_iterator_take, es_weak_map_get_or_insert, es_weak_map_get_or_insert_computed, web_dom_exception_stack, es_iterator_some, es_json_stringify, es_iterator_drop, es_iterator_every, es_iterator_find, es_json_parse, EditorToolbar2, FloatingToolbar, INTERNAL_EVT, internalOpt, CurrentPointers, IdManager2, ImageManager2, CommandManager2, KeyboardManager2, ColorManager2, AnnotationEditorUIManager2, AltText2, Comment, MIN_TOUCH_SPAN, TouchManager2, AnnotationEditor2, FakeEditor2, SEED2, MASK_HIGH2, MASK_LOW2, MurmurHash3_642, SerializableEmpty2, AnnotationStorage2, PrintAnnotationStorage2, es_iterator_for_each, FORCED_DEPENDENCY_LABEL, floor, ceil, EMPTY_BBOX, BBoxReader, ensureDebugMetadata, CanvasBBoxTracker, CanvasDependencyTracker, CanvasNestedDependencyTracker, Dependencies, CanvasImagesTracker, CONTROL_CHAR_REGEXP, FontLoader2, FontFaceObject2, CSS_FONT_INFO, SYSTEM_FONT_INFO, FONT_INFO, PATTERN_INFO, InfoUtils, CssFontInfo, SystemFontInfo, FontInfo, PatternInfo, FontPathInfo, isRefProxy2, isNameProxy, isValidExplicitDest, LoopbackPort2, es_promise_try, CallbackKind2, StreamKind2, MessageHandler2, BaseBinaryDataFactory, DOMBinaryDataFactory, BaseCanvasFactory2, DOMCanvasFactory2, BaseFilterFactory2, DOMFilterFactory2, NodeFilterFactory2, NodeCanvasFactory2, NodeBinaryDataFactory, MESH_WGSL, WebGPU, _webGPU, PathType2, BaseShadingPattern2, RadialAxialShadingPattern2, MeshShadingPattern2, DummyShadingPattern2, PaintType2, TilingPattern2, MIN_FONT_SIZE2, MAX_FONT_SIZE2, EXECUTION_TIME2, EXECUTION_STEPS2, FULL_CHUNK_HEIGHT2, XY, CanvasExtraState2, LINE_CAP_STYLES2, LINE_JOIN_STYLES2, NORMAL_CLIP2, EO_CLIP2, CanvasGraphics2, BasePDFStream, BasePDFStreamReader, BasePDFStreamRangeReader, PDFFetchStream2, PDFFetchStreamReader2, PDFFetchStreamRangeReader2, PDFDataTransportStream2, PDFDataTransportStreamReader2, PDFDataTransportStreamRangeReader2, OK_RESPONSE2, PARTIAL_CONTENT_RESPONSE2, PDFNetworkStream2, PDFNetworkStreamReader, PDFNetworkStreamRangeReader, PDFNodeStream2, PDFNodeStreamReader, PDFNodeStreamRangeReader, GlobalWorkerOptions2, Metadata2, INTERNAL2, OptionalContentGroup2, OptionalContentConfig2, PagesMapper, INITIAL_DATA2, dataObj, PDFObjects2, MAX_TEXT_DIVS_TO_RENDER2, DEFAULT_FONT_SIZE2, TextLayer2, RENDERING_CANCELLED_TIMEOUT2, PDFDocumentLoadingTask2, PDFDataRangeTransport2, PDFDocumentProxy2, PDFPageProxy2, PDFWorker2, WorkerTransport2, RenderTask2, InternalRenderTask2, version5, build2, es_math_sum_precise, ColorPicker2, BasicColorPicker, es_iterator_flat_map, ColorConverters2, BaseSVGFactory2, DOMSVGFactory2, annotation_layer_DEFAULT_FONT_SIZE2, GetElementsByNameSet2, TIMEZONE_OFFSET, AnnotationElementFactory2, AnnotationElement2, EditorAnnotationElement, LinkAnnotationElement2, TextAnnotationElement2, WidgetAnnotationElement2, TextWidgetAnnotationElement2, SignatureWidgetAnnotationElement2, CheckboxWidgetAnnotationElement2, RadioButtonWidgetAnnotationElement2, PushButtonWidgetAnnotationElement2, ChoiceWidgetAnnotationElement2, PopupAnnotationElement2, PopupElement2, FreeTextAnnotationElement2, LineAnnotationElement2, SquareAnnotationElement2, CircleAnnotationElement2, PolylineAnnotationElement2, PolygonAnnotationElement2, CaretAnnotationElement2, InkAnnotationElement2, HighlightAnnotationElement2, UnderlineAnnotationElement2, SquigglyAnnotationElement2, StrikeOutAnnotationElement2, StampAnnotationElement2, FileAttachmentAnnotationElement2, MediaAnnotationElement, AnnotationLayer2, EOL_PATTERN2, FreeTextEditor2, DrawingOptions2, DrawingEditor2, Outline2, FreeDrawOutliner2, FreeDrawOutline2, HighlightOutliner2, HighlightOutline2, FreeHighlightOutliner2, FreeHighlightDrawer, FreeHighlightOutline2, HighlightDrawingOptions, HighlightEditor2, InkDrawOutliner2, InkDrawOutline2, InkDrawingOptions2, InkEditor2, ContourDrawOutline, es_uint8_array_from_base64, BASE_HEADER_LENGTH, POINTS_PROPERTIES_NUMBER, SignatureExtractor, SignatureOptions, DrawnSignatureOptions, SignatureEditor, StampEditor2, AnnotationEditorLayer2, es_iterator_to_array, DrawLayer2, TextLayerImages;
|
|
112989
113275
|
var init_pdf2 = __esm({
|
|
112990
113276
|
"node_modules/officeparser/node_modules/pdfjs-dist/legacy/build/pdf.mjs"() {
|
|
112991
|
-
|
|
113277
|
+
import_meta3 = {};
|
|
112992
113278
|
__webpack_modules__ = {
|
|
112993
113279
|
/***/
|
|
112994
113280
|
9306(module2, __unused_webpack_exports, __webpack_require__4) {
|
|
@@ -114596,7 +114882,7 @@ var init_pdf2 = __esm({
|
|
|
114596
114882
|
var defineProperty = Object.defineProperty;
|
|
114597
114883
|
var stringSlice = uncurryThis("".slice);
|
|
114598
114884
|
var replace2 = uncurryThis("".replace);
|
|
114599
|
-
var
|
|
114885
|
+
var join17 = uncurryThis([].join);
|
|
114600
114886
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
114601
114887
|
return defineProperty(function() {
|
|
114602
114888
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -114629,7 +114915,7 @@ var init_pdf2 = __esm({
|
|
|
114629
114915
|
}
|
|
114630
114916
|
var state = enforceInternalState(value);
|
|
114631
114917
|
if (!hasOwn(state, "source")) {
|
|
114632
|
-
state.source =
|
|
114918
|
+
state.source = join17(TEMPLATE, typeof name19 == "string" ? name19 : "");
|
|
114633
114919
|
}
|
|
114634
114920
|
return value;
|
|
114635
114921
|
};
|
|
@@ -117293,7 +117579,7 @@ var init_pdf2 = __esm({
|
|
|
117293
117579
|
var charAt = uncurryThis("".charAt);
|
|
117294
117580
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
117295
117581
|
var $Array = globalThis2.Array;
|
|
117296
|
-
var
|
|
117582
|
+
var join17 = uncurryThis([].join);
|
|
117297
117583
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !function() {
|
|
117298
117584
|
try {
|
|
117299
117585
|
var target = new Uint8Array2();
|
|
@@ -117341,7 +117627,7 @@ var init_pdf2 = __esm({
|
|
|
117341
117627
|
result[written++] = "=";
|
|
117342
117628
|
}
|
|
117343
117629
|
}
|
|
117344
|
-
return
|
|
117630
|
+
return join17(result, "");
|
|
117345
117631
|
}
|
|
117346
117632
|
});
|
|
117347
117633
|
},
|
|
@@ -117353,7 +117639,7 @@ var init_pdf2 = __esm({
|
|
|
117353
117639
|
var anUint8Array = __webpack_require__4(4154);
|
|
117354
117640
|
var notDetached = __webpack_require__4(5169);
|
|
117355
117641
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
117356
|
-
var
|
|
117642
|
+
var join17 = uncurryThis([].join);
|
|
117357
117643
|
var $Array = Array;
|
|
117358
117644
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
117359
117645
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !function() {
|
|
@@ -117374,7 +117660,7 @@ var init_pdf2 = __esm({
|
|
|
117374
117660
|
var hex = numberToString2(this[i], 16);
|
|
117375
117661
|
result[i] = hex.length === 1 ? "0" + hex : hex;
|
|
117376
117662
|
}
|
|
117377
|
-
return
|
|
117663
|
+
return join17(result, "");
|
|
117378
117664
|
}
|
|
117379
117665
|
});
|
|
117380
117666
|
},
|
|
@@ -126314,7 +126600,7 @@ var init_pdf2 = __esm({
|
|
|
126314
126600
|
if (isNodeJS2) {
|
|
126315
126601
|
let canvas;
|
|
126316
126602
|
try {
|
|
126317
|
-
const require3 = process.getBuiltinModule("module").createRequire(
|
|
126603
|
+
const require3 = process.getBuiltinModule("module").createRequire(import_meta3.url);
|
|
126318
126604
|
try {
|
|
126319
126605
|
canvas = require3("@napi-rs/canvas");
|
|
126320
126606
|
} catch (ex) {
|
|
@@ -126349,7 +126635,7 @@ var init_pdf2 = __esm({
|
|
|
126349
126635
|
};
|
|
126350
126636
|
NodeCanvasFactory2 = class extends BaseCanvasFactory2 {
|
|
126351
126637
|
_createCanvas(width, height) {
|
|
126352
|
-
const require3 = process.getBuiltinModule("module").createRequire(
|
|
126638
|
+
const require3 = process.getBuiltinModule("module").createRequire(import_meta3.url);
|
|
126353
126639
|
const canvas = require3("@napi-rs/canvas");
|
|
126354
126640
|
return canvas.createCanvas(width, height);
|
|
126355
126641
|
}
|
|
@@ -145589,7 +145875,7 @@ async function JBig2(moduleArg = {}) {
|
|
|
145589
145875
|
var quit_ = (status, toThrow) => {
|
|
145590
145876
|
throw toThrow;
|
|
145591
145877
|
};
|
|
145592
|
-
var _scriptName =
|
|
145878
|
+
var _scriptName = import_meta4.url;
|
|
145593
145879
|
var scriptDirectory = "";
|
|
145594
145880
|
var readAsync, readBinary;
|
|
145595
145881
|
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
@@ -145902,7 +146188,7 @@ async function OpenJPEG(moduleArg = {}) {
|
|
|
145902
146188
|
var quit_ = (status, toThrow) => {
|
|
145903
146189
|
throw toThrow;
|
|
145904
146190
|
};
|
|
145905
|
-
var _scriptName =
|
|
146191
|
+
var _scriptName = import_meta4.url;
|
|
145906
146192
|
var scriptDirectory = "";
|
|
145907
146193
|
var readAsync, readBinary;
|
|
145908
146194
|
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
@@ -152276,10 +152562,10 @@ async function incrementalUpdate({
|
|
|
152276
152562
|
}
|
|
152277
152563
|
return array2;
|
|
152278
152564
|
}
|
|
152279
|
-
var import_meta3, __webpack_modules__2, __webpack_module_cache__2, es_array_push2, es_iterator_constructor2, es_iterator_filter2, es_iterator_map2, es_iterator_some2, es_map_get_or_insert2, es_map_get_or_insert_computed2, es_set_difference_v22, es_set_intersection_v22, es_set_is_disjoint_from_v22, es_set_is_subset_of_v22, es_set_is_superset_of_v22, es_set_symmetric_difference_v22, es_set_union_v22, es_typed_array_with2, es_uint8_array_set_from_base642, es_uint8_array_set_from_hex2, es_uint8_array_to_base642, es_uint8_array_to_hex2, web_self, es_array_includes2, web_url_parse2, isNodeJS3, BBOX_INIT2, F32_BBOX_INIT2, FONT_IDENTITY_MATRIX3, LINE_FACTOR2, LINE_DESCENT_FACTOR2, BASELINE_FACTOR2, SVG_NS3, RenderingIntentFlag3, AnnotationPrefix3, AnnotationEditorPrefix3, AnnotationEditorType3, PermissionFlag3, MeshFigureType, TextRenderingMode3, ImageKind3, AnnotationType3, AnnotationReplyType, AnnotationRenditionOperation, AnnotationFlag, AnnotationFieldFlag, AnnotationBorderStyleType3, AnnotationActionEventType, DocumentActionEventType, PageActionEventType, VerbosityLevel3, OPS3, DrawOPS2, PasswordResponses3, verbosity3, BaseException3, PasswordException3, UnknownErrorException3, InvalidPDFException3, ResponseException2, FormatError3, AbortException3, FeatureTest3, Util3, NormalizeRegex3, NormalizationMap3, makeArr2, makeMap2, makeObj2, makeSet2, es_iterator_every2, CIRCULAR_REF, EOF, CmdCache, NameCache, RefCache, Name2, Cmd, nonSerializable, Dict, Ref, RefSet, RefMap, BaseStream, CONTROL_CHAR_REGEXP2, PDFStringTranslateTable, PDFStringTextDecoders, PDF_VERSION_REGEXP, MAX_INT_32, IDENTITY_MATRIX2, RESOURCES_KEYS_OPERATOR_LIST, RESOURCES_KEYS_TEXT_CONTENT, MissingDataException, ParserEOFException, XRefEntryException, XRefParseException, ROMAN_NUMBER_MAP, XMLEntities, ALPHA_MASK, RGB_MASK, QCMS, DataType, Intent, cachedUint8ArrayMemory0, cachedTextDecoder, MAX_SAFARI_DECODE_BYTES, numBytesDecoded, WASM_VECTOR_LEN, wasmModule, wasmInstance, wasm, ColorSpace, AlternateCS, PatternCS, IndexedCS, DeviceGrayCS, DeviceRgbCS, DeviceRgbaCS, DeviceCmykCS, CalGrayCS, CalRGBCS, LabCS, IccColorSpace, CmykICCBasedCS, Stream, StringStream, NullStream, ChunkedStream, ChunkedStreamManager, MIN_IMAGE_DIM, MAX_IMAGE_DIM, MAX_ERROR, ImageResizer, emptyBuffer, DecodeStream, StreamsSequenceStream, ColorSpaceUtils, JpegError, DNLMarkerError, EOIMarkerError, dctZigZag, dctCos1, dctSin1, dctCos3, dctSin3, dctCos6, dctSin6, dctSqrt2, dctSqrt1d2, JpegImage, JpegStream, InitialState, NullOptimizer, QueueOptimizer, OperatorList, CheckedOperatorList, ShadingType, MAX_SAMPLED_COLOR_COMPONENTS, Pattern, BaseShading, RadialAxialShading, FunctionBasedShading, MeshStreamReader, bCache, MeshShading, DummyShading, es_iterator_find2, es_math_sum_precise2, es_iterator_for_each2, MAX_NUM_SIZE, MAX_ENCODED_NUM_SIZE, BinaryCMapStream, BinaryCMapReader, Ascii85Stream, AsciiHexStream, makeBrotliDecode, BrotliDecode, BrotliStream, jbig2, WasmImage, Jbig2Error, JBig2CCITTFaxImage, CCITTFaxStream, codeLenCodeMap, lengthDecode, distDecode, fixedLitCodeTab, fixedDistCodeTab, FlateStream, Jbig2Stream, openjpeg, JpxError, JpxImage, JpxStream, LZWStream, PredictorStream, RunLengthStream, MAX_LENGTH_TO_CACHE, Parser, specialChars, Lexer, Linearization, BUILT_IN_CMAPS, MAX_MAP_RANGE, CMap, IdentityCMap, CMapFactory, ExpertEncoding, MacExpertEncoding, MacRomanEncoding, StandardEncoding, WinAnsiEncoding, SymbolSetEncoding, ZapfDingbatsEncoding, getGlyphsUnicode, getDingbatsGlyphsUnicode, getSpecialPUASymbols, UnicodeRanges, SpecialCharRegExp, CategoryCache, FontFlags, MacStandardGlyphOrdering, getVerticalPresentationForm, MAX_SIZE_TO_COMPILE2, es_iterator_to_array2, ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset, DataBuilder, MAX_SUBR_NESTING, CFFStandardStrings, NUM_STANDARD_CFF_STRINGS, DEFAULT_BLUE_SCALE, DEFAULT_BLUE_SHIFT, DEFAULT_BLUE_FUZZ, DEFAULT_EXPANSION_FACTOR, CharstringValidationData, CharstringValidationData12, CFFParser, CFF, CFFHeader, CFFStrings, CFFIndex, CFFDict, CFFTopDictLayout, CFFTopDict, CFFPrivateDictLayout, CFFPrivateDict, CFFCharsetPredefinedTypes, CFFCharset, CFFEncoding, CFFFDSelect, CFFOffsetTracker, CFFCompiler, getStdFontMap, getFontNameToFileMap, getNonStdFontMap, getSerifFonts, getSymbolsFonts, getGlyphMapForMacOrderedFonts, getGlyphMapForStandardFonts, getSupplementalGlyphMapForTrebuchetMS, getSupplementalGlyphMapForArialBlack, getSupplementalGlyphMapForCalibri, ON_CURVE_POINT, X_SHORT_VECTOR, Y_SHORT_VECTOR, REPEAT_FLAG, X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR, Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR, OVERLAP_SIMPLE, ARG_1_AND_2_ARE_WORDS, ARGS_ARE_XY_VALUES, WE_HAVE_A_SCALE, MORE_COMPONENTS, WE_HAVE_AN_X_AND_Y_SCALE, WE_HAVE_A_TWO_BY_TWO, WE_HAVE_INSTRUCTIONS, GLYPH_HEADER_SIZE, GlyfTable, Glyph, GlyphHeader, Contour, SimpleGlyph, CompositeGlyph, ToUnicodeMap, IdentityToUnicodeMap, CFFFont, CSS_FONT_INFO2, SYSTEM_FONT_INFO2, FONT_INFO2, PATTERN_INFO2, InfoUtils2, Commands, CompiledFont, TrueTypeCompiled, Type2Compiled, FontRendererFactory, getMetrics, getFontBasicMetrics, OTF_HEADER_SIZE, OTF_TABLE_ENTRY_SIZE, OpenTypeFileBuilder, COMMAND_MAP, Type1CharString, EEXEC_ENCRYPT_KEY, CHAR_STRS_ENCRYPT_KEY, Type1Parser, Type1Font, PRIVATE_USE_AREAS, PDF_GLYPH_SPACE_UNITS, EXPORT_DATA_PROPERTIES, EXPORT_DATA_EXTRA_PROPERTIES, fonts_Glyph, getSymbolGlyphIdEncoding, Font, ErrorFont, CalibriBoldFactors, CalibriBoldMetrics, CalibriBoldItalicFactors, CalibriBoldItalicMetrics, CalibriItalicFactors, CalibriItalicMetrics, CalibriRegularFactors, CalibriRegularMetrics, HelveticaBoldFactors, HelveticaBoldMetrics, HelveticaBoldItalicFactors, HelveticaBoldItalicMetrics, HelveticaItalicFactors, HelveticaItalicMetrics, HelveticaRegularFactors, HelveticaRegularMetrics, LiberationSansBoldWidths, LiberationSansBoldMapping, LiberationSansBoldItalicWidths, LiberationSansBoldItalicMapping, LiberationSansItalicWidths, LiberationSansItalicMapping, LiberationSansRegularWidths, LiberationSansRegularMapping, MyriadProBoldFactors, MyriadProBoldMetrics, MyriadProBoldItalicFactors, MyriadProBoldItalicMetrics, MyriadProItalicFactors, MyriadProItalicMetrics, MyriadProRegularFactors, MyriadProRegularMetrics, SegoeuiBoldFactors, SegoeuiBoldMetrics, SegoeuiBoldItalicFactors, SegoeuiBoldItalicMetrics, SegoeuiItalicFactors, SegoeuiItalicMetrics, SegoeuiRegularFactors, SegoeuiRegularMetrics, getXFAFontMap, TOKEN, Token, lexer_Lexer, PS_VALUE_TYPE, PS_NODE, PsNode, PsProgram, PsBlock, PsNumber, PsOperator, PsIf, PsIfElse, PsArgNode, PsConstNode, PsUnaryNode, PsBinaryNode, PsTernaryNode, ast_Parser, MAX_STACK_SIZE, PSStackToTree, OP, _DEG_TO_RAD, _RAD_TO_DEG, PsJsCompiler, PSStackBasedInterpreter, wasm_compiler_OP, FUNC_TYPE, F64, SECTION, EXTERN_FUNC, EXTERN_MEM, MATH_IMPORTS, _mathImportObject, PsWasmCompiler, BaseLocalCache, LocalImageCache, LocalColorSpaceCache, LocalFunctionCache, LocalGStateCache, LocalTilingPatternCache, RegionalImageCache, GlobalColorSpaceCache, GlobalImageCache, FunctionType, PDFFunctionFactory, PDFFunction, baseTypes, arabicTypes, chars, types, NORMAL, MEDIUM, BOLD, ITALIC, BOLDITALIC, substitutionMap, fontAliases, SEED3, MASK_HIGH3, MASK_LOW3, MurmurHash3_643, PDFImage, DefaultPartialEvaluatorOptions, PatternType, TEXT_CHUNK_BATCH_SIZE, deferred, TimeSlotManager, PartialEvaluator, TranslatedFont, StateManager, TextState, EvalState, EvaluatorPreprocessor, DefaultAppearanceEvaluator, AppearanceStreamEvaluator, FakeUnicodeFont, DateFormats, TimeFormats, es_json_stringify2, NameOrNumberTree, NameTree, NumberTree, FileSpec, XMLParserErrorCode, XMLParserBase, SimpleDOMNode, SimpleXMLParser, MetadataParser, WAV_HEADER_SIZE, MAX_DEPTH, TABLE_SPAN_ATTRIBUTES, StructElementType, StructTreeRoot, StructElementNode, StructElement, StructTreePage, isRef, isValidExplicitDest2, Catalog, FLATE_COLOR_COUNT_THRESHOLD, ObjectLoader, $acceptWhitespace, $addHTML, $appendChild, $childrenToHTML, $clean, $cleanPage, $cleanup, $clone, $consumed, $content, $data, $dump, $extra, $finalize, $flushHTML, $getAttributeIt, $getAttributes, $getAvailableSpace, $getChildrenByClass, $getChildrenByName, $getChildrenByNameIt, $getDataValue, $getExtra, $getRealChildrenByNameIt, $getChildren, $getContainedChildren, $getNextPage, $getSubformParent, $getParent, $getTemplateRoot, $globalData, $hasSettableValue, $ids, $indexOf, $insertAt, $isCDATAXml, $isBindable, $isDataValue, $isDescendent, $isNsAgnostic, $isSplittable, $isThereMoreWidth, $isTransparent, $isUsable, $lastAttribute, $namespaceId, $nodeName, $nsAttributes, $onChild, $onChildCheck, $onText, $pushGlyphs, $popPara, $pushPara, $removeChild, $root, $resolvePrototypes, $searchNode, $setId, $setSetAttributes, $setValue, $tabIndex, $text, $toPages, $toHTML, $toString, $toStyle, $uid, es_iterator_flat_map2, es_uint8_array_from_base642, $buildXFAObject, NamespaceIds, dimConverters, measurementPattern, HTMLResult, FontFinder, WIDTH_FACTOR, FontInfo2, FontSelector, TextMeasure, es_weak_map_get_or_insert2, es_weak_map_get_or_insert_computed2, namePattern, indexPattern, operators, shortcuts, somCache, _applyPrototype, _attributes, _attributeNames, _children, _cloneAttribute, _dataValue, _defaultValue, _filteredChildrenGenerator, _getPrototype, _getUnsetAttributes, _hasChildren, _max, _options, _parent, _resolvePrototypesHelper, _setAttributes, _validator, uid, NS_DATASETS, XFAObject, XFAObjectArray, XFAAttribute, XmlObject, ContentObject, OptionObject, StringObject, IntegerObject, Option01, Option10, converters, TEMPLATE_NS_ID, MAX_ATTEMPTS_FOR_LRTB_LAYOUT, MAX_EMPTY_PAGES, DEFAULT_TAB_INDEX2, HEADING_PATTERN, MIMES, IMAGES_HEADERS, AppearanceFilter, Arc, Area, Assist, Barcode, Bind, BindItems, Bookend, BooleanElement, Border, Break, BreakAfter, BreakBefore, Button, Calculate, Caption, Certificate, Certificates, CheckButton, ChoiceList, Color, Comb, Connect, ContentArea, Corner, DateElement, DateTime, DateTimeEdit, Decimal, DefaultUi, Desc, DigestMethod, DigestMethods, Draw, Edge, Encoding, Encodings, Encrypt, EncryptData, Encryption, EncryptionMethod, EncryptionMethods, Event2, ExData, ExObject, ExclGroup, Execute, Extras, Field, Fill, Filter, Float, template_Font, Format, Handler, Hyphenation, Image2, ImageEdit, Integer, Issuers, Items, Keep, KeyUsage, Line, Linear, LockDocument, Manifest, Margin, Mdp, Medium, Message, NumericEdit, Occur, Oid, Oids, Overflow, PageArea, PageSet, Para, PasswordEdit, template_Pattern, Picture, Proto, Radial, Reason, Reasons, Rectangle, RefElement, Script, SetProperty, SignData, Signature2, Signing, Solid, Speak, Stipple, Subform, SubformSet, SubjectDN, SubjectDNs, Submit, Template, Text, TextEdit, Time, TimeStamp, ToolTip, Traversal, Traverse, Ui, Validate, Value, Variables, TemplateNamespace, bind_NS_DATASETS, Binder, DataHandler, CONFIG_NS_ID, Acrobat, Acrobat7, ADBE_JSConsole, ADBE_JSDebugger, AddSilentPrint, AddViewerPreferences, AdjustData, AdobeExtensionLevel, Agent, AlwaysEmbed, Amd, config_Area, Attributes, AutoSave, Base, BatchOutput, BehaviorOverride, Cache2, Change, Common, Compress, CompressLogicalStructure, CompressObjectStream, Compression, Config, Conformance, ContentCopy, Copies, Creator, CurrentPage, Data, Debug, DefaultTypeface, Destination, DocumentAssembly, Driver, DuplexOption, DynamicRender, Embed, config_Encrypt, config_Encryption, EncryptionLevel, Enforce, Equate, EquateRange, Exclude, ExcludeNS, FlipLabel, config_FontInfo, FormFieldFilling, GroupParent, IfEmpty, IncludeXDPContent, IncrementalLoad, IncrementalMerge, Interactive, Jog, LabelPrinter, Layout, Level, Linearized, Locale, LocaleSet, Log, MapElement, MediumInfo, config_Message, Messaging, Mode, ModifyAnnots, MsgId, NameAttr, NeverEmbed, NumberOfCopies, OpenAction, Output, OutputBin, OutputXSL, Overprint, Packets, PageOffset, PageRange, Pagination, PaginationOverride, Part, Pcl, Pdf, Pdfa, Permissions, PickTrayByPDFSize, config_Picture, PlaintextMetadata, Presence, Present, Print, PrintHighQuality, PrintScaling, PrinterName, Producer, Ps, Range2, Record, Relevant, Rename, RenderPolicy, RunScripts, config_Script, ScriptModel, Severity, SilentPrint, Staple, StartNode, StartPage, SubmitFormat, SubmitUrl, SubsetBelow, SuppressBanner, Tagged, config_Template, Threshold, To, TemplateCache, Trace, Transform, Type, Uri, config_Validate, ValidateApprovalSignatures, ValidationMessaging, Version, VersionControl, ViewerPreferences, WebClient, Whitespace, Window, Xdc, Xdp, Xsl, Zpl, ConfigNamespace, CONNECTION_SET_NS_ID, ConnectionSet, EffectiveInputPolicy, EffectiveOutputPolicy, Operation, RootElement, SoapAction, SoapAddress, connection_set_Uri, WsdlAddress, WsdlConnection, XmlConnection, XsdConnection, ConnectionSetNamespace, DATASETS_NS_ID, datasets_Data, Datasets, DatasetsNamespace, LOCALE_SET_NS_ID, CalendarSymbols, CurrencySymbol, CurrencySymbols, DatePattern, DatePatterns, DateTimeSymbols, Day, DayNames, Era, EraNames, locale_set_Locale, locale_set_LocaleSet, Meridiem, MeridiemNames, Month, MonthNames, NumberPattern, NumberPatterns, NumberSymbol, NumberSymbols, TimePattern, TimePatterns, TypeFace, TypeFaces, LocaleSetNamespace, SIGNATURE_NS_ID, signature_Signature, SignatureNamespace, STYLESHEET_NS_ID, Stylesheet, StylesheetNamespace, XDP_NS_ID, xdp_Xdp, XdpNamespace, XHTML_NS_ID, $richText, VALID_STYLES, StyleMapping, spacesRegExp, crlfRegExp, crlfForRichTextRegExp, NoWhites, XhtmlObject, A, B, Body, Br, Html, I, Li, Ol, P, Span, Sub, Sup, Ul, XhtmlNamespace, NamespaceSetUp, UnknownNamespace, Root, Empty, Builder, XFAParser, XFAFactory, AnnotationFactory, Annotation, AnnotationBorderStyle, MarkupAnnotation, WidgetAnnotation, TextWidgetAnnotation, ButtonWidgetAnnotation, ChoiceWidgetAnnotation, SignatureWidgetAnnotation, TextAnnotation, LinkAnnotation, PopupAnnotation, FreeTextAnnotation, LineAnnotation, SquareAnnotation, CircleAnnotation, PolylineAnnotation, PolygonAnnotation, CaretAnnotation, InkAnnotation, HighlightAnnotation, UnderlineAnnotation, SquigglyAnnotation, StrikeOutAnnotation, StampAnnotation, FileAttachmentAnnotation, MediaAnnotation, RichMediaAnnotation, ScreenAnnotation, SoundAnnotation, PARAMS, DatasetXMLParser, DatasetReader, SingleIntersector, STEPS, Intersector, Word64, calculate_sha_other_PARAMS, calculate_sha256_PARAMS, chunkSize, DecryptStream, NON_ASCII_SPACES, COMMONLY_MAPPED_TO_NOTHING, ARCFourCipher, NullCipher, AESBaseCipher, AES128Cipher, AES256Cipher, PDFBase, PDF17, PDF20, CipherTransform, CipherTransformFactory, XRef, LETTER_SIZE_MEDIABOX, SIGNATURE_TAIL_CHUNK_SIZE, Page, PDF_HEADER_SIGNATURE, STARTXREF_SIGNATURE, ENDOBJ_SIGNATURE, PDFDocument, BasePdfManager, LocalPdfManager, NetworkPdfManager, es_promise_try2, CallbackKind3, StreamKind3, MessageHandler3, MAX_LEAVES_PER_PAGES_NODE, MAX_IN_NAME_TREE_NODE, PageData, DocumentData, XRefWrapper, PDFEditor, BasePDFStream2, BasePDFStreamReader2, BasePDFStreamRangeReader2, PDFWorkerStream, PDFWorkerStreamReader, PDFWorkerStreamRangeReader, WorkerTask, WorkerMessageHandler;
|
|
152565
|
+
var import_meta4, __webpack_modules__2, __webpack_module_cache__2, es_array_push2, es_iterator_constructor2, es_iterator_filter2, es_iterator_map2, es_iterator_some2, es_map_get_or_insert2, es_map_get_or_insert_computed2, es_set_difference_v22, es_set_intersection_v22, es_set_is_disjoint_from_v22, es_set_is_subset_of_v22, es_set_is_superset_of_v22, es_set_symmetric_difference_v22, es_set_union_v22, es_typed_array_with2, es_uint8_array_set_from_base642, es_uint8_array_set_from_hex2, es_uint8_array_to_base642, es_uint8_array_to_hex2, web_self, es_array_includes2, web_url_parse2, isNodeJS3, BBOX_INIT2, F32_BBOX_INIT2, FONT_IDENTITY_MATRIX3, LINE_FACTOR2, LINE_DESCENT_FACTOR2, BASELINE_FACTOR2, SVG_NS3, RenderingIntentFlag3, AnnotationPrefix3, AnnotationEditorPrefix3, AnnotationEditorType3, PermissionFlag3, MeshFigureType, TextRenderingMode3, ImageKind3, AnnotationType3, AnnotationReplyType, AnnotationRenditionOperation, AnnotationFlag, AnnotationFieldFlag, AnnotationBorderStyleType3, AnnotationActionEventType, DocumentActionEventType, PageActionEventType, VerbosityLevel3, OPS3, DrawOPS2, PasswordResponses3, verbosity3, BaseException3, PasswordException3, UnknownErrorException3, InvalidPDFException3, ResponseException2, FormatError3, AbortException3, FeatureTest3, Util3, NormalizeRegex3, NormalizationMap3, makeArr2, makeMap2, makeObj2, makeSet2, es_iterator_every2, CIRCULAR_REF, EOF, CmdCache, NameCache, RefCache, Name2, Cmd, nonSerializable, Dict, Ref, RefSet, RefMap, BaseStream, CONTROL_CHAR_REGEXP2, PDFStringTranslateTable, PDFStringTextDecoders, PDF_VERSION_REGEXP, MAX_INT_32, IDENTITY_MATRIX2, RESOURCES_KEYS_OPERATOR_LIST, RESOURCES_KEYS_TEXT_CONTENT, MissingDataException, ParserEOFException, XRefEntryException, XRefParseException, ROMAN_NUMBER_MAP, XMLEntities, ALPHA_MASK, RGB_MASK, QCMS, DataType, Intent, cachedUint8ArrayMemory0, cachedTextDecoder, MAX_SAFARI_DECODE_BYTES, numBytesDecoded, WASM_VECTOR_LEN, wasmModule, wasmInstance, wasm, ColorSpace, AlternateCS, PatternCS, IndexedCS, DeviceGrayCS, DeviceRgbCS, DeviceRgbaCS, DeviceCmykCS, CalGrayCS, CalRGBCS, LabCS, IccColorSpace, CmykICCBasedCS, Stream, StringStream, NullStream, ChunkedStream, ChunkedStreamManager, MIN_IMAGE_DIM, MAX_IMAGE_DIM, MAX_ERROR, ImageResizer, emptyBuffer, DecodeStream, StreamsSequenceStream, ColorSpaceUtils, JpegError, DNLMarkerError, EOIMarkerError, dctZigZag, dctCos1, dctSin1, dctCos3, dctSin3, dctCos6, dctSin6, dctSqrt2, dctSqrt1d2, JpegImage, JpegStream, InitialState, NullOptimizer, QueueOptimizer, OperatorList, CheckedOperatorList, ShadingType, MAX_SAMPLED_COLOR_COMPONENTS, Pattern, BaseShading, RadialAxialShading, FunctionBasedShading, MeshStreamReader, bCache, MeshShading, DummyShading, es_iterator_find2, es_math_sum_precise2, es_iterator_for_each2, MAX_NUM_SIZE, MAX_ENCODED_NUM_SIZE, BinaryCMapStream, BinaryCMapReader, Ascii85Stream, AsciiHexStream, makeBrotliDecode, BrotliDecode, BrotliStream, jbig2, WasmImage, Jbig2Error, JBig2CCITTFaxImage, CCITTFaxStream, codeLenCodeMap, lengthDecode, distDecode, fixedLitCodeTab, fixedDistCodeTab, FlateStream, Jbig2Stream, openjpeg, JpxError, JpxImage, JpxStream, LZWStream, PredictorStream, RunLengthStream, MAX_LENGTH_TO_CACHE, Parser, specialChars, Lexer, Linearization, BUILT_IN_CMAPS, MAX_MAP_RANGE, CMap, IdentityCMap, CMapFactory, ExpertEncoding, MacExpertEncoding, MacRomanEncoding, StandardEncoding, WinAnsiEncoding, SymbolSetEncoding, ZapfDingbatsEncoding, getGlyphsUnicode, getDingbatsGlyphsUnicode, getSpecialPUASymbols, UnicodeRanges, SpecialCharRegExp, CategoryCache, FontFlags, MacStandardGlyphOrdering, getVerticalPresentationForm, MAX_SIZE_TO_COMPILE2, es_iterator_to_array2, ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset, DataBuilder, MAX_SUBR_NESTING, CFFStandardStrings, NUM_STANDARD_CFF_STRINGS, DEFAULT_BLUE_SCALE, DEFAULT_BLUE_SHIFT, DEFAULT_BLUE_FUZZ, DEFAULT_EXPANSION_FACTOR, CharstringValidationData, CharstringValidationData12, CFFParser, CFF, CFFHeader, CFFStrings, CFFIndex, CFFDict, CFFTopDictLayout, CFFTopDict, CFFPrivateDictLayout, CFFPrivateDict, CFFCharsetPredefinedTypes, CFFCharset, CFFEncoding, CFFFDSelect, CFFOffsetTracker, CFFCompiler, getStdFontMap, getFontNameToFileMap, getNonStdFontMap, getSerifFonts, getSymbolsFonts, getGlyphMapForMacOrderedFonts, getGlyphMapForStandardFonts, getSupplementalGlyphMapForTrebuchetMS, getSupplementalGlyphMapForArialBlack, getSupplementalGlyphMapForCalibri, ON_CURVE_POINT, X_SHORT_VECTOR, Y_SHORT_VECTOR, REPEAT_FLAG, X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR, Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR, OVERLAP_SIMPLE, ARG_1_AND_2_ARE_WORDS, ARGS_ARE_XY_VALUES, WE_HAVE_A_SCALE, MORE_COMPONENTS, WE_HAVE_AN_X_AND_Y_SCALE, WE_HAVE_A_TWO_BY_TWO, WE_HAVE_INSTRUCTIONS, GLYPH_HEADER_SIZE, GlyfTable, Glyph, GlyphHeader, Contour, SimpleGlyph, CompositeGlyph, ToUnicodeMap, IdentityToUnicodeMap, CFFFont, CSS_FONT_INFO2, SYSTEM_FONT_INFO2, FONT_INFO2, PATTERN_INFO2, InfoUtils2, Commands, CompiledFont, TrueTypeCompiled, Type2Compiled, FontRendererFactory, getMetrics, getFontBasicMetrics, OTF_HEADER_SIZE, OTF_TABLE_ENTRY_SIZE, OpenTypeFileBuilder, COMMAND_MAP, Type1CharString, EEXEC_ENCRYPT_KEY, CHAR_STRS_ENCRYPT_KEY, Type1Parser, Type1Font, PRIVATE_USE_AREAS, PDF_GLYPH_SPACE_UNITS, EXPORT_DATA_PROPERTIES, EXPORT_DATA_EXTRA_PROPERTIES, fonts_Glyph, getSymbolGlyphIdEncoding, Font, ErrorFont, CalibriBoldFactors, CalibriBoldMetrics, CalibriBoldItalicFactors, CalibriBoldItalicMetrics, CalibriItalicFactors, CalibriItalicMetrics, CalibriRegularFactors, CalibriRegularMetrics, HelveticaBoldFactors, HelveticaBoldMetrics, HelveticaBoldItalicFactors, HelveticaBoldItalicMetrics, HelveticaItalicFactors, HelveticaItalicMetrics, HelveticaRegularFactors, HelveticaRegularMetrics, LiberationSansBoldWidths, LiberationSansBoldMapping, LiberationSansBoldItalicWidths, LiberationSansBoldItalicMapping, LiberationSansItalicWidths, LiberationSansItalicMapping, LiberationSansRegularWidths, LiberationSansRegularMapping, MyriadProBoldFactors, MyriadProBoldMetrics, MyriadProBoldItalicFactors, MyriadProBoldItalicMetrics, MyriadProItalicFactors, MyriadProItalicMetrics, MyriadProRegularFactors, MyriadProRegularMetrics, SegoeuiBoldFactors, SegoeuiBoldMetrics, SegoeuiBoldItalicFactors, SegoeuiBoldItalicMetrics, SegoeuiItalicFactors, SegoeuiItalicMetrics, SegoeuiRegularFactors, SegoeuiRegularMetrics, getXFAFontMap, TOKEN, Token, lexer_Lexer, PS_VALUE_TYPE, PS_NODE, PsNode, PsProgram, PsBlock, PsNumber, PsOperator, PsIf, PsIfElse, PsArgNode, PsConstNode, PsUnaryNode, PsBinaryNode, PsTernaryNode, ast_Parser, MAX_STACK_SIZE, PSStackToTree, OP, _DEG_TO_RAD, _RAD_TO_DEG, PsJsCompiler, PSStackBasedInterpreter, wasm_compiler_OP, FUNC_TYPE, F64, SECTION, EXTERN_FUNC, EXTERN_MEM, MATH_IMPORTS, _mathImportObject, PsWasmCompiler, BaseLocalCache, LocalImageCache, LocalColorSpaceCache, LocalFunctionCache, LocalGStateCache, LocalTilingPatternCache, RegionalImageCache, GlobalColorSpaceCache, GlobalImageCache, FunctionType, PDFFunctionFactory, PDFFunction, baseTypes, arabicTypes, chars, types, NORMAL, MEDIUM, BOLD, ITALIC, BOLDITALIC, substitutionMap, fontAliases, SEED3, MASK_HIGH3, MASK_LOW3, MurmurHash3_643, PDFImage, DefaultPartialEvaluatorOptions, PatternType, TEXT_CHUNK_BATCH_SIZE, deferred, TimeSlotManager, PartialEvaluator, TranslatedFont, StateManager, TextState, EvalState, EvaluatorPreprocessor, DefaultAppearanceEvaluator, AppearanceStreamEvaluator, FakeUnicodeFont, DateFormats, TimeFormats, es_json_stringify2, NameOrNumberTree, NameTree, NumberTree, FileSpec, XMLParserErrorCode, XMLParserBase, SimpleDOMNode, SimpleXMLParser, MetadataParser, WAV_HEADER_SIZE, MAX_DEPTH, TABLE_SPAN_ATTRIBUTES, StructElementType, StructTreeRoot, StructElementNode, StructElement, StructTreePage, isRef, isValidExplicitDest2, Catalog, FLATE_COLOR_COUNT_THRESHOLD, ObjectLoader, $acceptWhitespace, $addHTML, $appendChild, $childrenToHTML, $clean, $cleanPage, $cleanup, $clone, $consumed, $content, $data, $dump, $extra, $finalize, $flushHTML, $getAttributeIt, $getAttributes, $getAvailableSpace, $getChildrenByClass, $getChildrenByName, $getChildrenByNameIt, $getDataValue, $getExtra, $getRealChildrenByNameIt, $getChildren, $getContainedChildren, $getNextPage, $getSubformParent, $getParent, $getTemplateRoot, $globalData, $hasSettableValue, $ids, $indexOf, $insertAt, $isCDATAXml, $isBindable, $isDataValue, $isDescendent, $isNsAgnostic, $isSplittable, $isThereMoreWidth, $isTransparent, $isUsable, $lastAttribute, $namespaceId, $nodeName, $nsAttributes, $onChild, $onChildCheck, $onText, $pushGlyphs, $popPara, $pushPara, $removeChild, $root, $resolvePrototypes, $searchNode, $setId, $setSetAttributes, $setValue, $tabIndex, $text, $toPages, $toHTML, $toString, $toStyle, $uid, es_iterator_flat_map2, es_uint8_array_from_base642, $buildXFAObject, NamespaceIds, dimConverters, measurementPattern, HTMLResult, FontFinder, WIDTH_FACTOR, FontInfo2, FontSelector, TextMeasure, es_weak_map_get_or_insert2, es_weak_map_get_or_insert_computed2, namePattern, indexPattern, operators, shortcuts, somCache, _applyPrototype, _attributes, _attributeNames, _children, _cloneAttribute, _dataValue, _defaultValue, _filteredChildrenGenerator, _getPrototype, _getUnsetAttributes, _hasChildren, _max, _options, _parent, _resolvePrototypesHelper, _setAttributes, _validator, uid, NS_DATASETS, XFAObject, XFAObjectArray, XFAAttribute, XmlObject, ContentObject, OptionObject, StringObject, IntegerObject, Option01, Option10, converters, TEMPLATE_NS_ID, MAX_ATTEMPTS_FOR_LRTB_LAYOUT, MAX_EMPTY_PAGES, DEFAULT_TAB_INDEX2, HEADING_PATTERN, MIMES, IMAGES_HEADERS, AppearanceFilter, Arc, Area, Assist, Barcode, Bind, BindItems, Bookend, BooleanElement, Border, Break, BreakAfter, BreakBefore, Button, Calculate, Caption, Certificate, Certificates, CheckButton, ChoiceList, Color, Comb, Connect, ContentArea, Corner, DateElement, DateTime, DateTimeEdit, Decimal, DefaultUi, Desc, DigestMethod, DigestMethods, Draw, Edge, Encoding, Encodings, Encrypt, EncryptData, Encryption, EncryptionMethod, EncryptionMethods, Event2, ExData, ExObject, ExclGroup, Execute, Extras, Field, Fill, Filter, Float, template_Font, Format, Handler, Hyphenation, Image2, ImageEdit, Integer, Issuers, Items, Keep, KeyUsage, Line, Linear, LockDocument, Manifest, Margin, Mdp, Medium, Message, NumericEdit, Occur, Oid, Oids, Overflow, PageArea, PageSet, Para, PasswordEdit, template_Pattern, Picture, Proto, Radial, Reason, Reasons, Rectangle, RefElement, Script, SetProperty, SignData, Signature2, Signing, Solid, Speak, Stipple, Subform, SubformSet, SubjectDN, SubjectDNs, Submit, Template, Text, TextEdit, Time, TimeStamp, ToolTip, Traversal, Traverse, Ui, Validate, Value, Variables, TemplateNamespace, bind_NS_DATASETS, Binder, DataHandler, CONFIG_NS_ID, Acrobat, Acrobat7, ADBE_JSConsole, ADBE_JSDebugger, AddSilentPrint, AddViewerPreferences, AdjustData, AdobeExtensionLevel, Agent, AlwaysEmbed, Amd, config_Area, Attributes, AutoSave, Base, BatchOutput, BehaviorOverride, Cache2, Change, Common, Compress, CompressLogicalStructure, CompressObjectStream, Compression, Config, Conformance, ContentCopy, Copies, Creator, CurrentPage, Data, Debug, DefaultTypeface, Destination, DocumentAssembly, Driver, DuplexOption, DynamicRender, Embed, config_Encrypt, config_Encryption, EncryptionLevel, Enforce, Equate, EquateRange, Exclude, ExcludeNS, FlipLabel, config_FontInfo, FormFieldFilling, GroupParent, IfEmpty, IncludeXDPContent, IncrementalLoad, IncrementalMerge, Interactive, Jog, LabelPrinter, Layout, Level, Linearized, Locale, LocaleSet, Log, MapElement, MediumInfo, config_Message, Messaging, Mode, ModifyAnnots, MsgId, NameAttr, NeverEmbed, NumberOfCopies, OpenAction, Output, OutputBin, OutputXSL, Overprint, Packets, PageOffset, PageRange, Pagination, PaginationOverride, Part, Pcl, Pdf, Pdfa, Permissions, PickTrayByPDFSize, config_Picture, PlaintextMetadata, Presence, Present, Print, PrintHighQuality, PrintScaling, PrinterName, Producer, Ps, Range2, Record, Relevant, Rename, RenderPolicy, RunScripts, config_Script, ScriptModel, Severity, SilentPrint, Staple, StartNode, StartPage, SubmitFormat, SubmitUrl, SubsetBelow, SuppressBanner, Tagged, config_Template, Threshold, To, TemplateCache, Trace, Transform, Type, Uri, config_Validate, ValidateApprovalSignatures, ValidationMessaging, Version, VersionControl, ViewerPreferences, WebClient, Whitespace, Window, Xdc, Xdp, Xsl, Zpl, ConfigNamespace, CONNECTION_SET_NS_ID, ConnectionSet, EffectiveInputPolicy, EffectiveOutputPolicy, Operation, RootElement, SoapAction, SoapAddress, connection_set_Uri, WsdlAddress, WsdlConnection, XmlConnection, XsdConnection, ConnectionSetNamespace, DATASETS_NS_ID, datasets_Data, Datasets, DatasetsNamespace, LOCALE_SET_NS_ID, CalendarSymbols, CurrencySymbol, CurrencySymbols, DatePattern, DatePatterns, DateTimeSymbols, Day, DayNames, Era, EraNames, locale_set_Locale, locale_set_LocaleSet, Meridiem, MeridiemNames, Month, MonthNames, NumberPattern, NumberPatterns, NumberSymbol, NumberSymbols, TimePattern, TimePatterns, TypeFace, TypeFaces, LocaleSetNamespace, SIGNATURE_NS_ID, signature_Signature, SignatureNamespace, STYLESHEET_NS_ID, Stylesheet, StylesheetNamespace, XDP_NS_ID, xdp_Xdp, XdpNamespace, XHTML_NS_ID, $richText, VALID_STYLES, StyleMapping, spacesRegExp, crlfRegExp, crlfForRichTextRegExp, NoWhites, XhtmlObject, A, B, Body, Br, Html, I, Li, Ol, P, Span, Sub, Sup, Ul, XhtmlNamespace, NamespaceSetUp, UnknownNamespace, Root, Empty, Builder, XFAParser, XFAFactory, AnnotationFactory, Annotation, AnnotationBorderStyle, MarkupAnnotation, WidgetAnnotation, TextWidgetAnnotation, ButtonWidgetAnnotation, ChoiceWidgetAnnotation, SignatureWidgetAnnotation, TextAnnotation, LinkAnnotation, PopupAnnotation, FreeTextAnnotation, LineAnnotation, SquareAnnotation, CircleAnnotation, PolylineAnnotation, PolygonAnnotation, CaretAnnotation, InkAnnotation, HighlightAnnotation, UnderlineAnnotation, SquigglyAnnotation, StrikeOutAnnotation, StampAnnotation, FileAttachmentAnnotation, MediaAnnotation, RichMediaAnnotation, ScreenAnnotation, SoundAnnotation, PARAMS, DatasetXMLParser, DatasetReader, SingleIntersector, STEPS, Intersector, Word64, calculate_sha_other_PARAMS, calculate_sha256_PARAMS, chunkSize, DecryptStream, NON_ASCII_SPACES, COMMONLY_MAPPED_TO_NOTHING, ARCFourCipher, NullCipher, AESBaseCipher, AES128Cipher, AES256Cipher, PDFBase, PDF17, PDF20, CipherTransform, CipherTransformFactory, XRef, LETTER_SIZE_MEDIABOX, SIGNATURE_TAIL_CHUNK_SIZE, Page, PDF_HEADER_SIGNATURE, STARTXREF_SIGNATURE, ENDOBJ_SIGNATURE, PDFDocument, BasePdfManager, LocalPdfManager, NetworkPdfManager, es_promise_try2, CallbackKind3, StreamKind3, MessageHandler3, MAX_LEAVES_PER_PAGES_NODE, MAX_IN_NAME_TREE_NODE, PageData, DocumentData, XRefWrapper, PDFEditor, BasePDFStream2, BasePDFStreamReader2, BasePDFStreamRangeReader2, PDFWorkerStream, PDFWorkerStreamReader, PDFWorkerStreamRangeReader, WorkerTask, WorkerMessageHandler;
|
|
152280
152566
|
var init_pdf_worker = __esm({
|
|
152281
152567
|
"node_modules/officeparser/node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs"() {
|
|
152282
|
-
|
|
152568
|
+
import_meta4 = {};
|
|
152283
152569
|
__webpack_modules__2 = {
|
|
152284
152570
|
/***/
|
|
152285
152571
|
9306(module2, __unused_webpack_exports, __webpack_require__4) {
|
|
@@ -153823,7 +154109,7 @@ var init_pdf_worker = __esm({
|
|
|
153823
154109
|
var defineProperty = Object.defineProperty;
|
|
153824
154110
|
var stringSlice = uncurryThis("".slice);
|
|
153825
154111
|
var replace2 = uncurryThis("".replace);
|
|
153826
|
-
var
|
|
154112
|
+
var join17 = uncurryThis([].join);
|
|
153827
154113
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
153828
154114
|
return defineProperty(function() {
|
|
153829
154115
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -153856,7 +154142,7 @@ var init_pdf_worker = __esm({
|
|
|
153856
154142
|
}
|
|
153857
154143
|
var state = enforceInternalState(value);
|
|
153858
154144
|
if (!hasOwn(state, "source")) {
|
|
153859
|
-
state.source =
|
|
154145
|
+
state.source = join17(TEMPLATE, typeof name19 == "string" ? name19 : "");
|
|
153860
154146
|
}
|
|
153861
154147
|
return value;
|
|
153862
154148
|
};
|
|
@@ -156106,7 +156392,7 @@ var init_pdf_worker = __esm({
|
|
|
156106
156392
|
var charAt = uncurryThis("".charAt);
|
|
156107
156393
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
156108
156394
|
var $Array = globalThis2.Array;
|
|
156109
|
-
var
|
|
156395
|
+
var join17 = uncurryThis([].join);
|
|
156110
156396
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !function() {
|
|
156111
156397
|
try {
|
|
156112
156398
|
var target = new Uint8Array2();
|
|
@@ -156154,7 +156440,7 @@ var init_pdf_worker = __esm({
|
|
|
156154
156440
|
result[written++] = "=";
|
|
156155
156441
|
}
|
|
156156
156442
|
}
|
|
156157
|
-
return
|
|
156443
|
+
return join17(result, "");
|
|
156158
156444
|
}
|
|
156159
156445
|
});
|
|
156160
156446
|
},
|
|
@@ -156166,7 +156452,7 @@ var init_pdf_worker = __esm({
|
|
|
156166
156452
|
var anUint8Array = __webpack_require__4(4154);
|
|
156167
156453
|
var notDetached = __webpack_require__4(5169);
|
|
156168
156454
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
156169
|
-
var
|
|
156455
|
+
var join17 = uncurryThis([].join);
|
|
156170
156456
|
var $Array = Array;
|
|
156171
156457
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
156172
156458
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !function() {
|
|
@@ -156187,7 +156473,7 @@ var init_pdf_worker = __esm({
|
|
|
156187
156473
|
var hex = numberToString2(this[i], 16);
|
|
156188
156474
|
result[i] = hex.length === 1 ? "0" + hex : hex;
|
|
156189
156475
|
}
|
|
156190
|
-
return
|
|
156476
|
+
return join17(result, "");
|
|
156191
156477
|
}
|
|
156192
156478
|
});
|
|
156193
156479
|
},
|
|
@@ -213486,10 +213772,10 @@ function normalizeEdgeBoundary2(container, offset, textLayer) {
|
|
|
213486
213772
|
function percentage2(value) {
|
|
213487
213773
|
return `${(value * 100).toFixed(2)}%`;
|
|
213488
213774
|
}
|
|
213489
|
-
var
|
|
213775
|
+
var import_meta5, isNodeJS4, BBOX_INIT3, F32_BBOX_INIT3, FONT_IDENTITY_MATRIX4, SVG_NS4, RenderingIntentFlag4, AnnotationMode3, AnnotationPrefix4, AnnotationEditorPrefix4, AnnotationEditorType4, AnnotationEditorParamsType3, PermissionFlag4, TextRenderingMode4, ImageKind4, AnnotationType4, AnnotationBorderStyleType4, VerbosityLevel4, OPS4, DrawOPS3, PasswordResponses4, verbosity4, BaseException4, PasswordException4, UnknownErrorException4, InvalidPDFException4, ResponseException3, FormatError4, AbortException4, FeatureTest4, Util4, NormalizeRegex4, NormalizationMap4, makeArr3, makeMap3, makeObj3, makeSet3, PageViewport3, XfaText3, disallowedRichTextStyleRegExp2, disallowedEventHandlerAttrRegExp2, XfaLayer3, PixelsPerInch3, RenderingCancelledException3, StatTimer3, PDFDateString3, OutputScale3, SupportedImageMimeTypes2, ColorScheme2, CSSConstants2, contrastCache2, EditorToolbar3, FloatingToolbar2, INTERNAL_EVT2, internalOpt2, CurrentPointers2, IdManager3, ImageManager3, CommandManager3, KeyboardManager3, ColorManager3, AnnotationEditorUIManager3, AltText3, Comment2, MIN_TOUCH_SPAN2, TouchManager3, AnnotationEditor3, FakeEditor3, SEED4, MASK_HIGH4, MASK_LOW4, MurmurHash3_644, SerializableEmpty3, AnnotationStorage3, PrintAnnotationStorage3, FORCED_DEPENDENCY_LABEL2, floor2, ceil2, EMPTY_BBOX2, BBoxReader2, ensureDebugMetadata2, CanvasBBoxTracker2, CanvasDependencyTracker2, CanvasNestedDependencyTracker2, Dependencies2, CanvasImagesTracker2, CONTROL_CHAR_REGEXP3, FontLoader3, FontFaceObject3, CSS_FONT_INFO3, SYSTEM_FONT_INFO3, FONT_INFO3, PATTERN_INFO3, InfoUtils3, CssFontInfo2, SystemFontInfo2, FontInfo3, PatternInfo2, FontPathInfo2, isRefProxy3, isNameProxy2, isValidExplicitDest3, LoopbackPort3, CallbackKind4, StreamKind4, MessageHandler4, BaseBinaryDataFactory2, DOMBinaryDataFactory2, BaseCanvasFactory3, DOMCanvasFactory3, BaseFilterFactory3, DOMFilterFactory3, NodeFilterFactory3, NodeCanvasFactory3, NodeBinaryDataFactory2, MESH_WGSL2, WebGPU2, _webGPU2, PathType3, BaseShadingPattern3, RadialAxialShadingPattern3, MeshShadingPattern3, DummyShadingPattern3, PaintType3, TilingPattern3, MIN_FONT_SIZE3, MAX_FONT_SIZE3, EXECUTION_TIME3, EXECUTION_STEPS3, FULL_CHUNK_HEIGHT3, XY2, CanvasExtraState3, LINE_CAP_STYLES3, LINE_JOIN_STYLES3, NORMAL_CLIP3, EO_CLIP3, CanvasGraphics3, BasePDFStream3, BasePDFStreamReader3, BasePDFStreamRangeReader3, PDFFetchStream3, PDFFetchStreamReader3, PDFFetchStreamRangeReader3, PDFDataTransportStream3, PDFDataTransportStreamReader3, PDFDataTransportStreamRangeReader3, OK_RESPONSE3, PARTIAL_CONTENT_RESPONSE3, PDFNetworkStream3, PDFNetworkStreamReader2, PDFNetworkStreamRangeReader2, PDFNodeStream3, PDFNodeStreamReader2, PDFNodeStreamRangeReader2, GlobalWorkerOptions3, Metadata3, INTERNAL3, OptionalContentGroup3, OptionalContentConfig3, PagesMapper2, INITIAL_DATA3, dataObj2, PDFObjects3, MAX_TEXT_DIVS_TO_RENDER3, DEFAULT_FONT_SIZE3, TextLayer3, RENDERING_CANCELLED_TIMEOUT3, PDFDocumentLoadingTask3, PDFDataRangeTransport3, PDFDocumentProxy3, PDFPageProxy3, PDFWorker3, WorkerTransport3, RenderTask3, InternalRenderTask3, version6, build3, ColorPicker3, BasicColorPicker2, ColorConverters3, BaseSVGFactory3, DOMSVGFactory3, annotation_layer_DEFAULT_FONT_SIZE3, GetElementsByNameSet3, TIMEZONE_OFFSET2, AnnotationElementFactory3, AnnotationElement3, EditorAnnotationElement2, LinkAnnotationElement3, TextAnnotationElement3, WidgetAnnotationElement3, TextWidgetAnnotationElement3, SignatureWidgetAnnotationElement3, CheckboxWidgetAnnotationElement3, RadioButtonWidgetAnnotationElement3, PushButtonWidgetAnnotationElement3, ChoiceWidgetAnnotationElement3, PopupAnnotationElement3, PopupElement3, FreeTextAnnotationElement3, LineAnnotationElement3, SquareAnnotationElement3, CircleAnnotationElement3, PolylineAnnotationElement3, PolygonAnnotationElement3, CaretAnnotationElement3, InkAnnotationElement3, HighlightAnnotationElement3, UnderlineAnnotationElement3, SquigglyAnnotationElement3, StrikeOutAnnotationElement3, StampAnnotationElement3, FileAttachmentAnnotationElement3, MediaAnnotationElement2, AnnotationLayer3, EOL_PATTERN3, FreeTextEditor3, DrawingOptions3, DrawingEditor3, Outline3, FreeDrawOutliner3, FreeDrawOutline3, HighlightOutliner3, HighlightOutline3, FreeHighlightOutliner3, FreeHighlightDrawer2, FreeHighlightOutline3, HighlightDrawingOptions2, HighlightEditor3, InkDrawOutliner3, InkDrawOutline3, InkDrawingOptions3, InkEditor3, ContourDrawOutline2, BASE_HEADER_LENGTH2, POINTS_PROPERTIES_NUMBER2, SignatureExtractor2, SignatureOptions2, DrawnSignatureOptions2, SignatureEditor2, StampEditor3, AnnotationEditorLayer3, DrawLayer3, TextLayerImages2;
|
|
213490
213776
|
var init_pdf3 = __esm({
|
|
213491
213777
|
"node_modules/officeparser/node_modules/pdfjs-dist/build/pdf.mjs"() {
|
|
213492
|
-
|
|
213778
|
+
import_meta5 = {};
|
|
213493
213779
|
isNodeJS4 = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
|
|
213494
213780
|
BBOX_INIT3 = [Infinity, Infinity, -Infinity, -Infinity];
|
|
213495
213781
|
F32_BBOX_INIT3 = new Float32Array(BBOX_INIT3);
|
|
@@ -222227,7 +222513,7 @@ var init_pdf3 = __esm({
|
|
|
222227
222513
|
};
|
|
222228
222514
|
NodeCanvasFactory3 = class extends BaseCanvasFactory3 {
|
|
222229
222515
|
_createCanvas(width, height) {
|
|
222230
|
-
const require3 = process.getBuiltinModule("module").createRequire(
|
|
222516
|
+
const require3 = process.getBuiltinModule("module").createRequire(import_meta5.url);
|
|
222231
222517
|
const canvas = require3("@napi-rs/canvas");
|
|
222232
222518
|
return canvas.createCanvas(width, height);
|
|
222233
222519
|
}
|
|
@@ -270189,7 +270475,7 @@ var require_pdf_worker = __commonJS({
|
|
|
270189
270475
|
includes: function includes(searchElement) {
|
|
270190
270476
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
270191
270477
|
},
|
|
270192
|
-
join: function
|
|
270478
|
+
join: function join17(separator) {
|
|
270193
270479
|
return arrayJoin.apply(validate(this), arguments);
|
|
270194
270480
|
},
|
|
270195
270481
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -297409,7 +297695,7 @@ var require_pdf = __commonJS({
|
|
|
297409
297695
|
includes: function includes(searchElement) {
|
|
297410
297696
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
297411
297697
|
},
|
|
297412
|
-
join: function
|
|
297698
|
+
join: function join17(separator) {
|
|
297413
297699
|
return arrayJoin.apply(validate(this), arguments);
|
|
297414
297700
|
},
|
|
297415
297701
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -332754,7 +333040,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
332754
333040
|
includes: function includes(searchElement) {
|
|
332755
333041
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
332756
333042
|
},
|
|
332757
|
-
join: function
|
|
333043
|
+
join: function join17(separator) {
|
|
332758
333044
|
return arrayJoin.apply(validate(this), arguments);
|
|
332759
333045
|
},
|
|
332760
333046
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -360080,7 +360366,7 @@ var require_pdf2 = __commonJS({
|
|
|
360080
360366
|
includes: function includes(searchElement) {
|
|
360081
360367
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
360082
360368
|
},
|
|
360083
|
-
join: function
|
|
360369
|
+
join: function join17(separator) {
|
|
360084
360370
|
return arrayJoin.apply(validate(this), arguments);
|
|
360085
360371
|
},
|
|
360086
360372
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -484886,13 +485172,13 @@ function safeEntryDest(rootDir, entryName) {
|
|
|
484886
485172
|
if (!entryName || entryName.includes("\0"))
|
|
484887
485173
|
return null;
|
|
484888
485174
|
const norm = entryName.replace(/\\/g, "/");
|
|
484889
|
-
if ((0,
|
|
485175
|
+
if ((0, import_node_path5.isAbsolute)(norm) || /^[A-Za-z]:/.test(norm))
|
|
484890
485176
|
return null;
|
|
484891
485177
|
if (norm.split("/").some((s) => s === ".."))
|
|
484892
485178
|
return null;
|
|
484893
|
-
const root = (0,
|
|
484894
|
-
const dest = (0,
|
|
484895
|
-
if (dest !== root && !dest.startsWith(root +
|
|
485179
|
+
const root = (0, import_node_path5.resolve)(rootDir);
|
|
485180
|
+
const dest = (0, import_node_path5.resolve)(root, norm);
|
|
485181
|
+
if (dest !== root && !dest.startsWith(root + import_node_path5.sep))
|
|
484896
485182
|
return null;
|
|
484897
485183
|
return dest;
|
|
484898
485184
|
}
|
|
@@ -484906,11 +485192,11 @@ function unzipGuardFilter(maxTotalBytes, maxEntries) {
|
|
|
484906
485192
|
return total <= maxTotalBytes;
|
|
484907
485193
|
};
|
|
484908
485194
|
}
|
|
484909
|
-
var
|
|
485195
|
+
var import_node_path5;
|
|
484910
485196
|
var init_entry_guard = __esm({
|
|
484911
485197
|
"src/main/services/pure/entry-guard.ts"() {
|
|
484912
485198
|
"use strict";
|
|
484913
|
-
|
|
485199
|
+
import_node_path5 = require("node:path");
|
|
484914
485200
|
}
|
|
484915
485201
|
});
|
|
484916
485202
|
|
|
@@ -485731,13 +486017,13 @@ var init_Tokenizer = __esm({
|
|
|
485731
486017
|
this.state = State.InProcessingInstruction;
|
|
485732
486018
|
this.sectionStart = this.index + 1;
|
|
485733
486019
|
} else if (this.isTagStartChar(c)) {
|
|
485734
|
-
const
|
|
486020
|
+
const lower2 = c | 32;
|
|
485735
486021
|
this.sectionStart = this.index;
|
|
485736
486022
|
if (this.xmlMode) {
|
|
485737
486023
|
this.state = State.InTagName;
|
|
485738
|
-
} else if (
|
|
486024
|
+
} else if (lower2 === Sequences.ScriptEnd[2]) {
|
|
485739
486025
|
this.state = State.BeforeSpecialS;
|
|
485740
|
-
} else if (
|
|
486026
|
+
} else if (lower2 === Sequences.TitleEnd[2] || lower2 === Sequences.XmpEnd[2]) {
|
|
485741
486027
|
this.state = State.BeforeSpecialT;
|
|
485742
486028
|
} else {
|
|
485743
486029
|
this.state = State.InTagName;
|
|
@@ -485910,10 +486196,10 @@ var init_Tokenizer = __esm({
|
|
|
485910
486196
|
}
|
|
485911
486197
|
}
|
|
485912
486198
|
stateBeforeSpecialS(c) {
|
|
485913
|
-
const
|
|
485914
|
-
if (
|
|
486199
|
+
const lower2 = c | 32;
|
|
486200
|
+
if (lower2 === Sequences.ScriptEnd[3]) {
|
|
485915
486201
|
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
485916
|
-
} else if (
|
|
486202
|
+
} else if (lower2 === Sequences.StyleEnd[3]) {
|
|
485917
486203
|
this.startSpecial(Sequences.StyleEnd, 4);
|
|
485918
486204
|
} else {
|
|
485919
486205
|
this.state = State.InTagName;
|
|
@@ -485921,8 +486207,8 @@ var init_Tokenizer = __esm({
|
|
|
485921
486207
|
}
|
|
485922
486208
|
}
|
|
485923
486209
|
stateBeforeSpecialT(c) {
|
|
485924
|
-
const
|
|
485925
|
-
switch (
|
|
486210
|
+
const lower2 = c | 32;
|
|
486211
|
+
switch (lower2) {
|
|
485926
486212
|
case Sequences.TitleEnd[3]: {
|
|
485927
486213
|
this.startSpecial(Sequences.TitleEnd, 4);
|
|
485928
486214
|
break;
|
|
@@ -517852,14 +518138,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
517852
518138
|
} else if (node.nodeType === 1) {
|
|
517853
518139
|
replacement = replacementForNode.call(self2, node);
|
|
517854
518140
|
}
|
|
517855
|
-
return
|
|
518141
|
+
return join17(output, replacement);
|
|
517856
518142
|
}, "");
|
|
517857
518143
|
}
|
|
517858
518144
|
function postProcess(output) {
|
|
517859
518145
|
var self2 = this;
|
|
517860
518146
|
this.rules.forEach(function(rule) {
|
|
517861
518147
|
if (typeof rule.append === "function") {
|
|
517862
|
-
output =
|
|
518148
|
+
output = join17(output, rule.append(self2.options));
|
|
517863
518149
|
}
|
|
517864
518150
|
});
|
|
517865
518151
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -517872,7 +518158,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
517872
518158
|
content = content.trim();
|
|
517873
518159
|
return whitespace2.leading + rule.replacement(content, node, this.options) + whitespace2.trailing;
|
|
517874
518160
|
}
|
|
517875
|
-
function
|
|
518161
|
+
function join17(output, replacement) {
|
|
517876
518162
|
var s1 = trimTrailingNewlines(output);
|
|
517877
518163
|
var s2 = trimLeadingNewlines(replacement);
|
|
517878
518164
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -518399,13 +518685,13 @@ __export(content_source_exports, {
|
|
|
518399
518685
|
LocalContentSource: () => LocalContentSource,
|
|
518400
518686
|
MemoryContentSource: () => MemoryContentSource
|
|
518401
518687
|
});
|
|
518402
|
-
var import_promises2,
|
|
518688
|
+
var import_promises2, import_node_path7, import_node_fs6, GithubContentSource, LOCAL_IMAGE_MIME, LocalContentSource, MemoryContentSource;
|
|
518403
518689
|
var init_content_source = __esm({
|
|
518404
518690
|
"src/main/services/content-source.ts"() {
|
|
518405
518691
|
"use strict";
|
|
518406
518692
|
import_promises2 = require("node:fs/promises");
|
|
518407
|
-
|
|
518408
|
-
|
|
518693
|
+
import_node_path7 = require("node:path");
|
|
518694
|
+
import_node_fs6 = require("node:fs");
|
|
518409
518695
|
init_repo_fetcher();
|
|
518410
518696
|
GithubContentSource = class {
|
|
518411
518697
|
constructor(owner, repo, branch, fetchFn) {
|
|
@@ -518443,8 +518729,8 @@ var init_content_source = __esm({
|
|
|
518443
518729
|
}
|
|
518444
518730
|
async getImageDataUrl(path6, maxBytes = 2e5) {
|
|
518445
518731
|
try {
|
|
518446
|
-
const abs = (0,
|
|
518447
|
-
if (!(0,
|
|
518732
|
+
const abs = (0, import_node_path7.join)(this.rootDir, path6);
|
|
518733
|
+
if (!(0, import_node_fs6.existsSync)(abs))
|
|
518448
518734
|
return null;
|
|
518449
518735
|
const buf = await (0, import_promises2.readFile)(abs);
|
|
518450
518736
|
if (buf.length > maxBytes)
|
|
@@ -519095,9 +519381,9 @@ function runYtDlp(args, signal) {
|
|
|
519095
519381
|
async function fetchViaYtDlp(url2, dataDir, onProgress, signal) {
|
|
519096
519382
|
if (!ytDlpPath())
|
|
519097
519383
|
throw new Error(YT_DLP_GUIDE);
|
|
519098
|
-
const workDir = (0,
|
|
519099
|
-
(0,
|
|
519100
|
-
(0,
|
|
519384
|
+
const workDir = (0, import_node_path9.join)(dataDir, "video-tmp", (0, import_node_crypto7.createHash)("sha1").update(url2).digest("hex").slice(0, 12));
|
|
519385
|
+
(0, import_node_fs8.rmSync)(workDir, { recursive: true, force: true });
|
|
519386
|
+
(0, import_node_fs8.mkdirSync)(workDir, { recursive: true });
|
|
519101
519387
|
try {
|
|
519102
519388
|
const t = await runYtDlp(["--print", "title", "--no-warnings", url2], signal);
|
|
519103
519389
|
const title = t.stdout.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? url2;
|
|
@@ -519111,38 +519397,38 @@ async function fetchViaYtDlp(url2, dataDir, onProgress, signal) {
|
|
|
519111
519397
|
"--sub-format",
|
|
519112
519398
|
"vtt/srt/best",
|
|
519113
519399
|
"-o",
|
|
519114
|
-
(0,
|
|
519400
|
+
(0, import_node_path9.join)(workDir, "sub.%(ext)s"),
|
|
519115
519401
|
"--no-warnings",
|
|
519116
519402
|
url2
|
|
519117
519403
|
], signal);
|
|
519118
|
-
const subFile = pickSubtitleFile((0,
|
|
519404
|
+
const subFile = pickSubtitleFile((0, import_node_fs8.readdirSync)(workDir));
|
|
519119
519405
|
if (subFile) {
|
|
519120
|
-
const text3 = parseSubtitleToText((0,
|
|
519406
|
+
const text3 = parseSubtitleToText((0, import_node_fs8.readFileSync)((0, import_node_path9.join)(workDir, subFile), "utf8"));
|
|
519121
519407
|
if (text3.length > 50) {
|
|
519122
519408
|
onProgress?.("\u5DF2\u6709\u5B57\u5E55,\u76F4\u63A5\u6210\u6587(\u96F6\u8F6C\u5199)\u2026");
|
|
519123
519409
|
return { source: "subtitle", title, text: text3 };
|
|
519124
519410
|
}
|
|
519125
519411
|
}
|
|
519126
519412
|
onProgress?.(`\u65E0\u5B57\u5E55,\u4E0B\u8F7D\u97F3\u8F68(${title})\u2026`);
|
|
519127
|
-
const dl = await runYtDlp(["-f", "bestaudio", "-o", (0,
|
|
519413
|
+
const dl = await runYtDlp(["-f", "bestaudio", "-o", (0, import_node_path9.join)(workDir, "audio.%(ext)s"), "--no-warnings", url2], signal);
|
|
519128
519414
|
if (dl.code !== 0)
|
|
519129
519415
|
throw new Error(`yt-dlp \u4E0B\u8F7D\u5931\u8D25: ${dl.stdout.slice(-300)}`);
|
|
519130
|
-
const audioFile = (0,
|
|
519416
|
+
const audioFile = (0, import_node_fs8.readdirSync)(workDir).find((f) => f.startsWith("audio."));
|
|
519131
519417
|
if (!audioFile)
|
|
519132
519418
|
throw new Error("yt-dlp \u672A\u4EA7\u51FA\u97F3\u9891\u6587\u4EF6");
|
|
519133
519419
|
const ext = audioFile.split(".").pop() ?? "m4a";
|
|
519134
|
-
return { source: "audio", title, bytes: new Uint8Array((0,
|
|
519420
|
+
return { source: "audio", title, bytes: new Uint8Array((0, import_node_fs8.readFileSync)((0, import_node_path9.join)(workDir, audioFile))), ext };
|
|
519135
519421
|
} finally {
|
|
519136
|
-
(0,
|
|
519422
|
+
(0, import_node_fs8.rmSync)(workDir, { recursive: true, force: true });
|
|
519137
519423
|
}
|
|
519138
519424
|
}
|
|
519139
|
-
var import_node_child_process,
|
|
519425
|
+
var import_node_child_process, import_node_fs8, import_node_path9, import_node_crypto7, BILI_HEADERS, ytdlpCache, YT_DLP_GUIDE;
|
|
519140
519426
|
var init_video_import_service = __esm({
|
|
519141
519427
|
"src/main/services/video-import-service.ts"() {
|
|
519142
519428
|
"use strict";
|
|
519143
519429
|
import_node_child_process = require("node:child_process");
|
|
519144
|
-
|
|
519145
|
-
|
|
519430
|
+
import_node_fs8 = require("node:fs");
|
|
519431
|
+
import_node_path9 = require("node:path");
|
|
519146
519432
|
import_node_crypto7 = require("node:crypto");
|
|
519147
519433
|
init_bilibili_wbi();
|
|
519148
519434
|
init_repo_fetcher();
|
|
@@ -521974,17 +522260,17 @@ __export(speech_model_service_exports, {
|
|
|
521974
522260
|
speechModelsRoot: () => speechModelsRoot
|
|
521975
522261
|
});
|
|
521976
522262
|
function speechModelsRoot(dataDir) {
|
|
521977
|
-
return
|
|
522263
|
+
return import_node_path10.default.join(dataDir, "speech-models");
|
|
521978
522264
|
}
|
|
521979
522265
|
function speechModelDir(dataDir, id) {
|
|
521980
|
-
return
|
|
522266
|
+
return import_node_path10.default.join(speechModelsRoot(dataDir), id);
|
|
521981
522267
|
}
|
|
521982
522268
|
function listModelFiles(dir) {
|
|
521983
522269
|
const out = /* @__PURE__ */ new Map();
|
|
521984
522270
|
const walk = (rel) => {
|
|
521985
522271
|
let entries3;
|
|
521986
522272
|
try {
|
|
521987
|
-
entries3 =
|
|
522273
|
+
entries3 = import_node_fs9.default.readdirSync(import_node_path10.default.join(dir, rel), { withFileTypes: true });
|
|
521988
522274
|
} catch {
|
|
521989
522275
|
return;
|
|
521990
522276
|
}
|
|
@@ -521996,7 +522282,7 @@ function listModelFiles(dir) {
|
|
|
521996
522282
|
walk(child);
|
|
521997
522283
|
else if (e.isFile()) {
|
|
521998
522284
|
try {
|
|
521999
|
-
out.set(child,
|
|
522285
|
+
out.set(child, import_node_fs9.default.statSync(import_node_path10.default.join(dir, child)).size);
|
|
522000
522286
|
} catch {
|
|
522001
522287
|
}
|
|
522002
522288
|
}
|
|
@@ -522092,12 +522378,12 @@ function streamToFile(resp, dest, opts) {
|
|
|
522092
522378
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
522093
522379
|
ws.destroy();
|
|
522094
522380
|
if (err2) {
|
|
522095
|
-
|
|
522381
|
+
import_node_fs9.default.rm(dest, { force: true }, () => reject(err2));
|
|
522096
522382
|
} else {
|
|
522097
522383
|
resolve5(written2);
|
|
522098
522384
|
}
|
|
522099
522385
|
};
|
|
522100
|
-
const ws =
|
|
522386
|
+
const ws = import_node_fs9.default.createWriteStream(dest);
|
|
522101
522387
|
let written = 0;
|
|
522102
522388
|
const armIdle = () => {
|
|
522103
522389
|
clearTimeout(idle);
|
|
@@ -522119,7 +522405,7 @@ function streamToFile(resp, dest, opts) {
|
|
|
522119
522405
|
}
|
|
522120
522406
|
async function downloadFile(url2, dest, opts = {}) {
|
|
522121
522407
|
const part = `${dest}.part`;
|
|
522122
|
-
|
|
522408
|
+
import_node_fs9.default.mkdirSync(import_node_path10.default.dirname(dest), { recursive: true });
|
|
522123
522409
|
const resp = await httpsStreamFollow(url2, opts.signal);
|
|
522124
522410
|
if (resp.status !== 200) {
|
|
522125
522411
|
resp.stream.resume();
|
|
@@ -522183,7 +522469,7 @@ async function downloadFromModelscope(dir, entry, source, hooks, signal) {
|
|
|
522183
522469
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
522184
522470
|
partial2.set(f.path, 0);
|
|
522185
522471
|
try {
|
|
522186
|
-
await downloadFile(url2,
|
|
522472
|
+
await downloadFile(url2, import_node_path10.default.join(dir, f.path), {
|
|
522187
522473
|
expectBytes: f.bytes,
|
|
522188
522474
|
signal,
|
|
522189
522475
|
onBytes: (n) => {
|
|
@@ -522231,16 +522517,16 @@ function extractTarBz2(archive, dir, stripTopDir, signal) {
|
|
|
522231
522517
|
stream.resume();
|
|
522232
522518
|
return next();
|
|
522233
522519
|
}
|
|
522234
|
-
const dest =
|
|
522235
|
-
|
|
522236
|
-
const ws =
|
|
522520
|
+
const dest = import_node_path10.default.join(dir, rel);
|
|
522521
|
+
import_node_fs9.default.mkdirSync(import_node_path10.default.dirname(dest), { recursive: true });
|
|
522522
|
+
const ws = import_node_fs9.default.createWriteStream(dest);
|
|
522237
522523
|
stream.pipe(ws);
|
|
522238
522524
|
ws.on("finish", next);
|
|
522239
522525
|
ws.on("error", (e) => finish(e));
|
|
522240
522526
|
});
|
|
522241
522527
|
extract.on("finish", () => finish(null));
|
|
522242
522528
|
extract.on("error", (e) => finish(e));
|
|
522243
|
-
const rs =
|
|
522529
|
+
const rs = import_node_fs9.default.createReadStream(archive);
|
|
522244
522530
|
const bz = unbzip2();
|
|
522245
522531
|
rs.on("error", (e) => finish(e));
|
|
522246
522532
|
bz.on("error", (e) => finish(e));
|
|
@@ -522253,7 +522539,7 @@ function extractTarBz2(archive, dir, stripTopDir, signal) {
|
|
|
522253
522539
|
});
|
|
522254
522540
|
}
|
|
522255
522541
|
async function downloadFromGithubArchive(dir, entry, source, hooks, signal) {
|
|
522256
|
-
const archivePath =
|
|
522542
|
+
const archivePath = import_node_path10.default.join(dir, ".download.tar.bz2");
|
|
522257
522543
|
let lastErr;
|
|
522258
522544
|
for (const url2 of archiveCandidateUrls(source)) {
|
|
522259
522545
|
try {
|
|
@@ -522310,7 +522596,7 @@ async function ensureSpeechModel(dataDir, entry, hooks = {}, signal) {
|
|
|
522310
522596
|
throw new Error(`${used} \u4E0B\u8F7D\u5B8C\u6210\u4F46\u53D8\u4F53\u6587\u4EF6\u4E0D\u9F50`);
|
|
522311
522597
|
hooks.onProgress?.({ id: entry.id, downloadedBytes: entry.approxBytes, totalBytes: entry.approxBytes, progress: 1, source: used });
|
|
522312
522598
|
await import_promises3.default.writeFile(
|
|
522313
|
-
|
|
522599
|
+
import_node_path10.default.join(dir, ".ready.json"),
|
|
522314
522600
|
JSON.stringify({ id: entry.id, variant, source: used, completedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)
|
|
522315
522601
|
);
|
|
522316
522602
|
return { variant, source: used };
|
|
@@ -522322,13 +522608,13 @@ async function ensureSpeechModel(dataDir, entry, hooks = {}, signal) {
|
|
|
522322
522608
|
}
|
|
522323
522609
|
throw lastErr instanceof Error ? lastErr : new Error("speech model download failed");
|
|
522324
522610
|
}
|
|
522325
|
-
var
|
|
522611
|
+
var import_node_fs9, import_promises3, import_node_path10, import_node_https2, import_tar_stream;
|
|
522326
522612
|
var init_speech_model_service = __esm({
|
|
522327
522613
|
"src/main/services/speech/speech-model-service.ts"() {
|
|
522328
522614
|
"use strict";
|
|
522329
|
-
|
|
522615
|
+
import_node_fs9 = __toESM(require("node:fs"));
|
|
522330
522616
|
import_promises3 = __toESM(require("node:fs/promises"));
|
|
522331
|
-
|
|
522617
|
+
import_node_path10 = __toESM(require("node:path"));
|
|
522332
522618
|
import_node_https2 = __toESM(require("node:https"));
|
|
522333
522619
|
import_tar_stream = __toESM(require_tar_stream());
|
|
522334
522620
|
init_speech_model_manifest();
|
|
@@ -522354,7 +522640,7 @@ __export(speech_engine_exports, {
|
|
|
522354
522640
|
whisperPrefix: () => whisperPrefix
|
|
522355
522641
|
});
|
|
522356
522642
|
function buildTtsConfig(modelDir) {
|
|
522357
|
-
const p = (f) =>
|
|
522643
|
+
const p = (f) => import_node_path11.default.join(modelDir, f);
|
|
522358
522644
|
return {
|
|
522359
522645
|
model: {
|
|
522360
522646
|
kokoro: {
|
|
@@ -522379,7 +522665,7 @@ function whisperPrefix(entryId) {
|
|
|
522379
522665
|
return entryId === "asr-whisper-small" ? "small" : "turbo";
|
|
522380
522666
|
}
|
|
522381
522667
|
function buildWhisperConfig(modelDir, prefix, variant, language) {
|
|
522382
|
-
const p = (f) =>
|
|
522668
|
+
const p = (f) => import_node_path11.default.join(modelDir, f);
|
|
522383
522669
|
const suffix = variant === "int8" ? ".int8" : "";
|
|
522384
522670
|
return {
|
|
522385
522671
|
featConfig: { sampleRate: 16e3, featureDim: 80 },
|
|
@@ -522500,11 +522786,11 @@ async function synthesize(tts, text3, opts = {}) {
|
|
|
522500
522786
|
});
|
|
522501
522787
|
return { samples: audio.samples, sampleRate: audio.sampleRate };
|
|
522502
522788
|
}
|
|
522503
|
-
var
|
|
522789
|
+
var import_node_path11, DEFAULT_TTS_SID, DEFAULT_TTS_SPEED, ttsHolder, whisperHolder, sherpaCache, ttsCreating, whisperCreating, engineGeneration;
|
|
522504
522790
|
var init_speech_engine = __esm({
|
|
522505
522791
|
"src/main/services/speech/speech-engine.ts"() {
|
|
522506
522792
|
"use strict";
|
|
522507
|
-
|
|
522793
|
+
import_node_path11 = __toESM(require("node:path"));
|
|
522508
522794
|
init_speech_plan();
|
|
522509
522795
|
init_native_require();
|
|
522510
522796
|
init_speech_model_service();
|
|
@@ -525861,17 +526147,17 @@ function getAssetsRoot() {
|
|
|
525861
526147
|
if (assetsRootOverride)
|
|
525862
526148
|
return assetsRootOverride;
|
|
525863
526149
|
const { app } = require("electron");
|
|
525864
|
-
return (0,
|
|
526150
|
+
return (0, import_node_path16.join)(app.getPath("userData"), "assets");
|
|
525865
526151
|
}
|
|
525866
526152
|
function getCourseAssetsDir(courseId) {
|
|
525867
|
-
return (0,
|
|
526153
|
+
return (0, import_node_path16.join)(getAssetsRoot(), courseId);
|
|
525868
526154
|
}
|
|
525869
526155
|
function getAssetFilePath(courseId, filename) {
|
|
525870
|
-
return (0,
|
|
526156
|
+
return (0, import_node_path16.join)(getCourseAssetsDir(courseId), filename);
|
|
525871
526157
|
}
|
|
525872
526158
|
async function copyImageToAssets(sourceAbsPath, courseId, destFilename) {
|
|
525873
526159
|
const dir = getCourseAssetsDir(courseId);
|
|
525874
|
-
if (!(0,
|
|
526160
|
+
if (!(0, import_node_fs14.existsSync)(dir)) {
|
|
525875
526161
|
await (0, import_promises7.mkdir)(dir, { recursive: true });
|
|
525876
526162
|
}
|
|
525877
526163
|
const destPath = getAssetFilePath(courseId, destFilename);
|
|
@@ -525880,7 +526166,7 @@ async function copyImageToAssets(sourceAbsPath, courseId, destFilename) {
|
|
|
525880
526166
|
}
|
|
525881
526167
|
async function writeBufferToAssets(buffer, courseId, destFilename) {
|
|
525882
526168
|
const dir = getCourseAssetsDir(courseId);
|
|
525883
|
-
if (!(0,
|
|
526169
|
+
if (!(0, import_node_fs14.existsSync)(dir)) {
|
|
525884
526170
|
await (0, import_promises7.mkdir)(dir, { recursive: true });
|
|
525885
526171
|
}
|
|
525886
526172
|
const destPath = getAssetFilePath(courseId, destFilename);
|
|
@@ -525926,7 +526212,7 @@ async function getAssetDataUrl(db, assetId) {
|
|
|
525926
526212
|
if (!asset)
|
|
525927
526213
|
return null;
|
|
525928
526214
|
const filePath = getAssetFilePath(asset.courseId, asset.filename);
|
|
525929
|
-
if (!(0,
|
|
526215
|
+
if (!(0, import_node_fs14.existsSync)(filePath))
|
|
525930
526216
|
return null;
|
|
525931
526217
|
const buf = await (0, import_promises7.readFile)(filePath);
|
|
525932
526218
|
const base643 = buf.toString("base64");
|
|
@@ -525934,18 +526220,18 @@ async function getAssetDataUrl(db, assetId) {
|
|
|
525934
526220
|
}
|
|
525935
526221
|
async function deleteCourseAssetsFiles(courseId) {
|
|
525936
526222
|
const dir = getCourseAssetsDir(courseId);
|
|
525937
|
-
if (!(0,
|
|
526223
|
+
if (!(0, import_node_fs14.existsSync)(dir))
|
|
525938
526224
|
return;
|
|
525939
526225
|
const { rm: rm2 } = await import("node:fs/promises");
|
|
525940
526226
|
await rm2(dir, { recursive: true, force: true });
|
|
525941
526227
|
}
|
|
525942
|
-
var
|
|
526228
|
+
var import_node_path16, import_promises7, import_node_fs14, import_node_crypto20, EXT_MIME, assetsRootOverride;
|
|
525943
526229
|
var init_asset_service = __esm({
|
|
525944
526230
|
"src/main/services/asset-service.ts"() {
|
|
525945
526231
|
"use strict";
|
|
525946
|
-
|
|
526232
|
+
import_node_path16 = require("node:path");
|
|
525947
526233
|
import_promises7 = require("node:fs/promises");
|
|
525948
|
-
|
|
526234
|
+
import_node_fs14 = require("node:fs");
|
|
525949
526235
|
init_drizzle_orm();
|
|
525950
526236
|
init_schema();
|
|
525951
526237
|
init_schema();
|
|
@@ -526729,13 +527015,13 @@ var init_translation_service = __esm({
|
|
|
526729
527015
|
|
|
526730
527016
|
// src/main/serve/index.ts
|
|
526731
527017
|
var import_node_os4 = require("node:os");
|
|
526732
|
-
var
|
|
527018
|
+
var import_node_path20 = require("node:path");
|
|
526733
527019
|
|
|
526734
527020
|
// src/main/serve/server.ts
|
|
526735
527021
|
var import_node_http = require("node:http");
|
|
526736
527022
|
var import_node_https3 = require("node:https");
|
|
526737
|
-
var
|
|
526738
|
-
var
|
|
527023
|
+
var import_node_fs16 = require("node:fs");
|
|
527024
|
+
var import_node_path19 = require("node:path");
|
|
526739
527025
|
var import_node_crypto27 = require("node:crypto");
|
|
526740
527026
|
|
|
526741
527027
|
// node_modules/ws/wrapper.mjs
|
|
@@ -526768,7 +527054,7 @@ function parseClientFrame(raw) {
|
|
|
526768
527054
|
}
|
|
526769
527055
|
|
|
526770
527056
|
// src/main/ipc/index.ts
|
|
526771
|
-
var
|
|
527057
|
+
var import_node_path17 = require("node:path");
|
|
526772
527058
|
init_db2();
|
|
526773
527059
|
|
|
526774
527060
|
// src/main/services/dsh-import-service.ts
|
|
@@ -527421,7 +527707,7 @@ init_drizzle_orm();
|
|
|
527421
527707
|
var import_node_crypto26 = require("node:crypto");
|
|
527422
527708
|
|
|
527423
527709
|
// package.json
|
|
527424
|
-
var version2 = "0.
|
|
527710
|
+
var version2 = "0.38.0";
|
|
527425
527711
|
|
|
527426
527712
|
// src/main/lib/update-check.ts
|
|
527427
527713
|
var RELEASES_PAGE = "https://github.com/Kaiji-Z/LookatStudy/releases";
|
|
@@ -527545,7 +527831,7 @@ function createPlanStore(dir) {
|
|
|
527545
527831
|
}
|
|
527546
527832
|
|
|
527547
527833
|
// src/main/services/import-job-service.ts
|
|
527548
|
-
var
|
|
527834
|
+
var import_node_fs10 = require("node:fs");
|
|
527549
527835
|
var import_node_crypto8 = require("node:crypto");
|
|
527550
527836
|
init_drizzle_orm();
|
|
527551
527837
|
init_schema();
|
|
@@ -527554,8 +527840,8 @@ init_import_llm_service();
|
|
|
527554
527840
|
|
|
527555
527841
|
// src/main/services/pure/local-folder-scanner.ts
|
|
527556
527842
|
var import_promises = require("node:fs/promises");
|
|
527557
|
-
var
|
|
527558
|
-
var
|
|
527843
|
+
var import_node_fs5 = require("node:fs");
|
|
527844
|
+
var import_node_path6 = require("node:path");
|
|
527559
527845
|
|
|
527560
527846
|
// import("./**/*.js") in src/main/services/pure/local-folder-scanner.ts
|
|
527561
527847
|
var globImport_js2 = __glob({});
|
|
@@ -527684,17 +527970,17 @@ function htmlToText(html) {
|
|
|
527684
527970
|
return s.trim();
|
|
527685
527971
|
}
|
|
527686
527972
|
function detectLang(filename) {
|
|
527687
|
-
const
|
|
527688
|
-
if (/\.zh[-_]?cn\./.test(
|
|
527973
|
+
const lower2 = filename.toLowerCase();
|
|
527974
|
+
if (/\.zh[-_]?cn\./.test(lower2) || /\.zh[-_]?hans\./.test(lower2) || /\.zh[-_]?tw\./.test(lower2) || /\.zh[-_]?hant\./.test(lower2) || /\.zh\./.test(lower2))
|
|
527689
527975
|
return "zh";
|
|
527690
|
-
if (/\.en[-_]?us\./.test(
|
|
527976
|
+
if (/\.en[-_]?us\./.test(lower2) || /\.en[-_]?gb\./.test(lower2) || /\.en\./.test(lower2))
|
|
527691
527977
|
return "en";
|
|
527692
|
-
if (/\.ja\./.test(
|
|
527978
|
+
if (/\.ja\./.test(lower2) || /\.ko\./.test(lower2) || /\.de\./.test(lower2) || /\.fr\./.test(lower2) || /\.es\./.test(lower2) || /\.pt[-_]?br\./.test(lower2) || /\.pt\./.test(lower2) || /\.it\./.test(lower2) || /\.ru\./.test(lower2) || /\.ar\./.test(lower2))
|
|
527693
527979
|
return "other";
|
|
527694
527980
|
return "other";
|
|
527695
527981
|
}
|
|
527696
527982
|
function inferTitle(relPath) {
|
|
527697
|
-
const filename = (0,
|
|
527983
|
+
const filename = (0, import_node_path6.basename)(relPath);
|
|
527698
527984
|
let name19 = filename.replace(/\.(txt|md|mdx|markdown|html?|pdf|ipynb|rst|rmd|org|adoc|asciidoc|py|js|jsx|ts|tsx|mjs|cjs|go|rs|java|kt|kts|scala|c|h|cpp|cc|cxx|hpp|cs|rb|php|swift|sh|bash|zsh|ps1|lua|r|jl|dart|clj|ex|exs|erl|hs|ml|fs|sql|pl|elm)$/i, "");
|
|
527699
527985
|
name19 = name19.replace(/\.(zh[-_]?cn|zh[-_]?hans|zh|en[-_]?us|en)$/i, "");
|
|
527700
527986
|
if (/^(readme|index)$/i.test(name19)) {
|
|
@@ -527710,7 +527996,7 @@ function inferTitle(relPath) {
|
|
|
527710
527996
|
return name19 || filename;
|
|
527711
527997
|
}
|
|
527712
527998
|
function dedupKey(relPath) {
|
|
527713
|
-
const filename = (0,
|
|
527999
|
+
const filename = (0, import_node_path6.basename)(relPath);
|
|
527714
528000
|
let name19 = filename.replace(/\.(txt|md|mdx|markdown|html?|pdf|ipynb|rst|rmd|org|adoc|asciidoc|py|js|jsx|ts|tsx|mjs|cjs|go|rs|java|kt|kts|scala|c|h|cpp|cc|cxx|hpp|cs|rb|php|swift|sh|bash|zsh|ps1|lua|r|jl|dart|clj|ex|exs|erl|hs|ml|fs|sql|pl|elm)$/i, "");
|
|
527715
528001
|
name19 = name19.replace(/\.(zh[-_]?cn|zh[-_]?hans|zh|en[-_]?us|en)$/i, "");
|
|
527716
528002
|
return name19.toLowerCase();
|
|
@@ -527769,7 +528055,7 @@ async function scanFolder(rootDir, onProgress, options) {
|
|
|
527769
528055
|
const ext = resolvedPath.toLowerCase().match(/\.([^.]+)$/)?.[1] ?? "";
|
|
527770
528056
|
refImages.push({
|
|
527771
528057
|
path: resolvedPath,
|
|
527772
|
-
absPath: (0,
|
|
528058
|
+
absPath: (0, import_node_path6.join)(rootDir, resolvedPath),
|
|
527773
528059
|
title: ref.alt || inferImageTitle(resolvedPath),
|
|
527774
528060
|
mime: IMAGE_EXT_MIME[ext] ?? "image/png",
|
|
527775
528061
|
source: "markdown_ref",
|
|
@@ -527784,7 +528070,7 @@ async function scanFolder(rootDir, onProgress, options) {
|
|
|
527784
528070
|
continue;
|
|
527785
528071
|
try {
|
|
527786
528072
|
const { processPdf: processPdf2 } = await Promise.resolve().then(() => (init_pdf_renderer(), pdf_renderer_exports));
|
|
527787
|
-
const pdfBuf = await (0, import_promises.readFile)((0,
|
|
528073
|
+
const pdfBuf = await (0, import_promises.readFile)((0, import_node_path6.join)(rootDir, doc.path));
|
|
527788
528074
|
const result = await processPdf2(pdfBuf);
|
|
527789
528075
|
for (const img of result.images) {
|
|
527790
528076
|
pdfImages.push({
|
|
@@ -527808,7 +528094,7 @@ async function scanFolder(rootDir, onProgress, options) {
|
|
|
527808
528094
|
continue;
|
|
527809
528095
|
try {
|
|
527810
528096
|
const { parsePptx: parsePptx2 } = await Promise.resolve().then(() => (init_pptx_parser(), pptx_parser_exports));
|
|
527811
|
-
const pptxBuf = await (0, import_promises.readFile)((0,
|
|
528097
|
+
const pptxBuf = await (0, import_promises.readFile)((0, import_node_path6.join)(rootDir, doc.path));
|
|
527812
528098
|
const result = await parsePptx2(pptxBuf);
|
|
527813
528099
|
for (const img of result.images) {
|
|
527814
528100
|
pptxImages.push({
|
|
@@ -527833,7 +528119,7 @@ async function scanFolder(rootDir, onProgress, options) {
|
|
|
527833
528119
|
continue;
|
|
527834
528120
|
try {
|
|
527835
528121
|
const { parseNotebook: parseNotebook2 } = await Promise.resolve().then(() => (init_notebook_parser(), notebook_parser_exports));
|
|
527836
|
-
const nbRaw = await (0, import_promises.readFile)((0,
|
|
528122
|
+
const nbRaw = await (0, import_promises.readFile)((0, import_node_path6.join)(rootDir, doc.path), "utf8");
|
|
527837
528123
|
const nbResult = parseNotebook2(nbRaw);
|
|
527838
528124
|
for (const img of nbResult.images) {
|
|
527839
528125
|
const buf = Buffer.from(img.base64, "base64");
|
|
@@ -527907,7 +528193,7 @@ function extractImageRefs(md) {
|
|
|
527907
528193
|
return refs3;
|
|
527908
528194
|
}
|
|
527909
528195
|
function resolveImageRef(refPath, docRelPath) {
|
|
527910
|
-
const docDir = (0,
|
|
528196
|
+
const docDir = (0, import_node_path6.dirname)(docRelPath).replace(/\\/g, "/");
|
|
527911
528197
|
const normalized = refPath.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
527912
528198
|
const parts = docDir === "." ? [] : docDir.split("/").filter(Boolean);
|
|
527913
528199
|
const refParts = normalized.split("/");
|
|
@@ -527920,13 +528206,13 @@ function resolveImageRef(refPath, docRelPath) {
|
|
|
527920
528206
|
return parts.join("/");
|
|
527921
528207
|
}
|
|
527922
528208
|
function inferImageTitle(filename) {
|
|
527923
|
-
let name19 = (0,
|
|
528209
|
+
let name19 = (0, import_node_path6.basename)(filename);
|
|
527924
528210
|
name19 = name19.replace(/\.(png|jpe?g|gif|webp|svg|bmp)$/i, "");
|
|
527925
528211
|
name19 = name19.replace(/^(\d+[_-]\s*)/, "");
|
|
527926
528212
|
name19 = name19.replace(/[-_]+/g, " ").trim();
|
|
527927
528213
|
if (/^[a-z]/.test(name19))
|
|
527928
528214
|
name19 = name19.charAt(0).toUpperCase() + name19.slice(1);
|
|
527929
|
-
return name19 || (0,
|
|
528215
|
+
return name19 || (0, import_node_path6.basename)(filename);
|
|
527930
528216
|
}
|
|
527931
528217
|
function dedupImages(fileImages, refImages) {
|
|
527932
528218
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -527950,16 +528236,16 @@ async function walkDir(root, current, acc) {
|
|
|
527950
528236
|
for (const entry of entries3) {
|
|
527951
528237
|
if (EXCLUDED_DIRS.has(entry.name))
|
|
527952
528238
|
continue;
|
|
527953
|
-
const abs = (0,
|
|
528239
|
+
const abs = (0, import_node_path6.join)(current, entry.name);
|
|
527954
528240
|
if (entry.isDirectory()) {
|
|
527955
528241
|
await walkDir(root, abs, acc);
|
|
527956
528242
|
} else if (entry.isFile()) {
|
|
527957
528243
|
const ext = entry.name.toLowerCase().match(/\.([^.]+)$/)?.[1] ?? "";
|
|
527958
528244
|
if (ext in EXT_KIND) {
|
|
527959
|
-
const rel = (0,
|
|
528245
|
+
const rel = (0, import_node_path6.relative)(root, abs).split(import_node_path6.sep).join("/");
|
|
527960
528246
|
acc.push({ absPath: abs, relPath: rel, isImage: false });
|
|
527961
528247
|
} else if (ext in IMAGE_EXT_MIME) {
|
|
527962
|
-
const rel = (0,
|
|
528248
|
+
const rel = (0, import_node_path6.relative)(root, abs).split(import_node_path6.sep).join("/");
|
|
527963
528249
|
acc.push({ absPath: abs, relPath: rel, isImage: true });
|
|
527964
528250
|
}
|
|
527965
528251
|
}
|
|
@@ -528048,8 +528334,8 @@ async function buildLocalInventory(rootDir, onProgress, options) {
|
|
|
528048
528334
|
return { docs, images, translations, translationLangs, readmeMd, fullTree, standaloneImages };
|
|
528049
528335
|
}
|
|
528050
528336
|
async function scanTranslationsDir(rootDir) {
|
|
528051
|
-
const translationsDir = (0,
|
|
528052
|
-
if (!(0,
|
|
528337
|
+
const translationsDir = (0, import_node_path6.join)(rootDir, "translations");
|
|
528338
|
+
if (!(0, import_node_fs5.existsSync)(translationsDir)) {
|
|
528053
528339
|
return { translations: [], translationLangs: [] };
|
|
528054
528340
|
}
|
|
528055
528341
|
let langEntries;
|
|
@@ -528061,7 +528347,7 @@ async function scanTranslationsDir(rootDir) {
|
|
|
528061
528347
|
const langs = langEntries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
528062
528348
|
const translations = [];
|
|
528063
528349
|
for (const lang of langs) {
|
|
528064
|
-
const langDir = (0,
|
|
528350
|
+
const langDir = (0, import_node_path6.join)(translationsDir, lang);
|
|
528065
528351
|
const transFiles = [];
|
|
528066
528352
|
await walkDir(langDir, langDir, transFiles);
|
|
528067
528353
|
for (const f of transFiles) {
|
|
@@ -528653,16 +528939,16 @@ function mathDensePageIndexes(pageTexts, threshold) {
|
|
|
528653
528939
|
}
|
|
528654
528940
|
|
|
528655
528941
|
// src/main/services/pdf-page-image.ts
|
|
528656
|
-
var
|
|
528657
|
-
var
|
|
528942
|
+
var import_node_fs7 = require("node:fs");
|
|
528943
|
+
var import_node_path8 = require("node:path");
|
|
528658
528944
|
function standardFontDir() {
|
|
528659
528945
|
const candidates = [
|
|
528660
|
-
(0,
|
|
528661
|
-
(0,
|
|
528946
|
+
(0, import_node_path8.join)(__dirname, "..", "..", "node_modules", "pdfjs-dist", "standard_fonts"),
|
|
528947
|
+
(0, import_node_path8.join)(process.cwd(), "node_modules", "pdfjs-dist", "standard_fonts")
|
|
528662
528948
|
];
|
|
528663
528949
|
for (const c of candidates)
|
|
528664
|
-
if ((0,
|
|
528665
|
-
return c +
|
|
528950
|
+
if ((0, import_node_fs7.existsSync)(c))
|
|
528951
|
+
return c + import_node_path8.sep;
|
|
528666
528952
|
return void 0;
|
|
528667
528953
|
}
|
|
528668
528954
|
async function openPdfPages(data) {
|
|
@@ -528919,7 +529205,7 @@ async function runSmartImport(spec, deps) {
|
|
|
528919
529205
|
send(`\u2713 README ${readmeMd.length} \u5B57 \xB7 ${fileList.length} \u4E2A\u8BFE\u7A0B\u6587\u4EF6`);
|
|
528920
529206
|
} else if (spec.kind === "folder" || spec.kind === "plan" && spec.plan.kind === "folder" && spec.plan.folder) {
|
|
528921
529207
|
const path6 = spec.kind === "folder" ? spec.path : spec.plan.folder.absPath;
|
|
528922
|
-
if (!(0,
|
|
529208
|
+
if (!(0, import_node_fs10.existsSync)(path6)) {
|
|
528923
529209
|
throw new Error("\u8BFE\u7A0B\u5305\u5BF9\u5E94\u7684\u672C\u5730\u6587\u4EF6\u5939\u5DF2\u4E0D\u5B58\u5728,\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6\u5939\u5BFC\u5165");
|
|
528924
529210
|
}
|
|
528925
529211
|
folderPath = path6;
|
|
@@ -529621,7 +529907,7 @@ function collectAttachmentFilesFromParts(partsJson) {
|
|
|
529621
529907
|
|
|
529622
529908
|
// src/main/services/attachment-store.ts
|
|
529623
529909
|
var import_promises4 = require("node:fs/promises");
|
|
529624
|
-
var
|
|
529910
|
+
var import_node_path12 = require("node:path");
|
|
529625
529911
|
var import_node_crypto11 = require("node:crypto");
|
|
529626
529912
|
var attachmentsRootOverride = null;
|
|
529627
529913
|
function setAttachmentsRoot(dir) {
|
|
@@ -529631,7 +529917,7 @@ function getAttachmentsRoot() {
|
|
|
529631
529917
|
if (attachmentsRootOverride)
|
|
529632
529918
|
return attachmentsRootOverride;
|
|
529633
529919
|
const { app } = require("electron");
|
|
529634
|
-
return (0,
|
|
529920
|
+
return (0, import_node_path12.join)(app.getPath("userData"), "attachments");
|
|
529635
529921
|
}
|
|
529636
529922
|
async function saveChatImage(base643, mime) {
|
|
529637
529923
|
if (!isSupportedImageMime(mime))
|
|
@@ -529639,14 +529925,14 @@ async function saveChatImage(base643, mime) {
|
|
|
529639
529925
|
const file2 = makeAttachmentFilename(mime, import_node_crypto11.randomUUID);
|
|
529640
529926
|
const dir = getAttachmentsRoot();
|
|
529641
529927
|
await (0, import_promises4.mkdir)(dir, { recursive: true });
|
|
529642
|
-
await (0, import_promises4.writeFile)((0,
|
|
529928
|
+
await (0, import_promises4.writeFile)((0, import_node_path12.join)(dir, file2), Buffer.from(base643, "base64"));
|
|
529643
529929
|
return { file: file2, mime };
|
|
529644
529930
|
}
|
|
529645
529931
|
async function readAttachmentDataUrl(file2) {
|
|
529646
529932
|
if (!isSafeAttachmentFile(file2))
|
|
529647
529933
|
return null;
|
|
529648
529934
|
try {
|
|
529649
|
-
const buf = await (0, import_promises4.readFile)((0,
|
|
529935
|
+
const buf = await (0, import_promises4.readFile)((0, import_node_path12.join)(getAttachmentsRoot(), file2));
|
|
529650
529936
|
const ext = file2.slice(file2.lastIndexOf(".") + 1).toLowerCase();
|
|
529651
529937
|
const mime = ext === "png" ? "image/png" : ext === "jpg" ? "image/jpeg" : ext === "webp" ? "image/webp" : "image/gif";
|
|
529652
529938
|
return `data:${mime};base64,${buf.toString("base64")}`;
|
|
@@ -529657,7 +529943,7 @@ async function readAttachmentDataUrl(file2) {
|
|
|
529657
529943
|
async function deleteAttachmentFiles(files) {
|
|
529658
529944
|
const dir = getAttachmentsRoot();
|
|
529659
529945
|
await Promise.all(
|
|
529660
|
-
files.filter((f) => isSafeAttachmentFile(f)).map((f) => (0, import_promises4.unlink)((0,
|
|
529946
|
+
files.filter((f) => isSafeAttachmentFile(f)).map((f) => (0, import_promises4.unlink)((0, import_node_path12.join)(dir, f)).catch(() => void 0))
|
|
529661
529947
|
);
|
|
529662
529948
|
}
|
|
529663
529949
|
|
|
@@ -530183,12 +530469,12 @@ init_speech_engine();
|
|
|
530183
530469
|
|
|
530184
530470
|
// src/main/services/speech/tts-cache.ts
|
|
530185
530471
|
var import_node_crypto13 = __toESM(require("node:crypto"));
|
|
530186
|
-
var
|
|
530472
|
+
var import_node_fs11 = __toESM(require("node:fs"));
|
|
530187
530473
|
var import_promises5 = __toESM(require("node:fs/promises"));
|
|
530188
|
-
var
|
|
530474
|
+
var import_node_path13 = __toESM(require("node:path"));
|
|
530189
530475
|
var SPEECH_CACHE_LIMIT_BYTES = 200 * 1024 * 1024;
|
|
530190
530476
|
function speechCacheDir(dataDir) {
|
|
530191
|
-
return
|
|
530477
|
+
return import_node_path13.default.join(dataDir, "speech-cache");
|
|
530192
530478
|
}
|
|
530193
530479
|
function ttsCacheKey(p) {
|
|
530194
530480
|
return import_node_crypto13.default.createHash("sha256").update(`${p.engine}|${p.voice}|${p.speed}|${p.sentence}`).digest("hex");
|
|
@@ -530214,7 +530500,7 @@ function bufferToArrayBuffer(buf) {
|
|
|
530214
530500
|
}
|
|
530215
530501
|
function readCachedAudio(dataDir, key2, mime) {
|
|
530216
530502
|
try {
|
|
530217
|
-
const buf =
|
|
530503
|
+
const buf = import_node_fs11.default.readFileSync(import_node_path13.default.join(speechCacheDir(dataDir), `${key2}${extOfMime(mime)}`));
|
|
530218
530504
|
return bufferToArrayBuffer(buf);
|
|
530219
530505
|
} catch {
|
|
530220
530506
|
return null;
|
|
@@ -530222,7 +530508,7 @@ function readCachedAudio(dataDir, key2, mime) {
|
|
|
530222
530508
|
}
|
|
530223
530509
|
function readCachedVisemeCues(dataDir, key2) {
|
|
530224
530510
|
try {
|
|
530225
|
-
const raw = JSON.parse(
|
|
530511
|
+
const raw = JSON.parse(import_node_fs11.default.readFileSync(import_node_path13.default.join(speechCacheDir(dataDir), `${key2}.cues.json`), "utf-8"));
|
|
530226
530512
|
return Array.isArray(raw) && raw.length > 0 ? raw : null;
|
|
530227
530513
|
} catch {
|
|
530228
530514
|
return null;
|
|
@@ -530234,14 +530520,14 @@ async function writeCachedVisemeCues(dataDir, key2, cues) {
|
|
|
530234
530520
|
try {
|
|
530235
530521
|
const dir = speechCacheDir(dataDir);
|
|
530236
530522
|
await import_promises5.default.mkdir(dir, { recursive: true });
|
|
530237
|
-
await import_promises5.default.writeFile(
|
|
530523
|
+
await import_promises5.default.writeFile(import_node_path13.default.join(dir, `${key2}.cues.json`), JSON.stringify(cues));
|
|
530238
530524
|
} catch {
|
|
530239
530525
|
}
|
|
530240
530526
|
}
|
|
530241
530527
|
async function writeCachedAudio(dataDir, key2, mime, audio) {
|
|
530242
530528
|
const dir = speechCacheDir(dataDir);
|
|
530243
530529
|
await import_promises5.default.mkdir(dir, { recursive: true });
|
|
530244
|
-
await import_promises5.default.writeFile(
|
|
530530
|
+
await import_promises5.default.writeFile(import_node_path13.default.join(dir, `${key2}${extOfMime(mime)}`), Buffer.from(audio));
|
|
530245
530531
|
await trimSpeechCache(dataDir);
|
|
530246
530532
|
}
|
|
530247
530533
|
async function trimSpeechCache(dataDir) {
|
|
@@ -530257,8 +530543,8 @@ async function trimSpeechCache(dataDir) {
|
|
|
530257
530543
|
if (!e.isFile() || !/\.(wav|mp3)$/.test(e.name))
|
|
530258
530544
|
continue;
|
|
530259
530545
|
try {
|
|
530260
|
-
const st = await import_promises5.default.stat(
|
|
530261
|
-
metas.push({ path:
|
|
530546
|
+
const st = await import_promises5.default.stat(import_node_path13.default.join(dir, e.name));
|
|
530547
|
+
metas.push({ path: import_node_path13.default.join(dir, e.name), size: st.size, mtimeMs: st.mtimeMs });
|
|
530262
530548
|
} catch {
|
|
530263
530549
|
}
|
|
530264
530550
|
}
|
|
@@ -554856,9 +555142,9 @@ function azureTtsMissing(cfg) {
|
|
|
554856
555142
|
|
|
554857
555143
|
// src/main/services/speech/edge-tts-client.ts
|
|
554858
555144
|
var import_node_dns = __toESM(require("node:dns"));
|
|
554859
|
-
var
|
|
555145
|
+
var import_node_fs12 = __toESM(require("node:fs"));
|
|
554860
555146
|
var import_node_os3 = __toESM(require("node:os"));
|
|
554861
|
-
var
|
|
555147
|
+
var import_node_path14 = __toESM(require("node:path"));
|
|
554862
555148
|
var import_node_edge_tts = __toESM(require_edge_tts());
|
|
554863
555149
|
var dnsTuned = false;
|
|
554864
555150
|
function tuneDnsOnce() {
|
|
@@ -554872,7 +555158,7 @@ function tuneDnsOnce() {
|
|
|
554872
555158
|
}
|
|
554873
555159
|
async function synthesizeEdgeMp3(text3, opts) {
|
|
554874
555160
|
tuneDnsOnce();
|
|
554875
|
-
const tmp =
|
|
555161
|
+
const tmp = import_node_path14.default.join(import_node_os3.default.tmpdir(), `lookatstudy-edge-${Date.now()}-${Math.random().toString(36).slice(2)}.mp3`);
|
|
554876
555162
|
try {
|
|
554877
555163
|
const tts = new import_node_edge_tts.EdgeTTS({
|
|
554878
555164
|
voice: opts.voice,
|
|
@@ -554883,12 +555169,12 @@ async function synthesizeEdgeMp3(text3, opts) {
|
|
|
554883
555169
|
saveSubtitles: true
|
|
554884
555170
|
});
|
|
554885
555171
|
await tts.ttsPromise(text3, tmp);
|
|
554886
|
-
const buf =
|
|
555172
|
+
const buf = import_node_fs12.default.readFileSync(tmp);
|
|
554887
555173
|
if (buf.length === 0)
|
|
554888
555174
|
throw new Error("edge tts produced empty audio");
|
|
554889
555175
|
let wordCues = [];
|
|
554890
555176
|
try {
|
|
554891
|
-
const raw = JSON.parse(
|
|
555177
|
+
const raw = JSON.parse(import_node_fs12.default.readFileSync(`${tmp}.json`, "utf-8"));
|
|
554892
555178
|
if (Array.isArray(raw)) {
|
|
554893
555179
|
wordCues = raw.filter((c) => typeof c.part === "string" && Number.isFinite(c.start) && Number.isFinite(c.end)).map((c) => ({ text: String(c.part), start: Number(c.start), end: Number(c.end) }));
|
|
554894
555180
|
}
|
|
@@ -554897,8 +555183,8 @@ async function synthesizeEdgeMp3(text3, opts) {
|
|
|
554897
555183
|
return { mp3: buf, wordCues };
|
|
554898
555184
|
} finally {
|
|
554899
555185
|
try {
|
|
554900
|
-
|
|
554901
|
-
|
|
555186
|
+
import_node_fs12.default.rmSync(tmp, { force: true });
|
|
555187
|
+
import_node_fs12.default.rmSync(`${tmp}.json`, { force: true });
|
|
554902
555188
|
} catch {
|
|
554903
555189
|
}
|
|
554904
555190
|
}
|
|
@@ -556205,9 +556491,9 @@ function setCompanionPackVehicle(dataDir, id, vehicle) {
|
|
|
556205
556491
|
}
|
|
556206
556492
|
|
|
556207
556493
|
// src/main/services/shimeji/shimeji-pack-service.ts
|
|
556208
|
-
var
|
|
556494
|
+
var import_node_path15 = require("node:path");
|
|
556209
556495
|
var import_promises6 = require("node:fs/promises");
|
|
556210
|
-
var
|
|
556496
|
+
var import_node_fs13 = require("node:fs");
|
|
556211
556497
|
var import_node_crypto15 = require("node:crypto");
|
|
556212
556498
|
init_esm2();
|
|
556213
556499
|
init_entry_guard();
|
|
@@ -556524,10 +556810,10 @@ function setSetting(db, key2, value) {
|
|
|
556524
556810
|
db.insert(settings).values({ key: key2, value }).run();
|
|
556525
556811
|
}
|
|
556526
556812
|
function packsRoot(dataDir) {
|
|
556527
|
-
return (0,
|
|
556813
|
+
return (0, import_node_path15.join)(dataDir, "shimeji-packs");
|
|
556528
556814
|
}
|
|
556529
556815
|
function stagingRoot(dataDir) {
|
|
556530
|
-
return (0,
|
|
556816
|
+
return (0, import_node_path15.join)(packsRoot(dataDir), ".staging");
|
|
556531
556817
|
}
|
|
556532
556818
|
async function readJson(path6) {
|
|
556533
556819
|
try {
|
|
@@ -556598,13 +556884,13 @@ async function importShimejiZip(db, dataDir, zipBase64) {
|
|
|
556598
556884
|
if (chars2.length === 0)
|
|
556599
556885
|
throw new Error("\u672A\u627E\u5230 Shimeji \u89D2\u8272\u76EE\u5F55(\u9700\u542B conf/Actions.xml \u4E0E img/)");
|
|
556600
556886
|
const importId = (0, import_node_crypto15.randomUUID)().slice(0, 8);
|
|
556601
|
-
const stagingDir = (0,
|
|
556887
|
+
const stagingDir = (0, import_node_path15.join)(stagingRoot(dataDir), importId);
|
|
556602
556888
|
await (0, import_promises6.mkdir)(stagingDir, { recursive: true });
|
|
556603
556889
|
for (const [path6, data] of Object.entries(files)) {
|
|
556604
556890
|
const target = safeEntryDest(stagingDir, path6);
|
|
556605
556891
|
if (!target)
|
|
556606
556892
|
continue;
|
|
556607
|
-
await (0, import_promises6.mkdir)((0,
|
|
556893
|
+
await (0, import_promises6.mkdir)((0, import_node_path15.dirname)(target), { recursive: true });
|
|
556608
556894
|
await (0, import_promises6.writeFile)(target, data);
|
|
556609
556895
|
}
|
|
556610
556896
|
const characters = chars2.map((c) => {
|
|
@@ -556626,28 +556912,28 @@ async function importShimejiZip(db, dataDir, zipBase64) {
|
|
|
556626
556912
|
async function confirmShimejiImport(_db2, dataDir, importId, characterRefs) {
|
|
556627
556913
|
if (!/^[0-9a-f]{8}$/.test(importId))
|
|
556628
556914
|
throw new Error(`\u975E\u6CD5\u5BFC\u5165\u4F1A\u8BDD id: ${importId}`);
|
|
556629
|
-
const stagingDir = (0,
|
|
556630
|
-
if (!(0,
|
|
556915
|
+
const stagingDir = (0, import_node_path15.join)(stagingRoot(dataDir), importId);
|
|
556916
|
+
if (!(0, import_node_fs13.existsSync)(stagingDir))
|
|
556631
556917
|
throw new Error(`\u5BFC\u5165\u4F1A\u8BDD\u4E0D\u5B58\u5728\u6216\u5DF2\u8FC7\u671F: ${importId}`);
|
|
556632
556918
|
const created = [];
|
|
556633
556919
|
for (const ref of characterRefs) {
|
|
556634
556920
|
const srcImgDir = safeEntryDest(stagingDir, ref);
|
|
556635
|
-
if (!srcImgDir || !(0,
|
|
556921
|
+
if (!srcImgDir || !(0, import_node_fs13.existsSync)(srcImgDir))
|
|
556636
556922
|
continue;
|
|
556637
556923
|
const name19 = ref.split("/").pop() ?? ref;
|
|
556638
556924
|
const confDir = /\/img(\/[^/]+)?$/.test(ref) ? ref.replace(/\/img(\/[^/]+)?$/, "") : "";
|
|
556639
|
-
const actionsPath = ["Actions.xml", "actions.xml"].map((f) => (0,
|
|
556925
|
+
const actionsPath = ["Actions.xml", "actions.xml"].map((f) => (0, import_node_path15.join)(stagingDir, confDir, "conf", f)).find((p) => (0, import_node_fs13.existsSync)(p));
|
|
556640
556926
|
const xml = await (0, import_promises6.readFile)(actionsPath, "utf8");
|
|
556641
556927
|
const format = detectFormat(actionsPath, xml);
|
|
556642
556928
|
const parsed = expandShimejiSequences(parseShimejiActions(xml));
|
|
556643
556929
|
const actions = parsed.actions.map((a) => ({ ...a, slot: archiveOf(a.name).slot, archive: archiveOf(a.name).archive }));
|
|
556644
|
-
const behPath = ["Behavior.xml", "behaviors.xml"].map((f) => (0,
|
|
556930
|
+
const behPath = ["Behavior.xml", "behaviors.xml"].map((f) => (0, import_node_path15.join)(stagingDir, confDir, "conf", f)).find((p) => (0, import_node_fs13.existsSync)(p));
|
|
556645
556931
|
const behaviors = behPath ? parseShimejiBehaviors(await (0, import_promises6.readFile)(behPath, "utf8")) : [];
|
|
556646
556932
|
const packId = `shimeji-${(0, import_node_crypto15.randomUUID)().slice(0, 8)}`;
|
|
556647
|
-
const packDir = (0,
|
|
556933
|
+
const packDir = (0, import_node_path15.join)(packsRoot(dataDir), packId);
|
|
556648
556934
|
await (0, import_promises6.mkdir)(packDir, { recursive: true });
|
|
556649
|
-
await (0, import_promises6.cp)(srcImgDir, (0,
|
|
556650
|
-
const imgFiles = (await (0, import_promises6.readdir)((0,
|
|
556935
|
+
await (0, import_promises6.cp)(srcImgDir, (0, import_node_path15.join)(packDir, "img"), { recursive: true });
|
|
556936
|
+
const imgFiles = (await (0, import_promises6.readdir)((0, import_node_path15.join)(packDir, "img"))).filter((f) => f.endsWith(".png") && !f.toLowerCase().endsWith("icon.png"));
|
|
556651
556937
|
const manifest = {
|
|
556652
556938
|
id: packId,
|
|
556653
556939
|
name: name19,
|
|
@@ -556658,14 +556944,14 @@ async function confirmShimejiImport(_db2, dataDir, importId, characterRefs) {
|
|
|
556658
556944
|
archiveVersion: 1,
|
|
556659
556945
|
importedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
556660
556946
|
};
|
|
556661
|
-
await (0, import_promises6.writeFile)((0,
|
|
556947
|
+
await (0, import_promises6.writeFile)((0, import_node_path15.join)(packDir, "manifest.json"), JSON.stringify(manifest));
|
|
556662
556948
|
created.push({
|
|
556663
556949
|
id: packId,
|
|
556664
556950
|
name: name19,
|
|
556665
556951
|
format,
|
|
556666
556952
|
frameCount: imgFiles.length,
|
|
556667
556953
|
actionCount: actions.length,
|
|
556668
|
-
iconBase64: (0,
|
|
556954
|
+
iconBase64: (0, import_node_fs13.existsSync)((0, import_node_path15.join)(packDir, "img", "icon.png")) ? (await (0, import_promises6.readFile)((0, import_node_path15.join)(packDir, "img", "icon.png"))).toString("base64") : null,
|
|
556669
556955
|
active: false
|
|
556670
556956
|
});
|
|
556671
556957
|
}
|
|
@@ -556675,7 +556961,7 @@ async function confirmShimejiImport(_db2, dataDir, importId, characterRefs) {
|
|
|
556675
556961
|
async function getShimejiPack(_db2, dataDir, packId) {
|
|
556676
556962
|
if (!/^shimeji-[0-9a-f]{8}$/.test(packId))
|
|
556677
556963
|
return null;
|
|
556678
|
-
const manifest = await readJson((0,
|
|
556964
|
+
const manifest = await readJson((0, import_node_path15.join)(packsRoot(dataDir), packId, "manifest.json"));
|
|
556679
556965
|
if (!manifest)
|
|
556680
556966
|
return null;
|
|
556681
556967
|
if (manifest.actions.some((a) => !a.archiveOf || !a.archive)) {
|
|
@@ -556685,7 +556971,7 @@ async function getShimejiPack(_db2, dataDir, packId) {
|
|
|
556685
556971
|
...a.archive ? {} : { archive: archiveOf(a.name).archive }
|
|
556686
556972
|
}));
|
|
556687
556973
|
try {
|
|
556688
|
-
await (0, import_promises6.writeFile)((0,
|
|
556974
|
+
await (0, import_promises6.writeFile)((0, import_node_path15.join)(packsRoot(dataDir), packId, "manifest.json"), JSON.stringify(manifest));
|
|
556689
556975
|
} catch {
|
|
556690
556976
|
}
|
|
556691
556977
|
}
|
|
@@ -556693,17 +556979,17 @@ async function getShimejiPack(_db2, dataDir, packId) {
|
|
|
556693
556979
|
}
|
|
556694
556980
|
async function listShimejiPacks(db, dataDir) {
|
|
556695
556981
|
const root = packsRoot(dataDir);
|
|
556696
|
-
if (!(0,
|
|
556982
|
+
if (!(0, import_node_fs13.existsSync)(root))
|
|
556697
556983
|
return [];
|
|
556698
556984
|
const activeId = db ? getSetting(db, "shimeji_active_pack") ?? null : null;
|
|
556699
556985
|
const out = [];
|
|
556700
556986
|
for (const dir of (await (0, import_promises6.readdir)(root, { withFileTypes: true })).filter((d) => d.isDirectory() && !d.name.startsWith("."))) {
|
|
556701
|
-
const manifest = await readJson((0,
|
|
556987
|
+
const manifest = await readJson((0, import_node_path15.join)(root, dir.name, "manifest.json"));
|
|
556702
556988
|
if (!manifest)
|
|
556703
556989
|
continue;
|
|
556704
556990
|
let iconBase64 = null;
|
|
556705
556991
|
try {
|
|
556706
|
-
iconBase64 = (await (0, import_promises6.readFile)((0,
|
|
556992
|
+
iconBase64 = (await (0, import_promises6.readFile)((0, import_node_path15.join)(root, dir.name, "img", "icon.png"))).toString("base64");
|
|
556707
556993
|
} catch {
|
|
556708
556994
|
}
|
|
556709
556995
|
out.push({
|
|
@@ -556728,7 +557014,7 @@ async function setVehicleShimeji(db, dataDir, packId, vehicle) {
|
|
|
556728
557014
|
return { ok: false };
|
|
556729
557015
|
if (!VEH_WHITELIST.has(vehicle))
|
|
556730
557016
|
return { ok: false };
|
|
556731
|
-
const file2 = (0,
|
|
557017
|
+
const file2 = (0, import_node_path15.join)(packsRoot(dataDir), packId, "manifest.json");
|
|
556732
557018
|
const manifest = await readJson(file2);
|
|
556733
557019
|
if (!manifest)
|
|
556734
557020
|
return { ok: false };
|
|
@@ -556741,7 +557027,7 @@ async function deleteShimejiPack(db, dataDir, packId) {
|
|
|
556741
557027
|
return;
|
|
556742
557028
|
if ((getSetting(db, "shimeji_active_pack") ?? null) === packId)
|
|
556743
557029
|
db.delete(settings).where(eq(settings.key, "shimeji_active_pack")).run();
|
|
556744
|
-
await (0, import_promises6.rm)((0,
|
|
557030
|
+
await (0, import_promises6.rm)((0, import_node_path15.join)(packsRoot(dataDir), packId), { recursive: true, force: true });
|
|
556745
557031
|
}
|
|
556746
557032
|
async function getActiveShimejiPack(db, dataDir) {
|
|
556747
557033
|
const activeId = getSetting(db, "shimeji_active_pack") ?? null;
|
|
@@ -556755,7 +557041,7 @@ async function getShimejiFrameDataUrl(_db2, dataDir, packId, frame) {
|
|
|
556755
557041
|
if (!/^[\w.-]+\.png$/i.test(frame))
|
|
556756
557042
|
return null;
|
|
556757
557043
|
try {
|
|
556758
|
-
const buf = await (0, import_promises6.readFile)((0,
|
|
557044
|
+
const buf = await (0, import_promises6.readFile)((0, import_node_path15.join)(packsRoot(dataDir), packId, "img", frame));
|
|
556759
557045
|
return `data:image/png;base64,${buf.toString("base64")}`;
|
|
556760
557046
|
} catch {
|
|
556761
557047
|
return null;
|
|
@@ -557644,9 +557930,9 @@ function unlockNextLesson(db, currentNodeId) {
|
|
|
557644
557930
|
const parentOrderIdx = current.parentId ? getParentOrderIdx(db, current.parentId) : -1;
|
|
557645
557931
|
const laterSections = db.select().from(contentNodes).all().filter((n) => n.courseId === courseId && n.type === "section" && n.orderIdx > parentOrderIdx).sort((a, b) => a.orderIdx - b.orderIdx);
|
|
557646
557932
|
for (const sec of laterSections) {
|
|
557647
|
-
const
|
|
557648
|
-
if (
|
|
557649
|
-
targets.push(
|
|
557933
|
+
const sectionLessons2 = db.select().from(contentNodes).all().filter((n) => n.courseId === courseId && n.parentId === sec.id && n.type === "lesson").sort((a, b) => a.orderIdx - b.orderIdx);
|
|
557934
|
+
if (sectionLessons2.length > 0) {
|
|
557935
|
+
targets.push(sectionLessons2[0].id);
|
|
557650
557936
|
break;
|
|
557651
557937
|
}
|
|
557652
557938
|
}
|
|
@@ -559087,7 +559373,7 @@ function summarizeToolPartsJson(partsJson) {
|
|
|
559087
559373
|
|
|
559088
559374
|
// src/main/services/agent/agent-engine.ts
|
|
559089
559375
|
function isImageRelatedQuery(query2) {
|
|
559090
|
-
const
|
|
559376
|
+
const lower2 = query2.toLowerCase();
|
|
559091
559377
|
const keywords = [
|
|
559092
559378
|
// 中文
|
|
559093
559379
|
"\u56FE",
|
|
@@ -559119,7 +559405,7 @@ function isImageRelatedQuery(query2) {
|
|
|
559119
559405
|
"illustration",
|
|
559120
559406
|
"screenshot"
|
|
559121
559407
|
];
|
|
559122
|
-
return keywords.some((kw) =>
|
|
559408
|
+
return keywords.some((kw) => lower2.includes(kw));
|
|
559123
559409
|
}
|
|
559124
559410
|
function extractInlineDataImages(content) {
|
|
559125
559411
|
const out = [];
|
|
@@ -559993,6 +560279,7 @@ function abortAgentChatThread(threadId) {
|
|
|
559993
560279
|
init_schema();
|
|
559994
560280
|
init_llm_client();
|
|
559995
560281
|
init_llm_presets();
|
|
560282
|
+
init_model_catalog();
|
|
559996
560283
|
init_custom_provider_service();
|
|
559997
560284
|
function getContextUsage(db, nodeId, locale) {
|
|
559998
560285
|
const blocks = assembleContextBlocks(db, nodeId, locale);
|
|
@@ -560002,10 +560289,11 @@ function getContextUsage(db, nodeId, locale) {
|
|
|
560002
560289
|
const providerId = settings2.active_provider ?? "glm";
|
|
560003
560290
|
const preset = getProviderPreset(providerId);
|
|
560004
560291
|
const model = settings2.active_model ?? preset?.defaultModel ?? "";
|
|
560005
|
-
const
|
|
560292
|
+
const meta = resolveModelMeta(db, providerId, model);
|
|
560293
|
+
const contextWindow = meta?.contextWindow ?? null;
|
|
560006
560294
|
let visionCapable = false;
|
|
560007
560295
|
if (preset) {
|
|
560008
|
-
visionCapable = supportsVision(preset, model);
|
|
560296
|
+
visionCapable = supportsVision(presetWithOverlay(db, preset), model);
|
|
560009
560297
|
} else if (providerId.startsWith("custom-")) {
|
|
560010
560298
|
const cp2 = getCustomProvider(db, providerId);
|
|
560011
560299
|
if (cp2) {
|
|
@@ -560019,6 +560307,7 @@ function getContextUsage(db, nodeId, locale) {
|
|
|
560019
560307
|
nodeTokens: estimateTokens(blocks.nodeContext),
|
|
560020
560308
|
learnerTokens: estimateTokens(blocks.learnerSnapshot ?? ""),
|
|
560021
560309
|
contextWindow,
|
|
560310
|
+
pricing: meta?.pricing ?? null,
|
|
560022
560311
|
provider: providerId,
|
|
560023
560312
|
model,
|
|
560024
560313
|
visionCapable: visionCapable || override !== null,
|
|
@@ -560088,6 +560377,96 @@ async function repairMermaidDiagram(db, input) {
|
|
|
560088
560377
|
|
|
560089
560378
|
// src/main/ipc/index.ts
|
|
560090
560379
|
init_llm_client();
|
|
560380
|
+
init_model_catalog();
|
|
560381
|
+
init_model_overlay();
|
|
560382
|
+
|
|
560383
|
+
// src/main/services/agent/modelsdev-map.ts
|
|
560384
|
+
var MODELS_DEV_PROVIDER_MAP = {
|
|
560385
|
+
glm: "zhipuai",
|
|
560386
|
+
// open.bigmodel.cn/api/paas/v4
|
|
560387
|
+
"glm-codingplan": "zhipuai-coding-plan",
|
|
560388
|
+
// open.bigmodel.cn/api/coding/paas/v4
|
|
560389
|
+
deepseek: "deepseek",
|
|
560390
|
+
// api.deepseek.com
|
|
560391
|
+
kimi: "moonshotai-cn",
|
|
560392
|
+
// api.moonshot.cn/v1(global 是 moonshotai)
|
|
560393
|
+
qwen: "alibaba-cn",
|
|
560394
|
+
// dashscope.aliyuncs.com/compatible-mode/v1(intl 是 alibaba)
|
|
560395
|
+
siliconcloud: "siliconflow-cn",
|
|
560396
|
+
// api.siliconflow.cn/v1
|
|
560397
|
+
openrouter: "openrouter",
|
|
560398
|
+
// 聚合器:量大但目录只是查找表,不影响可见性
|
|
560399
|
+
openai: "openai",
|
|
560400
|
+
anthropic: "anthropic",
|
|
560401
|
+
google: "google",
|
|
560402
|
+
groq: "groq",
|
|
560403
|
+
together: "togetherai",
|
|
560404
|
+
mistral: "mistral",
|
|
560405
|
+
xai: "xai",
|
|
560406
|
+
volcano: "volcengine",
|
|
560407
|
+
// ark.cn-beijing.volces.com/api/v3
|
|
560408
|
+
minimax: "minimax-cn"
|
|
560409
|
+
// 近似对位(我方 api.minimax.chat 旧端点;仅按模型 id 精确命中才生效)
|
|
560410
|
+
// 无映射(保留预设策展兜底):baidu、baichuan —— models.dev 未收录
|
|
560411
|
+
};
|
|
560412
|
+
function normalizeModelsDevApi(raw, fetchedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
560413
|
+
const providers = {};
|
|
560414
|
+
if (!raw || typeof raw !== "object")
|
|
560415
|
+
return { fetchedAt, providers };
|
|
560416
|
+
const src = raw;
|
|
560417
|
+
for (const [presetId, modelsDevKey] of Object.entries(MODELS_DEV_PROVIDER_MAP)) {
|
|
560418
|
+
const p = src[modelsDevKey];
|
|
560419
|
+
if (!p || typeof p !== "object" || !p.models)
|
|
560420
|
+
continue;
|
|
560421
|
+
const models = {};
|
|
560422
|
+
for (const entry of Object.values(p.models)) {
|
|
560423
|
+
if (!entry || typeof entry !== "object" || typeof entry.id !== "string" || !entry.id)
|
|
560424
|
+
continue;
|
|
560425
|
+
const label = typeof entry.name === "string" && entry.name && entry.name !== entry.id ? entry.name : void 0;
|
|
560426
|
+
const cost = entry.cost;
|
|
560427
|
+
const pricing = cost && (typeof cost.input === "number" || typeof cost.output === "number") ? { input: typeof cost.input === "number" ? cost.input : null, output: typeof cost.output === "number" ? cost.output : null } : void 0;
|
|
560428
|
+
models[entry.id.toLowerCase()] = {
|
|
560429
|
+
...label !== void 0 ? { label } : {},
|
|
560430
|
+
contextWindow: typeof entry.limit?.context === "number" ? entry.limit.context : null,
|
|
560431
|
+
outputLimit: typeof entry.limit?.output === "number" ? entry.limit.output : null,
|
|
560432
|
+
...pricing !== void 0 ? { pricing } : {},
|
|
560433
|
+
reasoning: entry.reasoning === true,
|
|
560434
|
+
tools: entry.tool_call === true,
|
|
560435
|
+
vision: Array.isArray(entry.modalities?.input) && (entry.modalities?.input ?? []).includes("image"),
|
|
560436
|
+
...typeof entry.status === "string" && entry.status ? { status: entry.status } : {}
|
|
560437
|
+
};
|
|
560438
|
+
}
|
|
560439
|
+
providers[presetId] = { models };
|
|
560440
|
+
}
|
|
560441
|
+
return { fetchedAt, providers };
|
|
560442
|
+
}
|
|
560443
|
+
|
|
560444
|
+
// src/main/lib/model-catalog-refresh.ts
|
|
560445
|
+
var MODELS_DEV_API_URL = "https://models.dev/api.json";
|
|
560446
|
+
var CATALOG_FETCH_TIMEOUT_MS = 8e3;
|
|
560447
|
+
var CATALOG_CACHE_TTL_MS = 24 * 3600 * 1e3;
|
|
560448
|
+
async function fetchModelCatalog(fetchFn = fetch) {
|
|
560449
|
+
try {
|
|
560450
|
+
const ctrl = new AbortController();
|
|
560451
|
+
const timer = setTimeout(() => ctrl.abort(), CATALOG_FETCH_TIMEOUT_MS);
|
|
560452
|
+
try {
|
|
560453
|
+
const res = await fetchFn(MODELS_DEV_API_URL, { signal: ctrl.signal });
|
|
560454
|
+
if (!res.ok)
|
|
560455
|
+
return null;
|
|
560456
|
+
const raw = await res.json();
|
|
560457
|
+
const catalog = normalizeModelsDevApi(raw);
|
|
560458
|
+
if (Object.keys(catalog.providers).length < 8)
|
|
560459
|
+
return null;
|
|
560460
|
+
return catalog;
|
|
560461
|
+
} finally {
|
|
560462
|
+
clearTimeout(timer);
|
|
560463
|
+
}
|
|
560464
|
+
} catch {
|
|
560465
|
+
return null;
|
|
560466
|
+
}
|
|
560467
|
+
}
|
|
560468
|
+
|
|
560469
|
+
// src/main/ipc/index.ts
|
|
560091
560470
|
init_llm_presets();
|
|
560092
560471
|
init_custom_provider_service();
|
|
560093
560472
|
|
|
@@ -560121,10 +560500,10 @@ function searchContent(sqljs, query2, limit = 10) {
|
|
|
560121
560500
|
const nodeId = String(row[0]);
|
|
560122
560501
|
const title = String(row[1] ?? "");
|
|
560123
560502
|
const content = String(row[2] ?? "");
|
|
560124
|
-
const
|
|
560503
|
+
const lower2 = content.toLowerCase();
|
|
560125
560504
|
let pos = -1;
|
|
560126
560505
|
for (const t of terms) {
|
|
560127
|
-
const p =
|
|
560506
|
+
const p = lower2.indexOf(t.toLowerCase());
|
|
560128
560507
|
if (p >= 0) {
|
|
560129
560508
|
pos = p;
|
|
560130
560509
|
break;
|
|
@@ -560133,7 +560512,7 @@ function searchContent(sqljs, query2, limit = 10) {
|
|
|
560133
560512
|
const start = pos >= 0 ? Math.max(0, pos - 20) : 0;
|
|
560134
560513
|
const snippet = (start > 0 ? "\u2026" : "") + content.slice(start, start + 60) + (start + 60 < content.length ? "\u2026" : "");
|
|
560135
560514
|
const hitCount = terms.filter(
|
|
560136
|
-
(t) =>
|
|
560515
|
+
(t) => lower2.includes(t.toLowerCase()) || title.toLowerCase().includes(t.toLowerCase())
|
|
560137
560516
|
).length;
|
|
560138
560517
|
return { nodeId, title, snippet, rank: -hitCount };
|
|
560139
560518
|
});
|
|
@@ -560457,12 +560836,12 @@ function collectExportData(db, courseId) {
|
|
|
560457
560836
|
const xpRows = db.select().from(settings).all().filter((r) => r.key.startsWith("daily_xp_"));
|
|
560458
560837
|
const totalXp = xpRows.reduce((sum2, r) => sum2 + (parseInt(r.value ?? "0", 10) || 0), 0);
|
|
560459
560838
|
const sectionDetails = sections.map((s) => {
|
|
560460
|
-
const
|
|
560839
|
+
const sectionLessons2 = allNodes.filter((n) => n.parentId === s.id && n.type === "lesson").sort((a, b) => a.orderIdx - b.orderIdx).map((l) => ({
|
|
560461
560840
|
title: l.title,
|
|
560462
560841
|
mastery: progressMap[l.id]?.mastery ?? null,
|
|
560463
560842
|
status: progressMap[l.id]?.status ?? "locked"
|
|
560464
560843
|
}));
|
|
560465
|
-
return { title: s.title, lessons:
|
|
560844
|
+
return { title: s.title, lessons: sectionLessons2 };
|
|
560466
560845
|
});
|
|
560467
560846
|
return {
|
|
560468
560847
|
courseTitle: course.title,
|
|
@@ -560701,19 +561080,22 @@ init_schema();
|
|
|
560701
561080
|
init_schema();
|
|
560702
561081
|
|
|
560703
561082
|
// shared/exam-logic.ts
|
|
560704
|
-
var EXAM_MIN_QUESTIONS =
|
|
561083
|
+
var EXAM_MIN_QUESTIONS = 3;
|
|
560705
561084
|
var EXAM_MAX_QUESTIONS = 15;
|
|
560706
561085
|
function planExamQuota(kcTitles) {
|
|
560707
561086
|
const n = kcTitles.length;
|
|
560708
561087
|
if (n === 0)
|
|
560709
561088
|
return [];
|
|
560710
|
-
const target = Math.min(
|
|
560711
|
-
EXAM_MAX_QUESTIONS,
|
|
560712
|
-
Math.max(EXAM_MIN_QUESTIONS, Math.ceil(n * 3 / 2))
|
|
560713
|
-
);
|
|
561089
|
+
const target = Math.min(EXAM_MAX_QUESTIONS, Math.max(EXAM_MIN_QUESTIONS, n));
|
|
560714
561090
|
const quotas = Array.from({ length: n }, () => 0);
|
|
560715
|
-
|
|
560716
|
-
|
|
561091
|
+
if (n >= target) {
|
|
561092
|
+
for (let q = 0; q < target; q++) {
|
|
561093
|
+
quotas[Math.round(q * (n - 1) / (target - 1))] = 1;
|
|
561094
|
+
}
|
|
561095
|
+
} else {
|
|
561096
|
+
for (let i = 0; i < target; i++) {
|
|
561097
|
+
quotas[i % n]++;
|
|
561098
|
+
}
|
|
560717
561099
|
}
|
|
560718
561100
|
return quotas;
|
|
560719
561101
|
}
|
|
@@ -560721,6 +561103,7 @@ function planExamQuota(kcTitles) {
|
|
|
560721
561103
|
// src/main/services/exam-service.ts
|
|
560722
561104
|
init_dist6();
|
|
560723
561105
|
init_llm_client();
|
|
561106
|
+
init_course_structure_service();
|
|
560724
561107
|
|
|
560725
561108
|
// src/main/services/exam-generation-store.ts
|
|
560726
561109
|
var sender = () => {
|
|
@@ -560867,10 +561250,25 @@ function getExamStatusView(db, examNodeId) {
|
|
|
560867
561250
|
attemptCount: attemptRows.length
|
|
560868
561251
|
};
|
|
560869
561252
|
}
|
|
560870
|
-
function
|
|
561253
|
+
function sectionLessons(db, examNodeId) {
|
|
560871
561254
|
const node = db.select().from(contentNodes).where(eq(contentNodes.id, examNodeId)).get();
|
|
560872
561255
|
const sectionId = node?.parentId;
|
|
560873
|
-
|
|
561256
|
+
return sectionId ? db.select().from(contentNodes).all().filter((n) => n.parentId === sectionId && n.type === "lesson").sort((a, b) => a.orderIdx - b.orderIdx) : [];
|
|
561257
|
+
}
|
|
561258
|
+
async function ensureSectionKcs(db, lessons, markDirty2, onOne) {
|
|
561259
|
+
const CONC = 3;
|
|
561260
|
+
for (let i = 0; i < lessons.length; i += CONC) {
|
|
561261
|
+
const chunk = lessons.slice(i, i + CONC);
|
|
561262
|
+
await Promise.all(
|
|
561263
|
+
chunk.map(async (l) => {
|
|
561264
|
+
await generateLessonSummary(db, l.id, markDirty2).catch(() => null);
|
|
561265
|
+
onOne();
|
|
561266
|
+
})
|
|
561267
|
+
);
|
|
561268
|
+
}
|
|
561269
|
+
}
|
|
561270
|
+
function collectChapterKcs(db, examNodeId) {
|
|
561271
|
+
const lessons = sectionLessons(db, examNodeId);
|
|
560874
561272
|
if (lessons.length === 0)
|
|
560875
561273
|
return [];
|
|
560876
561274
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -560910,6 +561308,21 @@ async function generateExamBank(db, examNodeId, locale, markDirty2) {
|
|
|
560910
561308
|
const node = db.select().from(contentNodes).where(eq(contentNodes.id, examNodeId)).get();
|
|
560911
561309
|
if (!node)
|
|
560912
561310
|
throw new Error(`\u8003\u8BD5\u8282\u70B9\u4E0D\u5B58\u5728: ${examNodeId}`);
|
|
561311
|
+
const lessons = sectionLessons(db, examNodeId);
|
|
561312
|
+
if (lessons.length === 0)
|
|
561313
|
+
throw new Error("\u672C\u7AE0\u6CA1\u6709\u8BFE\u65F6,\u65E0\u6CD5\u751F\u6210\u8003\u8BD5\u9898");
|
|
561314
|
+
const kpTodo = lessons.filter((l) => {
|
|
561315
|
+
const hasKp = getKnowledgePoints(db, l.id).length > 0;
|
|
561316
|
+
return !hasKp && (l.content ?? "").trim().length >= 20;
|
|
561317
|
+
});
|
|
561318
|
+
if (kpTodo.length > 0) {
|
|
561319
|
+
setGenerating(examNodeId, kpTodo.length);
|
|
561320
|
+
let kpDone = 0;
|
|
561321
|
+
await ensureSectionKcs(db, kpTodo, markDirty2, () => {
|
|
561322
|
+
kpDone++;
|
|
561323
|
+
setProgress(examNodeId, kpDone);
|
|
561324
|
+
});
|
|
561325
|
+
}
|
|
560913
561326
|
const kcs = collectChapterKcs(db, examNodeId);
|
|
560914
561327
|
if (kcs.length === 0)
|
|
560915
561328
|
throw new Error("\u672C\u7AE0\u6CA1\u6709\u8BFE\u65F6,\u65E0\u6CD5\u751F\u6210\u8003\u8BD5\u9898");
|
|
@@ -560926,7 +561339,12 @@ async function generateExamBank(db, examNodeId, locale, markDirty2) {
|
|
|
560926
561339
|
for (const batch of batches) {
|
|
560927
561340
|
const allowedKcs = batch.kcs.map((k) => k.title);
|
|
560928
561341
|
const lessonIds = [...new Set(batch.kcs.map((k) => k.lessonId))];
|
|
560929
|
-
const lessonContents = lessonIds.map((id) => db.select().from(contentNodes).where(eq(contentNodes.id, id)).get()).filter((l) => !!l).map((l) => ({
|
|
561342
|
+
const lessonContents = lessonIds.map((id) => db.select().from(contentNodes).where(eq(contentNodes.id, id)).get()).filter((l) => !!l).map((l) => ({
|
|
561343
|
+
title: l.title,
|
|
561344
|
+
content: ((l.summary ? `${l.summary}
|
|
561345
|
+
|
|
561346
|
+
` : "") + (l.content ?? "")).slice(0, 1500)
|
|
561347
|
+
}));
|
|
560930
561348
|
for (let attempt = 0; attempt <= BATCH_RETRY; attempt++) {
|
|
560931
561349
|
try {
|
|
560932
561350
|
const prompt = buildKcBatchPrompt(node.title, batch, lessonContents, outLang, languageTarget);
|
|
@@ -561154,7 +561572,9 @@ ${l.content || "(\u8BFE\u65F6\u65E0\u6B63\u6587)"}`
|
|
|
561154
561572
|
``,
|
|
561155
561573
|
`\u51FA\u9898\u8981\u6C42:`,
|
|
561156
561574
|
`- \u6BCF\u9898\u660E\u786E\u8003\u5BDF\u4E0A\u9762\u5217\u51FA\u7684\u67D0\u4E00\u4E2A\u77E5\u8BC6\u70B9,kc \u5B57\u6BB5\u586B\u5199\u8BE5\u77E5\u8BC6\u70B9\u6807\u9898(\u5FC5\u987B\u4E0E\u5217\u8868\u5B8C\u5168\u4E00\u81F4)`,
|
|
561157
|
-
`- \
|
|
561575
|
+
`- \u8986\u76D6\u4F18\u5148:\u672C\u6279\u7684\u6BCF\u4E2A\u77E5\u8BC6\u70B9\u81F3\u5C11\u88AB\u4E00\u9898\u8003\u5BDF,\u4E0D\u8981\u96C6\u4E2D\u5728\u67D0\u4E00\u4E2A`,
|
|
561576
|
+
`- \u53EA\u8003\u5BDF"\u8BFE\u7A0B\u5185\u5BB9"\u90E8\u5206\u51FA\u73B0\u8FC7/\u53EF\u7531\u5176\u76F4\u63A5\u63A8\u51FA\u7684\u6982\u5FF5;\u7981\u6B62\u5F15\u5165\u672C\u8BFE\u7A0B\u5176\u4ED6\u7AE0\u8282\u6216\u672A\u5728\u5185\u5BB9\u4E2D\u51FA\u73B0\u7684\u77E5\u8BC6(\u5373\u4F7F\u4F60\u4E86\u89E3\u5B83\u4EEC)\u2014\u2014\u8D85\u7EB2\u9898\u7B49\u4E8E\u5E9F\u9898`,
|
|
561577
|
+
`- \u9898\u5E72\u8003"\u7406\u89E3\u548C\u5E94\u7528",\u4E0D\u8981\u51FA\u6B7B\u8BB0\u786C\u80CC\u7684\u5B9A\u4E49\u9898`,
|
|
561158
561578
|
`- \u5E72\u6270\u9879 plausible \u4F46 definitely wrong(\u57FA\u4E8E\u5B66\u4E60\u8005\u5E38\u72AF\u7684\u771F\u5B9E\u8BEF\u89E3)`,
|
|
561159
561579
|
`- \u7B54\u6848\u5FC5\u987B\u5728\u63D0\u4F9B\u7684\u8BFE\u7A0B\u5185\u5BB9\u4E2D\u6709\u4F9D\u636E`,
|
|
561160
561580
|
`- \u6570\u5B66\u8868\u8FBE\u5F0F\u7528\u884C\u5185 $..$ \u6216\u884C\u95F4 $$..$$ \u7684 LaTeX \u8BB0\u6CD5\u4E66\u5199,\u4E0D\u8981\u7528\u7EAF\u6587\u672C\u8FD1\u4F3C(\u754C\u9762\u4F1A\u6E32\u67D3\u6210\u516C\u5F0F)`,
|
|
@@ -561531,7 +561951,7 @@ function registerCourseHandlers(deps) {
|
|
|
561531
561951
|
);
|
|
561532
561952
|
let importCancelRequested = false;
|
|
561533
561953
|
let importRunning = false;
|
|
561534
|
-
const planStore = createPlanStore((0,
|
|
561954
|
+
const planStore = createPlanStore((0, import_node_path17.join)(deps.dataDir, "import-plans"));
|
|
561535
561955
|
const runImportJob = (jobId, work) => {
|
|
561536
561956
|
void (async () => {
|
|
561537
561957
|
try {
|
|
@@ -562127,13 +562547,14 @@ function registerAgentHandlers(deps) {
|
|
|
562127
562547
|
});
|
|
562128
562548
|
handle("agent:isReady", async () => isLlmReady(getDb()));
|
|
562129
562549
|
handle("agent:getProviderPresets", async () => {
|
|
562550
|
+
const db = getDb();
|
|
562130
562551
|
return PROVIDER_PRESETS.map((p) => ({
|
|
562131
562552
|
id: p.id,
|
|
562132
562553
|
label: p.label,
|
|
562133
562554
|
protocol: p.protocol,
|
|
562134
562555
|
baseUrl: p.baseUrl,
|
|
562135
562556
|
defaultModel: p.defaultModel,
|
|
562136
|
-
models: p
|
|
562557
|
+
models: effectivePresetModels(db, p),
|
|
562137
562558
|
apiKeySetting: p.apiKeySetting,
|
|
562138
562559
|
keyUrl: p.keyUrl,
|
|
562139
562560
|
note: p.note
|
|
@@ -562145,12 +562566,102 @@ function registerAgentHandlers(deps) {
|
|
|
562145
562566
|
handle("agent:testCustomProvider", async (_e, input) => {
|
|
562146
562567
|
return testCustomProvider(input);
|
|
562147
562568
|
});
|
|
562569
|
+
handle("agent:testProvider", async (_e, providerId, modelId) => {
|
|
562570
|
+
return testProviderById(getDb(), providerId, modelId);
|
|
562571
|
+
});
|
|
562148
562572
|
handle("agent:discoverModels", async () => {
|
|
562149
562573
|
return fetchOpenRouterModels();
|
|
562150
562574
|
});
|
|
562151
562575
|
handle("agent:discoverProviderModels", async (_e, baseUrl, apiKey) => {
|
|
562152
562576
|
return fetchProviderModels(baseUrl, apiKey);
|
|
562153
562577
|
});
|
|
562578
|
+
handle("agent:discoverModelsFor", async (_e, providerId) => {
|
|
562579
|
+
const db = getDb();
|
|
562580
|
+
let baseUrl;
|
|
562581
|
+
let apiKey = null;
|
|
562582
|
+
if (providerId.startsWith("custom-")) {
|
|
562583
|
+
const raw = getCustomProviderRaw(db, providerId);
|
|
562584
|
+
if (!raw)
|
|
562585
|
+
return { ok: false, error: `\u81EA\u5B9A\u4E49 provider \u4E0D\u5B58\u5728: ${providerId}` };
|
|
562586
|
+
if (raw.protocol !== "openai-compatible") {
|
|
562587
|
+
return { ok: false, error: "\u8BE5\u901A\u9053\u53EA\u652F\u6301 OpenAI \u517C\u5BB9\u534F\u8BAE(anthropic/google \u534F\u8BAE\u65E0\u7EDF\u4E00 /models \u5F62\u72B6);\u8BF7\u624B\u5DE5\u6DFB\u52A0\u6A21\u578B" };
|
|
562588
|
+
}
|
|
562589
|
+
baseUrl = raw.baseUrl;
|
|
562590
|
+
apiKey = raw.apiKey || "no-key-needed";
|
|
562591
|
+
} else {
|
|
562592
|
+
const preset = getProviderPreset(providerId);
|
|
562593
|
+
if (!preset)
|
|
562594
|
+
return { ok: false, error: `\u672A\u77E5 provider: ${providerId}` };
|
|
562595
|
+
if (preset.protocol !== "openai-compatible") {
|
|
562596
|
+
return { ok: false, error: "\u8BE5\u9884\u8BBE\u4E0D\u652F\u6301\u62C9\u53D6(anthropic/google \u534F\u8BAE\u65E0\u7EDF\u4E00 /models \u5F62\u72B6);\u8BF7\u4ECE\u4E0B\u62C9\u9009\u62E9\u6216\u624B\u5DE5\u6DFB\u52A0" };
|
|
562597
|
+
}
|
|
562598
|
+
baseUrl = preset.baseUrl;
|
|
562599
|
+
apiKey = readSettingsMap(db)[preset.apiKeySetting] ?? null;
|
|
562600
|
+
if (!apiKey)
|
|
562601
|
+
return { ok: false, error: "\u672A\u914D\u7F6E API key \u2014\u2014 \u62C9\u53D6\u6A21\u578B\u5217\u8868\u9700\u8981 key" };
|
|
562602
|
+
}
|
|
562603
|
+
if (!baseUrl)
|
|
562604
|
+
return { ok: false, error: "\u7F3A\u5C11 baseUrl" };
|
|
562605
|
+
const r = await fetchProviderModels(baseUrl, apiKey);
|
|
562606
|
+
if (!r.ok || !r.models)
|
|
562607
|
+
return { ok: false, error: r.error ?? "\u62C9\u53D6\u5931\u8D25" };
|
|
562608
|
+
const catalog = getActiveCatalog(db);
|
|
562609
|
+
const models = r.models.slice(0, 500).map((m) => {
|
|
562610
|
+
const cat = providerId.startsWith("custom-") ? catalogEntryGlobal(catalog, m.id) : catalogEntryFor(catalog, providerId, m.id);
|
|
562611
|
+
if (!cat) {
|
|
562612
|
+
return { id: m.id, label: m.label, contextWindow: null };
|
|
562613
|
+
}
|
|
562614
|
+
const caps = ["chat"];
|
|
562615
|
+
if (cat.tools)
|
|
562616
|
+
caps.push("tools");
|
|
562617
|
+
if (cat.reasoning)
|
|
562618
|
+
caps.push("reasoning");
|
|
562619
|
+
if (cat.vision)
|
|
562620
|
+
caps.push("vision");
|
|
562621
|
+
return {
|
|
562622
|
+
id: m.id,
|
|
562623
|
+
label: cat.label ?? m.label,
|
|
562624
|
+
contextWindow: cat.contextWindow,
|
|
562625
|
+
...cat.pricing ? { pricing: cat.pricing } : {},
|
|
562626
|
+
...cat.reasoning !== void 0 ? { reasoning: cat.reasoning } : {},
|
|
562627
|
+
...cat.status ? { status: cat.status } : {},
|
|
562628
|
+
capabilities: caps
|
|
562629
|
+
};
|
|
562630
|
+
});
|
|
562631
|
+
return { ok: true, models };
|
|
562632
|
+
});
|
|
562633
|
+
handle("agent:getModelMeta", async (_e, providerId, modelId) => {
|
|
562634
|
+
return resolveModelMeta(getDb(), providerId, modelId);
|
|
562635
|
+
});
|
|
562636
|
+
handle("agent:getModelOverlay", async () => getOverlay(getDb()));
|
|
562637
|
+
handle("agent:setModelOverlay", async (_e, overlay) => {
|
|
562638
|
+
setOverlay(getDb(), overlay);
|
|
562639
|
+
markDirty();
|
|
562640
|
+
});
|
|
562641
|
+
handle("agent:refreshModelCatalog", async () => {
|
|
562642
|
+
const db = getDb();
|
|
562643
|
+
const now2 = Date.now();
|
|
562644
|
+
let fresh = false;
|
|
562645
|
+
const cacheRow = db.select().from(settings).where(eq(settings.key, MODEL_CATALOG_CACHE_KEY)).get();
|
|
562646
|
+
if (cacheRow?.value) {
|
|
562647
|
+
try {
|
|
562648
|
+
const o = JSON.parse(cacheRow.value);
|
|
562649
|
+
if (typeof o.fetchedAt === "number" && now2 - o.fetchedAt < CATALOG_CACHE_TTL_MS)
|
|
562650
|
+
fresh = true;
|
|
562651
|
+
} catch {
|
|
562652
|
+
}
|
|
562653
|
+
}
|
|
562654
|
+
if (!fresh) {
|
|
562655
|
+
const catalog = await fetchModelCatalog();
|
|
562656
|
+
if (catalog) {
|
|
562657
|
+
const value = JSON.stringify({ payload: catalog, fetchedAt: now2 });
|
|
562658
|
+
db.insert(settings).values({ key: MODEL_CATALOG_CACHE_KEY, value, isSecret: false }).onConflictDoUpdate({ target: settings.key, set: { value, isSecret: false } }).run();
|
|
562659
|
+
markDirty();
|
|
562660
|
+
}
|
|
562661
|
+
}
|
|
562662
|
+
const active2 = getActiveCatalog(db);
|
|
562663
|
+
return { fetchedAt: active2.fetchedAt };
|
|
562664
|
+
});
|
|
562154
562665
|
handle("customProvider:list", async () => {
|
|
562155
562666
|
return listCustomProviders(getDb());
|
|
562156
562667
|
});
|
|
@@ -562651,9 +563162,9 @@ init_asset_service();
|
|
|
562651
563162
|
|
|
562652
563163
|
// src/main/services/seed.ts
|
|
562653
563164
|
init_db2();
|
|
562654
|
-
var
|
|
562655
|
-
var
|
|
562656
|
-
var
|
|
563165
|
+
var import_node_fs15 = require("node:fs");
|
|
563166
|
+
var import_node_path18 = require("node:path");
|
|
563167
|
+
var import_node_url2 = require("node:url");
|
|
562657
563168
|
|
|
562658
563169
|
// src/main/services/seed-apply.ts
|
|
562659
563170
|
init_drizzle_orm();
|
|
@@ -562737,30 +563248,30 @@ function applySeedData(db, SEED_DATA2, SEED_VERSION2) {
|
|
|
562737
563248
|
}
|
|
562738
563249
|
|
|
562739
563250
|
// src/main/services/seed.ts
|
|
562740
|
-
var
|
|
563251
|
+
var import_meta6 = {};
|
|
562741
563252
|
function loadSeedData() {
|
|
562742
563253
|
const fileName = "seed-course.json";
|
|
562743
563254
|
const candidates = [
|
|
562744
563255
|
// 便携束(手机/serve):seed-course.json 与 server.cjs 并排(buildServerBundle 复制)
|
|
562745
|
-
(0,
|
|
563256
|
+
(0, import_node_path18.join)(__dirname, fileName),
|
|
562746
563257
|
// tsx 直跑(verify 脚本):__dirname = .../src/main/services
|
|
562747
|
-
(0,
|
|
563258
|
+
(0, import_node_path18.join)(__dirname, "..", "assets", fileName),
|
|
562748
563259
|
// dev/prod vite 构建:__dirname = .../dist-electron/main → 项目根 → src/main/assets
|
|
562749
|
-
(0,
|
|
563260
|
+
(0, import_node_path18.join)(__dirname, "..", "..", "src", "main", "assets", fileName),
|
|
562750
563261
|
// 打包后:__dirname 在 resources/app/dist-electron/main → 需把 assets 复制到 dist
|
|
562751
|
-
(0,
|
|
563262
|
+
(0, import_node_path18.join)(__dirname, "assets", fileName)
|
|
562752
563263
|
];
|
|
562753
563264
|
let lastErr = null;
|
|
562754
563265
|
for (const p of candidates) {
|
|
562755
563266
|
try {
|
|
562756
|
-
return JSON.parse((0,
|
|
563267
|
+
return JSON.parse((0, import_node_fs15.readFileSync)(p, "utf8"));
|
|
562757
563268
|
} catch (e) {
|
|
562758
563269
|
lastErr = e;
|
|
562759
563270
|
}
|
|
562760
563271
|
}
|
|
562761
563272
|
try {
|
|
562762
|
-
const here = (0,
|
|
562763
|
-
return JSON.parse((0,
|
|
563273
|
+
const here = (0, import_node_path18.dirname)((0, import_node_url2.fileURLToPath)(import_meta6.url));
|
|
563274
|
+
return JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path18.join)(here, "..", "assets", fileName), "utf8"));
|
|
562764
563275
|
} catch {
|
|
562765
563276
|
}
|
|
562766
563277
|
throw new Error(
|
|
@@ -562794,18 +563305,18 @@ var stubDialog = {
|
|
|
562794
563305
|
}
|
|
562795
563306
|
};
|
|
562796
563307
|
function loadOrCreateToken(dataDir) {
|
|
562797
|
-
const tokenPath = (0,
|
|
563308
|
+
const tokenPath = (0, import_node_path19.join)(dataDir, "serve-token");
|
|
562798
563309
|
try {
|
|
562799
|
-
const existing = (0,
|
|
563310
|
+
const existing = (0, import_node_fs16.readFileSync)(tokenPath, "utf8").trim();
|
|
562800
563311
|
if (existing.length >= 16)
|
|
562801
563312
|
return existing;
|
|
562802
563313
|
} catch {
|
|
562803
563314
|
}
|
|
562804
563315
|
const token = (0, import_node_crypto27.randomBytes)(24).toString("hex");
|
|
562805
|
-
(0,
|
|
562806
|
-
(0,
|
|
563316
|
+
(0, import_node_fs16.mkdirSync)(dataDir, { recursive: true });
|
|
563317
|
+
(0, import_node_fs16.writeFileSync)(tokenPath, token, "utf8");
|
|
562807
563318
|
try {
|
|
562808
|
-
(0,
|
|
563319
|
+
(0, import_node_fs16.chmodSync)(tokenPath, 384);
|
|
562809
563320
|
} catch {
|
|
562810
563321
|
}
|
|
562811
563322
|
return token;
|
|
@@ -562829,9 +563340,9 @@ var MIME2 = {
|
|
|
562829
563340
|
".webmanifest": "application/manifest+json"
|
|
562830
563341
|
};
|
|
562831
563342
|
async function startServe(opts) {
|
|
562832
|
-
(0,
|
|
562833
|
-
setAssetsRoot((0,
|
|
562834
|
-
setAttachmentsRoot((0,
|
|
563343
|
+
(0, import_node_fs16.mkdirSync)(opts.dataDir, { recursive: true });
|
|
563344
|
+
setAssetsRoot((0, import_node_path19.join)(opts.dataDir, "assets"));
|
|
563345
|
+
setAttachmentsRoot((0, import_node_path19.join)(opts.dataDir, "attachments"));
|
|
562835
563346
|
await initDb({ dataDir: opts.dataDir });
|
|
562836
563347
|
ensureSeedCourse();
|
|
562837
563348
|
const { patched } = ensureExamNodesForExistingCourses(getDb());
|
|
@@ -562841,7 +563352,7 @@ async function startServe(opts) {
|
|
|
562841
563352
|
const { ensurePrefLang: ensurePrefLang2 } = await Promise.resolve().then(() => (init_lang_pref(), lang_pref_exports));
|
|
562842
563353
|
ensurePrefLang2(getDb(), Intl.DateTimeFormat().resolvedOptions().locale || "zh-CN");
|
|
562843
563354
|
const token = opts.skipAuth ? "" : loadOrCreateToken(opts.dataDir);
|
|
562844
|
-
const webRoot = (0,
|
|
563355
|
+
const webRoot = (0, import_node_path19.resolve)(opts.webDir);
|
|
562845
563356
|
const clients = /* @__PURE__ */ new Set();
|
|
562846
563357
|
const emitter2 = {
|
|
562847
563358
|
send(channel, ...args) {
|
|
@@ -562870,22 +563381,22 @@ async function startServe(opts) {
|
|
|
562870
563381
|
res.writeHead(400).end();
|
|
562871
563382
|
return;
|
|
562872
563383
|
}
|
|
562873
|
-
let filePath = (0,
|
|
562874
|
-
if (filePath !== webRoot && !filePath.startsWith(webRoot +
|
|
563384
|
+
let filePath = (0, import_node_path19.normalize)((0, import_node_path19.join)(webRoot, urlPath));
|
|
563385
|
+
if (filePath !== webRoot && !filePath.startsWith(webRoot + import_node_path19.sep)) {
|
|
562875
563386
|
res.writeHead(403).end();
|
|
562876
563387
|
return;
|
|
562877
563388
|
}
|
|
562878
|
-
if (urlPath === "/" || !(0,
|
|
562879
|
-
filePath = (0,
|
|
563389
|
+
if (urlPath === "/" || !(0, import_node_fs16.existsSync)(filePath) || !filePath.includes(".")) {
|
|
563390
|
+
filePath = (0, import_node_path19.join)(webRoot, "index.html");
|
|
562880
563391
|
}
|
|
562881
|
-
const mime = MIME2[(0,
|
|
563392
|
+
const mime = MIME2[(0, import_node_path19.extname)(filePath)] ?? "application/octet-stream";
|
|
562882
563393
|
res.writeHead(200, { "content-type": mime, "cache-control": "no-cache" });
|
|
562883
|
-
(0,
|
|
563394
|
+
(0, import_node_fs16.createReadStream)(filePath).pipe(res);
|
|
562884
563395
|
};
|
|
562885
563396
|
let httpServer;
|
|
562886
563397
|
if (opts.tlsCert && opts.tlsKey) {
|
|
562887
563398
|
httpServer = (0, import_node_https3.createServer)(
|
|
562888
|
-
{ cert: (0,
|
|
563399
|
+
{ cert: (0, import_node_fs16.readFileSync)(opts.tlsCert), key: (0, import_node_fs16.readFileSync)(opts.tlsKey) },
|
|
562889
563400
|
requestHandler
|
|
562890
563401
|
);
|
|
562891
563402
|
} else {
|
|
@@ -562989,11 +563500,11 @@ function argvHas(name19) {
|
|
|
562989
563500
|
return process.argv.includes(`--${name19}`);
|
|
562990
563501
|
}
|
|
562991
563502
|
async function main() {
|
|
562992
|
-
const dataDir = (0,
|
|
562993
|
-
const webDir = (0,
|
|
563503
|
+
const dataDir = (0, import_node_path20.resolve)(arg("data", (0, import_node_path20.join)((0, import_node_os4.homedir)(), ".lookatstudy")));
|
|
563504
|
+
const webDir = (0, import_node_path20.resolve)(arg("web", (0, import_node_path20.join)(__dirname, "web")));
|
|
562994
563505
|
const port = Number(arg("port", "17890"));
|
|
562995
|
-
const tlsCert = argvHas("tls-cert") ? (0,
|
|
562996
|
-
const tlsKey = argvHas("tls-key") ? (0,
|
|
563506
|
+
const tlsCert = argvHas("tls-cert") ? (0, import_node_path20.resolve)(arg("tls-cert", "")) : void 0;
|
|
563507
|
+
const tlsKey = argvHas("tls-key") ? (0, import_node_path20.resolve)(arg("tls-key", "")) : void 0;
|
|
562997
563508
|
if (tlsCert !== void 0 !== (tlsKey !== void 0)) {
|
|
562998
563509
|
throw new Error("--tls-cert \u4E0E --tls-key \u5FC5\u987B\u6210\u5BF9\u63D0\u4F9B(PEM \u6587\u4EF6\u8DEF\u5F84)");
|
|
562999
563510
|
}
|