allyhub 0.22.0 → 0.23.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.
Files changed (218) hide show
  1. package/dist/command.js +1 -1
  2. package/dist/commands/dev.js +5 -5
  3. package/dist/commands/index.js +1 -1
  4. package/dist/commands/list.js +1 -1
  5. package/dist/commands/schedule.js +4 -0
  6. package/dist/commands.json +1 -1
  7. package/dist/main.js +8 -8
  8. package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
  9. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  10. package/dist/node_modules/@allyhub/blocks/package.json +1 -1
  11. package/dist/node_modules/@allyhub/browser/package.json +1 -1
  12. package/dist/node_modules/@allyhub/build/package.json +1 -1
  13. package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
  14. package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
  15. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  16. package/dist/node_modules/@allyhub/check/package.json +1 -1
  17. package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
  18. package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
  19. package/dist/node_modules/@allyhub/cloud/dist/scheduled-tasks.js +2 -0
  20. package/dist/node_modules/@allyhub/cloud/package.json +1 -1
  21. package/dist/node_modules/@allyhub/components/package.json +1 -1
  22. package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
  23. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  24. package/dist/node_modules/@allyhub/doc/package.json +1 -1
  25. package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
  26. package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
  27. package/dist/node_modules/@allyhub/export/package.json +1 -1
  28. package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
  29. package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
  30. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  31. package/dist/node_modules/@allyhub/html-extension/package.json +1 -1
  32. package/dist/node_modules/@allyhub/i18n/package.json +1 -1
  33. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  34. package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
  35. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  36. package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
  37. package/dist/node_modules/@allyhub/image-render/package.json +1 -1
  38. package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
  39. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  40. package/dist/node_modules/@allyhub/jobs/package.json +1 -1
  41. package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
  42. package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
  43. package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
  44. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  45. package/dist/node_modules/@allyhub/media/package.json +1 -1
  46. package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
  47. package/dist/node_modules/@allyhub/model/package.json +1 -1
  48. package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
  49. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  50. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  51. package/dist/node_modules/@allyhub/project/package.json +1 -1
  52. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  53. package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
  54. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  55. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  56. package/dist/node_modules/@allyhub/protocol/dist/paywall.js +1 -1
  57. package/dist/node_modules/@allyhub/protocol/dist/scheduled-tasks.js +2 -0
  58. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  59. package/dist/node_modules/@allyhub/protocol/package.json +5 -1
  60. package/dist/node_modules/@allyhub/registry/package.json +1 -1
  61. package/dist/node_modules/@allyhub/render/package.json +1 -1
  62. package/dist/node_modules/@allyhub/report-extension/package.json +1 -1
  63. package/dist/node_modules/@allyhub/runtime/package.json +1 -1
  64. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  65. package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
  66. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  67. package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
  68. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  69. package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
  70. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  71. package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
  72. package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
  73. package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
  74. package/dist/node_modules/@allyhub/stage/package.json +1 -1
  75. package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
  76. package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
  77. package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
  78. package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
  79. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  80. package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
  81. package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
  82. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  83. package/dist/node_modules/@allyhub/website/package.json +1 -1
  84. package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
  85. package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
  86. package/dist/node_modules/@allyhub/x-model/package.json +1 -1
  87. package/dist/node_modules/@allyhub/x-view/package.json +1 -1
  88. package/dist/package.json +15 -15
  89. package/dist/works.js +1 -1
  90. package/editor-web/assets/{abnfDiagram-WEYOIA3C-D6qI3rai.js → abnfDiagram-WEYOIA3C-OIbGwO0P.js} +1 -1
  91. package/editor-web/assets/{architecture-WOLXFQ4H-B3V6ggq8.js → architecture-WOLXFQ4H-i87EDk8h.js} +1 -1
  92. package/editor-web/assets/{architectureDiagram-ZHVYKT53-IauNyxXn.js → architectureDiagram-ZHVYKT53-DRsgKDbu.js} +1 -1
  93. package/editor-web/assets/article-BVbLqhwK.js +3 -0
  94. package/editor-web/assets/article-BxkgemqI.js +7 -0
  95. package/editor-web/assets/bar-button-BJ-_6g-F.js +1 -0
  96. package/editor-web/assets/{blockDiagram-RJAE7QA3-yXhlfxbH.js → blockDiagram-RJAE7QA3-k_lanKyI.js} +1 -1
  97. package/editor-web/assets/{c4Diagram-XDPPPE54-B-anrhvt.js → c4Diagram-XDPPPE54-BFJTpM5w.js} +1 -1
  98. package/editor-web/assets/channel-CDJSUIp1.js +1 -0
  99. package/editor-web/assets/chevron-right-7tjLd0X4.js +1 -0
  100. package/editor-web/assets/chip-lvclIKGj.js +1 -0
  101. package/editor-web/assets/{chunk-2E7WHVMD-QPOni4XB.js → chunk-2E7WHVMD-Bbfj2q42.js} +1 -1
  102. package/editor-web/assets/{chunk-4EMNKR2T-DG1FCRRI.js → chunk-4EMNKR2T-iKWsgYqL.js} +1 -1
  103. package/editor-web/assets/{chunk-55XCU76K-mKuMXpnC.js → chunk-55XCU76K-WwcsywWu.js} +1 -1
  104. package/editor-web/assets/{chunk-7S6XSTFO-CgZAazgt.js → chunk-7S6XSTFO-BEEtZTsQ.js} +1 -1
  105. package/editor-web/assets/{chunk-AQDTSKZB-BRU84phF.js → chunk-AQDTSKZB-ZT2PBdLK.js} +1 -1
  106. package/editor-web/assets/{chunk-DSNLSHJZ-zku9oeG3.js → chunk-DSNLSHJZ-BDlY4xos.js} +1 -1
  107. package/editor-web/assets/{chunk-HAGFOTED-CaUkBv_0.js → chunk-HAGFOTED-Yp6V4sx6.js} +1 -1
  108. package/editor-web/assets/{chunk-HNE4Q36P-BQz4ZCJf.js → chunk-HNE4Q36P-C6IdGLw2.js} +1 -1
  109. package/editor-web/assets/{chunk-NQOKRVIF-CHVBEDkg.js → chunk-NQOKRVIF-D3gs_SMr.js} +1 -1
  110. package/editor-web/assets/{chunk-UHW7PFBP-DrYeJo1e.js → chunk-UHW7PFBP-Byf0dX4X.js} +1 -1
  111. package/editor-web/assets/{chunk-VQ5W62QI-D8ToVCUe.js → chunk-VQ5W62QI-n9lsvBOX.js} +1 -1
  112. package/editor-web/assets/{chunk-WQQL4CDK-DZ0tyi9F.js → chunk-WQQL4CDK-BW540sO1.js} +1 -1
  113. package/editor-web/assets/{chunk-YZO67HFG-BLe7PXER.js → chunk-YZO67HFG-CWL9cioT.js} +1 -1
  114. package/editor-web/assets/{chunk-ZAUX2LTX-ByaeSIre.js → chunk-ZAUX2LTX-D9zlkFeQ.js} +1 -1
  115. package/editor-web/assets/{chunk-ZCHMQSOR-DdMJr_t5.js → chunk-ZCHMQSOR-nieSgKB5.js} +1 -1
  116. package/editor-web/assets/{classDiagram-v2-4MYWR3UA-DDpq7fFC.js → classDiagram-v2-4MYWR3UA-BXamBIDc.js} +1 -1
  117. package/editor-web/assets/{color-picker-CDeICDN5.js → color-picker-XpkmmKxv.js} +1 -1
  118. package/editor-web/assets/context-menu-pSruvRyd.js +1 -0
  119. package/editor-web/assets/{cynefin-EF2NZ3EQ-CMivy2fr.js → cynefin-EF2NZ3EQ-CVKVgqFb.js} +1 -1
  120. package/editor-web/assets/{cynefinDiagram-WF24UDRP-GtxT_9wW.js → cynefinDiagram-WF24UDRP-r0bqUe5X.js} +1 -1
  121. package/editor-web/assets/{dagre-NK4GIZVX-Bn1O2Hjl.js → dagre-NK4GIZVX-4q_IUjiM.js} +1 -1
  122. package/editor-web/assets/deck-cyd6f3QU.js +1 -0
  123. package/editor-web/assets/{diagram-CBK3MWTC-W715PWZw.js → diagram-CBK3MWTC-CDh12DaH.js} +1 -1
  124. package/editor-web/assets/{diagram-I5XIIV2D-BKObZPn2.js → diagram-I5XIIV2D-C_sqASp8.js} +1 -1
  125. package/editor-web/assets/{diagram-ODIL2UCW-UtQxEPoW.js → diagram-ODIL2UCW-QgoMb-iS.js} +1 -1
  126. package/editor-web/assets/{diagram-PFBEJUXE-CpLGEK-k.js → diagram-PFBEJUXE-Djhv4RT6.js} +1 -1
  127. package/editor-web/assets/{diagram-RJA3I4VV-DGyMXoHb.js → diagram-RJA3I4VV-CvVswF4l.js} +1 -1
  128. package/editor-web/assets/{diagram-TYUNFSNR-Dy_Ewr8V.js → diagram-TYUNFSNR-DLnbV741.js} +1 -1
  129. package/editor-web/assets/dist-BK-WZ2ce.js +3 -0
  130. package/editor-web/assets/dist-CQ8-PJqF.js +16 -0
  131. package/editor-web/assets/dist-CQElMvxC.js +4 -0
  132. package/editor-web/assets/{dist-H9rTuNhb.js → dist-D49XAtID.js} +1 -1
  133. package/editor-web/assets/{dist-DNMKDcLg.js → dist-DDQLLUz5.js} +1 -1
  134. package/editor-web/assets/{dist-oeSWr2LE.js → dist-DO2VygfS.js} +3 -3
  135. package/editor-web/assets/dist-DOoUVqs_.js +24 -0
  136. package/editor-web/assets/{dist-B0rUvCi2.js → dist-DUyJ8AI0.js} +1 -1
  137. package/editor-web/assets/dist-DlDgR_Er.js +1 -0
  138. package/editor-web/assets/dist-Dw7AH_ip.js +6 -0
  139. package/editor-web/assets/{dist-0I0Obj60.js → dist-Dx3tLwZ1.js} +17 -17
  140. package/editor-web/assets/{dist-DptBQzJR.js → dist-F7lLi27Y.js} +1 -1
  141. package/editor-web/assets/dist-OfUZ68xY.js +547 -0
  142. package/editor-web/assets/{dist-D7M5YTq2.js → dist-OyPpS4AG.js} +28 -28
  143. package/editor-web/assets/dist-QCvBWMrp.js +5 -0
  144. package/editor-web/assets/{dist-CKD_paj_.js → dist-RppJbSHJ.js} +1 -1
  145. package/editor-web/assets/dist-ZFgjTFWK.js +19 -0
  146. package/editor-web/assets/{dist-Cc8v9lfc.js → dist-onYtssQw.js} +1 -1
  147. package/editor-web/assets/{docx-draw-B5cM77hc.js → docx-draw-BBI4k72R.js} +1 -1
  148. package/editor-web/assets/{ebnfDiagram-V4P3TTPT-GPYcx6dU.js → ebnfDiagram-V4P3TTPT-BoiJRPsL.js} +1 -1
  149. package/editor-web/assets/{elk-QONTBCTQ-Bi0r4UFM.js → elk-QONTBCTQ-BDiBwn0f.js} +1 -1
  150. package/editor-web/assets/{erDiagram-KYQIGQAA-DrOSrnci.js → erDiagram-KYQIGQAA-DaA3jdNm.js} +1 -1
  151. package/editor-web/assets/{esm-jIPnpbBD.js → esm-BWIRT8Yl.js} +1 -1
  152. package/editor-web/assets/{eventmodeling-K75KTNOO-Dw-MjgUb.js → eventmodeling-K75KTNOO-j7ZSOAed.js} +1 -1
  153. package/editor-web/assets/flowDiagram-IUGLLWBU-Cb-xQSAJ.js +1 -0
  154. package/editor-web/assets/{ganttDiagram-R7GPNTJY-Bwe8cQqi.js → ganttDiagram-R7GPNTJY-CyNcjwUZ.js} +1 -1
  155. package/editor-web/assets/{gitGraph-VSP46ZUC-DsAcAKP0.js → gitGraph-VSP46ZUC-BuzoK22Z.js} +1 -1
  156. package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-aObRwdru.js → gitGraphDiagram-PDYL7XHY--lzum_QP.js} +1 -1
  157. package/editor-web/assets/index-BSd85XUU.js +28 -0
  158. package/editor-web/assets/{info-OHQRW6UA-DBPN8JFr.js → info-OHQRW6UA-rs42SY_Y.js} +1 -1
  159. package/editor-web/assets/{infoDiagram-MVDRKAX5-Bx26Hq7M.js → infoDiagram-MVDRKAX5-BjedWKrM.js} +1 -1
  160. package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-BJ_MCDwA.js → ishikawaDiagram-HPEHV2GE-Dtqm_gq7.js} +1 -1
  161. package/editor-web/assets/{journeyDiagram-BOSHW7O7-B5g4W2Dx.js → journeyDiagram-BOSHW7O7-J0dA2yU0.js} +1 -1
  162. package/editor-web/assets/{kanban-definition-FNSA4HC5-U8YNlxN7.js → kanban-definition-FNSA4HC5-DV13v0Uf.js} +1 -1
  163. package/editor-web/assets/{mermaid-parser.core-DYLQlYDo.js → mermaid-parser.core-B7bZFHzS.js} +3 -3
  164. package/editor-web/assets/{mermaid.core-qNJmZ0b4.js → mermaid.core-DQ10-Otk.js} +4 -4
  165. package/editor-web/assets/{mindmap-definition-6OY57UG3-CI5aBWbK.js → mindmap-definition-6OY57UG3-DgdXGBCF.js} +1 -1
  166. package/editor-web/assets/{packet-JDAUHWVQ-BBclMGlJ.js → packet-JDAUHWVQ-ZNSLC_YL.js} +1 -1
  167. package/editor-web/assets/{panes-BShVq38A.js → panes-1hRg6CCN.js} +2 -2
  168. package/editor-web/assets/{pegDiagram-ECIUJNBX-B3pljPTu.js → pegDiagram-ECIUJNBX-nBIsHepE.js} +1 -1
  169. package/editor-web/assets/{pie-XZMESJXO-B7WzimHm.js → pie-XZMESJXO-CXen6okO.js} +1 -1
  170. package/editor-web/assets/{pieDiagram-GNMPY74T-tM1Da50-.js → pieDiagram-GNMPY74T-BlimMsUq.js} +1 -1
  171. package/editor-web/assets/{quadrantDiagram-D57K4MC3-BEq_Shj9.js → quadrantDiagram-D57K4MC3-D_B7p8XB.js} +1 -1
  172. package/editor-web/assets/{radar-ABXABTNO-v2jJSW5T.js → radar-ABXABTNO-DFfRPPEM.js} +1 -1
  173. package/editor-web/assets/{railroad-I3PHUGI6-6W3Z4F8Y.js → railroad-I3PHUGI6-DS8ly7WZ.js} +1 -1
  174. package/editor-web/assets/{railroad-abnf-LNEFI6M7-DxIN7Zrt.js → railroad-abnf-LNEFI6M7-Coohlgpw.js} +1 -1
  175. package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-Bb5O7tAx.js → railroad-ebnf-DWYD2UWJ-CvcfKbZc.js} +1 -1
  176. package/editor-web/assets/{railroad-peg-JR7BVNR7-i2LjEP5t.js → railroad-peg-JR7BVNR7-jRtVHKtg.js} +1 -1
  177. package/editor-web/assets/{railroadDiagram-Y72NRBL7-DhsyVKbG.js → railroadDiagram-Y72NRBL7-kWUIDPHg.js} +1 -1
  178. package/editor-web/assets/{requirementDiagram-EQYSW5RA-Du2k7i1E.js → requirementDiagram-EQYSW5RA-C39Gfdi-.js} +1 -1
  179. package/editor-web/assets/ribbon-tabs-5R-_EtHp.js +1 -0
  180. package/editor-web/assets/{sankeyDiagram-SY24JHO5-CDnRMu7J.js → sankeyDiagram-SY24JHO5-DtSQ2N2q.js} +1 -1
  181. package/editor-web/assets/{sequenceDiagram-BLEHNHQU-BUXBhWYW.js → sequenceDiagram-BLEHNHQU-BZx9gAR1.js} +1 -1
  182. package/editor-web/assets/{session--OJYv_B7.js → session-2pd0mFQm.js} +1 -1
  183. package/editor-web/assets/{snapshots-DYooVfOx.js → snapshots-8hCkRemI.js} +1 -1
  184. package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-Enb8LZUA.js → stateDiagram-v2-A6IESKWZ-E9qhWPa3.js} +1 -1
  185. package/editor-web/assets/{swimlanes-B3ENRKFQ-pnpjgTrl.js → swimlanes-B3ENRKFQ-C6vD9fmU.js} +1 -1
  186. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-D_DL_JP0.js +8 -0
  187. package/editor-web/assets/{timeline-definition-JXYKGLGB-C4pR18kd.js → timeline-definition-JXYKGLGB-CT8AKsKE.js} +1 -1
  188. package/editor-web/assets/{treeView-D4JQ5SDB-kzNGeAv6.js → treeView-D4JQ5SDB-DA2iE5aC.js} +1 -1
  189. package/editor-web/assets/{treemap-SAJKECNS-Buhb5wzt.js → treemap-SAJKECNS-RgrBf6Sq.js} +1 -1
  190. package/editor-web/assets/{updating-Cbxw83_O.js → updating--4wIxO0k.js} +1 -1
  191. package/editor-web/assets/{usecaseDiagram-WPOLBNNX-CL-xLQWl.js → usecaseDiagram-WPOLBNNX-DfIcy0_F.js} +1 -1
  192. package/editor-web/assets/{vennDiagram-Q3Y3IDCW-bwsyCcdK.js → vennDiagram-Q3Y3IDCW-DxTSyNH7.js} +1 -1
  193. package/editor-web/assets/{video-8MxWX9f5.js → video-yjnj5UY2.js} +1 -1
  194. package/editor-web/assets/{wardley-7MLQ67FV-DXsLgedI.js → wardley-7MLQ67FV-pow5gWxU.js} +1 -1
  195. package/editor-web/assets/{wardleyDiagram-IVAIDKWA-Cn0ph953.js → wardleyDiagram-IVAIDKWA-Dar0j9HS.js} +1 -1
  196. package/editor-web/assets/{workbook-BDWkQ149.js → workbook-7fUt0Qgy.js} +1 -1
  197. package/editor-web/assets/{xychartDiagram-4URNHDU4-CfXnqGWZ.js → xychartDiagram-4URNHDU4-qCxuQZMj.js} +1 -1
  198. package/editor-web/index.html +4 -3
  199. package/package.json +2 -2
  200. package/editor-web/assets/article-BHjKp5We.js +0 -3
  201. package/editor-web/assets/article-BlNKv1Cn.js +0 -7
  202. package/editor-web/assets/bar-button-CJmpgNg4.js +0 -1
  203. package/editor-web/assets/channel-Bhb-_8v6.js +0 -1
  204. package/editor-web/assets/chip-pNQlYa2W.js +0 -1
  205. package/editor-web/assets/deck-Cohd-G5m.js +0 -1
  206. package/editor-web/assets/dist-6ugUm4dS.js +0 -6
  207. package/editor-web/assets/dist-CKUW5NzS.js +0 -3
  208. package/editor-web/assets/dist-Ca9Gsuu0.js +0 -24
  209. package/editor-web/assets/dist-CynBNzYv.js +0 -1
  210. package/editor-web/assets/dist-D9tsFc2N.js +0 -16
  211. package/editor-web/assets/dist-Doj7_HUI.js +0 -547
  212. package/editor-web/assets/dist-DzKB210A.js +0 -5
  213. package/editor-web/assets/dist-RyGsFHE0.js +0 -4
  214. package/editor-web/assets/dist-wD_hHJ8_.js +0 -19
  215. package/editor-web/assets/flowDiagram-IUGLLWBU-DbZTfPEP.js +0 -1
  216. package/editor-web/assets/index-D-MNVykg.js +0 -28
  217. package/editor-web/assets/ribbon-tabs-Bxuj_hct.js +0 -1
  218. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B-B2Eoc8.js +0 -8
