collabmd 0.1.30 → 0.1.32
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/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-tj0_ycIx.js → CodeMirrorEditor-UCMRAMCV-Bg0dawOb.js} +1 -1
- package/dist/client/assets/{_basePickBy-B6kIfhzj.js → _basePickBy-Dv0sK1l7.js} +1 -1
- package/dist/client/assets/{_baseUniq-Bbn0_sHS.js → _baseUniq-DKYX57ji.js} +1 -1
- package/dist/client/assets/{ar-SA-NXDWD63E-BWO5oYxe.js → ar-SA-NXDWD63E-WivLHHDW.js} +1 -1
- package/dist/client/assets/{arc-BIqum3oD.js → arc-DrfYGhWk.js} +1 -1
- package/dist/client/assets/architecture-PBZL5I3N-DiglIZi9.js +1 -0
- package/dist/client/assets/{architectureDiagram-2XIMDMQ5-BPG5b65m.js → architectureDiagram-2XIMDMQ5-kYbOThe4.js} +1 -1
- package/dist/client/assets/{az-AZ-MXSORGZV-Cfw6Z5oY.js → az-AZ-MXSORGZV-DOdq1TKC.js} +1 -1
- package/dist/client/assets/{bg-BG-O6MV2KSF-CQmG3YpD.js → bg-BG-O6MV2KSF-CYucKuDS.js} +1 -1
- package/dist/client/assets/{blockDiagram-WCTKOSBZ-F38TRzI3.js → blockDiagram-WCTKOSBZ-GIgTqnhk.js} +1 -1
- package/dist/client/assets/{bn-IN-MMW2ORAC-DZKVshfk.js → bn-BD-T2VJNT7N-2OKWLCYa.js} +1 -1
- package/dist/client/assets/{bn-BD-T2VJNT7N-C4S6DZ6o.js → bn-IN-MMW2ORAC-DYr8kqNL.js} +1 -1
- package/dist/client/assets/{c4Diagram-IC4MRINW-DHwxcDlQ.js → c4Diagram-IC4MRINW-CkHO1i_L.js} +1 -1
- package/dist/client/assets/{ca-ES-MKBCGNOG-Do3aMgyu.js → ca-ES-MKBCGNOG-B9Aeb43I.js} +1 -1
- package/dist/client/assets/channel-CgsU9TSN.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-BqEY6cCE.js → chunk-4BX2VUAB-2e7V-uuE.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-039iVf6v.js → chunk-55IACEB6-CpncB3ru.js} +1 -1
- package/dist/client/assets/{chunk-7E7YKBS2-BreG0gYL.js → chunk-7E7YKBS2-TdU92i9i.js} +1 -1
- package/dist/client/assets/{chunk-7R4GIKGN-BMrp52Pk.js → chunk-7R4GIKGN-mqd2GwMg.js} +2 -2
- package/dist/client/assets/{chunk-C72U2L5F-BLB26v5d.js → chunk-C72U2L5F-CJKQWBtz.js} +1 -1
- package/dist/client/assets/{chunk-EGIJ26TM-fG-0Yh0k.js → chunk-EGIJ26TM-C4nq20om.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-EWK5Pt4D.js → chunk-FMBD7UC4-CMahlBa_.js} +1 -1
- package/dist/client/assets/{chunk-GEFDOKGD-DYHmaq-c.js → chunk-GEFDOKGD-Bs7FmFox.js} +1 -1
- package/dist/client/assets/chunk-GLR3WWYH-qQe2O5VQ.js +2 -0
- package/dist/client/assets/chunk-HHEYEP7N-DlevL8bq.js +1 -0
- package/dist/client/assets/{chunk-JSJVCQXG-B69YGtcQ.js → chunk-JSJVCQXG-DPQ9cPJt.js} +1 -1
- package/dist/client/assets/{chunk-KX2RTZJC-tuEC7hg1.js → chunk-KX2RTZJC-BTiOJb7N.js} +1 -1
- package/dist/client/assets/{chunk-KYZI473N-D4r5eMJZ.js → chunk-KYZI473N-CTSCuqRb.js} +1 -1
- package/dist/client/assets/{chunk-L3YUKLVL-CD9nJYL8.js → chunk-L3YUKLVL-CJZMBtKF.js} +1 -1
- package/dist/client/assets/{chunk-MX3YWQON-DqN0TF5Q.js → chunk-MX3YWQON-DQpSwRf6.js} +1 -1
- package/dist/client/assets/{chunk-NQ4KR5QH-BBX89uUa.js → chunk-NQ4KR5QH-CMJKI6Oj.js} +1 -1
- package/dist/client/assets/{chunk-NU2UP6EN-CGeKI3BV.js → chunk-NU2UP6EN-DlUENSHU.js} +4 -4
- package/dist/client/assets/{chunk-O4XLMI2P-DaS3COAu.js → chunk-O4XLMI2P-CcVxZh41.js} +1 -1
- package/dist/client/assets/{chunk-OZEHJAEY-BaBXI-8x.js → chunk-OZEHJAEY-DjBZbgu0.js} +1 -1
- package/dist/client/assets/{chunk-PQ6SQG4A-BY9_Srs_.js → chunk-PQ6SQG4A-D1AbThjy.js} +1 -1
- package/dist/client/assets/{chunk-PU5JKC2W-t0zUh6E3.js → chunk-PU5JKC2W-D_6N6t8f.js} +1 -1
- package/dist/client/assets/chunk-QZHKN3VN-CgLPFSk5.js +1 -0
- package/dist/client/assets/{chunk-R5LLSJPH-BjSMFnTi.js → chunk-R5LLSJPH-CkjKXM73.js} +1 -1
- package/dist/client/assets/{chunk-WL4C6EOR-zSV-8h7F.js → chunk-WL4C6EOR-axcuKSup.js} +1 -1
- package/dist/client/assets/{chunk-XIRO2GV7-2tirYN5A.js → chunk-XIRO2GV7-4wqVHjs_.js} +1 -1
- package/dist/client/assets/{chunk-XPW4576I-C0GpOUHf.js → chunk-XPW4576I-DJr4_4Yy.js} +1 -1
- package/dist/client/assets/{chunk-XZSTWKYB-DDkpyNVE.js → chunk-XZSTWKYB-C8Y_hIKZ.js} +1 -1
- package/dist/client/assets/{chunk-YBOYWFTD-CzyyfGQX.js → chunk-YBOYWFTD-CKg4ymFF.js} +1 -1
- package/dist/client/assets/{chunk-Z5NKEFVG-Dgem5v98.js → chunk-Z5NKEFVG-HOkYqaKa.js} +1 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-BHZpvOxK.js +1 -0
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-DA7HMUUs.js +1 -0
- package/dist/client/assets/clone-Dgi8Z4IL.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-jZzFUguD.js → cose-bilkent-S5V4N54A-DASO2hrk.js} +1 -1
- package/dist/client/assets/{cs-CZ-V77HGUP7-DmZRJ2UO.js → cs-CZ-V77HGUP7-BDg-F0CJ.js} +1 -1
- package/dist/client/assets/{da-DK-I5RFNTM4-CRIiLQ-G.js → da-DK-I5RFNTM4-wtSQ0Jxa.js} +1 -1
- package/dist/client/assets/{dagre-fvYjRtTE.js → dagre-CfB3Fw33.js} +1 -1
- package/dist/client/assets/{dagre-KLK3FWXG-CAG8WeES.js → dagre-KLK3FWXG-CC7tq2Ky.js} +1 -1
- package/dist/client/assets/{de-DE-DTI4WUSC-MFge9MC3.js → de-CH-WLRDEVBV-C1swvmZy.js} +1 -1
- package/dist/client/assets/{de-CH-WLRDEVBV-k728UA4j.js → de-DE-DTI4WUSC-C0L6Nz8X.js} +1 -1
- package/dist/client/assets/{diagram-E7M64L7V-Bm5FD0I5.js → diagram-E7M64L7V-CMt7BN5M.js} +1 -1
- package/dist/client/assets/{diagram-IFDJBPK2-pqicH-av.js → diagram-IFDJBPK2-BFMBUGpd.js} +1 -1
- package/dist/client/assets/{diagram-P4PSJMXO-DwIXO27H.js → diagram-P4PSJMXO-CviA1xXr.js} +1 -1
- package/dist/client/assets/dist-8Igu3Ee_2.js +1 -0
- package/dist/client/assets/dist-B4uQVR_X.js +1 -0
- package/dist/client/assets/{dockerfile-C0qQqxf9.js → dockerfile-D8_6_FRV.js} +1 -1
- package/dist/client/assets/{drawio-editor-CTZtMo1J.js → drawio-editor-Br4qyh3r.js} +1 -1
- package/dist/client/assets/drawioEditor-ClmnTx5J.js +2 -0
- package/dist/client/assets/editor-session-Cf-iV5-3.js +16 -0
- package/dist/client/assets/{el-GR-ZXDJ2OS4-Bbz93mrG.js → el-GR-ZXDJ2OS4-BH0saXds.js} +1 -1
- package/dist/client/assets/embedded-editor-base-CgEkjNYn.css +1 -0
- package/dist/client/assets/{en-IQZW2TQM-CZeIyvu2.js → en-IQZW2TQM-CzlcEpq3.js} +1 -1
- package/dist/client/assets/{erDiagram-INFDFZHY-DlhPv4az.js → erDiagram-INFDFZHY-DlIf-fb7.js} +1 -1
- package/dist/client/assets/{es-ES-DYQHAD43-CReXU-Nn.js → es-ES-DYQHAD43-CyzL9Mni.js} +1 -1
- package/dist/client/assets/{eu-ES-QDSYU5Y3-jRpcaWwz.js → eu-ES-QDSYU5Y3-D2-x316S.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-CBEWfuhb.js → excalidraw-editor-CXAxVhlw.js} +2 -2
- package/dist/client/assets/{excalidraw-mermaid-stub-efoh2lJm.js → excalidraw-mermaid-stub-Bwe-bKcT.js} +1 -1
- package/dist/client/assets/{excalidraw-scene-BL-OtvCd.js → excalidraw-scene-BF_bT1OL.js} +8 -8
- package/dist/client/assets/excalidrawEditor-DoH_kMdu.js +2 -0
- package/dist/client/assets/export-page-PeexH2QK.js +39 -0
- package/dist/client/assets/exportDocument-9wTrBZNS.css +1 -0
- package/dist/client/assets/exportDocument-Bia2hI25.js +2 -0
- package/dist/client/assets/{fa-IR-26LZG4PM-DP8pJ8e3.js → fa-IR-26LZG4PM-D8-trU2x.js} +1 -1
- package/dist/client/assets/{factor-2uy-lXe_.js → factor-Cz-hzBGH.js} +1 -1
- package/dist/client/assets/{fi-FI-6YS4KDE4-BLUDpNOj.js → fi-FI-6YS4KDE4-CCdRVFDQ.js} +1 -1
- package/dist/client/assets/file-kind-DBptLlF_.js +1 -0
- package/dist/client/assets/{flowDiagram-PKNHOUZH-BU4MOSq8.js → flowDiagram-PKNHOUZH-C_t-mkwb.js} +1 -1
- package/dist/client/assets/{fr-FR-BRLLPTZC-BoZz3Pi8.js → fr-FR-BRLLPTZC-Dqq-O5T_.js} +1 -1
- package/dist/client/assets/{ganttDiagram-A5KZAMGK-CbX67lZu.js → ganttDiagram-A5KZAMGK-BtK9Tb--.js} +1 -1
- package/dist/client/assets/gitGraph-HDMCJU4V-CT7YfbD3.js +1 -0
- package/dist/client/assets/{gitGraphDiagram-K3NZZRJ6-DhyvWcW1.js → gitGraphDiagram-K3NZZRJ6-DULDLGiJ.js} +1 -1
- package/dist/client/assets/{gl-ES-OKUZTLYG-CaEvhjDi.js → gl-ES-OKUZTLYG-BK7pbLbm.js} +1 -1
- package/dist/client/assets/{graphlib-DSzYgMXB.js → graphlib-BgRST-Qg.js} +1 -1
- package/dist/client/assets/{he-IL-26MGYIU7-DYOchgy9.js → he-IL-26MGYIU7-C3BuYKyY.js} +1 -1
- package/dist/client/assets/{hi-IN-Q4ZOGTP2-yRs8g46n.js → hi-IN-Q4ZOGTP2-BEvXWXnH.js} +1 -1
- package/dist/client/assets/{hu-HU-P2OXPSN5-1skPmtgc.js → hu-HU-P2OXPSN5-BWWZeJNp.js} +1 -1
- package/dist/client/assets/{id-ID-2EIKXYN6-iUugQJd9.js → id-ID-2EIKXYN6-DxSKi_aJ.js} +1 -1
- package/dist/client/assets/image-XLNPCCAD-CFiKwiWK.js +1 -0
- package/dist/client/assets/{index-CywRKxsk.js → index-C8QZYHvV.js} +2 -2
- package/dist/client/assets/index-CxSbUTs2.css +1 -0
- package/dist/client/assets/info-3K5VOQVL-DUpNyDC-.js +1 -0
- package/dist/client/assets/{infoDiagram-LFFYTUFH-Bap6MyHX.js → infoDiagram-LFFYTUFH-DFTI0nfs.js} +1 -1
- package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/client/assets/{isEmpty-C7iPDOO3.js → isEmpty-CVvRj8fj.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-PHBUUO56-DbftskqN.js → ishikawaDiagram-PHBUUO56-DpBuDpC6.js} +1 -1
- package/dist/client/assets/{it-IT-4CFKVXI2-a5DFhzuI.js → it-IT-4CFKVXI2-BmA8wW6q.js} +1 -1
- package/dist/client/assets/{ja-JP-MAND2Z4V-DwogHVKd.js → ja-JP-MAND2Z4V-CLS1jI9o.js} +1 -1
- package/dist/client/assets/javascript-UJe68_xi.js +1 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/client/assets/{journeyDiagram-4ABVD52K-165YoX6B.js → journeyDiagram-4ABVD52K-DDur6iHm.js} +1 -1
- package/dist/client/assets/{kaa-HQRTCXTJ-p81XNRfH.js → kaa-HQRTCXTJ-W15DEDPz.js} +1 -1
- package/dist/client/assets/{kab-KAB-JKIKKTGH-mV5VzQZc.js → kab-KAB-JKIKKTGH-MLh1inqS.js} +1 -1
- package/dist/client/assets/{kanban-definition-K7BYSVSG-MlixoNyx.js → kanban-definition-K7BYSVSG-dA6NPLsg.js} +1 -1
- package/dist/client/assets/{kk-KZ-HXQ63ZFC-IIPX0GQv.js → kk-KZ-HXQ63ZFC-BtFrPeLs.js} +1 -1
- package/dist/client/assets/{km-KH-PKL3LSGX-D7WQFJuZ.js → km-KH-PKL3LSGX-xO5FyM9T.js} +1 -1
- package/dist/client/assets/{ko-KR-KXLREZX3-Bs1oLtJs.js → ko-KR-KXLREZX3-NZFoRybS.js} +1 -1
- package/dist/client/assets/{ku-TR-MJ4IER3X-DlxOs6aZ.js → ku-TR-MJ4IER3X-B5eVPIpK.js} +1 -1
- package/dist/client/assets/{line-D57TbKb7.js → line-B2GMovaI.js} +1 -1
- package/dist/client/assets/{linear-BIf852wI.js → linear-B2dOdA24.js} +1 -1
- package/dist/client/assets/{lt-LT-H6WFQ6FJ-xuo-3zKH.js → lt-LT-H6WFQ6FJ-D_7_OeJD.js} +1 -1
- package/dist/client/assets/{lv-LV-GOCK6SJW-C7S3M1nr.js → lv-LV-GOCK6SJW-CnpKr0oQ.js} +1 -1
- package/dist/client/assets/main-BjHHMlv0.js +1249 -0
- package/dist/client/assets/{mermaid-parser.core-lf87rdG-.js → mermaid-parser.core-B1ogGcR8.js} +2 -2
- package/dist/client/assets/{mermaid-runtime-C4a7TrTS.js → mermaid-runtime-Bn8A6DGx.js} +3 -3
- package/dist/client/assets/{mindmap-definition-YRQLILUH-_YbQSc4Q.js → mindmap-definition-YRQLILUH-DjQcsPoe.js} +1 -1
- package/dist/client/assets/{mr-IN-IXVLDMEQ-BsoowyZT.js → mr-IN-IXVLDMEQ-Pht2X_GK.js} +1 -1
- package/dist/client/assets/{my-MM-YG6MYTTD-DCqwN_K_.js → my-MM-YG6MYTTD-Cgq4HhPO.js} +1 -1
- package/dist/client/assets/{nb-NO-XGWJISD2-CZ5ytLgj.js → nb-NO-XGWJISD2-Bn_Bk2un.js} +1 -1
- package/dist/client/assets/{nl-NL-XVDVCPNC-wADsdb-h.js → nl-NL-XVDVCPNC-YkWSJS94.js} +1 -1
- package/dist/client/assets/{nn-NO-EMX5MJX5-D9zIKTL2.js → nn-NO-EMX5MJX5-DhP5eZJ7.js} +1 -1
- package/dist/client/assets/{nsis-CUd4RnvJ.js → nsis-QPGhLAeY.js} +1 -1
- package/dist/client/assets/{oc-FR-ROEINTVO-BSbBugJB.js → oc-FR-ROEINTVO-D3udMPnr.js} +1 -1
- package/dist/client/assets/{ordinal-B0PAtOQ6.js → ordinal-Dz3y_j0K.js} +1 -1
- package/dist/client/assets/{pa-IN-ZYN6SUDY-1pFA_3Pb.js → pa-IN-ZYN6SUDY-CR5YzFig.js} +1 -1
- package/dist/client/assets/packet-RMMSAZCW-DEwNbIrA.js +1 -0
- package/dist/client/assets/percentages-5DKR754L-D7n4T776.js +1 -0
- package/dist/client/assets/pie-UPGHQEXC-D5M_lSjo.js +1 -0
- package/dist/client/assets/{pieDiagram-SKSYHLDU-CqCgXFom.js → pieDiagram-SKSYHLDU-jhHouFpk.js} +1 -1
- package/dist/client/assets/{pl-PL-6VTG7PHC-DyYw0u_z.js → pl-PL-6VTG7PHC-_wZuoIDM.js} +1 -1
- package/dist/client/assets/preview-render-compiler-BjLlHmiQ.js +35 -0
- package/dist/client/assets/preview-render-compiler-Duy_3IcP.js +1 -0
- package/dist/client/assets/{preview-render-worker-BVbVXXPS.js → preview-render-worker-B4dH2yxj.js} +22 -22
- package/dist/client/assets/{pt-BR-5YFKRR5G-DJCCBBDl.js → pt-BR-5YFKRR5G-M7gIm2Hi.js} +1 -1
- package/dist/client/assets/{pt-PT-GEIXXZ67-BPJd09Ax.js → pt-PT-GEIXXZ67-CcxWpkGj.js} +1 -1
- package/dist/client/assets/{pug-BqBF8qF7.js → pug-DkUcLYWt.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-337W2JSQ-B8eMuhg4.js → quadrantDiagram-337W2JSQ-CYKgdx7K.js} +1 -1
- package/dist/client/assets/quick-switcher-controller-DcyllYpm.js +5 -0
- package/dist/client/assets/radar-KQ55EAFF-AU1qh3Bw.js +1 -0
- package/dist/client/assets/{requirementDiagram-Z7DCOOCP-B6POvqz4.js → requirementDiagram-Z7DCOOCP-D9SHxoW7.js} +1 -1
- package/dist/client/assets/{ro-RO-E2P6TFZI-DWVyTV7V.js → ro-RO-E2P6TFZI-qR9noVzP.js} +1 -1
- package/dist/client/assets/{room-COWSP--i.js → room-yJaBAoEU.js} +1 -1
- package/dist/client/assets/{ru-RU-YBIIY43T-Dyar7CYM.js → ru-RU-YBIIY43T-CE4S_RX8.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CXRga6Op.js → sankeyDiagram-WA2Y5GQK-CfHe3D6R.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-2WXFIKYE-CeSFlFx5.js → sequenceDiagram-2WXFIKYE-CZsMMqAJ.js} +1 -1
- package/dist/client/assets/{si-LK-673C2CI2-C61aLrIy.js → si-LK-673C2CI2-Bv6Avh3z.js} +1 -1
- package/dist/client/assets/{sk-SK-CKZHQ4AP-BlFwOxRD.js → sk-SK-CKZHQ4AP-Cnlpp55z.js} +1 -1
- package/dist/client/assets/{sl-SI-557H2GWM-DcAVW-_t.js → sl-SI-557H2GWM-BfGq7AQF.js} +1 -1
- package/dist/client/assets/{stateDiagram-RAJIS63D-DbewhqwJ.js → stateDiagram-RAJIS63D-CoNZjTYV.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-1zOw6NmQ.js +1 -0
- package/dist/client/assets/subset-shared.chunk-C9HjwTXy.js +1 -0
- package/dist/client/assets/{subset-worker.chunk-DVGT6bvR.js → subset-worker.chunk-BSCP6IiC.js} +1 -1
- package/dist/client/assets/{sv-SE-XOPKKDWS-BkhfOHzh.js → sv-SE-XOPKKDWS-B2_Vk-sp.js} +1 -1
- package/dist/client/assets/{ta-IN-XBH7DQI3-BIfwglZa.js → ta-IN-XBH7DQI3-BXQMZZIx.js} +1 -1
- package/dist/client/assets/{th-TH-TOCWH3R4-CkrxqVkf.js → th-TH-TOCWH3R4-C-ZIYMfH.js} +1 -1
- package/dist/client/assets/{timeline-definition-YZTLITO2-BXBHNWLQ.js → timeline-definition-YZTLITO2-DSe2mrG8.js} +1 -1
- package/dist/client/assets/{tr-TR-GXW6CYY5-CDdvG9rD.js → tr-TR-GXW6CYY5-dl702PMA.js} +1 -1
- package/dist/client/assets/treemap-KZPCXAKY-C9UI2fwP.js +1 -0
- package/dist/client/assets/{uk-UA-IJKTNUDG-DRHp0lWp.js → uk-UA-IJKTNUDG-CUYQvSSF.js} +1 -1
- package/dist/client/assets/{uz-UZ-TBZZEA4V-BIn-VE3Y.js → uz-UZ-TBZZEA4V-B9qw0PXX.js} +1 -1
- package/dist/client/assets/vault-api-client-Bf9tB_GW.js +1 -0
- package/dist/client/assets/vault-api-client-D7Ck0CvR.css +1 -0
- package/dist/client/assets/vault-utils-5Xr0MXCb.js +1 -0
- package/dist/client/assets/{vennDiagram-LZ73GAT5-C1hrSbf2.js → vennDiagram-LZ73GAT5-xSzaIpy1.js} +1 -1
- package/dist/client/assets/{vi-VN-MULSGNVB-Du7t5I0v.js → vi-VN-MULSGNVB-DqxZ_sVc.js} +1 -1
- package/dist/client/assets/{xychartDiagram-JWTSCODW-DhpWp8LV.js → xychartDiagram-JWTSCODW-C3vA70iJ.js} +1 -1
- package/dist/client/assets/{zh-CN-MVX3E32U-RcjS3rjt.js → zh-CN-MVX3E32U-BM0aLuGc.js} +1 -1
- package/dist/client/assets/{zh-HK-JNU5RLIE-g8UeEw5v.js → zh-HK-JNU5RLIE-dmG_YD0d.js} +1 -1
- package/dist/client/assets/{zh-TW-LENVCA6T-DwV25BqC.js → zh-TW-LENVCA6T-LFgbiOi3.js} +1 -1
- package/dist/client/drawio-editor.html +1 -1
- package/dist/client/excalidraw-editor.html +1 -1
- package/dist/client/export-document.html +3 -3
- package/dist/client/index.html +2 -2
- package/package.json +5 -1
- package/src/client/app/export-document.html +1 -1
- package/src/client/app/main-entry.js +2 -0
- package/src/client/application/app-shell/git-feature.js +28 -36
- package/src/client/application/app-shell/presence-feature.js +3 -1
- package/src/client/application/app-shell/workspace-feature.js +9 -0
- package/src/client/application/app-shell-elements.js +1 -0
- package/src/client/application/diagram-preview-hydrator.js +24 -15
- package/src/client/application/markdown-frontmatter.js +1 -56
- package/src/client/application/mermaid-preview-hydrator.js +121 -4
- package/src/client/application/plantuml-preview-hydrator.js +6 -16
- package/src/client/application/preview-render-compiler.js +50 -6
- package/src/client/application/preview-renderer.js +11 -2
- package/src/client/application/workspace-chrome-controller.js +25 -19
- package/src/client/application/workspace-coordinator.js +9 -0
- package/src/client/application/workspace-preview-controller.js +48 -3
- package/src/client/bootstrap/collabmd-app-shell.js +202 -52
- package/src/client/domain/excalidraw-document-switch.js +3 -0
- package/src/client/domain/vault-paths.js +19 -0
- package/src/client/excalidraw-editor.js +187 -84
- package/src/client/export/export-page.js +11 -3
- package/src/client/export/export-pipeline.js +77 -2
- package/src/client/infrastructure/auth-client.js +4 -4
- package/src/client/infrastructure/backlinks-api-client.js +18 -0
- package/src/client/infrastructure/comment-thread-store.js +4 -0
- package/src/client/infrastructure/editor-session.js +2 -0
- package/src/client/infrastructure/editor-view-adapter.js +8 -5
- package/src/client/infrastructure/git-api-client.js +134 -0
- package/src/client/infrastructure/plantuml-api-client.js +21 -0
- package/src/client/infrastructure/vault-api-client.js +121 -0
- package/src/client/presentation/app-shell-template.js +12 -0
- package/src/client/presentation/backlinks-panel.js +43 -20
- package/src/client/presentation/bases-preview-controller.js +463 -0
- package/src/client/presentation/excalidraw-embed-controller.js +251 -15
- package/src/client/presentation/excalidraw-embed-reconciler.js +0 -1
- package/src/client/presentation/file-action-controller.js +140 -0
- package/src/client/presentation/file-explorer-controller.js +2 -0
- package/src/client/presentation/file-explorer-view.js +378 -2
- package/src/client/presentation/file-history-view-controller.js +41 -40
- package/src/client/presentation/file-tree-state.js +9 -1
- package/src/client/presentation/git-diff-view-controller.js +70 -53
- package/src/client/presentation/git-panel-controller.js +12 -30
- package/src/client/presentation/quick-switcher-controller.js +54 -13
- package/src/client/styles/export-document.css +55 -0
- package/src/client/styles/features/auth-gate.css +13 -24
- package/src/client/styles/features/backlinks.css +65 -3
- package/src/client/styles/features/comment-card.css +6 -0
- package/src/client/styles/features/comments-drawer.css +38 -18
- package/src/client/styles/features/diagram-preview.css +33 -0
- package/src/client/styles/features/embedded-preview.css +37 -11
- package/src/client/styles/features/preview-markdown.css +285 -1
- package/src/client/styles/foundation/themes.css +4 -0
- package/src/client/styles/foundation/tokens.css +4 -3
- package/src/client/styles/layout/shell.css +8 -1
- package/src/client/styles/layout/sidebar.css +72 -0
- package/src/client/styles/layout/view-modes.css +5 -0
- package/src/domain/file-kind.js +17 -2
- package/src/domain/wiki-link-resolver.js +41 -23
- package/src/domain/yaml-frontmatter.js +59 -0
- package/src/server/auth/auth-common.js +224 -0
- package/src/server/auth/auth-constants.js +30 -0
- package/src/server/auth/auth-strategies.js +320 -0
- package/src/server/auth/create-auth-service.js +24 -545
- package/src/server/create-app-server.js +11 -2
- package/src/server/domain/backlink-index.js +102 -16
- package/src/server/domain/bases/base-definition.js +255 -0
- package/src/server/domain/bases/base-expression-runtime.js +1159 -0
- package/src/server/domain/bases/base-index-snapshot-store.js +418 -0
- package/src/server/domain/bases/base-query-results.js +205 -0
- package/src/server/domain/bases/base-query-service.js +204 -0
- package/src/server/domain/collaboration/collaboration-document-store.js +13 -2
- package/src/server/domain/collaboration/collaboration-room.js +36 -1
- package/src/server/domain/collaboration/room-client-state-store.js +1 -0
- package/src/server/domain/collaboration/room-persistence-controller.js +1 -1
- package/src/server/domain/workspace-state.js +52 -0
- package/src/server/infrastructure/http/create-request-handler.js +2 -0
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +5 -0
- package/src/server/infrastructure/http/create-vault-api-handler.js +2 -0
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +175 -1
- package/src/server/infrastructure/http/http-response.js +56 -0
- package/src/server/infrastructure/persistence/path-utils.js +1 -1
- package/src/server/infrastructure/persistence/vault-content-adapter.js +6 -0
- package/src/server/infrastructure/persistence/vault-file-store.js +124 -0
- package/src/server/infrastructure/workspace/file-system-sync-service.js +110 -19
- package/src/server/infrastructure/workspace/workspace-mutation-coordinator.js +15 -44
- package/dist/client/assets/architecture-PBZL5I3N-iRyVT2GQ.js +0 -1
- package/dist/client/assets/channel-s0w88EQN.js +0 -1
- package/dist/client/assets/chunk-GLR3WWYH-CQ1LryrI.js +0 -2
- package/dist/client/assets/chunk-HHEYEP7N-DOQ0PCdH.js +0 -1
- package/dist/client/assets/chunk-QZHKN3VN-B0v4d-CS.js +0 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-BQqG4q1b.js +0 -1
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-BUKbprX1.js +0 -1
- package/dist/client/assets/clone-C-n46MFF.js +0 -1
- package/dist/client/assets/dist-BqQjnEWr.js +0 -1
- package/dist/client/assets/drawioEditor-keSJVTcv.js +0 -2
- package/dist/client/assets/editor-session-C9l9XwVg.js +0 -16
- package/dist/client/assets/embedded-editor-base-DgmRcsR8.css +0 -1
- package/dist/client/assets/excalidrawEditor-Ws-fwGOc.js +0 -2
- package/dist/client/assets/export-page-B6xYnwy7.js +0 -39
- package/dist/client/assets/exportDocument-8JBw0p8O.js +0 -2
- package/dist/client/assets/exportDocument-CtX_4PSk.css +0 -1
- package/dist/client/assets/gitGraph-HDMCJU4V-kkuqHGSM.js +0 -1
- package/dist/client/assets/image-XLNPCCAD-B4wZgh-Y.js +0 -1
- package/dist/client/assets/index-R4OArFku.css +0 -1
- package/dist/client/assets/info-3K5VOQVL-DPN78whf.js +0 -1
- package/dist/client/assets/javascript-8DvdgifH.js +0 -1
- package/dist/client/assets/main-CB97rY6B.js +0 -1213
- package/dist/client/assets/packet-RMMSAZCW-BymvQ5cQ.js +0 -1
- package/dist/client/assets/percentages-5DKR754L-CiI2D7zA.js +0 -1
- package/dist/client/assets/pie-UPGHQEXC-MmzJzWOE.js +0 -1
- package/dist/client/assets/preview-render-compiler-TmHpBDlh.js +0 -1
- package/dist/client/assets/preview-render-compiler-aYpnXmNm.js +0 -35
- package/dist/client/assets/quick-switcher-controller-DplOTsT3.js +0 -5
- package/dist/client/assets/radar-KQ55EAFF-CCohASSY.js +0 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-DbW-jVkS.js +0 -1
- package/dist/client/assets/subset-shared.chunk-CC_u8ICU.js +0 -1
- package/dist/client/assets/treemap-KZPCXAKY-9kxB0uNY.js +0 -1
- package/dist/client/assets/vault-api-client-DIaCC56H.js +0 -1
- package/dist/client/assets/vault-api-client-De7kMvrE.css +0 -1
- package/dist/client/assets/vault-utils-BW53lKl1.js +0 -1
- /package/dist/client/assets/{apl-QJCYYBkj.js → apl-C1JYSI8J.js} +0 -0
- /package/dist/client/assets/{array-DwdVlTkF.js → array-B3agRrCs.js} +0 -0
- /package/dist/client/assets/{asciiarmor-DNy0UPqh.js → asciiarmor-DHW75j1s.js} +0 -0
- /package/dist/client/assets/{asn1-CNPXj-s7.js → asn1-CQiG40kG.js} +0 -0
- /package/dist/client/assets/{asterisk-BwMdLpT2.js → asterisk-BWExh0n4.js} +0 -0
- /package/dist/client/assets/{brainfuck-C2gHT8aA.js → brainfuck-CTNFyOLg.js} +0 -0
- /package/dist/client/assets/{chunk-3PELD44J-CL87tpFo.js → chunk-3PELD44J-DymL2rGq.js} +0 -0
- /package/dist/client/assets/{chunk-A66AFZZU-DuceaGnc.js → chunk-A66AFZZU-BFHL744F.js} +0 -0
- /package/dist/client/assets/{chunk-AXZTUZBK-Cxfm7hmm.js → chunk-AXZTUZBK-DuMiJYO9.js} +0 -0
- /package/dist/client/assets/{chunk-SRAX5OIU-CC2mobFL.js → chunk-SRAX5OIU-CLVBQRWC.js} +0 -0
- /package/dist/client/assets/{clike-D5X7HJpo.js → clike-1_ZsiVV8.js} +0 -0
- /package/dist/client/assets/{clojure-BEDKZv_5.js → clojure-D-DYVqu7.js} +0 -0
- /package/dist/client/assets/{cmake-Y3shE7av.js → cmake-DtGL-Unu.js} +0 -0
- /package/dist/client/assets/{cobol-f-3TLk62.js → cobol-DP4QggbL.js} +0 -0
- /package/dist/client/assets/{coffeescript-C0XA9-xa.js → coffeescript-B_7eyHAa.js} +0 -0
- /package/dist/client/assets/{commonlisp-BOB6sIEu.js → commonlisp-COlJYiQT.js} +0 -0
- /package/dist/client/assets/{crystal-ByNgE_My.js → crystal-I_dE9xG-.js} +0 -0
- /package/dist/client/assets/{css-eaI-ENiR.js → css-CmhPNxBE.js} +0 -0
- /package/dist/client/assets/{cypher-CQ-dGGSi.js → cypher-DE6I2lIA.js} +0 -0
- /package/dist/client/assets/{cytoscape.esm-DBDRhUia.js → cytoscape.esm-Czjc507F.js} +0 -0
- /package/dist/client/assets/{d-D9pnu4Cr.js → d-BNkKjn0o.js} +0 -0
- /package/dist/client/assets/{defaultLocale-BWgun1yJ.js → defaultLocale-B_FbTTbl.js} +0 -0
- /package/dist/client/assets/{diff-z9q33Lo6.js → diff-BWuPUsEo.js} +0 -0
- /package/dist/client/assets/{dist-xO1ImhKz.js → dist-BU8uusJX.js} +0 -0
- /package/dist/client/assets/{dist-CsYRf4AV.js → dist-x7PIEmJu.js} +0 -0
- /package/dist/client/assets/{drawio-room-C592VDk7.js → drawio-room-DEivFyNV.js} +0 -0
- /package/dist/client/assets/{dtd-BDizf_te.js → dtd-C6brJFPg.js} +0 -0
- /package/dist/client/assets/{dylan-Bk__XCKW.js → dylan-Bft86ZSB.js} +0 -0
- /package/dist/client/assets/{ebnf-SzN4Kxtp.js → ebnf-D6ifG44A.js} +0 -0
- /package/dist/client/assets/{ecl-5ulxiKbt.js → ecl-M7Iek4lq.js} +0 -0
- /package/dist/client/assets/{eiffel-Bhoaqbb6.js → eiffel-DwxtewZF.js} +0 -0
- /package/dist/client/assets/{elm-C3je846J.js → elm-B1TncobV.js} +0 -0
- /package/dist/client/assets/{erlang-Cgk9SIAz.js → erlang-BDJZNtt8.js} +0 -0
- /package/dist/client/assets/{excalidraw-mermaid-stub-B_2dv3Ll.js → excalidraw-mermaid-stub-BZPU4ZhU.js} +0 -0
- /package/dist/client/assets/{fcl-dvkZwp9p.js → fcl-BWKK0S4-.js} +0 -0
- /package/dist/client/assets/{forth-DmfSa3jN.js → forth-nvhcMz63.js} +0 -0
- /package/dist/client/assets/{fortran-BsZAiNnN.js → fortran-BZID-z10.js} +0 -0
- /package/dist/client/assets/{gas-DBpKE9ut.js → gas-DjQsZDGE.js} +0 -0
- /package/dist/client/assets/{gherkin-CceEbBs7.js → gherkin-S0kHlzux.js} +0 -0
- /package/dist/client/assets/{groovy-CxJnDvES.js → groovy-BEKazBrO.js} +0 -0
- /package/dist/client/assets/{haskell-CUSb34Xy.js → haskell-C6qH3-aI.js} +0 -0
- /package/dist/client/assets/{haxe-6EHO_h-N.js → haxe-BY9d_5nB.js} +0 -0
- /package/dist/client/assets/{http-C3qcBpvG.js → http-DG1Y9fpK.js} +0 -0
- /package/dist/client/assets/{idl-C95wIO2I.js → idl-B64p3NTJ.js} +0 -0
- /package/dist/client/assets/{image-blob-reduce.esm-BaW4gpT9.js → image-blob-reduce.esm-DriR2zT9.js} +0 -0
- /package/dist/client/assets/{init-Bjj5fg68.js → init-DtLQcSuO.js} +0 -0
- /package/dist/client/assets/{isArrayLikeObject-Cmt1CYnI.js → isArrayLikeObject-BId_dPHM.js} +0 -0
- /package/dist/client/assets/{javascript-aWB87b1w.js → javascript-CdiVhQeA.js} +0 -0
- /package/dist/client/assets/{jsx-runtime-DiaMmmG6.js → jsx-runtime-C2p7wRmT.js} +0 -0
- /package/dist/client/assets/{julia-DF9PPAXG.js → julia-B22G9Bym.js} +0 -0
- /package/dist/client/assets/{katex-BPsFnA3D.js → katex-CXYULLWy.js} +0 -0
- /package/dist/client/assets/{livescript-CnOyWwUY.js → livescript-CkcuHqeS.js} +0 -0
- /package/dist/client/assets/{lua-a0rEq19C.js → lua-kutgyRGY.js} +0 -0
- /package/dist/client/assets/{math-BaavbII8.js → math-B-LMBwub.js} +0 -0
- /package/dist/client/assets/{mathematica-CKUq0Ojc.js → mathematica-CKVhKnoY.js} +0 -0
- /package/dist/client/assets/{mbox-a-u2PLog.js → mbox-DANyzFJ2.js} +0 -0
- /package/dist/client/assets/{mirc-BOd43sOX.js → mirc-BVG2S5rO.js} +0 -0
- /package/dist/client/assets/{mllike-fHruGivh.js → mllike-C0p7lv48.js} +0 -0
- /package/dist/client/assets/{modelica-B0NJqf1C.js → modelica-vJ-Qa9jV.js} +0 -0
- /package/dist/client/assets/{mscgen-DJZ33SrF.js → mscgen-vUD-SWGJ.js} +0 -0
- /package/dist/client/assets/{mumps-DvMvHTxU.js → mumps-D0KfUTSd.js} +0 -0
- /package/dist/client/assets/{nginx-BVAs8laz.js → nginx-DkVceJrH.js} +0 -0
- /package/dist/client/assets/{ntriples-DrdyAZU1.js → ntriples-BBuCIfS0.js} +0 -0
- /package/dist/client/assets/{octave-_YqJ0g7E.js → octave-BTv2CqSQ.js} +0 -0
- /package/dist/client/assets/{oz-k7T3LoMr.js → oz-D8SjVDNU.js} +0 -0
- /package/dist/client/assets/{pascal-CftsTvte.js → pascal-T-tfhVyx.js} +0 -0
- /package/dist/client/assets/{path-BUmMWM1-.js → path-DIlZIGue.js} +0 -0
- /package/dist/client/assets/{perl-CbsLFc7A.js → perl-BDrCkHRd.js} +0 -0
- /package/dist/client/assets/{pica-By-YDy_B.js → pica-C1TdTz-C.js} +0 -0
- /package/dist/client/assets/{pig-C-jTwMS-.js → pig-BEyI4fPq.js} +0 -0
- /package/dist/client/assets/{powershell-DqXLgSHX.js → powershell-DtnFc6GG.js} +0 -0
- /package/dist/client/assets/{preview-diagram-utils-Dc83ucbv.js → preview-diagram-utils-COt-IYMD.js} +0 -0
- /package/dist/client/assets/{preview-render-profile-DPzmho7I.js → preview-render-profile-CR4dJZrp.js} +0 -0
- /package/dist/client/assets/{properties-05jaw55P.js → properties-DWUvbxV9.js} +0 -0
- /package/dist/client/assets/{protobuf-DThTsZQN.js → protobuf-CQGoYyfE.js} +0 -0
- /package/dist/client/assets/{puppet-DuHxMpoj.js → puppet-Dd-qWO3p.js} +0 -0
- /package/dist/client/assets/{python-BiE2VHJI.js → python-CZtTmYkS.js} +0 -0
- /package/dist/client/assets/{q-DH46YfNw.js → q-I27iQntV.js} +0 -0
- /package/dist/client/assets/{r-DmEm46kJ.js → r-DN_EydfL.js} +0 -0
- /package/dist/client/assets/{rough.esm-jZQkcmER.js → rough.esm-DE_lJ5Ge.js} +0 -0
- /package/dist/client/assets/{roundRect-CI6UmGg6.js → roundRect-BzEouiv_.js} +0 -0
- /package/dist/client/assets/{rpm-DILIIbRB.js → rpm-CjWxLM68.js} +0 -0
- /package/dist/client/assets/{ruby-2LcnHEMS.js → ruby-CB34f2Gf.js} +0 -0
- /package/dist/client/assets/{runtime-config-CqX_f_Q4.js → runtime-config-CqhchMC4.js} +0 -0
- /package/dist/client/assets/{sas-Bn81MKuB.js → sas-Bji4HDQq.js} +0 -0
- /package/dist/client/assets/{scheme-B8kPNbgd.js → scheme-C3elI80V.js} +0 -0
- /package/dist/client/assets/{shell-CGj6v8kb.js → shell-DUveK2Hb.js} +0 -0
- /package/dist/client/assets/{sieve-CfVNFN1K.js → sieve-2ogwMVx4.js} +0 -0
- /package/dist/client/assets/{simple-mode-_FSHdiXs.js → simple-mode-pOKc0mfx.js} +0 -0
- /package/dist/client/assets/{smalltalk-BpIFyCPt.js → smalltalk-BuGhc6lW.js} +0 -0
- /package/dist/client/assets/{solr-B7iFaetn.js → solr-DTxshpm8.js} +0 -0
- /package/dist/client/assets/{sparql-COhgMTFK.js → sparql-BOvq0dv7.js} +0 -0
- /package/dist/client/assets/{spreadsheet-BzuffEeg.js → spreadsheet-C6Vbtl9-.js} +0 -0
- /package/dist/client/assets/{sql-13lT5zDl.js → sql-DDFeQNTK.js} +0 -0
- /package/dist/client/assets/{src-E3c2cohN.js → src-Pgt9Gp65.js} +0 -0
- /package/dist/client/assets/{stex-BRSfZZYG.js → stex-CEwW0Q_0.js} +0 -0
- /package/dist/client/assets/{stylus-fFo0QRk_.js → stylus-D1SZIMDs.js} +0 -0
- /package/dist/client/assets/{swift-wb5gyb6a.js → swift-BCxe4-cw.js} +0 -0
- /package/dist/client/assets/{tcl-BJA7GgWY.js → tcl-SPk7uiDB.js} +0 -0
- /package/dist/client/assets/{textile-BQjiYu-x.js → textile-C48beRus.js} +0 -0
- /package/dist/client/assets/{tiddlywiki-D2vUXB6n.js → tiddlywiki-CiImjFLN.js} +0 -0
- /package/dist/client/assets/{tiki-BFhpdznG.js → tiki-HkXZ4BIW.js} +0 -0
- /package/dist/client/assets/{toml-DN06iQUw.js → toml-BmfpMy1_.js} +0 -0
- /package/dist/client/assets/{troff-DuQfjhPH.js → troff-BjbEOT5E.js} +0 -0
- /package/dist/client/assets/{ttcn-BCTy6d50.js → ttcn-NA-V4KnY.js} +0 -0
- /package/dist/client/assets/{ttcn-cfg-BYnZQqGa.js → ttcn-cfg-TPHncdGN.js} +0 -0
- /package/dist/client/assets/{turtle-BvN-Me9x.js → turtle-GBz_E4RG.js} +0 -0
- /package/dist/client/assets/{vb-DYk3wW9u.js → vb-C19AQWqO.js} +0 -0
- /package/dist/client/assets/{vbscript-BKI61VS6.js → vbscript-CHJk3s95.js} +0 -0
- /package/dist/client/assets/{velocity-BrtitHHA.js → velocity-Ya0P4sQU.js} +0 -0
- /package/dist/client/assets/{verilog-CjUx3yiL.js → verilog-C4wTycyo.js} +0 -0
- /package/dist/client/assets/{vhdl-CPWwYF4V.js → vhdl-Bwndeg44.js} +0 -0
- /package/dist/client/assets/{webidl-PiVOzma8.js → webidl-DttrYZRT.js} +0 -0
- /package/dist/client/assets/{xquery-CiTzM_oK.js → xquery-CEDTd8qs.js} +0 -0
- /package/dist/client/assets/{yacas-4QS9CntY.js → yacas-C7dxlPB0.js} +0 -0
- /package/dist/client/assets/{yjs-provider-reset-guard-DWGhQClh.js → yjs-provider-reset-guard-CtERLBID.js} +0 -0
- /package/dist/client/assets/{z80-BxidrTKR.js → z80-BqEfFSnA.js} +0 -0
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
import { isImageAttachmentFilePath } from '../../../domain/file-kind.js';
|
|
2
|
+
|
|
3
|
+
function isPlainObject(value) {
|
|
4
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function normalizeVaultPathSegments(pathValue = '') {
|
|
8
|
+
return String(pathValue ?? '')
|
|
9
|
+
.replace(/\\/g, '/')
|
|
10
|
+
.split('/')
|
|
11
|
+
.filter(Boolean);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function resolveVaultRelativePath(fromFilePath, relativePath) {
|
|
15
|
+
const sourceSegments = normalizeVaultPathSegments(fromFilePath);
|
|
16
|
+
const targetSegments = String(relativePath ?? '')
|
|
17
|
+
.split('/')
|
|
18
|
+
.map((segment) => {
|
|
19
|
+
try {
|
|
20
|
+
return decodeURIComponent(segment);
|
|
21
|
+
} catch {
|
|
22
|
+
return segment;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (targetSegments.length === 0) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
sourceSegments.pop();
|
|
31
|
+
const resolvedSegments = [...sourceSegments];
|
|
32
|
+
|
|
33
|
+
for (const rawSegment of targetSegments) {
|
|
34
|
+
const segment = String(rawSegment ?? '').trim();
|
|
35
|
+
if (!segment || segment === '.') {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (segment === '..') {
|
|
40
|
+
if (resolvedSegments.length === 0) {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
resolvedSegments.pop();
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
resolvedSegments.push(segment);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return resolvedSegments.join('/');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createLinkValue(target, {
|
|
54
|
+
display = '',
|
|
55
|
+
exists = false,
|
|
56
|
+
external = false,
|
|
57
|
+
rawTarget = '',
|
|
58
|
+
} = {}) {
|
|
59
|
+
return {
|
|
60
|
+
__baseType: 'link',
|
|
61
|
+
display: display ? String(display) : '',
|
|
62
|
+
exists: Boolean(exists),
|
|
63
|
+
external: Boolean(external),
|
|
64
|
+
path: external ? '' : String(target ?? ''),
|
|
65
|
+
rawTarget: String(rawTarget || target || ''),
|
|
66
|
+
url: external ? String(target ?? '') : '',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function dedupeLinkValues(values = []) {
|
|
71
|
+
const seen = new Set();
|
|
72
|
+
return values.filter((value) => {
|
|
73
|
+
const key = value?.external
|
|
74
|
+
? `external:${value.url || value.rawTarget || value.display || ''}`
|
|
75
|
+
: `path:${value.path || value.rawTarget || value.display || ''}`;
|
|
76
|
+
if (!key || seen.has(key)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
seen.add(key);
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function createFormulaNamespace(row, evaluationState) {
|
|
85
|
+
return {
|
|
86
|
+
__baseType: 'formula-namespace',
|
|
87
|
+
evaluationState,
|
|
88
|
+
row,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function createContextFileValue(fileValue) {
|
|
93
|
+
return fileValue ?? null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function normalizeDuration(duration) {
|
|
97
|
+
const match = String(duration ?? '').trim().match(/^(-?\d+)\s*([smhdw])$/iu);
|
|
98
|
+
if (!match) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const amount = Number(match[1]);
|
|
103
|
+
const unit = match[2].toLowerCase();
|
|
104
|
+
const multiplier = {
|
|
105
|
+
d: 86_400_000,
|
|
106
|
+
h: 3_600_000,
|
|
107
|
+
m: 60_000,
|
|
108
|
+
s: 1_000,
|
|
109
|
+
w: 604_800_000,
|
|
110
|
+
}[unit];
|
|
111
|
+
return Number.isFinite(amount) && multiplier ? amount * multiplier : null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function parseDateValue(value) {
|
|
115
|
+
if (value instanceof Date) {
|
|
116
|
+
return Number.isFinite(value.getTime()) ? value : null;
|
|
117
|
+
}
|
|
118
|
+
if (typeof value === 'number') {
|
|
119
|
+
const date = new Date(value);
|
|
120
|
+
return Number.isFinite(date.getTime()) ? date : null;
|
|
121
|
+
}
|
|
122
|
+
if (typeof value !== 'string') {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const normalized = value.trim();
|
|
127
|
+
if (!normalized) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (/^\d{8}$/u.test(normalized)) {
|
|
132
|
+
return new Date(`${normalized.slice(0, 4)}-${normalized.slice(4, 6)}-${normalized.slice(6, 8)}T00:00:00`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (/^\d{8}\d{4}$/u.test(normalized)) {
|
|
136
|
+
return new Date(`${normalized.slice(0, 4)}-${normalized.slice(4, 6)}-${normalized.slice(6, 8)}T${normalized.slice(8, 10)}:${normalized.slice(10, 12)}:00`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const date = new Date(normalized);
|
|
140
|
+
return Number.isFinite(date.getTime()) ? date : null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isDateLikeString(value) {
|
|
144
|
+
if (typeof value !== 'string') {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const normalized = value.trim();
|
|
149
|
+
if (!normalized) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
/^\d{8}(?:\d{4})?$/u.test(normalized)
|
|
155
|
+
|| /^\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:\d{2})?)?$/u.test(normalized)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function coerceDateComparable(value) {
|
|
160
|
+
if (!isDateLikeString(value)) {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return parseDateValue(value) ?? value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function normalizeComparablePair(left, right) {
|
|
168
|
+
if (left instanceof Date || right instanceof Date) {
|
|
169
|
+
return [
|
|
170
|
+
left instanceof Date ? left : coerceDateComparable(left),
|
|
171
|
+
right instanceof Date ? right : coerceDateComparable(right),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (typeof left === 'string' && typeof right === 'string' && isDateLikeString(left) && isDateLikeString(right)) {
|
|
176
|
+
return [
|
|
177
|
+
parseDateValue(left) ?? left,
|
|
178
|
+
parseDateValue(right) ?? right,
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return [left, right];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function formatDateValue(value, format = 'YYYY-MM-DD') {
|
|
186
|
+
const date = parseDateValue(value);
|
|
187
|
+
if (!date) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const padded = (number) => String(number).padStart(2, '0');
|
|
192
|
+
return String(format ?? 'YYYY-MM-DD')
|
|
193
|
+
.replace(/YYYY/g, String(date.getFullYear()))
|
|
194
|
+
.replace(/MM/g, padded(date.getMonth() + 1))
|
|
195
|
+
.replace(/DD/g, padded(date.getDate()))
|
|
196
|
+
.replace(/HH/g, padded(date.getHours()))
|
|
197
|
+
.replace(/mm/g, padded(date.getMinutes()))
|
|
198
|
+
.replace(/ss/g, padded(date.getSeconds()));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function toComparableValue(value) {
|
|
202
|
+
if (value instanceof Date) {
|
|
203
|
+
return value.getTime();
|
|
204
|
+
}
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function toDisplayText(value) {
|
|
209
|
+
if (value == null) {
|
|
210
|
+
return '';
|
|
211
|
+
}
|
|
212
|
+
if (value instanceof Date) {
|
|
213
|
+
return formatDateValue(value, 'YYYY-MM-DD HH:mm:ss');
|
|
214
|
+
}
|
|
215
|
+
if (Array.isArray(value)) {
|
|
216
|
+
return value.map((entry) => toDisplayText(entry)).join(', ');
|
|
217
|
+
}
|
|
218
|
+
if (typeof value === 'boolean') {
|
|
219
|
+
return value ? 'true' : 'false';
|
|
220
|
+
}
|
|
221
|
+
if (typeof value === 'number') {
|
|
222
|
+
return Number.isFinite(value) ? String(value) : '';
|
|
223
|
+
}
|
|
224
|
+
if (value?.__baseType === 'file') {
|
|
225
|
+
return value.path || value.name || '';
|
|
226
|
+
}
|
|
227
|
+
if (value?.__baseType === 'link') {
|
|
228
|
+
return value.display || value.path || value.url || '';
|
|
229
|
+
}
|
|
230
|
+
if (isPlainObject(value)) {
|
|
231
|
+
try {
|
|
232
|
+
return JSON.stringify(value);
|
|
233
|
+
} catch {
|
|
234
|
+
return '[object Object]';
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return String(value);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function valuesEqual(left, right) {
|
|
241
|
+
const [normalizedLeft, normalizedRight] = normalizeComparablePair(left, right);
|
|
242
|
+
|
|
243
|
+
left = normalizedLeft;
|
|
244
|
+
right = normalizedRight;
|
|
245
|
+
|
|
246
|
+
if (left?.__baseType === 'file' && right?.__baseType === 'file') {
|
|
247
|
+
return left.path === right.path;
|
|
248
|
+
}
|
|
249
|
+
if (left?.__baseType === 'link' && right?.__baseType === 'link') {
|
|
250
|
+
return left.url === right.url && left.path === right.path;
|
|
251
|
+
}
|
|
252
|
+
if (left instanceof Date || right instanceof Date) {
|
|
253
|
+
return toComparableValue(left) === toComparableValue(right);
|
|
254
|
+
}
|
|
255
|
+
return left === right;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function resolveImageAttachmentPath(value, {
|
|
259
|
+
rowFilePath = '',
|
|
260
|
+
snapshot = null,
|
|
261
|
+
sourcePath = '',
|
|
262
|
+
} = {}) {
|
|
263
|
+
const text = String(value ?? '').trim();
|
|
264
|
+
const rowsByPath = snapshot?.rowsByPath;
|
|
265
|
+
if (!text || !rowsByPath) {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const candidates = [];
|
|
270
|
+
const seen = new Set();
|
|
271
|
+
const appendCandidate = (candidate) => {
|
|
272
|
+
const normalized = String(candidate ?? '').trim().replace(/\\/g, '/');
|
|
273
|
+
if (!normalized || seen.has(normalized)) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
seen.add(normalized);
|
|
277
|
+
candidates.push(normalized);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
if (rowFilePath) {
|
|
281
|
+
appendCandidate(resolveVaultRelativePath(rowFilePath, text));
|
|
282
|
+
}
|
|
283
|
+
if (sourcePath) {
|
|
284
|
+
appendCandidate(resolveVaultRelativePath(sourcePath, text));
|
|
285
|
+
}
|
|
286
|
+
appendCandidate(text);
|
|
287
|
+
|
|
288
|
+
return candidates.find((candidate) => (
|
|
289
|
+
isImageAttachmentFilePath(candidate)
|
|
290
|
+
&& rowsByPath.has(candidate)
|
|
291
|
+
)) ?? null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function serializeBaseValue(value, options = {}) {
|
|
295
|
+
if (value == null || value === '') {
|
|
296
|
+
return { text: '', type: 'empty', value: null };
|
|
297
|
+
}
|
|
298
|
+
if (value instanceof Date) {
|
|
299
|
+
return {
|
|
300
|
+
iso: value.toISOString(),
|
|
301
|
+
text: formatDateValue(value, 'YYYY-MM-DD HH:mm:ss'),
|
|
302
|
+
type: 'date',
|
|
303
|
+
value: value.toISOString(),
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
if (Array.isArray(value)) {
|
|
307
|
+
return {
|
|
308
|
+
items: value.map((entry) => serializeBaseValue(entry, options)),
|
|
309
|
+
text: toDisplayText(value),
|
|
310
|
+
type: 'list',
|
|
311
|
+
value: value.map((entry) => toDisplayText(entry)),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (value?.__baseType === 'file') {
|
|
315
|
+
return {
|
|
316
|
+
path: value.path,
|
|
317
|
+
text: value.path,
|
|
318
|
+
type: 'file',
|
|
319
|
+
value: value.path,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (value?.__baseType === 'link') {
|
|
323
|
+
return {
|
|
324
|
+
external: value.external,
|
|
325
|
+
path: value.path,
|
|
326
|
+
text: value.display || value.path || value.url,
|
|
327
|
+
type: 'link',
|
|
328
|
+
url: value.url,
|
|
329
|
+
value: value.display || value.path || value.url,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
if (typeof value === 'boolean') {
|
|
333
|
+
return { text: value ? 'true' : 'false', type: 'boolean', value };
|
|
334
|
+
}
|
|
335
|
+
if (typeof value === 'number') {
|
|
336
|
+
return { text: Number.isFinite(value) ? String(value) : '', type: 'number', value };
|
|
337
|
+
}
|
|
338
|
+
if (typeof value === 'string') {
|
|
339
|
+
const imagePath = resolveImageAttachmentPath(value, options);
|
|
340
|
+
if (imagePath) {
|
|
341
|
+
return {
|
|
342
|
+
path: imagePath,
|
|
343
|
+
text: value,
|
|
344
|
+
type: 'image',
|
|
345
|
+
value: imagePath,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
return { text: value, type: 'string', value };
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
text: toDisplayText(value),
|
|
352
|
+
type: 'object',
|
|
353
|
+
value,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export function compareValues(left, right) {
|
|
358
|
+
const [normalizedLeft, normalizedRight] = normalizeComparablePair(left, right);
|
|
359
|
+
left = normalizedLeft;
|
|
360
|
+
right = normalizedRight;
|
|
361
|
+
|
|
362
|
+
const comparableLeft = toComparableValue(left);
|
|
363
|
+
const comparableRight = toComparableValue(right);
|
|
364
|
+
if (comparableLeft == null && comparableRight == null) return 0;
|
|
365
|
+
if (comparableLeft == null) return 1;
|
|
366
|
+
if (comparableRight == null) return -1;
|
|
367
|
+
if (typeof comparableLeft === 'number' && typeof comparableRight === 'number') {
|
|
368
|
+
return comparableLeft - comparableRight;
|
|
369
|
+
}
|
|
370
|
+
return String(toDisplayText(comparableLeft)).localeCompare(String(toDisplayText(comparableRight)), undefined, { sensitivity: 'base' });
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function applyBinaryOperator(operator, left, right) {
|
|
374
|
+
if (operator === '&&') {
|
|
375
|
+
return Boolean(left) && Boolean(right);
|
|
376
|
+
}
|
|
377
|
+
if (operator === '||') {
|
|
378
|
+
return Boolean(left) || Boolean(right);
|
|
379
|
+
}
|
|
380
|
+
if (operator === '==') {
|
|
381
|
+
return valuesEqual(left, right);
|
|
382
|
+
}
|
|
383
|
+
if (operator === '!=') {
|
|
384
|
+
return !valuesEqual(left, right);
|
|
385
|
+
}
|
|
386
|
+
if (operator === '<') {
|
|
387
|
+
return compareValues(left, right) < 0;
|
|
388
|
+
}
|
|
389
|
+
if (operator === '<=') {
|
|
390
|
+
return compareValues(left, right) <= 0;
|
|
391
|
+
}
|
|
392
|
+
if (operator === '>') {
|
|
393
|
+
return compareValues(left, right) > 0;
|
|
394
|
+
}
|
|
395
|
+
if (operator === '>=') {
|
|
396
|
+
return compareValues(left, right) >= 0;
|
|
397
|
+
}
|
|
398
|
+
if (operator === '+') {
|
|
399
|
+
if (left instanceof Date && typeof right === 'string') {
|
|
400
|
+
const duration = normalizeDuration(right);
|
|
401
|
+
return duration == null ? left : new Date(left.getTime() + duration);
|
|
402
|
+
}
|
|
403
|
+
if (typeof left === 'string' || typeof right === 'string') {
|
|
404
|
+
return `${toDisplayText(left)}${toDisplayText(right)}`;
|
|
405
|
+
}
|
|
406
|
+
return Number(left ?? 0) + Number(right ?? 0);
|
|
407
|
+
}
|
|
408
|
+
if (operator === '-') {
|
|
409
|
+
if (left instanceof Date && typeof right === 'string') {
|
|
410
|
+
const duration = normalizeDuration(right);
|
|
411
|
+
return duration == null ? left : new Date(left.getTime() - duration);
|
|
412
|
+
}
|
|
413
|
+
if (left instanceof Date && right instanceof Date) {
|
|
414
|
+
return left.getTime() - right.getTime();
|
|
415
|
+
}
|
|
416
|
+
return Number(left ?? 0) - Number(right ?? 0);
|
|
417
|
+
}
|
|
418
|
+
if (operator === '*') {
|
|
419
|
+
return Number(left ?? 0) * Number(right ?? 0);
|
|
420
|
+
}
|
|
421
|
+
if (operator === '/') {
|
|
422
|
+
return Number(right ?? 0) === 0 ? null : Number(left ?? 0) / Number(right ?? 0);
|
|
423
|
+
}
|
|
424
|
+
if (operator === '%') {
|
|
425
|
+
return Number(right ?? 0) === 0 ? null : Number(left ?? 0) % Number(right ?? 0);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
throw new Error(`Unsupported operator: ${operator}`);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function invokeGlobalFunction(name, argNodes, scope, evaluate) {
|
|
432
|
+
if (name === 'if') {
|
|
433
|
+
const condition = evaluate(argNodes[0], scope);
|
|
434
|
+
return condition ? evaluate(argNodes[1], scope) : evaluate(argNodes[2], scope);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const args = argNodes.map((node) => evaluate(node, scope));
|
|
438
|
+
switch (name) {
|
|
439
|
+
case 'date':
|
|
440
|
+
return parseDateValue(args[0]);
|
|
441
|
+
case 'link': {
|
|
442
|
+
const target = String(args[0] ?? '').trim();
|
|
443
|
+
if (!target) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
const external = /^[a-z]+:/iu.test(target);
|
|
447
|
+
return createLinkValue(target, {
|
|
448
|
+
display: typeof args[1] === 'string' ? args[1] : '',
|
|
449
|
+
exists: external,
|
|
450
|
+
external,
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
case 'list':
|
|
454
|
+
return args;
|
|
455
|
+
case 'max':
|
|
456
|
+
return args.flat().reduce((acc, value) => (acc == null || compareValues(value, acc) > 0 ? value : acc), null);
|
|
457
|
+
case 'min':
|
|
458
|
+
return args.flat().reduce((acc, value) => (acc == null || compareValues(value, acc) < 0 ? value : acc), null);
|
|
459
|
+
case 'now':
|
|
460
|
+
return new Date();
|
|
461
|
+
case 'today': {
|
|
462
|
+
const date = new Date();
|
|
463
|
+
date.setHours(0, 0, 0, 0);
|
|
464
|
+
return date;
|
|
465
|
+
}
|
|
466
|
+
default:
|
|
467
|
+
throw new Error(`Unknown function: ${name}`);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function invokeMethod(target, name, argNodes, scope, evaluate, rootContext) {
|
|
472
|
+
if (target?.__baseType === 'formula-namespace') {
|
|
473
|
+
if (argNodes.length > 0) {
|
|
474
|
+
throw new Error(`Formula namespace property "${name}" is not callable`);
|
|
475
|
+
}
|
|
476
|
+
return rootContext.resolveFormulaValue(name, target.row, target.evaluationState);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (Array.isArray(target)) {
|
|
480
|
+
if (name === 'contains') {
|
|
481
|
+
const needle = evaluate(argNodes[0], scope);
|
|
482
|
+
return target.some((entry) => valuesEqual(entry, needle));
|
|
483
|
+
}
|
|
484
|
+
if (name === 'containsAll') {
|
|
485
|
+
return argNodes.every((node) => target.some((entry) => valuesEqual(entry, evaluate(node, scope))));
|
|
486
|
+
}
|
|
487
|
+
if (name === 'containsAny') {
|
|
488
|
+
return argNodes.some((node) => target.some((entry) => valuesEqual(entry, evaluate(node, scope))));
|
|
489
|
+
}
|
|
490
|
+
if (name === 'filter') {
|
|
491
|
+
const predicate = argNodes[0];
|
|
492
|
+
return target.filter((value, index) => Boolean(evaluate(predicate, scope.child({ index, value }))));
|
|
493
|
+
}
|
|
494
|
+
if (name === 'flat') {
|
|
495
|
+
return target.flat();
|
|
496
|
+
}
|
|
497
|
+
if (name === 'isEmpty') {
|
|
498
|
+
return target.length === 0;
|
|
499
|
+
}
|
|
500
|
+
if (name === 'join') {
|
|
501
|
+
return target.map((entry) => toDisplayText(entry)).join(String(evaluate(argNodes[0], scope) ?? ''));
|
|
502
|
+
}
|
|
503
|
+
if (name === 'map') {
|
|
504
|
+
const mapper = argNodes[0];
|
|
505
|
+
return target.map((value, index) => evaluate(mapper, scope.child({ index, value })));
|
|
506
|
+
}
|
|
507
|
+
if (name === 'reduce') {
|
|
508
|
+
const reducer = argNodes[0];
|
|
509
|
+
let accumulator = argNodes.length > 1 ? evaluate(argNodes[1], scope) : null;
|
|
510
|
+
target.forEach((value, index) => {
|
|
511
|
+
accumulator = evaluate(reducer, scope.child({ acc: accumulator, index, value }));
|
|
512
|
+
});
|
|
513
|
+
return accumulator;
|
|
514
|
+
}
|
|
515
|
+
if (name === 'reverse') {
|
|
516
|
+
return [...target].reverse();
|
|
517
|
+
}
|
|
518
|
+
if (name === 'slice') {
|
|
519
|
+
return target.slice(Number(evaluate(argNodes[0], scope) ?? 0), argNodes[1] ? Number(evaluate(argNodes[1], scope)) : undefined);
|
|
520
|
+
}
|
|
521
|
+
if (name === 'sort') {
|
|
522
|
+
return [...target].sort(compareValues);
|
|
523
|
+
}
|
|
524
|
+
if (name === 'unique') {
|
|
525
|
+
const uniqueValues = [];
|
|
526
|
+
target.forEach((value) => {
|
|
527
|
+
if (!uniqueValues.some((entry) => valuesEqual(entry, value))) {
|
|
528
|
+
uniqueValues.push(value);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
return uniqueValues;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (typeof target === 'string') {
|
|
536
|
+
switch (name) {
|
|
537
|
+
case 'contains':
|
|
538
|
+
return target.toLowerCase().includes(String(evaluate(argNodes[0], scope) ?? '').toLowerCase());
|
|
539
|
+
case 'endsWith':
|
|
540
|
+
return target.endsWith(String(evaluate(argNodes[0], scope) ?? ''));
|
|
541
|
+
case 'isEmpty':
|
|
542
|
+
return target.length === 0;
|
|
543
|
+
case 'lower':
|
|
544
|
+
return target.toLowerCase();
|
|
545
|
+
case 'replace':
|
|
546
|
+
return target.replaceAll(String(evaluate(argNodes[0], scope) ?? ''), String(evaluate(argNodes[1], scope) ?? ''));
|
|
547
|
+
case 'split':
|
|
548
|
+
return target.split(String(evaluate(argNodes[0], scope) ?? ''));
|
|
549
|
+
case 'startsWith':
|
|
550
|
+
return target.startsWith(String(evaluate(argNodes[0], scope) ?? ''));
|
|
551
|
+
case 'title':
|
|
552
|
+
return target.replace(/\b\p{L}/gu, (match) => match.toUpperCase());
|
|
553
|
+
case 'trim':
|
|
554
|
+
return target.trim();
|
|
555
|
+
case 'upper':
|
|
556
|
+
return target.toUpperCase();
|
|
557
|
+
default:
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if (typeof target === 'number') {
|
|
563
|
+
switch (name) {
|
|
564
|
+
case 'ceil':
|
|
565
|
+
return Math.ceil(target);
|
|
566
|
+
case 'floor':
|
|
567
|
+
return Math.floor(target);
|
|
568
|
+
case 'isEmpty':
|
|
569
|
+
return false;
|
|
570
|
+
case 'round':
|
|
571
|
+
return Number.isFinite(evaluate(argNodes[0], scope))
|
|
572
|
+
? Number(target.toFixed(Number(evaluate(argNodes[0], scope))))
|
|
573
|
+
: Math.round(target);
|
|
574
|
+
case 'toFixed':
|
|
575
|
+
return target.toFixed(Number(evaluate(argNodes[0], scope) ?? 0));
|
|
576
|
+
default:
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const asDate = parseDateValue(target);
|
|
582
|
+
if (asDate) {
|
|
583
|
+
switch (name) {
|
|
584
|
+
case 'format':
|
|
585
|
+
return formatDateValue(asDate, String(evaluate(argNodes[0], scope) ?? 'YYYY-MM-DD'));
|
|
586
|
+
case 'isEmpty':
|
|
587
|
+
return false;
|
|
588
|
+
default:
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if (target?.__baseType === 'file') {
|
|
594
|
+
switch (name) {
|
|
595
|
+
case 'asLink':
|
|
596
|
+
return createLinkValue(target.path, {
|
|
597
|
+
display: typeof evaluate(argNodes[0], scope) === 'string' ? evaluate(argNodes[0], scope) : '',
|
|
598
|
+
exists: true,
|
|
599
|
+
});
|
|
600
|
+
case 'hasLink': {
|
|
601
|
+
const needle = evaluate(argNodes[0], scope);
|
|
602
|
+
const needlePath = needle?.__baseType === 'file'
|
|
603
|
+
? needle.path
|
|
604
|
+
: (needle?.__baseType === 'link' ? needle.path : String(needle ?? ''));
|
|
605
|
+
return target.links.some((link) => link.path === needlePath || link.rawTarget === needlePath);
|
|
606
|
+
}
|
|
607
|
+
case 'hasProperty':
|
|
608
|
+
return Object.hasOwn(target.properties, String(evaluate(argNodes[0], scope) ?? ''));
|
|
609
|
+
case 'hasTag':
|
|
610
|
+
return argNodes.some((node) => {
|
|
611
|
+
const value = String(evaluate(node, scope) ?? '').replace(/^#/u, '');
|
|
612
|
+
return target.tags.some((tag) => tag === value || tag.startsWith(`${value}/`));
|
|
613
|
+
});
|
|
614
|
+
case 'inFolder': {
|
|
615
|
+
const folder = String(evaluate(argNodes[0], scope) ?? '').replace(/\/+$/u, '');
|
|
616
|
+
return !folder || target.folder === folder || target.folder.startsWith(`${folder}/`);
|
|
617
|
+
}
|
|
618
|
+
default:
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
if (target?.__baseType === 'link') {
|
|
624
|
+
switch (name) {
|
|
625
|
+
case 'asFile':
|
|
626
|
+
return target.path ? rootContext.snapshot.rowsByPath.get(target.path)?.file ?? null : null;
|
|
627
|
+
case 'linksTo': {
|
|
628
|
+
const other = evaluate(argNodes[0], scope);
|
|
629
|
+
const otherPath = other?.__baseType === 'file'
|
|
630
|
+
? other.path
|
|
631
|
+
: (other?.__baseType === 'link' ? other.path : String(other ?? ''));
|
|
632
|
+
return target.path === otherPath;
|
|
633
|
+
}
|
|
634
|
+
default:
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
if (isPlainObject(target)) {
|
|
640
|
+
switch (name) {
|
|
641
|
+
case 'isEmpty':
|
|
642
|
+
return Object.keys(target).length === 0;
|
|
643
|
+
case 'keys':
|
|
644
|
+
return Object.keys(target);
|
|
645
|
+
case 'values':
|
|
646
|
+
return Object.values(target);
|
|
647
|
+
default:
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
throw new Error(`Unsupported method "${name}"`);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function tokenizeExpression(source = '') {
|
|
656
|
+
const tokens = [];
|
|
657
|
+
const text = String(source ?? '');
|
|
658
|
+
let index = 0;
|
|
659
|
+
|
|
660
|
+
while (index < text.length) {
|
|
661
|
+
const character = text[index];
|
|
662
|
+
if (/\s/u.test(character)) {
|
|
663
|
+
index += 1;
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const twoChar = text.slice(index, index + 2);
|
|
668
|
+
const threeChar = text.slice(index, index + 3);
|
|
669
|
+
if (['&&', '||', '==', '!=', '<=', '>='].includes(twoChar)) {
|
|
670
|
+
tokens.push({ type: 'operator', value: twoChar });
|
|
671
|
+
index += 2;
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if (threeChar === '...') {
|
|
675
|
+
tokens.push({ type: 'operator', value: threeChar });
|
|
676
|
+
index += 3;
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
if ('+-*/%!<>()[]{}.,:'.includes(character)) {
|
|
680
|
+
tokens.push({
|
|
681
|
+
type: '()[]{}.,:'.includes(character) ? 'punctuation' : 'operator',
|
|
682
|
+
value: character,
|
|
683
|
+
});
|
|
684
|
+
index += 1;
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
if (character === '"' || character === '\'') {
|
|
688
|
+
let value = '';
|
|
689
|
+
let cursor = index + 1;
|
|
690
|
+
while (cursor < text.length) {
|
|
691
|
+
const nextCharacter = text[cursor];
|
|
692
|
+
if (nextCharacter === '\\') {
|
|
693
|
+
const escaped = text[cursor + 1] ?? '';
|
|
694
|
+
value += escaped;
|
|
695
|
+
cursor += 2;
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
if (nextCharacter === character) {
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
value += nextCharacter;
|
|
702
|
+
cursor += 1;
|
|
703
|
+
}
|
|
704
|
+
if (text[cursor] !== character) {
|
|
705
|
+
throw new Error(`Unterminated string in expression: ${source}`);
|
|
706
|
+
}
|
|
707
|
+
tokens.push({ type: 'string', value });
|
|
708
|
+
index = cursor + 1;
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
if (/\d/u.test(character)) {
|
|
712
|
+
let cursor = index + 1;
|
|
713
|
+
while (cursor < text.length && /[\d.]/u.test(text[cursor])) {
|
|
714
|
+
cursor += 1;
|
|
715
|
+
}
|
|
716
|
+
tokens.push({ type: 'number', value: text.slice(index, cursor) });
|
|
717
|
+
index = cursor;
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
if (/[A-Za-z_$]/u.test(character)) {
|
|
721
|
+
let cursor = index + 1;
|
|
722
|
+
while (cursor < text.length && /[A-Za-z0-9_$]/u.test(text[cursor])) {
|
|
723
|
+
cursor += 1;
|
|
724
|
+
}
|
|
725
|
+
tokens.push({ type: 'identifier', value: text.slice(index, cursor) });
|
|
726
|
+
index = cursor;
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
throw new Error(`Unexpected token "${character}" in expression: ${source}`);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
return tokens;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
const BINARY_PRECEDENCE = {
|
|
737
|
+
'||': 1,
|
|
738
|
+
'&&': 2,
|
|
739
|
+
'==': 3,
|
|
740
|
+
'!=': 3,
|
|
741
|
+
'<': 4,
|
|
742
|
+
'<=': 4,
|
|
743
|
+
'>': 4,
|
|
744
|
+
'>=': 4,
|
|
745
|
+
'+': 5,
|
|
746
|
+
'-': 5,
|
|
747
|
+
'*': 6,
|
|
748
|
+
'/': 6,
|
|
749
|
+
'%': 6,
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
function parseExpression(source = '') {
|
|
753
|
+
const tokens = tokenizeExpression(source);
|
|
754
|
+
let index = 0;
|
|
755
|
+
|
|
756
|
+
const peek = () => tokens[index] ?? null;
|
|
757
|
+
const consume = (expectedValue = null) => {
|
|
758
|
+
const token = tokens[index] ?? null;
|
|
759
|
+
if (!token) {
|
|
760
|
+
throw new Error(`Unexpected end of expression: ${source}`);
|
|
761
|
+
}
|
|
762
|
+
if (expectedValue !== null && token.value !== expectedValue) {
|
|
763
|
+
throw new Error(`Expected "${expectedValue}" in expression: ${source}`);
|
|
764
|
+
}
|
|
765
|
+
index += 1;
|
|
766
|
+
return token;
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
const parsePrimary = () => {
|
|
770
|
+
const token = peek();
|
|
771
|
+
if (!token) {
|
|
772
|
+
throw new Error(`Unexpected end of expression: ${source}`);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (token.type === 'number') {
|
|
776
|
+
consume();
|
|
777
|
+
return { type: 'Literal', value: Number(token.value) };
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
if (token.type === 'string') {
|
|
781
|
+
consume();
|
|
782
|
+
return { type: 'Literal', value: token.value };
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
if (token.type === 'identifier') {
|
|
786
|
+
consume();
|
|
787
|
+
if (token.value === 'true') return { type: 'Literal', value: true };
|
|
788
|
+
if (token.value === 'false') return { type: 'Literal', value: false };
|
|
789
|
+
if (token.value === 'null') return { type: 'Literal', value: null };
|
|
790
|
+
return { name: token.value, type: 'Identifier' };
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
if (token.value === '(') {
|
|
794
|
+
consume('(');
|
|
795
|
+
const expression = parseBinaryExpression(0);
|
|
796
|
+
consume(')');
|
|
797
|
+
return expression;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (token.value === '[') {
|
|
801
|
+
consume('[');
|
|
802
|
+
const elements = [];
|
|
803
|
+
while (peek() && peek().value !== ']') {
|
|
804
|
+
elements.push(parseBinaryExpression(0));
|
|
805
|
+
if (peek()?.value === ',') {
|
|
806
|
+
consume(',');
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
consume(']');
|
|
810
|
+
return { elements, type: 'ArrayExpression' };
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if (token.value === '{') {
|
|
814
|
+
consume('{');
|
|
815
|
+
const properties = [];
|
|
816
|
+
while (peek() && peek().value !== '}') {
|
|
817
|
+
const keyToken = consume();
|
|
818
|
+
const key = keyToken.type === 'identifier' ? keyToken.value : String(keyToken.value ?? '');
|
|
819
|
+
consume(':');
|
|
820
|
+
properties.push({ key, value: parseBinaryExpression(0) });
|
|
821
|
+
if (peek()?.value === ',') {
|
|
822
|
+
consume(',');
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
consume('}');
|
|
826
|
+
return { properties, type: 'ObjectExpression' };
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
throw new Error(`Unexpected token "${token.value}" in expression: ${source}`);
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
const parsePostfix = (baseNode) => {
|
|
833
|
+
let node = baseNode;
|
|
834
|
+
while (peek()) {
|
|
835
|
+
if (peek().value === '.') {
|
|
836
|
+
consume('.');
|
|
837
|
+
const property = consume();
|
|
838
|
+
if (property.type !== 'identifier') {
|
|
839
|
+
throw new Error(`Expected property name in expression: ${source}`);
|
|
840
|
+
}
|
|
841
|
+
node = {
|
|
842
|
+
computed: false,
|
|
843
|
+
object: node,
|
|
844
|
+
property: { name: property.value, type: 'Identifier' },
|
|
845
|
+
type: 'MemberExpression',
|
|
846
|
+
};
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
if (peek().value === '[') {
|
|
851
|
+
consume('[');
|
|
852
|
+
const property = parseBinaryExpression(0);
|
|
853
|
+
consume(']');
|
|
854
|
+
node = {
|
|
855
|
+
computed: true,
|
|
856
|
+
object: node,
|
|
857
|
+
property,
|
|
858
|
+
type: 'MemberExpression',
|
|
859
|
+
};
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if (peek().value === '(') {
|
|
864
|
+
consume('(');
|
|
865
|
+
const args = [];
|
|
866
|
+
while (peek() && peek().value !== ')') {
|
|
867
|
+
args.push(parseBinaryExpression(0));
|
|
868
|
+
if (peek()?.value === ',') {
|
|
869
|
+
consume(',');
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
consume(')');
|
|
873
|
+
node = {
|
|
874
|
+
arguments: args,
|
|
875
|
+
callee: node,
|
|
876
|
+
type: 'CallExpression',
|
|
877
|
+
};
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
return node;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
const parseUnary = () => {
|
|
887
|
+
const token = peek();
|
|
888
|
+
if (token?.type === 'operator' && ['!', '-'].includes(token.value)) {
|
|
889
|
+
consume();
|
|
890
|
+
return {
|
|
891
|
+
argument: parseUnary(),
|
|
892
|
+
operator: token.value,
|
|
893
|
+
type: 'UnaryExpression',
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
return parsePostfix(parsePrimary());
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
const parseBinaryExpression = (minimumPrecedence) => {
|
|
901
|
+
let left = parseUnary();
|
|
902
|
+
while (true) {
|
|
903
|
+
const operator = peek();
|
|
904
|
+
const precedence = operator ? BINARY_PRECEDENCE[operator.value] : null;
|
|
905
|
+
if (!precedence || precedence < minimumPrecedence) {
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
consume();
|
|
910
|
+
const right = parseBinaryExpression(precedence + 1);
|
|
911
|
+
left = {
|
|
912
|
+
left,
|
|
913
|
+
operator: operator.value,
|
|
914
|
+
right,
|
|
915
|
+
type: 'BinaryExpression',
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
return left;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
const ast = parseBinaryExpression(0);
|
|
922
|
+
if (index < tokens.length) {
|
|
923
|
+
throw new Error(`Unexpected token "${tokens[index].value}" in expression: ${source}`);
|
|
924
|
+
}
|
|
925
|
+
return ast;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
class ExpressionScope {
|
|
929
|
+
constructor({ locals = {}, parent = null, rootContext }) {
|
|
930
|
+
this.locals = locals;
|
|
931
|
+
this.parent = parent;
|
|
932
|
+
this.rootContext = rootContext;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
child(locals = {}) {
|
|
936
|
+
return new ExpressionScope({
|
|
937
|
+
locals,
|
|
938
|
+
parent: this,
|
|
939
|
+
rootContext: this.rootContext,
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
get(name) {
|
|
944
|
+
if (Object.hasOwn(this.locals, name)) {
|
|
945
|
+
return this.locals[name];
|
|
946
|
+
}
|
|
947
|
+
if (this.parent) {
|
|
948
|
+
return this.parent.get(name);
|
|
949
|
+
}
|
|
950
|
+
return this.rootContext.resolveIdentifier(name);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function evaluateAst(ast, scope) {
|
|
955
|
+
const rootContext = scope.rootContext;
|
|
956
|
+
const evaluate = (node, nextScope = scope) => evaluateAst(node, nextScope);
|
|
957
|
+
|
|
958
|
+
switch (ast?.type) {
|
|
959
|
+
case 'ArrayExpression':
|
|
960
|
+
return ast.elements.map((element) => evaluate(element, scope));
|
|
961
|
+
case 'BinaryExpression':
|
|
962
|
+
return applyBinaryOperator(ast.operator, evaluate(ast.left, scope), evaluate(ast.right, scope));
|
|
963
|
+
case 'CallExpression': {
|
|
964
|
+
if (ast.callee?.type === 'Identifier') {
|
|
965
|
+
return invokeGlobalFunction(ast.callee.name, ast.arguments, scope, evaluate);
|
|
966
|
+
}
|
|
967
|
+
if (ast.callee?.type === 'MemberExpression') {
|
|
968
|
+
const target = evaluate(ast.callee.object, scope);
|
|
969
|
+
const property = ast.callee.computed
|
|
970
|
+
? evaluate(ast.callee.property, scope)
|
|
971
|
+
: ast.callee.property.name;
|
|
972
|
+
return invokeMethod(target, String(property ?? ''), ast.arguments, scope, evaluate, rootContext);
|
|
973
|
+
}
|
|
974
|
+
throw new Error('Unsupported call target');
|
|
975
|
+
}
|
|
976
|
+
case 'Identifier':
|
|
977
|
+
return scope.get(ast.name);
|
|
978
|
+
case 'Literal':
|
|
979
|
+
return ast.value;
|
|
980
|
+
case 'MemberExpression': {
|
|
981
|
+
const target = evaluate(ast.object, scope);
|
|
982
|
+
const property = ast.computed ? evaluate(ast.property, scope) : ast.property.name;
|
|
983
|
+
if (target?.__baseType === 'formula-namespace') {
|
|
984
|
+
return rootContext.resolveFormulaValue(String(property ?? ''), target.row, target.evaluationState);
|
|
985
|
+
}
|
|
986
|
+
if (target == null) {
|
|
987
|
+
return null;
|
|
988
|
+
}
|
|
989
|
+
return target[property];
|
|
990
|
+
}
|
|
991
|
+
case 'ObjectExpression':
|
|
992
|
+
return ast.properties.reduce((acc, property) => {
|
|
993
|
+
acc[property.key] = evaluate(property.value, scope);
|
|
994
|
+
return acc;
|
|
995
|
+
}, {});
|
|
996
|
+
case 'UnaryExpression': {
|
|
997
|
+
const value = evaluate(ast.argument, scope);
|
|
998
|
+
return ast.operator === '!' ? !value : -Number(value ?? 0);
|
|
999
|
+
}
|
|
1000
|
+
default:
|
|
1001
|
+
throw new Error(`Unsupported expression node "${ast?.type}"`);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
export function evaluateExpression(expressionSource, rootContext, locals = {}) {
|
|
1006
|
+
const cache = rootContext.astCache;
|
|
1007
|
+
let ast = cache.get(expressionSource);
|
|
1008
|
+
if (!ast) {
|
|
1009
|
+
ast = parseExpression(expressionSource);
|
|
1010
|
+
cache.set(expressionSource, ast);
|
|
1011
|
+
}
|
|
1012
|
+
const scope = new ExpressionScope({ locals, rootContext });
|
|
1013
|
+
return evaluateAst(ast, scope);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
export function evaluateFilterNode(filterNode, rootContext) {
|
|
1017
|
+
if (!filterNode) {
|
|
1018
|
+
return true;
|
|
1019
|
+
}
|
|
1020
|
+
if (typeof filterNode === 'string') {
|
|
1021
|
+
return Boolean(evaluateExpression(filterNode, rootContext));
|
|
1022
|
+
}
|
|
1023
|
+
if (!isPlainObject(filterNode)) {
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if (Array.isArray(filterNode.and)) {
|
|
1028
|
+
return filterNode.and.every((entry) => evaluateFilterNode(entry, rootContext));
|
|
1029
|
+
}
|
|
1030
|
+
if (Array.isArray(filterNode.or)) {
|
|
1031
|
+
return filterNode.or.some((entry) => evaluateFilterNode(entry, rootContext));
|
|
1032
|
+
}
|
|
1033
|
+
if (filterNode.not != null) {
|
|
1034
|
+
return !evaluateFilterNode(filterNode.not, rootContext);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
return true;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
function normalizeFormulaLookupName(name = '') {
|
|
1041
|
+
return String(name ?? '').replace(/^formula\./u, '');
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
export function createEvaluationRootContext({
|
|
1045
|
+
astCache = new Map(),
|
|
1046
|
+
currentRow,
|
|
1047
|
+
definition,
|
|
1048
|
+
evaluationState = null,
|
|
1049
|
+
identifierResolver = null,
|
|
1050
|
+
snapshot,
|
|
1051
|
+
thisFile,
|
|
1052
|
+
}) {
|
|
1053
|
+
const nextEvaluationState = evaluationState ?? {
|
|
1054
|
+
cache: new Map(),
|
|
1055
|
+
stack: new Set(),
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
return {
|
|
1059
|
+
astCache,
|
|
1060
|
+
currentRow,
|
|
1061
|
+
definition,
|
|
1062
|
+
evaluationState: nextEvaluationState,
|
|
1063
|
+
resolveFormulaValue: (name, row, state = nextEvaluationState) => {
|
|
1064
|
+
const formulaName = normalizeFormulaLookupName(name);
|
|
1065
|
+
const formulaPropertyId = Object.keys(definition.properties).find((propertyId) => {
|
|
1066
|
+
const config = definition.properties[propertyId];
|
|
1067
|
+
return config?.formula && normalizeFormulaLookupName(propertyId) === formulaName;
|
|
1068
|
+
});
|
|
1069
|
+
if (!formulaPropertyId) {
|
|
1070
|
+
return null;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const cacheKey = `${row.file.path}::${formulaPropertyId}`;
|
|
1074
|
+
if (state.cache.has(cacheKey)) {
|
|
1075
|
+
return state.cache.get(cacheKey);
|
|
1076
|
+
}
|
|
1077
|
+
if (state.stack.has(cacheKey)) {
|
|
1078
|
+
throw new Error(`Circular formula reference: ${formulaPropertyId}`);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
state.stack.add(cacheKey);
|
|
1082
|
+
const nextContext = createEvaluationRootContext({
|
|
1083
|
+
astCache,
|
|
1084
|
+
currentRow: row,
|
|
1085
|
+
definition,
|
|
1086
|
+
evaluationState: state,
|
|
1087
|
+
snapshot,
|
|
1088
|
+
thisFile,
|
|
1089
|
+
});
|
|
1090
|
+
const result = evaluateExpression(definition.properties[formulaPropertyId].formula, nextContext);
|
|
1091
|
+
state.stack.delete(cacheKey);
|
|
1092
|
+
state.cache.set(cacheKey, result);
|
|
1093
|
+
return result;
|
|
1094
|
+
},
|
|
1095
|
+
resolveIdentifier: (name) => {
|
|
1096
|
+
if (typeof identifierResolver === 'function') {
|
|
1097
|
+
const resolved = identifierResolver(name);
|
|
1098
|
+
if (resolved !== undefined) {
|
|
1099
|
+
return resolved;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
if (name === 'file') {
|
|
1103
|
+
return currentRow.file;
|
|
1104
|
+
}
|
|
1105
|
+
if (name === 'formula') {
|
|
1106
|
+
return createFormulaNamespace(currentRow, nextEvaluationState);
|
|
1107
|
+
}
|
|
1108
|
+
if (name === 'note') {
|
|
1109
|
+
return currentRow.noteProperties;
|
|
1110
|
+
}
|
|
1111
|
+
if (name === 'this') {
|
|
1112
|
+
return createContextFileValue(thisFile);
|
|
1113
|
+
}
|
|
1114
|
+
if (name === 'values') {
|
|
1115
|
+
return [];
|
|
1116
|
+
}
|
|
1117
|
+
if (Object.hasOwn(currentRow.noteProperties, name)) {
|
|
1118
|
+
return currentRow.noteProperties[name];
|
|
1119
|
+
}
|
|
1120
|
+
return null;
|
|
1121
|
+
},
|
|
1122
|
+
snapshot,
|
|
1123
|
+
thisFile,
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
export function getPropertyValue(propertyId, row, definition, snapshot, thisFile) {
|
|
1128
|
+
if (propertyId.startsWith('file.')) {
|
|
1129
|
+
return propertyId.split('.').slice(1).reduce((acc, segment) => acc?.[segment], row.file);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
if (propertyId.startsWith('note.')) {
|
|
1133
|
+
return row.noteProperties[propertyId.slice(5)] ?? null;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const propertyConfig = definition.properties[propertyId];
|
|
1137
|
+
if (propertyConfig?.formula) {
|
|
1138
|
+
const context = createEvaluationRootContext({
|
|
1139
|
+
currentRow: row,
|
|
1140
|
+
definition,
|
|
1141
|
+
snapshot,
|
|
1142
|
+
thisFile,
|
|
1143
|
+
});
|
|
1144
|
+
return context.resolveFormulaValue(propertyId, row, context.evaluationState);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
const formulaConfig = definition.properties[`formula.${propertyId}`];
|
|
1148
|
+
if (formulaConfig?.formula) {
|
|
1149
|
+
const context = createEvaluationRootContext({
|
|
1150
|
+
currentRow: row,
|
|
1151
|
+
definition,
|
|
1152
|
+
snapshot,
|
|
1153
|
+
thisFile,
|
|
1154
|
+
});
|
|
1155
|
+
return context.resolveFormulaValue(propertyId, row, context.evaluationState);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
return row.noteProperties[propertyId] ?? null;
|
|
1159
|
+
}
|