@powerhousedao/powerhouse-vetra-packages 6.0.2-staging.8 → 6.1.0-dev.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 (262) hide show
  1. package/dist/browser/{connect-ysCIyOu6.js → connect-CKdlDSUw.js} +600 -396
  2. package/dist/browser/connect-CKdlDSUw.js.map +1 -0
  3. package/dist/browser/{dist-CTgmb7N2.js → dist-BXygvBtd.js} +1 -1
  4. package/dist/browser/{dist-CTgmb7N2.js.map → dist-BXygvBtd.js.map} +1 -1
  5. package/dist/browser/dist-CC1E3l2O.js +466 -0
  6. package/dist/browser/dist-CC1E3l2O.js.map +1 -0
  7. package/dist/browser/{dist-OuHji4IC.js → dist-DOMEWT3x.js} +187 -82
  8. package/dist/browser/dist-DOMEWT3x.js.map +1 -0
  9. package/dist/browser/{document-drive-CN2AY1E7.js → dist-DQgJ8n4d.js} +1512 -261
  10. package/dist/browser/dist-DQgJ8n4d.js.map +1 -0
  11. package/dist/browser/document-models/index.js +1 -1
  12. package/dist/browser/{documents-Bhv2cQRX.js → documents-Bpu0aSLb.js} +21 -22
  13. package/dist/browser/{documents-Bhv2cQRX.js.map → documents-Bpu0aSLb.js.map} +1 -1
  14. package/dist/browser/{editor-C3zIQaIt.js → editor-B3yz7YdR.js} +28 -52
  15. package/dist/browser/editor-B3yz7YdR.js.map +1 -0
  16. package/dist/browser/{editor-DTI3f60r.js → editor-Dm_73jiz.js} +5 -5
  17. package/dist/browser/{editor-DTI3f60r.js.map → editor-Dm_73jiz.js.map} +1 -1
  18. package/dist/browser/editors/document-model-editor/module.js +1 -1
  19. package/dist/browser/editors/generic-drive-explorer/index.js +6 -6
  20. package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
  21. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  22. package/dist/browser/{folder-view-MAKSRYgy.js → folder-view-H2ov-zId.js} +3 -3
  23. package/dist/browser/{folder-view-MAKSRYgy.js.map → folder-view-H2ov-zId.js.map} +1 -1
  24. package/dist/browser/{graphql-editor-DHW3IM4Q.js → graphql-editor-CnaQ3XWx.js} +6 -6
  25. package/dist/browser/{graphql-editor-DHW3IM4Q.js.map → graphql-editor-CnaQ3XWx.js.map} +1 -1
  26. package/dist/browser/{hooks-DoEQ3wS2.js → hooks-Beny0xpe.js} +2 -2
  27. package/dist/browser/{hooks-DoEQ3wS2.js.map → hooks-Beny0xpe.js.map} +1 -1
  28. package/dist/browser/index.js +7 -2
  29. package/dist/browser/index.js.map +1 -1
  30. package/dist/browser/{json-editor-C_qVI2VR.js → json-editor-h3cffF6X.js} +2 -2
  31. package/dist/browser/{json-editor-C_qVI2VR.js.map → json-editor-h3cffF6X.js.map} +1 -1
  32. package/dist/browser/{parser-CO9mSyAT.js → parser-B0sh99Kk.js} +1 -1
  33. package/dist/browser/{parser-CO9mSyAT.js.map → parser-B0sh99Kk.js.map} +1 -1
  34. package/dist/browser/{schema-context-Cif2-trz.js → schema-context-C0GpuR27.js} +3 -3
  35. package/dist/browser/{schema-context-Cif2-trz.js.map → schema-context-C0GpuR27.js.map} +1 -1
  36. package/dist/browser/{schemas-D47w5Bks.js → schemas-Bqem6NRm.js} +37 -2
  37. package/dist/browser/{schemas-D47w5Bks.js.map → schemas-Bqem6NRm.js.map} +1 -1
  38. package/dist/browser/{state-schemas-BMIVUBp7.js → state-schemas-C5NPeV6-.js} +25 -26
  39. package/dist/browser/state-schemas-C5NPeV6-.js.map +1 -0
  40. package/dist/browser/{style-X7kuUXNl.js → style-DYS_RFSN.js} +8 -8
  41. package/dist/browser/{style-X7kuUXNl.js.map → style-DYS_RFSN.js.map} +1 -1
  42. package/dist/browser/tslib.es6-DRuVAsR8.js +32 -0
  43. package/dist/browser/tslib.es6-DRuVAsR8.js.map +1 -0
  44. package/dist/node/{connect-C_m9ZK7D.mjs → connect-SGvLzr5K.mjs} +601 -417
  45. package/dist/node/connect-SGvLzr5K.mjs.map +1 -0
  46. package/dist/node/{dist-DnalgmqP.mjs → dist-1kPMPFPD.mjs} +188 -595
  47. package/dist/node/dist-1kPMPFPD.mjs.map +1 -0
  48. package/dist/node/{dist-Bqlh0vGY.mjs → dist-BQTIepWC.mjs} +1 -1
  49. package/dist/node/{dist-Bqlh0vGY.mjs.map → dist-BQTIepWC.mjs.map} +1 -1
  50. package/dist/node/{document-drive-DKH0m2I3.mjs → dist-Bz4SgEHs.mjs} +1529 -261
  51. package/dist/node/dist-Bz4SgEHs.mjs.map +1 -0
  52. package/dist/node/dist-Cay1iRRr.mjs +491 -0
  53. package/dist/node/dist-Cay1iRRr.mjs.map +1 -0
  54. package/dist/node/document-models/index.mjs +1 -1
  55. package/dist/node/{documents-DqbIqAWu.mjs → documents-BWJpUm9f.mjs} +21 -22
  56. package/dist/node/{documents-DqbIqAWu.mjs.map → documents-BWJpUm9f.mjs.map} +1 -1
  57. package/dist/node/{editor-CrL70pxP.mjs → editor-BaXuDsby.mjs} +5 -5
  58. package/dist/node/{editor-CrL70pxP.mjs.map → editor-BaXuDsby.mjs.map} +1 -1
  59. package/dist/node/{editor-P1P79LKV.mjs → editor-W8QOlGXD.mjs} +24 -48
  60. package/dist/node/editor-W8QOlGXD.mjs.map +1 -0
  61. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  62. package/dist/node/editors/generic-drive-explorer/index.mjs +6 -6
  63. package/dist/node/editors/generic-drive-explorer/index.mjs.map +1 -1
  64. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  65. package/dist/node/{folder-view-D2GQYGF2.mjs → folder-view-B0FNXbc0.mjs} +3 -3
  66. package/dist/node/{folder-view-D2GQYGF2.mjs.map → folder-view-B0FNXbc0.mjs.map} +1 -1
  67. package/dist/node/{graphql-DntS4PVi.mjs → graphql-Du2phcBf.mjs} +2 -2
  68. package/dist/node/{graphql-DntS4PVi.mjs.map → graphql-Du2phcBf.mjs.map} +1 -1
  69. package/dist/node/{graphql-editor-SqVKbYGB.mjs → graphql-editor-D1koK5kR.mjs} +5 -5
  70. package/dist/node/{graphql-editor-SqVKbYGB.mjs.map → graphql-editor-D1koK5kR.mjs.map} +1 -1
  71. package/dist/node/{hooks-DWvMS6v8.mjs → hooks-Lbsf6g-v.mjs} +2 -2
  72. package/dist/node/{hooks-DWvMS6v8.mjs.map → hooks-Lbsf6g-v.mjs.map} +1 -1
  73. package/dist/node/index.mjs +7 -2
  74. package/dist/node/index.mjs.map +1 -1
  75. package/dist/node/{json-editor-FEIiQIZ2.mjs → json-editor-CVGgDVh2.mjs} +2 -2
  76. package/dist/node/{json-editor-FEIiQIZ2.mjs.map → json-editor-CVGgDVh2.mjs.map} +1 -1
  77. package/dist/node/{schema-context-bgyHwiqj.mjs → schema-context-mLgEY1Hh.mjs} +3 -3
  78. package/dist/node/{schema-context-bgyHwiqj.mjs.map → schema-context-mLgEY1Hh.mjs.map} +1 -1
  79. package/dist/node/{schemas-CHri6jtV.mjs → schemas-Cb8uEF9u.mjs} +37 -2
  80. package/dist/node/{schemas-CHri6jtV.mjs.map → schemas-Cb8uEF9u.mjs.map} +1 -1
  81. package/dist/node/{state-schemas-BEZasnwL.mjs → state-schemas-DAthoEEk.mjs} +17 -18
  82. package/dist/node/state-schemas-DAthoEEk.mjs.map +1 -0
  83. package/dist/node/{style-D3-CDNqD.mjs → style-CxHkfyna.mjs} +8 -8
  84. package/dist/node/{style-D3-CDNqD.mjs.map → style-CxHkfyna.mjs.map} +1 -1
  85. package/dist/node/tslib.es6-DwVpIYUS.mjs +545 -0
  86. package/dist/node/tslib.es6-DwVpIYUS.mjs.map +1 -0
  87. package/dist/style.css +12 -16
  88. package/package.json +26 -16
  89. package/dist/browser/chunk-YKewjYmz.js +0 -37
  90. package/dist/browser/connect-ysCIyOu6.js.map +0 -1
  91. package/dist/browser/dist-Cglb3DjH.js +0 -139
  92. package/dist/browser/dist-Cglb3DjH.js.map +0 -1
  93. package/dist/browser/dist-OuHji4IC.js.map +0 -1
  94. package/dist/browser/document-drive-CN2AY1E7.js.map +0 -1
  95. package/dist/browser/document-timeline-BTTeXWMa-DQCUJzMB.js +0 -3174
  96. package/dist/browser/document-timeline-BTTeXWMa-DQCUJzMB.js.map +0 -1
  97. package/dist/browser/editor-C3zIQaIt.js.map +0 -1
  98. package/dist/browser/jszip.min-DnuABTaX.js +0 -3111
  99. package/dist/browser/jszip.min-DnuABTaX.js.map +0 -1
  100. package/dist/browser/state-schemas-BMIVUBp7.js.map +0 -1
  101. package/dist/build.d.ts +0 -2
  102. package/dist/build.d.ts.map +0 -1
  103. package/dist/document-models/document-model/index.d.ts +0 -2
  104. package/dist/document-models/document-model/index.d.ts.map +0 -1
  105. package/dist/document-models/document-model/test/document-skip-operations.test.d.ts +0 -2
  106. package/dist/document-models/document-model/test/document-skip-operations.test.d.ts.map +0 -1
  107. package/dist/document-models/document-model/test/prune.test.d.ts +0 -2
  108. package/dist/document-models/document-model/test/prune.test.d.ts.map +0 -1
  109. package/dist/document-models/document-model/test/reducer.test.d.ts +0 -2
  110. package/dist/document-models/document-model/test/reducer.test.d.ts.map +0 -1
  111. package/dist/document-models/document-model/test/skip-operations.test.d.ts +0 -2
  112. package/dist/document-models/document-model/test/skip-operations.test.d.ts.map +0 -1
  113. package/dist/document-models/document-model/test/validation.test.d.ts +0 -2
  114. package/dist/document-models/document-model/test/validation.test.d.ts.map +0 -1
  115. package/dist/document-models/document-model/test/versioning.test.d.ts +0 -2
  116. package/dist/document-models/document-model/test/versioning.test.d.ts.map +0 -1
  117. package/dist/document-models/document-model/test/zip.test.d.ts +0 -2
  118. package/dist/document-models/document-model/test/zip.test.d.ts.map +0 -1
  119. package/dist/document-models/document-models.d.ts +0 -3
  120. package/dist/document-models/document-models.d.ts.map +0 -1
  121. package/dist/document-models/index.d.ts +0 -3
  122. package/dist/document-models/index.d.ts.map +0 -1
  123. package/dist/editors/document-model-editor/components/button.d.ts +0 -2
  124. package/dist/editors/document-model-editor/components/button.d.ts.map +0 -1
  125. package/dist/editors/document-model-editor/components/code-editors/constants.d.ts +0 -3
  126. package/dist/editors/document-model-editor/components/code-editors/constants.d.ts.map +0 -1
  127. package/dist/editors/document-model-editor/components/code-editors/factories.d.ts +0 -4
  128. package/dist/editors/document-model-editor/components/code-editors/factories.d.ts.map +0 -1
  129. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.d.ts +0 -10
  130. package/dist/editors/document-model-editor/components/code-editors/graphql-editor.d.ts.map +0 -1
  131. package/dist/editors/document-model-editor/components/code-editors/hooks.d.ts +0 -23
  132. package/dist/editors/document-model-editor/components/code-editors/hooks.d.ts.map +0 -1
  133. package/dist/editors/document-model-editor/components/code-editors/json-editor.d.ts +0 -8
  134. package/dist/editors/document-model-editor/components/code-editors/json-editor.d.ts.map +0 -1
  135. package/dist/editors/document-model-editor/components/code-editors/linting.d.ts +0 -6
  136. package/dist/editors/document-model-editor/components/code-editors/linting.d.ts.map +0 -1
  137. package/dist/editors/document-model-editor/components/divider.d.ts +0 -8
  138. package/dist/editors/document-model-editor/components/divider.d.ts.map +0 -1
  139. package/dist/editors/document-model-editor/components/errors.d.ts +0 -6
  140. package/dist/editors/document-model-editor/components/errors.d.ts.map +0 -1
  141. package/dist/editors/document-model-editor/components/form.d.ts +0 -12
  142. package/dist/editors/document-model-editor/components/form.d.ts.map +0 -1
  143. package/dist/editors/document-model-editor/components/input.d.ts +0 -6
  144. package/dist/editors/document-model-editor/components/input.d.ts.map +0 -1
  145. package/dist/editors/document-model-editor/components/label.d.ts +0 -6
  146. package/dist/editors/document-model-editor/components/label.d.ts.map +0 -1
  147. package/dist/editors/document-model-editor/components/model-metadata-form.d.ts +0 -31
  148. package/dist/editors/document-model-editor/components/model-metadata-form.d.ts.map +0 -1
  149. package/dist/editors/document-model-editor/components/module-form.d.ts +0 -10
  150. package/dist/editors/document-model-editor/components/module-form.d.ts.map +0 -1
  151. package/dist/editors/document-model-editor/components/module.d.ts +0 -22
  152. package/dist/editors/document-model-editor/components/module.d.ts.map +0 -1
  153. package/dist/editors/document-model-editor/components/modules.d.ts +0 -20
  154. package/dist/editors/document-model-editor/components/modules.d.ts.map +0 -1
  155. package/dist/editors/document-model-editor/components/operation-description-form.d.ts +0 -9
  156. package/dist/editors/document-model-editor/components/operation-description-form.d.ts.map +0 -1
  157. package/dist/editors/document-model-editor/components/operation-error-form.d.ts +0 -13
  158. package/dist/editors/document-model-editor/components/operation-error-form.d.ts.map +0 -1
  159. package/dist/editors/document-model-editor/components/operation-errors.d.ts +0 -10
  160. package/dist/editors/document-model-editor/components/operation-errors.d.ts.map +0 -1
  161. package/dist/editors/document-model-editor/components/operation-form.d.ts +0 -13
  162. package/dist/editors/document-model-editor/components/operation-form.d.ts.map +0 -1
  163. package/dist/editors/document-model-editor/components/operation.d.ts +0 -23
  164. package/dist/editors/document-model-editor/components/operation.d.ts.map +0 -1
  165. package/dist/editors/document-model-editor/components/operations.d.ts +0 -18
  166. package/dist/editors/document-model-editor/components/operations.d.ts.map +0 -1
  167. package/dist/editors/document-model-editor/components/state-error.d.ts +0 -5
  168. package/dist/editors/document-model-editor/components/state-error.d.ts.map +0 -1
  169. package/dist/editors/document-model-editor/components/state-schemas.d.ts +0 -15
  170. package/dist/editors/document-model-editor/components/state-schemas.d.ts.map +0 -1
  171. package/dist/editors/document-model-editor/components/tabs.d.ts +0 -8
  172. package/dist/editors/document-model-editor/components/tabs.d.ts.map +0 -1
  173. package/dist/editors/document-model-editor/components/text-area.d.ts +0 -9
  174. package/dist/editors/document-model-editor/components/text-area.d.ts.map +0 -1
  175. package/dist/editors/document-model-editor/components/text-field.d.ts +0 -21
  176. package/dist/editors/document-model-editor/components/text-field.d.ts.map +0 -1
  177. package/dist/editors/document-model-editor/config.d.ts +0 -3
  178. package/dist/editors/document-model-editor/config.d.ts.map +0 -1
  179. package/dist/editors/document-model-editor/constants/documents.d.ts +0 -13
  180. package/dist/editors/document-model-editor/constants/documents.d.ts.map +0 -1
  181. package/dist/editors/document-model-editor/constants/graphql-kinds.d.ts +0 -9
  182. package/dist/editors/document-model-editor/constants/graphql-kinds.d.ts.map +0 -1
  183. package/dist/editors/document-model-editor/context/form-context.d.ts +0 -11
  184. package/dist/editors/document-model-editor/context/form-context.d.ts.map +0 -1
  185. package/dist/editors/document-model-editor/context/schema-context.d.ts +0 -18
  186. package/dist/editors/document-model-editor/context/schema-context.d.ts.map +0 -1
  187. package/dist/editors/document-model-editor/editor.d.ts +0 -2
  188. package/dist/editors/document-model-editor/editor.d.ts.map +0 -1
  189. package/dist/editors/document-model-editor/hooks/index.d.ts +0 -3
  190. package/dist/editors/document-model-editor/hooks/index.d.ts.map +0 -1
  191. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.d.ts +0 -5
  192. package/dist/editors/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +0 -1
  193. package/dist/editors/document-model-editor/hooks/useFormField.d.ts +0 -13
  194. package/dist/editors/document-model-editor/hooks/useFormField.d.ts.map +0 -1
  195. package/dist/editors/document-model-editor/index.d.ts +0 -2
  196. package/dist/editors/document-model-editor/index.d.ts.map +0 -1
  197. package/dist/editors/document-model-editor/module.d.ts +0 -3
  198. package/dist/editors/document-model-editor/module.d.ts.map +0 -1
  199. package/dist/editors/document-model-editor/schemas/inputs.d.ts +0 -25
  200. package/dist/editors/document-model-editor/schemas/inputs.d.ts.map +0 -1
  201. package/dist/editors/document-model-editor/schemas/utils.d.ts +0 -3
  202. package/dist/editors/document-model-editor/schemas/utils.d.ts.map +0 -1
  203. package/dist/editors/document-model-editor/types/documents.d.ts +0 -26
  204. package/dist/editors/document-model-editor/types/documents.d.ts.map +0 -1
  205. package/dist/editors/document-model-editor/types.d.ts +0 -2
  206. package/dist/editors/document-model-editor/types.d.ts.map +0 -1
  207. package/dist/editors/document-model-editor/utils/helpers.d.ts +0 -112
  208. package/dist/editors/document-model-editor/utils/helpers.d.ts.map +0 -1
  209. package/dist/editors/document-model-editor/utils/helpers.test.d.ts +0 -2
  210. package/dist/editors/document-model-editor/utils/helpers.test.d.ts.map +0 -1
  211. package/dist/editors/document-model-editor/utils/linting.d.ts +0 -7
  212. package/dist/editors/document-model-editor/utils/linting.d.ts.map +0 -1
  213. package/dist/editors/document-model-editor/utils/style.d.ts +0 -3
  214. package/dist/editors/document-model-editor/utils/style.d.ts.map +0 -1
  215. package/dist/editors/editors.d.ts +0 -3
  216. package/dist/editors/editors.d.ts.map +0 -1
  217. package/dist/editors/generic-drive-explorer/components/create-document.d.ts +0 -2
  218. package/dist/editors/generic-drive-explorer/components/create-document.d.ts.map +0 -1
  219. package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts +0 -2
  220. package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts.map +0 -1
  221. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts +0 -5
  222. package/dist/editors/generic-drive-explorer/components/folder-view.d.ts.map +0 -1
  223. package/dist/editors/generic-drive-explorer/components/index.d.ts +0 -6
  224. package/dist/editors/generic-drive-explorer/components/index.d.ts.map +0 -1
  225. package/dist/editors/generic-drive-explorer/components/layout.d.ts +0 -12
  226. package/dist/editors/generic-drive-explorer/components/layout.d.ts.map +0 -1
  227. package/dist/editors/generic-drive-explorer/components/search-bar.d.ts +0 -2
  228. package/dist/editors/generic-drive-explorer/components/search-bar.d.ts.map +0 -1
  229. package/dist/editors/generic-drive-explorer/config.d.ts +0 -3
  230. package/dist/editors/generic-drive-explorer/config.d.ts.map +0 -1
  231. package/dist/editors/generic-drive-explorer/editor.d.ts +0 -3
  232. package/dist/editors/generic-drive-explorer/editor.d.ts.map +0 -1
  233. package/dist/editors/generic-drive-explorer/index.d.ts +0 -3
  234. package/dist/editors/generic-drive-explorer/index.d.ts.map +0 -1
  235. package/dist/editors/generic-drive-explorer/module.d.ts +0 -3
  236. package/dist/editors/generic-drive-explorer/module.d.ts.map +0 -1
  237. package/dist/editors/generic-drive-explorer/utils/cn.d.ts +0 -3
  238. package/dist/editors/generic-drive-explorer/utils/cn.d.ts.map +0 -1
  239. package/dist/editors/generic-drive-explorer/utils/index.d.ts +0 -3
  240. package/dist/editors/generic-drive-explorer/utils/index.d.ts.map +0 -1
  241. package/dist/editors/generic-drive-explorer/utils/types.d.ts +0 -8
  242. package/dist/editors/generic-drive-explorer/utils/types.d.ts.map +0 -1
  243. package/dist/editors/index.d.ts +0 -3
  244. package/dist/editors/index.d.ts.map +0 -1
  245. package/dist/index.d.ts +0 -5
  246. package/dist/index.d.ts.map +0 -1
  247. package/dist/node/chunk-BSw8zbkd.mjs +0 -37
  248. package/dist/node/connect-C_m9ZK7D.mjs.map +0 -1
  249. package/dist/node/dist-BiK14IsY.mjs +0 -139
  250. package/dist/node/dist-BiK14IsY.mjs.map +0 -1
  251. package/dist/node/dist-DnalgmqP.mjs.map +0 -1
  252. package/dist/node/document-drive-DKH0m2I3.mjs.map +0 -1
  253. package/dist/node/document-timeline-BTTeXWMa-AuNfC83V.mjs +0 -3
  254. package/dist/node/document-timeline-BTTeXWMa-F-UYxPgj.mjs +0 -3167
  255. package/dist/node/document-timeline-BTTeXWMa-F-UYxPgj.mjs.map +0 -1
  256. package/dist/node/editor-P1P79LKV.mjs.map +0 -1
  257. package/dist/node/lib-oT9d3J_F.mjs +0 -8697
  258. package/dist/node/lib-oT9d3J_F.mjs.map +0 -1
  259. package/dist/node/state-schemas-BEZasnwL.mjs.map +0 -1
  260. package/dist/tsconfig.tsbuildinfo +0 -1
  261. package/dist/tsdown.config.d.ts +0 -3
  262. package/dist/tsdown.config.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
