lookatstudy-mobile 0.30.0 → 0.31.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/package.json +1 -1
- package/server.cjs +1439 -559
- package/web/assets/{CanvasStage-CCg0mR3C.js → CanvasStage-Cyt4NB7v.js} +1 -1
- package/web/assets/{CommandPalette-R5Ao1bZa.js → CommandPalette-maHlqYwL.js} +1 -1
- package/web/assets/CompanionBotLab-BjbCeiRW.js +8 -0
- package/web/assets/{CourseSearchPanel-ZiNMRYeo.js → CourseSearchPanel-wyjGWBGr.js} +1 -1
- package/web/assets/{ExamView-DiBjtPlN.js → ExamView-BoGgfcwj.js} +1 -1
- package/web/assets/{ReviewPanel-BS8bsZT9.js → ReviewPanel-BxY2T_Ut.js} +1 -1
- package/web/assets/SettingsView-CdxkxEkP.js +10 -0
- package/web/assets/{VoicePanel-BPABzLLX.js → VoicePanel-BzRCM6vH.js} +1 -1
- package/web/assets/{abnfDiagram-N423BO3Z-D3qEZ3wx.js → abnfDiagram-N423BO3Z-iXwATPSN.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-BBQ0ZYnF.js → abnfDiagram-VCTEODGH-ODA7YWAP-C1yAT6qh.js} +1 -1
- package/web/assets/alien-body-DXq5WJRs.png +0 -0
- package/web/assets/alien-happy-Ci3JfpxD.png +0 -0
- package/web/assets/alien-head-CS10QxqG.png +0 -0
- package/web/assets/alien-idle-D2VKjYsl.png +0 -0
- package/web/assets/alien-keyL-C_tZriGQ.png +0 -0
- package/web/assets/alien-thinking-gWKA2xDz.png +0 -0
- package/web/assets/api-web-BCzlfr07.js +1 -0
- package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-BcPfzHrO.js → architectureDiagram-5GKGNRK7-C4PU3XN7-NvY1Ic-5.js} +1 -1
- package/web/assets/{architectureDiagram-T3A2C74G-BetPhhJ_.js → architectureDiagram-T3A2C74G-DwrvQJhj.js} +1 -1
- package/web/assets/{arrow-right-BW9yawWu.js → arrow-right-33rr0pBZ.js} +1 -1
- package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-DZDS1Qrk.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-DsNh9SAm.js} +1 -1
- package/web/assets/{blockDiagram-VBNYF7ZC-CwbzWh4u.js → blockDiagram-VBNYF7ZC-BX4qMKoE.js} +1 -1
- package/web/assets/{c4Diagram-5PPSVZJV-CuoQiYnK.js → c4Diagram-5PPSVZJV-wjiwvuPV.js} +1 -1
- package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-MNKifmBN.js → c4Diagram-UCG6FXSJ-75X3U2P3-Df4YtSzV.js} +1 -1
- package/web/assets/channel-D9baWZnV.js +1 -0
- package/web/assets/{chunk-2GRJ4B5K-MGdPJJSz.js → chunk-2GRJ4B5K-BqUg5toN.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-C7xrI1z5.js → chunk-2Q5K7J3B-D2YxB7H3.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-q7_wbM5v.js → chunk-5RXB4S5H-zfO8batT.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-DGzhNwYE.js → chunk-5VM5RSS4-CdfFIz--.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-Bnx3pMW2.js → chunk-6Q2QTUOP-c0FQ_SfU.js} +1 -1
- package/web/assets/{chunk-7XDTSPCN-BpaSrByV.js → chunk-7XDTSPCN-BBCpJUAH.js} +1 -1
- package/web/assets/{chunk-CTNIYPP6-D_psz8OE.js → chunk-CTNIYPP6-DW2rJhu_.js} +1 -1
- package/web/assets/{chunk-CXNFBKHE-B3NrBrh5.js → chunk-CXNFBKHE-renpw2QE.js} +1 -1
- package/web/assets/{chunk-GF5L2VYU-DH4Xjup-.js → chunk-GF5L2VYU-DiF8ZWcT.js} +1 -1
- package/web/assets/{chunk-ISA7TJRJ-BWhRpuJG.js → chunk-ISA7TJRJ-DhN-xjNX.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-Q9MkO98l.js → chunk-JWPE2WC7-smESCI0k.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-BnDJz0cn.js → chunk-KBJHAD2P-CLazgX1V.js} +1 -1
- package/web/assets/{chunk-LV3HUYFY-BFhZlxBi.js → chunk-LV3HUYFY-DTGGOw_N.js} +1 -1
- package/web/assets/{chunk-M3IUQBOH-CAPsa3nq.js → chunk-M3IUQBOH-Cp2xYH3K.js} +1 -1
- package/web/assets/{chunk-NDIOYS4C-DKs52SAc.js → chunk-NDIOYS4C-B_iYUPk5.js} +1 -1
- package/web/assets/{chunk-RE4WF27V-BzaQ0kW3.js → chunk-RE4WF27V-DFrNGxeZ.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-DB7ZT0W5.js → chunk-RYQCIY6F-CXmfoCP1.js} +1 -1
- package/web/assets/{chunk-VII2H2IX-efS7Zm4t.js → chunk-VII2H2IX-CTIhHlIp.js} +1 -1
- package/web/assets/{chunk-X5GNSKZ3-DYokAkhB.js → chunk-X5GNSKZ3-BnL2P09p.js} +1 -1
- package/web/assets/{chunk-XCWWM2C3-1jGJbVyZ.js → chunk-XCWWM2C3-B3diWYxV.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-BawDkI_V.js → chunk-XXDRQBXY-Cm9DsbCI.js} +1 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-CiuZ0TyW.js +1 -0
- package/web/assets/classDiagram-JCYQIIEL-DJMqLmfy.js +1 -0
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-CiuZ0TyW.js +1 -0
- package/web/assets/classDiagram-v2-OCEON4UE-DJMqLmfy.js +1 -0
- package/web/assets/{core-a88hYP2v.js → core-CnhTLa0G.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-Jl-SkPuF.js → cose-bilkent-JH36ORCC-B1ZJcbUV.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-CrbHDK16.js → cose-bilkent-JH36ORCC-OB24KH3T-BJpRu0cc.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-B-NBQ_17.js → cynefin-OW5HDTMX-GVF3BKWE-CLl32jOg.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-BjNU-j_h.js → cynefin-VYW2F7L2-BFZHy-wK.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-C9I0D50W.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-BpmHF9Wo.js} +1 -1
- package/web/assets/{cynefinDiagram-MW4NZA55-B7Vbl8wF.js → cynefinDiagram-MW4NZA55-BECq_tlH.js} +1 -1
- package/web/assets/{dagre-3AP2YEHR-DCERTXHT-BDRZvdKj.js → dagre-3AP2YEHR-DCERTXHT-DIUrMTsj.js} +1 -1
- package/web/assets/{dagre-VZM6K2ZE-DBJln4b_.js → dagre-VZM6K2ZE-D-oITinM.js} +1 -1
- package/web/assets/{diagram-7IWD3JNH-Dn2grKMm.js → diagram-7IWD3JNH-07yeFgf1.js} +1 -1
- package/web/assets/{diagram-B4RE2ZJO-C7Vyc_yD.js → diagram-B4RE2ZJO-dNtQBNGN.js} +1 -1
- package/web/assets/{diagram-LBJQPF4R-CmaGFdAR.js → diagram-LBJQPF4R-BoiQEUHl.js} +1 -1
- package/web/assets/{diagram-Q27KOJAE-C-p9KRf2.js → diagram-Q27KOJAE-Bi0oJVBH.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-Uwc94dO5.js → diagram-S7CK7UJ4-MULGZGEL-Bpt08-bP.js} +1 -1
- package/web/assets/{diagram-UB23O5K3-BeBC1pLd.js → diagram-UB23O5K3-FLVFr6Cc.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-YQBY353J-DpKpMQdr.js → diagram-UQ7AKVKN-YQBY353J-DORAQMoA.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-BvnZVqDy.js → diagram-VSXAHHWV-WLNH2ELY-Ce82dDi6.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-XW6YQV5G-CRLosetY.js → diagram-VX7I27RA-XW6YQV5G-D-fdo9DM.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-HG7RF65D-CDhznfkR.js → diagram-Z3DM3KII-HG7RF65D-ZqMt25Js.js} +1 -1
- package/web/assets/{ebnfDiagram-BXEA7PRR-ClYHHpf3.js → ebnfDiagram-BXEA7PRR-R3UwRAR7.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-SCAzhJFX.js → ebnfDiagram-PWID7BFC-OKY4VHYD-DDVM1P1I.js} +1 -1
- package/web/assets/{elk.bundled-COEZiBRU.js → elk.bundled-Dv5OJ-BO.js} +1 -1
- package/web/assets/{erDiagram-JOGREHBK-CQtxmkXJ.js → erDiagram-JOGREHBK-Dr_g_g8q.js} +1 -1
- package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-Cic-rvYb.js → erDiagram-SSCWMZ5O-PIPKOIK7-CxTLMFn2.js} +1 -1
- package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-Buf1q55B.js → flowDiagram-A5DVABFB-2Z4AVO5R-DRUX3zZ5.js} +1 -1
- package/web/assets/{flowDiagram-UKHOOZJN-DTNxUKXJ.js → flowDiagram-UKHOOZJN-BEX6wJhw.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-4j9UxRRI.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-DjG0obYU.js} +1 -1
- package/web/assets/{ganttDiagram-PKOTCBZU-Cch79h3b.js → ganttDiagram-PKOTCBZU-D-5FV0PV.js} +1 -1
- package/web/assets/{gitGraphDiagram-DS77QQ5N-CE7GRTAT.js → gitGraphDiagram-DS77QQ5N-DF-LawNi.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-DEY2TMGz.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-D70uly9x.js} +1 -1
- package/web/assets/{index-auPs2wIW.js → index-CApU5KjU.js} +1 -1
- package/web/assets/index-CvvLDKMx.css +1 -0
- package/web/assets/index-DZN4z5wF.js +53 -0
- package/web/assets/{index-Cq6cgm2q.js → index-DawWPxKA.js} +4 -4
- package/web/assets/{index-Cid4nWeb.js → index-X3hjUtR3.js} +2 -2
- package/web/assets/{infoDiagram-6WML65LV-CLqRvjN1.js → infoDiagram-6WML65LV-w8kz4hEa.js} +1 -1
- package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-B-gCpjUC.js → infoDiagram-RXCK75RN-HANS5KVC-C1PHC-YD.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-Bsci7xnu.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-BrPFk2Ox.js} +1 -1
- package/web/assets/{ishikawaDiagram-WSZJBQD7-Br8hddHM.js → ishikawaDiagram-WSZJBQD7-C34Z0ADb.js} +1 -1
- package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-C3S3QJ0n.js → journeyDiagram-EYS64GPL-OAPELBT7-CVn7FA19.js} +1 -1
- package/web/assets/{journeyDiagram-NVQOT4AX-q7oxzffp.js → journeyDiagram-NVQOT4AX-B6wtGi4C.js} +1 -1
- package/web/assets/{kanban-definition-27J2QSJJ-Dx7aMk7V.js → kanban-definition-27J2QSJJ-Cauno8t4.js} +1 -1
- package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-DNpRVVuU.js → kanban-definition-3QL26DDD-I7RKWQQY-DSkHnZWn.js} +1 -1
- package/web/assets/{katex-N6JRN4PM-DUn2v_Up.js → katex-N6JRN4PM-7jQy_F2_.js} +1 -1
- package/web/assets/{main-BbOwLoeH.js → main-CmJlqSDk.js} +130 -106
- package/web/assets/{mermaid-layout-elk.core-hmulpQUA.js → mermaid-layout-elk.core-h_IjwDpP.js} +2 -2
- package/web/assets/{mermaid.core-DUsXuPYV.js → mermaid.core-n1vgOa_E.js} +4 -4
- package/web/assets/{mindmap-definition-FAOFIHXS-HsDwfUOG.js → mindmap-definition-FAOFIHXS-oc1QsLGD.js} +1 -1
- package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-DMlLaIf9.js → mindmap-definition-FBJOCRG2-KIYZG64Y-De94GIvB.js} +1 -1
- package/web/assets/{pegDiagram-VL7TDLO6-B_CQxksA.js → pegDiagram-VL7TDLO6-C9eNGZDr.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-CwSsFCw4.js → pegDiagram-XKGWAZYB-OIP57N6J-C2k8WABX.js} +1 -1
- package/web/assets/{pet-BqoPCJEd.js → pet-D6jEJc1f.js} +1 -1
- package/web/assets/{pieDiagram-7S7Q4E2Y-Dz7YO9kD.js → pieDiagram-7S7Q4E2Y-lAjmXNe_.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-DcGAFS18.js → pieDiagram-E7YTZNPT-2UOTW327-h1VN7kXL.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-CoF5reED.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-CVllGfdW.js} +1 -1
- package/web/assets/{quadrantDiagram-CIZ2JOQS-C6bWSZMA.js → quadrantDiagram-CIZ2JOQS-B0NfwoFD.js} +1 -1
- package/web/assets/{railroadDiagram-AXF67PYL-_W8MikWh.js → railroadDiagram-AXF67PYL-BiLISELA.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-Lt-SXGEJ.js → railroadDiagram-O6MQD6OU-34742W6X-CqYqMw2v.js} +1 -1
- package/web/assets/{render-O7CIS3YK-DiJ-EmQM.js → render-O7CIS3YK-C1DYXW0Z.js} +7 -7
- package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-BludraKW.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-6i5RYobc.js} +1 -1
- package/web/assets/{requirementDiagram-LRYGKXZP-SrMwv2X8.js → requirementDiagram-LRYGKXZP-BMUGWzen.js} +1 -1
- package/web/assets/{rotate-ccw-D1vRxSpM.js → rotate-ccw-DhViz0iw.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-BlzAtbTK.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-EtCUQUn1.js} +1 -1
- package/web/assets/{sankeyDiagram-W5VNT64P-DdLeFYgz.js → sankeyDiagram-W5VNT64P-C_r4P5MM.js} +1 -1
- package/web/assets/{sequenceDiagram-SI44F4Z6-BcQQ0nzP.js → sequenceDiagram-SI44F4Z6-pG01U8Cr.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-CEylu1jV.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-sL3lWU4l.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-DvxYnTjx.js → sizeCapture-X5ZJPWSS-PSGVOMYM-VHssc8WH.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-DMJpw6x4.js → sizeCapture-X5ZJPWSS-TfK3b41W.js} +1 -1
- package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-p_Muo_9t.js → stateDiagram-HBIQ2CUA-4M2S6MAN-DY0svUZL.js} +1 -1
- package/web/assets/{stateDiagram-OKZ733FA-B0IjuFEV.js → stateDiagram-OKZ733FA-CHPWqFKU.js} +1 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-B2GuWRPu.js +1 -0
- package/web/assets/stateDiagram-v2-UEYNNEHI-mdLp8HQQ.js +1 -0
- package/web/assets/{swimlanes-SLNWSIFB-BODuryXb.js → swimlanes-SLNWSIFB-BoK2wZ7r.js} +2 -2
- package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-CTQ-daQG.js → swimlanes-XN3QIQJK-N6N2CCQ6-tXCXpXUD.js} +1 -1
- package/web/assets/swimlanesDiagram-ULZ7WXOC-CI3RFQDZ.js +8 -0
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-DLkFvd5d.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-O8Yphry8.js → timeline-definition-24CTP7MA-KN7RSRVM-uhQqtZRP.js} +1 -1
- package/web/assets/{timeline-definition-Z64GVDOM-CXw6-4p3.js → timeline-definition-Z64GVDOM-BID9BJj_.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-B4C2KaX_.js → vennDiagram-4TSXK5OY-AKJ7LXAN-MJEMZHM_.js} +1 -1
- package/web/assets/{vennDiagram-T6HMQDX7-Cscv288S.js → vennDiagram-T6HMQDX7-noYkNxPf.js} +1 -1
- package/web/assets/{wardleyDiagram-T6FBY63Y-C6LZlU6j.js → wardleyDiagram-T6FBY63Y-CnUMOnEG.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-DC6vVvzB.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-D_oZuxaD.js} +1 -1
- package/web/assets/{xychartDiagram-ELKLHX3M-DZ07gv7H.js → xychartDiagram-ELKLHX3M-Ck_2zrW5.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-Bj6wGGRd.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-Cd6y2GuD.js} +1 -1
- package/web/index.html +3 -3
- package/web/pet.html +3 -3
- package/web/assets/SettingsView-DtRypHxS.js +0 -7
- package/web/assets/api-web-BUHi8j_m.js +0 -1
- package/web/assets/channel-C4o9Ykyf.js +0 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-DqD8T9BT.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-BHZwOJ3M.js +0 -1
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-DqD8T9BT.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-BHZwOJ3M.js +0 -1
- package/web/assets/index-BlYQ3CxE.css +0 -1
- package/web/assets/index-DjO1zEnx.js +0 -53
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-D1Y1O6zn.js +0 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-SKGW5UQZ.js +0 -1
- package/web/assets/swimlanesDiagram-ULZ7WXOC-C0vv9__D.js +0 -8
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-DGgs8WcV.js +0 -8
package/server.cjs
CHANGED
|
@@ -5,11 +5,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __glob = (map3) => (
|
|
9
|
-
var fn = map3[
|
|
8
|
+
var __glob = (map3) => (path6) => {
|
|
9
|
+
var fn = map3[path6];
|
|
10
10
|
if (fn)
|
|
11
11
|
return fn();
|
|
12
|
-
throw new Error("Module not found in bundle: " +
|
|
12
|
+
throw new Error("Module not found in bundle: " + path6);
|
|
13
13
|
};
|
|
14
14
|
var __esm = (fn, res) => function __init() {
|
|
15
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -2321,7 +2321,7 @@ var require_websocket = __commonJS({
|
|
|
2321
2321
|
var http = require("http");
|
|
2322
2322
|
var net = require("net");
|
|
2323
2323
|
var tls = require("tls");
|
|
2324
|
-
var { randomBytes: randomBytes2, createHash:
|
|
2324
|
+
var { randomBytes: randomBytes2, createHash: createHash9 } = require("crypto");
|
|
2325
2325
|
var { Duplex, Readable } = require("stream");
|
|
2326
2326
|
var { URL: URL2 } = require("url");
|
|
2327
2327
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -3009,7 +3009,7 @@ var require_websocket = __commonJS({
|
|
|
3009
3009
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3010
3010
|
return;
|
|
3011
3011
|
}
|
|
3012
|
-
const digest =
|
|
3012
|
+
const digest = createHash9("sha1").update(key2 + GUID).digest("base64");
|
|
3013
3013
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
3014
3014
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
3015
3015
|
return;
|
|
@@ -3398,7 +3398,7 @@ var require_websocket_server = __commonJS({
|
|
|
3398
3398
|
var EventEmitter = require("events");
|
|
3399
3399
|
var http = require("http");
|
|
3400
3400
|
var { Duplex } = require("stream");
|
|
3401
|
-
var { createHash:
|
|
3401
|
+
var { createHash: createHash9 } = require("crypto");
|
|
3402
3402
|
var extension2 = require_extension();
|
|
3403
3403
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3404
3404
|
var subprotocol2 = require_subprotocol();
|
|
@@ -3713,7 +3713,7 @@ var require_websocket_server = __commonJS({
|
|
|
3713
3713
|
}
|
|
3714
3714
|
if (this._state > RUNNING)
|
|
3715
3715
|
return abortHandshake(socket, 503);
|
|
3716
|
-
const digest =
|
|
3716
|
+
const digest = createHash9("sha1").update(key2 + GUID).digest("base64");
|
|
3717
3717
|
const headers = [
|
|
3718
3718
|
"HTTP/1.1 101 Switching Protocols",
|
|
3719
3719
|
"Upgrade: websocket",
|
|
@@ -4294,16 +4294,16 @@ var require_sql_wasm = __commonJS({
|
|
|
4294
4294
|
};
|
|
4295
4295
|
var Ba = Object.assign({}, f), Ca = "./this.program", B2 = "", Da, Ea;
|
|
4296
4296
|
if (ca2) {
|
|
4297
|
-
var
|
|
4297
|
+
var fs5 = require("fs"), Fa = require("path");
|
|
4298
4298
|
B2 = __dirname + "/";
|
|
4299
4299
|
Ea = (a) => {
|
|
4300
4300
|
a = Ga(a) ? new URL(a) : Fa.normalize(a);
|
|
4301
|
-
return
|
|
4301
|
+
return fs5.readFileSync(a);
|
|
4302
4302
|
};
|
|
4303
4303
|
Da = (a) => {
|
|
4304
4304
|
a = Ga(a) ? new URL(a) : Fa.normalize(a);
|
|
4305
4305
|
return new Promise((b, c) => {
|
|
4306
|
-
|
|
4306
|
+
fs5.readFile(a, void 0, (d, e) => {
|
|
4307
4307
|
d ? c(d) : b(e.buffer);
|
|
4308
4308
|
});
|
|
4309
4309
|
});
|
|
@@ -4620,7 +4620,7 @@ var require_sql_wasm = __commonJS({
|
|
|
4620
4620
|
if (ca2) {
|
|
4621
4621
|
var b = Buffer.alloc(256), c = 0, d = process.stdin.fd;
|
|
4622
4622
|
try {
|
|
4623
|
-
c =
|
|
4623
|
+
c = fs5.readSync(d, b, 0, 256);
|
|
4624
4624
|
} catch (e) {
|
|
4625
4625
|
if (e.toString().includes("EOF"))
|
|
4626
4626
|
c = 0;
|
|
@@ -7320,7 +7320,7 @@ var init_sql = __esm({
|
|
|
7320
7320
|
return new SQL([new StringChunk(str2)]);
|
|
7321
7321
|
}
|
|
7322
7322
|
sql2.raw = raw;
|
|
7323
|
-
function
|
|
7323
|
+
function join15(chunks, separator) {
|
|
7324
7324
|
const result = [];
|
|
7325
7325
|
for (const [i, chunk] of chunks.entries()) {
|
|
7326
7326
|
if (i > 0 && separator !== void 0) {
|
|
@@ -7330,7 +7330,7 @@ var init_sql = __esm({
|
|
|
7330
7330
|
}
|
|
7331
7331
|
return new SQL(result);
|
|
7332
7332
|
}
|
|
7333
|
-
sql2.join =
|
|
7333
|
+
sql2.join = join15;
|
|
7334
7334
|
function identifier(value) {
|
|
7335
7335
|
return new Name(value);
|
|
7336
7336
|
}
|
|
@@ -7410,7 +7410,7 @@ var init_sql = __esm({
|
|
|
7410
7410
|
function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
7411
7411
|
const nullifyMap = {};
|
|
7412
7412
|
const result = columns.reduce(
|
|
7413
|
-
(result2, { path:
|
|
7413
|
+
(result2, { path: path6, field }, columnIndex) => {
|
|
7414
7414
|
let decoder2;
|
|
7415
7415
|
if (is(field, Column)) {
|
|
7416
7416
|
decoder2 = field;
|
|
@@ -7422,8 +7422,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
7422
7422
|
decoder2 = field.sql.decoder;
|
|
7423
7423
|
}
|
|
7424
7424
|
let node = result2;
|
|
7425
|
-
for (const [pathChunkIndex, pathChunk] of
|
|
7426
|
-
if (pathChunkIndex <
|
|
7425
|
+
for (const [pathChunkIndex, pathChunk] of path6.entries()) {
|
|
7426
|
+
if (pathChunkIndex < path6.length - 1) {
|
|
7427
7427
|
if (!(pathChunk in node)) {
|
|
7428
7428
|
node[pathChunk] = {};
|
|
7429
7429
|
}
|
|
@@ -7431,8 +7431,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
7431
7431
|
} else {
|
|
7432
7432
|
const rawValue = row[columnIndex];
|
|
7433
7433
|
const value = node[pathChunk] = rawValue === null ? null : decoder2.mapFromDriverValue(rawValue);
|
|
7434
|
-
if (joinsNotNullableMap && is(field, Column) &&
|
|
7435
|
-
const objectName =
|
|
7434
|
+
if (joinsNotNullableMap && is(field, Column) && path6.length === 2) {
|
|
7435
|
+
const objectName = path6[0];
|
|
7436
7436
|
if (!(objectName in nullifyMap)) {
|
|
7437
7437
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
|
7438
7438
|
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
|
|
@@ -10341,7 +10341,7 @@ var init_select2 = __esm({
|
|
|
10341
10341
|
const tableName = getTableLikeName(table);
|
|
10342
10342
|
for (const item of extractUsedTable(table))
|
|
10343
10343
|
this.usedTables.add(item);
|
|
10344
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
10344
|
+
if (typeof tableName === "string" && this.config.joins?.some((join15) => join15.alias === tableName)) {
|
|
10345
10345
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
10346
10346
|
}
|
|
10347
10347
|
if (!this.isPartialSelect) {
|
|
@@ -11230,7 +11230,7 @@ var init_update = __esm({
|
|
|
11230
11230
|
createJoin(joinType) {
|
|
11231
11231
|
return (table, on) => {
|
|
11232
11232
|
const tableName = getTableLikeName(table);
|
|
11233
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
11233
|
+
if (typeof tableName === "string" && this.config.joins.some((join15) => join15.alias === tableName)) {
|
|
11234
11234
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
11235
11235
|
}
|
|
11236
11236
|
if (typeof on === "function") {
|
|
@@ -14927,10 +14927,10 @@ function assignProp(target, prop2, value) {
|
|
|
14927
14927
|
configurable: true
|
|
14928
14928
|
});
|
|
14929
14929
|
}
|
|
14930
|
-
function getElementAtPath(obj,
|
|
14931
|
-
if (!
|
|
14930
|
+
function getElementAtPath(obj, path6) {
|
|
14931
|
+
if (!path6)
|
|
14932
14932
|
return obj;
|
|
14933
|
-
return
|
|
14933
|
+
return path6.reduce((acc, key2) => acc?.[key2], obj);
|
|
14934
14934
|
}
|
|
14935
14935
|
function promiseAllObject(promisesObj) {
|
|
14936
14936
|
const keys2 = Object.keys(promisesObj);
|
|
@@ -15179,11 +15179,11 @@ function aborted(x, startIndex = 0) {
|
|
|
15179
15179
|
}
|
|
15180
15180
|
return false;
|
|
15181
15181
|
}
|
|
15182
|
-
function prefixIssues(
|
|
15182
|
+
function prefixIssues(path6, issues) {
|
|
15183
15183
|
return issues.map((iss) => {
|
|
15184
15184
|
var _a24;
|
|
15185
15185
|
(_a24 = iss).path ?? (_a24.path = []);
|
|
15186
|
-
iss.path.unshift(
|
|
15186
|
+
iss.path.unshift(path6);
|
|
15187
15187
|
return iss;
|
|
15188
15188
|
});
|
|
15189
15189
|
}
|
|
@@ -15372,7 +15372,7 @@ function treeifyError(error40, _mapper) {
|
|
|
15372
15372
|
return issue2.message;
|
|
15373
15373
|
};
|
|
15374
15374
|
const result = { errors: [] };
|
|
15375
|
-
const processError = (error41,
|
|
15375
|
+
const processError = (error41, path6 = []) => {
|
|
15376
15376
|
var _a24, _b19;
|
|
15377
15377
|
for (const issue2 of error41.issues) {
|
|
15378
15378
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -15382,7 +15382,7 @@ function treeifyError(error40, _mapper) {
|
|
|
15382
15382
|
} else if (issue2.code === "invalid_element") {
|
|
15383
15383
|
processError({ issues: issue2.issues }, issue2.path);
|
|
15384
15384
|
} else {
|
|
15385
|
-
const fullpath = [...
|
|
15385
|
+
const fullpath = [...path6, ...issue2.path];
|
|
15386
15386
|
if (fullpath.length === 0) {
|
|
15387
15387
|
result.errors.push(mapper(issue2));
|
|
15388
15388
|
continue;
|
|
@@ -15412,9 +15412,9 @@ function treeifyError(error40, _mapper) {
|
|
|
15412
15412
|
processError(error40);
|
|
15413
15413
|
return result;
|
|
15414
15414
|
}
|
|
15415
|
-
function toDotPath(
|
|
15415
|
+
function toDotPath(path6) {
|
|
15416
15416
|
const segs = [];
|
|
15417
|
-
for (const seg of
|
|
15417
|
+
for (const seg of path6) {
|
|
15418
15418
|
if (typeof seg === "number")
|
|
15419
15419
|
segs.push(`[${seg}]`);
|
|
15420
15420
|
else if (typeof seg === "symbol")
|
|
@@ -26736,8 +26736,8 @@ var init_parseUtil = __esm({
|
|
|
26736
26736
|
init_errors4();
|
|
26737
26737
|
init_en2();
|
|
26738
26738
|
makeIssue = (params) => {
|
|
26739
|
-
const { data, path:
|
|
26740
|
-
const fullPath = [...
|
|
26739
|
+
const { data, path: path6, errorMaps, issueData } = params;
|
|
26740
|
+
const fullPath = [...path6, ...issueData.path || []];
|
|
26741
26741
|
const fullIssue = {
|
|
26742
26742
|
...issueData,
|
|
26743
26743
|
path: fullPath
|
|
@@ -27045,11 +27045,11 @@ var init_types = __esm({
|
|
|
27045
27045
|
init_parseUtil();
|
|
27046
27046
|
init_util2();
|
|
27047
27047
|
ParseInputLazyPath = class {
|
|
27048
|
-
constructor(parent, value,
|
|
27048
|
+
constructor(parent, value, path6, key2) {
|
|
27049
27049
|
this._cachedPath = [];
|
|
27050
27050
|
this.parent = parent;
|
|
27051
27051
|
this.data = value;
|
|
27052
|
-
this._path =
|
|
27052
|
+
this._path = path6;
|
|
27053
27053
|
this._key = key2;
|
|
27054
27054
|
}
|
|
27055
27055
|
get path() {
|
|
@@ -33149,8 +33149,8 @@ var require_auth_config = __commonJS({
|
|
|
33149
33149
|
writeAuthConfig: () => writeAuthConfig
|
|
33150
33150
|
});
|
|
33151
33151
|
module2.exports = __toCommonJS(auth_config_exports);
|
|
33152
|
-
var
|
|
33153
|
-
var
|
|
33152
|
+
var fs5 = __toESM2(require("fs"));
|
|
33153
|
+
var path6 = __toESM2(require("path"));
|
|
33154
33154
|
var import_token_util = require_token_util();
|
|
33155
33155
|
function getAuthConfigPath() {
|
|
33156
33156
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
@@ -33159,15 +33159,15 @@ var require_auth_config = __commonJS({
|
|
|
33159
33159
|
`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
|
|
33160
33160
|
);
|
|
33161
33161
|
}
|
|
33162
|
-
return
|
|
33162
|
+
return path6.join(dataDir, "auth.json");
|
|
33163
33163
|
}
|
|
33164
33164
|
function readAuthConfig() {
|
|
33165
33165
|
try {
|
|
33166
33166
|
const authPath = getAuthConfigPath();
|
|
33167
|
-
if (!
|
|
33167
|
+
if (!fs5.existsSync(authPath)) {
|
|
33168
33168
|
return null;
|
|
33169
33169
|
}
|
|
33170
|
-
const content =
|
|
33170
|
+
const content = fs5.readFileSync(authPath, "utf8");
|
|
33171
33171
|
if (!content) {
|
|
33172
33172
|
return null;
|
|
33173
33173
|
}
|
|
@@ -33178,11 +33178,11 @@ var require_auth_config = __commonJS({
|
|
|
33178
33178
|
}
|
|
33179
33179
|
function writeAuthConfig(config2) {
|
|
33180
33180
|
const authPath = getAuthConfigPath();
|
|
33181
|
-
const authDir =
|
|
33182
|
-
if (!
|
|
33183
|
-
|
|
33181
|
+
const authDir = path6.dirname(authPath);
|
|
33182
|
+
if (!fs5.existsSync(authDir)) {
|
|
33183
|
+
fs5.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
33184
33184
|
}
|
|
33185
|
-
|
|
33185
|
+
fs5.writeFileSync(authPath, JSON.stringify(config2, null, 2), { mode: 384 });
|
|
33186
33186
|
}
|
|
33187
33187
|
function isValidAccessToken(authConfig) {
|
|
33188
33188
|
if (!authConfig.token)
|
|
@@ -33328,8 +33328,8 @@ var require_token_util = __commonJS({
|
|
|
33328
33328
|
saveToken: () => saveToken
|
|
33329
33329
|
});
|
|
33330
33330
|
module2.exports = __toCommonJS(token_util_exports);
|
|
33331
|
-
var
|
|
33332
|
-
var
|
|
33331
|
+
var path6 = __toESM2(require("path"));
|
|
33332
|
+
var fs5 = __toESM2(require("fs"));
|
|
33333
33333
|
var import_token_error = require_token_error();
|
|
33334
33334
|
var import_token_io = require_token_io();
|
|
33335
33335
|
var import_auth_config = require_auth_config();
|
|
@@ -33340,7 +33340,7 @@ var require_token_util = __commonJS({
|
|
|
33340
33340
|
if (!dataDir) {
|
|
33341
33341
|
return null;
|
|
33342
33342
|
}
|
|
33343
|
-
return
|
|
33343
|
+
return path6.join(dataDir, vercelFolder);
|
|
33344
33344
|
}
|
|
33345
33345
|
async function getVercelCliToken() {
|
|
33346
33346
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -33413,13 +33413,13 @@ var require_token_util = __commonJS({
|
|
|
33413
33413
|
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
33414
33414
|
);
|
|
33415
33415
|
}
|
|
33416
|
-
const prjPath =
|
|
33417
|
-
if (!
|
|
33416
|
+
const prjPath = path6.join(dir, ".vercel", "project.json");
|
|
33417
|
+
if (!fs5.existsSync(prjPath)) {
|
|
33418
33418
|
throw new import_token_error.VercelOidcTokenError(
|
|
33419
33419
|
"project.json not found, have you linked your project with `vc link?`"
|
|
33420
33420
|
);
|
|
33421
33421
|
}
|
|
33422
|
-
const prj = JSON.parse(
|
|
33422
|
+
const prj = JSON.parse(fs5.readFileSync(prjPath, "utf8"));
|
|
33423
33423
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
33424
33424
|
throw new TypeError(
|
|
33425
33425
|
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
@@ -33434,11 +33434,11 @@ var require_token_util = __commonJS({
|
|
|
33434
33434
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
33435
33435
|
);
|
|
33436
33436
|
}
|
|
33437
|
-
const tokenPath =
|
|
33437
|
+
const tokenPath = path6.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
33438
33438
|
const tokenJson = JSON.stringify(token);
|
|
33439
|
-
|
|
33440
|
-
|
|
33441
|
-
|
|
33439
|
+
fs5.mkdirSync(path6.dirname(tokenPath), { mode: 504, recursive: true });
|
|
33440
|
+
fs5.writeFileSync(tokenPath, tokenJson);
|
|
33441
|
+
fs5.chmodSync(tokenPath, 432);
|
|
33442
33442
|
return;
|
|
33443
33443
|
}
|
|
33444
33444
|
function loadToken(projectId) {
|
|
@@ -33448,11 +33448,11 @@ var require_token_util = __commonJS({
|
|
|
33448
33448
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
33449
33449
|
);
|
|
33450
33450
|
}
|
|
33451
|
-
const tokenPath =
|
|
33452
|
-
if (!
|
|
33451
|
+
const tokenPath = path6.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
33452
|
+
if (!fs5.existsSync(tokenPath)) {
|
|
33453
33453
|
return null;
|
|
33454
33454
|
}
|
|
33455
|
-
const token = JSON.parse(
|
|
33455
|
+
const token = JSON.parse(fs5.readFileSync(tokenPath, "utf8"));
|
|
33456
33456
|
assertVercelOidcTokenResponse(token);
|
|
33457
33457
|
return token;
|
|
33458
33458
|
}
|
|
@@ -46946,37 +46946,37 @@ function createOpenAI(options = {}) {
|
|
|
46946
46946
|
);
|
|
46947
46947
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
46948
46948
|
provider: `${providerName}.chat`,
|
|
46949
|
-
url: ({ path:
|
|
46949
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46950
46950
|
headers: getHeaders,
|
|
46951
46951
|
fetch: options.fetch
|
|
46952
46952
|
});
|
|
46953
46953
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
46954
46954
|
provider: `${providerName}.completion`,
|
|
46955
|
-
url: ({ path:
|
|
46955
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46956
46956
|
headers: getHeaders,
|
|
46957
46957
|
fetch: options.fetch
|
|
46958
46958
|
});
|
|
46959
46959
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
46960
46960
|
provider: `${providerName}.embedding`,
|
|
46961
|
-
url: ({ path:
|
|
46961
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46962
46962
|
headers: getHeaders,
|
|
46963
46963
|
fetch: options.fetch
|
|
46964
46964
|
});
|
|
46965
46965
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
46966
46966
|
provider: `${providerName}.image`,
|
|
46967
|
-
url: ({ path:
|
|
46967
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46968
46968
|
headers: getHeaders,
|
|
46969
46969
|
fetch: options.fetch
|
|
46970
46970
|
});
|
|
46971
46971
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
46972
46972
|
provider: `${providerName}.transcription`,
|
|
46973
|
-
url: ({ path:
|
|
46973
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46974
46974
|
headers: getHeaders,
|
|
46975
46975
|
fetch: options.fetch
|
|
46976
46976
|
});
|
|
46977
46977
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
46978
46978
|
provider: `${providerName}.speech`,
|
|
46979
|
-
url: ({ path:
|
|
46979
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46980
46980
|
headers: getHeaders,
|
|
46981
46981
|
fetch: options.fetch
|
|
46982
46982
|
});
|
|
@@ -46991,7 +46991,7 @@ function createOpenAI(options = {}) {
|
|
|
46991
46991
|
const createResponsesModel = (modelId) => {
|
|
46992
46992
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
46993
46993
|
provider: `${providerName}.responses`,
|
|
46994
|
-
url: ({ path:
|
|
46994
|
+
url: ({ path: path6 }) => `${baseURL}${path6}`,
|
|
46995
46995
|
headers: getHeaders,
|
|
46996
46996
|
fetch: options.fetch,
|
|
46997
46997
|
fileIdPrefixes: ["file-"]
|
|
@@ -51755,8 +51755,8 @@ function createOpenAICompatible(options) {
|
|
|
51755
51755
|
const getHeaders = () => withUserAgentSuffix2(headers, `ai-sdk/openai-compatible/${VERSION7}`);
|
|
51756
51756
|
const getCommonModelConfig = (modelType) => ({
|
|
51757
51757
|
provider: `${providerName}.${modelType}`,
|
|
51758
|
-
url: ({ path:
|
|
51759
|
-
const url2 = new URL(`${baseURL}${
|
|
51758
|
+
url: ({ path: path6 }) => {
|
|
51759
|
+
const url2 = new URL(`${baseURL}${path6}`);
|
|
51760
51760
|
if (options.queryParams) {
|
|
51761
51761
|
url2.search = new URLSearchParams(options.queryParams).toString();
|
|
51762
51762
|
}
|
|
@@ -60227,8 +60227,8 @@ var init_markdown_course = __esm({
|
|
|
60227
60227
|
});
|
|
60228
60228
|
|
|
60229
60229
|
// src/main/services/pure/file-classifier.ts
|
|
60230
|
-
function isSectionIntro(
|
|
60231
|
-
const parts =
|
|
60230
|
+
function isSectionIntro(path6, siblingPaths) {
|
|
60231
|
+
const parts = path6.split("/").filter(Boolean);
|
|
60232
60232
|
const last = parts[parts.length - 1];
|
|
60233
60233
|
if (!last || !(/^readme/i.test(last) || last === "index.md"))
|
|
60234
60234
|
return false;
|
|
@@ -60237,7 +60237,7 @@ function isSectionIntro(path5, siblingPaths) {
|
|
|
60237
60237
|
return false;
|
|
60238
60238
|
const prefix = parts.slice(0, -1).join("/");
|
|
60239
60239
|
const hasDeeperLesson = siblingPaths.some((sib) => {
|
|
60240
|
-
if (sib ===
|
|
60240
|
+
if (sib === path6)
|
|
60241
60241
|
return false;
|
|
60242
60242
|
const sibLower = sib.toLowerCase();
|
|
60243
60243
|
if (sibLower.includes("/lab/") || sibLower.includes("/exercise/") || sibLower.includes("/assignment/"))
|
|
@@ -60250,10 +60250,10 @@ function isSectionIntro(path5, siblingPaths) {
|
|
|
60250
60250
|
});
|
|
60251
60251
|
return hasDeeperLesson;
|
|
60252
60252
|
}
|
|
60253
|
-
function classifyFile(
|
|
60254
|
-
const lowerPath =
|
|
60255
|
-
const parts =
|
|
60256
|
-
const filename = parts[parts.length - 1] ??
|
|
60253
|
+
function classifyFile(path6, _md, context) {
|
|
60254
|
+
const lowerPath = path6.toLowerCase();
|
|
60255
|
+
const parts = path6.split("/").filter(Boolean);
|
|
60256
|
+
const filename = parts[parts.length - 1] ?? path6;
|
|
60257
60257
|
const stem = filename.replace(/\.[^.]+$/, "").toLowerCase();
|
|
60258
60258
|
if (lowerPath.includes("translations/") || lowerPath.includes("translated_images/")) {
|
|
60259
60259
|
return {
|
|
@@ -60304,7 +60304,7 @@ function classifyFile(path5, _md, context) {
|
|
|
60304
60304
|
};
|
|
60305
60305
|
}
|
|
60306
60306
|
}
|
|
60307
|
-
if (isSectionIntro(
|
|
60307
|
+
if (isSectionIntro(path6, context.siblingPaths)) {
|
|
60308
60308
|
return {
|
|
60309
60309
|
role: "section-intro",
|
|
60310
60310
|
confidence: "high",
|
|
@@ -60829,11 +60829,11 @@ function parseAdoc(adocText) {
|
|
|
60829
60829
|
return "#".repeat(6) + " ";
|
|
60830
60830
|
return "#".repeat(eqs.length) + " ";
|
|
60831
60831
|
});
|
|
60832
|
-
processed = processed.replace(/image::(\S+?)\[([^\]]*)\]/g, (_m,
|
|
60833
|
-
return alt ? `\[([^\]]*)\]/g, (_m, path6, alt) => {
|
|
60833
|
+
return alt ? `` : ``;
|
|
60834
60834
|
});
|
|
60835
|
-
processed = processed.replace(/image:(\S+?)\[([^\]]*)\]/g, (_m,
|
|
60836
|
-
return alt ? `\[([^\]]*)\]/g, (_m, path6, alt) => {
|
|
60836
|
+
return alt ? `` : ``;
|
|
60837
60837
|
});
|
|
60838
60838
|
processed = processed.replace(/link:(\S+?)\[([^\]]*)\]/g, "[$2]($1)");
|
|
60839
60839
|
processed = processed.replace(/(\s|^)\*([^\s*][^*]*?)\*(?=\s|[.,;:!?)])/gm, "$1**$2**");
|
|
@@ -60878,8 +60878,8 @@ __export(repo_fetcher_exports, {
|
|
|
60878
60878
|
pathsToDiscoveredFiles: () => pathsToDiscoveredFiles,
|
|
60879
60879
|
sanitizeTranslatedMarkdown: () => sanitizeTranslatedMarkdown
|
|
60880
60880
|
});
|
|
60881
|
-
function cdnUrl(owner, repo, branch,
|
|
60882
|
-
const cleanPath =
|
|
60881
|
+
function cdnUrl(owner, repo, branch, path6) {
|
|
60882
|
+
const cleanPath = path6.replace(/^\.\//, "").replace(/^\//, "");
|
|
60883
60883
|
return `https://cdn.jsdelivr.net/gh/${owner}/${repo}@${branch}/${cleanPath}`;
|
|
60884
60884
|
}
|
|
60885
60885
|
function extractInternalLinks(readmeMd) {
|
|
@@ -61071,17 +61071,17 @@ function buildCourseFromFiles(courseTitle, files) {
|
|
|
61071
61071
|
const groupMap = /* @__PURE__ */ new Map();
|
|
61072
61072
|
const groupOrder = [];
|
|
61073
61073
|
const GENERIC_DIRS = /* @__PURE__ */ new Set(["lessons", "docs", "doc", "src", "content", "modules", "chapters", "tutorials", "guide", "week", "unit", "part", "topic", "lecture", "session", "day", "step"]);
|
|
61074
|
-
function sectionKeyOf(
|
|
61075
|
-
const parts =
|
|
61074
|
+
function sectionKeyOf(path6) {
|
|
61075
|
+
const parts = path6.split("/").filter(Boolean);
|
|
61076
61076
|
const dirParts = parts[parts.length - 1]?.match(/^readme/i) || parts[parts.length - 1] === "index.md" ? parts.slice(0, -1) : parts;
|
|
61077
61077
|
const specificDir = dirParts.find((p) => !GENERIC_DIRS.has(p.toLowerCase()) && !/\.(md|mdx)$/i.test(p));
|
|
61078
61078
|
if (dirParts.length >= 2 && specificDir) {
|
|
61079
61079
|
const gk = specificDir.replace(/\.md$/i, "");
|
|
61080
61080
|
return { groupKey: gk, sectionTitle: gk };
|
|
61081
61081
|
} else if (dirParts.length === 1) {
|
|
61082
|
-
return { groupKey:
|
|
61082
|
+
return { groupKey: path6, sectionTitle: dirParts[0].replace(/\.md$/i, "") };
|
|
61083
61083
|
}
|
|
61084
|
-
return { groupKey:
|
|
61084
|
+
return { groupKey: path6, sectionTitle: parts[parts.length - 1] ?? path6 };
|
|
61085
61085
|
}
|
|
61086
61086
|
const sortedFiles = [...files].sort((a, b) => a.path.localeCompare(b.path));
|
|
61087
61087
|
for (const file2 of sortedFiles) {
|
|
@@ -61489,7 +61489,7 @@ async function importRepoToParsedCourse(owner, repo, branch, fetchFn, onProgress
|
|
|
61489
61489
|
repo,
|
|
61490
61490
|
readmeBranch,
|
|
61491
61491
|
fetchFn,
|
|
61492
|
-
(done, total,
|
|
61492
|
+
(done, total, path6) => send(`\u62C9\u53D6 ${done}/${total}: ${path6}`)
|
|
61493
61493
|
);
|
|
61494
61494
|
if (fetchResult.ok.length === 0) {
|
|
61495
61495
|
throw new Error(
|
|
@@ -62078,23 +62078,23 @@ async function classifyFileRoles(db, readmeMd, fileList, fullTree, onProgress, o
|
|
|
62078
62078
|
});
|
|
62079
62079
|
if (!sourceLang && parsed.sourceLang)
|
|
62080
62080
|
sourceLang = parsed.sourceLang;
|
|
62081
|
-
for (const { path:
|
|
62081
|
+
for (const { path: path6, role, lang, translates } of parsed.files) {
|
|
62082
62082
|
if (role === "translation") {
|
|
62083
62083
|
if (lang && translates && allPathSet.has(translates)) {
|
|
62084
62084
|
if (!translations.has(lang))
|
|
62085
62085
|
translations.set(lang, []);
|
|
62086
|
-
translations.get(lang).push(
|
|
62087
|
-
translationPairs.set(translates,
|
|
62086
|
+
translations.get(lang).push(path6);
|
|
62087
|
+
translationPairs.set(translates, path6);
|
|
62088
62088
|
llmLangs.add(lang);
|
|
62089
62089
|
} else {
|
|
62090
|
-
original.push(
|
|
62090
|
+
original.push(path6);
|
|
62091
62091
|
}
|
|
62092
62092
|
} else if (role === "practice")
|
|
62093
|
-
practice.push(
|
|
62093
|
+
practice.push(path6);
|
|
62094
62094
|
else if (role === "skip")
|
|
62095
|
-
skip.push(
|
|
62095
|
+
skip.push(path6);
|
|
62096
62096
|
else
|
|
62097
|
-
original.push(
|
|
62097
|
+
original.push(path6);
|
|
62098
62098
|
}
|
|
62099
62099
|
}
|
|
62100
62100
|
if (!sourceLang)
|
|
@@ -63069,8 +63069,8 @@ function wrapReason(ex) {
|
|
|
63069
63069
|
return new UnknownErrorException(ex.message, ex.toString());
|
|
63070
63070
|
}
|
|
63071
63071
|
async function node_utils_fetchData(url2) {
|
|
63072
|
-
const
|
|
63073
|
-
const data = await
|
|
63072
|
+
const fs5 = process.getBuiltinModule("fs");
|
|
63073
|
+
const data = await fs5.promises.readFile(url2);
|
|
63074
63074
|
return new Uint8Array(data);
|
|
63075
63075
|
}
|
|
63076
63076
|
function applyBoundingBox(ctx, bbox) {
|
|
@@ -63471,7 +63471,7 @@ function compileType3Glyph(imgData) {
|
|
|
63471
63471
|
return null;
|
|
63472
63472
|
}
|
|
63473
63473
|
const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
|
|
63474
|
-
const
|
|
63474
|
+
const path6 = new Path2D();
|
|
63475
63475
|
for (i = 0; count2 && i <= height; i++) {
|
|
63476
63476
|
let p = i * width1;
|
|
63477
63477
|
const end = p + width;
|
|
@@ -63481,7 +63481,7 @@ function compileType3Glyph(imgData) {
|
|
|
63481
63481
|
if (p === end) {
|
|
63482
63482
|
continue;
|
|
63483
63483
|
}
|
|
63484
|
-
|
|
63484
|
+
path6.moveTo(p % width1, i);
|
|
63485
63485
|
const p0 = p;
|
|
63486
63486
|
let type = points[p];
|
|
63487
63487
|
do {
|
|
@@ -63497,7 +63497,7 @@ function compileType3Glyph(imgData) {
|
|
|
63497
63497
|
type = pp & 51 * type >> 4;
|
|
63498
63498
|
points[p] &= type >> 2 | type << 2;
|
|
63499
63499
|
}
|
|
63500
|
-
|
|
63500
|
+
path6.lineTo(p % width1, p / width1 | 0);
|
|
63501
63501
|
if (!points[p]) {
|
|
63502
63502
|
--count2;
|
|
63503
63503
|
}
|
|
@@ -63510,7 +63510,7 @@ function compileType3Glyph(imgData) {
|
|
|
63510
63510
|
c.save();
|
|
63511
63511
|
c.scale(1 / width, -1 / height);
|
|
63512
63512
|
c.translate(0, -height);
|
|
63513
|
-
c.fill(
|
|
63513
|
+
c.fill(path6);
|
|
63514
63514
|
c.beginPath();
|
|
63515
63515
|
c.restore();
|
|
63516
63516
|
};
|
|
@@ -69274,11 +69274,11 @@ var init_pdf = __esm({
|
|
|
69274
69274
|
} catch (ex) {
|
|
69275
69275
|
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
|
69276
69276
|
}
|
|
69277
|
-
const
|
|
69277
|
+
const path6 = new Path2D(cmds || "");
|
|
69278
69278
|
if (!this.fontExtraProperties) {
|
|
69279
69279
|
objs.delete(objId);
|
|
69280
69280
|
}
|
|
69281
|
-
return this.compiledGlyphs[character] =
|
|
69281
|
+
return this.compiledGlyphs[character] = path6;
|
|
69282
69282
|
}
|
|
69283
69283
|
};
|
|
69284
69284
|
CallbackKind = {
|
|
@@ -71257,9 +71257,9 @@ var init_pdf = __esm({
|
|
|
71257
71257
|
x,
|
|
71258
71258
|
y,
|
|
71259
71259
|
fontSize,
|
|
71260
|
-
path:
|
|
71260
|
+
path: path6
|
|
71261
71261
|
} of paths) {
|
|
71262
|
-
newPath.addPath(
|
|
71262
|
+
newPath.addPath(path6, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x, y).scale(fontSize, -fontSize));
|
|
71263
71263
|
}
|
|
71264
71264
|
ctx.clip(newPath);
|
|
71265
71265
|
ctx.beginPath();
|
|
@@ -71339,9 +71339,9 @@ var init_pdf = __esm({
|
|
|
71339
71339
|
nextLine() {
|
|
71340
71340
|
this.moveText(0, this.current.leading);
|
|
71341
71341
|
}
|
|
71342
|
-
#getScaledPath(
|
|
71342
|
+
#getScaledPath(path6, currentTransform, transform2) {
|
|
71343
71343
|
const newPath = new Path2D();
|
|
71344
|
-
newPath.addPath(
|
|
71344
|
+
newPath.addPath(path6, new DOMMatrix(transform2).invertSelf().multiplySelf(currentTransform));
|
|
71345
71345
|
return newPath;
|
|
71346
71346
|
}
|
|
71347
71347
|
paintChar(character, x, y, patternFillTransform, patternStrokeTransform) {
|
|
@@ -71354,9 +71354,9 @@ var init_pdf = __esm({
|
|
|
71354
71354
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
71355
71355
|
const patternFill = current.patternFill && !font.missingFile;
|
|
71356
71356
|
const patternStroke = current.patternStroke && !font.missingFile;
|
|
71357
|
-
let
|
|
71357
|
+
let path6;
|
|
71358
71358
|
if (font.disableFontFace || isAddToPathSet || patternFill || patternStroke) {
|
|
71359
|
-
|
|
71359
|
+
path6 = font.getPathGenerator(this.commonObjs, character);
|
|
71360
71360
|
}
|
|
71361
71361
|
if (font.disableFontFace || patternFill || patternStroke) {
|
|
71362
71362
|
ctx.save();
|
|
@@ -71366,19 +71366,19 @@ var init_pdf = __esm({
|
|
|
71366
71366
|
if (patternFillTransform) {
|
|
71367
71367
|
const currentTransform = ctx.getTransform();
|
|
71368
71368
|
ctx.setTransform(...patternFillTransform);
|
|
71369
|
-
ctx.fill(this.#getScaledPath(
|
|
71369
|
+
ctx.fill(this.#getScaledPath(path6, currentTransform, patternFillTransform));
|
|
71370
71370
|
} else {
|
|
71371
|
-
ctx.fill(
|
|
71371
|
+
ctx.fill(path6);
|
|
71372
71372
|
}
|
|
71373
71373
|
}
|
|
71374
71374
|
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
|
|
71375
71375
|
if (patternStrokeTransform) {
|
|
71376
71376
|
const currentTransform = ctx.getTransform();
|
|
71377
71377
|
ctx.setTransform(...patternStrokeTransform);
|
|
71378
|
-
ctx.stroke(this.#getScaledPath(
|
|
71378
|
+
ctx.stroke(this.#getScaledPath(path6, currentTransform, patternStrokeTransform));
|
|
71379
71379
|
} else {
|
|
71380
71380
|
ctx.lineWidth /= fontSize;
|
|
71381
|
-
ctx.stroke(
|
|
71381
|
+
ctx.stroke(path6);
|
|
71382
71382
|
}
|
|
71383
71383
|
}
|
|
71384
71384
|
ctx.restore();
|
|
@@ -71397,7 +71397,7 @@ var init_pdf = __esm({
|
|
|
71397
71397
|
x,
|
|
71398
71398
|
y,
|
|
71399
71399
|
fontSize,
|
|
71400
|
-
path:
|
|
71400
|
+
path: path6
|
|
71401
71401
|
});
|
|
71402
71402
|
}
|
|
71403
71403
|
}
|
|
@@ -73412,10 +73412,10 @@ var init_pdf = __esm({
|
|
|
73412
73412
|
this._readableStream = null;
|
|
73413
73413
|
this._readCapability = Promise.withResolvers();
|
|
73414
73414
|
this._headersCapability = Promise.withResolvers();
|
|
73415
|
-
const
|
|
73416
|
-
|
|
73415
|
+
const fs5 = process.getBuiltinModule("fs");
|
|
73416
|
+
fs5.promises.lstat(this._url).then((stat) => {
|
|
73417
73417
|
this._contentLength = stat.size;
|
|
73418
|
-
this._setReadableStream(
|
|
73418
|
+
this._setReadableStream(fs5.createReadStream(this._url));
|
|
73419
73419
|
this._headersCapability.resolve();
|
|
73420
73420
|
}, (error40) => {
|
|
73421
73421
|
if (error40.code === "ENOENT") {
|
|
@@ -73510,8 +73510,8 @@ var init_pdf = __esm({
|
|
|
73510
73510
|
this._readCapability = Promise.withResolvers();
|
|
73511
73511
|
const source = stream.source;
|
|
73512
73512
|
this._isStreamingSupported = !source.disableStream;
|
|
73513
|
-
const
|
|
73514
|
-
this._setReadableStream(
|
|
73513
|
+
const fs5 = process.getBuiltinModule("fs");
|
|
73514
|
+
this._setReadableStream(fs5.createReadStream(this._url, {
|
|
73515
73515
|
start,
|
|
73516
73516
|
end: end - 1
|
|
73517
73517
|
}));
|
|
@@ -83734,13 +83734,13 @@ var init_pdf = __esm({
|
|
|
83734
83734
|
const root = this.#createSVG();
|
|
83735
83735
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
83736
83736
|
root.append(defs);
|
|
83737
|
-
const
|
|
83738
|
-
defs.append(
|
|
83737
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
83738
|
+
defs.append(path6);
|
|
83739
83739
|
const pathId = `path_p${this.pageIndex}_${id}`;
|
|
83740
|
-
|
|
83741
|
-
|
|
83740
|
+
path6.setAttribute("id", pathId);
|
|
83741
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
83742
83742
|
if (isPathUpdatable) {
|
|
83743
|
-
this.#toUpdate.set(id,
|
|
83743
|
+
this.#toUpdate.set(id, path6);
|
|
83744
83744
|
}
|
|
83745
83745
|
const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
|
|
83746
83746
|
const use = _DrawLayer._svgFactory.createElement("use");
|
|
@@ -83758,11 +83758,11 @@ var init_pdf = __esm({
|
|
|
83758
83758
|
const root = this.#createSVG();
|
|
83759
83759
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
83760
83760
|
root.append(defs);
|
|
83761
|
-
const
|
|
83762
|
-
defs.append(
|
|
83761
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
83762
|
+
defs.append(path6);
|
|
83763
83763
|
const pathId = `path_p${this.pageIndex}_${id}`;
|
|
83764
|
-
|
|
83765
|
-
|
|
83764
|
+
path6.setAttribute("id", pathId);
|
|
83765
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
83766
83766
|
let maskId;
|
|
83767
83767
|
if (mustRemoveSelfIntersections) {
|
|
83768
83768
|
const mask = _DrawLayer._svgFactory.createElement("mask");
|
|
@@ -83809,7 +83809,7 @@ var init_pdf = __esm({
|
|
|
83809
83809
|
root,
|
|
83810
83810
|
bbox,
|
|
83811
83811
|
rootClass,
|
|
83812
|
-
path:
|
|
83812
|
+
path: path6
|
|
83813
83813
|
} = properties;
|
|
83814
83814
|
const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
|
|
83815
83815
|
if (!element) {
|
|
@@ -83829,10 +83829,10 @@ var init_pdf = __esm({
|
|
|
83829
83829
|
classList.toggle(className, value);
|
|
83830
83830
|
}
|
|
83831
83831
|
}
|
|
83832
|
-
if (
|
|
83832
|
+
if (path6) {
|
|
83833
83833
|
const defs = element.firstChild;
|
|
83834
83834
|
const pathElement = defs.firstChild;
|
|
83835
|
-
this.#updateProperties(pathElement,
|
|
83835
|
+
this.#updateProperties(pathElement, path6);
|
|
83836
83836
|
}
|
|
83837
83837
|
}
|
|
83838
83838
|
updateParent(id, layer) {
|
|
@@ -84386,7 +84386,7 @@ var require_errorUtils = __commonJS({
|
|
|
84386
84386
|
var WARNING_MESSAGES = {
|
|
84387
84387
|
[types_js_1.OfficeWarningType.PERFORMANCE_TIP]: (tip) => `\u26A1\uFE0F Performance Tip: ${tip}`,
|
|
84388
84388
|
[types_js_1.OfficeWarningType.OCR_FAILED]: (name18) => `OCR failed for ${name18}:`,
|
|
84389
|
-
[types_js_1.OfficeWarningType.CHART_DATA_EXTRACTION_FAILED]: (
|
|
84389
|
+
[types_js_1.OfficeWarningType.CHART_DATA_EXTRACTION_FAILED]: (path6) => `Failed to extract chart data from ${path6}:`,
|
|
84390
84390
|
[types_js_1.OfficeWarningType.PDF_WORKER_FALLBACK]: `Could not auto-resolve local worker path, falling back to CDN:`,
|
|
84391
84391
|
[types_js_1.OfficeWarningType.ATTACHMENT_EXTRACTION_FAILED]: `Error extracting embedded attachments:`,
|
|
84392
84392
|
[types_js_1.OfficeWarningType.PAGE_LOAD_FAILED]: (page) => `Error loading page ${page}:`,
|
|
@@ -100501,7 +100501,7 @@ var require_EpubParser = __commonJS({
|
|
|
100501
100501
|
};
|
|
100502
100502
|
var parseEpub2 = async (buffer, config2) => {
|
|
100503
100503
|
(0, errorUtils_js_1.checkAbortSignal)(config2.abortSignal);
|
|
100504
|
-
const files = await (0, zipUtils_js_1.extractFiles)(buffer, (
|
|
100504
|
+
const files = await (0, zipUtils_js_1.extractFiles)(buffer, (path6) => /META-INF\/container\.xml$/i.test(path6) || /\.opf$/i.test(path6) || /\.(xhtml|html|htm)$/i.test(path6) || !!config2.extractAttachments && /\.(png|jpe?g|gif|svg|webp)$/i.test(path6), config2.decompressionLimits, config2);
|
|
100505
100505
|
let opfPath;
|
|
100506
100506
|
const containerFile = files.find((f) => /META-INF\/container\.xml$/i.test(f.path));
|
|
100507
100507
|
if (containerFile) {
|
|
@@ -101597,11 +101597,11 @@ var require_defaultOptions = __commonJS({
|
|
|
101597
101597
|
var require_defaultOptions2 = __commonJS({
|
|
101598
101598
|
"node_modules/tesseract.js/src/worker/node/defaultOptions.js"(exports2, module2) {
|
|
101599
101599
|
"use strict";
|
|
101600
|
-
var
|
|
101600
|
+
var path6 = require("path");
|
|
101601
101601
|
var defaultOptions3 = require_defaultOptions();
|
|
101602
101602
|
module2.exports = {
|
|
101603
101603
|
...defaultOptions3,
|
|
101604
|
-
workerPath:
|
|
101604
|
+
workerPath: path6.join(__dirname, "..", "..", "worker-script", "node", "index.js")
|
|
101605
101605
|
};
|
|
101606
101606
|
}
|
|
101607
101607
|
});
|
|
@@ -102382,14 +102382,14 @@ var require_url_state_machine = __commonJS({
|
|
|
102382
102382
|
return url2.replace(/\u0009|\u000A|\u000D/g, "");
|
|
102383
102383
|
}
|
|
102384
102384
|
function shortenPath(url2) {
|
|
102385
|
-
const
|
|
102386
|
-
if (
|
|
102385
|
+
const path6 = url2.path;
|
|
102386
|
+
if (path6.length === 0) {
|
|
102387
102387
|
return;
|
|
102388
102388
|
}
|
|
102389
|
-
if (url2.scheme === "file" &&
|
|
102389
|
+
if (url2.scheme === "file" && path6.length === 1 && isNormalizedWindowsDriveLetter(path6[0])) {
|
|
102390
102390
|
return;
|
|
102391
102391
|
}
|
|
102392
|
-
|
|
102392
|
+
path6.pop();
|
|
102393
102393
|
}
|
|
102394
102394
|
function includesCredentials(url2) {
|
|
102395
102395
|
return url2.username !== "" || url2.password !== "";
|
|
@@ -104699,10 +104699,10 @@ var require_loadImage = __commonJS({
|
|
|
104699
104699
|
"node_modules/tesseract.js/src/worker/node/loadImage.js"(exports2, module2) {
|
|
104700
104700
|
"use strict";
|
|
104701
104701
|
var util2 = require("util");
|
|
104702
|
-
var
|
|
104702
|
+
var fs5 = require("fs");
|
|
104703
104703
|
var fetch4 = global.fetch || require_lib3();
|
|
104704
104704
|
var isURL = require_is_url();
|
|
104705
|
-
var readFile5 = util2.promisify(
|
|
104705
|
+
var readFile5 = util2.promisify(fs5.readFile);
|
|
104706
104706
|
module2.exports = async (image) => {
|
|
104707
104707
|
let data = image;
|
|
104708
104708
|
if (typeof image === "undefined") {
|
|
@@ -104808,20 +104808,20 @@ var require_createWorker = __commonJS({
|
|
|
104808
104808
|
action: "load",
|
|
104809
104809
|
payload: { options: { lstmOnly: lstmOnlyCore, corePath: options.corePath, logging: options.logging } }
|
|
104810
104810
|
}));
|
|
104811
|
-
const writeText = (
|
|
104811
|
+
const writeText = (path6, text3, jobId) => startJob(createJob({
|
|
104812
104812
|
id: jobId,
|
|
104813
104813
|
action: "FS",
|
|
104814
|
-
payload: { method: "writeFile", args: [
|
|
104814
|
+
payload: { method: "writeFile", args: [path6, text3] }
|
|
104815
104815
|
}));
|
|
104816
|
-
const readText = (
|
|
104816
|
+
const readText = (path6, jobId) => startJob(createJob({
|
|
104817
104817
|
id: jobId,
|
|
104818
104818
|
action: "FS",
|
|
104819
|
-
payload: { method: "readFile", args: [
|
|
104819
|
+
payload: { method: "readFile", args: [path6, { encoding: "utf8" }] }
|
|
104820
104820
|
}));
|
|
104821
|
-
const removeFile = (
|
|
104821
|
+
const removeFile = (path6, jobId) => startJob(createJob({
|
|
104822
104822
|
id: jobId,
|
|
104823
104823
|
action: "FS",
|
|
104824
|
-
payload: { method: "unlink", args: [
|
|
104824
|
+
payload: { method: "unlink", args: [path6] }
|
|
104825
104825
|
}));
|
|
104826
104826
|
const FS = (method, args, jobId) => startJob(createJob({
|
|
104827
104827
|
id: jobId,
|
|
@@ -105496,7 +105496,7 @@ var require_ExcelParser = __commonJS({
|
|
|
105496
105496
|
const drawingRelsRegex = /xl\/drawings\/_rels\/drawing\d+\.xml\.rels/g;
|
|
105497
105497
|
const commentsRegex = /xl\/comments\d+\.xml/g;
|
|
105498
105498
|
const files = await (0, zipUtils_js_1.extractFiles)(buffer, (x) => !!x.match(sheetsRegex) || !!x.match(drawingsRegex) || !!x.match(chartsRegex) || !config2.ignoreComments && !!x.match(commentsRegex) || x === stringsFilePath || x === "xl/styles.xml" || x === "xl/workbook.xml" || x === "xl/_rels/workbook.xml.rels" || !!x.match(corePropsFileRegex) || !!x.match(customPropsFileRegex) || !!x.match(appPropsFileRegex) || !!config2.extractAttachments && (!!x.match(mediaFileRegex) || !!x.match(drawingRelsRegex)) || (!!config2.extractAttachments || !config2.ignoreComments) && !!x.match(relsRegex), config2.decompressionLimits, config2);
|
|
105499
|
-
const workbookFile = (0, zipUtils_js_1.findRequiredPart)(files, (
|
|
105499
|
+
const workbookFile = (0, zipUtils_js_1.findRequiredPart)(files, (path6) => path6 === "xl/workbook.xml", config2, { fileType: "xlsx", part: "xl/workbook.xml" });
|
|
105500
105500
|
if (!files.some((file2) => !!file2.path.match(sheetsRegex)))
|
|
105501
105501
|
(0, errorUtils_js_1.logWarning)(types_js_1.OfficeWarningType.NO_WORKSHEETS_FOUND, config2);
|
|
105502
105502
|
const sharedStringsFile = files.find((f) => f.path === stringsFilePath);
|
|
@@ -106970,7 +106970,7 @@ var require_OpenOfficeParser = __commonJS({
|
|
|
106970
106970
|
else if (mime.includes("text"))
|
|
106971
106971
|
fileType = "odt";
|
|
106972
106972
|
}
|
|
106973
|
-
const mainContentFile = files.find((f) => f.path === "content.xml") || (0, zipUtils_js_1.findRequiredPart)(files, (
|
|
106973
|
+
const mainContentFile = files.find((f) => f.path === "content.xml") || (0, zipUtils_js_1.findRequiredPart)(files, (path6) => /(^|\/)content\.xml$/.test(path6) && !objectContentFileRegex.test(path6), config2, { fileType, part: "content.xml" });
|
|
106974
106974
|
const stylesFile = files.find((f) => f.path === "styles.xml");
|
|
106975
106975
|
const stylesDom = stylesFile ? (0, xmlUtils_js_1.parseXmlString)(stylesFile.content.toString()) : void 0;
|
|
106976
106976
|
const content = [];
|
|
@@ -111915,8 +111915,8 @@ async function fileTypeFromTokenizer(tokenizer, options) {
|
|
|
111915
111915
|
async function fileTypeStream(webStream, options) {
|
|
111916
111916
|
return new FileTypeParser(options).toDetectionStream(webStream, options);
|
|
111917
111917
|
}
|
|
111918
|
-
async function fileTypeFromFile(
|
|
111919
|
-
return new FileTypeParser(options).fromFile(
|
|
111918
|
+
async function fileTypeFromFile(path6, options) {
|
|
111919
|
+
return new FileTypeParser(options).fromFile(path6);
|
|
111920
111920
|
}
|
|
111921
111921
|
var reasonableDetectionSizeInBytes, maximumMpegOffsetTolerance, maximumNestedGzipDetectionSizeInBytes, maximumNestedGzipProbeDepth, unknownSizeGzipProbeTimeoutInMilliseconds, maximumId3HeaderSizeInBytes, maximumTiffTagCount, maximumDetectionReentryCount, maximumTiffStreamIfdOffsetInBytes, maximumTiffIfdOffsetInBytes, FileTypeParser, supportedExtensions, supportedMimeTypes;
|
|
111922
111922
|
var init_source = __esm({
|
|
@@ -112018,13 +112018,13 @@ var init_source = __esm({
|
|
|
112018
112018
|
const tokenizer = this.createTokenizerFromWebStream(stream);
|
|
112019
112019
|
return this.fromTokenizer(tokenizer);
|
|
112020
112020
|
}
|
|
112021
|
-
async fromFile(
|
|
112021
|
+
async fromFile(path6) {
|
|
112022
112022
|
this.options.signal?.throwIfAborted();
|
|
112023
112023
|
const [{ default: fsPromises }, { FileTokenizer }] = await Promise.all([
|
|
112024
112024
|
importAtRuntime("node:fs/promises"),
|
|
112025
112025
|
importAtRuntime("strtok3")
|
|
112026
112026
|
]);
|
|
112027
|
-
const fileHandle = await fsPromises.open(
|
|
112027
|
+
const fileHandle = await fsPromises.open(path6, fsPromises.constants.O_RDONLY | fsPromises.constants.O_NONBLOCK);
|
|
112028
112028
|
const fileStat = await fileHandle.stat();
|
|
112029
112029
|
if (!fileStat.isFile()) {
|
|
112030
112030
|
await fileHandle.close();
|
|
@@ -112032,7 +112032,7 @@ var init_source = __esm({
|
|
|
112032
112032
|
}
|
|
112033
112033
|
const tokenizer = new FileTokenizer(fileHandle, {
|
|
112034
112034
|
...this.getTokenizerOptions(),
|
|
112035
|
-
fileInfo: { path:
|
|
112035
|
+
fileInfo: { path: path6, size: fileStat.size }
|
|
112036
112036
|
});
|
|
112037
112037
|
return this.fromTokenizer(tokenizer);
|
|
112038
112038
|
}
|
|
@@ -113908,33 +113908,33 @@ function renderRichText({
|
|
|
113908
113908
|
container.append(fragment);
|
|
113909
113909
|
}
|
|
113910
113910
|
function makePathFromDrawOPS(data) {
|
|
113911
|
-
const
|
|
113911
|
+
const path6 = new Path2D();
|
|
113912
113912
|
if (!data) {
|
|
113913
|
-
return
|
|
113913
|
+
return path6;
|
|
113914
113914
|
}
|
|
113915
113915
|
for (let i = 0, ii = data.length; i < ii; ) {
|
|
113916
113916
|
switch (data[i++]) {
|
|
113917
113917
|
case DrawOPS.moveTo:
|
|
113918
|
-
|
|
113918
|
+
path6.moveTo(data[i++], data[i++]);
|
|
113919
113919
|
break;
|
|
113920
113920
|
case DrawOPS.lineTo:
|
|
113921
|
-
|
|
113921
|
+
path6.lineTo(data[i++], data[i++]);
|
|
113922
113922
|
break;
|
|
113923
113923
|
case DrawOPS.curveTo:
|
|
113924
|
-
|
|
113924
|
+
path6.bezierCurveTo(data[i++], data[i++], data[i++], data[i++], data[i++], data[i++]);
|
|
113925
113925
|
break;
|
|
113926
113926
|
case DrawOPS.quadraticCurveTo:
|
|
113927
|
-
|
|
113927
|
+
path6.quadraticCurveTo(data[i++], data[i++], data[i++], data[i++]);
|
|
113928
113928
|
break;
|
|
113929
113929
|
case DrawOPS.closePath:
|
|
113930
|
-
|
|
113930
|
+
path6.closePath();
|
|
113931
113931
|
break;
|
|
113932
113932
|
default:
|
|
113933
113933
|
warn2(`Unrecognized drawing path operator: ${data[i - 1]}`);
|
|
113934
113934
|
break;
|
|
113935
113935
|
}
|
|
113936
113936
|
}
|
|
113937
|
-
return
|
|
113937
|
+
return path6;
|
|
113938
113938
|
}
|
|
113939
113939
|
function bindEvents2(obj, element, names) {
|
|
113940
113940
|
for (const name18 of names) {
|
|
@@ -114042,8 +114042,8 @@ function blend(fg, bg, alpha) {
|
|
|
114042
114042
|
return Math.round(alpha * fg + (1 - alpha) * bg);
|
|
114043
114043
|
}
|
|
114044
114044
|
async function node_utils_fetchData2(url2) {
|
|
114045
|
-
const
|
|
114046
|
-
const data = await
|
|
114045
|
+
const fs5 = process.getBuiltinModule("fs/promises");
|
|
114046
|
+
const data = await fs5.readFile(url2);
|
|
114047
114047
|
return new Uint8Array(data);
|
|
114048
114048
|
}
|
|
114049
114049
|
function convertBlackAndWhiteToRGBA2({
|
|
@@ -114682,11 +114682,11 @@ function network_getArrayBuffer2(val) {
|
|
|
114682
114682
|
return typeof val !== "string" ? val : stringToBytes3(val).buffer;
|
|
114683
114683
|
}
|
|
114684
114684
|
function getReadableStream(url2, opts = null) {
|
|
114685
|
-
const
|
|
114685
|
+
const fs5 = process.getBuiltinModule("fs");
|
|
114686
114686
|
const {
|
|
114687
114687
|
Readable
|
|
114688
114688
|
} = process.getBuiltinModule("stream");
|
|
114689
|
-
const readStream =
|
|
114689
|
+
const readStream = fs5.createReadStream(url2, opts);
|
|
114690
114690
|
return Readable.toWeb(readStream);
|
|
114691
114691
|
}
|
|
114692
114692
|
function getNetworkStream(url2) {
|
|
@@ -116499,7 +116499,7 @@ var init_pdf2 = __esm({
|
|
|
116499
116499
|
var defineProperty = Object.defineProperty;
|
|
116500
116500
|
var stringSlice = uncurryThis("".slice);
|
|
116501
116501
|
var replace2 = uncurryThis("".replace);
|
|
116502
|
-
var
|
|
116502
|
+
var join15 = uncurryThis([].join);
|
|
116503
116503
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
116504
116504
|
return defineProperty(function() {
|
|
116505
116505
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -116532,7 +116532,7 @@ var init_pdf2 = __esm({
|
|
|
116532
116532
|
}
|
|
116533
116533
|
var state = enforceInternalState(value);
|
|
116534
116534
|
if (!hasOwn(state, "source")) {
|
|
116535
|
-
state.source =
|
|
116535
|
+
state.source = join15(TEMPLATE, typeof name18 == "string" ? name18 : "");
|
|
116536
116536
|
}
|
|
116537
116537
|
return value;
|
|
116538
116538
|
};
|
|
@@ -119102,7 +119102,7 @@ var init_pdf2 = __esm({
|
|
|
119102
119102
|
var anUint8Array = __webpack_require__4(4154);
|
|
119103
119103
|
var notDetached = __webpack_require__4(5169);
|
|
119104
119104
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
119105
|
-
var
|
|
119105
|
+
var join15 = uncurryThis([].join);
|
|
119106
119106
|
var $Array = Array;
|
|
119107
119107
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
119108
119108
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !function() {
|
|
@@ -119123,7 +119123,7 @@ var init_pdf2 = __esm({
|
|
|
119123
119123
|
var hex = numberToString2(this[i], 16);
|
|
119124
119124
|
result[i] = hex.length === 1 ? "0" + hex : hex;
|
|
119125
119125
|
}
|
|
119126
|
-
return
|
|
119126
|
+
return join15(result, "");
|
|
119127
119127
|
}
|
|
119128
119128
|
});
|
|
119129
119129
|
},
|
|
@@ -126586,11 +126586,11 @@ var init_pdf2 = __esm({
|
|
|
126586
126586
|
} catch (ex) {
|
|
126587
126587
|
warn2(`getPathGenerator - ignoring character: "${ex}".`);
|
|
126588
126588
|
}
|
|
126589
|
-
const
|
|
126589
|
+
const path6 = makePathFromDrawOPS(cmds?.path);
|
|
126590
126590
|
if (!this.fontExtraProperties) {
|
|
126591
126591
|
objs.delete(objId);
|
|
126592
126592
|
}
|
|
126593
|
-
return this.compiledGlyphs[character] =
|
|
126593
|
+
return this.compiledGlyphs[character] = path6;
|
|
126594
126594
|
}
|
|
126595
126595
|
get black() {
|
|
126596
126596
|
return this.#fontData.black;
|
|
@@ -128486,7 +128486,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
128486
128486
|
Util2.singularValueDecompose2dScale(this.baseTransform, scale);
|
|
128487
128487
|
return [matrixScaleX * scale[0], matrixScaleY * scale[1]];
|
|
128488
128488
|
}
|
|
128489
|
-
drawPattern(owner,
|
|
128489
|
+
drawPattern(owner, path6, useEOFill = false, [n, m], opIdx) {
|
|
128490
128490
|
const [x0, y0, x1, y1] = this.bbox;
|
|
128491
128491
|
const dependencyTracker = owner.dependencyTracker;
|
|
128492
128492
|
if (dependencyTracker) {
|
|
@@ -128494,9 +128494,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
128494
128494
|
}
|
|
128495
128495
|
owner.save();
|
|
128496
128496
|
if (useEOFill) {
|
|
128497
|
-
owner.ctx.clip(
|
|
128497
|
+
owner.ctx.clip(path6, "evenodd");
|
|
128498
128498
|
} else {
|
|
128499
|
-
owner.ctx.clip(
|
|
128499
|
+
owner.ctx.clip(path6);
|
|
128500
128500
|
}
|
|
128501
128501
|
owner.ctx.setTransform(...this.patternBaseMatrix);
|
|
128502
128502
|
owner.ctx.translate(n * this.xstep, m * this.ystep);
|
|
@@ -129587,15 +129587,15 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129587
129587
|
if (hasInnerCutout && maskX0 === layerOffsetX && maskY0 === layerOffsetY && maskX1 === layerOffsetX + layerWidth && maskY1 === layerOffsetY + layerHeight) {
|
|
129588
129588
|
return;
|
|
129589
129589
|
}
|
|
129590
|
-
const
|
|
129591
|
-
|
|
129590
|
+
const path6 = new Path2D();
|
|
129591
|
+
path6.rect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
|
129592
129592
|
if (hasInnerCutout) {
|
|
129593
|
-
|
|
129593
|
+
path6.rect(maskX0, maskY0, maskX1 - maskX0, maskY1 - maskY0);
|
|
129594
129594
|
}
|
|
129595
129595
|
layerCtx.save();
|
|
129596
129596
|
layerCtx.globalAlpha = alpha / 255;
|
|
129597
129597
|
layerCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
129598
|
-
layerCtx.clip(
|
|
129598
|
+
layerCtx.clip(path6, "evenodd");
|
|
129599
129599
|
layerCtx.globalCompositeOperation = "destination-in";
|
|
129600
129600
|
layerCtx.fillStyle = "#000000";
|
|
129601
129601
|
layerCtx.fillRect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
|
@@ -129653,21 +129653,21 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129653
129653
|
this._cachedGetSinglePixelWidth = null;
|
|
129654
129654
|
}
|
|
129655
129655
|
constructPath(opIdx, op, data, minMax) {
|
|
129656
|
-
let [
|
|
129656
|
+
let [path6] = data;
|
|
129657
129657
|
if (!minMax) {
|
|
129658
|
-
|
|
129658
|
+
path6 ||= data[0] = new Path2D();
|
|
129659
129659
|
if (op !== OPS2.stroke && op !== OPS2.closeStroke) {
|
|
129660
129660
|
this.current.tilingPatternDims = null;
|
|
129661
129661
|
}
|
|
129662
|
-
this[op](opIdx,
|
|
129662
|
+
this[op](opIdx, path6);
|
|
129663
129663
|
return;
|
|
129664
129664
|
}
|
|
129665
129665
|
if (this.dependencyTracker !== null) {
|
|
129666
129666
|
const outerExtraSize = op === OPS2.stroke ? this.current.lineWidth / 2 : 0;
|
|
129667
129667
|
this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
|
|
129668
129668
|
}
|
|
129669
|
-
if (!(
|
|
129670
|
-
|
|
129669
|
+
if (!(path6 instanceof Path2D)) {
|
|
129670
|
+
path6 = data[0] = makePathFromDrawOPS(path6);
|
|
129671
129671
|
}
|
|
129672
129672
|
Util2.axialAlignedBoundingBox(minMax, getCurrentTransform2(this.ctx), this.current.minMax);
|
|
129673
129673
|
const tilingDims = this.current.tilingPatternDims;
|
|
@@ -129679,13 +129679,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129679
129679
|
this.current.fillColor.updatePatternDims(clippedBBox, tilingDims);
|
|
129680
129680
|
}
|
|
129681
129681
|
}
|
|
129682
|
-
this[op](opIdx,
|
|
129682
|
+
this[op](opIdx, path6);
|
|
129683
129683
|
this._pathStartIdx = opIdx;
|
|
129684
129684
|
}
|
|
129685
129685
|
closePath(opIdx) {
|
|
129686
129686
|
this.ctx.closePath();
|
|
129687
129687
|
}
|
|
129688
|
-
stroke(opIdx,
|
|
129688
|
+
stroke(opIdx, path6, consumePath = true) {
|
|
129689
129689
|
const started = consumePath && this.#beginKnockoutElement(this.current.strokeAlpha);
|
|
129690
129690
|
const ctx = this.ctx;
|
|
129691
129691
|
const strokeColor = this.current.strokeColor;
|
|
@@ -129697,26 +129697,26 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129697
129697
|
ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse2(ctx), PathType2.STROKE, opIdx);
|
|
129698
129698
|
if (baseTransform) {
|
|
129699
129699
|
const newPath = new Path2D();
|
|
129700
|
-
newPath.addPath(
|
|
129701
|
-
|
|
129700
|
+
newPath.addPath(path6, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
|
129701
|
+
path6 = newPath;
|
|
129702
129702
|
}
|
|
129703
|
-
this.rescaleAndStroke(
|
|
129703
|
+
this.rescaleAndStroke(path6, false);
|
|
129704
129704
|
ctx.restore();
|
|
129705
129705
|
} else {
|
|
129706
|
-
this.rescaleAndStroke(
|
|
129706
|
+
this.rescaleAndStroke(path6, true);
|
|
129707
129707
|
}
|
|
129708
129708
|
}
|
|
129709
129709
|
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.stroke);
|
|
129710
129710
|
if (consumePath) {
|
|
129711
|
-
this.consumePath(opIdx,
|
|
129711
|
+
this.consumePath(opIdx, path6, this.current.getClippedPathBoundingBox(PathType2.STROKE, getCurrentTransform2(this.ctx)));
|
|
129712
129712
|
}
|
|
129713
129713
|
ctx.globalAlpha = this.current.fillAlpha;
|
|
129714
129714
|
this.#endKnockoutElement(started);
|
|
129715
129715
|
}
|
|
129716
|
-
closeStroke(opIdx,
|
|
129717
|
-
this.stroke(opIdx,
|
|
129716
|
+
closeStroke(opIdx, path6) {
|
|
129717
|
+
this.stroke(opIdx, path6);
|
|
129718
129718
|
}
|
|
129719
|
-
fill(opIdx,
|
|
129719
|
+
fill(opIdx, path6, consumePath = true) {
|
|
129720
129720
|
const started = consumePath && this.#beginKnockoutElement(this.current.fillAlpha);
|
|
129721
129721
|
const ctx = this.ctx;
|
|
129722
129722
|
const fillColor = this.current.fillColor;
|
|
@@ -129728,10 +129728,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129728
129728
|
const dims = this.current.tilingPatternDims;
|
|
129729
129729
|
const tileIdx = dims && fillColor.canSkipPatternCanvas(dims);
|
|
129730
129730
|
if (tileIdx) {
|
|
129731
|
-
fillColor.drawPattern(this,
|
|
129731
|
+
fillColor.drawPattern(this, path6, this.pendingEOFill, tileIdx, opIdx);
|
|
129732
129732
|
this.pendingEOFill = false;
|
|
129733
129733
|
if (consumePath) {
|
|
129734
|
-
this.consumePath(opIdx,
|
|
129734
|
+
this.consumePath(opIdx, path6, intersect2);
|
|
129735
129735
|
}
|
|
129736
129736
|
this.current.tilingPatternDims = null;
|
|
129737
129737
|
this.#endKnockoutElement(started);
|
|
@@ -129743,17 +129743,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129743
129743
|
ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse2(ctx), PathType2.FILL, opIdx);
|
|
129744
129744
|
if (baseTransform) {
|
|
129745
129745
|
const newPath = new Path2D();
|
|
129746
|
-
newPath.addPath(
|
|
129747
|
-
|
|
129746
|
+
newPath.addPath(path6, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
|
129747
|
+
path6 = newPath;
|
|
129748
129748
|
}
|
|
129749
129749
|
needRestore = true;
|
|
129750
129750
|
}
|
|
129751
129751
|
if (this.contentVisible && intersect2 !== null) {
|
|
129752
129752
|
if (this.pendingEOFill) {
|
|
129753
|
-
ctx.fill(
|
|
129753
|
+
ctx.fill(path6, "evenodd");
|
|
129754
129754
|
this.pendingEOFill = false;
|
|
129755
129755
|
} else {
|
|
129756
|
-
ctx.fill(
|
|
129756
|
+
ctx.fill(path6);
|
|
129757
129757
|
}
|
|
129758
129758
|
}
|
|
129759
129759
|
if (needRestore) {
|
|
@@ -129761,38 +129761,38 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129761
129761
|
this.dependencyTracker?.restore(opIdx);
|
|
129762
129762
|
}
|
|
129763
129763
|
if (consumePath) {
|
|
129764
|
-
this.consumePath(opIdx,
|
|
129764
|
+
this.consumePath(opIdx, path6, intersect2);
|
|
129765
129765
|
}
|
|
129766
129766
|
this.#endKnockoutElement(started);
|
|
129767
129767
|
}
|
|
129768
|
-
eoFill(opIdx,
|
|
129768
|
+
eoFill(opIdx, path6) {
|
|
129769
129769
|
this.pendingEOFill = true;
|
|
129770
|
-
this.fill(opIdx,
|
|
129770
|
+
this.fill(opIdx, path6);
|
|
129771
129771
|
}
|
|
129772
|
-
fillStroke(opIdx,
|
|
129772
|
+
fillStroke(opIdx, path6) {
|
|
129773
129773
|
const started = this.#beginKnockoutElement(Math.min(this.current.fillAlpha, this.current.strokeAlpha));
|
|
129774
|
-
this.fill(opIdx,
|
|
129775
|
-
this.stroke(opIdx,
|
|
129776
|
-
this.consumePath(opIdx,
|
|
129774
|
+
this.fill(opIdx, path6, false);
|
|
129775
|
+
this.stroke(opIdx, path6, false);
|
|
129776
|
+
this.consumePath(opIdx, path6);
|
|
129777
129777
|
this.#endKnockoutElement(started);
|
|
129778
129778
|
}
|
|
129779
|
-
eoFillStroke(opIdx,
|
|
129779
|
+
eoFillStroke(opIdx, path6) {
|
|
129780
129780
|
this.pendingEOFill = true;
|
|
129781
|
-
this.fillStroke(opIdx,
|
|
129781
|
+
this.fillStroke(opIdx, path6);
|
|
129782
129782
|
}
|
|
129783
|
-
closeFillStroke(opIdx,
|
|
129784
|
-
this.fillStroke(opIdx,
|
|
129783
|
+
closeFillStroke(opIdx, path6) {
|
|
129784
|
+
this.fillStroke(opIdx, path6);
|
|
129785
129785
|
}
|
|
129786
|
-
closeEOFillStroke(opIdx,
|
|
129786
|
+
closeEOFillStroke(opIdx, path6) {
|
|
129787
129787
|
this.pendingEOFill = true;
|
|
129788
|
-
this.fillStroke(opIdx,
|
|
129788
|
+
this.fillStroke(opIdx, path6);
|
|
129789
129789
|
}
|
|
129790
|
-
endPath(opIdx,
|
|
129791
|
-
this.consumePath(opIdx,
|
|
129790
|
+
endPath(opIdx, path6) {
|
|
129791
|
+
this.consumePath(opIdx, path6);
|
|
129792
129792
|
}
|
|
129793
|
-
rawFillPath(opIdx,
|
|
129793
|
+
rawFillPath(opIdx, path6) {
|
|
129794
129794
|
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
|
129795
|
-
this.ctx.fill(
|
|
129795
|
+
this.ctx.fill(path6);
|
|
129796
129796
|
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.rawFillPath).recordOperation(opIdx);
|
|
129797
129797
|
this.#endKnockoutElement(started);
|
|
129798
129798
|
}
|
|
@@ -129831,12 +129831,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129831
129831
|
x,
|
|
129832
129832
|
y,
|
|
129833
129833
|
fontSize,
|
|
129834
|
-
path:
|
|
129834
|
+
path: path6
|
|
129835
129835
|
} of paths) {
|
|
129836
|
-
if (!
|
|
129836
|
+
if (!path6) {
|
|
129837
129837
|
continue;
|
|
129838
129838
|
}
|
|
129839
|
-
newPath.addPath(
|
|
129839
|
+
newPath.addPath(path6, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x, y).scale(fontSize, -fontSize));
|
|
129840
129840
|
}
|
|
129841
129841
|
ctx.clip(newPath);
|
|
129842
129842
|
}
|
|
@@ -129924,9 +129924,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129924
129924
|
this.moveText(opIdx, 0, this.current.leading);
|
|
129925
129925
|
this.dependencyTracker?.recordIncrementalData("moveText", this.dependencyTracker.getSimpleIndex("leading") ?? opIdx);
|
|
129926
129926
|
}
|
|
129927
|
-
#getScaledPath(
|
|
129927
|
+
#getScaledPath(path6, currentTransform, transform2) {
|
|
129928
129928
|
const newPath = new Path2D();
|
|
129929
|
-
newPath.addPath(
|
|
129929
|
+
newPath.addPath(path6, new DOMMatrix(transform2).invertSelf().multiplySelf(currentTransform));
|
|
129930
129930
|
return newPath;
|
|
129931
129931
|
}
|
|
129932
129932
|
paintChar(opIdx, character, x, y, patternFillTransform, patternStrokeTransform) {
|
|
@@ -129939,11 +129939,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129939
129939
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode2.ADD_TO_PATH_FLAG);
|
|
129940
129940
|
const patternFill = current.patternFill && !font.missingFile;
|
|
129941
129941
|
const patternStroke = current.patternStroke && !font.missingFile;
|
|
129942
|
-
let
|
|
129942
|
+
let path6;
|
|
129943
129943
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
129944
|
-
|
|
129944
|
+
path6 = font.getPathGenerator(this.commonObjs, character);
|
|
129945
129945
|
}
|
|
129946
|
-
if (
|
|
129946
|
+
if (path6 && (font.disableFontFace || patternFill || patternStroke)) {
|
|
129947
129947
|
ctx.save();
|
|
129948
129948
|
ctx.translate(x, y);
|
|
129949
129949
|
ctx.scale(fontSize, -fontSize);
|
|
@@ -129953,10 +129953,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129953
129953
|
if (patternFillTransform) {
|
|
129954
129954
|
currentTransform = ctx.getTransform();
|
|
129955
129955
|
ctx.setTransform(...patternFillTransform);
|
|
129956
|
-
const scaledPath = this.#getScaledPath(
|
|
129956
|
+
const scaledPath = this.#getScaledPath(path6, currentTransform, patternFillTransform);
|
|
129957
129957
|
ctx.fill(scaledPath);
|
|
129958
129958
|
} else {
|
|
129959
|
-
ctx.fill(
|
|
129959
|
+
ctx.fill(path6);
|
|
129960
129960
|
}
|
|
129961
129961
|
}
|
|
129962
129962
|
if (fillStrokeMode === TextRenderingMode2.STROKE || fillStrokeMode === TextRenderingMode2.FILL_STROKE) {
|
|
@@ -129973,10 +129973,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129973
129973
|
const transf = Util2.transform([a, b, c, d, 0, 0], invPatternTransform);
|
|
129974
129974
|
Util2.singularValueDecompose2dScale(transf, XY);
|
|
129975
129975
|
ctx.lineWidth *= Math.max(XY[0], XY[1]) / fontSize;
|
|
129976
|
-
ctx.stroke(this.#getScaledPath(
|
|
129976
|
+
ctx.stroke(this.#getScaledPath(path6, currentTransform, patternStrokeTransform));
|
|
129977
129977
|
} else {
|
|
129978
129978
|
ctx.lineWidth /= fontSize;
|
|
129979
|
-
ctx.stroke(
|
|
129979
|
+
ctx.stroke(path6);
|
|
129980
129980
|
}
|
|
129981
129981
|
}
|
|
129982
129982
|
ctx.restore();
|
|
@@ -129999,7 +129999,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
129999
129999
|
x,
|
|
130000
130000
|
y,
|
|
130001
130001
|
fontSize,
|
|
130002
|
-
path:
|
|
130002
|
+
path: path6
|
|
130003
130003
|
});
|
|
130004
130004
|
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y);
|
|
130005
130005
|
}
|
|
@@ -130389,9 +130389,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
130389
130389
|
const [x0, y0, x1, y1] = group.bbox;
|
|
130390
130390
|
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
130391
130391
|
if (group.matrix) {
|
|
130392
|
-
const
|
|
130393
|
-
|
|
130394
|
-
clip =
|
|
130392
|
+
const path6 = new Path2D();
|
|
130393
|
+
path6.addPath(clip, new DOMMatrix(group.matrix));
|
|
130394
|
+
clip = path6;
|
|
130395
130395
|
}
|
|
130396
130396
|
currentCtx.clip(clip);
|
|
130397
130397
|
}
|
|
@@ -130450,9 +130450,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
130450
130450
|
const [x0, y0, x1, y1] = group.bbox;
|
|
130451
130451
|
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
130452
130452
|
if (group.matrix) {
|
|
130453
|
-
const
|
|
130454
|
-
|
|
130455
|
-
clip =
|
|
130453
|
+
const path6 = new Path2D();
|
|
130454
|
+
path6.addPath(clip, new DOMMatrix(group.matrix));
|
|
130455
|
+
clip = path6;
|
|
130456
130456
|
}
|
|
130457
130457
|
groupCtx.clip(clip);
|
|
130458
130458
|
}
|
|
@@ -130978,7 +130978,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
130978
130978
|
}
|
|
130979
130979
|
endCompat(opIdx) {
|
|
130980
130980
|
}
|
|
130981
|
-
consumePath(opIdx,
|
|
130981
|
+
consumePath(opIdx, path6, clipBox) {
|
|
130982
130982
|
const isEmpty = this.current.isEmptyClip();
|
|
130983
130983
|
if (this.pendingClip) {
|
|
130984
130984
|
this.current.updateClipFromPath();
|
|
@@ -130990,9 +130990,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
130990
130990
|
if (this.pendingClip) {
|
|
130991
130991
|
if (!isEmpty) {
|
|
130992
130992
|
if (this.pendingClip === EO_CLIP2) {
|
|
130993
|
-
ctx.clip(
|
|
130993
|
+
ctx.clip(path6, "evenodd");
|
|
130994
130994
|
} else {
|
|
130995
|
-
ctx.clip(
|
|
130995
|
+
ctx.clip(path6);
|
|
130996
130996
|
}
|
|
130997
130997
|
}
|
|
130998
130998
|
this.pendingClip = null;
|
|
@@ -131065,7 +131065,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
131065
131065
|
}
|
|
131066
131066
|
return this._cachedScaleForStroking;
|
|
131067
131067
|
}
|
|
131068
|
-
rescaleAndStroke(
|
|
131068
|
+
rescaleAndStroke(path6, saveRestore) {
|
|
131069
131069
|
const {
|
|
131070
131070
|
ctx,
|
|
131071
131071
|
current: {
|
|
@@ -131075,7 +131075,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
131075
131075
|
const [scaleX, scaleY] = this.getScaleForStroking();
|
|
131076
131076
|
if (scaleX === scaleY) {
|
|
131077
131077
|
ctx.lineWidth = (lineWidth || 1) * scaleX;
|
|
131078
|
-
ctx.stroke(
|
|
131078
|
+
ctx.stroke(path6);
|
|
131079
131079
|
return;
|
|
131080
131080
|
}
|
|
131081
131081
|
const dashes = ctx.getLineDash();
|
|
@@ -131086,7 +131086,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
131086
131086
|
SCALE_MATRIX.a = 1 / scaleX;
|
|
131087
131087
|
SCALE_MATRIX.d = 1 / scaleY;
|
|
131088
131088
|
const newPath = new Path2D();
|
|
131089
|
-
newPath.addPath(
|
|
131089
|
+
newPath.addPath(path6, SCALE_MATRIX);
|
|
131090
131090
|
if (dashes.length > 0) {
|
|
131091
131091
|
const scale = Math.max(scaleX, scaleY);
|
|
131092
131092
|
ctx.setLineDash(dashes.map((x) => x / scale));
|
|
@@ -131813,8 +131813,8 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
131813
131813
|
url: url2
|
|
131814
131814
|
} = stream._source;
|
|
131815
131815
|
this._isStreamingSupported = !disableStream;
|
|
131816
|
-
const
|
|
131817
|
-
|
|
131816
|
+
const fs5 = process.getBuiltinModule("fs/promises");
|
|
131817
|
+
fs5.lstat(url2).then((stat) => {
|
|
131818
131818
|
const readableStream = getReadableStream(url2);
|
|
131819
131819
|
this._reader = readableStream.getReader();
|
|
131820
131820
|
const {
|
|
@@ -142229,11 +142229,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
142229
142229
|
};
|
|
142230
142230
|
ContourDrawOutline = class extends InkDrawOutline2 {
|
|
142231
142231
|
toSVGPath() {
|
|
142232
|
-
let
|
|
142233
|
-
if (!
|
|
142234
|
-
|
|
142232
|
+
let path6 = super.toSVGPath();
|
|
142233
|
+
if (!path6.endsWith("Z")) {
|
|
142234
|
+
path6 += "Z";
|
|
142235
142235
|
}
|
|
142236
|
-
return
|
|
142236
|
+
return path6;
|
|
142237
142237
|
}
|
|
142238
142238
|
};
|
|
142239
142239
|
es_uint8_array_from_base64 = __webpack_require__2(5213);
|
|
@@ -144937,7 +144937,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
144937
144937
|
}
|
|
144938
144938
|
const drawLayer = textLayerData.drawLayer;
|
|
144939
144939
|
let div = textLayerData.selectionDiv;
|
|
144940
|
-
let
|
|
144940
|
+
let path6 = textLayerData.path;
|
|
144941
144941
|
if (!div) {
|
|
144942
144942
|
const clipPathId = `clip_selection_${_DrawLayer.#selectionId++}`;
|
|
144943
144943
|
div = document.createElement("div");
|
|
@@ -144956,18 +144956,18 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
144956
144956
|
const clipPath = _DrawLayer._svgFactory.createElement("clipPath");
|
|
144957
144957
|
clipPath.setAttribute("id", clipPathId);
|
|
144958
144958
|
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
|
144959
|
-
|
|
144960
|
-
clipPath.append(
|
|
144959
|
+
path6 = _DrawLayer._svgFactory.createElement("path");
|
|
144960
|
+
clipPath.append(path6);
|
|
144961
144961
|
svg.append(clipPath);
|
|
144962
144962
|
div.append(svg);
|
|
144963
|
-
textLayerData.path =
|
|
144963
|
+
textLayerData.path = path6;
|
|
144964
144964
|
textLayerData.selectionDiv = div;
|
|
144965
144965
|
}
|
|
144966
144966
|
if (!div.parentNode && drawLayer.#parent) {
|
|
144967
144967
|
drawLayer.#parent.append(div);
|
|
144968
144968
|
this.#selections.add(div);
|
|
144969
144969
|
}
|
|
144970
|
-
|
|
144970
|
+
path6.setAttribute("d", boxes.join(" "));
|
|
144971
144971
|
}
|
|
144972
144972
|
}
|
|
144973
144973
|
static get _svgFactory() {
|
|
@@ -145014,13 +145014,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
145014
145014
|
const root = this.#createSVG();
|
|
145015
145015
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
145016
145016
|
root.append(defs);
|
|
145017
|
-
const
|
|
145018
|
-
defs.append(
|
|
145017
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
145018
|
+
defs.append(path6);
|
|
145019
145019
|
const pathId = `path_${id}`;
|
|
145020
|
-
|
|
145021
|
-
|
|
145020
|
+
path6.setAttribute("id", pathId);
|
|
145021
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
145022
145022
|
if (isPathUpdatable) {
|
|
145023
|
-
this.#toUpdate.set(id,
|
|
145023
|
+
this.#toUpdate.set(id, path6);
|
|
145024
145024
|
}
|
|
145025
145025
|
const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
|
|
145026
145026
|
const use = _DrawLayer._svgFactory.createElement("use");
|
|
@@ -145038,11 +145038,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
145038
145038
|
const root = this.#createSVG();
|
|
145039
145039
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
145040
145040
|
root.append(defs);
|
|
145041
|
-
const
|
|
145042
|
-
defs.append(
|
|
145041
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
145042
|
+
defs.append(path6);
|
|
145043
145043
|
const pathId = `path_${id}`;
|
|
145044
|
-
|
|
145045
|
-
|
|
145044
|
+
path6.setAttribute("id", pathId);
|
|
145045
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
145046
145046
|
let maskId;
|
|
145047
145047
|
if (mustRemoveSelfIntersections) {
|
|
145048
145048
|
const mask = _DrawLayer._svgFactory.createElement("mask");
|
|
@@ -145089,7 +145089,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
145089
145089
|
root,
|
|
145090
145090
|
bbox,
|
|
145091
145091
|
rootClass,
|
|
145092
|
-
path:
|
|
145092
|
+
path: path6
|
|
145093
145093
|
} = properties;
|
|
145094
145094
|
const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
|
|
145095
145095
|
if (!element) {
|
|
@@ -145109,10 +145109,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
145109
145109
|
classList.toggle(className, value);
|
|
145110
145110
|
}
|
|
145111
145111
|
}
|
|
145112
|
-
if (
|
|
145112
|
+
if (path6) {
|
|
145113
145113
|
const defs = element.firstElementChild;
|
|
145114
145114
|
const pathElement = defs.firstElementChild;
|
|
145115
|
-
this.#updateProperties(pathElement,
|
|
145115
|
+
this.#updateProperties(pathElement, path6);
|
|
145116
145116
|
}
|
|
145117
145117
|
}
|
|
145118
145118
|
updateParent(id, layer) {
|
|
@@ -145756,9 +145756,9 @@ function lookupRect(arr, fallback) {
|
|
|
145756
145756
|
function lookupNormalRect(arr, fallback) {
|
|
145757
145757
|
return isNumberArray(arr, 4) ? Util3.normalizeRect(arr) : fallback;
|
|
145758
145758
|
}
|
|
145759
|
-
function parseXFAPath(
|
|
145759
|
+
function parseXFAPath(path6) {
|
|
145760
145760
|
const positionPattern = /(.+)\[(\d+)\]$/;
|
|
145761
|
-
return
|
|
145761
|
+
return path6.split(".").map((component) => {
|
|
145762
145762
|
const m = component.match(positionPattern);
|
|
145763
145763
|
if (m) {
|
|
145764
145764
|
return {
|
|
@@ -148898,8 +148898,8 @@ function compilePatternInfo(ir) {
|
|
|
148898
148898
|
}
|
|
148899
148899
|
return buffer;
|
|
148900
148900
|
}
|
|
148901
|
-
function compileFontPathInfo(
|
|
148902
|
-
return
|
|
148901
|
+
function compileFontPathInfo(path6) {
|
|
148902
|
+
return path6.slice().buffer;
|
|
148903
148903
|
}
|
|
148904
148904
|
function getFloat214(view, offset) {
|
|
148905
148905
|
return view.getInt16(offset) / 16384;
|
|
@@ -151046,7 +151046,7 @@ function getFamilyName(str2) {
|
|
|
151046
151046
|
function generateFont({
|
|
151047
151047
|
alias,
|
|
151048
151048
|
local,
|
|
151049
|
-
path:
|
|
151049
|
+
path: path6,
|
|
151050
151050
|
fallback,
|
|
151051
151051
|
style,
|
|
151052
151052
|
ultimate
|
|
@@ -151064,7 +151064,7 @@ function generateFont({
|
|
|
151064
151064
|
if (alias) {
|
|
151065
151065
|
const substitution = substitutionMap.get(alias);
|
|
151066
151066
|
const aliasAppend = append4 || getStyleToAppend(style);
|
|
151067
|
-
Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !
|
|
151067
|
+
Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path6, aliasAppend));
|
|
151068
151068
|
}
|
|
151069
151069
|
if (style) {
|
|
151070
151070
|
result.style = style;
|
|
@@ -151076,11 +151076,11 @@ function generateFont({
|
|
|
151076
151076
|
const fallbackInfo = substitutionMap.get(fallback);
|
|
151077
151077
|
const {
|
|
151078
151078
|
ultimate: fallbackUltimate
|
|
151079
|
-
} = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !
|
|
151079
|
+
} = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path6, append4);
|
|
151080
151080
|
result.ultimate ||= fallbackUltimate;
|
|
151081
151081
|
}
|
|
151082
|
-
if (usePath &&
|
|
151083
|
-
src.push(`url(${localFontPath}${
|
|
151082
|
+
if (usePath && path6 && localFontPath) {
|
|
151083
|
+
src.push(`url(${localFontPath}${path6})`);
|
|
151084
151084
|
}
|
|
151085
151085
|
return result;
|
|
151086
151086
|
}
|
|
@@ -153509,13 +153509,13 @@ function writeXFADataForAcroform(str2, changes) {
|
|
|
153509
153509
|
continue;
|
|
153510
153510
|
}
|
|
153511
153511
|
const {
|
|
153512
|
-
path:
|
|
153512
|
+
path: path6,
|
|
153513
153513
|
value
|
|
153514
153514
|
} = xfa;
|
|
153515
|
-
if (!
|
|
153515
|
+
if (!path6 || value === null) {
|
|
153516
153516
|
continue;
|
|
153517
153517
|
}
|
|
153518
|
-
const nodePath = parseXFAPath(
|
|
153518
|
+
const nodePath = parseXFAPath(path6);
|
|
153519
153519
|
let node = xml.documentElement.searchNode(nodePath, 0);
|
|
153520
153520
|
if (!node && nodePath.length > 1) {
|
|
153521
153521
|
node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
|
|
@@ -153523,7 +153523,7 @@ function writeXFADataForAcroform(str2, changes) {
|
|
|
153523
153523
|
if (node) {
|
|
153524
153524
|
node.childNodes = Array.isArray(value) ? value.map((val) => new SimpleDOMNode("value", val)) : [new SimpleDOMNode("#text", value)];
|
|
153525
153525
|
} else {
|
|
153526
|
-
warn3(`Node not found for path: ${
|
|
153526
|
+
warn3(`Node not found for path: ${path6}`);
|
|
153527
153527
|
}
|
|
153528
153528
|
}
|
|
153529
153529
|
const buffer = [];
|
|
@@ -155308,7 +155308,7 @@ var init_pdf_worker = __esm({
|
|
|
155308
155308
|
var defineProperty = Object.defineProperty;
|
|
155309
155309
|
var stringSlice = uncurryThis("".slice);
|
|
155310
155310
|
var replace2 = uncurryThis("".replace);
|
|
155311
|
-
var
|
|
155311
|
+
var join15 = uncurryThis([].join);
|
|
155312
155312
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
155313
155313
|
return defineProperty(function() {
|
|
155314
155314
|
}, "length", { value: 8 }).length !== 8;
|
|
@@ -155341,7 +155341,7 @@ var init_pdf_worker = __esm({
|
|
|
155341
155341
|
}
|
|
155342
155342
|
var state = enforceInternalState(value);
|
|
155343
155343
|
if (!hasOwn(state, "source")) {
|
|
155344
|
-
state.source =
|
|
155344
|
+
state.source = join15(TEMPLATE, typeof name18 == "string" ? name18 : "");
|
|
155345
155345
|
}
|
|
155346
155346
|
return value;
|
|
155347
155347
|
};
|
|
@@ -157527,7 +157527,7 @@ var init_pdf_worker = __esm({
|
|
|
157527
157527
|
var anUint8Array = __webpack_require__4(4154);
|
|
157528
157528
|
var notDetached = __webpack_require__4(5169);
|
|
157529
157529
|
var numberToString2 = uncurryThis(1.1.toString);
|
|
157530
|
-
var
|
|
157530
|
+
var join15 = uncurryThis([].join);
|
|
157531
157531
|
var $Array = Array;
|
|
157532
157532
|
var Uint8Array2 = globalThis2.Uint8Array;
|
|
157533
157533
|
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !function() {
|
|
@@ -157548,7 +157548,7 @@ var init_pdf_worker = __esm({
|
|
|
157548
157548
|
var hex = numberToString2(this[i], 16);
|
|
157549
157549
|
result[i] = hex.length === 1 ? "0" + hex : hex;
|
|
157550
157550
|
}
|
|
157551
|
-
return
|
|
157551
|
+
return join15(result, "");
|
|
157552
157552
|
}
|
|
157553
157553
|
});
|
|
157554
157554
|
},
|
|
@@ -175092,7 +175092,7 @@ var init_pdf_worker = __esm({
|
|
|
175092
175092
|
if (this.#compiledGlyphs.has(glyphId) && this.#compiledCharCodes.has(charCode)) {
|
|
175093
175093
|
return null;
|
|
175094
175094
|
}
|
|
175095
|
-
const
|
|
175095
|
+
const path6 = this.#compiledGlyphs.getOrInsertComputed(glyphId, () => {
|
|
175096
175096
|
try {
|
|
175097
175097
|
return this.compileGlyph(this.glyphs[glyphId], glyphId);
|
|
175098
175098
|
} catch (ex) {
|
|
@@ -175100,10 +175100,10 @@ var init_pdf_worker = __esm({
|
|
|
175100
175100
|
}
|
|
175101
175101
|
});
|
|
175102
175102
|
this.#compiledCharCodes.add(charCode);
|
|
175103
|
-
if (
|
|
175104
|
-
throw
|
|
175103
|
+
if (path6 instanceof Error) {
|
|
175104
|
+
throw path6;
|
|
175105
175105
|
}
|
|
175106
|
-
return compileFontPathInfo(
|
|
175106
|
+
return compileFontPathInfo(path6);
|
|
175107
175107
|
}
|
|
175108
175108
|
compileGlyph(code, glyphId) {
|
|
175109
175109
|
if (!code?.length || code[0] === 14) {
|
|
@@ -193325,12 +193325,12 @@ var init_pdf_worker = __esm({
|
|
|
193325
193325
|
get isXFAObjectArray() {
|
|
193326
193326
|
return false;
|
|
193327
193327
|
}
|
|
193328
|
-
createNodes(
|
|
193328
|
+
createNodes(path6) {
|
|
193329
193329
|
let root = this, node = null;
|
|
193330
193330
|
for (const {
|
|
193331
193331
|
name: name18,
|
|
193332
193332
|
index
|
|
193333
|
-
} of
|
|
193333
|
+
} of path6) {
|
|
193334
193334
|
for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {
|
|
193335
193335
|
const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];
|
|
193336
193336
|
node = new XmlObject(nsId, name18);
|
|
@@ -203089,10 +203089,10 @@ var init_pdf_worker = __esm({
|
|
|
203089
203089
|
});
|
|
203090
203090
|
data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
|
|
203091
203091
|
if (fieldValue === void 0 && annotationGlobals.xfaDatasets) {
|
|
203092
|
-
const
|
|
203093
|
-
if (
|
|
203092
|
+
const path6 = this._title.str;
|
|
203093
|
+
if (path6) {
|
|
203094
203094
|
this._hasValueFromXFA = true;
|
|
203095
|
-
data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(
|
|
203095
|
+
data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path6);
|
|
203096
203096
|
}
|
|
203097
203097
|
}
|
|
203098
203098
|
if (fieldValue === void 0 && data.defaultFieldValue !== null) {
|
|
@@ -205872,11 +205872,11 @@ var init_pdf_worker = __esm({
|
|
|
205872
205872
|
this.node = parser.node;
|
|
205873
205873
|
}
|
|
205874
205874
|
}
|
|
205875
|
-
getValue(
|
|
205876
|
-
if (!this.node || !
|
|
205875
|
+
getValue(path6) {
|
|
205876
|
+
if (!this.node || !path6) {
|
|
205877
205877
|
return "";
|
|
205878
205878
|
}
|
|
205879
|
-
const node = this.node.searchNode(parseXFAPath(
|
|
205879
|
+
const node = this.node.searchNode(parseXFAPath(path6), 0);
|
|
205880
205880
|
if (!node) {
|
|
205881
205881
|
return "";
|
|
205882
205882
|
}
|
|
@@ -213610,33 +213610,33 @@ function renderRichText2({
|
|
|
213610
213610
|
container.append(fragment);
|
|
213611
213611
|
}
|
|
213612
213612
|
function makePathFromDrawOPS2(data) {
|
|
213613
|
-
const
|
|
213613
|
+
const path6 = new Path2D();
|
|
213614
213614
|
if (!data) {
|
|
213615
|
-
return
|
|
213615
|
+
return path6;
|
|
213616
213616
|
}
|
|
213617
213617
|
for (let i = 0, ii = data.length; i < ii; ) {
|
|
213618
213618
|
switch (data[i++]) {
|
|
213619
213619
|
case DrawOPS3.moveTo:
|
|
213620
|
-
|
|
213620
|
+
path6.moveTo(data[i++], data[i++]);
|
|
213621
213621
|
break;
|
|
213622
213622
|
case DrawOPS3.lineTo:
|
|
213623
|
-
|
|
213623
|
+
path6.lineTo(data[i++], data[i++]);
|
|
213624
213624
|
break;
|
|
213625
213625
|
case DrawOPS3.curveTo:
|
|
213626
|
-
|
|
213626
|
+
path6.bezierCurveTo(data[i++], data[i++], data[i++], data[i++], data[i++], data[i++]);
|
|
213627
213627
|
break;
|
|
213628
213628
|
case DrawOPS3.quadraticCurveTo:
|
|
213629
|
-
|
|
213629
|
+
path6.quadraticCurveTo(data[i++], data[i++], data[i++], data[i++]);
|
|
213630
213630
|
break;
|
|
213631
213631
|
case DrawOPS3.closePath:
|
|
213632
|
-
|
|
213632
|
+
path6.closePath();
|
|
213633
213633
|
break;
|
|
213634
213634
|
default:
|
|
213635
213635
|
warn4(`Unrecognized drawing path operator: ${data[i - 1]}`);
|
|
213636
213636
|
break;
|
|
213637
213637
|
}
|
|
213638
213638
|
}
|
|
213639
|
-
return
|
|
213639
|
+
return path6;
|
|
213640
213640
|
}
|
|
213641
213641
|
function bindEvents3(obj, element, names) {
|
|
213642
213642
|
for (const name18 of names) {
|
|
@@ -213744,8 +213744,8 @@ function blend2(fg, bg, alpha) {
|
|
|
213744
213744
|
return Math.round(alpha * fg + (1 - alpha) * bg);
|
|
213745
213745
|
}
|
|
213746
213746
|
async function node_utils_fetchData3(url2) {
|
|
213747
|
-
const
|
|
213748
|
-
const data = await
|
|
213747
|
+
const fs5 = process.getBuiltinModule("fs/promises");
|
|
213748
|
+
const data = await fs5.readFile(url2);
|
|
213749
213749
|
return new Uint8Array(data);
|
|
213750
213750
|
}
|
|
213751
213751
|
function convertBlackAndWhiteToRGBA4({
|
|
@@ -214384,11 +214384,11 @@ function network_getArrayBuffer3(val) {
|
|
|
214384
214384
|
return typeof val !== "string" ? val : stringToBytes5(val).buffer;
|
|
214385
214385
|
}
|
|
214386
214386
|
function getReadableStream2(url2, opts = null) {
|
|
214387
|
-
const
|
|
214387
|
+
const fs5 = process.getBuiltinModule("fs");
|
|
214388
214388
|
const {
|
|
214389
214389
|
Readable
|
|
214390
214390
|
} = process.getBuiltinModule("stream");
|
|
214391
|
-
const readStream =
|
|
214391
|
+
const readStream = fs5.createReadStream(url2, opts);
|
|
214392
214392
|
return Readable.toWeb(readStream);
|
|
214393
214393
|
}
|
|
214394
214394
|
function getNetworkStream2(url2) {
|
|
@@ -221863,11 +221863,11 @@ var init_pdf3 = __esm({
|
|
|
221863
221863
|
} catch (ex) {
|
|
221864
221864
|
warn4(`getPathGenerator - ignoring character: "${ex}".`);
|
|
221865
221865
|
}
|
|
221866
|
-
const
|
|
221866
|
+
const path6 = makePathFromDrawOPS2(cmds?.path);
|
|
221867
221867
|
if (!this.fontExtraProperties) {
|
|
221868
221868
|
objs.delete(objId);
|
|
221869
221869
|
}
|
|
221870
|
-
return this.compiledGlyphs[character] =
|
|
221870
|
+
return this.compiledGlyphs[character] = path6;
|
|
221871
221871
|
}
|
|
221872
221872
|
get black() {
|
|
221873
221873
|
return this.#fontData.black;
|
|
@@ -223731,7 +223731,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
223731
223731
|
Util4.singularValueDecompose2dScale(this.baseTransform, scale);
|
|
223732
223732
|
return [matrixScaleX * scale[0], matrixScaleY * scale[1]];
|
|
223733
223733
|
}
|
|
223734
|
-
drawPattern(owner,
|
|
223734
|
+
drawPattern(owner, path6, useEOFill = false, [n, m], opIdx) {
|
|
223735
223735
|
const [x0, y0, x1, y1] = this.bbox;
|
|
223736
223736
|
const dependencyTracker = owner.dependencyTracker;
|
|
223737
223737
|
if (dependencyTracker) {
|
|
@@ -223739,9 +223739,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
223739
223739
|
}
|
|
223740
223740
|
owner.save();
|
|
223741
223741
|
if (useEOFill) {
|
|
223742
|
-
owner.ctx.clip(
|
|
223742
|
+
owner.ctx.clip(path6, "evenodd");
|
|
223743
223743
|
} else {
|
|
223744
|
-
owner.ctx.clip(
|
|
223744
|
+
owner.ctx.clip(path6);
|
|
223745
223745
|
}
|
|
223746
223746
|
owner.ctx.setTransform(...this.patternBaseMatrix);
|
|
223747
223747
|
owner.ctx.translate(n * this.xstep, m * this.ystep);
|
|
@@ -224832,15 +224832,15 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224832
224832
|
if (hasInnerCutout && maskX0 === layerOffsetX && maskY0 === layerOffsetY && maskX1 === layerOffsetX + layerWidth && maskY1 === layerOffsetY + layerHeight) {
|
|
224833
224833
|
return;
|
|
224834
224834
|
}
|
|
224835
|
-
const
|
|
224836
|
-
|
|
224835
|
+
const path6 = new Path2D();
|
|
224836
|
+
path6.rect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
|
224837
224837
|
if (hasInnerCutout) {
|
|
224838
|
-
|
|
224838
|
+
path6.rect(maskX0, maskY0, maskX1 - maskX0, maskY1 - maskY0);
|
|
224839
224839
|
}
|
|
224840
224840
|
layerCtx.save();
|
|
224841
224841
|
layerCtx.globalAlpha = alpha / 255;
|
|
224842
224842
|
layerCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
224843
|
-
layerCtx.clip(
|
|
224843
|
+
layerCtx.clip(path6, "evenodd");
|
|
224844
224844
|
layerCtx.globalCompositeOperation = "destination-in";
|
|
224845
224845
|
layerCtx.fillStyle = "#000000";
|
|
224846
224846
|
layerCtx.fillRect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
|
@@ -224898,21 +224898,21 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224898
224898
|
this._cachedGetSinglePixelWidth = null;
|
|
224899
224899
|
}
|
|
224900
224900
|
constructPath(opIdx, op, data, minMax) {
|
|
224901
|
-
let [
|
|
224901
|
+
let [path6] = data;
|
|
224902
224902
|
if (!minMax) {
|
|
224903
|
-
|
|
224903
|
+
path6 ||= data[0] = new Path2D();
|
|
224904
224904
|
if (op !== OPS4.stroke && op !== OPS4.closeStroke) {
|
|
224905
224905
|
this.current.tilingPatternDims = null;
|
|
224906
224906
|
}
|
|
224907
|
-
this[op](opIdx,
|
|
224907
|
+
this[op](opIdx, path6);
|
|
224908
224908
|
return;
|
|
224909
224909
|
}
|
|
224910
224910
|
if (this.dependencyTracker !== null) {
|
|
224911
224911
|
const outerExtraSize = op === OPS4.stroke ? this.current.lineWidth / 2 : 0;
|
|
224912
224912
|
this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
|
|
224913
224913
|
}
|
|
224914
|
-
if (!(
|
|
224915
|
-
|
|
224914
|
+
if (!(path6 instanceof Path2D)) {
|
|
224915
|
+
path6 = data[0] = makePathFromDrawOPS2(path6);
|
|
224916
224916
|
}
|
|
224917
224917
|
Util4.axialAlignedBoundingBox(minMax, getCurrentTransform3(this.ctx), this.current.minMax);
|
|
224918
224918
|
const tilingDims = this.current.tilingPatternDims;
|
|
@@ -224924,13 +224924,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224924
224924
|
this.current.fillColor.updatePatternDims(clippedBBox, tilingDims);
|
|
224925
224925
|
}
|
|
224926
224926
|
}
|
|
224927
|
-
this[op](opIdx,
|
|
224927
|
+
this[op](opIdx, path6);
|
|
224928
224928
|
this._pathStartIdx = opIdx;
|
|
224929
224929
|
}
|
|
224930
224930
|
closePath(opIdx) {
|
|
224931
224931
|
this.ctx.closePath();
|
|
224932
224932
|
}
|
|
224933
|
-
stroke(opIdx,
|
|
224933
|
+
stroke(opIdx, path6, consumePath = true) {
|
|
224934
224934
|
const started = consumePath && this.#beginKnockoutElement(this.current.strokeAlpha);
|
|
224935
224935
|
const ctx = this.ctx;
|
|
224936
224936
|
const strokeColor = this.current.strokeColor;
|
|
@@ -224942,26 +224942,26 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224942
224942
|
ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse3(ctx), PathType3.STROKE, opIdx);
|
|
224943
224943
|
if (baseTransform) {
|
|
224944
224944
|
const newPath = new Path2D();
|
|
224945
|
-
newPath.addPath(
|
|
224946
|
-
|
|
224945
|
+
newPath.addPath(path6, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
|
224946
|
+
path6 = newPath;
|
|
224947
224947
|
}
|
|
224948
|
-
this.rescaleAndStroke(
|
|
224948
|
+
this.rescaleAndStroke(path6, false);
|
|
224949
224949
|
ctx.restore();
|
|
224950
224950
|
} else {
|
|
224951
|
-
this.rescaleAndStroke(
|
|
224951
|
+
this.rescaleAndStroke(path6, true);
|
|
224952
224952
|
}
|
|
224953
224953
|
}
|
|
224954
224954
|
this.dependencyTracker?.recordDependencies(opIdx, Dependencies2.stroke);
|
|
224955
224955
|
if (consumePath) {
|
|
224956
|
-
this.consumePath(opIdx,
|
|
224956
|
+
this.consumePath(opIdx, path6, this.current.getClippedPathBoundingBox(PathType3.STROKE, getCurrentTransform3(this.ctx)));
|
|
224957
224957
|
}
|
|
224958
224958
|
ctx.globalAlpha = this.current.fillAlpha;
|
|
224959
224959
|
this.#endKnockoutElement(started);
|
|
224960
224960
|
}
|
|
224961
|
-
closeStroke(opIdx,
|
|
224962
|
-
this.stroke(opIdx,
|
|
224961
|
+
closeStroke(opIdx, path6) {
|
|
224962
|
+
this.stroke(opIdx, path6);
|
|
224963
224963
|
}
|
|
224964
|
-
fill(opIdx,
|
|
224964
|
+
fill(opIdx, path6, consumePath = true) {
|
|
224965
224965
|
const started = consumePath && this.#beginKnockoutElement(this.current.fillAlpha);
|
|
224966
224966
|
const ctx = this.ctx;
|
|
224967
224967
|
const fillColor = this.current.fillColor;
|
|
@@ -224973,10 +224973,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224973
224973
|
const dims = this.current.tilingPatternDims;
|
|
224974
224974
|
const tileIdx = dims && fillColor.canSkipPatternCanvas(dims);
|
|
224975
224975
|
if (tileIdx) {
|
|
224976
|
-
fillColor.drawPattern(this,
|
|
224976
|
+
fillColor.drawPattern(this, path6, this.pendingEOFill, tileIdx, opIdx);
|
|
224977
224977
|
this.pendingEOFill = false;
|
|
224978
224978
|
if (consumePath) {
|
|
224979
|
-
this.consumePath(opIdx,
|
|
224979
|
+
this.consumePath(opIdx, path6, intersect2);
|
|
224980
224980
|
}
|
|
224981
224981
|
this.current.tilingPatternDims = null;
|
|
224982
224982
|
this.#endKnockoutElement(started);
|
|
@@ -224988,17 +224988,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
224988
224988
|
ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse3(ctx), PathType3.FILL, opIdx);
|
|
224989
224989
|
if (baseTransform) {
|
|
224990
224990
|
const newPath = new Path2D();
|
|
224991
|
-
newPath.addPath(
|
|
224992
|
-
|
|
224991
|
+
newPath.addPath(path6, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
|
224992
|
+
path6 = newPath;
|
|
224993
224993
|
}
|
|
224994
224994
|
needRestore = true;
|
|
224995
224995
|
}
|
|
224996
224996
|
if (this.contentVisible && intersect2 !== null) {
|
|
224997
224997
|
if (this.pendingEOFill) {
|
|
224998
|
-
ctx.fill(
|
|
224998
|
+
ctx.fill(path6, "evenodd");
|
|
224999
224999
|
this.pendingEOFill = false;
|
|
225000
225000
|
} else {
|
|
225001
|
-
ctx.fill(
|
|
225001
|
+
ctx.fill(path6);
|
|
225002
225002
|
}
|
|
225003
225003
|
}
|
|
225004
225004
|
if (needRestore) {
|
|
@@ -225006,38 +225006,38 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225006
225006
|
this.dependencyTracker?.restore(opIdx);
|
|
225007
225007
|
}
|
|
225008
225008
|
if (consumePath) {
|
|
225009
|
-
this.consumePath(opIdx,
|
|
225009
|
+
this.consumePath(opIdx, path6, intersect2);
|
|
225010
225010
|
}
|
|
225011
225011
|
this.#endKnockoutElement(started);
|
|
225012
225012
|
}
|
|
225013
|
-
eoFill(opIdx,
|
|
225013
|
+
eoFill(opIdx, path6) {
|
|
225014
225014
|
this.pendingEOFill = true;
|
|
225015
|
-
this.fill(opIdx,
|
|
225015
|
+
this.fill(opIdx, path6);
|
|
225016
225016
|
}
|
|
225017
|
-
fillStroke(opIdx,
|
|
225017
|
+
fillStroke(opIdx, path6) {
|
|
225018
225018
|
const started = this.#beginKnockoutElement(Math.min(this.current.fillAlpha, this.current.strokeAlpha));
|
|
225019
|
-
this.fill(opIdx,
|
|
225020
|
-
this.stroke(opIdx,
|
|
225021
|
-
this.consumePath(opIdx,
|
|
225019
|
+
this.fill(opIdx, path6, false);
|
|
225020
|
+
this.stroke(opIdx, path6, false);
|
|
225021
|
+
this.consumePath(opIdx, path6);
|
|
225022
225022
|
this.#endKnockoutElement(started);
|
|
225023
225023
|
}
|
|
225024
|
-
eoFillStroke(opIdx,
|
|
225024
|
+
eoFillStroke(opIdx, path6) {
|
|
225025
225025
|
this.pendingEOFill = true;
|
|
225026
|
-
this.fillStroke(opIdx,
|
|
225026
|
+
this.fillStroke(opIdx, path6);
|
|
225027
225027
|
}
|
|
225028
|
-
closeFillStroke(opIdx,
|
|
225029
|
-
this.fillStroke(opIdx,
|
|
225028
|
+
closeFillStroke(opIdx, path6) {
|
|
225029
|
+
this.fillStroke(opIdx, path6);
|
|
225030
225030
|
}
|
|
225031
|
-
closeEOFillStroke(opIdx,
|
|
225031
|
+
closeEOFillStroke(opIdx, path6) {
|
|
225032
225032
|
this.pendingEOFill = true;
|
|
225033
|
-
this.fillStroke(opIdx,
|
|
225033
|
+
this.fillStroke(opIdx, path6);
|
|
225034
225034
|
}
|
|
225035
|
-
endPath(opIdx,
|
|
225036
|
-
this.consumePath(opIdx,
|
|
225035
|
+
endPath(opIdx, path6) {
|
|
225036
|
+
this.consumePath(opIdx, path6);
|
|
225037
225037
|
}
|
|
225038
|
-
rawFillPath(opIdx,
|
|
225038
|
+
rawFillPath(opIdx, path6) {
|
|
225039
225039
|
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
|
225040
|
-
this.ctx.fill(
|
|
225040
|
+
this.ctx.fill(path6);
|
|
225041
225041
|
this.dependencyTracker?.recordDependencies(opIdx, Dependencies2.rawFillPath).recordOperation(opIdx);
|
|
225042
225042
|
this.#endKnockoutElement(started);
|
|
225043
225043
|
}
|
|
@@ -225076,12 +225076,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225076
225076
|
x,
|
|
225077
225077
|
y,
|
|
225078
225078
|
fontSize,
|
|
225079
|
-
path:
|
|
225079
|
+
path: path6
|
|
225080
225080
|
} of paths) {
|
|
225081
|
-
if (!
|
|
225081
|
+
if (!path6) {
|
|
225082
225082
|
continue;
|
|
225083
225083
|
}
|
|
225084
|
-
newPath.addPath(
|
|
225084
|
+
newPath.addPath(path6, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x, y).scale(fontSize, -fontSize));
|
|
225085
225085
|
}
|
|
225086
225086
|
ctx.clip(newPath);
|
|
225087
225087
|
}
|
|
@@ -225169,9 +225169,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225169
225169
|
this.moveText(opIdx, 0, this.current.leading);
|
|
225170
225170
|
this.dependencyTracker?.recordIncrementalData("moveText", this.dependencyTracker.getSimpleIndex("leading") ?? opIdx);
|
|
225171
225171
|
}
|
|
225172
|
-
#getScaledPath(
|
|
225172
|
+
#getScaledPath(path6, currentTransform, transform2) {
|
|
225173
225173
|
const newPath = new Path2D();
|
|
225174
|
-
newPath.addPath(
|
|
225174
|
+
newPath.addPath(path6, new DOMMatrix(transform2).invertSelf().multiplySelf(currentTransform));
|
|
225175
225175
|
return newPath;
|
|
225176
225176
|
}
|
|
225177
225177
|
paintChar(opIdx, character, x, y, patternFillTransform, patternStrokeTransform) {
|
|
@@ -225184,11 +225184,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225184
225184
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode4.ADD_TO_PATH_FLAG);
|
|
225185
225185
|
const patternFill = current.patternFill && !font.missingFile;
|
|
225186
225186
|
const patternStroke = current.patternStroke && !font.missingFile;
|
|
225187
|
-
let
|
|
225187
|
+
let path6;
|
|
225188
225188
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
225189
|
-
|
|
225189
|
+
path6 = font.getPathGenerator(this.commonObjs, character);
|
|
225190
225190
|
}
|
|
225191
|
-
if (
|
|
225191
|
+
if (path6 && (font.disableFontFace || patternFill || patternStroke)) {
|
|
225192
225192
|
ctx.save();
|
|
225193
225193
|
ctx.translate(x, y);
|
|
225194
225194
|
ctx.scale(fontSize, -fontSize);
|
|
@@ -225198,10 +225198,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225198
225198
|
if (patternFillTransform) {
|
|
225199
225199
|
currentTransform = ctx.getTransform();
|
|
225200
225200
|
ctx.setTransform(...patternFillTransform);
|
|
225201
|
-
const scaledPath = this.#getScaledPath(
|
|
225201
|
+
const scaledPath = this.#getScaledPath(path6, currentTransform, patternFillTransform);
|
|
225202
225202
|
ctx.fill(scaledPath);
|
|
225203
225203
|
} else {
|
|
225204
|
-
ctx.fill(
|
|
225204
|
+
ctx.fill(path6);
|
|
225205
225205
|
}
|
|
225206
225206
|
}
|
|
225207
225207
|
if (fillStrokeMode === TextRenderingMode4.STROKE || fillStrokeMode === TextRenderingMode4.FILL_STROKE) {
|
|
@@ -225218,10 +225218,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225218
225218
|
const transf = Util4.transform([a, b, c, d, 0, 0], invPatternTransform);
|
|
225219
225219
|
Util4.singularValueDecompose2dScale(transf, XY2);
|
|
225220
225220
|
ctx.lineWidth *= Math.max(XY2[0], XY2[1]) / fontSize;
|
|
225221
|
-
ctx.stroke(this.#getScaledPath(
|
|
225221
|
+
ctx.stroke(this.#getScaledPath(path6, currentTransform, patternStrokeTransform));
|
|
225222
225222
|
} else {
|
|
225223
225223
|
ctx.lineWidth /= fontSize;
|
|
225224
|
-
ctx.stroke(
|
|
225224
|
+
ctx.stroke(path6);
|
|
225225
225225
|
}
|
|
225226
225226
|
}
|
|
225227
225227
|
ctx.restore();
|
|
@@ -225244,7 +225244,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225244
225244
|
x,
|
|
225245
225245
|
y,
|
|
225246
225246
|
fontSize,
|
|
225247
|
-
path:
|
|
225247
|
+
path: path6
|
|
225248
225248
|
});
|
|
225249
225249
|
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y);
|
|
225250
225250
|
}
|
|
@@ -225634,9 +225634,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225634
225634
|
const [x0, y0, x1, y1] = group.bbox;
|
|
225635
225635
|
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
225636
225636
|
if (group.matrix) {
|
|
225637
|
-
const
|
|
225638
|
-
|
|
225639
|
-
clip =
|
|
225637
|
+
const path6 = new Path2D();
|
|
225638
|
+
path6.addPath(clip, new DOMMatrix(group.matrix));
|
|
225639
|
+
clip = path6;
|
|
225640
225640
|
}
|
|
225641
225641
|
currentCtx.clip(clip);
|
|
225642
225642
|
}
|
|
@@ -225695,9 +225695,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
225695
225695
|
const [x0, y0, x1, y1] = group.bbox;
|
|
225696
225696
|
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
225697
225697
|
if (group.matrix) {
|
|
225698
|
-
const
|
|
225699
|
-
|
|
225700
|
-
clip =
|
|
225698
|
+
const path6 = new Path2D();
|
|
225699
|
+
path6.addPath(clip, new DOMMatrix(group.matrix));
|
|
225700
|
+
clip = path6;
|
|
225701
225701
|
}
|
|
225702
225702
|
groupCtx.clip(clip);
|
|
225703
225703
|
}
|
|
@@ -226223,7 +226223,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
226223
226223
|
}
|
|
226224
226224
|
endCompat(opIdx) {
|
|
226225
226225
|
}
|
|
226226
|
-
consumePath(opIdx,
|
|
226226
|
+
consumePath(opIdx, path6, clipBox) {
|
|
226227
226227
|
const isEmpty = this.current.isEmptyClip();
|
|
226228
226228
|
if (this.pendingClip) {
|
|
226229
226229
|
this.current.updateClipFromPath();
|
|
@@ -226235,9 +226235,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
226235
226235
|
if (this.pendingClip) {
|
|
226236
226236
|
if (!isEmpty) {
|
|
226237
226237
|
if (this.pendingClip === EO_CLIP3) {
|
|
226238
|
-
ctx.clip(
|
|
226238
|
+
ctx.clip(path6, "evenodd");
|
|
226239
226239
|
} else {
|
|
226240
|
-
ctx.clip(
|
|
226240
|
+
ctx.clip(path6);
|
|
226241
226241
|
}
|
|
226242
226242
|
}
|
|
226243
226243
|
this.pendingClip = null;
|
|
@@ -226310,7 +226310,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
226310
226310
|
}
|
|
226311
226311
|
return this._cachedScaleForStroking;
|
|
226312
226312
|
}
|
|
226313
|
-
rescaleAndStroke(
|
|
226313
|
+
rescaleAndStroke(path6, saveRestore) {
|
|
226314
226314
|
const {
|
|
226315
226315
|
ctx,
|
|
226316
226316
|
current: {
|
|
@@ -226320,7 +226320,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
226320
226320
|
const [scaleX, scaleY] = this.getScaleForStroking();
|
|
226321
226321
|
if (scaleX === scaleY) {
|
|
226322
226322
|
ctx.lineWidth = (lineWidth || 1) * scaleX;
|
|
226323
|
-
ctx.stroke(
|
|
226323
|
+
ctx.stroke(path6);
|
|
226324
226324
|
return;
|
|
226325
226325
|
}
|
|
226326
226326
|
const dashes = ctx.getLineDash();
|
|
@@ -226331,7 +226331,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
226331
226331
|
SCALE_MATRIX2.a = 1 / scaleX;
|
|
226332
226332
|
SCALE_MATRIX2.d = 1 / scaleY;
|
|
226333
226333
|
const newPath = new Path2D();
|
|
226334
|
-
newPath.addPath(
|
|
226334
|
+
newPath.addPath(path6, SCALE_MATRIX2);
|
|
226335
226335
|
if (dashes.length > 0) {
|
|
226336
226336
|
const scale = Math.max(scaleX, scaleY);
|
|
226337
226337
|
ctx.setLineDash(dashes.map((x) => x / scale));
|
|
@@ -227058,8 +227058,8 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
227058
227058
|
url: url2
|
|
227059
227059
|
} = stream._source;
|
|
227060
227060
|
this._isStreamingSupported = !disableStream;
|
|
227061
|
-
const
|
|
227062
|
-
|
|
227061
|
+
const fs5 = process.getBuiltinModule("fs/promises");
|
|
227062
|
+
fs5.lstat(url2).then((stat) => {
|
|
227063
227063
|
const readableStream = getReadableStream2(url2);
|
|
227064
227064
|
this._reader = readableStream.getReader();
|
|
227065
227065
|
const {
|
|
@@ -237472,11 +237472,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
237472
237472
|
};
|
|
237473
237473
|
ContourDrawOutline2 = class extends InkDrawOutline3 {
|
|
237474
237474
|
toSVGPath() {
|
|
237475
|
-
let
|
|
237476
|
-
if (!
|
|
237477
|
-
|
|
237475
|
+
let path6 = super.toSVGPath();
|
|
237476
|
+
if (!path6.endsWith("Z")) {
|
|
237477
|
+
path6 += "Z";
|
|
237478
237478
|
}
|
|
237479
|
-
return
|
|
237479
|
+
return path6;
|
|
237480
237480
|
}
|
|
237481
237481
|
};
|
|
237482
237482
|
BASE_HEADER_LENGTH2 = 8;
|
|
@@ -240178,7 +240178,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240178
240178
|
}
|
|
240179
240179
|
const drawLayer = textLayerData.drawLayer;
|
|
240180
240180
|
let div = textLayerData.selectionDiv;
|
|
240181
|
-
let
|
|
240181
|
+
let path6 = textLayerData.path;
|
|
240182
240182
|
if (!div) {
|
|
240183
240183
|
const clipPathId = `clip_selection_${_DrawLayer.#selectionId++}`;
|
|
240184
240184
|
div = document.createElement("div");
|
|
@@ -240197,18 +240197,18 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240197
240197
|
const clipPath = _DrawLayer._svgFactory.createElement("clipPath");
|
|
240198
240198
|
clipPath.setAttribute("id", clipPathId);
|
|
240199
240199
|
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
|
240200
|
-
|
|
240201
|
-
clipPath.append(
|
|
240200
|
+
path6 = _DrawLayer._svgFactory.createElement("path");
|
|
240201
|
+
clipPath.append(path6);
|
|
240202
240202
|
svg.append(clipPath);
|
|
240203
240203
|
div.append(svg);
|
|
240204
|
-
textLayerData.path =
|
|
240204
|
+
textLayerData.path = path6;
|
|
240205
240205
|
textLayerData.selectionDiv = div;
|
|
240206
240206
|
}
|
|
240207
240207
|
if (!div.parentNode && drawLayer.#parent) {
|
|
240208
240208
|
drawLayer.#parent.append(div);
|
|
240209
240209
|
this.#selections.add(div);
|
|
240210
240210
|
}
|
|
240211
|
-
|
|
240211
|
+
path6.setAttribute("d", boxes.join(" "));
|
|
240212
240212
|
}
|
|
240213
240213
|
}
|
|
240214
240214
|
static get _svgFactory() {
|
|
@@ -240255,13 +240255,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240255
240255
|
const root = this.#createSVG();
|
|
240256
240256
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
240257
240257
|
root.append(defs);
|
|
240258
|
-
const
|
|
240259
|
-
defs.append(
|
|
240258
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
240259
|
+
defs.append(path6);
|
|
240260
240260
|
const pathId = `path_${id}`;
|
|
240261
|
-
|
|
240262
|
-
|
|
240261
|
+
path6.setAttribute("id", pathId);
|
|
240262
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
240263
240263
|
if (isPathUpdatable) {
|
|
240264
|
-
this.#toUpdate.set(id,
|
|
240264
|
+
this.#toUpdate.set(id, path6);
|
|
240265
240265
|
}
|
|
240266
240266
|
const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
|
|
240267
240267
|
const use = _DrawLayer._svgFactory.createElement("use");
|
|
@@ -240279,11 +240279,11 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240279
240279
|
const root = this.#createSVG();
|
|
240280
240280
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
240281
240281
|
root.append(defs);
|
|
240282
|
-
const
|
|
240283
|
-
defs.append(
|
|
240282
|
+
const path6 = _DrawLayer._svgFactory.createElement("path");
|
|
240283
|
+
defs.append(path6);
|
|
240284
240284
|
const pathId = `path_${id}`;
|
|
240285
|
-
|
|
240286
|
-
|
|
240285
|
+
path6.setAttribute("id", pathId);
|
|
240286
|
+
path6.setAttribute("vector-effect", "non-scaling-stroke");
|
|
240287
240287
|
let maskId;
|
|
240288
240288
|
if (mustRemoveSelfIntersections) {
|
|
240289
240289
|
const mask = _DrawLayer._svgFactory.createElement("mask");
|
|
@@ -240330,7 +240330,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240330
240330
|
root,
|
|
240331
240331
|
bbox,
|
|
240332
240332
|
rootClass,
|
|
240333
|
-
path:
|
|
240333
|
+
path: path6
|
|
240334
240334
|
} = properties;
|
|
240335
240335
|
const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
|
|
240336
240336
|
if (!element) {
|
|
@@ -240350,10 +240350,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
240350
240350
|
classList.toggle(className, value);
|
|
240351
240351
|
}
|
|
240352
240352
|
}
|
|
240353
|
-
if (
|
|
240353
|
+
if (path6) {
|
|
240354
240354
|
const defs = element.firstElementChild;
|
|
240355
240355
|
const pathElement = defs.firstElementChild;
|
|
240356
|
-
this.#updateProperties(pathElement,
|
|
240356
|
+
this.#updateProperties(pathElement, path6);
|
|
240357
240357
|
}
|
|
240358
240358
|
}
|
|
240359
240359
|
updateParent(id, layer) {
|
|
@@ -241297,7 +241297,7 @@ var require_PowerPointParser = __commonJS({
|
|
|
241297
241297
|
const slideMastersRegex = /ppt\/slideMasters\/slideMaster\d+\.xml/;
|
|
241298
241298
|
const presentationFileRegex = /ppt\/presentation\.xml/;
|
|
241299
241299
|
const files = await (0, zipUtils_js_1.extractFiles)(buffer, (x) => !!x.match(config2.ignoreNotes ? slidesRegex : allFilesRegex) || !!x.match(corePropsFileRegex) || !!x.match(customPropsFileRegex) || !!x.match(appPropsFileRegex) || !!x.match(slideRelsRegex) || !config2.ignoreComments && (!!x.match(commentsFileRegex) || !!x.match(commentAuthorsRegex)) || !config2.ignoreSlideMasters && !!x.match(slideMastersRegex) || !!x.match(presentationFileRegex) || !!config2.extractAttachments && (!!x.match(mediaFileRegex) || !!x.match(chartFileRegex)), config2.decompressionLimits, config2);
|
|
241300
|
-
(0, zipUtils_js_1.findRequiredPart)(files, (
|
|
241300
|
+
(0, zipUtils_js_1.findRequiredPart)(files, (path6) => !!path6.match(presentationFileRegex), config2, { fileType: "pptx", part: "ppt/presentation.xml" });
|
|
241301
241301
|
if (!files.some((file2) => !!file2.path.match(slidesRegex)))
|
|
241302
241302
|
(0, errorUtils_js_1.logWarning)(types_js_1.OfficeWarningType.NO_SLIDES_FOUND, config2);
|
|
241303
241303
|
const corePropsFile = files.find((f) => f.path.match(corePropsFileRegex));
|
|
@@ -243490,7 +243490,7 @@ var require_WordParser = __commonJS({
|
|
|
243490
243490
|
return Array.from(element.childNodes);
|
|
243491
243491
|
};
|
|
243492
243492
|
const files = await (0, zipUtils_js_1.extractFiles)(buffer, (x) => !!x.match(documentFileRegex) || !!x.match(footnotesFileRegex) || !!x.match(endnotesFileRegex) || !!x.match(numberingFileRegex) || !!x.match(corePropsFileRegex) || !!x.match(customPropsFileRegex) || !!x.match(appPropsFileRegex) || !!x.match(relsFileRegex) || !!x.match(stylesFileRegex) || !config2.ignoreComments && !!x.match(commentsFileRegex) || !config2.ignoreHeadersAndFooters && (!!x.match(headerFileRegex) || !!x.match(footerFileRegex)) || !!config2.extractAttachments && !!x.match(mediaFileRegex), config2.decompressionLimits, config2);
|
|
243493
|
-
(0, zipUtils_js_1.findRequiredPart)(files, (
|
|
243493
|
+
(0, zipUtils_js_1.findRequiredPart)(files, (path6) => !!path6.match(documentFileRegex), config2, { fileType: "docx", part: "word/document.xml" });
|
|
243494
243494
|
const corePropsFile = files.find((f) => f.path.match(corePropsFileRegex));
|
|
243495
243495
|
const metadata = corePropsFile ? (0, xmlUtils_js_1.parseOfficeMetadata)(corePropsFile.content.toString()) : {};
|
|
243496
243496
|
const customPropsFile = files.find((f) => f.path.match(customPropsFileRegex));
|
|
@@ -244445,14 +244445,14 @@ var require_OfficeParser = __commonJS({
|
|
|
244445
244445
|
} else if (typeof file2 === "string") {
|
|
244446
244446
|
filePath = file2;
|
|
244447
244447
|
(0, envUtils_js_1.assertNode)("path-parsing");
|
|
244448
|
-
const
|
|
244449
|
-
if (!
|
|
244448
|
+
const fs5 = await import("fs");
|
|
244449
|
+
if (!fs5.existsSync(file2)) {
|
|
244450
244450
|
throw (0, errorUtils_js_1.getOfficeError)(types_js_1.OfficeErrorType.FILE_DOES_NOT_EXIST, internalConfig, file2);
|
|
244451
244451
|
}
|
|
244452
|
-
if (
|
|
244452
|
+
if (fs5.lstatSync(file2).isDirectory()) {
|
|
244453
244453
|
throw (0, errorUtils_js_1.getOfficeError)(types_js_1.OfficeErrorType.LOCATION_NOT_FOUND, internalConfig, file2);
|
|
244454
244454
|
}
|
|
244455
|
-
buffer =
|
|
244455
|
+
buffer = fs5.readFileSync(file2);
|
|
244456
244456
|
ext = ext || file2.split(".").pop() || "";
|
|
244457
244457
|
} else {
|
|
244458
244458
|
throw (0, errorUtils_js_1.getOfficeError)(types_js_1.OfficeErrorType.INVALID_INPUT, internalConfig);
|
|
@@ -256094,11 +256094,11 @@ var require_pdf_worker = __commonJS({
|
|
|
256094
256094
|
var nameTree = new NameTree2(nameTreeRef, xref);
|
|
256095
256095
|
var names = nameTree.getAll();
|
|
256096
256096
|
for (var name18 in names) {
|
|
256097
|
-
var
|
|
256097
|
+
var fs5 = new FileSpec2(names[name18], xref);
|
|
256098
256098
|
if (!attachments) {
|
|
256099
256099
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
256100
256100
|
}
|
|
256101
|
-
attachments[(0, _util.stringToPDFString)(name18)] =
|
|
256101
|
+
attachments[(0, _util.stringToPDFString)(name18)] = fs5.serializable;
|
|
256102
256102
|
}
|
|
256103
256103
|
}
|
|
256104
256104
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -261398,8 +261398,8 @@ var require_pdf_worker = __commonJS({
|
|
|
261398
261398
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
261399
261399
|
var buildPath = function buildPath2(fontChar) {
|
|
261400
261400
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
261401
|
-
var
|
|
261402
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
261401
|
+
var path6 = font.renderer.getPathJs(fontChar);
|
|
261402
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path6]);
|
|
261403
261403
|
}
|
|
261404
261404
|
};
|
|
261405
261405
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -271128,7 +271128,7 @@ var require_pdf_worker = __commonJS({
|
|
|
271128
271128
|
includes: function includes(searchElement) {
|
|
271129
271129
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
271130
271130
|
},
|
|
271131
|
-
join: function
|
|
271131
|
+
join: function join15(separator) {
|
|
271132
271132
|
return arrayJoin.apply(validate(this), arguments);
|
|
271133
271133
|
},
|
|
271134
271134
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -298348,7 +298348,7 @@ var require_pdf = __commonJS({
|
|
|
298348
298348
|
includes: function includes(searchElement) {
|
|
298349
298349
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
298350
298350
|
},
|
|
298351
|
-
join: function
|
|
298351
|
+
join: function join15(separator) {
|
|
298352
298352
|
return arrayJoin.apply(validate(this), arguments);
|
|
298353
298353
|
},
|
|
298354
298354
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -304355,10 +304355,10 @@ var require_pdf = __commonJS({
|
|
|
304355
304355
|
ctx.save();
|
|
304356
304356
|
ctx.beginPath();
|
|
304357
304357
|
for (var i = 0; i < paths.length; i++) {
|
|
304358
|
-
var
|
|
304359
|
-
ctx.setTransform.apply(ctx,
|
|
304360
|
-
ctx.translate(
|
|
304361
|
-
|
|
304358
|
+
var path6 = paths[i];
|
|
304359
|
+
ctx.setTransform.apply(ctx, path6.transform);
|
|
304360
|
+
ctx.translate(path6.x, path6.y);
|
|
304361
|
+
path6.addToPath(ctx, path6.fontSize);
|
|
304362
304362
|
}
|
|
304363
304363
|
ctx.restore();
|
|
304364
304364
|
ctx.clip();
|
|
@@ -306230,7 +306230,7 @@ var require_pdf = __commonJS({
|
|
|
306230
306230
|
throw new TypeError("Cannot call a class as a function");
|
|
306231
306231
|
}
|
|
306232
306232
|
}
|
|
306233
|
-
var
|
|
306233
|
+
var fs5 = require("fs");
|
|
306234
306234
|
var http = require("http");
|
|
306235
306235
|
var https3 = require("https");
|
|
306236
306236
|
var url2 = require("url");
|
|
@@ -306563,8 +306563,8 @@ var require_pdf = __commonJS({
|
|
|
306563
306563
|
function PDFNodeStreamFsFullReader3(stream) {
|
|
306564
306564
|
_classCallCheck(this, PDFNodeStreamFsFullReader3);
|
|
306565
306565
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader3)).call(this, stream));
|
|
306566
|
-
var
|
|
306567
|
-
|
|
306566
|
+
var path6 = decodeURI(_this7._url.path);
|
|
306567
|
+
fs5.lstat(path6, function(error40, stat) {
|
|
306568
306568
|
if (error40) {
|
|
306569
306569
|
_this7._errored = true;
|
|
306570
306570
|
_this7._reason = error40;
|
|
@@ -306572,7 +306572,7 @@ var require_pdf = __commonJS({
|
|
|
306572
306572
|
return;
|
|
306573
306573
|
}
|
|
306574
306574
|
_this7._contentLength = stat.size;
|
|
306575
|
-
_this7._setReadableStream(
|
|
306575
|
+
_this7._setReadableStream(fs5.createReadStream(path6));
|
|
306576
306576
|
_this7._headersCapability.resolve();
|
|
306577
306577
|
});
|
|
306578
306578
|
return _this7;
|
|
@@ -306584,7 +306584,7 @@ var require_pdf = __commonJS({
|
|
|
306584
306584
|
function PDFNodeStreamFsRangeReader3(stream, start, end) {
|
|
306585
306585
|
_classCallCheck(this, PDFNodeStreamFsRangeReader3);
|
|
306586
306586
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader3)).call(this, stream));
|
|
306587
|
-
_this8._setReadableStream(
|
|
306587
|
+
_this8._setReadableStream(fs5.createReadStream(decodeURI(_this8._url.path), {
|
|
306588
306588
|
start,
|
|
306589
306589
|
end: end - 1
|
|
306590
306590
|
}));
|
|
@@ -318648,11 +318648,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
318648
318648
|
var nameTree = new NameTree2(nameTreeRef, xref);
|
|
318649
318649
|
var names = nameTree.getAll();
|
|
318650
318650
|
for (var name18 in names) {
|
|
318651
|
-
var
|
|
318651
|
+
var fs5 = new FileSpec2(names[name18], xref);
|
|
318652
318652
|
if (!attachments) {
|
|
318653
318653
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
318654
318654
|
}
|
|
318655
|
-
attachments[(0, _util.stringToPDFString)(name18)] =
|
|
318655
|
+
attachments[(0, _util.stringToPDFString)(name18)] = fs5.serializable;
|
|
318656
318656
|
}
|
|
318657
318657
|
}
|
|
318658
318658
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -323952,8 +323952,8 @@ var require_pdf_worker2 = __commonJS({
|
|
|
323952
323952
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
323953
323953
|
var buildPath = function buildPath2(fontChar) {
|
|
323954
323954
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
323955
|
-
var
|
|
323956
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
323955
|
+
var path6 = font.renderer.getPathJs(fontChar);
|
|
323956
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path6]);
|
|
323957
323957
|
}
|
|
323958
323958
|
};
|
|
323959
323959
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -333693,7 +333693,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
333693
333693
|
includes: function includes(searchElement) {
|
|
333694
333694
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
333695
333695
|
},
|
|
333696
|
-
join: function
|
|
333696
|
+
join: function join15(separator) {
|
|
333697
333697
|
return arrayJoin.apply(validate(this), arguments);
|
|
333698
333698
|
},
|
|
333699
333699
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -361019,7 +361019,7 @@ var require_pdf2 = __commonJS({
|
|
|
361019
361019
|
includes: function includes(searchElement) {
|
|
361020
361020
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
361021
361021
|
},
|
|
361022
|
-
join: function
|
|
361022
|
+
join: function join15(separator) {
|
|
361023
361023
|
return arrayJoin.apply(validate(this), arguments);
|
|
361024
361024
|
},
|
|
361025
361025
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -367021,10 +367021,10 @@ var require_pdf2 = __commonJS({
|
|
|
367021
367021
|
ctx.save();
|
|
367022
367022
|
ctx.beginPath();
|
|
367023
367023
|
for (var i = 0; i < paths.length; i++) {
|
|
367024
|
-
var
|
|
367025
|
-
ctx.setTransform.apply(ctx,
|
|
367026
|
-
ctx.translate(
|
|
367027
|
-
|
|
367024
|
+
var path6 = paths[i];
|
|
367025
|
+
ctx.setTransform.apply(ctx, path6.transform);
|
|
367026
|
+
ctx.translate(path6.x, path6.y);
|
|
367027
|
+
path6.addToPath(ctx, path6.fontSize);
|
|
367028
367028
|
}
|
|
367029
367029
|
ctx.restore();
|
|
367030
367030
|
ctx.clip();
|
|
@@ -368412,7 +368412,7 @@ var require_pdf2 = __commonJS({
|
|
|
368412
368412
|
throw new TypeError("Cannot call a class as a function");
|
|
368413
368413
|
}
|
|
368414
368414
|
}
|
|
368415
|
-
var
|
|
368415
|
+
var fs5 = require("fs");
|
|
368416
368416
|
var http = require("http");
|
|
368417
368417
|
var https3 = require("https");
|
|
368418
368418
|
var url2 = require("url");
|
|
@@ -368745,8 +368745,8 @@ var require_pdf2 = __commonJS({
|
|
|
368745
368745
|
function PDFNodeStreamFsFullReader3(stream) {
|
|
368746
368746
|
_classCallCheck(this, PDFNodeStreamFsFullReader3);
|
|
368747
368747
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader3)).call(this, stream));
|
|
368748
|
-
var
|
|
368749
|
-
|
|
368748
|
+
var path6 = decodeURI(_this7._url.path);
|
|
368749
|
+
fs5.lstat(path6, function(error40, stat) {
|
|
368750
368750
|
if (error40) {
|
|
368751
368751
|
_this7._errored = true;
|
|
368752
368752
|
_this7._reason = error40;
|
|
@@ -368754,7 +368754,7 @@ var require_pdf2 = __commonJS({
|
|
|
368754
368754
|
return;
|
|
368755
368755
|
}
|
|
368756
368756
|
_this7._contentLength = stat.size;
|
|
368757
|
-
_this7._setReadableStream(
|
|
368757
|
+
_this7._setReadableStream(fs5.createReadStream(path6));
|
|
368758
368758
|
_this7._headersCapability.resolve();
|
|
368759
368759
|
});
|
|
368760
368760
|
return _this7;
|
|
@@ -368766,7 +368766,7 @@ var require_pdf2 = __commonJS({
|
|
|
368766
368766
|
function PDFNodeStreamFsRangeReader3(stream, start, end) {
|
|
368767
368767
|
_classCallCheck(this, PDFNodeStreamFsRangeReader3);
|
|
368768
368768
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader3)).call(this, stream));
|
|
368769
|
-
_this8._setReadableStream(
|
|
368769
|
+
_this8._setReadableStream(fs5.createReadStream(decodeURI(_this8._url.path), {
|
|
368770
368770
|
start,
|
|
368771
368771
|
end: end - 1
|
|
368772
368772
|
}));
|
|
@@ -386334,8 +386334,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
386334
386334
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
386335
386335
|
var buildPath = function buildPath2(fontChar) {
|
|
386336
386336
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
386337
|
-
var
|
|
386338
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
386337
|
+
var path6 = font.renderer.getPathJs(fontChar);
|
|
386338
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path6]);
|
|
386339
386339
|
}
|
|
386340
386340
|
};
|
|
386341
386341
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -391157,11 +391157,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
391157
391157
|
var nameTree = new NameTree2(nameTreeRef, xref);
|
|
391158
391158
|
var names = nameTree.getAll();
|
|
391159
391159
|
for (var name18 in names) {
|
|
391160
|
-
var
|
|
391160
|
+
var fs5 = new FileSpec2(names[name18], xref);
|
|
391161
391161
|
if (!attachments) {
|
|
391162
391162
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
391163
391163
|
}
|
|
391164
|
-
attachments[(0, _util.stringToPDFString)(name18)] =
|
|
391164
|
+
attachments[(0, _util.stringToPDFString)(name18)] = fs5.serializable;
|
|
391165
391165
|
}
|
|
391166
391166
|
}
|
|
391167
391167
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -420825,10 +420825,10 @@ var require_pdf3 = __commonJS({
|
|
|
420825
420825
|
ctx.save();
|
|
420826
420826
|
ctx.beginPath();
|
|
420827
420827
|
for (var i = 0; i < paths.length; i++) {
|
|
420828
|
-
var
|
|
420829
|
-
ctx.setTransform.apply(ctx,
|
|
420830
|
-
ctx.translate(
|
|
420831
|
-
|
|
420828
|
+
var path6 = paths[i];
|
|
420829
|
+
ctx.setTransform.apply(ctx, path6.transform);
|
|
420830
|
+
ctx.translate(path6.x, path6.y);
|
|
420831
|
+
path6.addToPath(ctx, path6.fontSize);
|
|
420832
420832
|
}
|
|
420833
420833
|
ctx.restore();
|
|
420834
420834
|
ctx.clip();
|
|
@@ -433213,11 +433213,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
433213
433213
|
var nameTree = new NameTree2(nameTreeRef, xref);
|
|
433214
433214
|
var names = nameTree.getAll();
|
|
433215
433215
|
for (var name18 in names) {
|
|
433216
|
-
var
|
|
433216
|
+
var fs5 = new FileSpec2(names[name18], xref);
|
|
433217
433217
|
if (!attachments) {
|
|
433218
433218
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
433219
433219
|
}
|
|
433220
|
-
attachments[(0, _util.stringToPDFString)(name18)] =
|
|
433220
|
+
attachments[(0, _util.stringToPDFString)(name18)] = fs5.serializable;
|
|
433221
433221
|
}
|
|
433222
433222
|
}
|
|
433223
433223
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -446373,8 +446373,8 @@ var require_pdf_worker4 = __commonJS({
|
|
|
446373
446373
|
if (font.data && (isAddToPathSet || this.options.disableFontFace || state.fillColorSpace.name === "Pattern")) {
|
|
446374
446374
|
var buildPath = function buildPath2(fontChar) {
|
|
446375
446375
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
446376
|
-
var
|
|
446377
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
446376
|
+
var path6 = font.renderer.getPathJs(fontChar);
|
|
446377
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path6]);
|
|
446378
446378
|
}
|
|
446379
446379
|
};
|
|
446380
446380
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -478481,10 +478481,10 @@ var require_pdf4 = __commonJS({
|
|
|
478481
478481
|
ctx.save();
|
|
478482
478482
|
ctx.beginPath();
|
|
478483
478483
|
for (var i = 0; i < paths.length; i++) {
|
|
478484
|
-
var
|
|
478485
|
-
ctx.setTransform.apply(ctx,
|
|
478486
|
-
ctx.translate(
|
|
478487
|
-
|
|
478484
|
+
var path6 = paths[i];
|
|
478485
|
+
ctx.setTransform.apply(ctx, path6.transform);
|
|
478486
|
+
ctx.translate(path6.x, path6.y);
|
|
478487
|
+
path6.addToPath(ctx, path6.fontSize);
|
|
478488
478488
|
}
|
|
478489
478489
|
ctx.restore();
|
|
478490
478490
|
ctx.clip();
|
|
@@ -483776,7 +483776,7 @@ var require_pdf4 = __commonJS({
|
|
|
483776
483776
|
throw new TypeError("Cannot call a class as a function");
|
|
483777
483777
|
}
|
|
483778
483778
|
}
|
|
483779
|
-
var
|
|
483779
|
+
var fs5 = require("fs");
|
|
483780
483780
|
var http = require("http");
|
|
483781
483781
|
var https3 = require("https");
|
|
483782
483782
|
var url2 = require("url");
|
|
@@ -484130,11 +484130,11 @@ var require_pdf4 = __commonJS({
|
|
|
484130
484130
|
function PDFNodeStreamFsFullReader3(stream) {
|
|
484131
484131
|
_classCallCheck(this, PDFNodeStreamFsFullReader3);
|
|
484132
484132
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader3)).call(this, stream));
|
|
484133
|
-
var
|
|
484133
|
+
var path6 = decodeURIComponent(_this7._url.path);
|
|
484134
484134
|
if (fileUriRegex.test(_this7._url.href)) {
|
|
484135
|
-
|
|
484135
|
+
path6 = path6.replace(/^\//, "");
|
|
484136
484136
|
}
|
|
484137
|
-
|
|
484137
|
+
fs5.lstat(path6, function(error40, stat) {
|
|
484138
484138
|
if (error40) {
|
|
484139
484139
|
_this7._errored = true;
|
|
484140
484140
|
_this7._reason = error40;
|
|
@@ -484142,7 +484142,7 @@ var require_pdf4 = __commonJS({
|
|
|
484142
484142
|
return;
|
|
484143
484143
|
}
|
|
484144
484144
|
_this7._contentLength = stat.size;
|
|
484145
|
-
_this7._setReadableStream(
|
|
484145
|
+
_this7._setReadableStream(fs5.createReadStream(path6));
|
|
484146
484146
|
_this7._headersCapability.resolve();
|
|
484147
484147
|
});
|
|
484148
484148
|
return _this7;
|
|
@@ -484154,11 +484154,11 @@ var require_pdf4 = __commonJS({
|
|
|
484154
484154
|
function PDFNodeStreamFsRangeReader3(stream, start, end) {
|
|
484155
484155
|
_classCallCheck(this, PDFNodeStreamFsRangeReader3);
|
|
484156
484156
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader3.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader3)).call(this, stream));
|
|
484157
|
-
var
|
|
484157
|
+
var path6 = decodeURIComponent(_this8._url.path);
|
|
484158
484158
|
if (fileUriRegex.test(_this8._url.href)) {
|
|
484159
|
-
|
|
484159
|
+
path6 = path6.replace(/^\//, "");
|
|
484160
484160
|
}
|
|
484161
|
-
_this8._setReadableStream(
|
|
484161
|
+
_this8._setReadableStream(fs5.createReadStream(path6, {
|
|
484162
484162
|
start,
|
|
484163
484163
|
end: end - 1
|
|
484164
484164
|
}));
|
|
@@ -506529,33 +506529,33 @@ var require_URL2 = __commonJS({
|
|
|
506529
506529
|
else
|
|
506530
506530
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
506531
506531
|
}
|
|
506532
|
-
function remove_dot_segments(
|
|
506533
|
-
if (!
|
|
506534
|
-
return
|
|
506532
|
+
function remove_dot_segments(path6) {
|
|
506533
|
+
if (!path6)
|
|
506534
|
+
return path6;
|
|
506535
506535
|
var output = "";
|
|
506536
|
-
while (
|
|
506537
|
-
if (
|
|
506538
|
-
|
|
506536
|
+
while (path6.length > 0) {
|
|
506537
|
+
if (path6 === "." || path6 === "..") {
|
|
506538
|
+
path6 = "";
|
|
506539
506539
|
break;
|
|
506540
506540
|
}
|
|
506541
|
-
var twochars =
|
|
506542
|
-
var threechars =
|
|
506543
|
-
var fourchars =
|
|
506541
|
+
var twochars = path6.substring(0, 2);
|
|
506542
|
+
var threechars = path6.substring(0, 3);
|
|
506543
|
+
var fourchars = path6.substring(0, 4);
|
|
506544
506544
|
if (threechars === "../") {
|
|
506545
|
-
|
|
506545
|
+
path6 = path6.substring(3);
|
|
506546
506546
|
} else if (twochars === "./") {
|
|
506547
|
-
|
|
506547
|
+
path6 = path6.substring(2);
|
|
506548
506548
|
} else if (threechars === "/./") {
|
|
506549
|
-
|
|
506550
|
-
} else if (twochars === "/." &&
|
|
506551
|
-
|
|
506552
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
506553
|
-
|
|
506549
|
+
path6 = "/" + path6.substring(3);
|
|
506550
|
+
} else if (twochars === "/." && path6.length === 2) {
|
|
506551
|
+
path6 = "/";
|
|
506552
|
+
} else if (fourchars === "/../" || threechars === "/.." && path6.length === 3) {
|
|
506553
|
+
path6 = "/" + path6.substring(4);
|
|
506554
506554
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
506555
506555
|
} else {
|
|
506556
|
-
var segment =
|
|
506556
|
+
var segment = path6.match(/(\/?([^\/]*))/)[0];
|
|
506557
506557
|
output += segment;
|
|
506558
|
-
|
|
506558
|
+
path6 = path6.substring(segment.length);
|
|
506559
506559
|
}
|
|
506560
506560
|
}
|
|
506561
506561
|
return output;
|
|
@@ -518748,14 +518748,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
518748
518748
|
} else if (node.nodeType === 1) {
|
|
518749
518749
|
replacement = replacementForNode.call(self2, node);
|
|
518750
518750
|
}
|
|
518751
|
-
return
|
|
518751
|
+
return join15(output, replacement);
|
|
518752
518752
|
}, "");
|
|
518753
518753
|
}
|
|
518754
518754
|
function postProcess(output) {
|
|
518755
518755
|
var self2 = this;
|
|
518756
518756
|
this.rules.forEach(function(rule) {
|
|
518757
518757
|
if (typeof rule.append === "function") {
|
|
518758
|
-
output =
|
|
518758
|
+
output = join15(output, rule.append(self2.options));
|
|
518759
518759
|
}
|
|
518760
518760
|
});
|
|
518761
518761
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -518768,7 +518768,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
518768
518768
|
content = content.trim();
|
|
518769
518769
|
return whitespace2.leading + rule.replacement(content, node, this.options) + whitespace2.trailing;
|
|
518770
518770
|
}
|
|
518771
|
-
function
|
|
518771
|
+
function join15(output, replacement) {
|
|
518772
518772
|
var s1 = trimTrailingNewlines(output);
|
|
518773
518773
|
var s2 = trimLeadingNewlines(replacement);
|
|
518774
518774
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -519309,14 +519309,14 @@ var init_content_source = __esm({
|
|
|
519309
519309
|
this.branch = branch;
|
|
519310
519310
|
this.fetchFn = fetchFn;
|
|
519311
519311
|
}
|
|
519312
|
-
async getFile(
|
|
519313
|
-
return fetchSingleFileContent(
|
|
519312
|
+
async getFile(path6) {
|
|
519313
|
+
return fetchSingleFileContent(path6, this.owner, this.repo, this.branch, this.fetchFn);
|
|
519314
519314
|
}
|
|
519315
|
-
async getImageDataUrl(
|
|
519316
|
-
return fetchImageAsDataUrl(
|
|
519315
|
+
async getImageDataUrl(path6) {
|
|
519316
|
+
return fetchImageAsDataUrl(path6, this.owner, this.repo, this.branch, this.fetchFn);
|
|
519317
519317
|
}
|
|
519318
|
-
getImageFallbackUrl(
|
|
519319
|
-
return cdnUrl(this.owner, this.repo, this.branch,
|
|
519318
|
+
getImageFallbackUrl(path6) {
|
|
519319
|
+
return cdnUrl(this.owner, this.repo, this.branch, path6);
|
|
519320
519320
|
}
|
|
519321
519321
|
};
|
|
519322
519322
|
LOCAL_IMAGE_MIME = {
|
|
@@ -519333,18 +519333,18 @@ var init_content_source = __esm({
|
|
|
519333
519333
|
this.rootDir = rootDir;
|
|
519334
519334
|
this.docs = docs;
|
|
519335
519335
|
}
|
|
519336
|
-
async getFile(
|
|
519337
|
-
return this.docs.get(
|
|
519336
|
+
async getFile(path6) {
|
|
519337
|
+
return this.docs.get(path6) ?? null;
|
|
519338
519338
|
}
|
|
519339
|
-
async getImageDataUrl(
|
|
519339
|
+
async getImageDataUrl(path6, maxBytes = 2e5) {
|
|
519340
519340
|
try {
|
|
519341
|
-
const abs = (0, import_node_path5.join)(this.rootDir,
|
|
519341
|
+
const abs = (0, import_node_path5.join)(this.rootDir, path6);
|
|
519342
519342
|
if (!(0, import_node_fs5.existsSync)(abs))
|
|
519343
519343
|
return null;
|
|
519344
519344
|
const buf = await (0, import_promises2.readFile)(abs);
|
|
519345
519345
|
if (buf.length > maxBytes)
|
|
519346
519346
|
return null;
|
|
519347
|
-
const ext =
|
|
519347
|
+
const ext = path6.split(".").pop()?.toLowerCase() ?? "png";
|
|
519348
519348
|
const mime = LOCAL_IMAGE_MIME[ext] ?? "image/png";
|
|
519349
519349
|
return `data:${mime};base64,${buf.toString("base64")}`;
|
|
519350
519350
|
} catch {
|
|
@@ -519359,8 +519359,8 @@ var init_content_source = __esm({
|
|
|
519359
519359
|
constructor(docs) {
|
|
519360
519360
|
this.docs = docs;
|
|
519361
519361
|
}
|
|
519362
|
-
async getFile(
|
|
519363
|
-
return this.docs.get(
|
|
519362
|
+
async getFile(path6) {
|
|
519363
|
+
return this.docs.get(path6) ?? null;
|
|
519364
519364
|
}
|
|
519365
519365
|
async getImageDataUrl(_path) {
|
|
519366
519366
|
return null;
|
|
@@ -520180,8 +520180,8 @@ function planModelscopeFiles(listing, source) {
|
|
|
520180
520180
|
const exclude = new Set(source.exclude ?? []);
|
|
520181
520181
|
return listing.filter((f) => f.Type !== "tree").filter((f) => !f.Path.endsWith("/")).filter((f) => include ? include.has(f.Path) : !exclude.has(f.Path)).filter((f) => !f.Path.startsWith(".")).map((f) => ({ path: f.Path, bytes: f.Size })).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
520182
520182
|
}
|
|
520183
|
-
function modelscopeFileUrl(repo, revision,
|
|
520184
|
-
return `https://modelscope.cn/models/${repo}/resolve/${revision}/${
|
|
520183
|
+
function modelscopeFileUrl(repo, revision, path6) {
|
|
520184
|
+
return `https://modelscope.cn/models/${repo}/resolve/${revision}/${path6.split("/").map(encodeURIComponent).join("/")}`;
|
|
520185
520185
|
}
|
|
520186
520186
|
function filterMissingFiles(plan, existing) {
|
|
520187
520187
|
return plan.filter((p) => existing.get(p.path) !== p.bytes);
|
|
@@ -524669,7 +524669,7 @@ async function writeBufferToAssets(buffer, courseId, destFilename) {
|
|
|
524669
524669
|
return destFilename;
|
|
524670
524670
|
}
|
|
524671
524671
|
function persistAssetRecord(db, input) {
|
|
524672
|
-
const id = (0,
|
|
524672
|
+
const id = (0, import_node_crypto16.randomUUID)();
|
|
524673
524673
|
const mimeType = input.mimeType ?? inferMime(input.filename);
|
|
524674
524674
|
db.insert(nodeAssets).values({
|
|
524675
524675
|
id,
|
|
@@ -524720,7 +524720,7 @@ async function deleteCourseAssetsFiles(courseId) {
|
|
|
524720
524720
|
const { rm } = await import("node:fs/promises");
|
|
524721
524721
|
await rm(dir, { recursive: true, force: true });
|
|
524722
524722
|
}
|
|
524723
|
-
var import_node_path13, import_promises6, import_node_fs12,
|
|
524723
|
+
var import_node_path13, import_promises6, import_node_fs12, import_node_crypto16, EXT_MIME, assetsRootOverride;
|
|
524724
524724
|
var init_asset_service = __esm({
|
|
524725
524725
|
"src/main/services/asset-service.ts"() {
|
|
524726
524726
|
"use strict";
|
|
@@ -524730,7 +524730,7 @@ var init_asset_service = __esm({
|
|
|
524730
524730
|
init_drizzle_orm();
|
|
524731
524731
|
init_schema();
|
|
524732
524732
|
init_schema();
|
|
524733
|
-
|
|
524733
|
+
import_node_crypto16 = require("node:crypto");
|
|
524734
524734
|
init_db2();
|
|
524735
524735
|
EXT_MIME = {
|
|
524736
524736
|
png: "image/png",
|
|
@@ -525415,7 +525415,7 @@ async function persistTranslations(db, courseId, locale, translations) {
|
|
|
525415
525415
|
db.update(contentNodeTranslations).set({ title: transTitle, content: transEntry.content }).where(eq(contentNodeTranslations.id, existing.id)).run();
|
|
525416
525416
|
} else {
|
|
525417
525417
|
db.insert(contentNodeTranslations).values({
|
|
525418
|
-
id: (0,
|
|
525418
|
+
id: (0, import_node_crypto24.randomUUID)(),
|
|
525419
525419
|
nodeId: node.id,
|
|
525420
525420
|
courseId,
|
|
525421
525421
|
locale,
|
|
@@ -525434,9 +525434,9 @@ async function alignTranslationsWithLlm(db, unmatchedNodes, translations) {
|
|
|
525434
525434
|
title: n.title,
|
|
525435
525435
|
preview: (n.content ?? "").slice(0, 100).replace(/\n/g, " ").trim()
|
|
525436
525436
|
}));
|
|
525437
|
-
const transList = Array.from(translations.entries()).map(([
|
|
525437
|
+
const transList = Array.from(translations.entries()).map(([path6, t]) => {
|
|
525438
525438
|
const headings = (t.content.match(/^#{1,3}\s+(.+)$/gm) || []).map((h) => h.replace(/^#{1,3}\s+/, "").trim()).slice(0, 5);
|
|
525439
|
-
return { path:
|
|
525439
|
+
return { path: path6, title: t.title, headings };
|
|
525440
525440
|
});
|
|
525441
525441
|
const prompt = `\u4F60\u662F\u4E00\u4E2A\u7FFB\u8BD1\u5BF9\u9F50\u4E13\u5BB6\u3002\u4E0B\u9762\u662F\u8BFE\u7A0B\u7684\u539F\u59CB\u8BFE\u65F6\u5217\u8868\u548C\u7FFB\u8BD1\u6587\u4EF6\u5217\u8868\u3002
|
|
525442
525442
|
\u8BF7\u5224\u65AD\u6BCF\u4E2A\u539F\u59CB\u8BFE\u65F6\u5BF9\u5E94\u54EA\u4E2A\u7FFB\u8BD1\u6587\u4EF6\uFF08\u901A\u8FC7\u6807\u9898\u548C\u5185\u5BB9\u7684\u8BED\u4E49\u76F8\u4F3C\u5EA6\uFF09\u3002
|
|
@@ -525495,11 +525495,11 @@ function getCourseTitleTranslations(db, courseId, locale) {
|
|
|
525495
525495
|
).all();
|
|
525496
525496
|
return new Map(rows.map((r) => [r.nodeId, r.title]));
|
|
525497
525497
|
}
|
|
525498
|
-
var
|
|
525498
|
+
var import_node_crypto24;
|
|
525499
525499
|
var init_translation_service = __esm({
|
|
525500
525500
|
"src/main/services/translation-service.ts"() {
|
|
525501
525501
|
"use strict";
|
|
525502
|
-
|
|
525502
|
+
import_node_crypto24 = require("node:crypto");
|
|
525503
525503
|
init_drizzle_orm();
|
|
525504
525504
|
init_dist6();
|
|
525505
525505
|
init_schema();
|
|
@@ -525517,7 +525517,7 @@ var import_node_http = require("node:http");
|
|
|
525517
525517
|
var import_node_https3 = require("node:https");
|
|
525518
525518
|
var import_node_fs14 = require("node:fs");
|
|
525519
525519
|
var import_node_path16 = require("node:path");
|
|
525520
|
-
var
|
|
525520
|
+
var import_node_crypto26 = require("node:crypto");
|
|
525521
525521
|
|
|
525522
525522
|
// node_modules/ws/wrapper.mjs
|
|
525523
525523
|
var import_stream = __toESM(require_stream(), 1);
|
|
@@ -525807,15 +525807,15 @@ function defaultDshStatePath() {
|
|
|
525807
525807
|
return (0, import_node_path2.join)(process.env.DSH_HOME ?? (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".dsh"), "lookatstudy-plugin", "state.json");
|
|
525808
525808
|
}
|
|
525809
525809
|
function detectDshStateFile() {
|
|
525810
|
-
const
|
|
525811
|
-
if (!(0, import_node_fs2.existsSync)(
|
|
525810
|
+
const path6 = defaultDshStatePath();
|
|
525811
|
+
if (!(0, import_node_fs2.existsSync)(path6))
|
|
525812
525812
|
return { found: false, path: null, version: null };
|
|
525813
525813
|
try {
|
|
525814
|
-
const raw = JSON.parse((0, import_node_fs2.readFileSync)(
|
|
525814
|
+
const raw = JSON.parse((0, import_node_fs2.readFileSync)(path6, "utf8"));
|
|
525815
525815
|
const version6 = typeof raw?.version === "number" ? raw.version : null;
|
|
525816
|
-
return { found: true, path:
|
|
525816
|
+
return { found: true, path: path6, version: version6 };
|
|
525817
525817
|
} catch {
|
|
525818
|
-
return { found: true, path:
|
|
525818
|
+
return { found: true, path: path6, version: null };
|
|
525819
525819
|
}
|
|
525820
525820
|
}
|
|
525821
525821
|
function settingOf(db, key2) {
|
|
@@ -526153,10 +526153,10 @@ function importDshStateFromText(db, text3, dbFilePath, now2 = /* @__PURE__ */ ne
|
|
|
526153
526153
|
};
|
|
526154
526154
|
}
|
|
526155
526155
|
}
|
|
526156
|
-
function importDshStateFromPath(db,
|
|
526156
|
+
function importDshStateFromPath(db, path6, dbFilePath, now2) {
|
|
526157
526157
|
let text3;
|
|
526158
526158
|
try {
|
|
526159
|
-
text3 = (0, import_node_fs2.readFileSync)(
|
|
526159
|
+
text3 = (0, import_node_fs2.readFileSync)(path6, "utf8");
|
|
526160
526160
|
} catch (e) {
|
|
526161
526161
|
return { ...baseResult(), error: `\u8BFB\u53D6\u5931\u8D25:${e instanceof Error ? e.message : String(e)}` };
|
|
526162
526162
|
}
|
|
@@ -526192,7 +526192,7 @@ function baseResult() {
|
|
|
526192
526192
|
// src/main/ipc/index.ts
|
|
526193
526193
|
init_schema();
|
|
526194
526194
|
init_drizzle_orm();
|
|
526195
|
-
var
|
|
526195
|
+
var import_node_crypto25 = require("node:crypto");
|
|
526196
526196
|
|
|
526197
526197
|
// src/main/services/import-plan-store.ts
|
|
526198
526198
|
var import_node_fs3 = require("node:fs");
|
|
@@ -526881,9 +526881,9 @@ function routeImportUrl(raw) {
|
|
|
526881
526881
|
};
|
|
526882
526882
|
}
|
|
526883
526883
|
}
|
|
526884
|
-
const
|
|
526884
|
+
const path6 = parsed.pathname;
|
|
526885
526885
|
if (host === "bilibili.com" || host === "b23.tv") {
|
|
526886
|
-
if (/(BV[a-zA-Z0-9]+|av\d+)/i.test(
|
|
526886
|
+
if (/(BV[a-zA-Z0-9]+|av\d+)/i.test(path6) || host === "b23.tv" || path6.startsWith("/video/")) {
|
|
526887
526887
|
return { kind: "video", source: "bilibili", url: parsed.toString() };
|
|
526888
526888
|
}
|
|
526889
526889
|
}
|
|
@@ -526891,7 +526891,7 @@ function routeImportUrl(raw) {
|
|
|
526891
526891
|
return { kind: "video", source: "ytdlp", url: parsed.toString() };
|
|
526892
526892
|
}
|
|
526893
526893
|
if (host === "youtube.com" || host === "youtu.be" || host === "m.youtube.com") {
|
|
526894
|
-
if (host === "youtu.be" ||
|
|
526894
|
+
if (host === "youtu.be" || path6 === "/watch" || path6.startsWith("/shorts/") || path6.startsWith("/live/")) {
|
|
526895
526895
|
return { kind: "video", source: "ytdlp", url: parsed.toString() };
|
|
526896
526896
|
}
|
|
526897
526897
|
}
|
|
@@ -527636,14 +527636,14 @@ async function runSmartImport(spec, deps) {
|
|
|
527636
527636
|
repoName = gh.repo;
|
|
527637
527637
|
send(`\u2713 README ${readmeMd.length} \u5B57 \xB7 ${fileList.length} \u4E2A\u8BFE\u7A0B\u6587\u4EF6`);
|
|
527638
527638
|
} else if (spec.kind === "folder" || spec.kind === "plan" && spec.plan.kind === "folder" && spec.plan.folder) {
|
|
527639
|
-
const
|
|
527640
|
-
if (!(0, import_node_fs9.existsSync)(
|
|
527639
|
+
const path6 = spec.kind === "folder" ? spec.path : spec.plan.folder.absPath;
|
|
527640
|
+
if (!(0, import_node_fs9.existsSync)(path6)) {
|
|
527641
527641
|
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");
|
|
527642
527642
|
}
|
|
527643
|
-
folderPath =
|
|
527643
|
+
folderPath = path6;
|
|
527644
527644
|
send("\u6B63\u5728\u626B\u63CF\u6587\u4EF6\u5939\u2026");
|
|
527645
527645
|
const mathVisionOn = readSettingsMap(db)["flag_math_vision"] === "true";
|
|
527646
|
-
const inv = await buildLocalInventory(
|
|
527646
|
+
const inv = await buildLocalInventory(path6, (n) => {
|
|
527647
527647
|
if (n % 20 === 0)
|
|
527648
527648
|
send(`\u5DF2\u626B\u63CF ${n} \u4E2A\u6587\u4EF6\u2026`);
|
|
527649
527649
|
}, {
|
|
@@ -527663,7 +527663,7 @@ async function runSmartImport(spec, deps) {
|
|
|
527663
527663
|
fullTree = inv.fullTree;
|
|
527664
527664
|
branch = "";
|
|
527665
527665
|
repoUrl = null;
|
|
527666
|
-
repoName =
|
|
527666
|
+
repoName = path6.split(/[\\/]/).pop() ?? "local-course";
|
|
527667
527667
|
standaloneImages = inv.standaloneImages.map((img) => ({ path: img.path, alt: img.altText }));
|
|
527668
527668
|
localTranslationLangs = inv.translationLangs.map((code) => ({ code, name: code }));
|
|
527669
527669
|
} else if (spec.kind === "url" || spec.kind === "text" || spec.kind === "epub" || spec.kind === "audio" || spec.kind === "video" || spec.kind === "plan" && (spec.plan.kind === "url" || spec.plan.kind === "text" || spec.plan.kind === "epub" || spec.plan.kind === "audio" || spec.plan.kind === "video")) {
|
|
@@ -527803,8 +527803,8 @@ async function runSmartImport(spec, deps) {
|
|
|
527803
527803
|
if (entries3.length === 0)
|
|
527804
527804
|
throw new Error("\u6CA1\u6709\u89E3\u6790\u51FA\u53EF\u5BFC\u5165\u7684\u5185\u5BB9");
|
|
527805
527805
|
docsMap = new Map(entries3);
|
|
527806
|
-
fileList = docsToDiscoveredFiles(entries3.map(([
|
|
527807
|
-
fullTree = entries3.map(([
|
|
527806
|
+
fileList = docsToDiscoveredFiles(entries3.map(([path6]) => ({ path: path6 })));
|
|
527807
|
+
fullTree = entries3.map(([path6]) => path6);
|
|
527808
527808
|
branch = "";
|
|
527809
527809
|
if (!textSha && spec.kind === "plan" && spec.plan.kind === "text" && spec.plan.text)
|
|
527810
527810
|
textSha = spec.plan.text.sha1;
|
|
@@ -527963,10 +527963,10 @@ ${(entries3[0]?.[1] ?? "").slice(0, 2e3)}`;
|
|
|
527963
527963
|
);
|
|
527964
527964
|
} else {
|
|
527965
527965
|
outlines = /* @__PURE__ */ new Map();
|
|
527966
|
-
for (const
|
|
527967
|
-
const content = docsMap.get(
|
|
527966
|
+
for (const path6 of allFiles) {
|
|
527967
|
+
const content = docsMap.get(path6);
|
|
527968
527968
|
if (content)
|
|
527969
|
-
outlines.set(
|
|
527969
|
+
outlines.set(path6, extractOutlineWithCharCounts(content, path6));
|
|
527970
527970
|
}
|
|
527971
527971
|
}
|
|
527972
527972
|
plan.outlines = Object.fromEntries(outlines);
|
|
@@ -553878,6 +553878,844 @@ init_speech_engine();
|
|
|
553878
553878
|
init_asr_service();
|
|
553879
553879
|
init_custom_provider_service();
|
|
553880
553880
|
|
|
553881
|
+
// src/main/services/companion-pack-service.ts
|
|
553882
|
+
init_llm_client();
|
|
553883
|
+
init_import_llm_service();
|
|
553884
|
+
var fs4 = __toESM(require("node:fs"));
|
|
553885
|
+
var path5 = __toESM(require("node:path"));
|
|
553886
|
+
var import_node_crypto14 = require("node:crypto");
|
|
553887
|
+
init_drizzle_orm();
|
|
553888
|
+
init_schema();
|
|
553889
|
+
|
|
553890
|
+
// shared/companion-cut.ts
|
|
553891
|
+
var MAX_PIXELS = 24e6;
|
|
553892
|
+
function extractParts(img, fm, classify) {
|
|
553893
|
+
const { main: main2 } = fm;
|
|
553894
|
+
const out = [];
|
|
553895
|
+
for (const name18 of ["head", "body", "armL", "armR"]) {
|
|
553896
|
+
let minX = Infinity, minY = Infinity, maxX = -1, maxY = -1, count2 = 0;
|
|
553897
|
+
for (let y = main2.y; y < main2.y + main2.h; y++) {
|
|
553898
|
+
for (let x = main2.x; x < main2.x + main2.w; x++) {
|
|
553899
|
+
if (classify(x, y) !== name18)
|
|
553900
|
+
continue;
|
|
553901
|
+
count2++;
|
|
553902
|
+
if (x < minX)
|
|
553903
|
+
minX = x;
|
|
553904
|
+
if (x > maxX)
|
|
553905
|
+
maxX = x;
|
|
553906
|
+
if (y < minY)
|
|
553907
|
+
minY = y;
|
|
553908
|
+
if (y > maxY)
|
|
553909
|
+
maxY = y;
|
|
553910
|
+
}
|
|
553911
|
+
}
|
|
553912
|
+
if (count2 === 0)
|
|
553913
|
+
continue;
|
|
553914
|
+
const w = maxX - minX + 1;
|
|
553915
|
+
const h = maxY - minY + 1;
|
|
553916
|
+
const rgba = new Uint8ClampedArray(w * h * 4);
|
|
553917
|
+
for (let y = 0; y < h; y++) {
|
|
553918
|
+
for (let x = 0; x < w; x++) {
|
|
553919
|
+
if (classify(minX + x, minY + y) !== name18)
|
|
553920
|
+
continue;
|
|
553921
|
+
const sp = ((minY + y) * img.width + (minX + x)) * 4;
|
|
553922
|
+
const q = (y * w + x) * 4;
|
|
553923
|
+
rgba[q] = img.data[sp];
|
|
553924
|
+
rgba[q + 1] = img.data[sp + 1];
|
|
553925
|
+
rgba[q + 2] = img.data[sp + 2];
|
|
553926
|
+
rgba[q + 3] = img.data[sp + 3];
|
|
553927
|
+
}
|
|
553928
|
+
}
|
|
553929
|
+
out.push({ name: name18, box: { x: minX, y: minY, w, h }, rgba });
|
|
553930
|
+
}
|
|
553931
|
+
return out;
|
|
553932
|
+
}
|
|
553933
|
+
function keyFigure(img, opts) {
|
|
553934
|
+
const { width: W, height: H, data } = img;
|
|
553935
|
+
if (!Number.isInteger(W) || !Number.isInteger(H) || W <= 0 || H <= 0) {
|
|
553936
|
+
throw new Error("CUT_BAD_SIZE");
|
|
553937
|
+
}
|
|
553938
|
+
if (W * H > MAX_PIXELS)
|
|
553939
|
+
throw new Error("CUT_TOO_LARGE");
|
|
553940
|
+
const corner = (x, y) => (y * W + x) * 4 + 3;
|
|
553941
|
+
const cornerOpaque = data[corner(0, 0)] > 128 && data[corner(W - 1, 0)] > 128 && data[corner(0, H - 1)] > 128 && data[corner(W - 1, H - 1)] > 128;
|
|
553942
|
+
const mode = cornerOpaque ? "green" : "alpha";
|
|
553943
|
+
const mask = new Uint8Array(W * H);
|
|
553944
|
+
for (let i = 0, p = 0; i < mask.length; i++, p += 4) {
|
|
553945
|
+
if (mode === "green") {
|
|
553946
|
+
const r = data[p];
|
|
553947
|
+
const g = data[p + 1];
|
|
553948
|
+
const b = data[p + 2];
|
|
553949
|
+
mask[i] = g > r + 20 && g > b + 20 ? 0 : 1;
|
|
553950
|
+
} else {
|
|
553951
|
+
mask[i] = data[p + 3] > 128 ? 1 : 0;
|
|
553952
|
+
}
|
|
553953
|
+
}
|
|
553954
|
+
const comp = new Int32Array(W * H).fill(-1);
|
|
553955
|
+
const stack = new Int32Array(W * H);
|
|
553956
|
+
const boxes = [];
|
|
553957
|
+
for (let s = 0; s < W * H; s++) {
|
|
553958
|
+
if (!mask[s] || comp[s] >= 0)
|
|
553959
|
+
continue;
|
|
553960
|
+
let sp = 0;
|
|
553961
|
+
stack[sp++] = s;
|
|
553962
|
+
comp[s] = boxes.length;
|
|
553963
|
+
let minX = W, maxX = 0, minY = H, maxY = 0, area = 0;
|
|
553964
|
+
while (sp > 0) {
|
|
553965
|
+
const cur = stack[--sp];
|
|
553966
|
+
const cx = cur % W;
|
|
553967
|
+
const cy = (cur - cx) / W;
|
|
553968
|
+
area++;
|
|
553969
|
+
if (cx < minX)
|
|
553970
|
+
minX = cx;
|
|
553971
|
+
if (cx > maxX)
|
|
553972
|
+
maxX = cx;
|
|
553973
|
+
if (cy < minY)
|
|
553974
|
+
minY = cy;
|
|
553975
|
+
if (cy > maxY)
|
|
553976
|
+
maxY = cy;
|
|
553977
|
+
if (cx > 0 && mask[cur - 1] && comp[cur - 1] < 0) {
|
|
553978
|
+
comp[cur - 1] = boxes.length;
|
|
553979
|
+
stack[sp++] = cur - 1;
|
|
553980
|
+
}
|
|
553981
|
+
if (cx < W - 1 && mask[cur + 1] && comp[cur + 1] < 0) {
|
|
553982
|
+
comp[cur + 1] = boxes.length;
|
|
553983
|
+
stack[sp++] = cur + 1;
|
|
553984
|
+
}
|
|
553985
|
+
if (cy > 0 && mask[cur - W] && comp[cur - W] < 0) {
|
|
553986
|
+
comp[cur - W] = boxes.length;
|
|
553987
|
+
stack[sp++] = cur - W;
|
|
553988
|
+
}
|
|
553989
|
+
if (cy < H - 1 && mask[cur + W] && comp[cur + W] < 0) {
|
|
553990
|
+
comp[cur + W] = boxes.length;
|
|
553991
|
+
stack[sp++] = cur + W;
|
|
553992
|
+
}
|
|
553993
|
+
}
|
|
553994
|
+
boxes.push({ area, box: { x: minX, y: minY, w: maxX - minX + 1, h: maxY - minY + 1 } });
|
|
553995
|
+
}
|
|
553996
|
+
if (boxes.length === 0)
|
|
553997
|
+
throw new Error("CUT_EMPTY");
|
|
553998
|
+
boxes.sort((a, b) => b.area - a.area);
|
|
553999
|
+
const main2 = boxes[0].box;
|
|
554000
|
+
const minBlobRatio = opts?.minBlobRatio ?? 0.05;
|
|
554001
|
+
const significant = boxes.filter((b) => b.area >= boxes[0].area * minBlobRatio).length;
|
|
554002
|
+
return { mode, width: W, height: H, mask, main: main2, significantComponents: significant };
|
|
554003
|
+
}
|
|
554004
|
+
function composeKeyedPreview(img, fm) {
|
|
554005
|
+
const out = new Uint8ClampedArray(fm.width * fm.height * 4);
|
|
554006
|
+
for (let i = 0; i < fm.mask.length; i++) {
|
|
554007
|
+
const p = i * 4;
|
|
554008
|
+
if (fm.mask[i]) {
|
|
554009
|
+
out[p] = img.data[p];
|
|
554010
|
+
out[p + 1] = img.data[p + 1];
|
|
554011
|
+
out[p + 2] = img.data[p + 2];
|
|
554012
|
+
out[p + 3] = img.data[p + 3];
|
|
554013
|
+
} else {
|
|
554014
|
+
out[p] = 47;
|
|
554015
|
+
out[p + 1] = 47;
|
|
554016
|
+
out[p + 2] = 54;
|
|
554017
|
+
out[p + 3] = 255;
|
|
554018
|
+
}
|
|
554019
|
+
}
|
|
554020
|
+
return { width: fm.width, height: fm.height, data: out };
|
|
554021
|
+
}
|
|
554022
|
+
function locatePrompt(W, H) {
|
|
554023
|
+
return [
|
|
554024
|
+
`\u4F60\u662F\u7EB8\u5076\u52A8\u753B\u7684\u90E8\u4EF6\u5207\u5206\u5E08\u3002\u6DF1\u7070\u8272\u80CC\u666F\u4E0A\u662F\u521A\u62A0\u597D\u7684Q\u7248\u89D2\u8272\u7ACB\u7ED8(\u753B\u5E03 ${W}x${H} \u50CF\u7D20)\u3002`,
|
|
554025
|
+
`\u8BF7\u5728\u89D2\u8272\u8EAB\u4E0A\u753B\u51FA\u628A\u8EAB\u4F53\u5206\u5F00\u7684\u5207\u5206\u7EBF\u3002\u53EA\u8F93\u51FA\u4E00\u4E2A JSON \u5BF9\u8C61,\u683C\u5F0F:`,
|
|
554026
|
+
`{"cuts": {"headBody": [[x,y],...], "armLeft": [[x,y],...] \u6216 null, "armRight": [[x,y],...] \u6216 null}}`,
|
|
554027
|
+
`headBody:\u6CBF\u5934\u90E8\u6700\u5E95\u7F18(\u542B\u5934\u53D1/\u8033\u6735/\u5934\u9970/\u515C\u5E3D\u7684\u8F6E\u5ED3,\u4E0D\u662F\u8863\u9886\u53E3)\u4ECE\u89D2\u8272\u5DE6\u4FA7\u7684\u7070\u8272\u80CC\u666F\u51FA\u53D1,`,
|
|
554028
|
+
` \u7ECF\u8FC7\u4E0B\u5DF4,\u5230\u8FBE\u53F3\u4FA7\u80CC\u666F\u7ED3\u675F,\u53D6 12~24 \u4E2A\u70B9(\u70B9\u8D8A\u5BC6\u7EBF\u8D8A\u8D34\u5408\u5F27\u7EBF)\u3002`,
|
|
554029
|
+
`armLeft/armRight:\u628A\u6574\u6761\u624B\u81C2\u8FDE\u540C\u8896\u5B50\u4ECE\u8EAF\u5E72\u4E0A\u5207\u4E0B\u6765,\u624B\u81C2\u4EE5\u80A9\u4E3A\u8F74\u8F6C\u52A8,\u6240\u4EE5\u5207\u7EBF\u8981\u8D70\u80A9\u7F1D:`,
|
|
554030
|
+
` \u4ECE\u80A9\u90E8\u4E0A\u65B9\u7684\u7070\u8272\u80CC\u666F\u51FA\u53D1,\u6CBF\u80A9\u5173\u8282\u7684\u7F1D\u7EBF\u5411\u4E0B\u5207\u5230\u814B\u7A9D(\u624B\u81C2\u4E0E\u8EAF\u5E72\u4EA4\u754C\u7684\u6700\u51F9\u5904);`,
|
|
554031
|
+
` \u814B\u7A9D\u4EE5\u4E0B\u624B\u81C2\u82E5\u5DF2\u4E0E\u8EAF\u5E72\u5206\u79BB,\u7EBF\u5C31\u5728\u814B\u7A9D\u5904\u7684\u80CC\u666F\u91CC\u7ED3\u675F;\u82E5\u624B\u81C2\u4E0E\u8EAF\u5E72\u4ECD\u6709\u9ECF\u8FDE`,
|
|
554032
|
+
` (\u5982\u957F\u8896\u8D34\u7740\u8EAB\u4F53),\u6CBF\u9ECF\u8FDE\u5E26\u7EE7\u7EED\u5411\u4E0B\u5207,\u76F4\u5230\u628A\u624B\u81C2\u5B8C\u5168\u5206\u5F00\u3001\u5230\u8FBE\u80CC\u666F\u4E3A\u6B62\u3002`,
|
|
554033
|
+
` \u6574\u6761\u8896\u5B50(\u77ED\u8896/\u957F\u8896)\u90FD\u5F52\u624B\u81C2;\u56FE\u4E0A\u770B\u4E0D\u89C1\u7F1D\u65F6(\u5982\u540C\u8272\u5E03\u6599\u9ECF\u8FDE),\u6309\u89E3\u5256\u4F4D\u7F6E\u76F4\u5207\u3002`,
|
|
554034
|
+
` armLeft=\u753B\u9762\u5DE6\u4FA7\u7684\u624B\u81C2(\u89C2\u5BDF\u8005\u89C6\u89D2)\u3002\u624B\u81C2\u6839\u672C\u4E0D\u5B58\u5728\u65F6\u8BE5\u81C2\u7ED9 null\u3002`,
|
|
554035
|
+
`\u6CE8\u610F:\u6BCF\u6761\u7EBF\u7684\u7EC8\u70B9\u5FC5\u987B\u660E\u786E\u843D\u5728\u7070\u8272\u80CC\u666F\u4E0A\u624D\u505C;\u82E5\u814B\u7A9D\u5904\u6CA1\u6709\u80CC\u666F,\u5C31\u6CBF\u624B\u81C2\u4E0E\u8EAF\u5E72\u7684\u9ECF\u8FDE\u5E26\u7EE7\u7EED\u5411\u4E0B\u8D70\u5230\u6700\u8FD1\u7684\u80CC\u666F\u3002`,
|
|
554036
|
+
`\u6240\u6709\u5750\u6807\u7528 0~1 \u5C0F\u6570(\u76F8\u5BF9\u539F\u56FE\u5BBD\u9AD8),\u70B9\u6309\u7EBF\u7684\u8D70\u5411\u987A\u5E8F\u6392\u5217\u3002`,
|
|
554037
|
+
`\u6BCF\u6761\u7EBF\u7684\u8D77\u70B9\u548C\u7EC8\u70B9\u90FD\u5FC5\u987B\u5728\u6CA1\u6709\u50CF\u7D20\u7684\u7070\u8272\u80CC\u666F\u4E0A\u3002\u4E0D\u8981\u8F93\u51FA\u5176\u4ED6\u6587\u5B57\u3002`
|
|
554038
|
+
].join("\n");
|
|
554039
|
+
}
|
|
554040
|
+
function parseCutsJson(raw, width, height) {
|
|
554041
|
+
const s = raw.replace(/```(?:json)?/gi, "");
|
|
554042
|
+
const start = s.indexOf("{");
|
|
554043
|
+
const end = s.lastIndexOf("}");
|
|
554044
|
+
if (start < 0 || end <= start)
|
|
554045
|
+
return null;
|
|
554046
|
+
let obj;
|
|
554047
|
+
try {
|
|
554048
|
+
obj = JSON.parse(s.slice(start, end + 1));
|
|
554049
|
+
} catch {
|
|
554050
|
+
return null;
|
|
554051
|
+
}
|
|
554052
|
+
const cutsRaw = typeof obj.cuts === "object" && obj.cuts !== null ? obj.cuts : obj;
|
|
554053
|
+
const normKey = (k) => k.toLowerCase().replace(/[^a-z]/g, "");
|
|
554054
|
+
const out = { headBody: null, armLeft: null, armRight: null };
|
|
554055
|
+
for (const [k, v] of Object.entries(cutsRaw)) {
|
|
554056
|
+
const poly = readPoly(v, width, height);
|
|
554057
|
+
if (!poly)
|
|
554058
|
+
continue;
|
|
554059
|
+
const n = normKey(k);
|
|
554060
|
+
if (n === "headbody" || n === "head" || n === "neck")
|
|
554061
|
+
out.headBody ??= poly;
|
|
554062
|
+
else if (n === "armleft" || n === "leftarm" || n === "arml")
|
|
554063
|
+
out.armLeft ??= poly;
|
|
554064
|
+
else if (n === "armright" || n === "rightarm" || n === "armr")
|
|
554065
|
+
out.armRight ??= poly;
|
|
554066
|
+
}
|
|
554067
|
+
return out;
|
|
554068
|
+
}
|
|
554069
|
+
function readPoly(v, width, height) {
|
|
554070
|
+
if (!Array.isArray(v) || v.length < 2)
|
|
554071
|
+
return null;
|
|
554072
|
+
const pts = [];
|
|
554073
|
+
for (const p of v) {
|
|
554074
|
+
let px;
|
|
554075
|
+
let py;
|
|
554076
|
+
if (Array.isArray(p) && p.length >= 2) {
|
|
554077
|
+
px = Number(p[0]);
|
|
554078
|
+
py = Number(p[1]);
|
|
554079
|
+
} else if (typeof p === "object" && p !== null) {
|
|
554080
|
+
const o = p;
|
|
554081
|
+
px = Number(o.x);
|
|
554082
|
+
py = Number(o.y);
|
|
554083
|
+
} else {
|
|
554084
|
+
continue;
|
|
554085
|
+
}
|
|
554086
|
+
if (!Number.isFinite(px) || !Number.isFinite(py))
|
|
554087
|
+
continue;
|
|
554088
|
+
pts.push({ x: px, y: py });
|
|
554089
|
+
}
|
|
554090
|
+
if (pts.length < 2)
|
|
554091
|
+
return null;
|
|
554092
|
+
const fractional = pts.every((p) => p.x <= 1.0001 && p.y <= 1.0001);
|
|
554093
|
+
return pts.map((p) => ({
|
|
554094
|
+
x: Math.round(fractional ? p.x * width : p.x),
|
|
554095
|
+
y: Math.round(fractional ? p.y * height : p.y)
|
|
554096
|
+
}));
|
|
554097
|
+
}
|
|
554098
|
+
var inBounds = (fm, x, y) => x >= 0 && y >= 0 && x < fm.width && y < fm.height;
|
|
554099
|
+
var maskAt = (fm, x, y) => inBounds(fm, x, y) ? fm.mask[y * fm.width + x] : 0;
|
|
554100
|
+
function walkPolyline(poly, visit) {
|
|
554101
|
+
for (let i = 1; i < poly.length; i++) {
|
|
554102
|
+
const a = poly[i - 1];
|
|
554103
|
+
const b = poly[i];
|
|
554104
|
+
const steps = Math.max(Math.abs(b.x - a.x), Math.abs(b.y - a.y), 1);
|
|
554105
|
+
for (let s = 1; s <= steps; s++) {
|
|
554106
|
+
visit(Math.round(a.x + (b.x - a.x) * s / steps), Math.round(a.y + (b.y - a.y) * s / steps));
|
|
554107
|
+
}
|
|
554108
|
+
}
|
|
554109
|
+
}
|
|
554110
|
+
function wallOnMaskCount(poly, fm) {
|
|
554111
|
+
let n = 0;
|
|
554112
|
+
walkPolyline(poly, (x, y) => {
|
|
554113
|
+
if (maskAt(fm, x, y) === 1)
|
|
554114
|
+
n++;
|
|
554115
|
+
});
|
|
554116
|
+
return n;
|
|
554117
|
+
}
|
|
554118
|
+
function segsCross(a1, a2, b1, b22) {
|
|
554119
|
+
const d = (p, q, r) => (q.x - p.x) * (r.y - p.y) - (q.y - p.y) * (r.x - p.x);
|
|
554120
|
+
const d1 = d(b1, b22, a1);
|
|
554121
|
+
const d2 = d(b1, b22, a2);
|
|
554122
|
+
const d3 = d(a1, a2, b1);
|
|
554123
|
+
const d4 = d(a1, a2, b22);
|
|
554124
|
+
return (d1 > 0 && d2 < 0 || d1 < 0 && d2 > 0) && (d3 > 0 && d4 < 0 || d3 < 0 && d4 > 0);
|
|
554125
|
+
}
|
|
554126
|
+
function polysCross(a, b) {
|
|
554127
|
+
for (let i = 1; i < a.length; i++) {
|
|
554128
|
+
for (let j = 1; j < b.length; j++) {
|
|
554129
|
+
if (segsCross(a[i - 1], a[i], b[j - 1], b[j]))
|
|
554130
|
+
return true;
|
|
554131
|
+
}
|
|
554132
|
+
}
|
|
554133
|
+
return false;
|
|
554134
|
+
}
|
|
554135
|
+
function extendEndpoint(p, toward, fm) {
|
|
554136
|
+
if (maskAt(fm, p.x, p.y) === 0)
|
|
554137
|
+
return [p];
|
|
554138
|
+
let dx = p.x - toward.x;
|
|
554139
|
+
let dy = p.y - toward.y;
|
|
554140
|
+
const len = Math.hypot(dx, dy);
|
|
554141
|
+
if (len < 1e-6) {
|
|
554142
|
+
dx = 1;
|
|
554143
|
+
dy = 0;
|
|
554144
|
+
} else {
|
|
554145
|
+
dx /= len;
|
|
554146
|
+
dy /= len;
|
|
554147
|
+
}
|
|
554148
|
+
const radius = Math.max(4, Math.round(Math.hypot(fm.width, fm.height) * 0.04));
|
|
554149
|
+
for (const forwardOnly of [true, false]) {
|
|
554150
|
+
for (let r = 1; r <= radius; r++) {
|
|
554151
|
+
for (let a = 0; a < 16; a++) {
|
|
554152
|
+
const ang = a * Math.PI / 8;
|
|
554153
|
+
const qx = Math.round(p.x + Math.cos(ang) * r);
|
|
554154
|
+
const qy = Math.round(p.y + Math.sin(ang) * r);
|
|
554155
|
+
if (inBounds(fm, qx, qy) && fm.mask[qy * fm.width + qx] !== 0)
|
|
554156
|
+
continue;
|
|
554157
|
+
if (!forwardOnly || dx * (qx - p.x) + dy * (qy - p.y) >= 0)
|
|
554158
|
+
return [{ x: qx, y: qy }];
|
|
554159
|
+
}
|
|
554160
|
+
}
|
|
554161
|
+
}
|
|
554162
|
+
return [];
|
|
554163
|
+
}
|
|
554164
|
+
function validateCurve(poly, fm) {
|
|
554165
|
+
const start = extendEndpoint(poly[0], poly[1], fm);
|
|
554166
|
+
const end = extendEndpoint(poly[poly.length - 1], poly[poly.length - 2], fm);
|
|
554167
|
+
if (start.length === 0 || end.length === 0)
|
|
554168
|
+
return null;
|
|
554169
|
+
const fixed = [...start, ...poly.slice(1, -1), ...end];
|
|
554170
|
+
return wallOnMaskCount(fixed, fm) >= 3 ? fixed : null;
|
|
554171
|
+
}
|
|
554172
|
+
function planCutCurves(fm, cuts) {
|
|
554173
|
+
if (!cuts.headBody)
|
|
554174
|
+
return null;
|
|
554175
|
+
const headBody = validateCurve(cuts.headBody, fm);
|
|
554176
|
+
if (!headBody)
|
|
554177
|
+
return null;
|
|
554178
|
+
const fixArm = (poly) => {
|
|
554179
|
+
if (!poly)
|
|
554180
|
+
return null;
|
|
554181
|
+
const fixed = validateCurve(poly, fm);
|
|
554182
|
+
return fixed ?? null;
|
|
554183
|
+
};
|
|
554184
|
+
const armLeft = fixArm(cuts.armLeft);
|
|
554185
|
+
const armRight = fixArm(cuts.armRight);
|
|
554186
|
+
if (armLeft && armRight && polysCross(armLeft, armRight)) {
|
|
554187
|
+
return { headBody, armLeft, armRight: null };
|
|
554188
|
+
}
|
|
554189
|
+
return { headBody, armLeft, armRight };
|
|
554190
|
+
}
|
|
554191
|
+
function snapCurvesToEdges(img, fm, plan) {
|
|
554192
|
+
const R = Math.max(12, Math.round(Math.min(fm.width, fm.height) * 0.02));
|
|
554193
|
+
const WIN = 2;
|
|
554194
|
+
const THRESH = 120;
|
|
554195
|
+
const sample = (x, y) => {
|
|
554196
|
+
if (x < 0 || y < 0 || x >= fm.width || y >= fm.height || !fm.mask[y * fm.width + x])
|
|
554197
|
+
return [47, 47, 54];
|
|
554198
|
+
const p = (y * img.width + x) * 4;
|
|
554199
|
+
return [img.data[p], img.data[p + 1], img.data[p + 2]];
|
|
554200
|
+
};
|
|
554201
|
+
const windowDiff = (x, y, nx, ny) => {
|
|
554202
|
+
let ar = 0, ag = 0, ab = 0, br = 0, bg = 0, bb = 0;
|
|
554203
|
+
for (let k = -1; k <= 1; k++) {
|
|
554204
|
+
const tx = -ny * k;
|
|
554205
|
+
const ty = nx * k;
|
|
554206
|
+
const a = sample(Math.round(x + nx * WIN + tx), Math.round(y + ny * WIN + ty));
|
|
554207
|
+
const b = sample(Math.round(x - nx * WIN + tx), Math.round(y - ny * WIN + ty));
|
|
554208
|
+
ar += a[0];
|
|
554209
|
+
ag += a[1];
|
|
554210
|
+
ab += a[2];
|
|
554211
|
+
br += b[0];
|
|
554212
|
+
bg += b[1];
|
|
554213
|
+
bb += b[2];
|
|
554214
|
+
}
|
|
554215
|
+
return Math.abs(ar - br) + Math.abs(ag - bg) + Math.abs(ab - bb);
|
|
554216
|
+
};
|
|
554217
|
+
const snapPoint = (prev, pt, next) => {
|
|
554218
|
+
let tx = next.x - prev.x;
|
|
554219
|
+
let ty = next.y - prev.y;
|
|
554220
|
+
const tl = Math.hypot(tx, ty);
|
|
554221
|
+
if (tl < 1e-6)
|
|
554222
|
+
return pt;
|
|
554223
|
+
tx /= tl;
|
|
554224
|
+
ty /= tl;
|
|
554225
|
+
const nx = -ty;
|
|
554226
|
+
const ny = tx;
|
|
554227
|
+
for (let t = 0; t <= R; t++) {
|
|
554228
|
+
const sides = t === 0 ? [0] : [t, -t];
|
|
554229
|
+
for (const s of sides) {
|
|
554230
|
+
const qx = pt.x + nx * s;
|
|
554231
|
+
const qy = pt.y + ny * s;
|
|
554232
|
+
if (windowDiff(qx, qy, nx, ny) >= THRESH) {
|
|
554233
|
+
return { x: Math.round(qx), y: Math.round(qy) };
|
|
554234
|
+
}
|
|
554235
|
+
}
|
|
554236
|
+
}
|
|
554237
|
+
return pt;
|
|
554238
|
+
};
|
|
554239
|
+
const snapPoly = (poly) => {
|
|
554240
|
+
if (poly.length < 3)
|
|
554241
|
+
return poly;
|
|
554242
|
+
const out = [poly[0]];
|
|
554243
|
+
for (let i = 1; i < poly.length - 1; i++)
|
|
554244
|
+
out.push(snapPoint(poly[i - 1], poly[i], poly[i + 1]));
|
|
554245
|
+
out.push(poly[poly.length - 1]);
|
|
554246
|
+
return out;
|
|
554247
|
+
};
|
|
554248
|
+
return {
|
|
554249
|
+
headBody: snapPoly(plan.headBody),
|
|
554250
|
+
armLeft: plan.armLeft ? snapPoly(plan.armLeft) : null,
|
|
554251
|
+
armRight: plan.armRight ? snapPoly(plan.armRight) : null
|
|
554252
|
+
};
|
|
554253
|
+
}
|
|
554254
|
+
function partitionByCurves(img, fm, plan) {
|
|
554255
|
+
const { width: W, mask, main: main2 } = fm;
|
|
554256
|
+
const barrier = new Uint8Array(W * fm.height);
|
|
554257
|
+
const paint = (x, y) => {
|
|
554258
|
+
if (x >= 0 && y >= 0 && x < W && y < fm.height)
|
|
554259
|
+
barrier[y * W + x] = 1;
|
|
554260
|
+
};
|
|
554261
|
+
walkPolyline(plan.headBody, paint);
|
|
554262
|
+
if (plan.armLeft)
|
|
554263
|
+
walkPolyline(plan.armLeft, paint);
|
|
554264
|
+
if (plan.armRight)
|
|
554265
|
+
walkPolyline(plan.armRight, paint);
|
|
554266
|
+
const region = new Int32Array(W * fm.height).fill(-1);
|
|
554267
|
+
const areas = [];
|
|
554268
|
+
const sumX = [];
|
|
554269
|
+
const sumY = [];
|
|
554270
|
+
const stack = new Int32Array(main2.w * main2.h);
|
|
554271
|
+
let figArea = 0;
|
|
554272
|
+
for (let y = main2.y; y < main2.y + main2.h; y++) {
|
|
554273
|
+
for (let x = main2.x; x < main2.x + main2.w; x++) {
|
|
554274
|
+
const s = y * W + x;
|
|
554275
|
+
if (mask[s])
|
|
554276
|
+
figArea++;
|
|
554277
|
+
if (!mask[s] || barrier[s] || region[s] >= 0)
|
|
554278
|
+
continue;
|
|
554279
|
+
const id = areas.length;
|
|
554280
|
+
region[s] = id;
|
|
554281
|
+
let sp = 0;
|
|
554282
|
+
stack[sp++] = s;
|
|
554283
|
+
let area = 0;
|
|
554284
|
+
let sx = 0;
|
|
554285
|
+
let sy = 0;
|
|
554286
|
+
while (sp > 0) {
|
|
554287
|
+
const cur = stack[--sp];
|
|
554288
|
+
const cx = cur % W;
|
|
554289
|
+
const cy = (cur - cx) / W;
|
|
554290
|
+
area++;
|
|
554291
|
+
sx += cx;
|
|
554292
|
+
sy += cy;
|
|
554293
|
+
const tryPush = (n) => {
|
|
554294
|
+
if (mask[n] && !barrier[n] && region[n] < 0) {
|
|
554295
|
+
region[n] = id;
|
|
554296
|
+
stack[sp++] = n;
|
|
554297
|
+
}
|
|
554298
|
+
};
|
|
554299
|
+
if (cx > main2.x)
|
|
554300
|
+
tryPush(cur - 1);
|
|
554301
|
+
if (cx < main2.x + main2.w - 1)
|
|
554302
|
+
tryPush(cur + 1);
|
|
554303
|
+
if (cy > main2.y)
|
|
554304
|
+
tryPush(cur - W);
|
|
554305
|
+
if (cy < main2.y + main2.h - 1)
|
|
554306
|
+
tryPush(cur + W);
|
|
554307
|
+
}
|
|
554308
|
+
areas.push(area);
|
|
554309
|
+
sumX.push(sx);
|
|
554310
|
+
sumY.push(sy);
|
|
554311
|
+
}
|
|
554312
|
+
}
|
|
554313
|
+
if (areas.length === 0 || figArea === 0)
|
|
554314
|
+
return [];
|
|
554315
|
+
const regionAtExtreme = (fromTop) => {
|
|
554316
|
+
for (let y = fromTop ? main2.y : main2.y + main2.h - 1; fromTop ? y < main2.y + main2.h : y >= main2.y; fromTop ? y++ : y--) {
|
|
554317
|
+
for (let x = main2.x; x < main2.x + main2.w; x++) {
|
|
554318
|
+
const s = y * W + x;
|
|
554319
|
+
if (mask[s] && !barrier[s] && region[s] >= 0)
|
|
554320
|
+
return region[s];
|
|
554321
|
+
}
|
|
554322
|
+
}
|
|
554323
|
+
return -1;
|
|
554324
|
+
};
|
|
554325
|
+
const headR = regionAtExtreme(true);
|
|
554326
|
+
const bodyR = regionAtExtreme(false);
|
|
554327
|
+
if (headR < 0 || bodyR < 0 || headR === bodyR)
|
|
554328
|
+
return [];
|
|
554329
|
+
const minArea = figArea * 0.04;
|
|
554330
|
+
if (areas[headR] < minArea || areas[bodyR] < minArea)
|
|
554331
|
+
return [];
|
|
554332
|
+
const labelOf = /* @__PURE__ */ new Map();
|
|
554333
|
+
labelOf.set(headR, "head");
|
|
554334
|
+
labelOf.set(bodyR, "body");
|
|
554335
|
+
const extras = [];
|
|
554336
|
+
for (let id = 0; id < areas.length; id++) {
|
|
554337
|
+
if (id === headR || id === bodyR)
|
|
554338
|
+
continue;
|
|
554339
|
+
if (areas[id] < minArea)
|
|
554340
|
+
continue;
|
|
554341
|
+
extras.push({ id, cx: sumX[id] / areas[id] });
|
|
554342
|
+
}
|
|
554343
|
+
if (extras.length > 2)
|
|
554344
|
+
return [];
|
|
554345
|
+
const bodyCx = sumX[bodyR] / areas[bodyR];
|
|
554346
|
+
extras.sort((a, b) => a.cx - b.cx);
|
|
554347
|
+
if (extras.length === 1) {
|
|
554348
|
+
labelOf.set(extras[0].id, extras[0].cx < bodyCx ? "armL" : "armR");
|
|
554349
|
+
} else if (extras.length === 2) {
|
|
554350
|
+
labelOf.set(extras[0].id, "armL");
|
|
554351
|
+
labelOf.set(extras[1].id, "armR");
|
|
554352
|
+
}
|
|
554353
|
+
return extractParts(img, fm, (x, y) => labelOf.get(region[y * W + x]) ?? null);
|
|
554354
|
+
}
|
|
554355
|
+
function boxBlurU8(a, W, H, r) {
|
|
554356
|
+
const tmp = new Uint8Array(W * H);
|
|
554357
|
+
const out = new Uint8Array(W * H);
|
|
554358
|
+
const win = 2 * r + 1;
|
|
554359
|
+
for (let y = 0; y < H; y++) {
|
|
554360
|
+
let sum2 = 0;
|
|
554361
|
+
for (let k = -r; k <= r; k++)
|
|
554362
|
+
sum2 += a[y * W + Math.min(W - 1, Math.max(0, k))];
|
|
554363
|
+
for (let x = 0; x < W; x++) {
|
|
554364
|
+
tmp[y * W + x] = Math.round(sum2 / win);
|
|
554365
|
+
sum2 += a[y * W + Math.min(W - 1, x + r + 1)] - a[y * W + Math.max(0, x - r)];
|
|
554366
|
+
}
|
|
554367
|
+
}
|
|
554368
|
+
for (let x = 0; x < W; x++) {
|
|
554369
|
+
let sum2 = 0;
|
|
554370
|
+
for (let k = -r; k <= r; k++)
|
|
554371
|
+
sum2 += tmp[Math.min(H - 1, Math.max(0, k)) * W + x];
|
|
554372
|
+
for (let y = 0; y < H; y++) {
|
|
554373
|
+
out[y * W + x] = Math.round(sum2 / win);
|
|
554374
|
+
sum2 += tmp[Math.min(H - 1, y + r + 1) * W + x] - tmp[Math.max(0, y - r) * W + x];
|
|
554375
|
+
}
|
|
554376
|
+
}
|
|
554377
|
+
return out;
|
|
554378
|
+
}
|
|
554379
|
+
function addWhiteOutline(img, radius = Math.max(3, Math.round(Math.min(img.width, img.height) * 8e-3))) {
|
|
554380
|
+
const { width: W, height: H, data } = img;
|
|
554381
|
+
const raw = new Uint8Array(W * H);
|
|
554382
|
+
for (let i = 0; i < W * H; i++)
|
|
554383
|
+
raw[i] = data[i * 4 + 3];
|
|
554384
|
+
const smooth = boxBlurU8(raw, W, H, 2);
|
|
554385
|
+
const a = new Uint8Array(W * H);
|
|
554386
|
+
for (let i = 0; i < W * H; i++)
|
|
554387
|
+
a[i] = smooth[i] >= 108 ? 1 : 0;
|
|
554388
|
+
const dil1 = new Uint8Array(W * H);
|
|
554389
|
+
for (let y = 0; y < H; y++) {
|
|
554390
|
+
for (let x = 0; x < W; x++) {
|
|
554391
|
+
let v = 0;
|
|
554392
|
+
for (let k = -radius; k <= radius && !v; k++) {
|
|
554393
|
+
const xx = x + k;
|
|
554394
|
+
if (xx >= 0 && xx < W && a[y * W + xx])
|
|
554395
|
+
v = 1;
|
|
554396
|
+
}
|
|
554397
|
+
dil1[y * W + x] = v;
|
|
554398
|
+
}
|
|
554399
|
+
}
|
|
554400
|
+
const dil = new Uint8Array(W * H);
|
|
554401
|
+
for (let x = 0; x < W; x++) {
|
|
554402
|
+
for (let y = 0; y < H; y++) {
|
|
554403
|
+
let v = 0;
|
|
554404
|
+
for (let k = -radius; k <= radius && !v; k++) {
|
|
554405
|
+
const yy = y + k;
|
|
554406
|
+
if (yy >= 0 && yy < H && dil1[yy * W + x])
|
|
554407
|
+
v = 1;
|
|
554408
|
+
}
|
|
554409
|
+
dil[y * W + x] = v;
|
|
554410
|
+
}
|
|
554411
|
+
}
|
|
554412
|
+
const out = new Uint8ClampedArray(W * H * 4);
|
|
554413
|
+
for (let i = 0; i < W * H; i++) {
|
|
554414
|
+
const p = i * 4;
|
|
554415
|
+
if (a[i]) {
|
|
554416
|
+
out[p] = data[p];
|
|
554417
|
+
out[p + 1] = data[p + 1];
|
|
554418
|
+
out[p + 2] = data[p + 2];
|
|
554419
|
+
out[p + 3] = data[p + 3];
|
|
554420
|
+
} else if (dil[i]) {
|
|
554421
|
+
out[p] = 255;
|
|
554422
|
+
out[p + 1] = 255;
|
|
554423
|
+
out[p + 2] = 255;
|
|
554424
|
+
out[p + 3] = 255;
|
|
554425
|
+
}
|
|
554426
|
+
}
|
|
554427
|
+
return { width: W, height: H, data: out };
|
|
554428
|
+
}
|
|
554429
|
+
function routeCut(img, opts = {}) {
|
|
554430
|
+
let fm;
|
|
554431
|
+
try {
|
|
554432
|
+
fm = keyFigure(img);
|
|
554433
|
+
} catch {
|
|
554434
|
+
return { route: "l1", parts: [], failure: "TOO_FEW_PARTS", debug: { accepted: { headBody: false, armLeft: false, armRight: false } } };
|
|
554435
|
+
}
|
|
554436
|
+
const none = { headBody: false, armLeft: false, armRight: false };
|
|
554437
|
+
if (!opts.cuts?.headBody) {
|
|
554438
|
+
return { route: "l1", parts: [], failure: "NO_HEAD_CUT", debug: { accepted: none } };
|
|
554439
|
+
}
|
|
554440
|
+
const plan = planCutCurves(fm, opts.cuts);
|
|
554441
|
+
if (!plan) {
|
|
554442
|
+
return { route: "l1", parts: [], failure: "NO_HEAD_CUT", debug: { accepted: none } };
|
|
554443
|
+
}
|
|
554444
|
+
const snapped = snapCurvesToEdges(img, fm, plan);
|
|
554445
|
+
const parts = partitionByCurves(img, fm, snapped);
|
|
554446
|
+
const has = (n) => parts.some((p) => p.name === n);
|
|
554447
|
+
if (parts.length < 2 || !has("head") || !has("body")) {
|
|
554448
|
+
return { route: "l1", parts: [], failure: "TOO_FEW_PARTS", debug: { accepted: { headBody: true, armLeft: !!plan.armLeft, armRight: !!plan.armRight } } };
|
|
554449
|
+
}
|
|
554450
|
+
return {
|
|
554451
|
+
route: "vision",
|
|
554452
|
+
parts,
|
|
554453
|
+
debug: { accepted: { headBody: true, armLeft: !!plan.armLeft, armRight: !!plan.armRight } }
|
|
554454
|
+
};
|
|
554455
|
+
}
|
|
554456
|
+
|
|
554457
|
+
// src/main/services/companion-pack-service.ts
|
|
554458
|
+
async function napi() {
|
|
554459
|
+
return import("@napi-rs/canvas");
|
|
554460
|
+
}
|
|
554461
|
+
function rgbaOfPng(png) {
|
|
554462
|
+
return (async () => {
|
|
554463
|
+
const { loadImage, createCanvas: createCanvas2 } = await napi();
|
|
554464
|
+
const img = await loadImage(Buffer.isBuffer(png) ? png : Buffer.from(png));
|
|
554465
|
+
const cv = createCanvas2(img.width, img.height);
|
|
554466
|
+
const ctx = cv.getContext("2d");
|
|
554467
|
+
ctx.drawImage(img, 0, 0);
|
|
554468
|
+
return { width: img.width, height: img.height, data: ctx.getImageData(0, 0, img.width, img.height).data };
|
|
554469
|
+
})();
|
|
554470
|
+
}
|
|
554471
|
+
async function rgbaToPng(img) {
|
|
554472
|
+
const { createCanvas: createCanvas2, ImageData: ImageData2 } = await napi();
|
|
554473
|
+
const cv = createCanvas2(img.width, img.height);
|
|
554474
|
+
cv.getContext("2d").putImageData(new ImageData2(new Uint8ClampedArray(img.data), img.width, img.height), 0, 0);
|
|
554475
|
+
return new Uint8Array(await cv.encode("png"));
|
|
554476
|
+
}
|
|
554477
|
+
async function cutCompanionFigure(deps, input) {
|
|
554478
|
+
const rgba = await rgbaOfPng(input.png);
|
|
554479
|
+
const W = rgba.width;
|
|
554480
|
+
const H = rgba.height;
|
|
554481
|
+
let fm = null;
|
|
554482
|
+
try {
|
|
554483
|
+
fm = keyFigure(rgba);
|
|
554484
|
+
} catch {
|
|
554485
|
+
fm = null;
|
|
554486
|
+
}
|
|
554487
|
+
let cuts = null;
|
|
554488
|
+
let visionError;
|
|
554489
|
+
if (fm && !deps.skipVision) {
|
|
554490
|
+
const locate = deps.locate ?? (async (dataUrl) => {
|
|
554491
|
+
const llm = resolveVisionLlm(deps.db);
|
|
554492
|
+
return generateTextWithTimeout(
|
|
554493
|
+
llm.languageModel,
|
|
554494
|
+
[
|
|
554495
|
+
{
|
|
554496
|
+
role: "user",
|
|
554497
|
+
content: [
|
|
554498
|
+
{ type: "text", text: locatePrompt(W, H) },
|
|
554499
|
+
{ type: "image", image: dataUrl }
|
|
554500
|
+
]
|
|
554501
|
+
}
|
|
554502
|
+
],
|
|
554503
|
+
{ maxOutputTokens: 128e3 }
|
|
554504
|
+
// glm-5.3-flash 思考过程计入输出,6000 仍把 JSON 掐断;按用户实测放大到 128k
|
|
554505
|
+
);
|
|
554506
|
+
});
|
|
554507
|
+
try {
|
|
554508
|
+
const previewPng = await rgbaToPng(composeKeyedPreview(rgba, fm));
|
|
554509
|
+
const dataUrl = `data:image/png;base64,${Buffer.from(previewPng).toString("base64")}`;
|
|
554510
|
+
cuts = parseCutsJson(await locate(dataUrl), W, H);
|
|
554511
|
+
if (!cuts)
|
|
554512
|
+
visionError = "\u5207\u5206\u7EBF\u89E3\u6790\u5931\u8D25(VLM \u8F93\u51FA\u4E0D\u542B cuts JSON)";
|
|
554513
|
+
} catch (e) {
|
|
554514
|
+
cuts = null;
|
|
554515
|
+
visionError = String(e.message ?? e).slice(0, 200);
|
|
554516
|
+
}
|
|
554517
|
+
}
|
|
554518
|
+
const result = routeCut(rgba, { cuts });
|
|
554519
|
+
const mode = fm?.mode ?? "alpha";
|
|
554520
|
+
if (result.route === "l1") {
|
|
554521
|
+
const outlined = addWhiteOutline(rgba, Math.max(3, Math.round(Math.min(W, H) * 8e-3)));
|
|
554522
|
+
const png = await rgbaToPng(outlined);
|
|
554523
|
+
const box = { x: 0, y: 0, w: W, h: H };
|
|
554524
|
+
return {
|
|
554525
|
+
route: "l1",
|
|
554526
|
+
failure: result.failure,
|
|
554527
|
+
visionError,
|
|
554528
|
+
parts: [{ name: "sticker", file: "sticker.png", box, png }],
|
|
554529
|
+
manifest: {
|
|
554530
|
+
formatVersion: 1,
|
|
554531
|
+
kind: "companion-cut",
|
|
554532
|
+
source: { width: W, height: H, keyMode: mode, route: "l1" },
|
|
554533
|
+
parts: { sticker: { file: "sticker.png", box } }
|
|
554534
|
+
}
|
|
554535
|
+
};
|
|
554536
|
+
}
|
|
554537
|
+
const outlineRadius = Math.max(3, Math.round(Math.min(W, H) * 6e-3));
|
|
554538
|
+
const files = {};
|
|
554539
|
+
const outParts = [];
|
|
554540
|
+
for (const part of result.parts) {
|
|
554541
|
+
const png = await rgbaToPng(addWhiteOutline({ width: part.box.w, height: part.box.h, data: part.rgba }, outlineRadius));
|
|
554542
|
+
const file2 = `${part.name}.png`;
|
|
554543
|
+
files[part.name] = { file: file2, box: part.box };
|
|
554544
|
+
outParts.push({ name: part.name, file: file2, box: part.box, png });
|
|
554545
|
+
}
|
|
554546
|
+
const manifest = {
|
|
554547
|
+
formatVersion: 1,
|
|
554548
|
+
kind: "companion-cut",
|
|
554549
|
+
source: { width: W, height: H, keyMode: mode, route: result.route },
|
|
554550
|
+
parts: files
|
|
554551
|
+
};
|
|
554552
|
+
return { route: result.route, visionError, parts: outParts, manifest };
|
|
554553
|
+
}
|
|
554554
|
+
function settingOf2(db, key2) {
|
|
554555
|
+
return db.select().from(settings).where(eq(settings.key, key2)).get()?.value ?? null;
|
|
554556
|
+
}
|
|
554557
|
+
function setSettingRaw2(db, key2, value) {
|
|
554558
|
+
db.insert(settings).values({ key: key2, value }).onConflictDoUpdate({ target: settings.key, set: { value } }).run();
|
|
554559
|
+
}
|
|
554560
|
+
var ACTIVE_ID_KEY = "companion_pack_active";
|
|
554561
|
+
var ACTIVE_NAME_KEY = "companion_pack_name";
|
|
554562
|
+
var FORM_KEY = "companion_form";
|
|
554563
|
+
function companionPackDir(dataDir, id) {
|
|
554564
|
+
if (!/^custom-[a-z0-9]{8}$/.test(id))
|
|
554565
|
+
throw new Error(`\u975E\u6CD5\u5305 id: ${id}`);
|
|
554566
|
+
return path5.join(dataDir, "companion-packs", id);
|
|
554567
|
+
}
|
|
554568
|
+
function applyCompanionPack(db, dataDir, input) {
|
|
554569
|
+
const hash = (0, import_node_crypto14.createHash)("sha256").update(input.name).update(JSON.stringify(input.manifest)).digest("hex").slice(0, 8);
|
|
554570
|
+
const id = `custom-${hash}`;
|
|
554571
|
+
const dir = companionPackDir(dataDir, id);
|
|
554572
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
554573
|
+
const validNames = new Set(Object.keys(input.manifest.parts));
|
|
554574
|
+
for (const part of input.parts) {
|
|
554575
|
+
if (!validNames.has(part.name))
|
|
554576
|
+
throw new Error(`\u90E8\u4EF6\u540D\u4E0D\u5728 manifest \u5185: ${part.name}`);
|
|
554577
|
+
const entry = input.manifest.parts[part.name];
|
|
554578
|
+
if (!entry)
|
|
554579
|
+
continue;
|
|
554580
|
+
fs4.writeFileSync(path5.join(dir, entry.file), Buffer.from(part.pngBase64, "base64"));
|
|
554581
|
+
}
|
|
554582
|
+
fs4.writeFileSync(path5.join(dir, "manifest.json"), JSON.stringify({ ...input.manifest, name: input.name }, null, 2));
|
|
554583
|
+
setSettingRaw2(db, ACTIVE_ID_KEY, id);
|
|
554584
|
+
setSettingRaw2(db, ACTIVE_NAME_KEY, input.name);
|
|
554585
|
+
return { id, name: input.name };
|
|
554586
|
+
}
|
|
554587
|
+
function getActiveCompanionPack(db, dataDir) {
|
|
554588
|
+
const id = settingOf2(db, ACTIVE_ID_KEY);
|
|
554589
|
+
if (!id)
|
|
554590
|
+
return null;
|
|
554591
|
+
const dir = companionPackDir(dataDir, id);
|
|
554592
|
+
const manifestPath = path5.join(dir, "manifest.json");
|
|
554593
|
+
if (!fs4.existsSync(manifestPath))
|
|
554594
|
+
return null;
|
|
554595
|
+
let manifest;
|
|
554596
|
+
try {
|
|
554597
|
+
manifest = JSON.parse(fs4.readFileSync(manifestPath, "utf8"));
|
|
554598
|
+
} catch {
|
|
554599
|
+
return null;
|
|
554600
|
+
}
|
|
554601
|
+
const srcs = {};
|
|
554602
|
+
for (const [name18, entry] of Object.entries(manifest.parts)) {
|
|
554603
|
+
const file2 = path5.join(dir, entry.file);
|
|
554604
|
+
if (!fs4.existsSync(file2))
|
|
554605
|
+
continue;
|
|
554606
|
+
srcs[name18] = `data:image/png;base64,${fs4.readFileSync(file2).toString("base64")}`;
|
|
554607
|
+
}
|
|
554608
|
+
if (Object.keys(srcs).length === 0)
|
|
554609
|
+
return null;
|
|
554610
|
+
return { id, name: settingOf2(db, ACTIVE_NAME_KEY) ?? id, manifest, srcs };
|
|
554611
|
+
}
|
|
554612
|
+
function listCompanionPacks(db, dataDir) {
|
|
554613
|
+
const activeId = settingOf2(db, ACTIVE_ID_KEY);
|
|
554614
|
+
const root = path5.join(dataDir, "companion-packs");
|
|
554615
|
+
let entries3 = [];
|
|
554616
|
+
try {
|
|
554617
|
+
entries3 = fs4.readdirSync(root);
|
|
554618
|
+
} catch {
|
|
554619
|
+
return { packs: [] };
|
|
554620
|
+
}
|
|
554621
|
+
const packs = [];
|
|
554622
|
+
for (const id of entries3) {
|
|
554623
|
+
if (!/^custom-[a-z0-9]{8}$/.test(id))
|
|
554624
|
+
continue;
|
|
554625
|
+
const manifestPath = path5.join(root, id, "manifest.json");
|
|
554626
|
+
let manifest;
|
|
554627
|
+
try {
|
|
554628
|
+
manifest = JSON.parse(fs4.readFileSync(manifestPath, "utf8"));
|
|
554629
|
+
} catch {
|
|
554630
|
+
continue;
|
|
554631
|
+
}
|
|
554632
|
+
if (!manifest.name) {
|
|
554633
|
+
manifest.name = "\u81EA\u5B9A\u4E49\u7EB8\u5076";
|
|
554634
|
+
try {
|
|
554635
|
+
fs4.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
554636
|
+
} catch {
|
|
554637
|
+
}
|
|
554638
|
+
}
|
|
554639
|
+
packs.push({
|
|
554640
|
+
id,
|
|
554641
|
+
name: manifest.name,
|
|
554642
|
+
active: id === activeId,
|
|
554643
|
+
route: manifest.source?.route ?? "l1",
|
|
554644
|
+
vehicle: manifest.vehicle
|
|
554645
|
+
});
|
|
554646
|
+
}
|
|
554647
|
+
packs.sort((x, y) => Number(y.active) - Number(x.active) || x.name.localeCompare(y.name));
|
|
554648
|
+
return { packs };
|
|
554649
|
+
}
|
|
554650
|
+
async function packThumb(dataDir, id) {
|
|
554651
|
+
try {
|
|
554652
|
+
const { loadImage } = await napi();
|
|
554653
|
+
const dir = path5.join(dataDir, "companion-packs", id);
|
|
554654
|
+
const manifest = JSON.parse(fs4.readFileSync(path5.join(dir, "manifest.json"), "utf8"));
|
|
554655
|
+
const pick2 = manifest.parts.head ?? manifest.parts.sticker ?? Object.values(manifest.parts)[0];
|
|
554656
|
+
if (!pick2)
|
|
554657
|
+
return void 0;
|
|
554658
|
+
const img = await loadImage(fs4.readFileSync(path5.join(dir, pick2.file)));
|
|
554659
|
+
const scale = 96 / Math.max(img.width, img.height);
|
|
554660
|
+
const { createCanvas: createCanvas2 } = await napi();
|
|
554661
|
+
const cv = createCanvas2(Math.max(1, Math.round(img.width * scale)), Math.max(1, Math.round(img.height * scale)));
|
|
554662
|
+
const ctx = cv.getContext("2d");
|
|
554663
|
+
ctx.drawImage(img, 0, 0, cv.width, cv.height);
|
|
554664
|
+
return `data:image/png;base64,${Buffer.from(await cv.encode("png")).toString("base64")}`;
|
|
554665
|
+
} catch (e) {
|
|
554666
|
+
console.warn("[companion-pack] \u7F29\u7565\u56FE\u751F\u6210\u5931\u8D25:", String(e).slice(0, 160));
|
|
554667
|
+
return void 0;
|
|
554668
|
+
}
|
|
554669
|
+
}
|
|
554670
|
+
async function listCompanionPacksWithThumbs(db, dataDir) {
|
|
554671
|
+
const { packs } = listCompanionPacks(db, dataDir);
|
|
554672
|
+
await Promise.all(
|
|
554673
|
+
packs.map(async (p) => {
|
|
554674
|
+
p.thumb = await packThumb(dataDir, p.id);
|
|
554675
|
+
})
|
|
554676
|
+
);
|
|
554677
|
+
return { packs };
|
|
554678
|
+
}
|
|
554679
|
+
function activateCompanionPack(db, dataDir, id) {
|
|
554680
|
+
const dir = companionPackDir(dataDir, id);
|
|
554681
|
+
const manifestPath = path5.join(dir, "manifest.json");
|
|
554682
|
+
if (!fs4.existsSync(manifestPath))
|
|
554683
|
+
throw new Error(`\u5305\u4E0D\u5B58\u5728: ${id}`);
|
|
554684
|
+
let name18 = id;
|
|
554685
|
+
try {
|
|
554686
|
+
name18 = JSON.parse(fs4.readFileSync(manifestPath, "utf8")).name ?? id;
|
|
554687
|
+
} catch {
|
|
554688
|
+
}
|
|
554689
|
+
setSettingRaw2(db, ACTIVE_ID_KEY, id);
|
|
554690
|
+
setSettingRaw2(db, ACTIVE_NAME_KEY, name18);
|
|
554691
|
+
return { ok: true };
|
|
554692
|
+
}
|
|
554693
|
+
function deleteCompanionPack(db, dataDir, id) {
|
|
554694
|
+
const activeId = settingOf2(db, ACTIVE_ID_KEY);
|
|
554695
|
+
const dir = companionPackDir(dataDir, id);
|
|
554696
|
+
fs4.rmSync(dir, { recursive: true, force: true });
|
|
554697
|
+
let formReset = false;
|
|
554698
|
+
if (id === activeId) {
|
|
554699
|
+
setSettingRaw2(db, ACTIVE_ID_KEY, "");
|
|
554700
|
+
setSettingRaw2(db, ACTIVE_NAME_KEY, "");
|
|
554701
|
+
if (settingOf2(db, FORM_KEY) === "custom") {
|
|
554702
|
+
setSettingRaw2(db, FORM_KEY, "ember");
|
|
554703
|
+
formReset = true;
|
|
554704
|
+
}
|
|
554705
|
+
}
|
|
554706
|
+
return { ok: true, formReset };
|
|
554707
|
+
}
|
|
554708
|
+
var VEHICLE_IDS = /* @__PURE__ */ new Set(["silver", "ember", "frost", "moss", "astro", "ink"]);
|
|
554709
|
+
function setCompanionPackVehicle(dataDir, id, vehicle) {
|
|
554710
|
+
if (!VEHICLE_IDS.has(vehicle))
|
|
554711
|
+
throw new Error(`\u672A\u77E5\u8F7D\u5177\u4E3B\u9898: ${vehicle}`);
|
|
554712
|
+
const manifestPath = path5.join(companionPackDir(dataDir, id), "manifest.json");
|
|
554713
|
+
const manifest = JSON.parse(fs4.readFileSync(manifestPath, "utf8"));
|
|
554714
|
+
manifest.vehicle = vehicle;
|
|
554715
|
+
fs4.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
554716
|
+
return { ok: true };
|
|
554717
|
+
}
|
|
554718
|
+
|
|
553881
554719
|
// src/main/services/progress-service.ts
|
|
553882
554720
|
init_drizzle_orm();
|
|
553883
554721
|
init_schema();
|
|
@@ -554062,7 +554900,7 @@ function findLessonForPractice(db, practiceNodeId) {
|
|
|
554062
554900
|
init_drizzle_orm();
|
|
554063
554901
|
init_schema();
|
|
554064
554902
|
init_schema();
|
|
554065
|
-
var
|
|
554903
|
+
var import_node_crypto15 = require("node:crypto");
|
|
554066
554904
|
|
|
554067
554905
|
// src/main/services/pure/frontmatter.ts
|
|
554068
554906
|
var FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
@@ -554171,7 +555009,7 @@ function getSoul(db, name18) {
|
|
|
554171
555009
|
return row ? mapRow2(row) : null;
|
|
554172
555010
|
}
|
|
554173
555011
|
function createSoul(db, input) {
|
|
554174
|
-
const id = (0,
|
|
555012
|
+
const id = (0, import_node_crypto15.randomUUID)();
|
|
554175
555013
|
db.insert(souls).values({
|
|
554176
555014
|
id,
|
|
554177
555015
|
name: input.name,
|
|
@@ -554206,7 +555044,7 @@ function seedBuiltinSouls(db) {
|
|
|
554206
555044
|
continue;
|
|
554207
555045
|
const parsed = parseFrontmatter(file2.raw);
|
|
554208
555046
|
db.insert(souls).values({
|
|
554209
|
-
id: (0,
|
|
555047
|
+
id: (0, import_node_crypto15.randomUUID)(),
|
|
554210
555048
|
name: file2.slug,
|
|
554211
555049
|
description: parsed.description,
|
|
554212
555050
|
type: "builtin",
|
|
@@ -554724,7 +555562,7 @@ init_schema();
|
|
|
554724
555562
|
|
|
554725
555563
|
// src/main/services/pure/friction-context.ts
|
|
554726
555564
|
init_drizzle_orm();
|
|
554727
|
-
var
|
|
555565
|
+
var import_node_crypto17 = require("node:crypto");
|
|
554728
555566
|
init_schema();
|
|
554729
555567
|
var CATEGORY_LABEL = {
|
|
554730
555568
|
confused: "\u7CCA\u6D82",
|
|
@@ -554732,7 +555570,7 @@ var CATEGORY_LABEL = {
|
|
|
554732
555570
|
frustrated: "\u53D7\u632B"
|
|
554733
555571
|
};
|
|
554734
555572
|
function insertFrictionDb(db, nodeId, category, summary) {
|
|
554735
|
-
db.insert(frictionLog).values({ id: (0,
|
|
555573
|
+
db.insert(frictionLog).values({ id: (0, import_node_crypto17.randomUUID)(), nodeId, category, summary }).run();
|
|
554736
555574
|
}
|
|
554737
555575
|
function buildFrictionContext(db, nodeId) {
|
|
554738
555576
|
const rows = db.select().from(frictionLog).where(
|
|
@@ -554856,12 +555694,12 @@ function buildSoulLangReminder(locale) {
|
|
|
554856
555694
|
init_drizzle_orm();
|
|
554857
555695
|
init_schema();
|
|
554858
555696
|
init_schema();
|
|
554859
|
-
var
|
|
555697
|
+
var import_node_crypto19 = require("node:crypto");
|
|
554860
555698
|
|
|
554861
555699
|
// src/main/services/kc-service.ts
|
|
554862
555700
|
init_drizzle_orm();
|
|
554863
555701
|
init_schema();
|
|
554864
|
-
var
|
|
555702
|
+
var import_node_crypto18 = require("node:crypto");
|
|
554865
555703
|
function getKnowledgePoints(db, nodeId) {
|
|
554866
555704
|
const row = db.select({ kp: contentNodes.knowledgePoints }).from(contentNodes).where(eq(contentNodes.id, nodeId)).get();
|
|
554867
555705
|
if (!row?.kp)
|
|
@@ -554895,7 +555733,7 @@ function ensureKcRows(db, nodeId) {
|
|
|
554895
555733
|
for (let i = 0; i < kps.length; i++) {
|
|
554896
555734
|
if (!existing.has(i)) {
|
|
554897
555735
|
db.insert(knowledgeComponentMastery).values({
|
|
554898
|
-
id: (0,
|
|
555736
|
+
id: (0, import_node_crypto18.randomUUID)(),
|
|
554899
555737
|
nodeId,
|
|
554900
555738
|
kcIndex: i,
|
|
554901
555739
|
mastery: BKT_DEFAULTS.pInit,
|
|
@@ -554917,7 +555755,7 @@ function updateKcMastery(db, nodeId, kcIndex, correct) {
|
|
|
554917
555755
|
db.update(knowledgeComponentMastery).set({ mastery: newMastery, testedCount: row.testedCount + 1 }).where(eq(knowledgeComponentMastery.id, row.id)).run();
|
|
554918
555756
|
} else {
|
|
554919
555757
|
db.insert(knowledgeComponentMastery).values({
|
|
554920
|
-
id: (0,
|
|
555758
|
+
id: (0, import_node_crypto18.randomUUID)(),
|
|
554921
555759
|
nodeId,
|
|
554922
555760
|
kcIndex,
|
|
554923
555761
|
mastery: newMastery,
|
|
@@ -555023,7 +555861,7 @@ function getXpStatus(db, now2 = /* @__PURE__ */ new Date()) {
|
|
|
555023
555861
|
|
|
555024
555862
|
// src/main/services/proposal-service.ts
|
|
555025
555863
|
function createProposal(db, input) {
|
|
555026
|
-
const id = (0,
|
|
555864
|
+
const id = (0, import_node_crypto19.randomUUID)();
|
|
555027
555865
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
555028
555866
|
db.insert(proposals).values({
|
|
555029
555867
|
id,
|
|
@@ -555158,7 +555996,7 @@ function executeOperation(db, op) {
|
|
|
555158
555996
|
case "add_to_srs": {
|
|
555159
555997
|
const dueAt = new Date(Date.now() + 24 * 60 * 60 * 1e3).toISOString();
|
|
555160
555998
|
db.insert(srsItems).values({
|
|
555161
|
-
id: (0,
|
|
555999
|
+
id: (0, import_node_crypto19.randomUUID)(),
|
|
555162
556000
|
nodeId: op.nodeId,
|
|
555163
556001
|
easeFactor: 250,
|
|
555164
556002
|
intervalDays: 1,
|
|
@@ -555187,7 +556025,7 @@ function mapRow3(row) {
|
|
|
555187
556025
|
init_drizzle_orm();
|
|
555188
556026
|
init_schema();
|
|
555189
556027
|
init_schema();
|
|
555190
|
-
var
|
|
556028
|
+
var import_node_crypto20 = require("node:crypto");
|
|
555191
556029
|
function sqlUtcNow() {
|
|
555192
556030
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " ");
|
|
555193
556031
|
}
|
|
@@ -555242,7 +556080,7 @@ function upsertSlot(db, args) {
|
|
|
555242
556080
|
db.update(memory).set({ summary: args.summary, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(memory.id, args.existingId)).run();
|
|
555243
556081
|
} else {
|
|
555244
556082
|
db.insert(memory).values({
|
|
555245
|
-
id: (0,
|
|
556083
|
+
id: (0, import_node_crypto20.randomUUID)(),
|
|
555246
556084
|
nodeId: args.nodeId,
|
|
555247
556085
|
courseId: args.courseId,
|
|
555248
556086
|
summary: args.summary,
|
|
@@ -556448,7 +557286,7 @@ function getDashboard(db, courseId, now2 = /* @__PURE__ */ new Date()) {
|
|
|
556448
557286
|
init_drizzle_orm();
|
|
556449
557287
|
init_schema();
|
|
556450
557288
|
init_schema();
|
|
556451
|
-
var
|
|
557289
|
+
var import_node_crypto21 = require("node:crypto");
|
|
556452
557290
|
function searchContent(sqljs, query2, limit = 10) {
|
|
556453
557291
|
const terms = query2.trim().split(/\s+/).filter(Boolean);
|
|
556454
557292
|
if (terms.length === 0)
|
|
@@ -556507,7 +557345,7 @@ function updateMemory(db, input) {
|
|
|
556507
557345
|
category: existing.category
|
|
556508
557346
|
};
|
|
556509
557347
|
}
|
|
556510
|
-
const id = (0,
|
|
557348
|
+
const id = (0, import_node_crypto21.randomUUID)();
|
|
556511
557349
|
db.insert(memory).values({ id, nodeId, summary: input.summary, category }).run();
|
|
556512
557350
|
return { id, nodeId, summary: input.summary, category };
|
|
556513
557351
|
}
|
|
@@ -556528,7 +557366,7 @@ function getMemory(db, nodeId, category) {
|
|
|
556528
557366
|
init_drizzle_orm();
|
|
556529
557367
|
init_schema();
|
|
556530
557368
|
init_schema();
|
|
556531
|
-
var
|
|
557369
|
+
var import_node_crypto22 = require("node:crypto");
|
|
556532
557370
|
init_markdown_course();
|
|
556533
557371
|
function insertExamNode(db, courseId, sectionId, sectionTitle, orderIdx) {
|
|
556534
557372
|
const existing = db.select().from(contentNodes).all().find(
|
|
@@ -556536,7 +557374,7 @@ function insertExamNode(db, courseId, sectionId, sectionTitle, orderIdx) {
|
|
|
556536
557374
|
);
|
|
556537
557375
|
if (existing)
|
|
556538
557376
|
return null;
|
|
556539
|
-
const examId = (0,
|
|
557377
|
+
const examId = (0, import_node_crypto22.randomUUID)();
|
|
556540
557378
|
db.insert(contentNodes).values({
|
|
556541
557379
|
id: examId,
|
|
556542
557380
|
courseId,
|
|
@@ -556582,7 +557420,7 @@ function generateCourseFromMarkdown(db, md, opts) {
|
|
|
556582
557420
|
let totalExams = 0;
|
|
556583
557421
|
let firstLessonId = null;
|
|
556584
557422
|
for (const section2 of parsed.sections) {
|
|
556585
|
-
const sectionId = (0,
|
|
557423
|
+
const sectionId = (0, import_node_crypto22.randomUUID)();
|
|
556586
557424
|
db.insert(contentNodes).values({
|
|
556587
557425
|
id: sectionId,
|
|
556588
557426
|
courseId,
|
|
@@ -556594,7 +557432,7 @@ function generateCourseFromMarkdown(db, md, opts) {
|
|
|
556594
557432
|
}).run();
|
|
556595
557433
|
let lessonOrder = 0;
|
|
556596
557434
|
for (const lesson of section2.lessons) {
|
|
556597
|
-
const lessonId = (0,
|
|
557435
|
+
const lessonId = (0, import_node_crypto22.randomUUID)();
|
|
556598
557436
|
const isFirstEver = firstLessonId === null;
|
|
556599
557437
|
db.insert(contentNodes).values({
|
|
556600
557438
|
id: lessonId,
|
|
@@ -556659,7 +557497,7 @@ function generateCourseFromRepoFiles(db, parsed, opts) {
|
|
|
556659
557497
|
let totalExams = 0;
|
|
556660
557498
|
let firstLessonId = null;
|
|
556661
557499
|
for (const section2 of parsed.sections) {
|
|
556662
|
-
const sectionId = (0,
|
|
557500
|
+
const sectionId = (0, import_node_crypto22.randomUUID)();
|
|
556663
557501
|
const sectionWorld = section2.world ?? "study";
|
|
556664
557502
|
db.insert(contentNodes).values({
|
|
556665
557503
|
id: sectionId,
|
|
@@ -556673,7 +557511,7 @@ function generateCourseFromRepoFiles(db, parsed, opts) {
|
|
|
556673
557511
|
}).run();
|
|
556674
557512
|
let lessonOrder = 0;
|
|
556675
557513
|
for (const lesson of section2.lessons) {
|
|
556676
|
-
const lessonId = (0,
|
|
557514
|
+
const lessonId = (0, import_node_crypto22.randomUUID)();
|
|
556677
557515
|
const isFirstEver = firstLessonId === null;
|
|
556678
557516
|
const lessonWorld = lesson.world ?? sectionWorld;
|
|
556679
557517
|
db.insert(contentNodes).values({
|
|
@@ -557134,7 +557972,7 @@ function setPromise(nodeId, p) {
|
|
|
557134
557972
|
}
|
|
557135
557973
|
|
|
557136
557974
|
// src/main/services/exam-service.ts
|
|
557137
|
-
var
|
|
557975
|
+
var import_node_crypto23 = require("node:crypto");
|
|
557138
557976
|
var ONE_STAR_THRESHOLD = 0.6;
|
|
557139
557977
|
var TWO_STAR_THRESHOLD = 0.8;
|
|
557140
557978
|
var THREE_STAR_THRESHOLD = 0.95;
|
|
@@ -557294,7 +558132,7 @@ async function generateExamBank(db, examNodeId, locale) {
|
|
|
557294
558132
|
}
|
|
557295
558133
|
for (const q of collected) {
|
|
557296
558134
|
db.insert(exercises).values({
|
|
557297
|
-
id: (0,
|
|
558135
|
+
id: (0, import_node_crypto23.randomUUID)(),
|
|
557298
558136
|
nodeId: examNodeId,
|
|
557299
558137
|
type: "mcq",
|
|
557300
558138
|
prompt: q.prompt,
|
|
@@ -557321,7 +558159,7 @@ function startExamAttempt(db, examNodeId) {
|
|
|
557321
558159
|
if (dangling) {
|
|
557322
558160
|
gradeAndFinalize(db, examNodeId, dangling, safeParseRecord(dangling.answersJson), true);
|
|
557323
558161
|
}
|
|
557324
|
-
const id = (0,
|
|
558162
|
+
const id = (0, import_node_crypto23.randomUUID)();
|
|
557325
558163
|
db.insert(examAttempts).values({
|
|
557326
558164
|
id,
|
|
557327
558165
|
examNodeId,
|
|
@@ -557900,7 +558738,7 @@ function registerCourseHandlers(deps) {
|
|
|
557900
558738
|
return null;
|
|
557901
558739
|
if (importRunning)
|
|
557902
558740
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
557903
|
-
const jobId = (0,
|
|
558741
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
557904
558742
|
importRunning = true;
|
|
557905
558743
|
importCancelRequested = false;
|
|
557906
558744
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -557920,7 +558758,7 @@ function registerCourseHandlers(deps) {
|
|
|
557920
558758
|
throw new Error("\u65E0\u6548\u7684 GitHub URL");
|
|
557921
558759
|
if (importRunning)
|
|
557922
558760
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
557923
|
-
const jobId = (0,
|
|
558761
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
557924
558762
|
importRunning = true;
|
|
557925
558763
|
importCancelRequested = false;
|
|
557926
558764
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -557941,7 +558779,7 @@ function registerCourseHandlers(deps) {
|
|
|
557941
558779
|
throw new Error("\u65E0\u6CD5\u8BC6\u522B\u7684\u94FE\u63A5:\u8BF7\u7C98\u8D34 http(s) \u7F51\u5740\u6216 GitHub \u4ED3\u5E93\u5730\u5740");
|
|
557942
558780
|
if (importRunning)
|
|
557943
558781
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
557944
|
-
const jobId = (0,
|
|
558782
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
557945
558783
|
importRunning = true;
|
|
557946
558784
|
importCancelRequested = false;
|
|
557947
558785
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -557963,7 +558801,7 @@ function registerCourseHandlers(deps) {
|
|
|
557963
558801
|
throw new Error("\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u6587\u672C\u5185\u5BB9");
|
|
557964
558802
|
if (importRunning)
|
|
557965
558803
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
557966
|
-
const jobId = (0,
|
|
558804
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
557967
558805
|
importRunning = true;
|
|
557968
558806
|
importCancelRequested = false;
|
|
557969
558807
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -557996,7 +558834,7 @@ function registerCourseHandlers(deps) {
|
|
|
557996
558834
|
}
|
|
557997
558835
|
if (importRunning)
|
|
557998
558836
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
557999
|
-
const jobId = (0,
|
|
558837
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
558000
558838
|
importRunning = true;
|
|
558001
558839
|
importCancelRequested = false;
|
|
558002
558840
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -558029,7 +558867,7 @@ function registerCourseHandlers(deps) {
|
|
|
558029
558867
|
throw new Error("\u97F3\u9891\u603B\u91CF\u8D85\u8FC7 200MB \u4E0A\u9650,\u8BF7\u5206\u6279\u5BFC\u5165");
|
|
558030
558868
|
if (importRunning)
|
|
558031
558869
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
558032
|
-
const jobId = (0,
|
|
558870
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
558033
558871
|
importRunning = true;
|
|
558034
558872
|
importCancelRequested = false;
|
|
558035
558873
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -558058,7 +558896,7 @@ function registerCourseHandlers(deps) {
|
|
|
558058
558896
|
throw new Error("\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u5BFC\u5165\u65B9\u6848\u5FEB\u7167(\u53EF\u80FD\u5DF2\u8FC7\u671F)");
|
|
558059
558897
|
if (importRunning)
|
|
558060
558898
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
558061
|
-
const jobId = (0,
|
|
558899
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
558062
558900
|
importRunning = true;
|
|
558063
558901
|
importCancelRequested = false;
|
|
558064
558902
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -558094,7 +558932,7 @@ function registerCourseHandlers(deps) {
|
|
|
558094
558932
|
throw new Error("\u8BFE\u7A0B\u5305\u4E0D\u542B\u8BFE\u7A0B\u7ED3\u6784,\u65E0\u6CD5\u76F4\u63A5\u5BFC\u5165");
|
|
558095
558933
|
if (importRunning)
|
|
558096
558934
|
throw new Error("\u5DF2\u6709\u5BFC\u5165\u4EFB\u52A1\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u6216\u5148\u53D6\u6D88");
|
|
558097
|
-
const jobId = (0,
|
|
558935
|
+
const jobId = (0, import_node_crypto25.randomUUID)();
|
|
558098
558936
|
importRunning = true;
|
|
558099
558937
|
importCancelRequested = false;
|
|
558100
558938
|
const shouldAbort = () => importCancelRequested;
|
|
@@ -558126,8 +558964,8 @@ function registerCourseHandlers(deps) {
|
|
|
558126
558964
|
if (deps.ui === "web") {
|
|
558127
558965
|
return { path: null, fileName, content };
|
|
558128
558966
|
}
|
|
558129
|
-
const
|
|
558130
|
-
return
|
|
558967
|
+
const path6 = await deps.dialog.savePack(fileName, content);
|
|
558968
|
+
return path6 ? { path: path6 } : null;
|
|
558131
558969
|
});
|
|
558132
558970
|
handle("course:delete", async (_e, courseId) => {
|
|
558133
558971
|
const db = getDb();
|
|
@@ -558357,9 +559195,9 @@ function registerDshImportHandlers(deps) {
|
|
|
558357
559195
|
}
|
|
558358
559196
|
return result;
|
|
558359
559197
|
};
|
|
558360
|
-
handle("dsh:importFromPath", async (_e,
|
|
559198
|
+
handle("dsh:importFromPath", async (_e, path6) => {
|
|
558361
559199
|
flushDb();
|
|
558362
|
-
return runImport(importDshStateFromPath(getDb(),
|
|
559200
|
+
return runImport(importDshStateFromPath(getDb(), path6, getDbFilePath()));
|
|
558363
559201
|
});
|
|
558364
559202
|
handle("dsh:importFromText", async (_e, jsonText) => {
|
|
558365
559203
|
flushDb();
|
|
@@ -558725,6 +559563,48 @@ function registerAllHandlers(deps) {
|
|
|
558725
559563
|
registerThreadHandlers();
|
|
558726
559564
|
registerSpeechHandlers(deps);
|
|
558727
559565
|
registerDshImportHandlers(deps);
|
|
559566
|
+
registerCompanionPackHandlers(deps);
|
|
559567
|
+
}
|
|
559568
|
+
function registerCompanionPackHandlers(deps) {
|
|
559569
|
+
handle("companionPack:cutFromImage", async (_e, input) => {
|
|
559570
|
+
const png = Buffer.from(input.pngBase64, "base64");
|
|
559571
|
+
const uiTestLocate = process.argv.includes("--ui-test") ? async () => JSON.stringify({
|
|
559572
|
+
cuts: {
|
|
559573
|
+
headBody: [[0.03, 0.375], [0.97, 0.375]],
|
|
559574
|
+
armLeft: [[0.335, 0.375], [0.335, 0.635]],
|
|
559575
|
+
armRight: [[0.665, 0.375], [0.665, 0.635]]
|
|
559576
|
+
}
|
|
559577
|
+
}) : void 0;
|
|
559578
|
+
const out = await cutCompanionFigure({ db: getDb(), ...uiTestLocate ? { locate: uiTestLocate } : {} }, { png, id: input.id, name: input.name });
|
|
559579
|
+
return {
|
|
559580
|
+
route: out.route,
|
|
559581
|
+
failure: out.failure,
|
|
559582
|
+
visionError: out.visionError,
|
|
559583
|
+
manifest: out.manifest,
|
|
559584
|
+
parts: out.parts.map((p) => ({ name: p.name, file: p.file, box: p.box, pngBase64: Buffer.from(p.png).toString("base64") }))
|
|
559585
|
+
};
|
|
559586
|
+
});
|
|
559587
|
+
handle(
|
|
559588
|
+
"companionPack:applyPack",
|
|
559589
|
+
async (_e, input) => {
|
|
559590
|
+
return applyCompanionPack(getDb(), deps.dataDir, input);
|
|
559591
|
+
}
|
|
559592
|
+
);
|
|
559593
|
+
handle("companionPack:getActive", async () => {
|
|
559594
|
+
return getActiveCompanionPack(getDb(), deps.dataDir);
|
|
559595
|
+
});
|
|
559596
|
+
handle("companionPack:list", async () => {
|
|
559597
|
+
return listCompanionPacksWithThumbs(getDb(), deps.dataDir);
|
|
559598
|
+
});
|
|
559599
|
+
handle("companionPack:activate", async (_e, input) => {
|
|
559600
|
+
return activateCompanionPack(getDb(), deps.dataDir, input.id);
|
|
559601
|
+
});
|
|
559602
|
+
handle("companionPack:delete", async (_e, input) => {
|
|
559603
|
+
return deleteCompanionPack(getDb(), deps.dataDir, input.id);
|
|
559604
|
+
});
|
|
559605
|
+
handle("companionPack:setVehicle", async (_e, input) => {
|
|
559606
|
+
return setCompanionPackVehicle(deps.dataDir, input.id, input.vehicle);
|
|
559607
|
+
});
|
|
558728
559608
|
}
|
|
558729
559609
|
function registerThreadHandlers() {
|
|
558730
559610
|
handle(
|
|
@@ -558990,7 +559870,7 @@ function loadOrCreateToken(dataDir) {
|
|
|
558990
559870
|
return existing;
|
|
558991
559871
|
} catch {
|
|
558992
559872
|
}
|
|
558993
|
-
const token = (0,
|
|
559873
|
+
const token = (0, import_node_crypto26.randomBytes)(24).toString("hex");
|
|
558994
559874
|
(0, import_node_fs14.mkdirSync)(dataDir, { recursive: true });
|
|
558995
559875
|
(0, import_node_fs14.writeFileSync)(tokenPath, token, "utf8");
|
|
558996
559876
|
return token;
|