ryugi-artifacts 1.43.0 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +662 -335
- package/dist/server.cjs +128 -80
- package/dist/viewer/{ArtboardLayout-7_rmu60e.js → ArtboardLayout-v5QCVEaH.js} +1 -1
- package/dist/viewer/{ArtifactList-CC5-1ZFP.js → ArtifactList-mxXh57SU.js} +1 -1
- package/dist/viewer/{AutoPublishPrompt-B2D53_Kz.js → AutoPublishPrompt-COIe6yz0.js} +1 -1
- package/dist/viewer/{Canvas-13klENDh.js → Canvas-DIlI-OTY.js} +1 -1
- package/dist/viewer/{DocumentLayout-DZ-2_UTn.js → DocumentLayout-CarX1EiV.js} +2 -2
- package/dist/viewer/{DocumentPage-BcgERMV0.js → DocumentPage-BgoMJYd6.js} +1 -1
- package/dist/viewer/{HtmlLayout-CtlWM446.js → HtmlLayout-BmYAOIJ4.js} +1 -1
- package/dist/viewer/{MenuRoot-CwCVByOp.js → MenuRoot-CCLU8wQR.js} +1 -1
- package/dist/viewer/{PopoverPopup-BA537pRU.js → PopoverPopup-By2qMtdn.js} +1 -1
- package/dist/viewer/{PreviewLayout-C5OKA9J4.js → PreviewLayout-Dzkz7UOF.js} +2 -2
- package/dist/viewer/{Select-D2-94UGe.js → Select-CpRtuH5I.js} +1 -1
- package/dist/viewer/{SnapshotDocument-kHyl0dKv.js → SnapshotDocument-D0Lkq1g9.js} +1 -1
- package/dist/viewer/{ThreadView-Qlz9Ufo7.js → ThreadView-CmAxKSZ7.js} +1 -1
- package/dist/viewer/{TooltipPopup-Cpm4Cwxn.js → TooltipPopup-CdpS4tTR.js} +1 -1
- package/dist/viewer/{WarningsBadge-BtRPiCiS.js → WarningsBadge-xIuKcdGp.js} +1 -1
- package/dist/viewer/{abnfDiagram-VCTEODGH-Cc589tRO.js → abnfDiagram-VCTEODGH-vYXwOi2L.js} +1 -1
- package/dist/viewer/{ar-SA-G6X2FPQ2-qNPFpNYG.js → ar-SA-G6X2FPQ2-9GXzPlrK.js} +1 -1
- package/dist/viewer/{architecture-7GRP2DOG-BizmpjHH.js → architecture-7GRP2DOG-Dy3GJfSN.js} +1 -1
- package/dist/viewer/{architectureDiagram-5GKGNRK7-BuHdaFmM.js → architectureDiagram-5GKGNRK7-1EQ6eTro.js} +1 -1
- package/dist/viewer/{az-AZ-76LH7QW2-CbXvPy4A.js → az-AZ-76LH7QW2-B6E08k0L.js} +1 -1
- package/dist/viewer/{bg-BG-XCXSNQG7-DcRkeEZa.js → bg-BG-XCXSNQG7-CT75Hh8J.js} +1 -1
- package/dist/viewer/{blockDiagram-I7D4REHJ-BjZAhqNZ.js → blockDiagram-I7D4REHJ-Bots_bLJ.js} +1 -1
- package/dist/viewer/{bn-BD-2XOGV67Q-CYG0oQ07.js → bn-BD-2XOGV67Q-CdBG2RJk.js} +1 -1
- package/dist/viewer/{c4Diagram-7LVT6UL2-Dw9Lqcc4.js → c4Diagram-7LVT6UL2-C7DksWh5.js} +1 -1
- package/dist/viewer/{ca-ES-6MX7JW3Y-DZg7oXog.js → ca-ES-6MX7JW3Y-DDc1wD41.js} +1 -1
- package/dist/viewer/channel-ByZrhKcD.js +1 -0
- package/dist/viewer/{channel-CgSk2sDt.js → channel-CK8VjRfv.js} +4 -4
- package/dist/viewer/{chunk-4HAMMTFA-CmIOM_4n.js → chunk-4HAMMTFA-CFwFBnb7.js} +1 -1
- package/dist/viewer/{chunk-75Z2AOVW-Bk3gHz3u.js → chunk-75Z2AOVW-Ckcf4HXf.js} +1 -1
- package/dist/viewer/{chunk-DU6HZSFF-Z871Xxjd.js → chunk-DU6HZSFF-DSkKm1Sg.js} +1 -1
- package/dist/viewer/{chunk-EIO257PC-BowPlGMj.js → chunk-EIO257PC-Cp5jHH2B.js} +1 -1
- package/dist/viewer/{chunk-F27PBJKO-Da_Uy85s.js → chunk-F27PBJKO-CGR7FwkE.js} +1 -1
- package/dist/viewer/{chunk-GMAD6QVW-D99eqSu1.js → chunk-GMAD6QVW-CrVyThKY.js} +1 -1
- package/dist/viewer/{chunk-GVQU2GXP-DpHE-JHS.js → chunk-GVQU2GXP-DeN7DWg4.js} +1 -1
- package/dist/viewer/{chunk-IMKFNOWR-DNlzjXm8.js → chunk-IMKFNOWR-fh_OFrpb.js} +1 -1
- package/dist/viewer/{chunk-L3NEJ4N5-CwGjxbjF.js → chunk-L3NEJ4N5-B5ku2yKH.js} +1 -1
- package/dist/viewer/{chunk-OSK3NFVY-B4adwKZF.js → chunk-OSK3NFVY-BZxVtLcj.js} +1 -1
- package/dist/viewer/{chunk-P2QGCYS3-CR8elxW8.js → chunk-P2QGCYS3-vj5npGX4.js} +1 -1
- package/dist/viewer/{chunk-POPQ4Y6H-D5X5fYtJ.js → chunk-POPQ4Y6H-y6gZTjTL.js} +1 -1
- package/dist/viewer/{chunk-PWAF6VOD-C52ljaIH.js → chunk-PWAF6VOD-C5U8QIrG.js} +1 -1
- package/dist/viewer/{chunk-SHT3W25Y-Bqd2yIYA.js → chunk-SHT3W25Y-CrNt-vdk.js} +1 -1
- package/dist/viewer/{chunk-SVP7TREG-B-2E6atr.js → chunk-SVP7TREG-B4H37B9Z.js} +1 -1
- package/dist/viewer/{chunk-TICWLB2K-C4hY4B9O.js → chunk-TICWLB2K-DYoGsdJA.js} +1 -1
- package/dist/viewer/classDiagram-ZZMXUADV-G09oZdI0.js +1 -0
- package/dist/viewer/classDiagram-v2-VYDZK3BY-G09oZdI0.js +1 -0
- package/dist/viewer/{cs-CZ-2BRQDIVT-DmUu99ZE.js → cs-CZ-2BRQDIVT-DgBiVbuw.js} +1 -1
- package/dist/viewer/{cynefin-OW5HDTMX-CNpCyJlF.js → cynefin-OW5HDTMX-bvMkVO6w.js} +1 -1
- package/dist/viewer/{cynefinDiagram-5FMLGOSQ-D_E8exI5.js → cynefinDiagram-5FMLGOSQ-CjPrZzrG.js} +1 -1
- package/dist/viewer/{da-DK-5WZEPLOC-DrcqQnR5.js → da-DK-5WZEPLOC-D-yGNnLN.js} +1 -1
- package/dist/viewer/{dagre-GXQ25YYZ-B-hQNnoj.js → dagre-GXQ25YYZ-CuRrD3a3.js} +1 -1
- package/dist/viewer/{de-DE-XR44H4JA-BwGQ1Bu3.js → de-DE-XR44H4JA-Bgx9Q_D-.js} +1 -1
- package/dist/viewer/{diagram-S7CK7UJ4-DyrrPPnW.js → diagram-S7CK7UJ4-d9huVCZC.js} +1 -1
- package/dist/viewer/{diagram-UQ7AKVKN-DFdvde_8.js → diagram-UQ7AKVKN-Dw0NgQU7.js} +1 -1
- package/dist/viewer/{diagram-VSXAHHWV-BDdvfK3v.js → diagram-VSXAHHWV-BO48ZPAa.js} +1 -1
- package/dist/viewer/{diagram-VX7I27RA-Bv2wKJgk.js → diagram-VX7I27RA-CjjLbqAT.js} +1 -1
- package/dist/viewer/{diagram-Z3DM3KII-DVbVVBJH.js → diagram-Z3DM3KII-CqSQfWgq.js} +1 -1
- package/dist/viewer/{dist-DL1gyV3R.js → dist-96ICyKY0.js} +1 -1
- package/dist/viewer/{dist-DRMtu_-x.js → dist-BICCa23f.js} +1 -1
- package/dist/viewer/{dist-gv6IdArU.js → dist-BQJ_hgBh.js} +1 -1
- package/dist/viewer/{dist-DJjmFLDp.js → dist-BdwcfhMg.js} +1 -1
- package/dist/viewer/{dist-nHjoUtlT.js → dist-BohmHXvo.js} +1 -1
- package/dist/viewer/{dist-Cp67yPvp.js → dist-Bq5yGCvS.js} +1 -1
- package/dist/viewer/{dist-BpMGGlEV.js → dist-Bsxu0shl.js} +4 -4
- package/dist/viewer/{dist-C1no3jCb.js → dist-C8DkAQYd.js} +1 -1
- package/dist/viewer/{dist-B_G83rKD.js → dist-CACUOSsz.js} +1 -1
- package/dist/viewer/{dist-3KIsZmwj.js → dist-CFmM2XV7.js} +1 -1
- package/dist/viewer/{dist-C-Ceo6Fq.js → dist-CGDckSlK.js} +1 -1
- package/dist/viewer/{dist-BLMq_PiX.js → dist-CNKIbzP5.js} +1 -1
- package/dist/viewer/{dist-CLaYa349.js → dist-CoNkk-jP.js} +1 -1
- package/dist/viewer/{dist-DDjqhgMa.js → dist-Ct9Rv4Nb.js} +1 -1
- package/dist/viewer/{dist-Cs9q7OJl.js → dist-DFqgUaXc.js} +1 -1
- package/dist/viewer/{dist-Dril0ai0.js → dist-DHvxE90p.js} +1 -1
- package/dist/viewer/{dist-BfMsz_Mq.js → dist-DRVN9BoJ.js} +1 -1
- package/dist/viewer/{dist-Ks19j7-h.js → dist-DbTvrrue.js} +1 -1
- package/dist/viewer/{dist-DJtATNMP.js → dist-DeTBwAKa.js} +1 -1
- package/dist/viewer/{dist-BqBGd2fX.js → dist-DwmGeZQ2.js} +1 -1
- package/dist/viewer/{dist-Dbb4bImq.js → dist-PKCsW6uh.js} +1 -1
- package/dist/viewer/{dist-DpiVIFsv.js → dist-f6pfIPrl.js} +1 -1
- package/dist/viewer/{dist-2N6kKX64.js → dist-iWGU90nm.js} +1 -1
- package/dist/viewer/{dist-b6M4YQd0.js → dist-tEmP_1dP.js} +1 -1
- package/dist/viewer/{ebnfDiagram-PWID7BFC-BPZEgIKG.js → ebnfDiagram-PWID7BFC-DUuSLOwC.js} +1 -1
- package/dist/viewer/{el-GR-BZB4AONW-BHX9PTvB.js → el-GR-BZB4AONW-DBGnJY6B.js} +1 -1
- package/dist/viewer/{en-B4ZKOASM-ChdJoy_X.js → en-B4ZKOASM-ChYtA4ee.js} +1 -1
- package/dist/viewer/{erDiagram-RLTQ6QDP-teAVgmCA.js → erDiagram-RLTQ6QDP-6atcXUph.js} +1 -1
- package/dist/viewer/{es-ES-U4NZUMDT-DGRmVt9a.js → es-ES-U4NZUMDT-CktGk8Tg.js} +1 -1
- package/dist/viewer/{eu-ES-A7QVB2H4-6SSWUUs4.js → eu-ES-A7QVB2H4-CFlNXwf5.js} +1 -1
- package/dist/viewer/{eventmodeling-NTZA5JFV-B1I1Mylr.js → eventmodeling-NTZA5JFV-C5ZVZEiz.js} +1 -1
- package/dist/viewer/{fa-IR-HGAKTJCU-B_-FrT72.js → fa-IR-HGAKTJCU-CQRMDqXN.js} +1 -1
- package/dist/viewer/{fi-FI-Z5N7JZ37-C7SiOzZ-.js → fi-FI-Z5N7JZ37-CHKM1WB9.js} +1 -1
- package/dist/viewer/flowDiagram-HODETNUW-B9-KDJxc.js +1 -0
- package/dist/viewer/{fr-FR-RHASNOE6-B_QvfKMB.js → fr-FR-RHASNOE6-CUyuT7p6.js} +1 -1
- package/dist/viewer/{ganttDiagram-EL5Y4UJY-BMv_Q37E.js → ganttDiagram-EL5Y4UJY-DD2E-HAj.js} +1 -1
- package/dist/viewer/{gitGraph-4MIJSDKK-Bu1dbHFU.js → gitGraph-4MIJSDKK-BLvljQme.js} +1 -1
- package/dist/viewer/{gitGraphDiagram-WWUBYQGX-DUZ8_32F.js → gitGraphDiagram-WWUBYQGX-B0qzhOb6.js} +1 -1
- package/dist/viewer/{gl-ES-HMX3MZ6V-CmXVsVrw.js → gl-ES-HMX3MZ6V-CwJG5tWR.js} +1 -1
- package/dist/viewer/{he-IL-6SHJWFNN-8kv-3A3Y.js → he-IL-6SHJWFNN-_DosmhM7.js} +1 -1
- package/dist/viewer/{hi-IN-IWLTKZ5I-CvpAemRq.js → hi-IN-IWLTKZ5I-CrW9_EjK.js} +1 -1
- package/dist/viewer/{hu-HU-A5ZG7DT2-DOiAQ3qh.js → hu-HU-A5ZG7DT2-Dczvo59m.js} +1 -1
- package/dist/viewer/{id-ID-SAP4L64H-BK_k3fGY.js → id-ID-SAP4L64H-iSPag4VQ.js} +1 -1
- package/dist/viewer/{image-GAAHSSAO-WbKWFRU6.js → image-GAAHSSAO-BVJuAdML.js} +1 -1
- package/dist/viewer/{imperative-DfjHJwB9.js → imperative-_CkvZv3L.js} +1 -1
- package/dist/viewer/index.html +3 -3
- package/dist/viewer/index.js +3 -3
- package/dist/viewer/{info-A6RAGUB7-BVW83dCy.js → info-A6RAGUB7-Bhn0w0ii.js} +1 -1
- package/dist/viewer/{infoDiagram-27XIBGKW-C7TxtcWL.js → infoDiagram-27XIBGKW-BVSbmxC-.js} +1 -1
- package/dist/viewer/{ishikawaDiagram-5VMMS53U-BT-yQVRc.js → ishikawaDiagram-5VMMS53U-DdsbHCoI.js} +1 -1
- package/dist/viewer/{it-IT-JPQ66NNP-BNsEQmLq.js → it-IT-JPQ66NNP-8-_iFasU.js} +1 -1
- package/dist/viewer/{itemEquality-Dx2kxFQI.js → itemEquality-C3XfrMi2.js} +1 -1
- package/dist/viewer/{ja-JP-DBVTYXUO-jEL5Zohm.js → ja-JP-DBVTYXUO-irdMOHqC.js} +1 -1
- package/dist/viewer/{journeyDiagram-3NMN7TZE-D56mmWU7.js → journeyDiagram-3NMN7TZE-Cse6N-5p.js} +1 -1
- package/dist/viewer/{kaa-6HZHGXH3-B6pyJXZH.js → kaa-6HZHGXH3-DSu-PtX5.js} +1 -1
- package/dist/viewer/{kab-KAB-ZGHBKWFO-CLlf3rfz.js → kab-KAB-ZGHBKWFO-Bjc7u2yG.js} +1 -1
- package/dist/viewer/{kanban-definition-UXKFOSKX-hi8MCy0F.js → kanban-definition-UXKFOSKX-CdmNcOy5.js} +1 -1
- package/dist/viewer/{kk-KZ-P5N5QNE5-D-GnQDUN.js → kk-KZ-P5N5QNE5-CjQwQASw.js} +1 -1
- package/dist/viewer/{km-KH-HSX4SM5Z-CvlRaq6r.js → km-KH-HSX4SM5Z-CMslZbL1.js} +1 -1
- package/dist/viewer/{ko-KR-MTYHY66A-mYkZX31W.js → ko-KR-MTYHY66A-DBdzdGrw.js} +1 -1
- package/dist/viewer/{ku-TR-6OUDTVRD-CeXiI7eX.js → ku-TR-6OUDTVRD-C3zBzgJI.js} +1 -1
- package/dist/viewer/{lt-LT-XHIRWOB4-DNl9HTRS.js → lt-LT-XHIRWOB4-DWVw-ffO.js} +1 -1
- package/dist/viewer/{lv-LV-5QDEKY6T-_QejX_-F.js → lv-LV-5QDEKY6T-Zl3V2KMV.js} +1 -1
- package/dist/viewer/{mermaid-parser.core-8H71iLKg.js → mermaid-parser.core-CJFJTtR4.js} +3 -3
- package/dist/viewer/{mindmap-definition-YA3MSWOX-DDgO7tS-.js → mindmap-definition-YA3MSWOX-9mWYfj6-.js} +1 -1
- package/dist/viewer/{mr-IN-CRQNXWMA-OIHNnnu8.js → mr-IN-CRQNXWMA-D9aX0Bdo.js} +1 -1
- package/dist/viewer/{my-MM-5M5IBNSE-DYrw8pYH.js → my-MM-5M5IBNSE-SPXzrrJR.js} +1 -1
- package/dist/viewer/{nb-NO-T6EIAALU-DMd3Sg5d.js → nb-NO-T6EIAALU-C8h-KZrY.js} +1 -1
- package/dist/viewer/{nl-NL-IS3SIHDZ-D9AJQvsb.js → nl-NL-IS3SIHDZ-BflXY5YN.js} +1 -1
- package/dist/viewer/{nn-NO-6E72VCQL-DNeLg3d9.js → nn-NO-6E72VCQL-CFWc1uPu.js} +1 -1
- package/dist/viewer/{oc-FR-POXYY2M6-D6JMp-_j.js → oc-FR-POXYY2M6-BHz8giUr.js} +1 -1
- package/dist/viewer/{pa-IN-N4M65BXN-g5Vjsxo8.js → pa-IN-N4M65BXN-KYWN5LeG.js} +1 -1
- package/dist/viewer/{packet-AYTQ26CC-Dgk7eBb9.js → packet-AYTQ26CC-DrNZHDt7.js} +1 -1
- package/dist/viewer/{pegDiagram-XKGWAZYB-CVIwfqJt.js → pegDiagram-XKGWAZYB-DPszelm4.js} +1 -1
- package/dist/viewer/percentages-BXMCSKIN-BgOWZqvL.js +1 -0
- package/dist/viewer/{pie-WAS4IAKB-DS_tuosA.js → pie-WAS4IAKB-J0UiOL4B.js} +1 -1
- package/dist/viewer/{pieDiagram-E7YTZNPT-4vQIT90F.js → pieDiagram-E7YTZNPT-ClDIExzM.js} +1 -1
- package/dist/viewer/{pl-PL-T2D74RX3-CHeYNLpa.js → pl-PL-T2D74RX3-DhMivhiU.js} +1 -1
- package/dist/viewer/preview.html +4 -4
- package/dist/viewer/preview.js +1 -1
- package/dist/viewer/{prod-DiBc1897.js → prod-itzLn3X0.js} +8 -8
- package/dist/viewer/{pt-BR-5N22H2LF-taNFaSz0.js → pt-BR-5N22H2LF-gkkaKj42.js} +1 -1
- package/dist/viewer/{pt-PT-UZXXM6DQ-CsmK_jBH.js → pt-PT-UZXXM6DQ-NWnJTvgF.js} +1 -1
- package/dist/viewer/{quadrantDiagram-AXDQQJYC-BeirbPa5.js → quadrantDiagram-AXDQQJYC-CYy8PwM3.js} +1 -1
- package/dist/viewer/{radar-RG4KPBEZ-BsCRiS0D.js → radar-RG4KPBEZ-DQrCAAlO.js} +1 -1
- package/dist/viewer/{railroad-74A4TZTK--zO8tvea.js → railroad-74A4TZTK-Bie2KVo4.js} +1 -1
- package/dist/viewer/{railroad-abnf-HS5TGJTU-BZWetNTH.js → railroad-abnf-HS5TGJTU-CqHzfM_H.js} +1 -1
- package/dist/viewer/{railroad-ebnf-LZEXJU2U-Bdr-nXDi.js → railroad-ebnf-LZEXJU2U-Ba93pI_q.js} +1 -1
- package/dist/viewer/{railroad-peg-WCYAUIDC-5QbqtFhr.js → railroad-peg-WCYAUIDC-oFmY9M6i.js} +1 -1
- package/dist/viewer/{railroadDiagram-O6MQD6OU-CEc9eC2b.js → railroadDiagram-O6MQD6OU-Bl287Huh.js} +1 -1
- package/dist/viewer/{requirementDiagram-BXWQKSXE-gHO3OQpd.js → requirementDiagram-BXWQKSXE-C7qjeIWt.js} +1 -1
- package/dist/viewer/{ro-RO-JPDTUUEW-URJMRk3q.js → ro-RO-JPDTUUEW-Ci-CRtV_.js} +1 -1
- package/dist/viewer/{ru-RU-B4JR7IUQ-DI6p8dtR.js → ru-RU-B4JR7IUQ-BPm31ic_.js} +1 -1
- package/dist/viewer/{sankeyDiagram-P5KCCOFB-BKwmk90Q.js → sankeyDiagram-P5KCCOFB-CSV23yCW.js} +1 -1
- package/dist/viewer/{selection-BUarVaVG.js → selection-DiNkp8_u.js} +1 -1
- package/dist/viewer/{sequenceDiagram-WJ2MYXX4-DNRtNYaC.js → sequenceDiagram-WJ2MYXX4-BbxTUdX6.js} +1 -1
- package/dist/viewer/{si-LK-N5RQ5JYF-CC3Wbwwt.js → si-LK-N5RQ5JYF-7zJDxmel.js} +1 -1
- package/dist/viewer/{sk-SK-C5VTKIMK-D4qIYJZm.js → sk-SK-C5VTKIMK-BNbR9mTT.js} +1 -1
- package/dist/viewer/{sl-SI-NN7IZMDC-BrX9Kjyd.js → sl-SI-NN7IZMDC-Dzy-6Up_.js} +1 -1
- package/dist/viewer/{stateDiagram-D77RDMKH-DFHhwDaw.js → stateDiagram-D77RDMKH-hpVLVGhL.js} +1 -1
- package/dist/viewer/stateDiagram-v2-MP3YSRHH-BH2KXEBo.js +1 -0
- package/dist/viewer/subset-shared.chunk-Czwfa2VQ.js +1 -0
- package/dist/viewer/{subset-worker.chunk-D_1PjTiM.js → subset-worker.chunk-Dgy8sQUD.js} +1 -1
- package/dist/viewer/{sv-SE-XGPEYMSR-CrLXWvFy.js → sv-SE-XGPEYMSR-C5bggny3.js} +1 -1
- package/dist/viewer/{swimlanes-42K2YHIH-DzGUJWU-.js → swimlanes-42K2YHIH-BRqXz7nV.js} +1 -1
- package/dist/viewer/swimlanesDiagram-VR7AAH4N-Blx0nEYQ.js +8 -0
- package/dist/viewer/{ta-IN-2NMHFXQM-BjEs1VFY.js → ta-IN-2NMHFXQM-Pw1wRofq.js} +1 -1
- package/dist/viewer/{th-TH-HPSO5L25-Cg6PzVXI.js → th-TH-HPSO5L25-Nz-UqtdD.js} +1 -1
- package/dist/viewer/{timeline-definition-24CTP7MA-CIpmMJhg.js → timeline-definition-24CTP7MA-Dp3nP8rd.js} +1 -1
- package/dist/viewer/{tr-TR-DEFEU3FU-DCEAv9nq.js → tr-TR-DEFEU3FU-DTlGCmld.js} +1 -1
- package/dist/viewer/{treeView-Q6P3EWNA-DHjfLsjZ.js → treeView-Q6P3EWNA-z3dPnkjZ.js} +1 -1
- package/dist/viewer/{treemap-WGGIJYW6-COOVf8-Y.js → treemap-WGGIJYW6-DeaU4Gxo.js} +1 -1
- package/dist/viewer/{type-icons-BonbxUGw.js → type-icons-BhI8cIWS.js} +1 -1
- package/dist/viewer/{uk-UA-QMV73CPH-DMWYOkg6.js → uk-UA-QMV73CPH-Bx9vPanC.js} +1 -1
- package/dist/viewer/useSystemTheme-Dzqcdh-y.js +64 -0
- package/dist/viewer/{useTranslation-Ci5tOdAN.js → useTranslation-B4Q9Bc_u.js} +1 -1
- package/dist/viewer/{useTypeFavicon-B--Z-Uwv.js → useTypeFavicon-B01CcUw4.js} +1 -1
- package/dist/viewer/{vennDiagram-4TSXK5OY-BWDC-eE0.js → vennDiagram-4TSXK5OY-B2g-6QAa.js} +1 -1
- package/dist/viewer/{vi-VN-M7AON7JQ-CVj2nFN-.js → vi-VN-M7AON7JQ-DvU5fCQK.js} +1 -1
- package/dist/viewer/{view-D0Odcpdb.js → view-R1KProyl.js} +1 -1
- package/dist/viewer/{wardley-WFR3VGLG-CDlPWlPO.js → wardley-WFR3VGLG-hhWao6Ek.js} +1 -1
- package/dist/viewer/{wardleyDiagram-VM6X3IG4-C9yxtxg6.js → wardleyDiagram-VM6X3IG4-pFu6p_Rn.js} +1 -1
- package/dist/viewer/{xychartDiagram-S5SC5T6Z-Dv4UxBWo.js → xychartDiagram-S5SC5T6Z-GC8fXUaM.js} +1 -1
- package/dist/viewer/{zh-CN-LNUGB5OW-i7Vn4Pqy.js → zh-CN-LNUGB5OW-LWpPfppU.js} +1 -1
- package/dist/viewer/{zh-HK-E62DVLB3-Cm16SoeD.js → zh-HK-E62DVLB3-BQrPpETb.js} +1 -1
- package/dist/viewer/{zh-TW-RAJ6MFWO-Lambeacv.js → zh-TW-RAJ6MFWO-O2w99mPI.js} +1 -1
- package/dist/viewer-lib/{Canvas-BdS1Xa5w.js → Canvas-Gv8uEhbb.js} +1 -1
- package/dist/viewer-lib/core.js +3 -3
- package/dist/viewer-lib/{ids-Crgtnwo0.js → ids-CJH3rRXm.js} +38 -38
- package/dist/viewer-lib/index.js +1002 -1002
- package/dist/viewer-lib/types/src/shared/ids.d.ts +3 -0
- package/package.json +1 -1
- package/dist/viewer/channel-DGerhKw9.js +0 -1
- package/dist/viewer/classDiagram-ZZMXUADV-DWXc-S98.js +0 -1
- package/dist/viewer/classDiagram-v2-VYDZK3BY-DWXc-S98.js +0 -1
- package/dist/viewer/flowDiagram-HODETNUW-DWhovppS.js +0 -1
- package/dist/viewer/percentages-BXMCSKIN-NLhw_fz5.js +0 -1
- package/dist/viewer/stateDiagram-v2-MP3YSRHH-D8ViYn3V.js +0 -1
- package/dist/viewer/subset-shared.chunk-Bx9OralH.js +0 -1
- package/dist/viewer/swimlanesDiagram-VR7AAH4N-Clea06qq.js +0 -8
- package/dist/viewer/useSystemTheme-BVZLLsnc.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,r as n}from"./useSystemTheme-BVZLLsnc.js";import{n as r,t as i}from"./jsx-runtime-CldxteV5.js";import{nr as a}from"./MenuRoot-CwCVByOp.js";import{dt as o}from"./use-presence-9dVDVxFO.js";import{t as s}from"./search-y2-lADui.js";import{i as c,n as l,t as u}from"./type-icons-BonbxUGw.js";import{h as d,t as f}from"./Select-D2-94UGe.js";import{t as p}from"./useTranslation-Ci5tOdAN.js";import{n as m}from"./useArtifactSocket-L4eDpLQm.js";import{t as h}from"./WarningsBadge-BtRPiCiS.js";var g={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};g.node;var _=o(g),v=e(r(),1),y=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20fill='currentColor'%3e%3cg%20transform='translate(82%20136.317460)%20scale(0.613756614)'%3e%3cg%20transform='translate(0.000000,390.000000)%20scale(0.100000,-0.100000)'%20stroke='none'%3e%3cpath%20d='M4945%203889%20c-339%20-44%20-682%20-239%20-905%20-517%20-139%20-172%20-232%20-355%20-365%20-717%20-136%20-368%20-285%20-735%20-360%20-890%20-219%20-449%20-524%20-768%20-849%20-887%20-121%20-44%20-215%20-60%20-356%20-60%20-162%200%20-244%2018%20-450%2097%20-291%20111%20-420%20144%20-650%20166%20-257%2024%20-637%20-19%20-772%20-87%20-148%20-75%20-249%20-247%20-235%20-399%2019%20-197%20186%20-344%20392%20-346%2040%20-1%20127%2011%20205%2027%20115%2023%20160%2028%20300%2028%20242%201%20372%20-29%20671%20-155%20226%20-95%20467%20-149%20662%20-149%20252%200%20548%2074%20789%20197%20394%20201%20708%20521%20988%201008%2083%20144%20271%20529%20405%20830%20220%20493%20300%20632%20436%20759%20121%20112%20226%20162%20424%20201%2044%209%20108%2029%20143%2045%20165%2077%20274%20285%20244%20467%20-31%20188%20-168%20334%20-354%20378%20-70%2016%20-249%2018%20-363%204z%20M765%203139%20c-202%20-11%20-415%20-48%20-497%20-86%20-91%20-44%20-151%20-101%20-193%20-186%20-123%20-248%2031%20-525%20307%20-554%2038%20-4%2099%203%20204%2023%20137%2027%20167%2029%20384%2029%20205%200%20249%20-3%20347%20-23%20225%20-45%20387%20-106%20658%20-247%20182%20-94%20308%20-144%20463%20-182%20138%20-35%20350%20-39%20447%20-9%20174%2053%20275%20152%20305%20299%2026%20130%20-40%20267%20-158%20323%20-52%2025%20-72%2028%20-227%2035%20-248%2011%20-328%2037%20-576%20187%20-232%20140%20-384%20213%20-585%20281%20-283%2095%20-541%20127%20-879%20110z%20M620%202104%20c-273%20-32%20-384%20-65%20-471%20-143%20-235%20-208%20-136%20-589%20172%20-660%2068%20-16%20129%20-13%20272%2014%20400%2073%20702%2031%201167%20-163%20239%20-99%20350%20-125%20535%20-125%20193%200%20338%2051%20448%20157%20117%20113%20139%20261%2056%20375%20-50%2069%20-99%2085%20-294%2092%20-245%2010%20-332%2035%20-563%20163%20-224%20123%20-456%20211%20-693%20262%20-111%2023%20-149%2026%20-359%2029%20-129%202%20-251%201%20-270%20-1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,b=i();function x({type:e,size:t=16}){let{fill:n,stroke:r}=u[e];return(0,b.jsxs)(`svg`,{width:t,height:t,viewBox:l,"aria-hidden":`true`,style:{flex:`none`,display:`block`},children:[n&&(0,b.jsx)(`path`,{d:n,fill:`currentColor`}),(0,b.jsx)(`path`,{d:r,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function S({src:e,type:t}){let[n,r]=(0,v.useState)(null);return(0,b.jsxs)(`div`,{className:`library-thumbnail`,"aria-hidden":`true`,children:[(0,b.jsx)(x,{type:t,size:24}),e&&n!==e&&(0,b.jsx)(`img`,{src:e,alt:``,width:600,height:360,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(e)},e)]})}var C=`0 0 512 512`,w=`<g transform="translate(82 136.317460) scale(0.613756614)"><g transform="translate(0.000000,390.000000) scale(0.100000,-0.100000)" stroke="none"><path d="M4945 3889 c-339 -44 -682 -239 -905 -517 -139 -172 -232 -355 -365 -717 -136 -368 -285 -735 -360 -890 -219 -449 -524 -768 -849 -887 -121 -44 -215 -60 -356 -60 -162 0 -244 18 -450 97 -291 111 -420 144 -650 166 -257 24 -637 -19 -772 -87 -148 -75 -249 -247 -235 -399 19 -197 186 -344 392 -346 40 -1 127 11 205 27 115 23 160 28 300 28 242 1 372 -29 671 -155 226 -95 467 -149 662 -149 252 0 548 74 789 197 394 201 708 521 988 1008 83 144 271 529 405 830 220 493 300 632 436 759 121 112 226 162 424 201 44 9 108 29 143 45 165 77 274 285 244 467 -31 188 -168 334 -354 378 -70 16 -249 18 -363 4z M765 3139 c-202 -11 -415 -48 -497 -86 -91 -44 -151 -101 -193 -186 -123 -248 31 -525 307 -554 38 -4 99 3 204 23 137 27 167 29 384 29 205 0 249 -3 347 -23 225 -45 387 -106 658 -247 182 -94 308 -144 463 -182 138 -35 350 -39 447 -9 174 53 275 152 305 299 26 130 -40 267 -158 323 -52 25 -72 28 -227 35 -248 11 -328 37 -576 187 -232 140 -384 213 -585 281 -283 95 -541 127 -879 110z M620 2104 c-273 -32 -384 -65 -471 -143 -235 -208 -136 -589 172 -660 68 -16 129 -13 272 14 400 73 702 31 1167 -163 239 -99 350 -125 535 -125 193 0 338 51 448 157 117 113 139 261 56 375 -50 69 -99 85 -294 92 -245 10 -332 35 -563 163 -224 123 -456 211 -693 262 -111 23 -149 26 -359 29 -129 2 -251 1 -270 -1z"/></g></g>`;function T({size:e=16,color:t}){return(0,b.jsx)(`svg`,{width:e,height:e,viewBox:C,fill:`currentColor`,"aria-hidden":`true`,style:{flex:`none`,display:`block`,color:t},dangerouslySetInnerHTML:{__html:w}})}function E(e,t,n,r=`recent`){let i=n.trim().toLocaleLowerCase();return e.filter(e=>(t===`all`||e.type===t)&&`${e.title}\n${e.id}`.toLocaleLowerCase().includes(i)).sort((e,t)=>(r===`name`?e.title.localeCompare(t.title):(r===`oldest`?1:-1)*(e.updatedAt-t.updatedAt))||`${e.type}/${e.id}`.localeCompare(`${t.type}/${t.id}`))}function D(e,n=Date.now()){let r=new Intl.RelativeTimeFormat(t.language,{numeric:`always`}),i=Math.floor(Math.max(0,n-e)/6e4);return i===0?t.t(`time.justNow`):i<60?r.format(-i,`minute`):i<1440?r.format(-Math.floor(i/60),`hour`):r.format(-Math.floor(i/1440),`day`)}function O(){let{t:e,i18n:t}=p(),r={all:e(`type.all`),artboard:e(`type.artboard`),document:e(`type.document`),html:e(`type.html`)},i=[{label:e(`library.sortRecent`),value:`recent`},{label:e(`library.sortOldest`),value:`oldest`},{label:e(`library.sortName`),value:`name`}],[o,l]=(0,v.useState)(null),[u,g]=(0,v.useState)(``),[C,w]=(0,v.useState)([]),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(`all`),[M,N]=(0,v.useState)(``),[P,F]=(0,v.useState)(`recent`),[I,L]=(0,v.useState)(Date.now),R=(0,v.useRef)(null),z=(0,v.useCallback)(async()=>{try{let e=await fetch(`/api/artifacts`,{cache:`no-store`});if(!e.ok)throw Error(`Could not load artifacts`);let t=await e.json();l(t.artifacts),g(t.project),w(t.warnings),k(!1)}catch{k(!0)}},[]),{live:B}=m(e=>{e.type===`change`&&z()},z);(0,v.useEffect)(()=>{document.title=u?`${u} · Artifacts`:`Artifacts · Ryugi`},[u]),(0,v.useEffect)(()=>{z();let e=setInterval(()=>L(Date.now()),6e4),t=e=>{let t=e.target;e.key===`/`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!t.closest(`input,textarea,[contenteditable="true"]`)&&(e.preventDefault(),R.current?.focus())};return addEventListener(`keydown`,t),()=>{clearInterval(e),removeEventListener(`keydown`,t)}},[z]);let V=E(o??[],A,M,P),H=[`all`,...n].map(e=>({value:e,label:(0,b.jsxs)(`span`,{className:`library-tab-label`,children:[r[e],(0,b.jsx)(`span`,{children:e===`all`?o?.length??0:o?.filter(t=>t.type===e).length??0})]})}));return(0,b.jsxs)(`div`,{className:`artifact-library`,children:[(0,b.jsxs)(`header`,{className:`library-topbar`,children:[(0,b.jsxs)(`div`,{className:`library-breadcrumb`,children:[(0,b.jsx)(`img`,{className:`library-logo`,src:y,alt:``}),(0,b.jsx)(`strong`,{children:`ryugi`}),(0,b.jsx)(`span`,{children:`/`}),(0,b.jsx)(`b`,{children:u||e(`common.project`)}),(0,b.jsx)(`span`,{children:`/`}),(0,b.jsx)(`span`,{children:`Artifacts`})]}),(0,b.jsxs)(`span`,{className:`library-status`,children:[(0,b.jsx)(`i`,{"data-live":B}),e(B?`library.localProject`:`library.reconnecting`)]})]}),(0,b.jsxs)(`main`,{className:`library-main`,children:[(0,b.jsxs)(`div`,{className:`library-heading`,children:[(0,b.jsx)(`h1`,{children:`Artifacts`}),(0,b.jsx)(`span`,{children:o?e(`library.count`,{count:o.length}):`…`})]}),(0,b.jsxs)(`div`,{className:`library-toolbar`,children:[(0,b.jsx)(c,{className:`library-tabs`,size:`small`,styles:{item:{height:30,paddingInline:8}},value:A,options:H,onChange:j}),(0,b.jsxs)(`div`,{className:`library-tools`,children:[(0,b.jsx)(d,{ref:R,className:`library-search`,variant:`filled`,prefix:(0,b.jsx)(s,{size:16}),suffix:(0,b.jsx)(`kbd`,{children:`/`}),"aria-label":e(`library.searchLabel`),placeholder:e(`library.searchPlaceholder`),value:M,onChange:e=>N(e.target.value)}),(0,b.jsx)(`label`,{className:`library-sr-only`,htmlFor:`artifact-sort`,children:e(`library.sortLabel`)}),(0,b.jsx)(f,{id:`artifact-sort`,className:`library-sort`,variant:`filled`,value:P,options:i,onSelect:F})]})]}),O&&(0,b.jsxs)(`div`,{className:`library-error`,role:`alert`,children:[e(`library.loadFailed`),(0,b.jsx)(a,{size:`small`,type:`text`,onClick:()=>void z(),children:e(`common.retry`)})]}),o===null&&!O&&(0,b.jsx)(`p`,{className:`library-empty`,role:`status`,children:e(`library.loadingList`)}),o?.length===0&&(0,b.jsxs)(`div`,{className:`library-empty`,children:[(0,b.jsx)(T,{size:28}),(0,b.jsx)(`h2`,{children:e(`library.emptyTitle`)}),(0,b.jsx)(`p`,{children:e(`library.emptyBody`)})]}),o!==null&&o.length>0&&V.length===0&&(0,b.jsxs)(`div`,{className:`library-empty`,children:[(0,b.jsx)(s,{size:24}),(0,b.jsx)(`h2`,{children:e(`library.noMatchTitle`)}),(0,b.jsx)(`p`,{children:e(`library.noMatchBody`)}),(0,b.jsx)(a,{size:`small`,onClick:()=>{N(``),j(`all`)},children:e(`common.clearFilter`)})]}),(0,b.jsx)(`ul`,{className:`library-grid`,"aria-label":e(`library.listLabel`),children:V.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{className:`library-card`,href:n.url??`/${n.type}/${n.id}`,"aria-label":e(`library.open`,{title:n.title}),children:[(0,b.jsx)(S,{type:n.type,src:`/api/thumbnail${n.url??`/${n.type}/${n.id}`}.svg?v=${n.updatedAt}`}),(0,b.jsxs)(`div`,{className:`library-card-info`,children:[(0,b.jsxs)(`div`,{className:`library-card-title`,children:[(0,b.jsx)(`span`,{title:n.title,children:n.title}),(0,b.jsx)(_,{size:13,"aria-hidden":`true`})]}),(0,b.jsxs)(`div`,{className:`library-card-meta`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(x,{type:n.type,size:12}),r[n.type]]}),(0,b.jsx)(`time`,{dateTime:new Date(n.updatedAt).toISOString(),title:new Date(n.updatedAt).toLocaleString(t.language),children:D(n.updatedAt,I)})]})]})]})},`${n.type}/${n.id}`))}),(0,b.jsxs)(`footer`,{className:`library-footer`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`img`,{className:`library-logo`,src:y,alt:``}),e(`library.footer`)]}),(0,b.jsxs)(`code`,{children:[u?`${u} / `:``,`.ryugi / artifacts`]})]})]}),(0,b.jsx)(h,{warnings:C})]})}export{O as ArtifactList};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,r as n}from"./useSystemTheme-Dzqcdh-y.js";import{n as r,t as i}from"./jsx-runtime-CldxteV5.js";import{nr as a}from"./MenuRoot-CCLU8wQR.js";import{dt as o}from"./use-presence-9dVDVxFO.js";import{t as s}from"./search-y2-lADui.js";import{i as c,n as l,t as u}from"./type-icons-BhI8cIWS.js";import{h as d,t as f}from"./Select-CpRtuH5I.js";import{t as p}from"./useTranslation-B4Q9Bc_u.js";import{n as m}from"./useArtifactSocket-L4eDpLQm.js";import{t as h}from"./WarningsBadge-xIuKcdGp.js";var g={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};g.node;var _=o(g),v=e(r(),1),y=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20fill='currentColor'%3e%3cg%20transform='translate(82%20136.317460)%20scale(0.613756614)'%3e%3cg%20transform='translate(0.000000,390.000000)%20scale(0.100000,-0.100000)'%20stroke='none'%3e%3cpath%20d='M4945%203889%20c-339%20-44%20-682%20-239%20-905%20-517%20-139%20-172%20-232%20-355%20-365%20-717%20-136%20-368%20-285%20-735%20-360%20-890%20-219%20-449%20-524%20-768%20-849%20-887%20-121%20-44%20-215%20-60%20-356%20-60%20-162%200%20-244%2018%20-450%2097%20-291%20111%20-420%20144%20-650%20166%20-257%2024%20-637%20-19%20-772%20-87%20-148%20-75%20-249%20-247%20-235%20-399%2019%20-197%20186%20-344%20392%20-346%2040%20-1%20127%2011%20205%2027%20115%2023%20160%2028%20300%2028%20242%201%20372%20-29%20671%20-155%20226%20-95%20467%20-149%20662%20-149%20252%200%20548%2074%20789%20197%20394%20201%20708%20521%20988%201008%2083%20144%20271%20529%20405%20830%20220%20493%20300%20632%20436%20759%20121%20112%20226%20162%20424%20201%2044%209%20108%2029%20143%2045%20165%2077%20274%20285%20244%20467%20-31%20188%20-168%20334%20-354%20378%20-70%2016%20-249%2018%20-363%204z%20M765%203139%20c-202%20-11%20-415%20-48%20-497%20-86%20-91%20-44%20-151%20-101%20-193%20-186%20-123%20-248%2031%20-525%20307%20-554%2038%20-4%2099%203%20204%2023%20137%2027%20167%2029%20384%2029%20205%200%20249%20-3%20347%20-23%20225%20-45%20387%20-106%20658%20-247%20182%20-94%20308%20-144%20463%20-182%20138%20-35%20350%20-39%20447%20-9%20174%2053%20275%20152%20305%20299%2026%20130%20-40%20267%20-158%20323%20-52%2025%20-72%2028%20-227%2035%20-248%2011%20-328%2037%20-576%20187%20-232%20140%20-384%20213%20-585%20281%20-283%2095%20-541%20127%20-879%20110z%20M620%202104%20c-273%20-32%20-384%20-65%20-471%20-143%20-235%20-208%20-136%20-589%20172%20-660%2068%20-16%20129%20-13%20272%2014%20400%2073%20702%2031%201167%20-163%20239%20-99%20350%20-125%20535%20-125%20193%200%20338%2051%20448%20157%20117%20113%20139%20261%2056%20375%20-50%2069%20-99%2085%20-294%2092%20-245%2010%20-332%2035%20-563%20163%20-224%20123%20-456%20211%20-693%20262%20-111%2023%20-149%2026%20-359%2029%20-129%202%20-251%201%20-270%20-1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,b=i();function x({type:e,size:t=16}){let{fill:n,stroke:r}=u[e];return(0,b.jsxs)(`svg`,{width:t,height:t,viewBox:l,"aria-hidden":`true`,style:{flex:`none`,display:`block`},children:[n&&(0,b.jsx)(`path`,{d:n,fill:`currentColor`}),(0,b.jsx)(`path`,{d:r,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function S({src:e,type:t}){let[n,r]=(0,v.useState)(null);return(0,b.jsxs)(`div`,{className:`library-thumbnail`,"aria-hidden":`true`,children:[(0,b.jsx)(x,{type:t,size:24}),e&&n!==e&&(0,b.jsx)(`img`,{src:e,alt:``,width:600,height:360,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(e)},e)]})}var C=`0 0 512 512`,w=`<g transform="translate(82 136.317460) scale(0.613756614)"><g transform="translate(0.000000,390.000000) scale(0.100000,-0.100000)" stroke="none"><path d="M4945 3889 c-339 -44 -682 -239 -905 -517 -139 -172 -232 -355 -365 -717 -136 -368 -285 -735 -360 -890 -219 -449 -524 -768 -849 -887 -121 -44 -215 -60 -356 -60 -162 0 -244 18 -450 97 -291 111 -420 144 -650 166 -257 24 -637 -19 -772 -87 -148 -75 -249 -247 -235 -399 19 -197 186 -344 392 -346 40 -1 127 11 205 27 115 23 160 28 300 28 242 1 372 -29 671 -155 226 -95 467 -149 662 -149 252 0 548 74 789 197 394 201 708 521 988 1008 83 144 271 529 405 830 220 493 300 632 436 759 121 112 226 162 424 201 44 9 108 29 143 45 165 77 274 285 244 467 -31 188 -168 334 -354 378 -70 16 -249 18 -363 4z M765 3139 c-202 -11 -415 -48 -497 -86 -91 -44 -151 -101 -193 -186 -123 -248 31 -525 307 -554 38 -4 99 3 204 23 137 27 167 29 384 29 205 0 249 -3 347 -23 225 -45 387 -106 658 -247 182 -94 308 -144 463 -182 138 -35 350 -39 447 -9 174 53 275 152 305 299 26 130 -40 267 -158 323 -52 25 -72 28 -227 35 -248 11 -328 37 -576 187 -232 140 -384 213 -585 281 -283 95 -541 127 -879 110z M620 2104 c-273 -32 -384 -65 -471 -143 -235 -208 -136 -589 172 -660 68 -16 129 -13 272 14 400 73 702 31 1167 -163 239 -99 350 -125 535 -125 193 0 338 51 448 157 117 113 139 261 56 375 -50 69 -99 85 -294 92 -245 10 -332 35 -563 163 -224 123 -456 211 -693 262 -111 23 -149 26 -359 29 -129 2 -251 1 -270 -1z"/></g></g>`;function T({size:e=16,color:t}){return(0,b.jsx)(`svg`,{width:e,height:e,viewBox:C,fill:`currentColor`,"aria-hidden":`true`,style:{flex:`none`,display:`block`,color:t},dangerouslySetInnerHTML:{__html:w}})}function E(e,t,n,r=`recent`){let i=n.trim().toLocaleLowerCase();return e.filter(e=>(t===`all`||e.type===t)&&`${e.title}\n${e.id}`.toLocaleLowerCase().includes(i)).sort((e,t)=>(r===`name`?e.title.localeCompare(t.title):(r===`oldest`?1:-1)*(e.updatedAt-t.updatedAt))||`${e.type}/${e.id}`.localeCompare(`${t.type}/${t.id}`))}function D(e,n=Date.now()){let r=new Intl.RelativeTimeFormat(t.language,{numeric:`always`}),i=Math.floor(Math.max(0,n-e)/6e4);return i===0?t.t(`time.justNow`):i<60?r.format(-i,`minute`):i<1440?r.format(-Math.floor(i/60),`hour`):r.format(-Math.floor(i/1440),`day`)}function O(){let{t:e,i18n:t}=p(),r={all:e(`type.all`),artboard:e(`type.artboard`),document:e(`type.document`),html:e(`type.html`)},i=[{label:e(`library.sortRecent`),value:`recent`},{label:e(`library.sortOldest`),value:`oldest`},{label:e(`library.sortName`),value:`name`}],[o,l]=(0,v.useState)(null),[u,g]=(0,v.useState)(``),[C,w]=(0,v.useState)([]),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(`all`),[M,N]=(0,v.useState)(``),[P,F]=(0,v.useState)(`recent`),[I,L]=(0,v.useState)(Date.now),R=(0,v.useRef)(null),z=(0,v.useCallback)(async()=>{try{let e=await fetch(`/api/artifacts`,{cache:`no-store`});if(!e.ok)throw Error(`Could not load artifacts`);let t=await e.json();l(t.artifacts),g(t.project),w(t.warnings),k(!1)}catch{k(!0)}},[]),{live:B}=m(e=>{e.type===`change`&&z()},z);(0,v.useEffect)(()=>{document.title=u?`${u} · Artifacts`:`Artifacts · Ryugi`},[u]),(0,v.useEffect)(()=>{z();let e=setInterval(()=>L(Date.now()),6e4),t=e=>{let t=e.target;e.key===`/`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!t.closest(`input,textarea,[contenteditable="true"]`)&&(e.preventDefault(),R.current?.focus())};return addEventListener(`keydown`,t),()=>{clearInterval(e),removeEventListener(`keydown`,t)}},[z]);let V=E(o??[],A,M,P),H=[`all`,...n].map(e=>({value:e,label:(0,b.jsxs)(`span`,{className:`library-tab-label`,children:[r[e],(0,b.jsx)(`span`,{children:e===`all`?o?.length??0:o?.filter(t=>t.type===e).length??0})]})}));return(0,b.jsxs)(`div`,{className:`artifact-library`,children:[(0,b.jsxs)(`header`,{className:`library-topbar`,children:[(0,b.jsxs)(`div`,{className:`library-breadcrumb`,children:[(0,b.jsx)(`img`,{className:`library-logo`,src:y,alt:``}),(0,b.jsx)(`strong`,{children:`ryugi`}),(0,b.jsx)(`span`,{children:`/`}),(0,b.jsx)(`b`,{children:u||e(`common.project`)}),(0,b.jsx)(`span`,{children:`/`}),(0,b.jsx)(`span`,{children:`Artifacts`})]}),(0,b.jsxs)(`span`,{className:`library-status`,children:[(0,b.jsx)(`i`,{"data-live":B}),e(B?`library.localProject`:`library.reconnecting`)]})]}),(0,b.jsxs)(`main`,{className:`library-main`,children:[(0,b.jsxs)(`div`,{className:`library-heading`,children:[(0,b.jsx)(`h1`,{children:`Artifacts`}),(0,b.jsx)(`span`,{children:o?e(`library.count`,{count:o.length}):`…`})]}),(0,b.jsxs)(`div`,{className:`library-toolbar`,children:[(0,b.jsx)(c,{className:`library-tabs`,size:`small`,styles:{item:{height:30,paddingInline:8}},value:A,options:H,onChange:j}),(0,b.jsxs)(`div`,{className:`library-tools`,children:[(0,b.jsx)(d,{ref:R,className:`library-search`,variant:`filled`,prefix:(0,b.jsx)(s,{size:16}),suffix:(0,b.jsx)(`kbd`,{children:`/`}),"aria-label":e(`library.searchLabel`),placeholder:e(`library.searchPlaceholder`),value:M,onChange:e=>N(e.target.value)}),(0,b.jsx)(`label`,{className:`library-sr-only`,htmlFor:`artifact-sort`,children:e(`library.sortLabel`)}),(0,b.jsx)(f,{id:`artifact-sort`,className:`library-sort`,variant:`filled`,value:P,options:i,onSelect:F})]})]}),O&&(0,b.jsxs)(`div`,{className:`library-error`,role:`alert`,children:[e(`library.loadFailed`),(0,b.jsx)(a,{size:`small`,type:`text`,onClick:()=>void z(),children:e(`common.retry`)})]}),o===null&&!O&&(0,b.jsx)(`p`,{className:`library-empty`,role:`status`,children:e(`library.loadingList`)}),o?.length===0&&(0,b.jsxs)(`div`,{className:`library-empty`,children:[(0,b.jsx)(T,{size:28}),(0,b.jsx)(`h2`,{children:e(`library.emptyTitle`)}),(0,b.jsx)(`p`,{children:e(`library.emptyBody`)})]}),o!==null&&o.length>0&&V.length===0&&(0,b.jsxs)(`div`,{className:`library-empty`,children:[(0,b.jsx)(s,{size:24}),(0,b.jsx)(`h2`,{children:e(`library.noMatchTitle`)}),(0,b.jsx)(`p`,{children:e(`library.noMatchBody`)}),(0,b.jsx)(a,{size:`small`,onClick:()=>{N(``),j(`all`)},children:e(`common.clearFilter`)})]}),(0,b.jsx)(`ul`,{className:`library-grid`,"aria-label":e(`library.listLabel`),children:V.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{className:`library-card`,href:n.url??`/${n.type}/${n.id}`,"aria-label":e(`library.open`,{title:n.title}),children:[(0,b.jsx)(S,{type:n.type,src:`/api/thumbnail${n.url??`/${n.type}/${n.id}`}.svg?v=${n.updatedAt}`}),(0,b.jsxs)(`div`,{className:`library-card-info`,children:[(0,b.jsxs)(`div`,{className:`library-card-title`,children:[(0,b.jsx)(`span`,{title:n.title,children:n.title}),(0,b.jsx)(_,{size:13,"aria-hidden":`true`})]}),(0,b.jsxs)(`div`,{className:`library-card-meta`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(x,{type:n.type,size:12}),r[n.type]]}),(0,b.jsx)(`time`,{dateTime:new Date(n.updatedAt).toISOString(),title:new Date(n.updatedAt).toLocaleString(t.language),children:D(n.updatedAt,I)})]})]})]})},`${n.type}/${n.id}`))}),(0,b.jsxs)(`footer`,{className:`library-footer`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`img`,{className:`library-logo`,src:y,alt:``}),e(`library.footer`)]}),(0,b.jsxs)(`code`,{children:[u?`${u} / `:``,`.ryugi / artifacts`]})]})]}),(0,b.jsx)(h,{warnings:C})]})}export{O as ArtifactList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import"./useSystemTheme-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import"./useSystemTheme-Dzqcdh-y.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{n as r,r as i,t as a}from"./useCloudStatus-DafDIfDW.js";import{t as o}from"./useTranslation-B4Q9Bc_u.js";var s=e(t(),1),c=n();function l({status:e,onAnswer:t}){let{t:n}=o(),[r,a]=(0,s.useState)(!1);if(!e?.signedIn||e.autoPublish?.global!==null)return null;let l=async e=>{a(!0),await t(e),a(!1)};return(0,c.jsxs)(`aside`,{role:`dialog`,"aria-label":n(`autoPublish.label`),className:`xixxii4 xvf9o5y x191j7n5 x1355qak x78zum5 x1a02dak x6s0dn4 x883omv x1lwm3bp xvueqy4 xp59q4u xqin4a2 xmkeg23 x1y0btm7 x12xov25 x1q4ynmn x12ilycc x1cqdj14 xo2rkog xqfszdh xfifm61`,children:[(0,c.jsx)(i,{size:16}),(0,c.jsxs)(`span`,{className:`xk30mkq x1evy7pa`,children:[(0,c.jsx)(`span`,{className:`x1lliihq x1s688f`,children:n(`autoPublish.title`)}),(0,c.jsx)(`span`,{className:`x1lliihq x1bo0w0s`,children:n(`autoPublish.hint`)})]}),(0,c.jsxs)(`span`,{className:`x78zum5 x17d4w8g xvc5jky`,children:[(0,c.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void l(!1),className:`x12ulsxz x1awh872 xc342km x1kogg8i xahzvm9 xuzgw23 xo2rkog xqfszdh xfifm61 x1ypdohk`,children:n(`autoPublish.later`)}),(0,c.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void l(!0),className:`x12ulsxz x1awh872 xc342km x1kogg8i xqfszdh xfifm61 x1ypdohk x19ckca5 x1et1poy x1gyoqcc`,children:n(`autoPublish.turnOn`)})]})]})}function u(){let{status:e,refresh:t}=r();return(0,c.jsx)(l,{status:e,onAnswer:async e=>{await a(`POST`,`auto-publish`,{scope:`global`,value:e}),await t()}})}export{u as AutoPublishBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{i as n}from"./useSystemTheme-BVZLLsnc.js";import{n as r,t as i}from"./jsx-runtime-CldxteV5.js";import{dt as a}from"./use-presence-9dVDVxFO.js";import{t as o}from"./maximize-2-DcJIGEuQ.js";import{t as s}from"./react-CeYd-wP1.js";import{t as c}from"./useTranslation-Ci5tOdAN.js";import{l}from"./view-D0Odcpdb.js";var u={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};u.node;var d=a(u),f=e(r(),1);function p(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}var m=(e,t)=>(e[t]??0)>0,h=(e,t)=>e.interactive===!0&&m(t,e.file),g=(e,t,n,r)=>`${e}${t}?v=${n}${r>0?`&r=${r}`:``}`,_=i(),v=160,y=[1,1.5,2,.5],b=e=>{let t=Math.max(0,Math.floor(Number.isFinite(e)?e:0));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function x({playing:e}){return(0,_.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[!1,!0].map(t=>(0,_.jsx)(s.g,{initial:!1,animate:{opacity:+(e===t),scale:e===t?1:.25,filter:e===t?`blur(0px)`:`blur(4px)`},transition:{type:`spring`,duration:.3,bounce:0},style:{transformOrigin:`12px 12px`},children:t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,_.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,_.jsx)(`path`,{d:`M8 4.6c-.9-.5-2 .1-2 1.1v12.6c0 1 1.1 1.6 2 1.1l11-6.3c.9-.5.9-1.7 0-2.2Z`})},String(t)))})}function S({src:e,title:t,barScale:n,barWidth:r,onExpand:i}){let{t:a}=c(),s=(0,f.useRef)(null),l=(0,f.useRef)(null),[u,p]=(0,f.useState)(!1),[m,h]=(0,f.useState)(0),[g,S]=(0,f.useState)(0),[C,w]=(0,f.useState)(1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{O(!1),h(e.currentTime),S(e.duration),p(!e.paused)},n=[`loadedmetadata`,`timeupdate`,`play`,`pause`,`ended`,`seeked`],r=()=>O(!0);for(let r of n)e.addEventListener(r,t);return e.addEventListener(`error`,r),()=>{for(let r of n)e.removeEventListener(r,t);e.removeEventListener(`error`,r)}},[]);let k=()=>{let e=s.current;e&&(e.paused?e.play().catch(()=>p(!e.paused)):e.pause())},A=()=>{let e=y[(y.indexOf(C)+1)%y.length];s.current&&(s.current.playbackRate=e),w(e)},j=()=>{s.current&&(s.current.loop=!T),E(!T)},M=e=>{let t=s.current;if(!t||!Number.isFinite(t.duration)||t.duration<=0)return;let n=e.currentTarget.getBoundingClientRect();t.currentTime=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width))*t.duration,h(t.currentTime)};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`video`,{ref:s,src:e,title:t,muted:!0,playsInline:!0,preload:`metadata`,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x19kjcj4 x1r1mewj x47corl`}),(0,_.jsx)(`button`,{type:`button`,"data-video-surface":!0,"aria-label":a(u?`video.pauseTitle`:`video.playTitle`,{title:t}),onPointerDown:e=>{l.current={x:e.clientX,y:e.clientY}},onClick:e=>{(!e.detail||!l.current||Math.hypot(e.clientX-l.current.x,e.clientY-l.current.y)<4)&&k(),l.current=null},onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&e.stopPropagation()},className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1717udv xc342km xjbqb8w x1ypdohk x1t137rt x9v5kkp x1de99jn x1fwhx9p x1v57pqu`}),D&&(0,_.jsx)(`div`,{className:`x10l6tqk x10a8y8t xrvj5dj x1ku5rj1 x1tamke2 x15cjo92 x160uoy xqfszdh x4z9k3i x2b8uid x47corl`,children:a(`video.failed`)}),r>=v&&(0,_.jsxs)(`div`,{"data-chrome":`video-controls`,onPointerDown:e=>e.stopPropagation(),className:`x10l6tqk xu96u03 xdsb8wn xc9qbxq x9f619 x78zum5 x6s0dn4 x1v2ro7d xaope02 x1hj3fc7 x15cjo92 x178xt8z x13fuv20 x1jrcaa3 xjmch63 x1fao0z8 x1j6dyjg x67bb7w xt0e3qv x87ps6o`,style:{width:r,transform:`scale(${n})`},children:[(0,_.jsx)(`button`,{type:`button`,"aria-label":a(u?`video.pause`:`video.play`),onClick:k,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`,children:(0,_.jsx)(x,{playing:u})}),(0,_.jsxs)(`span`,{className:`x2lah0s xss6m8b`,children:[b(m),` / `,b(g)]}),(0,_.jsxs)(`div`,{role:`slider`,"aria-label":a(`video.progress`),"aria-valuemin":0,"aria-valuemax":Math.round(g||0),"aria-valuenow":Math.round(m),tabIndex:0,onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),M(e)},onPointerMove:e=>{e.buttons===1&&M(e)},className:`x1n2onr6 x98rzlu x1v9usgg x78zum5 x6s0dn4 x1ypdohk`,children:[(0,_.jsx)(`span`,{className:`x10l6tqk xu96u03 x3m8u43 xuoj239 x1ooz4j5`}),(0,_.jsx)(`span`,{className:`x10l6tqk xu96u03 xuoj239 x83z2og`,style:{width:`${g>0?m/g*100:0}%`}})]}),(0,_.jsxs)(`button`,{type:`button`,"aria-label":a(`video.speed`),onClick:A,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk x17s4nb9 x1s688f`,children:[C,`×`]}),(0,_.jsx)(`button`,{type:`button`,"aria-label":a(`video.loop`),"aria-pressed":T,onClick:j,...{0:{className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`},1:{className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w xjb2p0i x1j6dyjg x1ypdohk xh3659q xtntqbz`}}[!T|0],children:(0,_.jsx)(d,{size:14})}),i&&(0,_.jsx)(`button`,{type:`button`,"aria-label":a(`video.expand`),onClick:i,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`,children:(0,_.jsx)(o,{size:13})})]})]})}function C({id:e,board:t,src:n,zoom:r,onExpand:i}){return t.type===`video`?(0,_.jsx)(S,{src:n,title:t.title??e,barScale:1/r,barWidth:t.w*r,onExpand:i}):(0,_.jsx)(`img`,{src:n,alt:t.title??e,draggable:!1,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x19kjcj4 x83z2og x47corl`})}function w(e,t){let n=e;for(;n.length>1;)n=n.slice(0,-1).map((e,r)=>({x:e.x+(n[r+1].x-e.x)*t,y:e.y+(n[r+1].y-e.y)*t}));return n[0]}function T(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=-i,o=r;a<0&&(a=-a,o=-o);let s=(t,n)=>({x:e.x+r*t+a*n,y:e.y+i*t+o*n}),c=[e,s(.2,0),s(.3,-.5),s(1.55,1.25),s(1.35,.1),t];if(n!==void 0){let t=(n-135)*Math.PI/180,a=Math.hypot(r,i)*.2;c[1]={x:e.x+Math.cos(t)*a,y:e.y+Math.sin(t)*a}}let l=c.slice(0,-1).map((e,t)=>({x:5*(c[t+1].x-e.x),y:5*(c[t+1].y-e.y)})),u=[0],d=e;for(let e=1;e<=600;e++){let t=w(c,e/600);u.push(u[e-1]+Math.hypot(t.x-d.x,t.y-d.y)),d=t}let f=u[600];return{length:f,at(e){let t=Math.max(0,Math.min(1,e))*f,n=0,r=600;for(;r-n>1;){let e=n+r>>1;u[e]<t?n=e:r=e}let i=u[r]-u[n],a=(n+(i?(t-u[n])/i:0))/600,o=w(l,a);return{...w(c,a),angle:Math.atan2(o.y,o.x)*180/Math.PI+135}}}}var E=`M6.2 3.6C5 2.7 3.4 3.6 3.6 5.1L6 22.7C6.2 24.3 8.2 24.8 9.1 23.5L13 18.3C13.4 17.8 14 17.5 14.6 17.5L21.1 17.3C22.7 17.2 23.4 15.2 22.2 14.3Z`,D=[{distance:22,size:6,opacity:.5},{distance:29,size:4.3,opacity:.3},{distance:35,size:3,opacity:.15}];function O({x:e,y:t,zoom:n,agent:r,title:i}){let a=(0,f.useRef)(null),o=(0,f.useRef)(null),s=(0,f.useRef)(null),c=(0,f.useRef)(null),l=(0,f.useRef)(!1),u=(0,f.useRef)(n),d=e=>`translate(${e.x}px, ${e.y}px) scale(${1/u.current})`,p=e=>`translate(-3.43px, -3.43px) rotate(${e}deg)`,m=e=>{if(c.current=e,a.current&&(a.current.style.transform=d(e)),o.current&&(o.current.style.transform=p(e.angle)),!s.current)return;s.current.style.opacity=l.current?`1`:`0`;let t=(e.angle-135)*Math.PI/180;D.forEach(({distance:e,size:n},r)=>{let i=s.current.children[r];i.style.transform=`translate(${-Math.cos(t)*e-n/2}px, ${-Math.sin(t)*e-n/2}px)`})};(0,f.useLayoutEffect)(()=>{u.current=n,c.current&&m(c.current)},[n]),(0,f.useLayoutEffect)(()=>{let n=matchMedia(`(prefers-reduced-motion: reduce)`),r=c.current,i=0,a=()=>{cancelAnimationFrame(i),i=0,l.current=!1,m({x:e,y:t,angle:c.current?.angle??0})};if(!r||n.matches||Math.hypot(e-r.x,t-r.y)*u.current<2)a();else{let n=T(r,{x:e,y:t},l.current?r.angle:void 0),a=Math.min(1800,900+n.length*u.current*1.2),o=performance.now(),s=o;l.current=!0;let d=e=>{let t=Math.min(1,Math.max(0,(e-o)/a)),r=n.at(t**3*(t*(t*6-15)+10)),u=c.current.angle;r.angle=u+(((r.angle-u)%360+540)%360-180)*(1-Math.exp(-(e-s)/80)),s=e,l.current=t<1,m(r),i=t<1?requestAnimationFrame(d):0};i=requestAnimationFrame(d)}let o=()=>{n.matches&&a()};return n.addEventListener(`change`,o),()=>{cancelAnimationFrame(i),n.removeEventListener(`change`,o)}},[e,t]);let h=c.current??{x:e,y:t,angle:0};return(0,_.jsxs)(`div`,{ref:a,role:`status`,"aria-label":`${r} last worked on ${i}`,className:`x10l6tqk xu96u03 x13vifvy x1u8a7rm x47corl x1hj3fc7`,style:{transform:d(h)},children:[(0,_.jsx)(`div`,{ref:s,"data-trail":``,"aria-hidden":`true`,className:`x10l6tqk xu96u03 x13vifvy x19991ni x13dflua`,style:{opacity:0},children:D.map(({size:e,opacity:t})=>(0,_.jsx)(`div`,{className:`x10l6tqk xu96u03 x13vifvy x16rqkct x18t3gi2`,style:{width:e,height:e,opacity:t}},e))}),(0,_.jsxs)(`svg`,{ref:o,width:`24`,height:`24`,viewBox:`0 0 28 28`,"aria-hidden":`true`,className:`x1lliihq xqqlr9g x1h6g33g`,style:{transform:p(h.angle)},children:[(0,_.jsx)(`path`,{d:E,fill:`none`,stroke:`#fff`,strokeWidth:`4`,strokeLinejoin:`round`}),(0,_.jsx)(`path`,{d:E,className:`x5sgsw0`})]}),(0,_.jsxs)(`span`,{"data-cursor-ring":``,className:`x10l6tqk x1trqr8e xv4lvxq x78zum5 x6s0dn4 x1219o5k x1w2h69v x25sj25 x7mq5nd x1e6avla xyq41xo xfungia x1j6dyjg x1xlr1w8 x152skdk xuxw1ft x14wndiz`,children:[(0,_.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,_.jsx)(`path`,{d:`M6 1Q6.8 5.2 11 6Q6.8 6.8 6 11Q5.2 6.8 1 6Q5.2 5.2 6 1Z`,fill:`#fff`})}),r]})]})}var k=t({Canvas:()=>P});function A(e){if(!e)return{backgroundColor:`#fff6db`,color:`#3d2e00`};let t=e.length===4?e.slice(1).split(``).map(e=>e+e).join(``):e.slice(1),[n,r,i]=[0,2,4].map(e=>{let n=parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4});return{backgroundColor:e,color:.2126*n+.7152*r+.0722*i>.179?`#000`:`#fff`}}var j={visibility:`hidden`},M={opacity:0};function N({image:e,showImage:t,hideFrame:n,frame:r,onError:i}){let[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(t);(0,f.useEffect)(()=>{if(!t||!a){c(!1);return}let e=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(e)},[t,a]),(0,f.useEffect)(()=>{let e=d.current;if(d.current=t,t||!e)return;u(!0);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>u(!1))});return()=>cancelAnimationFrame(n)},[t]);let p=t||l,m=e?a&&a!==e?[a,e]:[e]:[];return(0,_.jsxs)(_.Fragment,{children:[r?.(n&&s),m.map(t=>(0,_.jsx)(`img`,{alt:``,src:t,decoding:`async`,draggable:!1,onLoad:t===e?t=>{(t.currentTarget.decode?.()??Promise.resolve()).catch(()=>void 0).then(()=>o(e))}:void 0,onError:t===e?()=>i(e):void 0,style:p&&t===a?void 0:j,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x47corl`},t))]})}function P({view:e,renders:t,boards:r,notes:i,contentBase:a,versions:o,pending:s,playing:c,replays:u,inspecting:d,frameRef:f,frameLoaded:p,live:v,writing:y,agent:b,onExpand:x,onImageError:S}){let w=y;if(v){w=void 0;let e=0;for(let[t,i]of r){let r=o[i.file]??0;n(i)||s.has(t)||r<=e||(w=t,e=r)}}let T=r.find(([e])=>e===w)?.[1];return(0,_.jsxs)(`div`,{className:`x10l6tqk xu96u03 x13vifvy x1hj3fc7`,style:{transform:`translate(${e.x}px, ${e.y}px) scale(${e.k})`},children:[r.map(([r,i])=>{let l=m(o,i.file)&&!s.has(r),v=l?t.get(r):void 0,b=n(i),w=b?!!v&&(v.tier!==`empty`||c.has(r)):!!v?.mounted,T=b?null:v?.image??null,E=r===y,D={left:i.x,top:i.y,width:i.w,height:i.h};return(0,_.jsx)(`div`,{"data-board":r,"aria-busy":E||void 0,...{0:{className:`x10l6tqk`},2:{className:`x10l6tqk x78zum5 x6s0dn4 xl56j7k xb3r6kr xahzvm9 x1qgsegg xaatb59 x1tjb3dp x47corl`},1:{className:`x10l6tqk xaatb59 xc6r98 xkizt71`},3:{className:`x10l6tqk x78zum5 x6s0dn4 xl56j7k xb3r6kr xahzvm9 x1qgsegg x47corl xaatb59 xc6r98 xkizt71`}}[!w<<1|!!E],style:{...D,...E?{outlineWidth:2/e.k}:{}},children:w&&b?(0,_.jsx)(C,{id:r,board:i,src:g(a,i.file,o[i.file]??0,0),zoom:e.k,onExpand:x&&(()=>x(r))}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(N,{image:T,showImage:!w||!!v?.overlay,hideFrame:!!v?.hidden,onError:e=>S?.(r,e),frame:w?e=>(0,_.jsx)(`iframe`,{ref:f(r),onLoad:()=>p(r),style:e?M:void 0,title:i.title??r,src:g(a,i.file,o[i.file]??0,u[r]??0),sandbox:`allow-scripts`,...{0:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og x47corl x1qgsegg xaatb59 x1tjb3dp`},2:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og x1qgsegg xaatb59 x1tjb3dp x67bb7w`},1:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og xaatb59 x67bb7w x1de99jn xc6r98`},3:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og xaatb59 x67bb7w x1de99jn xc6r98`}}[!!d<<1|!!(h(i,o)&&c.has(r))]}):null}),!l&&(0,_.jsx)(`span`,{className:`x1bo0w0s xqfszdh xfifm61`,children:E?`Drawing…`:`Waiting…`})]})},r)}),i.map(([t,n])=>n.kind===`title`?(0,_.jsx)(`h2`,{className:`x10l6tqk x1ghz6dp x1xlr1w8 x1uo3zyz xjat59b xo2rkog x1bd091l`,style:{left:n.x,top:n.y,width:n.w,whiteSpace:n.w===void 0?`nowrap`:`normal`,fontSize:n.size??96,transform:`scale(${l(n.size??96,e.k)})`},children:n.text},t):(0,_.jsx)(`div`,{className:`x10l6tqk x12oqio5 x126k92a xj0a0fe x8zfma2`,style:{left:n.x,top:n.y,width:n.w??240,padding:16,fontSize:18,lineHeight:`27px`,...A(n.color)},children:n.text},t)),T&&(0,_.jsx)(O,{x:T.x+Math.min(64,T.w*.15),y:T.y+Math.min(80,T.h*.2),zoom:e.k,agent:b??`Agent`,title:T.title??w})]})}export{m as a,S as i,k as n,h as o,C as r,p as s,P as t};
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{i as n}from"./useSystemTheme-Dzqcdh-y.js";import{n as r,t as i}from"./jsx-runtime-CldxteV5.js";import{dt as a}from"./use-presence-9dVDVxFO.js";import{t as o}from"./maximize-2-DcJIGEuQ.js";import{t as s}from"./react-CeYd-wP1.js";import{t as c}from"./useTranslation-B4Q9Bc_u.js";import{l}from"./view-R1KProyl.js";var u={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};u.node;var d=a(u),f=e(r(),1);function p(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}var m=(e,t)=>(e[t]??0)>0,h=(e,t)=>e.interactive===!0&&m(t,e.file),g=(e,t,n,r)=>`${e}${t}?v=${n}${r>0?`&r=${r}`:``}`,_=i(),v=160,y=[1,1.5,2,.5],b=e=>{let t=Math.max(0,Math.floor(Number.isFinite(e)?e:0));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function x({playing:e}){return(0,_.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[!1,!0].map(t=>(0,_.jsx)(s.g,{initial:!1,animate:{opacity:+(e===t),scale:e===t?1:.25,filter:e===t?`blur(0px)`:`blur(4px)`},transition:{type:`spring`,duration:.3,bounce:0},style:{transformOrigin:`12px 12px`},children:t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,_.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,_.jsx)(`path`,{d:`M8 4.6c-.9-.5-2 .1-2 1.1v12.6c0 1 1.1 1.6 2 1.1l11-6.3c.9-.5.9-1.7 0-2.2Z`})},String(t)))})}function S({src:e,title:t,barScale:n,barWidth:r,onExpand:i}){let{t:a}=c(),s=(0,f.useRef)(null),l=(0,f.useRef)(null),[u,p]=(0,f.useState)(!1),[m,h]=(0,f.useState)(0),[g,S]=(0,f.useState)(0),[C,w]=(0,f.useState)(1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{O(!1),h(e.currentTime),S(e.duration),p(!e.paused)},n=[`loadedmetadata`,`timeupdate`,`play`,`pause`,`ended`,`seeked`],r=()=>O(!0);for(let r of n)e.addEventListener(r,t);return e.addEventListener(`error`,r),()=>{for(let r of n)e.removeEventListener(r,t);e.removeEventListener(`error`,r)}},[]);let k=()=>{let e=s.current;e&&(e.paused?e.play().catch(()=>p(!e.paused)):e.pause())},A=()=>{let e=y[(y.indexOf(C)+1)%y.length];s.current&&(s.current.playbackRate=e),w(e)},j=()=>{s.current&&(s.current.loop=!T),E(!T)},M=e=>{let t=s.current;if(!t||!Number.isFinite(t.duration)||t.duration<=0)return;let n=e.currentTarget.getBoundingClientRect();t.currentTime=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width))*t.duration,h(t.currentTime)};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`video`,{ref:s,src:e,title:t,muted:!0,playsInline:!0,preload:`metadata`,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x19kjcj4 x1r1mewj x47corl`}),(0,_.jsx)(`button`,{type:`button`,"data-video-surface":!0,"aria-label":a(u?`video.pauseTitle`:`video.playTitle`,{title:t}),onPointerDown:e=>{l.current={x:e.clientX,y:e.clientY}},onClick:e=>{(!e.detail||!l.current||Math.hypot(e.clientX-l.current.x,e.clientY-l.current.y)<4)&&k(),l.current=null},onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&e.stopPropagation()},className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1717udv xc342km xjbqb8w x1ypdohk x1t137rt x9v5kkp x1de99jn x1fwhx9p x1v57pqu`}),D&&(0,_.jsx)(`div`,{className:`x10l6tqk x10a8y8t xrvj5dj x1ku5rj1 x1tamke2 x15cjo92 x160uoy xqfszdh x4z9k3i x2b8uid x47corl`,children:a(`video.failed`)}),r>=v&&(0,_.jsxs)(`div`,{"data-chrome":`video-controls`,onPointerDown:e=>e.stopPropagation(),className:`x10l6tqk xu96u03 xdsb8wn xc9qbxq x9f619 x78zum5 x6s0dn4 x1v2ro7d xaope02 x1hj3fc7 x15cjo92 x178xt8z x13fuv20 x1jrcaa3 xjmch63 x1fao0z8 x1j6dyjg x67bb7w xt0e3qv x87ps6o`,style:{width:r,transform:`scale(${n})`},children:[(0,_.jsx)(`button`,{type:`button`,"aria-label":a(u?`video.pause`:`video.play`),onClick:k,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`,children:(0,_.jsx)(x,{playing:u})}),(0,_.jsxs)(`span`,{className:`x2lah0s xss6m8b`,children:[b(m),` / `,b(g)]}),(0,_.jsxs)(`div`,{role:`slider`,"aria-label":a(`video.progress`),"aria-valuemin":0,"aria-valuemax":Math.round(g||0),"aria-valuenow":Math.round(m),tabIndex:0,onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),M(e)},onPointerMove:e=>{e.buttons===1&&M(e)},className:`x1n2onr6 x98rzlu x1v9usgg x78zum5 x6s0dn4 x1ypdohk`,children:[(0,_.jsx)(`span`,{className:`x10l6tqk xu96u03 x3m8u43 xuoj239 x1ooz4j5`}),(0,_.jsx)(`span`,{className:`x10l6tqk xu96u03 xuoj239 x83z2og`,style:{width:`${g>0?m/g*100:0}%`}})]}),(0,_.jsxs)(`button`,{type:`button`,"aria-label":a(`video.speed`),onClick:A,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk x17s4nb9 x1s688f`,children:[C,`×`]}),(0,_.jsx)(`button`,{type:`button`,"aria-label":a(`video.loop`),"aria-pressed":T,onClick:j,...{0:{className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`},1:{className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w xjb2p0i x1j6dyjg x1ypdohk xh3659q xtntqbz`}}[!T|0],children:(0,_.jsx)(d,{size:14})}),i&&(0,_.jsx)(`button`,{type:`button`,"aria-label":a(`video.expand`),onClick:i,className:`x2lah0s xrvj5dj x1ku5rj1 x1717udv xc342km xjbqb8w x1a853yn x1iih0q2 xjb2p0i x1j6dyjg x1ypdohk`,children:(0,_.jsx)(o,{size:13})})]})]})}function C({id:e,board:t,src:n,zoom:r,onExpand:i}){return t.type===`video`?(0,_.jsx)(S,{src:n,title:t.title??e,barScale:1/r,barWidth:t.w*r,onExpand:i}):(0,_.jsx)(`img`,{src:n,alt:t.title??e,draggable:!1,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x19kjcj4 x83z2og x47corl`})}function w(e,t){let n=e;for(;n.length>1;)n=n.slice(0,-1).map((e,r)=>({x:e.x+(n[r+1].x-e.x)*t,y:e.y+(n[r+1].y-e.y)*t}));return n[0]}function T(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=-i,o=r;a<0&&(a=-a,o=-o);let s=(t,n)=>({x:e.x+r*t+a*n,y:e.y+i*t+o*n}),c=[e,s(.2,0),s(.3,-.5),s(1.55,1.25),s(1.35,.1),t];if(n!==void 0){let t=(n-135)*Math.PI/180,a=Math.hypot(r,i)*.2;c[1]={x:e.x+Math.cos(t)*a,y:e.y+Math.sin(t)*a}}let l=c.slice(0,-1).map((e,t)=>({x:5*(c[t+1].x-e.x),y:5*(c[t+1].y-e.y)})),u=[0],d=e;for(let e=1;e<=600;e++){let t=w(c,e/600);u.push(u[e-1]+Math.hypot(t.x-d.x,t.y-d.y)),d=t}let f=u[600];return{length:f,at(e){let t=Math.max(0,Math.min(1,e))*f,n=0,r=600;for(;r-n>1;){let e=n+r>>1;u[e]<t?n=e:r=e}let i=u[r]-u[n],a=(n+(i?(t-u[n])/i:0))/600,o=w(l,a);return{...w(c,a),angle:Math.atan2(o.y,o.x)*180/Math.PI+135}}}}var E=`M6.2 3.6C5 2.7 3.4 3.6 3.6 5.1L6 22.7C6.2 24.3 8.2 24.8 9.1 23.5L13 18.3C13.4 17.8 14 17.5 14.6 17.5L21.1 17.3C22.7 17.2 23.4 15.2 22.2 14.3Z`,D=[{distance:22,size:6,opacity:.5},{distance:29,size:4.3,opacity:.3},{distance:35,size:3,opacity:.15}];function O({x:e,y:t,zoom:n,agent:r,title:i}){let a=(0,f.useRef)(null),o=(0,f.useRef)(null),s=(0,f.useRef)(null),c=(0,f.useRef)(null),l=(0,f.useRef)(!1),u=(0,f.useRef)(n),d=e=>`translate(${e.x}px, ${e.y}px) scale(${1/u.current})`,p=e=>`translate(-3.43px, -3.43px) rotate(${e}deg)`,m=e=>{if(c.current=e,a.current&&(a.current.style.transform=d(e)),o.current&&(o.current.style.transform=p(e.angle)),!s.current)return;s.current.style.opacity=l.current?`1`:`0`;let t=(e.angle-135)*Math.PI/180;D.forEach(({distance:e,size:n},r)=>{let i=s.current.children[r];i.style.transform=`translate(${-Math.cos(t)*e-n/2}px, ${-Math.sin(t)*e-n/2}px)`})};(0,f.useLayoutEffect)(()=>{u.current=n,c.current&&m(c.current)},[n]),(0,f.useLayoutEffect)(()=>{let n=matchMedia(`(prefers-reduced-motion: reduce)`),r=c.current,i=0,a=()=>{cancelAnimationFrame(i),i=0,l.current=!1,m({x:e,y:t,angle:c.current?.angle??0})};if(!r||n.matches||Math.hypot(e-r.x,t-r.y)*u.current<2)a();else{let n=T(r,{x:e,y:t},l.current?r.angle:void 0),a=Math.min(1800,900+n.length*u.current*1.2),o=performance.now(),s=o;l.current=!0;let d=e=>{let t=Math.min(1,Math.max(0,(e-o)/a)),r=n.at(t**3*(t*(t*6-15)+10)),u=c.current.angle;r.angle=u+(((r.angle-u)%360+540)%360-180)*(1-Math.exp(-(e-s)/80)),s=e,l.current=t<1,m(r),i=t<1?requestAnimationFrame(d):0};i=requestAnimationFrame(d)}let o=()=>{n.matches&&a()};return n.addEventListener(`change`,o),()=>{cancelAnimationFrame(i),n.removeEventListener(`change`,o)}},[e,t]);let h=c.current??{x:e,y:t,angle:0};return(0,_.jsxs)(`div`,{ref:a,role:`status`,"aria-label":`${r} last worked on ${i}`,className:`x10l6tqk xu96u03 x13vifvy x1u8a7rm x47corl x1hj3fc7`,style:{transform:d(h)},children:[(0,_.jsx)(`div`,{ref:s,"data-trail":``,"aria-hidden":`true`,className:`x10l6tqk xu96u03 x13vifvy x19991ni x13dflua`,style:{opacity:0},children:D.map(({size:e,opacity:t})=>(0,_.jsx)(`div`,{className:`x10l6tqk xu96u03 x13vifvy x16rqkct x18t3gi2`,style:{width:e,height:e,opacity:t}},e))}),(0,_.jsxs)(`svg`,{ref:o,width:`24`,height:`24`,viewBox:`0 0 28 28`,"aria-hidden":`true`,className:`x1lliihq xqqlr9g x1h6g33g`,style:{transform:p(h.angle)},children:[(0,_.jsx)(`path`,{d:E,fill:`none`,stroke:`#fff`,strokeWidth:`4`,strokeLinejoin:`round`}),(0,_.jsx)(`path`,{d:E,className:`x5sgsw0`})]}),(0,_.jsxs)(`span`,{"data-cursor-ring":``,className:`x10l6tqk x1trqr8e xv4lvxq x78zum5 x6s0dn4 x1219o5k x1w2h69v x25sj25 x7mq5nd x1e6avla xyq41xo xfungia x1j6dyjg x1xlr1w8 x152skdk xuxw1ft x14wndiz`,children:[(0,_.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,_.jsx)(`path`,{d:`M6 1Q6.8 5.2 11 6Q6.8 6.8 6 11Q5.2 6.8 1 6Q5.2 5.2 6 1Z`,fill:`#fff`})}),r]})]})}var k=t({Canvas:()=>P});function A(e){if(!e)return{backgroundColor:`#fff6db`,color:`#3d2e00`};let t=e.length===4?e.slice(1).split(``).map(e=>e+e).join(``):e.slice(1),[n,r,i]=[0,2,4].map(e=>{let n=parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4});return{backgroundColor:e,color:.2126*n+.7152*r+.0722*i>.179?`#000`:`#fff`}}var j={visibility:`hidden`},M={opacity:0};function N({image:e,showImage:t,hideFrame:n,frame:r,onError:i}){let[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(t);(0,f.useEffect)(()=>{if(!t||!a){c(!1);return}let e=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(e)},[t,a]),(0,f.useEffect)(()=>{let e=d.current;if(d.current=t,t||!e)return;u(!0);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>u(!1))});return()=>cancelAnimationFrame(n)},[t]);let p=t||l,m=e?a&&a!==e?[a,e]:[e]:[];return(0,_.jsxs)(_.Fragment,{children:[r?.(n&&s),m.map(t=>(0,_.jsx)(`img`,{alt:``,src:t,decoding:`async`,draggable:!1,onLoad:t===e?t=>{(t.currentTarget.decode?.()??Promise.resolve()).catch(()=>void 0).then(()=>o(e))}:void 0,onError:t===e?()=>i(e):void 0,style:p&&t===a?void 0:j,className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x47corl`},t))]})}function P({view:e,renders:t,boards:r,notes:i,contentBase:a,versions:o,pending:s,playing:c,replays:u,inspecting:d,frameRef:f,frameLoaded:p,live:v,writing:y,agent:b,onExpand:x,onImageError:S}){let w=y;if(v){w=void 0;let e=0;for(let[t,i]of r){let r=o[i.file]??0;n(i)||s.has(t)||r<=e||(w=t,e=r)}}let T=r.find(([e])=>e===w)?.[1];return(0,_.jsxs)(`div`,{className:`x10l6tqk xu96u03 x13vifvy x1hj3fc7`,style:{transform:`translate(${e.x}px, ${e.y}px) scale(${e.k})`},children:[r.map(([r,i])=>{let l=m(o,i.file)&&!s.has(r),v=l?t.get(r):void 0,b=n(i),w=b?!!v&&(v.tier!==`empty`||c.has(r)):!!v?.mounted,T=b?null:v?.image??null,E=r===y,D={left:i.x,top:i.y,width:i.w,height:i.h};return(0,_.jsx)(`div`,{"data-board":r,"aria-busy":E||void 0,...{0:{className:`x10l6tqk`},2:{className:`x10l6tqk x78zum5 x6s0dn4 xl56j7k xb3r6kr xahzvm9 x1qgsegg xaatb59 x1tjb3dp x47corl`},1:{className:`x10l6tqk xaatb59 xc6r98 xkizt71`},3:{className:`x10l6tqk x78zum5 x6s0dn4 xl56j7k xb3r6kr xahzvm9 x1qgsegg x47corl xaatb59 xc6r98 xkizt71`}}[!w<<1|!!E],style:{...D,...E?{outlineWidth:2/e.k}:{}},children:w&&b?(0,_.jsx)(C,{id:r,board:i,src:g(a,i.file,o[i.file]??0,0),zoom:e.k,onExpand:x&&(()=>x(r))}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(N,{image:T,showImage:!w||!!v?.overlay,hideFrame:!!v?.hidden,onError:e=>S?.(r,e),frame:w?e=>(0,_.jsx)(`iframe`,{ref:f(r),onLoad:()=>p(r),style:e?M:void 0,title:i.title??r,src:g(a,i.file,o[i.file]??0,u[r]??0),sandbox:`allow-scripts`,...{0:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og x47corl x1qgsegg xaatb59 x1tjb3dp`},2:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og x1qgsegg xaatb59 x1tjb3dp x67bb7w`},1:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og xaatb59 x67bb7w x1de99jn xc6r98`},3:{className:`x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq xc342km x83z2og xaatb59 x67bb7w x1de99jn xc6r98`}}[!!d<<1|!!(h(i,o)&&c.has(r))]}):null}),!l&&(0,_.jsx)(`span`,{className:`x1bo0w0s xqfszdh xfifm61`,children:E?`Drawing…`:`Waiting…`})]})},r)}),i.map(([t,n])=>n.kind===`title`?(0,_.jsx)(`h2`,{className:`x10l6tqk x1ghz6dp x1xlr1w8 x1uo3zyz xjat59b xo2rkog x1bd091l`,style:{left:n.x,top:n.y,width:n.w,whiteSpace:n.w===void 0?`nowrap`:`normal`,fontSize:n.size??96,transform:`scale(${l(n.size??96,e.k)})`},children:n.text},t):(0,_.jsx)(`div`,{className:`x10l6tqk x12oqio5 x126k92a xj0a0fe x8zfma2`,style:{left:n.x,top:n.y,width:n.w??240,padding:16,fontSize:18,lineHeight:`27px`,...A(n.color)},children:n.text},t)),T&&(0,_.jsx)(O,{x:T.x+Math.min(64,T.w*.15),y:T.y+Math.min(80,T.h*.2),zoom:e.k,agent:b??`Agent`,title:T.title??w})]})}export{m as a,S as i,k as n,h as o,C as r,p as s,P as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocumentPage-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{f as t}from"./useSystemTheme-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocumentPage-BgoMJYd6.js","./rolldown-runtime-COiEfhsA.js","./useSystemTheme-Dzqcdh-y.js","./jsx-runtime-CldxteV5.js","./index.css","./MenuRoot-CCLU8wQR.js","./use-presence-9dVDVxFO.js","./channel-CK8VjRfv.js","./TooltipPopup-CdpS4tTR.js","./PopoverPopup-By2qMtdn.js","./itemEquality-C3XfrMi2.js","./ThreadView-CmAxKSZ7.js","./useTranslation-B4Q9Bc_u.js","./imperative-_CkvZv3L.js","./maximize-2-DcJIGEuQ.js","./search-y2-lADui.js","./ordinal-BDEzSJ7C.js","./init-C-OQMol4.js","./string-DqZmcFr9.js","./path-fybaL0A-.js","./math-Bi_r_ZWc.js","./array-BifhSqXX.js","./linear-CNEal4Ob.js","./useSandboxFrame-Bz-L2PEg.js","./index2.css","./useTypeFavicon-B01CcUw4.js","./useCloudStatus-DafDIfDW.js","./useArtifactSocket-L4eDpLQm.js","./useControlledState-iAGxiKP2.js","./type-icons-BhI8cIWS.js","./react-CeYd-wP1.js","./WarningsBadge-xIuKcdGp.js","./selection-DiNkp8_u.js","./DocumentPage-ClCMRXt7.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{f as t}from"./useSystemTheme-Dzqcdh-y.js";import{n,t as r}from"./jsx-runtime-CldxteV5.js";var i=e(n(),1),a=r(),o=(0,i.lazy)(()=>t(()=>import(`./shims-DAMrW7mQ.js`).then(()=>t(()=>import(`./DocumentPage-BgoMJYd6.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]),import.meta.url)),[],import.meta.url));function s({id:e}){return(0,a.jsx)(i.Suspense,{fallback:null,children:(0,a.jsx)(o,{id:e})})}export{s as DocumentLayout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,o as n,s as r}from"./useSystemTheme-BVZLLsnc.js";import{n as i,t as a}from"./jsx-runtime-CldxteV5.js";import{Fi as o,ur as s}from"./MenuRoot-CwCVByOp.js";import{dt as c}from"./use-presence-9dVDVxFO.js";import{$ as l,B as u,C as d,D as f,F as p,G as m,H as h,I as g,J as _,K as v,L as y,M as b,N as x,O as S,P as C,Q as w,R as T,S as E,T as D,U as O,V as k,W as A,X as ee,Xn as j,Y as te,Yn as ne,Z as M,_ as N,a as re,at as ie,b as P,c as F,d as I,et as L,f as ae,g as oe,i as R,it as z,j as se,k as ce,l as B,m as le,n as ue,nt as de,o as fe,p as pe,q as me,r as he,rt as V,s as ge,t as _e,tt as H,u as ve,v as ye,w as be,x as xe,y as Se,z as Ce}from"./channel-CgSk2sDt.js";import{c as we,l as Te,n as Ee,o as De,t as Oe}from"./useTypeFavicon-B--Z-Uwv.js";import{b as ke}from"./itemEquality-Dx2kxFQI.js";import{T as Ae,_ as je,c as Me,d as Ne,g as Pe,h as Fe,i as Ie,m as Le,o as Re,s as ze}from"./ThreadView-Qlz9Ufo7.js";import{n as Be}from"./useArtifactSocket-L4eDpLQm.js";import{t as Ve}from"./WarningsBadge-BtRPiCiS.js";import{a as He,o as Ue,t as We}from"./selection-BUarVaVG.js";var Ge={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Ge.node;var Ke=c(Ge),qe={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};qe.node;var Je=c(qe),U=e(i(),1);function Ye({streaming:e,pending:t,agentActiveAt:n,now:r}){if(e)return{kind:`editing`};if(t===0)return{kind:`idle`};if(n===void 0)return{kind:`working`,pending:t,idleMs:null};let i=Math.max(0,r-n);return i>3e5?{kind:`stale`,pending:t,idleMs:i}:{kind:`working`,pending:t,idleMs:i}}function Xe(e){return e<6e4?t.t(`time.seconds`,{count:Math.floor(e/1e3)}):e<36e5?t.t(`time.minutes`,{count:Math.floor(e/6e4)}):t.t(`time.hours`,{count:Math.floor(e/36e5)})}function Ze(e,n,r){switch(e.kind){case`editing`:return r?t.t(`activity.editingSection`,{agent:n,section:r}):t.t(`activity.editing`,{agent:n});case`idle`:return null;case`working`:{let r=t.t(`activity.pending`,{agent:n,count:e.pending});return e.idleMs===null?r:e.idleMs<1e4?t.t(`activity.updatedJustNow`,{left:r}):t.t(`activity.updatedAgo`,{left:r,duration:Xe(e.idleMs)})}case`stale`:return t.t(`activity.stale`,{agent:n,duration:Xe(e.idleMs),count:e.pending})}}async function Qe(e){await new Promise(e=>setTimeout(e,0));let t=[...e.getAllChanges().values()].flat().sort((e,t)=>e.lamport-t.lamport||e.peer.localeCompare(t.peer)||e.counter-t.counter),n=e.shallowSinceFrontiers(),r=e.frontiersToVV(n),i=[],a=[];try{for(let n of t){r.setLast({peer:n.peer,counter:n.counter+n.length-1});let t={id:`${n.counter}@${n.peer}`,change:n,frontiers:e.vvToFrontiers(r)};i.push(t);let o=n.message===`human`?`human`:n.message?.startsWith(`agent:`)?`agent`:n.message?.startsWith(`session `)?`session`:`unknown`,s=a.at(-1),c=s?.entries.at(-1)?.change;s&&c&&o!==`unknown`&&s.source===o&&c.peer===n.peer&&c.timestamp>0&&n.timestamp>=c.timestamp&&n.timestamp-c.timestamp<=60?(s.entries.push(t),s.id=t.id):a.push({id:t.id,source:o,entries:[t]}),i.length%200==0&&await new Promise(e=>setTimeout(e,0))}}finally{r.free()}return{entries:i,groups:a.reverse(),shallow:n.length>0}}function $e(e,n,r){let i=e.fork(),a;try{i.checkout(n);let e=i.getTree(Se).roots();if(e.length!==1)throw Error(t.t(`history.contentUnavailable`));let o=me({nodes:r,editable:!1,onError:e=>{throw e}});a=P(o,i);let s=e[0].children()??[],c=new Map,l=(e,t)=>{c.set(e.id,t),e.children()?.forEach(e=>l(e,t))};return s.forEach(e=>l(e,e.id)),{value:o.getEditorState().toJSON(),ids:s.map(e=>e.id),owners:c}}finally{a?.dispose(),i.free()}}var et=/^cid:(\d+@\d+):Map$/;function tt(e,t,n){let r=new Map(n.flatMap(e=>[...e.owners])),i=e.getTree(Se),a=new Map,o=new Map(t.map((e,t)=>[e,t])),s=(e,t)=>{let n=a.get(e);(!n||o.get(n)<o.get(t))&&a.set(e,t)};for(let n of t){let{peer:t,counter:i,length:a}=n.change;for(let o of e.getChangedContainersIn({peer:t,counter:i},a)){let t=e.getContainerById(o);for(;t;){let e=et.exec(t.id)?.[1],i=e&&r.get(e);if(i){s(i,n);break}t=t.parent()}}}let c=e=>e&&t.find(({change:t})=>t.peer===e.peer&&t.counter<=e.counter&&e.counter<t.counter+t.length);for(let e of new Set(r.values())){if(!i.isNodeDeleted(e))continue;let t=c(i.getNodeByID(e)?.getLastMoveId());t&&s(e,t)}return a}var nt=5e4,rt=`background-color: color-mix(in srgb, var(--rc-alert-caution) 22%, transparent); text-decoration: line-through;`,it=`background-color: color-mix(in srgb, var(--rc-alert-tip) 22%, transparent);`;function W(e){let t=e;return t.type===`heading`?`heading:${t.tag}`:t.type===`list`?`list:${t.listType}`:t.type||`unknown`}function at(e,t){return JSON.stringify(e)===JSON.stringify(t)}function G(e){let t=e;return t.type===`text`&&typeof t.text==`string`}function K(e){let t=e;return Array.isArray(t.children)?t.children:null}function ot(e,t){let n=typeof e==`string`?e.trim():``;return n?`${n}${n.endsWith(`;`)?``:`;`} ${t}`:t}function q(e,t,n){let{style:r}=e;return n===`delete`?r=ot(r,rt):n===`insert`&&(r=ot(r,it)),{...e,text:t,style:r}}function J(e,t){return{...e,children:t}}function Y(e,t){if(G(e))return q(e,e.text,t);let n=K(e);return n?J(e,n.map(e=>Y(e,t))):e}function st(e){return Array.from(e).reverse().join(``)}function ct(e){let t=[];for(let n of e){if(!n.text)continue;let e=t.at(-1);e&&e.kind===n.kind?e.text+=n.text:t.push({...n})}return t}function lt(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===0)return[{kind:`insert`,text:t.join(``)}];if(r===0)return[{kind:`delete`,text:e.join(``)}];if(n*r>nt)return[{kind:`delete`,text:e.join(``)},{kind:`insert`,text:t.join(``)}];let i=Array.from({length:n+1},()=>Array.from({length:r+1}).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]+1:i[a][n]=Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r;for(;o>0&&s>0;)if(e[o-1]===t[s-1]){let t=a.at(-1);t&&t.kind===`equal`?t.text+=e[o-1]:a.push({kind:`equal`,text:e[o-1]}),o--,s--}else if(i[o-1][s]>=i[o][s-1]){let t=a.at(-1);t&&t.kind===`delete`?t.text+=e[o-1]:a.push({kind:`delete`,text:e[o-1]}),o--}else{let e=a.at(-1);e&&e.kind===`insert`?e.text+=t[s-1]:a.push({kind:`insert`,text:t[s-1]}),s--}for(;o>0;){let t=a.at(-1);t&&t.kind===`delete`?t.text+=e[o-1]:a.push({kind:`delete`,text:e[o-1]}),o--}for(;s>0;){let e=a.at(-1);e&&e.kind===`insert`?e.text+=t[s-1]:a.push({kind:`insert`,text:t[s-1]}),s--}return ct(a.reverse().map(e=>({kind:e.kind,text:st(e.text)})))}function ut(e,t){let n=Array.from(e),r=Array.from(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.length-1,o=r.length-1;for(;a>=i&&o>=i&&n[a]===r[o];)a--,o--;let s=[];return i>0&&s.push({kind:`equal`,text:n.slice(0,i).join(``)}),s.push(...lt(n.slice(i,a+1),r.slice(i,o+1))),a<n.length-1&&s.push({kind:`equal`,text:n.slice(a+1).join(``)}),ct(s)}function dt(e,t){let n=ut(e.text,t.text),r=[],i=[],a=!1;for(let o of n)o.text&&(o.kind===`equal`?(r.push(q(e,o.text)),i.push(q(t,o.text))):(a=!0,o.kind===`delete`?r.push(q(e,o.text,`delete`)):i.push(q(t,o.text,`insert`))));return{oldNodes:r.length>0?r:[e],newNodes:i.length>0?i:[t],changed:a}}function ft(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array.from({length:r+1}).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++){let r=Math.max(i[a-1][n],i[a][n-1]);if(W(e[a-1])===W(t[n-1])){let o=at(e[a-1],t[n-1])?2:1;i[a][n]=Math.max(r,i[a-1][n-1]+o)}else i[a][n]=r}let a=[],o=n,s=r;for(;o>0&&s>0;){if(W(e[o-1])===W(t[s-1])){let n=at(e[o-1],t[s-1]),r=n?2:1;if(i[o][s]===i[o-1][s-1]+r){a.push(n?{kind:`equal`,node:e[o-1]}:{kind:`modify`,oldNode:e[o-1],newNode:t[s-1]}),o--,s--;continue}}i[o-1][s]>=i[o][s-1]?(a.push({kind:`delete`,node:e[o-1]}),o--):(a.push({kind:`insert`,node:t[s-1]}),s--)}for(;o>0;)a.push({kind:`delete`,node:e[--o]});for(;s>0;)a.push({kind:`insert`,node:t[--s]});return a.reverse(),a}function pt(e,t){let n=ft(e,t),r=[],i=[],a=!1;for(let e of n)switch(e.kind){case`equal`:r.push(e.node),i.push(e.node);break;case`delete`:a=!0,r.push(Y(e.node,`delete`));break;case`insert`:a=!0,i.push(Y(e.node,`insert`));break;case`modify`:{if(a=!0,G(e.oldNode)&&G(e.newNode)){let t=dt(e.oldNode,e.newNode);r.push(...t.oldNodes),i.push(...t.newNodes);break}let t=mt(e.oldNode,e.newNode);t?(r.push(t.oldNode),i.push(t.newNode)):(r.push(Y(e.oldNode,`delete`)),i.push(Y(e.newNode,`insert`)));break}}return{oldChildren:r,newChildren:i,changed:a}}function mt(e,t){if(W(e)!==W(t))return null;if(at(e,t))return{oldNode:e,newNode:t,changed:!1};let n=K(e),r=K(t);if(!n||!r)return null;let i=pt(n,r);return i.changed?{oldNode:J(e,i.oldChildren),newNode:J(t,i.newChildren),changed:!0}:{oldNode:e,newNode:t,changed:!1}}function ht(e,t){let n=mt(e,t);return n?{oldNode:n.oldNode,newNode:n.newNode}:{oldNode:Y(e,`delete`),newNode:Y(t,`insert`)}}function gt(e,t){let n=ut(e.text,t.text),r=[];for(let i of n)i.text&&(i.kind===`equal`?r.push(q(t,i.text)):i.kind===`delete`?r.push(q(e,i.text,`delete`)):r.push(q(t,i.text,`insert`)));return r}function _t(e,t){let n=ft(e,t),r=[];for(let e of n)switch(e.kind){case`equal`:r.push(e.node);break;case`delete`:r.push(Y(e.node,`delete`));break;case`insert`:r.push(Y(e.node,`insert`));break;case`modify`:{if(G(e.oldNode)&&G(e.newNode)){r.push(...gt(e.oldNode,e.newNode));break}let t=K(e.oldNode),n=K(e.newNode);t&&n?r.push(J(e.newNode,_t(t,n))):(r.push(Y(e.oldNode,`delete`)),r.push(Y(e.newNode,`insert`)));break}}return r}function vt(e,t){if(W(e)!==W(t))return Y(t,`insert`);if(at(e,t))return t;let n=K(e),r=K(t);return!n||!r?Y(t,`insert`):J(t,_t(n,r))}function yt(e,t){let n=ft(e.root.children,t.root.children),r=[];for(let e of n)switch(e.kind){case`equal`:{let t=r.at(-1);t&&t.type===`equal`?t.nodes.push(e.node):r.push({type:`equal`,nodes:[e.node]});break}case`modify`:{let t=ht(e.oldNode,e.newNode);r.push({type:`delete`,nodes:[t.oldNode]},{type:`insert`,nodes:[t.newNode]})}break;case`delete`:r.push({type:`delete`,nodes:[Y(e.node,`delete`)]});break;case`insert`:r.push({type:`insert`,nodes:[Y(e.node,`insert`)]})}return r}function bt(e){let t={...e};if(t.$){let{blockId:e,...n}=t.$;Object.keys(n).length?t.$=n:delete t.$}return t.children&&=t.children.map(bt),t}function xt(e,t){let{children:n,text:r,...i}=e,{children:a,text:o,...s}=t;return JSON.stringify(i)!==JSON.stringify(s)||!!(n&&a&&Tt(n,a).some(e=>e.kind===`modify`&&xt(e.old[0],e.current[0])))}function St(e){let n=e;return n.type===`dynamic`||n.type===`pending`?{type:`paragraph`,version:1,direction:null,format:``,indent:0,children:[{type:`text`,version:1,text:n.type===`dynamic`?t.t(`history.dynamic`,{url:n.url,height:n.initialHeight??320,props:JSON.stringify(n.props??{})}):t.t(`history.pendingIntent`,{intent:n.intent??``}),format:0,detail:0,mode:`normal`,style:``}]}:n.children?{...n,children:n.children.map(St)}:n}function Ct(e){return wt(e.map(St))}function wt(e){return{root:{type:`root`,version:1,direction:null,format:``,indent:0,children:e}}}function Tt(e,t){let n=yt(wt(e),wt(t)),r=[],i=0,a=0;for(let o=0;o<n.length;o++){let s=n[o];if(s.type===`equal`){r.push({kind:`equal`,old:e.slice(i,i+s.nodes.length),current:t.slice(a,a+s.nodes.length),oldIndex:i,newIndex:a}),i+=s.nodes.length,a+=s.nodes.length;continue}let c=0,l=0;for(;o<n.length&&n[o].type!==`equal`;){let e=n[o++];e.type===`delete`?c+=e.nodes.length:l+=e.nodes.length}o--;for(let n=0;n<Math.max(c,l);n++){let o=n<c?[e[i+n]]:[],s=n<l?[t[a+n]]:[];r.push({kind:o.length&&s.length?`modify`:o.length?`delete`:`insert`,old:o,current:s,oldIndex:o.length?i+n:void 0,newIndex:s.length?a+n:void 0})}i+=c,a+=l}return r}function Et(e,t){return Tt(e.root.children.map(bt),t.root.children.map(bt)).map(e=>{let t={oldIndex:e.oldIndex,newIndex:e.newIndex};if(e.kind===`modify`){let n=e.old[0],r=e.current[0];return n.type===r.type&&!xt(n,r)?{kind:`modify`,value:Ct([vt(n,r)]),...t}:{kind:`modify`,before:Ct(e.old),value:Ct(e.current),...t}}let n=e.kind===`delete`?e.old:e.current;return{kind:e.kind,value:Ct(e.kind===`equal`?n:n.map(t=>Y(t,e.kind))),...t}})}function Dt(e){let t=me(e);return t._headless=!0,[`registerDecoratorListener`,`registerRootListener`,`registerMutationListener`,`getRootElement`,`setRootElement`,`getElementByKey`,`focus`,`blur`].forEach(e=>{t[e]=()=>{(function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)})(439,e)}}),t}var X=a();function Ot({text:e}){let t=(0,U.useRef)(null),n=(0,U.useRef)(null);return(0,U.useEffect)(()=>{let r=t.current;if(!r)return;let i=r.parentNode;if(!i)return;let a=n.current;return!a||a.parentNode!==i?(a=document.createComment(e),i.insertBefore(a,r),n.current=a):a.data!==e&&(a.data=e),()=>{n.current?.parentNode&&n.current.parentNode.removeChild(n.current),n.current=null}},[e]),(0,X.jsx)(`template`,{suppressHydrationWarning:!0,"data-rich-comment-anchor":``,ref:t})}var Z=e=>`${V[e]} ${z[e]}`,kt={h1:Z(`headingH1`),h2:Z(`headingH2`),h3:Z(`headingH3`),h4:Z(`headingH4`),h5:Z(`headingH5`),h6:Z(`headingH6`)};function At(e){return e.toLowerCase().trim().replaceAll(/[^\s\w\u3000-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF-]/g,``).replaceAll(/[\s_]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function jt(e){return e.type===`comment`?``:e.text?e.text:e.children?e.children.map(jt).join(``):``}var Mt=/^["'«‘“‹「『"']/,Nt=/["'»’”›」』"']$/;function Pt(e,t,n,r,i){switch(e.type){case`root`:return(0,X.jsx)(X.Fragment,{children:n});case`paragraph`:{let r=e.format?{textAlign:e.format}:void 0;return(0,X.jsx)(`p`,{className:Z(`paragraph`),style:r,children:n??(0,X.jsx)(`br`,{})},t)}case`heading`:{let a=e.tag,o=At(i||jt(e)),s=o;if(o){let e=r.get(o);e===void 0?r.set(o,1):(s=`${o}-${e}`,r.set(o,e+1))}return(0,X.jsxs)(a,{className:kt[a],id:s||void 0,children:[s&&(0,X.jsx)(`a`,{className:Z(`headingAnchor`),href:`#${s}`,tabIndex:0,children:(0,X.jsx)(j,{"aria-hidden":!0,size:14,strokeWidth:2})}),n]},t)}case`rich-quote`:case`quote`:{let r=(i||jt(e)).trim(),a=Mt.test(r),o=Nt.test(r),s=e.attribution;return(0,X.jsxs)(`blockquote`,{className:Z(`quote`),"data-no-close-quote":o?``:void 0,"data-no-open-quote":a?``:void 0,children:[n,s&&(0,X.jsxs)(`footer`,{className:Z(`quoteAttribution`),children:[`— `,s]})]},t)}case`list`:{let r=e.listType===`number`?`ol`:`ul`,i=e.listType===`number`?Z(`listOl`):e.listType===`check`?`${Z(`checklist`)} ${Z(`listUl`)}`:Z(`listUl`);return(0,X.jsx)(r,{className:i,start:e.start===1?void 0:e.start,children:n},t)}case`listitem`:{let r=e.checked!==void 0,i=e.children?.some(e=>e.type===`list`),a=typeof e.value==`number`&&e.value>1?e.value:void 0,o;return o=i?Z(`listNestedItem`):r?e.checked?`${Z(`listItem`)} ${Z(`listItemChecked`)}`:`${Z(`listItem`)} ${Z(`listItemUnchecked`)}`:Z(`listItem`),(0,X.jsx)(`li`,{className:o,value:a,children:n},t)}case`link`:return(0,X.jsxs)(`a`,{className:Z(`link`),href:e.url,rel:e.rel||`noopener`,target:e.target||`_blank`,children:[(0,X.jsx)(se,{href:e.url}),n]},t);case`autolink`:return(0,X.jsxs)(`a`,{className:Z(`link`),href:e.url,rel:`noopener`,target:`_blank`,children:[(0,X.jsx)(se,{href:e.url}),n]},t);case`horizontalrule`:return(0,X.jsx)(`hr`,{className:Z(`hr`)},t);case`table`:return(0,X.jsx)(`div`,{className:Z(`tableScrollableWrapper`),children:(0,X.jsx)(`table`,{className:Z(`table`),children:n})},t);case`tablerow`:return(0,X.jsx)(`tr`,{children:n},t);case`tablecell`:{let r=e.headerState?`th`:`td`,i=e.headerState?Z(`tableCellHeader`):Z(`tableCell`);return(0,X.jsx)(r,{className:i,colSpan:e.colSpan>1?e.colSpan:void 0,children:n},t)}case`details`:{let r=e.summary||``;return(0,X.jsxs)(`details`,{className:`${y.details} ${T.details}`,open:e.open||void 0,children:[(0,X.jsxs)(`summary`,{className:`${y.summary} ${T.summary}`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`${y.chevron} ${T.chevron}`,children:(0,X.jsx)(`svg`,{fill:`none`,height:`20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,viewBox:`0 0 20 20`,width:`20`,children:(0,X.jsx)(`path`,{d:`M8 6L12 10L8 14`})})}),(0,X.jsx)(`span`,{className:`${y.summaryText} ${T.summaryText}`,children:r})]}),(0,X.jsx)(`div`,{className:`${y.content} ${T.content}`,children:n})]},t)}case`spoiler`:return(0,X.jsx)(`span`,{className:Z(`spoiler`),role:`button`,tabIndex:0,children:n},t);case`tag`:return(0,X.jsx)(`span`,{className:Z(`tag`),style:{backgroundColor:O(e.text)},children:e.text},t);case`comment`:return(0,X.jsx)(Ot,{text:e.text??``},t);case`ruby`:return(0,U.createElement)(H,{key:t,rendererKey:`Ruby`,defaultRenderer:ce,props:{reading:e.reading??``,children:n}});case`code`:return(0,X.jsx)(`pre`,{className:`rich-code-block`,children:(0,X.jsx)(`code`,{children:n})},t);case`code-highlight`:return(0,X.jsx)(`span`,{children:e.text},t);case`linebreak`:return(0,X.jsx)(`br`,{},t);case`tab`:return(0,X.jsx)(`span`,{children:` `},t);default:return null}}var Ft=e=>`${V[e]} ${z[e]}`,It=[[1,`textBold`],[2,`textItalic`],[4,`textStrikethrough`],[8,`textUnderline`],[16,`textCode`],[32,`textSubscript`],[64,`textSuperscript`],[128,`textHighlight`]];function Lt(e){let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();if(!r||!i)continue;let a=r.replaceAll(/-([a-z])/g,(e,t)=>t.toUpperCase());t[a]=i}return t}function Rt(e,t){let n=e.text,r=e.format||0;for(let[e,i]of It)r&e&&(n=(0,X.jsx)(`span`,{className:Ft(i),children:n},`${t}-${e}`));return e.style&&(n=(0,X.jsx)(`span`,{style:Lt(e.style),children:n},t)),n}function zt(e){let t={},n=new Set,r={},i=1;function a(e){if(e.type===`footnote`&&e.identifier){let t=e.identifier;n.has(t)||(n.add(t),r[t]=i++)}if(e.type===`footnote-section`&&e.definitions&&Object.assign(t,e.definitions),e.children)for(let t of e.children)a(t);if(e.root&&a(e.root),e.content&&typeof e.content==`object`&&e.content.root&&a(e.content),e.cells&&Array.isArray(e.cells))for(let t of e.cells)t&&t.root&&a(t)}a(e);for(let e of n)e in t||(t[e]=``);return{definitions:t,displayNumberMap:r}}var Bt=e=>`${V.alert} ${z.alert} rich-alert-${e}`;function Vt(e,t,n){switch(e.type){case`alert-quote`:return(0,U.createElement)(`div`,{key:t,className:Bt(e.alertType)},n);case`banner`:return(0,U.createElement)(`div`,{key:t,className:`rich-banner rich-banner-${e.bannerType}`},n);case`grid-container`:return(0,U.createElement)(`div`,{key:t,className:`${Ce.container} ${u.container}`},n);default:return(0,U.isValidElement)(n)?(0,U.cloneElement)(n,{key:t}):n}}function Ht(e,t,n){return(0,U.isValidElement)(e)&&typeof e.type==`string`?(0,U.cloneElement)(e,{"data-block-id":t}):(0,X.jsx)(`div`,{className:`rich-block-anchor`,"data-block-id":t,children:e},`${n}-block-anchor`)}function Ut(e,t,n,r){return t?(r.blockAnchor??Ht)(e,t,n):e}function Wt(e,t,n,r,i,a,o){let s=e.getKey?e.getKey():i,{builtinNodeOverrides:c}=o;if(typeof e.decorate==`function`){let r=null;try{r=e.decorate(t,n)}catch{}if(r!=null){let t=e.exportJSON?e.exportJSON():{},n=c?.[t.type];return Ut(n?n(t,s,[r],()=>Vt(t,s,r)):Vt(t,s,r),a,s,o)}}let l=e.exportJSON?e.exportJSON():{};if(l.type===`text`){let e=c?.text;return e?e(l,s,null,()=>Rt(l,s)):Rt(l,s)}let u=typeof e.getChildren==`function`?e.getChildren():[];Array.isArray(l.children)&&l.children.length===0&&u.length>0&&(l.children=u.map(e=>({type:typeof e.getType==`function`?e.getType():e.__type})));let d=null;u.length>0&&(d=u.map((e,i)=>Wt(e,t,n,r,`${s}-${i}`,void 0,o)));let f=e.getTextContent?e.getTextContent():void 0,p=c?.[l.type];return Ut(p?p(l,s,d,()=>Pt(l,s,d,r,f)):Pt(l,s,d,r,f),a,s,o)}function Gt(e,t,n){let r=Dt({nodes:t,theme:h,editable:!1,onError:e=>{console.error(`[RichRenderer]`,e)}}),i={namespace:`ssr`,theme:h},a=x(e),o=r.parseEditorState(a);r.setEditorState(o);let s=zt(a),c=a.root?.children,l=null;return o.read(()=>{let e=v(),t=new Map,a=e.getChildren().map((e,a)=>Wt(e,r,i,t,`ssr-${a}`,c?.[a]?.$?.blockId,n));l=(0,X.jsx)(X.Fragment,{children:a})}),{content:l,footnoteData:s,renderNestedContent:e=>{let r=Dt({nodes:t,theme:h,editable:!1,onError:e=>{console.error(`[RichRenderer:nested]`,e)}}),i={namespace:`ssr-nested`,theme:h},a=x(e),o=r.parseEditorState(a);r.setEditorState(o);let s=null,c=a.root?.children;return o.read(()=>{let e=v(),t=new Map,a=e.getChildren().map((e,a)=>Wt(e,r,i,t,`nested-${a}`,c?.[a]?.$?.blockId,n));s=(0,X.jsx)(X.Fragment,{children:a})}),s}}}function Kt({value:e,variant:t=`article`,theme:n=`light`,className:r,style:i,as:a=`div`,nested:o=!1,rendererConfig:s,extraNodes:c,builtinNodeOverrides:l,blockAnchor:u}){let d=de(t),f=A(),{content:m,footnoteData:h,renderNestedContent:_}=(0,U.useMemo)(()=>Gt(e,c?[...g,...c]:g,{blockAnchor:u,builtinNodeOverrides:l}),[u,l,c,e]),v=[`rich-content`,d,r].filter(Boolean).join(` `),y=typeof a==`string`?{suppressHydrationWarning:!0,className:v,"data-rich-nested":o?`true`:void 0,"data-theme":n}:{};return(0,X.jsx)(C,{className:d,theme:n,children:(0,X.jsx)(p,{colorScheme:n,children:(0,X.jsx)(L,{config:s,mode:`renderer`,variant:t,children:(0,X.jsx)(M,{definitions:h.definitions,displayNumberMap:h.displayNumberMap,children:(0,X.jsx)(k,{value:f??_,children:(0,X.jsx)(a,{...y,style:i,children:m})})})})})})}var qt=[D],Jt=864e5,Yt=e=>String(e).padStart(2,`0`),Xt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function Zt(e,n=Date.now()){if(!(e>0))return t.t(`time.notRecorded`);let i=new Date(e*1e3),a=new Date(n),o=Math.round((Xt(a)-Xt(i))/Jt);if(o===0)return t.t(`time.today`);if(o===1)return t.t(`time.yesterday`);let s=i.getFullYear()===a.getFullYear();return new Intl.DateTimeFormat(r[t.language],s?{month:`long`,day:`numeric`}:{year:`numeric`,month:`long`,day:`numeric`}).format(i)}function Qt(e,t=!1){if(!(e>0))return`--:--`;let n=new Date(e*1e3),r=`${Yt(n.getHours())}:${Yt(n.getMinutes())}`;return t?`${r}:${Yt(n.getSeconds())}`:r}function Q(e){return e>0?`${Zt(e)} ${Qt(e)}`:t.t(`time.notRecorded`)}var $t={human:`history.sourceHuman`,agent:`history.sourceAgent`,session:`history.sourceSession`,unknown:`history.sourceUnknown`};function en(e){let{session:t,selected:n}=e;return t&&n?t.history.groups.find(e=>e.entries.includes(n)):void 0}function tn(e){return e.session?.history.entries.at(-1)?.change.timestamp??0}function nn({model:e}){let{count:t,changeIndex:r,loading:i}=e;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{role:`status`,"aria-live":`polite`,className:`history-count`,children:[t?r+1:0,` / `,t]}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.previousChange`),disabled:r===0||i,onClick:()=>e.navigate(-1),children:(0,X.jsx)(Te,{size:14,"aria-hidden":`true`})}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.nextChange`),disabled:r>=t-1||i,onClick:()=>e.navigate(1),children:(0,X.jsx)(ke,{size:14,"aria-hidden":`true`})})]})}function rn({model:e}){return(0,X.jsx)(`button`,{type:`button`,className:`history-filter`,"aria-pressed":e.onlyChanges,onClick:e.toggleOnly,children:n(`history.onlyChanges`)})}function an({model:e}){return e.pending?(0,X.jsxs)(`div`,{className:`history-update`,role:`status`,children:[(0,X.jsx)(`span`,{children:e.streaming?n(`history.waitingEdits`):n(`history.newContent`,{time:Qt(tn(e))})}),(0,X.jsxs)(`button`,{type:`button`,disabled:e.streaming||e.loading,onClick:e.refresh,children:[(0,X.jsx)(Je,{size:12,"aria-hidden":`true`}),n(`history.refresh`)]})]}):null}function on({model:e}){let{selected:t,blocks:r,count:i}=e,a=en(e),o=r.filter(e=>e.kind===`insert`||e.kind===`modify`).length,s=r.filter(e=>e.kind===`delete`||e.kind===`modify`).length;return(0,X.jsxs)(`section`,{className:`history-compare`,"aria-label":n(`history.range`),children:[(0,X.jsxs)(`dl`,{children:[(0,X.jsx)(`dt`,{children:n(`history.from`)}),(0,X.jsxs)(`dd`,{children:[(0,X.jsx)(`strong`,{children:t?Q(t.change.timestamp):n(`history.pickPoint`)}),a?(0,X.jsx)(`span`,{children:n($t[a.source])}):null]}),(0,X.jsx)(`dt`,{children:n(`history.to`)}),(0,X.jsxs)(`dd`,{children:[(0,X.jsx)(`strong`,{children:n(`history.latestVersion`)}),(0,X.jsx)(`span`,{children:Q(tn(e))})]})]}),(0,X.jsxs)(`div`,{className:`history-controls`,children:[(0,X.jsx)(`span`,{children:n(`history.changes`,{count:i})}),(0,X.jsxs)(`span`,{className:`history-plus`,children:[`+`,o]}),(0,X.jsxs)(`span`,{className:`history-minus`,children:[`−`,s]}),(0,X.jsx)(`span`,{className:`history-spacer`}),(0,X.jsx)(rn,{model:e}),(0,X.jsx)(nn,{model:e})]})]})}function sn({model:e}){let[t,r]=(0,U.useState)(50),[i,a]=(0,U.useState)(()=>new Set),{session:o,selected:s,blocks:c}=e;if(!o)return null;let{groups:l,entries:u,shallow:d}=o.history,f=l.findIndex(e=>s!==null&&e.entries.includes(s)),p=new Map;for(let e of c)e.group&&p.set(e.group,(p.get(e.group)??0)+1);let m=l.slice(0,t),h=e=>Zt(e.entries.at(-1).change.timestamp),g=e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ol`,{className:`history-timeline`,"aria-label":n(`history.timeline`),children:m.map((t,r)=>{let a=t.entries.at(-1),o=h(t),c=r===0||o!==h(m[r-1]),l=r===f?`selected`:r===0?`latest`:r<f?`range`:`outside`,u=i.has(t.id),d=r<f?p.get(t):void 0;return(0,X.jsxs)(`li`,{className:`history-node`,"data-state":l,"data-upper":r<=f?`in`:`out`,"data-lower":r<f?`in`:`out`,"data-day":c?``:void 0,children:[c?(0,X.jsx)(`div`,{className:`history-day`,children:o}):null,(0,X.jsxs)(`div`,{className:`history-row`,children:[(0,X.jsx)(`span`,{className:`history-dot`,"aria-hidden":`true`}),(0,X.jsxs)(`button`,{type:`button`,className:`history-select`,"aria-current":l===`selected`?`true`:void 0,onClick:()=>e.select(a),children:[(0,X.jsxs)(`span`,{className:`history-line`,children:[(0,X.jsx)(`strong`,{children:Qt(a.change.timestamp)}),(0,X.jsx)(`span`,{children:n($t[t.source])}),l===`latest`?(0,X.jsx)(`span`,{className:`history-tag`,children:n(`history.latest`)}):null,l===`selected`?(0,X.jsx)(`span`,{className:`history-tag history-start`,children:n(`history.start`)}):null]}),(0,X.jsxs)(`span`,{className:`history-meta`,children:[n(`history.commits`,{count:t.entries.length}),d?(0,X.jsx)(`span`,{className:`history-changed`,children:n(`history.changedSuffix`,{count:d})}):null]})]}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon history-expand`,"aria-label":n(u?`history.collapseCommits`:`history.expandCommits`),"aria-expanded":u,onClick:()=>g(t.id),children:(0,X.jsx)(Ae,{size:14,"aria-hidden":`true`})})]}),u?(0,X.jsx)(`div`,{className:`history-raw`,children:[...t.entries].reverse().map(t=>(0,X.jsxs)(`button`,{type:`button`,title:t.change.message,"aria-current":t===s?`true`:void 0,onClick:()=>e.select(t),children:[(0,X.jsx)(`span`,{children:Qt(t.change.timestamp,!0)}),(0,X.jsx)(`code`,{children:t.change.message||n(`history.sourceUnknown`)})]},t.id))}):null]},t.id)})}),t<l.length?(0,X.jsx)(`button`,{type:`button`,className:`history-more`,onClick:()=>r(e=>e+50),children:n(`history.loadEarlier`)}):(0,X.jsxs)(`p`,{className:`history-end`,children:[n(d?`history.shallow`:`history.earliest`),` · `,n(`history.summary`,{edits:n(`history.edits`,{count:l.length}),commits:n(`history.commits`,{count:u.length})}),(0,X.jsx)(`br`,{}),n(`history.clockNote`)]})]})}function cn({streaming:e}){return(0,X.jsxs)(`div`,{className:`history-waiting`,children:[(0,X.jsx)(`p`,{role:`status`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`strong`,{children:n(`history.agentEditing`)}),(0,X.jsx)(`span`,{children:n(`history.agentEditingBody`)})]}):(0,X.jsx)(`strong`,{children:n(`history.loading`)})}),(0,X.jsx)(`div`,{className:`history-skeleton`,"aria-hidden":`true`,children:[150,130,160,120].map(e=>(0,X.jsx)(`span`,{style:{width:e}},e))})]})}function ln({model:e}){return(0,X.jsxs)(`div`,{role:`alert`,className:`history-failure`,children:[(0,X.jsxs)(`strong`,{children:[(0,X.jsx)(we,{size:15,"aria-hidden":`true`}),n(`history.failed`)]}),(0,X.jsx)(`code`,{children:e.error}),(0,X.jsx)(`span`,{children:n(`history.failedBody`)}),(0,X.jsxs)(`span`,{className:`history-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`history-button`,disabled:e.streaming,onClick:e.refresh,children:n(`common.retry`)}),(0,X.jsx)(`button`,{type:`button`,className:`history-quiet`,onClick:e.close,children:n(`history.backToComments`)})]})]})}function un({model:e}){return(0,X.jsxs)(`aside`,{className:`history-panel`,"aria-label":n(`history.title`),children:[(0,X.jsxs)(`header`,{className:`history-panel-head`,children:[(0,X.jsx)(`h2`,{children:n(`history.title`)}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.close`),onClick:e.close,children:(0,X.jsx)(s,{size:14,"aria-hidden":`true`})})]}),(0,X.jsx)(an,{model:e}),e.error?(0,X.jsx)(ln,{model:e}):e.session?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(on,{model:e}),(0,X.jsx)(sn,{model:e})]}):(0,X.jsx)(cn,{streaming:e.streaming})]})}function dn({model:e,onDismiss:t}){let r=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=document.activeElement,t=r.current,n=()=>[...t?.querySelectorAll(`button:not(:disabled), a[href], input:not(:disabled), [tabindex="0"]`)??[]];n()[0]?.focus();let i=e=>{if(e.key!==`Tab`)return;let t=n();e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),t.at(-1)?.focus()):!e.shiftKey&&document.activeElement===t.at(-1)&&(e.preventDefault(),t[0]?.focus())};return t?.addEventListener(`keydown`,i),()=>{t?.removeEventListener(`keydown`,i),e?.focus()}},[]);let i=(0,X.jsxs)(`div`,{className:`history-sheet-head`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n(`history.chooseStart`)}),(0,X.jsx)(`small`,{children:n(`history.compareWithLatest`,{time:Q(tn(e))})})]}),(0,X.jsx)(`button`,{type:`button`,onClick:t,children:n(`common.done`)})]});return(0,X.jsx)(`div`,{ref:r,className:`history-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`history.chooseStart`),children:(0,X.jsx)(He,{snaps:[0,.85],snap:.85,onSnap:e=>{e===0&&t()},onScrim:t,header:i,children:(0,X.jsx)(`div`,{className:`history-sheet-body`,children:(0,X.jsx)(sn,{model:e})})})})}var fn=[S,f,...qt],pn={[te]:be,[ee]:d,[w]:E,[l]:N},mn={insert:`history.kindInsert`,delete:`history.kindDelete`,modify:`history.kindModify`};function hn({model:e,theme:t,title:r,narrow:i,bodyRef:a,onPick:o}){let{session:s,selected:c,blocks:l,count:u,changeIndex:d,loading:f,error:p,streaming:m,onlyChanges:h}=e,g=e=>(0,X.jsx)(Kt,{value:e,variant:`article`,theme:t,extraNodes:fn,rendererConfig:pn}),_=-1;return(0,X.jsxs)(`div`,{className:`history-view`,children:[i?(0,X.jsxs)(`div`,{className:`history-strip`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`history-pick`,onClick:o,children:[(0,X.jsx)(`span`,{children:n(`history.compareFrom`)}),(0,X.jsxs)(`strong`,{children:[n(`history.toLatest`,{from:c?Q(c.change.timestamp):n(`history.pickPoint`)}),(0,X.jsx)(ke,{size:12,"aria-hidden":`true`})]})]}),(0,X.jsx)(rn,{model:e}),(0,X.jsx)(nn,{model:e})]}):null,i?(0,X.jsx)(an,{model:e}):null,p?i?(0,X.jsxs)(`div`,{role:`alert`,className:`history-message`,children:[n(`history.readFailed`,{error:p}),(0,X.jsx)(`button`,{type:`button`,disabled:m,onClick:e.refresh,children:n(`common.retry`)})]}):(0,X.jsx)(`p`,{className:`history-message`,children:n(`history.unreadable`)}):f||!s?(0,X.jsx)(`div`,{role:`status`,className:`history-message`,children:n(m?`history.waitingEdits`:`history.computing`)}):(0,X.jsxs)(`div`,{ref:a,"aria-label":n(`history.diffBody`),className:`history-content`,children:[s.latest.value.root.children.some(e=>e.type===`heading`&&e.tag===`h1`)?null:(0,X.jsx)(`h1`,{children:r}),u?null:(0,X.jsx)(`p`,{role:`status`,className:`history-note`,children:n(`history.noDiff`)}),l.map((t,r)=>{if(t.kind===`equal`)return h?(0,X.jsx)(`button`,{type:`button`,className:`history-fold`,onClick:e.showAll,children:(0,X.jsx)(`span`,{children:n(`history.unchanged`,{count:t.value.root.children.length})})},r):(0,X.jsx)(`section`,{className:`history-hunk history-equal`,children:g(t.value)},r);_++;let i=t.before?null:t.kind===`insert`?`history-after`:t.kind===`delete`?`history-before`:`history-merged`;return(0,X.jsxs)(`section`,{"data-history-change":``,"data-current":_===d?``:void 0,className:`history-hunk history-${t.kind}`,children:[(0,X.jsxs)(`div`,{className:`history-caption`,children:[(0,X.jsx)(`span`,{className:`history-kind`,children:n(mn[t.kind])}),t.author?(0,X.jsxs)(`span`,{children:[Q(t.author.change.timestamp),t.group?` · ${n($t[t.group.source])}`:``]}):null]}),t.before?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`history-before`,children:g(t.before)}),(0,X.jsx)(`div`,{className:`history-after`,children:g(t.value)})]}):(0,X.jsx)(`div`,{className:i,children:g(t.value)})]},r)}),(0,X.jsx)(`p`,{className:`history-end`,children:n(`history.endOfDiff`)})]})]})}var gn=e=>JSON.stringify(e.frontiers()),_n=(e,t)=>t===void 0?void 0:e[t];function vn({doc:e,nodes:t,streaming:n,theme:r,title:i,open:a,onClose:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null),p=(0,U.useRef)(0),[m,h]=(0,U.useState)(!0),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)([]),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(0),[E,D]=(0,U.useState)(!1),O=Fe(`(max-width: 1100px)`),k=(0,U.useRef)(null),A=(0,U.useCallback)(async()=>{if(!e)return;let n=++p.current;h(!0),_(null);let r=e.fork();try{let i=await Qe(r),a=$e(r,r.frontiers(),t);if(p.current!==n){r.free();return}let o=f.current;f.current=r;let s=(d.current&&i.entries.find(e=>e.id===d.current.id))??i.groups[1]?.entries.at(-1)??i.entries[0]??null;d.current=s,u(s),c({doc:r,history:i,latest:a}),y(gn(e)!==gn(r)),o?.free()}catch(e){r.free(),p.current===n&&_(e.message)}finally{p.current===n&&h(!1)}},[e,t]);if((0,U.useEffect)(()=>{if(a)return()=>{p.current++,f.current?.free(),f.current=null,d.current=null,c(null),u(null),x([]),y(!1),_(null),h(!0),D(!1),C(!1)}},[a,e]),(0,U.useEffect)(()=>{a&&!n&&!f.current&&A()},[a,A,n]),(0,U.useEffect)(()=>{if(a&&e)return e.subscribe(()=>y(f.current!==null&&gn(e)!==gn(f.current)))},[e,a]),(0,U.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&(E?D(!1):o())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,o,E]),(0,U.useEffect)(()=>{if(!s||!l)return;let e=!1;h(!0);let n=setTimeout(()=>{try{let n=$e(s.doc,l.frontiers,t),{entries:r,groups:i}=s.history,a=tt(s.doc,r.slice(r.indexOf(l)+1),[n,s.latest]),o=new Map(i.flatMap(e=>e.entries.map(t=>[t,e]))),c=Et(n.value,s.latest.value).map(e=>{if(e.kind===`equal`)return e;let t=[_n(s.latest.ids,e.newIndex),_n(n.ids,e.oldIndex)].map(e=>e&&a.get(e)).find(Boolean);return t?{...e,author:t,group:o.get(t)}:e});e||(x(c),T(0),_(null))}catch(t){e||_(t.message)}finally{e||h(!1)}},0);return()=>{e=!0,clearTimeout(n)}},[s,l,t]),!a||!e)return null;let ee=b.filter(e=>e.kind!==`equal`).length,j={session:s,selected:l,blocks:b,count:ee,changeIndex:w,loading:m,error:g,pending:v,streaming:n,onlyChanges:S,select:e=>{d.current=e,u(e),D(!1)},navigate:e=>{let t=Math.max(0,Math.min(ee-1,w+e));T(t),k.current?.querySelectorAll(`[data-history-change]`)[t]?.scrollIntoView?.({block:`center`,behavior:`instant`})},toggleOnly:()=>C(e=>!e),showAll:()=>C(!1),refresh:()=>void A(),close:o};return{content:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hn,{model:j,theme:r,title:i,narrow:O,bodyRef:k,onPick:()=>D(!0)}),O&&E?(0,X.jsx)(dn,{model:j,onDismiss:()=>D(!1)}):null]}),panel:O?null:(0,X.jsx)(un,{model:j})}}function yn({left:e,top:t,quote:r,initial:i,restored:a,leaving:o,onChange:s,onSubmit:c,onCancel:l,ref:u}){return(0,X.jsx)(`div`,{ref:u,...{0:{className:`x10l6tqk x1u8a7rm xj6ak53 xowlrko xllfotl xatqbsq x1u6ievf`},1:{className:`x10l6tqk x1u8a7rm xj6ak53 x1u6ievf xxp0q0x x12l1aco xn0cd8s x47corl`}}[!!o|0],style:{left:e,top:t},children:(0,X.jsxs)(re,{active:!0,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z xz9dl7a x1hr3lfm xqfszdh x1j6dyjg`,children:[(0,X.jsxs)(`span`,{className:`x98rzlu xeuugli xb3r6kr xuxw1ft xlyipyv xddlp02`,children:[`“`,r,`”`]}),a?(0,X.jsx)(`span`,{className:`x2lah0s x7zghnd`,children:n(`document.draftRestored`)}):null]}),(0,X.jsx)(Ie,{autoFocus:!0,initial:i,placeholder:n(`document.draftPlaceholder`),onChange:s,onSubmit:c,onCancel:l})]})})}function bn({left:e,top:t,onComment:r,onCopy:i,ref:a}){return(0,X.jsxs)(`div`,{ref:a,className:`x10l6tqk x1u8a7rm x78zum5 x6s0dn4 x195vfkc xc9qbxq x9f619 x9ms5i6 xmkeg23 x1y0btm7 xgcsv5v x1q4ynmn x12ilycc x1d5q07e xi1bcxy x773k2o xa3vuyk`,style:{left:e,top:t},onMouseDown:e=>e.preventDefault(),children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:r,className:`x78zum5 x6s0dn4 x17d4w8g x1fgtraw xt970qd x1awh872 xc342km xu4hgxq xjbqb8w xj0l527 x2230gt xo2rkog xqfszdh xfifm61 xk50ysn x1ypdohk x1de99jn xaatb59 x1y3gkto x1uczgqu x1fkwv27`,children:[(0,X.jsx)(Ke,{size:14,className:`x2lah0s x17nrqe2`}),n(`common.comment`)]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`x2lah0s x1i1rx1s xlup9mm xj3msbq xcn5yip`})]}):null,(0,X.jsx)(`button`,{type:`button`,onClick:i,className:`x78zum5 x6s0dn4 x17d4w8g x1fgtraw xt970qd x1awh872 xc342km xu4hgxq xjbqb8w xj0l527 x2230gt xqfszdh xfifm61 xk50ysn x1ypdohk x1de99jn xaatb59 x1y3gkto x1uczgqu x1fkwv27 x1bo0w0s`,children:n(`document.copy`)})]})}var xn=(e,t)=>`${e}\n${t}`;function Sn(){let e=new Map;return{save(t,n){n.trim()?e.set(t,n):e.delete(t)},take(t){return e.get(t)??``}}}function Cn(e){let t=(0,U.useMemo)(Sn,[]),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(``),s=(0,U.useRef)(0),c=(0,U.useRef)(null),l=(0,U.useRef)(null);F(i?null:n?.target.range??null);let u=(0,U.useCallback)(n=>{window.clearTimeout(s.current);let i=t.take(xn(n.blockId,n.quote));o.current=i,a(!1),r({target:n,initial:i}),window.getSelection()?.removeAllRanges(),e()},[t,e]),d=(0,U.useCallback)(e=>{n&&(t.save(xn(n.target.blockId,n.target.quote),e?o.current:``),a(!0),s.current=window.setTimeout(()=>{r(null),a(!1)},120))},[n,t]);return(0,U.useEffect)(()=>{if(!n||i)return;let e=e=>{let t=e.target;c.current?.contains(t)||l.current?.contains(t)||d(!0)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[n,i,d]),(0,U.useEffect)(()=>()=>window.clearTimeout(s.current),[]),{draft:n,leaving:i,restored:!!n?.initial,open:u,close:d,onText:e=>{o.current=e},panelRef:c,toolbarRef:l}}function wn(e){return{left:e.offsetLeft,right:Math.min(e.offsetLeft+e.offsetWidth,window.innerWidth-16)}}function Tn({editor:e,threads:t,actions:n,agent:r,canComment:i,selection:a,clearSelection:o,onCreate:s,onMain:c,history:l,children:u}){let d=Cn(o),{draft:f}=d;return(0,X.jsx)(R,{editor:e,threads:t,actions:n,agent:r,onMain:c,history:l,overlay:e=>(0,X.jsxs)(X.Fragment,{children:[a&&!f?(0,X.jsx)(bn,{ref:d.toolbarRef,...ae(a,wn(e),128,36,8),onComment:i?()=>d.open(a):void 0,onCopy:()=>{navigator.clipboard?.writeText(a.quote),window.getSelection()?.removeAllRanges(),o()}}):null,f?(0,X.jsx)(yn,{ref:d.panelRef,...I(f.target,wn(e),340,8),quote:f.target.quote,initial:f.initial,restored:d.restored,leaving:d.leaving,onChange:d.onText,onSubmit:e=>s(f.target,e).then(e=>(e&&d.close(!1),e)),onCancel:()=>d.close(!0)},`${f.target.blockId}:${f.target.quote}`):null]}),children:u})}function En({id:e,title:t,activity:r,agentSection:i,offline:a,openComments:o,cloud:s,compact:c=!1,onDone:l,actions:u,agent:d=`Agent`,history:f}){let p=Ze(r,d,i);return ue(e,s?{...t?{title:t}:{},online:s.online,comments:o,activity:p,activityTone:r.kind===`stale`?`warning`:r.kind===`working`?`quiet`:`live`,retrying:a,reason:s.reason,history:f?.available,historyOpen:f?.open}:null)&&!c?null:(0,X.jsxs)(`header`,{...{0:{className:`x7wzq59 x13vifvy x1n327nk xdd8jsf x78zum5 x6s0dn4 x1v2ro7d x4l9tsp x1rozbrz xqfszdh`},1:{className:`x7wzq59 x13vifvy x1n327nk xdd8jsf x78zum5 x6s0dn4 x1rozbrz xqfszdh x1hr3lfm x883omv`}}[!!c|0],children:[c?null:(0,X.jsxs)(`span`,{className:`xddlp02 xfifm61 xuxw1ft`,children:[`document / `,(0,X.jsx)(`span`,{className:`xo2rkog x1s688f`,children:e})]}),p?(0,X.jsxs)(`span`,{...{0:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla xlssvyo x19ay2w6 x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv`},2:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xahzvm9 x1bo0w0s`},1:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`},3:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`}}[(r.kind===`working`)<<1|r.kind===`stale`],children:[r.kind===`stale`?null:(0,X.jsx)(`i`,{className:`x1v4s8kt xols6we x16rqkct xtwfq29`}),p]}):null,a?(0,X.jsx)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`,children:n(`document.notSynced`)}):null,f?.open?(0,X.jsxs)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xahzvm9 x1bo0w0s`,children:[(0,X.jsx)(De,{size:11,"aria-hidden":`true`}),n(`document.readOnlyHistory`)]}):null,s?.reason&&!c?(0,X.jsx)(`span`,{className:`xb3r6kr xddlp02 xfifm61 xuxw1ft xlyipyv`,children:s.reason}):null,(0,X.jsx)(`span`,{className:`x98rzlu`}),s?(0,X.jsxs)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g x1bo0w0s xfifm61 xuxw1ft`,children:[(0,X.jsx)(`i`,{...{0:{className:`xci0xqf x1hagigm x16rqkct xxwmxtg`},1:{className:`xci0xqf x1hagigm x16rqkct xux1nz0`}}[!!s.online|0]}),s.online?n(`share.computerOnline`):n(`share.computerOffline`)]}):null,f?(0,X.jsx)(he,{comments:o,open:f.open,available:f.available,onComments:f.close,onHistory:f.toggle}):null,l?(0,X.jsx)(`button`,{type:`button`,onClick:l,className:`x12ulsxz xaope02 xc342km x1kogg8i x19ckca5 xs0jrwl xqfszdh x4z9k3i x1s688f x1ypdohk`,children:n(`common.done`)}):s||c?null:u]})}function Dn(e,t,n){let[r,i]=t<=n?[t,n]:[n,t];return{blockIds:e.slice(r,i+1).flatMap(e=>e.id?[e.id]:[]).slice(0,We.blockIds),heading:e.slice(0,r+1).filter(e=>e.heading).pop()?.text??``}}var On=crypto.randomUUID(),kn=300,An={quote:``,blockIds:[],heading:``};function jn(e){let t=window.getSelection(),n=e.getRootElement();if(!t||t.isCollapsed||!n?.contains(t.anchorNode)||!n.contains(t.focusNode))return An;let r=t.toString().trim().slice(0,We.quote);return r?e.read(()=>{let e=v().getChildren(),n=t=>{let n=t&&m(t)?.getTopLevelElement();return n?e.findIndex(e=>e.is(n)):-1},i=n(t.anchorNode),a=n(t.focusNode);if(i<0||a<0)return{...An,quote:r};let o=e.map(e=>({id:_(e,b)||``,heading:e.getType()===`heading`,text:e.getTextContent().slice(0,We.heading)}));return{quote:r,...Dn(o,i,a)}}):An}function Mn(e,t,n,r){let i=(0,U.useRef)(An);(0,U.useEffect)(()=>{if(!e)return;let n=0,a=()=>{let n=jn(e);JSON.stringify(n)!==JSON.stringify(i.current)&&(i.current=n,r({type:`selection`,artifact:t,tab:On,human:!0,...n}))},o=()=>{clearTimeout(n),n=window.setTimeout(a,kn)};return document.addEventListener(`selectionchange`,o),()=>{clearTimeout(n),document.removeEventListener(`selectionchange`,o)}},[e,t,r]),(0,U.useEffect)(()=>{n&&i.current.quote&&r({type:`selection`,artifact:t,tab:On,human:!1,...i.current})},[n,t,r])}var Nn={count:0,firstKey:null},Pn=e=>e.read(()=>{let e=v().getChildren().filter(e=>e.getType()===`pending`).map(e=>e.getKey());return{count:e.length,firstKey:e[0]??null}});function Fn(e){let[t,n]=(0,U.useState)(Nn);return(0,U.useEffect)(()=>{if(!e){n(Nn);return}let t=e=>n(t=>t.count===e.count&&t.firstKey===e.firstKey?t:e);return t(Pn(e.getEditorState())),e.registerUpdateListener(({editorState:e})=>t(Pn(e)))},[e]),t}function In(e,t=15e3){let[n,r]=(0,U.useState)(()=>Date.now());return(0,U.useEffect)(()=>{if(!e)return;r(Date.now());let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function Ln({left:e,top:t,placement:r,canComment:i,canEdit:a,onComment:o,onEdit:s}){let c=(0,U.useRef)(null),l=[i?{label:n(`common.comment`),Icon:Ke,run:o,primary:!0}:null,a?{label:n(`document.editText`),Icon:ne,run:s,primary:!1}:null].filter(e=>e!==null);return(0,U.useLayoutEffect)(()=>{Ne(c.current,[{opacity:0,transform:`scale(0.96)`},{opacity:1,transform:`none`}],{duration:160,easing:Me})},[]),l.length===0?null:(0,X.jsxs)(`div`,{ref:c,"data-edit-menu":!0,"data-placement":r,...{0:{className:`x10l6tqk x1u8a7rm x78zum5 xdt5ytf x1cy8zhl`},1:{className:`x10l6tqk x1u8a7rm x78zum5 x1cy8zhl x3ieub6`}}[r===`above`|0],style:{left:e,top:t,transformOrigin:r===`above`?`22px 100%`:`22px 0`},onMouseDown:e=>e.preventDefault(),children:[(0,X.jsx)(`span`,{className:`xsmyaan x1kpxq89 xyqm7xq x1qp53xl x1cum3z5 xf6xdpg x1158fpu`}),(0,X.jsx)(`div`,{className:`x78zum5 xn3w4p2 xfn1xvj x4pepcl xf6xdpg x1dam6yx`,children:l.map(({label:e,Icon:t,run:n,primary:r})=>(0,X.jsxs)(`button`,{type:`button`,onClick:n,...{0:{className:`x78zum5 x6s0dn4 x17d4w8g xn3w4p2 xt970qd xaope02 xc342km x1q4ynmn xjbqb8w x116urgp xqirfc3 xqfszdh xif65rj x1ypdohk`},1:{className:`x78zum5 x6s0dn4 x17d4w8g xn3w4p2 xt970qd xaope02 xc342km x1q4ynmn xjbqb8w x116urgp xqfszdh xif65rj x1ypdohk xfungia x1s688f`}}[!!r|0],children:[(0,X.jsx)(t,{size:16,"aria-hidden":!0}),e]},e))})]})}var Rn={state:{kmuXW:`x2lah0s`,kGuDYH:`xfifm61`,$$css:!0},waitingAgent:{kMwMTN:`x7zghnd`,$$css:!0},answered:{kMwMTN:`xh0clw4`,$$css:!0},resolved:{kMwMTN:`xddlp02`,$$css:!0}},zn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function Bn({thread:e,agent:t=`Agent`,actions:r,active:i=!1,offline:a=!1}){let s=je(e),c=e.status===`resolved`,l=c?{label:n(`common.resolved`),tone:Rn.resolved}:s===`agent`?{label:n(`document.waitingAgentReply`,{agent:t}),tone:Rn.waitingAgent}:s===`human`?{label:n(`document.agentReplied`,{agent:t}),tone:Rn.answered}:null;return(0,X.jsxs)(`div`,{"data-thread":e.id,...{0:{className:`xxlmvz2 x178xt8z x13fuv20 xxu5053 xqfszdh xo2rkog`},1:{className:`xxlmvz2 x178xt8z x13fuv20 xxu5053 xqfszdh xo2rkog xggygye`}}[!!i|0],children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z x1lqa7cf x1vo0akb x19ypqd9 x13ym6ox x4z9k3i`,children:[(0,X.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xuxw1ft xlyipyv x1bo0w0s`,children:e.anchor.quote||n(`document.wholeBlock`)}),l?(0,X.jsx)(`span`,{...o(Rn.state,l.tone),children:l.label}):null]}),c&&!i?null:e.messages.map(e=>{let{label:t,initial:r}=ze(e);return(0,X.jsxs)(`div`,{className:`x14vqqas`,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x167g77z x4z9k3i x1s688f`,children:[(0,X.jsx)(Re,{human:e.author===`human`,initial:r,name:e.name,src:e.avatar}),t,(0,X.jsx)(`span`,{className:`xddlp02 xo1l8bm xfifm61`,children:zn(e.editedAt??e.at)})]}),(0,X.jsx)(`div`,{...{0:{className:`x1gslohp xxpkpgd x1jvydc1 x1dbl2gt x126k92a xj0a0fe`},1:{className:`x1gslohp xxpkpgd x1jvydc1 x1dbl2gt x126k92a xj0a0fe xc7n51q`}}[!!e.deleted|0],children:e.deleted?n(`common.deleted`):e.text})]},e.id)}),r?(0,X.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xou54vl x1anpbxc xxpkpgd`,children:[c?null:(0,X.jsx)(`div`,{className:`x98rzlu xeuugli x1qyh8g1 xso031l x1q0q8m5 x1iz93xd`,children:(0,X.jsx)(Ie,{placeholder:n(`common.reply`),onSubmit:t=>r.reply(e.id,t)})}),a?null:(0,X.jsx)(`button`,{type:`button`,onClick:()=>c?r.reopen(e.id):r.resolve(e.id),className:`x2lah0s x1gg8mnh xt970qd xdqyycr x1w5wx5t xc342km xjbqb8w x1bo0w0s xqfszdh x4z9k3i x1ypdohk`,children:n(c?`common.reopen`:`common.resolve`)})]}):null]})}var $=.5,Vn=e=>e===78?$:e;function Hn({threads:e,agent:t=`Agent`,actions:r,offline:i,draft:a,onCreate:o,onCancelDraft:s,activeId:c,snap:l,onSnap:u}){let d=(0,U.useRef)(null),f=e.filter(e=>!e.messages.every(e=>e.deleted)),p=f.filter(e=>je(e)===`agent`).length,m=i?n(`document.offlineNoComments`):p>0?n(`document.waitingCount`,{count:p,agent:t}):null;return(0,U.useEffect)(()=>{let e=c?d.current?.querySelector(`[data-thread="${CSS.escape(c)}"]`):null,t=e?.closest(`[data-sheet-body]`);e&&t&&(t.scrollTo({top:t.scrollTop+e.getBoundingClientRect().top-t.getBoundingClientRect().top-8,behavior:`smooth`}),Ne(e,[{backgroundColor:`rgba(232, 194, 74, 0.24)`},{backgroundColor:`transparent`}],{duration:600,delay:250,easing:Me}))},[c]),(0,X.jsx)(He,{snaps:[78,$,1],snap:l,onSnap:u,onScrim:()=>u($),header:(0,X.jsxs)(`span`,{className:`x78zum5 x1pha0wt x17d4w8g xu0aao5 x17qtykl xwib8y2 xqfszdh x1jvydc1 x1s688f`,children:[n(`document.sheetComments`,{count:f.length}),m?(0,X.jsxs)(`span`,{className:`xddlp02 xfifm61 xo1l8bm`,children:[`· `,m]}):null]}),children:(0,X.jsxs)(`div`,{ref:d,className:`x17qtykl xwxc41k`,children:[a&&r?(0,X.jsxs)(`div`,{className:`x10dr8xq xqfszdh`,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z x4z9k3i`,children:[(0,X.jsx)(`span`,{className:`x98rzlu xeuugli x1lqa7cf x1vo0akb x19ypqd9 x13ym6ox xb3r6kr xuxw1ft xlyipyv x1bo0w0s`,children:a.quote}),(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`x1717udv xc342km xjbqb8w xddlp02 x4z9k3i x1ypdohk`,children:n(`common.cancel`)})]}),(0,X.jsx)(`div`,{className:`x1xmf6yo x1qyh8g1 xso031l x1q0q8m5 x1iz93xd`,children:(0,X.jsx)(Ie,{autoFocus:!0,placeholder:n(`document.agentPlaceholder`),onSubmit:e=>o(a,e).then(e=>(e&&s(),e))})})]}):null,f.length===0&&!a?(0,X.jsx)(`div`,{className:`xr9q8rw xddlp02 xqfszdh x4z9k3i x2b8uid`,children:n(`document.noComments`)}):null,f.map(e=>(0,X.jsx)(Bn,{thread:e,agent:t,actions:r,active:e.id===c,offline:i},e.id))]})})}var Un=52;function Wn({editor:e,threads:t,actions:n,agent:r,canComment:i,canEdit:a,offline:o,selection:s,clearSelection:c,onCreate:l,onEdit:u,onMain:d,history:f,children:p}){let[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(78),[b,x]=(0,U.useState)(null),S=ge(e,t,m);B(S,t,g),F(b?.range??null);let C=()=>{window.getSelection()?.removeAllRanges(),c()};return(0,X.jsxs)(`main`,{ref:e=>{h(e),d?.(e)},className:`x1n2onr6 x1cnzs8 x17qtykl x1ffnkcp`,children:[(0,X.jsxs)(`article`,{onClick:e=>{let t=fe(S,e.clientX,e.clientY);_(t),t&&y(Vn)},children:[f?.content,(0,X.jsx)(`div`,{hidden:!!f,children:p})]}),s&&!b&&!f?(0,X.jsx)(Ln,{...ve(s,{left:8,right:(m?.clientWidth??0)-8},170,44,{top:m?.getBoundingClientRect().top??0,height:window.innerHeight,reserved:Ue(v,window.innerHeight-Un)}),canComment:i,canEdit:a,onComment:()=>{x(s),y($),C()},onEdit:()=>{u(s),c()}}):null,(0,X.jsx)(`div`,{hidden:!!f,className:`xixxii4 x1ozmhy9 xu96u03 x3m8u43 x1ey2m1c x1355qak x47corl`,children:(0,X.jsx)(Hn,{threads:t,agent:r,actions:n,offline:o,draft:b,onCreate:l,onCancelDraft:()=>x(null),activeId:g,snap:v,onSnap:y})})]})}var Gn=200;function Kn(e,t){let[n,r]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(!e||!t)return;let n=0,i=()=>{let n=window.getSelection(),i=e.getRootElement();if(!n||n.isCollapsed||n.rangeCount===0||!i?.contains(n.anchorNode)){r(null);return}let a=n.toString().trim(),o=e.read(()=>{let e=n.anchorNode&&m(n.anchorNode)?.getTopLevelElement(),t=n.focusNode&&m(n.focusNode)?.getTopLevelElement();return!e||!t||!e.is(t)?null:_(e,b)||null});if(!o||!a){r(null);return}let s=n.getRangeAt(0),c=[...s.getClientRects()],l=c[0]??s.getBoundingClientRect(),u=c.at(-1)??l,d=t.getBoundingClientRect();r({blockId:o,quote:a.slice(0,500),left:l.left-d.left,bottom:u.bottom-d.top,top:l.top-d.top,right:u.right-d.left,range:s.cloneRange()})},a=()=>{clearTimeout(n),n=window.setTimeout(i,Gn)};return document.addEventListener(`selectionchange`,a),()=>{clearTimeout(n),document.removeEventListener(`selectionchange`,a)}},[e,t]),[n,()=>r(null)]}var qn=[...g.filter(e=>!le.some(t=>t.getType()===(`getType`in e?e.getType():e.replace.getType()))),...le];function Jn(){let e=(0,U.useMemo)(()=>window.matchMedia(`(prefers-color-scheme: dark)`),[]),[t,n]=(0,U.useState)(e.matches);return(0,U.useEffect)(()=>{let t=()=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[e]),t}function Yn(e){(0,U.useEffect)(()=>{if(!e)return;let t=document.createElement(`base`);return t.href=e,document.head.prepend(t),()=>t.remove()},[e])}function Xn({id:e,transport:t,live:r,cloud:i,fallback:a,actions:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(Pe),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(void 0),[y,b]=(0,U.useState)(0),x=(0,U.useCallback)(e=>{e!==void 0&&b(e-Date.now())},[]),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),O=!i||i.online&&!w,k=E&&O;(0,U.useEffect)(()=>{O||D(!1)},[O]),(0,U.useEffect)(()=>{if(!i)return;let t=t=>{t.source===window.parent&&t.origin===location.origin&&t.data?.type===`ryugi:document-history`&&t.data.id===e&&(t.data.action===`close`?D(!1):t.data.action===`toggle`&&O&&D(e=>!e))};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e,i,O]);let[A,ee]=(0,U.useState)(null),[j,te]=(0,U.useState)(null),ne=Jn(),{artifact:M,channel:N}=t,re=!i||i.online,P=!i||i.canEdit,F=Fe(Le),[I,L]=(0,U.useState)(!1),ae=F?I&&P:P,R=(0,U.useCallback)(async()=>{let e=await t.meta();e&&c(e)},[t]),z=a!=null;(0,U.useEffect)(()=>{let e=!1;return(async()=>{try{await R();let n=await t.state();if(e)return;let r=new ie;r.setRecordTimestamp(!0),r.setChangeMergeInterval(20),r.import(ye(n.snapshot)),g(!!n.streaming),v(n.agentActiveAt),x(n.now),f(n.comments??Pe());let i=z?{left:window.scrollX,top:window.scrollY,behavior:`instant`}:null;u(r),i&&requestAnimationFrame(()=>{e||window.scrollTo(i)})}catch(t){e||m(t.message)}})(),()=>{e=!0}},[t,R,x,z]),(0,U.useEffect)(()=>N.subscribe(e=>{e.type===`change`?R():e.type===`doc-status`?(g(e.streaming),v(e.agentActiveAt),x(e.now)):e.type===`doc-comments`&&f(e.comments)}),[N,R,x]),(0,U.useEffect)(()=>{A?.setEditable(ae&&!k)},[A,ae,k]),(0,U.useEffect)(()=>{P||L(!1)},[P]);let se=(0,U.useCallback)(e=>{g(!!e.streaming),v(e.agentActiveAt),x(e.now),e.comments&&f(e.comments)},[x]);Yn(s?.contentBase),Mn(A,M,r&&!k,t.send);let ce=(0,U.useMemo)(()=>({artifact:M,contentBase:s?.contentBase??``,channel:N,send:t.send}),[M,s?.contentBase,N,t]);(0,U.useEffect)(()=>{document.title=s?.title||e},[s?.title,e]),Oe(`document`);let B=Fn(A),le=In(B.count>0&&!h),ue=Ye({streaming:h,pending:B.count,agentActiveAt:_,now:le+y}),de=s?.agent??`Agent`,fe=(0,U.useMemo)(()=>({nextKey:B.firstKey,agent:de,activity:ue.kind}),[B.firstKey,de,ue.kind]),me=d.threads.filter(e=>e.status===`open`).length,[he,V]=Kn(A,j),ge=(0,U.useCallback)(()=>D(!1),[]),_e=vn({doc:l,nodes:qn,streaming:h,theme:ne?`dark`:`light`,title:s?.title||e,open:k,onClose:ge}),H=(0,U.useCallback)(async e=>{try{return f(await t.comment(e)),!0}catch{return!1}},[t]),ve=(0,U.useMemo)(()=>({reply:(e,t)=>H({op:`reply`,threadId:e,text:t}),edit:(e,t,n)=>void H({op:`edit`,threadId:e,messageId:t,text:n}),remove:(e,t)=>void H({op:`delete`,threadId:e,messageId:t}),resolve:e=>void H({op:`resolve`,threadId:e}),reopen:e=>void H({op:`reopen`,threadId:e})}),[H]),be=(0,U.useCallback)((e,t)=>H({op:`create`,blockId:e.blockId,quote:e.quote,text:t}),[H]),Se=(0,U.useCallback)(e=>{if(!A)return;A.setEditable(!0),L(!0),A.getRootElement()?.focus({preventScroll:!0});let t=window.getSelection();t?.removeAllRanges(),t?.addRange(e.range)},[A]);if(p)return(0,X.jsx)(`div`,{className:`x1o8uwn5 x2b8uid x1bo0w0s xqfszdh xif65rj`,children:p});if(!l)return a??(0,X.jsx)(`div`,{className:`x1o8uwn5 x2b8uid x1bo0w0s xqfszdh xif65rj`,children:n(`common.loading`)});let Ce=(0,X.jsx)(xe.Provider,{value:ce,children:(0,X.jsx)(oe.Provider,{value:fe,children:(0,X.jsx)(pe,{transport:t,agent:s?.agent,doc:l,theme:ne?`dark`:`light`,onAgentSection:C,onOffline:T,onState:se,onEditorReady:ee})})});return(0,X.jsxs)(`div`,{className:`x1us19tq x1rozbrz xo2rkog`,className:`ryugi-doc ${{className:`x1us19tq x1rozbrz xo2rkog`}.className??``}`,children:[(0,X.jsx)(En,{id:e,title:s?.title||e,agent:s?.agent,activity:ue,agentSection:S,offline:w,openComments:me,cloud:i,compact:F,onDone:F&&I?()=>L(!1):void 0,actions:o,history:{available:O,open:k,toggle:()=>D(e=>!e),close:ge}}),F?(0,X.jsx)(Wn,{editor:A,threads:d.threads,actions:ve,agent:s?.agent,canComment:re,canEdit:P,offline:!(!i||i.online),selection:I?null:he,clearSelection:V,onCreate:be,onEdit:Se,onMain:te,history:_e,children:Ce}):(0,X.jsx)(Tn,{editor:A,threads:d.threads,actions:ve,agent:s?.agent,canComment:re,selection:he,clearSelection:V,onCreate:be,onMain:te,history:_e,children:Ce}),(0,X.jsx)(Ve,{warnings:s?.warnings??[]})]})}var Zn=[`pending`],Qn=`x-ryugi-document-features`;function $n({id:e,channel:t,send:n}){let r=(t,n,r)=>fetch(`/api/document/${e}/${t}`,{method:`POST`,headers:{"Content-Type":r,[Qn]:Zn.join(`,`)},body:n});return{artifact:`document/${e}`,channel:t,send:n,async meta(){let t=await fetch(`/api/artifacts/document/${e}`,{cache:`no-store`});return t.ok?await t.json():null},async state(){let t=await fetch(`/api/document/${e}/state`,{cache:`no-store`}),n=await t.json();if(!t.ok||!n.snapshot)throw Error(n.error??`load failed (${t.status})`);return n},async update(e){let t=await r(`update`,e,`application/octet-stream`);if(!t.ok)throw Error(`update failed (${t.status})`)},async comment(e){let t=await r(`comments`,JSON.stringify(e),`application/json`);if(!t.ok)throw Error(`comment failed (${t.status})`);return(await t.json()).comments}}}function er(e){let t=(0,U.useMemo)(_e,[]),n=`document/${e}`,{live:r,send:i}=Be(e=>{e.artifact===n&&t.emit(e)},()=>t.emit({type:`open`}));return{transport:(0,U.useMemo)(()=>$n({id:e,channel:t,send:i}),[e,t,i]),live:r}}function tr({id:e}){let{transport:t,live:n}=er(e);return(0,X.jsx)(Xn,{id:e,transport:t,live:n,actions:(0,X.jsx)(Ee,{artifact:`document/${e}`})})}export{tr as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,o as n,s as r}from"./useSystemTheme-Dzqcdh-y.js";import{n as i,t as a}from"./jsx-runtime-CldxteV5.js";import{Fi as o,ur as s}from"./MenuRoot-CCLU8wQR.js";import{dt as c}from"./use-presence-9dVDVxFO.js";import{$ as l,B as u,C as d,D as f,F as p,G as m,H as h,I as g,J as _,K as v,L as y,M as b,N as x,O as S,P as C,Q as w,R as T,S as E,T as D,U as O,V as k,W as A,X as ee,Xn as j,Y as te,Yn as ne,Z as M,_ as N,a as re,at as ie,b as P,c as F,d as I,et as L,f as ae,g as oe,i as R,it as z,j as se,k as ce,l as B,m as le,n as ue,nt as de,o as fe,p as pe,q as me,r as he,rt as V,s as ge,t as _e,tt as H,u as ve,v as ye,w as be,x as xe,y as Se,z as Ce}from"./channel-CK8VjRfv.js";import{c as we,l as Te,n as Ee,o as De,t as Oe}from"./useTypeFavicon-B01CcUw4.js";import{b as ke}from"./itemEquality-C3XfrMi2.js";import{T as Ae,_ as je,c as Me,d as Ne,g as Pe,h as Fe,i as Ie,m as Le,o as Re,s as ze}from"./ThreadView-CmAxKSZ7.js";import{n as Be}from"./useArtifactSocket-L4eDpLQm.js";import{t as Ve}from"./WarningsBadge-xIuKcdGp.js";import{a as He,o as Ue,t as We}from"./selection-DiNkp8_u.js";var Ge={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Ge.node;var Ke=c(Ge),qe={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};qe.node;var Je=c(qe),U=e(i(),1);function Ye({streaming:e,pending:t,agentActiveAt:n,now:r}){if(e)return{kind:`editing`};if(t===0)return{kind:`idle`};if(n===void 0)return{kind:`working`,pending:t,idleMs:null};let i=Math.max(0,r-n);return i>3e5?{kind:`stale`,pending:t,idleMs:i}:{kind:`working`,pending:t,idleMs:i}}function Xe(e){return e<6e4?t.t(`time.seconds`,{count:Math.floor(e/1e3)}):e<36e5?t.t(`time.minutes`,{count:Math.floor(e/6e4)}):t.t(`time.hours`,{count:Math.floor(e/36e5)})}function Ze(e,n,r){switch(e.kind){case`editing`:return r?t.t(`activity.editingSection`,{agent:n,section:r}):t.t(`activity.editing`,{agent:n});case`idle`:return null;case`working`:{let r=t.t(`activity.pending`,{agent:n,count:e.pending});return e.idleMs===null?r:e.idleMs<1e4?t.t(`activity.updatedJustNow`,{left:r}):t.t(`activity.updatedAgo`,{left:r,duration:Xe(e.idleMs)})}case`stale`:return t.t(`activity.stale`,{agent:n,duration:Xe(e.idleMs),count:e.pending})}}async function Qe(e){await new Promise(e=>setTimeout(e,0));let t=[...e.getAllChanges().values()].flat().sort((e,t)=>e.lamport-t.lamport||e.peer.localeCompare(t.peer)||e.counter-t.counter),n=e.shallowSinceFrontiers(),r=e.frontiersToVV(n),i=[],a=[];try{for(let n of t){r.setLast({peer:n.peer,counter:n.counter+n.length-1});let t={id:`${n.counter}@${n.peer}`,change:n,frontiers:e.vvToFrontiers(r)};i.push(t);let o=n.message===`human`?`human`:n.message?.startsWith(`agent:`)?`agent`:n.message?.startsWith(`session `)?`session`:`unknown`,s=a.at(-1),c=s?.entries.at(-1)?.change;s&&c&&o!==`unknown`&&s.source===o&&c.peer===n.peer&&c.timestamp>0&&n.timestamp>=c.timestamp&&n.timestamp-c.timestamp<=60?(s.entries.push(t),s.id=t.id):a.push({id:t.id,source:o,entries:[t]}),i.length%200==0&&await new Promise(e=>setTimeout(e,0))}}finally{r.free()}return{entries:i,groups:a.reverse(),shallow:n.length>0}}function $e(e,n,r){let i=e.fork(),a;try{i.checkout(n);let e=i.getTree(Se).roots();if(e.length!==1)throw Error(t.t(`history.contentUnavailable`));let o=me({nodes:r,editable:!1,onError:e=>{throw e}});a=P(o,i);let s=e[0].children()??[],c=new Map,l=(e,t)=>{c.set(e.id,t),e.children()?.forEach(e=>l(e,t))};return s.forEach(e=>l(e,e.id)),{value:o.getEditorState().toJSON(),ids:s.map(e=>e.id),owners:c}}finally{a?.dispose(),i.free()}}var et=/^cid:(\d+@\d+):Map$/;function tt(e,t,n){let r=new Map(n.flatMap(e=>[...e.owners])),i=e.getTree(Se),a=new Map,o=new Map(t.map((e,t)=>[e,t])),s=(e,t)=>{let n=a.get(e);(!n||o.get(n)<o.get(t))&&a.set(e,t)};for(let n of t){let{peer:t,counter:i,length:a}=n.change;for(let o of e.getChangedContainersIn({peer:t,counter:i},a)){let t=e.getContainerById(o);for(;t;){let e=et.exec(t.id)?.[1],i=e&&r.get(e);if(i){s(i,n);break}t=t.parent()}}}let c=e=>e&&t.find(({change:t})=>t.peer===e.peer&&t.counter<=e.counter&&e.counter<t.counter+t.length);for(let e of new Set(r.values())){if(!i.isNodeDeleted(e))continue;let t=c(i.getNodeByID(e)?.getLastMoveId());t&&s(e,t)}return a}var nt=5e4,rt=`background-color: color-mix(in srgb, var(--rc-alert-caution) 22%, transparent); text-decoration: line-through;`,it=`background-color: color-mix(in srgb, var(--rc-alert-tip) 22%, transparent);`;function W(e){let t=e;return t.type===`heading`?`heading:${t.tag}`:t.type===`list`?`list:${t.listType}`:t.type||`unknown`}function at(e,t){return JSON.stringify(e)===JSON.stringify(t)}function G(e){let t=e;return t.type===`text`&&typeof t.text==`string`}function K(e){let t=e;return Array.isArray(t.children)?t.children:null}function ot(e,t){let n=typeof e==`string`?e.trim():``;return n?`${n}${n.endsWith(`;`)?``:`;`} ${t}`:t}function q(e,t,n){let{style:r}=e;return n===`delete`?r=ot(r,rt):n===`insert`&&(r=ot(r,it)),{...e,text:t,style:r}}function J(e,t){return{...e,children:t}}function Y(e,t){if(G(e))return q(e,e.text,t);let n=K(e);return n?J(e,n.map(e=>Y(e,t))):e}function st(e){return Array.from(e).reverse().join(``)}function ct(e){let t=[];for(let n of e){if(!n.text)continue;let e=t.at(-1);e&&e.kind===n.kind?e.text+=n.text:t.push({...n})}return t}function lt(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===0)return[{kind:`insert`,text:t.join(``)}];if(r===0)return[{kind:`delete`,text:e.join(``)}];if(n*r>nt)return[{kind:`delete`,text:e.join(``)},{kind:`insert`,text:t.join(``)}];let i=Array.from({length:n+1},()=>Array.from({length:r+1}).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++)e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]+1:i[a][n]=Math.max(i[a-1][n],i[a][n-1]);let a=[],o=n,s=r;for(;o>0&&s>0;)if(e[o-1]===t[s-1]){let t=a.at(-1);t&&t.kind===`equal`?t.text+=e[o-1]:a.push({kind:`equal`,text:e[o-1]}),o--,s--}else if(i[o-1][s]>=i[o][s-1]){let t=a.at(-1);t&&t.kind===`delete`?t.text+=e[o-1]:a.push({kind:`delete`,text:e[o-1]}),o--}else{let e=a.at(-1);e&&e.kind===`insert`?e.text+=t[s-1]:a.push({kind:`insert`,text:t[s-1]}),s--}for(;o>0;){let t=a.at(-1);t&&t.kind===`delete`?t.text+=e[o-1]:a.push({kind:`delete`,text:e[o-1]}),o--}for(;s>0;){let e=a.at(-1);e&&e.kind===`insert`?e.text+=t[s-1]:a.push({kind:`insert`,text:t[s-1]}),s--}return ct(a.reverse().map(e=>({kind:e.kind,text:st(e.text)})))}function ut(e,t){let n=Array.from(e),r=Array.from(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.length-1,o=r.length-1;for(;a>=i&&o>=i&&n[a]===r[o];)a--,o--;let s=[];return i>0&&s.push({kind:`equal`,text:n.slice(0,i).join(``)}),s.push(...lt(n.slice(i,a+1),r.slice(i,o+1))),a<n.length-1&&s.push({kind:`equal`,text:n.slice(a+1).join(``)}),ct(s)}function dt(e,t){let n=ut(e.text,t.text),r=[],i=[],a=!1;for(let o of n)o.text&&(o.kind===`equal`?(r.push(q(e,o.text)),i.push(q(t,o.text))):(a=!0,o.kind===`delete`?r.push(q(e,o.text,`delete`)):i.push(q(t,o.text,`insert`))));return{oldNodes:r.length>0?r:[e],newNodes:i.length>0?i:[t],changed:a}}function ft(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array.from({length:r+1}).fill(0));for(let a=1;a<=n;a++)for(let n=1;n<=r;n++){let r=Math.max(i[a-1][n],i[a][n-1]);if(W(e[a-1])===W(t[n-1])){let o=at(e[a-1],t[n-1])?2:1;i[a][n]=Math.max(r,i[a-1][n-1]+o)}else i[a][n]=r}let a=[],o=n,s=r;for(;o>0&&s>0;){if(W(e[o-1])===W(t[s-1])){let n=at(e[o-1],t[s-1]),r=n?2:1;if(i[o][s]===i[o-1][s-1]+r){a.push(n?{kind:`equal`,node:e[o-1]}:{kind:`modify`,oldNode:e[o-1],newNode:t[s-1]}),o--,s--;continue}}i[o-1][s]>=i[o][s-1]?(a.push({kind:`delete`,node:e[o-1]}),o--):(a.push({kind:`insert`,node:t[s-1]}),s--)}for(;o>0;)a.push({kind:`delete`,node:e[--o]});for(;s>0;)a.push({kind:`insert`,node:t[--s]});return a.reverse(),a}function pt(e,t){let n=ft(e,t),r=[],i=[],a=!1;for(let e of n)switch(e.kind){case`equal`:r.push(e.node),i.push(e.node);break;case`delete`:a=!0,r.push(Y(e.node,`delete`));break;case`insert`:a=!0,i.push(Y(e.node,`insert`));break;case`modify`:{if(a=!0,G(e.oldNode)&&G(e.newNode)){let t=dt(e.oldNode,e.newNode);r.push(...t.oldNodes),i.push(...t.newNodes);break}let t=mt(e.oldNode,e.newNode);t?(r.push(t.oldNode),i.push(t.newNode)):(r.push(Y(e.oldNode,`delete`)),i.push(Y(e.newNode,`insert`)));break}}return{oldChildren:r,newChildren:i,changed:a}}function mt(e,t){if(W(e)!==W(t))return null;if(at(e,t))return{oldNode:e,newNode:t,changed:!1};let n=K(e),r=K(t);if(!n||!r)return null;let i=pt(n,r);return i.changed?{oldNode:J(e,i.oldChildren),newNode:J(t,i.newChildren),changed:!0}:{oldNode:e,newNode:t,changed:!1}}function ht(e,t){let n=mt(e,t);return n?{oldNode:n.oldNode,newNode:n.newNode}:{oldNode:Y(e,`delete`),newNode:Y(t,`insert`)}}function gt(e,t){let n=ut(e.text,t.text),r=[];for(let i of n)i.text&&(i.kind===`equal`?r.push(q(t,i.text)):i.kind===`delete`?r.push(q(e,i.text,`delete`)):r.push(q(t,i.text,`insert`)));return r}function _t(e,t){let n=ft(e,t),r=[];for(let e of n)switch(e.kind){case`equal`:r.push(e.node);break;case`delete`:r.push(Y(e.node,`delete`));break;case`insert`:r.push(Y(e.node,`insert`));break;case`modify`:{if(G(e.oldNode)&&G(e.newNode)){r.push(...gt(e.oldNode,e.newNode));break}let t=K(e.oldNode),n=K(e.newNode);t&&n?r.push(J(e.newNode,_t(t,n))):(r.push(Y(e.oldNode,`delete`)),r.push(Y(e.newNode,`insert`)));break}}return r}function vt(e,t){if(W(e)!==W(t))return Y(t,`insert`);if(at(e,t))return t;let n=K(e),r=K(t);return!n||!r?Y(t,`insert`):J(t,_t(n,r))}function yt(e,t){let n=ft(e.root.children,t.root.children),r=[];for(let e of n)switch(e.kind){case`equal`:{let t=r.at(-1);t&&t.type===`equal`?t.nodes.push(e.node):r.push({type:`equal`,nodes:[e.node]});break}case`modify`:{let t=ht(e.oldNode,e.newNode);r.push({type:`delete`,nodes:[t.oldNode]},{type:`insert`,nodes:[t.newNode]})}break;case`delete`:r.push({type:`delete`,nodes:[Y(e.node,`delete`)]});break;case`insert`:r.push({type:`insert`,nodes:[Y(e.node,`insert`)]})}return r}function bt(e){let t={...e};if(t.$){let{blockId:e,...n}=t.$;Object.keys(n).length?t.$=n:delete t.$}return t.children&&=t.children.map(bt),t}function xt(e,t){let{children:n,text:r,...i}=e,{children:a,text:o,...s}=t;return JSON.stringify(i)!==JSON.stringify(s)||!!(n&&a&&Tt(n,a).some(e=>e.kind===`modify`&&xt(e.old[0],e.current[0])))}function St(e){let n=e;return n.type===`dynamic`||n.type===`pending`?{type:`paragraph`,version:1,direction:null,format:``,indent:0,children:[{type:`text`,version:1,text:n.type===`dynamic`?t.t(`history.dynamic`,{url:n.url,height:n.initialHeight??320,props:JSON.stringify(n.props??{})}):t.t(`history.pendingIntent`,{intent:n.intent??``}),format:0,detail:0,mode:`normal`,style:``}]}:n.children?{...n,children:n.children.map(St)}:n}function Ct(e){return wt(e.map(St))}function wt(e){return{root:{type:`root`,version:1,direction:null,format:``,indent:0,children:e}}}function Tt(e,t){let n=yt(wt(e),wt(t)),r=[],i=0,a=0;for(let o=0;o<n.length;o++){let s=n[o];if(s.type===`equal`){r.push({kind:`equal`,old:e.slice(i,i+s.nodes.length),current:t.slice(a,a+s.nodes.length),oldIndex:i,newIndex:a}),i+=s.nodes.length,a+=s.nodes.length;continue}let c=0,l=0;for(;o<n.length&&n[o].type!==`equal`;){let e=n[o++];e.type===`delete`?c+=e.nodes.length:l+=e.nodes.length}o--;for(let n=0;n<Math.max(c,l);n++){let o=n<c?[e[i+n]]:[],s=n<l?[t[a+n]]:[];r.push({kind:o.length&&s.length?`modify`:o.length?`delete`:`insert`,old:o,current:s,oldIndex:o.length?i+n:void 0,newIndex:s.length?a+n:void 0})}i+=c,a+=l}return r}function Et(e,t){return Tt(e.root.children.map(bt),t.root.children.map(bt)).map(e=>{let t={oldIndex:e.oldIndex,newIndex:e.newIndex};if(e.kind===`modify`){let n=e.old[0],r=e.current[0];return n.type===r.type&&!xt(n,r)?{kind:`modify`,value:Ct([vt(n,r)]),...t}:{kind:`modify`,before:Ct(e.old),value:Ct(e.current),...t}}let n=e.kind===`delete`?e.old:e.current;return{kind:e.kind,value:Ct(e.kind===`equal`?n:n.map(t=>Y(t,e.kind))),...t}})}function Dt(e){let t=me(e);return t._headless=!0,[`registerDecoratorListener`,`registerRootListener`,`registerMutationListener`,`getRootElement`,`setRootElement`,`getElementByKey`,`focus`,`blur`].forEach(e=>{t[e]=()=>{(function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)})(439,e)}}),t}var X=a();function Ot({text:e}){let t=(0,U.useRef)(null),n=(0,U.useRef)(null);return(0,U.useEffect)(()=>{let r=t.current;if(!r)return;let i=r.parentNode;if(!i)return;let a=n.current;return!a||a.parentNode!==i?(a=document.createComment(e),i.insertBefore(a,r),n.current=a):a.data!==e&&(a.data=e),()=>{n.current?.parentNode&&n.current.parentNode.removeChild(n.current),n.current=null}},[e]),(0,X.jsx)(`template`,{suppressHydrationWarning:!0,"data-rich-comment-anchor":``,ref:t})}var Z=e=>`${V[e]} ${z[e]}`,kt={h1:Z(`headingH1`),h2:Z(`headingH2`),h3:Z(`headingH3`),h4:Z(`headingH4`),h5:Z(`headingH5`),h6:Z(`headingH6`)};function At(e){return e.toLowerCase().trim().replaceAll(/[^\s\w\u3000-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF-]/g,``).replaceAll(/[\s_]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function jt(e){return e.type===`comment`?``:e.text?e.text:e.children?e.children.map(jt).join(``):``}var Mt=/^["'«‘“‹「『"']/,Nt=/["'»’”›」』"']$/;function Pt(e,t,n,r,i){switch(e.type){case`root`:return(0,X.jsx)(X.Fragment,{children:n});case`paragraph`:{let r=e.format?{textAlign:e.format}:void 0;return(0,X.jsx)(`p`,{className:Z(`paragraph`),style:r,children:n??(0,X.jsx)(`br`,{})},t)}case`heading`:{let a=e.tag,o=At(i||jt(e)),s=o;if(o){let e=r.get(o);e===void 0?r.set(o,1):(s=`${o}-${e}`,r.set(o,e+1))}return(0,X.jsxs)(a,{className:kt[a],id:s||void 0,children:[s&&(0,X.jsx)(`a`,{className:Z(`headingAnchor`),href:`#${s}`,tabIndex:0,children:(0,X.jsx)(j,{"aria-hidden":!0,size:14,strokeWidth:2})}),n]},t)}case`rich-quote`:case`quote`:{let r=(i||jt(e)).trim(),a=Mt.test(r),o=Nt.test(r),s=e.attribution;return(0,X.jsxs)(`blockquote`,{className:Z(`quote`),"data-no-close-quote":o?``:void 0,"data-no-open-quote":a?``:void 0,children:[n,s&&(0,X.jsxs)(`footer`,{className:Z(`quoteAttribution`),children:[`— `,s]})]},t)}case`list`:{let r=e.listType===`number`?`ol`:`ul`,i=e.listType===`number`?Z(`listOl`):e.listType===`check`?`${Z(`checklist`)} ${Z(`listUl`)}`:Z(`listUl`);return(0,X.jsx)(r,{className:i,start:e.start===1?void 0:e.start,children:n},t)}case`listitem`:{let r=e.checked!==void 0,i=e.children?.some(e=>e.type===`list`),a=typeof e.value==`number`&&e.value>1?e.value:void 0,o;return o=i?Z(`listNestedItem`):r?e.checked?`${Z(`listItem`)} ${Z(`listItemChecked`)}`:`${Z(`listItem`)} ${Z(`listItemUnchecked`)}`:Z(`listItem`),(0,X.jsx)(`li`,{className:o,value:a,children:n},t)}case`link`:return(0,X.jsxs)(`a`,{className:Z(`link`),href:e.url,rel:e.rel||`noopener`,target:e.target||`_blank`,children:[(0,X.jsx)(se,{href:e.url}),n]},t);case`autolink`:return(0,X.jsxs)(`a`,{className:Z(`link`),href:e.url,rel:`noopener`,target:`_blank`,children:[(0,X.jsx)(se,{href:e.url}),n]},t);case`horizontalrule`:return(0,X.jsx)(`hr`,{className:Z(`hr`)},t);case`table`:return(0,X.jsx)(`div`,{className:Z(`tableScrollableWrapper`),children:(0,X.jsx)(`table`,{className:Z(`table`),children:n})},t);case`tablerow`:return(0,X.jsx)(`tr`,{children:n},t);case`tablecell`:{let r=e.headerState?`th`:`td`,i=e.headerState?Z(`tableCellHeader`):Z(`tableCell`);return(0,X.jsx)(r,{className:i,colSpan:e.colSpan>1?e.colSpan:void 0,children:n},t)}case`details`:{let r=e.summary||``;return(0,X.jsxs)(`details`,{className:`${y.details} ${T.details}`,open:e.open||void 0,children:[(0,X.jsxs)(`summary`,{className:`${y.summary} ${T.summary}`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`${y.chevron} ${T.chevron}`,children:(0,X.jsx)(`svg`,{fill:`none`,height:`20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,viewBox:`0 0 20 20`,width:`20`,children:(0,X.jsx)(`path`,{d:`M8 6L12 10L8 14`})})}),(0,X.jsx)(`span`,{className:`${y.summaryText} ${T.summaryText}`,children:r})]}),(0,X.jsx)(`div`,{className:`${y.content} ${T.content}`,children:n})]},t)}case`spoiler`:return(0,X.jsx)(`span`,{className:Z(`spoiler`),role:`button`,tabIndex:0,children:n},t);case`tag`:return(0,X.jsx)(`span`,{className:Z(`tag`),style:{backgroundColor:O(e.text)},children:e.text},t);case`comment`:return(0,X.jsx)(Ot,{text:e.text??``},t);case`ruby`:return(0,U.createElement)(H,{key:t,rendererKey:`Ruby`,defaultRenderer:ce,props:{reading:e.reading??``,children:n}});case`code`:return(0,X.jsx)(`pre`,{className:`rich-code-block`,children:(0,X.jsx)(`code`,{children:n})},t);case`code-highlight`:return(0,X.jsx)(`span`,{children:e.text},t);case`linebreak`:return(0,X.jsx)(`br`,{},t);case`tab`:return(0,X.jsx)(`span`,{children:` `},t);default:return null}}var Ft=e=>`${V[e]} ${z[e]}`,It=[[1,`textBold`],[2,`textItalic`],[4,`textStrikethrough`],[8,`textUnderline`],[16,`textCode`],[32,`textSubscript`],[64,`textSuperscript`],[128,`textHighlight`]];function Lt(e){let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();if(!r||!i)continue;let a=r.replaceAll(/-([a-z])/g,(e,t)=>t.toUpperCase());t[a]=i}return t}function Rt(e,t){let n=e.text,r=e.format||0;for(let[e,i]of It)r&e&&(n=(0,X.jsx)(`span`,{className:Ft(i),children:n},`${t}-${e}`));return e.style&&(n=(0,X.jsx)(`span`,{style:Lt(e.style),children:n},t)),n}function zt(e){let t={},n=new Set,r={},i=1;function a(e){if(e.type===`footnote`&&e.identifier){let t=e.identifier;n.has(t)||(n.add(t),r[t]=i++)}if(e.type===`footnote-section`&&e.definitions&&Object.assign(t,e.definitions),e.children)for(let t of e.children)a(t);if(e.root&&a(e.root),e.content&&typeof e.content==`object`&&e.content.root&&a(e.content),e.cells&&Array.isArray(e.cells))for(let t of e.cells)t&&t.root&&a(t)}a(e);for(let e of n)e in t||(t[e]=``);return{definitions:t,displayNumberMap:r}}var Bt=e=>`${V.alert} ${z.alert} rich-alert-${e}`;function Vt(e,t,n){switch(e.type){case`alert-quote`:return(0,U.createElement)(`div`,{key:t,className:Bt(e.alertType)},n);case`banner`:return(0,U.createElement)(`div`,{key:t,className:`rich-banner rich-banner-${e.bannerType}`},n);case`grid-container`:return(0,U.createElement)(`div`,{key:t,className:`${Ce.container} ${u.container}`},n);default:return(0,U.isValidElement)(n)?(0,U.cloneElement)(n,{key:t}):n}}function Ht(e,t,n){return(0,U.isValidElement)(e)&&typeof e.type==`string`?(0,U.cloneElement)(e,{"data-block-id":t}):(0,X.jsx)(`div`,{className:`rich-block-anchor`,"data-block-id":t,children:e},`${n}-block-anchor`)}function Ut(e,t,n,r){return t?(r.blockAnchor??Ht)(e,t,n):e}function Wt(e,t,n,r,i,a,o){let s=e.getKey?e.getKey():i,{builtinNodeOverrides:c}=o;if(typeof e.decorate==`function`){let r=null;try{r=e.decorate(t,n)}catch{}if(r!=null){let t=e.exportJSON?e.exportJSON():{},n=c?.[t.type];return Ut(n?n(t,s,[r],()=>Vt(t,s,r)):Vt(t,s,r),a,s,o)}}let l=e.exportJSON?e.exportJSON():{};if(l.type===`text`){let e=c?.text;return e?e(l,s,null,()=>Rt(l,s)):Rt(l,s)}let u=typeof e.getChildren==`function`?e.getChildren():[];Array.isArray(l.children)&&l.children.length===0&&u.length>0&&(l.children=u.map(e=>({type:typeof e.getType==`function`?e.getType():e.__type})));let d=null;u.length>0&&(d=u.map((e,i)=>Wt(e,t,n,r,`${s}-${i}`,void 0,o)));let f=e.getTextContent?e.getTextContent():void 0,p=c?.[l.type];return Ut(p?p(l,s,d,()=>Pt(l,s,d,r,f)):Pt(l,s,d,r,f),a,s,o)}function Gt(e,t,n){let r=Dt({nodes:t,theme:h,editable:!1,onError:e=>{console.error(`[RichRenderer]`,e)}}),i={namespace:`ssr`,theme:h},a=x(e),o=r.parseEditorState(a);r.setEditorState(o);let s=zt(a),c=a.root?.children,l=null;return o.read(()=>{let e=v(),t=new Map,a=e.getChildren().map((e,a)=>Wt(e,r,i,t,`ssr-${a}`,c?.[a]?.$?.blockId,n));l=(0,X.jsx)(X.Fragment,{children:a})}),{content:l,footnoteData:s,renderNestedContent:e=>{let r=Dt({nodes:t,theme:h,editable:!1,onError:e=>{console.error(`[RichRenderer:nested]`,e)}}),i={namespace:`ssr-nested`,theme:h},a=x(e),o=r.parseEditorState(a);r.setEditorState(o);let s=null,c=a.root?.children;return o.read(()=>{let e=v(),t=new Map,a=e.getChildren().map((e,a)=>Wt(e,r,i,t,`nested-${a}`,c?.[a]?.$?.blockId,n));s=(0,X.jsx)(X.Fragment,{children:a})}),s}}}function Kt({value:e,variant:t=`article`,theme:n=`light`,className:r,style:i,as:a=`div`,nested:o=!1,rendererConfig:s,extraNodes:c,builtinNodeOverrides:l,blockAnchor:u}){let d=de(t),f=A(),{content:m,footnoteData:h,renderNestedContent:_}=(0,U.useMemo)(()=>Gt(e,c?[...g,...c]:g,{blockAnchor:u,builtinNodeOverrides:l}),[u,l,c,e]),v=[`rich-content`,d,r].filter(Boolean).join(` `),y=typeof a==`string`?{suppressHydrationWarning:!0,className:v,"data-rich-nested":o?`true`:void 0,"data-theme":n}:{};return(0,X.jsx)(C,{className:d,theme:n,children:(0,X.jsx)(p,{colorScheme:n,children:(0,X.jsx)(L,{config:s,mode:`renderer`,variant:t,children:(0,X.jsx)(M,{definitions:h.definitions,displayNumberMap:h.displayNumberMap,children:(0,X.jsx)(k,{value:f??_,children:(0,X.jsx)(a,{...y,style:i,children:m})})})})})})}var qt=[D],Jt=864e5,Yt=e=>String(e).padStart(2,`0`),Xt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function Zt(e,n=Date.now()){if(!(e>0))return t.t(`time.notRecorded`);let i=new Date(e*1e3),a=new Date(n),o=Math.round((Xt(a)-Xt(i))/Jt);if(o===0)return t.t(`time.today`);if(o===1)return t.t(`time.yesterday`);let s=i.getFullYear()===a.getFullYear();return new Intl.DateTimeFormat(r[t.language],s?{month:`long`,day:`numeric`}:{year:`numeric`,month:`long`,day:`numeric`}).format(i)}function Qt(e,t=!1){if(!(e>0))return`--:--`;let n=new Date(e*1e3),r=`${Yt(n.getHours())}:${Yt(n.getMinutes())}`;return t?`${r}:${Yt(n.getSeconds())}`:r}function Q(e){return e>0?`${Zt(e)} ${Qt(e)}`:t.t(`time.notRecorded`)}var $t={human:`history.sourceHuman`,agent:`history.sourceAgent`,session:`history.sourceSession`,unknown:`history.sourceUnknown`};function en(e){let{session:t,selected:n}=e;return t&&n?t.history.groups.find(e=>e.entries.includes(n)):void 0}function tn(e){return e.session?.history.entries.at(-1)?.change.timestamp??0}function nn({model:e}){let{count:t,changeIndex:r,loading:i}=e;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{role:`status`,"aria-live":`polite`,className:`history-count`,children:[t?r+1:0,` / `,t]}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.previousChange`),disabled:r===0||i,onClick:()=>e.navigate(-1),children:(0,X.jsx)(Te,{size:14,"aria-hidden":`true`})}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.nextChange`),disabled:r>=t-1||i,onClick:()=>e.navigate(1),children:(0,X.jsx)(ke,{size:14,"aria-hidden":`true`})})]})}function rn({model:e}){return(0,X.jsx)(`button`,{type:`button`,className:`history-filter`,"aria-pressed":e.onlyChanges,onClick:e.toggleOnly,children:n(`history.onlyChanges`)})}function an({model:e}){return e.pending?(0,X.jsxs)(`div`,{className:`history-update`,role:`status`,children:[(0,X.jsx)(`span`,{children:e.streaming?n(`history.waitingEdits`):n(`history.newContent`,{time:Qt(tn(e))})}),(0,X.jsxs)(`button`,{type:`button`,disabled:e.streaming||e.loading,onClick:e.refresh,children:[(0,X.jsx)(Je,{size:12,"aria-hidden":`true`}),n(`history.refresh`)]})]}):null}function on({model:e}){let{selected:t,blocks:r,count:i}=e,a=en(e),o=r.filter(e=>e.kind===`insert`||e.kind===`modify`).length,s=r.filter(e=>e.kind===`delete`||e.kind===`modify`).length;return(0,X.jsxs)(`section`,{className:`history-compare`,"aria-label":n(`history.range`),children:[(0,X.jsxs)(`dl`,{children:[(0,X.jsx)(`dt`,{children:n(`history.from`)}),(0,X.jsxs)(`dd`,{children:[(0,X.jsx)(`strong`,{children:t?Q(t.change.timestamp):n(`history.pickPoint`)}),a?(0,X.jsx)(`span`,{children:n($t[a.source])}):null]}),(0,X.jsx)(`dt`,{children:n(`history.to`)}),(0,X.jsxs)(`dd`,{children:[(0,X.jsx)(`strong`,{children:n(`history.latestVersion`)}),(0,X.jsx)(`span`,{children:Q(tn(e))})]})]}),(0,X.jsxs)(`div`,{className:`history-controls`,children:[(0,X.jsx)(`span`,{children:n(`history.changes`,{count:i})}),(0,X.jsxs)(`span`,{className:`history-plus`,children:[`+`,o]}),(0,X.jsxs)(`span`,{className:`history-minus`,children:[`−`,s]}),(0,X.jsx)(`span`,{className:`history-spacer`}),(0,X.jsx)(rn,{model:e}),(0,X.jsx)(nn,{model:e})]})]})}function sn({model:e}){let[t,r]=(0,U.useState)(50),[i,a]=(0,U.useState)(()=>new Set),{session:o,selected:s,blocks:c}=e;if(!o)return null;let{groups:l,entries:u,shallow:d}=o.history,f=l.findIndex(e=>s!==null&&e.entries.includes(s)),p=new Map;for(let e of c)e.group&&p.set(e.group,(p.get(e.group)??0)+1);let m=l.slice(0,t),h=e=>Zt(e.entries.at(-1).change.timestamp),g=e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ol`,{className:`history-timeline`,"aria-label":n(`history.timeline`),children:m.map((t,r)=>{let a=t.entries.at(-1),o=h(t),c=r===0||o!==h(m[r-1]),l=r===f?`selected`:r===0?`latest`:r<f?`range`:`outside`,u=i.has(t.id),d=r<f?p.get(t):void 0;return(0,X.jsxs)(`li`,{className:`history-node`,"data-state":l,"data-upper":r<=f?`in`:`out`,"data-lower":r<f?`in`:`out`,"data-day":c?``:void 0,children:[c?(0,X.jsx)(`div`,{className:`history-day`,children:o}):null,(0,X.jsxs)(`div`,{className:`history-row`,children:[(0,X.jsx)(`span`,{className:`history-dot`,"aria-hidden":`true`}),(0,X.jsxs)(`button`,{type:`button`,className:`history-select`,"aria-current":l===`selected`?`true`:void 0,onClick:()=>e.select(a),children:[(0,X.jsxs)(`span`,{className:`history-line`,children:[(0,X.jsx)(`strong`,{children:Qt(a.change.timestamp)}),(0,X.jsx)(`span`,{children:n($t[t.source])}),l===`latest`?(0,X.jsx)(`span`,{className:`history-tag`,children:n(`history.latest`)}):null,l===`selected`?(0,X.jsx)(`span`,{className:`history-tag history-start`,children:n(`history.start`)}):null]}),(0,X.jsxs)(`span`,{className:`history-meta`,children:[n(`history.commits`,{count:t.entries.length}),d?(0,X.jsx)(`span`,{className:`history-changed`,children:n(`history.changedSuffix`,{count:d})}):null]})]}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon history-expand`,"aria-label":n(u?`history.collapseCommits`:`history.expandCommits`),"aria-expanded":u,onClick:()=>g(t.id),children:(0,X.jsx)(Ae,{size:14,"aria-hidden":`true`})})]}),u?(0,X.jsx)(`div`,{className:`history-raw`,children:[...t.entries].reverse().map(t=>(0,X.jsxs)(`button`,{type:`button`,title:t.change.message,"aria-current":t===s?`true`:void 0,onClick:()=>e.select(t),children:[(0,X.jsx)(`span`,{children:Qt(t.change.timestamp,!0)}),(0,X.jsx)(`code`,{children:t.change.message||n(`history.sourceUnknown`)})]},t.id))}):null]},t.id)})}),t<l.length?(0,X.jsx)(`button`,{type:`button`,className:`history-more`,onClick:()=>r(e=>e+50),children:n(`history.loadEarlier`)}):(0,X.jsxs)(`p`,{className:`history-end`,children:[n(d?`history.shallow`:`history.earliest`),` · `,n(`history.summary`,{edits:n(`history.edits`,{count:l.length}),commits:n(`history.commits`,{count:u.length})}),(0,X.jsx)(`br`,{}),n(`history.clockNote`)]})]})}function cn({streaming:e}){return(0,X.jsxs)(`div`,{className:`history-waiting`,children:[(0,X.jsx)(`p`,{role:`status`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`strong`,{children:n(`history.agentEditing`)}),(0,X.jsx)(`span`,{children:n(`history.agentEditingBody`)})]}):(0,X.jsx)(`strong`,{children:n(`history.loading`)})}),(0,X.jsx)(`div`,{className:`history-skeleton`,"aria-hidden":`true`,children:[150,130,160,120].map(e=>(0,X.jsx)(`span`,{style:{width:e}},e))})]})}function ln({model:e}){return(0,X.jsxs)(`div`,{role:`alert`,className:`history-failure`,children:[(0,X.jsxs)(`strong`,{children:[(0,X.jsx)(we,{size:15,"aria-hidden":`true`}),n(`history.failed`)]}),(0,X.jsx)(`code`,{children:e.error}),(0,X.jsx)(`span`,{children:n(`history.failedBody`)}),(0,X.jsxs)(`span`,{className:`history-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`history-button`,disabled:e.streaming,onClick:e.refresh,children:n(`common.retry`)}),(0,X.jsx)(`button`,{type:`button`,className:`history-quiet`,onClick:e.close,children:n(`history.backToComments`)})]})]})}function un({model:e}){return(0,X.jsxs)(`aside`,{className:`history-panel`,"aria-label":n(`history.title`),children:[(0,X.jsxs)(`header`,{className:`history-panel-head`,children:[(0,X.jsx)(`h2`,{children:n(`history.title`)}),(0,X.jsx)(`button`,{type:`button`,className:`history-icon`,"aria-label":n(`history.close`),onClick:e.close,children:(0,X.jsx)(s,{size:14,"aria-hidden":`true`})})]}),(0,X.jsx)(an,{model:e}),e.error?(0,X.jsx)(ln,{model:e}):e.session?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(on,{model:e}),(0,X.jsx)(sn,{model:e})]}):(0,X.jsx)(cn,{streaming:e.streaming})]})}function dn({model:e,onDismiss:t}){let r=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=document.activeElement,t=r.current,n=()=>[...t?.querySelectorAll(`button:not(:disabled), a[href], input:not(:disabled), [tabindex="0"]`)??[]];n()[0]?.focus();let i=e=>{if(e.key!==`Tab`)return;let t=n();e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),t.at(-1)?.focus()):!e.shiftKey&&document.activeElement===t.at(-1)&&(e.preventDefault(),t[0]?.focus())};return t?.addEventListener(`keydown`,i),()=>{t?.removeEventListener(`keydown`,i),e?.focus()}},[]);let i=(0,X.jsxs)(`div`,{className:`history-sheet-head`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:n(`history.chooseStart`)}),(0,X.jsx)(`small`,{children:n(`history.compareWithLatest`,{time:Q(tn(e))})})]}),(0,X.jsx)(`button`,{type:`button`,onClick:t,children:n(`common.done`)})]});return(0,X.jsx)(`div`,{ref:r,className:`history-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`history.chooseStart`),children:(0,X.jsx)(He,{snaps:[0,.85],snap:.85,onSnap:e=>{e===0&&t()},onScrim:t,header:i,children:(0,X.jsx)(`div`,{className:`history-sheet-body`,children:(0,X.jsx)(sn,{model:e})})})})}var fn=[S,f,...qt],pn={[te]:be,[ee]:d,[w]:E,[l]:N},mn={insert:`history.kindInsert`,delete:`history.kindDelete`,modify:`history.kindModify`};function hn({model:e,theme:t,title:r,narrow:i,bodyRef:a,onPick:o}){let{session:s,selected:c,blocks:l,count:u,changeIndex:d,loading:f,error:p,streaming:m,onlyChanges:h}=e,g=e=>(0,X.jsx)(Kt,{value:e,variant:`article`,theme:t,extraNodes:fn,rendererConfig:pn}),_=-1;return(0,X.jsxs)(`div`,{className:`history-view`,children:[i?(0,X.jsxs)(`div`,{className:`history-strip`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`history-pick`,onClick:o,children:[(0,X.jsx)(`span`,{children:n(`history.compareFrom`)}),(0,X.jsxs)(`strong`,{children:[n(`history.toLatest`,{from:c?Q(c.change.timestamp):n(`history.pickPoint`)}),(0,X.jsx)(ke,{size:12,"aria-hidden":`true`})]})]}),(0,X.jsx)(rn,{model:e}),(0,X.jsx)(nn,{model:e})]}):null,i?(0,X.jsx)(an,{model:e}):null,p?i?(0,X.jsxs)(`div`,{role:`alert`,className:`history-message`,children:[n(`history.readFailed`,{error:p}),(0,X.jsx)(`button`,{type:`button`,disabled:m,onClick:e.refresh,children:n(`common.retry`)})]}):(0,X.jsx)(`p`,{className:`history-message`,children:n(`history.unreadable`)}):f||!s?(0,X.jsx)(`div`,{role:`status`,className:`history-message`,children:n(m?`history.waitingEdits`:`history.computing`)}):(0,X.jsxs)(`div`,{ref:a,"aria-label":n(`history.diffBody`),className:`history-content`,children:[s.latest.value.root.children.some(e=>e.type===`heading`&&e.tag===`h1`)?null:(0,X.jsx)(`h1`,{children:r}),u?null:(0,X.jsx)(`p`,{role:`status`,className:`history-note`,children:n(`history.noDiff`)}),l.map((t,r)=>{if(t.kind===`equal`)return h?(0,X.jsx)(`button`,{type:`button`,className:`history-fold`,onClick:e.showAll,children:(0,X.jsx)(`span`,{children:n(`history.unchanged`,{count:t.value.root.children.length})})},r):(0,X.jsx)(`section`,{className:`history-hunk history-equal`,children:g(t.value)},r);_++;let i=t.before?null:t.kind===`insert`?`history-after`:t.kind===`delete`?`history-before`:`history-merged`;return(0,X.jsxs)(`section`,{"data-history-change":``,"data-current":_===d?``:void 0,className:`history-hunk history-${t.kind}`,children:[(0,X.jsxs)(`div`,{className:`history-caption`,children:[(0,X.jsx)(`span`,{className:`history-kind`,children:n(mn[t.kind])}),t.author?(0,X.jsxs)(`span`,{children:[Q(t.author.change.timestamp),t.group?` · ${n($t[t.group.source])}`:``]}):null]}),t.before?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`history-before`,children:g(t.before)}),(0,X.jsx)(`div`,{className:`history-after`,children:g(t.value)})]}):(0,X.jsx)(`div`,{className:i,children:g(t.value)})]},r)}),(0,X.jsx)(`p`,{className:`history-end`,children:n(`history.endOfDiff`)})]})]})}var gn=e=>JSON.stringify(e.frontiers()),_n=(e,t)=>t===void 0?void 0:e[t];function vn({doc:e,nodes:t,streaming:n,theme:r,title:i,open:a,onClose:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null),p=(0,U.useRef)(0),[m,h]=(0,U.useState)(!0),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)([]),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(0),[E,D]=(0,U.useState)(!1),O=Fe(`(max-width: 1100px)`),k=(0,U.useRef)(null),A=(0,U.useCallback)(async()=>{if(!e)return;let n=++p.current;h(!0),_(null);let r=e.fork();try{let i=await Qe(r),a=$e(r,r.frontiers(),t);if(p.current!==n){r.free();return}let o=f.current;f.current=r;let s=(d.current&&i.entries.find(e=>e.id===d.current.id))??i.groups[1]?.entries.at(-1)??i.entries[0]??null;d.current=s,u(s),c({doc:r,history:i,latest:a}),y(gn(e)!==gn(r)),o?.free()}catch(e){r.free(),p.current===n&&_(e.message)}finally{p.current===n&&h(!1)}},[e,t]);if((0,U.useEffect)(()=>{if(a)return()=>{p.current++,f.current?.free(),f.current=null,d.current=null,c(null),u(null),x([]),y(!1),_(null),h(!0),D(!1),C(!1)}},[a,e]),(0,U.useEffect)(()=>{a&&!n&&!f.current&&A()},[a,A,n]),(0,U.useEffect)(()=>{if(a&&e)return e.subscribe(()=>y(f.current!==null&&gn(e)!==gn(f.current)))},[e,a]),(0,U.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&(E?D(!1):o())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,o,E]),(0,U.useEffect)(()=>{if(!s||!l)return;let e=!1;h(!0);let n=setTimeout(()=>{try{let n=$e(s.doc,l.frontiers,t),{entries:r,groups:i}=s.history,a=tt(s.doc,r.slice(r.indexOf(l)+1),[n,s.latest]),o=new Map(i.flatMap(e=>e.entries.map(t=>[t,e]))),c=Et(n.value,s.latest.value).map(e=>{if(e.kind===`equal`)return e;let t=[_n(s.latest.ids,e.newIndex),_n(n.ids,e.oldIndex)].map(e=>e&&a.get(e)).find(Boolean);return t?{...e,author:t,group:o.get(t)}:e});e||(x(c),T(0),_(null))}catch(t){e||_(t.message)}finally{e||h(!1)}},0);return()=>{e=!0,clearTimeout(n)}},[s,l,t]),!a||!e)return null;let ee=b.filter(e=>e.kind!==`equal`).length,j={session:s,selected:l,blocks:b,count:ee,changeIndex:w,loading:m,error:g,pending:v,streaming:n,onlyChanges:S,select:e=>{d.current=e,u(e),D(!1)},navigate:e=>{let t=Math.max(0,Math.min(ee-1,w+e));T(t),k.current?.querySelectorAll(`[data-history-change]`)[t]?.scrollIntoView?.({block:`center`,behavior:`instant`})},toggleOnly:()=>C(e=>!e),showAll:()=>C(!1),refresh:()=>void A(),close:o};return{content:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hn,{model:j,theme:r,title:i,narrow:O,bodyRef:k,onPick:()=>D(!0)}),O&&E?(0,X.jsx)(dn,{model:j,onDismiss:()=>D(!1)}):null]}),panel:O?null:(0,X.jsx)(un,{model:j})}}function yn({left:e,top:t,quote:r,initial:i,restored:a,leaving:o,onChange:s,onSubmit:c,onCancel:l,ref:u}){return(0,X.jsx)(`div`,{ref:u,...{0:{className:`x10l6tqk x1u8a7rm xj6ak53 xowlrko xllfotl xatqbsq x1u6ievf`},1:{className:`x10l6tqk x1u8a7rm xj6ak53 x1u6ievf xxp0q0x x12l1aco xn0cd8s x47corl`}}[!!o|0],style:{left:e,top:t},children:(0,X.jsxs)(re,{active:!0,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z xz9dl7a x1hr3lfm xqfszdh x1j6dyjg`,children:[(0,X.jsxs)(`span`,{className:`x98rzlu xeuugli xb3r6kr xuxw1ft xlyipyv xddlp02`,children:[`“`,r,`”`]}),a?(0,X.jsx)(`span`,{className:`x2lah0s x7zghnd`,children:n(`document.draftRestored`)}):null]}),(0,X.jsx)(Ie,{autoFocus:!0,initial:i,placeholder:n(`document.draftPlaceholder`),onChange:s,onSubmit:c,onCancel:l})]})})}function bn({left:e,top:t,onComment:r,onCopy:i,ref:a}){return(0,X.jsxs)(`div`,{ref:a,className:`x10l6tqk x1u8a7rm x78zum5 x6s0dn4 x195vfkc xc9qbxq x9f619 x9ms5i6 xmkeg23 x1y0btm7 xgcsv5v x1q4ynmn x12ilycc x1d5q07e xi1bcxy x773k2o xa3vuyk`,style:{left:e,top:t},onMouseDown:e=>e.preventDefault(),children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:r,className:`x78zum5 x6s0dn4 x17d4w8g x1fgtraw xt970qd x1awh872 xc342km xu4hgxq xjbqb8w xj0l527 x2230gt xo2rkog xqfszdh xfifm61 xk50ysn x1ypdohk x1de99jn xaatb59 x1y3gkto x1uczgqu x1fkwv27`,children:[(0,X.jsx)(Ke,{size:14,className:`x2lah0s x17nrqe2`}),n(`common.comment`)]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`x2lah0s x1i1rx1s xlup9mm xj3msbq xcn5yip`})]}):null,(0,X.jsx)(`button`,{type:`button`,onClick:i,className:`x78zum5 x6s0dn4 x17d4w8g x1fgtraw xt970qd x1awh872 xc342km xu4hgxq xjbqb8w xj0l527 x2230gt xqfszdh xfifm61 xk50ysn x1ypdohk x1de99jn xaatb59 x1y3gkto x1uczgqu x1fkwv27 x1bo0w0s`,children:n(`document.copy`)})]})}var xn=(e,t)=>`${e}\n${t}`;function Sn(){let e=new Map;return{save(t,n){n.trim()?e.set(t,n):e.delete(t)},take(t){return e.get(t)??``}}}function Cn(e){let t=(0,U.useMemo)(Sn,[]),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(``),s=(0,U.useRef)(0),c=(0,U.useRef)(null),l=(0,U.useRef)(null);F(i?null:n?.target.range??null);let u=(0,U.useCallback)(n=>{window.clearTimeout(s.current);let i=t.take(xn(n.blockId,n.quote));o.current=i,a(!1),r({target:n,initial:i}),window.getSelection()?.removeAllRanges(),e()},[t,e]),d=(0,U.useCallback)(e=>{n&&(t.save(xn(n.target.blockId,n.target.quote),e?o.current:``),a(!0),s.current=window.setTimeout(()=>{r(null),a(!1)},120))},[n,t]);return(0,U.useEffect)(()=>{if(!n||i)return;let e=e=>{let t=e.target;c.current?.contains(t)||l.current?.contains(t)||d(!0)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[n,i,d]),(0,U.useEffect)(()=>()=>window.clearTimeout(s.current),[]),{draft:n,leaving:i,restored:!!n?.initial,open:u,close:d,onText:e=>{o.current=e},panelRef:c,toolbarRef:l}}function wn(e){return{left:e.offsetLeft,right:Math.min(e.offsetLeft+e.offsetWidth,window.innerWidth-16)}}function Tn({editor:e,threads:t,actions:n,agent:r,canComment:i,selection:a,clearSelection:o,onCreate:s,onMain:c,history:l,children:u}){let d=Cn(o),{draft:f}=d;return(0,X.jsx)(R,{editor:e,threads:t,actions:n,agent:r,onMain:c,history:l,overlay:e=>(0,X.jsxs)(X.Fragment,{children:[a&&!f?(0,X.jsx)(bn,{ref:d.toolbarRef,...ae(a,wn(e),128,36,8),onComment:i?()=>d.open(a):void 0,onCopy:()=>{navigator.clipboard?.writeText(a.quote),window.getSelection()?.removeAllRanges(),o()}}):null,f?(0,X.jsx)(yn,{ref:d.panelRef,...I(f.target,wn(e),340,8),quote:f.target.quote,initial:f.initial,restored:d.restored,leaving:d.leaving,onChange:d.onText,onSubmit:e=>s(f.target,e).then(e=>(e&&d.close(!1),e)),onCancel:()=>d.close(!0)},`${f.target.blockId}:${f.target.quote}`):null]}),children:u})}function En({id:e,title:t,activity:r,agentSection:i,offline:a,openComments:o,cloud:s,compact:c=!1,onDone:l,actions:u,agent:d=`Agent`,history:f}){let p=Ze(r,d,i);return ue(e,s?{...t?{title:t}:{},online:s.online,comments:o,activity:p,activityTone:r.kind===`stale`?`warning`:r.kind===`working`?`quiet`:`live`,retrying:a,reason:s.reason,history:f?.available,historyOpen:f?.open}:null)&&!c?null:(0,X.jsxs)(`header`,{...{0:{className:`x7wzq59 x13vifvy x1n327nk xdd8jsf x78zum5 x6s0dn4 x1v2ro7d x4l9tsp x1rozbrz xqfszdh`},1:{className:`x7wzq59 x13vifvy x1n327nk xdd8jsf x78zum5 x6s0dn4 x1rozbrz xqfszdh x1hr3lfm x883omv`}}[!!c|0],children:[c?null:(0,X.jsxs)(`span`,{className:`xddlp02 xfifm61 xuxw1ft`,children:[`document / `,(0,X.jsx)(`span`,{className:`xo2rkog x1s688f`,children:e})]}),p?(0,X.jsxs)(`span`,{...{0:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla xlssvyo x19ay2w6 x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv`},2:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xahzvm9 x1bo0w0s`},1:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`},3:{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`}}[(r.kind===`working`)<<1|r.kind===`stale`],children:[r.kind===`stale`?null:(0,X.jsx)(`i`,{className:`x1v4s8kt xols6we x16rqkct xtwfq29`}),p]}):null,a?(0,X.jsx)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xqdcvd7 x7zghnd`,children:n(`document.notSynced`)}):null,f?.open?(0,X.jsxs)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g xj8oexa x1awh872 x1e6avla x1j6dyjg xuxw1ft xeuugli xb3r6kr xlyipyv xahzvm9 x1bo0w0s`,children:[(0,X.jsx)(De,{size:11,"aria-hidden":`true`}),n(`document.readOnlyHistory`)]}):null,s?.reason&&!c?(0,X.jsx)(`span`,{className:`xb3r6kr xddlp02 xfifm61 xuxw1ft xlyipyv`,children:s.reason}):null,(0,X.jsx)(`span`,{className:`x98rzlu`}),s?(0,X.jsxs)(`span`,{className:`x78zum5 x6s0dn4 x17d4w8g x1bo0w0s xfifm61 xuxw1ft`,children:[(0,X.jsx)(`i`,{...{0:{className:`xci0xqf x1hagigm x16rqkct xxwmxtg`},1:{className:`xci0xqf x1hagigm x16rqkct xux1nz0`}}[!!s.online|0]}),s.online?n(`share.computerOnline`):n(`share.computerOffline`)]}):null,f?(0,X.jsx)(he,{comments:o,open:f.open,available:f.available,onComments:f.close,onHistory:f.toggle}):null,l?(0,X.jsx)(`button`,{type:`button`,onClick:l,className:`x12ulsxz xaope02 xc342km x1kogg8i x19ckca5 xs0jrwl xqfszdh x4z9k3i x1s688f x1ypdohk`,children:n(`common.done`)}):s||c?null:u]})}function Dn(e,t,n){let[r,i]=t<=n?[t,n]:[n,t];return{blockIds:e.slice(r,i+1).flatMap(e=>e.id?[e.id]:[]).slice(0,We.blockIds),heading:e.slice(0,r+1).filter(e=>e.heading).pop()?.text??``}}var On=crypto.randomUUID(),kn=300,An={quote:``,blockIds:[],heading:``};function jn(e){let t=window.getSelection(),n=e.getRootElement();if(!t||t.isCollapsed||!n?.contains(t.anchorNode)||!n.contains(t.focusNode))return An;let r=t.toString().trim().slice(0,We.quote);return r?e.read(()=>{let e=v().getChildren(),n=t=>{let n=t&&m(t)?.getTopLevelElement();return n?e.findIndex(e=>e.is(n)):-1},i=n(t.anchorNode),a=n(t.focusNode);if(i<0||a<0)return{...An,quote:r};let o=e.map(e=>({id:_(e,b)||``,heading:e.getType()===`heading`,text:e.getTextContent().slice(0,We.heading)}));return{quote:r,...Dn(o,i,a)}}):An}function Mn(e,t,n,r){let i=(0,U.useRef)(An);(0,U.useEffect)(()=>{if(!e)return;let n=0,a=()=>{let n=jn(e);JSON.stringify(n)!==JSON.stringify(i.current)&&(i.current=n,r({type:`selection`,artifact:t,tab:On,human:!0,...n}))},o=()=>{clearTimeout(n),n=window.setTimeout(a,kn)};return document.addEventListener(`selectionchange`,o),()=>{clearTimeout(n),document.removeEventListener(`selectionchange`,o)}},[e,t,r]),(0,U.useEffect)(()=>{n&&i.current.quote&&r({type:`selection`,artifact:t,tab:On,human:!1,...i.current})},[n,t,r])}var Nn={count:0,firstKey:null},Pn=e=>e.read(()=>{let e=v().getChildren().filter(e=>e.getType()===`pending`).map(e=>e.getKey());return{count:e.length,firstKey:e[0]??null}});function Fn(e){let[t,n]=(0,U.useState)(Nn);return(0,U.useEffect)(()=>{if(!e){n(Nn);return}let t=e=>n(t=>t.count===e.count&&t.firstKey===e.firstKey?t:e);return t(Pn(e.getEditorState())),e.registerUpdateListener(({editorState:e})=>t(Pn(e)))},[e]),t}function In(e,t=15e3){let[n,r]=(0,U.useState)(()=>Date.now());return(0,U.useEffect)(()=>{if(!e)return;r(Date.now());let n=setInterval(()=>r(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function Ln({left:e,top:t,placement:r,canComment:i,canEdit:a,onComment:o,onEdit:s}){let c=(0,U.useRef)(null),l=[i?{label:n(`common.comment`),Icon:Ke,run:o,primary:!0}:null,a?{label:n(`document.editText`),Icon:ne,run:s,primary:!1}:null].filter(e=>e!==null);return(0,U.useLayoutEffect)(()=>{Ne(c.current,[{opacity:0,transform:`scale(0.96)`},{opacity:1,transform:`none`}],{duration:160,easing:Me})},[]),l.length===0?null:(0,X.jsxs)(`div`,{ref:c,"data-edit-menu":!0,"data-placement":r,...{0:{className:`x10l6tqk x1u8a7rm x78zum5 xdt5ytf x1cy8zhl`},1:{className:`x10l6tqk x1u8a7rm x78zum5 x1cy8zhl x3ieub6`}}[r===`above`|0],style:{left:e,top:t,transformOrigin:r===`above`?`22px 100%`:`22px 0`},onMouseDown:e=>e.preventDefault(),children:[(0,X.jsx)(`span`,{className:`xsmyaan x1kpxq89 xyqm7xq x1qp53xl x1cum3z5 xf6xdpg x1158fpu`}),(0,X.jsx)(`div`,{className:`x78zum5 xn3w4p2 xfn1xvj x4pepcl xf6xdpg x1dam6yx`,children:l.map(({label:e,Icon:t,run:n,primary:r})=>(0,X.jsxs)(`button`,{type:`button`,onClick:n,...{0:{className:`x78zum5 x6s0dn4 x17d4w8g xn3w4p2 xt970qd xaope02 xc342km x1q4ynmn xjbqb8w x116urgp xqirfc3 xqfszdh xif65rj x1ypdohk`},1:{className:`x78zum5 x6s0dn4 x17d4w8g xn3w4p2 xt970qd xaope02 xc342km x1q4ynmn xjbqb8w x116urgp xqfszdh xif65rj x1ypdohk xfungia x1s688f`}}[!!r|0],children:[(0,X.jsx)(t,{size:16,"aria-hidden":!0}),e]},e))})]})}var Rn={state:{kmuXW:`x2lah0s`,kGuDYH:`xfifm61`,$$css:!0},waitingAgent:{kMwMTN:`x7zghnd`,$$css:!0},answered:{kMwMTN:`xh0clw4`,$$css:!0},resolved:{kMwMTN:`xddlp02`,$$css:!0}},zn=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function Bn({thread:e,agent:t=`Agent`,actions:r,active:i=!1,offline:a=!1}){let s=je(e),c=e.status===`resolved`,l=c?{label:n(`common.resolved`),tone:Rn.resolved}:s===`agent`?{label:n(`document.waitingAgentReply`,{agent:t}),tone:Rn.waitingAgent}:s===`human`?{label:n(`document.agentReplied`,{agent:t}),tone:Rn.answered}:null;return(0,X.jsxs)(`div`,{"data-thread":e.id,...{0:{className:`xxlmvz2 x178xt8z x13fuv20 xxu5053 xqfszdh xo2rkog`},1:{className:`xxlmvz2 x178xt8z x13fuv20 xxu5053 xqfszdh xo2rkog xggygye`}}[!!i|0],children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z x1lqa7cf x1vo0akb x19ypqd9 x13ym6ox x4z9k3i`,children:[(0,X.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xuxw1ft xlyipyv x1bo0w0s`,children:e.anchor.quote||n(`document.wholeBlock`)}),l?(0,X.jsx)(`span`,{...o(Rn.state,l.tone),children:l.label}):null]}),c&&!i?null:e.messages.map(e=>{let{label:t,initial:r}=ze(e);return(0,X.jsxs)(`div`,{className:`x14vqqas`,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x167g77z x4z9k3i x1s688f`,children:[(0,X.jsx)(Re,{human:e.author===`human`,initial:r,name:e.name,src:e.avatar}),t,(0,X.jsx)(`span`,{className:`xddlp02 xo1l8bm xfifm61`,children:zn(e.editedAt??e.at)})]}),(0,X.jsx)(`div`,{...{0:{className:`x1gslohp xxpkpgd x1jvydc1 x1dbl2gt x126k92a xj0a0fe`},1:{className:`x1gslohp xxpkpgd x1jvydc1 x1dbl2gt x126k92a xj0a0fe xc7n51q`}}[!!e.deleted|0],children:e.deleted?n(`common.deleted`):e.text})]},e.id)}),r?(0,X.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xou54vl x1anpbxc xxpkpgd`,children:[c?null:(0,X.jsx)(`div`,{className:`x98rzlu xeuugli x1qyh8g1 xso031l x1q0q8m5 x1iz93xd`,children:(0,X.jsx)(Ie,{placeholder:n(`common.reply`),onSubmit:t=>r.reply(e.id,t)})}),a?null:(0,X.jsx)(`button`,{type:`button`,onClick:()=>c?r.reopen(e.id):r.resolve(e.id),className:`x2lah0s x1gg8mnh xt970qd xdqyycr x1w5wx5t xc342km xjbqb8w x1bo0w0s xqfszdh x4z9k3i x1ypdohk`,children:n(c?`common.reopen`:`common.resolve`)})]}):null]})}var $=.5,Vn=e=>e===78?$:e;function Hn({threads:e,agent:t=`Agent`,actions:r,offline:i,draft:a,onCreate:o,onCancelDraft:s,activeId:c,snap:l,onSnap:u}){let d=(0,U.useRef)(null),f=e.filter(e=>!e.messages.every(e=>e.deleted)),p=f.filter(e=>je(e)===`agent`).length,m=i?n(`document.offlineNoComments`):p>0?n(`document.waitingCount`,{count:p,agent:t}):null;return(0,U.useEffect)(()=>{let e=c?d.current?.querySelector(`[data-thread="${CSS.escape(c)}"]`):null,t=e?.closest(`[data-sheet-body]`);e&&t&&(t.scrollTo({top:t.scrollTop+e.getBoundingClientRect().top-t.getBoundingClientRect().top-8,behavior:`smooth`}),Ne(e,[{backgroundColor:`rgba(232, 194, 74, 0.24)`},{backgroundColor:`transparent`}],{duration:600,delay:250,easing:Me}))},[c]),(0,X.jsx)(He,{snaps:[78,$,1],snap:l,onSnap:u,onScrim:()=>u($),header:(0,X.jsxs)(`span`,{className:`x78zum5 x1pha0wt x17d4w8g xu0aao5 x17qtykl xwib8y2 xqfszdh x1jvydc1 x1s688f`,children:[n(`document.sheetComments`,{count:f.length}),m?(0,X.jsxs)(`span`,{className:`xddlp02 xfifm61 xo1l8bm`,children:[`· `,m]}):null]}),children:(0,X.jsxs)(`div`,{ref:d,className:`x17qtykl xwxc41k`,children:[a&&r?(0,X.jsxs)(`div`,{className:`x10dr8xq xqfszdh`,children:[(0,X.jsxs)(`div`,{className:`x78zum5 x1pha0wt x167g77z x4z9k3i`,children:[(0,X.jsx)(`span`,{className:`x98rzlu xeuugli x1lqa7cf x1vo0akb x19ypqd9 x13ym6ox xb3r6kr xuxw1ft xlyipyv x1bo0w0s`,children:a.quote}),(0,X.jsx)(`button`,{type:`button`,onClick:s,className:`x1717udv xc342km xjbqb8w xddlp02 x4z9k3i x1ypdohk`,children:n(`common.cancel`)})]}),(0,X.jsx)(`div`,{className:`x1xmf6yo x1qyh8g1 xso031l x1q0q8m5 x1iz93xd`,children:(0,X.jsx)(Ie,{autoFocus:!0,placeholder:n(`document.agentPlaceholder`),onSubmit:e=>o(a,e).then(e=>(e&&s(),e))})})]}):null,f.length===0&&!a?(0,X.jsx)(`div`,{className:`xr9q8rw xddlp02 xqfszdh x4z9k3i x2b8uid`,children:n(`document.noComments`)}):null,f.map(e=>(0,X.jsx)(Bn,{thread:e,agent:t,actions:r,active:e.id===c,offline:i},e.id))]})})}var Un=52;function Wn({editor:e,threads:t,actions:n,agent:r,canComment:i,canEdit:a,offline:o,selection:s,clearSelection:c,onCreate:l,onEdit:u,onMain:d,history:f,children:p}){let[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(78),[b,x]=(0,U.useState)(null),S=ge(e,t,m);B(S,t,g),F(b?.range??null);let C=()=>{window.getSelection()?.removeAllRanges(),c()};return(0,X.jsxs)(`main`,{ref:e=>{h(e),d?.(e)},className:`x1n2onr6 x1cnzs8 x17qtykl x1ffnkcp`,children:[(0,X.jsxs)(`article`,{onClick:e=>{let t=fe(S,e.clientX,e.clientY);_(t),t&&y(Vn)},children:[f?.content,(0,X.jsx)(`div`,{hidden:!!f,children:p})]}),s&&!b&&!f?(0,X.jsx)(Ln,{...ve(s,{left:8,right:(m?.clientWidth??0)-8},170,44,{top:m?.getBoundingClientRect().top??0,height:window.innerHeight,reserved:Ue(v,window.innerHeight-Un)}),canComment:i,canEdit:a,onComment:()=>{x(s),y($),C()},onEdit:()=>{u(s),c()}}):null,(0,X.jsx)(`div`,{hidden:!!f,className:`xixxii4 x1ozmhy9 xu96u03 x3m8u43 x1ey2m1c x1355qak x47corl`,children:(0,X.jsx)(Hn,{threads:t,agent:r,actions:n,offline:o,draft:b,onCreate:l,onCancelDraft:()=>x(null),activeId:g,snap:v,onSnap:y})})]})}var Gn=200;function Kn(e,t){let[n,r]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(!e||!t)return;let n=0,i=()=>{let n=window.getSelection(),i=e.getRootElement();if(!n||n.isCollapsed||n.rangeCount===0||!i?.contains(n.anchorNode)){r(null);return}let a=n.toString().trim(),o=e.read(()=>{let e=n.anchorNode&&m(n.anchorNode)?.getTopLevelElement(),t=n.focusNode&&m(n.focusNode)?.getTopLevelElement();return!e||!t||!e.is(t)?null:_(e,b)||null});if(!o||!a){r(null);return}let s=n.getRangeAt(0),c=[...s.getClientRects()],l=c[0]??s.getBoundingClientRect(),u=c.at(-1)??l,d=t.getBoundingClientRect();r({blockId:o,quote:a.slice(0,500),left:l.left-d.left,bottom:u.bottom-d.top,top:l.top-d.top,right:u.right-d.left,range:s.cloneRange()})},a=()=>{clearTimeout(n),n=window.setTimeout(i,Gn)};return document.addEventListener(`selectionchange`,a),()=>{clearTimeout(n),document.removeEventListener(`selectionchange`,a)}},[e,t]),[n,()=>r(null)]}var qn=[...g.filter(e=>!le.some(t=>t.getType()===(`getType`in e?e.getType():e.replace.getType()))),...le];function Jn(){let e=(0,U.useMemo)(()=>window.matchMedia(`(prefers-color-scheme: dark)`),[]),[t,n]=(0,U.useState)(e.matches);return(0,U.useEffect)(()=>{let t=()=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[e]),t}function Yn(e){(0,U.useEffect)(()=>{if(!e)return;let t=document.createElement(`base`);return t.href=e,document.head.prepend(t),()=>t.remove()},[e])}function Xn({id:e,transport:t,live:r,cloud:i,fallback:a,actions:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(Pe),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(void 0),[y,b]=(0,U.useState)(0),x=(0,U.useCallback)(e=>{e!==void 0&&b(e-Date.now())},[]),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),O=!i||i.online&&!w,k=E&&O;(0,U.useEffect)(()=>{O||D(!1)},[O]),(0,U.useEffect)(()=>{if(!i)return;let t=t=>{t.source===window.parent&&t.origin===location.origin&&t.data?.type===`ryugi:document-history`&&t.data.id===e&&(t.data.action===`close`?D(!1):t.data.action===`toggle`&&O&&D(e=>!e))};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e,i,O]);let[A,ee]=(0,U.useState)(null),[j,te]=(0,U.useState)(null),ne=Jn(),{artifact:M,channel:N}=t,re=!i||i.online,P=!i||i.canEdit,F=Fe(Le),[I,L]=(0,U.useState)(!1),ae=F?I&&P:P,R=(0,U.useCallback)(async()=>{let e=await t.meta();e&&c(e)},[t]),z=a!=null;(0,U.useEffect)(()=>{let e=!1;return(async()=>{try{await R();let n=await t.state();if(e)return;let r=new ie;r.setRecordTimestamp(!0),r.setChangeMergeInterval(20),r.import(ye(n.snapshot)),g(!!n.streaming),v(n.agentActiveAt),x(n.now),f(n.comments??Pe());let i=z?{left:window.scrollX,top:window.scrollY,behavior:`instant`}:null;u(r),i&&requestAnimationFrame(()=>{e||window.scrollTo(i)})}catch(t){e||m(t.message)}})(),()=>{e=!0}},[t,R,x,z]),(0,U.useEffect)(()=>N.subscribe(e=>{e.type===`change`?R():e.type===`doc-status`?(g(e.streaming),v(e.agentActiveAt),x(e.now)):e.type===`doc-comments`&&f(e.comments)}),[N,R,x]),(0,U.useEffect)(()=>{A?.setEditable(ae&&!k)},[A,ae,k]),(0,U.useEffect)(()=>{P||L(!1)},[P]);let se=(0,U.useCallback)(e=>{g(!!e.streaming),v(e.agentActiveAt),x(e.now),e.comments&&f(e.comments)},[x]);Yn(s?.contentBase),Mn(A,M,r&&!k,t.send);let ce=(0,U.useMemo)(()=>({artifact:M,contentBase:s?.contentBase??``,channel:N,send:t.send}),[M,s?.contentBase,N,t]);(0,U.useEffect)(()=>{document.title=s?.title||e},[s?.title,e]),Oe(`document`);let B=Fn(A),le=In(B.count>0&&!h),ue=Ye({streaming:h,pending:B.count,agentActiveAt:_,now:le+y}),de=s?.agent??`Agent`,fe=(0,U.useMemo)(()=>({nextKey:B.firstKey,agent:de,activity:ue.kind}),[B.firstKey,de,ue.kind]),me=d.threads.filter(e=>e.status===`open`).length,[he,V]=Kn(A,j),ge=(0,U.useCallback)(()=>D(!1),[]),_e=vn({doc:l,nodes:qn,streaming:h,theme:ne?`dark`:`light`,title:s?.title||e,open:k,onClose:ge}),H=(0,U.useCallback)(async e=>{try{return f(await t.comment(e)),!0}catch{return!1}},[t]),ve=(0,U.useMemo)(()=>({reply:(e,t)=>H({op:`reply`,threadId:e,text:t}),edit:(e,t,n)=>void H({op:`edit`,threadId:e,messageId:t,text:n}),remove:(e,t)=>void H({op:`delete`,threadId:e,messageId:t}),resolve:e=>void H({op:`resolve`,threadId:e}),reopen:e=>void H({op:`reopen`,threadId:e})}),[H]),be=(0,U.useCallback)((e,t)=>H({op:`create`,blockId:e.blockId,quote:e.quote,text:t}),[H]),Se=(0,U.useCallback)(e=>{if(!A)return;A.setEditable(!0),L(!0),A.getRootElement()?.focus({preventScroll:!0});let t=window.getSelection();t?.removeAllRanges(),t?.addRange(e.range)},[A]);if(p)return(0,X.jsx)(`div`,{className:`x1o8uwn5 x2b8uid x1bo0w0s xqfszdh xif65rj`,children:p});if(!l)return a??(0,X.jsx)(`div`,{className:`x1o8uwn5 x2b8uid x1bo0w0s xqfszdh xif65rj`,children:n(`common.loading`)});let Ce=(0,X.jsx)(xe.Provider,{value:ce,children:(0,X.jsx)(oe.Provider,{value:fe,children:(0,X.jsx)(pe,{transport:t,agent:s?.agent,doc:l,theme:ne?`dark`:`light`,onAgentSection:C,onOffline:T,onState:se,onEditorReady:ee})})});return(0,X.jsxs)(`div`,{className:`x1us19tq x1rozbrz xo2rkog`,className:`ryugi-doc ${{className:`x1us19tq x1rozbrz xo2rkog`}.className??``}`,children:[(0,X.jsx)(En,{id:e,title:s?.title||e,agent:s?.agent,activity:ue,agentSection:S,offline:w,openComments:me,cloud:i,compact:F,onDone:F&&I?()=>L(!1):void 0,actions:o,history:{available:O,open:k,toggle:()=>D(e=>!e),close:ge}}),F?(0,X.jsx)(Wn,{editor:A,threads:d.threads,actions:ve,agent:s?.agent,canComment:re,canEdit:P,offline:!(!i||i.online),selection:I?null:he,clearSelection:V,onCreate:be,onEdit:Se,onMain:te,history:_e,children:Ce}):(0,X.jsx)(Tn,{editor:A,threads:d.threads,actions:ve,agent:s?.agent,canComment:re,selection:he,clearSelection:V,onCreate:be,onMain:te,history:_e,children:Ce}),(0,X.jsx)(Ve,{warnings:s?.warnings??[]})]})}var Zn=[`pending`],Qn=`x-ryugi-document-features`;function $n({id:e,channel:t,send:n}){let r=(t,n,r)=>fetch(`/api/document/${e}/${t}`,{method:`POST`,headers:{"Content-Type":r,[Qn]:Zn.join(`,`)},body:n});return{artifact:`document/${e}`,channel:t,send:n,async meta(){let t=await fetch(`/api/artifacts/document/${e}`,{cache:`no-store`});return t.ok?await t.json():null},async state(){let t=await fetch(`/api/document/${e}/state`,{cache:`no-store`}),n=await t.json();if(!t.ok||!n.snapshot)throw Error(n.error??`load failed (${t.status})`);return n},async update(e){let t=await r(`update`,e,`application/octet-stream`);if(!t.ok)throw Error(`update failed (${t.status})`)},async comment(e){let t=await r(`comments`,JSON.stringify(e),`application/json`);if(!t.ok)throw Error(`comment failed (${t.status})`);return(await t.json()).comments}}}function er(e){let t=(0,U.useMemo)(_e,[]),n=`document/${e}`,{live:r,send:i}=Be(e=>{e.artifact===n&&t.emit(e)},()=>t.emit({type:`open`}));return{transport:(0,U.useMemo)(()=>$n({id:e,channel:t,send:i}),[e,t,i]),live:r}}function tr({id:e}){let{transport:t,live:n}=er(e);return(0,X.jsx)(Xn,{id:e,transport:t,live:n,actions:(0,X.jsx)(Ee,{artifact:`document/${e}`})})}export{tr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{n as r,t as i}from"./useTypeFavicon-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{n as r,t as i}from"./useTypeFavicon-B01CcUw4.js";import{t as a}from"./WarningsBadge-xIuKcdGp.js";import{n as o,t as s}from"./useSandboxFrame-Bz-L2PEg.js";import{t as c}from"./useArtifactFeed-yUSrUl7T.js";var l=e(t(),1);function u(e,{live:t,revision:n,load:r,send:i}){let[a,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t=!1;return r().then(({found:n,data:r})=>{if(t)return;let i=r;o({title:i.title??e,warnings:i.warnings??[],version:i.version??0,contentBase:i.contentBase??``,found:n})},()=>{}),()=>{t=!0}},[e,r,n]),{data:a,live:t,send:i}}var d=n();function f({id:e,feed:t,actions:n}){let{data:r,send:c}=u(e,t);(0,l.useEffect)(()=>{document.title=r?.title||e},[r?.title,e]),i(`html`);let f=r?.found&&!r.warnings.includes(`index.html not found`),p=f?`${r.contentBase}index.html?v=${r.version}`:null,{frameRef:m,src:h,onLoad:g}=o(p,{onError:t=>c({type:`runtime-error`,artifact:`html/${e}`,message:t}),onLoaded:t=>{let n=Number(new URL(t,location.href).searchParams.get(`v`));c({type:`loaded`,artifact:`html/${e}`,version:n})}});return(0,d.jsxs)(`div`,{className:`xixxii4 x10a8y8t x1rozbrz`,children:[f&&h?(0,d.jsx)(`iframe`,{ref:m,title:r.title,src:h,sandbox:s,allow:`clipboard-write`,onLoad:g,className:`x1lliihq xh8yej3 x5yr21d xc342km`}):(0,d.jsx)(`div`,{className:`x10l6tqk x10a8y8t x78zum5 x6s0dn4 xl56j7k xggk2y7 x1bo0w0s xqfszdh xif65rj x2b8uid`,children:r?r.warnings[0]??`Waiting for the agent to write index.html…`:`Connecting…`}),n,(0,d.jsx)(a,{warnings:r?.warnings??[]})]})}function p({id:e}){return(0,d.jsx)(f,{id:e,feed:c(`html`,e),actions:(0,d.jsx)(r,{artifact:`html/${e}`,floating:!0})})}export{p as HtmlLayout};
|