- import { i as __toESM, t as __commonJSMin } from "./chunk-YKewjYmz.js";
2
- import { B as undo, H as validateModules, P as setName, T as replayDocument, U as validateStateSchemaName, V as validateInitialState, W as generateId, _ as buildSignedAction, a as handleTargetNameCollisions, c as moveNode, d as logger, g as baseSaveToFileHandle, h as baseLoadFromInput, i as generateNodesCopy, l as updateNode, n as copyNode, o as isFileNode, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as createPresignedHeader, w as redo, y as createZip } from "./document-drive-CN2AY1E7.js";
3
- import { t as capitalCase } from "./dist-CTgmb7N2.js";
4
- import { A as twMerge, c as DropdownMenuItem, f as cn, g as __assign, l as DropdownMenuTrigger, o as DropdownMenu, p as mergeClassNameProps, s as DropdownMenuContent, u as Icon } from "./dist-OuHji4IC.js";
5
- import { t as parse } from "./parser-CO9mSyAT.js";
1
+ import { w as __toESM, x as __commonJSMin } from "./schemas-Bqem6NRm.js";
2
+ import { A as replayDocument, G as undo, J as validateStateSchemaName, K as validateInitialState, S as createZip, Y as generateId, _ as baseSaveToFileHandle, a as driveDocumentModelModule, c as isFileNode, d as updateNode, g as baseLoadFromInput, i as copyNode, k as redo, l as isFolderNode, n as logger, o as generateNodesCopy, q as validateModules, r as addFolder$1, s as handleTargetNameCollisions, t as documentModelDocumentModelModule, u as moveNode, v as buildSignedAction, y as createPresignedHeader, z as setName } from "./dist-DQgJ8n4d.js";
3
+ import { t as capitalCase } from "./dist-BXygvBtd.js";
4
+ import { a as driveCollectionId, i as SyncStatus, n as gql, r as ModuleNotFoundError, t as reactorDriveDocumentModelModule } from "./dist-CC1E3l2O.js";
5
+ import { O as twMerge, _ as mergeClassNameProps, d as DropdownMenuContent, f as DropdownMenuItem, g as cn, m as Icon, p as DropdownMenuTrigger, u as DropdownMenu } from "./dist-DOMEWT3x.js";
6
6
  import * as React$1 from "react";
