allyhub 0.15.0 → 0.15.2
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/CHANGELOG.md +10 -0
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/fonts.js +3 -3
- package/dist/node_modules/@allyhub/doc-print/dist/layout.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/dist/pdf.js +4 -4
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/export.js +2 -2
- package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/dist/ag-psd.js +2 -0
- package/dist/node_modules/@allyhub/image-psd/dist/read.js +12 -12
- package/dist/node_modules/@allyhub/image-psd/dist/write.js +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/dist/pdf.js +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/dist/index.js +2 -1
- package/dist/node_modules/@allyhub/linkedin-view/dist/stage.js +65 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/dist/exports.js +2 -2
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.d.ts +17 -0
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package-lock.json +49 -0
- package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package.json +7 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package.json +17 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package-lock.json +24 -0
- package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package.json +23 -0
- package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package-lock.json +19 -0
- package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package.json +15 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package-lock.json +55 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package.json +7 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package-lock.json +169 -0
- package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package.json +7 -0
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/chart.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/index.js +262 -1
- package/dist/node_modules/@allyhub/x-view/dist/stage.js +325 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +12 -12
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-BHI0AbUY.js → abnfDiagram-WEYOIA3C-9z0ZEYUq.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-BMQS-OKZ.js → architecture-WOLXFQ4H-ELMO_PA6.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-DZp9CM6P.js → architectureDiagram-ZHVYKT53-C0yuCWU3.js} +1 -1
- package/editor-web/assets/article-DHFgHYjv.js +3 -0
- package/editor-web/assets/article-Dt9id9Y9.js +7 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-h6LWaev4.js → blockDiagram-RJAE7QA3-vi6JOg4o.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-BvSMs7J4.js → c4Diagram-XDPPPE54-Agf_H8uS.js} +1 -1
- package/editor-web/assets/channel-Dkg198L0.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-0EJTAmDF.js → chunk-2E7WHVMD-XalaZaha.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BeYB4AEY.js → chunk-4EMNKR2T-DUlRZkCS.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BPFOPTBe.js → chunk-55XCU76K-DTa7whGr.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-CZ2C7ULu.js → chunk-7S6XSTFO-85zCPzj0.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-B5RtsZkj.js → chunk-AQDTSKZB-CWBseIyh.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-_3G4hddj.js → chunk-DSNLSHJZ-BFnyvrWg.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-DO5b4ll2.js → chunk-HAGFOTED-DFWda2Rk.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-C6XNI71Q.js → chunk-HNE4Q36P-aXibFitC.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-nDCX29rQ.js → chunk-NQOKRVIF-CtJUuFdN.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-CRCOiitq.js → chunk-UHW7PFBP-B6QKSKWE.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-hNPKKjCN.js → chunk-VQ5W62QI-CF6Al55P.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-KlnVtIDc.js → chunk-WQQL4CDK-w2TKLkyw.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-B76hDUrM.js → chunk-YZO67HFG-DVGOATM3.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-D9m1N0wI.js → chunk-ZAUX2LTX-Cq7MMjDP.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-443euxzo.js → chunk-ZCHMQSOR-GMW_lBh4.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-Bbw-8Ons.js → classDiagram-v2-4MYWR3UA-C7AK5Bkj.js} +1 -1
- package/editor-web/assets/code-BID_OoRp.js +1 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-C4E7TlUr.js → cynefin-EF2NZ3EQ-ZnDieQsN.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-PBPGa_HS.js → cynefinDiagram-WF24UDRP-BrukKIBF.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-DwXdEtQG.js → dagre-NK4GIZVX-DfO0S2p_.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-BE3FwdX7.js → diagram-CBK3MWTC-D43RLesi.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-BPl2ZY33.js → diagram-I5XIIV2D-bA1B1QQG.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-BLVPYSzw.js → diagram-ODIL2UCW-DAdXBD2K.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-BVZk62FO.js → diagram-PFBEJUXE-C_KyEaws.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-Z75LSbxH.js → diagram-RJA3I4VV-oXTtENF7.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-BynGqDAg.js → diagram-TYUNFSNR-Czupe6mO.js} +1 -1
- package/editor-web/assets/dist-2lNSE-G_.js +82 -0
- package/editor-web/assets/{dist-D_xVYGnk.js → dist-5HNrQ9AU.js} +3 -3
- package/editor-web/assets/dist-BPecIPz6.js +530 -0
- package/editor-web/assets/dist-BXJKASX4.js +24 -0
- package/editor-web/assets/{dist-CIQUbiAd.js → dist-BeDRTqQ8.js} +11 -11
- package/editor-web/assets/{dist-CxlIyluY.js → dist-BlL-4sl3.js} +1 -1
- package/editor-web/assets/dist-BtRMClDw.js +40 -0
- package/editor-web/assets/{dist-Ch34PllS.js → dist-BuqBg8k8.js} +1 -1
- package/editor-web/assets/{dist-cUeSwqws.js → dist-BwW08gSh.js} +1 -1
- package/editor-web/assets/{dist-VP4ECMOk.js → dist-C30Thvb3.js} +1 -1
- package/editor-web/assets/dist-Cj5AmpVb.js +5 -0
- package/editor-web/assets/dist-CjjnDOa8.js +3 -0
- package/editor-web/assets/dist-D7ur8721.js +6 -0
- package/editor-web/assets/{dist-Nc_h0Jye.js → dist-DOHhp09C.js} +1 -1
- package/editor-web/assets/{dist-UG2TIZxP.js → dist-LhFEYZza.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-SwhqbeK4.js → ebnfDiagram-V4P3TTPT-BOhNZmtp.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-Bb1GSt2Z.js → elk-QONTBCTQ-DoZH3OoE.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-qUy0NDKn.js → erDiagram-KYQIGQAA-Bv0KDJi4.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-BYBYso_j.js → eventmodeling-K75KTNOO-C-_xzqfj.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-C7ZmHJZW.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-Cw-BkZT8.js → ganttDiagram-R7GPNTJY-CAuJlaZX.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-CTXzWPq_.js → gitGraph-VSP46ZUC-Dx2xLi5C.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-Jd9HU3WA.js → gitGraphDiagram-PDYL7XHY-DHsk_UOT.js} +1 -1
- package/editor-web/assets/{index-CglHrLRS.js → index-BGAXezRR.js} +2 -2
- package/editor-web/assets/{info-OHQRW6UA-C4oj5BpF.js → info-OHQRW6UA-CnKQHx5m.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-D09aYJ28.js → infoDiagram-MVDRKAX5-ibAVFw_2.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-BEdXoXb2.js → ishikawaDiagram-HPEHV2GE-C1OCHt3y.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-DE-_0aww.js → journeyDiagram-BOSHW7O7-BDdqMOM1.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-Cn3_bvPS.js → kanban-definition-FNSA4HC5-CSAS_zGn.js} +1 -1
- package/editor-web/assets/lib-KOEbW83T.js +3 -0
- package/editor-web/assets/{mermaid-parser.core-BK52JMZH.js → mermaid-parser.core-DTLyYXbn.js} +3 -3
- package/editor-web/assets/{mermaid.core-CmfBU89G.js → mermaid.core-B8478wZ1.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-CtUhkv9I.js → mindmap-definition-6OY57UG3-DSWHcglH.js} +1 -1
- package/editor-web/assets/{packet-JDAUHWVQ-C7nciBNp.js → packet-JDAUHWVQ-_k1BF29s.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-DUkbAcTs.js → pegDiagram-ECIUJNBX-B22YyWAa.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BIGyKhav.js → pie-XZMESJXO-CSwV32hj.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DrYj-JeG.js → pieDiagram-GNMPY74T-rSFNeWnq.js} +1 -1
- package/editor-web/assets/{props-form-DrZYDmSM.js → props-form-B6mYjTgZ.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-qkBoh1ep.js → quadrantDiagram-D57K4MC3-Xrntfg4j.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-BkJmvR6a.js → radar-ABXABTNO-Dwq5qiNw.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-BFH-ip4B.js → railroad-I3PHUGI6-sIUGWcZh.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BBlzHL6Z.js → railroad-abnf-LNEFI6M7-1rWlT9BX.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-CCVsG0ui.js → railroad-ebnf-DWYD2UWJ-DWdkzEHc.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-Puo7BFPl.js → railroad-peg-JR7BVNR7-CME0JBbV.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-DCwfkv35.js → railroadDiagram-Y72NRBL7-Ch4BpP22.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-DSTcDj32.js → requirementDiagram-EQYSW5RA-CgE-x3wN.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Kqq4fCvG.js → sankeyDiagram-SY24JHO5-DBf4G6n3.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-B1uodEgL.js → sequenceDiagram-BLEHNHQU-Bz07CoUS.js} +1 -1
- package/editor-web/assets/{split-Cu0fidVK.js → split-mDSkdQkd.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-B6gG3vUm.js → stateDiagram-v2-A6IESKWZ-DuqAmDPP.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-CZayRtvU.js → swimlanes-B3ENRKFQ-C7sOL6rB.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CQ2aWYP-.js +8 -0
- package/editor-web/assets/syntax-BIEjjMZL.js +27 -0
- package/editor-web/assets/{tabs-B_K0Db1I.js → tabs-C0AHyuE5.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-5YoY8Xhw.js → timeline-definition-JXYKGLGB-CaLYz9mc.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-Brd_NUPx.js → treeView-D4JQ5SDB-D1P1Kyxc.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-DmfdnlWl.js → treemap-SAJKECNS-2YaFL53t.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-lcAkMviI.js → usecaseDiagram-WPOLBNNX-uYdbUhUS.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DY_n48hQ.js → vennDiagram-Q3Y3IDCW-DHepmX4t.js} +1 -1
- package/editor-web/assets/{video-Bv3rETBU.js → video-Xl-OaXRc.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-DzIFSBQz.js → wardley-7MLQ67FV-Dx0MOPV1.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-CsXNajIg.js → wardleyDiagram-IVAIDKWA-BX8ElwDW.js} +1 -1
- package/editor-web/assets/words-B2FXYyeZ.js +263 -0
- package/editor-web/assets/words-DFIhHhHF.js +3 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DDpGFEum.js → xychartDiagram-4URNHDU4-DoWQRJUS.js} +1 -1
- package/editor-web/index.html +1 -1
- package/package.json +2 -19
- package/editor-web/assets/article-C_mBG5a1.js +0 -8
- package/editor-web/assets/article-DWBxNvX0.js +0 -7
- package/editor-web/assets/bookmark-Dfji3syX.js +0 -1
- package/editor-web/assets/channel-BFHB0S0f.js +0 -1
- package/editor-web/assets/dist--ijXGgvi.js +0 -5
- package/editor-web/assets/dist-C-yi9AAi.js +0 -274
- package/editor-web/assets/dist-D9N4Fxqr.js +0 -84
- package/editor-web/assets/dist-DWKEqAou.js +0 -6
- package/editor-web/assets/dist-DX0VLTRV.js +0 -3
- package/editor-web/assets/dist-xpAaABxb.js +0 -24
- package/editor-web/assets/flowDiagram-IUGLLWBU-BSCBBtP3.js +0 -1
- package/editor-web/assets/katex-UWCZofcd.js +0 -257
- package/editor-web/assets/play-DvMyq5xW.js +0 -1
- package/editor-web/assets/repeat-2-DfPmKp4w.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B9tLTrym.js +0 -8
- package/editor-web/assets/syntax-PERQ2szW.js +0 -66
- package/editor-web/assets/words-BTRrBFUo.js +0 -2
- package/editor-web/assets/words-ll_94CD2.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{_ as t,d as n,o as r,s as i,u as a,v as o}from"./react-Bk7NnOLX.js";import{Dt as s,Et as c,Ot as l,gt as u,yt as d}from"./button-BVQH7zxz.js";import{t as f}from"./jsx-runtime-DePvh3-m.js";import{t as p}from"./audio-lines-1s1eRs4Q.js";import{i as m}from"./dist-DWKEqAou.js";import{t as h}from"./file-exclamation-point-C_fX4fpI.js";import{q as g}from"./index-CglHrLRS.js";import{t as _}from"./surface-D9qJjJQL.js";var v=e(o(),1),y=f(),b=d({en:{loading:`Opening the file…`,couldNotOpen:e=>`The file could not be opened: ${e}`,page:(e,t)=>`Page ${String(e)} of ${String(t)}`},"zh-cn":{loading:`正在打开文件…`,couldNotOpen:e=>`无法打开文件:${e}`,page:(e,t)=>`第 ${String(e)} 页,共 ${String(t)} 页`},"zh-tw":{loading:`正在開啟檔案…`,couldNotOpen:e=>`無法開啟檔案:${e}`,page:(e,t)=>`第 ${String(e)} 頁,共 ${String(t)} 頁`},ja:{loading:`ファイルを開いています…`,couldNotOpen:e=>`ファイルを開けませんでした:${e}`,page:(e,t)=>`${String(t)} ページ中 ${String(e)} ページ`},ko:{loading:`파일을 여는 중…`,couldNotOpen:e=>`파일을 열 수 없습니다: ${e}`,page:(e,t)=>`${String(t)}페이지 중 ${String(e)}페이지`},es:{loading:`Abriendo el archivo…`,couldNotOpen:e=>`No se pudo abrir el archivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`},fr:{loading:`Ouverture du fichier…`,couldNotOpen:e=>`Impossible d’ouvrir le fichier : ${e}`,page:(e,t)=>`Page ${String(e)} sur ${String(t)}`},de:{loading:`Datei wird geöffnet …`,couldNotOpen:e=>`Die Datei konnte nicht geöffnet werden: ${e}`,page:(e,t)=>`Seite ${String(e)} von ${String(t)}`},pt:{loading:`Abrindo o arquivo…`,couldNotOpen:e=>`Não foi possível abrir o arquivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`}}),x={png:`picture`,jpg:`picture`,jpeg:`picture`,gif:`picture`,webp:`picture`,avif:`picture`,bmp:`picture`,ico:`picture`,svg:`picture`,mp4:`video`,m4v:`video`,mov:`video`,webm:`video`,mp3:`sound`,wav:`sound`,m4a:`sound`,aac:`sound`,ogg:`sound`,oga:`sound`,opus:`sound`,flac:`sound`,pdf:`pdf`},S=Object.keys(x);function C(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?void 0:x[t.slice(n+1).toLowerCase()]}var w=300,T=1200,E=16;async function D(e){let[t,n]=await Promise.all([g(()=>import(`./pdf-BHx8b9rl.js`),[],import.meta.url),g(()=>import(`./pdf.worker.min-DI4FfYVf.js`),[],import.meta.url)]);t.GlobalWorkerOptions.workerSrc=n.default;let r=t.getDocument({url:e});return{pdf:await r.promise,close:()=>r.destroy()}}var O=e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}};function k({pdf:e,number:t,width:n,drawing:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let r=!0;return e.getPage(t).then(e=>{if(!r)return;let t=e.getViewport({scale:1});o({width:n,height:n*t.height/t.width})}),()=>{r=!1}},[e,t,n]),(0,v.useEffect)(()=>{let e=i.current;if(!e||s)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c(!0)},{rootMargin:`800px 0px`});return t.observe(e),()=>{t.disconnect()}},[s,a]),(0,v.useEffect)(()=>{let n=i.current;if(!n||!s||!a)return;let o;return r((async()=>{let r=await e.getPage(t),i=window.devicePixelRatio||1,s=r.getViewport({scale:1}),c=r.getViewport({scale:a.width/s.width*i});n.width=Math.round(c.width),n.height=Math.round(c.height);let l=r.render({canvas:n,viewport:c});o=l,await l.promise.catch(()=>void 0)})()),()=>{o?.cancel()}},[e,t,s,a,r]),(0,y.jsx)(`canvas`,{ref:i,"data-page":t,"data-testid":`media-viewer-pdf-page`,className:`border-rule border bg-white`,style:{width:a?.width??n,height:a?.height??n*1.3}})}function A({path:e,url:t,version:r}){let a=b.of(i()?.locale),o=(0,v.useRef)(null),[s,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(0),g=(0,v.useRef)(new Set),_=(0,v.useCallback)(e=>{g.current.add(e),e.finally(()=>g.current.delete(e))},[]);(0,v.useEffect)(()=>{let e=!0,n;return D(t).then(t=>{e?(n=t.close,d(t.pdf)):t.close()},t=>{e&&p(t instanceof Error?t.message:String(t))}),()=>{e=!1,n?.()}},[t]),(0,v.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{h(Math.max(0,Math.min(e.clientWidth-32,960)))});return t.observe(e),()=>{t.disconnect()}},[]);let x=()=>[...o.current?.querySelectorAll(`canvas[data-page]`)??[]],S=e=>`page ${e.dataset.page??`?`}`;n({hold:async()=>(await Promise.all([...g.current]),{key:`${e}@${String(r)}`,what:`The PDF ${e}`,source:{path:e}}),locate:t=>{let n=x().filter(e=>l(t,O(e)));return Promise.resolve({elements:n.map(t=>({name:`${S(t)} of the PDF ${e}`,source:{path:e}})),...n.length===0?{}:{where:`on ${n.map(S).join(`, `)}`}})},pick:t=>{let n=x().find(e=>{let n=O(e);return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height});return Promise.resolve(n&&{element:{name:`${S(n)} of the PDF ${e}`,source:{path:e}},outline:c(O(n)),where:`on ${S(n)}`})}});let C=Math.min(s?.numPages??0,w),[A,j]=(0,v.useState)(),M=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>()=>{clearTimeout(M.current)},[]),(0,y.jsxs)(`div`,{ref:o,onScroll:()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect().top+e.clientHeight/2,n=1;for(let e of x())e.getBoundingClientRect().top<=t&&(n=Number(e.dataset.page));j({at:n,live:!0}),clearTimeout(M.current),M.current=setTimeout(()=>{j(e=>e&&{...e,live:!1})},T)},className:`size-full overflow-auto`,"data-testid":`media-viewer-pdf`,"data-state":f===void 0?s?`open`:`loading`:`error`,children:[(f!==void 0||!s)&&(0,y.jsx)(`p`,{className:`text-lead p-6 text-center text-sm`,children:f===void 0?a.loading:a.couldNotOpen(f)}),(0,y.jsx)(`div`,{className:`flex flex-col items-center`,style:{gap:E,padding:E},children:s&&m>0&&Array.from({length:C},(e,t)=>(0,y.jsx)(k,{pdf:s,number:t+1,width:m,drawing:_},t))}),A&&C>1&&(0,y.jsx)(`p`,{className:u(`bg-background text-lead shadow-overlay pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 rounded-md px-2.5 py-1 text-xs tabular-nums motion-safe:transition-opacity`,A.live?`opacity-100`:`opacity-0`),"data-testid":`media-viewer-pdf-page-number`,"aria-live":`polite`,children:a.page(A.at,C)})]})}var j=()=>b.of(i()?.locale);function M(e){let t=r(),[n,i]=(0,v.useState)(0),[a,o]=(0,v.useState)({});return(0,v.useEffect)(()=>{let n=!0,r,a=t.on(`files/changed`,t=>{t.watch===r&&t.changes.some(t=>t.path===e)&&i(e=>e+1)});return t[`files/watch`]({paths:[e]}).then(e=>{n?r=e.watch:t[`files/unwatch`]({watch:e.watch}).catch(()=>void 0)},()=>void 0),()=>{n=!1,a(),r!==void 0&&t[`files/unwatch`]({watch:r}).catch(()=>void 0)}},[t,e]),(0,v.useEffect)(()=>{let r=!0;return t[`files/url`]({path:e}).then(({url:e})=>{if(!r)return;let t=new URL(e,location.href);n>0&&t.searchParams.set(`v`,String(n)),o({url:t.href})},e=>{r&&o({failed:e instanceof Error?e.message:String(e)})}),()=>{r=!1}},[t,e,n]),{url:a.url,version:n,failed:a.failed}}function N(e,t){let n=e.getBoundingClientRect();if(t.width<=0||t.height<=0||n.width<=0)return;let r=Math.min(n.width/t.width,n.height/t.height),i=t.width*r,a=t.height*r;return{x:n.x+(n.width-i)/2,y:n.y+(n.height-a)/2,width:i,height:a}}var P=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height;function F({path:e,url:t,version:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),d=()=>{let e=i.current;if(!e?.complete)return;let t={width:e.naturalWidth,height:e.naturalHeight},n=N(e,t);return n&&{box:n,...t}},f=()=>({name:`the picture ${e}`,source:{path:e}});return n({hold:()=>Promise.resolve({key:`${e}@${String(r)}`,what:`The picture ${e}`,source:{path:e}}),locate:t=>{let n=d();if(!n||!l(t,n.box))return Promise.resolve({elements:[]});let r=n.width/n.box.width,i=e=>({x:(e.x-n.box.x)*r,y:(e.y-n.box.y)*r});return Promise.resolve({elements:[{...f(),regions:[{in:`the picture`,file:e,width:n.width,height:n.height,...s(t,i),scale:r}]}]})},pick:e=>{let t=d();return Promise.resolve(t&&P(e,t.box)?{element:f(),outline:c(t.box)}:void 0)}}),(0,y.jsx)(`div`,{className:u(`size-full`,a?`overflow-auto`:`flex items-center justify-center p-6`),onDoubleClick:()=>{o(e=>!e)},"data-testid":`media-viewer-stage`,"data-size":a?`actual`:`fit`,children:(0,y.jsx)(`img`,{ref:i,src:t,alt:``,draggable:!1,className:u(`select-none`,a?`m-auto block max-w-none p-6`:`size-full object-contain`),"data-testid":`media-viewer-picture`})})}function I({path:e,url:r,version:i}){let o=(0,v.useRef)(null),s=(0,v.useRef)(!1),c=()=>(o.current?.currentTime??0).toFixed(2);return n({hold:()=>Promise.resolve({key:`${e}@${String(i)}`,what:`The video ${e}`,source:{path:e}}),locate:()=>Promise.resolve({elements:[]})}),a({element:()=>o.current,hold:()=>{let e=o.current;return s.current=e!==null&&!e.paused,e?.pause(),Promise.resolve()},release:()=>{s.current&&o.current?.play().catch(()=>void 0),s.current=!1},pictures:()=>{let e=o.current,n=e?t(e):void 0;return Promise.resolve(n?[n]:[])},locate:()=>Promise.resolve({elements:[{name:`the video ${e}`,source:{path:e}}],where:`on the video ${e} at ${c()} s`})}),(0,y.jsx)(`video`,{ref:o,src:r,controls:!0,playsInline:!0,preload:`metadata`,className:`size-full object-contain`,"data-testid":`media-viewer-video`})}function L({path:e,url:t,version:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(!1);return n({hold:()=>{let t=i.current;return a.current=t!==null&&!t.paused,t?.pause(),Promise.resolve({key:`${e}@${String(r)}`,what:`The sound ${e}`,source:{path:e}})},locate:()=>Promise.resolve({elements:[{name:`the sound ${e}`,source:{path:e}}],where:`at ${(i.current?.currentTime??0).toFixed(2)} s`}),release:()=>{a.current&&i.current?.play().catch(()=>void 0),a.current=!1}}),(0,y.jsxs)(_,{className:`flex w-full max-w-sm flex-col items-center gap-2 p-5 text-center`,children:[(0,y.jsx)(p,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:e.slice(e.lastIndexOf(`/`)+1)}),(0,y.jsx)(`audio`,{ref:i,src:t,controls:!0,preload:`metadata`,className:`mt-1 w-full`,"data-testid":`media-viewer-sound`})]})}var R={picture:F,video:I,sound:L,pdf:A};function z(){let e=j(),t=i()?.item.entry??``,n=C(t),{url:r,version:a,failed:o}=M(t),s=n===void 0?void 0:R[n];return(0,y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`media-viewer`,children:[(0,y.jsx)(m,{}),(0,y.jsx)(`div`,{className:u(`bg-stone relative min-h-0 flex-1`,(n===`video`||n===`sound`)&&`flex items-center justify-center p-6`),children:r!==void 0&&s?(0,y.jsx)(s,{path:t,url:r,version:a},r):o===void 0?null:(0,y.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,y.jsx)(h,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:t.slice(t.lastIndexOf(`/`)+1)}),(0,y.jsx)(`p`,{className:`text-lead text-xs`,children:e.couldNotOpen(o)})]})})]})}export{S as MEDIA_EXTENSIONS,z as MediaViewer,z as default,b as WORDS,C as mediaOf};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{_ as t,d as n,o as r,s as i,u as a,v as o}from"./react-Bk7NnOLX.js";import{Dt as s,Et as c,Ot as l,gt as u,yt as d}from"./button-BVQH7zxz.js";import{t as f}from"./jsx-runtime-DePvh3-m.js";import{t as p}from"./audio-lines-1s1eRs4Q.js";import{i as m}from"./dist-D7ur8721.js";import{t as h}from"./file-exclamation-point-C_fX4fpI.js";import{q as g}from"./index-BGAXezRR.js";import{t as _}from"./surface-D9qJjJQL.js";var v=e(o(),1),y=f(),b=d({en:{loading:`Opening the file…`,couldNotOpen:e=>`The file could not be opened: ${e}`,page:(e,t)=>`Page ${String(e)} of ${String(t)}`},"zh-cn":{loading:`正在打开文件…`,couldNotOpen:e=>`无法打开文件:${e}`,page:(e,t)=>`第 ${String(e)} 页,共 ${String(t)} 页`},"zh-tw":{loading:`正在開啟檔案…`,couldNotOpen:e=>`無法開啟檔案:${e}`,page:(e,t)=>`第 ${String(e)} 頁,共 ${String(t)} 頁`},ja:{loading:`ファイルを開いています…`,couldNotOpen:e=>`ファイルを開けませんでした:${e}`,page:(e,t)=>`${String(t)} ページ中 ${String(e)} ページ`},ko:{loading:`파일을 여는 중…`,couldNotOpen:e=>`파일을 열 수 없습니다: ${e}`,page:(e,t)=>`${String(t)}페이지 중 ${String(e)}페이지`},es:{loading:`Abriendo el archivo…`,couldNotOpen:e=>`No se pudo abrir el archivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`},fr:{loading:`Ouverture du fichier…`,couldNotOpen:e=>`Impossible d’ouvrir le fichier : ${e}`,page:(e,t)=>`Page ${String(e)} sur ${String(t)}`},de:{loading:`Datei wird geöffnet …`,couldNotOpen:e=>`Die Datei konnte nicht geöffnet werden: ${e}`,page:(e,t)=>`Seite ${String(e)} von ${String(t)}`},pt:{loading:`Abrindo o arquivo…`,couldNotOpen:e=>`Não foi possível abrir o arquivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`}}),x={png:`picture`,jpg:`picture`,jpeg:`picture`,gif:`picture`,webp:`picture`,avif:`picture`,bmp:`picture`,ico:`picture`,svg:`picture`,mp4:`video`,m4v:`video`,mov:`video`,webm:`video`,mp3:`sound`,wav:`sound`,m4a:`sound`,aac:`sound`,ogg:`sound`,oga:`sound`,opus:`sound`,flac:`sound`,pdf:`pdf`},S=Object.keys(x);function C(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?void 0:x[t.slice(n+1).toLowerCase()]}var w=300,T=1200,E=16;async function D(e){let[t,n]=await Promise.all([g(()=>import(`./pdf-BHx8b9rl.js`),[],import.meta.url),g(()=>import(`./pdf.worker.min-DI4FfYVf.js`),[],import.meta.url)]);t.GlobalWorkerOptions.workerSrc=n.default;let r=t.getDocument({url:e});return{pdf:await r.promise,close:()=>r.destroy()}}var O=e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}};function k({pdf:e,number:t,width:n,drawing:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let r=!0;return e.getPage(t).then(e=>{if(!r)return;let t=e.getViewport({scale:1});o({width:n,height:n*t.height/t.width})}),()=>{r=!1}},[e,t,n]),(0,v.useEffect)(()=>{let e=i.current;if(!e||s)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c(!0)},{rootMargin:`800px 0px`});return t.observe(e),()=>{t.disconnect()}},[s,a]),(0,v.useEffect)(()=>{let n=i.current;if(!n||!s||!a)return;let o;return r((async()=>{let r=await e.getPage(t),i=window.devicePixelRatio||1,s=r.getViewport({scale:1}),c=r.getViewport({scale:a.width/s.width*i});n.width=Math.round(c.width),n.height=Math.round(c.height);let l=r.render({canvas:n,viewport:c});o=l,await l.promise.catch(()=>void 0)})()),()=>{o?.cancel()}},[e,t,s,a,r]),(0,y.jsx)(`canvas`,{ref:i,"data-page":t,"data-testid":`media-viewer-pdf-page`,className:`border-rule border bg-white`,style:{width:a?.width??n,height:a?.height??n*1.3}})}function A({path:e,url:t,version:r}){let a=b.of(i()?.locale),o=(0,v.useRef)(null),[s,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(0),g=(0,v.useRef)(new Set),_=(0,v.useCallback)(e=>{g.current.add(e),e.finally(()=>g.current.delete(e))},[]);(0,v.useEffect)(()=>{let e=!0,n;return D(t).then(t=>{e?(n=t.close,d(t.pdf)):t.close()},t=>{e&&p(t instanceof Error?t.message:String(t))}),()=>{e=!1,n?.()}},[t]),(0,v.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{h(Math.max(0,Math.min(e.clientWidth-32,960)))});return t.observe(e),()=>{t.disconnect()}},[]);let x=()=>[...o.current?.querySelectorAll(`canvas[data-page]`)??[]],S=e=>`page ${e.dataset.page??`?`}`;n({hold:async()=>(await Promise.all([...g.current]),{key:`${e}@${String(r)}`,what:`The PDF ${e}`,source:{path:e}}),locate:t=>{let n=x().filter(e=>l(t,O(e)));return Promise.resolve({elements:n.map(t=>({name:`${S(t)} of the PDF ${e}`,source:{path:e}})),...n.length===0?{}:{where:`on ${n.map(S).join(`, `)}`}})},pick:t=>{let n=x().find(e=>{let n=O(e);return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height});return Promise.resolve(n&&{element:{name:`${S(n)} of the PDF ${e}`,source:{path:e}},outline:c(O(n)),where:`on ${S(n)}`})}});let C=Math.min(s?.numPages??0,w),[A,j]=(0,v.useState)(),M=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>()=>{clearTimeout(M.current)},[]),(0,y.jsxs)(`div`,{ref:o,onScroll:()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect().top+e.clientHeight/2,n=1;for(let e of x())e.getBoundingClientRect().top<=t&&(n=Number(e.dataset.page));j({at:n,live:!0}),clearTimeout(M.current),M.current=setTimeout(()=>{j(e=>e&&{...e,live:!1})},T)},className:`size-full overflow-auto`,"data-testid":`media-viewer-pdf`,"data-state":f===void 0?s?`open`:`loading`:`error`,children:[(f!==void 0||!s)&&(0,y.jsx)(`p`,{className:`text-lead p-6 text-center text-sm`,children:f===void 0?a.loading:a.couldNotOpen(f)}),(0,y.jsx)(`div`,{className:`flex flex-col items-center`,style:{gap:E,padding:E},children:s&&m>0&&Array.from({length:C},(e,t)=>(0,y.jsx)(k,{pdf:s,number:t+1,width:m,drawing:_},t))}),A&&C>1&&(0,y.jsx)(`p`,{className:u(`bg-background text-lead shadow-overlay pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 rounded-md px-2.5 py-1 text-xs tabular-nums motion-safe:transition-opacity`,A.live?`opacity-100`:`opacity-0`),"data-testid":`media-viewer-pdf-page-number`,"aria-live":`polite`,children:a.page(A.at,C)})]})}var j=()=>b.of(i()?.locale);function M(e){let t=r(),[n,i]=(0,v.useState)(0),[a,o]=(0,v.useState)({});return(0,v.useEffect)(()=>{let n=!0,r,a=t.on(`files/changed`,t=>{t.watch===r&&t.changes.some(t=>t.path===e)&&i(e=>e+1)});return t[`files/watch`]({paths:[e]}).then(e=>{n?r=e.watch:t[`files/unwatch`]({watch:e.watch}).catch(()=>void 0)},()=>void 0),()=>{n=!1,a(),r!==void 0&&t[`files/unwatch`]({watch:r}).catch(()=>void 0)}},[t,e]),(0,v.useEffect)(()=>{let r=!0;return t[`files/url`]({path:e}).then(({url:e})=>{if(!r)return;let t=new URL(e,location.href);n>0&&t.searchParams.set(`v`,String(n)),o({url:t.href})},e=>{r&&o({failed:e instanceof Error?e.message:String(e)})}),()=>{r=!1}},[t,e,n]),{url:a.url,version:n,failed:a.failed}}function N(e,t){let n=e.getBoundingClientRect();if(t.width<=0||t.height<=0||n.width<=0)return;let r=Math.min(n.width/t.width,n.height/t.height),i=t.width*r,a=t.height*r;return{x:n.x+(n.width-i)/2,y:n.y+(n.height-a)/2,width:i,height:a}}var P=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height;function F({path:e,url:t,version:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),d=()=>{let e=i.current;if(!e?.complete)return;let t={width:e.naturalWidth,height:e.naturalHeight},n=N(e,t);return n&&{box:n,...t}},f=()=>({name:`the picture ${e}`,source:{path:e}});return n({hold:()=>Promise.resolve({key:`${e}@${String(r)}`,what:`The picture ${e}`,source:{path:e}}),locate:t=>{let n=d();if(!n||!l(t,n.box))return Promise.resolve({elements:[]});let r=n.width/n.box.width,i=e=>({x:(e.x-n.box.x)*r,y:(e.y-n.box.y)*r});return Promise.resolve({elements:[{...f(),regions:[{in:`the picture`,file:e,width:n.width,height:n.height,...s(t,i),scale:r}]}]})},pick:e=>{let t=d();return Promise.resolve(t&&P(e,t.box)?{element:f(),outline:c(t.box)}:void 0)}}),(0,y.jsx)(`div`,{className:u(`size-full`,a?`overflow-auto`:`flex items-center justify-center p-6`),onDoubleClick:()=>{o(e=>!e)},"data-testid":`media-viewer-stage`,"data-size":a?`actual`:`fit`,children:(0,y.jsx)(`img`,{ref:i,src:t,alt:``,draggable:!1,className:u(`select-none`,a?`m-auto block max-w-none p-6`:`size-full object-contain`),"data-testid":`media-viewer-picture`})})}function I({path:e,url:r,version:i}){let o=(0,v.useRef)(null),s=(0,v.useRef)(!1),c=()=>(o.current?.currentTime??0).toFixed(2);return n({hold:()=>Promise.resolve({key:`${e}@${String(i)}`,what:`The video ${e}`,source:{path:e}}),locate:()=>Promise.resolve({elements:[]})}),a({element:()=>o.current,hold:()=>{let e=o.current;return s.current=e!==null&&!e.paused,e?.pause(),Promise.resolve()},release:()=>{s.current&&o.current?.play().catch(()=>void 0),s.current=!1},pictures:()=>{let e=o.current,n=e?t(e):void 0;return Promise.resolve(n?[n]:[])},locate:()=>Promise.resolve({elements:[{name:`the video ${e}`,source:{path:e}}],where:`on the video ${e} at ${c()} s`})}),(0,y.jsx)(`video`,{ref:o,src:r,controls:!0,playsInline:!0,preload:`metadata`,className:`size-full object-contain`,"data-testid":`media-viewer-video`})}function L({path:e,url:t,version:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(!1);return n({hold:()=>{let t=i.current;return a.current=t!==null&&!t.paused,t?.pause(),Promise.resolve({key:`${e}@${String(r)}`,what:`The sound ${e}`,source:{path:e}})},locate:()=>Promise.resolve({elements:[{name:`the sound ${e}`,source:{path:e}}],where:`at ${(i.current?.currentTime??0).toFixed(2)} s`}),release:()=>{a.current&&i.current?.play().catch(()=>void 0),a.current=!1}}),(0,y.jsxs)(_,{className:`flex w-full max-w-sm flex-col items-center gap-2 p-5 text-center`,children:[(0,y.jsx)(p,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:e.slice(e.lastIndexOf(`/`)+1)}),(0,y.jsx)(`audio`,{ref:i,src:t,controls:!0,preload:`metadata`,className:`mt-1 w-full`,"data-testid":`media-viewer-sound`})]})}var R={picture:F,video:I,sound:L,pdf:A};function z(){let e=j(),t=i()?.item.entry??``,n=C(t),{url:r,version:a,failed:o}=M(t),s=n===void 0?void 0:R[n];return(0,y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`media-viewer`,children:[(0,y.jsx)(m,{}),(0,y.jsx)(`div`,{className:u(`bg-stone relative min-h-0 flex-1`,(n===`video`||n===`sound`)&&`flex items-center justify-center p-6`),children:r!==void 0&&s?(0,y.jsx)(s,{path:t,url:r,version:a},r):o===void 0?null:(0,y.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,y.jsx)(h,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:t.slice(t.lastIndexOf(`/`)+1)}),(0,y.jsx)(`p`,{className:`text-lead text-xs`,children:e.couldNotOpen(o)})]})})]})}export{S as MEDIA_EXTENSIONS,z as MediaViewer,z as default,b as WORDS,C as mediaOf};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,o as r,p as i,s as a,v as o}from"./react-Bk7NnOLX.js";import{Ot as s,Tt as c,_t as l,gt as u,t as d}from"./button-BVQH7zxz.js";import{B as f,R as p,V as m,Y as h,et as g,tt as _}from"./snapshots-CTS2iez5.js";import{t as v}from"./session-CUCSWPTE.js";import{t as y}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-REX213UO.js";import{t as ee}from"./arrow-down-DzZjFrBL.js";import{t as te}from"./arrow-up-hdmh9LVD.js";import{t as ne}from"./chart-no-axes-column-CJmeYOSo.js";import{b as re,i as ie,v as ae,w as oe,x as se}from"./dist-D7ur8721.js";import{a as ce,c as x,i as le,l as ue,n as de,r as fe,s as pe,t as me}from"./split-mDSkdQkd.js";import{n as he,t as ge}from"./undo-2-DUGGyBdX.js";import{E as S,Q as C,b as w,h as T,m as E,p as D,v as O,y as k}from"./index-BGAXezRR.js";import{t as A}from"./collaborator-2qfw-8OJ.js";import{f as j,i as M,n as N,o as P,s as F,u as I}from"./browser-C9NP0ZYz.js";import{S as L,b as R,d as _e,f as ve,i as ye,l as be,m as xe,n as z,p as Se,t as B,u as Ce,v as V,y as H}from"./words-B2FXYyeZ.js";var U=b(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=b(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),W=[`following`,`mentionedUsers`,`subscribers`,`verified`],G=_().regex(/^[0-9]{1,19}$/u,`a post's id: 1 to 19 digits`),Te=g({file:_().min(1),alt:_().optional()},{error:e=>e.code===`invalid_type`?`a medium is { file: ./picture.png, alt: … }: its file, from this file's folder, and its alt text`:void 0}),Ee=g({options:f(_()),duration_minutes:h().int()},{error:e=>e.code===`invalid_type`?`a poll is { options: [ … ], duration_minutes: … }`:void 0}),De=g({text:_().default(``).transform(e=>e.replace(/\n+$/u,``)),media:f(Te).optional(),poll:Ee.optional(),made_with_ai:m().optional(),paid_partnership:m().optional(),reply:g({in_reply_to_tweet_id:G}).optional(),quote_tweet_id:G.optional()},{error:e=>e.code===`invalid_type`?`a post is { text: …, media: [ … ], poll: … }`:void 0}),Oe=g({reply_settings:p(W).optional(),posts:f(De,{error:`posts is the list of its posts: posts: [ { text: … }, … ]`}).min(1,`posts holds at least one post`)},{error:e=>e.code===`invalid_type`?`an x-post's file is { posts: [ { text: … }, … ] }, with reply_settings beside posts`:void 0});function ke(e,t){let n=e;for(let e of t)if(I(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(j(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function K(e){let t=new M,n=N(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=ke(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Oe.safeParse(n.toJS());return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function Ae(e,t){let n=e.createNode(t);return t.includes(`
|
|
2
|
+
`)&&(n.type=F.BLOCK_LITERAL),n}var q=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>q(e)===q(t);function je(e){return{text:e.text,media:e.media===void 0||e.media.length===0?void 0:e.media,poll:e.poll}}function Me(e,t){let n=N(e),r=K(e).value;if(r!==void 0&&J(r,t))return e;I(n.contents)||(n.contents=new P),t.reply_settings===void 0?n.deleteIn([`reply_settings`]):n.getIn([`reply_settings`])!==t.reply_settings&&n.setIn([`reply_settings`],t.reply_settings);let i=n.getIn([`posts`]),a=j(i)?i:void 0,o=(a?.items??[]).map(e=>I(e)?e:void 0),s=(r?.posts??[]).map(e=>q(e)),c=new Set,l=t.posts.map(()=>void 0);t.posts.forEach((e,t)=>{let n=s.findIndex((t,n)=>!c.has(n)&&o[n]&&t===q(e));n>=0&&(c.add(n),l[t]=n)}),t.posts.forEach((e,t)=>{l[t]===void 0&&o[t]&&!c.has(t)&&(c.add(t),l[t]=t)});let u=t.posts.map((e,t)=>{let r=l[t],i=r===void 0?void 0:o[r],a=je(e);if(!i){let t=n.createNode({});t.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`])a[e]!==void 0&&t.set(e,n.createNode(a[e]));return t}let s=i.get(`text`);(typeof s!=`string`||s.replace(/\n+$/u,``)!==e.text)&&i.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`]){let t=a[e],r=i.get(e,!0);t===void 0?r!==void 0&&i.delete(e):J(r?.toJSON?.(),t)||i.set(e,n.createNode(t))}return i});return a?a.items=u:n.setIn([`posts`],n.createNode(u)),n.toString({flowCollectionPadding:!1,lineWidth:0})}function Ne(e,t,n){let r=(e,t,n)=>J(t,e)?n:t,i=t.posts.length===e.posts.length?n.posts.length:n.posts.length===e.posts.length?t.posts.length:n.posts.length,a=[];for(let o=0;o<i;o++){let i=e.posts[o],s=t.posts[o],c=n.posts[o],l=c??s;if(l===void 0)continue;if(s===void 0||c===void 0||i===void 0){a.push(l);continue}let u={...c,text:r(i.text,s.text,c.text)};delete u.media,delete u.poll,a.push({...u,...Y(`media`,r(i.media,s.media,c.media)),...Y(`poll`,r(i.poll,s.poll,c.poll))})}let o={...n,posts:a};return delete o.reply_settings,{...o,...Y(`reply_settings`,r(e.reply_settings,t.reply_settings,n.reply_settings))}}function Y(e,t){return t===void 0?{}:{[e]:t}}var X=e(o(),1),Z=y();function Pe(e){let t=e?.part??e?.board;if(typeof t!=`string`)return;let n=/^post-(\d+)$/u.exec(t)?.[1];return n===void 0?void 0:Number(n)-1}var Fe=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ie(e,t){let n=e?.posts??[],r=t.posts;for(let e=0;e<r.length;e++)if(!Fe(n[e],r[e]))return e;if(n.length>r.length&&r.length>0)return r.length-1}function Le(e,t){let n=K(e),r=n.value?.posts.length??0,i=e.split(`
|
|
3
|
+
`).length;for(let e=0;e<r;e++){let a=n.line([`posts`,e]);if(a===void 0)continue;let o=e+1<r?n.line([`posts`,e+1]):void 0,s=o===void 0?i:o-1;if(a<=t.to&&t.from<=s)return e}}function Re(e,t){if(e.from!==void 0&&e.path===t.path)return Le(t.text,{from:e.from,to:e.to??e.from})}var ze=class e{session;file;unreadable;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable!==void 0)return;let t=Me(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=K(e),i=K(t).value,a=n?.kind===`agent`&&r.value?Ie(i,r.value):void 0;a!==void 0&&(this.landed={post:a,at:Date.now()}),r.value?(this.file=this.file===void 0||i===void 0?r.value:Ne(i,this.file,r.value),this.unreadable=void 0):(this.file=void 0,this.unreadable=r.errors.map(e=>e.message).join(` `)),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=K(e);this.file=t.value,this.unreadable=t.value?void 0:t.errors.map(e=>e.message).join(` `)}static async open(t,n){return new e(await v.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable!==void 0)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Q=(e,t,n)=>({...e,posts:e.posts.map((e,r)=>r===t?n(e):e)});function Be(e,t){let n={...e};return t===void 0||t.length===0?delete n.media:n.media=t,n}function Ve(e){let t={...e};return delete t.poll,t}function He({text:e}){let t=B(),{weighted:n}=R(e),r=L.length.most,i=r-n,a=i<0&&n<=L.length.premium,o=n>L.length.premium,s=Math.min(1,n/r),c=2*Math.PI*9;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs tabular-nums`,"aria-label":i>=0?t.left(i):t.over(-i),"data-testid":`x-count`,children:[i<=20?(0,Z.jsx)(`span`,{className:u(o?`text-destructive`:a?`text-warning`:`text-muted-foreground`),children:a?n:i}):null,(0,Z.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 22 22`,"aria-hidden":`true`,children:[(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:`var(--ak-x-line)`,strokeWidth:`2`}),(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:o?`#f4212e`:a||i<=20?`#ffd400`:`var(--ak-x-link)`,strokeWidth:`2`,strokeDasharray:`${String(s*c)} ${String(c)}`,transform:`rotate(-90 11 11)`})]})]})}function Ue(e){let t=B();return(0,Z.jsx)(x,{alt:e.alt??``,onAlt:e.onAlt,most:L.alt,trigger:(0,Z.jsx)(d,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,"aria-label":t.altText,children:t.alt})})}function We(e){let t=B();return(0,Z.jsx)(d,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media absolute top-2 right-2 rounded-full`,"aria-label":t.removeMedium,onClick:e.onRemove,children:(0,Z.jsx)(l,{})})}function Ge(e){let t=B(),{options:n,duration_minutes:r}=e.poll,i={days:Math.floor(r/1440),hours:Math.floor(r%1440/60),minutes:r%60},a=(t,n)=>{let r={...i,[t]:Math.max(0,Math.floor(n))};e.onChange({...e.poll,duration_minutes:r.days*1440+r.hours*60+r.minutes})};return(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 rounded-2xl border border-[var(--ak-x-line)] p-3`,"data-testid":`x-poll`,children:[n.map((r,i)=>{let a=H(r)-L.poll.option;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`input`,{className:`aria-invalid:border-destructive h-10 flex-1 rounded-md border border-[var(--ak-x-line)] bg-transparent px-3 text-[15px] outline-none focus:border-[var(--ak-x-link)]`,value:r,"aria-invalid":a>0||void 0,maxLength:L.poll.option,placeholder:t.option(i+1),"aria-label":t.option(i+1),onChange:t=>{e.onChange({...e.poll,options:n.map((e,n)=>n===i?t.target.value:e)},`option-${String(i)}`)}}),a>0?(0,Z.jsx)(`span`,{className:`text-destructive text-sm`,children:t.over(a)}):null,n.length>L.poll.least?(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,onClick:()=>{e.onChange({...e.poll,options:n.filter((e,t)=>t!==i)})},children:(0,Z.jsx)(l,{})}):null]},i)}),n.length<L.poll.most?(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,className:`self-start text-[var(--ak-x-link)]`,onClick:()=>{e.onChange({...e.poll,options:[...n,``]})},children:[(0,Z.jsx)(C,{}),t.addOption]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t border-[var(--ak-x-line)] pt-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground mr-auto self-center`,children:t.pollLength}),[`days`,`hours`,`minutes`].map(e=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-0.5 text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:t[e]}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:`h-8 w-16 rounded-md border border-[var(--ak-x-line)] bg-transparent px-2 text-sm`,value:i[e],onChange:t=>{a(e,Number(t.target.value))}})]},e)),(0,Z.jsx)(d,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=B(),n=t.replies[e.value??`everyone`];return(0,Z.jsxs)(D,{children:[(0,Z.jsx)(S,{asChild:!0,disabled:e.disabled,children:(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,className:`ak-x-c-replies -ml-2 gap-1 px-2 font-bold text-[var(--ak-x-link)]`,children:[(0,Z.jsx)(U,{}),n]})}),(0,Z.jsxs)(T,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(O,{children:t.whoCanReply}),(0,Z.jsx)(k,{value:e.value??`everyone`,onValueChange:t=>{e.onChange(t===`everyone`?void 0:W.includes(t)?t:void 0)},children:[`everyone`,...W].map(e=>(0,Z.jsx)(w,{value:e,children:t.replies[e]},e))})]})]})}function qe(e){let t=B(),n=e.post.made_with_ai===!0||e.post.paid_partnership===!0;return(0,Z.jsxs)(D,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)]`,"aria-label":t.disclosure,title:t.disclosure,"aria-pressed":n,children:(0,Z.jsx)(we,{className:u(n&&`fill-current`)})})}),(0,Z.jsxs)(T,{align:`start`,className:`w-56`,children:[(0,Z.jsx)(O,{children:t.disclosure}),(0,Z.jsx)(E,{checked:e.post.made_with_ai===!0,onCheckedChange:t=>{e.onChange({made_with_ai:t})},children:t.madeWithAi}),(0,Z.jsx)(E,{checked:e.post.paid_partnership===!0,onCheckedChange:t=>{e.onChange({paid_partnership:t})},children:t.paidPartnership})]})]})}function $(e){return(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}var Je=3e4;function Ye({doc:e,dir:r,entry:o}){let u=B(),f=a(),p=i(),m=(0,X.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[h,g]=(0,X.useState)(),[_,v]=(0,X.useState)(0),[y,b]=(0,X.useState)(),x=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(y===void 0)return;let e=x.current[y.post];e!=null&&(e.focus(),e.setSelectionRange(y.at,y.at),v(y.post),b(void 0))},[y]);let S=m.file,{agent:w,following:T}=t(),E=oe(),D=(()=>{if(w?.doing===void 0)return;let t=Pe(w.place);if(t!==void 0)return t;let n=m.landed!==void 0&&m.landed.at>=w.at-Je;return n&&w.source?.path===o?m.landed?.post:(w.source?Re(w.source,{path:o,text:e.text}):void 0)??(n?m.landed?.post:void 0)})(),O=D!==void 0&&D<(S?.posts.length??0)?D:void 0,k=(0,X.useRef)([]),j=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(T&&O!==void 0)for(let e of[k.current[O],j.current[O]])e?.scrollIntoView({block:`nearest`})},[T,O,m.landed]);let M=le(r,(S?.posts??[]).flatMap(e=>(e.media??[]).map(e=>e.file)));n({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The X post ${o}${(S?.posts.length??0)>1?`, a thread of ${String(S?.posts.length??0)} posts`:``}`,source:{path:o}}),locate:t=>{let n=S?.posts??[],r=K(e.text),i=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},a=e=>e!==void 0&&s(t,e),l=n.flatMap((e,t)=>{if(!a(i(k.current[t]))&&!a(i(j.current[t])))return[];let n=r.line([`posts`,t]);return[{name:`post ${String(t+1)} of the thread`,source:{path:o,...n===void 0?{}:{line:n}},...e.text===``?{}:{text:e.text}}]}),u=c(t)[0],d=e=>e!==void 0&&u!==void 0&&u.x>=e.x&&u.x<=e.x+e.width&&u.y>=e.y&&u.y<=e.y+e.height,f=n.findIndex((e,t)=>d(i(k.current[t]))),p=n.findIndex((e,t)=>d(i(j.current[t]))),m=f>=0?`in post ${String(f+1)}, where it is written`:p>=0?`in post ${String(p+1)}, as X's timeline will show it`:void 0;return Promise.resolve({elements:l,...m===void 0?{}:{where:m}})}});let N=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},P=(t,n,r)=>{p||e.edit(t,n,r)},F=e=>(e.media??[]).map(e=>{let t=M.get(e.file),n=fe(e.file),r=n?void 0:V(e.file.split(`.`).pop()??``);return t===void 0?{kind:`made`,label:n?u.made:e.file}:{kind:r??`picture`,src:t,alt:e.alt,file:e.file}}),I=(0,Z.jsx)(ie,{start:p?void 0:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":u.undo,title:u.undo,disabled:!m.canUndo,onClick:()=>{e.undo()},children:(0,Z.jsx)(ge,{})}),(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":u.redo,title:u.redo,disabled:!m.canRedo,onClick:()=>{e.redo()},children:(0,Z.jsx)(he,{})})]}),saved:{state:m.state},exports:{}}),R=f?.theme===`dark`;if(S===void 0)return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,children:[I,(0,Z.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:u.unreadable(m.unreadable??``)})]});let z=S.posts,H=Math.min(_,z.length-1),U=e=>{P(u.steps.add,t=>({...t,posts:[...t.posts.slice(0,e+1),{text:``},...t.posts.slice(e+1)]})),b({post:e+1,at:0})},we=e=>{let t=z[e],n=z[e-1];if(t===void 0||n===void 0)return!1;let r=e=>(e.media?.length??0)>0||e.poll!==void 0;if(r(t)&&r(n))return!1;let i=n.text===``||t.text===``?``:`
|
|
4
|
+
|
|
5
|
+
`;return P(u.steps.join,a=>({...a,posts:[...a.posts.slice(0,e-1),{...n,...r(t)?{...t.media?{media:t.media}:{},...t.poll?{poll:t.poll}:{}}:{},text:n.text+i+t.text},...a.posts.slice(e+1)]})),b({post:e-1,at:n.text.length+i.length}),!0},W=(0,Z.jsx)(`div`,{className:`ak-x ak-x-editing ak-x-composer`,"data-theme":R?`dark`:`light`,children:z.map((t,n)=>{let i=n===z.length-1,a=n===H,s=t.media??[],c=s.filter(e=>V(e.file.split(`.`).pop()??``)===`picture`||fe(e.file)).length,f=s.length>=L.pictures||s.length>c;return(0,Z.jsxs)(`div`,{ref:e=>{k.current[n]=e},className:`ak-x-c-post`,"data-here":a?``:void 0,"data-testid":`x-post`,onFocusCapture:()=>{v(n)},onPointerDown:()=>{v(n)},children:[(0,Z.jsxs)(`div`,{className:`ak-x-side`,children:[(0,Z.jsx)(`div`,{className:`ak-x-avatar`,"aria-hidden":`true`,children:Ce.name.slice(0,1)}),i?null:(0,Z.jsx)(`div`,{className:`ak-x-thread-line`})]}),(0,Z.jsxs)(`div`,{className:`ak-x-body`,children:[a&&n>0&&!p?(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`ak-x-c-remove`,"aria-label":u.remove,title:u.remove,onClick:()=>{P(u.steps.remove,e=>({...e,posts:e.posts.filter((e,t)=>t!==n)})),b({post:n-1,at:z[n-1]?.text.length??0})},children:(0,Z.jsx)(l,{})}):null,(0,Z.jsxs)(`div`,{className:`ak-x-field`,children:[(0,Z.jsx)(ve,{text:t.text,whole:!0}),(0,Z.jsx)(`textarea`,{ref:e=>{x.current[n]=e},dir:`auto`,value:t.text,placeholder:n===0?u.whatsHappening:u.addAnother,"aria-label":n===0?u.whatsHappening:u.addAnother,readOnly:p,"data-testid":`x-text`,onChange:e=>{let t=e.target.value;P(u.steps.text,e=>Q(e,n,e=>({...e,text:t})),`text-${String(n)}`)},onBlur:()=>{e.settle()},onKeyDown:e=>{let t=e.currentTarget;if(e.key===`Backspace`&&n>0&&t.selectionStart===0&&t.selectionEnd===0&&!p){we(n)&&e.preventDefault();return}if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey))return;e.preventDefault();let r=t.selectionStart;P(u.steps.split,e=>{let t=e.posts[n];if(!t)return e;let i=t.text.slice(0,r).replace(/\s+$/u,``),a=t.text.slice(r).replace(/^\s+/u,``);return{...e,posts:[...e.posts.slice(0,n),{...t,text:i},{text:a},...e.posts.slice(n+1)]}}),b({post:n+1,at:0})}})]}),(0,Z.jsx)(be,{media:F(t),onAlt:p?void 0:e=>(0,Z.jsx)(Ue,{alt:s[e]?.alt,onAlt:t=>{P(u.steps.alt,r=>Q(r,n,n=>({...n,media:(n.media??[]).map((n,r)=>{if(r!==e)return n;let i={file:n.file};return t.trim()===``?i:{...i,alt:t}})})))}}),onMedium:p?void 0:e=>(0,Z.jsx)(We,{onRemove:()=>{P(u.steps.media,t=>Q(t,n,t=>Be(t,(t.media??[]).filter((t,n)=>n!==e))))}})}),t.poll===void 0?null:p?(0,Z.jsx)(`div`,{className:`ak-x-poll`,children:t.poll.options.map((e,t)=>(0,Z.jsx)(`div`,{className:`ak-x-option`,dir:`auto`,children:e},t))}):(0,Z.jsx)(Ge,{poll:t.poll,onChange:(e,t)=>{P(u.steps.poll,t=>Q(t,n,t=>({...t,poll:e})),t===void 0?void 0:`${t}-${String(n)}`)},onRemove:()=>{P(u.steps.poll,e=>Q(e,n,e=>Ve(e)))}}),t.quote_tweet_id===void 0?null:(0,Z.jsx)(Se,{id:t.quote_tweet_id}),a?(0,Z.jsx)(Ke,{value:S.reply_settings,disabled:p,onChange:e=>{P(u.whoCanReply,t=>{let n={...t};return e===void 0?delete n.reply_settings:n.reply_settings=e,n})}}):null,a&&!p?(0,Z.jsxs)(`div`,{className:`ak-x-c-tools`,children:[(0,Z.jsxs)(ae,{open:h===n,onOpenChange:e=>{g(e?n:void 0)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":u.addMedia,title:u.addMedia,disabled:f||t.poll!==void 0,children:(0,Z.jsx)(ue,{})})}),(0,Z.jsx)(re,{className:`w-auto`,align:`start`,children:(0,Z.jsx)(de,{self:o,types:ye,testId:`x-picker`,onPick:e=>{g(void 0),P(u.steps.media,t=>Q(t,n,t=>({...t,media:[...t.media??[],{file:ce(r,e)}]})))}})})]}),(0,Z.jsx)($,{label:u.addPoll,disabled:t.poll!==void 0||s.length>0,onClick:()=>{P(u.steps.poll,e=>Q(e,n,e=>({...e,poll:{options:[``,``],duration_minutes:1440}})))},children:(0,Z.jsx)(ne,{})}),(0,Z.jsx)(qe,{post:t,onChange:e=>{P(u.disclosure,t=>Q(t,n,t=>{let n={...t,...e};return n.made_with_ai!==!0&&delete n.made_with_ai,n.paid_partnership!==!0&&delete n.paid_partnership,n}))}}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)($,{label:u.moveUp,disabled:n===0,onClick:()=>{P(u.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n-1,0,r),{...e,posts:t}}),v(n-1)},children:(0,Z.jsx)(te,{})}),(0,Z.jsx)($,{label:u.moveDown,disabled:i,onClick:()=>{P(u.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n+1,0,r),{...e,posts:t}}),v(n+1)},children:(0,Z.jsx)(ee,{})}),(0,Z.jsx)(He,{text:t.text}),(0,Z.jsx)(`span`,{className:`bg-rule mx-1 h-6 w-px`,"aria-hidden":`true`}),(0,Z.jsx)(d,{variant:`outline`,size:`icon-xs`,className:`rounded-full border-[var(--ak-x-line)] text-[var(--ak-x-link)]`,"aria-label":u.addPost,title:u.addPost,onClick:()=>{U(n)},children:(0,Z.jsx)(C,{})})]}):null]}),w&&O===n?(0,Z.jsx)(A,{"data-testid":`x-agent-box`,label:E(w),className:`inset-x-1 inset-y-0`}):null]},n)})}),G=(0,Z.jsx)(`div`,{className:`ak-x`,"data-theme":R?`dark`:`light`,children:z.map((e,t)=>(0,Z.jsxs)(`div`,{ref:e=>{j.current[t]=e},className:`relative`,children:[(0,Z.jsx)(_e,{post:{text:e.text,media:F(e),poll:e.poll,quote:e.quote_tweet_id},joined:t<z.length-1,published:!0}),w&&O===t?(0,Z.jsx)(A,{"data-testid":`x-agent-shown`,className:`inset-0`}):null]},t))});return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,onKeyDown:N,children:[I,(0,Z.jsx)(xe.Provider,{value:pe,children:(0,Z.jsx)(me,{edit:W,preview:G,width:598,background:R?`#000000`:`#ffffff`,testId:`x-preview`})})]})}function Xe(){let e=B(),t=r(),n=a(),i=n?.item.entry,o=n?.item.dir??``,[s,c]=(0,X.useState)(),[l,u]=(0,X.useState)();return(0,X.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return ze.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,i]),!s||i===void 0?(0,Z.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`x-post-editor`,"data-state":l===void 0?`loading`:`error`,children:l===void 0?e.loading:e.couldNotOpen(l)}):(0,Z.jsx)(Ye,{doc:s,dir:o,entry:i})}export{ze as PostDocument,z as WORDS,Xe as XPostEditor,Xe as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,o as r,p as i,s as a,v as o}from"./react-Bk7NnOLX.js";import{Ot as s,_t as c,gt as l,t as u}from"./button-BVQH7zxz.js";import{B as d,R as f,V as p,at as m,et as h,tt as g}from"./snapshots-CTS2iez5.js";import{t as _}from"./session-CUCSWPTE.js";import{t as v}from"./jsx-runtime-DePvh3-m.js";import{t as y}from"./createLucideIcon-REX213UO.js";import{t as ee}from"./chart-no-axes-column-CJmeYOSo.js";import{b as te,i as ne,v as b,w as re,x}from"./dist-D7ur8721.js";import{a as ie,c as S,i as ae,l as C,n as oe,r as w,s as se,t as ce}from"./split-mDSkdQkd.js";import{t as le}from"./link-CW2KxKT_.js";import{n as ue,t as de}from"./undo-2-DUGGyBdX.js";import{E as fe,Q as T,b as E,h as pe,it as me,nt as he,p as ge,ut as _e,y as ve}from"./index-BGAXezRR.js";import{t as ye}from"./collaborator-2qfw-8OJ.js";import{f as D,i as O,n as k,o as A,s as j,u as M}from"./browser-C9NP0ZYz.js";import{_ as N,a as be,b as P,c as xe,f as F,g as I,h as L,i as Se,m as Ce,n as R,o as z,p as we,t as B,u as Te,v as V,y as H}from"./words-DFIhHhHF.js";var Ee=y(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=g().min(1),W=h({file:U,title:g().optional(),altText:g().optional()},{error:e=>e.code===`invalid_type`?`content.media is { file: ./demo.mp4, title: …, altText: … }`:void 0}),G=h({file:U,altText:g().optional()},{error:e=>e.code===`invalid_type`?`a picture of multiImage is { file: ./a.png, altText: … }`:void 0}),De=h({images:d(G)},{error:e=>e.code===`invalid_type`?`content.multiImage is { images: [ { file: ./a.png }, … ] }`:void 0}),K=h({question:g(),options:d(h({text:g()},{error:`a poll's option is { text: … }`})),settings:h({duration:f(N).optional()}).optional()},{error:e=>e.code===`invalid_type`?`content.poll is { question: …, options: [ { text: … }, … ], settings: { duration: SEVEN_DAYS } }`:void 0}),Oe=h({source:m({error:`an article's source is a web address`}),title:g().optional(),description:g().optional(),thumbnail:U.optional()},{error:e=>e.code===`invalid_type`?`content.article is { source: https://…, title: …, description: …, thumbnail: ./card.png }`:void 0}),ke=h({media:W.optional(),multiImage:De.optional(),poll:K.optional(),article:Oe.optional()},{error:e=>e.code===`invalid_type`?`content is one of media, multiImage, poll or article`:void 0}).superRefine((e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==void 0);n.length>1&&t.addIssue({code:`custom`,message:`content holds one kind, and holds ${n.join(` and `)}: a post is pictures, a video, a document, a poll or a link, never two`})}),Ae=h({commentary:g().default(``).transform(e=>e.replace(/\n+$/u,``)),visibility:f(P).optional(),content:ke.optional(),isReshareDisabledByAuthor:p().optional()},{error:e=>e.code===`invalid_type`?`a linkedin-post's file is { commentary: …, content: … }, with visibility beside them`:void 0});function je(e,t){let n=e;for(let e of t)if(M(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(D(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function q(e){let t=new O,n=k(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=je(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Ae.safeParse(n.toJS()??{});return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function Me(e){let t=e.content;return t===void 0?[]:t.media?[{file:t.media.file,path:[`content`,`media`,`file`],role:`media`,altText:t.media.altText}]:t.multiImage?t.multiImage.images.map((e,t)=>({file:e.file,path:[`content`,`multiImage`,`images`,t,`file`],role:`picture`,altText:e.altText})):t.article?.thumbnail===void 0?[]:[{file:t.article.thumbnail,path:[`content`,`article`,`thumbnail`],role:`thumbnail`}]}function Ne(e){let t=e.toLowerCase();for(let e of[`picture`,`video`,`document`])if(H[e].includes(t))return e}var Pe=[`commentary`,`visibility`,`content`],Fe=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>Fe(e)===Fe(t);function Ie(e,t){let n=e.createNode(t);return t.includes(`
|
|
2
|
+
`)&&(n.type=j.BLOCK_LITERAL),n}function Le(e,t){let n=q(e).value;if(n!==void 0&&J(n,t))return e;let r=k(e);M(r.contents)||(r.contents=new A);let i=r.contents;for(let e of Pe){let n=t[e],a=i.get(e,!0);if(n===void 0||e===`commentary`&&n===``)a!==void 0&&i.delete(e);else if(e===`commentary`){let t=i.get(e);(typeof t!=`string`||t.replace(/\n+$/u,``)!==n)&&i.set(e,Ie(r,n))}else J(a?.toJSON?.(),n)||i.set(e,r.createNode(n))}if(i.items.length>1){let e=i.items.findIndex(e=>e.key?.value===`commentary`);if(e>0){let[t]=i.items.splice(e,1);t&&i.items.unshift(t)}}return r.toString({flowCollectionPadding:!1,lineWidth:0})}function Re(e,t,n){let r=r=>J(t[r],e[r])?n[r]:t[r],i=r(`visibility`),a=r(`content`);return{...n.isReshareDisabledByAuthor===void 0?{}:{isReshareDisabledByAuthor:n.isReshareDisabledByAuthor},commentary:r(`commentary`),...i===void 0?{}:{visibility:i},...a===void 0?{}:{content:a}}}var Y=e(o(),1),X=v(),ze=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Be=class e{session;file;unreadable;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable!==void 0)return;let t=Le(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=q(e),i=q(t).value;n?.kind===`agent`&&r.value&&!ze(i,r.value)&&(this.landed=Date.now()),r.value?(this.file=this.file===void 0||i===void 0?r.value:Re(i,this.file,r.value),this.unreadable=void 0):(this.file=void 0,this.unreadable=r.errors.map(e=>e.message).join(` `)),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=q(e);this.file=t.value,this.unreadable=t.value?void 0:t.errors.map(e=>e.message).join(` `)}static async open(t,n){return new e(await _.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable!==void 0)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Ve=3e4;function Z(e,t){let n={...e};return t===void 0?delete n.content:n.content=t,n}function Q(e){return w(e)?e.includes(`#`)?`picture`:void 0:Ne(e.split(`.`).pop()??``)}function He(e,t){if(Q(t)===`picture`){if(e?.multiImage)return{multiImage:{images:[...e.multiImage.images,{file:t}]}};if(e?.media&&Q(e.media.file)===`picture`)return{multiImage:{images:[{file:e.media.file,...e.media.altText===void 0?{}:{altText:e.media.altText}},{file:t}]}}}return{media:{file:t}}}function Ue({text:e}){let t=B(),{left:n}=I(e);return n>100?null:(0,X.jsx)(`span`,{className:l(`text-sm tabular-nums`,n<0?`text-destructive font-semibold`:`text-muted-foreground`),"aria-label":n>=0?t.left(n):t.over(-n),"data-testid":`linkedin-count`,children:n})}function $(e){return(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}function We(e){let t=B();return(0,X.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[e.alt===void 0?null:(0,X.jsx)(S,{alt:e.alt.value??``,onAlt:e.alt.onAlt,most:V.alt,trigger:(0,X.jsx)(u,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,children:t.alt})}),(0,X.jsx)(u,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media rounded-full`,"aria-label":t.remove,title:t.remove,onClick:e.onRemove,children:(0,X.jsx)(c,{})})]})}function Ge(e){let t=B(),n=`aria-invalid:border-destructive h-10 w-full rounded-md border border-[var(--ak-li-border)] bg-transparent px-3 text-sm outline-none focus:border-[var(--ak-li-link)]`,r=L(e.poll.question)-V.poll.question;return(0,X.jsxs)(`div`,{className:`mx-3 flex flex-col gap-2 rounded-lg border border-[var(--ak-li-border)] p-3`,"data-testid":`linkedin-poll`,children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[t.question,(0,X.jsx)(`input`,{className:n,value:e.poll.question,readOnly:e.locked,"aria-invalid":r>0||void 0,maxLength:V.poll.question,onChange:t=>{e.onChange({...e.poll,question:t.target.value},`question`)}})]}),e.poll.options.map((r,i)=>{let a=L(r.text)-V.poll.option;return(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[t.option(i+1),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`input`,{className:n,value:r.text,readOnly:e.locked,"aria-invalid":a>0||void 0,maxLength:V.poll.option,onChange:t=>{e.onChange({...e.poll,options:e.poll.options.map((e,n)=>n===i?{text:t.target.value}:e)},`option-${String(i)}`)}}),a>0?(0,X.jsx)(`span`,{className:`text-destructive text-xs`,children:t.over(a)}):null,!e.locked&&e.poll.options.length>V.poll.least?(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,title:t.removeOption,onClick:()=>{e.onChange({...e.poll,options:e.poll.options.filter((e,t)=>t!==i)})},children:(0,X.jsx)(c,{})}):null]})]},i)}),!e.locked&&e.poll.options.length<V.poll.most?(0,X.jsxs)(u,{variant:`outline`,size:`sm`,className:`self-start rounded-full`,onClick:()=>{e.onChange({...e.poll,options:[...e.poll.options,{text:``}]})},children:[(0,X.jsx)(T,{}),t.addOption]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-[var(--ak-li-border)] pt-2 text-sm`,children:[(0,X.jsxs)(`label`,{className:`mr-auto flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[var(--ak-li-muted)]`,children:t.duration}),(0,X.jsx)(`select`,{className:`h-8 rounded-md border border-[var(--ak-li-border)] bg-transparent px-2`,value:e.poll.settings?.duration??`SEVEN_DAYS`,disabled:e.locked,onChange:t=>{e.onChange({...e.poll,settings:{duration:t.target.value}})},children:N.map(e=>(0,X.jsx)(`option`,{value:e,children:t.durations[e]},e))})]}),e.locked?null:(0,X.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=B(),n=(t,n)=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[n,(0,X.jsx)(`input`,{className:`h-9 w-full rounded-md border border-[var(--ak-li-border)] bg-transparent px-3 text-sm text-[var(--ak-li-fg)] outline-none focus:border-[var(--ak-li-link)]`,value:e.article[t]??``,readOnly:e.locked,onChange:n=>{let r=n.target.value,{title:i,description:a,...o}={...e.article,[t]:r};e.onChange({...o,...i===void 0||i===``?{}:{title:i},...a===void 0||a===``?{}:{description:a}},t)}})]});return(0,X.jsxs)(`div`,{className:`mx-3 mb-2 flex flex-col gap-2 rounded-lg border border-[var(--ak-li-border)] p-3`,"data-testid":`linkedin-link`,children:[n(`source`,t.link.source),n(`title`,t.link.title),n(`description`,t.link.description)]})}function qe({doc:e,dir:r,entry:o}){let c=B(),l=a(),d=i(),f=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[p,m]=(0,Y.useState)(),[h,g]=(0,Y.useState)(!1),_=f.file,{agent:v,following:y}=t(),S=re(),T=v?.doing!==void 0&&(v.source?.path===o||f.landed!==void 0&&f.landed>=v.at-Ve),D=(0,Y.useRef)(null),O=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{y&&T&&(D.current?.scrollIntoView({block:`nearest`}),O.current?.scrollIntoView({block:`nearest`}))},[y,T,f.landed]);let k=ae(r,_?Me(_).map(e=>e.file):[]);n({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The LinkedIn post ${o}`,source:{path:o}}),locate:e=>{let t=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},n=t(D.current),r=t(O.current),i=n!==void 0&&s(e,n),a=r!==void 0&&s(e,r);if(!i&&!a)return Promise.resolve({elements:[]});let c=new Map;for(let n of[D.current,O.current])n?.querySelectorAll(`.ak-li-content img`).forEach((n,r)=>{let i=t(n);i!==void 0&&s(e,i)&&c.set(r,n.alt)});return Promise.resolve({elements:[{name:`the post`,source:{path:o},..._?.commentary?{text:_.commentary}:{}},...[...c].map(([e,t])=>({name:`picture ${String(e+1)} of the post`,source:{path:o},...t===``?{}:{text:t}}))],where:i?`where the post is written`:`as LinkedIn's feed will show it`})}});let A=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},j=(t,n,r)=>{d||e.edit(t,n,r)},M=(0,X.jsx)(ne,{start:d?void 0:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:c.undo,disabled:!f.canUndo,onClick:()=>{e.undo()},children:(0,X.jsx)(de,{})}),(0,X.jsx)($,{label:c.redo,disabled:!f.canRedo,onClick:()=>{e.redo()},children:(0,X.jsx)(ue,{})})]}),saved:{state:f.state},exports:{}}),N=l?.theme===`dark`;if(_===void 0)return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`linkedin-post-editor`,children:[M,(0,X.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:c.unreadable(f.unreadable??``)})]});let P=_.content,I=(e,t)=>{let n=k.get(e),r=Q(e);return r===`document`?{kind:`document`,file:e,label:e.split(`/`).pop()}:n===void 0?{kind:`made`,label:w(e)?`${e} · ${c.made}`:e,file:e}:{kind:r??`picture`,src:n,alt:t,file:e}},L=P?.media?{type:`media`,medium:I(P.media.file,P.media.altText),title:P.media.title}:P?.multiImage?{type:`multiImage`,images:P.multiImage.images.map(e=>I(e.file,e.altText))}:P?.poll?{type:`poll`,question:P.poll.question,options:P.poll.options.map(e=>e.text),duration:P.poll.settings?.duration}:P?.article?{type:`article`,source:P.article.source,title:P.article.title,description:P.article.description,thumbnail:P.article.thumbnail===void 0?void 0:I(P.article.thumbnail)}:void 0,R=e=>{j(c.steps.media,t=>{let n=t.content;if(n?.multiImage){let r=n.multiImage.images.filter((t,n)=>n!==e),[i]=r;return Z(t,r.length>1?{multiImage:{images:r}}:i?{media:i}:void 0)}if(n?.article){let e={...n.article};return delete e.thumbnail,Z(t,{article:e})}return Z(t,void 0)})},H=e=>{let t=(P?.multiImage?P.multiImage.images:P?.media&&Q(P.media.file)===`picture`?[P.media]:[])[e];if(t!==void 0)return{value:t.altText,onAlt:t=>{j(c.steps.alt,n=>{let r=e=>{let n={...e};return t.trim()===``?delete n.altText:n.altText=t,n},i=n.content;return i?.multiImage?Z(n,{multiImage:{images:i.multiImage.images.map((t,n)=>n===e?r(t):t)}}):i?.media?Z(n,{media:r(i.media)}):n})}}},U=P?.poll!==void 0||P?.article!==void 0||(P?.multiImage?.images.length??0)>=V.pictures.most||P?.media!==void 0&&Q(P.media.file)!==`picture`,W=(e,t)=>(0,X.jsx)(te,{className:`w-auto`,align:`start`,children:(0,X.jsx)(oe,{self:o,types:e,testId:`linkedin-picker`,onPick:e=>{m(void 0),t(ie(r,e))}})}),G=_.visibility??`PUBLIC`,De=(0,X.jsxs)(`div`,{ref:D,className:`ak-li ak-li-composer relative`,"data-theme":N?`dark`:`light`,"data-testid":`linkedin-composer`,children:[(0,X.jsxs)(`div`,{className:`ak-li-c-head`,children:[(0,X.jsx)(xe,{visibility:G,avatar:64}),(0,X.jsxs)(ge,{children:[(0,X.jsx)(fe,{asChild:!0,disabled:d,children:(0,X.jsxs)(u,{variant:`secondary`,size:`sm`,className:`ak-li-pill`,"data-testid":`linkedin-visibility`,children:[G===`CONNECTIONS`?(0,X.jsx)(Ee,{}):(0,X.jsx)(he,{}),c.postTo(G===`CONNECTIONS`?c.connections:c.anyone),(0,X.jsx)(_e,{})]})}),(0,X.jsx)(pe,{align:`start`,children:(0,X.jsxs)(ve,{value:G,onValueChange:e=>{j(c.steps.visibility,t=>{let n={...t};return e===`PUBLIC`?delete n.visibility:n.visibility=`CONNECTIONS`,n})},children:[(0,X.jsx)(E,{value:`PUBLIC`,children:c.anyone}),(0,X.jsx)(E,{value:`CONNECTIONS`,children:c.connections})]})})]})]}),(0,X.jsxs)(`div`,{className:`ak-li-field`,children:[(0,X.jsxs)(`div`,{className:`ak-li-field-words`,"aria-hidden":`true`,children:[(0,X.jsx)(Ce,{text:_.commentary}),_.commentary.endsWith(`
|
|
3
|
+
`)?``:null]}),(0,X.jsx)(`textarea`,{dir:`auto`,value:_.commentary,placeholder:c.share,"aria-label":c.share,readOnly:d,"data-testid":`linkedin-commentary`,onChange:e=>{let t=e.target.value;j(c.steps.text,e=>({...e,commentary:t}),`commentary`)},onBlur:()=>{e.settle()}})]}),P?.poll?(0,X.jsx)(Ge,{poll:P.poll,locked:d,onChange:(e,t)=>{j(c.steps.poll,t=>Z(t,{poll:e}),t===void 0?void 0:`poll-${t}`)},onRemove:()=>{j(c.steps.poll,e=>Z(e,void 0))}}):(0,X.jsxs)(X.Fragment,{children:[P?.article?(0,X.jsx)(Ke,{article:P.article,locked:d,onChange:(e,t)=>{j(c.steps.link,t=>Z(t,{article:e}),`link-${t??``}`)}}):null,(0,X.jsx)(Te,{content:L,onMedium:d?void 0:e=>(0,X.jsx)(We,{alt:H(e),onRemove:()=>{R(e)}})}),P?.media&&Q(P.media.file)!==`picture`?(0,X.jsx)(`input`,{className:`ak-li-doc-title-field`,value:P.media.title??``,placeholder:c.documentTitle,"aria-label":c.documentTitle,readOnly:d,onChange:e=>{let t=e.target.value;j(c.steps.title,e=>{let n=e.content?.media;if(!n)return e;let r={...n};return t===``?delete r.title:r.title=t,Z(e,{media:r})},`title`)}}):null]}),d?null:(0,X.jsxs)(`div`,{className:`ak-li-c-tools`,children:[(0,X.jsxs)(b,{open:p===`media`,onOpenChange:e=>{m(e?`media`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":P?.multiImage?c.addPicture:c.addMedia,title:P?.multiImage?c.addPicture:c.addMedia,disabled:U,children:(0,X.jsx)(C,{})})}),W(P?.multiImage||P?.media?z:be,e=>{j(c.steps.media,t=>Z(t,He(t.content,e)))})]}),(0,X.jsxs)(b,{open:p===`document`,onOpenChange:e=>{m(e?`document`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":c.addDocument,title:c.addDocument,disabled:P!==void 0,children:(0,X.jsx)(me,{})})}),W(Se,e=>{j(c.steps.media,t=>Z(t,{media:{file:e}}))})]}),(0,X.jsx)($,{label:c.addPoll,disabled:P!==void 0,onClick:()=>{j(c.steps.poll,e=>Z(e,{poll:{question:``,options:[{text:``},{text:``}]}}))},children:(0,X.jsx)(ee,{})}),(0,X.jsx)($,{label:c.addLink,disabled:P!==void 0,onClick:()=>{j(c.steps.link,e=>Z(e,{article:{source:`https://`}}))},children:(0,X.jsx)(le,{})}),P?.article&&P.article.thumbnail===void 0?(0,X.jsxs)(b,{open:p===`thumbnail`,onOpenChange:e=>{m(e?`thumbnail`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsxs)(u,{variant:`ghost`,size:`sm`,children:[(0,X.jsx)(C,{}),c.link.thumbnail]})}),W(z,e=>{j(c.steps.link,t=>t.content?.article?Z(t,{article:{...t.content.article,thumbnail:e}}):t)})]}):null,(0,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsx)(Ue,{text:_.commentary})]}),v&&T?(0,X.jsx)(ye,{"data-testid":`linkedin-agent-box`,label:S(v),className:`inset-1`}):null]}),K={commentary:_.commentary,visibility:G,content:L},Oe=(0,X.jsxs)(`div`,{ref:O,className:`ak-li ak-li-previews relative`,"data-theme":N?`dark`:`light`,children:[(0,X.jsx)(F,{post:K,lines:3,onFolded:g}),h?(0,X.jsx)(F,{post:K}):null,v&&T?(0,X.jsx)(ye,{"data-testid":`linkedin-agent-shown`,className:`inset-0`}):null]});return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`linkedin-post-editor`,onKeyDown:A,children:[M,(0,X.jsx)(we.Provider,{value:se,children:(0,X.jsx)(ce,{edit:De,preview:Oe,width:552,background:N?`#000000`:`#f4f2ee`,testId:`linkedin-preview`})})]})}function Je(){let e=B(),t=r(),n=a(),i=n?.item.entry,o=n?.item.dir??``,[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return Be.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,i]),!s||i===void 0?(0,X.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`linkedin-post-editor`,"data-state":l===void 0?`loading`:`error`,children:l===void 0?e.loading:e.couldNotOpen(l)}):(0,X.jsx)(qe,{doc:s,dir:o,entry:i})}export{Je as LinkedInPostEditor,Je as default,Be as PostDocument,R as WORDS};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,c as n,i as r,o as i,s as a,t as o,v as s}from"./react-Bk7NnOLX.js";import{$ as c,At as l,B as u,G as d,H as f,J as p,K as m,Q as h,R as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_t as C,a as ee,at as w,dt as T,gt as E,i as te,lt as D,mt as O,n as ne,nt as k,o as re,ot as A,pt as j,q as ie,r as ae,rt as M,t as oe,tt as se,yt as ce,z as le}from"./button-BVQH7zxz.js";import{o as ue}from"./snapshots-CTS2iez5.js";import{t as de}from"./jsx-runtime-DePvh3-m.js";import{t as N}from"./createLucideIcon-REX213UO.js";import{n as fe,t as pe}from"./progress-udl4pNsP.js";import{B as me,E as he,F as ge,G as _e,H as ve,I as ye,J as be,L as xe,M as Se,N as Ce,P as we,R as Te,U as Ee,V as De,W as Oe,Y as ke,_ as Ae,_t as P,a as je,c as Me,dt as Ne,h as Pe,i as Fe,it as Ie,l as Le,lt as Re,o as ze,p as Be,s as Ve,t as F,x as He,z as Ue}from"./index-BGAXezRR.js";var We=N(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ge=N(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ke=N(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),qe=N(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Je=N(`file-box`,[[`path`,{d:`M14.5 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.8`,key:`1kchwa`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11.7 14.2 7 17l-4.7-2.8`,key:`1yk8tc`}],[`path`,{d:`M3 13.1a2 2 0 0 0-.999 1.76v3.24a2 2 0 0 0 .969 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01z`,key:`19flxy`}],[`path`,{d:`M7 17v5`,key:`1yj1jh`}]]),Ye=N(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Xe=N(`file-chart-column`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 18v-1`,key:`zg0ygc`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`M16 18v-3`,key:`j5jt4h`}]]),Ze=N(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Qe=N(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),$e=N(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),et=N(`file-output`,[[`path`,{d:`M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127`,key:`wfxp4w`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 11-3 3`,key:`1dgrs4`}],[`path`,{d:`m5 17-3-3h10`,key:`1mvvaf`}]]),tt=N(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),nt=N(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),rt=N(`file-stack`,[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]),it=N(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),at=N(`file-video-camera`,[[`path`,{d:`M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2`,key:`jrl274`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157`,key:`17aeo9`}],[`rect`,{width:`7`,height:`6`,x:`3`,y:`16`,rx:`1`,key:`s27ndx`}]]),ot=N(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),I=N(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),st=N(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ct=N(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),L=e(s(),1),R=de(),lt=Object.defineProperty,z=(e,t)=>lt(e,`name`,{value:t,configurable:!0}),ut=`Checkbox`,[dt,ft]=A(ut),[pt,mt]=dt(ut);function ht(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=M({prop:n,defaultProp:i??!1,onChange:c,caller:ut}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),[y,b]=L.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!B(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,R.jsx)(pt,{scope:t,...S,children:Ct(d)?d(S):r})}z(ht,`CheckboxProvider`);var gt=`CheckboxTrigger`,_t=L.forwardRef(z(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=mt(gt,e),g=j(i,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?.form;if(e){let t=z(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,R.jsx)(D.button,{type:`button`,role:`checkbox`,"aria-checked":B(c)?`mixed`:c,"aria-required":l,"data-state":wt(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:w(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:w(n,e=>{p(),d(e=>B(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),vt=L.forwardRef(z(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,R.jsx)(ht,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_t,{...d,ref:t,__scopeCheckbox:n}),e&&(0,R.jsx)(St,{__scopeCheckbox:n})]})})},`Checkbox`)),yt=`CheckboxIndicator`,bt=L.forwardRef(z(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=mt(yt,n);return(0,R.jsx)(k,{present:r||B(a.checked)||a.checked===!0,children:(0,R.jsx)(D.span,{"data-state":wt(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),xt=`CheckboxBubbleInput`,St=L.forwardRef(z(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=mt(xt,e),_=j(r,h),v=g(i),y=L.useRef(!1),b=L.useRef(s),x=L.useRef(o);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=B(s),n.call(e,!B(s)&&s),e.dispatchEvent(t),y.current=!1}},[m,s,a,o]);let S=L.useRef(!B(s)&&s);return(0,R.jsx)(D.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:w(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ct(e){return typeof e==`function`}z(Ct,`isFunction`);function B(e){return e===`indeterminate`}z(B,`isIndeterminate`);function wt(e){return B(e)?`indeterminate`:e?`checked`:`unchecked`}z(wt,`getState`);var Tt=Object.defineProperty,V=(e,t)=>Tt(e,`name`,{value:t,configurable:!0}),Et=`ContextMenu`,[Dt,Ot]=A(Et,[De]),H=De(),[kt,At]=Dt(Et),jt=V(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=L.useRef(!1),[c,l]=M({prop:i,defaultProp:!1,onChange:r,caller:Et}),u=H(t);return(0,R.jsx)(kt,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,R.jsx)(Se,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),Mt=`ContextMenuTrigger`,Nt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=At(Mt,n),o=H(n),[s,c]=L.useState({x:0,y:0}),l=L.useMemo(()=>({current:{getBoundingClientRect:V(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=L.useRef(0),d=L.useCallback(()=>window.clearTimeout(u.current),[]),f=V(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return L.useEffect(()=>d,[d]),L.useEffect(()=>void(r&&d()),[r,d]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ce,{...o,virtualRef:l}),(0,R.jsx)(D.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:w(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:w(e.onPointerDown,Ut(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:w(e.onPointerMove,Ut(d)),onPointerCancel:r?e.onPointerCancel:w(e.onPointerCancel,Ut(d)),onPointerUp:r?e.onPointerUp:w(e.onPointerUp,Ut(d))})]})},`ContextMenuTrigger`)),Pt=V(e=>{let{__scopeContextMenu:t,...n}=e,r=H(t);return(0,R.jsx)(ye,{...r,...n})},`ContextMenuPortal`),Ft=`ContextMenuContent`,It=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=At(Ft,n),a=H(n),o=L.useRef(!1);return(0,R.jsx)(we,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Lt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(ge,{...i,...r,ref:t})},`ContextMenuItem`)),Rt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(xe,{...i,...r,ref:t})},`ContextMenuSeparator`)),zt=`ContextMenuSub`,Bt=V(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=H(t),[s,c]=M({prop:i,defaultProp:a??!1,onChange:r,caller:zt});return(0,R.jsx)(Te,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),Vt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(me,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),Ht=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(Ue,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function Ut(e){return t=>t.pointerType===`mouse`?void 0:e(t)}V(Ut,`whenTouchOrPen`);var Wt=Object.defineProperty,U=(e,t)=>Wt(e,`name`,{value:t,configurable:!0}),Gt=`Popover`,[Kt,qt]=A(Gt,[re]),W=re(),[Jt,G]=Kt(Gt),Yt=U(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=W(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=L.useState(0),[p,m]=L.useState(0),[h,g]=M({prop:r,defaultProp:i??!1,onChange:a,caller:Gt});return(0,R.jsx)(ne,{...s,children:(0,R.jsx)(Jt,{scope:t,contentId:se(),titleId:se(),descriptionId:se(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:L.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Xt=`PopoverAnchor`,Zt=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=G(Xt,n),a=W(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return L.useEffect(()=>(o(),()=>s()),[o,s]),(0,R.jsx)(ae,{...a,...r,ref:t})},`PopoverAnchor`)),Qt=`PopoverTrigger`,$t=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=G(Qt,n),a=W(n),o=j(t,i.triggerRef),s=(0,R.jsx)(D.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":dn(i.open),...r,ref:o,onClick:w(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(ae,{asChild:!0,...a,children:s})},`PopoverTrigger`)),en=`PopoverPortal`,[tn,nn]=Kt(en,{forceMount:void 0}),rn=U(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=G(en,t);return(0,R.jsx)(tn,{scope:t,forceMount:n,children:(0,R.jsx)(k,{present:n||a.open,children:(0,R.jsx)(p,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),K=`PopoverContent`,an=L.forwardRef(U(function(e,t){let n=nn(K,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=G(K,e.__scopePopover);return(0,R.jsx)(k,{present:r||a.open,children:a.modal?(0,R.jsx)(sn,{...i,ref:t}):(0,R.jsx)(cn,{...i,ref:t})})},`PopoverContent`)),on=T(`PopoverContent.RemoveScroll`),sn=L.forwardRef(U(function(e,t){let n=G(K,e.__scopePopover),r=L.useRef(null),i=j(t,r),a=L.useRef(!1),{nodes:o,registry:s}=h();return L.useEffect(()=>{let e=r.current;if(e)return d(e)},[]),(0,R.jsx)(m,{as:on,allowPinchZoom:!0,shards:L.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,R.jsx)(ln,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),cn=L.forwardRef(U(function(e,t){let n=G(K,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(ln,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ln=L.forwardRef(U(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=G(K,n),_=W(n),[v,y]=L.useState(null),C=j(t,y);return S(v),ie(),(0,R.jsx)(b,{registry:m,children:(0,R.jsx)(x,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(c,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(ee,{"data-state":dn(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?fn(f,g.descriptionId):f,..._,...h,ref:C,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),un=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=W(n);return(0,R.jsx)(te,{...i,...r,ref:t})},`PopoverArrow`));function dn(e){return e?`open`:`closed`}U(dn,`getState`);function fn(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}U(fn,`concatAriaDescribedby`);var pn=Object.defineProperty,mn=(e,t)=>pn(e,`name`,{value:t,configurable:!0}),hn=`Toggle`,gn=L.forwardRef(mn(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=M({prop:n,onChange:i,defaultProp:r??!1,caller:hn});return(0,R.jsx)(D.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:w(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),_n=Object.defineProperty,q=(e,t)=>_n(e,`name`,{value:t,configurable:!0}),J=`ToggleGroup`,Y={Single:`single`,Multiple:`multiple`},[vn,yn]=A(J,[Oe]),bn=Oe(),xn=L.forwardRef(q(function(e,t){let{type:n,...r}=e;if(n===Y.Single)return(0,R.jsx)(wn,{role:`radiogroup`,...r,ref:t});if(n===Y.Multiple)return(0,R.jsx)(Tn,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${J}\``)},`ToggleGroup`)),[Sn,Cn]=vn(J),wn=L.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=M({prop:n,defaultProp:r??``,onChange:i,caller:J});return(0,R.jsx)(Sn,{scope:e.__scopeToggleGroup,type:Y.Single,value:L.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:L.useCallback(()=>s(``),[s]),children:(0,R.jsx)(On,{...a,ref:t})})},`ToggleGroupImplSingle`)),Tn=L.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=M({prop:n,defaultProp:r??[],onChange:i,caller:J}),c=L.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=L.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,R.jsx)(Sn,{scope:e.__scopeToggleGroup,type:Y.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,R.jsx)(On,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[En,Dn]=vn(J),On=L.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=bn(n),u=_e(o),d={dir:u,...c};return(0,R.jsx)(En,{scope:n,rovingFocus:i,disabled:r,children:i?(0,R.jsx)(ve,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,R.jsx)(D.div,{...d,ref:t})}):(0,R.jsx)(D.div,{...d,ref:t})})},`ToggleGroupImpl`)),kn=`ToggleGroupItem`,An=L.forwardRef(q(function(e,t){let n=Cn(kn,e.__scopeToggleGroup),r=Dn(kn,e.__scopeToggleGroup),i=bn(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=L.useRef(null);return r.rovingFocus?(0,R.jsx)(Ee,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,R.jsx)(jn,{...s,ref:t})}):(0,R.jsx)(jn,{...s,ref:t})},`ToggleGroupItem`)),jn=L.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Cn(kn,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===Y.Single?o:void 0;return(0,R.jsx)(gn,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),X=ce({en:{saved:{saved:`Saved`,saving:`Saving…`,unsaved:`Not saved yet`,error:`Not saved`},agentDoing:{editing:e=>`${e} is editing`,looking:e=>`${e} is looking`},follow:e=>`Follow ${e}`,unfollow:e=>`Stop following ${e}`,markUp:`Mark up`,markUpHint:`Mark up what is on show, and AI makes the changes`,moreTools:`More`,export:`Export`,share:`Share`,exported:`Exported`,exportFailed:`Export failed`,format:`Format`,versions:`Languages`,include:`Include`,onShow:`On show`,all:e=>`All ${String(e)} languages`,choose:`Choose…`,chosen:e=>`${String(e)} chosen`,back:`Back`,checking:`Checking…`,blocked:e=>e===1?`1 must-fix problem stops the export`:`${String(e)} must-fix problems stop the export`,start:`Export`,queued:`Waiting`,queuedAhead:e=>`Waiting, ${String(e)} ahead`,running:e=>`Exporting ${String(e)}%`,cancel:`Cancel`,retry:`Try again`,failedHelp:e=>`Try again, or ask ${e} what went wrong.`,partial:`Some files could not be made.`,startFailed:`The export did not start`,nVersions:e=>`${String(e)} versions`,show:`Show in folder`,download:`Download`,option:{pptx:{label:`Slides`,values:{native:`Editable`,picture:`Pictures`}},steps:{label:`Each animation step`},scale:{label:`Size`}},type:{mov:`MOV (ProRes)`,srt:`Captions`,cover:`Cover image`,pptx:`PowerPoint`,zip:`ZIP (each board as a PNG)`}},"zh-cn":{saved:{saved:`已保存`,saving:`正在保存…`,unsaved:`尚未保存`,error:`没能保存`},agentDoing:{editing:e=>`${e} 正在编辑`,looking:e=>`${e} 正在查看`},follow:e=>`跟随 ${e}`,unfollow:e=>`停止跟随 ${e}`,markUp:`批改`,markUpHint:`在画面上批改,AI 照着改`,moreTools:`更多`,export:`导出`,share:`分享`,exported:`已导出`,exportFailed:`导出失败`,format:`格式`,versions:`语言`,include:`附带`,onShow:`当前`,all:e=>`全部 ${String(e)} 种语言`,choose:`选择…`,chosen:e=>`已选 ${String(e)} 个`,back:`返回`,checking:`检查中…`,blocked:e=>`有 ${String(e)} 个必修问题,暂时不能导出`,start:`导出`,queued:`排队中`,queuedAhead:e=>`排队中,前面还有 ${String(e)} 个`,running:e=>`导出中 ${String(e)}%`,cancel:`取消`,retry:`重试`,failedHelp:e=>`请重试,或让 ${e} 看看哪里出了问题。`,partial:`部分文件没能生成。`,startFailed:`导出没有开始`,nVersions:e=>`${String(e)} 个版本`,show:`在文件夹中显示`,download:`下载`,option:{pptx:{label:`幻灯片`,values:{native:`可编辑`,picture:`图片`}},steps:{label:`每个动画步骤`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面图`,pptx:`PowerPoint`,zip:`ZIP(每个画板一张 PNG)`}},"zh-tw":{saved:{saved:`已儲存`,saving:`正在儲存…`,unsaved:`尚未儲存`,error:`沒能儲存`},agentDoing:{editing:e=>`${e} 正在編輯`,looking:e=>`${e} 正在查看`},follow:e=>`跟隨 ${e}`,unfollow:e=>`停止跟隨 ${e}`,markUp:`批改`,markUpHint:`在畫面上批改,AI 照著改`,moreTools:`更多`,export:`匯出`,share:`分享`,exported:`已匯出`,exportFailed:`匯出失敗`,format:`格式`,versions:`語言`,include:`附帶`,onShow:`目前`,all:e=>`全部 ${String(e)} 種語言`,choose:`選擇…`,chosen:e=>`已選 ${String(e)} 個`,back:`返回`,checking:`檢查中…`,blocked:e=>`有 ${String(e)} 個必須修正的問題,暫時無法匯出`,start:`匯出`,queued:`排隊中`,queuedAhead:e=>`排隊中,前面還有 ${String(e)} 個`,running:e=>`匯出中 ${String(e)}%`,cancel:`取消`,retry:`重試`,failedHelp:e=>`請重試,或讓 ${e} 看看哪裡出了問題。`,partial:`部分檔案沒能產生。`,startFailed:`匯出沒有開始`,nVersions:e=>`${String(e)} 個版本`,show:`在資料夾中顯示`,download:`下載`,option:{pptx:{label:`投影片`,values:{native:`可編輯`,picture:`圖片`}},steps:{label:`每個動畫步驟`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面圖`,pptx:`PowerPoint`,zip:`ZIP(每個畫板一張 PNG)`}},ja:{saved:{saved:`保存済み`,saving:`保存中…`,unsaved:`未保存`,error:`保存できませんでした`},agentDoing:{editing:e=>`${e}が編集中`,looking:e=>`${e}が表示中`},follow:e=>`${e}をフォロー`,unfollow:e=>`${e}のフォローをやめる`,markUp:`赤入れ`,markUpHint:`画面に赤を入れると、AI が直します`,moreTools:`その他`,export:`書き出し`,share:`共有`,exported:`書き出し済み`,exportFailed:`書き出しに失敗`,format:`形式`,versions:`言語`,include:`追加`,onShow:`表示中`,all:e=>`全 ${String(e)} 言語`,choose:`選択…`,chosen:e=>`${String(e)} 件選択`,back:`戻る`,checking:`チェック中…`,blocked:e=>`要修正の問題が ${String(e)} 件あるため書き出せません`,start:`書き出す`,queued:`待機中`,queuedAhead:e=>`待機中、前に ${String(e)} 件`,running:e=>`書き出し中 ${String(e)}%`,cancel:`キャンセル`,retry:`再試行`,failedHelp:e=>`もう一度試すか、${e} に原因を確認してください。`,partial:`一部のファイルを作成できませんでした。`,startFailed:`書き出しを開始できませんでした`,nVersions:e=>`${String(e)} 個のバージョン`,show:`フォルダに表示`,download:`ダウンロード`,option:{pptx:{label:`スライド`,values:{native:`編集可能`,picture:`画像`}},steps:{label:`アニメーションの各ステップ`},scale:{label:`サイズ`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`カバー画像`,pptx:`PowerPoint`,zip:`ZIP(各ボードを PNG で)`}},ko:{saved:{saved:`저장됨`,saving:`저장 중…`,unsaved:`아직 저장되지 않음`,error:`저장되지 않음`},agentDoing:{editing:e=>`${e} 편집 중`,looking:e=>`${e} 보는 중`},follow:e=>`${e} 따라가기`,unfollow:e=>`${e} 따라가기 중지`,markUp:`첨삭`,markUpHint:`화면에 첨삭하면 AI가 고쳐 줍니다`,moreTools:`더보기`,export:`내보내기`,share:`공유`,exported:`내보냄`,exportFailed:`내보내기 실패`,format:`형식`,versions:`언어`,include:`포함`,onShow:`현재`,all:e=>`${String(e)}개 언어 모두`,choose:`선택…`,chosen:e=>`${String(e)}개 선택`,back:`뒤로`,checking:`확인 중…`,blocked:e=>`수정이 필요한 문제 ${String(e)}개 때문에 내보낼 수 없습니다`,start:`내보내기`,queued:`대기 중`,queuedAhead:e=>`대기 중, 앞에 ${String(e)}개`,running:e=>`내보내는 중 ${String(e)}%`,cancel:`취소`,retry:`다시 시도`,failedHelp:e=>`다시 시도하거나 ${e}에게 원인을 물어보세요.`,partial:`일부 파일을 만들지 못했습니다.`,startFailed:`내보내기를 시작하지 못했습니다`,nVersions:e=>`버전 ${String(e)}개`,show:`폴더에서 보기`,download:`다운로드`,option:{pptx:{label:`슬라이드`,values:{native:`편집 가능`,picture:`이미지`}},steps:{label:`애니메이션 단계별로`},scale:{label:`크기`}},type:{mov:`MOV (ProRes)`,srt:`자막`,cover:`표지 이미지`,pptx:`PowerPoint`,zip:`ZIP (보드마다 PNG)`}},es:{saved:{saved:`Guardado`,saving:`Guardando…`,unsaved:`Aún sin guardar`,error:`No guardado`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está mirando`},follow:e=>`Seguir a ${e}`,unfollow:e=>`Dejar de seguir a ${e}`,markUp:`Corregir`,markUpHint:`Corrige lo que ves y la IA hace los cambios`,moreTools:`Más`,export:`Exportar`,share:`Compartir`,exported:`Exportado`,exportFailed:`Error al exportar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Actual`,all:e=>`Los ${String(e)} idiomas`,choose:`Elegir…`,chosen:e=>`${String(e)} elegidos`,back:`Atrás`,checking:`Comprobando…`,blocked:e=>`${String(e)} problemas obligatorios detienen la exportación`,start:`Exportar`,queued:`En espera`,queuedAhead:e=>`En espera, ${String(e)} delante`,running:e=>`Exportando ${String(e)} %`,cancel:`Cancelar`,retry:`Reintentar`,failedHelp:e=>`Reinténtalo o pregunta a ${e} qué ha fallado.`,partial:`No se pudieron crear algunos archivos.`,startFailed:`La exportación no empezó`,nVersions:e=>`${String(e)} versiones`,show:`Mostrar en la carpeta`,download:`Descargar`,option:{pptx:{label:`Diapositivas`,values:{native:`Editables`,picture:`Imágenes`}},steps:{label:`Cada paso de animación`},scale:{label:`Tamaño`}},type:{mov:`MOV (ProRes)`,srt:`Subtítulos`,cover:`Imagen de portada`,pptx:`PowerPoint`,zip:`ZIP (cada mesa de trabajo en PNG)`}},fr:{saved:{saved:`Enregistré`,saving:`Enregistrement…`,unsaved:`Pas encore enregistré`,error:`Non enregistré`},agentDoing:{editing:e=>`${e} modifie`,looking:e=>`${e} regarde`},follow:e=>`Suivre ${e}`,unfollow:e=>`Ne plus suivre ${e}`,markUp:`Annoter`,markUpHint:`Annotez ce qui est affiché, et l'IA fait les changements`,moreTools:`Plus`,export:`Exporter`,share:`Partager`,exported:`Exporté`,exportFailed:`Échec de l’export`,format:`Format`,versions:`Langues`,include:`Inclure`,onShow:`Affichée`,all:e=>`Les ${String(e)} langues`,choose:`Choisir…`,chosen:e=>`${String(e)} choisies`,back:`Retour`,checking:`Vérification…`,blocked:e=>`${String(e)} problèmes à corriger bloquent l’export`,start:`Exporter`,queued:`En attente`,queuedAhead:e=>`En attente, ${String(e)} avant celui-ci`,running:e=>`Export ${String(e)}\u00a0%`,cancel:`Annuler`,retry:`Réessayer`,failedHelp:e=>`Réessayez ou demandez à ${e} ce qui n’a pas marché.`,partial:`Certains fichiers n’ont pas pu être créés.`,startFailed:`L’export n’a pas démarré`,nVersions:e=>`${String(e)} versions`,show:`Afficher dans le dossier`,download:`Télécharger`,option:{pptx:{label:`Diapositives`,values:{native:`Modifiables`,picture:`Images`}},steps:{label:`Chaque étape d'animation`},scale:{label:`Taille`}},type:{mov:`MOV (ProRes)`,srt:`Sous-titres`,cover:`Image de couverture`,pptx:`PowerPoint`,zip:`ZIP (chaque plan de travail en PNG)`}},de:{saved:{saved:`Gespeichert`,saving:`Wird gespeichert…`,unsaved:`Noch nicht gespeichert`,error:`Nicht gespeichert`},agentDoing:{editing:e=>`${e} bearbeitet`,looking:e=>`${e} schaut sich um`},follow:e=>`${e} folgen`,unfollow:e=>`${e} nicht mehr folgen`,markUp:`Korrigieren`,markUpHint:`Korrigieren Sie, was zu sehen ist, und die KI setzt es um`,moreTools:`Mehr`,export:`Exportieren`,share:`Teilen`,exported:`Exportiert`,exportFailed:`Export fehlgeschlagen`,format:`Format`,versions:`Sprachen`,include:`Dazu`,onShow:`Aktuell`,all:e=>`Alle ${String(e)} Sprachen`,choose:`Auswählen…`,chosen:e=>`${String(e)} ausgewählt`,back:`Zurück`,checking:`Wird geprüft…`,blocked:e=>`${String(e)} Probleme verhindern den Export`,start:`Exportieren`,queued:`Wartet`,queuedAhead:e=>`Wartet, ${String(e)} davor`,running:e=>`Export läuft: ${String(e)} %`,cancel:`Abbrechen`,retry:`Erneut versuchen`,failedHelp:e=>`Versuche es erneut oder frage ${e}, was schiefgelaufen ist.`,partial:`Einige Dateien konnten nicht erstellt werden.`,startFailed:`Der Export ist nicht gestartet`,nVersions:e=>`${String(e)} Versionen`,show:`Im Ordner zeigen`,download:`Herunterladen`,option:{pptx:{label:`Folien`,values:{native:`Bearbeitbar`,picture:`Bilder`}},steps:{label:`Jeden Animationsschritt`},scale:{label:`Größe`}},type:{mov:`MOV (ProRes)`,srt:`Untertitel`,cover:`Titelbild`,pptx:`PowerPoint`,zip:`ZIP (jede Zeichenfläche als PNG)`}},pt:{saved:{saved:`Salvo`,saving:`Salvando…`,unsaved:`Ainda não salvo`,error:`Não salvo`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está olhando`},follow:e=>`Seguir ${e}`,unfollow:e=>`Parar de seguir ${e}`,markUp:`Corrigir`,markUpHint:`Corrija o que vê e a IA faz as alterações`,moreTools:`Mais`,export:`Exportar`,share:`Compartilhar`,exported:`Exportado`,exportFailed:`Falha ao exportar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Atual`,all:e=>`Todos os ${String(e)} idiomas`,choose:`Escolher…`,chosen:e=>`${String(e)} escolhidos`,back:`Voltar`,checking:`Verificando…`,blocked:e=>`${String(e)} problemas obrigatórios impedem a exportação`,start:`Exportar`,queued:`Aguardando`,queuedAhead:e=>`Aguardando, ${String(e)} na frente`,running:e=>`Exportando ${String(e)}%`,cancel:`Cancelar`,retry:`Tentar novamente`,failedHelp:e=>`Tente novamente ou pergunte a ${e} o que deu errado.`,partial:`Não foi possível criar alguns arquivos.`,startFailed:`A exportação não começou`,nVersions:e=>`${String(e)} versões`,show:`Mostrar na pasta`,download:`Baixar`,option:{pptx:{label:`Slides`,values:{native:`Editáveis`,picture:`Imagens`}},steps:{label:`Cada etapa da animação`},scale:{label:`Tamanho`}},type:{mov:`MOV (ProRes)`,srt:`Legendas`,cover:`Imagem de capa`,pptx:`PowerPoint`,zip:`ZIP (cada prancheta em PNG)`}}});function Mn(){let e=a(),t=X.of(e?.locale);return e=>e.doing===void 0?e.name:t.agentDoing[e.doing](e.name)}function Nn(){let e=a(),n=Mn(),{agent:r,following:i,follow:s,unfollow:c}=t();if(r?.doing===void 0)return null;let l=X.of(e?.locale);return(0,R.jsxs)(F,{[o]:``,"data-testid":`agent-here`,"data-doing":r.doing,"aria-pressed":i,title:i?l.unfollow(r.name):l.follow(r.name),className:`text-agent-text hover:text-agent-text aria-pressed:text-agent-text`,onClick:()=>{i?c():s()},children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:E(`size-2 flex-none rounded-full`,i?`bg-agent motion-safe:animate-pulse`:`border-agent border`)}),n(r)]})}function Pn(){let e=i(),{agent:r,following:a,follow:o,unfollow:s}=t(),c=r?.doing,l=r?.name;return(0,L.useEffect)(()=>{e[`agent/here`]({...c===void 0||l===void 0?{}:{agent:{name:l,doing:c}},following:a}).catch(()=>void 0)},[e,c,l,a]),n(`editor/command`,({command:e})=>{e===`follow`?o():e===`unfollow`&&s()}),null}function Fn({checked:e,multiple:t=!1,variant:n=`row`,className:r,children:i,...a}){return(0,R.jsxs)(`button`,{type:`button`,role:t?`checkbox`:`radio`,"aria-checked":e,"data-slot":`choice`,...a,className:E(`text-sm text-ink transition-colors focus-visible:outline focus-visible:-outline-offset-1 focus-visible:outline-pencil disabled:cursor-default disabled:opacity-50`,n===`row`?`flex min-h-8 items-center gap-2.5 rounded-md px-2 py-1 text-left`:`flex flex-col items-center rounded-md border px-2 py-2.5`,e?E(`bg-pencil-wash`,n===`box`&&`border-pencil`):E(`hover:bg-hover active:bg-press`,n===`box`&&`border-rule hover:border-rule-strong`),r),children:[n===`row`&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:E(`flex size-4 flex-none items-center justify-center border text-on-pencil`,t?`rounded-sm`:`rounded-full`,e?t?`border-pencil bg-pencil`:`border-4 border-pencil`:`border-rule-strong`),children:t&&e&&(0,R.jsx)(Ne,{className:`size-3`})}),i]})}var Z=16,In=8;function Ln(){return(0,R.jsx)(un,{asChild:!0,width:Z,height:In,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 ${String(Z)} ${String(In)}`,"aria-hidden":!0,className:`-mt-px block overflow-visible`,children:[(0,R.jsx)(`path`,{d:`M0 -1 L${String(Z/2)} 7 L${String(Z)} -1 Z`,className:`fill-popover`}),(0,R.jsx)(`path`,{d:`M0 0 L${String(Z/2)} 7 L${String(Z)} 0`,className:`fill-none stroke-border`})]})})}function Rn({className:e,...t}){return(0,R.jsx)(vt,{"data-slot":`checkbox`,className:E(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary`,e),...t,children:(0,R.jsx)(bt,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,R.jsx)(Ne,{className:`size-3.5`})})})}function zn({...e}){return(0,R.jsx)(Yt,{"data-slot":`popover`,...e})}function Bn({...e}){return(0,R.jsx)($t,{"data-slot":`popover-trigger`,...e})}function Vn({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,R.jsx)(rn,{children:(0,R.jsx)(an,{"data-slot":`popover-content`,align:t,sideOffset:n,className:E(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function Hn({...e}){return(0,R.jsx)(Zt,{"data-slot":`popover-anchor`,...e})}function Un({...e}){return(0,R.jsx)(le,{"data-slot":`sheet`,...e})}function Wn({...e}){return(0,R.jsx)(_,{"data-slot":`sheet-portal`,...e})}function Gn({className:e,...t}){return(0,R.jsx)(f,{"data-slot":`sheet-overlay`,className:E(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Kn({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,R.jsxs)(Wn,{children:[(0,R.jsx)(Gn,{}),(0,R.jsxs)(v,{"data-slot":`sheet-content`,className:E(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,R.jsxs)(u,{className:`absolute top-2.5 right-2.5 grid size-7 place-items-center rounded-md text-lead ring-offset-background hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus:outline-hidden active:bg-press disabled:pointer-events-none motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,R.jsx)(C,{className:`size-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function qn({className:e,...t}){return(0,R.jsx)(y,{"data-slot":`sheet-title`,className:E(`font-semibold text-foreground`,e),...t})}var Jn=O(`inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 min-w-9 px-2`,sm:`h-8 min-w-8 px-1.5`,lg:`h-10 min-w-10 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}}),Yn=L.createContext({size:`default`,variant:`default`,spacing:0});function Xn({className:e,variant:t,size:n,spacing:r=0,children:i,...a}){return(0,R.jsx)(xn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,style:{"--gap":r},className:E(`group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs`,e),...a,children:(0,R.jsx)(Yn.Provider,{value:{variant:t,size:n,spacing:r},children:i})})}function Zn({className:e,children:t,variant:n,size:r,...i}){let a=L.useContext(Yn);return(0,R.jsx)(An,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:E(Jn({variant:a.variant||n,size:a.size||r}),`w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10`,`data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l`,e),...i,children:t})}var Qn=5;function $n(e,t){let n=new Set;return e.filter(e=>e.item===t&&e.state!==`cancelled`).reverse().filter(e=>{if(e.state!==`done`||e.files.length===0)return!0;let t=[...e.files].sort().join(`
|
|
2
|
+
`);return!n.has(t)&&(n.add(t),!0)}).slice(0,Qn)}var Q=e=>e.state===`queued`||e.state===`running`;function er(e,t,n,r={}){let i=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e));return Q(e)&&i(e.versions,t)&&i(e.types,n)&&tr(e.options??{},r)}var tr=(e,t)=>Object.keys({...e,...t}).every(n=>e[n]===t[n]);function nr(e,t,n){return Object.fromEntries(e.flatMap(e=>{let r=n[e.name];return!e.only.includes(t)||r===void 0?[]:e.values?e.values.includes(String(r))?[[e.name,r]]:[]:r===!0?[[e.name,!0]]:[]}))}function rr(e,t){return Math.max(0,e.filter(Q).map(e=>e.id).indexOf(t))}function ir(e,t,n,r){if(n.length!==0)return e===`all`?[...n]:e===`some`?n.filter(e=>r.includes(e)):t===void 0?[...n]:[t]}function ar(e,t){let n=e.findLast(Q);if(n)return n.state===`running`?{at:`running`,percent:Math.round(n.progress*100)}:{at:`queued`};let r=e[0];return r===void 0||!t.has(r.id)?{at:`idle`}:r.state===`failed`?{at:`failed`}:{at:`done`}}var or=e=>e.slice(e.lastIndexOf(`/`)+1),sr={mp4:`MP4`,gif:`GIF`,png:`PNG`,jpeg:`JPEG`,webp:`WebP`,avif:`AVIF`,pdf:`PDF`,html:`HTML`,zip:`ZIP`,psd:`PSD`,docx:`Word`,md:`Markdown`,xlsx:`Excel`,csv:`CSV`,json:`JSON`,glb:`GLB`},cr=(e,t)=>sr[t]??(t in e.type?e.type[t]:t);function lr(){let e=a(),t=X.of(e?.locale),n=e?.item.kindInfo.exports?.names,r=e?.locale??`en`;return e=>{let i=n?.[e];return i?.[r]??i?.en??cr(t,e)}}function ur(){let[e,t]=(0,L.useState)(()=>window.matchMedia(`(max-width: 479px)`).matches);return(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 479px)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function dr(e){let t=i(),[r,a]=(0,L.useState)([]),[o,s]=(0,L.useState)(new Set),[c,l]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=!0;return P(t,`export/list`,{}).then(t=>{e&&(a(t.jobs),l(t.reveal))},()=>void 0),()=>{e=!1}},[t]),n(`export/changed`,({job:t})=>{a(e=>{let n=e.findIndex(e=>e.id===t.id);return n<0?[...e,t]:e.map((e,r)=>r===n?t:e)}),!Q(t)&&!e&&s(e=>new Set(e).add(t.id))});let[u,d]=(0,L.useState)(e);return u!==e&&(d(e),e&&s(new Set)),{all:r,fresh:o,reveals:c}}function fr(e,t){let n=i(),r=`item-bar.export.${e}`,[a,o]=(0,L.useState)({type:t.types[0]??``,extras:[],options:{}});return(0,L.useEffect)(()=>{let e=!0;return n[`storage/get`]({key:r}).then(({value:n})=>{let r=n;if(!e||!r)return;let i=t.types.find(e=>e===r.type);i!==void 0&&o({type:i,extras:t.extras.filter(e=>r.extras?.includes(e)),options:r.options??{}})},()=>void 0),()=>{e=!1}},[n,r,t]),[a,e=>{o(e),n[`storage/set`]({key:r,value:e}).catch(()=>void 0)}]}async function pr(e,t){let{url:n}=await e[`files/url`]({path:t}),r=document.createElement(`a`);r.href=n,r.download=or(t),r.click()}async function mr(e,t,n){n&&await P(e,`export/reveal`,{path:t}).then(()=>!0,()=>!1)||await pr(e,t)}function hr({job:e,versions:t,ahead:n,words:r,reveals:o}){let s=lr(),c=i(),l=a()?.agent?.name??`AllyHub`,u=Math.round(e.progress*100),d=o?ot:Ge,f=o?r.show:r.download,p=e.versions.length===0?void 0:e.versions.length>2?r.nVersions(e.versions.length):e.versions.map(e=>t.find(t=>t.key===e)?.label??e).join(`, `),m=[e.types.map(e=>s(e)).join(`, `),...t.length>1&&p!==void 0?[p]:[]].join(` · `);return(0,R.jsxs)(`div`,{className:`border-t py-2 pr-2 pl-4`,"data-testid":`export-job`,"data-state":e.state,children:[Q(e)&&(0,R.jsxs)(`div`,{className:`pr-2`,children:[(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,children:m}),(0,R.jsx)(`span`,{className:`text-lead text-xs tabular-nums`,children:e.state===`running`?`${String(u)}%`:n>0?r.queuedAhead(n):r.queued}),(0,R.jsx)(F,{icon:!0,"aria-label":r.cancel,title:r.cancel,"data-testid":`export-cancel`,onClick:()=>{P(c,`export/cancel`,{job:e.id}).catch(()=>void 0)},children:(0,R.jsx)(C,{"aria-hidden":!0})})]}),(0,R.jsx)(pe,{value:u,className:`mt-1 h-1`})]}),e.state===`failed`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,R.jsx)(ke,{className:`text-destructive size-3.5 flex-none`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`text-dense text-destructive min-w-0 flex-1 truncate`,children:[r.exportFailed,` · `,m]}),(0,R.jsx)(F,{icon:!0,"aria-label":r.retry,title:r.retry,"data-testid":`export-retry`,onClick:()=>{P(c,`export/start`,{item:e.item,versions:e.versions,types:e.types,...e.options?{options:e.options}:{}}).catch(e=>{be.error(r.startFailed,{description:e instanceof Error?e.message:String(e)})})},children:(0,R.jsx)(st,{"aria-hidden":!0})})]}),(0,R.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:r.failedHelp(l)})]}),e.files.map(e=>(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,"data-testid":`export-file`,children:[(0,R.jsx)(Ne,{className:`text-success size-3.5 flex-none`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,title:e,children:or(e)}),(0,R.jsx)(F,{icon:!0,"aria-label":f,title:f,"data-testid":`export-give`,onClick:()=>{mr(c,e,o)},children:(0,R.jsx)(d,{"aria-hidden":!0})})]},e)),e.state===`done`&&e.error!==void 0&&(0,R.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:r.partial})]})}function gr({versions:e,shown:t,picked:n,onPick:r,onBack:i,words:a}){return(0,R.jsxs)(`div`,{"data-testid":`export-choose`,children:[(0,R.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b pr-4 pl-2`,children:[(0,R.jsx)(F,{icon:!0,"aria-label":a.back,title:a.back,onClick:i,children:(0,R.jsx)(We,{"aria-hidden":!0})}),(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:a.versions}),(0,R.jsxs)(`span`,{className:`text-lead ml-auto text-xs tabular-nums`,children:[n.length,`/`,e.length]})]}),(0,R.jsx)(`ul`,{className:`max-h-64 overflow-y-auto p-2`,children:e.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`label`,{className:`pressable flex h-8 items-center gap-2 rounded-md px-2 text-sm`,children:[(0,R.jsx)(Rn,{checked:n.includes(e.key),"data-version":e.key,onCheckedChange:t=>{r(t===!0?[...n,e.key]:n.filter(t=>t!==e.key))}}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.key===t&&(0,R.jsx)(`span`,{className:`text-lead text-xs`,children:a.onShow})]})},e.key))})]})}function _r({kind:e,offer:t,item:n,props:r,jobs:a,all:o,words:s,reveals:c,startRef:l}){let u=lr(),d=i(),f=r.versions??[],p=f.map(e=>e.key),m=f.find(e=>e.key===r.shown)?.label,h=r.unavailable??{},[g,_]=fr(e,t),[v,y]=(0,L.useState)(`shown`),[b,x]=(0,L.useState)(r.shown===void 0?[]:[r.shown]),[S,C]=(0,L.useState)(!1),[ee,w]=(0,L.useState)(!1),T=ir(v,r.shown,p,b),te=T?.length??1,D=[g.type,...g.extras.filter(e=>h[e]===void 0)],O=t.options.filter(e=>e.only.includes(g.type)),ne=nr(O,g.type,g.options),k=O.filter(e=>e.values===void 0),re=(e,t)=>{_({...g,options:{...g.options,[e]:t}})},A=r.check?.waiting===!0,j=A?0:r.check?.problems(T)??0,ie=a.some(e=>er(e,T??[],D,ne)),ae=async()=>{w(!0);try{await P(d,`export/start`,{item:n,...T?{versions:T}:{},types:D,...Object.keys(ne).length>0?{options:ne}:{}})}catch(e){if(ue(e))return;be.error(s.startFailed,{description:e instanceof Error?e.message:String(e)})}finally{w(!1)}},M=(0,R.jsx)(yr,{label:s.format,types:t.types,chosen:g.type,name:u,onChoose:e=>{_({...g,type:e})}}),se=(0,R.jsx)(oe,{ref:l,size:`sm`,disabled:A||j>0||ee||te===0||ie,"data-testid":`export-start`,onClick:()=>{ae()},children:A?s.checking:s.start});return(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-lg text-sm`,"data-testid":`export-panel`,children:[S?(0,R.jsx)(gr,{versions:f,shown:r.shown,picked:b,onPick:x,onBack:()=>{C(!1)},words:s}):(0,R.jsxs)(R.Fragment,{children:[t.types.length>1&&(0,R.jsx)(`div`,{className:`px-4 pt-4`,children:M}),(p.length>1||t.extras.length+O.length>0)&&(0,R.jsxs)(`div`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-3 px-4 pt-4`,children:[O.map(e=>e.values?(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead`,children:s.option[e.name]?.label}),(0,R.jsx)(Xn,{type:`single`,variant:`outline`,size:`sm`,className:`w-full`,"aria-label":s.option[e.name]?.label,"data-testid":`export-option-${e.name}`,value:String(g.options[e.name]??e.values[0]),onValueChange:t=>{t!==``&&re(e.name,t)},children:e.values.map(t=>(0,R.jsx)(Zn,{value:t,"data-value":t,className:`flex-1`,children:s.option[e.name]?.values?.[t]??t},t))})]},e.name):null),p.length>1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead`,children:s.versions}),(0,R.jsxs)(Fe,{value:v,onValueChange:e=>{y(e),e===`some`&&C(!0)},children:[(0,R.jsx)(Me,{size:`sm`,"aria-label":s.versions,className:`w-full min-w-0`,"data-testid":`export-scope`,children:(0,R.jsx)(Le,{})}),(0,R.jsxs)(je,{position:`popper`,align:`start`,children:[(0,R.jsx)(ze,{value:`shown`,children:m??s.onShow}),(0,R.jsx)(ze,{value:`all`,children:s.all(p.length)}),(0,R.jsx)(Ve,{}),(0,R.jsx)(ze,{value:`some`,onPointerUp:()=>{C(!0)},children:v===`some`?s.chosen(b.length):s.choose})]})]})]}),t.extras.length+k.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead self-start`,children:s.include}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,"data-testid":`export-include`,children:[k.map(e=>(0,R.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Rn,{checked:g.options[e.name]===!0,"data-option":e.name,onCheckedChange:t=>{re(e.name,t===!0)}}),(0,R.jsx)(`span`,{className:`truncate`,children:s.option[e.name]?.label})]},e.name)),t.extras.map(e=>{let t=h[e];return(0,R.jsxs)(`label`,{title:t,className:E(`flex items-center gap-2`,t!==void 0&&`text-lead-soft`),children:[(0,R.jsx)(Rn,{checked:t===void 0&&g.extras.includes(e),disabled:t!==void 0,"data-type":e,onCheckedChange:t=>{_({...g,extras:t===!0?[...g.extras,e]:g.extras.filter(t=>t!==e)})}}),(0,R.jsx)(`span`,{className:`truncate`,children:u(e)})]},e)})]})]})]}),j>0&&(0,R.jsxs)(`p`,{className:`text-dense text-destructive flex items-start gap-1.5 px-4 pt-3`,"data-testid":`export-blocked`,children:[(0,R.jsx)(ke,{className:`mt-0.5 size-3.5 flex-none`,"aria-hidden":!0}),s.blocked(j)]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`text-lead min-w-0 flex-1 truncate text-xs`,children:r.facts??(t.types.length===1?u(g.type):void 0)}),se]})]}),a.length>0&&(0,R.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:a.map(e=>(0,R.jsx)(hr,{job:e,versions:f,ahead:rr(o,e.id),words:s,reveals:c},e.id))})]})}var vr={png:Qe,jpeg:Qe,webp:Qe,avif:Qe,gif:tt,mp4:at,mov:at,pdf:Ie,docx:$e,md:it,txt:it,html:Ze,xlsx:nt,csv:nt,json:Ye,pptx:Xe,zip:qe,psd:rt,glb:Je};function yr(e){let t=(0,L.useRef)(null),n=e.types.length,r=n<=4?n:Math.min(4,Math.ceil(n/2));return(0,R.jsx)(`div`,{ref:t,role:`radiogroup`,"aria-label":e.label,"data-testid":`export-format`,className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${String(r)}, minmax(0, 1fr))`},onKeyDown:r=>{let i=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(i===0)return;r.preventDefault();let a=e.types[(e.types.indexOf(e.chosen)+i+n)%n];a!==void 0&&(e.onChoose(a),t.current?.querySelector(`[data-type="${a}"]`)?.focus())},children:e.types.map(t=>{let n=vr[t]??et,r=e.chosen===t;return(0,R.jsxs)(Fn,{variant:`box`,checked:r,tabIndex:r?0:-1,"data-type":t,title:e.name(t),className:`min-h-16 min-w-0 justify-center gap-1.5 rounded-lg px-1.5 py-2.5`,onClick:()=>{e.onChoose(t)},children:[(0,R.jsx)(n,{"aria-hidden":!0,strokeWidth:1.5,className:E(`size-5`,r?`text-pencil`:`text-lead`)}),(0,R.jsx)(`span`,{className:`line-clamp-2 w-full text-center text-xs leading-tight text-balance break-words`,children:e.name(t)})]},t)})})}function br(e){let t=/Mac|iPhone|iPad/u.test(navigator.userAgent),n=e.target;return e.code===`KeyE`&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.shiftKey&&!e.altKey&&!(n instanceof HTMLElement&&(n.isContentEditable||n.tagName===`INPUT`||n.tagName===`TEXTAREA`))}function xr(e){let t=i(),r=a(),o=r?.commands===!0,s=r?.item.kind,c=r?.item.kindInfo.exports,l=r?.item.id,u=X.of(r?.locale),d=ur(),f=(0,L.useRef)(null),[p,m]=(0,L.useState)(!1),{all:h,fresh:g,reveals:_}=dr(p);n(`editor/command`,({command:e,open:t})=>{e===`export`&&m(e=>t??!e)}),(0,L.useEffect)(()=>{let e=e=>{br(e)&&(e.preventDefault(),m(e=>!e))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,L.useEffect)(()=>{if(!p||d)return;let e=()=>{m(!1)};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[p,d]);let v=c!==void 0,y=l===void 0?[]:$n(h,l),b=ar(y,g),x=b.at===`running`?b.percent:void 0;if((0,L.useEffect)(()=>{o&&v&&t[`export/state`]({at:b.at,...x===void 0?{}:{percent:x},open:p}).catch(()=>void 0)},[t,o,v,b.at,x,p]),s===void 0||l===void 0||c===void 0)return null;let S=b.at===`running`?`${String(b.percent)}%`:b.at===`queued`?u.queued:b.at===`done`?u.exported:b.at===`failed`?u.exportFailed:u.export,C=(0,R.jsxs)(F,{"data-testid":`export`,"data-state":b.at,"aria-pressed":p,"aria-label":b.at===`running`?u.running(b.percent):S,title:S,onClick:()=>{d&&m(!0)},children:[b.at===`running`&&(0,R.jsx)(fe,{value:b.percent/100}),b.at===`queued`&&(0,R.jsx)(fe,{value:0}),b.at===`done`&&(0,R.jsx)(Ne,{className:`text-success`,"aria-hidden":!0}),b.at===`failed`&&(0,R.jsx)(ke,{className:`text-destructive`,"aria-hidden":!0}),b.at===`idle`&&(0,R.jsx)(Ge,{"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`@max-lg/item:hidden`,children:S})]}),ee=(0,R.jsx)(_r,{kind:s,offer:c,item:l,props:e,jobs:y,all:h,words:u,reveals:_,startRef:f});return d?(0,R.jsxs)(R.Fragment,{children:[!o&&C,(0,R.jsx)(Un,{open:p,onOpenChange:m,children:(0,R.jsxs)(Kn,{side:`bottom`,showCloseButton:!1,className:`gap-0 rounded-t-lg`,children:[(0,R.jsx)(qn,{className:`sr-only`,children:u.export}),ee]})})]}):(0,R.jsxs)(zn,{open:p,onOpenChange:m,children:[o?(0,R.jsx)(Hn,{className:`pointer-events-none fixed top-0 right-2 size-0`}):(0,R.jsx)(Bn,{asChild:!0,children:C}),(0,R.jsxs)(Vn,{align:`end`,sideOffset:o?4:8,className:`w-88 p-0`,onOpenAutoFocus:e=>{f.current&&!f.current.disabled&&(e.preventDefault(),f.current.focus())},children:[!o&&(0,R.jsx)(Ln,{}),ee]})]})}function Sr({...e}){return(0,R.jsx)(jt,{"data-slot":`context-menu`,...e})}function Cr({...e}){return(0,R.jsx)(Nt,{"data-slot":`context-menu-trigger`,...e})}function wr({...e}){return(0,R.jsx)(Bt,{"data-slot":`context-menu-sub`,...e})}function Tr({className:e,inset:t,children:n,...r}){return(0,R.jsxs)(Vt,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:E(`flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,R.jsx)(Re,{className:`ml-auto`})]})}function Er({className:e,...t}){return(0,R.jsx)(Ht,{"data-slot":`context-menu-sub-content`,className:E(`z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}function Dr({className:e,container:t,...n}){return(0,R.jsx)(Pt,{container:t,children:(0,R.jsx)(It,{"data-slot":`context-menu-content`,className:E(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Or({className:e,inset:t,variant:n=`default`,...r}){return(0,R.jsx)(Lt,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:E(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function kr({className:e,...t}){return(0,R.jsx)(Rt,{"data-slot":`context-menu-separator`,className:E(`-mx-1 my-1 h-px bg-border`,e),...t})}function Ar({className:e,...t}){return(0,R.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:E(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var jr=150,Mr=e=>{if(!(e.currentTarget instanceof Element))return;let t=e.currentTarget.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}},Nr=(e,t,n=!0)=>{let r=Mr(t);setTimeout(()=>{e.begin(r,n)},jr)};function $(){let e=i(),t=a();if(t?.notes!==!0)return;let n=X.of(t.locale);return{label:n.markUp,hint:n.markUpHint,begin:(t,n)=>{e[`note/begin`]({...t?{from:t}:{},...n===!0?{selection:n}:{}}).catch(()=>void 0)}}}function Pr(){let e=$();return e?(0,R.jsxs)(F,{title:e.hint,"data-testid":`mark-up`,className:`text-ink`,onClick:t=>{e.begin(Mr(t))},children:[(0,R.jsx)(I,{"aria-hidden":!0}),e.label]}):null}function Fr(e){let t=$();return t?(0,R.jsx)(`div`,{role:`toolbar`,"aria-label":t.label,"data-note-chrome":``,"data-testid":`mark-up-bar`,className:`border-rule bg-sheet shadow-overlay flex items-center rounded-lg border p-0.5 ${e.className??``}`,style:e.style,onPointerDown:e=>{e.stopPropagation()},children:(0,R.jsxs)(F,{title:t.hint,"data-testid":`mark-up-selected`,className:`text-ink`,onClick:e=>{t.begin(Mr(e),!0)},children:[(0,R.jsx)(I,{"aria-hidden":!0}),t.label]})}):null}function Ir({selection:e=!0}={}){let t=$();return t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(He,{}),(0,R.jsxs)(Ae,{title:t.hint,"data-testid":`mark-up-item`,onSelect:n=>{Nr(t,n,e)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t.label]})]}):null}function Lr(){let e=$();return e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(kr,{}),(0,R.jsxs)(Or,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Nr(e,t)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),e.label]})]}):null}var Rr=e=>e instanceof Element&&e.closest(`input, textarea`)!==null;function zr(){let e=$(),t=e!==void 0,[n,r]=(0,L.useState)();return(0,L.useEffect)(()=>{if(!t)return;let e=e=>{e.defaultPrevented||Rr(e.target)||(e.preventDefault(),r({x:e.clientX,y:e.clientY}))};return document.addEventListener(`contextmenu`,e),()=>{document.removeEventListener(`contextmenu`,e)}},[t]),!e||!n?null:(0,R.jsxs)(Be,{open:!0,onOpenChange:e=>{e||r(void 0)},children:[(0,R.jsx)(he,{asChild:!0,children:(0,R.jsx)(`span`,{style:{position:`fixed`,left:n.x,top:n.y,width:0,height:0}})}),(0,R.jsx)(Pe,{align:`start`,className:`text-xs`,children:(0,R.jsxs)(Ae,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Nr(e,t)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),e.label]})})]})}function Br(){let e=a();return e?.share===!0&&e.mode===`edit`&&e.item.kindInfo.share===!0}function Vr(){let e=i(),t=a();if(!Br())return null;let n=X.of(t?.locale);return(0,R.jsxs)(F,{"data-testid":`share`,"aria-label":n.share,title:n.share,onClick:()=>{e[`share/begin`]({}).catch(()=>void 0)},children:[(0,R.jsx)(ct,{"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`@max-lg/item:hidden`,children:n.share})]})}var Hr=800;function Ur(e){let t=e?.state===`saving`||e?.state===`unsaved`,[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{r(!0)},Hr);return()=>{clearTimeout(e),r(!1)}},[t]),e!==void 0&&e.state!==`saved`&&(!t||n)}function Wr({saved:e,words:t}){return(0,R.jsx)(`span`,{"data-testid":`save-state`,"data-state":e.state,title:e.message,className:E(`px-1 text-xs`,e.state===`error`?`text-destructive`:`text-lead`),children:t.saved[e.state]})}function Gr({start:e,saved:t,exports:n}){let i=a(),o=Br(),s=X.of(i?.locale),c=Ur(t),l=r()?.doing!==void 0;if(i?.mode!==`edit`)return e?(0,R.jsx)(`div`,{className:`bg-background flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null;if(i.commands===!0)return(0,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null,(0,R.jsx)(Pn,{}),(0,R.jsx)(xr,{...n}),(0,R.jsx)(zr,{})]});let u=i.item.kindInfo.exports!==void 0;return!e&&!c&&!u&&!o&&!l?(0,R.jsx)(zr,{}):(0,R.jsxs)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:[e,(0,R.jsxs)(`div`,{className:`ml-auto flex flex-none items-center gap-1`,children:[(0,R.jsx)(Nn,{}),t&&c&&(0,R.jsx)(Wr,{saved:t,words:s}),(0,R.jsx)(Pr,{}),(0,R.jsx)(xr,{...n}),(0,R.jsx)(Vr,{})]}),(0,R.jsx)(zr,{})]})}var Kr=e(l(),1),qr=`group-data-[compact]/bar:hidden`,Jr=32,Yr={compact:!1,out:[],firsts:[],order:{}},Xr=(0,L.createContext)(null),Zr=(e,t)=>e.compact===t.compact&&e.out.join(`
|
|
3
|
+
`)===t.out.join(`
|
|
4
|
+
`)&&e.firsts.join(`
|
|
5
|
+
`)===t.firsts.join(`
|
|
6
|
+
`)&&JSON.stringify(e.order)===JSON.stringify(t.order);function Qr({children:e,id:t,priority:n=0,keep:r=!1,ruled:i=!0}){let a=(0,L.useContext)(Xr),o=(0,L.useId)(),s=t??o,c=a?.fit.firsts.includes(s)??!1,l=a?.touch;(0,L.useLayoutEffect)(()=>(l?.(),l),[l]);let u=(0,R.jsx)(`span`,{className:E(`relative flex h-8 flex-none items-center gap-0.5`,!c&&`pl-2`,!c&&i&&`before:bg-rule before:absolute before:top-2 before:bottom-2 before:left-0.75 before:w-px`),children:e});if(!a)return u;let d=a.fit.out.includes(s);return(0,R.jsx)(`span`,{"data-group":s,"data-priority":n,"data-keep":r?``:void 0,className:d?`hidden`:`flex flex-none`,children:d?a.panel?(0,Kr.createPortal)((0,R.jsx)(`span`,{"data-group":s,"data-away":``,className:`flex flex-none`,style:{order:a.fit.order[s]??0},children:u}),a.panel):null:u})}function $r({testid:e,className:t,children:n,...r}){let i=a(),o=X.of(i?.locale),s=(0,L.useRef)(null),[c,l]=(0,L.useState)(null),u=(0,L.useRef)(new Map),[d,f]=(0,L.useState)(Yr),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(0),_=(0,L.useCallback)(()=>{g(e=>e+1)},[]),v=(0,L.useRef)(null);return(0,L.useLayoutEffect)(()=>{let e=new ResizeObserver(()=>{g(e=>e+1)});return v.current=e,s.current&&e.observe(s.current),()=>{e.disconnect(),v.current=null}},[]),(0,L.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=[],n=new Set,r=!0;for(let i of e.querySelectorAll(`[data-group]:not([data-away]), [data-spacer]`)){if(i.dataset.spacer!==void 0){r=!0;continue}let e=i.dataset.group??``;if(t.push({key:e,priority:Number(i.dataset.priority??0),keep:i.dataset.keep!==void 0,at:t.length}),d.out.includes(e))continue;r&&n.add(e),r=!1,v.current?.observe(i);let a=i.getBoundingClientRect().width;a>0&&u.current.set(`${String(d.compact)}:${e}`,a)}for(let e of c?.querySelectorAll(`[data-away]`)??[]){let t=e.getBoundingClientRect().width;t>0&&u.current.set(`${String(d.compact)}:${e.dataset.group??``}`,t)}let i=e.clientWidth,a=(e,t)=>u.current.get(`${String(e)}:${t.key}`),o=e=>t.every(t=>a(e,t)!==void 0),l=e=>t.reduce((t,n)=>t+(a(e,n)??0),0),h=!1,g=[];if(!o(!1)||l(!1)<=i)h=!1;else if(!o(!0)||l(!0)<=i)h=!0;else{h=!0;let e=t.filter(e=>!e.keep).sort((e,t)=>e.priority-t.priority||t.at-e.at),n=new Set,r=l(!0)+Jr;for(let t of e){if(r<=i)break;n.add(t.key),r-=a(!0,t)??0}g=t.filter(e=>n.has(e.key)).map(e=>e.key)}let _={compact:h,out:g,firsts:[...n],order:Object.fromEntries(t.map(e=>[e.key,e.at]))};Zr(_,d)||f(_),g.length===0&&p&&m(!1)},[d,p,h,c,n]),(0,R.jsx)(Xr.Provider,{value:{fit:d,panel:p?c:null,touch:_},children:(0,R.jsxs)(`div`,{...r,ref:s,role:r.role??`toolbar`,"data-testid":e,"data-compact":d.compact?``:void 0,className:E(`group/bar relative flex h-8 min-w-0 flex-1 items-center overflow-hidden`,t),children:[n,d.out.length>0?(0,R.jsxs)(zn,{open:p,onOpenChange:m,children:[(0,R.jsx)(Bn,{asChild:!0,children:(0,R.jsx)(F,{icon:!0,className:`ml-auto flex-none`,"aria-label":o.moreTools,title:o.moreTools,"data-testid":`${e}-more`,onMouseDown:e=>{e.preventDefault()},children:(0,R.jsx)(Ke,{})})}),(0,R.jsx)(Vn,{align:`end`,collisionPadding:8,role:`toolbar`,"aria-label":o.moreTools,"data-testid":`${e}-panel`,"data-compact":d.compact?``:void 0,onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{let t=e.target;t instanceof Element&&t.closest(`[data-radix-popper-content-wrapper]`)&&e.preventDefault()},className:`group/bar w-auto max-w-[calc(100vw-1rem)] overflow-hidden p-1`,children:(0,R.jsx)(`div`,{ref:l,className:`-ml-2 flex flex-wrap items-center`})})]}):null]})})}export{Fn as C,I as E,Rn as S,st as T,Cr as _,Fr as a,Vn as b,$ as c,Or as d,kr as f,Tr as g,Er as h,Gr as i,Sr as l,wr as m,Qr as n,Lr as o,Ar as p,$r as r,Ir as s,qr as t,Dr as u,zn as v,Mn as w,Bn as x,Hn as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,m as r,o as i,s as a,u as o,v as s}from"./react-Bk7NnOLX.js";import{Dt as c,Et as l,Ot as u,Tt as d,yt as f}from"./button-BVQH7zxz.js";import{A as p,B as m,H as h,P as g,Q as _,R as v,S as y,U as b,V as x,W as S,X as C,Y as w,b as T,et as E,g as ee,it as D,nt as O,q as k,rt as A,tt as j,x as te}from"./snapshots-CTS2iez5.js";import{t as ne}from"./jsx-runtime-DePvh3-m.js";import{_ as re,a as ie,c as ae,d as oe,i as M,l as se,n as ce,o as le,p as ue,r as de,u as fe,w as pe}from"./dist-DWKEqAou.js";import{E as me,S as N,_ as P,f as he,h as F,p as ge,t as I,ut as _e}from"./index-CglHrLRS.js";import{t as ve}from"./collaborator-2qfw-8OJ.js";var L=ne(),ye=f({en:{loading:`Drawing the boards`,noBoards:`This image has no boards yet`,boards:`Boards`,zoom:`Zoom`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,zoomFit:`Zoom to Fit`,zoomActual:`Actual Size`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`The boards could not be drawn: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 board`:`${String(e)} boards`},"zh-cn":{loading:`正在绘制画板`,noBoards:`这张图片还没有画板`,boards:`画板`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到适合`,zoomActual:`实际大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`无法绘制画板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 个画板`},"zh-tw":{loading:`正在繪製畫板`,noBoards:`這張圖片還沒有畫板`,boards:`畫板`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適合大小`,zoomActual:`實際大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`無法繪製畫板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 個畫板`},ja:{loading:`ボードを描画中`,noBoards:`この画像にはまだボードがありません`,boards:`ボード`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`実寸`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`ボードを描画できませんでした:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 枚のボード`},ko:{loading:`보드를 그리는 중`,noBoards:`이 이미지에는 아직 보드가 없습니다`,boards:`보드`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`실제 크기`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`보드를 그리지 못했습니다: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`보드 ${String(e)}개`},es:{loading:`Dibujando las mesas de trabajo`,noBoards:`Esta imagen aún no tiene mesas de trabajo`,boards:`Mesas de trabajo`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la ventana`,zoomActual:`Tamaño real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`No se pudieron dibujar las mesas de trabajo: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 mesa de trabajo`:`${String(e)} mesas de trabajo`},fr:{loading:`Dessin des plans de travail`,noBoards:`Cette image n’a pas encore de plan de travail`,boards:`Plans de travail`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Taille réelle`,percent:e=>`${String(e)}\u202f%`,couldNotDraw:e=>`Les plans de travail n’ont pas pu être dessinés : ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 plan de travail`:`${String(e)} plans de travail`},de:{loading:`Zeichenflächen werden gezeichnet`,noBoards:`Dieses Bild hat noch keine Zeichenflächen`,boards:`Zeichenflächen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`An Fenster anpassen`,zoomActual:`Originalgröße`,percent:e=>`${String(e)}\u00a0%`,couldNotDraw:e=>`Die Zeichenflächen konnten nicht gezeichnet werden: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 Zeichenfläche`:`${String(e)} Zeichenflächen`},pt:{loading:`Desenhando as pranchetas`,noBoards:`Esta imagem ainda não tem pranchetas`,boards:`Pranchetas`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à janela`,zoomActual:`Tamanho real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`Não foi possível desenhar as pranchetas: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 prancheta`:`${String(e)} pranchetas`}});function be(){return ye.of(a()?.locale)}var xe=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`;function Se(e){let t=be();return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ce,{id:`zoom`,priority:3,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(me,{asChild:!0,children:(0,L.jsxs)(I,{"aria-label":t.zoom,title:t.zoom,className:`tabular-nums`,"data-testid":`image-zoom`,children:[t.percent(Math.round(e.zoom*100)),(0,L.jsx)(_e,{className:`size-3`})]})}),(0,L.jsxs)(F,{align:`start`,children:[(0,L.jsx)(`div`,{className:`px-1 pb-1`,children:(0,L.jsx)(he,{"aria-label":t.zoom,className:`h-7 tabular-nums`,inputMode:`decimal`,defaultValue:t.percent(Math.round(e.zoom*100)),"data-testid":`image-zoom-typed`,onKeyDown:t=>{if(t.stopPropagation(),t.key!==`Enter`)return;let n=parseFloat(t.currentTarget.value.replace(`,`,`.`));Number.isFinite(n)&&n>0&&e.onZoom(n/100)}},Math.round(e.zoom*100))}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`in`)},children:[t.zoomIn,(0,L.jsx)(N,{children:`${xe}+`})]}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`out`)},children:[t.zoomOut,(0,L.jsx)(N,{children:`${xe}−`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-fit`,onSelect:()=>{e.onZoom(`fit`)},children:[t.zoomFit,(0,L.jsx)(N,{children:`⇧1`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-actual`,onSelect:()=>{e.onZoom(1)},children:[t.zoomActual,(0,L.jsx)(N,{children:`⇧0`})]})]})]})})})}var Ce=`normal.dissolve.darken.multiply.colorBurn.linearBurn.darkerColor.lighten.screen.colorDodge.linearDodge.lighterColor.overlay.softLight.hardLight.vividLight.linearLight.pinLight.hardMix.difference.exclusion.subtract.divide.hue.saturation.color.luminosity.passThrough`.split(`.`),we=e=>typeof e==`object`&&!!e&&(`__allyhubMedia`in e||`sha256`in e),R=w().min(0).max(1),Te=O([R,R,R,R]).refine(([e,t,n,r])=>n>0&&r>0&&e+n<=1+1e-9&&t+r<=1+1e-9,`[x, y, w, h] as shares of the frame, inside it, its sides more than 0`),z=A([j().min(1),h(we,`an imported picture`)]),B=w().min(0).max(100).refine(Number.isFinite,`a percent from 0 to 100`),V=w().min(0).max(1e3).refine(Number.isFinite),H=w().min(-360).max(360),U=v(Ce),Ee=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu,De=/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)$/iu;function Oe(e){if(typeof e!=`string`)return!1;let t=e.trim();if(Ee.test(t)||De.test(t))return!0;if(!/^[a-z]+$/iu.test(t))return!1;let n=globalThis.CSS;return n?n.supports(`color`,t):t.length>2}var W=j().refine(Oe,`a CSS colour (#rrggbb, rgb(…), hsl(…) or a colour's name)`),ke=C({color:W,location:B,midpoint:B.optional()}),Ae=C({stops:m(ke).min(2),style:v([`linear`,`radial`,`angle`,`reflected`,`diamond`]).optional(),angle:H.optional(),scale:w().min(10).max(1e3).optional(),reverse:x().optional()});A([C({color:W}),C({gradient:Ae}),C({pattern:z,scale:w().min(1).max(1e3).optional()})]);var je=C({src:z.optional(),path:j().min(1).optional(),box:Te.optional(),mode:v([`alpha`,`luminance`]).optional(),density:B.optional(),feather:V.optional(),invert:x().optional(),enabled:x().optional()}),Me=A([z,je]),G={enabled:x().optional(),blendMode:U.optional(),opacity:B.optional()},Ne={...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional()},Pe=C({dropShadow:C({...Ne,spread:B.optional()}).optional(),innerShadow:C({...Ne,choke:B.optional()}).optional(),outerGlow:C({...G,color:W.optional(),spread:B.optional(),size:V.optional()}).optional(),innerGlow:C({...G,color:W.optional(),choke:B.optional(),size:V.optional(),source:v([`edge`,`center`]).optional()}).optional(),stroke:C({...G,color:W.optional(),size:V.optional(),position:v([`outside`,`inside`,`center`]).optional()}).optional(),colorOverlay:C({...G,color:W.optional()}).optional(),gradientOverlay:C({...G,gradient:Ae.optional()}).optional(),patternOverlay:C({...G,pattern:z,scale:w().min(1).max(1e3).optional()}).optional(),satin:C({...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional(),invert:x().optional()}).optional(),bevelEmboss:C({...G,style:v([`innerBevel`,`outerBevel`,`emboss`,`pillowEmboss`,`strokeEmboss`]).optional(),technique:v([`smooth`,`chiselHard`,`chiselSoft`]).optional(),depth:w().min(1).max(1e3).optional(),direction:v([`up`,`down`]).optional(),size:V.optional(),soften:V.optional(),angle:H.optional(),altitude:w().min(0).max(90).optional(),highlightMode:U.optional(),highlightColor:W.optional(),highlightOpacity:B.optional(),shadowMode:U.optional(),shadowColor:W.optional(),shadowOpacity:B.optional()}).optional()}),Fe=C({rotation:w().min(-360).max(360).optional(),flipH:x().optional(),flipV:x().optional()});C({blendMode:U.optional(),opacity:B.optional(),fillOpacity:B.optional(),clipping:x().optional(),mask:Me.optional(),effects:Pe.optional(),transform:Fe.optional(),visible:x().optional()});var K=w().min(0).max(255),Ie=C({inputBlack:K.optional(),inputWhite:K.optional(),gamma:w().min(.1).max(9.99).optional(),outputBlack:K.optional(),outputWhite:K.optional()}),Le=O([K,K]),Re=m(Le).min(2).max(16);b(`kind`,[C({kind:k(`levels`),rgb:Ie.optional(),red:Ie.optional(),green:Ie.optional(),blue:Ie.optional()}),C({kind:k(`curves`),rgb:Re.optional(),red:Re.optional(),green:Re.optional(),blue:Re.optional()}),C({kind:k(`brightnessContrast`),brightness:w().min(-150).max(150).optional(),contrast:w().min(-50).max(100).optional(),useLegacy:x().optional()}),C({kind:k(`hueSaturation`),hue:w().min(-180).max(180).optional(),saturation:w().min(-100).max(100).optional(),lightness:w().min(-100).max(100).optional(),colorize:x().optional()}),C({kind:k(`vibrance`),vibrance:w().min(-100).max(100).optional(),saturation:w().min(-100).max(100).optional()}),C({kind:k(`colorBalance`),shadows:O([w(),w(),w()]).optional(),midtones:O([w(),w(),w()]).optional(),highlights:O([w(),w(),w()]).optional(),preserveLuminosity:x().optional()}),C({kind:k(`blackAndWhite`),reds:w().min(-200).max(300).optional(),yellows:w().min(-200).max(300).optional(),greens:w().min(-200).max(300).optional(),cyans:w().min(-200).max(300).optional(),blues:w().min(-200).max(300).optional(),magentas:w().min(-200).max(300).optional()}),C({kind:k(`photoFilter`),color:W.optional(),density:B.optional(),preserveLuminosity:x().optional()}),C({kind:k(`invert`)}),C({kind:k(`threshold`),level:w().int().min(1).max(255).optional()}),C({kind:k(`gradientMap`),gradient:Ae.optional(),reverse:x().optional()}),C({kind:k(`exposure`),exposure:w().min(-20).max(20).optional(),offset:w().min(-.5).max(.5).optional(),gammaCorrection:w().min(.01).max(9.99).optional()})]),C({color:W.optional(),width:V.optional(),alignment:v([`inside`,`center`,`outside`]).optional(),dashes:m(w().min(0).max(1e3)).max(8).optional(),cap:v([`butt`,`round`,`square`]).optional(),join:v([`miter`,`round`,`bevel`]).optional(),opacity:B.optional()}),C({font:j().min(1).optional(),weight:w().int().min(100).max(900).optional(),italic:x().optional(),size:w().min(1).max(4096).optional(),color:W.optional(),tracking:w().min(-1e3).max(1e4).optional(),leading:A([w().min(0).max(5e3),k(`auto`)]).optional(),capitalization:v([`normal`,`allCaps`,`smallCaps`]).optional(),underline:x().optional(),strikeThrough:x().optional()}),C({justification:v([`left`,`center`,`right`,`justifyLeft`,`justifyCenter`,`justifyRight`,`justifyAll`]).optional(),firstLineIndent:w().min(-1296).max(1296).optional(),leftIndent:w().min(0).max(1296).optional(),rightIndent:w().min(0).max(1296).optional(),spaceBefore:w().min(0).max(1296).optional(),spaceAfter:w().min(0).max(1296).optional()});var ze=[`pixel`,`type`,`shape`,`smartObject`,`adjustment`,`fill`,`group`],q=e(s(),1),J=O([w(),w(),w(),w()]),Be=E({text:j(),box:J,size:w(),capHeight:w().optional(),color:j(),font:j(),weight:j(),lineHeight:w(),align:j(),letterSpacing:w().optional()}),Ve=E({key:j(),component:j(),kind:v(ze),parent:j().optional(),hidden:x(),style:_(j(),D()),box:J.optional(),words:m(E({prop:j(),key:j(),text:j()})),texts:m(Be),picture:E({file:j(),source:O([w(),w()]),whole:J,box:J,fit:j(),position:O([w(),w()]),crop:J.optional()}).optional()}),He=E({key:j(),title:j().optional(),width:S().positive(),height:S().positive(),background:j(),picture:y,layers:m(Ve)}),Ue=E({from:S().positive(),to:S().positive()}),We=Ue.extend({key:j().min(1)}),Ge=Ue.extend({key:j().min(1),layers:m(We)}),Ke={"image/versions":g(E({item:p}),E({piece:j(),title:j().optional(),script:j().min(1).optional(),versions:m(E({key:j(),lang:j().optional(),variant:j().optional(),script:p.optional()}))}),`An image's versions, one per combo, and its script in each version's language.`),"image/boards":g(E({...T,height:S().min(16).max(2048).optional()}),E({image:y,width:S().positive(),height:S().positive(),boards:m(E({key:j(),width:S().positive(),height:S().positive(),x:S().nonnegative()}))}),`An image version's boards drawn side by side, in order, at one height: its card and its preview.`),"image/edit":g(E({...T,scale:w().min(.05).max(2).optional()}),E({piece:j(),boards:m(He)}),`An image version's boards as its viewer shows them: each drawn, and its named layers with what each draws, the messages it shows and its picture (what Mark up finds under a mark).`),"image/stage":g(E({...T,board:j().min(1).optional()}),ee,"The address of an image version's stage page, for its viewer's sandboxed frame: a board drawn live, as large as the frame holds it, which moves to another board (`seek` by `part`)."),"image/sources":g(E({item:p}),E({path:p,boards:m(Ge)}),`Where each board and its layers are written in the image's module, by line: what a change to those lines changes.`)},qe=te(Ke),Je=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ye(e,t){for(let n of t){let t=e.find(e=>e.key===n.key);if(!t)return{board:n.key};for(let e of n.layers){let r=t.layers.find(t=>t.key===e.key);if(!r||!Je(r,e))return{board:n.key,layer:e.key}}if(t.layers.length!==n.layers.length)return{board:n.key}}}var Xe=(e,t)=>e.from<=t.to&&t.from<=e.to,Ze=(e,t)=>e.filter(e=>Xe(e,t)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];function Qe(e,t,n=t){let r={from:t,to:n},i=Ze(e,r);if(!i)return;let a=Ze(i.layers,r);return{board:i.key,...a?{layer:a.key}:{}}}var $e=1,et=e=>`data:${e.mime};base64,${e.data}`;function tt(e){let t=i(),[n,r]=(0,q.useState)(),[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(new Map),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(),[h,g]=(0,q.useState)(),[_,v]=(0,q.useState)(0),y=(0,q.useRef)(0),b=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>t.on(`project/changed`,e=>{y.current=e.revision,v(e=>e+1)}),[t]),(0,q.useEffect)(()=>{if(e===void 0)return;let n={on:!0},i=y.current;return qe(t,`image/sources`,{item:e}).then(e=>{n.on&&m(e)},()=>void 0),(async()=>{let a=(await qe(t,`image/versions`,{item:e})).versions.map(e=>({key:e.key,lang:e.lang,variant:e.variant})),s=new Map,l;for(let n of a){let r=await qe(t,`image/edit`,{item:e,version:n.key,scale:$e});l=r.piece,s.set(n.key,{version:n,boards:r.boards})}if(n.on){for(let[e,t]of s){let n=b.current.get(e),r=n&&Ye(n.boards,t.boards);if(r){g({spot:r,version:e,at:Date.now()});break}}b.current=s,r(l),o(a),c(s),u(void 0),f(i)}})().catch(e=>{n.on&&u(e instanceof Error?e.message:String(e))}),()=>{n.on=!1}},[t,e,_]),{item:e,piece:n,versions:a,drawn:s,revision:d,sources:p,landed:h,error:l}}var nt=e=>typeof e==`object`&&!!e&&e.allyhub===!0&&typeof e.type==`string`;function rt(e){let t=i(),[n,a]=(0,q.useState)(),o=r(n),[s,c]=(0,q.useState)(new Map),l=(0,q.useRef)(new Map),u=(0,q.useRef)(1),d=e.wanted.map(e=>e.id).join(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,m as r,o as i,s as a,u as o,v as s}from"./react-Bk7NnOLX.js";import{Dt as c,Et as l,Ot as u,Tt as d,yt as f}from"./button-BVQH7zxz.js";import{A as p,B as m,H as h,P as g,Q as _,R as v,S as y,U as b,V as x,W as S,X as C,Y as w,b as T,et as E,g as ee,it as D,nt as O,q as k,rt as A,tt as j,x as te}from"./snapshots-CTS2iez5.js";import{t as ne}from"./jsx-runtime-DePvh3-m.js";import{_ as re,a as ie,c as ae,d as oe,i as M,l as se,n as ce,o as le,p as ue,r as de,u as fe,w as pe}from"./dist-D7ur8721.js";import{E as me,S as N,_ as P,f as he,h as F,p as ge,t as I,ut as _e}from"./index-BGAXezRR.js";import{t as ve}from"./collaborator-2qfw-8OJ.js";var L=ne(),ye=f({en:{loading:`Drawing the boards`,noBoards:`This image has no boards yet`,boards:`Boards`,zoom:`Zoom`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,zoomFit:`Zoom to Fit`,zoomActual:`Actual Size`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`The boards could not be drawn: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 board`:`${String(e)} boards`},"zh-cn":{loading:`正在绘制画板`,noBoards:`这张图片还没有画板`,boards:`画板`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到适合`,zoomActual:`实际大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`无法绘制画板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 个画板`},"zh-tw":{loading:`正在繪製畫板`,noBoards:`這張圖片還沒有畫板`,boards:`畫板`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適合大小`,zoomActual:`實際大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`無法繪製畫板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 個畫板`},ja:{loading:`ボードを描画中`,noBoards:`この画像にはまだボードがありません`,boards:`ボード`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`実寸`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`ボードを描画できませんでした:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 枚のボード`},ko:{loading:`보드를 그리는 중`,noBoards:`이 이미지에는 아직 보드가 없습니다`,boards:`보드`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`실제 크기`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`보드를 그리지 못했습니다: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`보드 ${String(e)}개`},es:{loading:`Dibujando las mesas de trabajo`,noBoards:`Esta imagen aún no tiene mesas de trabajo`,boards:`Mesas de trabajo`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la ventana`,zoomActual:`Tamaño real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`No se pudieron dibujar las mesas de trabajo: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 mesa de trabajo`:`${String(e)} mesas de trabajo`},fr:{loading:`Dessin des plans de travail`,noBoards:`Cette image n’a pas encore de plan de travail`,boards:`Plans de travail`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Taille réelle`,percent:e=>`${String(e)}\u202f%`,couldNotDraw:e=>`Les plans de travail n’ont pas pu être dessinés : ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 plan de travail`:`${String(e)} plans de travail`},de:{loading:`Zeichenflächen werden gezeichnet`,noBoards:`Dieses Bild hat noch keine Zeichenflächen`,boards:`Zeichenflächen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`An Fenster anpassen`,zoomActual:`Originalgröße`,percent:e=>`${String(e)}\u00a0%`,couldNotDraw:e=>`Die Zeichenflächen konnten nicht gezeichnet werden: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 Zeichenfläche`:`${String(e)} Zeichenflächen`},pt:{loading:`Desenhando as pranchetas`,noBoards:`Esta imagem ainda não tem pranchetas`,boards:`Pranchetas`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à janela`,zoomActual:`Tamanho real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`Não foi possível desenhar as pranchetas: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 prancheta`:`${String(e)} pranchetas`}});function be(){return ye.of(a()?.locale)}var xe=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`;function Se(e){let t=be();return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ce,{id:`zoom`,priority:3,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(me,{asChild:!0,children:(0,L.jsxs)(I,{"aria-label":t.zoom,title:t.zoom,className:`tabular-nums`,"data-testid":`image-zoom`,children:[t.percent(Math.round(e.zoom*100)),(0,L.jsx)(_e,{className:`size-3`})]})}),(0,L.jsxs)(F,{align:`start`,children:[(0,L.jsx)(`div`,{className:`px-1 pb-1`,children:(0,L.jsx)(he,{"aria-label":t.zoom,className:`h-7 tabular-nums`,inputMode:`decimal`,defaultValue:t.percent(Math.round(e.zoom*100)),"data-testid":`image-zoom-typed`,onKeyDown:t=>{if(t.stopPropagation(),t.key!==`Enter`)return;let n=parseFloat(t.currentTarget.value.replace(`,`,`.`));Number.isFinite(n)&&n>0&&e.onZoom(n/100)}},Math.round(e.zoom*100))}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`in`)},children:[t.zoomIn,(0,L.jsx)(N,{children:`${xe}+`})]}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`out`)},children:[t.zoomOut,(0,L.jsx)(N,{children:`${xe}−`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-fit`,onSelect:()=>{e.onZoom(`fit`)},children:[t.zoomFit,(0,L.jsx)(N,{children:`⇧1`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-actual`,onSelect:()=>{e.onZoom(1)},children:[t.zoomActual,(0,L.jsx)(N,{children:`⇧0`})]})]})]})})})}var Ce=`normal.dissolve.darken.multiply.colorBurn.linearBurn.darkerColor.lighten.screen.colorDodge.linearDodge.lighterColor.overlay.softLight.hardLight.vividLight.linearLight.pinLight.hardMix.difference.exclusion.subtract.divide.hue.saturation.color.luminosity.passThrough`.split(`.`),we=e=>typeof e==`object`&&!!e&&(`__allyhubMedia`in e||`sha256`in e),R=w().min(0).max(1),Te=O([R,R,R,R]).refine(([e,t,n,r])=>n>0&&r>0&&e+n<=1+1e-9&&t+r<=1+1e-9,`[x, y, w, h] as shares of the frame, inside it, its sides more than 0`),z=A([j().min(1),h(we,`an imported picture`)]),B=w().min(0).max(100).refine(Number.isFinite,`a percent from 0 to 100`),V=w().min(0).max(1e3).refine(Number.isFinite),H=w().min(-360).max(360),U=v(Ce),Ee=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu,De=/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)$/iu;function Oe(e){if(typeof e!=`string`)return!1;let t=e.trim();if(Ee.test(t)||De.test(t))return!0;if(!/^[a-z]+$/iu.test(t))return!1;let n=globalThis.CSS;return n?n.supports(`color`,t):t.length>2}var W=j().refine(Oe,`a CSS colour (#rrggbb, rgb(…), hsl(…) or a colour's name)`),ke=C({color:W,location:B,midpoint:B.optional()}),Ae=C({stops:m(ke).min(2),style:v([`linear`,`radial`,`angle`,`reflected`,`diamond`]).optional(),angle:H.optional(),scale:w().min(10).max(1e3).optional(),reverse:x().optional()});A([C({color:W}),C({gradient:Ae}),C({pattern:z,scale:w().min(1).max(1e3).optional()})]);var je=C({src:z.optional(),path:j().min(1).optional(),box:Te.optional(),mode:v([`alpha`,`luminance`]).optional(),density:B.optional(),feather:V.optional(),invert:x().optional(),enabled:x().optional()}),Me=A([z,je]),G={enabled:x().optional(),blendMode:U.optional(),opacity:B.optional()},Ne={...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional()},Pe=C({dropShadow:C({...Ne,spread:B.optional()}).optional(),innerShadow:C({...Ne,choke:B.optional()}).optional(),outerGlow:C({...G,color:W.optional(),spread:B.optional(),size:V.optional()}).optional(),innerGlow:C({...G,color:W.optional(),choke:B.optional(),size:V.optional(),source:v([`edge`,`center`]).optional()}).optional(),stroke:C({...G,color:W.optional(),size:V.optional(),position:v([`outside`,`inside`,`center`]).optional()}).optional(),colorOverlay:C({...G,color:W.optional()}).optional(),gradientOverlay:C({...G,gradient:Ae.optional()}).optional(),patternOverlay:C({...G,pattern:z,scale:w().min(1).max(1e3).optional()}).optional(),satin:C({...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional(),invert:x().optional()}).optional(),bevelEmboss:C({...G,style:v([`innerBevel`,`outerBevel`,`emboss`,`pillowEmboss`,`strokeEmboss`]).optional(),technique:v([`smooth`,`chiselHard`,`chiselSoft`]).optional(),depth:w().min(1).max(1e3).optional(),direction:v([`up`,`down`]).optional(),size:V.optional(),soften:V.optional(),angle:H.optional(),altitude:w().min(0).max(90).optional(),highlightMode:U.optional(),highlightColor:W.optional(),highlightOpacity:B.optional(),shadowMode:U.optional(),shadowColor:W.optional(),shadowOpacity:B.optional()}).optional()}),Fe=C({rotation:w().min(-360).max(360).optional(),flipH:x().optional(),flipV:x().optional()});C({blendMode:U.optional(),opacity:B.optional(),fillOpacity:B.optional(),clipping:x().optional(),mask:Me.optional(),effects:Pe.optional(),transform:Fe.optional(),visible:x().optional()});var K=w().min(0).max(255),Ie=C({inputBlack:K.optional(),inputWhite:K.optional(),gamma:w().min(.1).max(9.99).optional(),outputBlack:K.optional(),outputWhite:K.optional()}),Le=O([K,K]),Re=m(Le).min(2).max(16);b(`kind`,[C({kind:k(`levels`),rgb:Ie.optional(),red:Ie.optional(),green:Ie.optional(),blue:Ie.optional()}),C({kind:k(`curves`),rgb:Re.optional(),red:Re.optional(),green:Re.optional(),blue:Re.optional()}),C({kind:k(`brightnessContrast`),brightness:w().min(-150).max(150).optional(),contrast:w().min(-50).max(100).optional(),useLegacy:x().optional()}),C({kind:k(`hueSaturation`),hue:w().min(-180).max(180).optional(),saturation:w().min(-100).max(100).optional(),lightness:w().min(-100).max(100).optional(),colorize:x().optional()}),C({kind:k(`vibrance`),vibrance:w().min(-100).max(100).optional(),saturation:w().min(-100).max(100).optional()}),C({kind:k(`colorBalance`),shadows:O([w(),w(),w()]).optional(),midtones:O([w(),w(),w()]).optional(),highlights:O([w(),w(),w()]).optional(),preserveLuminosity:x().optional()}),C({kind:k(`blackAndWhite`),reds:w().min(-200).max(300).optional(),yellows:w().min(-200).max(300).optional(),greens:w().min(-200).max(300).optional(),cyans:w().min(-200).max(300).optional(),blues:w().min(-200).max(300).optional(),magentas:w().min(-200).max(300).optional()}),C({kind:k(`photoFilter`),color:W.optional(),density:B.optional(),preserveLuminosity:x().optional()}),C({kind:k(`invert`)}),C({kind:k(`threshold`),level:w().int().min(1).max(255).optional()}),C({kind:k(`gradientMap`),gradient:Ae.optional(),reverse:x().optional()}),C({kind:k(`exposure`),exposure:w().min(-20).max(20).optional(),offset:w().min(-.5).max(.5).optional(),gammaCorrection:w().min(.01).max(9.99).optional()})]),C({color:W.optional(),width:V.optional(),alignment:v([`inside`,`center`,`outside`]).optional(),dashes:m(w().min(0).max(1e3)).max(8).optional(),cap:v([`butt`,`round`,`square`]).optional(),join:v([`miter`,`round`,`bevel`]).optional(),opacity:B.optional()}),C({font:j().min(1).optional(),weight:w().int().min(100).max(900).optional(),italic:x().optional(),size:w().min(1).max(4096).optional(),color:W.optional(),tracking:w().min(-1e3).max(1e4).optional(),leading:A([w().min(0).max(5e3),k(`auto`)]).optional(),capitalization:v([`normal`,`allCaps`,`smallCaps`]).optional(),underline:x().optional(),strikeThrough:x().optional()}),C({justification:v([`left`,`center`,`right`,`justifyLeft`,`justifyCenter`,`justifyRight`,`justifyAll`]).optional(),firstLineIndent:w().min(-1296).max(1296).optional(),leftIndent:w().min(0).max(1296).optional(),rightIndent:w().min(0).max(1296).optional(),spaceBefore:w().min(0).max(1296).optional(),spaceAfter:w().min(0).max(1296).optional()});var ze=[`pixel`,`type`,`shape`,`smartObject`,`adjustment`,`fill`,`group`],q=e(s(),1),J=O([w(),w(),w(),w()]),Be=E({text:j(),box:J,size:w(),capHeight:w().optional(),color:j(),font:j(),weight:j(),lineHeight:w(),align:j(),letterSpacing:w().optional()}),Ve=E({key:j(),component:j(),kind:v(ze),parent:j().optional(),hidden:x(),style:_(j(),D()),box:J.optional(),words:m(E({prop:j(),key:j(),text:j()})),texts:m(Be),picture:E({file:j(),source:O([w(),w()]),whole:J,box:J,fit:j(),position:O([w(),w()]),crop:J.optional()}).optional()}),He=E({key:j(),title:j().optional(),width:S().positive(),height:S().positive(),background:j(),picture:y,layers:m(Ve)}),Ue=E({from:S().positive(),to:S().positive()}),We=Ue.extend({key:j().min(1)}),Ge=Ue.extend({key:j().min(1),layers:m(We)}),Ke={"image/versions":g(E({item:p}),E({piece:j(),title:j().optional(),script:j().min(1).optional(),versions:m(E({key:j(),lang:j().optional(),variant:j().optional(),script:p.optional()}))}),`An image's versions, one per combo, and its script in each version's language.`),"image/boards":g(E({...T,height:S().min(16).max(2048).optional()}),E({image:y,width:S().positive(),height:S().positive(),boards:m(E({key:j(),width:S().positive(),height:S().positive(),x:S().nonnegative()}))}),`An image version's boards drawn side by side, in order, at one height: its card and its preview.`),"image/edit":g(E({...T,scale:w().min(.05).max(2).optional()}),E({piece:j(),boards:m(He)}),`An image version's boards as its viewer shows them: each drawn, and its named layers with what each draws, the messages it shows and its picture (what Mark up finds under a mark).`),"image/stage":g(E({...T,board:j().min(1).optional()}),ee,"The address of an image version's stage page, for its viewer's sandboxed frame: a board drawn live, as large as the frame holds it, which moves to another board (`seek` by `part`)."),"image/sources":g(E({item:p}),E({path:p,boards:m(Ge)}),`Where each board and its layers are written in the image's module, by line: what a change to those lines changes.`)},qe=te(Ke),Je=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ye(e,t){for(let n of t){let t=e.find(e=>e.key===n.key);if(!t)return{board:n.key};for(let e of n.layers){let r=t.layers.find(t=>t.key===e.key);if(!r||!Je(r,e))return{board:n.key,layer:e.key}}if(t.layers.length!==n.layers.length)return{board:n.key}}}var Xe=(e,t)=>e.from<=t.to&&t.from<=e.to,Ze=(e,t)=>e.filter(e=>Xe(e,t)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];function Qe(e,t,n=t){let r={from:t,to:n},i=Ze(e,r);if(!i)return;let a=Ze(i.layers,r);return{board:i.key,...a?{layer:a.key}:{}}}var $e=1,et=e=>`data:${e.mime};base64,${e.data}`;function tt(e){let t=i(),[n,r]=(0,q.useState)(),[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(new Map),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(),[h,g]=(0,q.useState)(),[_,v]=(0,q.useState)(0),y=(0,q.useRef)(0),b=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>t.on(`project/changed`,e=>{y.current=e.revision,v(e=>e+1)}),[t]),(0,q.useEffect)(()=>{if(e===void 0)return;let n={on:!0},i=y.current;return qe(t,`image/sources`,{item:e}).then(e=>{n.on&&m(e)},()=>void 0),(async()=>{let a=(await qe(t,`image/versions`,{item:e})).versions.map(e=>({key:e.key,lang:e.lang,variant:e.variant})),s=new Map,l;for(let n of a){let r=await qe(t,`image/edit`,{item:e,version:n.key,scale:$e});l=r.piece,s.set(n.key,{version:n,boards:r.boards})}if(n.on){for(let[e,t]of s){let n=b.current.get(e),r=n&&Ye(n.boards,t.boards);if(r){g({spot:r,version:e,at:Date.now()});break}}b.current=s,r(l),o(a),c(s),u(void 0),f(i)}})().catch(e=>{n.on&&u(e instanceof Error?e.message:String(e))}),()=>{n.on=!1}},[t,e,_]),{item:e,piece:n,versions:a,drawn:s,revision:d,sources:p,landed:h,error:l}}var nt=e=>typeof e==`object`&&!!e&&e.allyhub===!0&&typeof e.type==`string`;function rt(e){let t=i(),[n,a]=(0,q.useState)(),o=r(n),[s,c]=(0,q.useState)(new Map),l=(0,q.useRef)(new Map),u=(0,q.useRef)(1),d=e.wanted.map(e=>e.id).join(`
|
|
2
2
|
`);return(0,q.useEffect)(()=>{if(e.item===void 0)return;let n=!0,r=e.item;return Promise.all(e.wanted.slice(0,8).map(e=>qe(t,`image/stage`,{item:r,version:e.version,board:e.board}).then(t=>({w:e,r:t}),()=>void 0))).then(e=>{if(!n)return;let t=e.find(e=>e!==void 0);t&&a(t.r.probe),c(t=>{let n=new Map;for(let r of e){if(!r)continue;let e=t.get(r.w.id),i=()=>({n:u.current++,src:r.r.url,drawn:!1});e?.shown?e.shown.src===r.r.url?n.set(r.w.id,e):n.set(r.w.id,{shown:e.shown,pending:e.pending?.src===r.r.url?e.pending:i()}):n.set(r.w.id,{shown:i(),pending:void 0})}return n})}),()=>{n=!1}},[t,e.item,d,e.revision]),(0,q.useEffect)(()=>{let e=e=>{if(!nt(e.data)||e.data.type!==`ready`)return;let t;for(let[n,r]of l.current)r.contentWindow===e.source&&(t=n);t!==void 0&&c(e=>{let n=!1,r=new Map(e);for(let[i,a]of e)a.shown?.n===t&&!a.shown.drawn?(r.set(i,{...a,shown:{...a.shown,drawn:!0}}),n=!0):a.pending?.n===t&&(r.set(i,{shown:{...a.pending,drawn:!0},pending:void 0}),n=!0);return n?r:e})};return addEventListener(`message`,e),()=>{removeEventListener(`message`,e)}},[]),{frame:(e,t)=>{let n=s.get(e);return!n||o===void 0?null:(0,L.jsx)(at,{frames:n,sandbox:o,els:l,picture:t})},drawn:e=>s.get(e)?.shown?.drawn===!0}}function it(e){let t=/^data:([^;,]+);base64,(.*)$/su.exec(e);return t?.[1]!==void 0&&t[2]!==void 0?{mime:t[1],data:t[2]}:void 0}function at({frames:e,sandbox:t,els:n,picture:r}){let i=(0,q.useRef)(null),a=()=>{let e=i.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0};o({element:()=>i.current,pictures:()=>{let e=a(),t=it(r);return Promise.resolve(e&&t?[{rect:e,...t}]:[])}});let s=(e,r)=>(0,L.jsx)(`iframe`,{ref:t=>{t?n.current.set(e.n,t):n.current.delete(e.n),r||(i.current=t)},src:e.src,title:``,tabIndex:-1,...t?{sandbox:`allow-scripts`}:{},"data-testid":r?`image-live-pending`:`image-live`,"data-drawn":e.drawn?``:void 0,className:`pointer-events-none absolute inset-0 size-full border-0`,style:{opacity:!r&&e.drawn?1:0}},e.n);return(0,L.jsxs)(L.Fragment,{children:[e.shown?s(e.shown,!1):null,e.pending?s(e.pending,!0):null]})}function ot(e,t,n,r){let i=e=>({x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}),a=c(n,i),o=t=>st(e,t),s=[...e.layers].reverse(),l=e=>!e.hidden&&e.shown!==void 0&&u(n,{x:t.x+e.shown.left*t.zoom,y:t.y+e.shown.top*t.zoom,width:e.shown.width*t.zoom,height:e.shown.height*t.zoom}),d=s.filter(e=>e.kind!==`group`&&!o(e)&&l(e)),f=d.length>0?d:s.filter(e=>e.kind!==`group`&&l(e)),p=new Set,m=new Map(e.layers.map(e=>[e.key,e.parent]));for(let e of f)for(let t=e.parent;t!==void 0;t=m.get(t))p.add(t);let h=new Set([...f.map(e=>e.key),...p]);return s.filter(e=>h.has(e.key)).map(o=>{let s=[{in:`board ${e.key}`,width:e.width,height:e.height,...a,scale:1/t.zoom}],l=o.info.picture;if(l&&l.whole[2]>0&&l.whole[3]>0){let[e,r,a,o]=l.whole,[u,d]=l.source;s.push({in:`the picture`,file:l.file,width:u,height:d,...c(n,t=>{let n=i(t);return{x:(n.x-e)*u/a,y:(n.y-r)*d/o}}),scale:u/a/t.zoom})}return{...ct(e,o,r),regions:s}})}var st=(e,t)=>(t.kind===`adjustment`||t.kind===`fill`)&&t.box!==void 0&&t.box.left<=0&&t.box.top<=0&&t.box.left+t.box.width>=e.width&&t.box.top+t.box.height>=e.height;function ct(e,t,n){let r=t.info.picture,i=t.info.words[0]?.text??t.info.texts[0]?.text,a=n.lineOf(t.key);return{name:`layer ${t.name===t.key?`"${t.key}"`:`"${t.key}" (${t.name})`}, a ${t.kind}${r?` of ${r.file}`:``}, of board ${e.key}`,source:{path:n.file,...a===void 0?{}:{line:a}},...i===void 0?{}:{text:i}}}function lt(e,t,n){let r=(n.x-t.x)/t.zoom,i=(n.y-t.y)/t.zoom,a=e=>!e.hidden&&e.kind!==`group`&&e.shown!==void 0&&r>=e.shown.left&&r<=e.shown.left+e.shown.width&&i>=e.shown.top&&i<=e.shown.top+e.shown.height,o=[...e.layers].reverse();return o.find(t=>a(t)&&!st(e,t))??o.find(a)}function ut(e,t,n,r){if(n.shown!==void 0)return{element:ct(e,n,r),outline:l({x:t.x+n.shown.left*t.zoom,y:t.y+n.shown.top*t.zoom,width:n.shown.width*t.zoom,height:n.shown.height*t.zoom})}}function dt(e,t){let n=e.split(`
|
|
3
3
|
`).findIndex(e=>RegExp(`key:\\s*["'\`]${t.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}["'\`]`,`u`).test(e));return n<0?void 0:n+1}var ft=e=>e===void 0?void 0:{left:e[0],top:e[1],width:e[2],height:e[3]};function pt(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:void 0}function mt(e){let t=new Map;for(let n of e){let e=n.info.style.clipping===!0&&n.kind!==`group`,r=e?t.get(n.parent):void 0;n.shown=r===void 0?n.box:r.shown&&n.box?pt(n.box,r.shown):void 0,e||t.set(n.parent,n)}}function ht(e,t,n){let r=t.layers.map(e=>({key:e.key,name:e.key,component:e.component,kind:e.kind,hidden:e.hidden,parent:e.parent,box:ft(e.box),shown:void 0,info:e}));return mt(r),{version:e,key:t.key,title:t.title??t.key,width:t.width,height:t.height,background:t.background,picture:n,layers:r}}function gt(e,t,n){return e.flatMap(e=>{let r=t.get(e.key);return r?[r.boards.map(t=>ht(e,t,n(t.picture)))]:[]})}var Y=48,_t=80,vt=20,yt=22,bt=26,X=40,Z=(e,t)=>`${e} ${t}`;function xt(e){let t=[];for(let n of e)n.forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.width)});return t}var St=e=>Math.max(vt,_t*e);function Ct(e,t){let n=xt(e),r=e.length>1;return{width:n.reduce((e,n)=>e+n*t,0)+St(t)*Math.max(0,n.length-1)+96,height:e.reduce((e,n)=>e+Math.max(0,...n.map(e=>e.height))*t+yt+(r?bt:0),0)+X*Math.max(0,e.length-1)+96}}function wt(e,t,n,r){let i=xt(e),a=St(t),o=Ct(e,t),s=Math.max(0,((r?.width??0)-o.width)/2),c=Math.max(0,((r?.height??0)-o.height)/2),l=new Map,u=[],d=c+Y,f=0,p=e.length>1;for(let r of e){let e=r[0];p&&e&&(u.push({x:s+Y,y:d,label:n(e)}),d+=bt);let o=d;d+=yt;let c=s+Y,m=0;r.forEach((e,n)=>{l.set(Z(e.version.key,e.key),{x:c,y:d,labelY:o}),c+=(i[n]??e.width)*t+a,m=Math.max(m,e.height*t)}),f=Math.max(f,c-a+Y+s),d+=m+X}return{width:f,height:d-X+Y+c,boards:l,rows:u}}function Tt(e,t){let n=xt(e);if(n.length===0||t.width<=0||t.height<=0)return 1;let r=n.reduce((e,t)=>e+t,0),i=n.length-1,a=(t.width-96)/(r+_t*i),o=_t*a>=vt?a:(t.width-96-vt*i)/r,s=e.reduce((e,t)=>e+Math.max(...t.map(e=>e.height)),0),c=e.length*(yt+(e.length>1?bt:0))+X*(e.length-1),l=Math.min(o,(t.height-96-c)/s,1);return Math.max(.02,l)}var Q=e=>`${String(e)}px`,$=e=>`${String(e*100)}%`;function Et(e){let t=e.board.layers.find(t=>t.key===e.layer)?.shown;return t?(0,L.jsx)(`div`,{"data-note-chrome":``,"data-testid":e.selected?`image-selected`:`image-hovered`,"data-layer":e.layer,className:e.selected?`outline-pencil absolute shadow-[0_0_0_4px_var(--color-sheet),inset_0_0_0_2px_var(--color-sheet)] outline-2`:`outline-pencil absolute shadow-[0_0_0_2px_var(--color-sheet),inset_0_0_0_1px_var(--color-sheet)] outline-1`,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)},children:e.selected&&e.bar!==void 0?(0,L.jsx)(`div`,{className:`pointer-events-auto absolute top-full left-1/2 mt-2 -translate-x-1/2`,children:e.bar}):null}):null}function Dt(e){let t=(e.agent.layer===void 0?void 0:e.board.layers.find(t=>t.key===e.agent.layer))?.box;return t?(0,L.jsx)(ve,{"data-testid":`image-agent`,label:e.agent.label,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)}}):(0,L.jsx)(ve,{"data-testid":`image-agent`,label:e.agent.label,flag:`end`,className:`inset-0`})}function Ot(e){let t=be(),{board:n,zoom:r}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-lead text-micro absolute flex h-5 items-end gap-2 truncate`,style:{left:Q(e.at.x),top:Q(e.at.labelY),width:Q(n.width*r)},"data-testid":`image-board-label`,children:[(0,L.jsx)(`span`,{className:`text-ink truncate font-medium`,children:n.title}),n.title.replace(/\s/gu,``).toLowerCase().replace(`×`,`x`).includes(`${String(n.width)}x${String(n.height)}`)?null:(0,L.jsx)(`span`,{className:`tabular-nums`,children:t.size(n.width,n.height)})]}),(0,L.jsxs)(`div`,{className:`bg-sheet absolute overflow-hidden shadow-[0_0_0_1px_var(--color-rule)]`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},"data-testid":`image-board`,"data-board":n.key,"data-version":n.version.key,children:[(0,L.jsx)(`img`,{src:n.picture,alt:``,draggable:!1,className:`absolute inset-0 size-full max-w-none select-none`}),e.frame]}),e.agent||e.hovered!==void 0||e.selected!==void 0?(0,L.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},children:[e.agent?(0,L.jsx)(Dt,{board:n,agent:e.agent}):null,e.hovered===void 0?null:(0,L.jsx)(Et,{board:n,layer:e.hovered,selected:!1}),e.selected===void 0?null:(0,L.jsx)(Et,{board:n,layer:e.selected,selected:!0,bar:e.selectionBar})]}):null]})}function kt({ref:e,...t}){let n=(0,q.useRef)(null),r=(0,q.useCallback)(t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),i=(0,q.useRef)(t.onZoomAt);return(0,q.useEffect)(()=>{i.current=t.onZoomAt}),(0,q.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=e.getBoundingClientRect();i.current(Math.exp(-t.deltaY/200),{x:t.clientX-n.left,y:t.clientY-n.top})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]),(0,L.jsx)(`div`,{ref:r,className:`bg-stone focus-visible:outline-pencil relative min-h-0 min-w-0 flex-1 overflow-auto outline-none focus-visible:-outline-offset-1 focus-visible:outline-1`,tabIndex:0,role:`application`,"aria-label":t.label,"data-testid":`image-surface`,style:{cursor:t.cursor},onPointerDown:t.onPointerDown,onPointerMove:t.onPointerMove,onPointerUp:t.onPointerUp,onPointerCancel:t.onPointerUp,onLostPointerCapture:t.onPointerUp,onPointerLeave:t.onPointerLeave,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,children:(0,L.jsxs)(`div`,{className:`relative`,style:{width:Q(t.layout.width),height:Q(t.layout.height)},"data-testid":`image-world`,children:[t.layout.rows.map(e=>(0,L.jsx)(`div`,{className:`text-lead absolute text-xs font-medium`,style:{left:Q(e.x),top:Q(e.y)},"data-testid":`image-row-label`,children:e.label},e.y)),t.rows.flatMap(e=>e.map(e=>{let n=Z(e.version.key,e.key),r=t.layout.boards.get(n);return r?(0,L.jsx)(Ot,{board:e,zoom:t.zoom,at:r,frame:t.frame?.(n,e.picture),agent:t.agent?.id===n?{label:t.agent.label,layer:t.agent.layer}:void 0,hovered:t.hovered?.id===n?t.hovered.layer:void 0,selected:t.selected?.id===n?t.selected.layer:void 0,selectionBar:t.selectionBar},n):null}))]})})}function At(e,t){if(e!==void 0)try{return new Intl.DisplayNames([t??`en`],{type:`language`}).of(e)}catch{return e}}var jt=3e4;function Mt(e){let t=e?.board??e?.part;if(typeof t!=`string`)return;let n=e?.layer;return typeof n==`string`?{board:t,layer:n}:{board:t}}var Nt=e=>e instanceof Element&&e.closest(`input, textarea, [contenteditable='true'], [role='combobox']`)!==null;function Pt(e){return e.bar(e.tools)}function Ft(e){let r=be(),o=i(),s=a(),c=(0,q.useMemo)(()=>gt(e.data.versions,e.data.drawn,et),[e.data.versions,e.data.drawn]),l=c.flat(),u=(0,q.useRef)(null),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!0),[g,_]=(0,q.useState)(`default`),[v,y]=(0,q.useState)(!1),b=(0,q.useRef)(void 0),x=e=>[At(e.version.lang,s?.locale),e.version.variant].filter(e=>e!==void 0).join(` · `)||e.version.key,[S,C]=(0,q.useState)();(0,q.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{C(t=>t?.width===e.offsetWidth&&t.height===e.offsetHeight?t:{width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let w=m&&S&&c.length>0?Tt(c,S):f??1,T=(0,q.useMemo)(()=>wt(c,w,x,S),[c,w,s?.locale,S]),E=(0,q.useRef)(void 0);(0,q.useLayoutEffect)(()=>{let e=u.current,t=E.current;if(!e||!t)return;E.current=void 0;let n=w/t.from;e.scrollLeft=(e.scrollLeft+t.at.x)*n-t.at.x,e.scrollTop=(e.scrollTop+t.at.y)*n-t.at.y},[w]);let ee=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(ee.current||e.board===void 0||c.length===0)return;let t=u.current?.querySelector(`[data-testid="image-board"][data-board="${CSS.escape(e.board)}"]`);t&&(ee.current=!0,t.scrollIntoView({block:`nearest`,inline:`nearest`}))},[e.board,c.length,T]);let{agent:D,following:O}=t(),k=pe(),A=(()=>{if(D?.doing===void 0)return;let{landed:t,sources:n}=e.data,r=D.source,i=r?.path!==void 0&&r.path===n?.path&&r.from!==void 0?Qe(n.boards,r.from,r.to):void 0,a=t&&t.at>=D.at-jt?t:void 0,o=Mt(D.place)??i??a?.spot;if(!o)return;let s=l.filter(e=>e.key===o.board),c=s.find(e=>e.version.key===a?.version)??s[0];if(!c)return;let u=c.layers.some(e=>e.key===o.layer)?o.layer:void 0;return{id:Z(c.version.key,c.key),layer:u,label:k(D)}})(),j=O&&A?`${A.id}\n${A.layer??``}`:void 0;(0,q.useEffect)(()=>{let e=u.current;if(j===void 0||!e)return;let[t=``,n=``]=j.split(`
|
|
4
4
|
`),r=l.find(e=>Z(e.version.key,e.key)===t),i=T.boards.get(t);if(!r||!i)return;let a=r.layers.find(e=>e.key===n)?.box??{left:0,top:0,width:r.width,height:r.height},o=(e,t,n,r)=>t+96>r||e-48<n?e-48:e+t+48>n+r?e+t+48-r:n;e.scrollTo({left:o(i.x+a.left*w,a.width*w,e.scrollLeft,e.clientWidth),top:o(i.y+a.top*w,a.height*w,e.scrollTop,e.clientHeight)})},[j]);let te=rt({item:e.data.item,wanted:l.map(e=>({id:Z(e.version.key,e.key),version:e.version.key,board:e.key})),revision:e.data.revision}),ne=(e,t)=>{h(!1);let n=u.current;E.current={at:t??{x:(n?.clientWidth??0)/2,y:(n?.clientHeight??0)/2},from:w},p(Math.min(8,Math.max(.02,e)))},M=e=>{e===`fit`?h(!0):ne(typeof e==`number`?e:w*(e===`in`?1.25:.8))},ce=(e,t)=>u.current?.querySelector(`[data-testid="image-board"][data-version="${CSS.escape(e)}"][data-board="${CSS.escape(t)}"]`)?.getBoundingClientRect(),de=(0,q.useRef)(``),me=e=>{for(let t of l){let n=ce(t.version.key,t.key);if(n&&e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return{b:t,r:n}}},N=ae()!==void 0,[P,he]=(0,q.useState)(),[F,ge]=(0,q.useState)(),I=(e,t)=>({x:e.x,y:e.y,zoom:e.width/t.width}),_e=e=>{let t=me(e),n=t?lt(t.b,I(t.r,t.b),e):void 0;return t&&n?{id:Z(t.b.version.key,t.b.key),layer:n.key}:void 0},ve=(e,t)=>e?.id===t?.id&&e?.layer===t?.layer,ye={file:e.entry,lineOf:e=>dt(de.current,e)},xe=t=>{let n=At(t.version.lang,`en`);return`on board ${t.key}${n===void 0||e.data.versions.length<2?``:` (${n})`}`},Se=e=>{u.current?.focus({preventScroll:!0});let t=u.current;if(N&&!v&&e.button!==1){let t=_e({x:e.clientX,y:e.clientY});(e.button===0||t)&&ge(t)}(v||e.button===1)&&t&&(e.currentTarget.setPointerCapture(e.pointerId),b.current={x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},_(`grabbing`))},Ce=()=>{b.current&&(b.current=void 0,_(v?`grab`:`default`))};return n({hold:async()=>(de.current=await o[`files/read`]({path:e.entry}).then(e=>e.text,()=>``),{key:`${e.entry}@${String(e.data.revision)}`,what:`The image ${e.entry}, its boards side by side${e.data.versions.length>1?`, a version a row`:``}`,source:{path:e.entry}}),locate:t=>{let n=d(t)[0],r=n?me(n):void 0;if(!n||!r)return Promise.resolve({elements:[]});let i=At(r.b.version.lang,`en`),a=e=>`${String(Math.round(Math.min(1,Math.max(0,e))*100))}%`,o=a((n.x-r.r.x)/r.r.width),s=a((n.y-r.r.y)/r.r.height);return Promise.resolve({elements:ot(r.b,{x:r.r.x,y:r.r.y,zoom:r.r.width/r.b.width},t,{file:e.entry,lineOf:e=>dt(de.current,e)}),where:`on board ${r.b.key}${i===void 0||e.data.versions.length<2?``:` (${i})`}, at ${o} across and ${s} down it`})},pick:e=>{let t=me(e),n=t?lt(t.b,I(t.r,t.b),e):void 0,r=t&&n?ut(t.b,I(t.r,t.b),n,ye):void 0;return Promise.resolve(t&&r?{...r,where:xe(t.b)}:void 0)},selected:()=>{let e=l.find(e=>Z(e.version.key,e.key)===F?.id),t=e?.layers.find(e=>e.key===F?.layer),n=e?ce(e.version.key,e.key):void 0,r=e&&t&&n?ut(e,I(n,e),t,ye):void 0;return Promise.resolve(e&&r?[{...r,where:xe(e)}]:[])}}),(0,L.jsxs)(`div`,{className:`relative flex size-full min-h-0 flex-col`,"data-testid":`image-viewer`,children:[(0,L.jsx)(Pt,{bar:e.bar,tools:{zoom:w,onZoom:M}}),(0,L.jsxs)(se,{children:[(0,L.jsx)(re,{asChild:!0,children:(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,L.jsx)(kt,{ref:u,rows:c,layout:T,zoom:w,cursor:v&&g==="default"?`grab`:g,frame:te.frame,agent:A,hovered:ve(P,F)?void 0:P,selected:F,selectionBar:(0,L.jsx)(ie,{}),onPointerLeave:()=>{he(void 0)},onPointerDown:Se,onPointerMove:e=>{let t=b.current,n=u.current;if(t&&e.buttons===0){Ce();return}if(t&&n){n.scrollLeft=t.left-(e.clientX-t.x),n.scrollTop=t.top-(e.clientY-t.y);return}if(!N)return;let r=v||e.buttons!==0?void 0:_e({x:e.clientX,y:e.clientY});ve(r,P)||he(r)},onPointerUp:Ce,onKeyDown:e=>{if(Nt(e.target))return;let t=e.metaKey||e.ctrlKey,n=e.key===`Escape`&&F?()=>{ge(void 0)}:e.key===` `?()=>{e.repeat||y(!0),_(`grab`)}:e.shiftKey&&e.code===`Digit1`?()=>{M(`fit`)}:e.shiftKey&&e.code===`Digit0`?()=>{M(1)}:t&&(e.key===`=`||e.key===`+`)?()=>{M(`in`)}:t&&e.key===`-`?()=>{M(`out`)}:void 0;n&&(e.preventDefault(),n())},onKeyUp:e=>{e.key===` `&&(y(!1),_(`default`))},onZoomAt:(e,t)=>{ne(w*e,t)},label:r.boards})})}),(0,L.jsxs)(fe,{className:`w-60`,"data-testid":`image-menu`,children:[(0,L.jsxs)(oe,{onSelect:()=>{M(`fit`)},children:[r.zoomFit,(0,L.jsx)(ue,{children:`⇧1`})]}),(0,L.jsx)(le,{})]})]})]})}var It=e=>typeof e==`object`&&!!e&&typeof e.board==`string`;function Lt(){let e=be(),t=a(),n=tt(t?.item.id);if(n.piece===void 0||t===void 0)return(0,L.jsx)(`div`,{className:`text-lead flex size-full items-center justify-center text-sm`,"data-testid":`image-editor`,"data-state":n.error===void 0?`loading`:`error`,children:n.error===void 0?e.loading:e.couldNotDraw(n.error)});let r=It(t.place)?t.place:void 0;return(0,L.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`image-editor`,"data-state":`ready`,children:[(0,L.jsx)(Ft,{entry:t.item.entry,data:n,board:r?.board,bar:t=>(0,L.jsx)(M,{start:(0,L.jsx)(de,{testid:`image-bar`,"aria-label":e.zoom,children:(0,L.jsx)(Se,{...t})}),exports:{versions:n.versions.map(e=>({key:e.key,label:e.lang??e.key})),facts:e.boardCount(n.drawn.values().next().value?.boards.length??0)}})}),n.drawn.size>0&&[...n.drawn.values()].every(e=>e.boards.length===0)?(0,L.jsx)(`p`,{className:`text-lead p-6 text-sm`,children:e.noBoards}):null]})}export{Lt as ImageEditor,Lt as default,ye as WORDS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{a as r,d as i,f as a,o,s,v as c}from"./react-Bk7NnOLX.js";import{Et as l,Ot as u,Tt as d,gt as f,yt as p}from"./button-BVQH7zxz.js";import{T as m}from"./snapshots-CTS2iez5.js";import{t as h}from"./session-CUCSWPTE.js";import{t as g}from"./jsx-runtime-DePvh3-m.js";import{t as _}from"./createLucideIcon-REX213UO.js";import{t as v}from"./audio-lines-1s1eRs4Q.js";import{
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{a as r,d as i,f as a,o,s,v as c}from"./react-Bk7NnOLX.js";import{Et as l,Ot as u,Tt as d,gt as f,yt as p}from"./button-BVQH7zxz.js";import{T as m}from"./snapshots-CTS2iez5.js";import{t as h}from"./session-CUCSWPTE.js";import{t as g}from"./jsx-runtime-DePvh3-m.js";import{t as _}from"./createLucideIcon-REX213UO.js";import{t as v}from"./audio-lines-1s1eRs4Q.js";import{E as ee,_ as te,b as ne,c as re,d as ie,f as ae,i as oe,l as se,o as ce,p as le,u as ue,v as y,w as de,x as b}from"./dist-D7ur8721.js";import{t as fe}from"./file-exclamation-point-C_fX4fpI.js";import{t as x}from"./group-pebHQTdP.js";import{c as pe,i as S,l as me,n as he,o as ge,r as _e,t as ve}from"./syntax-DSsHrzWF.js";import{t as ye}from"./minus-D1tgAHbU.js";import{n as be,t as xe}from"./undo-2-DUGGyBdX.js";import{t as Se}from"./sticky-note-C5qUDHhC.js";import{n as Ce,t as C}from"./swatch-S8YuBYyj.js";import{K as we,Q as Te,_t as w,f as Ee,nt as De,rt as T,t as E,tt as D}from"./index-BGAXezRR.js";import{c as Oe,l as ke,n as Ae,o as je,r as Me,t as Ne}from"./dist-D2a_y4AE.js";import{t as Pe}from"./collaborator-2qfw-8OJ.js";import{t as O}from"./row-dgHEAE7h.js";import{A as k,F as A,L as Fe,M as Ie,R as j,S as Le,_ as Re,a as ze,b as M,g as Be,h as Ve,i as He,j as Ue,m as We,n as Ge,p as Ke,r as qe,t as Je,v as Ye,x as Xe,y as Ze,z as Qe}from"./syntax-C0iPON60.js";var $e={".html":`text/html; charset=utf-8`,".js":`text/javascript; charset=utf-8`,".mjs":`text/javascript; charset=utf-8`,".css":`text/css; charset=utf-8`,".json":`application/json; charset=utf-8`,".txt":`text/plain; charset=utf-8`,".md":`text/plain; charset=utf-8`,".mdx":`text/plain; charset=utf-8`,".csv":`text/plain; charset=utf-8`,".yaml":`text/plain; charset=utf-8`,".svg":`image/svg+xml`,".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".gif":`image/gif`,".avif":`image/avif`,".woff2":`font/woff2`,".woff":`font/woff`,".ttf":`font/ttf`,".otf":`font/otf`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".m4a":`audio/mp4`,".ogg":`audio/ogg`,".aac":`audio/aac`,".flac":`audio/flac`,".mp4":`video/mp4`,".webm":`video/webm`,".mov":`video/quicktime`,".pdf":`application/pdf`,".wasm":`application/wasm`,".glb":`model/gltf-binary`,".gltf":`model/gltf+json`,".bin":`application/octet-stream`,".ktx2":`image/ktx2`,".hdr":`image/vnd.radiance`,".exr":`image/x-exr`,".htm":`text/html; charset=utf-8`,".map":`application/json; charset=utf-8`,".webmanifest":`application/manifest+json`,".xml":`application/xml`,".rss":`application/rss+xml`,".atom":`application/atom+xml`,".ico":`image/x-icon`,".vtt":`text/vtt; charset=utf-8`,".zip":`application/zip`},et=e=>$e[/\.[^./]+$/u.exec(e)?.[0].toLowerCase()??``]??`application/octet-stream`,tt=_(`focus`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]),nt=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),rt=_(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),it=_(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),at=[`1`,`2`,`3`,`4`,`5`,`6`],ot=[`top`,`right`,`bottom`,`left`],N=[`none`,`arrow`],P={nodes:[],edges:[],top:{}},F=e=>typeof e==`object`&&!!e&&!Array.isArray(e),I=e=>typeof e==`string`?e:void 0,st=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,ct=(e,t)=>typeof t==`string`&&e.includes(t)?t:void 0;function lt(e){let t=I(e.id),n=I(e.type),r=st(e.x),i=st(e.y),a=st(e.width),o=st(e.height);if(t!==void 0&&t!==``&&n!==void 0&&r!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{id:t,type:n,x:r,y:i,width:a,height:o,color:I(e.color),text:I(e.text),file:I(e.file),subpath:I(e.subpath),url:I(e.url),label:I(e.label),background:I(e.background),backgroundStyle:I(e.backgroundStyle),raw:e}}function ut(e){let t=I(e.id),n=I(e.fromNode),r=I(e.toNode);if(t&&n&&r)return{id:t,fromNode:n,fromSide:ct(ot,e.fromSide),fromEnd:ct(N,e.fromEnd)??`none`,toNode:r,toSide:ct(ot,e.toSide),toEnd:ct(N,e.toEnd)??`arrow`,color:I(e.color),label:I(e.label),raw:e}}var L=e=>{let t=e.id;return typeof t==`string`&&t!==``?t:void 0};function dt(e){if(e.trim()===``)return{canvas:P,problems:[],readable:!0};let t;try{t=JSON.parse(e)}catch(e){return{canvas:P,readable:!1,problems:[{at:`file`,message:`It is not JSON: ${e instanceof Error?e.message:String(e)}`}]}}if(!F(t))return{canvas:P,readable:!1,problems:[{at:`file`,message:`It is not a JSON object.`}]};let n=[],r=e=>{let r=t[e];return r===void 0?[]:Array.isArray(r)?r.flatMap((t,r)=>F(t)?[t]:(n.push({at:e===`nodes`?`node`:`edge`,index:r,message:`Its ${e} entry ${String(r)} is not an object.`}),[])):(n.push({at:e,message:`Its "${e}" is not a list.`}),[])},i=r(`nodes`),a=r(`edges`);return i.forEach((e,t)=>{if(lt(e))return;let r=L(e);n.push({at:`node`,index:t,...r===void 0?{}:{id:r},message:`Its node ${r??String(t)} is not drawn: a node has an id, a type, and x, y, width and height as numbers.`})}),a.forEach((e,t)=>{if(ut(e))return;let r=L(e);n.push({at:`edge`,index:t,...r===void 0?{}:{id:r},message:`Its edge ${r??String(t)} is not drawn: an edge has an id, a fromNode and a toNode.`})}),{canvas:{nodes:i,edges:a,top:t},problems:n,readable:!0}}var ft=e=>e.nodes.flatMap(e=>{let t=lt(e);return t?[t]:[]}),pt=e=>e.edges.flatMap(e=>{let t=ut(e);return t?[t]:[]});function mt(e){let t=e=>e.length===0?`[]`:`[\n${e.map(e=>`\t\t${JSON.stringify(e)}`).join(`,
|
|
2
2
|
`)}\n\t]`;return`{\n${[`\t"nodes":${t(e.nodes)}`,`\t"edges":${t(e.edges)}`,...Object.entries(e.top).filter(([e])=>e!==`nodes`&&e!==`edges`).map(([e,t])=>`\t${JSON.stringify(e)}:${JSON.stringify(t)}`)].join(`,
|
|
3
3
|
`)}\n}`}function ht(e,t=Math.random){let n=new Set([...e.nodes,...e.edges].flatMap(e=>L(e)??[]));for(;;){let e=``;for(let n=0;n<16;n++)e+=Math.floor(t()*16).toString(16);if(!n.has(e))return e}}var R=e=>Math.round(e);function z(e,t){let n=new Set(Object.entries(t).filter(([,e])=>e===void 0).map(([e])=>e)),r=Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)));for(let[e,n]of Object.entries(t))n!==void 0&&(r[e]=n);return r}var gt=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function _t(e,t,n){if(gt(t,e))return n;if(gt(n,e))return t;if(t===void 0||n===void 0)return t??n;if(e===void 0)return t;let r=[...new Set([...Object.keys(t),...Object.keys(e)])].filter(n=>!gt(t[n],e[n]));return z(n,Object.fromEntries(r.map(e=>[e,t[e]])))}function vt(e,t,n){let r=e=>{let t=new Map;for(let n of e){let e=L(n);e!==void 0&&!t.has(e)&&t.set(e,n)}return t},i=r(e),a=r(t),o=r(n),s=[],c=new Set;for(let e of n){let t=L(e);if(t===void 0){s.push(e);continue}if(c.has(t))continue;c.add(t);let n=_t(i.get(t),a.get(t),e);n&&s.push(n)}let l;for(let e of t){let t=L(e);if(t!==void 0){if(!c.has(t)){c.add(t);let n=_t(i.get(t),e,o.get(t));if(n){let e=l===void 0?-1:s.findIndex(e=>L(e)===l);s.splice(e+1,0,n)}}s.some(e=>L(e)===t)&&(l=t)}}return s}function yt(e,t,n){let r=_t(e.top,t.top,n.top)??{};return{nodes:vt(e.nodes,t.nodes,n.nodes),edges:vt(e.edges,t.edges,n.edges),top:r}}function B(e,t,n){let r=[...e];for(let e of n===`after`?t:[...t].reverse()){let t=n===`after`?e.after:e.before,i=r.findIndex(t=>L(t)===e.id);t===void 0?i>=0&&r.splice(i,1):i>=0?r[i]=t:r.splice(Math.min(e.index,r.length),0,t)}return r}function bt(e,t,n){return{...e,nodes:B(e.nodes,t.nodes,n),edges:B(e.edges,t.edges,n)}}function xt(e,t){let n=(e,t)=>{let n=[],r=new Map;e.forEach((e,t)=>{let n=L(e);n!==void 0&&r.set(n,{raw:e,index:t})});let i=new Set;t.forEach((e,t)=>{let a=L(e);if(a===void 0)return;i.add(a);let o=r.get(a);o?JSON.stringify(o.raw)!==JSON.stringify(e)&&n.push({id:a,before:o.raw,after:e,index:t}):n.push({id:a,after:e,index:t})});for(let[e,t]of r)i.has(e)||n.push({id:e,before:t.raw,index:t.index});return n};return{nodes:n(e.nodes,t.nodes),edges:n(e.edges,t.edges)}}var St=e=>e.nodes.length===0&&e.edges.length===0;function Ct(e,t){let n=`"id":${JSON.stringify(t)}`,r=`"id": ${JSON.stringify(t)}`,i=e.split(`
|
|
4
4
|
`).findIndex(e=>e.includes(n)||e.includes(r));return i<0?void 0:i+1}function wt(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Tt=/[ \t\n\f\r]/g;function Et(e){return typeof e==`object`?e.type===`text`&&Dt(e.value):Dt(e)}function Dt(e){return e.replace(Tt,``)===``}var Ot=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Ot.prototype.normal={},Ot.prototype.property={},Ot.prototype.space=void 0;function kt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Ot(n,r,t)}function At(e){return e.toLowerCase()}var V=class{constructor(e,t){this.attribute=t,this.property=e}};V.prototype.attribute=``,V.prototype.booleanish=!1,V.prototype.boolean=!1,V.prototype.commaOrSpaceSeparated=!1,V.prototype.commaSeparated=!1,V.prototype.defined=!1,V.prototype.mustUseProperty=!1,V.prototype.number=!1,V.prototype.overloadedBoolean=!1,V.prototype.property=``,V.prototype.spaceSeparated=!1,V.prototype.space=void 0;var jt=t({boolean:()=>H,booleanish:()=>U,commaOrSpaceSeparated:()=>K,commaSeparated:()=>Pt,number:()=>W,overloadedBoolean:()=>Nt,spaceSeparated:()=>G}),Mt=0,H=Ft(),U=Ft(),Nt=Ft(),W=Ft(),G=Ft(),Pt=Ft(),K=Ft();function Ft(){return 2**++Mt}var It=Object.keys(jt),Lt=class extends V{constructor(e,t,n,r){let i=-1;if(super(e,t),Rt(this,`space`,r),typeof n==`number`)for(;++i<It.length;){let e=It[i];Rt(this,It[i],(n&jt[e])===jt[e])}}};Lt.prototype.defined=!0;function Rt(e,t,n){n&&(e[t]=n)}function zt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Lt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[At(r)]=r,n[At(a.attribute)]=r}return new Ot(t,n,e.space)}var Bt=zt({properties:{ariaActiveDescendant:null,ariaAtomic:U,ariaAutoComplete:null,ariaBusy:U,ariaChecked:U,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:U,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:U,ariaFlowTo:G,ariaGrabbed:U,ariaHasPopup:null,ariaHidden:U,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:W,ariaLive:null,ariaModal:U,ariaMultiLine:U,ariaMultiSelectable:U,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:U,ariaReadOnly:U,ariaRelevant:null,ariaRequired:U,ariaRoleDescription:G,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:U,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Vt(e,t){return t in e?e[t]:t}function Ht(e,t){return Vt(e,t.toLowerCase())}var Ut=zt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Pt,acceptCharset:G,accessKey:G,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alpha:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:G,autoFocus:H,autoPlay:H,blocking:G,capture:null,charSet:null,checked:H,cite:null,className:G,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:U,controls:H,controlsList:G,coords:W|Pt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:Nt,draggable:U,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:G,height:W,hidden:Nt,high:W,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:G,itemRef:G,itemScope:H,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:H,optimum:W,pattern:null,ping:G,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:G,required:H,reversed:H,rows:W,rowSpan:W,sandbox:G,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootCustomElementRegistry:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shadowRootSerializable:H,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:U,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:U,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:U,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:H,disablePictureInPicture:H,disableRemotePlayback:H,exportParts:Pt,part:G,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Ht}),Wt=zt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:K,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:G,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pt,g2:Pt,glyphName:Pt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:K,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:K,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:K,rev:K,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:K,requiredFeatures:K,requiredFonts:K,requiredFormats:K,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:K,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:K,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:K,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Vt}),Gt=zt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Kt=zt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ht}),qt=zt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Jt={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Yt=/[A-Z]/g,Xt=/-[a-z]/g,Zt=/^data[-\w.:]+$/i;function Qt(e,t){let n=At(t),r=t,i=V;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Zt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Xt,en);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Xt.test(e)){let n=e.replace(Yt,$t);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Lt}return new i(r,t)}function $t(e){return`-`+e.toLowerCase()}function en(e){return e.charAt(1).toUpperCase()}var tn=kt([Bt,Ut,Gt,Kt,qt],`html`),nn=kt([Bt,Wt,Gt,Kt,qt],`svg`);function rn(e){return e.join(` `).trim()}var an=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
package/editor-web/assets/{ebnfDiagram-V4P3TTPT-SwhqbeK4.js → ebnfDiagram-V4P3TTPT-BOhNZmtp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,t}from"./mermaid-parser.core-
|
|
1
|
+
import{f as e,t}from"./mermaid-parser.core-DTLyYXbn.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{n as r}from"./d3-selection-COWvaQNI.js";import"./chunk-DSNLSHJZ-BFnyvrWg.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-XalaZaha.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-B8478wZ1.js";var c=e().RailroadEbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformChoice`),u=n(e=>{let t=e.elements.map(p);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformSequence`),d=n(e=>{switch(e.$type){case`EbnfTerminal`:return{type:`terminal`,value:e.value};case`EbnfNonTerminal`:return{type:`nonterminal`,name:e.name};case`EbnfSpecial`:return{type:`special`,text:e.text};case`EbnfGroup`:return l(e.element);case`EbnfOptional`:return{type:`optional`,element:l(e.element)};case`EbnfRepetition`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${e.$type}`)}},`transformPrimary`),f=n((e,t)=>{switch(t.$type){case`EbnfOptionalPostfix`:return{type:`optional`,element:e};case`EbnfZeroOrMorePostfix`:return{type:`repetition`,element:e,min:0,max:1/0};case`EbnfOneOrMorePostfix`:return{type:`repetition`,element:e,min:1,max:1/0};case`EbnfExceptionPostfix`:return{type:`sequence`,elements:[e,{type:`terminal`,value:`-`},d(t.except)]};default:throw Error(`Unsupported EBNF postfix node: ${t.$type}`)}},`transformPostfix`),p=n(e=>e.postfixes.reduce((e,t)=>f(e,t),d(e.base)),`transformTerm`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[EBNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[EBNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[EBNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
|