@arbidocs/blocks 0.5.171 → 0.5.173

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 (164) hide show
  1. package/dist/{ConnectedCallDock-PFMK5OGR.cjs → ConnectedCallDock-AQRVWENO.cjs} +23 -23
  2. package/dist/{ConnectedCallDock-PFMK5OGR.cjs.map → ConnectedCallDock-AQRVWENO.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-VHU2XWLY.cjs → ConnectedCallRoom-7M4YQ4KA.cjs} +16 -16
  4. package/dist/{ConnectedCallRoom-VHU2XWLY.cjs.map → ConnectedCallRoom-7M4YQ4KA.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-3JTDXI34.cjs → ConnectedNativeDocxComparison-KGUSDMDH.cjs} +20 -20
  6. package/dist/{ConnectedNativeDocxComparison-3JTDXI34.cjs.map → ConnectedNativeDocxComparison-KGUSDMDH.cjs.map} +1 -1
  7. package/dist/{ConnectedPresentation-ZZ5VLJ5Z.cjs → ConnectedPresentation-FOYVUVM3.cjs} +16 -16
  8. package/dist/{ConnectedPresentation-ZZ5VLJ5Z.cjs.map → ConnectedPresentation-FOYVUVM3.cjs.map} +1 -1
  9. package/dist/{ConnectedProductionSetDialog-JFZT6SCO.cjs → ConnectedProductionSetDialog-SHDI7KP6.cjs} +6 -6
  10. package/dist/{ConnectedProductionSetDialog-JFZT6SCO.cjs.map → ConnectedProductionSetDialog-SHDI7KP6.cjs.map} +1 -1
  11. package/dist/{ConnectedSlidesTab-GT5TQPWW.cjs → ConnectedSlidesTab-LEA5OW75.cjs} +14 -14
  12. package/dist/{ConnectedSlidesTab-GT5TQPWW.cjs.map → ConnectedSlidesTab-LEA5OW75.cjs.map} +1 -1
  13. package/dist/{ConnectedStreamedWordArtifact-WKUIL754.cjs → ConnectedStreamedWordArtifact-ERKIDFFG.cjs} +20 -20
  14. package/dist/{ConnectedStreamedWordArtifact-WKUIL754.cjs.map → ConnectedStreamedWordArtifact-ERKIDFFG.cjs.map} +1 -1
  15. package/dist/{DocumentReviewCard-PASUSZUT.cjs → DocumentReviewCard-EYJ5Q4F4.cjs} +20 -20
  16. package/dist/{DocumentReviewCard-PASUSZUT.cjs.map → DocumentReviewCard-EYJ5Q4F4.cjs.map} +1 -1
  17. package/dist/{FilesViewerDialog-TIZKGOBA.cjs → FilesViewerDialog-AZUR4XBV.cjs} +53 -53
  18. package/dist/{FilesViewerDialog-TIZKGOBA.cjs.map → FilesViewerDialog-AZUR4XBV.cjs.map} +1 -1
  19. package/dist/{NativeDocxEditor-R2OKJLRY.cjs → NativeDocxEditor-T7FSMKG3.cjs} +6 -6
  20. package/dist/{NativeDocxEditor-R2OKJLRY.cjs.map → NativeDocxEditor-T7FSMKG3.cjs.map} +1 -1
  21. package/dist/{WorkspaceTableView-57A4WBAX.cjs → WorkspaceTableView-YQERZOHV.cjs} +10 -10
  22. package/dist/{WorkspaceTableView-57A4WBAX.cjs.map → WorkspaceTableView-YQERZOHV.cjs.map} +1 -1
  23. package/dist/agents/index.cjs +286 -286
  24. package/dist/{ai-VXPILCGE.cjs → ai-U2UMKQZO.cjs} +26 -26
  25. package/dist/ai-U2UMKQZO.cjs.map +1 -0
  26. package/dist/auth/index.cjs +12 -12
  27. package/dist/calls/index.cjs +126 -126
  28. package/dist/chat/index.cjs +6 -6
  29. package/dist/{chunk-VNUBBRJM.cjs → chunk-2K5DLB7B.cjs} +3 -3
  30. package/dist/{chunk-VNUBBRJM.cjs.map → chunk-2K5DLB7B.cjs.map} +1 -1
  31. package/dist/{chunk-SKQ5OMMF.cjs → chunk-2ZNADJ7G.cjs} +6 -6
  32. package/dist/{chunk-SKQ5OMMF.cjs.map → chunk-2ZNADJ7G.cjs.map} +1 -1
  33. package/dist/{chunk-BJRQHR7R.cjs → chunk-3EIO4ZH5.cjs} +6 -6
  34. package/dist/{chunk-BJRQHR7R.cjs.map → chunk-3EIO4ZH5.cjs.map} +1 -1
  35. package/dist/{chunk-LZNSXXX7.cjs → chunk-4BOX77K3.cjs} +13 -13
  36. package/dist/{chunk-LZNSXXX7.cjs.map → chunk-4BOX77K3.cjs.map} +1 -1
  37. package/dist/{chunk-B5AOYT4U.cjs → chunk-5FSULBPE.cjs} +3 -3
  38. package/dist/{chunk-B5AOYT4U.cjs.map → chunk-5FSULBPE.cjs.map} +1 -1
  39. package/dist/{chunk-7NVDGD63.cjs → chunk-5OD6DRG7.cjs} +5 -5
  40. package/dist/{chunk-7NVDGD63.cjs.map → chunk-5OD6DRG7.cjs.map} +1 -1
  41. package/dist/{chunk-LYDA43KU.cjs → chunk-5PZZRBAG.cjs} +4 -4
  42. package/dist/{chunk-LYDA43KU.cjs.map → chunk-5PZZRBAG.cjs.map} +1 -1
  43. package/dist/{chunk-NZ46UGVT.cjs → chunk-6AFAYGJW.cjs} +5 -5
  44. package/dist/{chunk-NZ46UGVT.cjs.map → chunk-6AFAYGJW.cjs.map} +1 -1
  45. package/dist/{chunk-M3HYFFCK.cjs → chunk-7GVKG3G4.cjs} +13 -13
  46. package/dist/{chunk-M3HYFFCK.cjs.map → chunk-7GVKG3G4.cjs.map} +1 -1
  47. package/dist/{chunk-LH3PDPJP.cjs → chunk-7H7KIJW2.cjs} +3 -3
  48. package/dist/{chunk-LH3PDPJP.cjs.map → chunk-7H7KIJW2.cjs.map} +1 -1
  49. package/dist/{chunk-SG5G3SOV.cjs → chunk-7VZHGEA4.cjs} +28 -28
  50. package/dist/{chunk-SG5G3SOV.cjs.map → chunk-7VZHGEA4.cjs.map} +1 -1
  51. package/dist/{chunk-WQ2KG4LS.cjs → chunk-BCU65RJM.cjs} +3 -3
  52. package/dist/{chunk-WQ2KG4LS.cjs.map → chunk-BCU65RJM.cjs.map} +1 -1
  53. package/dist/{chunk-7DLBWHPZ.cjs → chunk-CHZ6SPOT.cjs} +4 -4
  54. package/dist/{chunk-7DLBWHPZ.cjs.map → chunk-CHZ6SPOT.cjs.map} +1 -1
  55. package/dist/{chunk-Y46657UP.cjs → chunk-D5QGLBQC.cjs} +36 -36
  56. package/dist/{chunk-Y46657UP.cjs.map → chunk-D5QGLBQC.cjs.map} +1 -1
  57. package/dist/{chunk-O2NHBB3D.cjs → chunk-E23H6FJR.cjs} +4 -4
  58. package/dist/{chunk-O2NHBB3D.cjs.map → chunk-E23H6FJR.cjs.map} +1 -1
  59. package/dist/{chunk-LJTHFTQQ.cjs → chunk-ER2MRSLT.cjs} +3 -3
  60. package/dist/{chunk-LJTHFTQQ.cjs.map → chunk-ER2MRSLT.cjs.map} +1 -1
  61. package/dist/{chunk-WQQ6C2ML.cjs → chunk-FUKN3PI5.cjs} +3 -3
  62. package/dist/{chunk-WQQ6C2ML.cjs.map → chunk-FUKN3PI5.cjs.map} +1 -1
  63. package/dist/{chunk-TU46WKTN.cjs → chunk-FX5TZ6JU.cjs} +3 -3
  64. package/dist/{chunk-TU46WKTN.cjs.map → chunk-FX5TZ6JU.cjs.map} +1 -1
  65. package/dist/{chunk-BD7P4KYQ.cjs → chunk-G2B2BWE5.cjs} +12 -2
  66. package/dist/chunk-G2B2BWE5.cjs.map +1 -0
  67. package/dist/{chunk-M2UA4QVI.cjs → chunk-GPPPH37H.cjs} +4 -4
  68. package/dist/{chunk-M2UA4QVI.cjs.map → chunk-GPPPH37H.cjs.map} +1 -1
  69. package/dist/{chunk-R3ERUO4V.cjs → chunk-H4N6BZNU.cjs} +13 -13
  70. package/dist/{chunk-R3ERUO4V.cjs.map → chunk-H4N6BZNU.cjs.map} +1 -1
  71. package/dist/{chunk-ZSZI576U.cjs → chunk-HH5MKRBL.cjs} +7 -7
  72. package/dist/{chunk-ZSZI576U.cjs.map → chunk-HH5MKRBL.cjs.map} +1 -1
  73. package/dist/{chunk-TDQO7HTC.cjs → chunk-IJBCEBGR.cjs} +28 -28
  74. package/dist/{chunk-TDQO7HTC.cjs.map → chunk-IJBCEBGR.cjs.map} +1 -1
  75. package/dist/{chunk-USQDVAYR.cjs → chunk-JEHGTPS2.cjs} +4 -4
  76. package/dist/{chunk-USQDVAYR.cjs.map → chunk-JEHGTPS2.cjs.map} +1 -1
  77. package/dist/{chunk-WN6BLSAZ.cjs → chunk-JKTUL4L3.cjs} +5 -5
  78. package/dist/{chunk-WN6BLSAZ.cjs.map → chunk-JKTUL4L3.cjs.map} +1 -1
  79. package/dist/{chunk-MOY5Q4GH.cjs → chunk-K7JV2OV3.cjs} +11 -11
  80. package/dist/{chunk-MOY5Q4GH.cjs.map → chunk-K7JV2OV3.cjs.map} +1 -1
  81. package/dist/{chunk-LG2IKM2G.cjs → chunk-KQJUY2OE.cjs} +15 -12
  82. package/dist/chunk-KQJUY2OE.cjs.map +1 -0
  83. package/dist/{chunk-BLJET4KG.cjs → chunk-KULGPKLY.cjs} +4 -4
  84. package/dist/{chunk-BLJET4KG.cjs.map → chunk-KULGPKLY.cjs.map} +1 -1
  85. package/dist/{chunk-KD4UCP2O.cjs → chunk-MGI5FR6I.cjs} +18 -18
  86. package/dist/{chunk-KD4UCP2O.cjs.map → chunk-MGI5FR6I.cjs.map} +1 -1
  87. package/dist/{chunk-Q25CZLK6.cjs → chunk-N33U2SB5.cjs} +28 -4
  88. package/dist/chunk-N33U2SB5.cjs.map +1 -0
  89. package/dist/{chunk-H3VVUNEX.cjs → chunk-O2D4VIWD.cjs} +3 -3
  90. package/dist/{chunk-H3VVUNEX.cjs.map → chunk-O2D4VIWD.cjs.map} +1 -1
  91. package/dist/{chunk-IPSR2PUU.cjs → chunk-OHWYQI3B.cjs} +12 -12
  92. package/dist/{chunk-IPSR2PUU.cjs.map → chunk-OHWYQI3B.cjs.map} +1 -1
  93. package/dist/{chunk-IRUQZI6P.cjs → chunk-PIKTGP55.cjs} +3 -2
  94. package/dist/chunk-PIKTGP55.cjs.map +1 -0
  95. package/dist/chunk-QHXFXV2F.cjs +18 -0
  96. package/dist/{chunk-ZOMVN3OF.cjs.map → chunk-QHXFXV2F.cjs.map} +1 -1
  97. package/dist/{chunk-6CNK2C34.cjs → chunk-QSY2VW7V.cjs} +6 -6
  98. package/dist/{chunk-6CNK2C34.cjs.map → chunk-QSY2VW7V.cjs.map} +1 -1
  99. package/dist/{chunk-NFVYHS3X.cjs → chunk-RBNMRU4V.cjs} +48 -48
  100. package/dist/{chunk-NFVYHS3X.cjs.map → chunk-RBNMRU4V.cjs.map} +1 -1
  101. package/dist/{chunk-3ZU4YBHO.cjs → chunk-TF3JNVHS.cjs} +4 -4
  102. package/dist/{chunk-3ZU4YBHO.cjs.map → chunk-TF3JNVHS.cjs.map} +1 -1
  103. package/dist/{chunk-L7JAIOFE.cjs → chunk-THGWHKWR.cjs} +69 -69
  104. package/dist/{chunk-L7JAIOFE.cjs.map → chunk-THGWHKWR.cjs.map} +1 -1
  105. package/dist/{chunk-W7TSEN3J.cjs → chunk-TLIZD6DV.cjs} +6 -6
  106. package/dist/{chunk-W7TSEN3J.cjs.map → chunk-TLIZD6DV.cjs.map} +1 -1
  107. package/dist/{chunk-HLT2SFZG.cjs → chunk-TMK5YVNN.cjs} +62 -62
  108. package/dist/{chunk-HLT2SFZG.cjs.map → chunk-TMK5YVNN.cjs.map} +1 -1
  109. package/dist/{chunk-3SQEDZPI.cjs → chunk-U2L4GTMV.cjs} +6 -6
  110. package/dist/{chunk-3SQEDZPI.cjs.map → chunk-U2L4GTMV.cjs.map} +1 -1
  111. package/dist/{chunk-LYYJDQW6.cjs → chunk-UTYEXDJK.cjs} +28 -28
  112. package/dist/{chunk-LYYJDQW6.cjs.map → chunk-UTYEXDJK.cjs.map} +1 -1
  113. package/dist/{chunk-6N7QT2DH.cjs → chunk-VDHBLDQC.cjs} +3 -3
  114. package/dist/{chunk-6N7QT2DH.cjs.map → chunk-VDHBLDQC.cjs.map} +1 -1
  115. package/dist/{chunk-6ZJBUMNK.cjs → chunk-VDT7TEAH.cjs} +3 -3
  116. package/dist/{chunk-6ZJBUMNK.cjs.map → chunk-VDT7TEAH.cjs.map} +1 -1
  117. package/dist/{chunk-FQRJAXGK.cjs → chunk-WQ3GB74G.cjs} +11 -11
  118. package/dist/{chunk-FQRJAXGK.cjs.map → chunk-WQ3GB74G.cjs.map} +1 -1
  119. package/dist/{chunk-TPYOXG5S.cjs → chunk-XKXKEVHH.cjs} +6 -6
  120. package/dist/{chunk-TPYOXG5S.cjs.map → chunk-XKXKEVHH.cjs.map} +1 -1
  121. package/dist/{chunk-XOC4MM2R.cjs → chunk-ZOI4DFSB.cjs} +52 -52
  122. package/dist/{chunk-XOC4MM2R.cjs.map → chunk-ZOI4DFSB.cjs.map} +1 -1
  123. package/dist/{chunk-WAEMGHJ6.cjs → chunk-ZUQGG3FL.cjs} +10 -10
  124. package/dist/{chunk-WAEMGHJ6.cjs.map → chunk-ZUQGG3FL.cjs.map} +1 -1
  125. package/dist/connect/docx.cjs +24 -24
  126. package/dist/connect/index.cjs +1134 -1133
  127. package/dist/connect/index.cjs.map +1 -1
  128. package/dist/connect/viewer.cjs +41 -41
  129. package/dist/connection/messenger/DmAgentProgress.js +1 -1
  130. package/dist/connection/messenger/DmAgentProgress.js.map +2 -2
  131. package/dist/connection/workspace-access/ConnectedGrantWorkspaceAccessDialog.js +5 -4
  132. package/dist/connection/workspace-access/ConnectedGrantWorkspaceAccessDialog.js.map +2 -2
  133. package/dist/dashboards/index.cjs +1 -1
  134. package/dist/databases/DatabaseTable.js +26 -2
  135. package/dist/databases/DatabaseTable.js.map +2 -2
  136. package/dist/databases/index.cjs +52 -52
  137. package/dist/docx/index.cjs +38 -38
  138. package/dist/docx/review/DocxEditorReview.js +10 -0
  139. package/dist/docx/review/DocxEditorReview.js.map +2 -2
  140. package/dist/embed/index.cjs +46 -46
  141. package/dist/facts/index.cjs +43 -43
  142. package/dist/files/index.cjs +241 -241
  143. package/dist/index.cjs +1610 -1610
  144. package/dist/lib/entity-id.d.ts +1 -1
  145. package/dist/lib/entity-id.js +1 -0
  146. package/dist/lib/entity-id.js.map +2 -2
  147. package/dist/pages/index.cjs +41 -41
  148. package/dist/settings/index.cjs +147 -147
  149. package/dist/shell/index.cjs +81 -81
  150. package/dist/shell/use-sidebar-controller.js +4 -1
  151. package/dist/shell/use-sidebar-controller.js.map +2 -2
  152. package/dist/site/index.cjs +6 -6
  153. package/dist/studio/index.cjs +29 -29
  154. package/dist/styles.css +1 -1
  155. package/dist/workflow-canvas/index.cjs +64 -64
  156. package/node_modules/@arbidocs/coedit/package.json +1 -1
  157. package/package.json +5 -5
  158. package/src/blocks.css +2 -0
  159. package/dist/ai-VXPILCGE.cjs.map +0 -1
  160. package/dist/chunk-BD7P4KYQ.cjs.map +0 -1
  161. package/dist/chunk-IRUQZI6P.cjs.map +0 -1
  162. package/dist/chunk-LG2IKM2G.cjs.map +0 -1
  163. package/dist/chunk-Q25CZLK6.cjs.map +0 -1
  164. package/dist/chunk-ZOMVN3OF.cjs +0 -18
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkLJTHFTQQ_cjs = require('./chunk-LJTHFTQQ.cjs');
5
- var chunkBJRQHR7R_cjs = require('./chunk-BJRQHR7R.cjs');
4
+ var chunkER2MRSLT_cjs = require('./chunk-ER2MRSLT.cjs');
5
+ var chunk3EIO4ZH5_cjs = require('./chunk-3EIO4ZH5.cjs');
6
6
  var chunkM55XUF4L_cjs = require('./chunk-M55XUF4L.cjs');