7
- import React, { Children, Fragment, Suspense, cloneElement, createContext, forwardRef, isValidElement, lazy, use, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
7
+ import React, { Children, Fragment, cloneElement, createContext, createElement, forwardRef, isValidElement, use, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { flushSync } from "react-dom";
10
10
  //#region ../reactor-browser/dist/make-ph-event-functions-Cr4GqOTT.js
@@ -59,36 +59,6 @@ function makePHEventFunctions(key) {
59
59
  };
60
60
  }
61
61
  //#endregion
62
- //#region ../reactor/dist/index.js
63
- /**
64
- * Error thrown when a document model module is not found in the registry.
65
- */
66
- var ModuleNotFoundError = class extends Error {
67
- documentType;
68
- requestedVersion;
69
- constructor(documentType, version) {
70
- const versionSuffix = version !== void 0 ? ` version ${version}` : "";
71
- super(`Document model module not found for type: ${documentType}${versionSuffix}`);
72
- this.name = "ModuleNotFoundError";
73
- this.documentType = documentType;
74
- this.requestedVersion = version;
75
- }
76
- static isError(error) {
77
- return Error.isError(error) && error.name === "ModuleNotFoundError";
78
- }
79
- };
80
- function driveCollectionId(branch, driveId) {
81
- return `drive.${branch}.${driveId}`;
82
- }
83
- let SyncStatus = /* @__PURE__ */ function(SyncStatus) {
84
- SyncStatus["Synced"] = "SYNCED";
85
- SyncStatus["Outgoing"] = "OUTGOING";
86
- SyncStatus["Incoming"] = "INCOMING";
87
- SyncStatus["OutgoingAndIncoming"] = "OUTGOING_AND_INCOMING";
88
- SyncStatus["Error"] = "ERROR";
89
- return SyncStatus;
90
- }({});
91
- //#endregion
92
62
  //#region ../reactor-browser/dist/document-by-id-DuujBqAQ.js
93
63
  async function queueActions(document, actionOrActions) {
94
64
  if (!document) throw new Error("No document provided");
@@ -252,103 +222,7 @@ function useDocumentById(id) {
252
222
  return [document, dispatch];
253
223
  }
254
224
  //#endregion
255
- //#region ../../node_modules/.pnpm/graphql-tag@2.12.6_graphql@16.12.0/node_modules/graphql-tag/lib/index.js
256
- var docCache = /* @__PURE__ */ new Map();
257
- var fragmentSourceMap = /* @__PURE__ */ new Map();
258
- var printFragmentWarnings = true;
259
- var experimentalFragmentVariables = false;
260
- function normalize(string) {
261
- return string.replace(/[\s,]+/g, " ").trim();
262
- }
263
- function cacheKeyFromLoc(loc) {
264
- return normalize(loc.source.body.substring(loc.start, loc.end));
265
- }
266
- function processFragments(ast) {
267
- var seenKeys = /* @__PURE__ */ new Set();
268
- var definitions = [];
269
- ast.definitions.forEach(function(fragmentDefinition) {
270
- if (fragmentDefinition.kind === "FragmentDefinition") {
271
- var fragmentName = fragmentDefinition.name.value;
272
- var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);
273
- var sourceKeySet = fragmentSourceMap.get(fragmentName);
274
- if (sourceKeySet && !sourceKeySet.has(sourceKey)) {
275
- if (printFragmentWarnings) console.warn("Warning: fragment with name " + fragmentName + " already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names");
276
- } else if (!sourceKeySet) fragmentSourceMap.set(fragmentName, sourceKeySet = /* @__PURE__ */ new Set());
277
- sourceKeySet.add(sourceKey);
278
- if (!seenKeys.has(sourceKey)) {
279
- seenKeys.add(sourceKey);
280
- definitions.push(fragmentDefinition);
281
- }
282
- } else definitions.push(fragmentDefinition);
283
- });
284
- return __assign(__assign({}, ast), { definitions });
285
- }
286
- function stripLoc(doc) {
287
- var workSet = new Set(doc.definitions);
288
- workSet.forEach(function(node) {
289
- if (node.loc) delete node.loc;
290
- Object.keys(node).forEach(function(key) {
291
- var value = node[key];
292
- if (value && typeof value === "object") workSet.add(value);
293
- });
294
- });
295
- var loc = doc.loc;
296
- if (loc) {
297
- delete loc.startToken;
298
- delete loc.endToken;
299
- }
300
- return doc;
301
- }
302
- function parseDocument(source) {
303
- var cacheKey = normalize(source);
304
- if (!docCache.has(cacheKey)) {
305
- var parsed = parse(source, {
306
- experimentalFragmentVariables,
307
- allowLegacyFragmentVariables: experimentalFragmentVariables
308
- });
309
- if (!parsed || parsed.kind !== "Document") throw new Error("Not a valid GraphQL document.");
310
- docCache.set(cacheKey, stripLoc(processFragments(parsed)));
311
- }
312
- return docCache.get(cacheKey);
313
- }
314
- function gql(literals) {
315
- var args = [];
316
- for (var _i = 1; _i < arguments.length; _i++) args[_i - 1] = arguments[_i];
317
- if (typeof literals === "string") literals = [literals];
318
- var result = literals[0];
319
- args.forEach(function(arg, i) {
320
- if (arg && arg.kind === "Document") result += arg.loc.source.body;
321
- else result += arg;
322
- result += literals[i + 1];
323
- });
324
- return parseDocument(result);
325
- }
326
- function resetCaches() {
327
- docCache.clear();
328
- fragmentSourceMap.clear();
329
- }
330
- function disableFragmentWarnings() {
331
- printFragmentWarnings = false;
332
- }
333
- function enableExperimentalFragmentVariables() {
334
- experimentalFragmentVariables = true;
335
- }
336
- function disableExperimentalFragmentVariables() {
337
- experimentalFragmentVariables = false;
338
- }
339
- var extras = {
340
- gql,
341
- resetCaches,
342
- disableFragmentWarnings,
343
- enableExperimentalFragmentVariables,
344
- disableExperimentalFragmentVariables
345
- };
346
- (function(gql_1) {
347
- gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables;
348
- })(gql || (gql = {}));
349
- gql["default"] = gql;
350
- //#endregion
351
- //#region ../reactor-browser/dist/client-DfoxBz8A.js
225
+ //#region ../reactor-browser/dist/client-D7hUM13i.js
352
226
  const PhDocumentFieldsFragmentDoc = gql`
353
227
  fragment PHDocumentFields on PHDocument {
354
228
  id
@@ -644,6 +518,22 @@ gql`
644
518
  }
645
519
  ${PhDocumentFieldsFragmentDoc}
646
520
  `;
521
+ gql`
522
+ mutation SetPreferredEditor(
523
+ $documentIdentifier: String!
524
+ $preferredEditor: String
525
+ $branch: String
526
+ ) {
527
+ setPreferredEditor(
528
+ documentIdentifier: $documentIdentifier
529
+ preferredEditor: $preferredEditor
530
+ branch: $branch
531
+ ) {
532
+ ...PHDocumentFields
533
+ }
534
+ }
535
+ ${PhDocumentFieldsFragmentDoc}
536
+ `;
647
537
  gql`
