@arbidocs/blocks 0.5.135 → 0.5.136

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 (181) hide show
  1. package/dist/{DocumentReviewCard-EM2AJUF3.cjs → DocumentReviewCard-UV3DLFCB.cjs} +3 -3
  2. package/dist/{DocumentReviewCard-EM2AJUF3.cjs.map → DocumentReviewCard-UV3DLFCB.cjs.map} +1 -1
  3. package/dist/connect/index.cjs +9 -9
  4. package/dist/index.cjs +22 -22
  5. package/dist/vite/index.cjs +11 -1
  6. package/dist/vite/index.cjs.map +1 -1
  7. package/dist/vite/index.d.ts +13 -0
  8. package/dist/vite/index.js +11 -1
  9. package/dist/vite/index.js.map +1 -1
  10. package/dist/workflow-canvas/index.cjs +1 -1
  11. package/node_modules/@arbidocs/coedit/dist/commands.cjs +18 -1
  12. package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -1
  13. package/node_modules/@arbidocs/coedit/dist/commands.d.cts +2 -2
  14. package/node_modules/@arbidocs/coedit/dist/commands.d.ts +2 -2
  15. package/node_modules/@arbidocs/coedit/dist/commands.js +18 -1
  16. package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -1
  17. package/node_modules/@arbidocs/coedit/dist/{port-BbN5OZHx.d.cts → port-DXBNxZYw.d.cts} +2 -0
  18. package/node_modules/@arbidocs/coedit/dist/{port-BbN5OZHx.d.ts → port-DXBNxZYw.d.ts} +2 -0
  19. package/node_modules/@arbidocs/coedit/dist/server.cjs +16 -0
  20. package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -1
  21. package/node_modules/@arbidocs/coedit/dist/server.d.cts +1 -1
  22. package/node_modules/@arbidocs/coedit/dist/server.d.ts +1 -1
  23. package/node_modules/@arbidocs/coedit/dist/server.js +16 -0
  24. package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -1
  25. package/node_modules/@arbidocs/coedit/package.json +2 -2
  26. package/node_modules/@docx-editor.dev/core/README.md +25 -1
  27. package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +1 -0
  28. package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -1
  29. package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +21 -63
  30. package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -1
  31. package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -1
  32. package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +49 -40
  33. package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -1
  34. package/node_modules/@docx-editor.dev/core/dist/{chrome-print-CAs51cpq.d.ts → chrome-print-CrPI9ZQc.d.ts} +714 -290
  35. package/node_modules/@docx-editor.dev/core/dist/chunk-23MKR33J.js +4 -0
  36. package/node_modules/@docx-editor.dev/core/dist/chunk-2CWQY27B.cjs +1 -0
  37. package/node_modules/@docx-editor.dev/core/dist/chunk-2DEY5NUC.cjs +32 -0
  38. package/node_modules/@docx-editor.dev/core/dist/chunk-2DR4TH6B.js +1 -0
  39. package/node_modules/@docx-editor.dev/core/dist/chunk-2F2UEAE2.js +2 -0
  40. package/node_modules/@docx-editor.dev/core/dist/chunk-2GPGAFOJ.cjs +5 -0
  41. package/node_modules/@docx-editor.dev/core/dist/chunk-ALD626VU.cjs +2 -0
  42. package/node_modules/@docx-editor.dev/core/dist/chunk-AU33YWEJ.js +236 -0
  43. package/node_modules/@docx-editor.dev/core/dist/chunk-AXU63LYW.cjs +1 -0
  44. package/node_modules/@docx-editor.dev/core/dist/chunk-CM5VZRBV.js +32 -0
  45. package/node_modules/@docx-editor.dev/core/dist/chunk-D7FAFFTN.js +1 -0
  46. package/node_modules/@docx-editor.dev/core/dist/chunk-DYUVJNDD.cjs +1 -0
  47. package/node_modules/@docx-editor.dev/core/dist/chunk-ESYUKD5D.js +2 -0
  48. package/node_modules/@docx-editor.dev/core/dist/chunk-F7TGQMVR.js +5 -0
  49. package/node_modules/@docx-editor.dev/core/dist/chunk-FLW7KIQX.js +30 -0
  50. package/node_modules/@docx-editor.dev/core/dist/chunk-JG4A6W6I.js +7 -0
  51. package/node_modules/@docx-editor.dev/core/dist/chunk-JNGLSBPH.js +2 -0
  52. package/node_modules/@docx-editor.dev/core/dist/chunk-KE6ZWRIY.cjs +236 -0
  53. package/node_modules/@docx-editor.dev/core/dist/chunk-L3YXJDPX.js +1 -0
  54. package/node_modules/@docx-editor.dev/core/dist/chunk-LI42N7OW.cjs +4 -0
  55. package/node_modules/@docx-editor.dev/core/dist/chunk-PLKDS4JT.js +1 -0
  56. package/node_modules/@docx-editor.dev/core/dist/chunk-PXMTQ73F.cjs +2 -0
  57. package/node_modules/@docx-editor.dev/core/dist/chunk-R4R3AAE4.js +1 -0
  58. package/node_modules/@docx-editor.dev/core/dist/chunk-RFUNFTGV.cjs +1 -0
  59. package/node_modules/@docx-editor.dev/core/dist/chunk-SVM6PGMS.js +3 -0
  60. package/node_modules/@docx-editor.dev/core/dist/chunk-SZURLHR3.cjs +3 -0
  61. package/node_modules/@docx-editor.dev/core/dist/chunk-UYCGCVZ2.cjs +1 -0
  62. package/node_modules/@docx-editor.dev/core/dist/chunk-WN7ICTA5.js +1 -0
  63. package/node_modules/@docx-editor.dev/core/dist/chunk-X34QRAUU.cjs +1 -0
  64. package/node_modules/@docx-editor.dev/core/dist/chunk-XNBYG4XJ.cjs +30 -0
  65. package/node_modules/@docx-editor.dev/core/dist/chunk-ZDFJW5XS.cjs +2 -0
  66. package/node_modules/@docx-editor.dev/core/dist/chunk-ZWO4JHNN.cjs +7 -0
  67. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -1
  68. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +29 -5
  69. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -1
  70. package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -1
  71. package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +5 -6
  72. package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -1
  73. package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +3 -3
  74. package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +13 -10
  75. package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +2 -2
  76. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +15 -13
  77. package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +135 -2
  78. package/node_modules/@docx-editor.dev/core/dist/{custom-node-writes-Bn6uciLb.d.ts → custom-node-writes-AqY5KpVx.d.ts} +7 -2
  79. package/node_modules/@docx-editor.dev/core/dist/diagnostic-context-CuzhOX0g.d.ts +98 -0
  80. package/node_modules/@docx-editor.dev/core/dist/{diagnostic-hints-BeVjfNOv.d.ts → diagnostic-hints-BtCaCqQC.d.ts} +14 -7
  81. package/node_modules/@docx-editor.dev/core/dist/{document-protection-CUb55pl_.d.ts → document-protection-BvbpSXbQ.d.ts} +1 -1
  82. package/node_modules/@docx-editor.dev/core/dist/drawing-graphic-kind-CXYGYbB3.d.ts +324 -0
  83. package/node_modules/@docx-editor.dev/core/dist/drawing-preview-package-B9lSLRg4.d.ts +115 -0
  84. package/node_modules/@docx-editor.dev/core/dist/{editor-CZQZmTIU.d.ts → editor-B7OOAAie.d.ts} +536 -283
  85. package/node_modules/@docx-editor.dev/core/dist/editor-fonts-D_-vjuJi.d.ts +53 -0
  86. package/node_modules/@docx-editor.dev/core/dist/editor-scope-CA6egMaK.d.ts +141 -0
  87. package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -1
  88. package/node_modules/@docx-editor.dev/core/dist/editor.css +6 -4
  89. package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +834 -34
  90. package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -1
  91. package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -2
  92. package/node_modules/@docx-editor.dev/core/dist/export.d.ts +52 -21
  93. package/node_modules/@docx-editor.dev/core/dist/export.js +2 -2
  94. package/node_modules/@docx-editor.dev/core/dist/{failure-NS2lsya4.d.ts → failure-6KGFrDO9.d.ts} +1 -1
  95. package/node_modules/@docx-editor.dev/core/dist/{font-resolver-lSBLirLR.d.ts → font-resolver-Bm9XqTNO.d.ts} +15 -1
  96. package/node_modules/@docx-editor.dev/core/dist/font-shaping-policy-BvpkrfxM.d.ts +7 -0
  97. package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -1
  98. package/node_modules/@docx-editor.dev/core/dist/index.d.ts +44 -27
  99. package/node_modules/@docx-editor.dev/core/dist/index.js +1 -1
  100. package/node_modules/@docx-editor.dev/core/dist/{layout-shaping-BD-dF_rn.d.ts → layout-shaping-Ci_BTnSU.d.ts} +3 -2
  101. package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -1
  102. package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +276 -126
  103. package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -1
  104. package/node_modules/@docx-editor.dev/core/dist/metafile-drawing-DtMFyMKq.d.ts +107 -0
  105. package/node_modules/@docx-editor.dev/core/dist/{note-properties-qQUjO1GQ.d.ts → note-properties-DCIJUKIy.d.ts} +1 -1
  106. package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -1
  107. package/node_modules/@docx-editor.dev/core/dist/output.d.ts +24 -10
  108. package/node_modules/@docx-editor.dev/core/dist/output.js +1 -1
  109. package/node_modules/@docx-editor.dev/core/dist/{protocol-DYzzz2ej.d.ts → protocol-Cp_QzVxS.d.ts} +167 -5
  110. package/node_modules/@docx-editor.dev/core/dist/{review-paragraph-order-CN_0l2Cb.d.ts → review-paragraph-order-BJQ43_r0.d.ts} +1 -1
  111. package/node_modules/@docx-editor.dev/core/dist/revision-projection-OVusTS77.d.ts +258 -0
  112. package/node_modules/@docx-editor.dev/core/dist/{semantic-cell-selection-eYag3P47.d.ts → semantic-cell-selection-CoI5hHBm.d.ts} +2 -2
  113. package/node_modules/@docx-editor.dev/core/dist/{semantic-interaction-kR_QB845.d.ts → semantic-interaction-BbA4dgEo.d.ts} +1 -1
  114. package/node_modules/@docx-editor.dev/core/dist/{semantic-paint-ZayFF3tD.d.ts → semantic-paint-B5JcIv9c.d.ts} +19 -9
  115. package/node_modules/@docx-editor.dev/core/dist/{semantic-record-queries-Bsgth6lv.d.ts → semantic-record-queries-DnO8J5_j.d.ts} +1 -1
  116. package/node_modules/@docx-editor.dev/core/dist/{semantic-records-DQmumPgL.d.ts → semantic-records-DoK0lNjS.d.ts} +697 -608
  117. package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -1
  118. package/node_modules/@docx-editor.dev/core/dist/store.d.ts +527 -123
  119. package/node_modules/@docx-editor.dev/core/dist/store.js +1 -1
  120. package/node_modules/@docx-editor.dev/core/dist/{types-barrel-DuC5QBNC.d.ts → tree-op-types-Df4oY2u4.d.ts} +1723 -765
  121. package/node_modules/@docx-editor.dev/core/dist/{tree-package-store-CovjNARF.d.ts → tree-package-store-DXhX1PE-.d.ts} +617 -428
  122. package/node_modules/@docx-editor.dev/core/dist/{tree-session-contract-CZVAGl51.d.ts → tree-session-contract-CF2625mv.d.ts} +28 -13
  123. package/node_modules/@docx-editor.dev/core/dist/unsupported-elements-CUojsaCr.d.ts +23 -0
  124. package/node_modules/@docx-editor.dev/core/docs/accept-reject-without-scrolling.md +95 -0
  125. package/node_modules/@docx-editor.dev/core/docs/comment-on-found-text.md +72 -0
  126. package/node_modules/@docx-editor.dev/core/docs/custom-review-cards.md +178 -0
  127. package/node_modules/@docx-editor.dev/core/docs/highlight-ranges.md +48 -0
  128. package/node_modules/@docx-editor.dev/core/docs/index.md +36 -0
  129. package/node_modules/@docx-editor.dev/core/docs/propose-rewrite.md +247 -0
  130. package/node_modules/@docx-editor.dev/core/docs/tracked-replacement.md +68 -0
  131. package/node_modules/@docx-editor.dev/core/licenses/ECMA-376.md +29 -0
  132. package/node_modules/@docx-editor.dev/core/package.json +3 -2
  133. package/node_modules/@docx-editor.dev/react/README.md +71 -0
  134. package/node_modules/@docx-editor.dev/react/dist/index.d.mts +936 -86
  135. package/node_modules/@docx-editor.dev/react/dist/index.d.ts +936 -86
  136. package/node_modules/@docx-editor.dev/react/dist/index.js +3 -3
  137. package/node_modules/@docx-editor.dev/react/dist/index.mjs +3 -3
  138. package/node_modules/@docx-editor.dev/react/docs/accept-reject-without-scrolling.md +72 -0
  139. package/node_modules/@docx-editor.dev/react/docs/comment-on-found-text.md +47 -0
  140. package/node_modules/@docx-editor.dev/react/docs/custom-review-cards.md +105 -0
  141. package/node_modules/@docx-editor.dev/react/docs/highlight-ranges.md +25 -0
  142. package/node_modules/@docx-editor.dev/react/docs/index.md +36 -0
  143. package/node_modules/@docx-editor.dev/react/docs/propose-rewrite.md +247 -0
  144. package/node_modules/@docx-editor.dev/react/docs/tracked-replacement.md +45 -0
  145. package/node_modules/@docx-editor.dev/react/package.json +4 -3
  146. package/package.json +8 -8
  147. package/node_modules/@docx-editor.dev/core/dist/chunk-236O4YQW.js +0 -2
  148. package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +0 -1
  149. package/node_modules/@docx-editor.dev/core/dist/chunk-6JPL6ZAS.cjs +0 -5
  150. package/node_modules/@docx-editor.dev/core/dist/chunk-6ZQP4HQ7.js +0 -3
  151. package/node_modules/@docx-editor.dev/core/dist/chunk-7WQ7AAHW.cjs +0 -2
  152. package/node_modules/@docx-editor.dev/core/dist/chunk-BCXH4BXB.js +0 -5
  153. package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +0 -1
  154. package/node_modules/@docx-editor.dev/core/dist/chunk-BY2ACZZ6.cjs +0 -1
  155. package/node_modules/@docx-editor.dev/core/dist/chunk-CAJEXXVG.cjs +0 -4
  156. package/node_modules/@docx-editor.dev/core/dist/chunk-CPWLFPWC.js +0 -30
  157. package/node_modules/@docx-editor.dev/core/dist/chunk-D7ZMDMPX.cjs +0 -3
  158. package/node_modules/@docx-editor.dev/core/dist/chunk-DOHF6FA7.cjs +0 -30
  159. package/node_modules/@docx-editor.dev/core/dist/chunk-DVX32P2P.js +0 -27
  160. package/node_modules/@docx-editor.dev/core/dist/chunk-E4LOMDNL.js +0 -1
  161. package/node_modules/@docx-editor.dev/core/dist/chunk-EKLM7NWB.cjs +0 -7
  162. package/node_modules/@docx-editor.dev/core/dist/chunk-G3K63G7P.cjs +0 -27
  163. package/node_modules/@docx-editor.dev/core/dist/chunk-G4HOFIKJ.js +0 -1
  164. package/node_modules/@docx-editor.dev/core/dist/chunk-JLVBDYVQ.cjs +0 -2
  165. package/node_modules/@docx-editor.dev/core/dist/chunk-LQX36Z5P.js +0 -7
  166. package/node_modules/@docx-editor.dev/core/dist/chunk-LSZ6KPKK.js +0 -1
  167. package/node_modules/@docx-editor.dev/core/dist/chunk-MM5QBMTE.cjs +0 -1
  168. package/node_modules/@docx-editor.dev/core/dist/chunk-OMCG63ZF.js +0 -1
  169. package/node_modules/@docx-editor.dev/core/dist/chunk-OSFOJTHU.cjs +0 -18
  170. package/node_modules/@docx-editor.dev/core/dist/chunk-RCLZXP3B.js +0 -2
  171. package/node_modules/@docx-editor.dev/core/dist/chunk-T6K2QYNZ.cjs +0 -2
  172. package/node_modules/@docx-editor.dev/core/dist/chunk-TRGAVV2Y.js +0 -4
  173. package/node_modules/@docx-editor.dev/core/dist/chunk-U4JZVSOE.js +0 -2
  174. package/node_modules/@docx-editor.dev/core/dist/chunk-UHHYFIDT.cjs +0 -1
  175. package/node_modules/@docx-editor.dev/core/dist/chunk-W35WTWAO.cjs +0 -1
  176. package/node_modules/@docx-editor.dev/core/dist/chunk-YQ5G6LC7.js +0 -18
  177. package/node_modules/@docx-editor.dev/core/dist/diagnostic-context-B8M79cfK.d.ts +0 -30
  178. package/node_modules/@docx-editor.dev/core/dist/editor-scope-7o9xweiJ.d.ts +0 -84
  179. package/node_modules/@docx-editor.dev/core/dist/headless-document-view-pp3q7wIh.d.ts +0 -143
  180. package/node_modules/@docx-editor.dev/core/dist/image-resources-tXLQShoC.d.ts +0 -211
  181. package/node_modules/@docx-editor.dev/core/dist/omml-equation-BUbU0utM.d.ts +0 -85