7
- var chunkB5AOYT4U_cjs = require('./chunk-B5AOYT4U.cjs');
8
- var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
7
+ var chunk5FSULBPE_cjs = require('./chunk-5FSULBPE.cjs');
9
8
  var chunkSQCCQU3K_cjs = require('./chunk-SQCCQU3K.cjs');
9
+ var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
10
10
  var chunkHN56WWBR_cjs = require('./chunk-HN56WWBR.cjs');
11
11
  var browser = require('@arbidocs/sdk/browser');
12
12
  var react = require('@arbidocs/react');
@@ -49,11 +49,11 @@ function useLaunchWorkflow({
49
49
  } = {}) {
50
50
  const { data: documents = [] } = react.useDocuments();
51
51
  const { data: workspaceTags = [] } = react.useTags();
52
- const tags = react$1.useMemo(() => chunkB5AOYT4U_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
52
+ const tags = react$1.useMemo(() => chunk5FSULBPE_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
53
53
  const createTag = react.useCreateTag();
54
54
  const updateTag = react.useUpdateTag();
55
55
  const generate = react.useGenerateDocTags();
56
- const { create: createTask } = chunkLJTHFTQQ_cjs.useWorkflowTasks();
56
+ const { create: createTask } = chunkER2MRSLT_cjs.useWorkflowTasks();
57
57
  const applyModel = react.useApplyChatModel();
58
58
  const session = react.useArbiSessionStore();
59
59
  const { notify, openFiles, openNewConversation } = chunkHN56WWBR_cjs.useBlocksEnvironment();
@@ -61,7 +61,7 @@ function useLaunchWorkflow({
61
61
  async ({ inputs, scope }) => {
62
62
  const description = text(inputs, "description");
63
63
  const name = text(inputs, "name") || chunkM55XUF4L_cjs.deriveAnnotationName(description);
64
- const matching = chunkB5AOYT4U_cjs.matchWorkflowScope(documents, scope);
64
+ const matching = chunk5FSULBPE_cjs.matchWorkflowScope(documents, scope);
65
65
  if (!name || !description || matching.length === 0) return;
66
66
  try {
67
67
  const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase());
@@ -161,7 +161,7 @@ function useLaunchWorkflow({
161
161
  const binding = PROMPT_BINDINGS[workflow.id];
162
162
  const prepare = () => {
163
163
  if (binding?.attachScope !== false && !chunkSQCCQU3K_cjs.isEmptyWorkflowScope(scope)) {
164
- const ids = chunkB5AOYT4U_cjs.matchWorkflowScope(documents, scope).map((d) => d.external_id);
164
+ const ids = chunk5FSULBPE_cjs.matchWorkflowScope(documents, scope).map((d) => d.external_id);
165
165
  if (ids.length > 0) {
166
166
  session.setConversationDocuments(
167
167
  inPlace ? session.getState().conversationId ?? "new" : "new",
@@ -215,7 +215,7 @@ function ConnectedWorkflowStart({
215
215
  );
216
216
  const { openUpload } = chunkHN56WWBR_cjs.useBlocksEnvironment();
217
217
  const { data: workspaceTags = [] } = react.useTags();
218
- const tags = react$1.useMemo(() => chunkB5AOYT4U_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
218
+ const tags = react$1.useMemo(() => chunk5FSULBPE_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
219
219
  const fieldPlaceholder = react$1.useCallback(
220
220
  (field, inputs, workflow) => {
221
221
  if (workflow.id !== chunkM55XUF4L_cjs.ANNOTATE_ID || field.name !== "name") return void 0;
@@ -225,7 +225,7 @@ function ConnectedWorkflowStart({
225
225
  []
226
226
  );
227
227
  return /* @__PURE__ */ jsxRuntime.jsx(
228
- chunkBJRQHR7R_cjs.ConnectedWorkflowLauncher,
228
+ chunk3EIO4ZH5_cjs.ConnectedWorkflowLauncher,
229
229
  {
230
230
  ...rest,
231
231
  workflows,
@@ -265,5 +265,5 @@ function ConnectedWorkflowStart({
265
265
  exports.ConnectedWorkflowStart = ConnectedWorkflowStart;
266
266
  exports.PROMPT_BINDINGS = PROMPT_BINDINGS;
267
267
  exports.useLaunchWorkflow = useLaunchWorkflow;
268
- //# sourceMappingURL=chunk-IPSR2PUU.cjs.map
269
- //# sourceMappingURL=chunk-IPSR2PUU.cjs.map
268
+ //# sourceMappingURL=chunk-OHWYQI3B.cjs.map
269
+ //# sourceMappingURL=chunk-OHWYQI3B.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","j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,EAAc,WAAU,uCAAA,EAAwC,CAAA;AAAA,8CAChE,MAAA,EAAA,EAAK,QAAA,EAAA;AAAA,gBAAA,uBAAA;AAAA,gCACiBH,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,aAAA,EAAe,mBAAS,IAAA,EAAK,CAAA;AAAA,gBAAO;AAAA,eAAA,EAG3E;AAAA;AAAA;AAAA,SACF;AAAA,MAEJ;AAAA;AAAA,GACF;AAEJ","file":"chunk-IPSR2PUU.cjs","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type OnWorkflowLaunch,\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n /** The band's layout: reflowing columns (default) or one sideways-scrolling row (a carousel). */\n tilesLayout?: 'grid' | 'carousel'\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /**\n * Run a launch here instead of the usual way (`useLaunchWorkflow`): a surface that wants the\n * result itself, e.g. the presentation, which adds a generated image to its clips. The dialog\n * shows it running until it resolves, closes then, and stays open if it throws.\n */\n onLaunch?: OnWorkflowLaunch\n /**\n * Files added from a `documents` field are uploaded right in the field instead of through the\n * host's upload dialog: for a dialog in a popped-out window, where the host's dialog would open\n * in the app's window, out of sight, and block this one.\n */\n uploadInPlace?: boolean\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n onLaunch: launchHere,\n uploadInPlace = false,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const launchUsually = useLaunchWorkflow({ landing, send })\n const onLaunch = launchHere ?? launchUsually\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={uploadInPlace ? undefined : openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","jsx","ConnectedWorkflowLauncher","jsxs","TriangleAlert"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;AAC9B,CAAA;AAEO,IAAM,eAAA,GAAiD;AAAA,EAC5D,CAACA,mCAAiB,GAAG;AAAA,IACnB,WAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAO,CAAC,MAAA,KAAW;AACjB,MAAA,MAAM,cAAc,OAAO,MAAA,CAAO,YAAA,K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Ae,YAAA,KAAiB,IAAA,GAC5C,YAAY,YAAY,CAAA,SAAA,EAAY,iBAAiB,CAAA,GAAI,GAAA,GAAM,EAAE,CAAA,CAAA,GACjE,MAAA;AAAA,MAEN,YAAA,EAAc,CAAC,EAAE,QAAA,EAAU,QAAO,KAAM;AACtC,QAAA,IAAI,QAAA,CAAS,EAAA,KAAOA,6BAAA,EAAa,OAAO,IAAA;AAGxC,QAAA,MAAM,IAAA,GACJ,MAAA,CAAO,MAAA,CAAO,IAAA,IAAQ,EAAE,CAAA,CAAE,IAAA,EAAK,IAAKF,sCAAA,CAAqB,MAAA,CAAO,MAAA,CAAO,WAAA,IAAe,EAAE,CAAC,CAAA;AAC3F,QAAA,MAAM,QAAA,GAAW,IAAA,GACb,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,CAAK,WAAA,EAAY,KAAM,IAAA,CAAK,WAAA,EAAa,CAAA,GAC5D,MAAA;AACJ,QAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AACtB,QAAA,uBACEW,eAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,mIAAA;AAAA,YACV,IAAA,EAAK,QAAA;AAAA,YACL,aAAA,EAAY,iCAAA;AAAA,YAEZ,QAAA,EAAA;AAAA,8BAAAF,cAAA,CAACG,yBAAA,EAAA,EAAc,WAAU,uCAAA,EAAwC,CAAA;AAAA,8CAChE,MAAA,EAAA,EAAK,QAAA,EAAA;AAAA,gBAAA,uBAAA;AAAA,gCACiBH,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,aAAA,EAAe,mBAAS,IAAA,EAAK,CAAA;AAAA,gBAAO;AAAA,eAAA,EAG3E;AAAA;AAAA;AAAA,SACF;AAAA,MAEJ;AAAA;AAAA,GACF;AAEJ","file":"chunk-OHWYQI3B.cjs","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type OnWorkflowLaunch,\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n /** The band's layout: reflowing columns (default) or one sideways-scrolling row (a carousel). */\n tilesLayout?: 'grid' | 'carousel'\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /**\n * Run a launch here instead of the usual way (`useLaunchWorkflow`): a surface that wants the\n * result itself, e.g. the presentation, which adds a generated image to its clips. The dialog\n * shows it running until it resolves, closes then, and stays open if it throws.\n */\n onLaunch?: OnWorkflowLaunch\n /**\n * Files added from a `documents` field are uploaded right in the field instead of through the\n * host's upload dialog: for a dialog in a popped-out window, where the host's dialog would open\n * in the app's window, out of sight, and block this one.\n */\n uploadInPlace?: boolean\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n onLaunch: launchHere,\n uploadInPlace = false,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const launchUsually = useLaunchWorkflow({ landing, send })\n const onLaunch = launchHere ?? launchUsually\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={uploadInPlace ? undefined : openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n"]}
@@ -7,11 +7,12 @@ var ENTITY_ID = new RegExp(`^${ENTITY_ID_SOURCE}$`);
7
7
  function entityIdFromPath(pathname) {
8
8
  const parts = pathname.split("/").filter(Boolean);
9
9
  if (parts.length === 2 && parts[0].startsWith("wrk-") && ENTITY_ID.test(parts[0])) parts.shift();
10
+ if (parts.length === 2 && parts[1].startsWith(`${parts[0]}-`)) parts.shift();
10
11
  return parts.length === 1 && ENTITY_ID.test(parts[0]) ? parts[0] : void 0;
11
12
  }
12
13
 
13
14
  exports.ENTITY_ID = ENTITY_ID;
14
15
  exports.ENTITY_ID_SOURCE = ENTITY_ID_SOURCE;
15
16
  exports.entityIdFromPath = entityIdFromPath;
16
- //# sourceMappingURL=chunk-IRUQZI6P.cjs.map
17
- //# sourceMappingURL=chunk-IRUQZI6P.cjs.map
17
+ //# sourceMappingURL=chunk-PIKTGP55.cjs.map
18
+ //# sourceMappingURL=chunk-PIKTGP55.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/entity-id.ts"],"names":[],"mappings":";;;AACO,IAAM,gBAAA,GACX;AACK,IAAM,SAAA,GAAY,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAA,CAAG;AAGpD,SAAS,iBAAiB,QAAA,EAAsC;AACrE,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AAChD,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,KAAA,CAAM,CAAC,EAAE,UAAA,CAAW,MAAM,CAAA,IAAK,SAAA,CAAU,KAAK,KAAA,CAAM,CAAC,CAAC,CAAA,QAAS,KAAA,EAAM;AAC/F,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,IAAK,KAAA,CAAM,CAAC,CAAA,CAAE,UAAA,CAAW,CAAA,EAAG,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA,CAAG,CAAA,QAAS,KAAA,EAAM;AAC3E,EAAA,OAAO,KAAA,CAAM,MAAA,KAAW,CAAA,IAAK,SAAA,CAAU,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,KAAA,CAAM,CAAC,CAAA,GAAI,MAAA;AACrE","file":"chunk-PIKTGP55.cjs","sourcesContent":["/** Exact external ids only: partial ids in streaming text must never cause lookups. */\nexport const ENTITY_ID_SOURCE =\n '(?:doc|eml|evt|call|con|wrk|prj|wfl|pag|dbs|viw|fct|tag|usr|agt|cht|cal)-[a-zA-Z0-9]{8}'\nexport const ENTITY_ID = new RegExp(`^${ENTITY_ID_SOURCE}$`)\n\n/** A direct resource reference, optionally qualified by a complete workspace id or its own type. */\nexport function entityIdFromPath(pathname: string): string | undefined {\n const parts = pathname.split('/').filter(Boolean)\n if (parts.length === 2 && parts[0].startsWith('wrk-') && ENTITY_ID.test(parts[0])) parts.shift()\n if (parts.length === 2 && parts[1].startsWith(`${parts[0]}-`)) parts.shift()\n return parts.length === 1 && ENTITY_ID.test(parts[0]) ? parts[0] : undefined\n}\n"]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkJKTUL4L3_cjs = require('./chunk-JKTUL4L3.cjs');
5
+ var chunkK7JV2OV3_cjs = require('./chunk-K7JV2OV3.cjs');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ function ConnectedStreamedWordArtifact({
9
+ fontBaseUrl,
10
+ ...props
11
+ }) {
12
+ const adapter = chunkK7JV2OV3_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
13
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkJKTUL4L3_cjs.StreamedWordArtifact, { ...props, adapter });
14
+ }
15
+
16
+ exports.ConnectedStreamedWordArtifact = ConnectedStreamedWordArtifact;
17
+ //# sourceMappingURL=chunk-QHXFXV2F.cjs.map
18
+ //# sourceMappingURL=chunk-QHXFXV2F.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":["useConnectedNativeDocxAdapter","jsx","StreamedWordArtifact"],"mappings":";;;;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOC,cAAA,CAACC,sCAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-ZOMVN3OF.cjs","sourcesContent":["import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport {\n StreamedWordArtifact,\n type StreamedWordArtifactProps,\n} from '../../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":["useConnectedNativeDocxAdapter","jsx","StreamedWordArtifact"],"mappings":";;;;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOC,cAAA,CAACC,sCAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-QHXFXV2F.cjs","sourcesContent":["import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport {\n StreamedWordArtifact,\n type StreamedWordArtifactProps,\n} from '../../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkKKYNTWDU_cjs = require('./chunk-KKYNTWDU.cjs');
5
- var chunk7NVDGD63_cjs = require('./chunk-7NVDGD63.cjs');
5
+ var chunk5OD6DRG7_cjs = require('./chunk-5OD6DRG7.cjs');
6
6
  var chunkPLIF5CUV_cjs = require('./chunk-PLIF5CUV.cjs');
7
7
  var react = require('react');
8
8
  var ui = require('@arbidocs/react/ui');
@@ -122,20 +122,20 @@ function resolveAuthReturn() {
122
122
  }
123
123
  if (url.origin !== window.location.origin) return null;
124
124
  const { pathname, search, hash } = url;
125
- const route = chunk7NVDGD63_cjs.parseHref(`${pathname}${search}${hash}`);
125
+ const route = chunk5OD6DRG7_cjs.parseHref(`${pathname}${search}${hash}`);
126
126
  switch (route?.kind) {
127
127
  case "review-access":
128
128
  return { type: "review_access", notificationId: route.notificationId };
129
129
  case "notification":
130
130
  return { type: "notification", notificationId: route.notificationId };
131
131
  }
132
- if (chunk7NVDGD63_cjs.isDeepLinkPath(pathname)) return { type: "path", path: `${pathname}${search}${hash}` };
132
+ if (chunk5OD6DRG7_cjs.isDeepLinkPath(pathname)) return { type: "path", path: `${pathname}${search}${hash}` };
133
133
  switch (route?.kind) {
134
134
  case "workspace":
135
135
  case "conversation":
136
136
  case "document":
137
137
  case "action":
138
- return { type: "path", path: chunk7NVDGD63_cjs.hrefFor(route) };
138
+ return { type: "path", path: chunk5OD6DRG7_cjs.hrefFor(route) };
139
139
  // A secure-mail claim's key never rides in the saved address; a call keeps its invite and key.
140
140
  case "secure-mail":
141
141
  return { type: "path", path: pathname };
@@ -171,5 +171,5 @@ exports.preserveAuthReturnUrl = preserveAuthReturnUrl;
171
171
  exports.resolveAuthReturn = resolveAuthReturn;
172
172
  exports.signInRedirect = signInRedirect;
173
173
  exports.takeAuthReturnUrl = takeAuthReturnUrl;
174
- //# sourceMappingURL=chunk-6CNK2C34.cjs.map
175
- //# sourceMappingURL=chunk-6CNK2C34.cjs.map
174
+ //# sourceMappingURL=chunk-QSY2VW7V.cjs.map
175
+ //# sourceMappingURL=chunk-QSY2VW7V.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auth/SsoLoginButton.tsx","../src/auth/return-url.ts","../src/auth/InstallInstructionsDialog.tsx"],"names":["ARBI_MARK_SRC","useMemo","jsx","testIdOr","jsxs","Button","parseHref","isDeepLinkPath","hrefFor","getInstallInstructions","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription"],"mappings":";;;;;;;;;AAUO,IAAM,+BAAA,GAAwD;AAAA,EACnE,SAAA,EAAW,YAAA;AAAA,EACX,YAAA,EAAc;AAChB;AAeO,SAAS,cAAA,CAAe;AAAA,EAC7B,OAAA;AAAA,EACA,YAAA,GAAeA,gBAAA;AAAA,EACf,YAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA,EAAwB;AACtB,EAAA,MAAM,CAAA,GAAIC,aAAA,CAAQ,OAAO,EAAE,GAAG,+BAAA,EAAiC,GAAG,MAAA,EAAO,CAAA,EAAI,CAAC,MAAM,CAAC,CAAA;AACrF,EAAA,uBACEC,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,eAAaC,0BAAA,CAAS,eAAA,EAAiB,EAAE,MAAA,EAAQ,8BAA8B,CAAA;AAAA,MAC/E,SAAA,EAAU,aAAA;AAAA,MAEV,QAAA,kBAAAC,eAAA;AAAA,QAACC,SAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,SAAA,EAAU,+CAAA;AAAA,UACV,OAAA,EAAQ,SAAA;AAAA,UACR,eAAaF,0BAAA,CAAS,MAAA,EAAQ,EAAE,MAAA,EAAQ,0BAA0B,CAAA;AAAA,UAElE,QAA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B,QAAA,EAAA;AAAA,oBAAAP,gBAACQ,eAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAAV,cAAAA,CAACW,cAAA,EAAA,EAAa,QAAA,EAAA,KAAA,CAAM,OAAA,EAAQ,CAAA;AAAA,sBAC5BX,cAAAA,CAACY,oBAAA,EAAA,EAAkB,SAAA,EAAU,WAAU,QAAA,EAAA,+CAAA,EAEvC;AAAA,KAAA,EACF,CAAA;AAAA,oBACAZ,cAAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,wDAAA,EACX,gBAAM,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,qBAChBA,cAAAA,CAAC,IAAA,EAAA,EAAe,QAAA,EAAA,IAAA,EAAA,EAAP,IAAY,CACtB,CAAA,EACH,CAAA;AAAA,IACC,KAAA,CAAM,wBAAQA,cAAAA,CAAC,OAAE,SAAA,EAAU,oCAAA,EAAsC,gBAAM,IAAA,EAAK;AAAA,GAAA,EAC/E,CAAA,EACF,CAAA;AAEJ","file":"chunk-6CNK2C34.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { ARBI_MARK_SRC, Button } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Every fixed string of the SSO button. `brandIconAlt` prop wins over `brandIconAlt` label. */\nexport interface SsoLoginButtonLabels {\n loginWith: string\n brandIconAlt: string\n}\n\nexport const DEFAULT_SSO_LOGIN_BUTTON_LABELS: SsoLoginButtonLabels = {\n loginWith: 'Login with',\n brandIconAlt: 'ARBI Docs',\n}\n\nexport interface SsoLoginButtonProps {\n labels?: Partial<SsoLoginButtonLabels>\n onClick: () => void\n /** Source of the brand mark shown first. */\n brandIconSrc?: string\n brandIconAlt?: string\n /** Button test id (default `login-with-arbi-button`). */\n testId?: string\n /** Wrapper test id (default `sso-login-button-container`). */\n containerTestId?: string\n}\n\n/** \"Login with\" button showing the ARBI mark and the supported identity providers. */\nexport function SsoLoginButton({\n onClick,\n brandIconSrc = ARBI_MARK_SRC,\n brandIconAlt,\n testId,\n containerTestId,\n labels,\n}: SsoLoginButtonProps) {\n const l = useMemo(() => ({ ...DEFAULT_SSO_LOGIN_BUTTON_LABELS, ...labels }), [labels])\n return (\n <div\n data-slot=\"sso-login\"\n data-testid={testIdOr(containerTestId, { testId: 'sso-login-button-container' })}\n className=\"text-center\"\n >\n <Button\n onClick={onClick}\n className=\"flex w-full items-center justify-center gap-3\"\n variant=\"outline\"\n data-testid={testIdOr(testId, { testId: 'login-with-arbi-button' })}\n >\n <span>{l.loginWith}</span>\n <div className=\"flex items-center gap-3 pr-1\">\n <img\n src={brandIconSrc}\n alt={brandIconAlt ?? l.brandIconAlt}\n className=\"h-5 w-5 rounded object-contain\"\n />\n\n {/* LinkedIn */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" fill=\"#0A66C2\" aria-hidden=\"true\">\n <path d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\" />\n </svg>\n\n {/* Google */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"\n />\n </svg>\n\n {/* Apple */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\" />\n </svg>\n </div>\n </Button>\n </div>\n )\n}\n","import { hrefFor, isDeepLinkPath, parseHref } from '../lib/routes'\n\nconst RETURN_URL_KEY = 'arbi_return_url'\n\n/**\n * Strip trailing slashes so `/login/` compares equal to `/login` (bare `/`\n * stays `/`). External / typed / marketing links commonly arrive with a\n * trailing slash; without normalizing, `/login/` slips past the auth-page\n * guard below, gets saved as the return URL, and the post-auth effect\n * `window.location.href`-reloads straight back into the login shell —\n * racing session persistence and wedging the user on /login.\n */\nexport function normalizeAuthPath(pathname: string): string {\n return pathname.replace(/\\/+$/, '') || '/'\n}\n\n/**\n * Auth shells we must never save as a return URL nor hard-reload into\n * (trailing-slash tolerant).\n */\nexport function isAuthRoutePath(pathname: string): boolean {\n const p = normalizeAuthPath(pathname)\n return p === '/login' || p === '/sso'\n}\n\n/**\n * Saves the current URL for post-authentication redirect\n * Preserves pathname, search params, and hash\n */\nexport function preserveAuthReturnUrl(url?: string): void {\n const { pathname, search, hash } = window.location\n const urlToSave = url || `${pathname}${search}${hash}`\n // Guard against the URL being saved, not the current page — a caller can be\n // on /login itself and still pass an explicit destination to save for after\n // auth (e.g. a resource-share invite link's `&next=` param), which must not\n // be silently dropped just because /login is where it's being parsed. A\n // fixed dummy base (rather than window.location.origin) resolves a bare\n // path like `/wrk-.../doc-...` without depending on window.location being\n // in a valid state — an absolute `url` (e.g. McpConnect's window.location.href)\n // ignores the base entirely, per the URL spec.\n const guard = url ? new URL(url, 'http://dummy-base.invalid') : { pathname, search, hash }\n const path = normalizeAuthPath(guard.pathname)\n\n // Don't save the auth pages themselves, or the bare home with nothing to\n // return to. Deep links are path-based (e.g. `/wrk-…/con-…/msg-…`), so they\n // carry a non-`/` pathname and are preserved naturally. We still save `/`\n // when it carries a query (e.g. `?review_access=…`) so those flows survive\n // the login round-trip.\n const isAuthPage = isAuthRoutePath(guard.pathname)\n const isBareHome = path === '/' && !guard.search && !guard.hash\n // Embedded add-in panels (Word/Chrome) own their own post-auth state and must\n // never become a saved return URL — otherwise the main-app post-auth effect\n // would `window.location.href` into the panel (a full reload that breaks the\n // just-established session inside the Office iframe → bounce back to login).\n const isEmbedded = path.startsWith('/word/') || path.startsWith('/chrome/')\n\n if (!isAuthPage && !isBareHome && !isEmbedded) {\n sessionStorage.setItem(RETURN_URL_KEY, urlToSave)\n }\n}\n\n/** The saved return URL, taken: it is cleared, so only the first reader acts on it. */\nexport function takeAuthReturnUrl(): string | null {\n const returnUrl = sessionStorage.getItem(RETURN_URL_KEY)\n if (returnUrl) sessionStorage.removeItem(RETURN_URL_KEY)\n return returnUrl || null\n}\n\n/** Where a saved return URL leads after the sign-in, decided once. */\nexport type AuthReturnDestination =\n /** The review of an access request (`PENDING_ACCESS_REVIEW_VIEW`). */\n | { type: 'review_access'; notificationId: string }\n /** Where a notification leads (`PENDING_NOTIFICATION_VIEW`). */\n | { type: 'notification'; notificationId: string }\n /** A place the signed-in app opens itself: navigate there client-side (a full load would race\n * the session just established). */\n | { type: 'path'; path: string }\n /** Another page of this site: load it. */\n | { type: 'external'; url: string }\n\n/**\n * Take the saved return URL (`takeAuthReturnUrl`: only the first caller gets it) and decide where\n * it leads; the caller navigates. Only an address of this site counts: another origin is dropped,\n * and so is an auth page, which would bounce straight back into the sign-in.\n */\nexport function resolveAuthReturn(): AuthReturnDestination | null {\n const returnUrl = takeAuthReturnUrl()\n if (!returnUrl) return null\n let url: URL\n try {\n url = new URL(returnUrl, window.location.origin)\n } catch {\n return null\n }\n if (url.origin !== window.location.origin) return null\n const { pathname, search, hash } = url\n const route = parseHref(`${pathname}${search}${hash}`)\n switch (route?.kind) {\n case 'review-access':\n return { type: 'review_access', notificationId: route.notificationId }\n case 'notification':\n return { type: 'notification', notificationId: route.notificationId }\n }\n // A deep link opens in the app, a malformed one too (the app says it cannot be opened).\n if (isDeepLinkPath(pathname)) return { type: 'path', path: `${pathname}${search}${hash}` }\n switch (route?.kind) {\n case 'workspace':\n case 'conversation':\n case 'document':\n case 'action':\n // A legacy hash link (`/#/wrk-…`) opens at its path.\n return { type: 'path', path: hrefFor(route)! }\n // A secure-mail claim's key never rides in the saved address; a call keeps its invite and key.\n case 'secure-mail':\n return { type: 'path', path: pathname }\n case 'call':\n return { type: 'path', path: `${pathname}${search}${hash}` }\n }\n if (isAuthRoutePath(pathname)) return null\n return { type: 'external', url: returnUrl }\n}\n\n/**\n * Where a signed-out visit to a page that needs the sign-in goes: the sign-in, with the page kept\n * for after it (the bare start is not worth keeping).\n */\nexport function signInRedirect(): string {\n const { pathname, search, hash } = window.location\n if (!(normalizeAuthPath(pathname) === '/' && !search && !hash)) preserveAuthReturnUrl()\n return '/login'\n}\n","/**\n * InstallInstructionsDialog\n *\n * Shown when the user asks to install the ARBI app but the browser can't open\n * the install dialog directly (Safari, Firefox, or a Chromium browser that\n * never fired beforeinstallprompt — e.g. it's already installed). The\n * per-browser steps come from @arbidocs/blocks.\n */\n\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n} from '@arbidocs/react/ui'\nimport { getInstallInstructions } from '../shell/install-instructions'\n\ninterface InstallInstructionsDialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nexport function InstallInstructionsDialog({ open, onOpenChange }: InstallInstructionsDialogProps) {\n const guide = getInstallInstructions({ appName: 'ARBI' })\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent data-testid=\"install-instructions-dialog\">\n <DialogHeader>\n <DialogTitle>{guide.heading}</DialogTitle>\n <DialogDescription className=\"sr-only\">\n Steps to install the ARBI app on your device.\n </DialogDescription>\n </DialogHeader>\n <ol className=\"list-decimal space-y-2 pl-5 text-sm text-foreground/90\">\n {guide.steps.map((step) => (\n <li key={step}>{step}</li>\n ))}\n </ol>\n {guide.note && <p className=\"mt-3 text-xs text-muted-foreground\">{guide.note}</p>}\n </DialogContent>\n </Dialog>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/auth/SsoLoginButton.tsx","../src/auth/return-url.ts","../src/auth/InstallInstructionsDialog.tsx"],"names":["ARBI_MARK_SRC","useMemo","jsx","testIdOr","jsxs","Button","parseHref","isDeepLinkPath","hrefFor","getInstallInstructions","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription"],"mappings":";;;;;;;;;AAUO,IAAM,+BAAA,GAAwD;AAAA,EACnE,SAAA,EAAW,YAAA;AAAA,EACX,YAAA,EAAc;AAChB;AAeO,SAAS,cAAA,CAAe;AAAA,EAC7B,OAAA;AAAA,EACA,YAAA,GAAeA,gBAAA;AAAA,EACf,YAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA,EAAwB;AACtB,EAAA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ARK_SRC, Button } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Every fixed string of the SSO button. `brandIconAlt` prop wins over `brandIconAlt` label. */\nexport interface SsoLoginButtonLabels {\n loginWith: string\n brandIconAlt: string\n}\n\nexport const DEFAULT_SSO_LOGIN_BUTTON_LABELS: SsoLoginButtonLabels = {\n loginWith: 'Login with',\n brandIconAlt: 'ARBI Docs',\n}\n\nexport interface SsoLoginButtonProps {\n labels?: Partial<SsoLoginButtonLabels>\n onClick: () => void\n /** Source of the brand mark shown first. */\n brandIconSrc?: string\n brandIconAlt?: string\n /** Button test id (default `login-with-arbi-button`). */\n testId?: string\n /** Wrapper test id (default `sso-login-button-container`). */\n containerTestId?: string\n}\n\n/** \"Login with\" button showing the ARBI mark and the supported identity providers. */\nexport function SsoLoginButton({\n onClick,\n brandIconSrc = ARBI_MARK_SRC,\n brandIconAlt,\n testId,\n containerTestId,\n labels,\n}: SsoLoginButtonProps) {\n const l = useMemo(() => ({ ...DEFAULT_SSO_LOGIN_BUTTON_LABELS, ...labels }), [labels])\n return (\n <div\n data-slot=\"sso-login\"\n data-testid={testIdOr(containerTestId, { testId: 'sso-login-button-container' })}\n className=\"text-center\"\n >\n <Button\n onClick={onClick}\n className=\"flex w-full items-center justify-center gap-3\"\n variant=\"outline\"\n data-testid={testIdOr(testId, { testId: 'login-with-arbi-button' })}\n >\n <span>{l.loginWith}</span>\n <div className=\"flex items-center gap-3 pr-1\">\n <img\n src={brandIconSrc}\n alt={brandIconAlt ?? l.brandIconAlt}\n className=\"h-5 w-5 rounded object-contain\"\n />\n\n {/* LinkedIn */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" fill=\"#0A66C2\" aria-hidden=\"true\">\n <path d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\" />\n </svg>\n\n {/* Google */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"\n />\n </svg>\n\n {/* Apple */}\n <svg className=\"h-5 w-5\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\" />\n </svg>\n </div>\n </Button>\n </div>\n )\n}\n","import { hrefFor, isDeepLinkPath, parseHref } from '../lib/routes'\n\nconst RETURN_URL_KEY = 'arbi_return_url'\n\n/**\n * Strip trailing slashes so `/login/` compares equal to `/login` (bare `/`\n * stays `/`). External / typed / marketing links commonly arrive with a\n * trailing slash; without normalizing, `/login/` slips past the auth-page\n * guard below, gets saved as the return URL, and the post-auth effect\n * `window.location.href`-reloads straight back into the login shell —\n * racing session persistence and wedging the user on /login.\n */\nexport function normalizeAuthPath(pathname: string): string {\n return pathname.replace(/\\/+$/, '') || '/'\n}\n\n/**\n * Auth shells we must never save as a return URL nor hard-reload into\n * (trailing-slash tolerant).\n */\nexport function isAuthRoutePath(pathname: string): boolean {\n const p = normalizeAuthPath(pathname)\n return p === '/login' || p === '/sso'\n}\n\n/**\n * Saves the current URL for post-authentication redirect\n * Preserves pathname, search params, and hash\n */\nexport function preserveAuthReturnUrl(url?: string): void {\n const { pathname, search, hash } = window.location\n const urlToSave = url || `${pathname}${search}${hash}`\n // Guard against the URL being saved, not the current page — a caller can be\n // on /login itself and still pass an explicit destination to save for after\n // auth (e.g. a resource-share invite link's `&next=` param), which must not\n // be silently dropped just because /login is where it's being parsed. A\n // fixed dummy base (rather than window.location.origin) resolves a bare\n // path like `/wrk-.../doc-...` without depending on window.location being\n // in a valid state — an absolute `url` (e.g. McpConnect's window.location.href)\n // ignores the base entirely, per the URL spec.\n const guard = url ? new URL(url, 'http://dummy-base.invalid') : { pathname, search, hash }\n const path = normalizeAuthPath(guard.pathname)\n\n // Don't save the auth pages themselves, or the bare home with nothing to\n // return to. Deep links are path-based (e.g. `/wrk-…/con-…/msg-…`), so they\n // carry a non-`/` pathname and are preserved naturally. We still save `/`\n // when it carries a query (e.g. `?review_access=…`) so those flows survive\n // the login round-trip.\n const isAuthPage = isAuthRoutePath(guard.pathname)\n const isBareHome = path === '/' && !guard.search && !guard.hash\n // Embedded add-in panels (Word/Chrome) own their own post-auth state and must\n // never become a saved return URL — otherwise the main-app post-auth effect\n // would `window.location.href` into the panel (a full reload that breaks the\n // just-established session inside the Office iframe → bounce back to login).\n const isEmbedded = path.startsWith('/word/') || path.startsWith('/chrome/')\n\n if (!isAuthPage && !isBareHome && !isEmbedded) {\n sessionStorage.setItem(RETURN_URL_KEY, urlToSave)\n }\n}\n\n/** The saved return URL, taken: it is cleared, so only the first reader acts on it. */\nexport function takeAuthReturnUrl(): string | null {\n const returnUrl = sessionStorage.getItem(RETURN_URL_KEY)\n if (returnUrl) sessionStorage.removeItem(RETURN_URL_KEY)\n return returnUrl || null\n}\n\n/** Where a saved return URL leads after the sign-in, decided once. */\nexport type AuthReturnDestination =\n /** The review of an access request (`PENDING_ACCESS_REVIEW_VIEW`). */\n | { type: 'review_access'; notificationId: string }\n /** Where a notification leads (`PENDING_NOTIFICATION_VIEW`). */\n | { type: 'notification'; notificationId: string }\n /** A place the signed-in app opens itself: navigate there client-side (a full load would race\n * the session just established). */\n | { type: 'path'; path: string }\n /** Another page of this site: load it. */\n | { type: 'external'; url: string }\n\n/**\n * Take the saved return URL (`takeAuthReturnUrl`: only the first caller gets it) and decide where\n * it leads; the caller navigates. Only an address of this site counts: another origin is dropped,\n * and so is an auth page, which would bounce straight back into the sign-in.\n */\nexport function resolveAuthReturn(): AuthReturnDestination | null {\n const returnUrl = takeAuthReturnUrl()\n if (!returnUrl) return null\n let url: URL\n try {\n url = new URL(returnUrl, window.location.origin)\n } catch {\n return null\n }\n if (url.origin !== window.location.origin) return null\n const { pathname, search, hash } = url\n const route = parseHref(`${pathname}${search}${hash}`)\n switch (route?.kind) {\n case 'review-access':\n return { type: 'review_access', notificationId: route.notificationId }\n case 'notification':\n return { type: 'notification', notificationId: route.notificationId }\n }\n // A deep link opens in the app, a malformed one too (the app says it cannot be opened).\n if (isDeepLinkPath(pathname)) return { type: 'path', path: `${pathname}${search}${hash}` }\n switch (route?.kind) {\n case 'workspace':\n case 'conversation':\n case 'document':\n case 'action':\n // A legacy hash link (`/#/wrk-…`) opens at its path.\n return { type: 'path', path: hrefFor(route)! }\n // A secure-mail claim's key never rides in the saved address; a call keeps its invite and key.\n case 'secure-mail':\n return { type: 'path', path: pathname }\n case 'call':\n return { type: 'path', path: `${pathname}${search}${hash}` }\n }\n if (isAuthRoutePath(pathname)) return null\n return { type: 'external', url: returnUrl }\n}\n\n/**\n * Where a signed-out visit to a page that needs the sign-in goes: the sign-in, with the page kept\n * for after it (the bare start is not worth keeping).\n */\nexport function signInRedirect(): string {\n const { pathname, search, hash } = window.location\n if (!(normalizeAuthPath(pathname) === '/' && !search && !hash)) preserveAuthReturnUrl()\n return '/login'\n}\n","/**\n * InstallInstructionsDialog\n *\n * Shown when the user asks to install the ARBI app but the browser can't open\n * the install dialog directly (Safari, Firefox, or a Chromium browser that\n * never fired beforeinstallprompt — e.g. it's already installed). The\n * per-browser steps come from @arbidocs/blocks.\n */\n\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n} from '@arbidocs/react/ui'\nimport { getInstallInstructions } from '../shell/install-instructions'\n\ninterface InstallInstructionsDialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n}\n\nexport function InstallInstructionsDialog({ open, onOpenChange }: InstallInstructionsDialogProps) {\n const guide = getInstallInstructions({ appName: 'ARBI' })\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent data-testid=\"install-instructions-dialog\">\n <DialogHeader>\n <DialogTitle>{guide.heading}</DialogTitle>\n <DialogDescription className=\"sr-only\">\n Steps to install the ARBI app on your device.\n </DialogDescription>\n </DialogHeader>\n <ol className=\"list-decimal space-y-2 pl-5 text-sm text-foreground/90\">\n {guide.steps.map((step) => (\n <li key={step}>{step}</li>\n ))}\n </ol>\n {guide.note && <p className=\"mt-3 text-xs text-muted-foreground\">{guide.note}</p>}\n </DialogContent>\n </Dialog>\n )\n}\n"]}