648
538
  mutation AddRelationship(
649
539
  $sourceIdentifier: String!
@@ -864,7 +754,7 @@ function extractQueryParts(doc, fallbackBody) {
864
754
  extractSelectionSet(GetDocumentOperationsDocument, "documentOperations", "{ items { index } }");
865
755
  extractQueryParts(GetDocumentDocument, "document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }");
866
756
  //#endregion
867
- //#region ../reactor-browser/dist/renown-CV_45Xc1.js
757
+ //#region ../reactor-browser/dist/renown-s0H1puU4.js
868
758
  const { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions("loading");
869
759
  const renownEventFunctions = makePHEventFunctions("renown");
870
760
  renownEventFunctions.addEventHandler;
@@ -911,7 +801,7 @@ const Slot = forwardRef(({ children, ...props }, ref) => {
911
801
  Slot.displayName = "Slot";
912
802
  //#endregion
913
803
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
914
- function e$9(e, t, n) {
804
+ function e$12(e, t, n) {
915
805
  let r = (n) => e(n, ...t);
916
806
  return n === void 0 ? r : Object.assign(r, {
917
807
  lazy: n,
@@ -920,36 +810,36 @@ function e$9(e, t, n) {
920
810
  }
921
811
  //#endregion
922
812
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
923
- function t$10(t, n, r) {
813
+ function t$14(t, n, r) {
924
814
  let i = t.length - n.length;
925
815
  if (i === 0) return t(...n);
926
- if (i === 1) return e$9(t, n, r);
816
+ if (i === 1) return e$12(t, n, r);
927
817
  throw Error(`Wrong number of arguments`);
928
818
  }
929
819
  //#endregion
930
820
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/addProp.js
931
- function t$9(...t) {
932
- return t$10(n$8, t);
821
+ function t$13(...t) {
822
+ return t$14(n$10, t);
933
823
  }
934
- const n$8 = (e, t, n) => ({
824
+ const n$10 = (e, t, n) => ({
935
825
  ...e,
936
826
  [t]: n
937
827
  });
938
828
  //#endregion
939
829
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js
940
- function t$8(...t) {
941
- return t$10(n$7, t);
830
+ function t$12(...t) {
831
+ return t$14(n$9, t);
942
832
  }
943
- const n$7 = (e, t) => t.every((t) => t(e));
833
+ const n$9 = (e, t) => t.every((t) => t(e));
944
834
  //#endregion
945
835
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js
946
- function e$8(e, t, n) {
836
+ function e$11(e, t, n) {
947
837
  return e(n[0]) ? (e) => t(e, ...n) : t(...n);
948
838
  }
949
- function t$7(...t) {
950
- return e$8(r$3, n$6, t);
839
+ function t$11(...t) {
840
+ return e$11(r$4, n$8, t);
951
841
  }
952
- function n$6(e, ...t) {
842
+ function n$8(e, ...t) {
953
843
  for (let n of t) {
954
844
  if (typeof n == `function`) return n(e);
955
845
  let [t, r] = n;
@@ -957,28 +847,31 @@ function n$6(e, ...t) {
957
847
  }
958
848
  throw Error(`conditional: data failed for all cases`);
959
849
  }
960
- function r$3(e) {
850
+ function r$4(e) {
961
851
  if (!Array.isArray(e)) return !1;
962
852
  let [t, n, ...r] = e;
963
853
  return typeof t == `function` && t.length <= 1 && typeof n == `function` && n.length <= 1 && r.length === 0;
964
854
  }
965
855
  //#endregion
966
856
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js
967
- function e$7(e) {
857
+ function e$10(e) {
968
858
  return () => e;
969
859
  }
970
860
  //#endregion
971
- //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/utilityEvaluators-Cb8x6-JZ.js
972
- const t$6 = {
861
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/defaultTo.js
862
+ function t$10(...t) {
863
+ return t$14(n$7, t);
864
+ }
865
+ const n$7 = (e, t) => e ?? t, t$9 = {
973
866
  done: !1,
974
867
  hasNext: !1
975
868
  };
976
869
  //#endregion
977
870
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/pipe.js
978
- function t$5(e, ...t) {
979
- let a = e, o = t.map((e) => `lazy` in e ? r$1(e) : void 0), s = 0;
871
+ function t$8(e, ...t) {
872
+ let a = e, o = t.map((e) => `lazy` in e ? r$2(e) : void 0), s = 0;
980
873
  for (; s < t.length;) {
981
- if (o[s] === void 0 || !i(a)) {
874
+ if (o[s] === void 0 || !i$1(a)) {
982
875
  let e = t[s];
983
876
  a = e(a), s += 1;
984
877
  continue;
@@ -989,20 +882,20 @@ function t$5(e, ...t) {
989
882
  if (t === void 0 || (e.push(t), t.isSingle)) break;
990
883
  }
991
884
  let r = [];
992
- for (let t of a) if (n$4(t, r, e)) break;
885
+ for (let t of a) if (n$5(t, r, e)) break;
993
886
  let { isSingle: c } = e.at(-1);
994
887
  a = c ? r[0] : r, s += e.length;
995
888
  }
996
889
  return a;
997
890
  }
998
- function n$4(t, r, i) {
891
+ function n$5(t, r, i) {
999
892
  if (i.length === 0) return r.push(t), !1;
1000
- let a = t, o = t$6, s = !1;
893
+ let a = t, o = t$9, s = !1;
1001
894
  for (let [e, t] of i.entries()) {
1002
895
  let { index: c, items: l } = t;
1003
896
  if (l.push(a), o = t(a, c, l), t.index += 1, o.hasNext) {
1004
897
  if (o.hasMany ?? !1) {
1005
- for (let t of o.next) if (n$4(t, r, i.slice(e + 1))) return !0;
898
+ for (let t of o.next) if (n$5(t, r, i.slice(e + 1))) return !0;
1006
899
  return s;
1007
900
  }
1008
901
  a = o.next;
@@ -1012,7 +905,7 @@ function n$4(t, r, i) {
1012
905
  }
1013
906
  return o.hasNext && r.push(a), s;
1014
907
  }
1015
- function r$1(e) {
908
+ function r$2(e) {
1016
909
  let { lazy: t, lazyArgs: n } = e, r = t(...n);
1017
910
  return Object.assign(r, {
1018
911
  isSingle: t.single ?? !1,
@@ -1020,27 +913,37 @@ function r$1(e) {
1020
913
  items: []
1021
914
  });
1022
915
  }
1023
- function i(e) {
916
+ function i$1(e) {
1024
917
  return typeof e == `string` || typeof e == `object` && !!e && Symbol.iterator in e;
1025
918
  }
1026
919
  //#endregion
1027
920
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
1028
- function t$4(...t) {
1029
- return t$10(n$3, t);
921
+ function t$7(...t) {
922
+ return t$14(n$4, t);
1030
923
  }
1031
- const n$3 = (e, t) => e.length >= t;
924
+ const n$4 = (e, t) => e.length >= t;
1032
925
  //#endregion
1033
926
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/entries.js
1034
- function t$3(...t) {
1035
- return t$10(Object.entries, t);
927
+ function t$6(...t) {
928
+ return t$14(Object.entries, t);
929
+ }
930
+ //#endregion
931
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/filter.js
932
+ function n$3(...t) {
933
+ return t$14(r$1, t, i);
1036
934
  }
935
+ const r$1 = (e, t) => e.filter(t), i = (e) => (n, r, i) => e(n, r, i) ? {
936
+ done: !1,
937
+ hasNext: !0,
938
+ next: n
939
+ } : t$9;
1037
940
  //#endregion
1038
941
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js
1039
- const e$5 = Symbol(`funnel/voidReducer`), t$2 = () => e$5;
1040
- function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$2 }) {
942
+ const e$8 = Symbol(`funnel/voidReducer`), t$5 = () => e$8;
943
+ function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs: a, minGapMs: o, reducer: s = t$5 }) {
1041
944
  let c, l, u, d, f = () => {
1042
945
  let t = u;
1043
- t !== void 0 && (u = void 0, t === e$5 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
946
+ t !== void 0 && (u = void 0, t === e$8 ? n() : n(t), o !== void 0 && (l = setTimeout(p, o)));
1044
947
  }, p = () => {
1045
948
  clearTimeout(l), l = void 0, c === void 0 && f();
1046
949
  }, m = () => {
@@ -1072,35 +975,54 @@ function n$2(n, { triggerAt: r = `end`, minQuietPeriodMs: i, maxBurstDurationMs:
1072
975
  };
1073
976
  }
1074
977
  //#endregion
978
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isArray.js
979
+ function e$7(e) {
980
+ return Array.isArray(e);
981
+ }
982
+ //#endregion
1075
983
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js
1076
- function e$4(e) {
984
+ function e$6(e) {
1077
985
  return e !== void 0;
1078
986
  }
1079
987
  //#endregion
988
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isIncludedIn.js
989
+ function e$5(e, t) {
990
+ if (t === void 0) {
991
+ let t = new Set(e);
992
+ return (e) => t.has(e);
993
+ }
994
+ return t.includes(e);
995
+ }
996
+ //#endregion
1080
997
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js
1081
- function e$3(e) {
998
+ function e$4(e) {
1082
999
  return (t) => !e(t);
1083
1000
  }
1084
1001
  //#endregion
1085
1002
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js
1086
- function t$1(...t) {
1087
- return t$10(n$1, t);
1003
+ function t$4(...t) {
1004
+ return t$14(n$1, t);
1088
1005
  }
1089
1006
  const n$1 = (e, t) => e === t || Object.is(e, t);
1090
1007
  //#endregion
1091
1008
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js
1092
- function e$2(e) {
1009
+ function e$3(e) {
1093
1010
  return typeof e == `string`;
1094
1011
  }
1095
1012
  //#endregion
1096
1013
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js
1097
- function e$1(e) {
1014
+ function e$2(e) {
1098
1015
  return !!e;
1099
1016
  }
1100
1017
  //#endregion
1018
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/keys.js
1019
+ function t$3(...t) {
1020
+ return t$14(Object.keys, t);
1021
+ }
1022
+ //#endregion
1101
1023
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/map.js
1102
- function t(...t) {
1103
- return t$10(n, t, r);
1024
+ function t$2(...t) {
1025
+ return t$14(n, t, r);
1104
1026
  }
1105
1027
  const n = (e, t) => e.map(t), r = (e) => (t, n, r) => ({
1106
1028
  done: !1,
@@ -1109,11 +1031,29 @@ const n = (e, t) => e.map(t), r = (e) => (t, n, r) => ({
1109
1031
  });
1110
1032
  //#endregion
1111
1033
  //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js
1112
- function e(e) {
1034
+ function e$1(e) {
1113
1035
  let t = !1, n;
1114
1036
  return () => (t ||= (n = e(), !0), n);
1115
1037
  }
1116
1038
  //#endregion
1039
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/prop.js
1040
+ function e(e, ...n) {
1041
+ return typeof e == `string` || typeof e == `number` || typeof e == `symbol` ? (r) => t$1(r, e, ...n) : t$1(e, ...n);
1042
+ }
1043
+ function t$1(e, ...t) {
1044
+ let n = e;
1045
+ for (let e of t) {
1046
+ if (n == null) return;
1047
+ n = n[e];
1048
+ }
1049
+ return n;
1050
+ }
1051
+ //#endregion
1052
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/values.js
1053
+ function t(...t) {
1054
+ return t$14(Object.values, t);
1055
+ }
1056
+ //#endregion
1117
1057
  //#region ../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js
1118
1058
  let base64;
1119
1059
  if (typeof window !== "undefined") if (window.btoa) base64 = function(input) {
@@ -2624,7 +2564,9 @@ function getUserPermissions() {
2624
2564
  const BASE_STATE_KEYS = new Set(["auth"]);
2625
2565
  const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
2626
2566
  async function downloadFile(document, fileName) {
2627
- (await createZip(document)).generateAsync({ type: "blob" }).then((blob) => {
2567
+ try {
2568
+ const data = await createZip(document);
2569
+ const blob = new Blob([new Uint8Array(data)], { type: "application/zip" });
2628
2570
  const link = window.document.createElement("a");
2629
2571
  link.style.display = "none";
2630
2572
  link.href = URL.createObjectURL(blob);
@@ -2632,7 +2574,9 @@ async function downloadFile(document, fileName) {
2632
2574
  window.document.body.appendChild(link);
2633
2575
  link.click();
2634
2576
  window.document.body.removeChild(link);
2635
- }).catch(logger.error);
2577
+ } catch (e) {
2578
+ logger.error(e instanceof Error ? e.message : String(e));
2579
+ }
2636
2580
  }
2637
2581
  async function getDocumentExtension(document) {
2638
2582
  const documentType = document.header.documentType;
@@ -2728,8 +2672,8 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
2728
2672
  try {
2729
2673
  newDoc = await reactorClient.drives.addFile(driveId, newDocument, parentFolder);
2730
2674
  } catch (e) {
2731
- logger.error("Error adding document", e);
2732
- throw new Error("There was an error adding document");
2675
+ logger.error("Error adding document: @error", e);
2676
+ throw new Error("There was an error adding document", { cause: e });
2733
2677
  }
2734
2678
  return {
2735
2679
  id: newDoc.header.id,
@@ -2815,8 +2759,8 @@ async function moveNodeById(args) {
2815
2759
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
2816
2760
  const reactorClient = window.ph?.reactorClient;
2817
2761
  if (!reactorClient) throw new Error("ReactorClient not initialized");
2818
- const targetParentFolder = t$7(targetId, [e$3(e$4), e$7(void 0)], [t$1(driveId), e$7(void 0)], e$7(targetId));
2819
- if (t$1(targetParentFolder, srcId)) return;
2762
+ const targetParentFolder = t$11(targetId, [e$4(e$6), e$10(void 0)], [t$4(driveId), e$10(void 0)], e$10(targetId));
2763
+ if (t$4(targetParentFolder, srcId)) return;
2820
2764
  return await reactorClient.execute(driveId, "main", [moveNode({
2821
2765
  srcFolder: srcId,
2822
2766
  targetParentFolder
@@ -2874,7 +2818,11 @@ async function copyNode$1(driveId, src, target) {
2874
2818
  }
2875
2819
  return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
2876
2820
  }
2877
- const baseDocumentModelsMap = { DocumentModel: documentModelDocumentModelModule };
2821
+ const baseDocumentModelsMap = {
2822
+ DocumentModel: documentModelDocumentModelModule,
2823
+ DocumentDrive: driveDocumentModelModule,
2824
+ ReactorDrive: reactorDriveDocumentModelModule
2825
+ };
2878
2826
  Object.values(baseDocumentModelsMap);
2879
2827
  const isExternalControlsEnabledEventFunctions = makePHEventFunctions("isExternalControlsEnabled");
2880
2828
  /** Sets whether external controls are enabled for a given editor. */
@@ -3161,12 +3109,6 @@ const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;
3161
3109
  /** Sets the selected drive id */
3162
3110
  const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;
3163
3111
  selectedDriveIdEventFunctions.addEventHandler;
3164
- /** Returns the selected drive */
3165
- function useSelectedDrive() {
3166
- const drive = useSelectedDriveSafe();
3167
- if (!drive[0]) throw new Error("There is no drive selected. Did you mean to call 'useSelectedDriveSafe'?");
3168
- return drive;
3169
- }
3170
3112
  /** Returns the selected drive, or undefined if no drive is selected */
3171
3113
  function useSelectedDriveSafe() {
3172
3114
  const selectedDriveId = useSelectedDriveId();
@@ -3237,7 +3179,7 @@ function unsetDragging() {
3237
3179
  draggingNodeSetter.cancel();
3238
3180
  draggingNodeUnsetter.call();
3239
3181
  }
3240
- const isNodeDrag = (params) => t$7(params, [({ srcId }) => e$3(e$1)(srcId), e$7(false)], [({ driveId }) => e$3(e$1)(driveId), e$7(false)], [({ driveId, srcId }) => t$1(driveId, srcId), e$7(false)], e$7(true));
3182
+ const isNodeDrag = (params) => t$11(params, [({ srcId }) => e$4(e$2)(srcId), e$10(false)], [({ driveId }) => e$4(e$2)(driveId), e$10(false)], [({ driveId, srcId }) => t$4(driveId, srcId), e$10(false)], e$10(true));
3241
3183
  function useDragNode(args) {
3242
3184
  const { srcId, parentId } = args;
3243
3185
  const driveId = useSelectedDriveId();
@@ -3248,14 +3190,14 @@ function useDragNode(args) {
3248
3190
  parentId
3249
3191
  };
3250
3192
  const draggable = isNodeDrag(params);
3251
- const isDragging = t$8({
3193
+ const isDragging = t$12({
3252
3194
  srcId,
3253
3195
  draggingNodeId
3254
3196
  }, [
3255
3197
  () => draggable,
3256
- ({ srcId }) => e$2(srcId),
3257
- ({ draggingNodeId }) => e$2(draggingNodeId),
3258
- ({ srcId, draggingNodeId }) => t$1(srcId, draggingNodeId)
3198
+ ({ srcId }) => e$3(srcId),
3199
+ ({ draggingNodeId }) => e$3(draggingNodeId),
3200
+ ({ srcId, draggingNodeId }) => t$4(srcId, draggingNodeId)
3259
3201
  ]);
3260
3202
  const onDragStart = () => {
3261
3203
  if (!draggable) return;
@@ -3272,7 +3214,7 @@ function useDragNode(args) {
3272
3214
  onDragEnd
3273
3215
  };
3274
3216
  }
3275
- const isNodeDrop = (params) => t$7(params, [({ srcId }) => e$3(e$1)(srcId), e$7(false)], [({ driveId }) => e$3(e$4)(driveId), e$7(false)], [({ srcId, targetId }) => t$1(srcId, targetId), e$7(false)], [({ driveId, parentId, targetId }) => e$3(e$1)(parentId) && t$1(targetId, driveId), e$7(false)], [({ targetId, parentId }) => t$1(targetId, parentId), e$7(false)], e$7(true));
3217
+ const isNodeDrop = (params) => t$11(params, [({ srcId }) => e$4(e$2)(srcId), e$10(false)], [({ driveId }) => e$4(e$6)(driveId), e$10(false)], [({ srcId, targetId }) => t$4(srcId, targetId), e$10(false)], [({ driveId, parentId, targetId }) => e$4(e$2)(parentId) && t$4(targetId, driveId), e$10(false)], [({ targetId, parentId }) => t$4(targetId, parentId), e$10(false)], e$10(true));
3276
3218
  function useDropNode(targetId) {
3277
3219
  const driveId = useSelectedDriveId();
3278
3220
  const { srcId, parentId } = useDraggingNode() ?? {};
@@ -3290,9 +3232,9 @@ function useDropNode(targetId) {
3290
3232
  cb?.();
3291
3233
  }
3292
3234
  const onDragEnter = (event) => handleNodeDrop(event);
3293
- const onDragOver = (event) => handleNodeDrop(event, e(setTarget));
3294
- const onDragLeave = (event) => handleNodeDrop(event, e(unsetTarget));
3295
- const onDrop = (event) => handleNodeDrop(event, e(() => {
3235
+ const onDragOver = (event) => handleNodeDrop(event, e$1(setTarget));
3236
+ const onDragLeave = (event) => handleNodeDrop(event, e$1(unsetTarget));
3237
+ const onDrop = (event) => handleNodeDrop(event, e$1(() => {
3296
3238
  unsetDragging();
3297
3239
  unsetTarget();
3298
3240
  moveNodeById(params).catch(console.error);
@@ -3408,8 +3350,7 @@ function setSelectedNode(nodeOrNodeSlug) {
3408
3350
  }
3409
3351
  const selectedTimelineItemEventFunctions = makePHEventFunctions("selectedTimelineItem");
3410
3352
  selectedTimelineItemEventFunctions.useValue;
3411
- /** Sets the selected timeline item */
3412
- const setSelectedTimelineItem = selectedTimelineItemEventFunctions.setValue;
3353
+ selectedTimelineItemEventFunctions.setValue;
3413
3354
  selectedTimelineItemEventFunctions.addEventHandler;
3414
3355
  const selectedTimelineRevisionEventFunctions = makePHEventFunctions("selectedTimelineRevision");
3415
3356
  selectedTimelineRevisionEventFunctions.useValue;
@@ -3542,7 +3483,7 @@ function defaultHandleError(error) {
3542
3483
  console.error(`Failed to export document: ${error.message}`);
3543
3484
  }
3544
3485
  function handleDocumentValidation(document) {
3545
- if (t$4(validateDocument(document), 1)) return false;
3486
+ if (t$7(validateDocument(document), 1)) return false;
3546
3487
  return true;
3547
3488
  }
3548
3489
  function downloadDocument(document, handleError = defaultHandleError) {
@@ -3730,12 +3671,14 @@ function buildDocumentSubgraphUrl(driveUrl, identifier, authToken) {
3730
3671
  * @returns An async function that returns the switchboard URL, or null if not applicable
3731
3672
  */
3732
3673
  function useGetSwitchboardLink(document) {
3733
- const [drive] = useSelectedDrive();
3674
+ const [drive] = useSelectedDriveSafe();
3734
3675
  const remotes = useSyncList();
3735
3676
  const isRemoteDrive = useMemo(() => {
3677
+ if (!e$6(drive)) return false;
3736
3678
  return remotes.some((remote) => remote.collectionId === driveCollectionId("main", drive.header.id));
3737
3679
  }, [remotes, drive]);
3738
3680
  const remoteUrl = useMemo(() => {
3681
+ if (!e$6(drive)) return null;
3739
3682
  try {
3740
3683
  const channelUrl = (remotes.find((remote) => remote.collectionId === driveCollectionId("main", drive.header.id))?.channel)?.config.url;
3741
3684
  if (typeof channelUrl === "string") return channelUrl;
@@ -8544,6 +8487,9 @@ function NodeInput(props) {
8544
8487
  const { onSubmit, onCancel, defaultValue, className, minLength = 1, ...inputProps } = props;
8545
8488
  const [value, setValue] = useState(defaultValue ?? "");
8546
8489
  const ref = useRef(null);
8490
+ function handleSubmit() {
8491
+ if (value.length >= minLength) onSubmit(value);
8492
+ }
8547
8493
  useOnClickOutside(ref, handleSubmit);
8548
8494
  useEventListener("keyup", (e) => {
8549
8495
  if (e.key === "Enter") handleSubmit();
@@ -8556,9 +8502,6 @@ function NodeInput(props) {
8556
8502
  ref.current?.scroll({ left: 9999 });
8557
8503
  }, 100);
8558
8504
  }, []);
8559
- function handleSubmit() {
8560
- if (value.length >= minLength) onSubmit(value);
8561
- }
8562
8505
  return /* @__PURE__ */ jsx("input", {
8563
8506
  ...inputProps,
8564
8507
  autoFocus: true,
@@ -8659,201 +8602,462 @@ function Breadcrumb(props) {
8659
8602
  children: name
8660
8603
  });
8661
8604
  }
8662
- function useDocumentUndoRedo(documentId) {
8605
+ /**
8606
+ * Default outer container for `DocumentToolbar`.
8607
+ *
8608
+ * This component provides the toolbar's base layout and visual styling while
8609
+ * still accepting standard `div` props. Pass a custom container to
8610
+ * `DocumentToolbar` when you need to replace this wrapper.
8611
+ */
8612
+ function ToolbarContainer(props) {
8613
+ const { children, className, ...rest } = props;
8614
+ return /* @__PURE__ */ jsx("div", {
8615
+ ...rest,
8616
+ className: twMerge("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4", className),
8617
+ children
8618
+ });
8619
+ }
8620
+ /**
8621
+ * Default container for a group of toolbar controls.
8622
+ *
8623
+ * `DocumentToolbar` renders one controls container per toolbar slot. This
8624
+ * component provides the default horizontal layout for the controls in that
8625
+ * slot while still accepting standard `div` props.
8626
+ */
8627
+ function ToolbarControlsContainer(props) {
8628
+ const { children, className, ...rest } = props;
8629
+ return /* @__PURE__ */ jsx("div", {
8630
+ className: twMerge("flex items-center gap-x-2", className),
8631
+ ...rest,
8632
+ children
8633
+ });
8634
+ }
8635
+ /**
8636
+ * Checks whether a document has at least one non-zero revision count.
8637
+ *
8638
+ * Revision scopes are dynamic document-model keys, so this checks the values of
8639
+ * the document's revision object instead of relying on a fixed list of scope
8640
+ * names.
8641
+ */
8642
+ function hasRevisions(document) {
8643
+ return t$8(e(document, "header", "revision"), t$10({}), t(), n$3(e$2), t$7(1));
8644
+ }
8645
+ /**
8646
+ * Returns undo state and an undo dispatcher for a document.
8647
+ *
8648
+ * `canUndo` is true when the document has at least one non-zero revision count
8649
+ * across any revision scope.
8650
+ */
8651
+ function useUndo(documentId) {
8663
8652
  const [document, dispatch] = useDocumentById(documentId);
8664
- const globalRevisionNumber = document?.header.revision.global ?? 0;
8665
- const localRevisionNumber = document?.header.revision.local ?? 0;
8666
- const canUndo = globalRevisionNumber > 0 || localRevisionNumber > 0;
8667
- const canRedo = !!document?.clipboard.length;
8668
- const handleUndo = () => {
8669
- dispatch(undo());
8670
- };
8671
- const handleRedo = () => {
8672
- dispatch(redo());
8653
+ return {
8654
+ canUndo: hasRevisions(document),
8655
+ undo: () => dispatch(undo())
8673
8656
  };
8657
+ }
8658
+ /**
8659
+ * Returns redo state and a redo dispatcher for a document.
8660
+ *
8661
+ * `canRedo` is true when the document clipboard contains at least one operation
8662
+ * that can be reapplied.
8663
+ */
8664
+ function useRedo(documentId) {
8665
+ const [document, dispatch] = useDocumentById(documentId);
8674
8666
  return {
8675
- undo: handleUndo,
8676
- redo: handleRedo,
8677
- canUndo,
8678
- canRedo
8667
+ canRedo: t$7(document?.clipboard ?? [], 1),
8668
+ redo: () => dispatch(redo())
8679
8669
  };
8680
8670
  }
8681
- const DocumentTimeline$1 = /* @__PURE__ */ lazy(() => import("./document-timeline-BTTeXWMa-DQCUJzMB.js").then((n) => n.t).then((n) => n.n).then((m) => ({ default: m.DocumentTimeline })));
8682
- function useDocumentTimeline(documentId) {
8683
- return [];
8671
+ /**
8672
+ * Base button component used by the built-in toolbar controls.
8673
+ *
8674
+ * This component provides the default toolbar button styling and disabled-state
8675
+ * behavior while accepting standard `button` props.
8676
+ */
8677
+ function ToolbarButton(props) {
8678
+ const { className, children, disabled, ...rest } = props;
8679
+ return /* @__PURE__ */ jsx("button", {
8680
+ ...rest,
8681
+ disabled,
8682
+ className: twMerge("grid size-fit place-items-center rounded-lg border border-gray-200 bg-white p-1 text-gray-900", disabled ? "cursor-not-allowed text-gray-500" : "cursor-pointer active:opacity-70", className),
8683
+ children
8684
+ });
8684
8685
  }
8685
- const DocumentToolbar = (props) => {
8686
- const { onClose, children, onDownloadDocument, className, document: _document, onSwitchboardLinkClick, enabledControls = [
8687
- "undo",
8688
- "redo",
8689
- "export",
8690
- "history"
8691
- ], defaultTimelineVisible = true, disableRevisionHistory = false, initialTimelineVisible = false, ...containerProps } = props;
8692
- const [selectedDocument] = useSelectedDocumentSafe();
8693
- const document = _document ?? selectedDocument;
8694
- const { onRenameNode, onRenameDriveNodes } = useNodeActions();
8695
- const documentName = document?.header.name || void 0;
8696
- const [isEditingName, setIsEditingName] = useState(false);
8697
- const parentFolder = useNodeParentFolderById(document?.header.id);
8698
- const handleClose = onClose ?? (() => setSelectedNode(parentFolder));
8699
- const documentUndoRedo = useDocumentUndoRedo(document?.header.id);
8700
- const isUndoDisabled = !documentUndoRedo.canUndo;
8701
- const isRedoDisabled = !documentUndoRedo.canRedo;
8702
- const defaultDownloadDocument = useDownloadDocument(document?.header.id);
8703
- const timelineItemsData = useDocumentTimeline(document?.header.id);
8704
- const [showTimeline, setShowTimeline] = useState(initialTimelineVisible);
8686
+ /**
8687
+ * Toolbar control for undoing the latest document revision.
8688
+ *
8689
+ * The button is disabled when there are no revisions available to undo.
8690
+ * Provide `children` to replace the default icon, or `onClick` to override the
8691
+ * default undo behavior.
8692
+ */
8693
+ function ToolbarUndoButton(props) {
8694
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8695
+ name: "ArrowCouterclockwise",
8696
+ size: 16
8697
+ }) } = props;
8698
+ const { undo, canUndo } = useUndo(document?.header.id);
8699
+ const disabled = !canUndo;
8700
+ const onClick = makeOnClick(document, onClickOverride, undo);
8701
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8702
+ "data-testid": "toolbar-undo-button",
8703
+ "aria-label": "Undo",
8704
+ className,
8705
+ disabled,
8706
+ onClick,
8707
+ children
8708
+ });
8709
+ }
8710
+ /**
8711
+ * Toolbar control for redoing the latest undone document revision.
8712
+ *
8713
+ * The button is disabled when there are no revisions available to redo.
8714
+ * Provide `children` to replace the default icon, or `onClick` to override the
8715
+ * default redo behavior.
8716
+ */
8717
+ function ToolbarRedoButton(props) {
8718
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8719
+ name: "ArrowCouterclockwise",
8720
+ className: "-scale-x-100",
8721
+ size: 16
8722
+ }) } = props;
8723
+ const { redo, canRedo } = useRedo(document?.header.id);
8724
+ const onClick = makeOnClick(document, onClickOverride, redo);
8725
+ const disabled = !canRedo;
8726
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8727
+ "data-testid": "toolbar-redo-button",
8728
+ "aria-label": "Redo",
8729
+ className,
8730
+ disabled,
8731
+ onClick,
8732
+ children
8733
+ });
8734
+ }
8735
+ /**
8736
+ * Toolbar control for downloading the current document.
8737
+ *
8738
+ * Provide `children` to replace the default label, or `onClick` to override the
8739
+ * default download behavior.
8740
+ */
8741
+ function ToolbarDownloadButton(props) {
8742
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx("span", {
8743
+ className: "px-1 text-xs",
8744
+ children: "Download"
8745
+ }) } = props;
8746
+ const onClick = makeOnClick(document, onClickOverride, useDownloadDocument(document?.header.id));
8747
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8748
+ "data-testid": "toolbar-download-button",
8749
+ "aria-label": "Download",
8750
+ className,
8751
+ onClick,
8752
+ children
8753
+ });
8754
+ }
8755
+ /**
8756
+ * Toolbar control for opening the current document in Switchboard.
8757
+ *
8758
+ * Provide `children` to replace the default icon, or `onClick` to override the
8759
+ * default behavior.
8760
+ */
8761
+ function ToolbarSwitchboardButton(props) {
8762
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8763
+ name: "Drive",
8764
+ size: 16
8765
+ }) } = props;
8705
8766
  const getSwitchboardLink = useGetSwitchboardLink(document);
8706
- function handleDownloadDocument() {
8707
- if (!document) return;
8708
- (onDownloadDocument ?? defaultDownloadDocument)(document);
8709
- }
8710
- const handleDefaultSwitchboardClick = async () => {
8711
- if (getSwitchboardLink) try {
8712
- const url = await getSwitchboardLink();
8713
- window.open(url, "_blank");
8714
- } catch (error) {
8715
- console.error("Error opening switchboard link:", error);
8716
- }
8767
+ const onClick = makeOnClick(document, onClickOverride, () => {
8768
+ getSwitchboardLink?.().then((url) => window.open(url, "_blank")).catch((error) => console.error("Error opening switchboard link:", error));
8769
+ });
8770
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8771
+ "data-testid": "toolbar-switchboard-button",
8772
+ "aria-label": "Open link in Switchboard",
8773
+ className,
8774
+ onClick,
8775
+ children
8776
+ });
8777
+ }
8778
+ /**
8779
+ * Toolbar control for showing the current document's revision history.
8780
+ *
8781
+ * Provide `children` to replace the default icon, or `onClick` to override the
8782
+ * default revision-history behavior.
8783
+ */
8784
+ function ToolbarHistoryButton(props) {
8785
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8786
+ name: "History",
8787
+ size: 16
8788
+ }) } = props;
8789
+ const onClick = makeOnClick(document, onClickOverride, showRevisionHistory);
8790
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8791
+ "data-testid": "toolbar-history-button",
8792
+ "aria-label": "Open document revision history",
8793
+ className,
8794
+ onClick,
8795
+ children
8796
+ });
8797
+ }
8798
+ /**
8799
+ * Toolbar control for closing the current document view.
8800
+ *
8801
+ * By default, this selects the current document's parent folder. Provide
8802
+ * `children` to replace the default icon, or `onClick` to override the default
8803
+ * close behavior.
8804
+ */
8805
+ function ToolbarCloseButton(props) {
8806
+ const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
8807
+ name: "XmarkLight",
8808
+ size: 16
8809
+ }) } = props;
8810
+ const parentFolder = useNodeParentFolderById(document?.header.id);
8811
+ const onClick = makeOnClick(document, onClickOverride, () => setSelectedNode(parentFolder));
8812
+ return /* @__PURE__ */ jsx(ToolbarButton, {
8813
+ "data-testid": "toolbar-close-button",
8814
+ "aria-label": "Close document",
8815
+ className,
8816
+ onClick,
8817
+ children
8818
+ });
8819
+ }
8820
+ /**
8821
+ * Creates a toolbar button click handler.
8822
+ *
8823
+ * If an override is provided, it is called with the current document. Otherwise,
8824
+ * the built-in handler is called with the current document.
8825
+ */
8826
+ function makeOnClick(document, onClickOverride, defaultOnClick) {
8827
+ if (e$6(onClickOverride)) return () => onClickOverride(document);
8828
+ return () => defaultOnClick(document);
8829
+ }
8830
+ /**
8831
+ * Text input styled for use inside a toolbar.
8832
+ *
8833
+ * This wraps `NodeInput` with toolbar-specific text styling. Use it for inline
8834
+ * toolbar editing flows where the user can submit a value or cancel editing.
8835
+ */
8836
+ function ToolbarInput(props) {
8837
+ const { defaultValue, className, onSubmit, onCancel, "aria-label": ariaLabel } = props;
8838
+ return /* @__PURE__ */ jsx(NodeInput, {
8839
+ defaultValue,
8840
+ className: twMerge("text-center text-sm font-medium text-gray-500", className),
8841
+ "aria-label": ariaLabel,
8842
+ onCancel,
8843
+ onSubmit
8844
+ });
8845
+ }
8846
+ /**
8847
+ * Toolbar control for displaying and renaming the current document.
8848
+ *
8849
+ * By default, the component renders the document name as a clickable heading.
8850
+ * When clicked, it switches to an inline input. Submitting the input renames
8851
+ * both the node and the corresponding drive node entry.
8852
+ */
8853
+ function ToolbarName(props) {
8854
+ const { document, inputClassName, titleClassName } = props;
8855
+ const [isEditing, setIsEditing] = useState(false);
8856
+ const node = useNodeById(document?.header.id);
8857
+ const { onRenameNode, onRenameDriveNodes } = useNodeActions();
8858
+ const documentName = document?.header.name;
8859
+ const documentId = document?.header.id;
8860
+ const activateEditing = () => setIsEditing(true);
8861
+ const cancelEditing = () => setIsEditing(false);
8862
+ const onSubmit = (newName) => {
8863
+ cancelEditing();
8864
+ if (!documentId || !node) return;
8865
+ Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, documentId)]).catch(console.error);
8717
8866
  };
8718
- const resolvedSwitchboardHandler = onSwitchboardLinkClick ?? (getSwitchboardLink ? handleDefaultSwitchboardClick : void 0);
8719
- const isDownloadDisabled = !document;
8720
- const isSwitchboardLinkDisabled = !resolvedSwitchboardHandler;
8721
- const isTimelineDisabled = timelineItemsData.length === 0;
8722
- useEffect(() => {
8723
- if (typeof initialTimelineVisible === "boolean") setShowTimeline(initialTimelineVisible);
8724
- }, [initialTimelineVisible]);
8725
- const handleTimelineToggle = () => {
8726
- if (isTimelineDisabled) return;
8727
- setShowTimeline(!showTimeline);
8867
+ if (!documentName) return null;
8868
+ if (isEditing) return /* @__PURE__ */ jsx(ToolbarInput, {
8869
+ className: inputClassName,
8870
+ onSubmit,
8871
+ onCancel: cancelEditing,
8872
+ defaultValue: documentName,
8873
+ "aria-label": "Document name"
8874
+ });
8875
+ return /* @__PURE__ */ jsx("h1", {
8876
+ className: twMerge("cursor-pointer text-sm font-medium text-gray-500 hover:text-gray-700", titleClassName),
8877
+ onClick: activateEditing,
8878
+ title: "Click to edit",
8879
+ children: documentName
8880
+ });
8881
+ }
8882
+ /**
8883
+ * Default slot layout for the built-in document toolbar controls.
8884
+ *
8885
+ * The toolbar is divided into three control groups:
8886
+ *
8887
+ * - `first`: primary document actions.
8888
+ * - `second`: document identity/display controls.
8889
+ * - `third`: secondary document actions.
8890
+ */
8891
+ const defaultControlSlots = {
8892
+ first: [
8893
+ "undo",
8894
+ "redo",
8895
+ "download"
8896
+ ],
8897
+ second: ["name"],
8898
+ third: [
8899
+ "history",
8900
+ "switchboard",
8901
+ "close"
8902
+ ]
8903
+ };
8904
+ /**
8905
+ * Ordered list of toolbar slot names.
8906
+ */
8907
+ const controlSlots = t$3(defaultControlSlots);
8908
+ /**
8909
+ * Ordered list of all built-in document toolbar control names.
8910
+ *
8911
+ * The order is derived from `defaultControlSlots`.
8912
+ */
8913
+ const documentToolbarControls = [
8914
+ ...defaultControlSlots.first,
8915
+ ...defaultControlSlots.second,
8916
+ ...defaultControlSlots.third
8917
+ ];
8918
+ /**
8919
+ * Default component implementation for each built-in toolbar control.
8920
+ *
8921
+ * These components are used unless a matching entry is provided through
8922
+ * `componentOverrides`.
8923
+ */
8924
+ const defaultControlComponents = {
8925
+ undo: ToolbarUndoButton,
8926
+ redo: ToolbarRedoButton,
8927
+ download: ToolbarDownloadButton,
8928
+ name: ToolbarName,
8929
+ switchboard: ToolbarSwitchboardButton,
8930
+ history: ToolbarHistoryButton,
8931
+ close: ToolbarCloseButton
8932
+ };
8933
+ /**
8934
+ * Creates a predicate for checking whether a built-in toolbar control should render.
8935
+ *
8936
+ * A control renders when it is included in `enabledControls` and absent from
8937
+ * `disabledControls`. When `enabledControls` is omitted, all built-in controls
8938
+ * are considered enabled. When a control appears in both lists,
8939
+ * `disabledControls` takes precedence.
8940
+ */
8941
+ function makeIsEnabledChecker(args) {
8942
+ const { enabledControls = documentToolbarControls, disabledControls = [] } = args;
8943
+ return (control) => e$5(control, enabledControls) && !e$5(control, disabledControls);
8944
+ }
8945
+ /**
8946
+ * Creates a getter for rendering the built-in toolbar controls in a slot.
8947
+ *
8948
+ * The returned function resolves the controls assigned to a slot, filters them
8949
+ * through the enabled/disabled control lists, applies any component overrides,
8950
+ * and renders each control with the current document.
8951
+ */
8952
+ function makeToolbarControlsRenderer(args) {
8953
+ const { document, enabledControls, disabledControls, componentOverrides } = args;
8954
+ const checkIsEnabled = makeIsEnabledChecker({
8955
+ enabledControls,
8956
+ disabledControls
8957
+ });
8958
+ const renderComponent = (control) => t$8(e(componentOverrides, control), t$10(e(defaultControlComponents, control)), (Component) => /* @__PURE__ */ jsx(Component, { document }, control));
8959
+ return (slot) => t$8(e(defaultControlSlots, slot), n$3(checkIsEnabled), t$2(renderComponent));
8960
+ }
8961
+ /**
8962
+ * Checks whether a custom control should render in the requested position.
8963
+ *
8964
+ * Controls without an explicit position are treated as `"start"`.
8965
+ */
8966
+ function isControlInPosition(control, position) {
8967
+ return t$10(control.position, "start") === position;
8968
+ }
8969
+ /**
8970
+ * Creates a getter for rendering custom controls in a slot and position.
8971
+ *
8972
+ * The returned function resolves the custom control or controls assigned to a
8973
+ * slot, then renders only the controls that belong in the requested position.
8974
+ */
8975
+ function makeCustomControlsRenderer(args) {
8976
+ const { document, customControls = {} } = args;
8977
+ return (slot, pos) => {
8978
+ const controlOrControlList = e(customControls, slot);
8979
+ if (!e$6(controlOrControlList)) return null;
8980
+ if (e$7(controlOrControlList)) return renderCustomControlList(controlOrControlList, pos, document);
8981
+ return renderCustomControl(controlOrControlList, pos, document);
8728
8982
  };
8729
- return /* @__PURE__ */ jsxs("div", {
8730
- className: "flex w-full flex-col",
8731
- ...containerProps,
8983
+ }
8984
+ /**
8985
+ * Renders a single custom control when it belongs in the requested position.
8986
+ */
8987
+ function renderCustomControl(control, pos, document) {
8988
+ if (!isControlInPosition(control, pos)) return null;
8989
+ const Component = control.component;
8990
+ return /* @__PURE__ */ jsx(Component, { document });
8991
+ }
8992
+ /**
8993
+ * Renders a list of custom controls for the requested position.
8994
+ *
8995
+ * Returns `null` when no controls in the list belong in that position.
8996
+ */
8997
+ function renderCustomControlList(controls, pos, document) {
8998
+ const controlsInPosition = n$3(controls, (control) => isControlInPosition(control, pos));
8999
+ if (!t$7(controlsInPosition, 1)) return null;
9000
+ return /* @__PURE__ */ jsx(Fragment$1, { children: t$2(controlsInPosition, ({ component: Component, key }) => /* @__PURE__ */ jsx(Component, { document }, key)) });
9001
+ }
9002
+ /**
9003
+ * Renders a document toolbar.
9004
+ *
9005
+ * By default, the toolbar renders the built-in document controls grouped into
9006
+ * toolbar slots. The controls operate on the provided `document`, or on the
9007
+ * currently selected document when no document is provided.
9008
+ *
9009
+ * Use `enabledControls` and `disabledControls` to control which built-in
9010
+ * controls are shown. Use `componentOverrides` to replace individual built-in
9011
+ * controls while keeping the default toolbar layout. Use `customControls` to
9012
+ * insert additional controls before or after the built-in controls in a slot.
9013
+ *
9014
+ * To take over the toolbar contents completely, pass `children`.
9015
+ */
9016
+ function DocumentToolbar(props) {
9017
+ const [selectedDocument] = useSelectedDocumentSafe();
9018
+ const { toolbarClassName, document = selectedDocument, toolbarContainer: Container = ToolbarContainer } = props;
9019
+ if ("children" in props) return /* @__PURE__ */ jsx(Container, {
9020
+ className: toolbarClassName,
9021
+ children: props.children
9022
+ });
9023
+ return /* @__PURE__ */ jsx(Container, {
9024
+ className: toolbarClassName,
9025
+ children: t$2(controlSlots, (slot) => /* @__PURE__ */ createElement(ControlsContainerSlot, {
9026
+ ...props,
9027
+ document,
9028
+ slot,
9029
+ key: slot
9030
+ }))
9031
+ });
9032
+ }
9033
+ /**
9034
+ * Renders one toolbar controls slot.
9035
+ *
9036
+ * Custom controls with position `"start"` are rendered before the built-in
9037
+ * controls for the slot. Custom controls with position `"end"` are rendered
9038
+ * after them.
9039
+ */
9040
+ function ControlsContainerSlot(props) {
9041
+ const { slot, document, controlsContainerClassName, enabledControls, disabledControls, componentOverrides, customControls, controlsContainer: ControlsContainer = ToolbarControlsContainer } = props;
9042
+ const renderToolbarControls = makeToolbarControlsRenderer({
9043
+ document,
9044
+ enabledControls,
9045
+ disabledControls,
9046
+ componentOverrides
9047
+ });
9048
+ const renderCustomControls = makeCustomControlsRenderer({
9049
+ document,
9050
+ customControls
9051
+ });
9052
+ return /* @__PURE__ */ jsxs(ControlsContainer, {
9053
+ className: controlsContainerClassName,
8732
9054
  children: [
8733
- /* @__PURE__ */ jsxs("div", {
8734
- className: twMerge("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4", className),
8735
- children: [
8736
- /* @__PURE__ */ jsxs("div", {
8737
- className: "flex items-center gap-x-2",
8738
- children: [
8739
- enabledControls.includes("undo") && /* @__PURE__ */ jsx("button", {
8740
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isUndoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8741
- onClick: documentUndoRedo.undo,
8742
- disabled: isUndoDisabled,
8743
- children: /* @__PURE__ */ jsx(Icon, {
8744
- name: "ArrowCouterclockwise",
8745
- size: 16,
8746
- className: isUndoDisabled ? "text-gray-500" : "text-gray-900"
8747
- })
8748
- }),
8749
- enabledControls.includes("redo") && /* @__PURE__ */ jsx("button", {
8750
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isRedoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8751
- onClick: documentUndoRedo.redo,
8752
- disabled: isRedoDisabled,
8753
- children: /* @__PURE__ */ jsx("div", {
8754
- className: "-scale-x-100",
8755
- children: /* @__PURE__ */ jsx(Icon, {
8756
- name: "ArrowCouterclockwise",
8757
- size: 16,
8758
- className: isRedoDisabled ? "text-gray-500" : "text-gray-900"
8759
- })
8760
- })
8761
- }),
8762
- enabledControls.includes("export") && /* @__PURE__ */ jsx("button", {
8763
- className: twMerge("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm", isDownloadDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8764
- onClick: handleDownloadDocument,
8765
- disabled: isDownloadDisabled,
8766
- children: /* @__PURE__ */ jsx("span", {
8767
- className: isDownloadDisabled ? "text-gray-500" : "text-gray-900",
8768
- children: "Download"
8769
- })
8770
- })
8771
- ]
8772
- }),
8773
- /* @__PURE__ */ jsx("div", {
8774
- className: "flex items-center",
8775
- children: isEditingName && document ? /* @__PURE__ */ jsx(NodeInput, {
8776
- defaultValue: documentName,
8777
- className: "text-center text-sm font-medium text-gray-500",
8778
- "aria-label": "Document name",
8779
- onCancel: () => setIsEditingName(false),
8780
- onSubmit: (newName) => {
8781
- const node = { id: document.header.id };
8782
- Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, document.header.id)]).then(() => setIsEditingName(false)).catch((error) => {
8783
- console.error("Failed to rename document:", error);
8784
- setIsEditingName(false);
8785
- });
8786
- }
8787
- }) : /* @__PURE__ */ jsx("h1", {
8788
- className: twMerge("text-sm font-medium text-gray-500", document && "cursor-pointer hover:text-gray-700"),
8789
- onDoubleClick: document ? () => setIsEditingName(true) : void 0,
8790
- title: document ? "Double-click to edit" : void 0,
8791
- children: documentName
8792
- })
8793
- }),
8794
- /* @__PURE__ */ jsxs("div", {
8795
- className: "flex items-center gap-x-2",
8796
- children: [
8797
- !isSwitchboardLinkDisabled && /* @__PURE__ */ jsx("button", {
8798
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", "cursor-pointer active:opacity-70"),
8799
- onClick: resolvedSwitchboardHandler,
8800
- disabled: isSwitchboardLinkDisabled,
8801
- children: /* @__PURE__ */ jsx(Icon, {
8802
- name: "Drive",
8803
- size: 16,
8804
- className: "text-gray-900"
8805
- })
8806
- }),
8807
- enabledControls.includes("history") && /* @__PURE__ */ jsx("button", {
8808
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", disableRevisionHistory ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8809
- onClick: showRevisionHistory,
8810
- disabled: disableRevisionHistory,
8811
- children: /* @__PURE__ */ jsx(Icon, {
8812
- name: "History",
8813
- size: 16,
8814
- className: disableRevisionHistory ? "text-gray-500" : "text-gray-900"
8815
- })
8816
- }),
8817
- enabledControls.includes("timeline") && defaultTimelineVisible && /* @__PURE__ */ jsx("button", {
8818
- className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isTimelineDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
8819
- onClick: handleTimelineToggle,
8820
- disabled: isTimelineDisabled,
8821
- "aria-pressed": showTimeline,
8822
- children: /* @__PURE__ */ jsx(Icon, {
8823
- name: "Timeline",
8824
- size: 16,
8825
- className: twMerge("text-gray-900", isTimelineDisabled && "opacity-50", showTimeline && "text-blue-600")
8826
- })
8827
- }),
8828
- /* @__PURE__ */ jsx("button", {
8829
- id: "close-document-button",
8830
- "aria-label": "Close document",
8831
- className: "grid size-8 cursor-pointer place-items-center rounded-lg border border-gray-200 bg-white active:opacity-70",
8832
- onClick: handleClose,
8833
- children: /* @__PURE__ */ jsx(Icon, {
8834
- name: "XmarkLight",
8835
- size: 16,
8836
- className: "text-gray-900"
8837
- })
8838
- })
8839
- ]
8840
- })
8841
- ]
8842
- }),
8843
- showTimeline && /* @__PURE__ */ jsx("div", {
8844
- className: "mt-2 w-full",
8845
- children: /* @__PURE__ */ jsx(Suspense, {
8846
- fallback: null,
8847
- children: /* @__PURE__ */ jsx(DocumentTimeline$1, {
8848
- timeline: timelineItemsData,
8849
- onItemClick: setSelectedTimelineItem
8850
- })
8851
- })
8852
- }),
8853
- children
9055
+ renderCustomControls(slot, "start"),
9056
+ renderToolbarControls(slot),
9057
+ renderCustomControls(slot, "end")
8854
9058
  ]
8855
9059
  });
8856
- };
9060
+ }
8857
9061
  function ConnectDropdownMenu(props) {
8858
9062
  const { children, items, open, onItemClick, onOpenChange, menuClassName } = props;
8859
9063
  return /* @__PURE__ */ jsxs(DropdownMenu, {
@@ -9014,7 +9218,7 @@ function FileItem(props) {
9014
9218
  RENAME: () => setMode("WRITE"),
9015
9219
  DELETE: () => showDeleteNodeModal(fileNode)
9016
9220
  };
9017
- const dropdownMenuOptions = t$5(fileNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
9221
+ const dropdownMenuOptions = t$8(fileNodeDropdownOptions, t$6(), t$2(([id, option]) => t$13(option, "id", id)));
9018
9222
  function onSubmit(name) {
9019
9223
  Promise.all([onRenameNode(name, fileNode), onRenameDriveNodes(name, fileNode.id)]).catch((error) => {
9020
9224
  console.error(error);
@@ -9044,9 +9248,9 @@ function FileItem(props) {
9044
9248
  width: 32,
9045
9249
  draggable: false
9046
9250
  }), isReadMode && syncStatus && /* @__PURE__ */ jsx("div", {
9047
- className: "absolute bottom-[-2px] right-0 size-3 rounded-full bg-white",
9251
+ className: "absolute right-0 bottom-[-2px] size-3 rounded-full bg-white",
9048
9252
  children: /* @__PURE__ */ jsx("div", {
9049
- className: "absolute left-[-2px] top-[-2px]",
9253
+ className: "absolute top-[-2px] left-[-2px]",
9050
9254
  children: /* @__PURE__ */ jsx(SyncStatusIcon, {
9051
9255
  overrideSyncIcons: { SUCCESS: "CheckCircleFill" },
9052
9256
  syncStatus
@@ -9054,7 +9258,7 @@ function FileItem(props) {
9054
9258
  })
9055
9259
  })]
9056
9260
  });
9057
- const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2 text-gray-600 hover:text-gray-800", isDragging ? "opacity-60" : "", className);
9261
+ const containerStyles = twMerge("group flex h-12 cursor-pointer items-center rounded-lg bg-gray-200 px-2 text-gray-600 select-none hover:text-gray-800", isDragging ? "opacity-60" : "", className);
9058
9262
  const content = isReadMode ? /* @__PURE__ */ jsxs("div", {
9059
9263
  className: "flex w-52 items-center justify-between",
9060
9264
  children: [/* @__PURE__ */ jsxs("div", {
@@ -9132,7 +9336,7 @@ function FolderItem(props) {
9132
9336
  RENAME: () => setMode("WRITE"),
9133
9337
  DELETE: () => showDeleteNodeModal(folderNode)
9134
9338
  };
9135
- const dropdownMenuOptions = t$5(folderNodeDropdownOptions, t$3(), t(([id, option]) => t$9(option, "id", id)));
9339
+ const dropdownMenuOptions = t$8(folderNodeDropdownOptions, t$6(), t$2(([id, option]) => t$13(option, "id", id)));
9136
9340
  function onDropdownMenuOptionClick(itemId) {
9137
9341
  const handler = dropdownMenuHandlers[itemId];
9138
9342
  if (!handler) {
@@ -9151,7 +9355,7 @@ function FolderItem(props) {
9151
9355
  onCancel,
9152
9356
  onSubmit
9153
9357
  });
9154
- const containerStyles = twMerge("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2", isDragging ? "opacity-60" : isDropTarget ? "bg-blue-100" : "", className);
9358
+ const containerStyles = twMerge("group flex h-12 cursor-pointer items-center rounded-lg bg-gray-200 px-2 select-none", isDragging ? "opacity-60" : isDropTarget ? "bg-blue-100" : "", className);
9155
9359
  return /* @__PURE__ */ jsx("div", {
9156
9360
  className: "relative w-64",
9157
9361
  onClick: isReadMode ? () => setSelectedNode(folderNode) : void 0,
@@ -9253,4 +9457,4 @@ const ConnectSearchBar = (props) => {
9253
9457
  //#endregion
9254
9458
  export { useUserPermissions as C, useSetPHDocumentEditorConfig as S, useDocumentModelModules as _, FolderItem as a, useSelectedDocumentOfType as b, FormProvider as c, set as d, useForm as f, showCreateDocumentModal as g, isFolderNodeKind as h, FileItem as i, appendErrors as l, isFileNodeKind as m, ConnectSearchBar as n, useVirtualizer as o, useFormContext as p, DocumentToolbar as r, Controller as s, Breadcrumbs as t, get as u, useNodesInSelectedDriveOrFolder as v, useSetPHAppConfig as x, usePHToast as y };
9255
9459
 
9256
- //# sourceMappingURL=connect-ysCIyOu6.js.map
9460
+ //# sourceMappingURL=connect-CKdlDSUw.js.map