@appsoftwareltd/etherpk-mcp 0.19.3 → 0.20.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/README.md +5 -1
- package/dist/drawing-page/assets/{abnfDiagram-N423BO3Z-CESuDXS9.js → abnfDiagram-N423BO3Z-D8OWVggw.js} +1 -1
- package/dist/drawing-page/assets/{ar-SA-G6X2FPQ2-BxYfG_4w.js → ar-SA-G6X2FPQ2-BsVAczME.js} +1 -1
- package/dist/drawing-page/assets/{arc-DKLVGaIz.js → arc-Y4DAzUBl.js} +1 -1
- package/dist/drawing-page/assets/{architectureDiagram-T3A2C74G-CGXZt2s5.js → architectureDiagram-T3A2C74G-Cz1L9ghf.js} +1 -1
- package/dist/drawing-page/assets/{az-AZ-76LH7QW2-CmORYk3r.js → az-AZ-76LH7QW2-Bqye8SiI.js} +1 -1
- package/dist/drawing-page/assets/{bg-BG-XCXSNQG7-CueRTQtz.js → bg-BG-XCXSNQG7-asUbixpL.js} +1 -1
- package/dist/drawing-page/assets/{blockDiagram-VBNYF7ZC-CrWptAUX.js → blockDiagram-VBNYF7ZC-DyXHdjs9.js} +1 -1
- package/dist/drawing-page/assets/{bn-BD-2XOGV67Q-BfLU6g3f.js → bn-BD-2XOGV67Q-CBYUnCH7.js} +1 -1
- package/dist/drawing-page/assets/{c4Diagram-5PPSVZJV-Cc4bJvZb.js → c4Diagram-5PPSVZJV-BhjosCS6.js} +1 -1
- package/dist/drawing-page/assets/{ca-ES-6MX7JW3Y-CoTtS-84.js → ca-ES-6MX7JW3Y-C4bGnaRX.js} +1 -1
- package/dist/drawing-page/assets/channel-DS9pcdIs.js +1 -0
- package/dist/drawing-page/assets/{chunk-2GRJ4B5K-DcSwK2S2.js → chunk-2GRJ4B5K-Buq_N5c0.js} +1 -1
- package/dist/drawing-page/assets/{chunk-4I5QYGJK-DneDyAZt.js → chunk-4I5QYGJK-Bl8Z8LVy.js} +1 -1
- package/dist/drawing-page/assets/{chunk-5RXB4S5H-B8cC2Isj.js → chunk-5RXB4S5H-DE4YEvsJ.js} +1 -1
- package/dist/drawing-page/assets/{chunk-6Q2QTUOP-FSofyzu7.js → chunk-6Q2QTUOP-kbEK7SHm.js} +1 -1
- package/dist/drawing-page/assets/{chunk-7Z6QIM7H-Czjy6v_N.js → chunk-7Z6QIM7H-Be4sL324.js} +1 -1
- package/dist/drawing-page/assets/{chunk-GF5L2VYU-D7C4sksR.js → chunk-GF5L2VYU-Ydi_RicV.js} +1 -1
- package/dist/drawing-page/assets/{chunk-I66GZJ75-eQyCt4m7.js → chunk-I66GZJ75-C2Z4jtZy.js} +1 -1
- package/dist/drawing-page/assets/{chunk-JQJVKLGR-BP6tAsN9.js → chunk-JQJVKLGR-B80bvrZd.js} +1 -1
- package/dist/drawing-page/assets/{chunk-KBJHAD2P-C5PM9_Z3.js → chunk-KBJHAD2P-BAvZlShA.js} +1 -1
- package/dist/drawing-page/assets/{chunk-NSK5VX7P-CSBZRlGI.js → chunk-NSK5VX7P-BdEZvUp3.js} +1 -1
- package/dist/drawing-page/assets/{chunk-QR6OTTB3-ArIwTbsg.js → chunk-QR6OTTB3-DRMRhUJT.js} +1 -1
- package/dist/drawing-page/assets/{chunk-RYQCIY6F-r64JZc1V.js → chunk-RYQCIY6F-CQl9Ntnt.js} +1 -1
- package/dist/drawing-page/assets/{chunk-UBXNYLIW-DCDJQ_uV.js → chunk-UBXNYLIW-Bd9Q_n7K.js} +1 -1
- package/dist/drawing-page/assets/{chunk-W5SLKNZC-DVmpr6gi.js → chunk-W5SLKNZC-DWSon6sa.js} +1 -1
- package/dist/drawing-page/assets/{chunk-WRU74C26-CBC9mgCI.js → chunk-WRU74C26-IUs_bJSX.js} +1 -1
- package/dist/drawing-page/assets/{chunk-XXDRQBXY-D1NataVh.js → chunk-XXDRQBXY-CHyUWQko.js} +1 -1
- package/dist/drawing-page/assets/classDiagram-JCYQIIEL-DzQM8hoW.js +1 -0
- package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-DzQM8hoW.js +1 -0
- package/dist/drawing-page/assets/{client-CX293Fae.js → client-DZUoshau.js} +1 -1
- package/dist/drawing-page/assets/{cose-bilkent-JH36ORCC-CPalPD7U.js → cose-bilkent-JH36ORCC-B2IOQydr.js} +1 -1
- package/dist/drawing-page/assets/{cs-CZ-2BRQDIVT-JneBadmf.js → cs-CZ-2BRQDIVT-2eGnB8k8.js} +1 -1
- package/dist/drawing-page/assets/{cynefinDiagram-MW4NZA55-6UGHnaXm.js → cynefinDiagram-MW4NZA55-BBR5L_qc.js} +1 -1
- package/dist/drawing-page/assets/{da-DK-5WZEPLOC-MyYyPsgH.js → da-DK-5WZEPLOC-CyBLbPbT.js} +1 -1
- package/dist/drawing-page/assets/{dagre-VZM6K2ZE-Cq2tBCTV.js → dagre-VZM6K2ZE-CmtH_NsG.js} +1 -1
- package/dist/drawing-page/assets/{de-DE-XR44H4JA-C5sxzBO0.js → de-DE-XR44H4JA-DXW5rzjb.js} +1 -1
- package/dist/drawing-page/assets/{diagram-7IWD3JNH-CSFNaVMQ.js → diagram-7IWD3JNH-DrmVlUuB.js} +1 -1
- package/dist/drawing-page/assets/{diagram-B4RE2ZJO-DERYVA6I.js → diagram-B4RE2ZJO-DKj0DZ37.js} +1 -1
- package/dist/drawing-page/assets/{diagram-LBJQPF4R-BZLgpVLi.js → diagram-LBJQPF4R-Cl9_05Rh.js} +1 -1
- package/dist/drawing-page/assets/{diagram-Q27KOJAE-CW8RthgJ.js → diagram-Q27KOJAE-DYeXQLno.js} +1 -1
- package/dist/drawing-page/assets/{diagram-UB23O5K3-DtMRLexl.js → diagram-UB23O5K3-R3YIOKDN.js} +1 -1
- package/dist/drawing-page/assets/{dist-CBR8fdSM.js → dist-Bip7SX9b.js} +6 -6
- package/dist/drawing-page/assets/{dist-pj5P0X0N.js → dist-DBTArFLM.js} +1 -1
- package/dist/drawing-page/assets/{ebnfDiagram-BXEA7PRR-DKlWK14b.js → ebnfDiagram-BXEA7PRR-D5WCgRZP.js} +1 -1
- package/dist/drawing-page/assets/{el-GR-BZB4AONW-BDF9TGyK.js → el-GR-BZB4AONW-CADjKmTB.js} +1 -1
- package/dist/drawing-page/assets/{en-B4ZKOASM-DQptt87B.js → en-B4ZKOASM-C7v1BS8o.js} +1 -1
- package/dist/drawing-page/assets/{erDiagram-JOGREHBK-C8jQzl05.js → erDiagram-JOGREHBK-BR1DC0W8.js} +1 -1
- package/dist/drawing-page/assets/{es-ES-U4NZUMDT-CvMMDbja.js → es-ES-U4NZUMDT-C5_USRPz.js} +1 -1
- package/dist/drawing-page/assets/{eu-ES-A7QVB2H4-Azi3qer2.js → eu-ES-A7QVB2H4-Bh-Tlgte.js} +1 -1
- package/dist/drawing-page/assets/{fa-IR-HGAKTJCU-CcB_2DLJ.js → fa-IR-HGAKTJCU-DIWd51q2.js} +1 -1
- package/dist/drawing-page/assets/{fi-FI-Z5N7JZ37-Cfhwoabd.js → fi-FI-Z5N7JZ37-AF3JZRRl.js} +1 -1
- package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-BxlljAAj.js +1 -0
- package/dist/drawing-page/assets/{fr-FR-RHASNOE6-CtRkYaA9.js → fr-FR-RHASNOE6-P6MTmYPf.js} +1 -1
- package/dist/drawing-page/assets/{ganttDiagram-PKOTCBZU-BlOkl0Ml.js → ganttDiagram-PKOTCBZU-BNF-Xqfv.js} +1 -1
- package/dist/drawing-page/assets/{gitGraphDiagram-DS77QQ5N-nNmXQTuR.js → gitGraphDiagram-DS77QQ5N-DbMDTDRm.js} +1 -1
- package/dist/drawing-page/assets/{gl-ES-HMX3MZ6V-BYvext-h.js → gl-ES-HMX3MZ6V-D92Lwl1g.js} +1 -1
- package/dist/drawing-page/assets/{he-IL-6SHJWFNN-Ds0Iws-m.js → he-IL-6SHJWFNN-CF5QXU1O.js} +1 -1
- package/dist/drawing-page/assets/{hi-IN-IWLTKZ5I-C5-S2BYt.js → hi-IN-IWLTKZ5I-DCG9nnM5.js} +1 -1
- package/dist/drawing-page/assets/{hu-HU-A5ZG7DT2-BKp400E6.js → hu-HU-A5ZG7DT2-DqWC1pUc.js} +1 -1
- package/dist/drawing-page/assets/{id-ID-SAP4L64H-C0DZ4SF3.js → id-ID-SAP4L64H-NL4uPTqX.js} +1 -1
- package/dist/drawing-page/assets/{image-GAAHSSAO-CRETPnVQ.js → image-GAAHSSAO-ioAhIVlf.js} +1 -1
- package/dist/drawing-page/assets/{infoDiagram-6WML65LV-PbgVrt2v.js → infoDiagram-6WML65LV-sj0RgLXh.js} +1 -1
- package/dist/drawing-page/assets/{ishikawaDiagram-WSZJBQD7-oqiUmo-r.js → ishikawaDiagram-WSZJBQD7-CADsKhde.js} +1 -1
- package/dist/drawing-page/assets/{it-IT-JPQ66NNP-DqEW-1TC.js → it-IT-JPQ66NNP-C0BwfQO9.js} +1 -1
- package/dist/drawing-page/assets/{ja-JP-DBVTYXUO-BD5fy2g0.js → ja-JP-DBVTYXUO-Cywbh0wR.js} +1 -1
- package/dist/drawing-page/assets/{journeyDiagram-NVQOT4AX-Du1rIQY5.js → journeyDiagram-NVQOT4AX-DcOlSjLB.js} +1 -1
- package/dist/drawing-page/assets/{kaa-6HZHGXH3-JwewpKGA.js → kaa-6HZHGXH3-BiB4IMVP.js} +1 -1
- package/dist/drawing-page/assets/{kab-KAB-ZGHBKWFO-Ypv2Vt_S.js → kab-KAB-ZGHBKWFO-C6EOE5eo.js} +1 -1
- package/dist/drawing-page/assets/{kanban-definition-27J2QSJJ-D41YNdW5.js → kanban-definition-27J2QSJJ-CbKcjFOA.js} +1 -1
- package/dist/drawing-page/assets/{kk-KZ-P5N5QNE5-CW8QQBb4.js → kk-KZ-P5N5QNE5-ip1AEYXT.js} +1 -1
- package/dist/drawing-page/assets/{km-KH-HSX4SM5Z-Brql62o4.js → km-KH-HSX4SM5Z-DQs24dA3.js} +1 -1
- package/dist/drawing-page/assets/{ko-KR-MTYHY66A-B2AA9q3T.js → ko-KR-MTYHY66A-CAWadZAw.js} +1 -1
- package/dist/drawing-page/assets/{ku-TR-6OUDTVRD-wRfKM-UR.js → ku-TR-6OUDTVRD-C7tGdvI8.js} +1 -1
- package/dist/drawing-page/assets/{line-DR25GccZ.js → line-BEw28pZ8.js} +1 -1
- package/dist/drawing-page/assets/{linear-CgBNAElN.js → linear-0eaIpIui.js} +1 -1
- package/dist/drawing-page/assets/{lt-LT-XHIRWOB4-JLA_pCNn.js → lt-LT-XHIRWOB4-Qd0fa1dX.js} +1 -1
- package/dist/drawing-page/assets/{lv-LV-5QDEKY6T-Bm_FaNIi.js → lv-LV-5QDEKY6T-BoAOhYL4.js} +1 -1
- package/dist/drawing-page/assets/{mindmap-definition-FAOFIHXS-CIAkR1vw.js → mindmap-definition-FAOFIHXS-CDIxta_Q.js} +1 -1
- package/dist/drawing-page/assets/{mr-IN-CRQNXWMA-B1pSsBa2.js → mr-IN-CRQNXWMA-CS9yIl05.js} +1 -1
- package/dist/drawing-page/assets/{my-MM-5M5IBNSE-DEuiqvRE.js → my-MM-5M5IBNSE-Do5mbf6R.js} +1 -1
- package/dist/drawing-page/assets/{nb-NO-T6EIAALU-NgPXPjzu.js → nb-NO-T6EIAALU-DMJUR2cn.js} +1 -1
- package/dist/drawing-page/assets/{nl-NL-IS3SIHDZ-CEIThWDg.js → nl-NL-IS3SIHDZ-C1CpMJaC.js} +1 -1
- package/dist/drawing-page/assets/{nn-NO-6E72VCQL-CWaPfJ9b.js → nn-NO-6E72VCQL-Bw4IDI_E.js} +1 -1
- package/dist/drawing-page/assets/{oc-FR-POXYY2M6-DQI9Oi0b.js → oc-FR-POXYY2M6-PpxcOiLq.js} +1 -1
- package/dist/drawing-page/assets/{pa-IN-N4M65BXN-Bp1ixU58.js → pa-IN-N4M65BXN-Ck8ZOFZQ.js} +1 -1
- package/dist/drawing-page/assets/{pegDiagram-VL7TDLO6-B-xberCP.js → pegDiagram-VL7TDLO6-CsNIPAUO.js} +1 -1
- package/dist/drawing-page/assets/percentages-BXMCSKIN-DD68R4BU.js +1 -0
- package/dist/drawing-page/assets/{pica-CjdSVAiE.js → pica-TJxRH1hS.js} +1 -1
- package/dist/drawing-page/assets/picture-D1_Gef1m.js +1 -0
- package/dist/drawing-page/assets/{pieDiagram-7S7Q4E2Y-mlV2Cfx3.js → pieDiagram-7S7Q4E2Y-ivc04D1I.js} +1 -1
- package/dist/drawing-page/assets/{pl-PL-T2D74RX3-BUKE4wqp.js → pl-PL-T2D74RX3-BO6STjgQ.js} +1 -1
- package/dist/drawing-page/assets/{prod-h6IKD9uE.js → prod-B73VusLB.js} +9 -9
- package/dist/drawing-page/assets/{pt-BR-5N22H2LF--wv9sZf1.js → pt-BR-5N22H2LF-BhL7mFPh.js} +1 -1
- package/dist/drawing-page/assets/{pt-PT-UZXXM6DQ-0XUNZ7du.js → pt-PT-UZXXM6DQ-D9xt78jb.js} +1 -1
- package/dist/drawing-page/assets/{quadrantDiagram-CIZ2JOQS-DCASpnCZ.js → quadrantDiagram-CIZ2JOQS-B5ShXxBL.js} +1 -1
- package/dist/drawing-page/assets/{railroadDiagram-AXF67PYL-DUPotRSX.js → railroadDiagram-AXF67PYL-TouNMOa2.js} +1 -1
- package/dist/drawing-page/assets/{react-dom-bLrj4m0o.js → react-dom-DOyQ--4c.js} +1 -1
- package/dist/drawing-page/assets/{react-rKJS6zPL.js → react-giARbZ_k.js} +1 -1
- package/dist/drawing-page/assets/{requirementDiagram-LRYGKXZP-BqF3hAjG.js → requirementDiagram-LRYGKXZP-8_FxBKqF.js} +1 -1
- package/dist/drawing-page/assets/{ro-RO-JPDTUUEW-C_HZ_9_y.js → ro-RO-JPDTUUEW-Ce5SkqHN.js} +1 -1
- package/dist/drawing-page/assets/{ru-RU-B4JR7IUQ-CghTzS1B.js → ru-RU-B4JR7IUQ-BMaHD5jb.js} +1 -1
- package/dist/drawing-page/assets/{sankeyDiagram-W5VNT64P-TOHKGdOj.js → sankeyDiagram-W5VNT64P-BJlO_5Zn.js} +1 -1
- package/dist/drawing-page/assets/scene-DRZ2XrJm.js +1 -0
- package/dist/drawing-page/assets/{sequenceDiagram-SI44F4Z6-BPzBwJ23.js → sequenceDiagram-SI44F4Z6-B25_T2t7.js} +1 -1
- package/dist/drawing-page/assets/{si-LK-N5RQ5JYF-C-E7WMzT.js → si-LK-N5RQ5JYF-Ck9OaWE_.js} +1 -1
- package/dist/drawing-page/assets/{sk-SK-C5VTKIMK-xSSzQ-Nc.js → sk-SK-C5VTKIMK-C1EJOPsj.js} +1 -1
- package/dist/drawing-page/assets/{sl-SI-NN7IZMDC-vd9S4rru.js → sl-SI-NN7IZMDC-DFCcSE-x.js} +1 -1
- package/dist/drawing-page/assets/{src-Bq_MLJPW.js → src-CxkpPvd7.js} +1 -1
- package/dist/drawing-page/assets/{stateDiagram-OKZ733FA-DWhPSrGe.js → stateDiagram-OKZ733FA-DhMMG4Il.js} +1 -1
- package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-CbCHFTZh.js +1 -0
- package/dist/drawing-page/assets/{sv-SE-XGPEYMSR-C03vrITo.js → sv-SE-XGPEYMSR-BbGGGINr.js} +1 -1
- package/dist/drawing-page/assets/{swimlanes-SLNWSIFB-bAtn9k-6.js → swimlanes-SLNWSIFB-C_067SLp.js} +1 -1
- package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-D8yDNrVf.js +8 -0
- package/dist/drawing-page/assets/{ta-IN-2NMHFXQM-iApHUOhp.js → ta-IN-2NMHFXQM-MmNA5EQD.js} +1 -1
- package/dist/drawing-page/assets/{th-TH-HPSO5L25-XaEE8A2a.js → th-TH-HPSO5L25-BqwSAk--.js} +1 -1
- package/dist/drawing-page/assets/{timeline-definition-Z64GVDOM-HpHAE7p1.js → timeline-definition-Z64GVDOM-9j9r3WvN.js} +1 -1
- package/dist/drawing-page/assets/{tr-TR-DEFEU3FU-qh_6U6tZ.js → tr-TR-DEFEU3FU-DazmI1UO.js} +1 -1
- package/dist/drawing-page/assets/{uk-UA-QMV73CPH-Dnaa4Abz.js → uk-UA-QMV73CPH-BU7K3yLx.js} +1 -1
- package/dist/drawing-page/assets/{vennDiagram-T6HMQDX7-DLs65-zf.js → vennDiagram-T6HMQDX7-R7gZSWda.js} +1 -1
- package/dist/drawing-page/assets/{vi-VN-M7AON7JQ-YOkhVPYg.js → vi-VN-M7AON7JQ-DlSTVl7E.js} +1 -1
- package/dist/drawing-page/assets/{wardleyDiagram-T6FBY63Y-BD5VH3jw.js → wardleyDiagram-T6FBY63Y-DOdJ3ql5.js} +1 -1
- package/dist/drawing-page/assets/{xychartDiagram-ELKLHX3M-jJa9qhv1.js → xychartDiagram-ELKLHX3M-D-FGz-0h.js} +1 -1
- package/dist/drawing-page/assets/{zh-CN-LNUGB5OW-DggUAMgs.js → zh-CN-LNUGB5OW-D3QP-vIz.js} +1 -1
- package/dist/drawing-page/assets/{zh-HK-E62DVLB3-MCovRg56.js → zh-HK-E62DVLB3-48EQNd3p.js} +1 -1
- package/dist/drawing-page/assets/{zh-TW-RAJ6MFWO-BuC6uBYw.js → zh-TW-RAJ6MFWO-DYxGzawk.js} +1 -1
- package/dist/drawing-page/drawing-picture-page.js +4 -4
- package/dist/main.js +934 -521
- package/dist/main.js.map +1 -1
- package/dist/map-picture-page.js +162 -109
- package/package.json +6 -6
- package/dist/drawing-page/assets/channel-BzrpSA9e.js +0 -1
- package/dist/drawing-page/assets/classDiagram-JCYQIIEL-fQUEpNef.js +0 -1
- package/dist/drawing-page/assets/classDiagram-v2-OCEON4UE-fQUEpNef.js +0 -1
- package/dist/drawing-page/assets/flowDiagram-UKHOOZJN-LEBtdj-L.js +0 -1
- package/dist/drawing-page/assets/percentages-BXMCSKIN-BB8F9H2s.js +0 -1
- package/dist/drawing-page/assets/picture-B8KpPOJ2.js +0 -1
- package/dist/drawing-page/assets/scene-CNYL6uXE.js +0 -1
- package/dist/drawing-page/assets/stateDiagram-v2-UEYNNEHI-0SsDmXm-.js +0 -1
- package/dist/drawing-page/assets/swimlanesDiagram-ULZ7WXOC-3CBtkpxY.js +0 -8
package/dist/main.js
CHANGED
|
@@ -714,7 +714,7 @@ function looksLikeAgentSetupCode(value) {
|
|
|
714
714
|
}
|
|
715
715
|
var package_default = {
|
|
716
716
|
name: "@appsoftwareltd/etherpk-mcp",
|
|
717
|
-
version: "0.
|
|
717
|
+
version: "0.20.0",
|
|
718
718
|
license: "Elastic-2.0",
|
|
719
719
|
description: "EtherPK Headless Client: an MCP server over a synced knowledge graph, run beside the agent on the user's own machine.",
|
|
720
720
|
type: "module",
|
|
@@ -1688,6 +1688,13 @@ var SyncApiError = class extends Error {
|
|
|
1688
1688
|
this.connectionKind = connectionKind;
|
|
1689
1689
|
}
|
|
1690
1690
|
};
|
|
1691
|
+
/**
|
|
1692
|
+
* A write names its type even with no body: a built SvelteKit server refuses a cross-origin write
|
|
1693
|
+
* that names none before the route runs, and a browser reports that as "Failed to fetch".
|
|
1694
|
+
*/
|
|
1695
|
+
function contentTypeHeader(method = "GET") {
|
|
1696
|
+
return method === "GET" ? {} : { "Content-Type": "application/json" };
|
|
1697
|
+
}
|
|
1691
1698
|
function createSyncApi(deps) {
|
|
1692
1699
|
const f = deps.fetch ?? fetch;
|
|
1693
1700
|
const base = deps.baseUrl.replace(/\/$/, "");
|
|
@@ -1697,7 +1704,7 @@ function createSyncApi(deps) {
|
|
|
1697
1704
|
...init,
|
|
1698
1705
|
headers: {
|
|
1699
1706
|
Authorization: `Bearer ${token}`,
|
|
1700
|
-
...init?.
|
|
1707
|
+
...contentTypeHeader(init?.method),
|
|
1701
1708
|
...init?.headers
|
|
1702
1709
|
}
|
|
1703
1710
|
});
|
|
@@ -2762,7 +2769,10 @@ async function revokeHeldToken(call) {
|
|
|
2762
2769
|
try {
|
|
2763
2770
|
return (await (call.fetch ?? fetch)(`${base(call.syncServer)}/api/v1/sync/tokens/current`, {
|
|
2764
2771
|
method: "DELETE",
|
|
2765
|
-
headers: {
|
|
2772
|
+
headers: {
|
|
2773
|
+
"content-type": "application/json",
|
|
2774
|
+
authorization: `Bearer ${call.token}`
|
|
2775
|
+
}
|
|
2766
2776
|
})).ok;
|
|
2767
2777
|
} catch {
|
|
2768
2778
|
return false;
|
|
@@ -4270,6 +4280,7 @@ function extensionFences(lines) {
|
|
|
4270
4280
|
// ../client/src/lib/document/map-text.ts
|
|
4271
4281
|
var NUMBER = String.raw`[+-]?(?:\d+(?:\.\d*)?|\.\d+)`;
|
|
4272
4282
|
var POINT = new RegExp(String.raw`^\s*(${NUMBER})\s*,\s*(${NUMBER})\s*$`);
|
|
4283
|
+
var SIZE = /^\s*size\s+(\d{1,5})?x(\d{1,5})\s*$/;
|
|
4273
4284
|
/** How many of the last `@`s on a line may end its name (`readMapLine`). */
|
|
4274
4285
|
var MAX_NAME_ENDS = 16;
|
|
4275
4286
|
function readPoint(text) {
|
|
@@ -4328,19 +4339,40 @@ function readMapLine(text) {
|
|
|
4328
4339
|
}
|
|
4329
4340
|
return readLocation(trimmed, "");
|
|
4330
4341
|
}
|
|
4331
|
-
/**
|
|
4342
|
+
/** What a size line says, or null when `text` is not one. No size line can read as a place or a route. */
|
|
4343
|
+
function readMapSize(text) {
|
|
4344
|
+
const match = SIZE.exec(text);
|
|
4345
|
+
if (!match) return null;
|
|
4346
|
+
const width = match[1] === void 0 ? null : Number(match[1]);
|
|
4347
|
+
const height = Number(match[2]);
|
|
4348
|
+
return width === 0 || height === 0 ? null : {
|
|
4349
|
+
width,
|
|
4350
|
+
height
|
|
4351
|
+
};
|
|
4352
|
+
}
|
|
4353
|
+
/**
|
|
4354
|
+
* Every item in a Map Block's body, numbered by line, and its size. Blank lines are skipped, not
|
|
4355
|
+
* reported. A second size line is reported like any line that does not read: two members resizing at
|
|
4356
|
+
* once merge as two lines, and the map can only be one size.
|
|
4357
|
+
*/
|
|
4332
4358
|
function readMapBody(lines) {
|
|
4333
4359
|
const body = {
|
|
4334
4360
|
items: [],
|
|
4335
|
-
unread: []
|
|
4361
|
+
unread: [],
|
|
4362
|
+
size: null
|
|
4336
4363
|
};
|
|
4337
4364
|
lines.forEach((text, line) => {
|
|
4338
4365
|
if (text.trim() === "") return;
|
|
4339
4366
|
const read = readMapLine(text);
|
|
4340
|
-
if (read)
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4367
|
+
if (read) {
|
|
4368
|
+
body.items.push({
|
|
4369
|
+
...read,
|
|
4370
|
+
line
|
|
4371
|
+
});
|
|
4372
|
+
return;
|
|
4373
|
+
}
|
|
4374
|
+
const size = body.size === null ? readMapSize(text) : null;
|
|
4375
|
+
if (size) body.size = size;
|
|
4344
4376
|
else body.unread.push({
|
|
4345
4377
|
line,
|
|
4346
4378
|
text
|
|
@@ -4401,7 +4433,6 @@ var EMPTY = {
|
|
|
4401
4433
|
scheduled: null
|
|
4402
4434
|
};
|
|
4403
4435
|
/**
|
|
4404
|
-
* Tags are **case-sensitive** (ADR 0032), so `#p1` and `#d` are prose, not metadata.
|
|
4405
4436
|
* Dates are shape-matched, not calendar-validated: `#D-2026-13-45` is still a date-shaped
|
|
4406
4437
|
* tag. Shape is what makes string ordering equal date ordering, and a wrong date is the
|
|
4407
4438
|
* user's to see and fix, not ours to silently drop.
|
|
@@ -4424,8 +4455,13 @@ var STATE_TAGS = [
|
|
|
4424
4455
|
["archived", "#A"]
|
|
4425
4456
|
];
|
|
4426
4457
|
var STATE_BY_TOKEN = new Map(STATE_TAGS.map(([kind, token]) => [token, kind]));
|
|
4427
|
-
/**
|
|
4428
|
-
function
|
|
4458
|
+
/** `token` as a Task Tag is written: its ASCII letters in upper case. Not `toUpperCase`, which also turns `ſ` into `S`. */
|
|
4459
|
+
function inTagCase(token) {
|
|
4460
|
+
return token.replace(/[a-z]+/g, (letters) => letters.toUpperCase());
|
|
4461
|
+
}
|
|
4462
|
+
/** Read one token as a tag, in any case, or null if it is not one (which ends the run). */
|
|
4463
|
+
function readTag(written) {
|
|
4464
|
+
const token = inTagCase(written);
|
|
4429
4465
|
const state = STATE_BY_TOKEN.get(token);
|
|
4430
4466
|
if (state) return {
|
|
4431
4467
|
kind: state,
|
|
@@ -4497,13 +4533,17 @@ function parseTaskTags(label) {
|
|
|
4497
4533
|
/** A Free Tag's word: letters and digits in words joined by single hyphens. */
|
|
4498
4534
|
var FREE_TAG_WORD = /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/;
|
|
4499
4535
|
/**
|
|
4500
|
-
* Anything a [[Task Tag]] is or could be, in any case: `#
|
|
4536
|
+
* Anything a [[Task Tag]] is or could be, in any case: `#P4` and `#d-2026` are not Task Tags, but a
|
|
4501
4537
|
* person who wrote them meant one, so neither is a Free Tag either.
|
|
4502
4538
|
*/
|
|
4503
4539
|
var TASK_TAG_SHAPED = /^(?:P\d+|W|D|T|C|A|[DCS]-[\d-]*)$/i;
|
|
4540
|
+
/** Whether `word` (without its `#`) is a [[Task Tag]] or shaped like one, in any case. */
|
|
4541
|
+
function isTaskTagShaped(word) {
|
|
4542
|
+
return TASK_TAG_SHAPED.test(word);
|
|
4543
|
+
}
|
|
4504
4544
|
/** Whether `word` (without its `#`) can be a [[Free Tag]]: what the Task Editor checks a new tag by. */
|
|
4505
4545
|
function isFreeTagWord(word) {
|
|
4506
|
-
return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !
|
|
4546
|
+
return FREE_TAG_WORD.test(word) && /[A-Za-z]/.test(word) && !isTaskTagShaped(word);
|
|
4507
4547
|
}
|
|
4508
4548
|
/** True when a whitespace-separated token is exactly one Free Tag. */
|
|
4509
4549
|
function isFreeTagToken(token) {
|
|
@@ -4719,13 +4759,17 @@ new Set(STATE_TAGS.map(([kind]) => kind));
|
|
|
4719
4759
|
function taskTitleKey(label) {
|
|
4720
4760
|
return taskDisplay(label).text.toLowerCase();
|
|
4721
4761
|
}
|
|
4762
|
+
/** The [[Free Tag]]s on a task's line, once each, in the spelling first written. */
|
|
4763
|
+
function taskFreeTags(label) {
|
|
4764
|
+
return freeTagsIn(parseTaskTags(label).text);
|
|
4765
|
+
}
|
|
4722
4766
|
/**
|
|
4723
4767
|
* A task's tags as a [[Task Text Filter]] matches them: every [[Task Tag]] in its leading run and
|
|
4724
4768
|
* every [[Free Tag]] on its line, lower-cased, each with a space either side. No tag holds a space,
|
|
4725
4769
|
* so {@link taskTagNeedle} finds a tag whole, and `#bug` is not found in `#bugfix`.
|
|
4726
4770
|
*/
|
|
4727
4771
|
function taskTagsKey(label) {
|
|
4728
|
-
const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...
|
|
4772
|
+
const tags = [...taskTagTokens(label).map((token) => token.slice(1)), ...taskFreeTags(label)];
|
|
4729
4773
|
return tags.length === 0 ? "" : ` ${tags.join(" ").toLowerCase()} `;
|
|
4730
4774
|
}
|
|
4731
4775
|
/** What {@link taskTagsKey} is searched for, for a tag out of a {@link TaskTextFilter}. */
|
|
@@ -5601,7 +5645,7 @@ function createSchema(db) {
|
|
|
5601
5645
|
db.exec(SCHEMA$1);
|
|
5602
5646
|
db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('active_generation', 1)");
|
|
5603
5647
|
db.run("INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('revision', 0)");
|
|
5604
|
-
db.exec(`PRAGMA user_version =
|
|
5648
|
+
db.exec(`PRAGMA user_version = 23`);
|
|
5605
5649
|
}
|
|
5606
5650
|
function activeIndexGeneration(db) {
|
|
5607
5651
|
return db.all("SELECT value FROM index_metadata WHERE key = 'active_generation'")[0]?.value ?? 1;
|
|
@@ -5622,7 +5666,7 @@ function advanceIndexRevision(db) {
|
|
|
5622
5666
|
*/
|
|
5623
5667
|
function isUsableIndex(db) {
|
|
5624
5668
|
try {
|
|
5625
|
-
return db.all("PRAGMA user_version")[0]?.user_version ===
|
|
5669
|
+
return db.all("PRAGMA user_version")[0]?.user_version === 23;
|
|
5626
5670
|
} catch {
|
|
5627
5671
|
return false;
|
|
5628
5672
|
}
|
|
@@ -5675,13 +5719,13 @@ function indexDocHash(doc) {
|
|
|
5675
5719
|
const includes = doc.includes ?? [];
|
|
5676
5720
|
const properties = doc.properties ?? [];
|
|
5677
5721
|
const aliases = doc.aliases ?? [];
|
|
5678
|
-
if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText(doc.text);
|
|
5722
|
+
if (includes.length === 0 && properties.length === 0 && aliases.length === 0 && !doc.template) return hashText$1(doc.text);
|
|
5679
5723
|
const includeText = includes.map((i) => `${i.publication}\u0001${i.slot}\u0001${i.concept}`).join("\0");
|
|
5680
5724
|
const propertyText = properties.map((p) => `${p.key}\u0001${p.value ?? ""}`).join("\0");
|
|
5681
5725
|
const templateMark = doc.template ? "template" : "";
|
|
5682
|
-
return hashText(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
|
|
5726
|
+
return hashText$1(`${doc.text}\u0000${includeText}\u0003${propertyText}\u0004${aliases.join("\0")}${templateMark}`);
|
|
5683
5727
|
}
|
|
5684
|
-
function hashText(text) {
|
|
5728
|
+
function hashText$1(text) {
|
|
5685
5729
|
let h1 = 3735928559;
|
|
5686
5730
|
let h2 = 1103547991;
|
|
5687
5731
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -5803,7 +5847,7 @@ function insertDerived(db, pageId, doc) {
|
|
|
5803
5847
|
passage.startLine,
|
|
5804
5848
|
passage.endLine,
|
|
5805
5849
|
passage.firstBlockLocalId,
|
|
5806
|
-
hashText(passage.text),
|
|
5850
|
+
hashText$1(passage.text),
|
|
5807
5851
|
passage.text
|
|
5808
5852
|
]);
|
|
5809
5853
|
return searchable;
|
|
@@ -6691,6 +6735,34 @@ function propertyKeys(db) {
|
|
|
6691
6735
|
GROUP BY pr.key
|
|
6692
6736
|
ORDER BY documents DESC, pr.key_lc, pr.key`, [activeIndexGeneration(db)]);
|
|
6693
6737
|
}
|
|
6738
|
+
/**
|
|
6739
|
+
* Every [[Free Tag]] on a task in the graph, once ignoring case, most used first and then A–Z, each
|
|
6740
|
+
* in the spelling most tasks write it in: what the `#` helper offers. Read from the tasks' text at
|
|
6741
|
+
* each ask rather than kept in a table of its own. It runs in the worker, once per `#` typed, and
|
|
6742
|
+
* `tags_key` has already ruled out every task with no tag at all.
|
|
6743
|
+
*/
|
|
6744
|
+
function usedFreeTags(db) {
|
|
6745
|
+
const rows = db.all(`SELECT t.text FROM tasks t JOIN pages p ON p.id = t.page_id
|
|
6746
|
+
WHERE p.generation = ? AND t.tags_key <> ''`, [activeIndexGeneration(db)]);
|
|
6747
|
+
const spellingsByKey = /* @__PURE__ */ new Map();
|
|
6748
|
+
for (const { text } of rows) for (const tag of taskFreeTags(text)) {
|
|
6749
|
+
const key = tag.toLowerCase();
|
|
6750
|
+
const spellings = spellingsByKey.get(key) ?? /* @__PURE__ */ new Map();
|
|
6751
|
+
spellingsByKey.set(key, spellings.set(tag, (spellings.get(tag) ?? 0) + 1));
|
|
6752
|
+
}
|
|
6753
|
+
return [...spellingsByKey].map(([key, spellings]) => ({
|
|
6754
|
+
key,
|
|
6755
|
+
...mostUsedSpelling(spellings)
|
|
6756
|
+
})).sort((a, b) => b.total - a.total || a.key.localeCompare(b.key)).map((entry) => entry.spelling);
|
|
6757
|
+
}
|
|
6758
|
+
/** The spelling most tasks write, A–Z on a tie, and how many tasks write any of them. */
|
|
6759
|
+
function mostUsedSpelling(spellings) {
|
|
6760
|
+
const [[spelling]] = [...spellings].sort(([a, m], [b, n]) => n - m || a.localeCompare(b));
|
|
6761
|
+
return {
|
|
6762
|
+
spelling,
|
|
6763
|
+
total: [...spellings.values()].reduce((sum, n) => sum + n, 0)
|
|
6764
|
+
};
|
|
6765
|
+
}
|
|
6694
6766
|
/** The values `key` has across the graph, grouped ignoring case, most used first. */
|
|
6695
6767
|
function propertyValues(db, key, limit = 50) {
|
|
6696
6768
|
return db.all(`SELECT MIN(pr.value) AS value, COUNT(DISTINCT pr.page_id) AS documents
|
|
@@ -7443,7 +7515,7 @@ function cacheRoot(env) {
|
|
|
7443
7515
|
* recovered from a joined path (see there).
|
|
7444
7516
|
*/
|
|
7445
7517
|
var CACHE_FILE_NAME = `local-cache.v${CACHE_DB_VERSION}.bin`;
|
|
7446
|
-
var INDEX_FILE_NAME = `index.
|
|
7518
|
+
var INDEX_FILE_NAME = `index.v23.sqlite`;
|
|
7447
7519
|
var VECTORS_FILE_NAME = `vectors.v1.sqlite`;
|
|
7448
7520
|
function cacheFile(dir) {
|
|
7449
7521
|
return join(dir, CACHE_FILE_NAME);
|
|
@@ -12834,6 +12906,70 @@ async function listHostRecords(env) {
|
|
|
12834
12906
|
}
|
|
12835
12907
|
return found;
|
|
12836
12908
|
}
|
|
12909
|
+
// src/graph-connection.ts
|
|
12910
|
+
/**
|
|
12911
|
+
* Follow `source` for as long as it lives; a session clears its listeners when disposed. Only an
|
|
12912
|
+
* open socket counts as connected, so `connecting`, `reconnecting` and `ended` are all offline: in
|
|
12913
|
+
* each of them the copy has stopped following the Sync Server.
|
|
12914
|
+
*/
|
|
12915
|
+
function followConnection(source, options = {}) {
|
|
12916
|
+
const now = options.now ?? Date.now;
|
|
12917
|
+
let connected = source.activity().connection === "open";
|
|
12918
|
+
let everConnected = connected;
|
|
12919
|
+
let since = now();
|
|
12920
|
+
const describe = (activity) => {
|
|
12921
|
+
const at = new Date(since).toISOString();
|
|
12922
|
+
return connected ? {
|
|
12923
|
+
state: "connected",
|
|
12924
|
+
since: at
|
|
12925
|
+
} : {
|
|
12926
|
+
state: "offline",
|
|
12927
|
+
since: at,
|
|
12928
|
+
unsentDocuments: activity.unsentDocuments
|
|
12929
|
+
};
|
|
12930
|
+
};
|
|
12931
|
+
function observe(activity) {
|
|
12932
|
+
const connectedNow = activity.connection === "open";
|
|
12933
|
+
if (connectedNow !== connected) {
|
|
12934
|
+
const at = now();
|
|
12935
|
+
const offlineForMs = connectedNow && everConnected ? at - since : null;
|
|
12936
|
+
connected = connectedNow;
|
|
12937
|
+
everConnected ||= connectedNow;
|
|
12938
|
+
since = at;
|
|
12939
|
+
options.onChange?.({
|
|
12940
|
+
connection: describe(activity),
|
|
12941
|
+
offlineForMs
|
|
12942
|
+
});
|
|
12943
|
+
}
|
|
12944
|
+
return describe(activity);
|
|
12945
|
+
}
|
|
12946
|
+
source.onActivity(observe);
|
|
12947
|
+
return { current: () => observe(source.activity()) };
|
|
12948
|
+
}
|
|
12949
|
+
function plural(count, unit) {
|
|
12950
|
+
return `${count} ${unit}${count === 1 ? "" : "s"}`;
|
|
12951
|
+
}
|
|
12952
|
+
function durationWords(ms) {
|
|
12953
|
+
const minutes = Math.floor(ms / 6e4);
|
|
12954
|
+
if (minutes < 1) return "under a minute";
|
|
12955
|
+
if (minutes < 60) return plural(minutes, "minute");
|
|
12956
|
+
const hours = Math.floor(minutes / 60);
|
|
12957
|
+
return hours < 48 ? plural(hours, "hour") : plural(Math.floor(hours / 24), "day");
|
|
12958
|
+
}
|
|
12959
|
+
/** How the tools word the state, with the exact time and, in brackets, how long that is. */
|
|
12960
|
+
function offlineSince(connection, now = Date.now()) {
|
|
12961
|
+
return `offline from the Sync Server since ${connection.since} (${durationWords(now - Date.parse(connection.since))})`;
|
|
12962
|
+
}
|
|
12963
|
+
/** The note an answer carries while its copy is offline; null while connected and on a folder, which has no connection. */
|
|
12964
|
+
function offlineNotice(connection, now = Date.now()) {
|
|
12965
|
+
if (connection?.state !== "offline") return null;
|
|
12966
|
+
return `This computer's copy of the graph has been ${offlineSince(connection, now)}. This answer comes from that copy: it can lack edits made elsewhere since then, and a page or task it does not find may only be newer than the copy. Tell the user before relying on it. The copy catches up when the connection returns.`;
|
|
12967
|
+
}
|
|
12968
|
+
/** One line for the host's log. */
|
|
12969
|
+
function connectionChangeLine(change) {
|
|
12970
|
+
if (change.connection.state === "offline") return "lost the connection to the Sync Server; the tools answer from this computer's copy.";
|
|
12971
|
+
return change.offlineForMs === null ? "connected to the Sync Server." : `connected to the Sync Server again, after ${durationWords(change.offlineForMs)} offline.`;
|
|
12972
|
+
}
|
|
12837
12973
|
// ../client/src/lib/document/publish/selection.ts
|
|
12838
12974
|
/**
|
|
12839
12975
|
* Which documents a [[Publication]] contains (ADR 0082). The one place the membership rule is
|
|
@@ -13635,7 +13771,7 @@ var files = /* #__PURE__ */ Object.assign({
|
|
|
13635
13771
|
"../etherpk-blog/theme.json": "{\n \"name\": \"etherpk-blog\",\n \"title\": \"EtherPK Blog\",\n \"version\": \"1.0.0\",\n \"contract\": 1,\n \"description\": \"A blog: dated documents as posts newest first, a top navigation from the publication's outline, the feed, and search.\",\n \"kinds\": [\"blog\"],\n \"includes\": [\n { \"name\": \"head\", \"description\": \"Extra markup inside <head>: analytics, fonts, meta tags. Raw HTML in the page body.\" },\n { \"name\": \"logo\", \"description\": \"The logo before the site title in the header: an image or inline SVG. Replaces the EtherPK icon.\" },\n { \"name\": \"favicon\", \"description\": \"The icon in the browser tab: a <link rel=\\\"icon\\\"> tag. Raw HTML in the page body. Replaces the EtherPK icon.\" },\n { \"name\": \"header\", \"description\": \"The site header. Replaces the theme's title, navigation and search box.\" },\n { \"name\": \"before-content\", \"description\": \"Rendered above every page's content.\" },\n { \"name\": \"after-content\", \"description\": \"Rendered below every page's content, above the linked references: an author bio, a comments widget.\" },\n { \"name\": \"footer\", \"description\": \"The site footer.\" },\n { \"name\": \"scripts\", \"description\": \"Scripts before </body>, added after the theme's own (search, the sidebar drawer): analytics, a widget. Raw HTML in the page body.\" },\n { \"name\": \"styles\", \"description\": \"CSS appended after the theme's stylesheet: the page's first css fence.\", \"kind\": \"css\" }\n ],\n \"files\": [\n \"layouts/page.html\", \"layouts/home.html\", \"layouts/journal.html\", \"layouts/archive.html\", \"layouts/404.html\",\n \"partials/shell-top.html\", \"partials/shell-bottom.html\", \"partials/head.html\", \"partials/logo.html\", \"partials/favicon.html\", \"partials/header.html\",\n \"partials/nav-item.html\", \"partials/backlinks.html\", \"partials/before-content.html\", \"partials/after-content.html\",\n \"partials/footer.html\", \"partials/theme-scripts.html\", \"partials/scripts.html\",\n \"assets/theme.css\", \"assets/favicon.svg\", \"assets/search.js\"\n ]\n}\n",
|
|
13636
13772
|
"../etherpk-docs/assets/favicon.svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 191.82 166.13\">\n <path fill=\"#0a0a0a\" fill-rule=\"evenodd\" d=\"M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z\"/>\n</svg>\n",
|
|
13637
13773
|
"../etherpk-docs/assets/search.js": "/*\n * Search for a Published Site: reads search.json (built over the publication's own documents\n * and nothing else) and scores documents by title and text matches. No dependencies, no\n * network beyond the one index file, and nothing runs until the search box is used. The same\n * script runs the sidebar toggle on small screens, so a page carries one script.\n */\n(function () {\n 'use strict';\n\n // -- Navigation toggle (small screens) -------------------------------------------------\n var toggle = document.querySelector('.nav-toggle');\n var backdrop = document.querySelector('.nav-backdrop');\n var nav = document.getElementById('site-nav');\n function setNavOpen(open) {\n var was = document.body.classList.contains('nav-open');\n document.body.classList.toggle('nav-open', open);\n if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');\n if (backdrop) backdrop.hidden = !open;\n // Focus follows the drawer: into its first link on open, back to the button on close,\n // so a keyboard or screen-reader user is never left on something now hidden.\n if (open && !was) {\n var first = nav.querySelector('a');\n if (first) first.focus();\n } else if (!open && was && toggle) {\n toggle.focus();\n }\n }\n if (toggle && nav) {\n toggle.addEventListener('click', function () { setNavOpen(!document.body.classList.contains('nav-open')); });\n if (backdrop) backdrop.addEventListener('click', function () { setNavOpen(false); });\n document.addEventListener('keydown', function (e) {\n if (e.key === 'Escape' && document.body.classList.contains('nav-open')) setNavOpen(false);\n });\n }\n\n // -- Search --------------------------------------------------------------------------\n var form = document.querySelector('.site-search');\n if (!form) return;\n var input = form.querySelector('input[type=\"search\"]');\n var results = form.querySelector('.site-search-results');\n var indexUrl = form.getAttribute('data-search-index') || 'search.json';\n var scriptUrl = form.getAttribute('data-search-script') || 'search-index.js';\n var index = null;\n var loading = null;\n /* True once neither route produced the index: the results then say so rather than \"nothing matches\". */\n var unavailable = false;\n\n /* The index as a script assigning window.etherpkSearchIndex: what a site opened from disk can\n load, since file:// refuses fetch but allows <script src>. */\n function loadScript() {\n return new Promise(function (resolve, reject) {\n if (window.etherpkSearchIndex) { resolve(window.etherpkSearchIndex); return; }\n var s = document.createElement('script');\n s.src = scriptUrl;\n s.onload = function () {\n if (window.etherpkSearchIndex) resolve(window.etherpkSearchIndex);\n else reject(new Error('no index'));\n };\n s.onerror = function () { reject(new Error('no script')); };\n document.head.appendChild(s);\n });\n }\n\n function load() {\n if (index) return Promise.resolve(index);\n if (!loading) {\n loading = fetch(indexUrl).then(function (r) {\n if (!r.ok) throw new Error(String(r.status));\n return r.json();\n }).catch(loadScript).then(function (data) {\n index = (data && data.documents) || [];\n return index;\n }).catch(function () { unavailable = true; index = []; return index; });\n }\n return loading;\n }\n\n function tokens(q) {\n return q.toLowerCase().split(/\\s+/).filter(function (t) { return t.length > 0; });\n }\n\n function score(doc, terms) {\n var title = (doc.title || '').toLowerCase();\n var text = (doc.text || '').toLowerCase();\n var s = 0;\n for (var i = 0; i < terms.length; i++) {\n var t = terms[i];\n if (title === t) s += 20;\n else if (title.indexOf(t) === 0) s += 10;\n else if (title.indexOf(t) !== -1) s += 6;\n var at = text.indexOf(t);\n if (at !== -1) s += 2;\n else if (title.indexOf(t) === -1) return 0; // every term must match somewhere\n }\n return s;\n }\n\n function snippet(doc, terms) {\n var text = doc.text || '';\n var lower = text.toLowerCase();\n var at = -1;\n for (var i = 0; i < terms.length && at === -1; i++) at = lower.indexOf(terms[i]);\n if (at === -1) return doc.excerpt || '';\n var start = Math.max(0, at - 60);\n var end = Math.min(text.length, at + 100);\n return (start > 0 ? '…' : '') + text.slice(start, end).replace(/\\s+/g, ' ') + (end < text.length ? '…' : '');\n }\n\n function escapeHtml(s) {\n return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n }\n\n function render(list, q) {\n if (!q) { results.hidden = true; results.innerHTML = ''; return; }\n if (unavailable) {\n results.innerHTML = '<p class=\"site-search-empty\">The search index could not be loaded.</p>';\n results.hidden = false;\n return;\n }\n if (list.length === 0) {\n results.innerHTML = '<p class=\"site-search-empty\">Nothing matches \"' + escapeHtml(q) + '\".</p>';\n results.hidden = false;\n return;\n }\n results.innerHTML = list.map(function (hit) {\n return '<a class=\"site-search-hit\" role=\"option\" href=\"' + escapeHtml(hit.doc.url) + '\">' +\n '<span class=\"site-search-title\">' + escapeHtml(hit.doc.title) + '</span>' +\n '<span class=\"site-search-snippet\">' + escapeHtml(hit.snippet) + '</span></a>';\n }).join('');\n results.hidden = false;\n }\n\n var timer = null;\n function run() {\n var q = input.value.trim();\n var terms = tokens(q);\n if (terms.length === 0) { render([], ''); return; }\n load().then(function (docs) {\n var hits = [];\n for (var i = 0; i < docs.length; i++) {\n var s = score(docs[i], terms);\n if (s > 0) hits.push({ doc: docs[i], score: s, snippet: snippet(docs[i], terms) });\n }\n hits.sort(function (a, b) { return b.score - a.score || a.doc.title.localeCompare(b.doc.title); });\n render(hits.slice(0, 12), q);\n });\n }\n\n input.addEventListener('input', function () {\n clearTimeout(timer);\n timer = setTimeout(run, 120);\n });\n input.addEventListener('focus', function () { load(); });\n form.addEventListener('submit', function (e) {\n e.preventDefault();\n var first = results.querySelector('a');\n if (first) window.location.href = first.getAttribute('href');\n });\n document.addEventListener('keydown', function (e) {\n if (e.key === '/' && document.activeElement !== input && !/input|textarea/i.test(document.activeElement.tagName)) {\n e.preventDefault();\n input.focus();\n }\n if (e.key === 'Escape' && !results.hidden) { render([], ''); }\n });\n document.addEventListener('click', function (e) {\n if (!form.contains(e.target)) render([], '');\n });\n})();\n",
|
|
13638
|
-
"../etherpk-docs/assets/theme.css": "/* EtherPK docs theme. Tokens follow the app's own (agent blue, the gk surface scale); the font\n is the system stack so the site loads nothing from anywhere. Dark mode follows the reader's\n preference. Classes the publisher emits and this file styles: .wikilink, .wikilink-missing,\n .task, .task-tag, .toc, .backlinks, .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --font-sans: \"Inter\", system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --agent-500: #007acc;\n --agent-600: #005f9e;\n --agent-100: #c2e3ff;\n --surface-0: #ffffff;\n --surface-1: #f9fafb;\n --surface-2: #e5e7eb;\n --text-strong: #030712;\n --text-default: #374151;\n --text-muted: #6b7280;\n --border-soft: rgba(3, 7, 18, 0.08);\n --border-strong: rgba(3, 7, 18, 0.16);\n --mark: #fff3a3;\n --missing: #b45309;\n --nav-width: 17rem;\n /* The header is exactly this tall, so the sticky sidebar and the drawer toggle can be\n measured against it rather than guessing at the search box's height. */\n --header-height: 3.5rem;\n /* The width of the text column beside the sidebar. Pictures are capped to it as well. */\n --content-width: 52rem;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --agent-500: #5ab3ff;\n --agent-600: #94ccff;\n --agent-100: #002e4f;\n --surface-0: #18181b;\n --surface-1: #1c1c20;\n --surface-2: #2a2a30;\n --text-strong: #fafafa;\n --text-default: #d4d4d8;\n --text-muted: #a1a1aa;\n --border-soft: rgba(255, 255, 255, 0.08);\n --border-strong: rgba(255, 255, 255, 0.16);\n --mark: #6b5a00;\n --missing: #f59e0b;\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }\nbody {\n margin: 0;\n color: var(--text-default);\n background: var(--surface-0);\n line-height: 1.6;\n font-size: 16px;\n}\na { color: var(--agent-500); }\na:hover { color: var(--agent-600); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface-1); padding: 0.5rem 1rem; z-index: 100; }\n.skip-link:focus { left: 1rem; top: 1rem; }\n\n/* -- Header ----------------------------------------------------------------------------- */\n.site-header {\n display: flex;\n align-items: center;\n gap: 1rem;\n height: var(--header-height);\n padding: 0 1.5rem;\n border-bottom: 1px solid var(--border-soft);\n background: var(--surface-1);\n position: sticky;\n top: 0;\n z-index: 20;\n}\n.site-title { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 600; color: var(--text-strong); text-decoration: none; font-size: 1.05rem; }\n.site-title:hover { color: var(--agent-500); }\n.site-logo { flex-shrink: 0; }\n.site-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 22rem; }\n.site-search input {\n width: 100%;\n padding: 0.4rem 0.75rem;\n line-height: 1.25;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-0);\n color: var(--text-default);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n.site-search-results {\n position: absolute;\n top: calc(100% + 0.35rem);\n left: 0;\n right: 0;\n max-height: 24rem;\n overflow: auto;\n background: var(--surface-0);\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 0.55rem 0.75rem; text-decoration: none; color: var(--text-default); border-bottom: 1px solid var(--border-soft); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--surface-1); }\n.site-search-title { display: block; font-weight: 600; color: var(--text-strong); }\n.site-search-snippet { display: block; font-size: 0.9rem; color: var(--text-muted); }\n.site-search-empty { margin: 0; padding: 0.6rem 0.75rem; color: var(--text-muted); }\n\n/* -- Shell: sidebar + content ------------------------------------------------------------ */\n.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }\n.site-nav {\n border-right: 1px solid var(--border-soft);\n background: var(--surface-1);\n padding: 1.25rem 1rem;\n overflow-y: auto;\n position: sticky;\n top: var(--header-height);\n height: calc(100vh - var(--header-height));\n}\n.site-nav-list { list-style: none; margin: 0; padding: 0; }\n.site-nav-list .site-nav-list { padding-left: 0.85rem; border-left: 1px solid var(--border-soft); margin-left: 0.5rem; }\n.site-nav li { margin: 0.1rem 0; }\n.site-nav a, .site-nav .nav-group-label {\n display: block;\n padding: 0.3rem 0.6rem;\n border-radius: 0.4rem;\n color: var(--text-default);\n text-decoration: none;\n font-size: 0.95rem;\n line-height: 1.4;\n}\n.site-nav a:hover { background: var(--surface-2); color: var(--text-strong); }\n.site-nav .nav-current > a { background: var(--agent-100); color: var(--text-strong); font-weight: 600; }\n.site-nav .nav-group-label { font-weight: 600; color: var(--text-strong); margin-top: 0.75rem; }\n.site-nav a .wikilink { color: inherit; text-decoration: none; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n\n/* The padding sits outside the text column (border-box would take it from inside). */\n.content { padding: 2rem 3rem 4rem; max-width: calc(var(--content-width) + 6rem); width: 100%; }\n.page-header h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; color: var(--text-strong); }\n.page-header h1 .wikilink { color: inherit; text-decoration: none; }\n.page-header h1 .wikilink:hover { text-decoration: underline; }\n.page-date { color: var(--text-muted); font-size: 0.95rem; }\n.page-body h2 { margin-top: 2rem; font-size: 1.4rem; color: var(--text-strong); }\n.page-body h3 { margin-top: 1.5rem; font-size: 1.15rem; color: var(--text-strong); }\n.page-body ul { padding-left: 1.4rem; }\n.page-body li { margin: 0.2rem 0; }\n.page-body img { max-width: 100%; height: auto; border-radius: 0.35rem; }\n.page-body table { border-collapse: collapse; margin: 1rem 0; width: 100%; }\n.page-body th, .page-body td { border: 1px solid var(--border-strong); padding: 0.4rem 0.6rem; text-align: left; }\n.page-body th { background: var(--surface-1); }\n.page-body blockquote { border-left: 3px solid var(--border-strong); margin: 1rem 0; padding: 0.25rem 1rem; color: var(--text-muted); }\n.page-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-1); padding: 0.1em 0.35em; border-radius: 0.25rem; }\n.page-body pre { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 0.5rem; padding: 0.9rem 1rem; overflow-x: auto; }\n.page-body pre code { background: none; padding: 0; font-size: 0.88rem; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; border-radius: 0.2em; }\n\n/* Wikilinks, as the editor colours them. A missing target is visibly missing. */\na.wikilink { text-decoration: none; border-bottom: 1px solid var(--agent-100); }\na.wikilink:hover { border-bottom-color: var(--agent-500); }\na.wikilink-missing { color: var(--missing); text-decoration: none; border-bottom: 1px dashed var(--missing); }\n\n/* Tasks and their badges. */\nli.task { list-style: none; margin-left: -1.4rem; padding-left: 0; }\nli.task input[type=\"checkbox\"] { margin-right: 0.35rem; vertical-align: -0.1em; }\nli.task.done { color: var(--text-muted); }\n.task-tag { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.05em 0.5em; border-radius: 999px; background: var(--surface-2); color: var(--text-strong); margin-right: 0.25rem; vertical-align: 0.1em; }\n.task-tag.priority-1 { background: #fee2e2; color: #991b1b; }\n.task-tag.priority-2 { background: #ffedd5; color: #9a3412; }\n.task-tag.priority-3 { background: #fef9c3; color: #854d0e; }\n.task-tag.waiting, .task-tag.doing { background: var(--agent-100); color: var(--agent-600); }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Table of contents, diagrams, maths. */\n.toc { margin: 0 0 1.5rem; font-size: 0.95rem; }\n.toc summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }\n.toc ul { list-style: none; padding-left: 0; margin: 0.4rem 0 0; }\n.toc li.toc-level-3 { padding-left: 1rem; }\n.toc li.toc-level-4 { padding-left: 2rem; }\n.diagram { margin: 1rem 0; text-align: center; }\n.diagram svg { max-width: 100%; height: auto; }\n.math-block { overflow-x: auto; margin: 1rem 0; }\n\n/* Linked references, beneath the content. */\n.backlinks { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-soft); }\n.backlinks h2 { font-size: 1.1rem; color: var(--text-strong); margin: 0 0 0.75rem; }\n.backlink-list { list-style: none; padding: 0; margin: 0; }\n.backlink-source { margin: 0 0 0.9rem; }\n.backlink-source > a { font-weight: 600; }\n.backlink-source ul { list-style: none; padding-left: 1rem; margin: 0.25rem 0 0; border-left: 2px solid var(--border-soft); }\n.backlink-context { color: var(--text-muted); font-size: 0.95rem; margin: 0.15rem 0; }\n\n/* Archive and index lists. */\n.journal-archive, .page-index-list { list-style: none; padding: 0; }\n/* The contents page: the outline as a tree, then any page it leaves out. */\n.page-index-list .page-index-list { padding-left: 1.5rem; margin-top: 0.3rem; }\n.page-index-list li { margin: 0.4rem 0; }\n.page-index-group-label { color: var(--text-muted); font-weight: 600; }\n.page-index-other { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n.journal-archive li { margin: 0 0 1rem; }\n.journal-archive time { color: var(--text-muted); margin-right: 0.5rem; font-variant-numeric: tabular-nums; }\n.archive-excerpt { margin: 0.2rem 0 0; color: var(--text-muted); }\n.archive-year { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n\n.site-footer { border-top: 1px solid var(--border-soft); padding: 1rem 1.5rem; color: var(--text-muted); font-size: 0.9rem; text-align: center; }\n\n/* Code tokens (lezer classHighlighter names). */\n.tok-keyword { color: #0a7; }\n.tok-string, .tok-string2 { color: #690; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: #999; font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: #905; }\n.tok-function, .tok-definition.tok-variableName { color: #c60; }\n.tok-typeName, .tok-className, .tok-namespace { color: #b58900; }\n.tok-operator, .tok-punctuation { color: #555; }\n.tok-propertyName, .tok-attributeName { color: #268bd2; }\n.tok-tagName { color: #22863a; }\n.tok-invalid { color: #d00; }\n@media (prefers-color-scheme: dark) {\n .tok-keyword { color: #4ec9b0; }\n .tok-string, .tok-string2 { color: #b5cea8; }\n .tok-comment, .tok-lineComment, .tok-blockComment { color: #7f848e; }\n .tok-number, .tok-bool, .tok-null, .tok-atom { color: #d19a66; }\n .tok-function, .tok-definition.tok-variableName { color: #dcdcaa; }\n .tok-typeName, .tok-className, .tok-namespace { color: #e5c07b; }\n .tok-operator, .tok-punctuation { color: #abb2bf; }\n .tok-propertyName, .tok-attributeName { color: #61afef; }\n .tok-tagName { color: #98c379; }\n}\n\n/* -- Small screens: the sidebar becomes a drawer ---------------------------------------- */\n@media (max-width: 56rem) {\n /* Content flows on its own; the drawer and its toggle are fixed, so the shell reserves no\n row for either (a grid row here stretched the toggle to the full page height). */\n .shell { display: block; min-height: 0; }\n .site-header { padding-right: 4.25rem; }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0.5rem;\n right: 1rem;\n width: 2.5rem;\n height: 2.5rem;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-1);\n color: var(--text-strong);\n cursor: pointer;\n z-index: 45;\n }\n .nav-toggle:hover { background: var(--surface-2); }\n .nav-toggle:focus-visible { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n .site-nav {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n height: auto;\n width: min(20rem, 85vw);\n border-right: 1px solid var(--border-strong);\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n transform: translateX(-100%);\n /* Hidden while closed, so its links are not tab stops behind the page; the visibility\n change waits for the slide out. */\n visibility: hidden;\n transition: transform 160ms ease-out, visibility 0s linear 160ms;\n z-index: 40;\n }\n body.nav-open .site-nav { transform: translateX(0); visibility: visible; transition: transform 160ms ease-out; }\n body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 35; }\n .content { padding: 1rem 1.25rem 3rem; }\n .site-search { flex-basis: 12rem; }\n}\n@media (prefers-reduced-motion: reduce) {\n .site-nav { transition: none; }\n body.nav-open .site-nav { transition: none; }\n}\n",
|
|
13774
|
+
"../etherpk-docs/assets/theme.css": "/* EtherPK docs theme. Tokens follow the app's own (agent blue, the gk surface scale); the font\n is the system stack so the site loads nothing from anywhere. Dark mode follows the reader's\n preference. Classes the publisher emits and this file styles: .wikilink, .wikilink-missing,\n .task, .task-tag, .toc, .backlinks, .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --font-sans: \"Inter\", system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --agent-500: #007acc;\n --agent-600: #005f9e;\n --agent-100: #c2e3ff;\n --surface-0: #ffffff;\n --surface-1: #f9fafb;\n --surface-2: #e5e7eb;\n --text-strong: #030712;\n --text-default: #374151;\n --text-muted: #6b7280;\n --border-soft: rgba(3, 7, 18, 0.08);\n --border-strong: rgba(3, 7, 18, 0.16);\n --mark: #fff3a3;\n --missing: #b45309;\n --nav-width: 17rem;\n /* The header is exactly this tall, so the sticky sidebar and the drawer toggle can be\n measured against it rather than guessing at the search box's height. */\n --header-height: 3.5rem;\n /* The width of the text column beside the sidebar. Pictures are capped to it as well. */\n --content-width: 52rem;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --agent-500: #5ab3ff;\n --agent-600: #94ccff;\n --agent-100: #002e4f;\n --surface-0: #18181b;\n --surface-1: #1c1c20;\n --surface-2: #2a2a30;\n --text-strong: #fafafa;\n --text-default: #d4d4d8;\n --text-muted: #a1a1aa;\n --border-soft: rgba(255, 255, 255, 0.08);\n --border-strong: rgba(255, 255, 255, 0.16);\n --mark: #6b5a00;\n --missing: #f59e0b;\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }\nbody {\n margin: 0;\n color: var(--text-default);\n background: var(--surface-0);\n line-height: 1.6;\n font-size: 16px;\n}\na { color: var(--agent-500); }\na:hover { color: var(--agent-600); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface-1); padding: 0.5rem 1rem; z-index: 100; }\n.skip-link:focus { left: 1rem; top: 1rem; }\n\n/* -- Header ----------------------------------------------------------------------------- */\n.site-header {\n display: flex;\n align-items: center;\n gap: 1rem;\n height: var(--header-height);\n padding: 0 1.5rem;\n border-bottom: 1px solid var(--border-soft);\n background: var(--surface-1);\n position: sticky;\n top: 0;\n z-index: 20;\n}\n.site-title { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 600; color: var(--text-strong); text-decoration: none; font-size: 1.05rem; }\n.site-title:hover { color: var(--agent-500); }\n.site-logo { flex-shrink: 0; }\n.site-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 22rem; }\n.site-search input {\n width: 100%;\n padding: 0.4rem 0.75rem;\n line-height: 1.25;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-0);\n color: var(--text-default);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n.site-search-results {\n position: absolute;\n top: calc(100% + 0.35rem);\n left: 0;\n right: 0;\n max-height: 24rem;\n overflow: auto;\n background: var(--surface-0);\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 0.55rem 0.75rem; text-decoration: none; color: var(--text-default); border-bottom: 1px solid var(--border-soft); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--surface-1); }\n.site-search-title { display: block; font-weight: 600; color: var(--text-strong); }\n.site-search-snippet { display: block; font-size: 0.9rem; color: var(--text-muted); }\n.site-search-empty { margin: 0; padding: 0.6rem 0.75rem; color: var(--text-muted); }\n\n/* -- Shell: sidebar + content ------------------------------------------------------------ */\n.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }\n.site-nav {\n border-right: 1px solid var(--border-soft);\n background: var(--surface-1);\n padding: 1.25rem 1rem;\n overflow-y: auto;\n position: sticky;\n top: var(--header-height);\n height: calc(100vh - var(--header-height));\n}\n.site-nav-list { list-style: none; margin: 0; padding: 0; }\n.site-nav-list .site-nav-list { padding-left: 0.85rem; border-left: 1px solid var(--border-soft); margin-left: 0.5rem; }\n.site-nav li { margin: 0.1rem 0; }\n.site-nav a, .site-nav .nav-group-label {\n display: block;\n padding: 0.3rem 0.6rem;\n border-radius: 0.4rem;\n color: var(--text-default);\n text-decoration: none;\n font-size: 0.95rem;\n line-height: 1.4;\n}\n.site-nav a:hover { background: var(--surface-2); color: var(--text-strong); }\n.site-nav .nav-current > a { background: var(--agent-100); color: var(--text-strong); font-weight: 600; }\n.site-nav .nav-group-label { font-weight: 600; color: var(--text-strong); margin-top: 0.75rem; }\n.site-nav a .wikilink { color: inherit; text-decoration: none; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n\n/* The padding sits outside the text column (border-box would take it from inside). */\n.content { padding: 2rem 3rem 4rem; max-width: calc(var(--content-width) + 6rem); width: 100%; }\n.page-header h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; color: var(--text-strong); }\n.page-header h1 .wikilink { color: inherit; text-decoration: none; }\n.page-header h1 .wikilink:hover { text-decoration: underline; }\n.page-date { color: var(--text-muted); font-size: 0.95rem; }\n.page-body h2 { margin-top: 2rem; font-size: 1.4rem; color: var(--text-strong); }\n.page-body h3 { margin-top: 1.5rem; font-size: 1.15rem; color: var(--text-strong); }\n.page-body ul { padding-left: 1.4rem; }\n.page-body li { margin: 0.2rem 0; }\n.page-body img { max-width: 100%; height: auto; border-radius: 0.35rem; }\n.page-body table { border-collapse: collapse; margin: 1rem 0; width: 100%; }\n.page-body th, .page-body td { border: 1px solid var(--border-strong); padding: 0.4rem 0.6rem; text-align: left; }\n.page-body th { background: var(--surface-1); }\n.page-body blockquote { border-left: 3px solid var(--border-strong); margin: 1rem 0; padding: 0.25rem 1rem; color: var(--text-muted); }\n.page-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-1); padding: 0.1em 0.35em; border-radius: 0.25rem; }\n.page-body pre { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 0.5rem; padding: 0.9rem 1rem; overflow-x: auto; }\n.page-body pre code { background: none; padding: 0; font-size: 0.88rem; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; border-radius: 0.2em; }\n\n/* Wikilinks, as the editor colours them. A missing target is visibly missing. */\na.wikilink { text-decoration: none; border-bottom: 1px solid var(--agent-100); }\na.wikilink:hover { border-bottom-color: var(--agent-500); }\na.wikilink-missing { color: var(--missing); text-decoration: none; border-bottom: 1px dashed var(--missing); }\n\n/* Tasks and their badges. */\nli.task { list-style: none; margin-left: -1.4rem; padding-left: 0; }\nli.task input[type=\"checkbox\"] { margin-right: 0.35rem; vertical-align: -0.1em; }\nli.task.done { color: var(--text-muted); }\n.task-tag { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.05em 0.5em; border-radius: 999px; background: var(--surface-2); color: var(--text-strong); margin-right: 0.25rem; vertical-align: 0.1em; }\n.task-tag.priority-1 { background: #fee2e2; color: #991b1b; }\n.task-tag.priority-2 { background: #ffedd5; color: #9a3412; }\n.task-tag.priority-3 { background: #fef9c3; color: #854d0e; }\n.task-tag.waiting, .task-tag.doing { background: var(--agent-100); color: var(--agent-600); }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Table of contents, diagrams, maths. */\n.toc { margin: 0 0 1.5rem; font-size: 0.95rem; }\n.toc summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }\n.toc ul { list-style: none; padding-left: 0; margin: 0.4rem 0 0; }\n.toc li.toc-level-3 { padding-left: 1rem; }\n.toc li.toc-level-4 { padding-left: 2rem; }\n.diagram { margin: 1rem 0; text-align: center; }\n.diagram svg { max-width: 100%; height: auto; }\n.math-block { overflow-x: auto; margin: 1rem 0; }\n\n/* Linked references, beneath the content. */\n.backlinks { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-soft); }\n.backlinks h2 { font-size: 1.1rem; color: var(--text-strong); margin: 0 0 0.75rem; }\n.backlink-list { list-style: none; padding: 0; margin: 0; }\n.backlink-source { margin: 0 0 0.9rem; }\n.backlink-source > a { font-weight: 600; }\n.backlink-source ul { list-style: none; padding-left: 1rem; margin: 0.25rem 0 0; border-left: 2px solid var(--border-soft); }\n.backlink-context { color: var(--text-muted); font-size: 0.95rem; margin: 0.15rem 0; }\n\n/* Archive and index lists. */\n.journal-archive, .page-index-list { list-style: none; padding: 0; }\n/* The contents page: the outline as a tree, then any page it leaves out. */\n.page-index-list .page-index-list { padding-left: 1.5rem; margin-top: 0.3rem; }\n.page-index-list li { margin: 0.4rem 0; }\n.page-index-group-label { color: var(--text-muted); font-weight: 600; }\n.page-index-other { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n.journal-archive li { margin: 0 0 1rem; }\n.journal-archive time { color: var(--text-muted); margin-right: 0.5rem; font-variant-numeric: tabular-nums; }\n.archive-excerpt { margin: 0.2rem 0 0; color: var(--text-muted); }\n.archive-year { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }\n\n.site-footer { border-top: 1px solid var(--border-soft); padding: 1rem 1.5rem; color: var(--text-muted); font-size: 0.9rem; text-align: center; }\n\n/* Code tokens (lezer classHighlighter names). */\n.tok-keyword { color: #0a7; }\n.tok-string, .tok-string2 { color: #690; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: #999; font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: #905; }\n.tok-function, .tok-definition.tok-variableName { color: #c60; }\n.tok-typeName, .tok-className, .tok-namespace { color: #b58900; }\n.tok-operator, .tok-punctuation { color: #555; }\n.tok-propertyName, .tok-attributeName { color: #268bd2; }\n.tok-tagName { color: #22863a; }\n.tok-invalid { color: #d00; }\n@media (prefers-color-scheme: dark) {\n .tok-keyword { color: #4ec9b0; }\n .tok-string, .tok-string2 { color: #b5cea8; }\n .tok-comment, .tok-lineComment, .tok-blockComment { color: #7f848e; }\n .tok-number, .tok-bool, .tok-null, .tok-atom { color: #d19a66; }\n .tok-function, .tok-definition.tok-variableName { color: #dcdcaa; }\n .tok-typeName, .tok-className, .tok-namespace { color: #e5c07b; }\n .tok-operator, .tok-punctuation { color: #abb2bf; }\n .tok-propertyName, .tok-attributeName { color: #61afef; }\n .tok-tagName { color: #98c379; }\n}\n\n/* -- Small screens: the sidebar becomes a drawer ---------------------------------------- */\n@media (max-width: 56rem) {\n /* Content flows on its own; the drawer and its toggle are fixed, so the shell reserves no\n row for either (a grid row here stretched the toggle to the full page height). */\n .shell { display: block; min-height: 0; }\n .site-header { padding-right: 4.25rem; }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0.5rem;\n right: 1rem;\n width: 2.5rem;\n height: 2.5rem;\n border: 1px solid var(--border-strong);\n border-radius: 0.5rem;\n background: var(--surface-1);\n color: var(--text-strong);\n cursor: pointer;\n z-index: 45;\n }\n .nav-toggle:hover { background: var(--surface-2); }\n .nav-toggle:focus-visible { outline: 2px solid var(--agent-500); outline-offset: 1px; }\n .site-nav {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n height: auto;\n width: min(20rem, 85vw);\n border-right: 1px solid var(--border-strong);\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n transform: translateX(-100%);\n /* Hidden while closed, so its links are not tab stops behind the page; the visibility\n change waits for the slide out. */\n visibility: hidden;\n transition: transform 160ms ease-out, visibility 0s linear 160ms;\n z-index: 40;\n }\n body.nav-open .site-nav { transform: translateX(0); visibility: visible; transition: transform 160ms ease-out; }\n body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 35; }\n .content { padding: 1rem 1.25rem 3rem; }\n /* The box is narrow here, beside the title and the menu button, so its results hang from the\n header instead: once the form is static, the sticky header is what they are positioned in.\n The height limit keeps the last result reachable on a phone held sideways, since the panel\n moves with the header and scrolling the page would not bring its end into view. */\n .site-search { flex-basis: 12rem; position: static; }\n .site-search-results {\n left: auto;\n right: 1rem;\n width: min(26rem, calc(100vw - 2rem));\n max-height: min(24rem, calc(100dvh - var(--header-height) - 1rem));\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .site-nav { transition: none; }\n body.nav-open .site-nav { transition: none; }\n}\n",
|
|
13639
13775
|
"../etherpk-docs/layouts/404.html": "{{> shell-top}}\n <article class=\"page not-published\">\n <header class=\"page-header\">\n <h1>Not published</h1>\n </header>\n <div class=\"page-body\">\n <p>The page you followed a link to is not part of this site.</p>\n <p><a href=\"index.html\">Back to {{site.title}}</a></p>\n </div>\n </article>\n{{> shell-bottom}}\n",
|
|
13640
13776
|
"../etherpk-docs/layouts/archive.html": "{{> shell-top}}\n <article class=\"page archive\">\n <header class=\"page-header\">\n <h1>{{#page.isPostsArchive}}Posts{{/page.isPostsArchive}}{{#page.isJournalArchive}}Journal{{/page.isJournalArchive}}</h1>\n </header>\n {{#page.isPostsArchive}}\n {{#site.postsByYear}}\n <h2 class=\"archive-year\" id=\"y{{year}}\">{{year}}</h2>\n <ul class=\"journal-archive\">\n {{#posts}}\n <li>\n <time datetime=\"{{date}}\">{{date}}</time>\n <a href=\"{{url}}\">{{title}}</a>\n </li>\n {{/posts}}\n </ul>\n {{/site.postsByYear}}\n {{/page.isPostsArchive}}\n {{#page.isJournalArchive}}\n <ul class=\"journal-archive\">\n {{#site.journals}}\n <li>\n <time datetime=\"{{date}}\">{{date}}</time>\n <a href=\"{{url}}\">{{title}}</a>\n {{#excerpt}}<p class=\"archive-excerpt\">{{excerpt}}</p>{{/excerpt}}\n </li>\n {{/site.journals}}\n </ul>\n {{/page.isJournalArchive}}\n </article>\n{{> shell-bottom}}\n",
|
|
13641
13777
|
"../etherpk-docs/layouts/home.html": "{{> shell-top}}\n <article class=\"page home\">\n {{^page.isGeneratedIndex}}\n <header class=\"page-header\">\n <h1>{{{page.titleHtml}}}</h1>\n </header>\n{{> toc}}\n {{/page.isGeneratedIndex}}\n {{#page.isGeneratedIndex}}\n <header class=\"page-header\">\n <h1>{{site.title}}</h1>\n </header>\n {{/page.isGeneratedIndex}}\n <div class=\"page-body\">\n{{{page.content}}}\n </div>\n </article>\n{{> shell-bottom}}\n",
|
|
@@ -13711,7 +13847,7 @@ var files = /* #__PURE__ */ Object.assign({
|
|
|
13711
13847
|
"../etherpk-stack/theme.json": "{\n \"name\": \"etherpk-stack\",\n \"title\": \"EtherPK Stack\",\n \"version\": \"1.0.0\",\n \"contract\": 1,\n \"description\": \"In the mould of Hugo's Stack: a card-based blog with a left sidebar of site identity and menu, article cards in the middle, and widgets (search, contents, archive, pages) on the right.\",\n \"kinds\": [\"blog\", \"docs\"],\n \"includes\": [\n { \"name\": \"head\", \"description\": \"Extra markup inside <head>: analytics, fonts, meta tags. Raw HTML in the page body.\" },\n { \"name\": \"logo\", \"description\": \"The avatar above the site title in the sidebar: an image or inline SVG. Replaces the EtherPK icon.\" },\n { \"name\": \"favicon\", \"description\": \"The icon in the browser tab: a <link rel=\\\"icon\\\"> tag. Raw HTML in the page body. Replaces the EtherPK icon.\" },\n { \"name\": \"header\", \"description\": \"The left sidebar's identity block (avatar, title, description). Replaces the theme's - the menu stays.\" },\n { \"name\": \"before-content\", \"description\": \"Rendered above every page's content: a banner, a notice.\" },\n { \"name\": \"after-content\", \"description\": \"Rendered below every page's content, above the linked references: an author bio, a comments widget.\" },\n { \"name\": \"footer\", \"description\": \"The footer under the article column.\" },\n { \"name\": \"scripts\", \"description\": \"Scripts before </body>, added after the theme's own (search, the theme toggle): analytics, a widget. Raw HTML in the page body.\" },\n { \"name\": \"styles\", \"description\": \"CSS appended after the theme's stylesheet: the page's first css fence.\", \"kind\": \"css\" }\n ],\n \"files\": [\n \"layouts/page.html\", \"layouts/home.html\", \"layouts/journal.html\", \"layouts/archive.html\", \"layouts/404.html\",\n \"partials/shell-top.html\", \"partials/shell-bottom.html\", \"partials/head.html\", \"partials/logo.html\", \"partials/favicon.html\", \"partials/header.html\",\n \"partials/nav-item.html\", \"partials/toc.html\", \"partials/backlinks.html\", \"partials/article-card.html\", \"partials/widgets.html\",\n \"partials/before-content.html\", \"partials/after-content.html\", \"partials/footer.html\", \"partials/theme-scripts.html\", \"partials/scripts.html\",\n \"assets/theme.css\", \"assets/favicon.svg\", \"assets/search.js\", \"assets/theme.js\"\n ]\n}\n",
|
|
13712
13848
|
"../etherpk-terminal/assets/favicon.svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 191.82 166.13\">\n <path fill=\"#0a0a0a\" fill-rule=\"evenodd\" d=\"M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z\"/>\n</svg>\n",
|
|
13713
13849
|
"../etherpk-terminal/assets/search.js": "/*\n * Search for a Published Site: reads search.json (built over the publication's own documents\n * and nothing else) and scores documents by title and text matches. No dependencies, no\n * network beyond the one index file, and nothing runs until the search box is used. The same\n * script runs the sidebar toggle on small screens, so a page carries one script.\n */\n(function () {\n 'use strict';\n\n // -- Navigation toggle (small screens) -------------------------------------------------\n var toggle = document.querySelector('.nav-toggle');\n var backdrop = document.querySelector('.nav-backdrop');\n var nav = document.getElementById('site-nav');\n function setNavOpen(open) {\n var was = document.body.classList.contains('nav-open');\n document.body.classList.toggle('nav-open', open);\n if (toggle) toggle.setAttribute('aria-expanded', open ? 'true' : 'false');\n if (backdrop) backdrop.hidden = !open;\n // Focus follows the drawer: into its first link on open, back to the button on close,\n // so a keyboard or screen-reader user is never left on something now hidden.\n if (open && !was) {\n var first = nav.querySelector('a');\n if (first) first.focus();\n } else if (!open && was && toggle) {\n toggle.focus();\n }\n }\n if (toggle && nav) {\n toggle.addEventListener('click', function () { setNavOpen(!document.body.classList.contains('nav-open')); });\n if (backdrop) backdrop.addEventListener('click', function () { setNavOpen(false); });\n document.addEventListener('keydown', function (e) {\n if (e.key === 'Escape' && document.body.classList.contains('nav-open')) setNavOpen(false);\n });\n }\n\n // -- Search --------------------------------------------------------------------------\n var form = document.querySelector('.site-search');\n if (!form) return;\n var input = form.querySelector('input[type=\"search\"]');\n var results = form.querySelector('.site-search-results');\n var indexUrl = form.getAttribute('data-search-index') || 'search.json';\n var scriptUrl = form.getAttribute('data-search-script') || 'search-index.js';\n var index = null;\n var loading = null;\n /* True once neither route produced the index: the results then say so rather than \"nothing matches\". */\n var unavailable = false;\n\n /* The index as a script assigning window.etherpkSearchIndex: what a site opened from disk can\n load, since file:// refuses fetch but allows <script src>. */\n function loadScript() {\n return new Promise(function (resolve, reject) {\n if (window.etherpkSearchIndex) { resolve(window.etherpkSearchIndex); return; }\n var s = document.createElement('script');\n s.src = scriptUrl;\n s.onload = function () {\n if (window.etherpkSearchIndex) resolve(window.etherpkSearchIndex);\n else reject(new Error('no index'));\n };\n s.onerror = function () { reject(new Error('no script')); };\n document.head.appendChild(s);\n });\n }\n\n function load() {\n if (index) return Promise.resolve(index);\n if (!loading) {\n loading = fetch(indexUrl).then(function (r) {\n if (!r.ok) throw new Error(String(r.status));\n return r.json();\n }).catch(loadScript).then(function (data) {\n index = (data && data.documents) || [];\n return index;\n }).catch(function () { unavailable = true; index = []; return index; });\n }\n return loading;\n }\n\n function tokens(q) {\n return q.toLowerCase().split(/\\s+/).filter(function (t) { return t.length > 0; });\n }\n\n function score(doc, terms) {\n var title = (doc.title || '').toLowerCase();\n var text = (doc.text || '').toLowerCase();\n var s = 0;\n for (var i = 0; i < terms.length; i++) {\n var t = terms[i];\n if (title === t) s += 20;\n else if (title.indexOf(t) === 0) s += 10;\n else if (title.indexOf(t) !== -1) s += 6;\n var at = text.indexOf(t);\n if (at !== -1) s += 2;\n else if (title.indexOf(t) === -1) return 0; // every term must match somewhere\n }\n return s;\n }\n\n function snippet(doc, terms) {\n var text = doc.text || '';\n var lower = text.toLowerCase();\n var at = -1;\n for (var i = 0; i < terms.length && at === -1; i++) at = lower.indexOf(terms[i]);\n if (at === -1) return doc.excerpt || '';\n var start = Math.max(0, at - 60);\n var end = Math.min(text.length, at + 100);\n return (start > 0 ? '…' : '') + text.slice(start, end).replace(/\\s+/g, ' ') + (end < text.length ? '…' : '');\n }\n\n function escapeHtml(s) {\n return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n }\n\n function render(list, q) {\n if (!q) { results.hidden = true; results.innerHTML = ''; return; }\n if (unavailable) {\n results.innerHTML = '<p class=\"site-search-empty\">The search index could not be loaded.</p>';\n results.hidden = false;\n return;\n }\n if (list.length === 0) {\n results.innerHTML = '<p class=\"site-search-empty\">Nothing matches \"' + escapeHtml(q) + '\".</p>';\n results.hidden = false;\n return;\n }\n results.innerHTML = list.map(function (hit) {\n return '<a class=\"site-search-hit\" role=\"option\" href=\"' + escapeHtml(hit.doc.url) + '\">' +\n '<span class=\"site-search-title\">' + escapeHtml(hit.doc.title) + '</span>' +\n '<span class=\"site-search-snippet\">' + escapeHtml(hit.snippet) + '</span></a>';\n }).join('');\n results.hidden = false;\n }\n\n var timer = null;\n function run() {\n var q = input.value.trim();\n var terms = tokens(q);\n if (terms.length === 0) { render([], ''); return; }\n load().then(function (docs) {\n var hits = [];\n for (var i = 0; i < docs.length; i++) {\n var s = score(docs[i], terms);\n if (s > 0) hits.push({ doc: docs[i], score: s, snippet: snippet(docs[i], terms) });\n }\n hits.sort(function (a, b) { return b.score - a.score || a.doc.title.localeCompare(b.doc.title); });\n render(hits.slice(0, 12), q);\n });\n }\n\n input.addEventListener('input', function () {\n clearTimeout(timer);\n timer = setTimeout(run, 120);\n });\n input.addEventListener('focus', function () { load(); });\n form.addEventListener('submit', function (e) {\n e.preventDefault();\n var first = results.querySelector('a');\n if (first) window.location.href = first.getAttribute('href');\n });\n document.addEventListener('keydown', function (e) {\n if (e.key === '/' && document.activeElement !== input && !/input|textarea/i.test(document.activeElement.tagName)) {\n e.preventDefault();\n input.focus();\n }\n if (e.key === 'Escape' && !results.hidden) { render([], ''); }\n });\n document.addEventListener('click', function (e) {\n if (!form.contains(e.target)) render([], '');\n });\n})();\n",
|
|
13714
|
-
"../etherpk-terminal/assets/theme.css": "/* EtherPK's Terminal: after Hugo's Terminal (panr, MIT), written afresh for EtherPK's view - one\n monospace face, a dark ground, no colour at all - the accent is a brighter shade of the text,\n so everything is drawn in tones of one ink - the block logo with its blinking cursor,\n underlined titles, framed boxes and bordered buttons. Uses Fira Code\n or the system monospace, so the site loads nothing from anywhere. Classes the publisher emits\n and this file styles: .wikilink, .wikilink-missing, .task, .task-tag, .toc, .backlinks,\n .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --accent: #f2f2f2;\n --background: #1d1e28;\n --color: #cfcfd6;\n --color-muted: #8f8f9a;\n --border-color: rgba(255, 255, 255, 0.1);\n --code-bg: rgba(255, 255, 255, 0.06);\n --font: \"Fira Code\", ui-monospace, Monaco, Consolas, \"Ubuntu Mono\", monospace;\n --container-width: 1080px;\n --mark: rgba(255, 255, 255, 0.22);\n --missing: var(--color-muted);\n}\n/* Terminal is dark by nature; a light system preference is respected, the ink inverted. */\n@media (prefers-color-scheme: light) {\n :root:not([data-theme=\"dark\"]) {\n --accent: #111111;\n --background: #f7f4ef;\n --color: #2b2b2b;\n --color-muted: #6a6a6a;\n --mark: rgba(0, 0, 0, 0.14);\n --border-color: rgba(0, 0, 0, 0.12);\n --code-bg: rgba(0, 0, 0, 0.05);\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { color-scheme: dark light; }\nbody {\n margin: 0;\n font-family: var(--font);\n font-size: 0.9375rem;\n line-height: 1.6;\n background: var(--background);\n color: var(--color);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-feature-settings: \"liga\", \"tnum\", \"zero\", \"ss01\", \"locl\";\n}\na { color: var(--accent); }\na:hover { text-decoration: none; }\nimg { max-width: 100%; height: auto; display: block; }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--background); padding: 8px 16px; z-index: 100; }\n.skip-link:focus { left: 16px; top: 16px; }\n\n.container { max-width: var(--container-width); margin: 0 auto; padding: 40px; }\n\n/* -- Header: the prompt-style logo ------------------------------------------------------ */\n.header { margin-bottom: 40px; }\n.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }\n/* The block logo: the mark, the title and a blinking cursor on one line, the mark's box sized\n to the text's cap height so the two read as one glyph run. */\n.logo {\n display: inline-flex;\n align-items: center;\n gap: 12px;\n padding: 8px 16px;\n background: var(--accent);\n color: var(--background);\n font-size: 1.375rem;\n line-height: 1;\n font-weight: bold;\n text-decoration: none;\n}\n.logo:hover { text-decoration: none; }\n.logo__mark { display: inline-flex; align-items: center; line-height: 0; }\n.logo__mark .site-logo { display: block; width: 1.3em; height: 1.125em; }\n.logo__cursor {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n background: var(--background);\n animation: cursor 1s infinite;\n}\n@keyframes cursor { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .logo__cursor { animation: none; } }\n.menu { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; }\n.menu__inner { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 30px; }\n.menu__inner li a, .menu__inner .nav-group-label { color: var(--color); text-decoration: none; }\n.menu__inner li a:hover { color: var(--accent); }\n.menu__inner .nav-current > a { color: var(--accent); }\n.menu__inner .nav-current > a::after { content: \" *\"; }\n.menu__inner .nav-group-label { color: var(--color-muted); }\n.menu__inner .nav-group-label::after { content: \":\"; }\n/* A nested outline level follows its parent on the same line, the way a path reads. */\n.menu__inner li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }\n.menu__inner .site-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }\n.menu__inner .site-nav-list li::before { content: \"/\"; color: var(--color-muted); margin-right: 12px; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 16rem; }\n.site-search input {\n width: 100%;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--color);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }\n.site-search input::placeholder { color: var(--color-muted); }\n.site-search-results {\n position: absolute;\n right: 0;\n top: calc(100% + 6px);\n width: min(26rem, 90vw);\n max-height: 24rem;\n overflow: auto;\n background: var(--background);\n border: 1px solid var(--accent);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 8px 12px; color: var(--color); text-decoration: none; border-bottom: 1px solid var(--border-color); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--code-bg); }\n.site-search-title { display: block; color: var(--accent); }\n.site-search-snippet { display: block; color: var(--color-muted); font-size: 0.9rem; }\n.site-search-empty { margin: 0; padding: 8px 12px; color: var(--color-muted); }\n\n/* -- Posts ------------------------------------------------------------------------------ */\n.posts { width: 100%; }\n.post { width: 100%; }\n.post.on-list { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px dotted var(--accent); }\n.post.on-list:last-child { border-bottom: 0; }\n.post-title {\n position: relative;\n margin: 0 0 15px;\n font-size: 1.6rem;\n line-height: 1.3;\n color: var(--accent);\n text-decoration: underline;\n text-decoration-color: var(--accent);\n text-decoration-thickness: 2px;\n text-underline-offset: 6px;\n}\n.post-title a { color: inherit; text-decoration: none; }\n.post-title .wikilink { color: inherit; text-decoration: none; }\n.index-title { text-decoration: none; }\n.index-title::before { content: \"# \"; }\n.post-meta { margin: 0 0 20px; font-size: 0.9rem; color: var(--color-muted); }\n.post-content { margin-top: 20px; }\n.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-weight: bold; line-height: 1.3; margin: 40px 0 20px; }\n.post-content h2 { font-size: 1.3rem; }\n.post-content h3 { font-size: 1.2rem; }\n.post-content h2::before { content: \"## \"; color: var(--accent); }\n.post-content h3::before { content: \"### \"; color: var(--accent); }\n.post-content p { margin: 0 0 20px; }\n.post-content ul, .post-content ol { margin: 0 0 20px; padding-left: 24px; }\n.post-content li { margin: 4px 0; }\n.post-content ul li::marker { color: var(--accent); }\n.post-content img { margin: 20px 0; border: 1px solid var(--border-color); }\n.post-content .diagram { margin: 20px 0; text-align: center; }\n.post-content .diagram svg { max-width: 100%; height: auto; }\n.post-content blockquote {\n position: relative;\n margin: 40px 0;\n padding: 25px;\n border-top: 1px solid var(--accent);\n border-bottom: 1px solid var(--accent);\n font-style: italic;\n}\n.post-content blockquote::before { content: \"”\"; position: absolute; top: -40px; left: 10px; font-size: 3.875rem; font-style: normal; color: var(--accent); }\n.post-content blockquote p:last-child { margin-bottom: 0; }\n.post-content hr { border: 0; border-top: 1px dashed var(--accent); margin: 40px 0; }\n.post-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }\n.post-content th, .post-content td { padding: 8px 12px; border: 1px dashed var(--accent); text-align: left; }\n.post-content th { color: var(--accent); }\n.post-content code { padding: 1px 6px; background: var(--code-bg); font-family: inherit; font-size: 0.95em; }\n.post-content pre {\n margin: 20px 0;\n padding: 20px;\n background: var(--code-bg);\n border-left: 3px solid var(--accent);\n overflow-x: auto;\n font-family: inherit;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n.post-content pre code { padding: 0; background: none; font-size: inherit; }\n.math-block { overflow-x: auto; margin: 20px 0; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; }\n\n/* Wikilinks and tasks. */\na.wikilink { color: var(--accent); }\na.wikilink-missing { color: var(--missing); text-decoration-style: dotted; }\nli.task { list-style: none; margin-left: -24px; }\nli.task input[type=\"checkbox\"] { accent-color: var(--accent); margin-right: 6px; vertical-align: -0.1em; }\nli.task.done { color: var(--color-muted); text-decoration: line-through; }\n.task-tag { display: inline-block; padding: 0 6px; margin-right: 4px; border: 1px solid var(--accent); color: var(--accent); font-size: 0.8rem; }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Buttons, frames, the table of contents and pagination. */\n.button {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n padding: 8px 18px;\n border: 1px solid var(--accent);\n color: var(--accent);\n font: inherit;\n text-decoration: none;\n background: transparent;\n cursor: pointer;\n}\n.button:hover { background: var(--accent); color: var(--background); }\n.button.inline { display: inline-flex; }\n.read-more { margin-top: 10px; }\n.all-posts { margin: 30px 0 0; }\n/* The contents page of a docs site: the outline as a tree, then any page it leaves out. */\n.page-index-list { list-style: none; margin: 0; padding: 0; }\n.page-index-list .page-index-list { padding-left: 24px; }\n.page-index-list li { margin: 6px 0; }\n.page-index-list li::before { content: \"- \"; color: var(--accent); }\n.page-index-list a { color: var(--color); }\n.page-index-list a:hover { color: var(--accent); }\n.page-index-group-label { color: var(--color-muted); }\n.page-index-group-label::after { content: \":\"; }\n.page-index-other { margin: 30px 0 10px; font-size: 1.1rem; }\n.page-index-other::before { content: \"## \"; color: var(--accent); }\n/* The archives: a year as a prompt-style heading, then one line per post. */\n.archive-year { margin: 30px 0 10px; font-size: 1.1rem; }\n.archive-year::before { content: \"## \"; color: var(--accent); }\n.archive-list { list-style: none; margin: 0; padding: 0; }\n.archive-list li { margin: 6px 0; }\n.archive-list time { color: var(--color-muted); margin-right: 12px; font-variant-numeric: tabular-nums; }\n.archive-list a { color: var(--color); }\n.archive-list a:hover { color: var(--accent); }\n.archive-excerpt { color: var(--color-muted); }\n.framed { border: 1px solid var(--accent); padding: 20px; }\n.toc { margin: 20px 0 40px; }\n.toc__title { margin: 0 0 10px; color: var(--accent); }\n.toc ul { list-style: none; margin: 0; padding: 0; }\n.toc li { margin: 4px 0; }\n.toc li::before { content: \"- \"; color: var(--accent); }\n.toc li.toc-level-3 { padding-left: 1.5rem; }\n.toc li.toc-level-4 { padding-left: 3rem; }\n.toc a { color: var(--color); text-decoration: none; }\n.toc a:hover { color: var(--accent); }\n.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 50px; }\n.pagination__next { margin-left: auto; }\n.button__text { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n/* Linked references, framed like everything else worth a box. */\n.backlinks { margin-top: 40px; border: 1px solid var(--accent); padding: 20px; }\n.backlinks h2 { margin: 0 0 12px; font-size: 1rem; color: var(--accent); }\n.backlinks h2::before { content: \":: \"; }\n.backlink-list { list-style: none; margin: 0; padding: 0; }\n.backlink-source { margin: 0 0 12px; }\n.backlink-source > a { color: var(--color); }\n.backlink-source ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 16px; border-left: 1px dashed var(--accent); }\n.backlink-context { color: var(--color-muted); font-size: 0.9rem; margin: 2px 0; }\n\n/* -- Footer ----------------------------------------------------------------------------- */\n.footer { margin-top: 60px; padding-top: 20px; border-top: 1px dotted var(--accent); font-size: 0.9rem; color: var(--color-muted); }\n.footer__inner { display: flex; flex-wrap: wrap; gap: 10px; }\n.copyright { display: flex; flex-wrap: wrap; gap: 0 8px; }\n.footer__separator { color: var(--accent); }\n\n/* Code tokens (lezer classHighlighter names). */\n/* Code tokens (lezer classHighlighter names), in tones of the one ink: weight and italics carry\n the distinction the usual colours would. */\n.tok-keyword { color: var(--accent); font-weight: bold; }\n.tok-string, .tok-string2 { color: var(--color); font-style: italic; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: var(--color-muted); font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: var(--accent); }\n.tok-function, .tok-definition.tok-variableName { color: var(--accent); }\n.tok-typeName, .tok-className, .tok-namespace { color: var(--accent); font-weight: bold; }\n.tok-operator, .tok-punctuation { color: var(--color-muted); }\n.tok-propertyName, .tok-attributeName { color: var(--color); }\n.tok-tagName { color: var(--accent); }\n.tok-invalid { color: var(--missing); text-decoration: underline wavy; }\n\n/* -- Small screens: the menu behind a Terminal-style button ----------------------------- */\n@media (max-width: 684px) {\n .container { padding: 20px; }\n .nav-toggle {\n display: inline-block;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--accent);\n font: inherit;\n cursor: pointer;\n }\n .nav-toggle::before { content: \"$ \"; }\n .menu { display: none; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 20px; padding: 20px; border: 1px solid var(--accent); }\n body.nav-open .menu { display: flex; }\n .menu__inner { flex-direction: column; gap: 8px; }\n .menu__inner li { flex-direction: column; align-items: flex-start; }\n .menu__inner .site-nav-list { flex-direction: column; padding-left: 12px; }\n .menu__inner .site-nav-list li::before { margin-right: 6px; }\n .site-search { margin-left: 0; flex-basis: auto; }\n .post-title { font-size: 1.3rem; }\n .pagination__prev, .pagination__next { flex-basis: 100%; }\n .pagination__next { justify-content: flex-end; }\n}\n",
|
|
13850
|
+
"../etherpk-terminal/assets/theme.css": "/* EtherPK's Terminal: after Hugo's Terminal (panr, MIT), written afresh for EtherPK's view - one\n monospace face, a dark ground, no colour at all - the accent is a brighter shade of the text,\n so everything is drawn in tones of one ink - the block logo with its blinking cursor,\n underlined titles, framed boxes and bordered buttons. Uses Fira Code\n or the system monospace, so the site loads nothing from anywhere. Classes the publisher emits\n and this file styles: .wikilink, .wikilink-missing, .task, .task-tag, .toc, .backlinks,\n .site-nav-list, .diagram, .math, .tok-* (code). */\n\n:root {\n --accent: #f2f2f2;\n --background: #1d1e28;\n --color: #cfcfd6;\n --color-muted: #8f8f9a;\n --border-color: rgba(255, 255, 255, 0.1);\n --code-bg: rgba(255, 255, 255, 0.06);\n --font: \"Fira Code\", ui-monospace, Monaco, Consolas, \"Ubuntu Mono\", monospace;\n --container-width: 1080px;\n --mark: rgba(255, 255, 255, 0.22);\n --missing: var(--color-muted);\n}\n/* Terminal is dark by nature; a light system preference is respected, the ink inverted. */\n@media (prefers-color-scheme: light) {\n :root:not([data-theme=\"dark\"]) {\n --accent: #111111;\n --background: #f7f4ef;\n --color: #2b2b2b;\n --color-muted: #6a6a6a;\n --mark: rgba(0, 0, 0, 0.14);\n --border-color: rgba(0, 0, 0, 0.12);\n --code-bg: rgba(0, 0, 0, 0.05);\n }\n}\n\n*, *::before, *::after { box-sizing: border-box; }\nhtml { color-scheme: dark light; }\nbody {\n margin: 0;\n font-family: var(--font);\n font-size: 0.9375rem;\n line-height: 1.6;\n background: var(--background);\n color: var(--color);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n font-feature-settings: \"liga\", \"tnum\", \"zero\", \"ss01\", \"locl\";\n}\na { color: var(--accent); }\na:hover { text-decoration: none; }\nimg { max-width: 100%; height: auto; display: block; }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--background); padding: 8px 16px; z-index: 100; }\n.skip-link:focus { left: 16px; top: 16px; }\n\n.container { max-width: var(--container-width); margin: 0 auto; padding: 40px; }\n\n/* -- Header: the prompt-style logo ------------------------------------------------------ */\n.header { margin-bottom: 40px; }\n.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }\n/* The block logo: the mark, the title and a blinking cursor on one line, the mark's box sized\n to the text's cap height so the two read as one glyph run. */\n.logo {\n display: inline-flex;\n align-items: center;\n gap: 12px;\n padding: 8px 16px;\n background: var(--accent);\n color: var(--background);\n font-size: 1.375rem;\n line-height: 1;\n font-weight: bold;\n text-decoration: none;\n}\n.logo:hover { text-decoration: none; }\n.logo__mark { display: inline-flex; align-items: center; line-height: 0; }\n.logo__mark .site-logo { display: block; width: 1.3em; height: 1.125em; }\n.logo__cursor {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n background: var(--background);\n animation: cursor 1s infinite;\n}\n@keyframes cursor { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .logo__cursor { animation: none; } }\n.menu { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 30px; }\n.menu__inner { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 30px; }\n.menu__inner li a, .menu__inner .nav-group-label { color: var(--color); text-decoration: none; }\n.menu__inner li a:hover { color: var(--accent); }\n.menu__inner .nav-current > a { color: var(--accent); }\n.menu__inner .nav-current > a::after { content: \" *\"; }\n.menu__inner .nav-group-label { color: var(--color-muted); }\n.menu__inner .nav-group-label::after { content: \":\"; }\n/* A nested outline level follows its parent on the same line, the way a path reads. */\n.menu__inner li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }\n.menu__inner .site-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 12px; }\n.menu__inner .site-nav-list li::before { content: \"/\"; color: var(--color-muted); margin-right: 12px; }\n.nav-toggle { display: none; }\n.nav-backdrop { display: none; }\n.site-search { position: relative; margin-left: auto; flex: 0 1 16rem; }\n.site-search input {\n width: 100%;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--color);\n font: inherit;\n}\n.site-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }\n.site-search input::placeholder { color: var(--color-muted); }\n.site-search-results {\n position: absolute;\n right: 0;\n top: calc(100% + 6px);\n width: min(26rem, 90vw);\n max-height: 24rem;\n overflow: auto;\n background: var(--background);\n border: 1px solid var(--accent);\n z-index: 30;\n}\n.site-search-hit { display: block; padding: 8px 12px; color: var(--color); text-decoration: none; border-bottom: 1px solid var(--border-color); }\n.site-search-hit:hover, .site-search-hit:focus { background: var(--code-bg); }\n.site-search-title { display: block; color: var(--accent); }\n.site-search-snippet { display: block; color: var(--color-muted); font-size: 0.9rem; }\n.site-search-empty { margin: 0; padding: 8px 12px; color: var(--color-muted); }\n\n/* -- Posts ------------------------------------------------------------------------------ */\n.posts { width: 100%; }\n.post { width: 100%; }\n.post.on-list { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px dotted var(--accent); }\n.post.on-list:last-child { border-bottom: 0; }\n.post-title {\n position: relative;\n margin: 0 0 15px;\n font-size: 1.6rem;\n line-height: 1.3;\n color: var(--accent);\n text-decoration: underline;\n text-decoration-color: var(--accent);\n text-decoration-thickness: 2px;\n text-underline-offset: 6px;\n}\n.post-title a { color: inherit; text-decoration: none; }\n.post-title .wikilink { color: inherit; text-decoration: none; }\n.index-title { text-decoration: none; }\n.index-title::before { content: \"# \"; }\n.post-meta { margin: 0 0 20px; font-size: 0.9rem; color: var(--color-muted); }\n.post-content { margin-top: 20px; }\n.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-weight: bold; line-height: 1.3; margin: 40px 0 20px; }\n.post-content h2 { font-size: 1.3rem; }\n.post-content h3 { font-size: 1.2rem; }\n.post-content h2::before { content: \"## \"; color: var(--accent); }\n.post-content h3::before { content: \"### \"; color: var(--accent); }\n.post-content p { margin: 0 0 20px; }\n.post-content ul, .post-content ol { margin: 0 0 20px; padding-left: 24px; }\n.post-content li { margin: 4px 0; }\n.post-content ul li::marker { color: var(--accent); }\n.post-content img { margin: 20px 0; border: 1px solid var(--border-color); }\n.post-content .diagram { margin: 20px 0; text-align: center; }\n.post-content .diagram svg { max-width: 100%; height: auto; }\n.post-content blockquote {\n position: relative;\n margin: 40px 0;\n padding: 25px;\n border-top: 1px solid var(--accent);\n border-bottom: 1px solid var(--accent);\n font-style: italic;\n}\n.post-content blockquote::before { content: \"”\"; position: absolute; top: -40px; left: 10px; font-size: 3.875rem; font-style: normal; color: var(--accent); }\n.post-content blockquote p:last-child { margin-bottom: 0; }\n.post-content hr { border: 0; border-top: 1px dashed var(--accent); margin: 40px 0; }\n.post-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }\n.post-content th, .post-content td { padding: 8px 12px; border: 1px dashed var(--accent); text-align: left; }\n.post-content th { color: var(--accent); }\n.post-content code { padding: 1px 6px; background: var(--code-bg); font-family: inherit; font-size: 0.95em; }\n.post-content pre {\n margin: 20px 0;\n padding: 20px;\n background: var(--code-bg);\n border-left: 3px solid var(--accent);\n overflow-x: auto;\n font-family: inherit;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n.post-content pre code { padding: 0; background: none; font-size: inherit; }\n.math-block { overflow-x: auto; margin: 20px 0; }\nmark { background: var(--mark); color: inherit; padding: 0 0.15em; }\n\n/* Wikilinks and tasks. */\na.wikilink { color: var(--accent); }\na.wikilink-missing { color: var(--missing); text-decoration-style: dotted; }\nli.task { list-style: none; margin-left: -24px; }\nli.task input[type=\"checkbox\"] { accent-color: var(--accent); margin-right: 6px; vertical-align: -0.1em; }\nli.task.done { color: var(--color-muted); text-decoration: line-through; }\n.task-tag { display: inline-block; padding: 0 6px; margin-right: 4px; border: 1px solid var(--accent); color: var(--accent); font-size: 0.8rem; }\n.task-tag.cancelled { text-decoration: line-through; }\n\n/* Buttons, frames, the table of contents and pagination. */\n.button {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n padding: 8px 18px;\n border: 1px solid var(--accent);\n color: var(--accent);\n font: inherit;\n text-decoration: none;\n background: transparent;\n cursor: pointer;\n}\n.button:hover { background: var(--accent); color: var(--background); }\n.button.inline { display: inline-flex; }\n.read-more { margin-top: 10px; }\n.all-posts { margin: 30px 0 0; }\n/* The contents page of a docs site: the outline as a tree, then any page it leaves out. */\n.page-index-list { list-style: none; margin: 0; padding: 0; }\n.page-index-list .page-index-list { padding-left: 24px; }\n.page-index-list li { margin: 6px 0; }\n.page-index-list li::before { content: \"- \"; color: var(--accent); }\n.page-index-list a { color: var(--color); }\n.page-index-list a:hover { color: var(--accent); }\n.page-index-group-label { color: var(--color-muted); }\n.page-index-group-label::after { content: \":\"; }\n.page-index-other { margin: 30px 0 10px; font-size: 1.1rem; }\n.page-index-other::before { content: \"## \"; color: var(--accent); }\n/* The archives: a year as a prompt-style heading, then one line per post. */\n.archive-year { margin: 30px 0 10px; font-size: 1.1rem; }\n.archive-year::before { content: \"## \"; color: var(--accent); }\n.archive-list { list-style: none; margin: 0; padding: 0; }\n.archive-list li { margin: 6px 0; }\n.archive-list time { color: var(--color-muted); margin-right: 12px; font-variant-numeric: tabular-nums; }\n.archive-list a { color: var(--color); }\n.archive-list a:hover { color: var(--accent); }\n.archive-excerpt { color: var(--color-muted); }\n.framed { border: 1px solid var(--accent); padding: 20px; }\n.toc { margin: 20px 0 40px; }\n.toc__title { margin: 0 0 10px; color: var(--accent); }\n.toc ul { list-style: none; margin: 0; padding: 0; }\n.toc li { margin: 4px 0; }\n.toc li::before { content: \"- \"; color: var(--accent); }\n.toc li.toc-level-3 { padding-left: 1.5rem; }\n.toc li.toc-level-4 { padding-left: 3rem; }\n.toc a { color: var(--color); text-decoration: none; }\n.toc a:hover { color: var(--accent); }\n.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 50px; }\n.pagination__next { margin-left: auto; }\n.button__text { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n/* Linked references, framed like everything else worth a box. */\n.backlinks { margin-top: 40px; border: 1px solid var(--accent); padding: 20px; }\n.backlinks h2 { margin: 0 0 12px; font-size: 1rem; color: var(--accent); }\n.backlinks h2::before { content: \":: \"; }\n.backlink-list { list-style: none; margin: 0; padding: 0; }\n.backlink-source { margin: 0 0 12px; }\n.backlink-source > a { color: var(--color); }\n.backlink-source ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 16px; border-left: 1px dashed var(--accent); }\n.backlink-context { color: var(--color-muted); font-size: 0.9rem; margin: 2px 0; }\n\n/* -- Footer ----------------------------------------------------------------------------- */\n.footer { margin-top: 60px; padding-top: 20px; border-top: 1px dotted var(--accent); font-size: 0.9rem; color: var(--color-muted); }\n.footer__inner { display: flex; flex-wrap: wrap; gap: 10px; }\n.copyright { display: flex; flex-wrap: wrap; gap: 0 8px; }\n.footer__separator { color: var(--accent); }\n\n/* Code tokens (lezer classHighlighter names). */\n/* Code tokens (lezer classHighlighter names), in tones of the one ink: weight and italics carry\n the distinction the usual colours would. */\n.tok-keyword { color: var(--accent); font-weight: bold; }\n.tok-string, .tok-string2 { color: var(--color); font-style: italic; }\n.tok-comment, .tok-lineComment, .tok-blockComment { color: var(--color-muted); font-style: italic; }\n.tok-number, .tok-bool, .tok-null, .tok-atom { color: var(--accent); }\n.tok-function, .tok-definition.tok-variableName { color: var(--accent); }\n.tok-typeName, .tok-className, .tok-namespace { color: var(--accent); font-weight: bold; }\n.tok-operator, .tok-punctuation { color: var(--color-muted); }\n.tok-propertyName, .tok-attributeName { color: var(--color); }\n.tok-tagName { color: var(--accent); }\n.tok-invalid { color: var(--missing); text-decoration: underline wavy; }\n\n/* -- Small screens: the menu behind a Terminal-style button ----------------------------- */\n@media (max-width: 684px) {\n .container { padding: 20px; }\n .nav-toggle {\n display: inline-block;\n padding: 5px 10px;\n border: 1px solid var(--accent);\n background: transparent;\n color: var(--accent);\n font: inherit;\n cursor: pointer;\n }\n .nav-toggle::before { content: \"$ \"; }\n .menu { display: none; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 20px; padding: 20px; border: 1px solid var(--accent); }\n body.nav-open .menu { display: flex; }\n .menu__inner { flex-direction: column; gap: 8px; }\n .menu__inner li { flex-direction: column; align-items: flex-start; }\n .menu__inner .site-nav-list { flex-direction: column; padding-left: 12px; }\n .menu__inner .site-nav-list li::before { margin-right: 6px; }\n .site-search { margin-left: 0; flex-basis: auto; }\n .site-search-results { left: 0; right: 0; width: auto; }\n .post-title { font-size: 1.3rem; }\n .pagination__prev, .pagination__next { flex-basis: 100%; }\n .pagination__next { justify-content: flex-end; }\n}\n",
|
|
13715
13851
|
"../etherpk-terminal/layouts/404.html": "{{> shell-top}}\n <article class=\"post\">\n <h1 class=\"post-title\">404 :: not published</h1>\n <div class=\"post-content\">\n <p>$ the page you followed a link to is not part of this site.</p>\n <p><a class=\"button inline\" href=\"index.html\">← {{site.title}}</a></p>\n </div>\n </article>\n{{> shell-bottom}}\n",
|
|
13716
13852
|
"../etherpk-terminal/layouts/archive.html": "{{> shell-top}}\n <article class=\"post archive\">\n <h1 class=\"post-title index-title\">{{#page.isPostsArchive}}posts{{/page.isPostsArchive}}{{#page.isJournalArchive}}journal{{/page.isJournalArchive}}</h1>\n {{#page.isPostsArchive}}\n {{#site.postsByYear}}\n <h2 class=\"archive-year\" id=\"y{{year}}\">{{year}}</h2>\n <ul class=\"archive-list\">\n {{#posts}}<li><time datetime=\"{{date}}\">{{date}}</time> <a href=\"{{url}}\">{{title}}</a></li>{{/posts}}\n </ul>\n {{/site.postsByYear}}\n {{/page.isPostsArchive}}\n {{#page.isJournalArchive}}\n <ul class=\"archive-list\">\n {{#site.journals}}<li><time datetime=\"{{date}}\">{{date}}</time> <a href=\"{{url}}\">{{title}}</a>{{#excerpt}} <span class=\"archive-excerpt\">{{excerpt}}</span>{{/excerpt}}</li>{{/site.journals}}\n </ul>\n {{/page.isJournalArchive}}\n </article>\n{{> shell-bottom}}\n",
|
|
13717
13853
|
"../etherpk-terminal/layouts/home.html": "{{> shell-top}}\n {{^page.isGeneratedIndex}}\n <article class=\"post home-info\">\n <h1 class=\"post-title\">{{{page.titleHtml}}}</h1>\n <div class=\"post-content\">\n{{{page.content}}}\n </div>\n </article>\n {{/page.isGeneratedIndex}}\n {{#page.isGeneratedIndex}}\n <h1 class=\"post-title index-title\">{{site.title}}</h1>\n {{/page.isGeneratedIndex}}\n <div class=\"posts\">\n {{#site.isBlog}}{{#site.recentPosts}}{{> post-entry}}{{/site.recentPosts}}{{^site.hasPosts}}<p class=\"post-list-empty\">No dated documents are published yet. A journal entry is dated by its day, a page by a <code>date:</code> line in its frontmatter.</p>{{/site.hasPosts}}{{/site.isBlog}}\n {{^site.isBlog}}{{#page.isGeneratedIndex}}<div class=\"post-content\">{{{page.content}}}</div>{{/page.isGeneratedIndex}}{{/site.isBlog}}\n </div>\n {{#site.isBlog}}{{#site.hasPosts}}\n <p class=\"all-posts\"><a class=\"button inline\" href=\"{{site.postsUrl}}\">$ ls all {{site.postCount}} posts →</a></p>\n {{/site.hasPosts}}{{/site.isBlog}}\n{{> shell-bottom}}\n",
|
|
@@ -13969,7 +14105,7 @@ function httpsAddress(value) {
|
|
|
13969
14105
|
}
|
|
13970
14106
|
}
|
|
13971
14107
|
/** A positive, finite size, or undefined. */
|
|
13972
|
-
function size(value) {
|
|
14108
|
+
function size$1(value) {
|
|
13973
14109
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
13974
14110
|
}
|
|
13975
14111
|
/**
|
|
@@ -13984,8 +14120,8 @@ function checkedFenceAnswer(out) {
|
|
|
13984
14120
|
const kind = answer.kind;
|
|
13985
14121
|
if (kind === "picture") {
|
|
13986
14122
|
const { type, bytes, alt } = answer;
|
|
13987
|
-
const width = size(answer.width);
|
|
13988
|
-
const height = size(answer.height);
|
|
14123
|
+
const width = size$1(answer.width);
|
|
14124
|
+
const height = size$1(answer.height);
|
|
13989
14125
|
if (typeof type !== "string" || !PICTURE_TYPES.has(type) || !(bytes instanceof Uint8Array)) throw new Error("its picture is not an SVG, PNG or WebP file");
|
|
13990
14126
|
if (width === void 0 || height === void 0) throw new Error("its picture has no size");
|
|
13991
14127
|
return {
|
|
@@ -14006,8 +14142,8 @@ function checkedFenceAnswer(out) {
|
|
|
14006
14142
|
if (image !== null && typeof image === "object") {
|
|
14007
14143
|
const { src: rawSrc, alt, width: rawWidth, height: rawHeight } = image;
|
|
14008
14144
|
const src = httpsAddress(rawSrc);
|
|
14009
|
-
const width = size(rawWidth);
|
|
14010
|
-
const height = size(rawHeight);
|
|
14145
|
+
const width = size$1(rawWidth);
|
|
14146
|
+
const height = size$1(rawHeight);
|
|
14011
14147
|
if (src) picture = {
|
|
14012
14148
|
src,
|
|
14013
14149
|
alt: String(alt ?? ""),
|
|
@@ -16569,7 +16705,7 @@ async function openDiagramRenderer(env) {
|
|
|
16569
16705
|
window.mermaid.initialize({
|
|
16570
16706
|
startOnLoad: false,
|
|
16571
16707
|
securityLevel: "strict",
|
|
16572
|
-
theme: "
|
|
16708
|
+
theme: "neutral"
|
|
16573
16709
|
});
|
|
16574
16710
|
});
|
|
16575
16711
|
return p;
|
|
@@ -16600,161 +16736,566 @@ async function openDiagramRenderer(env) {
|
|
|
16600
16736
|
}
|
|
16601
16737
|
};
|
|
16602
16738
|
}
|
|
16603
|
-
//
|
|
16604
|
-
var DRAWING_FENCE = "excalidraw.drawing";
|
|
16605
|
-
// src/page-server.ts
|
|
16739
|
+
// ../client/src/lib/storage/fs/asset-store.ts
|
|
16606
16740
|
/**
|
|
16607
|
-
*
|
|
16608
|
-
*
|
|
16609
|
-
*
|
|
16610
|
-
*
|
|
16741
|
+
* The **Asset store** over a {@link DirectoryAdapter}: uploads land as binary files
|
|
16742
|
+
* under `assets/`, named `kebab-stem.<contenthash>.ext` (DESIGN.md → On-disk layout).
|
|
16743
|
+
* Identical bytes de-duplicate to one file **by content and extension alone** - the stem is
|
|
16744
|
+
* display, not identity - so the same file added again under a different name references the
|
|
16745
|
+
* one already stored rather than writing a second copy. Built on the same File-System seam as
|
|
16746
|
+
* {@link createFilesystemDocumentStore}, so the pure naming/dedup logic is Node-testable
|
|
16747
|
+
* over the in-memory adapter before any browser code runs.
|
|
16748
|
+
*
|
|
16749
|
+
* Assets are referenced from documents by a relative path — `../assets/<name>` — which
|
|
16750
|
+
* resolves from any journal entry or page (both sit one level under the graph root,
|
|
16751
|
+
* the Logseq convention). `resolve` reads those bytes back and hands out an object URL plus
|
|
16752
|
+
* the name and MIME type a download or a viewer needs; the URLs are cached per asset and
|
|
16753
|
+
* revoked on {@link AssetStore.dispose}.
|
|
16754
|
+
*
|
|
16755
|
+
* Remote (S3) upload and per-graph access control are deferred (DESIGN.md → Server
|
|
16756
|
+
* Backend); this is the Filesystem Backend path only.
|
|
16611
16757
|
*/
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
"
|
|
16615
|
-
"
|
|
16616
|
-
"
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
/**
|
|
16624
|
-
|
|
16625
|
-
const files = (await readdir(folder, {
|
|
16626
|
-
recursive: true,
|
|
16627
|
-
withFileTypes: true
|
|
16628
|
-
}).catch(() => [])).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
|
|
16629
|
-
return new Map(files.map((file) => [`/${relative(folder, file).split(sep).join("/")}`, file]));
|
|
16630
|
-
}
|
|
16631
|
-
/** The server: `html` at `/page.html`, and each of `files` at its path. */
|
|
16632
|
-
async function servePage(html, files) {
|
|
16633
|
-
const server = createServer$1((request, response) => {
|
|
16634
|
-
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
16635
|
-
if (path === "/page.html") {
|
|
16636
|
-
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(html);
|
|
16637
|
-
return;
|
|
16638
|
-
}
|
|
16639
|
-
const file = files.get(path);
|
|
16640
|
-
if (!file) {
|
|
16641
|
-
response.writeHead(404).end();
|
|
16642
|
-
return;
|
|
16643
|
-
}
|
|
16644
|
-
readFile(file).then((bytes) => response.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" }).end(bytes), () => response.writeHead(404).end());
|
|
16645
|
-
});
|
|
16646
|
-
await new Promise((resolve, reject) => {
|
|
16647
|
-
server.once("error", reject);
|
|
16648
|
-
server.listen(0, "127.0.0.1", () => resolve());
|
|
16649
|
-
});
|
|
16650
|
-
const address = server.address();
|
|
16651
|
-
if (!address || typeof address === "string") throw new Error("The page server has no port.");
|
|
16652
|
-
return {
|
|
16653
|
-
server,
|
|
16654
|
-
origin: `http://127.0.0.1:${address.port}`
|
|
16655
|
-
};
|
|
16656
|
-
}
|
|
16657
|
-
// src/drawing-pictures.ts
|
|
16758
|
+
/** Extensions rendered inline as images (everything else renders as a download link). */
|
|
16759
|
+
var IMAGE_EXTS = /* @__PURE__ */ new Set([
|
|
16760
|
+
"png",
|
|
16761
|
+
"jpg",
|
|
16762
|
+
"jpeg",
|
|
16763
|
+
"gif",
|
|
16764
|
+
"webp",
|
|
16765
|
+
"svg",
|
|
16766
|
+
"avif",
|
|
16767
|
+
"bmp"
|
|
16768
|
+
]);
|
|
16769
|
+
/** A doc-relative asset reference: optional `../` hops, then `assets/<name>`. */
|
|
16770
|
+
var ASSET_REF = /^(?:\.\.\/)*assets\/(.+)$/;
|
|
16658
16771
|
/**
|
|
16659
|
-
*
|
|
16660
|
-
*
|
|
16661
|
-
*
|
|
16662
|
-
*
|
|
16663
|
-
*
|
|
16664
|
-
* The page runs the Excalidraw extension's own code (`drawing-page/`, built from
|
|
16665
|
-
* `src/drawing-picture-page.ts` beside the Node bundle), and is served, with Excalidraw's chunks and
|
|
16666
|
-
* fonts, from a server on the loopback address (page-server.ts).
|
|
16772
|
+
* An asset could not be fetched just now: the connection failed, or the server answered with a
|
|
16773
|
+
* status that means "try again". It says nothing about whether the file exists, so something
|
|
16774
|
+
* showing the file asks again rather than calling it missing. `status` is the server's answer,
|
|
16775
|
+
* absent when the connection failed before there was one.
|
|
16667
16776
|
*/
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
<script type="module" src="/drawing-picture-page.js"><\/script>
|
|
16677
|
-
</head><body></body></html>`;
|
|
16777
|
+
var AssetUnavailableError = class extends Error {
|
|
16778
|
+
name = "AssetUnavailableError";
|
|
16779
|
+
status;
|
|
16780
|
+
constructor(message, options = {}) {
|
|
16781
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
16782
|
+
this.status = options.status;
|
|
16783
|
+
}
|
|
16784
|
+
};
|
|
16678
16785
|
/**
|
|
16679
|
-
*
|
|
16680
|
-
*
|
|
16786
|
+
* An asset arrived, but not as it was stored: the server offered a different number of chunks than
|
|
16787
|
+
* its encrypted metadata records, or the joined bytes do not match the size or hash recorded there.
|
|
16788
|
+
* Each chunk is authenticated on its own, so this is what catches a file cut short, or a reuse
|
|
16789
|
+
* answer that points at a different file (ADR 0027, amended 2026-10-05). The bytes are never
|
|
16790
|
+
* handed over. Distinct from a missing file (`null`), which is gone, and from an unavailable one,
|
|
16791
|
+
* which may come good by itself.
|
|
16681
16792
|
*/
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
})();
|
|
16695
|
-
return pagePromise;
|
|
16793
|
+
var AssetIntegrityError = class extends Error {
|
|
16794
|
+
name = "AssetIntegrityError";
|
|
16795
|
+
constructor(message = "This file did not arrive complete, so it was not opened. Try again in a moment.") {
|
|
16796
|
+
super(message);
|
|
16797
|
+
}
|
|
16798
|
+
};
|
|
16799
|
+
/** Split a file name into its stem and lower-cased extension (`''` ext when there is none). */
|
|
16800
|
+
function splitNameExt(fileName) {
|
|
16801
|
+
const dot = fileName.lastIndexOf(".");
|
|
16802
|
+
if (dot <= 0) return {
|
|
16803
|
+
stem: fileName,
|
|
16804
|
+
ext: ""
|
|
16696
16805
|
};
|
|
16697
16806
|
return {
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
if (drawn === null) return null;
|
|
16701
|
-
return {
|
|
16702
|
-
kind: "picture",
|
|
16703
|
-
type: drawn.type,
|
|
16704
|
-
width: drawn.width,
|
|
16705
|
-
height: drawn.height,
|
|
16706
|
-
alt: drawn.alt,
|
|
16707
|
-
bytes: new Uint8Array(Buffer$1.from(drawn.data, "base64"))
|
|
16708
|
-
};
|
|
16709
|
-
},
|
|
16710
|
-
async dispose() {
|
|
16711
|
-
await browser.close().catch(() => {});
|
|
16712
|
-
const open = served;
|
|
16713
|
-
await new Promise((resolve) => open ? open.server.close(() => resolve()) : resolve());
|
|
16714
|
-
}
|
|
16807
|
+
stem: fileName.slice(0, dot),
|
|
16808
|
+
ext: fileName.slice(dot + 1).toLowerCase()
|
|
16715
16809
|
};
|
|
16716
16810
|
}
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
light: HOST_STYLE,
|
|
16721
|
-
dark: HOST_STYLE
|
|
16722
|
-
};
|
|
16723
|
-
// src/map-pictures.ts
|
|
16724
|
-
var require$1 = createRequire(import.meta.url);
|
|
16725
|
-
/** The light basemap style a publish draws with, or null for a plain background. */
|
|
16726
|
-
function publishMapStyle(env) {
|
|
16727
|
-
const named = env.ETHERPK_MAP_STYLE_URL;
|
|
16728
|
-
if (named === void 0) return DEFAULT_MAP_STYLES.light;
|
|
16729
|
-
return named.trim() === "" ? null : named.trim();
|
|
16811
|
+
/** True when `ext` (with or without a leading dot) names an inline-rendered image format. */
|
|
16812
|
+
function isImageExt(ext) {
|
|
16813
|
+
return IMAGE_EXTS.has(ext.replace(/^\./, "").toLowerCase());
|
|
16730
16814
|
}
|
|
16731
|
-
/**
|
|
16732
|
-
function
|
|
16733
|
-
|
|
16734
|
-
|
|
16815
|
+
/** The on-disk asset name: `kebab-stem.<hash>.ext` (stem falls back to `asset` when slugging empties it). */
|
|
16816
|
+
function assetFileName(originalName, hash) {
|
|
16817
|
+
const { stem, ext } = splitNameExt(originalName);
|
|
16818
|
+
const slug = publishSlug(stem) || "asset";
|
|
16819
|
+
return ext ? `${slug}.${hash}.${ext}` : `${slug}.${hash}`;
|
|
16735
16820
|
}
|
|
16736
|
-
/** The
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
<script type="importmap">{"imports":{"maplibre-gl":"/maplibre-gl.mjs"}}<\/script>
|
|
16740
|
-
<script type="module" src="/map-picture-page.js"><\/script>
|
|
16741
|
-
</head><body></body></html>`;
|
|
16742
|
-
/** The files the page loads, by path, and where each is on disk. */
|
|
16743
|
-
function pageFiles() {
|
|
16744
|
-
const maplibre = dirname(require$1.resolve("maplibre-gl/dist/maplibre-gl.mjs"));
|
|
16745
|
-
return /* @__PURE__ */ new Map([
|
|
16746
|
-
["/maplibre-gl.mjs", join(maplibre, "maplibre-gl.mjs")],
|
|
16747
|
-
["/maplibre-gl-shared.mjs", join(maplibre, "maplibre-gl-shared.mjs")],
|
|
16748
|
-
["/maplibre-gl-worker.mjs", join(maplibre, "maplibre-gl-worker.mjs")],
|
|
16749
|
-
["/map-picture-page.js", builtPath("map-picture-page.js")]
|
|
16750
|
-
]);
|
|
16821
|
+
/** The de-duplication key: content plus extension. The stem is display, not identity. */
|
|
16822
|
+
function contentKey(hash, ext) {
|
|
16823
|
+
return `${hash}.${ext}`;
|
|
16751
16824
|
}
|
|
16752
16825
|
/**
|
|
16753
|
-
*
|
|
16754
|
-
*
|
|
16826
|
+
* An on-disk asset name with its content hash taken back out — `q3-report.a1b2c3d4.pdf` reads as
|
|
16827
|
+
* `q3-report.pdf`. What a download is called and what titles an asset tab, so neither shows a
|
|
16828
|
+
* user a hash they never typed. A name this store did not write is returned unchanged.
|
|
16755
16829
|
*/
|
|
16756
|
-
|
|
16757
|
-
const
|
|
16830
|
+
function displayAssetName(fileName) {
|
|
16831
|
+
const parsed = assetHashFromName(fileName);
|
|
16832
|
+
if (!parsed) return fileName;
|
|
16833
|
+
const stem = fileName.slice(0, fileName.length - `.${parsed.hash}`.length - (parsed.ext ? parsed.ext.length + 1 : 0));
|
|
16834
|
+
return parsed.ext ? `${stem}.${parsed.ext}` : stem;
|
|
16835
|
+
}
|
|
16836
|
+
/**
|
|
16837
|
+
* MIME types for the formats the app itself renders, plus the handful a browser needs told about
|
|
16838
|
+
* to do anything sensible with a download. Deliberately small and deliberately **empty for
|
|
16839
|
+
* anything else**: a wrong type is worse than none, because a wrong one is acted on. The
|
|
16840
|
+
* Filesystem Backend has nowhere else to learn a type from — unlike the Server Backend, which
|
|
16841
|
+
* carries the uploader's own MIME type inside the encrypted asset metadata.
|
|
16842
|
+
*/
|
|
16843
|
+
var MIME_TYPES = {
|
|
16844
|
+
png: "image/png",
|
|
16845
|
+
jpg: "image/jpeg",
|
|
16846
|
+
jpeg: "image/jpeg",
|
|
16847
|
+
gif: "image/gif",
|
|
16848
|
+
webp: "image/webp",
|
|
16849
|
+
svg: "image/svg+xml",
|
|
16850
|
+
avif: "image/avif",
|
|
16851
|
+
bmp: "image/bmp",
|
|
16852
|
+
pdf: "application/pdf",
|
|
16853
|
+
txt: "text/plain",
|
|
16854
|
+
csv: "text/csv",
|
|
16855
|
+
json: "application/json",
|
|
16856
|
+
md: "text/markdown",
|
|
16857
|
+
mp3: "audio/mpeg",
|
|
16858
|
+
mp4: "video/mp4",
|
|
16859
|
+
webm: "video/webm",
|
|
16860
|
+
zip: "application/zip"
|
|
16861
|
+
};
|
|
16862
|
+
/** The MIME type for a file extension (with or without a leading dot), or `''` when unknown. */
|
|
16863
|
+
function mimeTypeForExt(ext) {
|
|
16864
|
+
return MIME_TYPES[ext.replace(/^\./, "").toLowerCase()] ?? "";
|
|
16865
|
+
}
|
|
16866
|
+
/**
|
|
16867
|
+
* The on-disk name referenced by a doc-relative asset ref, or `null` if `ref` is not an asset
|
|
16868
|
+
* reference. A reference whose name decodes to anything but one file inside `assets/`, or does not
|
|
16869
|
+
* decode at all, is not one: it can never name a file on disk (see `isSafeAssetName`).
|
|
16870
|
+
*/
|
|
16871
|
+
function assetNameFromRef(ref) {
|
|
16872
|
+
const clean = ref.split(/[?#]/)[0];
|
|
16873
|
+
const match = ASSET_REF.exec(clean);
|
|
16874
|
+
if (!match) return null;
|
|
16875
|
+
let name;
|
|
16876
|
+
try {
|
|
16877
|
+
name = decodeURIComponent(match[1]);
|
|
16878
|
+
} catch {
|
|
16879
|
+
return null;
|
|
16880
|
+
}
|
|
16881
|
+
return isSafeAssetName(name) ? name : null;
|
|
16882
|
+
}
|
|
16883
|
+
/**
|
|
16884
|
+
* The markdown to embed a saved asset: an inline image, or a plain link that downloads on click.
|
|
16885
|
+
* For an image, an optional `displaySize` (e.g. `300` or `300x200`) is added as a `|` display-size
|
|
16886
|
+
* hint; the caller is responsible for passing a valid spec (see `normalizeDisplaySize`).
|
|
16887
|
+
*/
|
|
16888
|
+
function buildAssetMarkdown(asset, displaySize) {
|
|
16889
|
+
if (!asset.isImage) return `[${asset.stem}](${asset.ref})`;
|
|
16890
|
+
return ``;
|
|
16891
|
+
}
|
|
16892
|
+
/** First 8 hex chars of the SHA-256 of the bytes — the content hash in the asset name. */
|
|
16893
|
+
async function contentHash(bytes) {
|
|
16894
|
+
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
16895
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
|
|
16896
|
+
}
|
|
16897
|
+
function createAssetStore(adapter) {
|
|
16898
|
+
const urlCache = /* @__PURE__ */ new Map();
|
|
16899
|
+
/**
|
|
16900
|
+
* Content key → the on-disk name already holding those bytes. Built from `assets/` on the
|
|
16901
|
+
* first save (so a store that only ever resolves never pays for the listing) and maintained
|
|
16902
|
+
* on every write after that.
|
|
16903
|
+
*
|
|
16904
|
+
* This is what keeps the [[Asset]] guarantee honest on this backend: identity is content,
|
|
16905
|
+
* not the name it was added under. Keying the write on the whole file name instead — which
|
|
16906
|
+
* is what this did before — stored the same bytes twice whenever the stem differed.
|
|
16907
|
+
*/
|
|
16908
|
+
let contentIndex;
|
|
16909
|
+
async function assetsByContent() {
|
|
16910
|
+
if (contentIndex) return contentIndex;
|
|
16911
|
+
const index = /* @__PURE__ */ new Map();
|
|
16912
|
+
for (const { name } of await adapter.list("assets")) {
|
|
16913
|
+
const parsed = assetHashFromName(name);
|
|
16914
|
+
if (parsed && !index.has(contentKey(parsed.hash, parsed.ext))) index.set(contentKey(parsed.hash, parsed.ext), name);
|
|
16915
|
+
}
|
|
16916
|
+
contentIndex = index;
|
|
16917
|
+
return index;
|
|
16918
|
+
}
|
|
16919
|
+
return {
|
|
16920
|
+
async save({ name, bytes }, onBytes) {
|
|
16921
|
+
const hash = await contentHash(bytes);
|
|
16922
|
+
const { stem, ext } = splitNameExt(name);
|
|
16923
|
+
const index = await assetsByContent();
|
|
16924
|
+
const key = contentKey(hash, ext);
|
|
16925
|
+
const existing = index.get(key);
|
|
16926
|
+
const fileName = existing ?? assetFileName(name, hash);
|
|
16927
|
+
if (!existing) {
|
|
16928
|
+
await adapter.writeBinary("assets", fileName, bytes);
|
|
16929
|
+
index.set(key, fileName);
|
|
16930
|
+
}
|
|
16931
|
+
onBytes?.(bytes.length);
|
|
16932
|
+
return {
|
|
16933
|
+
ref: `../assets/${fileName}`,
|
|
16934
|
+
name: fileName,
|
|
16935
|
+
stem: publishSlug(stem) || "asset",
|
|
16936
|
+
isImage: isImageExt(ext),
|
|
16937
|
+
...existing ? { reused: true } : {}
|
|
16938
|
+
};
|
|
16939
|
+
},
|
|
16940
|
+
async readBytes(ref) {
|
|
16941
|
+
const assetName = assetNameFromRef(ref);
|
|
16942
|
+
if (!assetName) return null;
|
|
16943
|
+
const { ext } = splitNameExt(assetName);
|
|
16944
|
+
try {
|
|
16945
|
+
const { bytes } = await adapter.readBinary("assets", assetName);
|
|
16946
|
+
return {
|
|
16947
|
+
bytes,
|
|
16948
|
+
name: displayAssetName(assetName),
|
|
16949
|
+
type: mimeTypeForExt(ext)
|
|
16950
|
+
};
|
|
16951
|
+
} catch {
|
|
16952
|
+
return null;
|
|
16953
|
+
}
|
|
16954
|
+
},
|
|
16955
|
+
async resolve(ref) {
|
|
16956
|
+
const assetName = assetNameFromRef(ref);
|
|
16957
|
+
if (!assetName) return null;
|
|
16958
|
+
const { ext } = splitNameExt(assetName);
|
|
16959
|
+
const meta = {
|
|
16960
|
+
name: displayAssetName(assetName),
|
|
16961
|
+
type: mimeTypeForExt(ext)
|
|
16962
|
+
};
|
|
16963
|
+
const cached = urlCache.get(assetName);
|
|
16964
|
+
if (cached) return {
|
|
16965
|
+
url: cached,
|
|
16966
|
+
...meta
|
|
16967
|
+
};
|
|
16968
|
+
let content;
|
|
16969
|
+
try {
|
|
16970
|
+
content = await adapter.readBinary("assets", assetName);
|
|
16971
|
+
} catch {
|
|
16972
|
+
return null;
|
|
16973
|
+
}
|
|
16974
|
+
const url = URL.createObjectURL(new Blob([content.bytes], meta.type ? { type: meta.type } : {}));
|
|
16975
|
+
urlCache.set(assetName, url);
|
|
16976
|
+
return {
|
|
16977
|
+
url,
|
|
16978
|
+
...meta
|
|
16979
|
+
};
|
|
16980
|
+
},
|
|
16981
|
+
dispose() {
|
|
16982
|
+
for (const url of urlCache.values()) URL.revokeObjectURL(url);
|
|
16983
|
+
urlCache.clear();
|
|
16984
|
+
},
|
|
16985
|
+
renamed(from, to) {
|
|
16986
|
+
const url = urlCache.get(from);
|
|
16987
|
+
if (url) URL.revokeObjectURL(url);
|
|
16988
|
+
urlCache.delete(from);
|
|
16989
|
+
const parsed = assetHashFromName(to);
|
|
16990
|
+
if (parsed) contentIndex?.set(contentKey(parsed.hash, parsed.ext), to);
|
|
16991
|
+
}
|
|
16992
|
+
};
|
|
16993
|
+
}
|
|
16994
|
+
// ../../extensions/excalidraw/src/format.ts
|
|
16995
|
+
var DRAWING_FENCE = "excalidraw.drawing";
|
|
16996
|
+
var HEADER_TYPE = "excalidraw.drawing";
|
|
16997
|
+
/** Every JSON object written on one line that parses, in order, with where it is. */
|
|
16998
|
+
function spansOnLine(line) {
|
|
16999
|
+
const out = [];
|
|
17000
|
+
let depth = 0;
|
|
17001
|
+
let start = -1;
|
|
17002
|
+
let inString = false;
|
|
17003
|
+
let escaped = false;
|
|
17004
|
+
for (let i = 0; i < line.length; i++) {
|
|
17005
|
+
const ch = line[i];
|
|
17006
|
+
if (inString) {
|
|
17007
|
+
if (escaped) escaped = false;
|
|
17008
|
+
else if (ch === "\\") escaped = true;
|
|
17009
|
+
else if (ch === "\"") inString = false;
|
|
17010
|
+
continue;
|
|
17011
|
+
}
|
|
17012
|
+
if (ch === "\"") inString = true;
|
|
17013
|
+
else if (ch === "{") {
|
|
17014
|
+
if (depth === 0) start = i;
|
|
17015
|
+
depth++;
|
|
17016
|
+
} else if (ch === "}" && depth > 0) {
|
|
17017
|
+
depth--;
|
|
17018
|
+
if (depth === 0 && start !== -1) {
|
|
17019
|
+
try {
|
|
17020
|
+
out.push({
|
|
17021
|
+
start,
|
|
17022
|
+
end: i + 1,
|
|
17023
|
+
value: JSON.parse(line.slice(start, i + 1))
|
|
17024
|
+
});
|
|
17025
|
+
} catch {}
|
|
17026
|
+
start = -1;
|
|
17027
|
+
}
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
return out;
|
|
17031
|
+
}
|
|
17032
|
+
/** Every JSON object written on one line, in order: one, or several where a merge joined lines. */
|
|
17033
|
+
function objectsOnLine(line) {
|
|
17034
|
+
return spansOnLine(line).map((span) => span.value);
|
|
17035
|
+
}
|
|
17036
|
+
function isElement(value) {
|
|
17037
|
+
if (!value || typeof value !== "object") return false;
|
|
17038
|
+
const record = value;
|
|
17039
|
+
return typeof record.id === "string" && typeof record.type === "string" && typeof record.version === "number";
|
|
17040
|
+
}
|
|
17041
|
+
function isHeader(value) {
|
|
17042
|
+
return !!value && typeof value === "object" && value.type === HEADER_TYPE && typeof value.id === "string";
|
|
17043
|
+
}
|
|
17044
|
+
/** Whether a line's object is a shape in skeleton form: a `type`, not the drawing's own, and no `version`. */
|
|
17045
|
+
function isSkeleton(value) {
|
|
17046
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
17047
|
+
const record = value;
|
|
17048
|
+
return typeof record.type === "string" && record.type !== HEADER_TYPE && record.version === void 0 && record.isDeleted !== true;
|
|
17049
|
+
}
|
|
17050
|
+
/** Whether `a` is the later of two versions of one element, by Excalidraw's own rule. */
|
|
17051
|
+
function later(a, b) {
|
|
17052
|
+
if (a.version !== b.version) return a.version > b.version;
|
|
17053
|
+
return (a.versionNonce ?? 0) <= (b.versionNonce ?? 0);
|
|
17054
|
+
}
|
|
17055
|
+
/** Elements in their stacking order: by `index`, then by id, so every device draws them alike. */
|
|
17056
|
+
function byStackingOrder(elements) {
|
|
17057
|
+
return elements.sort((a, b) => {
|
|
17058
|
+
const ai = a.index ?? "";
|
|
17059
|
+
const bi = b.index ?? "";
|
|
17060
|
+
if (ai !== bi) return ai < bi ? -1 : 1;
|
|
17061
|
+
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
17062
|
+
});
|
|
17063
|
+
}
|
|
17064
|
+
/** The reference an image names its Asset by, or null for an image with none and anything else. */
|
|
17065
|
+
function imageAsset(element) {
|
|
17066
|
+
if (element.type !== "image") return null;
|
|
17067
|
+
const asset = element.customData?.asset;
|
|
17068
|
+
return typeof asset === "string" && asset !== "" ? asset : null;
|
|
17069
|
+
}
|
|
17070
|
+
/**
|
|
17071
|
+
* The file id of an image known only by its reference: the same on every device, in letters, digits
|
|
17072
|
+
* and hyphens, since an SVG picture names the image's element by it. Two hashes, so two images in a
|
|
17073
|
+
* drawing cannot plausibly share one.
|
|
17074
|
+
*/
|
|
17075
|
+
function imageFileId(ref) {
|
|
17076
|
+
return `asset-${hashText(ref)}-${hashText(`${ref}#`)}`;
|
|
17077
|
+
}
|
|
17078
|
+
/** An image with no file id gets the one its reference makes, so a line an older Client converted still draws. */
|
|
17079
|
+
function withFileIdFromAsset(element) {
|
|
17080
|
+
const asset = imageAsset(element);
|
|
17081
|
+
return asset && !element.fileId ? {
|
|
17082
|
+
...element,
|
|
17083
|
+
fileId: imageFileId(asset)
|
|
17084
|
+
} : element;
|
|
17085
|
+
}
|
|
17086
|
+
/** A drawing read from its fence's body. */
|
|
17087
|
+
function readDrawing(body) {
|
|
17088
|
+
const first = body[0] ? objectsOnLine(body[0])[0] : void 0;
|
|
17089
|
+
const header = isHeader(first) ? {
|
|
17090
|
+
type: HEADER_TYPE,
|
|
17091
|
+
version: 1,
|
|
17092
|
+
id: first.id,
|
|
17093
|
+
...typeof first.background === "string" ? { background: first.background } : {}
|
|
17094
|
+
} : null;
|
|
17095
|
+
const byId = /* @__PURE__ */ new Map();
|
|
17096
|
+
const skeletons = [];
|
|
17097
|
+
body.forEach((line, n) => {
|
|
17098
|
+
if (n === 0 && header) return;
|
|
17099
|
+
for (const value of objectsOnLine(line)) {
|
|
17100
|
+
if (isSkeleton(value)) skeletons.push(value);
|
|
17101
|
+
if (!isElement(value) || value.isDeleted) continue;
|
|
17102
|
+
const known = byId.get(value.id);
|
|
17103
|
+
if (!known || later(value, known)) byId.set(value.id, withFileIdFromAsset(value));
|
|
17104
|
+
}
|
|
17105
|
+
});
|
|
17106
|
+
return {
|
|
17107
|
+
header,
|
|
17108
|
+
elements: byStackingOrder([...byId.values()]),
|
|
17109
|
+
skeletons
|
|
17110
|
+
};
|
|
17111
|
+
}
|
|
17112
|
+
/**
|
|
17113
|
+
* Each image's reference a body holds, written by hand or not, for whatever has to read them all
|
|
17114
|
+
* before it can draw them.
|
|
17115
|
+
*/
|
|
17116
|
+
function imageReferences(body) {
|
|
17117
|
+
const { elements, skeletons } = readDrawing(body);
|
|
17118
|
+
return [...new Set([...elements, ...skeletons].flatMap((element) => imageAsset(element) ?? []))];
|
|
17119
|
+
}
|
|
17120
|
+
/** A short, stable hash of some text, in letters and digits (FNV-1a). */
|
|
17121
|
+
function hashText(text) {
|
|
17122
|
+
let hash = 2166136261;
|
|
17123
|
+
for (let i = 0; i < text.length; i++) {
|
|
17124
|
+
hash ^= text.charCodeAt(i);
|
|
17125
|
+
hash = Math.imul(hash, 16777619);
|
|
17126
|
+
}
|
|
17127
|
+
return (hash >>> 0).toString(36);
|
|
17128
|
+
}
|
|
17129
|
+
// src/page-server.ts
|
|
17130
|
+
/**
|
|
17131
|
+
* A server for the pages the Headless Client draws pictures in (map-pictures.ts,
|
|
17132
|
+
* drawing-pictures.ts): on the loopback address, answering one page and the files named to it and
|
|
17133
|
+
* nothing else, so a page's workers, chunks and fonts load over http as they do in the Client. Open
|
|
17134
|
+
* only for a publish that draws something.
|
|
17135
|
+
*/
|
|
17136
|
+
var TYPES = {
|
|
17137
|
+
".js": "text/javascript; charset=utf-8",
|
|
17138
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
17139
|
+
".css": "text/css; charset=utf-8",
|
|
17140
|
+
".woff2": "font/woff2"
|
|
17141
|
+
};
|
|
17142
|
+
/** A file built beside this module in the published package (dist/), or in dist/ when run from source. */
|
|
17143
|
+
function builtPath(...path) {
|
|
17144
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17145
|
+
return here.endsWith("dist") ? join(here, ...path) : join(here, "..", "dist", ...path);
|
|
17146
|
+
}
|
|
17147
|
+
/** Every file under `folder`, by the path a page asks for it at. Empty when the folder is missing. */
|
|
17148
|
+
async function filesUnder$1(folder) {
|
|
17149
|
+
const files = (await readdir(folder, {
|
|
17150
|
+
recursive: true,
|
|
17151
|
+
withFileTypes: true
|
|
17152
|
+
}).catch(() => [])).filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name));
|
|
17153
|
+
return new Map(files.map((file) => [`/${relative(folder, file).split(sep).join("/")}`, file]));
|
|
17154
|
+
}
|
|
17155
|
+
/** The server: `html` at `/page.html`, and each of `files` at its path. */
|
|
17156
|
+
async function servePage(html, files) {
|
|
17157
|
+
const server = createServer$1((request, response) => {
|
|
17158
|
+
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
17159
|
+
if (path === "/page.html") {
|
|
17160
|
+
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(html);
|
|
17161
|
+
return;
|
|
17162
|
+
}
|
|
17163
|
+
const file = files.get(path);
|
|
17164
|
+
if (!file) {
|
|
17165
|
+
response.writeHead(404).end();
|
|
17166
|
+
return;
|
|
17167
|
+
}
|
|
17168
|
+
readFile(file).then((bytes) => response.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" }).end(bytes), () => response.writeHead(404).end());
|
|
17169
|
+
});
|
|
17170
|
+
await new Promise((resolve, reject) => {
|
|
17171
|
+
server.once("error", reject);
|
|
17172
|
+
server.listen(0, "127.0.0.1", () => resolve());
|
|
17173
|
+
});
|
|
17174
|
+
const address = server.address();
|
|
17175
|
+
if (!address || typeof address === "string") throw new Error("The page server has no port.");
|
|
17176
|
+
return {
|
|
17177
|
+
server,
|
|
17178
|
+
origin: `http://127.0.0.1:${address.port}`
|
|
17179
|
+
};
|
|
17180
|
+
}
|
|
17181
|
+
// src/drawing-pictures.ts
|
|
17182
|
+
/**
|
|
17183
|
+
* Drawing pictures for a publish from the Headless Client (ADR 0175): a [[Drawing]] is published as
|
|
17184
|
+
* a picture, never as its lines, and the picture is drawn in a real Chromium, the one Mermaid
|
|
17185
|
+
* diagrams use (diagrams.ts), because Excalidraw's export needs a page to measure text and load
|
|
17186
|
+
* fonts in. No page of this kind can reach the graph, so the images a drawing names are read here and
|
|
17187
|
+
* handed in, as a publish reads any other asset.
|
|
17188
|
+
*
|
|
17189
|
+
* The page runs the Excalidraw extension's own code (`drawing-page/`, built from
|
|
17190
|
+
* `src/drawing-picture-page.ts` beside the Node bundle), and is served, with Excalidraw's chunks and
|
|
17191
|
+
* fonts, from a server on the loopback address (page-server.ts).
|
|
17192
|
+
*/
|
|
17193
|
+
/** Whether a publish of these bodies draws a drawing: a fenced block whose info string is the drawing fence's. */
|
|
17194
|
+
function needsDrawings(bodies) {
|
|
17195
|
+
const fence = new RegExp(`^\\s*(?:-\\s+)?\`{3,}${DRAWING_FENCE.replace(".", "\\.")}\\s*$`, "m");
|
|
17196
|
+
for (const body of bodies) if (fence.test(body)) return true;
|
|
17197
|
+
return false;
|
|
17198
|
+
}
|
|
17199
|
+
var PAGE$1 = `<!doctype html>
|
|
17200
|
+
<html><head><meta charset="utf-8">
|
|
17201
|
+
<script type="module" src="/drawing-picture-page.js"><\/script>
|
|
17202
|
+
</head><body></body></html>`;
|
|
17203
|
+
/**
|
|
17204
|
+
* The images a drawing names, as data URLs by reference, leaving out any that cannot be read. Its type
|
|
17205
|
+
* comes from its name, since a data URL drawn in the picture must not say anything but an image.
|
|
17206
|
+
*/
|
|
17207
|
+
async function drawingImages(body, readAsset) {
|
|
17208
|
+
const images = {};
|
|
17209
|
+
for (const ref of imageReferences(body)) {
|
|
17210
|
+
const type = mimeTypeForExt(splitNameExt(assetNameFromRef(ref) ?? "").ext);
|
|
17211
|
+
if (!type.startsWith("image/")) continue;
|
|
17212
|
+
const asset = await readAsset(ref).catch(() => null);
|
|
17213
|
+
if (asset) images[ref] = `data:${type};base64,${Buffer$1.from(asset.bytes).toString("base64")}`;
|
|
17214
|
+
}
|
|
17215
|
+
return images;
|
|
17216
|
+
}
|
|
17217
|
+
/**
|
|
17218
|
+
* A renderer over one headless browser, opened for a publish and closed after it. Null when no
|
|
17219
|
+
* browser is available; the caller decides what that means (a publish with drawings refuses).
|
|
17220
|
+
*/
|
|
17221
|
+
async function openDrawingRenderer(env, readAsset) {
|
|
17222
|
+
const browser = await launchChromium(env);
|
|
17223
|
+
if (!browser) return null;
|
|
17224
|
+
let served = null;
|
|
17225
|
+
let pagePromise;
|
|
17226
|
+
const page = () => {
|
|
17227
|
+
pagePromise ??= (async () => {
|
|
17228
|
+
served = await servePage(PAGE$1, await filesUnder$1(builtPath("drawing-page")));
|
|
17229
|
+
const p = await (await browser.newContext()).newPage();
|
|
17230
|
+
await p.goto(`${served.origin}/page.html`);
|
|
17231
|
+
await p.waitForFunction(() => typeof window.etherpkDrawDrawingPicture === "function", void 0, { timeout: 15e3 });
|
|
17232
|
+
return p;
|
|
17233
|
+
})();
|
|
17234
|
+
return pagePromise;
|
|
17235
|
+
};
|
|
17236
|
+
return {
|
|
17237
|
+
async render(body) {
|
|
17238
|
+
const p = await page();
|
|
17239
|
+
const images = await drawingImages(body, readAsset);
|
|
17240
|
+
const drawn = await p.evaluate(([lines, held]) => window.etherpkDrawDrawingPicture(lines, held), [[...body], images]);
|
|
17241
|
+
if (drawn === null) return null;
|
|
17242
|
+
return {
|
|
17243
|
+
kind: "picture",
|
|
17244
|
+
type: drawn.type,
|
|
17245
|
+
width: drawn.width,
|
|
17246
|
+
height: drawn.height,
|
|
17247
|
+
alt: drawn.alt,
|
|
17248
|
+
bytes: new Uint8Array(Buffer$1.from(drawn.data, "base64"))
|
|
17249
|
+
};
|
|
17250
|
+
},
|
|
17251
|
+
async dispose() {
|
|
17252
|
+
await browser.close().catch(() => {});
|
|
17253
|
+
const open = served;
|
|
17254
|
+
await new Promise((resolve) => open ? open.server.close(() => resolve()) : resolve());
|
|
17255
|
+
}
|
|
17256
|
+
};
|
|
17257
|
+
}
|
|
17258
|
+
// ../../extensions/maps/src/map-host.ts
|
|
17259
|
+
var HOST_STYLE = "https://maps.etherpk.com/styles/light.json";
|
|
17260
|
+
var DEFAULT_MAP_STYLES = {
|
|
17261
|
+
light: HOST_STYLE,
|
|
17262
|
+
dark: HOST_STYLE
|
|
17263
|
+
};
|
|
17264
|
+
// src/map-pictures.ts
|
|
17265
|
+
var require$1 = createRequire(import.meta.url);
|
|
17266
|
+
/** The light basemap style a publish draws with, or null for a plain background. */
|
|
17267
|
+
function publishMapStyle(env) {
|
|
17268
|
+
const named = env.ETHERPK_MAP_STYLE_URL;
|
|
17269
|
+
if (named === void 0) return DEFAULT_MAP_STYLES.light;
|
|
17270
|
+
return named.trim() === "" ? null : named.trim();
|
|
17271
|
+
}
|
|
17272
|
+
/** Whether a publish of these bodies draws a map: a fenced block whose info string is `map`. */
|
|
17273
|
+
function needsMaps(bodies) {
|
|
17274
|
+
for (const body of bodies) if (/^\s*(?:-\s+)?```map\s*$/m.test(body)) return true;
|
|
17275
|
+
return false;
|
|
17276
|
+
}
|
|
17277
|
+
/** The page: MapLibre by the import map, then the drawing code, which puts its function on `window`. */
|
|
17278
|
+
var PAGE = `<!doctype html>
|
|
17279
|
+
<html><head><meta charset="utf-8">
|
|
17280
|
+
<script type="importmap">{"imports":{"maplibre-gl":"/maplibre-gl.mjs"}}<\/script>
|
|
17281
|
+
<script type="module" src="/map-picture-page.js"><\/script>
|
|
17282
|
+
</head><body></body></html>`;
|
|
17283
|
+
/** The files the page loads, by path, and where each is on disk. */
|
|
17284
|
+
function pageFiles() {
|
|
17285
|
+
const maplibre = dirname(require$1.resolve("maplibre-gl/dist/maplibre-gl.mjs"));
|
|
17286
|
+
return /* @__PURE__ */ new Map([
|
|
17287
|
+
["/maplibre-gl.mjs", join(maplibre, "maplibre-gl.mjs")],
|
|
17288
|
+
["/maplibre-gl-shared.mjs", join(maplibre, "maplibre-gl-shared.mjs")],
|
|
17289
|
+
["/maplibre-gl-worker.mjs", join(maplibre, "maplibre-gl-worker.mjs")],
|
|
17290
|
+
["/map-picture-page.js", builtPath("map-picture-page.js")]
|
|
17291
|
+
]);
|
|
17292
|
+
}
|
|
17293
|
+
/**
|
|
17294
|
+
* A renderer over one headless browser, opened for a publish and closed after it. Null when no
|
|
17295
|
+
* browser is available; the caller decides what that means (a publish with maps refuses).
|
|
17296
|
+
*/
|
|
17297
|
+
async function openMapRenderer(env) {
|
|
17298
|
+
const browser = await launchChromium(env);
|
|
16758
17299
|
if (!browser) return null;
|
|
16759
17300
|
const style = publishMapStyle(env);
|
|
16760
17301
|
let served = null;
|
|
@@ -17521,320 +18062,65 @@ var DocumentUnconfirmedError = class extends Error {
|
|
|
17521
18062
|
* A rename acts on the [[Concept]]; a page is a passenger. The decision the two options
|
|
17522
18063
|
* encode: renaming a page leaves every `[[Old Name]]` in the graph pointing at a concept with
|
|
17523
18064
|
* no page behind it, and neither fix is right often enough to impose. Aliasing touches one
|
|
17524
|
-
* document and honours "the source is always canonical"; rewriting makes the prose read
|
|
17525
|
-
* correctly but is N concurrent document edits with no transaction around them on a synced
|
|
17526
|
-
* graph. A [[Pageless Concept]] has nothing to alias, so for it there is no choice: renaming
|
|
17527
|
-
* one IS the rewrite (ADR 0064).
|
|
17528
|
-
*/
|
|
17529
|
-
/**
|
|
17530
|
-
* A rename refused because a document it would have to read - a referencing document under
|
|
17531
|
-
* the rewrite arm, or a document one of its steps moves or merges - could not be brought to
|
|
17532
|
-
* text this device can trust in time. Refused whole rather than applied to the documents that
|
|
17533
|
-
* could be confirmed: a graph with half its links rewritten is worse than one with none, and
|
|
17534
|
-
* the second attempt, once sync has caught up, costs nothing.
|
|
17535
|
-
*/
|
|
17536
|
-
var RenameUnconfirmedError = class extends Error {
|
|
17537
|
-
concepts;
|
|
17538
|
-
name = "RenameUnconfirmedError";
|
|
17539
|
-
constructor(concepts) {
|
|
17540
|
-
const list = concepts.slice(0, 5).join(", ") + (concepts.length > 5 ? "…" : "");
|
|
17541
|
-
super(`${concepts.length === 1 ? "A document" : `${concepts.length} documents`} the rename would change ${concepts.length === 1 ? "has" : "have"} not finished syncing to this device: ${list}. Nothing was renamed - try again once sync has caught up.`);
|
|
17542
|
-
this.concepts = concepts;
|
|
17543
|
-
}
|
|
17544
|
-
};
|
|
17545
|
-
/**
|
|
17546
|
-
* Why a rename was refused, as a user-facing message, or null when it may proceed.
|
|
17547
|
-
* Shared so both backends refuse identically.
|
|
17548
|
-
*
|
|
17549
|
-
* A [[Journal Entry]] is refused because its concept *is* its date and there is exactly one
|
|
17550
|
-
* per day; renaming it would break that invariant rather than express anything. A
|
|
17551
|
-
* journal-shaped [[Pageless Concept]] (a day nobody has written yet) is refused for the same
|
|
17552
|
-
* reason: its name is its day whether or not the entry exists.
|
|
17553
|
-
*
|
|
17554
|
-
* The same holds in the other direction: a page renamed TO a day is refused, rather than left
|
|
17555
|
-
* in `pages/` answering to the day or merged into its journal entry with a `title` block the
|
|
17556
|
-
* entry never carries (ADR 0056).
|
|
17557
|
-
*
|
|
17558
|
-
* A collision is NOT a refusal (ADR 0038 §4): it is a [[Merge]], confirmed in the dialog.
|
|
17559
|
-
*/
|
|
17560
|
-
function renameRefusal(options) {
|
|
17561
|
-
const to = options.to.trim();
|
|
17562
|
-
if (to === "") return "A page needs a non-empty name.";
|
|
17563
|
-
if (options.kind === "journal" || options.kind === null && isJournalConcept(options.from)) return "A journal entry cannot be renamed - its name is its date, and there is exactly one per day.";
|
|
17564
|
-
if (options.kind === "page" && isJournalConcept(to)) return dayIsNotAPageName(to);
|
|
17565
|
-
return null;
|
|
17566
|
-
}
|
|
17567
|
-
/** Every step, direct first - what an applier iterates. */
|
|
17568
|
-
function renameSteps(plan) {
|
|
17569
|
-
return [plan.direct, ...plan.cascade];
|
|
17570
|
-
}
|
|
17571
|
-
/**
|
|
17572
|
-
* The name a document called `concept` before the rename goes by after it: where a title step
|
|
17573
|
-
* lands it (its `into`, a merge's survivor included), or the same name when no step moves it.
|
|
17574
|
-
* How a holder of an alias the rename rewrites is found, and named in what the rename reports.
|
|
17575
|
-
*/
|
|
17576
|
-
function landedName(plan, concept) {
|
|
17577
|
-
const key = conceptKey(concept);
|
|
17578
|
-
return renameSteps(plan).find((step) => step.hasDocument && conceptKey(step.from) === key)?.into ?? concept;
|
|
17579
|
-
}
|
|
17580
|
-
/** How many steps merge - what the dialog warns about. */
|
|
17581
|
-
function mergeCount(plan) {
|
|
17582
|
-
return renameSteps(plan).filter((s) => s.merges).length;
|
|
17583
|
-
}
|
|
17584
|
-
// ../client/src/lib/storage/fs/asset-store.ts
|
|
17585
|
-
/**
|
|
17586
|
-
* The **Asset store** over a {@link DirectoryAdapter}: uploads land as binary files
|
|
17587
|
-
* under `assets/`, named `kebab-stem.<contenthash>.ext` (DESIGN.md → On-disk layout).
|
|
17588
|
-
* Identical bytes de-duplicate to one file **by content and extension alone** - the stem is
|
|
17589
|
-
* display, not identity - so the same file added again under a different name references the
|
|
17590
|
-
* one already stored rather than writing a second copy. Built on the same File-System seam as
|
|
17591
|
-
* {@link createFilesystemDocumentStore}, so the pure naming/dedup logic is Node-testable
|
|
17592
|
-
* over the in-memory adapter before any browser code runs.
|
|
17593
|
-
*
|
|
17594
|
-
* Assets are referenced from documents by a relative path — `../assets/<name>` — which
|
|
17595
|
-
* resolves from any journal entry or page (both sit one level under the graph root,
|
|
17596
|
-
* the Logseq convention). `resolve` reads those bytes back and hands out an object URL plus
|
|
17597
|
-
* the name and MIME type a download or a viewer needs; the URLs are cached per asset and
|
|
17598
|
-
* revoked on {@link AssetStore.dispose}.
|
|
17599
|
-
*
|
|
17600
|
-
* Remote (S3) upload and per-graph access control are deferred (DESIGN.md → Server
|
|
17601
|
-
* Backend); this is the Filesystem Backend path only.
|
|
17602
|
-
*/
|
|
17603
|
-
/** Extensions rendered inline as images (everything else renders as a download link). */
|
|
17604
|
-
var IMAGE_EXTS = /* @__PURE__ */ new Set([
|
|
17605
|
-
"png",
|
|
17606
|
-
"jpg",
|
|
17607
|
-
"jpeg",
|
|
17608
|
-
"gif",
|
|
17609
|
-
"webp",
|
|
17610
|
-
"svg",
|
|
17611
|
-
"avif",
|
|
17612
|
-
"bmp"
|
|
17613
|
-
]);
|
|
17614
|
-
/** A doc-relative asset reference: optional `../` hops, then `assets/<name>`. */
|
|
17615
|
-
var ASSET_REF = /^(?:\.\.\/)*assets\/(.+)$/;
|
|
17616
|
-
/**
|
|
17617
|
-
* An asset could not be fetched just now: the connection failed, or the server answered with a
|
|
17618
|
-
* status that means "try again". It says nothing about whether the file exists, so something
|
|
17619
|
-
* showing the file asks again rather than calling it missing. `status` is the server's answer,
|
|
17620
|
-
* absent when the connection failed before there was one.
|
|
17621
|
-
*/
|
|
17622
|
-
var AssetUnavailableError = class extends Error {
|
|
17623
|
-
name = "AssetUnavailableError";
|
|
17624
|
-
status;
|
|
17625
|
-
constructor(message, options = {}) {
|
|
17626
|
-
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
17627
|
-
this.status = options.status;
|
|
17628
|
-
}
|
|
17629
|
-
};
|
|
17630
|
-
/**
|
|
17631
|
-
* An asset arrived, but not as it was stored: the server offered a different number of chunks than
|
|
17632
|
-
* its encrypted metadata records, or the joined bytes do not match the size or hash recorded there.
|
|
17633
|
-
* Each chunk is authenticated on its own, so this is what catches a file cut short, or a reuse
|
|
17634
|
-
* answer that points at a different file (ADR 0027, amended 2026-10-05). The bytes are never
|
|
17635
|
-
* handed over. Distinct from a missing file (`null`), which is gone, and from an unavailable one,
|
|
17636
|
-
* which may come good by itself.
|
|
17637
|
-
*/
|
|
17638
|
-
var AssetIntegrityError = class extends Error {
|
|
17639
|
-
name = "AssetIntegrityError";
|
|
17640
|
-
constructor(message = "This file did not arrive complete, so it was not opened. Try again in a moment.") {
|
|
17641
|
-
super(message);
|
|
17642
|
-
}
|
|
17643
|
-
};
|
|
17644
|
-
/** Split a file name into its stem and lower-cased extension (`''` ext when there is none). */
|
|
17645
|
-
function splitNameExt(fileName) {
|
|
17646
|
-
const dot = fileName.lastIndexOf(".");
|
|
17647
|
-
if (dot <= 0) return {
|
|
17648
|
-
stem: fileName,
|
|
17649
|
-
ext: ""
|
|
17650
|
-
};
|
|
17651
|
-
return {
|
|
17652
|
-
stem: fileName.slice(0, dot),
|
|
17653
|
-
ext: fileName.slice(dot + 1).toLowerCase()
|
|
17654
|
-
};
|
|
17655
|
-
}
|
|
17656
|
-
/** True when `ext` (with or without a leading dot) names an inline-rendered image format. */
|
|
17657
|
-
function isImageExt(ext) {
|
|
17658
|
-
return IMAGE_EXTS.has(ext.replace(/^\./, "").toLowerCase());
|
|
17659
|
-
}
|
|
17660
|
-
/** The on-disk asset name: `kebab-stem.<hash>.ext` (stem falls back to `asset` when slugging empties it). */
|
|
17661
|
-
function assetFileName(originalName, hash) {
|
|
17662
|
-
const { stem, ext } = splitNameExt(originalName);
|
|
17663
|
-
const slug = publishSlug(stem) || "asset";
|
|
17664
|
-
return ext ? `${slug}.${hash}.${ext}` : `${slug}.${hash}`;
|
|
17665
|
-
}
|
|
17666
|
-
/** The de-duplication key: content plus extension. The stem is display, not identity. */
|
|
17667
|
-
function contentKey(hash, ext) {
|
|
17668
|
-
return `${hash}.${ext}`;
|
|
17669
|
-
}
|
|
17670
|
-
/**
|
|
17671
|
-
* An on-disk asset name with its content hash taken back out — `q3-report.a1b2c3d4.pdf` reads as
|
|
17672
|
-
* `q3-report.pdf`. What a download is called and what titles an asset tab, so neither shows a
|
|
17673
|
-
* user a hash they never typed. A name this store did not write is returned unchanged.
|
|
17674
|
-
*/
|
|
17675
|
-
function displayAssetName(fileName) {
|
|
17676
|
-
const parsed = assetHashFromName(fileName);
|
|
17677
|
-
if (!parsed) return fileName;
|
|
17678
|
-
const stem = fileName.slice(0, fileName.length - `.${parsed.hash}`.length - (parsed.ext ? parsed.ext.length + 1 : 0));
|
|
17679
|
-
return parsed.ext ? `${stem}.${parsed.ext}` : stem;
|
|
17680
|
-
}
|
|
18065
|
+
* document and honours "the source is always canonical"; rewriting makes the prose read
|
|
18066
|
+
* correctly but is N concurrent document edits with no transaction around them on a synced
|
|
18067
|
+
* graph. A [[Pageless Concept]] has nothing to alias, so for it there is no choice: renaming
|
|
18068
|
+
* one IS the rewrite (ADR 0064).
|
|
18069
|
+
*/
|
|
17681
18070
|
/**
|
|
17682
|
-
*
|
|
17683
|
-
*
|
|
17684
|
-
*
|
|
17685
|
-
*
|
|
17686
|
-
*
|
|
18071
|
+
* A rename refused because a document it would have to read - a referencing document under
|
|
18072
|
+
* the rewrite arm, or a document one of its steps moves or merges - could not be brought to
|
|
18073
|
+
* text this device can trust in time. Refused whole rather than applied to the documents that
|
|
18074
|
+
* could be confirmed: a graph with half its links rewritten is worse than one with none, and
|
|
18075
|
+
* the second attempt, once sync has caught up, costs nothing.
|
|
17687
18076
|
*/
|
|
17688
|
-
var
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
bmp: "image/bmp",
|
|
17697
|
-
pdf: "application/pdf",
|
|
17698
|
-
txt: "text/plain",
|
|
17699
|
-
csv: "text/csv",
|
|
17700
|
-
json: "application/json",
|
|
17701
|
-
md: "text/markdown",
|
|
17702
|
-
mp3: "audio/mpeg",
|
|
17703
|
-
mp4: "video/mp4",
|
|
17704
|
-
webm: "video/webm",
|
|
17705
|
-
zip: "application/zip"
|
|
18077
|
+
var RenameUnconfirmedError = class extends Error {
|
|
18078
|
+
concepts;
|
|
18079
|
+
name = "RenameUnconfirmedError";
|
|
18080
|
+
constructor(concepts) {
|
|
18081
|
+
const list = concepts.slice(0, 5).join(", ") + (concepts.length > 5 ? "…" : "");
|
|
18082
|
+
super(`${concepts.length === 1 ? "A document" : `${concepts.length} documents`} the rename would change ${concepts.length === 1 ? "has" : "have"} not finished syncing to this device: ${list}. Nothing was renamed - try again once sync has caught up.`);
|
|
18083
|
+
this.concepts = concepts;
|
|
18084
|
+
}
|
|
17706
18085
|
};
|
|
17707
|
-
/** The MIME type for a file extension (with or without a leading dot), or `''` when unknown. */
|
|
17708
|
-
function mimeTypeForExt(ext) {
|
|
17709
|
-
return MIME_TYPES[ext.replace(/^\./, "").toLowerCase()] ?? "";
|
|
17710
|
-
}
|
|
17711
18086
|
/**
|
|
17712
|
-
*
|
|
17713
|
-
*
|
|
17714
|
-
*
|
|
18087
|
+
* Why a rename was refused, as a user-facing message, or null when it may proceed.
|
|
18088
|
+
* Shared so both backends refuse identically.
|
|
18089
|
+
*
|
|
18090
|
+
* A [[Journal Entry]] is refused because its concept *is* its date and there is exactly one
|
|
18091
|
+
* per day; renaming it would break that invariant rather than express anything. A
|
|
18092
|
+
* journal-shaped [[Pageless Concept]] (a day nobody has written yet) is refused for the same
|
|
18093
|
+
* reason: its name is its day whether or not the entry exists.
|
|
18094
|
+
*
|
|
18095
|
+
* The same holds in the other direction: a page renamed TO a day is refused, rather than left
|
|
18096
|
+
* in `pages/` answering to the day or merged into its journal entry with a `title` block the
|
|
18097
|
+
* entry never carries (ADR 0056).
|
|
18098
|
+
*
|
|
18099
|
+
* A collision is NOT a refusal (ADR 0038 §4): it is a [[Merge]], confirmed in the dialog.
|
|
17715
18100
|
*/
|
|
17716
|
-
function
|
|
17717
|
-
const
|
|
17718
|
-
|
|
17719
|
-
if (
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
return isSafeAssetName(name) ? name : null;
|
|
18101
|
+
function renameRefusal(options) {
|
|
18102
|
+
const to = options.to.trim();
|
|
18103
|
+
if (to === "") return "A page needs a non-empty name.";
|
|
18104
|
+
if (options.kind === "journal" || options.kind === null && isJournalConcept(options.from)) return "A journal entry cannot be renamed - its name is its date, and there is exactly one per day.";
|
|
18105
|
+
if (options.kind === "page" && isJournalConcept(to)) return dayIsNotAPageName(to);
|
|
18106
|
+
return null;
|
|
18107
|
+
}
|
|
18108
|
+
/** Every step, direct first - what an applier iterates. */
|
|
18109
|
+
function renameSteps(plan) {
|
|
18110
|
+
return [plan.direct, ...plan.cascade];
|
|
17727
18111
|
}
|
|
17728
18112
|
/**
|
|
17729
|
-
* The
|
|
17730
|
-
*
|
|
17731
|
-
*
|
|
18113
|
+
* The name a document called `concept` before the rename goes by after it: where a title step
|
|
18114
|
+
* lands it (its `into`, a merge's survivor included), or the same name when no step moves it.
|
|
18115
|
+
* How a holder of an alias the rename rewrites is found, and named in what the rename reports.
|
|
17732
18116
|
*/
|
|
17733
|
-
function
|
|
17734
|
-
|
|
17735
|
-
return
|
|
17736
|
-
}
|
|
17737
|
-
/** First 8 hex chars of the SHA-256 of the bytes — the content hash in the asset name. */
|
|
17738
|
-
async function contentHash(bytes) {
|
|
17739
|
-
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
17740
|
-
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
|
|
18117
|
+
function landedName(plan, concept) {
|
|
18118
|
+
const key = conceptKey(concept);
|
|
18119
|
+
return renameSteps(plan).find((step) => step.hasDocument && conceptKey(step.from) === key)?.into ?? concept;
|
|
17741
18120
|
}
|
|
17742
|
-
|
|
17743
|
-
|
|
17744
|
-
|
|
17745
|
-
* Content key → the on-disk name already holding those bytes. Built from `assets/` on the
|
|
17746
|
-
* first save (so a store that only ever resolves never pays for the listing) and maintained
|
|
17747
|
-
* on every write after that.
|
|
17748
|
-
*
|
|
17749
|
-
* This is what keeps the [[Asset]] guarantee honest on this backend: identity is content,
|
|
17750
|
-
* not the name it was added under. Keying the write on the whole file name instead — which
|
|
17751
|
-
* is what this did before — stored the same bytes twice whenever the stem differed.
|
|
17752
|
-
*/
|
|
17753
|
-
let contentIndex;
|
|
17754
|
-
async function assetsByContent() {
|
|
17755
|
-
if (contentIndex) return contentIndex;
|
|
17756
|
-
const index = /* @__PURE__ */ new Map();
|
|
17757
|
-
for (const { name } of await adapter.list("assets")) {
|
|
17758
|
-
const parsed = assetHashFromName(name);
|
|
17759
|
-
if (parsed && !index.has(contentKey(parsed.hash, parsed.ext))) index.set(contentKey(parsed.hash, parsed.ext), name);
|
|
17760
|
-
}
|
|
17761
|
-
contentIndex = index;
|
|
17762
|
-
return index;
|
|
17763
|
-
}
|
|
17764
|
-
return {
|
|
17765
|
-
async save({ name, bytes }, onBytes) {
|
|
17766
|
-
const hash = await contentHash(bytes);
|
|
17767
|
-
const { stem, ext } = splitNameExt(name);
|
|
17768
|
-
const index = await assetsByContent();
|
|
17769
|
-
const key = contentKey(hash, ext);
|
|
17770
|
-
const existing = index.get(key);
|
|
17771
|
-
const fileName = existing ?? assetFileName(name, hash);
|
|
17772
|
-
if (!existing) {
|
|
17773
|
-
await adapter.writeBinary("assets", fileName, bytes);
|
|
17774
|
-
index.set(key, fileName);
|
|
17775
|
-
}
|
|
17776
|
-
onBytes?.(bytes.length);
|
|
17777
|
-
return {
|
|
17778
|
-
ref: `../assets/${fileName}`,
|
|
17779
|
-
name: fileName,
|
|
17780
|
-
stem: publishSlug(stem) || "asset",
|
|
17781
|
-
isImage: isImageExt(ext),
|
|
17782
|
-
...existing ? { reused: true } : {}
|
|
17783
|
-
};
|
|
17784
|
-
},
|
|
17785
|
-
async readBytes(ref) {
|
|
17786
|
-
const assetName = assetNameFromRef(ref);
|
|
17787
|
-
if (!assetName) return null;
|
|
17788
|
-
const { ext } = splitNameExt(assetName);
|
|
17789
|
-
try {
|
|
17790
|
-
const { bytes } = await adapter.readBinary("assets", assetName);
|
|
17791
|
-
return {
|
|
17792
|
-
bytes,
|
|
17793
|
-
name: displayAssetName(assetName),
|
|
17794
|
-
type: mimeTypeForExt(ext)
|
|
17795
|
-
};
|
|
17796
|
-
} catch {
|
|
17797
|
-
return null;
|
|
17798
|
-
}
|
|
17799
|
-
},
|
|
17800
|
-
async resolve(ref) {
|
|
17801
|
-
const assetName = assetNameFromRef(ref);
|
|
17802
|
-
if (!assetName) return null;
|
|
17803
|
-
const { ext } = splitNameExt(assetName);
|
|
17804
|
-
const meta = {
|
|
17805
|
-
name: displayAssetName(assetName),
|
|
17806
|
-
type: mimeTypeForExt(ext)
|
|
17807
|
-
};
|
|
17808
|
-
const cached = urlCache.get(assetName);
|
|
17809
|
-
if (cached) return {
|
|
17810
|
-
url: cached,
|
|
17811
|
-
...meta
|
|
17812
|
-
};
|
|
17813
|
-
let content;
|
|
17814
|
-
try {
|
|
17815
|
-
content = await adapter.readBinary("assets", assetName);
|
|
17816
|
-
} catch {
|
|
17817
|
-
return null;
|
|
17818
|
-
}
|
|
17819
|
-
const url = URL.createObjectURL(new Blob([content.bytes], meta.type ? { type: meta.type } : {}));
|
|
17820
|
-
urlCache.set(assetName, url);
|
|
17821
|
-
return {
|
|
17822
|
-
url,
|
|
17823
|
-
...meta
|
|
17824
|
-
};
|
|
17825
|
-
},
|
|
17826
|
-
dispose() {
|
|
17827
|
-
for (const url of urlCache.values()) URL.revokeObjectURL(url);
|
|
17828
|
-
urlCache.clear();
|
|
17829
|
-
},
|
|
17830
|
-
renamed(from, to) {
|
|
17831
|
-
const url = urlCache.get(from);
|
|
17832
|
-
if (url) URL.revokeObjectURL(url);
|
|
17833
|
-
urlCache.delete(from);
|
|
17834
|
-
const parsed = assetHashFromName(to);
|
|
17835
|
-
if (parsed) contentIndex?.set(contentKey(parsed.hash, parsed.ext), to);
|
|
17836
|
-
}
|
|
17837
|
-
};
|
|
18121
|
+
/** How many steps merge - what the dialog warns about. */
|
|
18122
|
+
function mergeCount(plan) {
|
|
18123
|
+
return renameSteps(plan).filter((s) => s.merges).length;
|
|
17838
18124
|
}
|
|
17839
18125
|
// ../client/src/lib/retry.ts
|
|
17840
18126
|
/**
|
|
@@ -18669,6 +18955,64 @@ async function writeDownload(directory, name, bytes) {
|
|
|
18669
18955
|
}
|
|
18670
18956
|
throw new Error(`${directory} already holds a thousand files named like ${safe}.`);
|
|
18671
18957
|
}
|
|
18958
|
+
// src/image-size.ts
|
|
18959
|
+
function ascii(bytes, at, text) {
|
|
18960
|
+
for (let i = 0; i < text.length; i++) if (bytes[at + i] !== text.charCodeAt(i)) return false;
|
|
18961
|
+
return true;
|
|
18962
|
+
}
|
|
18963
|
+
function size(width, height) {
|
|
18964
|
+
return width > 0 && height > 0 ? {
|
|
18965
|
+
width,
|
|
18966
|
+
height
|
|
18967
|
+
} : null;
|
|
18968
|
+
}
|
|
18969
|
+
function pngSize(view) {
|
|
18970
|
+
return view.byteLength >= 24 ? size(view.getUint32(16), view.getUint32(20)) : null;
|
|
18971
|
+
}
|
|
18972
|
+
function gifSize(view) {
|
|
18973
|
+
return view.byteLength >= 10 ? size(view.getUint16(6, true), view.getUint16(8, true)) : null;
|
|
18974
|
+
}
|
|
18975
|
+
/** The first frame header's size, stepping over the segments before it, each of which states its length. */
|
|
18976
|
+
function jpegSize(view) {
|
|
18977
|
+
let at = 2;
|
|
18978
|
+
while (at + 9 <= view.byteLength) {
|
|
18979
|
+
if (view.getUint8(at) !== 255) return null;
|
|
18980
|
+
const marker = view.getUint8(at + 1);
|
|
18981
|
+
if (marker === 255) {
|
|
18982
|
+
at += 1;
|
|
18983
|
+
continue;
|
|
18984
|
+
}
|
|
18985
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return size(view.getUint16(at + 7), view.getUint16(at + 5));
|
|
18986
|
+
at += 2 + view.getUint16(at + 2);
|
|
18987
|
+
}
|
|
18988
|
+
return null;
|
|
18989
|
+
}
|
|
18990
|
+
function webpSize(bytes, view) {
|
|
18991
|
+
if (ascii(bytes, 12, "VP8 ") && view.byteLength >= 30) return size(view.getUint16(26, true) & 16383, view.getUint16(28, true) & 16383);
|
|
18992
|
+
if (ascii(bytes, 12, "VP8L") && view.byteLength >= 25) {
|
|
18993
|
+
const bits = view.getUint32(21, true);
|
|
18994
|
+
return size((bits & 16383) + 1, (bits >>> 14 & 16383) + 1);
|
|
18995
|
+
}
|
|
18996
|
+
if (ascii(bytes, 12, "VP8X") && view.byteLength >= 30) {
|
|
18997
|
+
const width = view.getUint8(24) | view.getUint8(25) << 8 | view.getUint8(26) << 16;
|
|
18998
|
+
const height = view.getUint8(27) | view.getUint8(28) << 8 | view.getUint8(29) << 16;
|
|
18999
|
+
return size(width + 1, height + 1);
|
|
19000
|
+
}
|
|
19001
|
+
return null;
|
|
19002
|
+
}
|
|
19003
|
+
/** Its height is negative when its rows run top to bottom. */
|
|
19004
|
+
function bmpSize(view) {
|
|
19005
|
+
return view.byteLength >= 26 ? size(view.getInt32(18, true), Math.abs(view.getInt32(22, true))) : null;
|
|
19006
|
+
}
|
|
19007
|
+
function imagePixelSize(bytes) {
|
|
19008
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19009
|
+
if (ascii(bytes, 1, "PNG\r\n")) return pngSize(view);
|
|
19010
|
+
if (ascii(bytes, 0, "GIF8")) return gifSize(view);
|
|
19011
|
+
if (bytes[0] === 255 && bytes[1] === 216) return jpegSize(view);
|
|
19012
|
+
if (ascii(bytes, 0, "RIFF") && ascii(bytes, 8, "WEBP")) return webpSize(bytes, view);
|
|
19013
|
+
if (ascii(bytes, 0, "BM")) return bmpSize(view);
|
|
19014
|
+
return null;
|
|
19015
|
+
}
|
|
18672
19016
|
// ../client/src/lib/navigation/concept-path.ts
|
|
18673
19017
|
/**
|
|
18674
19018
|
* A concept in a URL path (ADR 0023): each `/`-separated segment encoded on its own, so a
|
|
@@ -20410,10 +20754,11 @@ async function uploadAsset(graph, args) {
|
|
|
20410
20754
|
const identity = assets.identify(saved.ref);
|
|
20411
20755
|
if (identity) assets.uploaded.add(identity);
|
|
20412
20756
|
return {
|
|
20413
|
-
|
|
20757
|
+
reference: saved.ref,
|
|
20414
20758
|
name: displayNameOf(saved.ref),
|
|
20415
20759
|
type,
|
|
20416
20760
|
bytes: file.bytes.byteLength,
|
|
20761
|
+
...imagePixelSize(file.bytes),
|
|
20417
20762
|
reused: saved.reused === true,
|
|
20418
20763
|
/** Paste this into a document to show the asset: an image tag for an image, a link otherwise. */
|
|
20419
20764
|
markdown: buildAssetMarkdown(saved)
|
|
@@ -20426,12 +20771,12 @@ async function uploadAsset(graph, args) {
|
|
|
20426
20771
|
*/
|
|
20427
20772
|
async function readAsset(graph, args) {
|
|
20428
20773
|
const assets = requireAssets(graph);
|
|
20429
|
-
if (!args.
|
|
20774
|
+
if (!args.reference || args.reference.trim() === "") throw new ToolError("invalid_argument", "reference must be an asset reference or name.");
|
|
20430
20775
|
await graph.store.refresh();
|
|
20431
|
-
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(args.
|
|
20432
|
-
const ref = normaliseRef(args.
|
|
20776
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(args.reference.trim())) throw new ToolError("invalid_argument", `"${args.reference}" is a url, not an asset of this graph.`);
|
|
20777
|
+
const ref = normaliseRef(args.reference);
|
|
20433
20778
|
const identity = assets.identify(ref);
|
|
20434
|
-
if (!identity) throw new ToolError("invalid_argument", `"${args.
|
|
20779
|
+
if (!identity) throw new ToolError("invalid_argument", `"${args.reference}" is not an asset reference of this graph.`);
|
|
20435
20780
|
const documents = await reachable(graph, identity);
|
|
20436
20781
|
if (!documents) throw new ToolError("asset_not_found", `No document you can read references "${displayNameOf(ref)}", so it is not available here.`);
|
|
20437
20782
|
const asset = await assets.store.readBytes(ref);
|
|
@@ -20448,7 +20793,8 @@ async function readAsset(graph, args) {
|
|
|
20448
20793
|
name: asset.name || displayNameOf(ref),
|
|
20449
20794
|
type: asset.type,
|
|
20450
20795
|
bytes: asset.bytes.byteLength,
|
|
20451
|
-
|
|
20796
|
+
...imagePixelSize(asset.bytes),
|
|
20797
|
+
reference: ref,
|
|
20452
20798
|
documents
|
|
20453
20799
|
};
|
|
20454
20800
|
}
|
|
@@ -20490,7 +20836,7 @@ async function listAssets(graph, args = {}) {
|
|
|
20490
20836
|
sizes = void 0;
|
|
20491
20837
|
}
|
|
20492
20838
|
const list = [...found.entries()].map(([id, entry]) => ({
|
|
20493
|
-
|
|
20839
|
+
reference: entry.ref,
|
|
20494
20840
|
name: entry.name,
|
|
20495
20841
|
type: entry.type,
|
|
20496
20842
|
...sizes?.has(id) ? { bytes: sizes.get(id) } : {},
|
|
@@ -20648,7 +20994,16 @@ async function requireReferencedTask(graph, reference, purpose = "read") {
|
|
|
20648
20994
|
if (found.code === "task_ambiguous") throw new ToolError("task_ambiguous", `More than one task has those words (${found.candidates.map((candidate) => `"${candidate.document}" line ${candidate.line}`).join(", ")}), so none was chosen. Ask the user which one, or name it by concept and line.`);
|
|
20649
20995
|
const named = resolveIdentity(graph, parsed.document);
|
|
20650
20996
|
if (purpose === "write" && named && await visibleText(graph, named) === null) throw protectedDocument(parsed.document);
|
|
20651
|
-
throw new ToolError("task_not_found",
|
|
20997
|
+
throw new ToolError("task_not_found", taskNotFoundMessage(graph.connection()));
|
|
20998
|
+
}
|
|
20999
|
+
/**
|
|
21000
|
+
* The tools see only this computer's copy, so a task that is missing from it may be gone or may
|
|
21001
|
+
* not have arrived. An offline copy makes the second likely, and a fresh instruction names the
|
|
21002
|
+
* same words and would fail the same way, so it asks for a retry instead.
|
|
21003
|
+
*/
|
|
21004
|
+
function taskNotFoundMessage(connection) {
|
|
21005
|
+
if (connection?.state === "offline") return `No task in this computer's copy of the graph has those words, but the copy has been ${offlineSince(connection)}, so the task may be newer than the copy. Tell the user, and try again once graph_info says the copy is connected.`;
|
|
21006
|
+
return "No task in the graph has those words now: it was edited or deleted, or the change has not reached this computer yet. Ask the user for a fresh agent instruction.";
|
|
20652
21007
|
}
|
|
20653
21008
|
/**
|
|
20654
21009
|
* The block's own lines and everything nested under it: in the index's rows, which run in
|
|
@@ -20759,6 +21114,7 @@ async function graphInfo(graph) {
|
|
|
20759
21114
|
return {
|
|
20760
21115
|
name: graph.name,
|
|
20761
21116
|
backend: graph.backend,
|
|
21117
|
+
connection: graph.connection() ?? void 0,
|
|
20762
21118
|
documents: {
|
|
20763
21119
|
pages: documents.filter((d) => d.kind === "page").length,
|
|
20764
21120
|
journals: documents.filter((d) => d.kind === "journal").length,
|
|
@@ -21030,7 +21386,7 @@ async function publish(graph, args, host) {
|
|
|
21030
21386
|
}
|
|
21031
21387
|
let drawings = null;
|
|
21032
21388
|
if (needsDrawings(bodies)) {
|
|
21033
|
-
drawings = await openDrawingRenderer(env);
|
|
21389
|
+
drawings = await openDrawingRenderer(env, source.readAsset);
|
|
21034
21390
|
if (!drawings) {
|
|
21035
21391
|
await renderer?.dispose();
|
|
21036
21392
|
await maps?.dispose();
|
|
@@ -21140,14 +21496,21 @@ function cliPublishOutput(result) {
|
|
|
21140
21496
|
note: "Documents the site leaves out are counted here, not named. Settings → Publish in EtherPK shows the full report."
|
|
21141
21497
|
};
|
|
21142
21498
|
}
|
|
21499
|
+
/**
|
|
21500
|
+
* How long `graph_info` waits for the publications. Reading them asks the relay how far each
|
|
21501
|
+
* document has moved, and that request waits for a reconnect if the socket drops under it.
|
|
21502
|
+
* `graph_info` is how an agent learns the copy is offline, so it answers without them.
|
|
21503
|
+
*/
|
|
21504
|
+
var PUBLISHING_READ_MS = 15e3;
|
|
21143
21505
|
/** The publishing half of `graph_info`: each publication with its folder here, and whether diagrams can be drawn. */
|
|
21144
|
-
async function publishingInfo(graph, host) {
|
|
21506
|
+
async function publishingInfo(graph, host, readMs = PUBLISHING_READ_MS) {
|
|
21145
21507
|
const { env, cmd } = hostOf$1(host);
|
|
21146
|
-
const
|
|
21508
|
+
const reading = graph.publishing.readSource();
|
|
21509
|
+
const read = await reachedWithin(reading, readMs);
|
|
21147
21510
|
const destinationOf = await destinationsFor(graph, env);
|
|
21148
21511
|
const chromium = await chromiumStatus(env, cmd);
|
|
21149
21512
|
return {
|
|
21150
|
-
publications: summarisePublishing(source).publications.map((p) => {
|
|
21513
|
+
publications: read ? summarisePublishing((await reading).source).publications.map((p) => {
|
|
21151
21514
|
const { folder, repository } = destinationOf(p.id);
|
|
21152
21515
|
return {
|
|
21153
21516
|
id: p.id,
|
|
@@ -21156,7 +21519,8 @@ async function publishingInfo(graph, host) {
|
|
|
21156
21519
|
publishFolder: folder,
|
|
21157
21520
|
publishRepository: repository ? repositoryLabel(repository) : null
|
|
21158
21521
|
};
|
|
21159
|
-
}),
|
|
21522
|
+
}) : null,
|
|
21523
|
+
...read ? {} : { note: "The publications could not be read in time. list_publications waits for them." },
|
|
21160
21524
|
mermaid: {
|
|
21161
21525
|
available: chromium.executable !== null,
|
|
21162
21526
|
...chromium.executable ? {} : { setup: chromium.setupCommand }
|
|
@@ -21652,7 +22016,7 @@ async function previewTheme(graph, args, host) {
|
|
|
21652
22016
|
};
|
|
21653
22017
|
const bodies = source.documents.map((d) => d.text);
|
|
21654
22018
|
const renderer = needsMermaid(bodies) ? await openDiagramRenderer(env) : null;
|
|
21655
|
-
const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env) : null;
|
|
22019
|
+
const drawings = needsDrawings(bodies) ? await openDrawingRenderer(env, source.readAsset) : null;
|
|
21656
22020
|
try {
|
|
21657
22021
|
const environment = createNodePublishEnvironment({
|
|
21658
22022
|
graphTheme: (id) => graph.publishing.graphTheme(id),
|
|
@@ -21769,6 +22133,20 @@ async function runTool(work) {
|
|
|
21769
22133
|
}
|
|
21770
22134
|
}
|
|
21771
22135
|
/**
|
|
22136
|
+
* A note after the answer, whether that is a result or a refusal, while the copy it came from is
|
|
22137
|
+
* offline. A block of its own, so the answer's JSON stays as it always is.
|
|
22138
|
+
*/
|
|
22139
|
+
function withOfflineNote(result, connection) {
|
|
22140
|
+
const note = offlineNotice(connection);
|
|
22141
|
+
return note ? {
|
|
22142
|
+
...result,
|
|
22143
|
+
content: [...result.content, {
|
|
22144
|
+
type: "text",
|
|
22145
|
+
text: note
|
|
22146
|
+
}]
|
|
22147
|
+
} : result;
|
|
22148
|
+
}
|
|
22149
|
+
/**
|
|
21772
22150
|
* The refusal every tool gives once the Sync Server has ended access, instead of answering from
|
|
21773
22151
|
* a cache that can no longer be trusted or saved.
|
|
21774
22152
|
*/
|
|
@@ -21799,18 +22177,23 @@ function createMcpServer(source, info) {
|
|
|
21799
22177
|
const ready = typeof source === "function" ? null : Promise.resolve(source);
|
|
21800
22178
|
ready?.catch(() => {});
|
|
21801
22179
|
const backendKind = typeof source === "function" || source instanceof Promise ? info.backendKind : source.backend.kind;
|
|
21802
|
-
const run =
|
|
21803
|
-
|
|
22180
|
+
const run = async (work) => {
|
|
22181
|
+
let graph;
|
|
22182
|
+
try {
|
|
22183
|
+
graph = await (ready ?? source());
|
|
22184
|
+
} catch (error) {
|
|
22185
|
+
return failed(error);
|
|
22186
|
+
}
|
|
21804
22187
|
const ended = accessEndedError(graph, info.cmd ?? "etherpk-mcp");
|
|
21805
|
-
if (ended)
|
|
21806
|
-
return work(graph);
|
|
21807
|
-
}
|
|
22188
|
+
if (ended) return failed(ended);
|
|
22189
|
+
return withOfflineNote(await runTool(() => work(graph)), graph.connection());
|
|
22190
|
+
};
|
|
21808
22191
|
const server = new McpServer({
|
|
21809
22192
|
name: "etherpk",
|
|
21810
22193
|
version: info.version
|
|
21811
22194
|
}, { instructions: [
|
|
21812
22195
|
`You are connected to the EtherPK knowledge graph "${info.graphName}": daily journal entries and titled pages in plain markdown, linked with [[wikilinks]].`,
|
|
21813
|
-
...backendKind === "synced" ? ["This graph is synced and encrypted: it has no folder on this computer, so reach it only through these tools."] : [],
|
|
22196
|
+
...backendKind === "synced" ? ["This graph is synced and encrypted: it has no folder on this computer, so reach it only through these tools.", "The tools answer from this computer's copy of the graph. While that copy is offline from the Sync Server, every answer ends with a note saying since when and graph_info reports connection.state \"offline\". Edits made elsewhere since then are missing, so a page or task that is not found may only be newer than the copy: tell the user that, rather than saying it is gone."] : [],
|
|
21814
22197
|
`This process holds the EtherPK sign-in and Encryption Keys it needs. Never read, print, copy or search ${info.credentialsDir ?? "~/.config/etherpk"}, or any keychain entry named etherpk-mcp: they are credentials that open the whole account, not notes.`,
|
|
21815
22198
|
"Concept names are case-insensitive. Protected documents are not shown here: no list, search, backlink, task or graph answer names one, and a read of one answers not_found. graph_info says how many there are. A write onto a protected document's name is refused with protected_document - tell the user to make that change in EtherPK.",
|
|
21816
22199
|
"Bullets are \"- \" with two-space nesting. Tasks are \"- [ ]\" / \"- [x]\" with task tags (#P1 #P2 #P3, #W #D #C, #D-YYYY-MM-DD due, #S-YYYY-MM-DD scheduled) right after the checkbox. A free tag such as #bug or #needs-review (letters, digits and single hyphens) is the user's own label and can go anywhere in a task's text; write task tags first.",
|
|
@@ -21820,11 +22203,11 @@ function createMcpServer(source, info) {
|
|
|
21820
22203
|
"search has two kinds of matching: mode \"text\" (default) matches words and quoted phrases, and mode \"semantic\" finds passages about what a question or description means even when no words match. Use semantic for questions and descriptions, text for names, identifiers and exact phrases. \"hybrid\" returns both groups. When you answer from a search result, cite the document and where in it (its breadcrumb or lines). Semantic mode needs a one-time \"semantic setup\" on this computer - if it is not set up, search says so and names the command.",
|
|
21821
22204
|
"graph_insights says what the links show across the whole graph (the most-linked concepts, pages many documents ask for that do not exist yet, pages linked to nothing, groups of related concepts and the concepts bridging them), and graph_path finds how two concepts are connected. Use them to answer questions about the shape of the graph, or to suggest pages to write or link.",
|
|
21822
22205
|
"Start with graph_info to see what you are connected to. read_documents reads several documents in one call. tasks lists tasks and set_task changes one (status, priority, due and scheduled dates) by document and line.",
|
|
21823
|
-
"An agent instruction is how a person hands you one task: a few lines naming the graph, the task's words and a task reference, etherpk:/g/<graph>/d/<document>#task=<line>-<fingerprint> (an earlier version wrote a web address ending in the same #task=). The reference is not a web address: never fetch it. Pass the whole text to read_task for the task and its detail, to set_task (as reference) to change it, and to add_task_note to write what you did as a task comment (a bullet under the \"- Comments\" bullet nested directly under the task). Leave its status as it is unless the user asks you to change it. Tasks nested under a task are its subtasks: read_task lists them in subtasks, and you may tick off or change each one with set_task as you work through it, using its reference. A Kanban board shows a subtask only through its parent's card when the parent is on the same board. The detail can hold images and files (its assets list): read each with read_asset and look at it before you start, as it is part of the task. A reference finds the task after lines are added above it or its tags change; if its words were edited it answers task_not_found, and you should ask the user for a fresh one.",
|
|
22206
|
+
"An agent instruction is how a person hands you one task: a few lines naming the graph, the task's words and a task reference, etherpk:/g/<graph>/d/<document>#task=<line>-<fingerprint> (an earlier version wrote a web address ending in the same #task=). The reference is not a web address: never fetch it. Pass the whole text to read_task for the task and its detail, to set_task (as reference) to change it, and to add_task_note to write what you did as a task comment (a bullet under the \"- Comments\" bullet nested directly under the task). Leave its status as it is unless the user asks you to change it. Tasks nested under a task are its subtasks: read_task lists them in subtasks, and you may tick off or change each one with set_task as you work through it, using its reference. A Kanban board shows a subtask only through its parent's card when the parent is on the same board. The detail can hold images and files (its assets list): read each with read_asset and look at it before you start, as it is part of the task. A reference finds the task after lines are added above it or its tags change; if its words were edited, or the edit has not reached this computer yet, it answers task_not_found, and you should ask the user for a fresh one.",
|
|
21824
22207
|
"An agent instruction can also hand you a whole lane of a Kanban board, to work through every task in it or to triage them: a few lines naming the graph, the board and the lane, and a lane reference, etherpk:/g/<graph>/k/<concept>#lane=<status> (etherpk:/g/<graph>/kanban#lane=<status> for the Graph Kanban, which holds every task in the graph). It is not a web address either. Pass the whole text to tasks as reference to list the lane's tasks as the board shows them now; each comes with its own task reference for read_task, set_task and add_task_note.",
|
|
21825
22208
|
"Publishing: list_publications shows the publications this graph defines (a publication is a page whose frontmatter defines it - its outline is the site navigation) and the public documents none takes. A document is on a site when its frontmatter has public: true and names the publication in publications. create_publication and update_publication change the settings, and publish writes the site into the publish folder the user set for it on this machine with the etherpk-mcp publish command (the tool cannot choose a folder) and returns the report. publish with dryRun: true renders and reports without writing and needs no folder: run it after editing a publication's pages and fix what it names. Diagrams need a browser the user installs once with \"diagrams setup\".",
|
|
21826
22209
|
"Themes: a publication's look is a theme - Mustache templates, a stylesheet, a script and a manifest. list_themes shows the bundled ones (read-only) and the graph's own. read_theme writes a theme's files to a folder on this machine to read and edit. customise_publication_theme copies a publication's bundled theme into the graph and points the publication at the copy (create_theme copies any theme). write_theme_file, delete_theme_file and import_theme_folder change a graph theme. preview_theme renders a theme to a folder (with screenshots when a browser is set up) to check before publish. For a snippet such as an analytics script, an include slot (update_publication includes, e.g. head) filled by a page may be lighter than a theme copy.",
|
|
21827
|
-
"Images and files are assets: upload_asset adds a file from this machine and returns the markdown to paste into a document. read_asset writes an asset to a local file you can open, and list_assets shows the assets documents reference. An asset is available only where a document you can read references it (or you uploaded it this session). read_asset, read_theme and preview_theme write under the graph's downloads directory and return the path - name a folder relative to it, never elsewhere.",
|
|
22210
|
+
"Images and files are assets: upload_asset adds a file from this machine and returns the markdown to paste into a document. To put an image in a drawing, add a line to its excalidraw.drawing fence with the reference, width and height upload_asset returns: {\"type\":\"image\",\"customData\":{\"asset\":\"<reference>\"},\"x\":0,\"y\":0,\"width\":<width>,\"height\":<height>}. A shape added after it draws above it. Add lines only, and never edit or reorder the lines there. read_asset writes an asset to a local file you can open, and list_assets shows the assets documents reference. An asset is available only where a document you can read references it (or you uploaded it this session). read_asset, read_theme and preview_theme write under the graph's downloads directory and return the path - name a folder relative to it, never elsewhere.",
|
|
21828
22211
|
"The user documentation is at https://docs.etherpk.com."
|
|
21829
22212
|
].join("\n") });
|
|
21830
22213
|
server.registerTool("list_documents", {
|
|
@@ -22028,7 +22411,7 @@ function createMcpServer(source, info) {
|
|
|
22028
22411
|
}, async (args) => run((graph) => setFrontmatter(graph, args)));
|
|
22029
22412
|
server.registerTool("upload_asset", {
|
|
22030
22413
|
title: "Upload an asset",
|
|
22031
|
-
description: "Add a file on this machine (an image, a PDF, any file) to the graph as an asset. Returns the reference and the markdown to paste into a document (an image tag for an image, a link otherwise). Bytes the graph already holds are not stored twice: the result then says reused: true and points at the existing asset. The file is stored as it is, without image optimisation. Refused with error \"invalid_argument\" for a folder, a file over 100 MiB, a hidden file or one in a hidden folder (.ssh, .env), and the Headless Client's own config and cache. Refused with error \"asset_refused\" when the server declines it on a quota.",
|
|
22414
|
+
description: "Add a file on this machine (an image, a PDF, any file) to the graph as an asset. Returns the reference, an image's width and height in pixels, and the markdown to paste into a document (an image tag for an image, a link otherwise). Bytes the graph already holds are not stored twice: the result then says reused: true and points at the existing asset. The file is stored as it is, without image optimisation. Refused with error \"invalid_argument\" for a folder, a file over 100 MiB, a hidden file or one in a hidden folder (.ssh, .env), and the Headless Client's own config and cache. Refused with error \"asset_refused\" when the server declines it on a quota.",
|
|
22032
22415
|
inputSchema: {
|
|
22033
22416
|
path: z.string().min(1).describe("Absolute path of an ordinary file on this machine."),
|
|
22034
22417
|
name: z.string().min(1).optional().describe("The name to store it under - the file's own name by default.")
|
|
@@ -22036,9 +22419,9 @@ function createMcpServer(source, info) {
|
|
|
22036
22419
|
}, async (args) => run((graph) => uploadAsset(graph, args)));
|
|
22037
22420
|
server.registerTool("read_asset", {
|
|
22038
22421
|
title: "Read an asset",
|
|
22039
|
-
description: "Write an asset's bytes to a file on this machine and return the path, so you can open or view it. Pass the reference as a document shows it (\"../assets/<name>\") or the name alone. Available only where a document you can read references the asset (or you uploaded it this session) - otherwise error \"asset_not_found\". The file is written under the graph's downloads directory, named after the asset, and never over an existing file.",
|
|
22422
|
+
description: "Write an asset's bytes to a file on this machine and return the path, with an image's width and height in pixels, so you can open or view it. Pass the reference as a document shows it (\"../assets/<name>\") or the name alone. Available only where a document you can read references the asset (or you uploaded it this session) - otherwise error \"asset_not_found\". The file is written under the graph's downloads directory, named after the asset, and never over an existing file.",
|
|
22040
22423
|
inputSchema: {
|
|
22041
|
-
|
|
22424
|
+
reference: z.string().min(1).describe("The asset as a document or read_task shows it (\"../assets/<name>\"), or its name alone."),
|
|
22042
22425
|
out_dir: z.string().min(1).optional().describe("A folder under the graph's downloads directory, relative to it - the downloads directory itself by default. A folder outside it is refused.")
|
|
22043
22426
|
}
|
|
22044
22427
|
}, async (args) => run((graph) => readAsset(graph, args)));
|
|
@@ -22174,12 +22557,15 @@ function createMcpServer(source, info) {
|
|
|
22174
22557
|
}, async (args) => run((graph) => previewTheme(graph, args, host)));
|
|
22175
22558
|
server.registerTool("graph_info", {
|
|
22176
22559
|
title: "Graph info",
|
|
22177
|
-
description: "What you are connected to: the graph's name, whether it is a synced graph (
|
|
22560
|
+
description: "What you are connected to: the graph's name, whether it is a synced graph (on which server, and whether this computer's copy is connected to it now: connection.state and since) or a folder, how many pages and journal entries it has and how many of them are protected (protected documents are counted here and shown nowhere else), the state of semantic search, whether assets are available, the publications with the publish folder set for each on this machine, and whether Mermaid diagrams can be drawn here.",
|
|
22178
22561
|
inputSchema: {}
|
|
22179
|
-
}, async () => run(async (graph) =>
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22562
|
+
}, async () => run(async (graph) => {
|
|
22563
|
+
const publishing = await publishingInfo(graph, host);
|
|
22564
|
+
return {
|
|
22565
|
+
...await graphInfo(graph),
|
|
22566
|
+
publishing
|
|
22567
|
+
};
|
|
22568
|
+
}));
|
|
22183
22569
|
return server;
|
|
22184
22570
|
}
|
|
22185
22571
|
// src/socket-transport.ts
|
|
@@ -22823,6 +23209,31 @@ function mapItems(db, concept, cap = MAP_ITEMS_CAP) {
|
|
|
22823
23209
|
* against an in-memory database, exactly as ADR 0015 established for the query layer — no
|
|
22824
23210
|
* browser, no worker, no OPFS.
|
|
22825
23211
|
*/
|
|
23212
|
+
/** The reads that list rows from the open index, and list nothing while none is open. */
|
|
23213
|
+
function answerListRead(db, request) {
|
|
23214
|
+
switch (request.type) {
|
|
23215
|
+
case "property-keys": return {
|
|
23216
|
+
type: "property-keys",
|
|
23217
|
+
id: request.id,
|
|
23218
|
+
keys: db ? propertyKeys(db) : []
|
|
23219
|
+
};
|
|
23220
|
+
case "free-tags": return {
|
|
23221
|
+
type: "free-tags",
|
|
23222
|
+
id: request.id,
|
|
23223
|
+
tags: db ? usedFreeTags(db) : []
|
|
23224
|
+
};
|
|
23225
|
+
case "templates": return {
|
|
23226
|
+
type: "templates",
|
|
23227
|
+
id: request.id,
|
|
23228
|
+
templates: db ? templatePages(db) : []
|
|
23229
|
+
};
|
|
23230
|
+
case "property-values": return {
|
|
23231
|
+
type: "property-values",
|
|
23232
|
+
id: request.id,
|
|
23233
|
+
values: db ? propertyValues(db, request.key) : []
|
|
23234
|
+
};
|
|
23235
|
+
}
|
|
23236
|
+
}
|
|
22826
23237
|
function createIndexCore(host) {
|
|
22827
23238
|
let db;
|
|
22828
23239
|
let persisted = false;
|
|
@@ -23116,21 +23527,10 @@ function createIndexCore(host) {
|
|
|
23116
23527
|
capped: count.capped
|
|
23117
23528
|
}];
|
|
23118
23529
|
}
|
|
23119
|
-
case "property-keys":
|
|
23120
|
-
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
}];
|
|
23124
|
-
case "templates": return [{
|
|
23125
|
-
type: "templates",
|
|
23126
|
-
id: request.id,
|
|
23127
|
-
templates: db ? templatePages(db) : []
|
|
23128
|
-
}];
|
|
23129
|
-
case "property-values": return [{
|
|
23130
|
-
type: "property-values",
|
|
23131
|
-
id: request.id,
|
|
23132
|
-
values: db ? propertyValues(db, request.key) : []
|
|
23133
|
-
}];
|
|
23530
|
+
case "property-keys":
|
|
23531
|
+
case "free-tags":
|
|
23532
|
+
case "templates":
|
|
23533
|
+
case "property-values": return [answerListRead(db, request)];
|
|
23134
23534
|
case "property-match": return [{
|
|
23135
23535
|
type: "property-match",
|
|
23136
23536
|
id: request.id,
|
|
@@ -24034,6 +24434,12 @@ function createRemoteGraphIndex(source, transport, options) {
|
|
|
24034
24434
|
id
|
|
24035
24435
|
}))).keys;
|
|
24036
24436
|
},
|
|
24437
|
+
async freeTags() {
|
|
24438
|
+
return (await request((id) => ({
|
|
24439
|
+
type: "free-tags",
|
|
24440
|
+
id
|
|
24441
|
+
}))).tags;
|
|
24442
|
+
},
|
|
24037
24443
|
async templates() {
|
|
24038
24444
|
return (await request((id) => ({
|
|
24039
24445
|
type: "templates",
|
|
@@ -27309,7 +27715,10 @@ function api(deps) {
|
|
|
27309
27715
|
return {
|
|
27310
27716
|
f: deps.fetch ?? fetch,
|
|
27311
27717
|
base: deps.baseUrl.replace(/\/$/, ""),
|
|
27312
|
-
headers: async () => ({
|
|
27718
|
+
headers: async () => ({
|
|
27719
|
+
"x-sync-token": await deps.syncToken(),
|
|
27720
|
+
"Content-Type": "application/json"
|
|
27721
|
+
})
|
|
27313
27722
|
};
|
|
27314
27723
|
}
|
|
27315
27724
|
/**
|
|
@@ -27460,6 +27869,7 @@ function assembleHeadlessGraph(parts) {
|
|
|
27460
27869
|
themes: parts.themes,
|
|
27461
27870
|
settle: () => parts.settle(schedulePersist),
|
|
27462
27871
|
accessLoss: () => parts.accessLoss?.() ?? null,
|
|
27872
|
+
connection: () => parts.connection?.() ?? null,
|
|
27463
27873
|
persist,
|
|
27464
27874
|
semantic,
|
|
27465
27875
|
semanticOpened: () => semanticOpening ? semanticOpening.catch(() => void 0) : Promise.resolve(void 0),
|
|
@@ -27500,6 +27910,7 @@ async function openHeadlessGraph(deps) {
|
|
|
27500
27910
|
onAccessLost: deps.onAccessLost,
|
|
27501
27911
|
publishName: deps.publishName
|
|
27502
27912
|
});
|
|
27913
|
+
const connection = followConnection(sync, { onChange: deps.onConnectionChange });
|
|
27503
27914
|
const store = createServerDocumentStore(sync, { readyTimeoutMs: deps.readyTimeoutMs });
|
|
27504
27915
|
try {
|
|
27505
27916
|
await store.scan();
|
|
@@ -27590,6 +28001,7 @@ async function openHeadlessGraph(deps) {
|
|
|
27590
28001
|
graphId: deps.graphId,
|
|
27591
28002
|
name: sync.getMeta().name ?? deps.graphId,
|
|
27592
28003
|
accessLoss: () => sync.accessLoss(),
|
|
28004
|
+
connection: () => connection.current(),
|
|
27593
28005
|
store: documents,
|
|
27594
28006
|
index,
|
|
27595
28007
|
assets,
|
|
@@ -29696,6 +30108,7 @@ async function openSyncedGraph(syncServer, graphId, named) {
|
|
|
29696
30108
|
embeddingModel: () => loadEmbeddingModel(process.env),
|
|
29697
30109
|
onSemanticProgress: reportSemanticProgress,
|
|
29698
30110
|
onError: (error) => console.error(`etherpk-mcp: ${error.message}`),
|
|
30111
|
+
onConnectionChange: (change) => console.error(`etherpk-mcp: ${connectionChangeLine(change)}`),
|
|
29699
30112
|
onAccessLost: (loss) => console.error(loss.kind === "membership" ? `etherpk-mcp: ${account.serverBaseUrl} ended this account's access to graph ${graphId}: it left, was removed, or the graph was deleted. Stopped syncing. Run: ${CMD} graphs` : `etherpk-mcp: the token for ${account.serverBaseUrl} was revoked or is no longer valid. Stopped syncing. Run: ${CMD} login --sync-server ${login.syncServer}`),
|
|
29700
30113
|
publishName: createGraphNamePublisher({
|
|
29701
30114
|
api: account.api,
|