@@ -1,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,b as n,c as r,f as i,m as a,s as o}from"./react-Byupo4pA.js";import{Et as s,ht as c,kt as l,n as u,t as d}from"./x-BAJilkKD.js";import{C as f,S as p,_ as m,a as ee,l as h,s as g}from"./schemas-DlRAoVtq.js";import{t as _}from"./session--OJYv_B7.js";import{t as v}from"./jsx-runtime-DePvh3-m.js";import{C as y,_ as b,d as x,f as S,g as C,h as w,u as T}from"./bar-button-CJmpgNg4.js";import{C as te,E as ne,S as re,b as ie,i as ae}from"./dist-6ugUm4dS.js";import{t as E}from"./createLucideIcon-euu7Wcd9.js";import{t as oe}from"./arrow-down-D-QZrqcz.js";import{t as se}from"./arrow-up-B1zjKUHX.js";import{t as ce}from"./chart-no-axes-column-Dyy25XZ_.js";import{a as le,d as ue,i as de,l as fe,n as pe,o as me,r as he,s as ge,t as _e,u as D}from"./panes-BShVq38A.js";import{n as ve,t as ye}from"./undo-2-DCbMWoug.js";import{h as be}from"./index-D-MNVykg.js";import{n as xe,r as Se,t as O}from"./updating-Cbxw83_O.js";import{t as k}from"./collaborator-CbTacvkB.js";import{c as Ce,d as A,i as j,n as M,p as N,s as P}from"./browser-DEGNhKTV.js";import{S as F,b as we,d as Te,f as Ee,i as De,l as Oe,m as ke,n as I,p as Ae,t as L,u as je,v as Me,y as R}from"./words-B2jQwWpp.js";var z=E(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),B=E(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),V=[`following`,`mentionedUsers`,`subscribers`,`verified`],H=f().regex(/^[0-9]{1,19}$/u,`a post's id: 1 to 19 digits`),U=p({file:f().min(1),alt:f().optional()},{error:e=>e.code===`invalid_type`?`a medium is { file: ./picture.png, alt: … }: its file, from this file's folder, and its alt text`:void 0}),W=p({options:g(f()),duration_minutes:m().int()},{error:e=>e.code===`invalid_type`?`a poll is { options: [ … ], duration_minutes: … }`:void 0}),Ne=p({text:f().default(``).transform(e=>e.replace(/\n+$/u,``)),media:g(U).optional(),poll:W.optional(),made_with_ai:h().optional(),paid_partnership:h().optional(),reply:p({in_reply_to_tweet_id:H}).optional(),quote_tweet_id:H.optional()},{error:e=>e.code===`invalid_type`?`a post is { text: …, media: [ … ], poll: … }`:void 0}),Pe=p({reply_settings:ee(V).optional(),posts:g(Ne,{error:`posts is the list of its posts: posts: [ { text: … }, … ]`}).min(1,`posts holds at least one post`)},{error:e=>e.code===`invalid_type`?`an x-post's file is { posts: [ { text: … }, … ] }, with reply_settings beside posts`:void 0});function Fe(e,t){let n=e;for(let e of t)if(A(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(N(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function G(e){let t=new j,n=M(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=Fe(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Pe.safeParse(n.toJS());return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function K(e,t){let n=e.createNode(t);return t.includes(`
2
- `)&&(n.type=Ce.BLOCK_LITERAL),n}var q=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>q(e)===q(t);function Ie(e){return{text:e.text,media:e.media===void 0||e.media.length===0?void 0:e.media,poll:e.poll}}function Le(e,t){let n=M(e),r=G(e).value;if(r!==void 0&&J(r,t))return e;A(n.contents)||(n.contents=new P),t.reply_settings===void 0?n.deleteIn([`reply_settings`]):n.getIn([`reply_settings`])!==t.reply_settings&&n.setIn([`reply_settings`],t.reply_settings);let i=n.getIn([`posts`]),a=N(i)?i:void 0,o=(a?.items??[]).map(e=>A(e)?e:void 0),s=(r?.posts??[]).map(e=>q(e)),c=new Set,l=t.posts.map(()=>void 0);t.posts.forEach((e,t)=>{let n=s.findIndex((t,n)=>!c.has(n)&&o[n]&&t===q(e));n>=0&&(c.add(n),l[t]=n)}),t.posts.forEach((e,t)=>{l[t]===void 0&&o[t]&&!c.has(t)&&(c.add(t),l[t]=t)});let u=t.posts.map((e,t)=>{let r=l[t],i=r===void 0?void 0:o[r],a=Ie(e);if(!i){let t=n.createNode({});t.set(`text`,K(n,e.text));for(let e of[`media`,`poll`])a[e]!==void 0&&t.set(e,n.createNode(a[e]));return t}let s=i.get(`text`);(typeof s!=`string`||s.replace(/\n+$/u,``)!==e.text)&&i.set(`text`,K(n,e.text));for(let e of[`media`,`poll`]){let t=a[e],r=i.get(e,!0);t===void 0?r!==void 0&&i.delete(e):J(r?.toJSON?.(),t)||i.set(e,n.createNode(t))}return i});return a?a.items=u:n.setIn([`posts`],n.createNode(u)),n.toString({flowCollectionPadding:!1,lineWidth:0})}function Re(e,t,n){let r=(e,t,n)=>J(t,e)?n:t,i=t.posts.length===e.posts.length?n.posts.length:n.posts.length===e.posts.length?t.posts.length:n.posts.length,a=[];for(let o=0;o<i;o++){let i=e.posts[o],s=t.posts[o],c=n.posts[o],l=c??s;if(l===void 0)continue;if(s===void 0||c===void 0||i===void 0){a.push(l);continue}let u={...c,text:r(i.text,s.text,c.text)};delete u.media,delete u.poll,a.push({...u,...Y(`media`,r(i.media,s.media,c.media)),...Y(`poll`,r(i.poll,s.poll,c.poll))})}let o={...n,posts:a};return delete o.reply_settings,{...o,...Y(`reply_settings`,r(e.reply_settings,t.reply_settings,n.reply_settings))}}function Y(e,t){return t===void 0?{}:{[e]:t}}var X=e(n(),1),Z=v();function ze(e){let t=e?.part??e?.board;if(typeof t!=`string`)return;let n=/^post-(\d+)$/u.exec(t)?.[1];return n===void 0?void 0:Number(n)-1}var Be=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ve(e,t){let n=e?.posts??[],r=t.posts;for(let e=0;e<r.length;e++)if(!Be(n[e],r[e]))return e;if(n.length>r.length&&r.length>0)return r.length-1}function He(e,t){let n=G(e),r=n.value?.posts.length??0,i=e.split(`
3
- `).length;for(let e=0;e<r;e++){let a=n.line([`posts`,e]);if(a===void 0)continue;let o=e+1<r?n.line([`posts`,e+1]):void 0,s=o===void 0?i:o-1;if(a<=t.to&&t.from<=s)return e}}function Ue(e,t){if(e.from!==void 0&&e.path===t.path)return He(t.text,{from:e.from,to:e.to??e.from})}var We=class e{session;file;unreadable=!1;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable)return;let t=Le(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=G(e),i=G(t).value,a=n?.kind===`agent`&&r.value?Ve(i,r.value):void 0;a!==void 0&&(this.landed={post:a,at:Date.now()}),r.value?(this.file=this.file===void 0||i===void 0?r.value:Re(i,this.file,r.value),this.unreadable=!1):(this.file=void 0,this.unreadable=!0),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=G(e);this.file=t.value,this.unreadable=t.value===void 0}static async open(t,n){return new e(await _.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Q=(e,t,n)=>({...e,posts:e.posts.map((e,r)=>r===t?n(e):e)});function Ge(e,t){let n={...e};return t===void 0||t.length===0?delete n.media:n.media=t,n}function Ke(e){let t={...e};return delete t.poll,t}function qe({text:e}){let t=L(),{weighted:n}=we(e),r=F.length.most,i=r-n,a=i<0&&n<=F.length.premium,o=n>F.length.premium,s=Math.min(1,n/r),l=2*Math.PI*9;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs tabular-nums`,"aria-label":i>=0?t.left(i):t.over(-i),"data-testid":`x-count`,children:[i<=20?(0,Z.jsx)(`span`,{className:c(o?`text-destructive`:a?`text-warning`:`text-muted-foreground`),children:a?n:i}):null,(0,Z.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 22 22`,"aria-hidden":`true`,children:[(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:`var(--ak-x-line)`,strokeWidth:`2`}),(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:o?`#f4212e`:a||i<=20?`#ffd400`:`var(--ak-x-link)`,strokeWidth:`2`,strokeDasharray:`${String(s*l)} ${String(l)}`,transform:`rotate(-90 11 11)`})]})]})}function Je(e){let t=L();return(0,Z.jsx)(D,{alt:e.alt??``,onAlt:e.onAlt,most:F.alt,trigger:(0,Z.jsx)(u,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,"aria-label":t.altText,children:t.alt})})}function Ye(e){let t=L();return(0,Z.jsx)(u,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media absolute top-2 right-2 rounded-full`,"aria-label":t.removeMedium,onClick:e.onRemove,children:(0,Z.jsx)(d,{})})}function Xe(e){let t=L(),{options:n,duration_minutes:r}=e.poll,i={days:Math.floor(r/1440),hours:Math.floor(r%1440/60),minutes:r%60},a=(t,n)=>{let r={...i,[t]:Math.max(0,Math.floor(n))};e.onChange({...e.poll,duration_minutes:r.days*1440+r.hours*60+r.minutes})};return(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 rounded-2xl border border-[var(--ak-x-line)] p-3`,"data-testid":`x-poll`,children:[n.map((r,i)=>{let a=R(r)-F.poll.option;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`input`,{className:`aria-invalid:border-destructive h-10 flex-1 rounded-md border border-[var(--ak-x-line)] bg-transparent px-3 text-[15px] outline-none focus:border-[var(--ak-x-link)]`,value:r,"aria-invalid":a>0||void 0,maxLength:F.poll.option,placeholder:t.option(i+1),"aria-label":t.option(i+1),onChange:t=>{e.onChange({...e.poll,options:n.map((e,n)=>n===i?t.target.value:e)},`option-${String(i)}`)}}),a>0?(0,Z.jsx)(`span`,{className:`text-destructive text-sm`,children:t.over(a)}):null,n.length>F.poll.least?(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,onClick:()=>{e.onChange({...e.poll,options:n.filter((e,t)=>t!==i)})},children:(0,Z.jsx)(d,{})}):null]},i)}),n.length<F.poll.most?(0,Z.jsxs)(u,{variant:`ghost`,size:`sm`,className:`self-start text-[var(--ak-x-link)]`,onClick:()=>{e.onChange({...e.poll,options:[...n,``]})},children:[(0,Z.jsx)(be,{}),t.addOption]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t border-[var(--ak-x-line)] pt-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground mr-auto self-center`,children:t.pollLength}),[`days`,`hours`,`minutes`].map(e=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-0.5 text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:t[e]}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:`h-8 w-16 rounded-md border border-[var(--ak-x-line)] bg-transparent px-2 text-sm`,value:i[e],onChange:t=>{a(e,Number(t.target.value))}})]},e)),(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ze(e){let t=L(),n=t.replies[e.value??`everyone`];return(0,Z.jsxs)(T,{children:[(0,Z.jsx)(y,{asChild:!0,disabled:e.disabled,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`sm`,className:`ak-x-c-replies -ml-2 gap-1 px-2 font-bold text-[var(--ak-x-link)]`,children:[(0,Z.jsx)(z,{}),n]})}),(0,Z.jsxs)(S,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(w,{children:t.whoCanReply}),(0,Z.jsx)(C,{value:e.value??`everyone`,onValueChange:t=>{e.onChange(t===`everyone`?void 0:V.includes(t)?t:void 0)},children:[`everyone`,...V].map(e=>(0,Z.jsx)(b,{value:e,children:t.replies[e]},e))})]})]})}function Qe(e){let t=L(),n=e.post.made_with_ai===!0||e.post.paid_partnership===!0;return(0,Z.jsxs)(T,{children:[(0,Z.jsx)(y,{asChild:!0,children:(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)]`,"aria-label":t.disclosure,title:t.disclosure,"aria-pressed":n,children:(0,Z.jsx)(B,{className:c(n&&`fill-current`)})})}),(0,Z.jsxs)(S,{align:`start`,className:`w-56`,children:[(0,Z.jsx)(w,{children:t.disclosure}),(0,Z.jsx)(x,{checked:e.post.made_with_ai===!0,onCheckedChange:t=>{e.onChange({made_with_ai:t})},children:t.madeWithAi}),(0,Z.jsx)(x,{checked:e.post.paid_partnership===!0,onCheckedChange:t=>{e.onChange({paid_partnership:t})},children:t.paidPartnership})]})]})}function $(e){return(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}var $e=3e4;function et({doc:e,dir:n,entry:o}){let c=L(),f=r(),p=a(),[m,ee]=he(),h=(0,X.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[g,_]=(0,X.useState)(),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(),S=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(b===void 0)return;let e=S.current[b.post];e!=null&&(e.focus(),e.setSelectionRange(b.at,b.at),y(b.post),x(void 0))},[b]);let{shown:C,updating:w}=Se(h.file),T=p||w,{agent:E,following:D}=t(),Ce=ne(),A=(()=>{if(E?.doing===void 0)return;let t=ze(E.place);if(t!==void 0)return t;let n=h.landed!==void 0&&h.landed.at>=E.at-$e;return n&&E.source?.path===o?h.landed?.post:(E.source?Ue(E.source,{path:o,text:e.text}):void 0)??(n?h.landed?.post:void 0)})(),j=A!==void 0&&A<(C?.posts.length??0)?A:void 0,M=(0,X.useRef)([]),N=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(D&&j!==void 0)for(let e of[M.current[j],N.current[j]])e?.scrollIntoView({block:`nearest`})},[D,j,h.landed]);let P=me(n,(C?.posts??[]).flatMap(e=>(e.media??[]).map(e=>e.file)));i({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The X post ${o}${(C?.posts.length??0)>1?`, a thread of ${String(C?.posts.length??0)} posts`:``}`,source:{path:o}}),locate:t=>{let n=C?.posts??[],r=G(e.text),i=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},a=e=>e!==void 0&&l(t,e),c=n.flatMap((e,t)=>{if(!a(i(M.current[t]))&&!a(i(N.current[t])))return[];let n=r.line([`posts`,t]);return[{name:`post ${String(t+1)} of the thread`,source:{path:o,...n===void 0?{}:{line:n}},...e.text===``?{}:{text:e.text}}]}),u=s(t)[0],d=e=>e!==void 0&&u!==void 0&&u.x>=e.x&&u.x<=e.x+e.width&&u.y>=e.y&&u.y<=e.y+e.height,f=n.findIndex((e,t)=>d(i(M.current[t]))),p=n.findIndex((e,t)=>d(i(N.current[t]))),m=f>=0?`in post ${String(f+1)}, where it is written`:p>=0?`in post ${String(p+1)}, as X's timeline will show it`:void 0;return Promise.resolve({elements:c,...m===void 0?{}:{where:m}})}});let we=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},I=(t,n,r)=>{T||e.edit(t,n,r)},R=e=>(e.media??[]).map(e=>{let t=P.get(e.file),n=le(e.file),r=n?void 0:Me(e.file.split(`.`).pop()??``);return t===void 0?{kind:`made`,label:n?c.made:e.file}:{kind:r??`picture`,src:t,alt:e.alt,file:e.file}}),z=(0,Z.jsx)(ae,{start:(0,Z.jsxs)(Z.Fragment,{children:[T||m!==`edit`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":c.undo,title:c.undo,disabled:!h.canUndo,onClick:()=>{e.undo()},children:(0,Z.jsx)(ye,{})}),(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":c.redo,title:c.redo,disabled:!h.canRedo,onClick:()=>{e.redo()},children:(0,Z.jsx)(ve,{})})]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(_e,{pane:m,onPane:ee})]}),saved:{state:h.state},exports:{}}),B=f?.theme===`dark`;if(C===void 0)return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,children:[z,(0,Z.jsx)(O,{className:`flex min-h-0 flex-1 items-center justify-center`})]});let V=C.posts,H=Math.min(v,V.length-1),U=e=>{I(c.steps.add,t=>({...t,posts:[...t.posts.slice(0,e+1),{text:``},...t.posts.slice(e+1)]})),x({post:e+1,at:0})},W=e=>{let t=V[e],n=V[e-1];if(t===void 0||n===void 0)return!1;let r=e=>(e.media?.length??0)>0||e.poll!==void 0;if(r(t)&&r(n))return!1;let i=n.text===``||t.text===``?``:`
4
-
5
- `;return I(c.steps.join,a=>({...a,posts:[...a.posts.slice(0,e-1),{...n,...r(t)?{...t.media?{media:t.media}:{},...t.poll?{poll:t.poll}:{}}:{},text:n.text+i+t.text},...a.posts.slice(e+1)]})),x({post:e-1,at:n.text.length+i.length}),!0},Ne=(0,Z.jsx)(`div`,{className:`ak-x ak-x-editing ak-x-composer`,"data-theme":B?`dark`:`light`,children:V.map((t,r)=>{let i=r===V.length-1,a=r===H,s=t.media??[],l=s.filter(e=>Me(e.file.split(`.`).pop()??``)===`picture`||le(e.file)).length,f=s.length>=F.pictures||s.length>l;return(0,Z.jsxs)(`div`,{ref:e=>{M.current[r]=e},className:`ak-x-c-post`,"data-here":a?``:void 0,"data-testid":`x-post`,onFocusCapture:()=>{y(r)},onPointerDown:()=>{y(r)},children:[(0,Z.jsxs)(`div`,{className:`ak-x-side`,children:[(0,Z.jsx)(`div`,{className:`ak-x-avatar`,"aria-hidden":`true`,children:je.name.slice(0,1)}),i?null:(0,Z.jsx)(`div`,{className:`ak-x-thread-line`})]}),(0,Z.jsxs)(`div`,{className:`ak-x-body`,children:[a&&r>0&&!T?(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`ak-x-c-remove`,"aria-label":c.remove,title:c.remove,onClick:()=>{I(c.steps.remove,e=>({...e,posts:e.posts.filter((e,t)=>t!==r)})),x({post:r-1,at:V[r-1]?.text.length??0})},children:(0,Z.jsx)(d,{})}):null,(0,Z.jsxs)(`div`,{className:`ak-x-field`,children:[(0,Z.jsx)(Ee,{text:t.text,whole:!0}),(0,Z.jsx)(`textarea`,{ref:e=>{S.current[r]=e},dir:`auto`,value:t.text,placeholder:r===0?c.whatsHappening:c.addAnother,"aria-label":r===0?c.whatsHappening:c.addAnother,readOnly:T,"data-testid":`x-text`,onChange:e=>{let t=e.target.value;I(c.steps.text,e=>Q(e,r,e=>({...e,text:t})),`text-${String(r)}`)},onBlur:()=>{e.settle()},onKeyDown:e=>{let t=e.currentTarget;if(e.key===`Backspace`&&r>0&&t.selectionStart===0&&t.selectionEnd===0&&!T){W(r)&&e.preventDefault();return}if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey))return;e.preventDefault();let n=t.selectionStart;I(c.steps.split,e=>{let t=e.posts[r];if(!t)return e;let i=t.text.slice(0,n).replace(/\s+$/u,``),a=t.text.slice(n).replace(/^\s+/u,``);return{...e,posts:[...e.posts.slice(0,r),{...t,text:i},{text:a},...e.posts.slice(r+1)]}}),x({post:r+1,at:0})}})]}),(0,Z.jsx)(Oe,{media:R(t),onAlt:T?void 0:e=>(0,Z.jsx)(Je,{alt:s[e]?.alt,onAlt:t=>{I(c.steps.alt,n=>Q(n,r,n=>({...n,media:(n.media??[]).map((n,r)=>{if(r!==e)return n;let i={file:n.file};return t.trim()===``?i:{...i,alt:t}})})))}}),onMedium:T?void 0:e=>(0,Z.jsx)(Ye,{onRemove:()=>{I(c.steps.media,t=>Q(t,r,t=>Ge(t,(t.media??[]).filter((t,n)=>n!==e))))}})}),t.poll===void 0?null:T?(0,Z.jsx)(`div`,{className:`ak-x-poll`,children:t.poll.options.map((e,t)=>(0,Z.jsx)(`div`,{className:`ak-x-option`,dir:`auto`,children:e},t))}):(0,Z.jsx)(Xe,{poll:t.poll,onChange:(e,t)=>{I(c.steps.poll,t=>Q(t,r,t=>({...t,poll:e})),t===void 0?void 0:`${t}-${String(r)}`)},onRemove:()=>{I(c.steps.poll,e=>Q(e,r,e=>Ke(e)))}}),t.quote_tweet_id===void 0?null:(0,Z.jsx)(Ae,{id:t.quote_tweet_id}),a?(0,Z.jsx)(Ze,{value:C.reply_settings,disabled:T,onChange:e=>{I(c.whoCanReply,t=>{let n={...t};return e===void 0?delete n.reply_settings:n.reply_settings=e,n})}}):null,a&&!T?(0,Z.jsxs)(`div`,{className:`ak-x-c-tools`,children:[(0,Z.jsxs)(ie,{open:g===r,onOpenChange:e=>{_(e?r:void 0)},children:[(0,Z.jsx)(te,{asChild:!0,children:(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":c.addMedia,title:c.addMedia,disabled:f||t.poll!==void 0,children:(0,Z.jsx)(ue,{})})}),(0,Z.jsx)(re,{className:`w-auto`,align:`start`,children:(0,Z.jsx)(de,{self:o,types:De,testId:`x-picker`,onPick:e=>{_(void 0),I(c.steps.media,t=>Q(t,r,t=>({...t,media:[...t.media??[],{file:ge(n,e)}]})))}})})]}),(0,Z.jsx)($,{label:c.addPoll,disabled:t.poll!==void 0||s.length>0,onClick:()=>{I(c.steps.poll,e=>Q(e,r,e=>({...e,poll:{options:[``,``],duration_minutes:1440}})))},children:(0,Z.jsx)(ce,{})}),(0,Z.jsx)(Qe,{post:t,onChange:e=>{I(c.disclosure,t=>Q(t,r,t=>{let n={...t,...e};return n.made_with_ai!==!0&&delete n.made_with_ai,n.paid_partnership!==!0&&delete n.paid_partnership,n}))}}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)($,{label:c.moveUp,disabled:r===0,onClick:()=>{I(c.steps.move,e=>{let t=[...e.posts],[n]=t.splice(r,1);return n&&t.splice(r-1,0,n),{...e,posts:t}}),y(r-1)},children:(0,Z.jsx)(se,{})}),(0,Z.jsx)($,{label:c.moveDown,disabled:i,onClick:()=>{I(c.steps.move,e=>{let t=[...e.posts],[n]=t.splice(r,1);return n&&t.splice(r+1,0,n),{...e,posts:t}}),y(r+1)},children:(0,Z.jsx)(oe,{})}),(0,Z.jsx)(qe,{text:t.text}),(0,Z.jsx)(`span`,{className:`bg-rule mx-1 h-6 w-px`,"aria-hidden":`true`}),(0,Z.jsx)(u,{variant:`outline`,size:`icon-xs`,className:`rounded-full border-[var(--ak-x-line)] text-[var(--ak-x-link)]`,"aria-label":c.addPost,title:c.addPost,onClick:()=>{U(r)},children:(0,Z.jsx)(be,{})})]}):null]}),E&&j===r?(0,Z.jsx)(k,{"data-testid":`x-agent-box`,label:Ce(E),className:`inset-x-1 inset-y-0`}):null]},r)})}),Pe=(0,Z.jsx)(`div`,{className:`ak-x`,"data-theme":B?`dark`:`light`,children:V.map((e,t)=>(0,Z.jsxs)(`div`,{ref:e=>{N.current[t]=e},className:`relative`,children:[(0,Z.jsx)(Te,{post:{text:e.text,media:R(e),poll:e.poll,quote:e.quote_tweet_id},joined:t<V.length-1,published:!0}),E&&j===t?(0,Z.jsx)(k,{"data-testid":`x-agent-shown`,className:`inset-0`}):null]},t))});return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,onKeyDown:we,children:[z,(0,Z.jsx)(ke.Provider,{value:fe,children:(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[w?(0,Z.jsx)(xe,{}):null,(0,Z.jsx)(pe,{pane:m,edit:Ne,preview:Pe,width:598,background:B?`#000000`:`#ffffff`,testId:`x-preview`})]})})]})}function tt(){let e=L(),t=o(),n=r(),i=n?.item.entry,a=n?.item.dir??``,[s,c]=(0,X.useState)(),[l,u]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return We.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{reportError(e),n&&u(!0)}),()=>{n=!1,e?.close()}},[t,i]),l?(0,Z.jsx)(`div`,{className:`flex size-full`,"data-testid":`x-post-editor`,"data-state":`updating`,children:(0,Z.jsx)(O,{})}):!s||i===void 0?(0,Z.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`x-post-editor`,"data-state":`loading`,children:e.loading}):(0,Z.jsx)(et,{doc:s,dir:a,entry:i})}export{We as PostDocument,I as WORDS,tt as XPostEditor,tt as default};
@@ -1,4 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,b as n,c as r,d as i,f as a,h as o,s}from"./react-Byupo4pA.js";import{Dt as c,Et as l,Ot as u,kt as d,yt as f}from"./x-BAJilkKD.js";import{C as p,E as m,S as h,T as g,_,a as v,b as y,d as b,f as x,h as S,l as C,s as w,u as ee,v as T,w as E}from"./schemas-DlRAoVtq.js";import{F as D,S as te,b as O,g as k,j as A,x as ne}from"./snapshots-DYooVfOx.js";import{t as re}from"./jsx-runtime-DePvh3-m.js";import{A as j,C as ie,f as ae,m as M,t as oe,u as se,y as N}from"./bar-button-CJmpgNg4.js";import{E as ce,_ as le,a as ue,c as de,d as fe,i as P,l as pe,n as me,o as he,p as ge,r as F,u as _e}from"./dist-6ugUm4dS.js";import{a as ve,n as ye}from"./index-D-MNVykg.js";import{n as be,t as xe}from"./updating-Cbxw83_O.js";import{t as I}from"./collaborator-CbTacvkB.js";var L=re(),Se=f({en:{loading:`Drawing the boards`,noBoards:`This image has no boards yet`,boards:`Boards`,zoom:`Zoom`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,zoomFit:`Zoom to Fit`,zoomActual:`Actual Size`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 board`:`${String(e)} boards`},"zh-cn":{loading:`正在绘制画板`,noBoards:`这张图片还没有画板`,boards:`画板`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到适合`,zoomActual:`实际大小`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 个画板`},"zh-tw":{loading:`正在繪製畫板`,noBoards:`這張圖片還沒有畫板`,boards:`畫板`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適合大小`,zoomActual:`實際大小`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 個畫板`},ja:{loading:`ボードを描画中`,noBoards:`この画像にはまだボードがありません`,boards:`ボード`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`実寸`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 枚のボード`},ko:{loading:`보드를 그리는 중`,noBoards:`이 이미지에는 아직 보드가 없습니다`,boards:`보드`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`실제 크기`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`보드 ${String(e)}개`},es:{loading:`Dibujando las mesas de trabajo`,noBoards:`Esta imagen aún no tiene mesas de trabajo`,boards:`Mesas de trabajo`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la ventana`,zoomActual:`Tamaño real`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 mesa de trabajo`:`${String(e)} mesas de trabajo`},fr:{loading:`Dessin des plans de travail`,noBoards:`Cette image n’a pas encore de plan de travail`,boards:`Plans de travail`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Taille réelle`,percent:e=>`${String(e)}\u202f%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 plan de travail`:`${String(e)} plans de travail`},de:{loading:`Zeichenflächen werden gezeichnet`,noBoards:`Dieses Bild hat noch keine Zeichenflächen`,boards:`Zeichenflächen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`An Fenster anpassen`,zoomActual:`Originalgröße`,percent:e=>`${String(e)}\u00a0%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 Zeichenfläche`:`${String(e)} Zeichenflächen`},pt:{loading:`Desenhando as pranchetas`,noBoards:`Esta imagem ainda não tem pranchetas`,boards:`Pranchetas`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à janela`,zoomActual:`Tamanho real`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 prancheta`:`${String(e)} pranchetas`}});function R(){return Se.of(r()?.locale)}var z=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`;function Ce(e){let t=R();return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(me,{id:`zoom`,priority:3,children:(0,L.jsxs)(se,{children:[(0,L.jsx)(ie,{asChild:!0,children:(0,L.jsxs)(oe,{"aria-label":t.zoom,title:t.zoom,className:`tabular-nums`,"data-testid":`image-zoom`,children:[t.percent(Math.round(e.zoom*100)),(0,L.jsx)(j,{className:`size-3`})]})}),(0,L.jsxs)(ae,{align:`start`,children:[(0,L.jsx)(`div`,{className:`px-1 pb-1`,children:(0,L.jsx)(ve,{"aria-label":t.zoom,className:`h-7 tabular-nums`,inputMode:`decimal`,defaultValue:t.percent(Math.round(e.zoom*100)),"data-testid":`image-zoom-typed`,onKeyDown:t=>{if(t.stopPropagation(),t.key!==`Enter`)return;let n=parseFloat(t.currentTarget.value.replace(`,`,`.`));Number.isFinite(n)&&n>0&&e.onZoom(n/100)}},Math.round(e.zoom*100))}),(0,L.jsxs)(M,{onSelect:()=>{e.onZoom(`in`)},children:[t.zoomIn,(0,L.jsx)(N,{children:`${z}+`})]}),(0,L.jsxs)(M,{onSelect:()=>{e.onZoom(`out`)},children:[t.zoomOut,(0,L.jsx)(N,{children:`${z}−`})]}),(0,L.jsxs)(M,{"data-testid":`image-zoom-fit`,onSelect:()=>{e.onZoom(`fit`)},children:[t.zoomFit,(0,L.jsx)(N,{children:`⇧1`})]}),(0,L.jsxs)(M,{"data-testid":`image-zoom-actual`,onSelect:()=>{e.onZoom(1)},children:[t.zoomActual,(0,L.jsx)(N,{children:`⇧0`})]})]})]})})})}var we=`normal.dissolve.darken.multiply.colorBurn.linearBurn.darkerColor.lighten.screen.colorDodge.linearDodge.lighterColor.overlay.softLight.hardLight.vividLight.linearLight.pinLight.hardMix.difference.exclusion.subtract.divide.hue.saturation.color.luminosity.passThrough`.split(`.`),Te=e=>typeof e==`object`&&!!e&&(`__allyhubMedia`in e||`sha256`in e),B=_().min(0).max(1),Ee=E([B,B,B,B]).refine(([e,t,n,r])=>n>0&&r>0&&e+n<=1+1e-9&&t+r<=1+1e-9,`[x, y, w, h] as shares of the frame, inside it, its sides more than 0`),De=g([p().min(1),ee(Te,`an imported picture`)]),V=_().min(0).max(100).refine(Number.isFinite,`a percent from 0 to 100`),H=_().min(0).max(1e3).refine(Number.isFinite),Oe=_().min(-360).max(360),U=v(we),ke=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu,Ae=/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)$/iu;function je(e){if(typeof e!=`string`)return!1;let t=e.trim();if(ke.test(t)||Ae.test(t))return!0;if(!/^[a-z]+$/iu.test(t))return!1;let n=globalThis.CSS;return n?n.supports(`color`,t):t.length>2}var W=p().refine(je,`a CSS colour (#rrggbb, rgb(…), hsl(…) or a colour's name)`),Me=T({color:W,location:V,midpoint:V.optional()}),Ne=T({stops:w(Me).min(2),style:v([`linear`,`radial`,`angle`,`reflected`,`diamond`]).optional(),angle:Oe.optional(),scale:_().min(10).max(1e3).optional(),reverse:C().optional()});g([T({color:W}),T({gradient:Ne}),T({pattern:De,scale:_().min(1).max(1e3).optional()})]);var Pe=T({src:De.optional(),path:p().min(1).optional(),box:Ee.optional(),mode:v([`alpha`,`luminance`]).optional(),density:V.optional(),feather:H.optional(),invert:C().optional(),enabled:C().optional()}),Fe=g([De,Pe]),G={enabled:C().optional(),blendMode:U.optional(),opacity:V.optional()},Ie={...G,color:W.optional(),angle:Oe.optional(),distance:H.optional(),size:H.optional()},Le=T({dropShadow:T({...Ie,spread:V.optional()}).optional(),innerShadow:T({...Ie,choke:V.optional()}).optional(),outerGlow:T({...G,color:W.optional(),spread:V.optional(),size:H.optional()}).optional(),innerGlow:T({...G,color:W.optional(),choke:V.optional(),size:H.optional(),source:v([`edge`,`center`]).optional()}).optional(),stroke:T({...G,color:W.optional(),size:H.optional(),position:v([`outside`,`inside`,`center`]).optional()}).optional(),colorOverlay:T({...G,color:W.optional()}).optional(),gradientOverlay:T({...G,gradient:Ne.optional()}).optional(),patternOverlay:T({...G,pattern:De,scale:_().min(1).max(1e3).optional()}).optional(),satin:T({...G,color:W.optional(),angle:Oe.optional(),distance:H.optional(),size:H.optional(),invert:C().optional()}).optional(),bevelEmboss:T({...G,style:v([`innerBevel`,`outerBevel`,`emboss`,`pillowEmboss`,`strokeEmboss`]).optional(),technique:v([`smooth`,`chiselHard`,`chiselSoft`]).optional(),depth:_().min(1).max(1e3).optional(),direction:v([`up`,`down`]).optional(),size:H.optional(),soften:H.optional(),angle:Oe.optional(),altitude:_().min(0).max(90).optional(),highlightMode:U.optional(),highlightColor:W.optional(),highlightOpacity:V.optional(),shadowMode:U.optional(),shadowColor:W.optional(),shadowOpacity:V.optional()}).optional()}),Re=T({rotation:_().min(-360).max(360).optional(),flipH:C().optional(),flipV:C().optional()});T({blendMode:U.optional(),opacity:V.optional(),fillOpacity:V.optional(),clipping:C().optional(),mask:Fe.optional(),effects:Le.optional(),transform:Re.optional(),visible:C().optional()});var K=_().min(0).max(255),ze=T({inputBlack:K.optional(),inputWhite:K.optional(),gamma:_().min(.1).max(9.99).optional(),outputBlack:K.optional(),outputWhite:K.optional()}),Be=E([K,K]),Ve=w(Be).min(2).max(16);b(`kind`,[T({kind:S(`levels`),rgb:ze.optional(),red:ze.optional(),green:ze.optional(),blue:ze.optional()}),T({kind:S(`curves`),rgb:Ve.optional(),red:Ve.optional(),green:Ve.optional(),blue:Ve.optional()}),T({kind:S(`brightnessContrast`),brightness:_().min(-150).max(150).optional(),contrast:_().min(-50).max(100).optional(),useLegacy:C().optional()}),T({kind:S(`hueSaturation`),hue:_().min(-180).max(180).optional(),saturation:_().min(-100).max(100).optional(),lightness:_().min(-100).max(100).optional(),colorize:C().optional()}),T({kind:S(`vibrance`),vibrance:_().min(-100).max(100).optional(),saturation:_().min(-100).max(100).optional()}),T({kind:S(`colorBalance`),shadows:E([_(),_(),_()]).optional(),midtones:E([_(),_(),_()]).optional(),highlights:E([_(),_(),_()]).optional(),preserveLuminosity:C().optional()}),T({kind:S(`blackAndWhite`),reds:_().min(-200).max(300).optional(),yellows:_().min(-200).max(300).optional(),greens:_().min(-200).max(300).optional(),cyans:_().min(-200).max(300).optional(),blues:_().min(-200).max(300).optional(),magentas:_().min(-200).max(300).optional()}),T({kind:S(`photoFilter`),color:W.optional(),density:V.optional(),preserveLuminosity:C().optional()}),T({kind:S(`invert`)}),T({kind:S(`threshold`),level:_().int().min(1).max(255).optional()}),T({kind:S(`gradientMap`),gradient:Ne.optional(),reverse:C().optional()}),T({kind:S(`exposure`),exposure:_().min(-20).max(20).optional(),offset:_().min(-.5).max(.5).optional(),gammaCorrection:_().min(.01).max(9.99).optional()})]),T({color:W.optional(),width:H.optional(),alignment:v([`inside`,`center`,`outside`]).optional(),dashes:w(_().min(0).max(1e3)).max(8).optional(),cap:v([`butt`,`round`,`square`]).optional(),join:v([`miter`,`round`,`bevel`]).optional(),opacity:V.optional()}),T({font:p().min(1).optional(),weight:_().int().min(100).max(900).optional(),italic:C().optional(),size:_().min(1).max(4096).optional(),color:W.optional(),tracking:_().min(-1e3).max(1e4).optional(),leading:g([_().min(0).max(5e3),S(`auto`)]).optional(),capitalization:v([`normal`,`allCaps`,`smallCaps`]).optional(),underline:C().optional(),strikeThrough:C().optional()}),T({justification:v([`left`,`center`,`right`,`justifyLeft`,`justifyCenter`,`justifyRight`,`justifyAll`]).optional(),firstLineIndent:_().min(-1296).max(1296).optional(),leftIndent:_().min(0).max(1296).optional(),rightIndent:_().min(0).max(1296).optional(),spaceBefore:_().min(0).max(1296).optional(),spaceAfter:_().min(0).max(1296).optional()});var He=[`pixel`,`type`,`shape`,`smartObject`,`adjustment`,`fill`,`group`],q=e(n(),1),J=E([_(),_(),_(),_()]),Ue=h({text:p(),box:J,size:_(),capHeight:_().optional(),color:p(),font:p(),weight:p(),lineHeight:_(),align:p(),letterSpacing:_().optional()}),We=h({key:p(),component:p(),kind:v(He),parent:p().optional(),hidden:C(),style:y(p(),m()),box:J.optional(),words:w(h({prop:p(),key:p(),text:p()})),texts:w(Ue),picture:h({file:p(),source:E([_(),_()]),whole:J,box:J,fit:p(),position:E([_(),_()]),crop:J.optional()}).optional()}),Ge=h({key:p(),title:p().optional(),width:x().positive(),height:x().positive(),background:p(),picture:te,layers:w(We)}),Ke=h({from:x().positive(),to:x().positive()}),qe=Ke.extend({key:p().min(1)}),Je=Ke.extend({key:p().min(1),layers:w(qe)}),Ye={"image/versions":D(h({item:A}),h({piece:p(),title:p().optional(),script:p().min(1).optional(),versions:w(h({key:p(),lang:p().optional(),variant:p().optional(),script:A.optional()}))}),`An image's versions, one per combo, and its script in each version's language.`),"image/boards":D(h({...O,height:x().min(16).max(2048).optional()}),h({image:te,width:x().positive(),height:x().positive(),boards:w(h({key:p(),width:x().positive(),height:x().positive(),x:x().nonnegative()}))}),`An image version's boards drawn side by side, in order, at one height: its card and its preview.`),"image/edit":D(h({...O,scale:_().min(.05).max(2).optional()}),h({piece:p(),boards:w(Ge)}),`An image version's boards as its viewer shows them: each drawn, and its named layers with what each draws, the messages it shows and its picture (what Mark up finds under a mark).`),"image/stage":D(h({...O,board:p().min(1).optional()}),k,"The address of an image version's stage page, for its viewer's sandboxed frame: a board drawn live, as large as the frame holds it, which moves to another board (`seek` by `part`)."),"image/sources":D(h({item:A}),h({path:A,boards:w(Je)}),`Where each board and its layers are written in the image's module, by line: what a change to those lines changes.`)},Xe=ne(Ye),Ze=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Qe(e,t){for(let n of t){let t=e.find(e=>e.key===n.key);if(!t)return{board:n.key};for(let e of n.layers){let r=t.layers.find(t=>t.key===e.key);if(!r||!Ze(r,e))return{board:n.key,layer:e.key}}if(t.layers.length!==n.layers.length)return{board:n.key}}}var $e=(e,t)=>e.from<=t.to&&t.from<=e.to,et=(e,t)=>e.filter(e=>$e(e,t)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];function tt(e,t,n=t){let r={from:t,to:n},i=et(e,r);if(!i)return;let a=et(i.layers,r);return{board:i.key,...a?{layer:a.key}:{}}}var nt=1,rt=e=>`data:${e.mime};base64,${e.data}`;function it(e){let t=s(),[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)([]),[o,c]=(0,q.useState)(new Map),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(),[h,g]=(0,q.useState)(),[_,v]=(0,q.useState)(0),y=(0,q.useRef)(0),b=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>t.on(`project/changed`,e=>{y.current=e.revision,v(e=>e+1)}),[t]),(0,q.useEffect)(()=>{if(e===void 0)return;let n={on:!0},i=y.current;return Xe(t,`image/sources`,{item:e}).then(e=>{n.on&&m(e)},()=>void 0),(async()=>{let o=(await Xe(t,`image/versions`,{item:e})).versions.map(e=>({key:e.key,lang:e.lang,variant:e.variant})),s=new Map,l;for(let n of o){let r=await Xe(t,`image/edit`,{item:e,version:n.key,scale:nt});l=r.piece,s.set(n.key,{version:n,boards:r.boards})}if(n.on){for(let[e,t]of s){let n=b.current.get(e),r=n&&Qe(n.boards,t.boards);if(r){g({spot:r,version:e,at:Date.now()});break}}b.current=s,r(l),a(o),c(s),u(void 0),f(i)}})().catch(e=>{n.on&&u(e instanceof Error?e.message:String(e))}),()=>{n.on=!1}},[t,e,_]),{item:e,piece:n,versions:i,drawn:o,revision:d,sources:p,landed:h,error:l}}var at=e=>typeof e==`object`&&!!e&&e.allyhub===!0&&typeof e.type==`string`;function ot(e){let t=s(),[n,r]=(0,q.useState)(),i=o(n),[a,c]=(0,q.useState)(new Map),l=(0,q.useRef)(new Map),u=(0,q.useRef)(1),d=e.wanted.map(e=>e.id).join(`
2
- `);return(0,q.useEffect)(()=>{if(e.item===void 0)return;let n=!0,i=e.item;return Promise.all(e.wanted.slice(0,8).map(e=>Xe(t,`image/stage`,{item:i,version:e.version,board:e.board}).then(t=>({w:e,r:t}),()=>void 0))).then(e=>{if(!n)return;let t=e.find(e=>e!==void 0);t&&r(t.r.probe),c(t=>{let n=new Map;for(let r of e){if(!r)continue;let e=t.get(r.w.id),i=()=>({n:u.current++,src:r.r.url,drawn:!1});e?.shown?e.shown.src===r.r.url?n.set(r.w.id,e):n.set(r.w.id,{shown:e.shown,pending:e.pending?.src===r.r.url?e.pending:i()}):n.set(r.w.id,{shown:i(),pending:void 0})}return n})}),()=>{n=!1}},[t,e.item,d,e.revision]),(0,q.useEffect)(()=>{let e=e=>{if(!at(e.data)||e.data.type!==`ready`)return;let t;for(let[n,r]of l.current)r.contentWindow===e.source&&(t=n);t!==void 0&&c(e=>{let n=!1,r=new Map(e);for(let[i,a]of e)a.shown?.n===t&&!a.shown.drawn?(r.set(i,{...a,shown:{...a.shown,drawn:!0}}),n=!0):a.pending?.n===t&&(r.set(i,{shown:{...a.pending,drawn:!0},pending:void 0}),n=!0);return n?r:e})};return addEventListener(`message`,e),()=>{removeEventListener(`message`,e)}},[]),{frame:(e,t)=>{let n=a.get(e);return!n||i===void 0?null:(0,L.jsx)(ct,{frames:n,sandbox:i,els:l,picture:t})},drawn:e=>a.get(e)?.shown?.drawn===!0}}function st(e){let t=/^data:([^;,]+);base64,(.*)$/su.exec(e);return t?.[1]!==void 0&&t[2]!==void 0?{mime:t[1],data:t[2]}:void 0}function ct({frames:e,sandbox:t,els:n,picture:r}){let a=(0,q.useRef)(null),o=()=>{let e=a.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0};i({element:()=>a.current,pictures:()=>{let e=o(),t=st(r);return Promise.resolve(e&&t?[{rect:e,...t}]:[])}});let s=(e,r)=>(0,L.jsx)(`iframe`,{ref:t=>{t?n.current.set(e.n,t):n.current.delete(e.n),r||(a.current=t)},src:e.src,title:``,tabIndex:-1,...t?{sandbox:`allow-scripts`}:{},"data-testid":r?`image-live-pending`:`image-live`,"data-drawn":e.drawn?``:void 0,className:`pointer-events-none absolute inset-0 size-full border-0`,style:{opacity:!r&&e.drawn?1:0}},e.n);return(0,L.jsxs)(L.Fragment,{children:[e.shown?s(e.shown,!1):null,e.pending?s(e.pending,!0):null]})}function lt(e,t,n,r){let i=e=>({x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}),a=u(n,i),o=t=>ut(e,t),s=[...e.layers].reverse(),c=e=>!e.hidden&&e.shown!==void 0&&d(n,{x:t.x+e.shown.left*t.zoom,y:t.y+e.shown.top*t.zoom,width:e.shown.width*t.zoom,height:e.shown.height*t.zoom}),l=s.filter(e=>e.kind!==`group`&&!o(e)&&c(e)),f=l.length>0?l:s.filter(e=>e.kind!==`group`&&c(e)),p=new Set,m=new Map(e.layers.map(e=>[e.key,e.parent]));for(let e of f)for(let t=e.parent;t!==void 0;t=m.get(t))p.add(t);let h=new Set([...f.map(e=>e.key),...p]);return s.filter(e=>h.has(e.key)).map(o=>{let s=[{in:`board ${e.key}`,width:e.width,height:e.height,...a,scale:1/t.zoom}],c=o.info.picture;if(c&&c.whole[2]>0&&c.whole[3]>0){let[e,r,a,o]=c.whole,[l,d]=c.source;s.push({in:`the picture`,file:c.file,width:l,height:d,...u(n,t=>{let n=i(t);return{x:(n.x-e)*l/a,y:(n.y-r)*d/o}}),scale:l/a/t.zoom})}return{...dt(e,o,r),regions:s}})}var ut=(e,t)=>(t.kind===`adjustment`||t.kind===`fill`)&&t.box!==void 0&&t.box.left<=0&&t.box.top<=0&&t.box.left+t.box.width>=e.width&&t.box.top+t.box.height>=e.height;function dt(e,t,n){let r=t.info.picture,i=t.info.words[0]?.text??t.info.texts[0]?.text,a=n.lineOf(t.key);return{name:`layer ${t.name===t.key?`"${t.key}"`:`"${t.key}" (${t.name})`}, a ${t.kind}${r?` of ${r.file}`:``}, of board ${e.key}`,source:{path:n.file,...a===void 0?{}:{line:a}},...i===void 0?{}:{text:i}}}function ft(e,t,n){let r=(n.x-t.x)/t.zoom,i=(n.y-t.y)/t.zoom,a=e=>!e.hidden&&e.kind!==`group`&&e.shown!==void 0&&r>=e.shown.left&&r<=e.shown.left+e.shown.width&&i>=e.shown.top&&i<=e.shown.top+e.shown.height,o=[...e.layers].reverse();return o.find(t=>a(t)&&!ut(e,t))??o.find(a)}function pt(e,t,n,r){if(n.shown!==void 0)return{element:dt(e,n,r),outline:c({x:t.x+n.shown.left*t.zoom,y:t.y+n.shown.top*t.zoom,width:n.shown.width*t.zoom,height:n.shown.height*t.zoom})}}function mt(e,t){let n=e.split(`
3
- `).findIndex(e=>RegExp(`key:\\s*["'\`]${t.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}["'\`]`,`u`).test(e));return n<0?void 0:n+1}var ht=e=>e===void 0?void 0:{left:e[0],top:e[1],width:e[2],height:e[3]};function gt(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:void 0}function _t(e){let t=new Map;for(let n of e){let e=n.info.style.clipping===!0&&n.kind!==`group`,r=e?t.get(n.parent):void 0;n.shown=r===void 0?n.box:r.shown&&n.box?gt(n.box,r.shown):void 0,e||t.set(n.parent,n)}}function vt(e,t,n){let r=t.layers.map(e=>({key:e.key,name:e.key,component:e.component,kind:e.kind,hidden:e.hidden,parent:e.parent,box:ht(e.box),shown:void 0,info:e}));return _t(r),{version:e,key:t.key,title:t.title??t.key,width:t.width,height:t.height,background:t.background,picture:n,layers:r}}function yt(e,t,n){return e.flatMap(e=>{let r=t.get(e.key);return r?[r.boards.map(t=>vt(e,t,n(t.picture)))]:[]})}var Y=48,bt=80,xt=20,St=22,Ct=26,X=40,Z=(e,t)=>`${e} ${t}`;function wt(e){let t=[];for(let n of e)n.forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.width)});return t}var Tt=e=>Math.max(xt,bt*e);function Et(e,t){let n=wt(e),r=e.length>1;return{width:n.reduce((e,n)=>e+n*t,0)+Tt(t)*Math.max(0,n.length-1)+96,height:e.reduce((e,n)=>e+Math.max(0,...n.map(e=>e.height))*t+St+(r?Ct:0),0)+X*Math.max(0,e.length-1)+96}}function Dt(e,t,n,r){let i=wt(e),a=Tt(t),o=Et(e,t),s=Math.max(0,((r?.width??0)-o.width)/2),c=Math.max(0,((r?.height??0)-o.height)/2),l=new Map,u=[],d=c+Y,f=0,p=e.length>1;for(let r of e){let e=r[0];p&&e&&(u.push({x:s+Y,y:d,label:n(e)}),d+=Ct);let o=d;d+=St;let c=s+Y,m=0;r.forEach((e,n)=>{l.set(Z(e.version.key,e.key),{x:c,y:d,labelY:o}),c+=(i[n]??e.width)*t+a,m=Math.max(m,e.height*t)}),f=Math.max(f,c-a+Y+s),d+=m+X}return{width:f,height:d-X+Y+c,boards:l,rows:u}}function Ot(e,t){let n=wt(e);if(n.length===0||t.width<=0||t.height<=0)return 1;let r=n.reduce((e,t)=>e+t,0),i=n.length-1,a=(t.width-96)/(r+bt*i),o=bt*a>=xt?a:(t.width-96-xt*i)/r,s=e.reduce((e,t)=>e+Math.max(...t.map(e=>e.height)),0),c=e.length*(St+(e.length>1?Ct:0))+X*(e.length-1),l=Math.min(o,(t.height-96-c)/s,1);return Math.max(.02,l)}var Q=e=>`${String(e)}px`,$=e=>`${String(e*100)}%`;function kt(e){let t=e.board.layers.find(t=>t.key===e.layer)?.shown;return t?(0,L.jsx)(`div`,{"data-note-chrome":``,"data-testid":e.selected?`image-selected`:`image-hovered`,"data-layer":e.layer,className:e.selected?`outline-pencil absolute shadow-[0_0_0_4px_var(--color-sheet),inset_0_0_0_2px_var(--color-sheet)] outline-2`:`outline-pencil absolute shadow-[0_0_0_2px_var(--color-sheet),inset_0_0_0_1px_var(--color-sheet)] outline-1`,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)},children:e.selected&&e.bar!==void 0?(0,L.jsx)(`div`,{className:`pointer-events-auto absolute top-full left-1/2 mt-2 -translate-x-1/2`,children:e.bar}):null}):null}function At(e){let t=(e.agent.layer===void 0?void 0:e.board.layers.find(t=>t.key===e.agent.layer))?.box;return t?(0,L.jsx)(I,{"data-testid":`image-agent`,label:e.agent.label,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)}}):(0,L.jsx)(I,{"data-testid":`image-agent`,label:e.agent.label,flag:`end`,className:`inset-0`})}function jt(e){let t=R(),{board:n,zoom:r}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-lead text-micro absolute flex h-5 items-end gap-2 truncate`,style:{left:Q(e.at.x),top:Q(e.at.labelY),width:Q(n.width*r)},"data-testid":`image-board-label`,children:[(0,L.jsx)(`span`,{className:`text-ink truncate font-medium`,children:n.title}),n.title.replace(/\s/gu,``).toLowerCase().replace(`×`,`x`).includes(`${String(n.width)}x${String(n.height)}`)?null:(0,L.jsx)(`span`,{className:`tabular-nums`,children:t.size(n.width,n.height)})]}),(0,L.jsxs)(`div`,{className:`bg-sheet absolute overflow-hidden shadow-[0_0_0_1px_var(--color-rule)]`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},"data-testid":`image-board`,"data-board":n.key,"data-version":n.version.key,children:[(0,L.jsx)(`img`,{src:n.picture,alt:``,draggable:!1,className:`absolute inset-0 size-full max-w-none select-none`}),e.frame]}),e.agent||e.hovered!==void 0||e.selected!==void 0?(0,L.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},children:[e.agent?(0,L.jsx)(At,{board:n,agent:e.agent}):null,e.hovered===void 0?null:(0,L.jsx)(kt,{board:n,layer:e.hovered,selected:!1}),e.selected===void 0?null:(0,L.jsx)(kt,{board:n,layer:e.selected,selected:!0,bar:e.selectionBar})]}):null]})}function Mt({ref:e,...t}){let n=(0,q.useRef)(null),r=(0,q.useCallback)(t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),i=(0,q.useRef)(t.onZoomAt);return(0,q.useEffect)(()=>{i.current=t.onZoomAt}),(0,q.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=e.getBoundingClientRect();i.current(Math.exp(-t.deltaY/200),{x:t.clientX-n.left,y:t.clientY-n.top})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]),(0,L.jsx)(`div`,{ref:r,className:`bg-stone focus-visible:outline-pencil relative min-h-0 min-w-0 flex-1 overflow-auto outline-none focus-visible:-outline-offset-1 focus-visible:outline-1`,tabIndex:0,role:`application`,"aria-label":t.label,"data-testid":`image-surface`,style:{cursor:t.cursor},onPointerDown:t.onPointerDown,onPointerMove:t.onPointerMove,onPointerUp:t.onPointerUp,onPointerCancel:t.onPointerUp,onLostPointerCapture:t.onPointerUp,onPointerLeave:t.onPointerLeave,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,children:(0,L.jsxs)(`div`,{className:`relative`,style:{width:Q(t.layout.width),height:Q(t.layout.height)},"data-testid":`image-world`,children:[t.layout.rows.map(e=>(0,L.jsx)(`div`,{className:`text-lead absolute text-xs font-medium`,style:{left:Q(e.x),top:Q(e.y)},"data-testid":`image-row-label`,children:e.label},e.y)),t.rows.flatMap(e=>e.map(e=>{let n=Z(e.version.key,e.key),r=t.layout.boards.get(n);return r?(0,L.jsx)(jt,{board:e,zoom:t.zoom,at:r,frame:t.frame?.(n,e.picture),agent:t.agent?.id===n?{label:t.agent.label,layer:t.agent.layer}:void 0,hovered:t.hovered?.id===n?t.hovered.layer:void 0,selected:t.selected?.id===n?t.selected.layer:void 0,selectionBar:t.selectionBar},n):null}))]})})}function Nt(e,t){if(e!==void 0)try{return new Intl.DisplayNames([t??`en`],{type:`language`}).of(e)}catch{return e}}var Pt=3e4;function Ft(e){let t=e?.board??e?.part;if(typeof t!=`string`)return;let n=e?.layer;return typeof n==`string`?{board:t,layer:n}:{board:t}}var It=e=>e instanceof Element&&e.closest(`input, textarea, [contenteditable='true'], [role='combobox']`)!==null;function Lt(e){return e.bar(e.tools)}function Rt(e){let n=R(),i=s(),o=r(),c=(0,q.useMemo)(()=>yt(e.data.versions,e.data.drawn,rt),[e.data.versions,e.data.drawn]),u=c.flat(),d=(0,q.useRef)(null),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!0),[g,_]=(0,q.useState)(`default`),[v,y]=(0,q.useState)(!1),b=(0,q.useRef)(void 0),x=e=>[Nt(e.version.lang,o?.locale),e.version.variant].filter(e=>e!==void 0).join(` · `)||e.version.key,[S,C]=(0,q.useState)();(0,q.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{C(t=>t?.width===e.offsetWidth&&t.height===e.offsetHeight?t:{width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let w=m&&S&&c.length>0?Ot(c,S):f??1,ee=(0,q.useMemo)(()=>Dt(c,w,x,S),[c,w,o?.locale,S]),T=(0,q.useRef)(void 0);(0,q.useLayoutEffect)(()=>{let e=d.current,t=T.current;if(!e||!t)return;T.current=void 0;let n=w/t.from;e.scrollLeft=(e.scrollLeft+t.at.x)*n-t.at.x,e.scrollTop=(e.scrollTop+t.at.y)*n-t.at.y},[w]);let E=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(E.current||e.board===void 0||c.length===0)return;let t=d.current?.querySelector(`[data-testid="image-board"][data-board="${CSS.escape(e.board)}"]`);t&&(E.current=!0,t.scrollIntoView({block:`nearest`,inline:`nearest`}))},[e.board,c.length,ee]);let{agent:D,following:te}=t(),O=ce(),k=(()=>{if(D?.doing===void 0)return;let{landed:t,sources:n}=e.data,r=D.source,i=r?.path!==void 0&&r.path===n?.path&&r.from!==void 0?tt(n.boards,r.from,r.to):void 0,a=t&&t.at>=D.at-Pt?t:void 0,o=Ft(D.place)??i??a?.spot;if(!o)return;let s=u.filter(e=>e.key===o.board),c=s.find(e=>e.version.key===a?.version)??s[0];if(!c)return;let l=c.layers.some(e=>e.key===o.layer)?o.layer:void 0;return{id:Z(c.version.key,c.key),layer:l,label:O(D)}})(),A=te&&k?`${k.id}\n${k.layer??``}`:void 0;(0,q.useEffect)(()=>{let e=d.current;if(A===void 0||!e)return;let[t=``,n=``]=A.split(`
4
- `),r=u.find(e=>Z(e.version.key,e.key)===t),i=ee.boards.get(t);if(!r||!i)return;let a=r.layers.find(e=>e.key===n)?.box??{left:0,top:0,width:r.width,height:r.height},o=(e,t,n,r)=>t+96>r||e-48<n?e-48:e+t+48>n+r?e+t+48-r:n;e.scrollTo({left:o(i.x+a.left*w,a.width*w,e.scrollLeft,e.clientWidth),top:o(i.y+a.top*w,a.height*w,e.scrollTop,e.clientHeight)})},[A]);let ne=ot({item:e.data.item,wanted:u.map(e=>({id:Z(e.version.key,e.key),version:e.version.key,board:e.key})),revision:e.data.revision}),re=(e,t)=>{h(!1);let n=d.current;T.current={at:t??{x:(n?.clientWidth??0)/2,y:(n?.clientHeight??0)/2},from:w},p(Math.min(8,Math.max(.02,e)))},j=e=>{e===`fit`?h(!0):re(typeof e==`number`?e:w*(e===`in`?1.25:.8))},ie=(e,t)=>d.current?.querySelector(`[data-testid="image-board"][data-version="${CSS.escape(e)}"][data-board="${CSS.escape(t)}"]`)?.getBoundingClientRect(),ae=(0,q.useRef)(``),M=e=>{for(let t of u){let n=ie(t.version.key,t.key);if(n&&e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return{b:t,r:n}}},oe=de()!==void 0,[se,N]=(0,q.useState)(),[P,me]=(0,q.useState)(),F=(e,t)=>({x:e.x,y:e.y,zoom:e.width/t.width}),ve=e=>{let t=M(e),n=t?ft(t.b,F(t.r,t.b),e):void 0;return t&&n?{id:Z(t.b.version.key,t.b.key),layer:n.key}:void 0},ye=(e,t)=>e?.id===t?.id&&e?.layer===t?.layer,xe={file:e.entry,lineOf:e=>mt(ae.current,e)},I=t=>{let n=Nt(t.version.lang,`en`);return`on board ${t.key}${n===void 0||e.data.versions.length<2?``:` (${n})`}`},Se=e=>{d.current?.focus({preventScroll:!0});let t=d.current;if(oe&&!v&&e.button!==1){let t=ve({x:e.clientX,y:e.clientY});(e.button===0||t)&&me(t)}(v||e.button===1)&&t&&(e.currentTarget.setPointerCapture(e.pointerId),b.current={x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},_(`grabbing`))},z=()=>{b.current&&(b.current=void 0,_(v?`grab`:`default`))};return a({hold:async()=>(ae.current=await i[`files/read`]({path:e.entry}).then(e=>e.text,()=>``),{key:`${e.entry}@${String(e.data.revision)}`,what:`The image ${e.entry}, its boards side by side${e.data.versions.length>1?`, a version a row`:``}`,source:{path:e.entry}}),locate:t=>{let n=l(t)[0],r=n?M(n):void 0;if(!n||!r)return Promise.resolve({elements:[]});let i=Nt(r.b.version.lang,`en`),a=e=>`${String(Math.round(Math.min(1,Math.max(0,e))*100))}%`,o=a((n.x-r.r.x)/r.r.width),s=a((n.y-r.r.y)/r.r.height);return Promise.resolve({elements:lt(r.b,{x:r.r.x,y:r.r.y,zoom:r.r.width/r.b.width},t,{file:e.entry,lineOf:e=>mt(ae.current,e)}),where:`on board ${r.b.key}${i===void 0||e.data.versions.length<2?``:` (${i})`}, at ${o} across and ${s} down it`})},pick:e=>{let t=M(e),n=t?ft(t.b,F(t.r,t.b),e):void 0,r=t&&n?pt(t.b,F(t.r,t.b),n,xe):void 0;return Promise.resolve(t&&r?{...r,where:I(t.b)}:void 0)},selected:()=>{let e=u.find(e=>Z(e.version.key,e.key)===P?.id),t=e?.layers.find(e=>e.key===P?.layer),n=e?ie(e.version.key,e.key):void 0,r=e&&t&&n?pt(e,F(n,e),t,xe):void 0;return Promise.resolve(e&&r?[{...r,where:I(e)}]:[])}}),(0,L.jsxs)(`div`,{className:`relative flex size-full min-h-0 flex-col`,"data-testid":`image-viewer`,children:[(0,L.jsx)(Lt,{bar:e.bar,tools:{zoom:w,onZoom:j}}),(0,L.jsxs)(pe,{children:[(0,L.jsx)(le,{asChild:!0,children:(0,L.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[e.data.error===void 0?null:(0,L.jsx)(be,{}),(0,L.jsx)(Mt,{ref:d,rows:c,layout:ee,zoom:w,cursor:v&&g==="default"?`grab`:g,frame:ne.frame,agent:k,hovered:ye(se,P)?void 0:se,selected:P,selectionBar:(0,L.jsx)(ue,{}),onPointerLeave:()=>{N(void 0)},onPointerDown:Se,onPointerMove:e=>{let t=b.current,n=d.current;if(t&&e.buttons===0){z();return}if(t&&n){n.scrollLeft=t.left-(e.clientX-t.x),n.scrollTop=t.top-(e.clientY-t.y);return}if(!oe)return;let r=v||e.buttons!==0?void 0:ve({x:e.clientX,y:e.clientY});ye(r,se)||N(r)},onPointerUp:z,onKeyDown:e=>{if(It(e.target))return;let t=e.metaKey||e.ctrlKey,n=e.key===`Escape`&&P?()=>{me(void 0)}:e.key===` `?()=>{e.repeat||y(!0),_(`grab`)}:e.shiftKey&&e.code===`Digit1`?()=>{j(`fit`)}:e.shiftKey&&e.code===`Digit0`?()=>{j(1)}:t&&(e.key===`=`||e.key===`+`)?()=>{j(`in`)}:t&&e.key===`-`?()=>{j(`out`)}:void 0;n&&(e.preventDefault(),n())},onKeyUp:e=>{e.key===` `&&(y(!1),_(`default`))},onZoomAt:(e,t)=>{re(w*e,t)},label:n.boards})]})}),(0,L.jsxs)(_e,{className:`w-60`,"data-testid":`image-menu`,children:[(0,L.jsxs)(fe,{onSelect:()=>{j(`fit`)},children:[n.zoomFit,(0,L.jsx)(ge,{children:`⇧1`})]}),(0,L.jsx)(he,{})]})]})]})}var zt=e=>typeof e==`object`&&!!e&&typeof e.board==`string`;function Bt(){let e=R(),t=r(),n=it(t?.item.id);if(n.piece===void 0||t===void 0)return(0,L.jsx)(`div`,{className:`text-lead bg-paper flex size-full items-center justify-center text-sm`,"data-testid":`image-editor`,"data-state":n.error===void 0?`loading`:`updating`,children:n.error===void 0?(0,L.jsx)(ye,{label:e.loading}):(0,L.jsx)(xe,{})});let i=zt(t.place)?t.place:void 0;return(0,L.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`image-editor`,"data-state":`ready`,children:[(0,L.jsx)(Rt,{entry:t.item.entry,data:n,board:i?.board,bar:t=>(0,L.jsx)(P,{start:(0,L.jsx)(F,{testid:`image-bar`,"aria-label":e.zoom,children:(0,L.jsx)(Ce,{...t})}),exports:{versions:n.versions.map(e=>({key:e.key,label:e.lang??e.key})),facts:e.boardCount(n.drawn.values().next().value?.boards.length??0)}})}),n.drawn.size>0&&[...n.drawn.values()].every(e=>e.boards.length===0)?(0,L.jsx)(`p`,{className:`text-lead p-6 text-sm`,children:e.noBoards}):null]})}export{Bt as ImageEditor,Bt as default,Se as WORDS};