@@ -2,8 +2,8 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkJYZ6UE5X_cjs = require('./chunk-JYZ6UE5X.cjs');
5
- require('./chunk-VPKKPHJY.cjs');
6
5
  var chunkAEQT2QQX_cjs = require('./chunk-AEQT2QQX.cjs');
6
+ require('./chunk-VPKKPHJY.cjs');
7
7
  var chunkLLD4PNBW_cjs = require('./chunk-LLD4PNBW.cjs');
8
8
  require('./chunk-VIUEPJ3Y.cjs');
9
9
  require('./chunk-C5APAFUY.cjs');
@@ -516,5 +516,5 @@ function DocumentReviewCard({
516
516
  }
517
517
 
518
518
  exports.DocumentReviewCard = DocumentReviewCard;
519
- //# sourceMappingURL=DocumentReviewCard-EM2AJUF3.cjs.map
520
- //# sourceMappingURL=DocumentReviewCard-EM2AJUF3.cjs.map
519
+ //# sourceMappingURL=DocumentReviewCard-UV3DLFCB.cjs.map
520
+ //# sourceMappingURL=DocumentReviewCard-UV3DLFCB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/files/review/useDocumentValueWrites.ts","../src/connection/files/review/useReviewColumns.ts","../src/connection/files/review/DocumentReviewCard.tsx"],"names":["useConnectedWorkspace","useAssignDocTags","useUpdateDocTag","useRemoveDocTags","useRef","useCallback","isPresenceTag","useState","useArbiSessionState","useFilesGridStates","useMemo","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","arrayMove","useBlocksEnvironment","useUpdateDocuments","useCreateTag","useTags","useWorkspaceUsers","useWorkspaceRole","useWorkspaces","tagsForScope","filterDocumentTags","useRelatedDocuments","COLUMN_LABEL_FALLBACKS","canEditDocumentFields","getEntityLabel","jsx","jsxs","DndContext","closestCenter","DroppableContainer","SortableContext","verticalListSortingStrategy","documentFieldContent","canDeleteDocument","KeyValueRow","ConnectedTagEntity","createPortal","DragOverlay","GripVertical"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAA,EAAM;AAAA,eAAA,EAClE,IACE,IAAA,EACN,CAAA;AAAA,cACA,QAAA,CAAS;AAAA;AACX;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"DocumentReviewCard-EM2AJUF3.cjs","sourcesContent":["/**\n * useDocumentValueWrites Hook\n *\n * Provides stable mutation functions for creating, updating, and deleting document tags.\n * Handles checkbox, text, number, and select tag types with citation support.\n */\n\nimport { isPresenceTag } from '@arbidocs/sdk/browser'\nimport { useCallback, useRef } from 'react'\n\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\nimport type { WorkspaceDocument as Doc } from '@arbidocs/react'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\nimport type { DocTagCitations as Citations } from '../fields/documentField'\nimport { useAssignDocTags, useRemoveDocTags, useUpdateDocTag } from '@arbidocs/react'\n\ninterface UseDocumentValueWritesResult {\n handleUpdateTagValue: (doc: Doc, tag: Tag, value: string | boolean) => Promise<void>\n handleUpdateTagWithCitations: (\n doc: Doc,\n tag: Tag,\n note: string,\n citations: Citations\n ) => Promise<void>\n}\n\nexport function useDocumentValueWrites(): UseDocumentValueWritesResult {\n const { workspaceId: selectedWorkspaceId } = useConnectedWorkspace()\n\n // Stabilize mutation hooks - only update when workspaceId changes\n const createDocTagHook = useAssignDocTags()\n const updateDocTagHook = useUpdateDocTag()\n const deleteDocTagHook = useRemoveDocTags()\n\n const mutationsRef = useRef({\n createDocTag: createDocTagHook,\n updateDocTag: updateDocTagHook,\n deleteDocTag: deleteDocTagHook,\n workspaceId: selectedWorkspaceId,\n })\n\n if (mutationsRef.current.workspaceId !== selectedWorkspaceId) {\n mutationsRef.current = {\n createDocTag: createDocTagHook,\n updateDocTag: updateDocTagHook,\n deleteDocTag: deleteDocTagHook,\n workspaceId: selectedWorkspaceId,\n }\n }\n\n const createDocTag = mutationsRef.current.createDocTag\n const updateDocTag = mutationsRef.current.updateDocTag\n const deleteDocTag = mutationsRef.current.deleteDocTag\n\n const handleUpdateTagValue = useCallback(\n async (doc: Doc, tag: Tag, value: string | boolean) => {\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n if (isPresenceTag(tag)) {\n // Label, issue or entity: create if checked, delete if unchecked\n if (value === true && !doctag) {\n await createDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n } else if (value === false && doctag) {\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else {\n // Text/number/select: update note field\n const noteValue = value as string\n\n if (doctag) {\n if (noteValue.trim()) {\n await updateDocTag.mutateAsync({\n tagId: tag.external_id,\n docId: doc.external_id,\n note: noteValue,\n })\n } else {\n // Delete doctag when value is cleared\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else if (noteValue.trim()) {\n await createDocTag.mutateAsync({\n tagId: tag.external_id,\n docIds: [doc.external_id],\n note: noteValue,\n })\n }\n }\n\n // Cache is already patched by useAssignDocTags/useUpdateDocTag/useRemoveDocTags hooks\n },\n [createDocTag, updateDocTag, deleteDocTag]\n )\n\n const handleUpdateTagWithCitations = useCallback(\n async (doc: Doc, tag: Tag, note: string, citations: Citations) => {\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n if (doctag) {\n if (note.trim() || citations) {\n await updateDocTag.mutateAsync({\n tagId: tag.external_id,\n docId: doc.external_id,\n note: note || null,\n citations: citations,\n })\n } else {\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else if (note.trim() || citations) {\n await createDocTag.mutateAsync({\n tagId: tag.external_id,\n docIds: [doc.external_id],\n note: note || null,\n citations: citations,\n })\n }\n\n // Cache is already patched by useAssignDocTags/useUpdateDocTag/useRemoveDocTags hooks\n },\n [createDocTag, updateDocTag, deleteDocTag]\n )\n\n return {\n handleUpdateTagValue,\n handleUpdateTagWithCitations,\n }\n}\n","import { useArbiSessionState } from '@arbidocs/react'\nimport { useFilesGridStates } from '../store'\nimport type { GridState, GridApi } from 'ag-grid-community'\n/**\n * useReviewColumns Hook\n *\n * Provides drag-and-drop functionality for reordering columns in the review form.\n */\n\nimport { useState, useMemo, useCallback } from 'react'\nimport {\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n DragEndEvent,\n DragStartEvent,\n} from '@dnd-kit/core'\nimport { arrayMove, sortableKeyboardCoordinates } from '@dnd-kit/sortable'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\n\n// Columns handled in the header/footer, not in the field list\nconst HEADER_HANDLED_COLUMNS = ['view', 'inConversation', 'shared']\n\ninterface ColumnInfo {\n id: string\n label: string\n type: 'standard' | 'custom'\n tag?: Tag\n}\n\ninterface UseReviewColumnsProps {\n gridId: string\n gridApi?: Pick<GridApi, 'getState' | 'isDestroyed'> | null\n workspaceTags: Tag[]\n getColumnLabel: (colId: string) => string\n onReorderColumns?: (newOrder: string[]) => void\n}\n\ninterface UseReviewColumnsResult {\n activeId: string | null\n hiddenExpanded: boolean\n setHiddenExpanded: (expanded: boolean) => void\n sensors: ReturnType<typeof useSensors>\n visibleColumns: string[]\n allColumns: ColumnInfo[]\n visibleColumnsList: ColumnInfo[]\n hiddenColumnsList: ColumnInfo[]\n activeColumn: ColumnInfo | null\n handleDragStart: (event: DragStartEvent) => void\n handleDragEnd: (event: DragEndEvent) => void\n handleHideColumn: (colId: string) => void\n handleShowColumn: (colId: string) => void\n}\n\nexport function useReviewColumns({\n gridId,\n gridApi,\n workspaceTags,\n getColumnLabel,\n onReorderColumns,\n}: UseReviewColumnsProps): UseReviewColumnsResult {\n const [activeId, setActiveId] = useState<string | null>(null)\n const [hiddenExpanded, setHiddenExpanded] = useState(false)\n\n // A host's shared session layout wins; the kit's normal persisted grid supports other hosts.\n // Before the first saved state, the ready grid already knows its initial column order.\n const sessionGrid = useArbiSessionState((state) => state.grid.states[gridId]) as\n GridState | undefined\n const ownGrid = useFilesGridStates((state) => state.gridStates[gridId])\n const gridState =\n sessionGrid ?? ownGrid ?? (gridApi && !gridApi.isDestroyed() ? gridApi.getState?.() : undefined)\n\n const hiddenColIds = useMemo(\n () => gridState?.columnVisibility?.hiddenColIds || [],\n [gridState?.columnVisibility?.hiddenColIds]\n )\n\n const orderedColIds = useMemo(\n () => gridState?.columnOrder?.orderedColIds || [],\n [gridState?.columnOrder?.orderedColIds]\n )\n\n // Visible columns = ordered columns minus hidden ones\n const visibleColumns = useMemo(\n () =>\n orderedColIds.filter(\n (colId) => !hiddenColIds.includes(colId) && colId !== 'ag-Grid-SelectionColumn'\n ),\n [orderedColIds, hiddenColIds]\n )\n\n // Drag sensors\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 8,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n // Build list of all available columns (standard + custom tags)\n const allColumns = useMemo(() => {\n const result: ColumnInfo[] = []\n\n const allColIds = orderedColIds.filter(\n (colId) => !HEADER_HANDLED_COLUMNS.includes(colId) && colId !== 'ag-Grid-SelectionColumn'\n )\n\n allColIds.forEach((colId) => {\n const tag = workspaceTags.find((t) => t.external_id === colId)\n if (tag) {\n result.push({ id: colId, label: getColumnLabel(colId), type: 'custom', tag })\n } else {\n result.push({ id: colId, label: getColumnLabel(colId), type: 'standard' })\n }\n })\n\n return result\n }, [orderedColIds, workspaceTags, getColumnLabel])\n\n // Split columns into visible and hidden\n const visibleColumnsList = useMemo(() => {\n return visibleColumns\n .map((id) => allColumns.find((col) => col.id === id))\n .filter(Boolean) as ColumnInfo[]\n }, [visibleColumns, allColumns])\n\n const hiddenColumnsList = useMemo(() => {\n return allColumns.filter((col) => !visibleColumns.includes(col.id))\n }, [allColumns, visibleColumns])\n\n // Active column for drag overlay\n const activeColumn = useMemo(() => {\n if (!activeId) return null\n return allColumns.find((col) => col.id === activeId) || null\n }, [activeId, allColumns])\n\n // Hide a column\n const handleHideColumn = useCallback(\n (colId: string) => {\n if (visibleColumns.length <= 1) return\n const newVisibleColumns = visibleColumns.filter((id) => id !== colId)\n onReorderColumns?.(newVisibleColumns)\n },\n [visibleColumns, onReorderColumns]\n )\n\n // Show a column\n const handleShowColumn = useCallback(\n (colId: string) => {\n const newVisibleColumns = [...visibleColumns, colId]\n onReorderColumns?.(newVisibleColumns)\n },\n [visibleColumns, onReorderColumns]\n )\n\n // Drag handlers\n const handleDragStart = useCallback((event: DragStartEvent) => {\n setActiveId(event.active.id as string)\n }, [])\n\n const handleDragEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event\n setActiveId(null)\n\n if (!over) return\n\n const activeColId = active.id as string\n const isActiveInVisible = visibleColumns.includes(activeColId)\n\n const overId = over.id as string\n\n if (activeColId === overId) return\n\n const visibleIds = visibleColumns\n const hiddenIds = hiddenColumnsList.map((col) => col.id)\n\n const isActiveInHidden = hiddenIds.includes(activeColId)\n\n const isOverVisibleContainer = overId === 'visible-container'\n const isOverHiddenContainer = overId === 'hidden-container'\n const isOverInVisible = visibleIds.includes(overId) || isOverVisibleContainer\n const isOverInHidden = hiddenIds.includes(overId) || isOverHiddenContainer\n\n let newVisibleColumns = [...visibleColumns]\n\n // Moving from hidden to visible\n if (isActiveInHidden && isOverInVisible) {\n if (isOverVisibleContainer) {\n newVisibleColumns = [...newVisibleColumns, activeColId]\n } else {\n const dropIndex = newVisibleColumns.indexOf(overId)\n newVisibleColumns = [\n ...newVisibleColumns.slice(0, dropIndex),\n activeColId,\n ...newVisibleColumns.slice(dropIndex),\n ]\n }\n }\n // Moving from visible to hidden\n else if (isActiveInVisible && isOverInHidden) {\n if (newVisibleColumns.length <= 1) return\n newVisibleColumns = newVisibleColumns.filter((id) => id !== activeColId)\n }\n // Reordering within visible\n else if (isActiveInVisible && isOverInVisible && !isOverVisibleContainer) {\n const oldIndex = newVisibleColumns.indexOf(activeColId)\n const newIndex = newVisibleColumns.indexOf(overId)\n if (oldIndex !== -1 && newIndex !== -1) {\n newVisibleColumns = arrayMove(newVisibleColumns, oldIndex, newIndex)\n }\n }\n\n if (newVisibleColumns.join(',') !== visibleColumns.join(',')) {\n onReorderColumns?.(newVisibleColumns)\n }\n },\n [visibleColumns, hiddenColumnsList, onReorderColumns]\n )\n\n return {\n activeId,\n hiddenExpanded,\n setHiddenExpanded,\n sensors,\n visibleColumns,\n allColumns,\n visibleColumnsList,\n hiddenColumnsList,\n activeColumn,\n handleDragStart,\n handleDragEnd,\n handleHideColumn,\n handleShowColumn,\n }\n}\n","/**\n * DocumentReviewCard Component\n *\n * Dynamic vertical form renderer for document fields.\n * Renders columns (tags) vertically for a single document.\n * Schema + Data pattern: Tags = columns, DocTags = cell values.\n */\n\nimport { getEntityLabel, COLUMN_LABEL_FALLBACKS } from '@arbidocs/react/ui'\nimport { filterDocumentTags, tagsForScope } from '@arbidocs/sdk/browser'\nimport {\n useCreateTag,\n useTags,\n useUpdateDocuments,\n useAssignDocTags,\n useWorkspaceUsers,\n useWorkspaceRole,\n useWorkspaces,\n} from '@arbidocs/react'\nimport { useCallback, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport { GripVertical } from 'lucide-react'\nimport { DndContext, closestCenter, DragOverlay } from '@dnd-kit/core'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport type { GridApi } from 'ag-grid-community'\nimport type { WorkspaceDocument as Doc } from '@arbidocs/react'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\nimport type { DocTagCitations as Citations } from '../fields/documentField'\nimport { useRelatedDocuments } from '@arbidocs/react'\nimport { KeyValueRow } from '../../../home/KeyValueRow'\nimport { ConnectedTagEntity } from '../grid/ConnectedTagEntity'\nimport { documentFieldContent } from '../fields/documentField'\nimport { DroppableContainer } from '../../../components/DroppableContainer'\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\nimport { useDocumentValueWrites } from './useDocumentValueWrites'\nimport { useReviewColumns } from './useReviewColumns'\n\nimport { useBlocksEnvironment } from '../../../provider/environment'\nimport { canEditDocumentFields, canDeleteDocument } from '../../../files/permissions'\n\ninterface DocumentReviewCardProps {\n /** Current document to display */\n currentDocument: Doc | null\n /** All documents for navigation (filtered/sorted) */\n documents: Doc[]\n /** Grid ID whose saved column order and visibility the form follows. */\n gridId: string\n /** Grid API for column definitions */\n gridApi: GridApi<Doc>\n /** Called when navigating to a different document */\n onNavigate: (docId: string) => void\n onOpenDocumentViewer: (docId?: string) => void\n onDeleteDocument: (docId: string) => void\n isDocumentViewerEnabled?: boolean\n onReorderColumns?: (newOrder: string[]) => void\n onCompareDocuments?: (docId: string, otherDocId: string) => void\n /** Pre-computed nav state from the parent. If omitted, the hook runs internally. */\n currentIndex?: number\n onPrevious?: () => void\n onNext?: () => void\n}\n\nexport function DocumentReviewCard({\n currentDocument: currentDoc,\n documents,\n gridId,\n gridApi,\n onDeleteDocument,\n onOpenDocumentViewer,\n onReorderColumns,\n onCompareDocuments,\n}: DocumentReviewCardProps) {\n const { notify } = useBlocksEnvironment()\n\n // Active citation state from Zustand\n\n const updateDocument = useUpdateDocuments()\n const createTagMutation = useCreateTag()\n const createDocTagMutation = useAssignDocTags()\n const { data: workspaceTagsRaw = [] } = useTags()\n const { data: workspaceUsers = [] } = useWorkspaceUsers()\n const workspaceRole = useWorkspaceRole()\n const { workspaceId, user, userId } = useConnectedWorkspace()\n const { data: workspaces = [] } = useWorkspaces()\n const ownershipMembers = workspaces.find(\n (workspace) => workspace.external_id === workspaceId\n )?.users\n // Legacy sessions can know the email before the workspace-specific id. This resolves document\n // ownership only; assigned workspace role above never comes from creator status or this lookup.\n const currentUserExtId = useMemo(\n () =>\n (user?.email\n ? ownershipMembers?.find((member) => member.user.email === user.email)?.user.external_id\n : undefined) ?? userId,\n [user?.email, userId, ownershipMembers]\n )\n\n // Sort tags by created_at for stable order\n const workspaceTags = useMemo(() => {\n return tagsForScope(filterDocumentTags(workspaceTagsRaw as Tag[]), 'document').sort(\n (a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()\n )\n }, [workspaceTagsRaw])\n\n // Build related docs map for all documents\n const relatedDocsMap = useRelatedDocuments(documents)\n\n // Helper to get column label from grid\n const getColumnLabel = useCallback(\n (colId: string): string => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n if (colDef?.headerName) return colDef.headerName\n }\n if (COLUMN_LABEL_FALLBACKS[colId]) return COLUMN_LABEL_FALLBACKS[colId]\n const tag = workspaceTags.find((t) => t.external_id === colId)\n if (tag) return tag.name\n return colId\n },\n [gridApi, workspaceTags]\n )\n\n // Helper to get column icon from grid\n const getColumnIcon = useCallback(\n (colId: string): React.ElementType | undefined => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n return colDef?.context?.icon\n }\n return undefined\n },\n [gridApi]\n )\n\n // Helper to check if column is editable\n const isColumnEditable = useCallback(\n (colId: string): boolean => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n if (colDef?.editable === true) return true\n if (typeof colDef?.editable === 'function') return true\n }\n return false\n },\n [gridApi]\n )\n\n // Use extracted hooks\n const {\n handleUpdateTagValue: updateTagValue,\n handleUpdateTagWithCitations: updateTagWithCitations,\n } = useDocumentValueWrites()\n\n const {\n sensors,\n visibleColumns,\n visibleColumnsList,\n activeColumn,\n handleDragStart,\n handleDragEnd,\n } = useReviewColumns({\n gridId,\n gridApi,\n workspaceTags,\n getColumnLabel,\n onReorderColumns,\n })\n\n // Get creator user for current document\n const currentDocCreator = useMemo(() => {\n if (!currentDoc?.created_by_ext_id) return undefined\n const workspaceUser = workspaceUsers?.find(\n (wu) => wu.user.external_id === currentDoc.created_by_ext_id\n )\n return workspaceUser?.user\n }, [currentDoc?.created_by_ext_id, workspaceUsers])\n\n // Same rule as the table grid, so a field is editable here exactly when it is there\n const canEdit = canEditDocumentFields(currentDoc, currentUserExtId, workspaceRole ?? null)\n\n // Handler for updating document fields\n const handleUpdateDocumentField = useCallback(\n async (field: string, value: unknown) => {\n if (!currentDoc) return\n\n if (!canEdit) {\n notify('Unsharing is not possible for this item', 'error')\n return\n }\n\n // Validate date field\n if (field === 'doc_date' && value) {\n const dateValue = value as string\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(dateValue)) {\n notify('Please enter date in YYYY-MM-DD format (e.g., 2024-11-24)', 'error')\n return\n }\n const date = new Date(dateValue)\n if (isNaN(date.getTime())) {\n notify('Please enter a valid date in YYYY-MM-DD format (e.g., 2024-11-24)', 'error')\n return\n }\n }\n\n // Handle metadata fields\n const metadataFields = ['title', 'doc_date', 'doc_nature', 'doc_author', 'doc_subject']\n if (metadataFields.includes(field)) {\n updateDocument.mutate({\n documents: [\n {\n external_id: currentDoc.external_id,\n doc_metadata: {\n ...currentDoc.doc_metadata,\n [field]: value,\n },\n },\n ],\n })\n } else {\n updateDocument.mutate({\n documents: [{ external_id: currentDoc.external_id, [field]: value }],\n })\n }\n\n // Send notification for privacy changes\n if (field === 'shared') {\n if (value === true) {\n notify(\n `Privacy: ${getEntityLabel('DOCUMENT')} now visible to ${getEntityLabel('WORKSPACE')} members`,\n 'success'\n )\n } else {\n notify(`Privacy: ${getEntityLabel('DOCUMENT')} visibility restricted`, 'success')\n }\n }\n },\n [currentDoc, canEdit, updateDocument, notify]\n )\n\n // Wrappers for tag mutations that include currentDoc\n const handleUpdateTagValue = useCallback(\n (tag: Tag, value: string | boolean) => {\n if (currentDoc) {\n updateTagValue(currentDoc, tag, value)\n }\n },\n [currentDoc, updateTagValue]\n )\n\n const handleUpdateTagWithCitations = useCallback(\n (tag: Tag, note: string, citations: Citations) => {\n if (currentDoc) {\n updateTagWithCitations(currentDoc, tag, note, citations)\n }\n },\n [currentDoc, updateTagWithCitations]\n )\n\n // Handler for creating a new label and applying it to the current doc\n const handleCreateAndApplyLabel = useCallback(\n async (name: string) => {\n if (!currentDoc || !name.trim()) return\n const newTag = await createTagMutation.mutateAsync({\n name: name.trim(),\n tagType: { type: 'checkbox', options: [] },\n shared: false,\n })\n if (newTag?.external_id) {\n await createDocTagMutation.mutateAsync({\n tagId: newTag.external_id,\n docIds: [currentDoc.external_id],\n })\n // Cache is already patched by useAssignDocTags hook\n }\n },\n [currentDoc, createTagMutation, createDocTagMutation]\n )\n\n if (!currentDoc) {\n return <div className=\"p-4 text-center text-muted-foreground\">No document selected</div>\n }\n\n return (\n <div\n className=\"h-full flex flex-col bg-card @container\"\n data-testid={`document-card-navigator-${currentDoc.external_id}`}\n >\n {/* Body: Fields with Drag-and-Drop */}\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n >\n <div className=\"flex-1 overflow-y-auto overflow-x-hidden min-h-0\">\n <div className=\"space-y-4 py-2\">\n {/* Visible Fields */}\n <DroppableContainer id=\"visible-container\" className=\"w-full space-y-0.5\">\n <SortableContext items={visibleColumns} strategy={verticalListSortingStrategy}>\n {visibleColumnsList.map((col) => {\n const fieldContent = documentFieldContent({\n columnId: col.id,\n doc: currentDoc,\n canEdit,\n workspaceTags,\n allDocuments: documents,\n creator: currentDocCreator,\n getColumnLabel,\n getColumnIcon,\n isColumnEditable,\n onUpdateDocumentField: handleUpdateDocumentField,\n onUpdateTagValue: handleUpdateTagValue,\n onUpdateTagWithCitations: handleUpdateTagWithCitations,\n onCreateAndApplyLabel: handleCreateAndApplyLabel,\n relatedDocs: relatedDocsMap.get(currentDoc.external_id),\n onOpenDocument: onOpenDocumentViewer,\n onDeleteDocument,\n canDeleteRelatedDocument: (doc) =>\n canDeleteDocument(doc, currentUserExtId, workspaceRole ?? null),\n onCompareDocuments,\n })\n if (!fieldContent) return null\n\n return (\n <KeyValueRow\n key={col.id}\n sortableId={col.id}\n label={fieldContent.label}\n icon={fieldContent.icon}\n labelSlot={\n fieldContent.tag ? (\n <ConnectedTagEntity tag={fieldContent.tag} size=\"md\" />\n ) : undefined\n }\n data-testid={`navigator-field-${col.id}`}\n >\n {fieldContent.children}\n </KeyValueRow>\n )\n })}\n </SortableContext>\n </DroppableContainer>\n </div>\n </div>\n\n {/* Drag Overlay */}\n {createPortal(\n <DragOverlay dropAnimation={null}>\n {activeColumn ? (\n <div className=\"flex items-center gap-1.5 p-1.5 rounded bg-card border-2 border-blue-text shadow-lg cursor-grabbing pointer-events-none\">\n <GripVertical className=\"w-3.5 h-3.5 flex-shrink-0\" />\n <span className=\"text-sm whitespace-nowrap\">{activeColumn.label}</span>\n </div>\n ) : null}\n </DragOverlay>,\n document.body\n )}\n </DndContext>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/files/review/useDocumentValueWrites.ts","../src/connection/files/review/useReviewColumns.ts","../src/connection/files/review/DocumentReviewCard.tsx"],"names":["useConnectedWorkspace","useAssignDocTags","useUpdateDocTag","useRemoveDocTags","useRef","useCallback","isPresenceTag","useState","useArbiSessionState","useFilesGridStates","useMemo","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","arrayMove","useBlocksEnvironment","useUpdateDocuments","useCreateTag","useTags","useWorkspaceUsers","useWorkspaceRole","useWorkspaces","tagsForScope","filterDocumentTags","useRelatedDocuments","COLUMN_LABEL_FALLBACKS","canEditDocumentFields","getEntityLabel","jsx","jsxs","DndContext","closestCenter","DroppableContainer","SortableContext","verticalListSortingStrategy","documentFieldContent","canDeleteDocument","KeyValueRow","ConnectedTagEntity","createPortal","DragOverlay","GripVertical"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,SAAS,sBAAA,GAAuD;AACrE,EAAA,MAAM,EAAE,WAAA,EAAa,mBAAA,EAAoB,GAAIA,uCAAA,EAAsB;AAGnE,EAAA,MAAM,mBAAmBC,sBAAA,EAAiB;AAC1C,EAAA,MAAM,mBAAmBC,qBAAA,EAAgB;AACzC,EAAA,MAAM,mBAAmBC,sBAAA,EAAiB;AAE1C,EAAA,MAAM,eAAeC,cAAA,CAAO;AAAA,IAC1B,YAAA,EAAc,gBAAA;AAAA,IACd,YAAA,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AACD,cAAA,IAAI,CAAC,cAAc,OAAO,IAAA;AAE1B,cAAA,uBACER,cAAA;AAAA,gBAACS,6BAAA;AAAA,gBAAA;AAAA,kBAEC,YAAY,GAAA,CAAI,EAAA;AAAA,kBAChB,OAAO,YAAA,CAAa,KAAA;AAAA,kBACpB,MAAM,YAAA,CAAa,IAAA;AAAA,kBACnB,SAAA,EACE,YAAA,CAAa,GAAA,mBACXT,cAAA,CAACU,oCAAA,EAAA,EAAmB,KAAK,YAAA,CAAa,GAAA,EAAK,IAAA,EAAK,IAAA,EAAK,CAAA,GACnD,MAAA;AAAA,kBAEN,aAAA,EAAa,CAAA,gBAAA,EAAmB,GAAA,CAAI,EAAE,CAAA,CAAA;AAAA,kBAErC,QAAA,EAAA,YAAA,CAAa;AAAA,iBAAA;AAAA,gBAXT,GAAA,CAAI;AAAA,eAYX;AAAA,YAEJ,CAAC,CAAA,EACH,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,YAGCC,qBAAA;AAAA,8BACCX,cAAA,CAACY,oBAAY,aAAA,EAAe,IAAA,EACzB,yCACCX,eAAA,CAAC,KAAA,EAAA,EAAI,WAAU,yHAAA,EACb,QAAA,EAAA;AAAA,gCAAAD,cAAA,CAACa,wBAAA,EAAA,EAAa,WAAU,2BAAA,EAA4B,CAAA;AAAA,gCACpDb,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,2BAAA,EAA6B,uBAAa,KAAA,EAAM;AAAA,eAAA,EAClE,IACE,IAAA,EACN,CAAA;AAAA,cACA,QAAA,CAAS;AAAA;AACX;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"DocumentReviewCard-UV3DLFCB.cjs","sourcesContent":["/**\n * useDocumentValueWrites Hook\n *\n * Provides stable mutation functions for creating, updating, and deleting document tags.\n * Handles checkbox, text, number, and select tag types with citation support.\n */\n\nimport { isPresenceTag } from '@arbidocs/sdk/browser'\nimport { useCallback, useRef } from 'react'\n\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\nimport type { WorkspaceDocument as Doc } from '@arbidocs/react'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\nimport type { DocTagCitations as Citations } from '../fields/documentField'\nimport { useAssignDocTags, useRemoveDocTags, useUpdateDocTag } from '@arbidocs/react'\n\ninterface UseDocumentValueWritesResult {\n handleUpdateTagValue: (doc: Doc, tag: Tag, value: string | boolean) => Promise<void>\n handleUpdateTagWithCitations: (\n doc: Doc,\n tag: Tag,\n note: string,\n citations: Citations\n ) => Promise<void>\n}\n\nexport function useDocumentValueWrites(): UseDocumentValueWritesResult {\n const { workspaceId: selectedWorkspaceId } = useConnectedWorkspace()\n\n // Stabilize mutation hooks - only update when workspaceId changes\n const createDocTagHook = useAssignDocTags()\n const updateDocTagHook = useUpdateDocTag()\n const deleteDocTagHook = useRemoveDocTags()\n\n const mutationsRef = useRef({\n createDocTag: createDocTagHook,\n updateDocTag: updateDocTagHook,\n deleteDocTag: deleteDocTagHook,\n workspaceId: selectedWorkspaceId,\n })\n\n if (mutationsRef.current.workspaceId !== selectedWorkspaceId) {\n mutationsRef.current = {\n createDocTag: createDocTagHook,\n updateDocTag: updateDocTagHook,\n deleteDocTag: deleteDocTagHook,\n workspaceId: selectedWorkspaceId,\n }\n }\n\n const createDocTag = mutationsRef.current.createDocTag\n const updateDocTag = mutationsRef.current.updateDocTag\n const deleteDocTag = mutationsRef.current.deleteDocTag\n\n const handleUpdateTagValue = useCallback(\n async (doc: Doc, tag: Tag, value: string | boolean) => {\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n if (isPresenceTag(tag)) {\n // Label, issue or entity: create if checked, delete if unchecked\n if (value === true && !doctag) {\n await createDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n } else if (value === false && doctag) {\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else {\n // Text/number/select: update note field\n const noteValue = value as string\n\n if (doctag) {\n if (noteValue.trim()) {\n await updateDocTag.mutateAsync({\n tagId: tag.external_id,\n docId: doc.external_id,\n note: noteValue,\n })\n } else {\n // Delete doctag when value is cleared\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else if (noteValue.trim()) {\n await createDocTag.mutateAsync({\n tagId: tag.external_id,\n docIds: [doc.external_id],\n note: noteValue,\n })\n }\n }\n\n // Cache is already patched by useAssignDocTags/useUpdateDocTag/useRemoveDocTags hooks\n },\n [createDocTag, updateDocTag, deleteDocTag]\n )\n\n const handleUpdateTagWithCitations = useCallback(\n async (doc: Doc, tag: Tag, note: string, citations: Citations) => {\n const doctag = doc.doctags?.find((dt) => dt.tag_ext_id === tag.external_id)\n\n if (doctag) {\n if (note.trim() || citations) {\n await updateDocTag.mutateAsync({\n tagId: tag.external_id,\n docId: doc.external_id,\n note: note || null,\n citations: citations,\n })\n } else {\n await deleteDocTag.mutateAsync({ tagId: tag.external_id, docIds: [doc.external_id] })\n }\n } else if (note.trim() || citations) {\n await createDocTag.mutateAsync({\n tagId: tag.external_id,\n docIds: [doc.external_id],\n note: note || null,\n citations: citations,\n })\n }\n\n // Cache is already patched by useAssignDocTags/useUpdateDocTag/useRemoveDocTags hooks\n },\n [createDocTag, updateDocTag, deleteDocTag]\n )\n\n return {\n handleUpdateTagValue,\n handleUpdateTagWithCitations,\n }\n}\n","import { useArbiSessionState } from '@arbidocs/react'\nimport { useFilesGridStates } from '../store'\nimport type { GridState, GridApi } from 'ag-grid-community'\n/**\n * useReviewColumns Hook\n *\n * Provides drag-and-drop functionality for reordering columns in the review form.\n */\n\nimport { useState, useMemo, useCallback } from 'react'\nimport {\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n DragEndEvent,\n DragStartEvent,\n} from '@dnd-kit/core'\nimport { arrayMove, sortableKeyboardCoordinates } from '@dnd-kit/sortable'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\n\n// Columns handled in the header/footer, not in the field list\nconst HEADER_HANDLED_COLUMNS = ['view', 'inConversation', 'shared']\n\ninterface ColumnInfo {\n id: string\n label: string\n type: 'standard' | 'custom'\n tag?: Tag\n}\n\ninterface UseReviewColumnsProps {\n gridId: string\n gridApi?: Pick<GridApi, 'getState' | 'isDestroyed'> | null\n workspaceTags: Tag[]\n getColumnLabel: (colId: string) => string\n onReorderColumns?: (newOrder: string[]) => void\n}\n\ninterface UseReviewColumnsResult {\n activeId: string | null\n hiddenExpanded: boolean\n setHiddenExpanded: (expanded: boolean) => void\n sensors: ReturnType<typeof useSensors>\n visibleColumns: string[]\n allColumns: ColumnInfo[]\n visibleColumnsList: ColumnInfo[]\n hiddenColumnsList: ColumnInfo[]\n activeColumn: ColumnInfo | null\n handleDragStart: (event: DragStartEvent) => void\n handleDragEnd: (event: DragEndEvent) => void\n handleHideColumn: (colId: string) => void\n handleShowColumn: (colId: string) => void\n}\n\nexport function useReviewColumns({\n gridId,\n gridApi,\n workspaceTags,\n getColumnLabel,\n onReorderColumns,\n}: UseReviewColumnsProps): UseReviewColumnsResult {\n const [activeId, setActiveId] = useState<string | null>(null)\n const [hiddenExpanded, setHiddenExpanded] = useState(false)\n\n // A host's shared session layout wins; the kit's normal persisted grid supports other hosts.\n // Before the first saved state, the ready grid already knows its initial column order.\n const sessionGrid = useArbiSessionState((state) => state.grid.states[gridId]) as\n GridState | undefined\n const ownGrid = useFilesGridStates((state) => state.gridStates[gridId])\n const gridState =\n sessionGrid ?? ownGrid ?? (gridApi && !gridApi.isDestroyed() ? gridApi.getState?.() : undefined)\n\n const hiddenColIds = useMemo(\n () => gridState?.columnVisibility?.hiddenColIds || [],\n [gridState?.columnVisibility?.hiddenColIds]\n )\n\n const orderedColIds = useMemo(\n () => gridState?.columnOrder?.orderedColIds || [],\n [gridState?.columnOrder?.orderedColIds]\n )\n\n // Visible columns = ordered columns minus hidden ones\n const visibleColumns = useMemo(\n () =>\n orderedColIds.filter(\n (colId) => !hiddenColIds.includes(colId) && colId !== 'ag-Grid-SelectionColumn'\n ),\n [orderedColIds, hiddenColIds]\n )\n\n // Drag sensors\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 8,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n // Build list of all available columns (standard + custom tags)\n const allColumns = useMemo(() => {\n const result: ColumnInfo[] = []\n\n const allColIds = orderedColIds.filter(\n (colId) => !HEADER_HANDLED_COLUMNS.includes(colId) && colId !== 'ag-Grid-SelectionColumn'\n )\n\n allColIds.forEach((colId) => {\n const tag = workspaceTags.find((t) => t.external_id === colId)\n if (tag) {\n result.push({ id: colId, label: getColumnLabel(colId), type: 'custom', tag })\n } else {\n result.push({ id: colId, label: getColumnLabel(colId), type: 'standard' })\n }\n })\n\n return result\n }, [orderedColIds, workspaceTags, getColumnLabel])\n\n // Split columns into visible and hidden\n const visibleColumnsList = useMemo(() => {\n return visibleColumns\n .map((id) => allColumns.find((col) => col.id === id))\n .filter(Boolean) as ColumnInfo[]\n }, [visibleColumns, allColumns])\n\n const hiddenColumnsList = useMemo(() => {\n return allColumns.filter((col) => !visibleColumns.includes(col.id))\n }, [allColumns, visibleColumns])\n\n // Active column for drag overlay\n const activeColumn = useMemo(() => {\n if (!activeId) return null\n return allColumns.find((col) => col.id === activeId) || null\n }, [activeId, allColumns])\n\n // Hide a column\n const handleHideColumn = useCallback(\n (colId: string) => {\n if (visibleColumns.length <= 1) return\n const newVisibleColumns = visibleColumns.filter((id) => id !== colId)\n onReorderColumns?.(newVisibleColumns)\n },\n [visibleColumns, onReorderColumns]\n )\n\n // Show a column\n const handleShowColumn = useCallback(\n (colId: string) => {\n const newVisibleColumns = [...visibleColumns, colId]\n onReorderColumns?.(newVisibleColumns)\n },\n [visibleColumns, onReorderColumns]\n )\n\n // Drag handlers\n const handleDragStart = useCallback((event: DragStartEvent) => {\n setActiveId(event.active.id as string)\n }, [])\n\n const handleDragEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event\n setActiveId(null)\n\n if (!over) return\n\n const activeColId = active.id as string\n const isActiveInVisible = visibleColumns.includes(activeColId)\n\n const overId = over.id as string\n\n if (activeColId === overId) return\n\n const visibleIds = visibleColumns\n const hiddenIds = hiddenColumnsList.map((col) => col.id)\n\n const isActiveInHidden = hiddenIds.includes(activeColId)\n\n const isOverVisibleContainer = overId === 'visible-container'\n const isOverHiddenContainer = overId === 'hidden-container'\n const isOverInVisible = visibleIds.includes(overId) || isOverVisibleContainer\n const isOverInHidden = hiddenIds.includes(overId) || isOverHiddenContainer\n\n let newVisibleColumns = [...visibleColumns]\n\n // Moving from hidden to visible\n if (isActiveInHidden && isOverInVisible) {\n if (isOverVisibleContainer) {\n newVisibleColumns = [...newVisibleColumns, activeColId]\n } else {\n const dropIndex = newVisibleColumns.indexOf(overId)\n newVisibleColumns = [\n ...newVisibleColumns.slice(0, dropIndex),\n activeColId,\n ...newVisibleColumns.slice(dropIndex),\n ]\n }\n }\n // Moving from visible to hidden\n else if (isActiveInVisible && isOverInHidden) {\n if (newVisibleColumns.length <= 1) return\n newVisibleColumns = newVisibleColumns.filter((id) => id !== activeColId)\n }\n // Reordering within visible\n else if (isActiveInVisible && isOverInVisible && !isOverVisibleContainer) {\n const oldIndex = newVisibleColumns.indexOf(activeColId)\n const newIndex = newVisibleColumns.indexOf(overId)\n if (oldIndex !== -1 && newIndex !== -1) {\n newVisibleColumns = arrayMove(newVisibleColumns, oldIndex, newIndex)\n }\n }\n\n if (newVisibleColumns.join(',') !== visibleColumns.join(',')) {\n onReorderColumns?.(newVisibleColumns)\n }\n },\n [visibleColumns, hiddenColumnsList, onReorderColumns]\n )\n\n return {\n activeId,\n hiddenExpanded,\n setHiddenExpanded,\n sensors,\n visibleColumns,\n allColumns,\n visibleColumnsList,\n hiddenColumnsList,\n activeColumn,\n handleDragStart,\n handleDragEnd,\n handleHideColumn,\n handleShowColumn,\n }\n}\n","/**\n * DocumentReviewCard Component\n *\n * Dynamic vertical form renderer for document fields.\n * Renders columns (tags) vertically for a single document.\n * Schema + Data pattern: Tags = columns, DocTags = cell values.\n */\n\nimport { getEntityLabel, COLUMN_LABEL_FALLBACKS } from '@arbidocs/react/ui'\nimport { filterDocumentTags, tagsForScope } from '@arbidocs/sdk/browser'\nimport {\n useCreateTag,\n useTags,\n useUpdateDocuments,\n useAssignDocTags,\n useWorkspaceUsers,\n useWorkspaceRole,\n useWorkspaces,\n} from '@arbidocs/react'\nimport { useCallback, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport { GripVertical } from 'lucide-react'\nimport { DndContext, closestCenter, DragOverlay } from '@dnd-kit/core'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport type { GridApi } from 'ag-grid-community'\nimport type { WorkspaceDocument as Doc } from '@arbidocs/react'\nimport type { TagResponse as Tag } from '@arbidocs/sdk/browser'\nimport type { DocTagCitations as Citations } from '../fields/documentField'\nimport { useRelatedDocuments } from '@arbidocs/react'\nimport { KeyValueRow } from '../../../home/KeyValueRow'\nimport { ConnectedTagEntity } from '../grid/ConnectedTagEntity'\nimport { documentFieldContent } from '../fields/documentField'\nimport { DroppableContainer } from '../../../components/DroppableContainer'\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\nimport { useDocumentValueWrites } from './useDocumentValueWrites'\nimport { useReviewColumns } from './useReviewColumns'\n\nimport { useBlocksEnvironment } from '../../../provider/environment'\nimport { canEditDocumentFields, canDeleteDocument } from '../../../files/permissions'\n\ninterface DocumentReviewCardProps {\n /** Current document to display */\n currentDocument: Doc | null\n /** All documents for navigation (filtered/sorted) */\n documents: Doc[]\n /** Grid ID whose saved column order and visibility the form follows. */\n gridId: string\n /** Grid API for column definitions */\n gridApi: GridApi<Doc>\n /** Called when navigating to a different document */\n onNavigate: (docId: string) => void\n onOpenDocumentViewer: (docId?: string) => void\n onDeleteDocument: (docId: string) => void\n isDocumentViewerEnabled?: boolean\n onReorderColumns?: (newOrder: string[]) => void\n onCompareDocuments?: (docId: string, otherDocId: string) => void\n /** Pre-computed nav state from the parent. If omitted, the hook runs internally. */\n currentIndex?: number\n onPrevious?: () => void\n onNext?: () => void\n}\n\nexport function DocumentReviewCard({\n currentDocument: currentDoc,\n documents,\n gridId,\n gridApi,\n onDeleteDocument,\n onOpenDocumentViewer,\n onReorderColumns,\n onCompareDocuments,\n}: DocumentReviewCardProps) {\n const { notify } = useBlocksEnvironment()\n\n // Active citation state from Zustand\n\n const updateDocument = useUpdateDocuments()\n const createTagMutation = useCreateTag()\n const createDocTagMutation = useAssignDocTags()\n const { data: workspaceTagsRaw = [] } = useTags()\n const { data: workspaceUsers = [] } = useWorkspaceUsers()\n const workspaceRole = useWorkspaceRole()\n const { workspaceId, user, userId } = useConnectedWorkspace()\n const { data: workspaces = [] } = useWorkspaces()\n const ownershipMembers = workspaces.find(\n (workspace) => workspace.external_id === workspaceId\n )?.users\n // Legacy sessions can know the email before the workspace-specific id. This resolves document\n // ownership only; assigned workspace role above never comes from creator status or this lookup.\n const currentUserExtId = useMemo(\n () =>\n (user?.email\n ? ownershipMembers?.find((member) => member.user.email === user.email)?.user.external_id\n : undefined) ?? userId,\n [user?.email, userId, ownershipMembers]\n )\n\n // Sort tags by created_at for stable order\n const workspaceTags = useMemo(() => {\n return tagsForScope(filterDocumentTags(workspaceTagsRaw as Tag[]), 'document').sort(\n (a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()\n )\n }, [workspaceTagsRaw])\n\n // Build related docs map for all documents\n const relatedDocsMap = useRelatedDocuments(documents)\n\n // Helper to get column label from grid\n const getColumnLabel = useCallback(\n (colId: string): string => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n if (colDef?.headerName) return colDef.headerName\n }\n if (COLUMN_LABEL_FALLBACKS[colId]) return COLUMN_LABEL_FALLBACKS[colId]\n const tag = workspaceTags.find((t) => t.external_id === colId)\n if (tag) return tag.name\n return colId\n },\n [gridApi, workspaceTags]\n )\n\n // Helper to get column icon from grid\n const getColumnIcon = useCallback(\n (colId: string): React.ElementType | undefined => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n return colDef?.context?.icon\n }\n return undefined\n },\n [gridApi]\n )\n\n // Helper to check if column is editable\n const isColumnEditable = useCallback(\n (colId: string): boolean => {\n if (gridApi && !gridApi.isDestroyed()) {\n const colDef = gridApi.getColumnDef(colId)\n if (colDef?.editable === true) return true\n if (typeof colDef?.editable === 'function') return true\n }\n return false\n },\n [gridApi]\n )\n\n // Use extracted hooks\n const {\n handleUpdateTagValue: updateTagValue,\n handleUpdateTagWithCitations: updateTagWithCitations,\n } = useDocumentValueWrites()\n\n const {\n sensors,\n visibleColumns,\n visibleColumnsList,\n activeColumn,\n handleDragStart,\n handleDragEnd,\n } = useReviewColumns({\n gridId,\n gridApi,\n workspaceTags,\n getColumnLabel,\n onReorderColumns,\n })\n\n // Get creator user for current document\n const currentDocCreator = useMemo(() => {\n if (!currentDoc?.created_by_ext_id) return undefined\n const workspaceUser = workspaceUsers?.find(\n (wu) => wu.user.external_id === currentDoc.created_by_ext_id\n )\n return workspaceUser?.user\n }, [currentDoc?.created_by_ext_id, workspaceUsers])\n\n // Same rule as the table grid, so a field is editable here exactly when it is there\n const canEdit = canEditDocumentFields(currentDoc, currentUserExtId, workspaceRole ?? null)\n\n // Handler for updating document fields\n const handleUpdateDocumentField = useCallback(\n async (field: string, value: unknown) => {\n if (!currentDoc) return\n\n if (!canEdit) {\n notify('Unsharing is not possible for this item', 'error')\n return\n }\n\n // Validate date field\n if (field === 'doc_date' && value) {\n const dateValue = value as string\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(dateValue)) {\n notify('Please enter date in YYYY-MM-DD format (e.g., 2024-11-24)', 'error')\n return\n }\n const date = new Date(dateValue)\n if (isNaN(date.getTime())) {\n notify('Please enter a valid date in YYYY-MM-DD format (e.g., 2024-11-24)', 'error')\n return\n }\n }\n\n // Handle metadata fields\n const metadataFields = ['title', 'doc_date', 'doc_nature', 'doc_author', 'doc_subject']\n if (metadataFields.includes(field)) {\n updateDocument.mutate({\n documents: [\n {\n external_id: currentDoc.external_id,\n doc_metadata: {\n ...currentDoc.doc_metadata,\n [field]: value,\n },\n },\n ],\n })\n } else {\n updateDocument.mutate({\n documents: [{ external_id: currentDoc.external_id, [field]: value }],\n })\n }\n\n // Send notification for privacy changes\n if (field === 'shared') {\n if (value === true) {\n notify(\n `Privacy: ${getEntityLabel('DOCUMENT')} now visible to ${getEntityLabel('WORKSPACE')} members`,\n 'success'\n )\n } else {\n notify(`Privacy: ${getEntityLabel('DOCUMENT')} visibility restricted`, 'success')\n }\n }\n },\n [currentDoc, canEdit, updateDocument, notify]\n )\n\n // Wrappers for tag mutations that include currentDoc\n const handleUpdateTagValue = useCallback(\n (tag: Tag, value: string | boolean) => {\n if (currentDoc) {\n updateTagValue(currentDoc, tag, value)\n }\n },\n [currentDoc, updateTagValue]\n )\n\n const handleUpdateTagWithCitations = useCallback(\n (tag: Tag, note: string, citations: Citations) => {\n if (currentDoc) {\n updateTagWithCitations(currentDoc, tag, note, citations)\n }\n },\n [currentDoc, updateTagWithCitations]\n )\n\n // Handler for creating a new label and applying it to the current doc\n const handleCreateAndApplyLabel = useCallback(\n async (name: string) => {\n if (!currentDoc || !name.trim()) return\n const newTag = await createTagMutation.mutateAsync({\n name: name.trim(),\n tagType: { type: 'checkbox', options: [] },\n shared: false,\n })\n if (newTag?.external_id) {\n await createDocTagMutation.mutateAsync({\n tagId: newTag.external_id,\n docIds: [currentDoc.external_id],\n })\n // Cache is already patched by useAssignDocTags hook\n }\n },\n [currentDoc, createTagMutation, createDocTagMutation]\n )\n\n if (!currentDoc) {\n return <div className=\"p-4 text-center text-muted-foreground\">No document selected</div>\n }\n\n return (\n <div\n className=\"h-full flex flex-col bg-card @container\"\n data-testid={`document-card-navigator-${currentDoc.external_id}`}\n >\n {/* Body: Fields with Drag-and-Drop */}\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n >\n <div className=\"flex-1 overflow-y-auto overflow-x-hidden min-h-0\">\n <div className=\"space-y-4 py-2\">\n {/* Visible Fields */}\n <DroppableContainer id=\"visible-container\" className=\"w-full space-y-0.5\">\n <SortableContext items={visibleColumns} strategy={verticalListSortingStrategy}>\n {visibleColumnsList.map((col) => {\n const fieldContent = documentFieldContent({\n columnId: col.id,\n doc: currentDoc,\n canEdit,\n workspaceTags,\n allDocuments: documents,\n creator: currentDocCreator,\n getColumnLabel,\n getColumnIcon,\n isColumnEditable,\n onUpdateDocumentField: handleUpdateDocumentField,\n onUpdateTagValue: handleUpdateTagValue,\n onUpdateTagWithCitations: handleUpdateTagWithCitations,\n onCreateAndApplyLabel: handleCreateAndApplyLabel,\n relatedDocs: relatedDocsMap.get(currentDoc.external_id),\n onOpenDocument: onOpenDocumentViewer,\n onDeleteDocument,\n canDeleteRelatedDocument: (doc) =>\n canDeleteDocument(doc, currentUserExtId, workspaceRole ?? null),\n onCompareDocuments,\n })\n if (!fieldContent) return null\n\n return (\n <KeyValueRow\n key={col.id}\n sortableId={col.id}\n label={fieldContent.label}\n icon={fieldContent.icon}\n labelSlot={\n fieldContent.tag ? (\n <ConnectedTagEntity tag={fieldContent.tag} size=\"md\" />\n ) : undefined\n }\n data-testid={`navigator-field-${col.id}`}\n >\n {fieldContent.children}\n </KeyValueRow>\n )\n })}\n </SortableContext>\n </DroppableContainer>\n </div>\n </div>\n\n {/* Drag Overlay */}\n {createPortal(\n <DragOverlay dropAnimation={null}>\n {activeColumn ? (\n <div className=\"flex items-center gap-1.5 p-1.5 rounded bg-card border-2 border-blue-text shadow-lg cursor-grabbing pointer-events-none\">\n <GripVertical className=\"w-3.5 h-3.5 flex-shrink-0\" />\n <span className=\"text-sm whitespace-nowrap\">{activeColumn.label}</span>\n </div>\n ) : null}\n </DragOverlay>,\n document.body\n )}\n </DndContext>\n </div>\n )\n}\n"]}
@@ -9,22 +9,22 @@ var chunkJYZ6UE5X_cjs = require('../chunk-JYZ6UE5X.cjs');
9
9
  var chunk2FA7UVLG_cjs = require('../chunk-2FA7UVLG.cjs');
10
10
  var chunk5GCCUXMT_cjs = require('../chunk-5GCCUXMT.cjs');
11
11
  var chunkUWTCK5IN_cjs = require('../chunk-UWTCK5IN.cjs');
12
- var chunkMMKMQZ2B_cjs = require('../chunk-MMKMQZ2B.cjs');
13
12
  var chunkWNAZM2YS_cjs = require('../chunk-WNAZM2YS.cjs');
13
+ var chunkMMKMQZ2B_cjs = require('../chunk-MMKMQZ2B.cjs');
14
14
  var chunk32W2S6DE_cjs = require('../chunk-32W2S6DE.cjs');
15
15
  var chunkKWJW5TMH_cjs = require('../chunk-KWJW5TMH.cjs');
16
+ var chunk3Y75LUCT_cjs = require('../chunk-3Y75LUCT.cjs');
17
+ var chunkC6RJQQLG_cjs = require('../chunk-C6RJQQLG.cjs');
18
+ var chunkE5TPRRAW_cjs = require('../chunk-E5TPRRAW.cjs');
19
+ require('../chunk-UMMZNZV3.cjs');
20
+ require('../chunk-AEQT2QQX.cjs');
16
21
  var chunkBN33PC5F_cjs = require('../chunk-BN33PC5F.cjs');
17
22
  var chunkMEYQLQWS_cjs = require('../chunk-MEYQLQWS.cjs');
18
23
  var chunkTOYKBRAU_cjs = require('../chunk-TOYKBRAU.cjs');
19
24
  var chunk5GHGIDZP_cjs = require('../chunk-5GHGIDZP.cjs');
20
25
  var chunkVPKKPHJY_cjs = require('../chunk-VPKKPHJY.cjs');
21
26
  var chunk6CGMSJLB_cjs = require('../chunk-6CGMSJLB.cjs');
22
- var chunk3Y75LUCT_cjs = require('../chunk-3Y75LUCT.cjs');
23
27
  var chunkTJY7XPDE_cjs = require('../chunk-TJY7XPDE.cjs');
24
- var chunkC6RJQQLG_cjs = require('../chunk-C6RJQQLG.cjs');
25
- var chunkE5TPRRAW_cjs = require('../chunk-E5TPRRAW.cjs');
26
- require('../chunk-UMMZNZV3.cjs');
27
- require('../chunk-AEQT2QQX.cjs');
28
28
  var chunkSFRKKPBB_cjs = require('../chunk-SFRKKPBB.cjs');
29
29
  require('../chunk-XNW62J54.cjs');
30
30
  var chunkVG5XNE4H_cjs = require('../chunk-VG5XNE4H.cjs');
@@ -58,11 +58,11 @@ require('../chunk-7NJKDJVO.cjs');
58
58
  var chunkIEAZX7L6_cjs = require('../chunk-IEAZX7L6.cjs');
59
59
  var chunkEYXU32D7_cjs = require('../chunk-EYXU32D7.cjs');
60
60
  require('../chunk-NEGFHF3V.cjs');
61
- var chunkZ3LFF3YT_cjs = require('../chunk-Z3LFF3YT.cjs');
62
61
  var chunkI6GEQWIV_cjs = require('../chunk-I6GEQWIV.cjs');
63
- var chunk4B6HYQTW_cjs = require('../chunk-4B6HYQTW.cjs');
62
+ var chunkZ3LFF3YT_cjs = require('../chunk-Z3LFF3YT.cjs');
64
63
  var chunkADMNU2CR_cjs = require('../chunk-ADMNU2CR.cjs');
65
64
  require('../chunk-PCB2BPN3.cjs');
65
+ var chunk4B6HYQTW_cjs = require('../chunk-4B6HYQTW.cjs');
66
66
  var chunkNX56DIG3_cjs = require('../chunk-NX56DIG3.cjs');
67
67
  var chunkZM6B5WJW_cjs = require('../chunk-ZM6B5WJW.cjs');
68
68
  var chunkP7VUIW24_cjs = require('../chunk-P7VUIW24.cjs');
@@ -35375,7 +35375,7 @@ var TABLET_TABLE_BELOW = 860;
35375
35375
  var TABLET_VIEWPORT_BELOW = 1100;
35376
35376
  var NO_CONVERSATION_DOCUMENTS2 = [];
35377
35377
  var DocumentReviewCard = react$1.lazy(
35378
- () => import('../DocumentReviewCard-EM2AJUF3.cjs').then((module) => ({ default: module.DocumentReviewCard }))
35378
+ () => import('../DocumentReviewCard-UV3DLFCB.cjs').then((module) => ({ default: module.DocumentReviewCard }))
35379
35379
  );
35380
35380
  var FilesViewerDialog = react$1.lazy(
35381
35381
  () => import('../FilesViewerDialog-IFF2JR2A.cjs').then((module) => ({ default: module.FilesViewerDialog }))
package/dist/index.cjs CHANGED
@@ -13,11 +13,11 @@ var chunkVZKTOGZR_cjs = require('./chunk-VZKTOGZR.cjs');
13
13
  var chunkIEAZX7L6_cjs = require('./chunk-IEAZX7L6.cjs');
14
14
  var chunkEYXU32D7_cjs = require('./chunk-EYXU32D7.cjs');
15
15
  var chunkNEGFHF3V_cjs = require('./chunk-NEGFHF3V.cjs');
16
- var chunkZ3LFF3YT_cjs = require('./chunk-Z3LFF3YT.cjs');
17
16
  var chunkI6GEQWIV_cjs = require('./chunk-I6GEQWIV.cjs');
18
- var chunk4B6HYQTW_cjs = require('./chunk-4B6HYQTW.cjs');
17
+ var chunkZ3LFF3YT_cjs = require('./chunk-Z3LFF3YT.cjs');
19
18
  var chunkADMNU2CR_cjs = require('./chunk-ADMNU2CR.cjs');
20
19
  var chunkPCB2BPN3_cjs = require('./chunk-PCB2BPN3.cjs');
20
+ var chunk4B6HYQTW_cjs = require('./chunk-4B6HYQTW.cjs');
21
21
  var chunkNX56DIG3_cjs = require('./chunk-NX56DIG3.cjs');
22
22
  var chunkZM6B5WJW_cjs = require('./chunk-ZM6B5WJW.cjs');
23
23
  var chunkP7VUIW24_cjs = require('./chunk-P7VUIW24.cjs');
@@ -674,6 +674,10 @@ Object.defineProperty(exports, "toHslTriplet", {
674
674
  enumerable: true,
675
675
  get: function () { return chunkNEGFHF3V_cjs.toHslTriplet; }
676
676
  });
677
+ Object.defineProperty(exports, "MemberAvatarStack", {
678
+ enumerable: true,
679
+ get: function () { return chunkI6GEQWIV_cjs.MemberAvatarStack; }
680
+ });
677
681
  Object.defineProperty(exports, "DEFAULT_THREAD_FOLLOW_LABELS", {
678
682
  enumerable: true,
679
683
  get: function () { return chunkZ3LFF3YT_cjs.DEFAULT_THREAD_FOLLOW_LABELS; }
@@ -694,26 +698,6 @@ Object.defineProperty(exports, "WorkspaceNotificationMenu", {
694
698
  enumerable: true,
695
699
  get: function () { return chunkZ3LFF3YT_cjs.WorkspaceNotificationMenu; }
696
700
  });
697
- Object.defineProperty(exports, "MemberAvatarStack", {
698
- enumerable: true,
699
- get: function () { return chunkI6GEQWIV_cjs.MemberAvatarStack; }
700
- });
701
- Object.defineProperty(exports, "TIPS_VISIBILITY_OVERRIDE", {
702
- enumerable: true,
703
- get: function () { return chunk4B6HYQTW_cjs.TIPS_VISIBILITY_OVERRIDE; }
704
- });
705
- Object.defineProperty(exports, "WELCOME_REPLAY_VIEW", {
706
- enumerable: true,
707
- get: function () { return chunk4B6HYQTW_cjs.WELCOME_REPLAY_VIEW; }
708
- });
709
- Object.defineProperty(exports, "setHintsSessionOverride", {
710
- enumerable: true,
711
- get: function () { return chunk4B6HYQTW_cjs.setHintsSessionOverride; }
712
- });
713
- Object.defineProperty(exports, "startWelcomeReplay", {
714
- enumerable: true,
715
- get: function () { return chunk4B6HYQTW_cjs.startWelcomeReplay; }
716
- });
717
701
  Object.defineProperty(exports, "TIMELINE_ZOOM", {
718
702
  enumerable: true,
719
703
  get: function () { return chunkADMNU2CR_cjs.TIMELINE_ZOOM; }
@@ -754,6 +738,22 @@ Object.defineProperty(exports, "Callout", {
754
738
  enumerable: true,
755
739
  get: function () { return chunkPCB2BPN3_cjs.Callout; }
756
740
  });
741
+ Object.defineProperty(exports, "TIPS_VISIBILITY_OVERRIDE", {
742
+ enumerable: true,
743
+ get: function () { return chunk4B6HYQTW_cjs.TIPS_VISIBILITY_OVERRIDE; }
744
+ });
745
+ Object.defineProperty(exports, "WELCOME_REPLAY_VIEW", {
746
+ enumerable: true,
747
+ get: function () { return chunk4B6HYQTW_cjs.WELCOME_REPLAY_VIEW; }
748
+ });
749
+ Object.defineProperty(exports, "setHintsSessionOverride", {
750
+ enumerable: true,
751
+ get: function () { return chunk4B6HYQTW_cjs.setHintsSessionOverride; }
752
+ });
753
+ Object.defineProperty(exports, "startWelcomeReplay", {
754
+ enumerable: true,
755
+ get: function () { return chunk4B6HYQTW_cjs.startWelcomeReplay; }
756
+ });
757
757
  Object.defineProperty(exports, "ApplyLabelButton", {
758
758
  enumerable: true,
759
759
  get: function () { return chunkNX56DIG3_cjs.ApplyLabelButton; }
@@ -34,7 +34,17 @@ function codeSplitting() {
34
34
  return {
35
35
  groups: [
36
36
  { name: "preload-helper", test: /vite\/preload-helper/, priority: 100 },
37
- { name: vendorChunkOf }
37
+ { name: vendorChunkOf },
38
+ // Vite's build-import lexer has a fixed WASM heap: the combined Word editor
39
+ // can exceed it. Bound its chunks without pulling lazy editor code into an
40
+ // eager vendor group or capturing its shared React/runtime dependencies.
41
+ {
42
+ name: "docx-editor",
43
+ test: /node_modules\/@docx-editor\.dev\//,
44
+ entriesAware: true,
45
+ includeDependenciesRecursively: false,
46
+ maxSize: 2e6
47
+ }
38
48
  ]
39
49
  };
40
50
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"names":["readdir","path","promisify","brotliCompress","gzip","readFile","constants","writeFile","require","createRequire","createReadStream"],"mappings":";;;;;;;;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IAC1C,EAAA,CAAG,SAAS,mCAAmC,CAAA;AAE/C,IAAA,OAAO,eAAA;AACT,EAAA,IAAI,GAAG,QAAA,CAAS,4BAA4B,CAAA,IAAK,EAAA,CAAG,SAAS,gCAAgC,CAAA;AAC3F,IAAA,OAAO,SAAA;AAET,EAAA,IACE,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IACzC,EAAA,CAAG,SAAS,sBAAsB,CAAA,IAAK,CAAC,EAAA,CAAG,QAAA,CAAS,4BAA4B,KAChF,EAAA,CAAG,QAAA,CAAS,sBAAsB,CA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shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves and get their own chunks without help. The vendor groups below\n * deliberately leave them out: pinning a lazily loaded library into a named chunk lets the bundler\n * park shared helpers there, and the sign-in page then downloads the whole library.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"names":["readdir","path","promisify","brotliCompress","gzip","readFile","constants","writeFile","require","createRequire","createReadStream"],"mappings":";;;;;;;;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IAC1C,EAAA,CAAG,SAAS,mCAAmC,CAAA;AAE/C,IAAA,OAAO,eAAA;AACT,EAAA,IAAI,GAAG,QAAA,CAAS,4BAA4B,CAAA,IAAK,EAAA,CAAG,SAAS,gCAAgC,CAAA;AAC3F,I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AAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.cjs","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the combined Word editor\n // can exceed it. Bound its chunks without pulling lazy editor code into an\n // eager vendor group or capturing its shared React/runtime dependencies.\n {\n name: 'docx-editor',\n test: /node_modules\\/@docx-editor\\.dev\\//,\n entriesAware: true,\n includeDependenciesRecursively: false,\n maxSize: 2_000_000,\n },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
@@ -14,10 +14,23 @@ export declare function codeSplitting(): {
14
14
  name: string;
15
15
  test: RegExp;
16
16
  priority: number;
17
+ entriesAware?: undefined;
18
+ includeDependenciesRecursively?: undefined;
19
+ maxSize?: undefined;
17
20
  } | {
18
21
  name: typeof vendorChunkOf;
19
22
  test?: undefined;
20
23
  priority?: undefined;
24
+ entriesAware?: undefined;
25
+ includeDependenciesRecursively?: undefined;
26
+ maxSize?: undefined;
27
+ } | {
28
+ name: string;
29
+ test: RegExp;
30
+ entriesAware: boolean;
31
+ includeDependenciesRecursively: boolean;
32
+ maxSize: number;
33
+ priority?: undefined;
21
34
  })[];
22
35
  };
23
36
  /** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */
@@ -28,7 +28,17 @@ function codeSplitting() {
28
28
  return {
29
29
  groups: [
30
30
  { name: "preload-helper", test: /vite\/preload-helper/, priority: 100 },
31
- { name: vendorChunkOf }
31
+ { name: vendorChunkOf },
32
+ // Vite's build-import lexer has a fixed WASM heap: the combined Word editor
33
+ // can exceed it. Bound its chunks without pulling lazy editor code into an
34
+ // eager vendor group or capturing its shared React/runtime dependencies.
35
+ {
36
+ name: "docx-editor",
37
+ test: /node_modules\/@docx-editor\.dev\//,
38
+ entriesAware: true,
39
+ includeDependenciesRecursively: false,
40
+ maxSize: 2e6
41
+ }
32
42
  ]
33
43
  };
34
44
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"names":["require"],"mappings":";;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAA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AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.js","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves and get their own chunks without help. The vendor groups below\n * deliberately leave them out: pinning a lazily loaded library into a named chunk lets the bundler\n * park shared helpers there, and the sign-in page then downloads the whole library.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"names":["require"],"mappings":";;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,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AAA,EAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,QAAA,CAAS,2BAA2B,CAAA,EAAG,OAAO,IAAA,EAAK;AAC/E,QAAA,GAAA,CAAI,SAAA,CAAU,gBAAgB,kBAAkB,CAAA;AAChD,QAAA,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.js","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the combined Word editor\n // can exceed it. Bound its chunks without pulling lazy editor code into an\n // eager vendor group or capturing its shared React/runtime dependencies.\n {\n name: 'docx-editor',\n test: /node_modules\\/@docx-editor\\.dev\\//,\n entriesAware: true,\n includeDependenciesRecursively: false,\n maxSize: 2_000_000,\n },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
@@ -4,10 +4,10 @@
4
4
  var chunkMMKMQZ2B_cjs = require('../chunk-MMKMQZ2B.cjs');
5
5
  require('../chunk-32W2S6DE.cjs');
6
6
  require('../chunk-KWJW5TMH.cjs');
7
+ require('../chunk-AEQT2QQX.cjs');
7
8
  require('../chunk-5GHGIDZP.cjs');
8
9
  require('../chunk-VPKKPHJY.cjs');
9
10
  var chunk6CGMSJLB_cjs = require('../chunk-6CGMSJLB.cjs');
10
- require('../chunk-AEQT2QQX.cjs');
11
11
  var chunkLLD4PNBW_cjs = require('../chunk-LLD4PNBW.cjs');
12
12
  require('../chunk-VIUEPJ3Y.cjs');
13
13
  require('../chunk-C5APAFUY.cjs');
@@ -1163,7 +1163,13 @@ var headingStyle = (paragraphs) => paragraphs.find((p) => p.topLevel && p.headin
1163
1163
  function insertParagraphs(port, index, body, count, keep) {
1164
1164
  const before = port.paragraphs();
1165
1165
  const kept = keep ? before.findIndex((p) => p.id === keep.paragraphId) : -1;
1166
- if (index < before.length) {
1166
+ const separateParagraph = index > 0 && index < before.length;
1167
+ if (separateParagraph) {
1168
+ const previous = before[index - 1];
1169
+ port.setCaret({ paragraphId: previous.id, offset: engineLength(previous) });
1170
+ port.splitParagraph();
1171
+ port.setCaret({ paragraphId: port.paragraphs()[index].id, offset: 0 });
1172
+ } else if (index < before.length) {
1167
1173
  port.setCaret({ paragraphId: before[index].id, offset: 0 });
1168
1174
  } else {
1169
1175
  const last = before[before.length - 1];
@@ -1173,6 +1179,17 @@ function insertParagraphs(port, index, body, count, keep) {
1173
1179
  port.setCaret({ paragraphId: opened[opened.length - 1].id, offset: 0 });
1174
1180
  }
1175
1181
  if (!port.paste(body, "", true)) throw new Error("The definition could not be added.");
1182
+ if (separateParagraph) {
1183
+ const inserted = port.paragraphs();
1184
+ const last = inserted[index + count - 1];
1185
+ const empty = inserted[index + count];
1186
+ if (port.joinEmptyParagraph) port.joinEmptyParagraph(last.id, empty.id);
1187
+ else
1188
+ port.deleteRange(
1189
+ { paragraphId: last.id, offset: engineLength(last) },
1190
+ { paragraphId: empty.id, offset: 0 }
1191
+ );
1192
+ }
1176
1193
  if (!keep || kept < 0) return keep;
1177
1194
  const after = port.paragraphs();
1178
1195
  const moved = index <= kept ? kept + count : kept;