@taskforcehq/taskforce 0.3.328 → 0.3.329

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 (264) hide show
  1. package/dist/Taskforce.module.css +233 -34
  2. package/dist/TaskforceCore.js +237 -230
  3. package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.js +1 -1
  4. package/dist/cli.js +34 -0
  5. package/dist/cliCloudTargetGuard.d.ts +5 -0
  6. package/dist/cliCloudTargetGuard.js +11 -0
  7. package/dist/components/features/AnnotatedAttachmentWorkspace.js +24 -8
  8. package/dist/components/features/TaskSettings.d.ts +12 -1
  9. package/dist/components/features/TaskSettings.js +147 -40
  10. package/dist/components/features/agentCapabilities/AgentCapabilitiesPrototype.d.ts +1 -1
  11. package/dist/components/features/planning/PlanningModule.js +2 -5
  12. package/dist/components/features/planning/PlanningTaskOrderList.d.ts +1 -1
  13. package/dist/components/features/planning/PlanningTaskOrderList.js +17 -6
  14. package/dist/components/features/planning/planningTaskArrangement.d.ts +1 -0
  15. package/dist/components/features/planning/planningTaskArrangement.js +5 -5
  16. package/dist/components/features/taskforceAgentEditorModel.js +3 -1
  17. package/dist/components/task/TaskCard.d.ts +5 -0
  18. package/dist/components/task/TaskCard.js +65 -10
  19. package/dist/components/task/TaskImageReviews.js +14 -5
  20. package/dist/components/task/TaskKanban.d.ts +6 -1
  21. package/dist/components/task/TaskKanban.js +152 -6
  22. package/dist/components/task/TaskList.d.ts +5 -0
  23. package/dist/components/task/TaskList.js +3 -3
  24. package/dist/components/ui/PasswordInput.d.ts +6 -0
  25. package/dist/components/ui/PasswordInput.js +11 -0
  26. package/dist/components/ui/TopNoticeLayer.js +1 -1
  27. package/dist/components/views/AppShellHeader.js +32 -11
  28. package/dist/components/views/PlanComparisonPage.js +12 -0
  29. package/dist/components/views/StandaloneLayout.js +7 -31
  30. package/dist/components/views/WidgetView.js +3 -3
  31. package/dist/components/views/panels/PlanningDrawer.js +5 -12
  32. package/dist/components/views/standalone/modals/AccountSettingsModal.js +26 -17
  33. package/dist/config/envSchema.js +12 -0
  34. package/dist/config/localServiceRuntimeContract.d.ts +13 -0
  35. package/dist/config/localServiceRuntimeContract.js +135 -0
  36. package/dist/core/AiProfileService.js +46 -8
  37. package/dist/core/DeletedTaskLifecycleService.d.ts +1 -0
  38. package/dist/core/DeletedTaskLifecycleService.js +37 -6
  39. package/dist/core/TaskAttachmentLinksDurableMutationService.d.ts +3 -2
  40. package/dist/core/TaskAttachmentLinksDurableMutationService.js +33 -9
  41. package/dist/core/Taskforce.d.ts +62 -2
  42. package/dist/core/Taskforce.js +635 -32
  43. package/dist/core/types.d.ts +6 -0
  44. package/dist/hooks/sync/useDurableLocalOutboxDrain.d.ts +1 -1
  45. package/dist/hooks/sync/useDurableTaskCreateMutation.js +1 -1
  46. package/dist/hooks/sync/useDurableTaskMetadataMutation.d.ts +1 -0
  47. package/dist/hooks/sync/useDurableTaskMetadataMutation.js +1 -0
  48. package/dist/hooks/sync/useDurableTaskStatusMutation.d.ts +1 -0
  49. package/dist/hooks/tasks/taskHttpMutation.js +1 -0
  50. package/dist/hooks/tasks/useCloudTaskSearch.d.ts +12 -0
  51. package/dist/hooks/tasks/useCloudTaskSearch.js +71 -0
  52. package/dist/hooks/tasks/useTaskDescriptionImageDraftRecovery.d.ts +16 -0
  53. package/dist/hooks/tasks/useTaskDescriptionImageDraftRecovery.js +197 -0
  54. package/dist/hooks/tasks/useTaskEditorNavigation.d.ts +16 -3
  55. package/dist/hooks/tasks/useTaskEditorNavigation.js +72 -13
  56. package/dist/hooks/tasks/useTaskFormActions.d.ts +6 -0
  57. package/dist/hooks/tasks/useTaskFormActions.js +65 -12
  58. package/dist/hooks/ui/useSettingsModel.d.ts +24 -2
  59. package/dist/hooks/ui/useSettingsModel.js +13 -2
  60. package/dist/hooks/ui/useSettingsPersistence.d.ts +12 -1
  61. package/dist/hooks/ui/useSettingsPersistence.js +74 -47
  62. package/dist/hooks/useFilterSort.d.ts +7 -3
  63. package/dist/hooks/useFilterSort.js +15 -5
  64. package/dist/hooks/useTaskData.d.ts +10 -1
  65. package/dist/hooks/useTaskData.js +216 -7
  66. package/dist/hooks/useTaskMutations.d.ts +10 -2
  67. package/dist/hooks/useTaskMutations.js +223 -43
  68. package/dist/hooks/useTaskforce.d.ts +37 -9
  69. package/dist/hooks/useTaskforce.js +349 -39
  70. package/dist/hooks/useUiNotice.d.ts +4 -0
  71. package/dist/hooks/useUiNotice.js +4 -0
  72. package/dist/mcp/adminWorkspaceRegistrar.js +3 -3
  73. package/dist/mcp/documentAssetRegistrar.js +44 -35
  74. package/dist/mcp/documentHelpers.d.ts +1 -0
  75. package/dist/mcp/documentHelpers.js +7 -3
  76. package/dist/mcp/runtime.js +172 -42
  77. package/dist/mcp/taskPlanningRegistrar.js +41 -38
  78. package/dist/mcp/toolCallCompatibility.js +38 -1
  79. package/dist/mcp/toolCatalog.d.ts +1 -0
  80. package/dist/migrations/taskSchemaMigrations.js +12 -0
  81. package/dist/runtime/appGateDefinitions.d.ts +30 -6
  82. package/dist/runtime/appGateDefinitions.js +6 -6
  83. package/dist/runtime/appGates.d.ts +12 -13
  84. package/dist/runtime/appGates.js +29 -13
  85. package/dist/runtime/nodeAppGates.d.ts +8 -0
  86. package/dist/runtime/nodeAppGates.js +27 -0
  87. package/dist/server/cloudCollectionRead.d.ts +1 -1
  88. package/dist/server/cloudCollectionRead.js +2 -2
  89. package/dist/server/index.d.ts +3 -0
  90. package/dist/server/index.js +15 -3
  91. package/dist/server/localServiceLease.d.ts +3 -0
  92. package/dist/server/localServiceLease.js +9 -1
  93. package/dist/server/localWorkspaceSyncServerRuntime.js +10 -3
  94. package/dist/server/rateLimit.d.ts +1 -0
  95. package/dist/server/rateLimit.js +4 -0
  96. package/dist/server/realtimeSyncWs.js +36 -12
  97. package/dist/server/routes/admin.js +1 -0
  98. package/dist/server/routes/agentRoles.js +3 -2
  99. package/dist/server/routes/agentSkills.js +3 -2
  100. package/dist/server/routes/agents.js +118 -16
  101. package/dist/server/routes/annotatedAttachments.js +3 -2
  102. package/dist/server/routes/auth.js +3 -1
  103. package/dist/server/routes/durableTaskHttpRouters.d.ts +9 -2
  104. package/dist/server/routes/localService.js +2 -0
  105. package/dist/server/routes/primitives.d.ts +2 -0
  106. package/dist/server/routes/syncAuxRoutes.js +5 -2
  107. package/dist/server/routes/syncPullApplyRoutes.js +23 -4
  108. package/dist/server/routes/syncV3FeedRoutes.js +18 -16
  109. package/dist/server/routes/syncV3LocalCaptureRoutes.js +28 -2
  110. package/dist/server/routes/syncV3LocalFeedApplyRoutes.d.ts +1 -0
  111. package/dist/server/routes/syncV3LocalFeedApplyRoutes.js +26 -0
  112. package/dist/server/routes/syncV3OperationRoutes.js +10 -0
  113. package/dist/server/routes/tasks.js +103 -11
  114. package/dist/server/routes/workspaces.js +43 -1
  115. package/dist/server/workspaceDeletionAdmission.d.ts +23 -0
  116. package/dist/server/workspaceDeletionAdmission.js +50 -0
  117. package/dist/service/localServiceCli.js +16 -0
  118. package/dist/service/localServiceClientLifecycle.js +36 -10
  119. package/dist/services/codexAppServerModelGateway.d.ts +112 -0
  120. package/dist/services/codexAppServerModelGateway.js +438 -0
  121. package/dist/services/taskforceAgentMcpBridge.d.ts +7 -1
  122. package/dist/services/taskforceAgentMcpBridge.js +23 -3
  123. package/dist/shared/taskforceAgentDefinition.js +7 -1
  124. package/dist/shared/taskforceAgentModels.d.ts +1 -0
  125. package/dist/shared/taskforceAgentModels.js +30 -1
  126. package/dist/storage/postgresAdapter.d.ts +20 -3
  127. package/dist/storage/postgresAdapter.js +106 -14
  128. package/dist/storage/postgresWorker.js +13 -4
  129. package/dist/storage/postgresWorkerProtocol.d.ts +29 -0
  130. package/dist/storage/postgresWorkerProtocol.js +30 -0
  131. package/dist/sync/cloudSyncApi.d.ts +4 -1
  132. package/dist/sync/cloudSyncApi.js +7 -2
  133. package/dist/sync/contentSyncState.d.ts +1 -1
  134. package/dist/sync/coordinator/localSyncExecutionPermitStore.d.ts +1 -0
  135. package/dist/sync/coordinator/localSyncExecutionPermitStore.js +7 -1
  136. package/dist/sync/coordinator/localWorkspaceSyncRunner.js +6 -2
  137. package/dist/sync/engine/workspaceSyncEngineBrowserGatewayRemoteServices.js +20 -2
  138. package/dist/sync/engine/workspaceSyncEngineLocalServices.d.ts +4 -0
  139. package/dist/sync/engine/workspaceSyncEngineLocalServices.js +11 -0
  140. package/dist/sync/engine/workspaceSyncEngineRemoteServices.d.ts +11 -0
  141. package/dist/sync/engine/workspaceSyncEngineRemoteServices.js +2 -1
  142. package/dist/sync/engine/workspaceSyncEngineServerRemoteServices.js +31 -4
  143. package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.d.ts +3 -1
  144. package/dist/sync/engine/workspaceSyncEngineServerRunnerOperations.js +25 -8
  145. package/dist/sync/engine/workspaceSyncEngineTransfers.d.ts +1 -1
  146. package/dist/sync/engine/workspaceSyncEngineTransfers.js +8 -3
  147. package/dist/sync/syncService.d.ts +2 -0
  148. package/dist/sync/syncService.js +4 -1
  149. package/dist/sync/v3/combinedFeedCapability.js +4 -0
  150. package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.d.ts +2 -0
  151. package/dist/sync/v3/durableTaskAttachmentLinksMutationRouter.js +11 -1
  152. package/dist/sync/v3/durableTaskChecklistMutationRouter.d.ts +2 -0
  153. package/dist/sync/v3/durableTaskChecklistMutationRouter.js +4 -0
  154. package/dist/sync/v3/durableTaskHttpBulkMutationRouter.d.ts +1 -0
  155. package/dist/sync/v3/durableTaskHttpBulkMutationRouter.js +30 -8
  156. package/dist/sync/v3/durableTaskHttpRootMutationRouter.d.ts +5 -3
  157. package/dist/sync/v3/durableTaskHttpRootMutationRouter.js +27 -2
  158. package/dist/sync/v3/localTaskAttachmentLinksOutboxService.d.ts +2 -0
  159. package/dist/sync/v3/localTaskAttachmentLinksOutboxService.js +47 -7
  160. package/dist/sync/v3/localTaskCreateOutboxService.js +15 -6
  161. package/dist/sync/v3/localTaskMetadataClient.d.ts +1 -0
  162. package/dist/sync/v3/localTaskMetadataClient.js +1 -0
  163. package/dist/sync/v3/localTaskMetadataOutboxHandler.js +5 -1
  164. package/dist/sync/v3/localTaskMetadataOutboxService.d.ts +2 -0
  165. package/dist/sync/v3/localTaskMetadataOutboxService.js +7 -0
  166. package/dist/sync/v3/localTaskRestoreOutboxService.js +14 -6
  167. package/dist/sync/v3/localTaskStatusClient.d.ts +1 -0
  168. package/dist/sync/v3/localTaskStatusClient.js +6 -1
  169. package/dist/sync/v3/localTaskStatusOutboxService.d.ts +2 -0
  170. package/dist/sync/v3/localTaskStatusOutboxService.js +54 -13
  171. package/dist/sync/v3/syncDurabilityStore.d.ts +7 -0
  172. package/dist/sync/v3/syncDurabilityStore.js +31 -11
  173. package/dist/sync/v3/taskAttachmentLinksMutationService.d.ts +6 -4
  174. package/dist/sync/v3/taskAttachmentLinksMutationService.js +19 -10
  175. package/dist/sync/v3/taskChecklistMutationService.d.ts +4 -2
  176. package/dist/sync/v3/taskChecklistMutationService.js +4 -0
  177. package/dist/sync/v3/taskCreateMutationService.d.ts +2 -2
  178. package/dist/sync/v3/taskCreateMutationService.js +7 -4
  179. package/dist/sync/v3/taskMetadataMutationService.d.ts +3 -0
  180. package/dist/sync/v3/taskMetadataMutationService.js +4 -0
  181. package/dist/sync/v3/taskRestoreMutationService.d.ts +2 -2
  182. package/dist/sync/v3/taskRestoreMutationService.js +7 -4
  183. package/dist/sync/v3/taskStatusMutationService.d.ts +2 -0
  184. package/dist/sync/v3/taskStatusMutationService.js +4 -0
  185. package/dist/sync/v3/workflowAssignmentSync.d.ts +1 -0
  186. package/dist/sync/v3/workflowAssignmentSync.js +3 -0
  187. package/dist/sync/v3/workspaceSyncV2ProjectionExclusions.d.ts +1 -1
  188. package/dist/sync/v3/workspaceSyncV2ProjectionExclusions.js +13 -3
  189. package/dist/sync/v3/workspaceSyncV3AttachmentApplyObligationStore.d.ts +11 -0
  190. package/dist/sync/v3/workspaceSyncV3AttachmentApplyObligationStore.js +27 -10
  191. package/dist/sync/v3/workspaceSyncV3AttachmentAssetHydration.d.ts +2 -1
  192. package/dist/sync/v3/workspaceSyncV3AttachmentAssetHydration.js +52 -10
  193. package/dist/sync/v3/workspaceSyncV3CloudOperationHandler.js +9 -1
  194. package/dist/sync/v3/workspaceSyncV3CombinedFeedOrchestrator.js +8 -3
  195. package/dist/sync/v3/workspaceSyncV3CombinedLocalApply.js +51 -10
  196. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.d.ts +7 -0
  197. package/dist/sync/v3/workspaceSyncV3CombinedRepairBaseline.js +30 -18
  198. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.d.ts +9 -4
  199. package/dist/sync/v3/workspaceSyncV3CombinedRepairMaterialization.js +98 -47
  200. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.d.ts +10 -0
  201. package/dist/sync/v3/workspaceSyncV3CombinedRepairSnapshot.js +58 -21
  202. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.d.ts +3 -1
  203. package/dist/sync/v3/workspaceSyncV3CombinedWireContract.js +18 -0
  204. package/dist/sync/v3/workspaceSyncV3CoverageRegistry.js +6 -0
  205. package/dist/sync/v3/workspaceSyncV3FeedProfile.d.ts +1 -1
  206. package/dist/sync/v3/workspaceSyncV3LegacyBoundaryAttestation.d.ts +1 -0
  207. package/dist/sync/v3/workspaceSyncV3LegacyBoundaryAttestation.js +23 -10
  208. package/dist/sync/v3/workspaceSyncV3NestedTaskApply.d.ts +3 -0
  209. package/dist/sync/v3/workspaceSyncV3NestedTaskApply.js +64 -13
  210. package/dist/sync/v3/workspaceSyncV3NestedTaskCodecs.d.ts +9 -0
  211. package/dist/sync/v3/workspaceSyncV3NestedTaskCodecs.js +26 -0
  212. package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.d.ts +15 -5
  213. package/dist/sync/v3/workspaceSyncV3NestedTaskProjection.js +50 -14
  214. package/dist/sync/v3/workspaceSyncV3NestedTaskRepairSnapshot.d.ts +2 -1
  215. package/dist/sync/v3/workspaceSyncV3NestedTaskRepairSnapshot.js +11 -3
  216. package/dist/sync/v3/workspaceSyncV3OperationProtocol.d.ts +2 -0
  217. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.d.ts +2 -0
  218. package/dist/sync/v3/workspaceSyncV3OperatorDiagnostics.js +19 -7
  219. package/dist/sync/v3/workspaceSyncV3TaskCommentAudit.js +9 -2
  220. package/dist/sync/v3/workspaceSyncV3TaskCoverCoverage.d.ts +7 -0
  221. package/dist/sync/v3/workspaceSyncV3TaskCoverCoverage.js +37 -0
  222. package/dist/sync/v3/workspaceSyncV3TaskCoverWireContract.d.ts +6 -0
  223. package/dist/sync/v3/workspaceSyncV3TaskCoverWireContract.js +9 -0
  224. package/dist/sync/workspacePullFeed.js +2 -1
  225. package/dist/sync/workspaceRepair.d.ts +3 -0
  226. package/dist/sync/workspaceRepair.js +67 -6
  227. package/dist/types.d.ts +47 -1
  228. package/dist/types.js +6 -0
  229. package/dist/ui/assets/{AiIdentityRosterCard-MZs7lVED.js → AiIdentityRosterCard-BZM4aQnM.js} +1 -1
  230. package/dist/ui/assets/AiProfilesModule-BbAEWtHH.js +1 -0
  231. package/dist/ui/assets/AnnotatedAttachmentWorkspace-B68Wg-RV.js +3 -0
  232. package/dist/ui/assets/AnnotatedAttachmentWorkspace-TzYu7pkG.css +1 -0
  233. package/dist/ui/assets/{AssetTraySortControl-Kf1pelSy.js → AssetTraySortControl-C8Rztyal.js} +1 -1
  234. package/dist/ui/assets/{ContextAttachmentManager-B8boOs6Q.js → ContextAttachmentManager-Cj3c7X9y.js} +2 -2
  235. package/dist/ui/assets/{DocumentWorkspace-DXH4XUsB.js → DocumentWorkspace-B5uvzems.js} +1 -1
  236. package/dist/ui/assets/{EntityActivityTimeline-BtSTq0ON.js → EntityActivityTimeline-BVFvCB5R.js} +1 -1
  237. package/dist/ui/assets/PlanningModule-B5DWQOGz.js +1 -0
  238. package/dist/ui/assets/PlansPage-AY4cGWco.js +1 -0
  239. package/dist/ui/assets/TaskContextUpload-DZxTVesW.js +1 -0
  240. package/dist/ui/assets/TaskSettings-BeWAuyZj.js +12 -0
  241. package/dist/ui/assets/{TaskforceAgentsModule-BazdUwxZ.js → TaskforceAgentsModule-BifCYtjR.js} +6 -6
  242. package/dist/ui/assets/{WorkflowManagerModule-DWFspC-o.js → WorkflowManagerModule-DEr5di_r.js} +1 -1
  243. package/dist/ui/assets/index-I5zhdtgt.js +7 -0
  244. package/dist/ui/assets/index-VRFsx3wz.css +1 -0
  245. package/dist/ui/assets/{vendor-icons-BkFLXavV.js → vendor-icons-D9Lpw-j4.js} +1 -1
  246. package/dist/ui/index.html +3 -3
  247. package/dist/utils/taskActivity.d.ts +3 -2
  248. package/dist/utils/taskActivity.js +19 -2
  249. package/dist/utils/taskEditorReconciliation.d.ts +40 -0
  250. package/dist/utils/taskEditorReconciliation.js +217 -0
  251. package/dist/utils/taskNormalization.d.ts +1 -0
  252. package/dist/utils/taskNormalization.js +39 -0
  253. package/dist/utils/taskSearch.js +2 -2
  254. package/dist/utils/uiNotice.d.ts +4 -0
  255. package/package.json +16 -4
  256. package/dist/ui/assets/AiProfilesModule-C3i0LOxe.js +0 -1
  257. package/dist/ui/assets/AnnotatedAttachmentWorkspace-CBRZ8rca.css +0 -1
  258. package/dist/ui/assets/AnnotatedAttachmentWorkspace-DVZk5Tln.js +0 -3
  259. package/dist/ui/assets/PlanningModule-BPVyEa-f.js +0 -1
  260. package/dist/ui/assets/PlansPage-ChqgxALc.js +0 -1
  261. package/dist/ui/assets/TaskContextUpload-CB3ol0sN.js +0 -1
  262. package/dist/ui/assets/TaskSettings-g4ECKNOz.js +0 -12
  263. package/dist/ui/assets/index-BUplSsv_.js +0 -7
  264. package/dist/ui/assets/index-gz2EXuoK.css +0 -1
@@ -1,3 +1,3 @@
1
- import{r as l,j as e,a as Ce}from"./vendor-react-CKJs5o3c.js";import{t as o,aZ as ke,a_ as je,a$ as xt,aY as Wt,b0 as wt,u as ve,b1 as Ee,b2 as Ae,b3 as Ie,b4 as Re,R as De,b5 as Te,b6 as Ne}from"./index-BUplSsv_.js";import{w as Yt,t as Le,bo as ot,af as bt,q as Se,X as $e,Z as Pe,bp as Fe,a3 as Zt,bq as Vt,a1 as Jt,r as Qt,u as te,ak as Me,a2 as ze}from"./vendor-icons-BkFLXavV.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const ae=[".png",".jpg",".jpeg",".webp",".gif",".pdf",".txt",".md",".csv",".json",".doc",".docx",".html",".js",".ts",".tsx",".css",".py",".java",".go",".rs",".sh"].join(","),Ue=new Set(["image/png","image/jpeg","image/webp"]),Oe=new Set(ae.split(",").map(c=>c.trim().toLowerCase())),Be=10*1024*1024,_e=3500;function oe(c){const u=c.trim().toLowerCase(),y=u.lastIndexOf(".");return y===-1?"":u.slice(y)}function yt(c){if(c.length===0)return"";const u=c.slice(0,3).join(", "),y=c.length-3;return y>0?`${u}, +${y} more`:u}function Ke(c){return`${c.name.trim().toLowerCase()}::${c.size}::${c.lastModified}`}function J(c){return/\.(png|jpe?g|webp|gif)(\?|#|$)/i.test(c)}function qe(c){const u=c.types;if(!u)return null;for(const y of Array.from(u)){const v=String(y||"").trim().toLowerCase();if(Ue.has(v))return v}return null}function ee(c,u){const y=c.includes("?")?"&":"?";return`${c}${y}download=1&filename=${encodeURIComponent(u)}`}function ne(c){return typeof c=="string"?c.split("/").pop()||"Context file":c.displayName||c.originalFilename||c.caption||c.fsPath||c.path.split("/").pop()||"Context file"}function Xe(c){const u=typeof c=="string"?[c]:[c.originalFilename,c.displayName,c.caption,c.fsPath,c.path];for(const v of u){if(!v)continue;const W=oe(v);if(W)return W.replace(".","").slice(0,5).toUpperCase()}const y=typeof c=="string"?c:c.path;return/^https?:\/\//i.test(y)?"LINK":"FILE"}function Qe(c){const{ownerType:u="task",ownerId:y,ownerReferenceLabel:v,workspaceId:W,attachments:N,onAddAttachment:Ct,onRemoveAttachment:kt,onUpdateAttachmentCaption:se,cardCoverAssetId:re=null,onSetCardCover:jt,cardCoverDisabled:vt=!1,readOnly:g=!1,defaultExpanded:st=!0,supplementalContent:le}=c,L=l.useRef(null),rt=l.useRef(null),[Et,lt]=l.useState(!1),[At,E]=l.useState(null),[it,ct]=l.useState(""),[Q,I]=l.useState(null),[M,k]=l.useState(null),[It,ut]=l.useState(null),[dt,tt]=l.useState(st),[S,R]=l.useState(!1),[Y,P]=l.useState(!1),[D,x]=l.useState(null),[A,T]=l.useState(null),[ie,ce]=l.useState({top:0,left:0}),[j,$]=l.useState(null),[ue,Rt]=l.useState(null),z=l.useRef(null);l.useEffect(()=>()=>{z.current!==null&&window.clearTimeout(z.current)},[]),l.useEffect(()=>{ut(null)},[y,u,W]);const de=async t=>{try{await navigator.clipboard.writeText(t)}catch{const n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}Rt(t),z.current!==null&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>{Rt(null),z.current=null},1200)},[Dt,U]=l.useState(!1),[Ge,O]=l.useState(0),Tt=l.useRef(null),B=l.useRef(null),Nt=l.useRef(null),Z=l.useRef(null),Lt=l.useRef(null),_=l.useRef(null),pt=l.useRef(null),et=l.useRef(null),K=l.useRef(null),St=l.useRef(null),F=l.useRef(new Set),ft=l.useRef(new Set),nt=l.useRef(0),$t=l.useRef(""),Pt=t=>(t||"").trim(),at=(t,n)=>{const a=[],s=Pt(t),d=Pt(n);return s&&a.push(`path:${s}`),d&&a.push(`fs:${d}`),a},ht=l.useMemo(()=>{const t=new Set;return N.forEach(n=>{if(typeof n=="string"){at(n).forEach(a=>t.add(a));return}at(n.path,n.fsPath).forEach(a=>t.add(a))}),t},[N]);l.useEffect(()=>{F.current=new Set(ht)},[ht]);const Ft=(t,n)=>n.some(a=>t.has(a)),Mt=(t,n)=>n.forEach(a=>t.add(a)),q=String(W||"").trim(),C=String(y||"").trim(),mt=`${q}\0${u}\0${C}`;l.useLayoutEffect(()=>($t.current=mt,nt.current+=1,ft.current.clear(),F.current=new Set(ht),lt(!1),E(null),ct(""),I(null),k(null),tt(st),R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0),L.current&&(L.current.value=""),()=>{nt.current+=1}),[st,mt]);const pe=u==="initiative"?"initiative":u==="workstream"?"workstream":"task",zt=(t,n=!0,a=F.current)=>{const s=t.trim();if(!s||!/^https?:\/\//i.test(s))return"invalid";const i=s,p=at(i);if(Ft(a,p))return"duplicate";const f=s.split(/[\\/]/).pop()||s;return Ct({path:i,caption:f,timestamp:new Date().toISOString()}),Mt(a,p),n&&ct(""),I(null),"added"};l.useEffect(()=>{if(!M)return;const t=window.setTimeout(()=>{k(null)},_e);return()=>window.clearTimeout(t)},[M]),l.useEffect(()=>{if(!S&&D===null&&A===null)return;const t=n=>{const a=n.target;S&&!Tt.current?.contains(a)&&R(!1),D!==null&&!a?.closest('[data-context-actions-menu="true"]')&&x(null),A!==null&&!_.current?.contains(a)&&!pt.current?.contains(a)&&T(null)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[D,A,S]),l.useEffect(()=>{Y&&St.current?.focus()},[Y]),l.useEffect(()=>{S&&Nt.current?.focus()},[S]),l.useEffect(()=>{D!==null&&Lt.current?.focus()},[D]),l.useEffect(()=>{A!==null&&et.current?.focus()},[A]),l.useLayoutEffect(()=>{if(A===null)return;const t=()=>{const n=_.current?.getBoundingClientRect();if(!n)return;const a=pt.current?.getBoundingClientRect(),s=a?.width||150,d=a?.height||108,i=4,p=8,f=Math.max(p,Math.min(n.right-s,window.innerWidth-s-p)),w=n.bottom+i,m=w+d<=window.innerHeight-p?w:Math.max(p,n.top-d-i);ce({top:m,left:f})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[A]),l.useEffect(()=>{g&&(R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0))},[g]);const Ut=async t=>{if(t.length===0)return;const n=mt,a=nt.current,s=()=>$t.current===n&&nt.current===a;if(!s())return;E(null),k(null);const d=t,i=[],p=[],f=[],w=[],m=new Set(ft.current);d.forEach(r=>{const H=oe(r.name);if(!Oe.has(H)){i.push(r.name);return}if(r.size>Be){p.push(r.name);return}const V=Ke(r);if(m.has(V)){f.push(r.name);return}m.add(V),w.push({file:r,fingerprint:V})});const b=[];if(i.length>0&&b.push(`${i.length} unsupported file${i.length===1?"":"s"} skipped: ${yt(i)}.`),p.length>0&&b.push(`${p.length} file${p.length===1?"":"s"} over 10 MB skipped: ${yt(p)}.`),f.length>0&&b.push(`${f.length} local duplicate file${f.length===1?"":"s"} skipped before upload: ${yt(f)}.`),w.length===0){b.length>0&&k(b.join(" ")),L.current&&(L.current.value="");return}lt(!0);const h=new Set(F.current);let G=0;try{for(const{file:H,fingerprint:V}of w){const gt=await Te(H,{ownerType:u,ownerId:C||null,workspaceId:q||null});if(!s())return;const Ht=at(gt.path,gt.fsPath);if(Ft(h,Ht)){G+=1;continue}Ct(gt),Ne({workspaceId:q||"default",ownerType:u,ownerId:C||null,taskId:u==="task"&&C||null,reason:"upload"}),Mt(h,Ht),ft.current.add(V)}if(!s())return;const r=[...b];G>0&&r.push(`${G} duplicate file${G===1?"":"s"} skipped.`),k(r.length>0?r.join(" "):null),F.current=h}catch(r){s()&&E(r instanceof Error?r.message:"Failed to upload context file")}finally{s()&&(lt(!1),L.current&&(L.current.value=""))}},Ot=async t=>{!t||t.length===0||await Ut(Array.from(t))},fe=async()=>{if(E(null),k(null),!navigator.clipboard||typeof navigator.clipboard.read!="function"){E("Clipboard image paste is not available in this browser.");return}try{const t=await navigator.clipboard.read(),n=[];for(const a of t){const s=qe(a);if(!s)continue;const d=await a.getType(s),i=s.toLowerCase()==="image/png"?"png":s.toLowerCase()==="image/webp"?"webp":"jpg";n.push(new globalThis.File([d],`pasted-image-${Date.now()}.${i}`,{type:s}))}if(n.length===0){E("Clipboard does not currently contain a supported image.");return}await Ut(n)}catch(t){E(t?.message||"Failed to read an image from the clipboard.")}},he=t=>{const n=new Set,a=t.dataTransfer.getData("text/uri-list")||"",s=t.dataTransfer.getData("text/plain")||"",d=`${a}
1
+ import{r as l,j as e,a as Ce}from"./vendor-react-CKJs5o3c.js";import{t as a,a_ as ke,a$ as je,b0 as xt,aZ as Wt,b1 as wt,v as ve,b2 as Ee,b3 as Ae,b4 as Ie,b5 as Re,R as De,b6 as Te,b7 as Ne}from"./index-I5zhdtgt.js";import{w as Zt,t as Le,bo as at,ah as bt,q as Se,X as $e,Z as Pe,bp as Fe,a3 as Vt,bq as Yt,a1 as Jt,r as Qt,u as te,a9 as Me,a2 as ze}from"./vendor-icons-D9Lpw-j4.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const oe=[".png",".jpg",".jpeg",".webp",".gif",".pdf",".txt",".md",".csv",".json",".doc",".docx",".html",".js",".ts",".tsx",".css",".py",".java",".go",".rs",".sh"].join(","),Ue=new Set(["image/png","image/jpeg","image/webp"]),Oe=new Set(oe.split(",").map(c=>c.trim().toLowerCase())),Be=10*1024*1024,_e=3500;function ae(c){const u=c.trim().toLowerCase(),y=u.lastIndexOf(".");return y===-1?"":u.slice(y)}function yt(c){if(c.length===0)return"";const u=c.slice(0,3).join(", "),y=c.length-3;return y>0?`${u}, +${y} more`:u}function Ke(c){return`${c.name.trim().toLowerCase()}::${c.size}::${c.lastModified}`}function J(c){return/\.(png|jpe?g|webp|gif)(\?|#|$)/i.test(c)}function qe(c){const u=c.types;if(!u)return null;for(const y of Array.from(u)){const v=String(y||"").trim().toLowerCase();if(Ue.has(v))return v}return null}function ee(c,u){const y=c.includes("?")?"&":"?";return`${c}${y}download=1&filename=${encodeURIComponent(u)}`}function ne(c){return typeof c=="string"?c.split("/").pop()||"Context file":c.displayName||c.originalFilename||c.caption||c.fsPath||c.path.split("/").pop()||"Context file"}function Xe(c){const u=typeof c=="string"?[c]:[c.originalFilename,c.displayName,c.caption,c.fsPath,c.path];for(const v of u){if(!v)continue;const W=ae(v);if(W)return W.replace(".","").slice(0,5).toUpperCase()}const y=typeof c=="string"?c:c.path;return/^https?:\/\//i.test(y)?"LINK":"FILE"}function Qe(c){const{ownerType:u="task",ownerId:y,ownerReferenceLabel:v,workspaceId:W,attachments:N,onAddAttachment:Ct,onRemoveAttachment:kt,onUpdateAttachmentCaption:se,cardCoverAssetId:re=null,onSetCardCover:jt,cardCoverDisabled:vt=!1,readOnly:g=!1,defaultExpanded:st=!0,supplementalContent:le}=c,L=l.useRef(null),rt=l.useRef(null),[Et,lt]=l.useState(!1),[At,E]=l.useState(null),[it,ct]=l.useState(""),[Q,I]=l.useState(null),[M,k]=l.useState(null),[It,ut]=l.useState(null),[dt,tt]=l.useState(st),[S,R]=l.useState(!1),[Z,P]=l.useState(!1),[D,x]=l.useState(null),[A,T]=l.useState(null),[ie,ce]=l.useState({top:0,left:0}),[j,$]=l.useState(null),[ue,Rt]=l.useState(null),z=l.useRef(null);l.useEffect(()=>()=>{z.current!==null&&window.clearTimeout(z.current)},[]),l.useEffect(()=>{ut(null)},[y,u,W]);const de=async t=>{try{await navigator.clipboard.writeText(t)}catch{const n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}Rt(t),z.current!==null&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>{Rt(null),z.current=null},1200)},[Dt,U]=l.useState(!1),[Ge,O]=l.useState(0),Tt=l.useRef(null),B=l.useRef(null),Nt=l.useRef(null),V=l.useRef(null),Lt=l.useRef(null),_=l.useRef(null),pt=l.useRef(null),et=l.useRef(null),K=l.useRef(null),St=l.useRef(null),F=l.useRef(new Set),ft=l.useRef(new Set),nt=l.useRef(0),$t=l.useRef(""),Pt=t=>(t||"").trim(),ot=(t,n)=>{const o=[],s=Pt(t),d=Pt(n);return s&&o.push(`path:${s}`),d&&o.push(`fs:${d}`),o},ht=l.useMemo(()=>{const t=new Set;return N.forEach(n=>{if(typeof n=="string"){ot(n).forEach(o=>t.add(o));return}ot(n.path,n.fsPath).forEach(o=>t.add(o))}),t},[N]);l.useEffect(()=>{F.current=new Set(ht)},[ht]);const Ft=(t,n)=>n.some(o=>t.has(o)),Mt=(t,n)=>n.forEach(o=>t.add(o)),q=String(W||"").trim(),C=String(y||"").trim(),mt=`${q}\0${u}\0${C}`;l.useLayoutEffect(()=>($t.current=mt,nt.current+=1,ft.current.clear(),F.current=new Set(ht),lt(!1),E(null),ct(""),I(null),k(null),tt(st),R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0),L.current&&(L.current.value=""),()=>{nt.current+=1}),[st,mt]);const pe=u==="initiative"?"initiative":u==="workstream"?"workstream":"task",zt=(t,n=!0,o=F.current)=>{const s=t.trim();if(!s||!/^https?:\/\//i.test(s))return"invalid";const i=s,p=ot(i);if(Ft(o,p))return"duplicate";const f=s.split(/[\\/]/).pop()||s;return Ct({path:i,caption:f,timestamp:new Date().toISOString()}),Mt(o,p),n&&ct(""),I(null),"added"};l.useEffect(()=>{if(!M)return;const t=window.setTimeout(()=>{k(null)},_e);return()=>window.clearTimeout(t)},[M]),l.useEffect(()=>{if(!S&&D===null&&A===null)return;const t=n=>{const o=n.target;S&&!Tt.current?.contains(o)&&R(!1),D!==null&&!o?.closest('[data-context-actions-menu="true"]')&&x(null),A!==null&&!_.current?.contains(o)&&!pt.current?.contains(o)&&T(null)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[D,A,S]),l.useEffect(()=>{Z&&St.current?.focus()},[Z]),l.useEffect(()=>{S&&Nt.current?.focus()},[S]),l.useEffect(()=>{D!==null&&Lt.current?.focus()},[D]),l.useEffect(()=>{A!==null&&et.current?.focus()},[A]),l.useLayoutEffect(()=>{if(A===null)return;const t=()=>{const n=_.current?.getBoundingClientRect();if(!n)return;const o=pt.current?.getBoundingClientRect(),s=o?.width||150,d=o?.height||108,i=4,p=8,f=Math.max(p,Math.min(n.right-s,window.innerWidth-s-p)),w=n.bottom+i,m=w+d<=window.innerHeight-p?w:Math.max(p,n.top-d-i);ce({top:m,left:f})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[A]),l.useEffect(()=>{g&&(R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0))},[g]);const Ut=async t=>{if(t.length===0)return;const n=mt,o=nt.current,s=()=>$t.current===n&&nt.current===o;if(!s())return;E(null),k(null);const d=t,i=[],p=[],f=[],w=[],m=new Set(ft.current);d.forEach(r=>{const H=ae(r.name);if(!Oe.has(H)){i.push(r.name);return}if(r.size>Be){p.push(r.name);return}const Y=Ke(r);if(m.has(Y)){f.push(r.name);return}m.add(Y),w.push({file:r,fingerprint:Y})});const b=[];if(i.length>0&&b.push(`${i.length} unsupported file${i.length===1?"":"s"} skipped: ${yt(i)}.`),p.length>0&&b.push(`${p.length} file${p.length===1?"":"s"} over 10 MB skipped: ${yt(p)}.`),f.length>0&&b.push(`${f.length} local duplicate file${f.length===1?"":"s"} skipped before upload: ${yt(f)}.`),w.length===0){b.length>0&&k(b.join(" ")),L.current&&(L.current.value="");return}lt(!0);const h=new Set(F.current);let G=0;try{for(const{file:H,fingerprint:Y}of w){const gt=await Te(H,{ownerType:u,ownerId:C||null,workspaceId:q||null});if(!s())return;const Ht=ot(gt.path,gt.fsPath);if(Ft(h,Ht)){G+=1;continue}Ct(gt),Ne({workspaceId:q||"default",ownerType:u,ownerId:C||null,taskId:u==="task"&&C||null,reason:"upload"}),Mt(h,Ht),ft.current.add(Y)}if(!s())return;const r=[...b];G>0&&r.push(`${G} duplicate file${G===1?"":"s"} skipped.`),k(r.length>0?r.join(" "):null),F.current=h}catch(r){s()&&E(r instanceof Error?r.message:"Failed to upload context file")}finally{s()&&(lt(!1),L.current&&(L.current.value=""))}},Ot=async t=>{!t||t.length===0||await Ut(Array.from(t))},fe=async()=>{if(E(null),k(null),!navigator.clipboard||typeof navigator.clipboard.read!="function"){E("Clipboard image paste is not available in this browser.");return}try{const t=await navigator.clipboard.read(),n=[];for(const o of t){const s=qe(o);if(!s)continue;const d=await o.getType(s),i=s.toLowerCase()==="image/png"?"png":s.toLowerCase()==="image/webp"?"webp":"jpg";n.push(new globalThis.File([d],`pasted-image-${Date.now()}.${i}`,{type:s}))}if(n.length===0){E("Clipboard does not currently contain a supported image.");return}await Ut(n)}catch(t){E(t?.message||"Failed to read an image from the clipboard.")}},he=t=>{const n=new Set,o=t.dataTransfer.getData("text/uri-list")||"",s=t.dataTransfer.getData("text/plain")||"",d=`${o}
2
2
  ${s}`.split(`
3
- `).map(i=>i.trim()).filter(i=>!!i&&!i.startsWith("#"));for(const i of d){if(/^file:\/\//i.test(i)){try{const p=new URL(i),f=decodeURIComponent(p.pathname||"").trim();f&&n.add(f)}catch{}continue}n.add(i)}return Array.from(n)},me=t=>{if(t.preventDefault(),t.stopPropagation(),U(!1),O(0),E(null),I(null),k(null),t.dataTransfer.files&&t.dataTransfer.files.length>0){Ot(t.dataTransfer.files);return}const n=he(t);if(n.length===0){E("Drop a file or URL.");return}const a=new Set(F.current);let s=0,d=0,i=0;n.forEach(f=>{const w=zt(f,!1,a);w==="duplicate"&&(s+=1),w==="added"&&(d+=1),w==="invalid"&&(i+=1)});const p=[];s>0&&p.push(`${s} duplicate link${s===1?"":"s"} skipped.`),i>0&&p.push(`${i} local path${i===1?"":"s"} skipped. Upload files to attach them, or drop an http(s) URL to link.`),k(p.length>0?p.join(" "):d>0?null:M),F.current=a},ge=t=>{t.preventDefault(),t.stopPropagation(),O(n=>n+1),U(!0)},xe=t=>{t.preventDefault(),t.stopPropagation(),O(n=>{const a=Math.max(0,n-1);return a===0&&U(!1),a})},we=t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="copy"},be=()=>{tt(!0),P(!1),I(null),x(null),R(t=>!t)},ye=()=>{tt(!0),R(!1),P(!0),I(null)},Bt=()=>{P(!1),I(null),window.requestAnimationFrame(()=>B.current?.focus())},_t=()=>{if(!it.trim()){I("Enter an http(s) URL to link.");return}const t=zt(it,!0);if(t==="invalid"){I("Only external http(s) URLs can be linked here. Upload files to attach them.");return}if(t==="duplicate"){k(`Link already exists in ${pe} context.`);return}k(null),P(!1),window.requestAnimationFrame(()=>B.current?.focus())},Kt=(t,n)=>{x(null),$({index:t,value:n,originalValue:n})},X=(t=!1)=>{if(!j)return;const n=j.index,a=j.value.trim();a!==j.originalValue&&se(j.index,a),$(null),t&&window.requestAnimationFrame(()=>{if(K.current?.isConnected){K.current.focus();return}rt.current?.querySelector(`[data-context-caption-index="${n}"]`)?.focus()})},qt=()=>{const t=j?.index;$(null),window.requestAnimationFrame(()=>{if(K.current?.isConnected){K.current.focus();return}t!==void 0&&rt.current?.querySelector(`[data-context-caption-index="${t}"]`)?.focus()})},Xt=N.filter(t=>{const n=typeof t=="string"?t:t.path;return J(n)}),Gt=N.filter(t=>{const n=typeof t=="string"?t:t.path;return!J(n)});return e.jsxs("div",{ref:rt,className:o.specialistSection,children:[e.jsx(ke,{label:"Context",count:N.length,showZeroCount:!0,expanded:dt,expandedTitle:"Hide context",collapsedTitle:"Show context",onToggle:()=>{const t=!dt;tt(t),t||(R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0))},actions:g?void 0:e.jsxs("div",{ref:Tt,className:o.contextMenuControl,onKeyDown:t=>{t.key!=="Escape"||!S||(t.preventDefault(),t.stopPropagation(),R(!1),B.current?.focus())},children:[e.jsx("button",{ref:B,type:"button",className:"tf-control-icon","aria-label":"Add context",title:"Add context","aria-expanded":S,onClick:be,disabled:Et,children:Et?e.jsx(Yt,{size:14,className:o.spinner}):e.jsx(Le,{size:14})}),S&&e.jsxs("div",{className:`${o.contextMenu} ${o.contextAddMenu}`,role:"group","aria-label":"Add context",children:[e.jsxs("button",{ref:Nt,type:"button",onClick:()=>{R(!1),B.current?.focus(),L.current?.click()},children:[e.jsx(ot,{size:14}),"Upload file"]}),e.jsxs("button",{type:"button",onClick:()=>{R(!1),B.current?.focus(),fe()},children:[e.jsx(bt,{size:14}),"Paste image"]}),e.jsxs("button",{type:"button",onClick:ye,children:[e.jsx(Se,{size:14}),"Add link"]})]})]})}),!g&&e.jsx("input",{ref:L,type:"file",accept:ae,multiple:!0,className:o.hiddenInput,onChange:t=>{Ot(t.target.files)}}),dt&&e.jsxs("div",{className:`${o.contextContent} ${Dt?o.contextContentDropActive:""}`,role:"region","aria-label":"Context attachments",onDragEnter:g?void 0:ge,onDragLeave:g?void 0:xe,onDragOver:g?void 0:we,onDrop:g?void 0:me,children:[Dt&&e.jsxs("div",{className:o.contextDropOverlay,"aria-hidden":"true",children:[e.jsx(ot,{size:18}),"Drop files or URLs here"]}),le,Y&&e.jsxs("div",{className:o.contextLinkComposer,children:[e.jsx("input",{ref:St,type:"text",className:o.input,"aria-label":"External context URL","aria-invalid":!!Q,placeholder:"Add external URL (https://...)",value:it,onChange:t=>{ct(t.target.value),Q&&I(null),M&&k(null)},onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),_t()),t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),Bt())}}),e.jsx("button",{type:"button",className:"tf-button-ghost tf-button-compact",onClick:_t,children:"Add link"}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Cancel adding link",title:"Cancel",onClick:()=>{Bt()},children:e.jsx($e,{size:14})})]}),At&&e.jsx("div",{className:o.error,role:"alert",children:At}),M&&e.jsx("div",{className:o.contextNotice,role:"status",children:M}),Y&&Q&&e.jsx("div",{className:o.error,role:"alert",children:Q}),N.length===0&&!Y&&e.jsxs("div",{className:o.contextEmptyState,children:[e.jsx(ot,{size:14}),e.jsx("span",{children:"Drop files here"})]}),Xt.length>0&&e.jsxs("section",{"aria-label":"Images",children:[Gt.length>0&&e.jsx("div",{className:o.contextGroupLabel,children:"Images"}),e.jsx("div",{className:o.attachmentGrid,children:N.map((t,n)=>{const a=typeof t=="string"?t:t.path;if(!J(a))return null;const s=typeof t=="string"?void 0:t.fsPath,d=typeof t=="string"?"":t.caption||"",i=ne(t),p=J(a),f=/^https?:\/\//i.test(a),w=u==="task"&&je(t),m=typeof t=="string"?"":String(t.assetId||"").trim(),b=!!(m&&m===re),h=u==="task"&&!!C&&!!m&&typeof t!="string"&&t.linkRole==="image"&&!!jt&&!g,G=!!(s||!f||!g);return e.jsxs("div",{className:o.attachmentCard,children:[e.jsxs("div",{className:o.attachmentPreviewContainer,children:[p?e.jsx("button",{type:"button",className:o.attachmentPreviewButton,"aria-label":`Open ${d||i}`,onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||u==="task"&&Wt(t,{taskId:C,taskReferenceLabel:v})||window.open(a,"_blank")},children:e.jsx("img",{src:a,alt:"",onError:r=>{r.currentTarget.style.display="none",r.currentTarget.parentElement?.parentElement?.classList.add(o.brokenImage)}})}):e.jsxs("button",{type:"button",className:o.contextFileLink,onClick:()=>{const r=u==="task"?typeof t=="string"?{path:t,taskId:C}:{...t,taskId:C}:t;wt(r,s)||window.open(a,"_blank")},title:"Open file",children:[e.jsx(ot,{size:16}),e.jsx("span",{children:d||s||a.split("/").pop()||"Context file"})]}),e.jsxs("div",{className:o.brokenImagePlaceholder,children:[e.jsx(Pe,{size:16}),e.jsx("span",{children:"Preview unavailable"})]}),e.jsxs("div",{className:o.attachmentActions,children:[h&&e.jsx("button",{type:"button",className:`${o.attachmentActionBtn} ${b?o.attachmentActionBtnActive:""}`,"aria-pressed":b,"aria-label":b?"Remove from task card":"Show on task card",onClick:r=>{r.stopPropagation(),ut(m),E(null),Promise.resolve(jt?.(b?null:m)).then(()=>{k(b?"Removed image from task card.":"Image shown on task card.")}).catch(H=>{E(H instanceof Error?H.message:"Unable to update the task card image.")}).finally(()=>ut(null))},disabled:vt||It!==null,title:vt?"Attachment is still saving":b?"Remove from task card":"Show on task card",children:It===m?e.jsx(Yt,{size:12,className:o.spinner}):e.jsx(Fe,{size:12})}),w&&e.jsx("button",{type:"button",className:o.attachmentActionBtn,"aria-label":"Annotate image",onClick:r=>{r.stopPropagation(),Wt(t,{taskId:C,taskReferenceLabel:v})},title:"Annotate",children:e.jsx(Zt,{size:12})}),G&&e.jsx("button",{type:"button",className:o.attachmentActionBtn,"aria-label":`Actions for ${i}`,"aria-expanded":A===n,onClick:r=>{r.stopPropagation(),_.current=r.currentTarget,x(null),T(A===n?null:n)},title:"More actions",children:e.jsx(Vt,{size:12})}),A===n&&Ce.createPortal(e.jsxs("div",{ref:pt,className:`${o.contextMenu} ${o.attachmentImageActionsMenu}`,role:"group","aria-label":`Actions for ${i}`,style:ie,onClick:r=>r.stopPropagation(),onKeyDown:r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),T(null),_.current?.focus())},children:[s&&e.jsxs("button",{ref:et,type:"button",onClick:()=>{navigator.clipboard.writeText(s),T(null),window.requestAnimationFrame(()=>_.current?.focus())},children:[e.jsx(bt,{size:14})," Copy path"]}),!f&&e.jsxs("button",{ref:s?void 0:et,type:"button",onClick:()=>{window.open(ee(a,d||i),"_blank"),T(null),window.requestAnimationFrame(()=>_.current?.focus())},children:[e.jsx(Jt,{size:14})," Download"]}),!g&&e.jsxs("button",{ref:!s&&f?et:void 0,type:"button",className:o.contextDestructiveMenuItem,onClick:()=>{kt(n),T(null)},children:[e.jsx(Qt,{size:14})," Delete"]})]}),document.body)]})]}),j?.index===n?e.jsxs("div",{className:o.contextCaptionEditor,onBlur:r=>{r.currentTarget.contains(r.relatedTarget)||X(!1)},children:[e.jsx("input",{autoFocus:!0,type:"text",className:o.attachmentCaptionInput,"aria-label":`Rename ${i}`,value:j.value,onChange:r=>$({...j,value:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),X(!0)),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),qt())}}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Save label",onClick:()=>X(!0),children:e.jsx(te,{size:12})})]}):g?e.jsx("span",{className:o.attachmentCaptionLabel,children:d||i}):e.jsx("button",{type:"button",className:o.attachmentCaptionLabel,"data-context-caption-index":n,title:"Edit label",onClick:r=>{K.current=r.currentTarget,Kt(n,d)},children:d||i})]},n)})})]}),Gt.length>0&&e.jsxs("section",{"aria-label":"Documents",children:[Xt.length>0&&e.jsx("div",{className:o.contextGroupLabel,children:"Documents"}),e.jsx("div",{className:o.documentAttachmentList,children:N.map((t,n)=>{const a=typeof t=="string"?t:t.path;if(J(a))return null;const s=typeof t=="string"?void 0:t.fsPath,d=typeof t=="string"?"":t.caption||"",i=ne(t),p=Xe(t),f=typeof t=="string"?"":ve(t),w=/^https?:\/\//i.test(a),m=u==="task"?typeof t=="string"?{path:t,taskId:C}:{...t,taskId:C}:t,b=Ee(m,s)&&!!(Ae(m,s)||Ie(m));return e.jsxs("div",{className:o.documentAttachmentItem,children:[e.jsxs("div",{className:o.documentAttachmentRow,children:[e.jsxs("div",{className:o.documentAttachmentMain,children:[e.jsx(Re,{label:p}),f&&e.jsx(De,{label:f,copied:ue===f,title:`Copy document reference ${f}`,ariaLabel:`Copy document reference ${f}`,className:o.documentAttachmentReference,onClick:()=>{de(f)}}),e.jsx("button",{type:"button",className:o.documentAttachmentLink,onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||wt(m,s)||window.open(a,"_blank")},title:i,"aria-label":`${d||i} ${p}`,children:e.jsx("span",{className:o.documentAttachmentName,children:d||i})})]}),(!g||!!s||!w)&&e.jsxs("div",{className:o.contextMenuControl,"data-context-actions-menu":"true",onKeyDown:h=>{h.key!=="Escape"||D!==n||(h.preventDefault(),h.stopPropagation(),x(null),Z.current?.focus())},children:[e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":`Actions for ${i}`,title:"More actions","aria-expanded":D===n,onClick:h=>{Z.current=h.currentTarget,x(D===n?null:n)},children:e.jsx(Vt,{size:14})}),D===n&&e.jsxs("div",{className:`${o.contextMenu} ${o.contextActionsMenu}`,role:"group","aria-label":`Actions for ${i}`,children:[e.jsxs("button",{ref:Lt,type:"button",onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||window.open(a,"_blank"),x(null)},children:[e.jsx(Me,{size:14})," Preview"]}),b&&e.jsxs("button",{type:"button",onClick:()=>{wt(m,s)||window.open(a,"_blank"),x(null)},children:[e.jsx(ze,{size:14})," Open"]}),!g&&e.jsxs("button",{type:"button",onClick:()=>{K.current=Z.current,Kt(n,d),x(null)},children:[e.jsx(Zt,{size:14})," Rename"]}),s&&e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(s),x(null),window.requestAnimationFrame(()=>Z.current?.focus())},children:[e.jsx(bt,{size:14})," Copy path"]}),!w&&e.jsxs("button",{type:"button",onClick:()=>{window.open(ee(a,d||i),"_blank"),x(null),window.requestAnimationFrame(()=>Z.current?.focus())},children:[e.jsx(Jt,{size:14})," Download"]}),!g&&e.jsxs("button",{type:"button",className:o.contextDestructiveMenuItem,onClick:()=>{kt(n),x(null)},children:[e.jsx(Qt,{size:14})," Delete"]})]})]})]}),j?.index===n&&e.jsxs("div",{className:o.contextCaptionEditor,onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||X(!1)},children:[e.jsx("input",{autoFocus:!0,type:"text",className:o.documentAttachmentCaptionInput,"aria-label":`Rename ${i}`,value:j.value,onChange:h=>$({...j,value:h.target.value}),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),h.stopPropagation(),X(!0)),h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),qt())}}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Save label",onClick:()=>X(!0),children:e.jsx(te,{size:12})})]})]},n)})})]})]})]})}export{Qe as ContextAttachmentManager};
3
+ `).map(i=>i.trim()).filter(i=>!!i&&!i.startsWith("#"));for(const i of d){if(/^file:\/\//i.test(i)){try{const p=new URL(i),f=decodeURIComponent(p.pathname||"").trim();f&&n.add(f)}catch{}continue}n.add(i)}return Array.from(n)},me=t=>{if(t.preventDefault(),t.stopPropagation(),U(!1),O(0),E(null),I(null),k(null),t.dataTransfer.files&&t.dataTransfer.files.length>0){Ot(t.dataTransfer.files);return}const n=he(t);if(n.length===0){E("Drop a file or URL.");return}const o=new Set(F.current);let s=0,d=0,i=0;n.forEach(f=>{const w=zt(f,!1,o);w==="duplicate"&&(s+=1),w==="added"&&(d+=1),w==="invalid"&&(i+=1)});const p=[];s>0&&p.push(`${s} duplicate link${s===1?"":"s"} skipped.`),i>0&&p.push(`${i} local path${i===1?"":"s"} skipped. Upload files to attach them, or drop an http(s) URL to link.`),k(p.length>0?p.join(" "):d>0?null:M),F.current=o},ge=t=>{t.preventDefault(),t.stopPropagation(),O(n=>n+1),U(!0)},xe=t=>{t.preventDefault(),t.stopPropagation(),O(n=>{const o=Math.max(0,n-1);return o===0&&U(!1),o})},we=t=>{t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="copy"},be=()=>{tt(!0),P(!1),I(null),x(null),R(t=>!t)},ye=()=>{tt(!0),R(!1),P(!0),I(null)},Bt=()=>{P(!1),I(null),window.requestAnimationFrame(()=>B.current?.focus())},_t=()=>{if(!it.trim()){I("Enter an http(s) URL to link.");return}const t=zt(it,!0);if(t==="invalid"){I("Only external http(s) URLs can be linked here. Upload files to attach them.");return}if(t==="duplicate"){k(`Link already exists in ${pe} context.`);return}k(null),P(!1),window.requestAnimationFrame(()=>B.current?.focus())},Kt=(t,n)=>{x(null),$({index:t,value:n,originalValue:n})},X=(t=!1)=>{if(!j)return;const n=j.index,o=j.value.trim();o!==j.originalValue&&se(j.index,o),$(null),t&&window.requestAnimationFrame(()=>{if(K.current?.isConnected){K.current.focus();return}rt.current?.querySelector(`[data-context-caption-index="${n}"]`)?.focus()})},qt=()=>{const t=j?.index;$(null),window.requestAnimationFrame(()=>{if(K.current?.isConnected){K.current.focus();return}t!==void 0&&rt.current?.querySelector(`[data-context-caption-index="${t}"]`)?.focus()})},Xt=N.filter(t=>{const n=typeof t=="string"?t:t.path;return J(n)}),Gt=N.filter(t=>{const n=typeof t=="string"?t:t.path;return!J(n)});return e.jsxs("div",{ref:rt,className:a.specialistSection,children:[e.jsx(ke,{label:"Context",count:N.length,showZeroCount:!0,expanded:dt,expandedTitle:"Hide context",collapsedTitle:"Show context",onToggle:()=>{const t=!dt;tt(t),t||(R(!1),P(!1),x(null),T(null),$(null),U(!1),O(0))},actions:g?void 0:e.jsxs("div",{ref:Tt,className:a.contextMenuControl,onKeyDown:t=>{t.key!=="Escape"||!S||(t.preventDefault(),t.stopPropagation(),R(!1),B.current?.focus())},children:[e.jsx("button",{ref:B,type:"button",className:"tf-control-icon","aria-label":"Add context",title:"Add context","aria-expanded":S,onClick:be,disabled:Et,children:Et?e.jsx(Zt,{size:14,className:a.spinner}):e.jsx(Le,{size:14})}),S&&e.jsxs("div",{className:`${a.contextMenu} ${a.contextAddMenu}`,role:"group","aria-label":"Add context",children:[e.jsxs("button",{ref:Nt,type:"button",onClick:()=>{R(!1),B.current?.focus(),L.current?.click()},children:[e.jsx(at,{size:14}),"Upload file"]}),e.jsxs("button",{type:"button",onClick:()=>{R(!1),B.current?.focus(),fe()},children:[e.jsx(bt,{size:14}),"Paste image"]}),e.jsxs("button",{type:"button",onClick:ye,children:[e.jsx(Se,{size:14}),"Add link"]})]})]})}),!g&&e.jsx("input",{ref:L,type:"file",accept:oe,multiple:!0,className:a.hiddenInput,onChange:t=>{Ot(t.target.files)}}),dt&&e.jsxs("div",{className:`${a.contextContent} ${Dt?a.contextContentDropActive:""}`,role:"region","aria-label":"Context attachments",onDragEnter:g?void 0:ge,onDragLeave:g?void 0:xe,onDragOver:g?void 0:we,onDrop:g?void 0:me,children:[Dt&&e.jsxs("div",{className:a.contextDropOverlay,"aria-hidden":"true",children:[e.jsx(at,{size:18}),"Drop files or URLs here"]}),le,Z&&e.jsxs("div",{className:a.contextLinkComposer,children:[e.jsx("input",{ref:St,type:"text",className:a.input,"aria-label":"External context URL","aria-invalid":!!Q,placeholder:"Add external URL (https://...)",value:it,onChange:t=>{ct(t.target.value),Q&&I(null),M&&k(null)},onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),_t()),t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),Bt())}}),e.jsx("button",{type:"button",className:"tf-button-ghost tf-button-compact",onClick:_t,children:"Add link"}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Cancel adding link",title:"Cancel",onClick:()=>{Bt()},children:e.jsx($e,{size:14})})]}),At&&e.jsx("div",{className:a.error,role:"alert",children:At}),M&&e.jsx("div",{className:a.contextNotice,role:"status",children:M}),Z&&Q&&e.jsx("div",{className:a.error,role:"alert",children:Q}),N.length===0&&!Z&&e.jsxs("div",{className:a.contextEmptyState,children:[e.jsx(at,{size:14}),e.jsx("span",{children:"Drop files here"})]}),Xt.length>0&&e.jsxs("section",{"aria-label":"Images",children:[Gt.length>0&&e.jsx("div",{className:a.contextGroupLabel,children:"Images"}),e.jsx("div",{className:a.attachmentGrid,children:N.map((t,n)=>{const o=typeof t=="string"?t:t.path;if(!J(o))return null;const s=typeof t=="string"?void 0:t.fsPath,d=typeof t=="string"?"":t.caption||"",i=ne(t),p=J(o),f=/^https?:\/\//i.test(o),w=u==="task"&&je(t),m=typeof t=="string"?"":String(t.assetId||"").trim(),b=!!(m&&m===re),h=u==="task"&&!!C&&!!m&&typeof t!="string"&&t.linkRole==="image"&&!!jt&&!g,G=!!(s||!f||!g);return e.jsxs("div",{className:a.attachmentCard,children:[e.jsxs("div",{className:a.attachmentPreviewContainer,children:[p?e.jsx("button",{type:"button",className:a.attachmentPreviewButton,"aria-label":`Open ${d||i}`,onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||u==="task"&&Wt(t,{taskId:C,taskReferenceLabel:v})||window.open(o,"_blank")},children:e.jsx("img",{src:o,alt:"",onError:r=>{r.currentTarget.style.display="none",r.currentTarget.parentElement?.parentElement?.classList.add(a.brokenImage)}})}):e.jsxs("button",{type:"button",className:a.contextFileLink,onClick:()=>{const r=u==="task"?typeof t=="string"?{path:t,taskId:C}:{...t,taskId:C}:t;wt(r,s)||window.open(o,"_blank")},title:"Open file",children:[e.jsx(at,{size:16}),e.jsx("span",{children:d||s||o.split("/").pop()||"Context file"})]}),e.jsxs("div",{className:a.brokenImagePlaceholder,children:[e.jsx(Pe,{size:16}),e.jsx("span",{children:"Preview unavailable"})]}),e.jsxs("div",{className:a.attachmentActions,children:[h&&e.jsx("button",{type:"button",className:`${a.attachmentActionBtn} ${b?a.attachmentActionBtnActive:""}`,"aria-pressed":b,"aria-label":b?"Remove from task card":"Show on task card",onClick:r=>{r.stopPropagation(),ut(m),E(null),Promise.resolve(jt?.(b?null:m)).then(()=>{k(b?"Removed image from task card.":"Image shown on task card.")}).catch(H=>{E(H instanceof Error?H.message:"Unable to update the task card image.")}).finally(()=>ut(null))},disabled:vt||It!==null,title:vt?"Attachment is still saving":b?"Remove from task card":"Show on task card",children:It===m?e.jsx(Zt,{size:12,className:a.spinner}):e.jsx(Fe,{size:12})}),w&&e.jsx("button",{type:"button",className:a.attachmentActionBtn,"aria-label":"Annotate image",onClick:r=>{r.stopPropagation(),Wt(t,{taskId:C,taskReferenceLabel:v})},title:"Annotate",children:e.jsx(Vt,{size:12})}),G&&e.jsx("button",{type:"button",className:a.attachmentActionBtn,"aria-label":`Actions for ${i}`,"aria-expanded":A===n,onClick:r=>{r.stopPropagation(),_.current=r.currentTarget,x(null),T(A===n?null:n)},title:"More actions",children:e.jsx(Yt,{size:12})}),A===n&&Ce.createPortal(e.jsxs("div",{ref:pt,className:`${a.contextMenu} ${a.attachmentImageActionsMenu}`,role:"group","aria-label":`Actions for ${i}`,style:ie,onClick:r=>r.stopPropagation(),onKeyDown:r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),T(null),_.current?.focus())},children:[s&&e.jsxs("button",{ref:et,type:"button",onClick:()=>{navigator.clipboard.writeText(s),T(null),window.requestAnimationFrame(()=>_.current?.focus())},children:[e.jsx(bt,{size:14})," Copy path"]}),!f&&e.jsxs("button",{ref:s?void 0:et,type:"button",onClick:()=>{window.open(ee(o,d||i),"_blank"),T(null),window.requestAnimationFrame(()=>_.current?.focus())},children:[e.jsx(Jt,{size:14})," Download"]}),!g&&e.jsxs("button",{ref:!s&&f?et:void 0,type:"button",className:a.contextDestructiveMenuItem,onClick:()=>{kt(n),T(null)},children:[e.jsx(Qt,{size:14})," Delete"]})]}),document.body)]})]}),j?.index===n?e.jsxs("div",{className:a.contextCaptionEditor,onBlur:r=>{r.currentTarget.contains(r.relatedTarget)||X(!1)},children:[e.jsx("input",{autoFocus:!0,type:"text",className:a.attachmentCaptionInput,"aria-label":`Rename ${i}`,value:j.value,onChange:r=>$({...j,value:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),X(!0)),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),qt())}}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Save label",onClick:()=>X(!0),children:e.jsx(te,{size:12})})]}):g?e.jsx("span",{className:a.attachmentCaptionLabel,children:d||i}):e.jsx("button",{type:"button",className:a.attachmentCaptionLabel,"data-context-caption-index":n,title:"Edit label",onClick:r=>{K.current=r.currentTarget,Kt(n,d)},children:d||i})]},n)})})]}),Gt.length>0&&e.jsxs("section",{"aria-label":"Documents",children:[Xt.length>0&&e.jsx("div",{className:a.contextGroupLabel,children:"Documents"}),e.jsx("div",{className:a.documentAttachmentList,children:N.map((t,n)=>{const o=typeof t=="string"?t:t.path;if(J(o))return null;const s=typeof t=="string"?void 0:t.fsPath,d=typeof t=="string"?"":t.caption||"",i=ne(t),p=Xe(t),f=typeof t=="string"?"":ve(t),w=/^https?:\/\//i.test(o),m=u==="task"?typeof t=="string"?{path:t,taskId:C}:{...t,taskId:C}:t,b=Ee(m,s)&&!!(Ae(m,s)||Ie(m));return e.jsxs("div",{className:a.documentAttachmentItem,children:[e.jsxs("div",{className:a.documentAttachmentRow,children:[e.jsxs("div",{className:a.documentAttachmentMain,children:[e.jsx(Re,{label:p}),f&&e.jsx(De,{label:f,copied:ue===f,title:`Copy document reference ${f}`,ariaLabel:`Copy document reference ${f}`,className:a.documentAttachmentReference,onClick:()=>{de(f)}}),e.jsx("button",{type:"button",className:a.documentAttachmentLink,onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||wt(m,s)||window.open(o,"_blank")},title:i,"aria-label":`${d||i} ${p}`,children:e.jsx("span",{className:a.documentAttachmentName,children:d||i})})]}),(!g||!!s||!w)&&e.jsxs("div",{className:a.contextMenuControl,"data-context-actions-menu":"true",onKeyDown:h=>{h.key!=="Escape"||D!==n||(h.preventDefault(),h.stopPropagation(),x(null),V.current?.focus())},children:[e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":`Actions for ${i}`,title:"More actions","aria-expanded":D===n,onClick:h=>{V.current=h.currentTarget,x(D===n?null:n)},children:e.jsx(Yt,{size:14})}),D===n&&e.jsxs("div",{className:`${a.contextMenu} ${a.contextActionsMenu}`,role:"group","aria-label":`Actions for ${i}`,children:[e.jsxs("button",{ref:Lt,type:"button",onClick:()=>{xt(t,{ownerType:u,ownerId:C||null,ownerReferenceLabel:v,workspaceId:q||null})||window.open(o,"_blank"),x(null)},children:[e.jsx(Me,{size:14})," Preview"]}),b&&e.jsxs("button",{type:"button",onClick:()=>{wt(m,s)||window.open(o,"_blank"),x(null)},children:[e.jsx(ze,{size:14})," Open"]}),!g&&e.jsxs("button",{type:"button",onClick:()=>{K.current=V.current,Kt(n,d),x(null)},children:[e.jsx(Vt,{size:14})," Rename"]}),s&&e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(s),x(null),window.requestAnimationFrame(()=>V.current?.focus())},children:[e.jsx(bt,{size:14})," Copy path"]}),!w&&e.jsxs("button",{type:"button",onClick:()=>{window.open(ee(o,d||i),"_blank"),x(null),window.requestAnimationFrame(()=>V.current?.focus())},children:[e.jsx(Jt,{size:14})," Download"]}),!g&&e.jsxs("button",{type:"button",className:a.contextDestructiveMenuItem,onClick:()=>{kt(n),x(null)},children:[e.jsx(Qt,{size:14})," Delete"]})]})]})]}),j?.index===n&&e.jsxs("div",{className:a.contextCaptionEditor,onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||X(!1)},children:[e.jsx("input",{autoFocus:!0,type:"text",className:a.documentAttachmentCaptionInput,"aria-label":`Rename ${i}`,value:j.value,onChange:h=>$({...j,value:h.target.value}),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),h.stopPropagation(),X(!0)),h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),qt())}}),e.jsx("button",{type:"button",className:"tf-control-icon tf-control-icon-compact","aria-label":"Save label",onClick:()=>X(!0),children:e.jsx(te,{size:12})})]})]},n)})})]})]})]})}export{Qe as ContextAttachmentManager};
@@ -1,4 +1,4 @@
1
- import{R as ue,j as e,r as s,s as Ds}from"./vendor-react-CKJs5o3c.js";import{i as vn,j as et,k as tt,m as Gn,f as U,t as me,o as Jn,p as Qn,q as $s,s as Ms,u as Bs,R as Ls,v as Lt,M as Fs,w as Yn,x as Xn,y as Zn}from"./index-BUplSsv_.js";import{A as Ps,a as zs}from"./AssetTraySortControl-Kf1pelSy.js";import{a0 as Os,ai as Hs,S as Ws,a_ as Vs,R as dn,aW as Us,a$ as Ks,g as qs,ak as un,N as Gs,au as mn,X as hn,b0 as es,s as Ft,y as ht,b1 as Js,b2 as Qs,a as Ys,x as Xs,b3 as Zs,b4 as er,b5 as tr,a7 as ut,b6 as nr,aZ as Bt,a6 as sr,a5 as rr,b7 as ts,a1 as ar,b8 as or,r as ns,t as ir,A as lr,O as cr,J as dr,K as ur,b9 as mr}from"./vendor-icons-BkFLXavV.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const hr="_index_1ya8h_1",fr="_header_1ya8h_8",pr="_title_1ya8h_23",vr="_search_1ya8h_35",wr="_searchIcon_1ya8h_41",gr="_searchInput_1ya8h_50",yr="_sortControlRow_1ya8h_67",br="_filters_1ya8h_74",_r="_filtersHeader_1ya8h_83",xr="_filtersTitle_1ya8h_90",Cr="_filterControls_1ya8h_102",kr="_list_1ya8h_114",Sr="_state_1ya8h_126",Rr="_stateError_1ya8h_134",jr="_item_1ya8h_141",Nr="_itemActive_1ya8h_163",Tr="_itemIcon_1ya8h_173",Er="_pinButton_1ya8h_183",Ar="_pinButtonActive_1ya8h_205",Ir="_itemBody_1ya8h_209",Dr="_itemTitle_1ya8h_217",$r="_itemTask_1ya8h_229",Mr="_itemBadge_1ya8h_240",Br="_itemMeta_1ya8h_253",Lr="_itemMetaDetails_1ya8h_264",Fr="_itemMetaReference_1ya8h_271",E={index:hr,header:fr,title:pr,search:vr,searchIcon:wr,searchInput:gr,sortControlRow:yr,filters:br,filtersHeader:_r,filtersTitle:xr,filterControls:Cr,list:kr,state:Sr,stateError:Rr,item:jr,itemActive:Nr,itemIcon:Tr,pinButton:Er,pinButtonActive:Ar,itemBody:Ir,itemTitle:Dr,itemTask:$r,itemBadge:Mr,itemMeta:Br,itemMetaDetails:Lr,itemMetaReference:Fr};function fn(n){let l=n;try{l=decodeURIComponent(n)}catch{l=n}return l.trim().replace(/\\/g,"/").replace(/^\/+/,"").replace(/^\.\//,"").replace(/^\.taskforce\//,"")}function Xe(n,l){const h=String(l||"").trim();if(!h)return n;const i=n.includes("?")?"&":"?";return`${n}${i}workspaceId=${encodeURIComponent(h)}`}function Pr(n,l){return!!(n===l||n.endsWith(`/${l}`)||l.endsWith(`/${n}`))}function ss(n){const l=fn(String(n||""));if(!l)return null;const h=l.match(/(^|\/)(asset-[a-f0-9]{32})(?=[^/]*$)/i);return h?.[2]?h[2].toLowerCase():null}function is(n){return Array.isArray(n.targets)?n.targets.length:typeof n.attachmentCount=="number"&&Number.isFinite(n.attachmentCount)?Math.max(0,Math.floor(n.attachmentCount)):n.taskId?1:0}function wn(n){return Array.isArray(n.targets)?n.targets.length>0?"attached":"unattached":n.attachmentState==="attached"||n.attachmentState==="unattached"?n.attachmentState:is(n)>0?"attached":"unattached"}function zr(n,l,h,i){const d=l.trim().toLowerCase();return n.filter(c=>{const b=[vn(c),c.title,c.originalFilename,c.referenceLabel,c.referenceNumber].filter(j=>j!=null).join(" ").toLowerCase(),k=d.length===0||b.includes(d),S=h.length===0||h.includes(c.docType),I=wn(c),T=i.length===0||i.includes(I);return k&&S&&T})}function Or({docType:n}){switch(n){case"implementation-plan":return e.jsx(Gs,{size:13});case"review":return e.jsx(un,{size:13});case"walkthrough":return e.jsx(qs,{size:13});default:return e.jsx(Ks,{size:13})}}function Hr(n){return n<1024?`${n}B`:n<1024*1024?`${(n/1024).toFixed(1)}KB`:`${(n/(1024*1024)).toFixed(1)}MB`}function Wr(n){if(!n)return"";const l=new Date(n),i=new Date().getTime()-l.getTime(),d=Math.floor(i/(1e3*60*60*24));return d===0?"Today":d===1?"Yesterday":d<7?`${d}d ago`:d<30?`${Math.floor(d/7)}w ago`:l.toLocaleDateString()}function Vr(n,l){n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),l())}function an(n,l=!1){return n==="initiative"?l?"initiatives":"initiative":n==="workstream"?l?"workstreams":"workstream":l?"tasks":"task"}function Ur(n,l){const h=n.targets;if(Array.isArray(h)){if(h.length===0)return null;const c=[...new Map(h.map(b=>[`${b.targetType}:${b.targetId}`,b])).values()];if(h.length!==c.length){if(c.length===1){const b=c[0],k=b.title||b.referenceLabel||an(b.targetType);return`${h.length} links to ${k}`}return`${h.length} links across ${c.length} items`}if(c.length===1){const b=c[0];return b.title||b.referenceLabel||`1 ${an(b.targetType)} linked`}return new Set(c.map(b=>b.targetType)).size===1?`${c.length} ${an(c[0].targetType,!0)} linked`:`${c.length} items linked`}const i=is(n),d=n.taskId?l.get(n.taskId):null;return i>1?`${i} tasks linked`:i===1?d?.title||"1 task linked":null}function Kr({documents:n,selectedDocId:l,loading:h,error:i,searchQuery:d,sortField:c,sortOrder:p,pinnedDocIds:b=[],onTogglePinnedDoc:k,taskById:S,onSearchChange:I,onSelect:T,onCloseTray:j,onSortFieldChange:J,onSortOrderChange:Q,hasActiveFilters:$,typeFilters:ie,attachmentFilters:z,onTypeFiltersChange:N,onAttachmentFiltersChange:H,listScrollTop:Y=0,onListScrollChange:X}){const L=ue.useRef(null),x=ue.useRef(null),R=ue.useRef(null),O=ue.useRef(X);ue.useEffect(()=>{O.current=X},[X]),ue.useEffect(()=>{const w=L.current;if(!w)return;const re=Math.max(0,Math.round(Y));Math.abs(w.scrollTop-re)<=1||(w.scrollTop=re)},[n.length,i,Y,h]),ue.useEffect(()=>()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[]);const W=ue.useCallback(()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null);const w=x.current;x.current=null,w!==null&&O.current?.(w)},[]),K=ue.useCallback(w=>{x.current=Math.max(0,Math.round(w)),R.current===null&&(R.current=window.setTimeout(W,200))},[W]),le=+(ie.length!==et.length)+ +(z.length!==tt.length),Ne=`${le} active document ${le===1?"filter":"filters"}`,we=()=>{N(et.map(w=>w.value)),H(tt.map(w=>w.value))};return e.jsxs("div",{className:E.index,children:[e.jsxs("div",{className:E.header,children:[e.jsxs("span",{className:E.title,children:[e.jsx(Os,{size:14}),"Documents"]}),j?e.jsx("button",{type:"button",className:"tf-control-icon",onClick:j,title:"Collapse document tray","aria-label":"Collapse document tray",children:e.jsx(Hs,{size:16})}):null]}),e.jsxs("div",{className:E.search,children:[e.jsx(Ws,{size:12,className:E.searchIcon}),e.jsx("input",{type:"text",placeholder:"Search documents…",value:d,onChange:w=>I(w.target.value),className:E.searchInput})]}),e.jsx("div",{className:E.sortControlRow,children:e.jsx(Ps,{field:c,order:p,onFieldChange:J,onOrderChange:Q})}),e.jsxs("section",{className:E.filters,"aria-label":"Document filters",children:[e.jsxs("div",{className:E.filtersHeader,children:[e.jsxs("span",{className:E.filtersTitle,children:[e.jsx(Vs,{size:12,"aria-hidden":"true"}),"Filters",le>0?e.jsx("span",{className:"tf-chip-count","aria-label":Ne,children:le}):null]}),e.jsx("button",{type:"button",className:"tf-control-icon",onClick:we,disabled:le===0,"aria-label":"Reset document filters",title:"Reset document filters",children:e.jsx(dn,{size:13,"aria-hidden":"true"})})]}),e.jsxs("div",{className:E.filterControls,children:[e.jsx(Gn,{label:"Attachment",options:tt,selected:z,onChange:w=>H(w),variant:"value",containerStyle:{minWidth:0}}),e.jsx(Gn,{label:"Type",options:et,selected:ie,onChange:w=>N(w),variant:"value",containerStyle:{minWidth:0}})]})]}),e.jsxs("div",{ref:L,className:`${E.list} tf-scrollbar tf-tray-scroll-viewport`,"data-testid":"doc-index-list",onScroll:w=>K(w.currentTarget.scrollTop),children:[h&&e.jsx("div",{className:E.state,children:"Loading documents…"}),!h&&i&&e.jsx("div",{className:E.stateError,children:i}),!h&&!i&&n.length===0&&e.jsx("div",{className:E.state,children:$?"No documents match your filters.":"No documents found. Documents added as task attachments will appear here."}),!h&&n.map(w=>{const re=w.assetId===l,A=b.includes(w.assetId),M=vn(w),q=wn(w),Ce=Ur(w,S);return e.jsxs("div",{role:"button",tabIndex:0,className:`${E.item} ${re?E.itemActive:""}`,onClick:()=>T(w),onKeyDown:fe=>Vr(fe,()=>T(w)),children:[e.jsx("div",{className:E.itemIcon,children:e.jsx(Or,{docType:w.docType})}),e.jsxs("div",{className:E.itemBody,children:[e.jsx("span",{className:E.itemTitle,title:M,children:M}),q==="unattached"&&e.jsx("span",{className:E.itemBadge,children:"Unattached"}),Ce&&e.jsx("span",{className:E.itemTask,title:Ce,children:Ce}),e.jsxs("span",{className:E.itemMeta,children:[e.jsxs("span",{className:E.itemMetaDetails,children:[Hr(w.sizeBytes),w.updatedAt&&e.jsxs(e.Fragment,{children:[" · ",Wr(w.updatedAt)]})]}),w.referenceLabel&&e.jsx("span",{className:E.itemMetaReference,children:w.referenceLabel})]})]}),k?e.jsx("button",{type:"button",className:`${E.pinButton} ${A?E.pinButtonActive:""}`.trim(),"aria-label":A?"Unpin document":"Pin document",title:A?`Unpin ${M}`:`Pin ${M}`,"aria-pressed":A,onClick:fe=>{fe.stopPropagation(),k(w.assetId)},onKeyDown:fe=>fe.stopPropagation(),children:e.jsx(Us,{size:14,fill:A?"currentColor":"none"})}):null]},w.assetId)})]})]})}const qr="_viewer_1glbl_1",Gr="_viewerMonochrome_1glbl_10",Jr="_metaDocumentName_1glbl_10",Qr="_viewerEditMode_1glbl_14",Yr="_meta_1glbl_10",Xr="_metaLeft_1glbl_30",Zr="_metaRenameRow_1glbl_49",ea="_typeBadge_1glbl_56",ta="_typeBadgeImplementationPlan_1glbl_71",na="_typeBadgeReview_1glbl_77",sa="_typeBadgeWalkthrough_1glbl_83",ra="_metaTaskName_1glbl_89",aa="_statusBadge_1glbl_98",oa="_metaDate_1glbl_113",ia="_metaSize_1glbl_114",la="_actions_1glbl_122",ca="_actionBtn_1glbl_129",da="_dangerBtn_1glbl_156",ua="_generateBtn_1glbl_167",ma="_editBtn_1glbl_178",ha="_saveBtn_1glbl_189",fa="_layoutToggle_1glbl_205",pa="_layoutBtn_1glbl_213",va="_layoutBtnActive_1glbl_229",wa="_saveStatus_1glbl_234",ga="_saveStatusSaved_1glbl_241",ya="_saveStatusError_1glbl_245",ba="_unsaved_1glbl_250",_a="_viewerContent_1glbl_256",xa="_viewerBody_1glbl_265",Ca="_viewerBodyFullWidth_1glbl_274",ka="_viewerMain_1glbl_278",Sa="_reviewRail_1glbl_286",Ra="_reviewSection_1glbl_292",ja="_reviewHeader_1glbl_299",Na="_reviewHeaderTop_1glbl_309",Ta="_reviewHeaderActions_1glbl_316",Ea="_reviewCloseButton_1glbl_322",Aa="_reviewEyebrow_1glbl_326",Ia="_reviewSubtitle_1glbl_334",Da="_reviewMetadataRow_1glbl_341",$a="_reviewMetadata_1glbl_341",Ma="_reviewSessionTitle_1glbl_355",Ba="_reviewEmptyHeading_1glbl_356",La="_reviewSessionDetails_1glbl_366",Fa="_reviewVersionDetails_1glbl_375",Pa="_reviewDraftNotice_1glbl_383",za="_reviewVersionNotice_1glbl_384",Oa="_reviewControls_1glbl_406",Ha="_reviewCreateButton_1glbl_415",Wa="_reviewResolutionAction_1glbl_416",Va="_reviewSelect_1glbl_431",Ua="_reviewTitleEditRow_1glbl_438",Ka="_reviewTitleInput_1glbl_444",qa="_reviewWorkspace_1glbl_451",Ga="_reviewThread_1glbl_459",Ja="_reviewNewCommentsBar_1glbl_469",Qa="_reviewEmptyState_1glbl_477",Ya="_reviewComment_1glbl_490",Xa="_reviewCommentThread_1glbl_511",Za="_reviewReplies_1glbl_517",eo="_reviewReply_1glbl_526",to="_reviewThreadActions_1glbl_531",no="_reviewReplyComposer_1glbl_540",so="_reviewReplyInput_1glbl_548",ro="_reviewReplyComposerActions_1glbl_553",ao="_reviewCommentHeader_1glbl_559",oo="_reviewCommentAvatar_1glbl_566",io="_reviewCommentAuthor_1glbl_578",lo="_reviewCommentTime_1glbl_588",co="_reviewCommentActions_1glbl_594",uo="_reviewCommentHeaderControls_1glbl_600",mo="_reviewCommentAction_1glbl_594",ho="_reviewCommentDeleteAction_1glbl_616",fo="_reviewAnchorLabel_1glbl_622",po="_reviewAnchorRow_1glbl_637",vo="_reviewAnchorMoved_1glbl_645",wo="_reviewAnchorUnresolved_1glbl_646",go="_reviewAnchorUnknown_1glbl_647",yo="_reviewCommentBody_1glbl_675",bo="_reviewCommentEditor_1glbl_691",_o="_reviewCommentEditInput_1glbl_698",xo="_reviewComposerArea_1glbl_703",Co="_reviewComposerRow_1glbl_713",ko="_reviewComposerInput_1glbl_719",So="_reviewSendButton_1glbl_728",Ro="_reviewComposerHint_1glbl_735",jo="_reviewResolvedComposer_1glbl_740",No="_reviewResolvedIcon_1glbl_751",To="_reviewResolvedCopy_1glbl_762",Eo="_reviewAnchorChip_1glbl_776",Ao="_reviewAnchorSnippet_1glbl_789",Io="_reviewAnchorClear_1glbl_799",Do="_viewerState_1glbl_814",$o="_viewerStateError_1glbl_821",Mo="_editorArea_1glbl_828",Bo="_editorPane_1glbl_834",Lo="_editorLayoutSplit_1glbl_842",Fo="_previewPane_1glbl_843",Po="_editorLayoutEditor_1glbl_847",zo="_editorLayoutPreview_1glbl_848",Oo="_editorPaneLabel_1glbl_852",Ho="_editorTextarea_1glbl_864",Wo="_markdownSurface_1glbl_906",Vo="_readerSurface_1glbl_911",Uo="_attachModalBody_1glbl_1040",Ko="_attachModalCopy_1glbl_1047",qo="_attachModalError_1glbl_1054",Go="_attachTaskList_1glbl_1067",Jo="_attachTaskRow_1glbl_1076",Qo="_attachTaskTitle_1glbl_1103",Yo="_attachTaskInfo_1glbl_1109",Xo="_attachTaskReference_1glbl_1117",Zo="_attachTaskMeta_1glbl_1124",ei="_attachEmptyState_1glbl_1131",a={viewer:qr,viewerMonochrome:Gr,metaDocumentName:Jr,viewerEditMode:Qr,meta:Yr,metaLeft:Xr,metaRenameRow:Zr,typeBadge:ea,typeBadgeImplementationPlan:ta,typeBadgeReview:na,typeBadgeWalkthrough:sa,metaTaskName:ra,statusBadge:aa,metaDate:oa,metaSize:ia,actions:la,actionBtn:ca,dangerBtn:da,generateBtn:ua,editBtn:ma,saveBtn:ha,layoutToggle:fa,layoutBtn:pa,layoutBtnActive:va,saveStatus:wa,saveStatusSaved:ga,saveStatusError:ya,unsaved:ba,viewerContent:_a,viewerBody:xa,viewerBodyFullWidth:Ca,viewerMain:ka,reviewRail:Sa,reviewSection:Ra,reviewHeader:ja,reviewHeaderTop:Na,reviewHeaderActions:Ta,reviewCloseButton:Ea,reviewEyebrow:Aa,reviewSubtitle:Ia,reviewMetadataRow:Da,reviewMetadata:$a,reviewSessionTitle:Ma,reviewEmptyHeading:Ba,reviewSessionDetails:La,reviewVersionDetails:Fa,reviewDraftNotice:Pa,reviewVersionNotice:za,reviewControls:Oa,reviewCreateButton:Ha,reviewResolutionAction:Wa,reviewSelect:Va,reviewTitleEditRow:Ua,reviewTitleInput:Ka,reviewWorkspace:qa,reviewThread:Ga,reviewNewCommentsBar:Ja,reviewEmptyState:Qa,reviewComment:Ya,reviewCommentThread:Xa,reviewReplies:Za,reviewReply:eo,reviewThreadActions:to,reviewReplyComposer:no,reviewReplyInput:so,reviewReplyComposerActions:ro,reviewCommentHeader:ao,reviewCommentAvatar:oo,reviewCommentAuthor:io,reviewCommentTime:lo,reviewCommentActions:co,reviewCommentHeaderControls:uo,reviewCommentAction:mo,reviewCommentDeleteAction:ho,reviewAnchorLabel:fo,reviewAnchorRow:po,reviewAnchorMoved:vo,reviewAnchorUnresolved:wo,reviewAnchorUnknown:go,reviewCommentBody:yo,reviewCommentEditor:bo,reviewCommentEditInput:_o,reviewComposerArea:xo,reviewComposerRow:Co,reviewComposerInput:ko,reviewSendButton:So,reviewComposerHint:Ro,reviewResolvedComposer:jo,reviewResolvedIcon:No,reviewResolvedCopy:To,reviewAnchorChip:Eo,reviewAnchorSnippet:Ao,reviewAnchorClear:Io,viewerState:Do,viewerStateError:$o,editorArea:Mo,editorPane:Bo,editorLayoutSplit:Lo,previewPane:Fo,editorLayoutEditor:Po,editorLayoutPreview:zo,editorPaneLabel:Oo,editorTextarea:Ho,markdownSurface:Wo,readerSurface:Vo,attachModalBody:Uo,attachModalCopy:Ko,attachModalError:qo,attachTaskList:Go,attachTaskRow:Jo,attachTaskTitle:Qo,attachTaskInfo:Yo,attachTaskReference:Xo,attachTaskMeta:Zo,attachEmptyState:ei},ti="_overlay_1unik_1",ni="_modal_1unik_12",si="_header_1unik_16",ri="_title_1unik_20",ai="_docName_1unik_24",oi="_body_1unik_34",ii="_state_1unik_41",li="_stateError_1unik_52",ci="_stateDone_1unik_63",di="_toolbar_1unik_84",ui="_toolbarCount_1unik_95",mi="_toolbarActions_1unik_100",hi="_tree_1unik_105",fi="_taskRow_1unik_113",pi="_taskRowDimmed_1unik_126",vi="_taskCheck_1unik_130",wi="_taskExpandBtn_1unik_139",gi="_taskExpandSpacer_1unik_155",yi="_taskTitle_1unik_160",bi="_taskBadge_1unik_169",_i="_footer_1unik_179",D={overlay:ti,modal:ni,header:si,title:ri,docName:ai,body:oi,state:ii,stateError:li,stateDone:ci,toolbar:di,toolbarCount:ui,toolbarActions:mi,tree:hi,taskRow:fi,taskRowDimmed:pi,taskCheck:vi,taskExpandBtn:wi,taskExpandSpacer:gi,taskTitle:yi,taskBadge:bi,footer:_i},xi={1:"Low",2:"Medium",3:"High"};function ft(n,l){return n.map(h=>({...h,selected:l,children:ft(h.children,l)}))}function ls(n,l,h){return n.map(i=>i.idempotencyKey===l?{...i,selected:h,children:ft(i.children,h)}:{...i,children:ls(i.children,l,h)})}function pn(n){let l=0;for(const h of n)h.selected&&l++,l+=pn(h.children);return l}function cs({node:n,depth:l,onToggle:h}){const[i,d]=s.useState(!0),c=n.children.length>0,p=l*20;return e.jsxs("div",{children:[e.jsxs("div",{className:`${D.taskRow} ${n.selected?"":D.taskRowDimmed}`,style:{paddingLeft:`${12+p}px`},children:[e.jsx("button",{className:D.taskCheck,onClick:()=>h(n.idempotencyKey,!n.selected),title:n.selected?"Deselect":"Select",children:n.selected?e.jsx(Js,{size:14,style:{color:"var(--brand-primary-strong)"}}):e.jsx(Qs,{size:14,style:{color:"var(--text-muted)"}})}),c?e.jsx("button",{className:D.taskExpandBtn,onClick:()=>d(b=>!b),children:i?e.jsx(Ys,{size:12}):e.jsx(Xs,{size:12})}):e.jsx("span",{className:D.taskExpandSpacer}),e.jsx("span",{className:D.taskTitle,title:n.description||void 0,children:n.title}),e.jsx("span",{className:D.taskBadge,style:{color:Jn(n.type),borderColor:Jn(n.type)},children:n.type}),e.jsx("span",{className:D.taskBadge,style:{color:Qn(n.priority),borderColor:Qn(n.priority)},children:xi[n.priority]})]}),c&&i&&e.jsx("div",{children:n.children.map(b=>e.jsx(cs,{node:b,depth:l+1,onToggle:h},b.idempotencyKey))})]})}function Ci({content:n,docTitle:l,apiBaseUrl:h="",onClose:i,onGenerated:d}){const[c,p]=s.useState("preview"),[b,k]=s.useState(null),[S,I]=s.useState([]),[T,j]=s.useState(!0),[J,Q]=s.useState(0),[$,ie]=s.useState(null),z=s.useRef(null);s.useEffect(()=>{let x=!1;return j(!0),k(null),U("/api/taskforce/documents/generate-tasks/preview",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})},h).then(R=>R.json()).then(R=>{if(!x){if(R.error)throw new Error(R.error);I(R.tasks||[]),p("preview")}}).catch(R=>{x||(k(R?.message||"Failed to parse plan"),p("error"))}).finally(()=>{x||j(!1)}),()=>{x=!0}},[n,h]);const N=s.useCallback((x,R)=>{I(O=>ls(O,x,R))},[]),H=()=>I(x=>ft(x,!0)),Y=()=>I(x=>ft(x,!1)),X=pn(S),L=async()=>{p("generating"),ie(null);try{const x=JSON.stringify({tasks:S});z.current?.requestBody!==x&&(z.current={requestBody:x,operationId:$s()});const O={method:"POST",credentials:"include",headers:{"Content-Type":"application/json","x-taskforce-operation-id":z.current.operationId},body:x};let W;try{W=await U("/api/taskforce/documents/generate-tasks/commit",O,h)}catch{W=await U("/api/taskforce/documents/generate-tasks/commit",O,h)}const K=await W.json().catch(()=>({}));if(!W.ok)throw new Error(K.error||`Generation failed (${W.status})`);z.current=null,Q(K.created??0),p("done"),d(K.created??0)}catch(x){ie(x?.message||"Generation failed"),p("error")}};return e.jsx("div",{className:D.overlay,onClick:x=>{x.target===x.currentTarget&&i()},children:e.jsxs("div",{className:`tf-surface-modal tf-modal-shell ${D.modal}`,children:[e.jsxs("div",{className:`tf-modal-header ${D.header}`,children:[e.jsxs("div",{className:`tf-modal-title ${D.title}`,children:[e.jsx(mn,{size:16,style:{color:"var(--brand-primary-strong)"}}),"Generate Tasks from Plan"]}),e.jsx("span",{className:D.docName,children:l}),e.jsx("button",{className:"tf-control-icon",onClick:i,title:"Close",children:e.jsx(hn,{size:16})})]}),e.jsxs("div",{className:D.body,children:[T&&e.jsxs("div",{className:D.state,children:[e.jsx(es,{size:20,className:me.docSpinning}),"Parsing plan…"]}),!T&&c==="error"&&e.jsxs("div",{className:D.stateError,children:[e.jsx(Ft,{size:16}),b||$||"An error occurred"]}),!T&&c==="done"&&e.jsxs("div",{className:D.stateDone,children:[e.jsx(ht,{size:24,style:{color:"var(--status-success)"}}),e.jsxs("strong",{children:[J," task",J!==1?"s":""," created"]}),e.jsx("p",{children:"Tasks are now in your board. Switch to the Kanban or Hierarchy view to see them."})]}),!T&&(c==="preview"||c==="confirm"||c==="generating")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:D.toolbar,children:[e.jsxs("span",{className:D.toolbarCount,children:[X," of ",pn(ft(S,!0))," tasks selected"]}),e.jsxs("div",{className:D.toolbarActions,children:[e.jsx("button",{className:"tf-control-icon",onClick:H,children:"Select all"}),e.jsx("button",{className:"tf-control-icon",onClick:Y,children:"Deselect all"})]})]}),S.length===0?e.jsx("div",{className:D.state,children:"No tasks could be parsed from this document. Make sure the document uses ## H2 headings for phases and bullet points for tasks."}):e.jsx("div",{className:`${D.tree} tf-scrollbar`,children:S.map(x=>e.jsx(cs,{node:x,depth:0,onToggle:N},x.idempotencyKey))})]})]}),!T&&c!=="done"&&c!=="error"&&e.jsxs("div",{className:D.footer,children:[e.jsx("button",{className:"tf-button-secondary",onClick:i,children:"Cancel"}),e.jsx("button",{className:"tf-button-primary",onClick:L,disabled:X===0||c==="generating",children:c==="generating"?e.jsxs(e.Fragment,{children:[e.jsx(es,{size:13,className:me.docSpinning})," Generating…"]}):e.jsxs(e.Fragment,{children:[e.jsx(mn,{size:13})," Generate ",X," task",X!==1?"s":""]})})]}),!T&&c==="done"&&e.jsx("div",{className:D.footer,children:e.jsx("button",{className:"tf-button-primary",onClick:i,children:"Done"})})]})})}const ki={"implementation-plan":"Implementation Plan",review:"Review",walkthrough:"Walkthrough",planning:"Planning",other:"Document"},Si={"implementation-plan":a.typeBadgeImplementationPlan,review:a.typeBadgeReview,walkthrough:a.typeBadgeWalkthrough,planning:void 0,other:void 0},Ri={editor:a.editorLayoutEditor,split:a.editorLayoutSplit,preview:a.editorLayoutPreview},ji=1500,Ni=80,on="Document refresh failed; showing the previous saved version.",ln="A newer saved version is available. Cancel editing to reload it before saving.",cn="__new-review__",Ti=`
1
+ import{R as ue,j as e,r as s,s as Ds}from"./vendor-react-CKJs5o3c.js";import{j as vn,k as et,m as tt,o as Gn,f as U,t as me,p as Jn,q as Qn,s as $s,u as Ms,v as Bs,R as Ls,w as Lt,M as Fs,x as Yn,y as Xn,z as Zn}from"./index-I5zhdtgt.js";import{A as Ps,a as zs}from"./AssetTraySortControl-C8Rztyal.js";import{a0 as Os,ak as Hs,S as Ws,a_ as Vs,R as dn,aW as Us,a$ as Ks,g as qs,a9 as un,N as Gs,au as mn,X as hn,b0 as es,s as Ft,y as ht,b1 as Js,b2 as Qs,a as Ys,x as Xs,b3 as Zs,b4 as er,b5 as tr,a7 as ut,b6 as nr,aZ as Bt,a6 as sr,a5 as rr,b7 as ts,a1 as ar,b8 as or,r as ns,t as ir,A as lr,O as cr,J as dr,K as ur,b9 as mr}from"./vendor-icons-D9Lpw-j4.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const hr="_index_1ya8h_1",fr="_header_1ya8h_8",pr="_title_1ya8h_23",vr="_search_1ya8h_35",wr="_searchIcon_1ya8h_41",gr="_searchInput_1ya8h_50",yr="_sortControlRow_1ya8h_67",br="_filters_1ya8h_74",_r="_filtersHeader_1ya8h_83",xr="_filtersTitle_1ya8h_90",Cr="_filterControls_1ya8h_102",kr="_list_1ya8h_114",Sr="_state_1ya8h_126",Rr="_stateError_1ya8h_134",jr="_item_1ya8h_141",Nr="_itemActive_1ya8h_163",Tr="_itemIcon_1ya8h_173",Er="_pinButton_1ya8h_183",Ar="_pinButtonActive_1ya8h_205",Ir="_itemBody_1ya8h_209",Dr="_itemTitle_1ya8h_217",$r="_itemTask_1ya8h_229",Mr="_itemBadge_1ya8h_240",Br="_itemMeta_1ya8h_253",Lr="_itemMetaDetails_1ya8h_264",Fr="_itemMetaReference_1ya8h_271",E={index:hr,header:fr,title:pr,search:vr,searchIcon:wr,searchInput:gr,sortControlRow:yr,filters:br,filtersHeader:_r,filtersTitle:xr,filterControls:Cr,list:kr,state:Sr,stateError:Rr,item:jr,itemActive:Nr,itemIcon:Tr,pinButton:Er,pinButtonActive:Ar,itemBody:Ir,itemTitle:Dr,itemTask:$r,itemBadge:Mr,itemMeta:Br,itemMetaDetails:Lr,itemMetaReference:Fr};function fn(n){let l=n;try{l=decodeURIComponent(n)}catch{l=n}return l.trim().replace(/\\/g,"/").replace(/^\/+/,"").replace(/^\.\//,"").replace(/^\.taskforce\//,"")}function Xe(n,l){const h=String(l||"").trim();if(!h)return n;const i=n.includes("?")?"&":"?";return`${n}${i}workspaceId=${encodeURIComponent(h)}`}function Pr(n,l){return!!(n===l||n.endsWith(`/${l}`)||l.endsWith(`/${n}`))}function ss(n){const l=fn(String(n||""));if(!l)return null;const h=l.match(/(^|\/)(asset-[a-f0-9]{32})(?=[^/]*$)/i);return h?.[2]?h[2].toLowerCase():null}function is(n){return Array.isArray(n.targets)?n.targets.length:typeof n.attachmentCount=="number"&&Number.isFinite(n.attachmentCount)?Math.max(0,Math.floor(n.attachmentCount)):n.taskId?1:0}function wn(n){return Array.isArray(n.targets)?n.targets.length>0?"attached":"unattached":n.attachmentState==="attached"||n.attachmentState==="unattached"?n.attachmentState:is(n)>0?"attached":"unattached"}function zr(n,l,h,i){const d=l.trim().toLowerCase();return n.filter(c=>{const b=[vn(c),c.title,c.originalFilename,c.referenceLabel,c.referenceNumber].filter(j=>j!=null).join(" ").toLowerCase(),k=d.length===0||b.includes(d),S=h.length===0||h.includes(c.docType),I=wn(c),T=i.length===0||i.includes(I);return k&&S&&T})}function Or({docType:n}){switch(n){case"implementation-plan":return e.jsx(Gs,{size:13});case"review":return e.jsx(un,{size:13});case"walkthrough":return e.jsx(qs,{size:13});default:return e.jsx(Ks,{size:13})}}function Hr(n){return n<1024?`${n}B`:n<1024*1024?`${(n/1024).toFixed(1)}KB`:`${(n/(1024*1024)).toFixed(1)}MB`}function Wr(n){if(!n)return"";const l=new Date(n),i=new Date().getTime()-l.getTime(),d=Math.floor(i/(1e3*60*60*24));return d===0?"Today":d===1?"Yesterday":d<7?`${d}d ago`:d<30?`${Math.floor(d/7)}w ago`:l.toLocaleDateString()}function Vr(n,l){n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),l())}function an(n,l=!1){return n==="initiative"?l?"initiatives":"initiative":n==="workstream"?l?"workstreams":"workstream":l?"tasks":"task"}function Ur(n,l){const h=n.targets;if(Array.isArray(h)){if(h.length===0)return null;const c=[...new Map(h.map(b=>[`${b.targetType}:${b.targetId}`,b])).values()];if(h.length!==c.length){if(c.length===1){const b=c[0],k=b.title||b.referenceLabel||an(b.targetType);return`${h.length} links to ${k}`}return`${h.length} links across ${c.length} items`}if(c.length===1){const b=c[0];return b.title||b.referenceLabel||`1 ${an(b.targetType)} linked`}return new Set(c.map(b=>b.targetType)).size===1?`${c.length} ${an(c[0].targetType,!0)} linked`:`${c.length} items linked`}const i=is(n),d=n.taskId?l.get(n.taskId):null;return i>1?`${i} tasks linked`:i===1?d?.title||"1 task linked":null}function Kr({documents:n,selectedDocId:l,loading:h,error:i,searchQuery:d,sortField:c,sortOrder:p,pinnedDocIds:b=[],onTogglePinnedDoc:k,taskById:S,onSearchChange:I,onSelect:T,onCloseTray:j,onSortFieldChange:J,onSortOrderChange:Q,hasActiveFilters:$,typeFilters:ie,attachmentFilters:z,onTypeFiltersChange:N,onAttachmentFiltersChange:H,listScrollTop:Y=0,onListScrollChange:X}){const L=ue.useRef(null),x=ue.useRef(null),R=ue.useRef(null),O=ue.useRef(X);ue.useEffect(()=>{O.current=X},[X]),ue.useEffect(()=>{const w=L.current;if(!w)return;const re=Math.max(0,Math.round(Y));Math.abs(w.scrollTop-re)<=1||(w.scrollTop=re)},[n.length,i,Y,h]),ue.useEffect(()=>()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[]);const W=ue.useCallback(()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null);const w=x.current;x.current=null,w!==null&&O.current?.(w)},[]),K=ue.useCallback(w=>{x.current=Math.max(0,Math.round(w)),R.current===null&&(R.current=window.setTimeout(W,200))},[W]),le=+(ie.length!==et.length)+ +(z.length!==tt.length),Ne=`${le} active document ${le===1?"filter":"filters"}`,we=()=>{N(et.map(w=>w.value)),H(tt.map(w=>w.value))};return e.jsxs("div",{className:E.index,children:[e.jsxs("div",{className:E.header,children:[e.jsxs("span",{className:E.title,children:[e.jsx(Os,{size:14}),"Documents"]}),j?e.jsx("button",{type:"button",className:"tf-control-icon",onClick:j,title:"Collapse document tray","aria-label":"Collapse document tray",children:e.jsx(Hs,{size:16})}):null]}),e.jsxs("div",{className:E.search,children:[e.jsx(Ws,{size:12,className:E.searchIcon}),e.jsx("input",{type:"text",placeholder:"Search documents…",value:d,onChange:w=>I(w.target.value),className:E.searchInput})]}),e.jsx("div",{className:E.sortControlRow,children:e.jsx(Ps,{field:c,order:p,onFieldChange:J,onOrderChange:Q})}),e.jsxs("section",{className:E.filters,"aria-label":"Document filters",children:[e.jsxs("div",{className:E.filtersHeader,children:[e.jsxs("span",{className:E.filtersTitle,children:[e.jsx(Vs,{size:12,"aria-hidden":"true"}),"Filters",le>0?e.jsx("span",{className:"tf-chip-count","aria-label":Ne,children:le}):null]}),e.jsx("button",{type:"button",className:"tf-control-icon",onClick:we,disabled:le===0,"aria-label":"Reset document filters",title:"Reset document filters",children:e.jsx(dn,{size:13,"aria-hidden":"true"})})]}),e.jsxs("div",{className:E.filterControls,children:[e.jsx(Gn,{label:"Attachment",options:tt,selected:z,onChange:w=>H(w),variant:"value",containerStyle:{minWidth:0}}),e.jsx(Gn,{label:"Type",options:et,selected:ie,onChange:w=>N(w),variant:"value",containerStyle:{minWidth:0}})]})]}),e.jsxs("div",{ref:L,className:`${E.list} tf-scrollbar tf-tray-scroll-viewport`,"data-testid":"doc-index-list",onScroll:w=>K(w.currentTarget.scrollTop),children:[h&&e.jsx("div",{className:E.state,children:"Loading documents…"}),!h&&i&&e.jsx("div",{className:E.stateError,children:i}),!h&&!i&&n.length===0&&e.jsx("div",{className:E.state,children:$?"No documents match your filters.":"No documents found. Documents added as task attachments will appear here."}),!h&&n.map(w=>{const re=w.assetId===l,A=b.includes(w.assetId),M=vn(w),q=wn(w),Ce=Ur(w,S);return e.jsxs("div",{role:"button",tabIndex:0,className:`${E.item} ${re?E.itemActive:""}`,onClick:()=>T(w),onKeyDown:fe=>Vr(fe,()=>T(w)),children:[e.jsx("div",{className:E.itemIcon,children:e.jsx(Or,{docType:w.docType})}),e.jsxs("div",{className:E.itemBody,children:[e.jsx("span",{className:E.itemTitle,title:M,children:M}),q==="unattached"&&e.jsx("span",{className:E.itemBadge,children:"Unattached"}),Ce&&e.jsx("span",{className:E.itemTask,title:Ce,children:Ce}),e.jsxs("span",{className:E.itemMeta,children:[e.jsxs("span",{className:E.itemMetaDetails,children:[Hr(w.sizeBytes),w.updatedAt&&e.jsxs(e.Fragment,{children:[" · ",Wr(w.updatedAt)]})]}),w.referenceLabel&&e.jsx("span",{className:E.itemMetaReference,children:w.referenceLabel})]})]}),k?e.jsx("button",{type:"button",className:`${E.pinButton} ${A?E.pinButtonActive:""}`.trim(),"aria-label":A?"Unpin document":"Pin document",title:A?`Unpin ${M}`:`Pin ${M}`,"aria-pressed":A,onClick:fe=>{fe.stopPropagation(),k(w.assetId)},onKeyDown:fe=>fe.stopPropagation(),children:e.jsx(Us,{size:14,fill:A?"currentColor":"none"})}):null]},w.assetId)})]})]})}const qr="_viewer_1glbl_1",Gr="_viewerMonochrome_1glbl_10",Jr="_metaDocumentName_1glbl_10",Qr="_viewerEditMode_1glbl_14",Yr="_meta_1glbl_10",Xr="_metaLeft_1glbl_30",Zr="_metaRenameRow_1glbl_49",ea="_typeBadge_1glbl_56",ta="_typeBadgeImplementationPlan_1glbl_71",na="_typeBadgeReview_1glbl_77",sa="_typeBadgeWalkthrough_1glbl_83",ra="_metaTaskName_1glbl_89",aa="_statusBadge_1glbl_98",oa="_metaDate_1glbl_113",ia="_metaSize_1glbl_114",la="_actions_1glbl_122",ca="_actionBtn_1glbl_129",da="_dangerBtn_1glbl_156",ua="_generateBtn_1glbl_167",ma="_editBtn_1glbl_178",ha="_saveBtn_1glbl_189",fa="_layoutToggle_1glbl_205",pa="_layoutBtn_1glbl_213",va="_layoutBtnActive_1glbl_229",wa="_saveStatus_1glbl_234",ga="_saveStatusSaved_1glbl_241",ya="_saveStatusError_1glbl_245",ba="_unsaved_1glbl_250",_a="_viewerContent_1glbl_256",xa="_viewerBody_1glbl_265",Ca="_viewerBodyFullWidth_1glbl_274",ka="_viewerMain_1glbl_278",Sa="_reviewRail_1glbl_286",Ra="_reviewSection_1glbl_292",ja="_reviewHeader_1glbl_299",Na="_reviewHeaderTop_1glbl_309",Ta="_reviewHeaderActions_1glbl_316",Ea="_reviewCloseButton_1glbl_322",Aa="_reviewEyebrow_1glbl_326",Ia="_reviewSubtitle_1glbl_334",Da="_reviewMetadataRow_1glbl_341",$a="_reviewMetadata_1glbl_341",Ma="_reviewSessionTitle_1glbl_355",Ba="_reviewEmptyHeading_1glbl_356",La="_reviewSessionDetails_1glbl_366",Fa="_reviewVersionDetails_1glbl_375",Pa="_reviewDraftNotice_1glbl_383",za="_reviewVersionNotice_1glbl_384",Oa="_reviewControls_1glbl_406",Ha="_reviewCreateButton_1glbl_415",Wa="_reviewResolutionAction_1glbl_416",Va="_reviewSelect_1glbl_431",Ua="_reviewTitleEditRow_1glbl_438",Ka="_reviewTitleInput_1glbl_444",qa="_reviewWorkspace_1glbl_451",Ga="_reviewThread_1glbl_459",Ja="_reviewNewCommentsBar_1glbl_469",Qa="_reviewEmptyState_1glbl_477",Ya="_reviewComment_1glbl_490",Xa="_reviewCommentThread_1glbl_511",Za="_reviewReplies_1glbl_517",eo="_reviewReply_1glbl_526",to="_reviewThreadActions_1glbl_531",no="_reviewReplyComposer_1glbl_540",so="_reviewReplyInput_1glbl_548",ro="_reviewReplyComposerActions_1glbl_553",ao="_reviewCommentHeader_1glbl_559",oo="_reviewCommentAvatar_1glbl_566",io="_reviewCommentAuthor_1glbl_578",lo="_reviewCommentTime_1glbl_588",co="_reviewCommentActions_1glbl_594",uo="_reviewCommentHeaderControls_1glbl_600",mo="_reviewCommentAction_1glbl_594",ho="_reviewCommentDeleteAction_1glbl_616",fo="_reviewAnchorLabel_1glbl_622",po="_reviewAnchorRow_1glbl_637",vo="_reviewAnchorMoved_1glbl_645",wo="_reviewAnchorUnresolved_1glbl_646",go="_reviewAnchorUnknown_1glbl_647",yo="_reviewCommentBody_1glbl_675",bo="_reviewCommentEditor_1glbl_691",_o="_reviewCommentEditInput_1glbl_698",xo="_reviewComposerArea_1glbl_703",Co="_reviewComposerRow_1glbl_713",ko="_reviewComposerInput_1glbl_719",So="_reviewSendButton_1glbl_728",Ro="_reviewComposerHint_1glbl_735",jo="_reviewResolvedComposer_1glbl_740",No="_reviewResolvedIcon_1glbl_751",To="_reviewResolvedCopy_1glbl_762",Eo="_reviewAnchorChip_1glbl_776",Ao="_reviewAnchorSnippet_1glbl_789",Io="_reviewAnchorClear_1glbl_799",Do="_viewerState_1glbl_814",$o="_viewerStateError_1glbl_821",Mo="_editorArea_1glbl_828",Bo="_editorPane_1glbl_834",Lo="_editorLayoutSplit_1glbl_842",Fo="_previewPane_1glbl_843",Po="_editorLayoutEditor_1glbl_847",zo="_editorLayoutPreview_1glbl_848",Oo="_editorPaneLabel_1glbl_852",Ho="_editorTextarea_1glbl_864",Wo="_markdownSurface_1glbl_906",Vo="_readerSurface_1glbl_911",Uo="_attachModalBody_1glbl_1040",Ko="_attachModalCopy_1glbl_1047",qo="_attachModalError_1glbl_1054",Go="_attachTaskList_1glbl_1067",Jo="_attachTaskRow_1glbl_1076",Qo="_attachTaskTitle_1glbl_1103",Yo="_attachTaskInfo_1glbl_1109",Xo="_attachTaskReference_1glbl_1117",Zo="_attachTaskMeta_1glbl_1124",ei="_attachEmptyState_1glbl_1131",a={viewer:qr,viewerMonochrome:Gr,metaDocumentName:Jr,viewerEditMode:Qr,meta:Yr,metaLeft:Xr,metaRenameRow:Zr,typeBadge:ea,typeBadgeImplementationPlan:ta,typeBadgeReview:na,typeBadgeWalkthrough:sa,metaTaskName:ra,statusBadge:aa,metaDate:oa,metaSize:ia,actions:la,actionBtn:ca,dangerBtn:da,generateBtn:ua,editBtn:ma,saveBtn:ha,layoutToggle:fa,layoutBtn:pa,layoutBtnActive:va,saveStatus:wa,saveStatusSaved:ga,saveStatusError:ya,unsaved:ba,viewerContent:_a,viewerBody:xa,viewerBodyFullWidth:Ca,viewerMain:ka,reviewRail:Sa,reviewSection:Ra,reviewHeader:ja,reviewHeaderTop:Na,reviewHeaderActions:Ta,reviewCloseButton:Ea,reviewEyebrow:Aa,reviewSubtitle:Ia,reviewMetadataRow:Da,reviewMetadata:$a,reviewSessionTitle:Ma,reviewEmptyHeading:Ba,reviewSessionDetails:La,reviewVersionDetails:Fa,reviewDraftNotice:Pa,reviewVersionNotice:za,reviewControls:Oa,reviewCreateButton:Ha,reviewResolutionAction:Wa,reviewSelect:Va,reviewTitleEditRow:Ua,reviewTitleInput:Ka,reviewWorkspace:qa,reviewThread:Ga,reviewNewCommentsBar:Ja,reviewEmptyState:Qa,reviewComment:Ya,reviewCommentThread:Xa,reviewReplies:Za,reviewReply:eo,reviewThreadActions:to,reviewReplyComposer:no,reviewReplyInput:so,reviewReplyComposerActions:ro,reviewCommentHeader:ao,reviewCommentAvatar:oo,reviewCommentAuthor:io,reviewCommentTime:lo,reviewCommentActions:co,reviewCommentHeaderControls:uo,reviewCommentAction:mo,reviewCommentDeleteAction:ho,reviewAnchorLabel:fo,reviewAnchorRow:po,reviewAnchorMoved:vo,reviewAnchorUnresolved:wo,reviewAnchorUnknown:go,reviewCommentBody:yo,reviewCommentEditor:bo,reviewCommentEditInput:_o,reviewComposerArea:xo,reviewComposerRow:Co,reviewComposerInput:ko,reviewSendButton:So,reviewComposerHint:Ro,reviewResolvedComposer:jo,reviewResolvedIcon:No,reviewResolvedCopy:To,reviewAnchorChip:Eo,reviewAnchorSnippet:Ao,reviewAnchorClear:Io,viewerState:Do,viewerStateError:$o,editorArea:Mo,editorPane:Bo,editorLayoutSplit:Lo,previewPane:Fo,editorLayoutEditor:Po,editorLayoutPreview:zo,editorPaneLabel:Oo,editorTextarea:Ho,markdownSurface:Wo,readerSurface:Vo,attachModalBody:Uo,attachModalCopy:Ko,attachModalError:qo,attachTaskList:Go,attachTaskRow:Jo,attachTaskTitle:Qo,attachTaskInfo:Yo,attachTaskReference:Xo,attachTaskMeta:Zo,attachEmptyState:ei},ti="_overlay_1unik_1",ni="_modal_1unik_12",si="_header_1unik_16",ri="_title_1unik_20",ai="_docName_1unik_24",oi="_body_1unik_34",ii="_state_1unik_41",li="_stateError_1unik_52",ci="_stateDone_1unik_63",di="_toolbar_1unik_84",ui="_toolbarCount_1unik_95",mi="_toolbarActions_1unik_100",hi="_tree_1unik_105",fi="_taskRow_1unik_113",pi="_taskRowDimmed_1unik_126",vi="_taskCheck_1unik_130",wi="_taskExpandBtn_1unik_139",gi="_taskExpandSpacer_1unik_155",yi="_taskTitle_1unik_160",bi="_taskBadge_1unik_169",_i="_footer_1unik_179",D={overlay:ti,modal:ni,header:si,title:ri,docName:ai,body:oi,state:ii,stateError:li,stateDone:ci,toolbar:di,toolbarCount:ui,toolbarActions:mi,tree:hi,taskRow:fi,taskRowDimmed:pi,taskCheck:vi,taskExpandBtn:wi,taskExpandSpacer:gi,taskTitle:yi,taskBadge:bi,footer:_i},xi={1:"Low",2:"Medium",3:"High"};function ft(n,l){return n.map(h=>({...h,selected:l,children:ft(h.children,l)}))}function ls(n,l,h){return n.map(i=>i.idempotencyKey===l?{...i,selected:h,children:ft(i.children,h)}:{...i,children:ls(i.children,l,h)})}function pn(n){let l=0;for(const h of n)h.selected&&l++,l+=pn(h.children);return l}function cs({node:n,depth:l,onToggle:h}){const[i,d]=s.useState(!0),c=n.children.length>0,p=l*20;return e.jsxs("div",{children:[e.jsxs("div",{className:`${D.taskRow} ${n.selected?"":D.taskRowDimmed}`,style:{paddingLeft:`${12+p}px`},children:[e.jsx("button",{className:D.taskCheck,onClick:()=>h(n.idempotencyKey,!n.selected),title:n.selected?"Deselect":"Select",children:n.selected?e.jsx(Js,{size:14,style:{color:"var(--brand-primary-strong)"}}):e.jsx(Qs,{size:14,style:{color:"var(--text-muted)"}})}),c?e.jsx("button",{className:D.taskExpandBtn,onClick:()=>d(b=>!b),children:i?e.jsx(Ys,{size:12}):e.jsx(Xs,{size:12})}):e.jsx("span",{className:D.taskExpandSpacer}),e.jsx("span",{className:D.taskTitle,title:n.description||void 0,children:n.title}),e.jsx("span",{className:D.taskBadge,style:{color:Jn(n.type),borderColor:Jn(n.type)},children:n.type}),e.jsx("span",{className:D.taskBadge,style:{color:Qn(n.priority),borderColor:Qn(n.priority)},children:xi[n.priority]})]}),c&&i&&e.jsx("div",{children:n.children.map(b=>e.jsx(cs,{node:b,depth:l+1,onToggle:h},b.idempotencyKey))})]})}function Ci({content:n,docTitle:l,apiBaseUrl:h="",onClose:i,onGenerated:d}){const[c,p]=s.useState("preview"),[b,k]=s.useState(null),[S,I]=s.useState([]),[T,j]=s.useState(!0),[J,Q]=s.useState(0),[$,ie]=s.useState(null),z=s.useRef(null);s.useEffect(()=>{let x=!1;return j(!0),k(null),U("/api/taskforce/documents/generate-tasks/preview",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})},h).then(R=>R.json()).then(R=>{if(!x){if(R.error)throw new Error(R.error);I(R.tasks||[]),p("preview")}}).catch(R=>{x||(k(R?.message||"Failed to parse plan"),p("error"))}).finally(()=>{x||j(!1)}),()=>{x=!0}},[n,h]);const N=s.useCallback((x,R)=>{I(O=>ls(O,x,R))},[]),H=()=>I(x=>ft(x,!0)),Y=()=>I(x=>ft(x,!1)),X=pn(S),L=async()=>{p("generating"),ie(null);try{const x=JSON.stringify({tasks:S});z.current?.requestBody!==x&&(z.current={requestBody:x,operationId:$s()});const O={method:"POST",credentials:"include",headers:{"Content-Type":"application/json","x-taskforce-operation-id":z.current.operationId},body:x};let W;try{W=await U("/api/taskforce/documents/generate-tasks/commit",O,h)}catch{W=await U("/api/taskforce/documents/generate-tasks/commit",O,h)}const K=await W.json().catch(()=>({}));if(!W.ok)throw new Error(K.error||`Generation failed (${W.status})`);z.current=null,Q(K.created??0),p("done"),d(K.created??0)}catch(x){ie(x?.message||"Generation failed"),p("error")}};return e.jsx("div",{className:D.overlay,onClick:x=>{x.target===x.currentTarget&&i()},children:e.jsxs("div",{className:`tf-surface-modal tf-modal-shell ${D.modal}`,children:[e.jsxs("div",{className:`tf-modal-header ${D.header}`,children:[e.jsxs("div",{className:`tf-modal-title ${D.title}`,children:[e.jsx(mn,{size:16,style:{color:"var(--brand-primary-strong)"}}),"Generate Tasks from Plan"]}),e.jsx("span",{className:D.docName,children:l}),e.jsx("button",{className:"tf-control-icon",onClick:i,title:"Close",children:e.jsx(hn,{size:16})})]}),e.jsxs("div",{className:D.body,children:[T&&e.jsxs("div",{className:D.state,children:[e.jsx(es,{size:20,className:me.docSpinning}),"Parsing plan…"]}),!T&&c==="error"&&e.jsxs("div",{className:D.stateError,children:[e.jsx(Ft,{size:16}),b||$||"An error occurred"]}),!T&&c==="done"&&e.jsxs("div",{className:D.stateDone,children:[e.jsx(ht,{size:24,style:{color:"var(--status-success)"}}),e.jsxs("strong",{children:[J," task",J!==1?"s":""," created"]}),e.jsx("p",{children:"Tasks are now in your board. Switch to the Kanban or Hierarchy view to see them."})]}),!T&&(c==="preview"||c==="confirm"||c==="generating")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:D.toolbar,children:[e.jsxs("span",{className:D.toolbarCount,children:[X," of ",pn(ft(S,!0))," tasks selected"]}),e.jsxs("div",{className:D.toolbarActions,children:[e.jsx("button",{className:"tf-control-icon",onClick:H,children:"Select all"}),e.jsx("button",{className:"tf-control-icon",onClick:Y,children:"Deselect all"})]})]}),S.length===0?e.jsx("div",{className:D.state,children:"No tasks could be parsed from this document. Make sure the document uses ## H2 headings for phases and bullet points for tasks."}):e.jsx("div",{className:`${D.tree} tf-scrollbar`,children:S.map(x=>e.jsx(cs,{node:x,depth:0,onToggle:N},x.idempotencyKey))})]})]}),!T&&c!=="done"&&c!=="error"&&e.jsxs("div",{className:D.footer,children:[e.jsx("button",{className:"tf-button-secondary",onClick:i,children:"Cancel"}),e.jsx("button",{className:"tf-button-primary",onClick:L,disabled:X===0||c==="generating",children:c==="generating"?e.jsxs(e.Fragment,{children:[e.jsx(es,{size:13,className:me.docSpinning})," Generating…"]}):e.jsxs(e.Fragment,{children:[e.jsx(mn,{size:13})," Generate ",X," task",X!==1?"s":""]})})]}),!T&&c==="done"&&e.jsx("div",{className:D.footer,children:e.jsx("button",{className:"tf-button-primary",onClick:i,children:"Done"})})]})})}const ki={"implementation-plan":"Implementation Plan",review:"Review",walkthrough:"Walkthrough",planning:"Planning",other:"Document"},Si={"implementation-plan":a.typeBadgeImplementationPlan,review:a.typeBadgeReview,walkthrough:a.typeBadgeWalkthrough,planning:void 0,other:void 0},Ri={editor:a.editorLayoutEditor,split:a.editorLayoutSplit,preview:a.editorLayoutPreview},ji=1500,Ni=80,on="Document refresh failed; showing the previous saved version.",ln="A newer saved version is available. Cancel editing to reload it before saving.",cn="__new-review__",Ti=`
2
2
  @page {
3
3
  margin: 0.94in 1.02in 1in;
4
4
  }
@@ -1 +1 @@
1
- import{R as x,j as n}from"./vendor-react-CKJs5o3c.js";import{aT as q,aU as z,v as G,aV as J,aW as Q,aX as V}from"./index-BUplSsv_.js";import"./vendor-icons-BkFLXavV.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const Y="_thread_1di31_1",Z="_empty_1di31_7",tt="_item_1di31_17",et="_comment_1di31_24",nt="_event_1di31_31",ot="_eventSystem_1di31_39",rt="_header_1di31_43",at="_eventMain_1di31_57",st="_author_1di31_64",it="_time_1di31_79",ct="_commentText_1di31_86",mt="_commentOtherActor_1di31_97",dt="_commentSystem_1di31_112",lt="_commentCurrentActor_1di31_125",ht="_eventText_1di31_140",vt="_eventChanges_1di31_148",ut="_eventChange_1di31_148",e={thread:Y,empty:Z,item:tt,comment:et,event:nt,eventSystem:ot,header:rt,eventMain:at,author:st,time:it,commentText:ct,commentOtherActor:mt,commentSystem:dt,commentCurrentActor:lt,eventText:ht,eventChanges:vt,eventChange:ut};function At({activity:p,comments:j,formatFieldValue:A,resolveActorPresentation:i,currentActorId:_,taskReferences:w,emptyMessage:B="No activity yet.",listClassName:M,emptyClassName:O,listRef:P,endRef:K,onScroll:W,targetEntryId:H,targetEntryRef:b}){const T=x.useMemo(()=>q({activity:p,comments:j}),[p,j]),c=String(_||"").trim().toLowerCase(),m=String(H||"").trim(),g=c!==""&&c!=="anonymous",f=x.useMemo(()=>g?i({actorId:_,actorType:"human",fallbackKind:"member"}):null,[_,g,i]),d=String(f?.label||"").trim(),l=d.toLowerCase(),S=!!(f?.kind==="member"&&d&&l!=="you"&&l!=="user"&&l!=="human"&&l!==c),L=x.useCallback(t=>{const r=String(t.label||"").trim().toLowerCase(),a=r==="you"||r==="user"||r==="human";return t.isCurrentActorHint===!0&&S&&a?d:t.label},[d,S]);return n.jsxs("div",{ref:P,className:[e.thread,M].filter(Boolean).join(" "),onScroll:W,children:[T.length===0?n.jsx("div",{className:[e.empty,O].filter(Boolean).join(" "),children:B}):null,T.map(t=>{const r=!!(m&&(t.id===m||t.type==="comment"&&t.comment.id===m||t.type==="event"&&t.event.id===m));if(t.type==="comment"){const o=i({actorId:t.comment.author,actorType:t.comment.actor?.kind==="ai"?"ai":t.comment.actor?.kind==="human"?"human":null,actorProfile:t.comment.actor||null}),s=o.kind==="agent"?"agent":o.kind==="system"?"system":"member",v=String(t.comment.author||"").trim().toLowerCase(),u=String(t.comment.actor?.id||"").trim().toLowerCase(),$=[v,u].map(X=>String(X||"").trim().toLowerCase()).filter(Boolean),C=g?!!(u&&u!=="user"&&u!=="human"||v&&v!=="user"&&v!=="human")?$.includes(c):o.isCurrentActorHint===!0:s==="member",E=C?L(o):o.label,{ActorIcon:D}=o,y=o.kind==="system"?void 0:o.color,F=y?{"--conversation-accent":y}:void 0;return n.jsxs("div",{ref:r?b:void 0,tabIndex:r?-1:void 0,"data-activity-entry-id":t.id,"data-activity-targeted":r?"true":void 0,"data-conversation-role":s==="agent"?"assistant":s==="system"?"system":"user","data-conversation-side":C?"outgoing":"incoming",style:F,className:[e.item,e.comment,s==="system"?e.commentSystem:"",C?e.commentCurrentActor:e.commentOtherActor].join(" "),children:[n.jsxs("div",{className:e.header,children:[n.jsxs("span",{className:e.author,style:y?{color:y}:void 0,title:o.description,"aria-label":o.description?`${E}. ${o.description}`:void 0,children:[n.jsx(D,{size:12,strokeWidth:1.5}),E]}),n.jsx("time",{className:e.time,dateTime:t.comment.timestamp,children:z(t.comment.timestamp,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),n.jsx("div",{className:e.commentText,children:n.jsx(G,{variant:"conversation",taskReferences:w,children:t.comment.text})})]},t.id)}const a=i({actorId:t.event.actor,actorType:t.event.actorType,actorProfile:t.event.actorProfile||null,fallbackKind:"system"}),R=L(a),{ActorIcon:U}=a,N=a.color,h=Object.entries(t.event.details?.changes||{}),k=J(t.event),I=h.length>1&&k?h.filter(([o])=>o!==k):h.length>1?h:[];return n.jsx("div",{ref:r?b:void 0,tabIndex:r?-1:void 0,"data-activity-entry-id":t.id,"data-activity-targeted":r?"true":void 0,className:[e.item,e.event,a.kind==="system"?e.eventSystem:""].filter(Boolean).join(" "),children:n.jsxs("div",{className:e.eventMain,children:[n.jsxs("span",{className:e.author,style:N?{color:N}:void 0,children:[n.jsx(U,{size:12,strokeWidth:1.5}),R]}),n.jsxs("div",{className:e.eventText,children:[n.jsx("div",{children:Q(t.event,A)}),I.length>0?n.jsx("div",{className:e.eventChanges,children:I.map(([o,s])=>n.jsx("div",{className:e.eventChange,children:V(o,s,A)},o))}):null]}),n.jsx("time",{className:e.time,dateTime:t.event.createdAt,children:z(t.event.createdAt,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})},t.id)}),n.jsx("div",{ref:K})]})}export{At as EntityActivityTimeline};
1
+ import{R as x,j as n}from"./vendor-react-CKJs5o3c.js";import{aU as Y,aV as z,w as q,aW as G,aX as J,aY as Q}from"./index-I5zhdtgt.js";import"./vendor-icons-D9Lpw-j4.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const V="_thread_1di31_1",Z="_empty_1di31_7",tt="_item_1di31_17",et="_comment_1di31_24",nt="_event_1di31_31",ot="_eventSystem_1di31_39",rt="_header_1di31_43",at="_eventMain_1di31_57",st="_author_1di31_64",it="_time_1di31_79",ct="_commentText_1di31_86",mt="_commentOtherActor_1di31_97",dt="_commentSystem_1di31_112",lt="_commentCurrentActor_1di31_125",ht="_eventText_1di31_140",ut="_eventChanges_1di31_148",vt="_eventChange_1di31_148",e={thread:V,empty:Z,item:tt,comment:et,event:nt,eventSystem:ot,header:rt,eventMain:at,author:st,time:it,commentText:ct,commentOtherActor:mt,commentSystem:dt,commentCurrentActor:lt,eventText:ht,eventChanges:ut,eventChange:vt};function At({activity:p,comments:j,formatFieldValue:A,resolveActorPresentation:i,currentActorId:_,taskReferences:w,emptyMessage:B="No activity yet.",listClassName:M,emptyClassName:O,listRef:P,endRef:K,onScroll:W,targetEntryId:H,targetEntryRef:b}){const T=x.useMemo(()=>Y({activity:p,comments:j}),[p,j]),c=String(_||"").trim().toLowerCase(),m=String(H||"").trim(),g=c!==""&&c!=="anonymous",f=x.useMemo(()=>g?i({actorId:_,actorType:"human",fallbackKind:"member"}):null,[_,g,i]),d=String(f?.label||"").trim(),l=d.toLowerCase(),S=!!(f?.kind==="member"&&d&&l!=="you"&&l!=="user"&&l!=="human"&&l!==c),L=x.useCallback(t=>{const r=String(t.label||"").trim().toLowerCase(),a=r==="you"||r==="user"||r==="human";return t.isCurrentActorHint===!0&&S&&a?d:t.label},[d,S]);return n.jsxs("div",{ref:P,className:[e.thread,M].filter(Boolean).join(" "),onScroll:W,children:[T.length===0?n.jsx("div",{className:[e.empty,O].filter(Boolean).join(" "),children:B}):null,T.map(t=>{const r=!!(m&&(t.id===m||t.type==="comment"&&t.comment.id===m||t.type==="event"&&t.event.id===m));if(t.type==="comment"){const o=i({actorId:t.comment.author,actorType:t.comment.actor?.kind==="ai"?"ai":t.comment.actor?.kind==="human"?"human":null,actorProfile:t.comment.actor||null}),s=o.kind==="agent"?"agent":o.kind==="system"?"system":"member",u=String(t.comment.author||"").trim().toLowerCase(),v=String(t.comment.actor?.id||"").trim().toLowerCase(),$=[u,v].map(X=>String(X||"").trim().toLowerCase()).filter(Boolean),C=g?!!(v&&v!=="user"&&v!=="human"||u&&u!=="user"&&u!=="human")?$.includes(c):o.isCurrentActorHint===!0:s==="member",E=C?L(o):o.label,{ActorIcon:D}=o,y=o.kind==="system"?void 0:o.color,F=y?{"--conversation-accent":y}:void 0;return n.jsxs("div",{ref:r?b:void 0,tabIndex:r?-1:void 0,"data-activity-entry-id":t.id,"data-activity-targeted":r?"true":void 0,"data-conversation-role":s==="agent"?"assistant":s==="system"?"system":"user","data-conversation-side":C?"outgoing":"incoming",style:F,className:[e.item,e.comment,s==="system"?e.commentSystem:"",C?e.commentCurrentActor:e.commentOtherActor].join(" "),children:[n.jsxs("div",{className:e.header,children:[n.jsxs("span",{className:e.author,style:y?{color:y}:void 0,title:o.description,"aria-label":o.description?`${E}. ${o.description}`:void 0,children:[n.jsx(D,{size:12,strokeWidth:1.5}),E]}),n.jsx("time",{className:e.time,dateTime:t.comment.timestamp,children:z(t.comment.timestamp,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),n.jsx("div",{className:e.commentText,children:n.jsx(q,{variant:"conversation",taskReferences:w,children:t.comment.text})})]},t.id)}const a=i({actorId:t.event.actor,actorType:t.event.actorType,actorProfile:t.event.actorProfile||null,fallbackKind:"system"}),R=L(a),{ActorIcon:U}=a,N=a.color,h=Object.entries(t.event.details?.changes||{}),k=G(t.event),I=h.length>1&&k?h.filter(([o])=>o!==k):h.length>1?h:[];return n.jsx("div",{ref:r?b:void 0,tabIndex:r?-1:void 0,"data-activity-entry-id":t.id,"data-activity-targeted":r?"true":void 0,className:[e.item,e.event,a.kind==="system"?e.eventSystem:""].filter(Boolean).join(" "),children:n.jsxs("div",{className:e.eventMain,children:[n.jsxs("span",{className:e.author,style:N?{color:N}:void 0,children:[n.jsx(U,{size:12,strokeWidth:1.5}),R]}),n.jsxs("div",{className:e.eventText,children:[n.jsx("div",{children:J(t.event,A)}),I.length>0?n.jsx("div",{className:e.eventChanges,children:I.map(([o,s])=>n.jsx("div",{className:e.eventChange,children:Q(o,s,A)},o))}):null]}),n.jsx("time",{className:e.time,dateTime:t.event.createdAt,children:z(t.event.createdAt,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})},t.id)}),n.jsx("div",{ref:K})]})}export{At as EntityActivityTimeline};
@@ -0,0 +1 @@
1
+ import{R as a,j as t}from"./vendor-react-CKJs5o3c.js";import{an as ze,ao as $e,ap as Le,aq as We,ar as ye,as as re,T as Pe,at as ge,au as ee,av as te,aw as U,ax as J,ay as De,az as Fe,aA as He,aB as Be,aC as Me,aD as Ue,aE as be,aF as _e,aG as oe,aH as je,aI as Ge,aJ as Ve,aK as Ke,aL as qe,aM as Qe}from"./index-I5zhdtgt.js";import{w as ae,Z as ke,R as se,a8 as Je,a9 as Xe,S as Ye,X as Ze,al as et,aj as tt,t as ne,ak as me,V as ie,Y as nt,a7 as it}from"./vendor-icons-D9Lpw-j4.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const at="_module_3zich_1",st="_columns_3zich_15",rt="_column_3zich_15",ot="_columnHeader_3zich_36",lt="_columnHeadingGroup_3zich_49",ct="_paneHeading_3zich_56",dt="_responsiveBack_3zich_60",ut="_sectionLabel_3zich_64",ht="_sectionHeadingRow_3zich_68",vt="_headerActions_3zich_81",pt="_portfolioControls_3zich_87",ft="_searchRow_3zich_95",yt="_searchShell_3zich_101",gt="_clearSearch_3zich_139",kt="_controlActive_3zich_160",mt="_filterPanel_3zich_166",wt="_filterField_3zich_177",xt="_filterLabel_3zich_184",bt="_filterDropdown_3zich_190",_t="_sortTrigger_3zich_204",jt="_scrollRegion_3zich_217",Ct="_selectedEntityContext_3zich_227",Et="_selectedEntityContextArchived_3zich_237",St="_selectedEntityReferenceRow_3zich_242",It="_selectedEntityReferenceIdentity_3zich_257",Nt="_selectedEntityReferenceActions_3zich_264",At="_workspaceEditor_3zich_278",Rt="_workspaceEditorField_3zich_294",Ot="_workspaceEditorActions_3zich_337",Tt="_selectedEntityDescription_3zich_348",zt="_selectedEntityDescriptionMarkdown_3zich_355",$t="_selectedEntityOwnerField_3zich_361",Lt="_selectedEntityOwnerDropdown_3zich_373",Wt="_selectedEntityDetailsSection_3zich_377",Pt="_activityTimelineList_3zich_382",Dt="_activityTimelineEmpty_3zich_389",Ft="_visuallyHidden_3zich_393",Ht="_entityCard_3zich_405",Bt="_entityCardTopRow_3zich_426",Mt="_entityCardBody_3zich_433",Ut="_entityCardContentButton_3zich_437",Gt="_entityCardSelected_3zich_447",Vt="_entityCardArchived_3zich_455",Kt="_relationshipRecovery_3zich_466",qt="_empty_3zich_488",Qt="_centerState_3zich_495",Jt="_inlineError_3zich_509",Xt="_spinner_3zich_524",Yt="_columnPortfolio_3zich_543",Zt="_columnActive_3zich_544",en="_columnWorkstreams_3zich_545",tn="_columnTasks_3zich_550",nn="_workspaceEditorIdentity_3zich_592",i={module:at,columns:st,column:rt,columnHeader:ot,columnHeadingGroup:lt,paneHeading:ct,responsiveBack:dt,sectionLabel:ut,sectionHeadingRow:ht,headerActions:vt,portfolioControls:pt,searchRow:ft,searchShell:yt,clearSearch:gt,controlActive:kt,filterPanel:mt,filterField:wt,filterLabel:xt,filterDropdown:bt,sortTrigger:_t,scrollRegion:jt,selectedEntityContext:Ct,selectedEntityContextArchived:Et,selectedEntityReferenceRow:St,selectedEntityReferenceIdentity:It,selectedEntityReferenceActions:Nt,workspaceEditor:At,workspaceEditorField:Rt,workspaceEditorActions:Ot,selectedEntityDescription:Tt,selectedEntityDescriptionMarkdown:zt,selectedEntityOwnerField:$t,selectedEntityOwnerDropdown:Lt,selectedEntityDetailsSection:Wt,activityTimelineList:Pt,activityTimelineEmpty:Dt,visuallyHidden:Ft,entityCard:Ht,entityCardTopRow:Bt,entityCardBody:Mt,entityCardContentButton:Ut,entityCardSelected:Gt,entityCardArchived:Vt,relationshipRecovery:Kt,empty:qt,centerState:Qt,inlineError:Jt,spinner:Xt,columnPortfolio:Yt,columnActive:Zt,columnWorkstreams:en,columnTasks:tn,workspaceEditorIdentity:nn};function Y({entityType:e,mode:l,initialTitle:_="",initialDescription:m="",ownerOptions:p,fixedInitiativeId:f,formId:I,showActions:N=!0,onSavingChange:j,onCancel:A,onSave:T}){const w=e==="initiative"?"Initiative":"Workstream",B=a.useId(),$=a.useId(),L=a.useId(),y=a.useRef(null),[V,M]=a.useState(_),[E,g]=a.useState(m),[x,R]=a.useState(""),[S,W]=a.useState(null),[u,b]=a.useState(null),[C,P]=a.useState(null),[D,z]=a.useState(null),[k,O]=a.useState(!1);a.useEffect(()=>{y.current?.focus()},[]);const F=async c=>{if(c.preventDefault(),k)return;const h=V.trim();if(!h){P(`${w} title is required.`),y.current?.focus();return}P(null),z(null),O(!0),j?.(!0);try{await T({title:h,description:E.trim()||null,...l==="create"?{ownerId:x.trim()||null}:{},...e==="workstream"&&l==="create"?{initiativeId:f||null}:{},...l==="create"&&(S||u)?{icon:S,color:u}:{}})}catch(H){z(H instanceof Error?H.message:`Failed to save ${w.toLowerCase()}.`)}finally{O(!1),j?.(!1)}};return t.jsxs("form",{id:I,className:i.workspaceEditor,onSubmit:c=>{F(c)},onKeyDown:c=>{c.key!=="Escape"||k||(c.preventDefault(),A())},noValidate:!0,children:[l==="create"?t.jsxs("div",{className:i.workspaceEditorIdentity,children:[t.jsx(be,{entityType:e,entityId:"create-preview",icon:S,color:u||"blue",size:"detail",onChange:c=>{Object.prototype.hasOwnProperty.call(c,"icon")&&W(c.icon??null),Object.prototype.hasOwnProperty.call(c,"color")&&b(c.color??null)}}),t.jsx("span",{children:"Choose an icon and color"})]}):null,t.jsxs("div",{className:i.workspaceEditorField,children:[t.jsxs("label",{htmlFor:B,children:[w," title"]}),t.jsx("input",{ref:y,id:B,value:V,disabled:k,required:!0,"aria-invalid":C?"true":void 0,"aria-describedby":C?$:void 0,onChange:c=>{M(c.target.value),C&&P(null)},placeholder:e==="initiative"?"Enter initiative title":"Enter workstream title"}),C?t.jsx("p",{id:$,className:"tf-text-error",children:C}):null]}),t.jsxs("div",{className:i.workspaceEditorField,children:[t.jsxs("label",{htmlFor:L,children:[w," description"]}),t.jsx("textarea",{id:L,value:E,disabled:k,rows:5,onChange:c=>g(c.target.value),placeholder:e==="initiative"?"Describe the broader outcome this initiative is meant to achieve.":"Describe the lane of work this workstream will coordinate."})]}),l==="create"&&p?t.jsxs("div",{className:i.workspaceEditorField,children:[t.jsxs("span",{children:[w," owner"]}),t.jsx(re,{value:x,options:p,onChange:R,disabled:k,ariaLabel:`${w} owner`,className:`${_e.control} ${i.selectedEntityOwnerDropdown}`})]}):null,D?t.jsx("p",{className:"tf-text-error",role:"alert",children:D}):null,N?t.jsxs("div",{className:i.workspaceEditorActions,children:[t.jsx("button",{type:"button",className:"tf-button-secondary tf-button-compact",onClick:A,disabled:k,children:"Cancel"}),t.jsxs("button",{type:"submit",className:"tf-button-primary tf-button-compact",disabled:k,children:[k?t.jsx(ae,{size:14,className:i.spinner,"aria-hidden":"true"}):null,l==="create"?`Create ${w}`:"Save"]})]}):null]})}function an({initiative:e,ownerOption:l,ownerOptions:_,workstreamCount:m,selected:p,onSelect:f,onChangeOwner:I,onChangeIdentity:N}){return t.jsxs("div",{className:`${i.entityCard} ${e.isArchived?i.entityCardArchived:""} ${p?i.entityCardSelected:""}`.trim(),children:[t.jsx(oe,{label:J(e),entityType:"initiative",entityName:e.title,interactive:!1}),t.jsx("div",{className:i.entityCardBody,children:t.jsx("div",{role:"button",tabIndex:0,className:i.entityCardContentButton,onClick:f,onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),f())},"aria-pressed":p,children:t.jsx(je,{item:e,entityType:"initiative",workstreamCount:m,ownerOption:l,ownerOptions:_,onChangeOwner:I,onChangeIdentity:N})})})]})}function we({workstream:e,ownerOption:l,ownerOptions:_,selected:m,onSelect:p,onChangeOwner:f,onChangeIdentity:I,referenceAction:N,feedback:j}){const A=U(e);return t.jsxs("div",{className:`${i.entityCard} ${e.isArchived?i.entityCardArchived:""} ${m?i.entityCardSelected:""}`.trim(),children:[t.jsxs("div",{className:i.entityCardTopRow,children:[N,t.jsx(oe,{label:A||"Reference pending",entityType:"workstream",entityName:e.title,interactive:!1,pending:!A})]}),j,t.jsx("div",{className:i.entityCardBody,children:t.jsx("div",{role:"button",tabIndex:0,className:i.entityCardContentButton,onClick:p,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),p())},"aria-pressed":m,children:t.jsx(je,{item:e,entityType:"workstream",ownerOption:l,ownerOptions:_,onChangeOwner:f,onChangeIdentity:I})})})]})}function xe({item:e,entityType:l,ownerOptions:_,onChangeOwner:m,onChangeIdentity:p,workspaceId:f,currentActorId:I,taskReferences:N,hydrationState:j,onRetryHydration:A,onAddContextFile:T,onRemoveContextFile:w,onUpdateContextCaption:B,onUpdate:$,onArchive:L,onUnarchive:y,referenceAction:V,relationshipActions:M,relationshipContent:E}){const g=l==="initiative"?"Initiative":"Workstream",x=l==="initiative"?J(e):U(e),[R,S]=a.useState(String(e.ownerId||"")),[W,u]=a.useState(!1),[b,C]=a.useState(!1),[P,D]=a.useState(!1),[z,k]=a.useState(!1),[O,F]=a.useState(!1),c=a.useId(),h=Ge({entityType:l,isArchived:e.isArchived,taskCount:e.taskCount,completedTaskCount:e.completedTaskCount,archiveReady:e.archiveReady,activeWorkstreamCount:e.archiveActiveWorkstreamCount}),H=h.mode==="archived"?`Unarchive ${g.toLowerCase()}`:h.mode==="blocked"?`Archive unavailable — active ${h.remainingKind==="task"?"tasks":"workstreams"} remain`:h.mode==="checking"?"Archive availability is still loading":`Archive ${g.toLowerCase()}`;a.useEffect(()=>{S(String(e.ownerId||"")),u(!1)},[e.id,e.ownerId]),a.useEffect(()=>{C(!1),D(!1),k(!1),F(!1)},[e.id]);const s=async d=>{if(!m||e.isArchived||W||d===R)return;const G=R;S(d),u(!0);try{await m(d)}catch{S(G)}finally{u(!1)}},K=async()=>{if(O)return;if(h.mode==="ready"){k(!0);return}const d=h.mode==="archived"?y:L;if(!(!d||h.mode==="blocked"||h.mode==="checking")){F(!0);try{await d()}finally{F(!1)}}},r=async()=>{if(!(!L||O)){F(!0);try{await L()!==!1&&k(!1)}finally{F(!1)}}};return t.jsxs("section",{className:`${i.selectedEntityContext} ${e.isArchived?i.selectedEntityContextArchived:""}`.trim(),"aria-label":`Selected ${g.toLowerCase()}`,"aria-busy":j?.status==="loading",children:[t.jsxs("div",{className:i.selectedEntityReferenceRow,children:[t.jsxs("div",{className:i.selectedEntityReferenceIdentity,children:[t.jsx(be,{entityType:l,entityId:e.id,icon:e.icon,color:e.color,size:"detail",disabled:!!e.isArchived,onChange:p?d=>p(l,e.id,d):void 0}),V,t.jsx(oe,{label:x||"Reference pending",entityType:l,entityName:e.title,interactive:!1,pending:!x})]}),t.jsxs("div",{className:i.selectedEntityReferenceActions,children:[t.jsx("span",{children:g}),M,!b&&(L||y)?t.jsx("button",{type:"button",className:"tf-control-icon",disabled:O||h.mode==="blocked"||h.mode==="checking"||(h.mode==="archived"?!y:!L),onClick:()=>{K()},"aria-label":H,title:H,"aria-expanded":h.mode==="ready"?z:void 0,children:h.mode==="archived"?t.jsx(se,{size:14,"aria-hidden":"true"}):t.jsx(nt,{size:14,"aria-hidden":"true"})}):null,!b&&!e.isArchived&&$?t.jsx("button",{type:"button",className:"tf-control-icon",onClick:()=>C(!0),"aria-label":`Edit ${g.toLowerCase()}`,title:`Edit ${g.toLowerCase()}`,children:t.jsx(it,{size:14,"aria-hidden":"true"})}):null,b?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"tf-button-secondary tf-button-compact",onClick:()=>C(!1),disabled:P,children:"Cancel"}),t.jsx("button",{type:"submit",form:c,className:"tf-button-primary tf-button-compact",disabled:P,children:"Save"})]}):null]})]}),z&&h.mode==="ready"?t.jsx(Ve,{entityType:l,title:e.title,activeTaskCount:e.archiveActiveTaskCount,activeWorkstreamCount:e.archiveActiveWorkstreamCount,busy:O,onCancel:()=>k(!1),onConfirm:()=>{r()}}):null,E,b&&$?t.jsx(Y,{entityType:l,mode:"edit",formId:c,showActions:!1,onSavingChange:D,initialTitle:e.title,initialDescription:e.description||"",onCancel:()=>C(!1),onSave:async d=>{await $(d),C(!1)}},`${l}:${e.id}`):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"tf-heading-card",children:e.title}),t.jsx(Ke,{description:e.description,label:g,taskReferences:N,className:`${i.selectedEntityDescription} tf-scrollbar`.trim(),markdownClassName:i.selectedEntityDescriptionMarkdown})]}),t.jsxs("div",{className:i.selectedEntityOwnerField,children:[t.jsx("span",{children:"Owner"}),t.jsx(re,{value:R,options:_,onChange:d=>{s(d)},disabled:!m||!!e.isArchived||W,ariaLabel:`${g} owner`,className:`${_e.control} ${i.selectedEntityOwnerDropdown}`})]}),t.jsx("div",{className:i.selectedEntityDetailsSection,children:t.jsx(qe,{entityType:l,entityId:e.id,referenceLabel:l==="initiative"?J(e):U(e),workspaceId:f,attachments:e.attachments,readOnly:!!e.isArchived,defaultExpanded:!1,onAddAttachment:!e.isArchived&&T?d=>T(l,e.id,d):void 0,onRemoveAttachment:!e.isArchived&&w?d=>w(l,e.id,d):void 0,onUpdateAttachmentCaption:!e.isArchived&&B?(d,G)=>B(l,e.id,d,G):void 0})}),t.jsx("div",{className:i.selectedEntityDetailsSection,children:t.jsx(Qe,{entityType:l,item:e,assigneeOptions:_,currentActorId:I,taskReferences:N,defaultExpanded:!1,listClassName:i.activityTimelineList,emptyClassName:i.activityTimelineEmpty,hydrationState:j,onRetryHydration:A})})]})}function un({model:e}){const[l,_]=a.useState(null),[m,p]=a.useState(null),[f,I]=a.useState("portfolio"),[N,j]=a.useState(""),[A,T]=a.useState("all"),[w,B]=a.useState("default"),[$,L]=a.useState(!1),[y,V]=a.useState(!1),M=e.taskArrangeMode||"execution",[E,g]=a.useState(null),[x,R]=a.useState(null),[S,W]=a.useState(null),[u,b]=a.useState(!1),C=a.useRef(null),P=a.useRef(null),D=a.useRef(null),z=a.useRef(null),k=a.useRef(null),O=a.useMemo(()=>new Map(e.assigneeOptions.filter(n=>!String(n.archivedAt||"").trim()).map(n=>[String(n.value),n])),[e.assigneeOptions]),F=a.useMemo(()=>{const n=String(e.currentOwnerId||"").trim(),o=n?ze(e.assigneeOptions,n).find(v=>v.value===n):void 0;return[{value:"all",label:"All owners",icon:"Users",color:"var(--text-secondary)",kind:"unassigned"},...n?[{...o,value:"mine",label:"Owned by me",icon:o?.icon||"User",color:o?.color||"var(--text-secondary)",kind:o?.kind||"member"}]:[],{value:"unassigned",label:"Unassigned",icon:Le,color:$e,kind:"unassigned"}]},[e.assigneeOptions,e.currentOwnerId]),c=a.useMemo(()=>We({initiatives:e.initiatives,standaloneWorkstreams:e.standaloneWorkstreams,showArchivedPlanning:y,searchQuery:N,ownerFilter:A,currentOwnerId:String(e.currentOwnerId||""),sort:w}),[e.currentOwnerId,e.initiatives,e.standaloneWorkstreams,A,N,y,w]),h=a.useMemo(()=>c.initiatives.map(({initiative:n})=>n),[c.initiatives]),H=c.standaloneWorkstreams,s=a.useMemo(()=>e.initiatives.find(n=>n.id===l)??null,[e.initiatives,l]),K=a.useMemo(()=>[...e.initiatives.flatMap(n=>n.allWorkstreams??n.workstreams),...e.standaloneWorkstreams],[e.initiatives,e.standaloneWorkstreams]),r=a.useMemo(()=>K.find(n=>n.id===m)??null,[K,m]),d=s?(s.allWorkstreams??s.workstreams).filter(n=>y||!n.isArchived):r&&!r.initiativeId?[r]:[],G=a.useMemo(()=>ye((r?.tasks??[]).filter(n=>y||!n.isArchived),M),[r?.tasks,y,M]),le=a.useMemo(()=>new Set((s?.allWorkstreams??s?.workstreams??[]).map(n=>n.id)),[s]),ce=a.useMemo(()=>new Set((r?.tasks??[]).map(n=>n.id)),[r]),Ce=a.useMemo(()=>e.linkOptions.workstreams.filter(n=>!le.has(n.id)),[le,e.linkOptions.workstreams]),Ee=a.useMemo(()=>e.linkOptions.tasks.filter(n=>!ce.has(n.id)),[ce,e.linkOptions.tasks]),q=r?"workstream":s?"initiative":null,Q=r?.id||s?.id||null,de=q&&Q?e.hydrationStateByEntity?.[`${q}:${Q}`]:void 0,ue=a.useMemo(()=>e.initiatives.some(o=>o.isArchived)?!0:[...e.initiatives.flatMap(o=>o.allWorkstreams??o.workstreams),...e.standaloneWorkstreams].some(o=>o.isArchived||(o.tasks??[]).some(v=>v.isArchived)),[e.initiatives,e.standaloneWorkstreams]);a.useEffect(()=>{const n=k.current;if(n){if(n.entityType==="initiative"){if(!e.initiatives.some(o=>o.id===n.entityId))return;k.current=null,_(n.entityId),p(null),z.current="workstreams",I("workstreams");return}K.some(o=>o.id===n.entityId)&&(k.current=null,_(n.initiativeId||null),p(n.entityId),z.current="tasks",I("tasks"))}},[K,e.initiatives]),a.useEffect(()=>{l&&!s&&(_(null),p(null),I("portfolio"))},[s,l]),a.useEffect(()=>{m&&!r&&(p(null),I(s?"workstreams":"portfolio"))},[s,r,m]),a.useEffect(()=>{!e.hydrateEntity||!q||!Q||e.hydrateEntity(q,Q)},[e.hydrateEntity,Q,q]),a.useEffect(()=>{R(null),W(null),b(!1)},[Q,q]),a.useLayoutEffect(()=>{if(z.current!==f)return;(f==="portfolio"?C.current:f==="workstreams"?P.current:D.current)?.focus({preventScroll:!0}),z.current=null},[f]);const X=n=>{if(n===f){(n==="portfolio"?C.current:n==="workstreams"?P.current:D.current)?.focus({preventScroll:!0});return}z.current=n,I(n)},Se=n=>{_(n),p(null),X("workstreams")},he=n=>{n.initiativeId||_(null),p(n.id),X("tasks")},Ie=()=>{X(s?"workstreams":"portfolio")},Ne=c.hasCriteria||w!=="default",Ae=()=>{j(""),T("all"),B("default")},Z=async n=>{if(!E||!e.createEntity)return;const o=await e.createEntity(E.entityType,n);k.current={entityType:E.entityType,entityId:o.id,initiativeId:E.initiativeId},g(null)},ve=async(n,o)=>{if(u)return;const v=n==="workstream"?e.attachWorkstreamToInitiative:e.attachTaskToWorkstream,fe=n==="workstream"?s?.id:r?.id;if(!(!v||!fe)){b(!0);try{await v(fe,o.referenceLabel)}finally{b(!1)}}},Re=async n=>{if(!(!r||!e.assignWorkstreamToInitiative||u)){b(!0);try{await e.assignWorkstreamToInitiative(r.id,n.referenceLabel)!==!1&&_(n.id)}finally{b(!1)}}},Oe=async()=>{if(!(!x||u)){b(!0);try{if(x.entityType==="workstream"){if(!e.assignWorkstreamToInitiative)return;const n=s?J(s):null;if(await e.assignWorkstreamToInitiative(x.id,null)===!1)return;W({pane:x.id===r?.id?"tasks":"workstreams",message:`${x.referenceLabel} removed from its initiative.`,onUndo:async()=>{if(!n)return;await e.assignWorkstreamToInitiative?.(x.id,n)!==!1&&W(null)}})}else{if(!e.assignTaskToWorkstream||!r)return;const n=r.id;if(await e.assignTaskToWorkstream(x.id,null)===!1)return;W({pane:"tasks",message:`${x.referenceLabel} removed from this workstream.`,onUndo:async()=>{await e.assignTaskToWorkstream?.(x.id,n)!==!1&&W(null)}})}R(null)}finally{b(!1)}}},Te=async()=>{if(!(!S||u)){b(!0);try{await S.onUndo()}finally{b(!1)}}},pe=S?t.jsxs("div",{className:i.relationshipRecovery,role:"status",children:[t.jsx("span",{children:S.message}),t.jsx("button",{type:"button",className:"tf-button-ghost tf-button-compact",disabled:u,onClick:()=>{Te()},children:u?"Restoring…":"Undo"})]}):null;return e.loadState.status==="loading"&&e.initiatives.length===0&&e.standaloneWorkstreams.length===0?t.jsxs("main",{className:i.centerState,"aria-busy":"true","aria-label":"Loading planning workspace",children:[t.jsx(ae,{size:22,className:i.spinner}),t.jsx("span",{children:"Loading planning…"})]}):e.loadState.status==="error"&&e.initiatives.length===0&&e.standaloneWorkstreams.length===0?t.jsxs("main",{className:i.centerState,role:"alert",children:[t.jsx(ke,{size:22}),t.jsx("strong",{children:"Planning could not be loaded."}),t.jsx("span",{children:e.loadState.error}),t.jsxs("button",{type:"button",className:"tf-button-secondary tf-button-compact",onClick:e.retry,disabled:e.loadState.isRefreshing,children:[e.loadState.isRefreshing?t.jsx(ae,{size:15,className:i.spinner}):t.jsx(se,{size:15}),"Retry"]})]}):t.jsxs("main",{className:i.module,"aria-label":"Planning workspace","aria-busy":e.loadState.isRefreshing,children:[e.loadState.isRefreshing?t.jsx("span",{className:i.visuallyHidden,role:"status","aria-live":"polite",children:"Refreshing planning"}):null,(e.loadState.status==="partial"||e.loadState.status==="error")&&t.jsxs("div",{className:i.inlineError,role:"alert",children:[t.jsx(ke,{size:16}),t.jsx("span",{children:e.loadState.error||"Some planning information could not be loaded."}),t.jsx("button",{type:"button",className:"tf-button-secondary tf-button-compact",onClick:e.retry,children:"Retry"})]}),t.jsxs("div",{className:i.columns,"data-active-pane":f,children:[t.jsxs("section",{className:`${i.column} ${i.columnPortfolio} ${f==="portfolio"?i.columnActive:""}`.trim(),"aria-labelledby":"planning-portfolio-heading",children:[t.jsxs("div",{className:i.columnHeader,children:[t.jsx("h2",{ref:C,id:"planning-portfolio-heading",className:`tf-heading-section ${i.paneHeading}`,tabIndex:-1,children:"Portfolio"}),t.jsxs("div",{className:i.headerActions,children:[t.jsx("span",{children:h.length+H.length}),t.jsx("button",{type:"button",className:`tf-control-icon ${y?i.controlActive:""}`.trim(),onClick:()=>V(n=>!n),disabled:!ue,"aria-label":y?"Hide archived planning items":"Show archived planning items","aria-pressed":y,title:ue?y?"Hide archived planning items":"Show archived planning items":"No archived planning items",children:y?t.jsx(Je,{size:15,"aria-hidden":"true"}):t.jsx(Xe,{size:15,"aria-hidden":"true"})})]})]}),t.jsxs("div",{className:i.portfolioControls,children:[t.jsxs("div",{className:i.searchRow,children:[t.jsxs("div",{className:i.searchShell,children:[t.jsx(Ye,{size:14,"aria-hidden":"true"}),t.jsx("input",{type:"search",value:N,onChange:n=>j(n.target.value),placeholder:"Search initiatives and workstreams","aria-label":"Search planning"}),N?t.jsx("button",{type:"button",className:i.clearSearch,onClick:()=>j(""),"aria-label":"Clear planning search",title:"Clear search",children:t.jsx(Ze,{size:13,"aria-hidden":"true"})}):null]}),t.jsx("button",{type:"button",className:`tf-control-icon ${$||A!=="all"||w!=="default"?i.controlActive:""}`.trim(),"aria-label":"Filter and sort planning",title:"Filter and sort planning","aria-expanded":$,"aria-controls":"planning-workspace-navigator-options",onClick:()=>L(n=>!n),children:t.jsx(et,{size:15,"aria-hidden":"true"})})]}),$?t.jsxs("div",{id:"planning-workspace-navigator-options",className:i.filterPanel,children:[t.jsxs("div",{className:i.filterField,children:[t.jsx("span",{className:i.filterLabel,children:"Owner"}),t.jsx(re,{value:A,options:e.assigneeOptions,leadingOptions:F,includeUnassigned:!1,onChange:T,disabled:!1,ariaLabel:"Filter planning by owner",className:i.filterDropdown})]}),t.jsxs("div",{className:i.filterField,children:[t.jsx("span",{className:i.filterLabel,children:"Sort"}),t.jsx(Pe,{value:w,options:ge,onChange:n=>B(String(n)),ariaLabel:"Sort planning",className:i.filterDropdown,portalPanel:!0,panelAlign:"start",triggerContent:t.jsxs("span",{className:i.sortTrigger,children:[t.jsx(tt,{size:14,"aria-hidden":"true"}),t.jsx("span",{children:ge.find(n=>n.value===w)?.label})]}),renderOptionContent:n=>n.label})]}),t.jsx("button",{type:"button",className:"tf-control-icon",onClick:Ae,disabled:!Ne,"aria-label":"Reset planning filters and sort",title:"Reset planning filters and sort",children:t.jsx(se,{size:14,"aria-hidden":"true"})})]}):null]}),t.jsxs("div",{className:i.scrollRegion,children:[t.jsxs("div",{className:i.sectionHeadingRow,children:[t.jsx("h3",{className:`tf-heading-section ${i.sectionLabel}`,children:"Initiatives"}),e.createEntity?t.jsx("button",{type:"button",className:"tf-control-icon",onClick:()=>g({entityType:"initiative"}),"aria-label":"Create initiative",title:"Create initiative",children:t.jsx(ne,{size:15,"aria-hidden":"true"})}):null]}),E?.entityType==="initiative"?t.jsx(Y,{entityType:"initiative",mode:"create",ownerOptions:e.assigneeOptions,onCancel:()=>g(null),onSave:Z}):null,c.initiatives.map(({initiative:n,workstreams:o})=>t.jsx(an,{initiative:n,workstreamCount:o.length,ownerOption:n.ownerId?O.get(n.ownerId):void 0,ownerOptions:e.assigneeOptions,selected:l===n.id,onSelect:()=>Se(n.id),onChangeOwner:e.changeOwner?v=>e.changeOwner?.("initiative",n.id,v==="unassigned"?"":v):void 0,onChangeIdentity:e.changeIdentity?v=>e.changeIdentity?.("initiative",n.id,v):void 0},n.id)),t.jsxs("div",{className:i.sectionHeadingRow,children:[t.jsx("h3",{className:`tf-heading-section ${i.sectionLabel}`,children:"Standalone workstreams"}),e.createEntity?t.jsx("button",{type:"button",className:"tf-control-icon",onClick:()=>g({entityType:"workstream",initiativeId:null}),"aria-label":"Create standalone workstream",title:"Create standalone workstream",children:t.jsx(ne,{size:15,"aria-hidden":"true"})}):null]}),E?.entityType==="workstream"&&!E.initiativeId?t.jsx(Y,{entityType:"workstream",mode:"create",ownerOptions:e.assigneeOptions,fixedInitiativeId:null,onCancel:()=>g(null),onSave:Z}):null,H.map(n=>t.jsx(we,{workstream:n,ownerOption:n.ownerId?O.get(n.ownerId):void 0,ownerOptions:e.assigneeOptions,selected:m===n.id,onSelect:()=>he(n),onChangeOwner:e.changeOwner?o=>e.changeOwner?.("workstream",n.id,o==="unassigned"?"":o):void 0,onChangeIdentity:e.changeIdentity?o=>e.changeIdentity?.("workstream",n.id,o):void 0},n.id)),h.length===0&&H.length===0&&t.jsx("p",{className:`tf-text-helper ${i.empty}`,children:c.hasCriteria?"No planning matches.":"No planning items yet."})]})]}),t.jsxs("section",{className:`${i.column} ${i.columnWorkstreams} ${f==="workstreams"?i.columnActive:""}`.trim(),"aria-labelledby":"planning-workstreams-heading",children:[t.jsxs("div",{className:i.columnHeader,children:[t.jsxs("div",{className:i.columnHeadingGroup,children:[t.jsx("button",{type:"button",className:`tf-control-icon ${i.responsiveBack}`.trim(),onClick:()=>X("portfolio"),"aria-label":"Back to Portfolio",title:"Back to Portfolio",children:t.jsx(me,{size:15,"aria-hidden":"true"})}),t.jsxs("h2",{ref:P,id:"planning-workstreams-heading",className:`tf-heading-section ${i.paneHeading}`,tabIndex:-1,children:["Workstreams (",d.length,")"]})]}),t.jsx("div",{className:i.headerActions,children:s&&e.createEntity?t.jsx("button",{type:"button",className:"tf-control-icon",onClick:()=>g({entityType:"workstream",initiativeId:s.id}),"aria-label":`Create workstream in ${s.title}`,title:"Create workstream",children:t.jsx(ne,{size:15,"aria-hidden":"true"})}):null})]}),t.jsxs("div",{className:i.scrollRegion,children:[s?t.jsxs(t.Fragment,{children:[t.jsx(xe,{item:s,entityType:"initiative",ownerOptions:e.assigneeOptions,onChangeOwner:e.changeOwner?n=>e.changeOwner?.("initiative",s.id,n):void 0,onChangeIdentity:e.changeIdentity,workspaceId:e.currentWorkspaceId,currentActorId:e.currentOwnerId,taskReferences:e.taskReferences,hydrationState:r?void 0:de,onRetryHydration:e.hydrateEntity?()=>{e.hydrateEntity?.("initiative",s.id)}:void 0,onAddContextFile:e.addContextFile,onRemoveContextFile:e.removeContextFile,onUpdateContextCaption:e.updateContextCaption,onUpdate:e.updateEntity?n=>e.updateEntity("initiative",s.id,n):void 0,onArchive:e.archiveEntity?()=>e.archiveEntity("initiative",s.id):void 0,onUnarchive:e.unarchiveEntity?()=>e.unarchiveEntity("initiative",s.id):void 0}),t.jsx(ee,{options:Ce,entityLabel:"workstream",onSelect:n=>ve("workstream",n),disabled:!e.attachWorkstreamToInitiative||u})]}):null,E?.entityType==="workstream"&&E.initiativeId===s?.id?t.jsx(Y,{entityType:"workstream",mode:"create",ownerOptions:e.assigneeOptions,fixedInitiativeId:s.id,onCancel:()=>g(null),onSave:Z}):null,d.map(n=>t.jsx(we,{workstream:n,ownerOption:n.ownerId?O.get(n.ownerId):void 0,ownerOptions:e.assigneeOptions,selected:m===n.id,onSelect:()=>he(n),onChangeOwner:e.changeOwner?o=>e.changeOwner?.("workstream",n.id,o==="unassigned"?"":o):void 0,onChangeIdentity:e.changeIdentity?o=>e.changeIdentity?.("workstream",n.id,o):void 0,referenceAction:s?t.jsx(te,{disabled:!e.assignWorkstreamToInitiative||u,onClick:()=>R({entityType:"workstream",id:n.id,referenceLabel:U(n),title:n.title,parentLabel:s?`${J(s)} ${s.title}`.trim():"its initiative"}),title:`Unlink ${U(n)||n.title} from initiative`,ariaLabel:`Unlink ${U(n)||n.title} from initiative`,children:t.jsx(ie,{size:14,"aria-hidden":"true"})}):void 0},n.id)),s&&S?.pane==="workstreams"?pe:null,d.length===0&&t.jsx("p",{className:`tf-text-helper ${i.empty}`,children:"Select an initiative or standalone workstream."})]})]}),t.jsxs("section",{className:`${i.column} ${i.columnTasks} ${f==="tasks"?i.columnActive:""}`.trim(),"aria-labelledby":"planning-tasks-heading",children:[t.jsx("div",{className:i.columnHeader,children:t.jsxs("div",{className:i.columnHeadingGroup,children:[t.jsx("button",{type:"button",className:`tf-control-icon ${i.responsiveBack}`.trim(),onClick:Ie,"aria-label":s?"Back to Workstreams":"Back to Portfolio",title:s?"Back to Workstreams":"Back to Portfolio",children:t.jsx(me,{size:15,"aria-hidden":"true"})}),t.jsxs("h2",{ref:D,id:"planning-tasks-heading",className:`tf-heading-section ${i.paneHeading}`,tabIndex:-1,children:["Tasks (",G.length,")"]})]})}),t.jsxs("div",{className:i.scrollRegion,children:[r?t.jsxs(t.Fragment,{children:[t.jsx(xe,{item:r,entityType:"workstream",ownerOptions:e.assigneeOptions,onChangeOwner:e.changeOwner?n=>e.changeOwner?.("workstream",r.id,n):void 0,workspaceId:e.currentWorkspaceId,currentActorId:e.currentOwnerId,taskReferences:e.taskReferences,hydrationState:de,onRetryHydration:e.hydrateEntity?()=>{e.hydrateEntity?.("workstream",r.id)}:void 0,onAddContextFile:e.addContextFile,onRemoveContextFile:e.removeContextFile,onUpdateContextCaption:e.updateContextCaption,onUpdate:e.updateEntity?n=>e.updateEntity("workstream",r.id,n):void 0,onArchive:e.archiveEntity?()=>e.archiveEntity("workstream",r.id):void 0,onUnarchive:e.unarchiveEntity?()=>e.unarchiveEntity("workstream",r.id):void 0,referenceAction:r.initiativeId?t.jsx(te,{disabled:!e.assignWorkstreamToInitiative||u,onClick:()=>{R({entityType:"workstream",id:r.id,referenceLabel:U(r),title:r.title,parentLabel:s?`${J(s)} ${s.title}`.trim():"its initiative"})},title:"Unlink workstream from initiative",ariaLabel:"Unlink workstream from initiative",children:t.jsx(ie,{size:14,"aria-hidden":"true"})}):t.jsx(ee,{options:e.linkOptions.initiatives,entityLabel:"initiative",onSelect:Re,disabled:!e.assignWorkstreamToInitiative||u,iconTrigger:!0,triggerTitle:"Link initiative"})}),t.jsx(ee,{options:Ee,entityLabel:"task",onSelect:n=>ve("task",n),disabled:!e.attachTaskToWorkstream||u}),e.setTaskArrangeMode?t.jsx(De,{value:M,onChange:e.setTaskArrangeMode}):null]}):null,t.jsx(Fe,{tasks:G,mode:M,onReorder:r&&e.reorderWorkstreamTasks?n=>e.reorderWorkstreamTasks?.(r.id,Me(ye(r.tasks??[],"execution"),n)):void 0,children:n=>{const o=He(n);return t.jsx(Be,{task:n,assigneeOption:n.assignee?O.get(n.assignee):void 0,assigneeOptions:e.assigneeOptions,showStatusLabel:e.showTaskCardStatusLabel,onOpen:()=>e.openTask(n.id),onAssigneeChange:e.setTaskAssignee?v=>e.setTaskAssignee?.(n.id,v):void 0,onStatusChange:e.setTaskStatus?v=>e.setTaskStatus?.(n.id,v):void 0,referenceInteractive:!1,referenceAction:t.jsx(te,{disabled:!e.assignTaskToWorkstream||u,onClick:v=>{v.stopPropagation(),R({entityType:"task",id:n.id,referenceLabel:o||n.id,title:n.title,parentLabel:r?`${U(r)} ${r.title}`.trim():"its workstream"})},title:`Unlink ${o||n.title} from workstream`,ariaLabel:`Unlink ${o||n.title} from workstream`,children:t.jsx(ie,{size:14,"aria-hidden":"true"})})},n.id)}}),r&&S?.pane==="tasks"?pe:null,!r&&t.jsx("p",{className:`tf-text-helper ${i.empty}`,children:"Select a workstream."}),r&&G.length===0&&t.jsx("p",{className:`tf-text-helper ${i.empty}`,children:"No tasks are linked to this workstream."})]})]})]}),t.jsx(Ue,{item:x,busy:u,theme:e.theme,onCancel:()=>R(null),onConfirm:()=>{Oe()}})]})}export{un as PlanningModule};
@@ -0,0 +1 @@
1
+ import{r as s,j as e}from"./vendor-react-CKJs5o3c.js";import{aN as ye,t as Oe,aO as Ke,aP as ke,aQ as ge,aR as he,aS as He,aT as qe}from"./index-I5zhdtgt.js";import{bn as ze,w as Ye,K as We}from"./vendor-icons-D9Lpw-j4.js";import{u as Ge,a as Qe}from"./vendor-router-AqJMU8Lz.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";const Je="_plansWrapper_ojftl_1",Xe="_contentFrame_ojftl_24",Ze="_shellOwnsScroll_ojftl_32",et="_withChrome_ojftl_38",tt="_siteVariant_ojftl_42",nt="_title_ojftl_56",rt="_subtitle_ojftl_71",at="_header_ojftl_78",it="_planCard_ojftl_93",st="_grid_ojftl_106",ot="_pricingNotes_ojftl_114",ct="_planName_ojftl_123",lt="_featureText_ojftl_130",ut="_currentBadge_ojftl_134",dt="_navAction_ojftl_138",mt="_backBtn_ojftl_139",pt="_priceRows_ojftl_150",ft="_foundingBeta_ojftl_154",gt="_cloudCapacityNote_ojftl_176",ht="_headerBar_ojftl_258",yt="_headerActions_ojftl_267",_t="_debugMeta_ojftl_318",Ct="_planNoticeCard_ojftl_381",bt="_planDescription_ojftl_392",St="_teamComingSoonCard_ojftl_397",jt="_clickablePlanCard_ojftl_416",wt="_activePlanCard_ojftl_431",vt="_callToAction_ojftl_495",xt="_primaryCta_ojftl_507",Nt="_secondaryCta_ojftl_518",kt="_currentCta_ojftl_530",Pt="_featuresList_ojftl_544",It="_priceRow_ojftl_150",At="_regularPriceLine_ojftl_568",Tt="_campaignPriceLine_ojftl_569",Lt="_priceRowWithCampaign_ojftl_576",Rt="_priceRowAmount_ojftl_580",Et="_regularPriceDiscounted_ojftl_586",Bt="_priceRowInterval_ojftl_592",$t="_campaignPriceLabel_ojftl_601",Mt="_campaignPriceAmount_ojftl_606",Ut="_campaignPriceInterval_ojftl_612",Dt="_ctaRow_ojftl_617",Ft="_featureItem_ojftl_623",Vt="_featureIcon_ojftl_629",Ot="_featureLimitAccent_ojftl_643",Kt="_featureLimitUnit_ojftl_654",Ht="_featureTextBlock_ojftl_660",qt="_featureDescription_ojftl_666",zt="_emptyState_ojftl_672",Yt="_marketingEmptyState_ojftl_681",Wt="_emptyBadge_ojftl_715",Gt="_emptyHighlights_ojftl_730",Qt="_loader_ojftl_752",Jt="_spinner_ojftl_762",Xt="_statusBanner_ojftl_815",Zt="_successBanner_ojftl_823",en="_infoBanner_ojftl_829",tn="_errorBanner_ojftl_835",r={plansWrapper:Je,contentFrame:Xe,shellOwnsScroll:Ze,withChrome:et,siteVariant:tt,title:nt,subtitle:rt,header:at,planCard:it,grid:st,pricingNotes:ot,planName:ct,featureText:lt,currentBadge:ut,navAction:dt,backBtn:mt,priceRows:pt,foundingBeta:ft,cloudCapacityNote:gt,headerBar:ht,headerActions:yt,debugMeta:_t,planNoticeCard:Ct,planDescription:bt,teamComingSoonCard:St,clickablePlanCard:jt,activePlanCard:wt,callToAction:vt,primaryCta:xt,secondaryCta:Nt,currentCta:kt,featuresList:Pt,priceRow:It,regularPriceLine:At,campaignPriceLine:Tt,priceRowWithCampaign:Lt,priceRowAmount:Rt,regularPriceDiscounted:Et,priceRowInterval:Bt,campaignPriceLabel:$t,campaignPriceAmount:Mt,campaignPriceInterval:Ut,ctaRow:Dt,featureItem:Ft,featureIcon:Vt,featureLimitAccent:Ot,featureLimitUnit:Kt,featureTextBlock:Ht,featureDescription:qt,emptyState:zt,marketingEmptyState:Yt,emptyBadge:Wt,emptyHighlights:Gt,loader:Qt,spinner:Jt,statusBanner:Xt,successBanner:Zt,infoBanner:en,errorBanner:tn};function nn(){const t=globalThis.__DEBUG_MODE__;return typeof t=="boolean"?t:!1}function rn(t){const a=String(t?.environment||"").trim(),c=String(t?.runtimeMode||"").trim();return!a&&!c?null:a&&c?`${a} (${c})`:a||c||null}const an=new Set(["a","b","br","em","i","li","ol","p","strong","u","ul"]);function sn(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function on(t){const a=String(t||"").trim();if(!a)return"";if(typeof document>"u")return sn(a);const c=document.createElement("template");c.innerHTML=a;const p=document.createElement("div"),l=C=>{if(C.nodeType===Node.TEXT_NODE)return document.createTextNode(C.textContent||"");if(C.nodeType!==Node.ELEMENT_NODE)return null;const E=C,P=E.tagName.toLowerCase();if(P==="script"||P==="style")return null;const $=Array.from(E.childNodes).map(l).filter(h=>!!h);if(!an.has(P)){const h=document.createDocumentFragment();for(const W of $)h.appendChild(W);return h}const v=document.createElement(P);if(P==="a"){const h=String(E.getAttribute("href")||"").trim();/^(https?:|mailto:|\/|#)/i.test(h)&&(v.setAttribute("href",h),v.setAttribute("rel","noopener noreferrer"))}for(const h of $)v.appendChild(h);return v};for(const C of Array.from(c.content.childNodes)){const E=l(C);E&&p.appendChild(E)}return p.innerHTML}function cn(t,a){if(t==null||!a)return"Contact Sales";try{return new Intl.NumberFormat("en-US",{style:"currency",currency:a.toUpperCase(),minimumFractionDigits:0}).format(t/100)}catch{return`${a.toUpperCase()} ${t/100}`}}function ln(){return"$0"}function O(t){return t?t.pricingType==="free"?!0:t.unitAmount!=null&&t.currency!=null:!1}function Te(t){return t?t.pricingType==="free"?ln():cn(t.unitAmount,t.currency):"Unavailable"}function Le(t,a){return O(a)?{price:a,pricingAudience:"campaign"}:{price:t,pricingAudience:"public"}}function un(t,a,c,p){const l=O(t)||O(c),C=O(a)||O(p);if(!l&&!C)return null;const E=(P,$,v)=>{if(!O(P)&&!O($))return null;const h=O($),W=v==="year"?"year":"month";return e.jsxs("div",{className:`${r.priceRow} ${h?r.priceRowWithCampaign:""}`,children:[O(P)?e.jsxs("div",{className:r.regularPriceLine,children:[e.jsx("span",{className:`${r.priceRowAmount} ${h?r.regularPriceDiscounted:""}`,children:Te(P)}),e.jsxs("span",{className:r.priceRowInterval,children:["/ ",W]})]}):null,h?e.jsxs("div",{className:r.campaignPriceLine,children:[e.jsx("span",{className:r.campaignPriceLabel,children:"Founding Offer:"}),e.jsx("span",{className:r.campaignPriceAmount,children:Te($)}),e.jsxs("span",{className:r.campaignPriceInterval,children:["/ ",W]})]}):null]},v)};return e.jsxs("div",{className:r.priceRows,children:[E(t,c,"month"),E(a,p,"year")]})}function Re(t){const a=[t.pricing.month,t.pricing.year].filter(Boolean);if(a.some(p=>p.pricingType==="free"))return 0;const c=a.map(p=>p.pricingType==="stripe"&&typeof p.unitAmount=="number"?p.unitAmount:null).filter(p=>p!=null);return c.length>0?Math.min(...c):Number.POSITIVE_INFINITY}function dn(t){return String(t||"").replace(/[_\-.]+/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function Pe(t,a){const c=t?.[a],p=Number(c);return Number.isFinite(p)?Math.max(1,Math.floor(p)):null}const Ee="Unlimited";function we(t,a){return a!==1?t:t.replace(/\b([A-Za-z]+)ies\b$/,"$1y").replace(/\b([A-Za-z]+[^s\s])s\b$/,"$1")}function mn(t){return t<=1e3?{value:String(t),unit:"MB"}:{value:String(Math.round(t/1e3)),unit:"GB"}}function pn(t,a){const c=String(t.publicLabel||t.label||"").trim()||dn(t.featureKey),p=t.config&&typeof t.config=="object"?t.config:{};if(t.featureKey==="context.uploads"){const l=Pe(p,"storageLimitMb");if(l!==null){const C=mn(l);return{limitValue:C.value,limitUnit:C.unit,baseLabel:we(c,l)}}}if(t.featureKey==="workspace.workspaces"){const l=Pe(p,"maxWorkspaces");if(l!==null)return{limitValue:String(l),limitUnit:null,baseLabel:we(c,l)};if(t.access!=="disabled")return{limitValue:Ee,limitUnit:null,baseLabel:c}}if(t.featureKey==="collaboration.ai_profiles"){const l=Pe(p,"maxAiProfiles");if(l!==null)return{limitValue:String(l),limitUnit:null,baseLabel:we(c,l)};if(t.access!=="disabled")return{limitValue:Ee,limitUnit:null,baseLabel:c}}if(t.featureKey==="collaboration.team_management"){const l=Number(a);if(Number.isFinite(l)&&l>0){const C=Math.floor(l);return{limitValue:String(C),limitUnit:null,baseLabel:we(c,C)}}}return{limitValue:null,limitUnit:null,baseLabel:c}}function fn({heading:t,subtitle:a,variant:c="app",theme:p="dark",chrome:l,footer:C,isAuthenticated:E,authSessionResolved:P=!0,currentPlanId:$,currentPlanVersionId:v,currentEntitlementState:h,markCurrentPlan:W,canManageCurrentPlan:G=!0,pricingEndpoint:I,statusBanner:H,onBack:A,backLabel:T,backDisabled:M=!1,topActions:se,shellOwnsScroll:_e=!1,showPageBackButton:X=!0,showHeaderBarWithChrome:re=!1,preferPricingPageTitle:Ce=!0,currentPlanCardActionMode:be="manage",fallbackPricingSource:g=null,onSelectPlan:q}){const[Z,Q]=s.useState([]),[oe,F]=s.useState(null),[x,L]=s.useState({pageTitle:null,pageDescription:null}),[ce,z]=s.useState(!0),[le,ue]=s.useState(null),[Se,ee]=s.useState(0);s.useEffect(()=>{let i=!0;return(async()=>{const D=String(I||"/api/taskforce/public/pricing").trim()||"/api/taskforce/public/pricing";i&&(z(!0),ue(null));try{const w=await fetch(D,{method:"GET",credentials:"include"}),u=await w.json().catch(()=>({}));if(w.ok){i&&(Q(Array.isArray(u?.plans)?u.plans:[]),F(u?.pricingSource&&typeof u.pricingSource=="object"?u.pricingSource:null),L({pageTitle:typeof u?.pageTitle=="string"&&u.pageTitle.trim()||null,pageDescription:typeof u?.pageDescription=="string"&&u.pageDescription.trim()||null}));return}throw new Error(String(u?.error||`Failed to load pricing (${w.status})`))}catch(w){if(i){const u=w instanceof Error?w.message:"Failed to load pricing";ue(u||"Failed to load pricing"),F(null),L({pageTitle:null,pageDescription:null})}}finally{i&&z(!1)}})(),()=>{i=!1}},[I,Se]);const J=s.useMemo(()=>[...Z].sort((i,U)=>{const D=Re(i),w=Re(U);if(D!==w)return D-w;const u=i.defaultVersion?.versionNumber||0,V=U.defaultVersion?.versionNumber||0;return u!==V?u-V:String(i.displayName||i.planId).localeCompare(String(U.displayName||U.planId))}),[Z]),de=s.useMemo(()=>rn(oe||g),[g,oe]),ve=String((Ce?x.pageTitle:null)||t).trim()||t,me=String(x.pageDescription||a||"").trim(),j=s.useMemo(()=>on(me),[me]),te=P,pe=`${r.plansWrapper} ${_e?r.shellOwnsScroll:"tf-scrollbar"} ${c==="site"?r.siteVariant:""} ${l?r.withChrome:""}`.trim(),B=i=>_e?e.jsxs(e.Fragment,{children:[l,i,C]}):e.jsxs("div",{className:Oe.standaloneWrapper,"data-theme":p,children:[l,i,C]});return B(ce?e.jsx(e.Fragment,{children:e.jsx("div",{className:pe,children:e.jsx("div",{className:r.contentFrame,children:e.jsxs("div",{className:r.loader,children:[e.jsx(Ye,{size:48,className:r.spinner}),e.jsx("p",{children:"Loading plans..."})]})})})}):le?e.jsx(e.Fragment,{children:e.jsx("div",{className:pe,children:e.jsx("div",{className:r.contentFrame,children:e.jsxs("div",{className:r.emptyState,children:[e.jsx("h2",{children:"Connecting to plan pricing..."}),e.jsx("p",{children:le}),e.jsx("button",{className:r.backBtn,onClick:()=>ee(i=>i+1),children:"Retry"})]})})})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:pe,children:e.jsxs("div",{className:r.contentFrame,children:[e.jsxs("div",{className:r.header,children:[(!l||re)&&(X||se)&&e.jsxs("div",{className:r.headerBar,children:[e.jsx("div",{children:X?e.jsx("button",{className:r.backBtn,onClick:A,disabled:M,children:T}):null}),e.jsx("div",{className:r.headerActions,children:se})]}),e.jsx("h1",{className:r.title,children:ve}),j&&e.jsx("div",{className:r.subtitle,dangerouslySetInnerHTML:{__html:j}}),nn()&&de?e.jsxs("p",{className:r.debugMeta,children:["Pricing source: ",de]}):null,H&&e.jsx("div",{className:`${r.statusBanner} ${H.type==="success"?r.successBanner:H.type==="info"?r.infoBanner:r.errorBanner}`,children:H.message})]}),e.jsxs("section",{className:r.foundingBeta,"aria-labelledby":"founding-beta-heading",children:[e.jsx("h2",{id:"founding-beta-heading",children:"Founding beta"}),e.jsx("p",{children:"Taskforce is in founding beta. You may run into rough edges while we improve cloud workspaces and agent workflows. Early members get access while the product is still forming, plus a direct role in shaping what comes next."})]}),J.length===0?e.jsxs("div",{className:`${r.emptyState} ${r.marketingEmptyState}`,children:[e.jsx("span",{className:r.emptyBadge,children:"Coming Soon"}),e.jsx("h2",{children:"Paid plans are getting their final polish."}),e.jsx("p",{children:"Taskforce pricing is on the way with flexible options for solo operators, teams, and larger rollouts. Check back soon for launch tiers, feature bundles, and early access details."}),e.jsxs("div",{className:r.emptyHighlights,"aria-label":"Upcoming pricing highlights",children:[e.jsx("span",{children:"Launch-ready tiers"}),e.jsx("span",{children:"Team billing controls"}),e.jsx("span",{children:"Feature-based packaging"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r.grid,children:J.map(i=>{const U=i.pricing.month,D=i.pricing.year,w=i.campaignPricing?.month||null,u=i.campaignPricing?.year||null,V=Le(U,w),K=Le(D,u),Y=O(V.price),ae=O(K.price),ie=Y&&ae,N=String(i.defaultVersion?.planVersionId||"").trim(),xe=ye(h),fe=W??xe,Ne=!!(N&&v&&v===N)||!!(!v&&($&&$===i.planId)),ne=fe&&Ne&&h!=="canceled",n=Y?"month":ae?"year":null,o=n==="year"?K:V,_=be==="manage",f=be==="indicator",y=te&&!!N&&(ne?_&&G:!!n),m=()=>{if(N){if(ne){if(!_||!G)return;q({planId:i.planId,planVersionId:N,interval:n||"month",pricingType:o.price?.pricingType||"stripe",pricingAudience:o.pricingAudience,isCurrentPlan:!0});return}n&&q({planId:i.planId,planVersionId:N,interval:n,pricingType:o.price?.pricingType||"stripe",pricingAudience:o.pricingAudience,isCurrentPlan:!1})}};return e.jsxs("div",{className:`${r.planCard} ${ne?r.activePlanCard:""} ${y?r.clickablePlanCard:""}`,"data-testid":`plan-card-${i.planId}`,role:y?"button":void 0,tabIndex:y?0:void 0,onClick:y?m:void 0,onKeyDown:y?d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),m())}:void 0,children:[ne&&e.jsx("span",{className:r.currentBadge,children:"Current Plan"}),e.jsx("h3",{className:r.planName,children:i.displayName}),un(U,D,w,u),String(i.description||"").trim()&&e.jsx("p",{className:r.planDescription,children:String(i.description||"").trim()}),e.jsx("div",{className:r.featuresList,children:Array.isArray(i.features)&&i.features.length>0?i.features.map((d,S)=>e.jsxs("div",{className:r.featureItem,children:[e.jsx(ze,{className:r.featureIcon}),e.jsxs("div",{className:r.featureTextBlock,children:[(()=>{const{limitValue:k,limitUnit:b,baseLabel:R}=pn(d,i.defaultVersion?.seatLimit);return e.jsxs("span",{className:r.featureText,children:[k&&e.jsxs("span",{className:r.featureLimitAccent,children:[e.jsx("span",{children:k}),b?e.jsx("span",{className:r.featureLimitUnit,children:b}):null]}),e.jsx("span",{children:k?` ${R}`:R})]})})(),d.publicDescriptionVisible!==!1&&String(d.publicDescription||d.description||"").trim()&&e.jsx("span",{className:r.featureDescription,children:String(d.publicDescription||d.description||"").trim()})]})]},`${d.featureKey}-${S}`)):e.jsx("span",{className:r.featureText,children:"No additional features included"})}),ne?_?e.jsx("button",{className:`${r.callToAction} ${r.currentCta}`,"data-testid":`plan-manage-${i.planId}`,onClick:d=>{d.stopPropagation(),G&&q({planId:i.planId,planVersionId:N,interval:n||"month",pricingType:o.price?.pricingType||"stripe",pricingAudience:o.pricingAudience,isCurrentPlan:!0})},disabled:!N||!G||!te,children:E&&G?"Manage Plan":"Current Plan"}):f?e.jsx("button",{className:`${r.callToAction} ${r.currentCta}`,"data-testid":`plan-current-${i.planId}`,disabled:!0,children:"Current Plan"}):null:e.jsxs("div",{className:r.ctaRow,children:[Y?e.jsx("button",{className:`${r.callToAction} ${r.secondaryCta}`,"data-testid":`plan-select-${i.planId}-month`,onClick:d=>{d.stopPropagation(),q({planId:i.planId,planVersionId:N,interval:"month",pricingType:V.price?.pricingType||"stripe",pricingAudience:V.pricingAudience,isCurrentPlan:!1})},disabled:!N||!te,children:ie?"Start Monthly":"Get Started"}):null,ae?e.jsx("button",{className:`${r.callToAction} ${r.primaryCta}`,"data-testid":`plan-select-${i.planId}-year`,onClick:d=>{d.stopPropagation(),q({planId:i.planId,planVersionId:N,interval:"year",pricingType:K.price?.pricingType||"stripe",pricingAudience:K.pricingAudience,isCurrentPlan:!1})},disabled:!N||!te,children:ie?"Start Yearly":"Get Started"}):null]})]},i.planId)})}),e.jsxs("div",{className:r.pricingNotes,children:[e.jsx("p",{children:"Prices are listed in USD. Taxes may apply."}),e.jsx("p",{children:"Local install is free on every plan. Cloud limits apply only to hosted workspaces."})]}),e.jsxs("section",{className:`${r.foundingBeta} ${r.cloudCapacityNote}`,"aria-labelledby":"cloud-capacity-heading",children:[e.jsx("h2",{id:"cloud-capacity-heading",children:"Need more cloud capacity?"}),e.jsx("p",{children:"Pro users can request expanded limits for cloud workspaces, AI agents, and storage."}),e.jsxs("p",{children:["Contact ",e.jsx("a",{href:"mailto:support@taskforcehq.ai",children:"support@taskforcehq.ai"})," to discuss capacity needs."]})]}),e.jsxs("div",{className:`${r.planCard} ${r.planNoticeCard} ${r.teamComingSoonCard}`,children:[e.jsx("h2",{className:r.planName,children:"Team workspaces are coming soon."}),e.jsx("p",{className:r.planDescription,children:"Shared workspaces, collaborators, team agent rosters, admin controls, and larger cloud limits are in development."})]})]})]})})}))}const gn=1600,Be=[0,500,1e3,2e3],hn=5e3,yn=45e3,_n="Choose a plan to continue.";function Cn(t,a){if(t===401)return!0;const c=String(a||"").trim().toUpperCase();return c==="CHECKOUT_SESSION_INCOMPLETE"||c==="CHECKOUT_PLAN_VERSION_UNRESOLVED"}function bn(t){return t==="year"?"year":"month"}function Sn(t){return t==="campaign"?"campaign":"public"}function Ie(t){const a=String(t||"").trim().toLowerCase();return a==="year"?"year":a==="month"?"month":null}function $e(t){const a=String(t||"").trim();return a?a.replace(/\/+$/,""):""}function Ae(t={}){const a=new URLSearchParams;a.set("screen","plans");for(const[c,p]of Object.entries(t)){const l=String(p||"").trim();l&&a.set(c,l)}return`/?${a.toString()}`}function Tn({isAuthenticated:t,authUserId:a,runtimeMode:c,authSessionResolved:p,currentTheme:l="dark",projectName:C,currentWorkspaceId:E,apiBaseUrl:P,connectedEnvironmentSource:$,resolveCloudAuthUrl:v,embedded:h=!1,shellOwnsScroll:W=!1,onAccountProfileSummaryChange:G,onContinueToTaskforce:I,continueBusy:H=!1}){const A=Ge(),T=Qe(),[M,se]=s.useState(null),[_e,X]=s.useState(!1),[re,Ce]=s.useState(!1),[be,g]=s.useState(null),q=s.useRef(!1),Z=s.useRef(null),Q=s.useRef(null),oe=s.useRef(I),F=s.useMemo(()=>new URLSearchParams(T.search),[T.search]),x=String(F.get("checkout")||"").trim().toLowerCase(),L=String(F.get("gate")||"").trim().toLowerCase(),ce=String(F.get("planId")||"").trim(),z=String(F.get("planVersionId")||"").trim(),le=bn(F.get("interval")),ue=Sn(F.get("pricingAudience")),Se=Ie(F.get("interval")),ee=String(F.get("session_id")||"").trim(),J=s.useMemo(()=>$e(P),[P]),de=s.useMemo(()=>$e($),[$]),ve=s.useMemo(()=>({environment:Ke(de||J),runtimeMode:c==="cloud"?"cloud":"local"}),[J,de,c]),me=s.useCallback(n=>{const o=String(n||"").trim();return J?`${J}${o.startsWith("/")?o:`/${o}`}`:o},[J]),j=s.useCallback(n=>v?v(n):me(n),[me,v]),te=s.useCallback(()=>{const n=new URLSearchParams(T.search);n.delete("screen"),n.delete("gate"),n.delete("checkout"),n.delete("planId"),n.delete("planVersionId"),n.delete("interval"),n.delete("pricingAudience");const o=n.toString();A(`/${o?`?${o}`:""}${T.hash||""}`)},[T.hash,T.search,A]),pe=s.useMemo(()=>j("/api/taskforce/public/pricing"),[j]),B=s.useMemo(()=>ke(M,L),[M,L]),i=s.useMemo(()=>B.allowReturnToApp,[B.allowReturnToApp]),U=s.useMemo(()=>{const n=String(B.message||"").trim();return!n||n===_n?null:n},[B.message]),D=s.useCallback(()=>{const n=new URLSearchParams(T.search);n.delete("checkout"),n.delete("session_id"),n.delete("gate"),n.delete("planId"),n.delete("planVersionId"),n.delete("interval");const o=n.toString();A(`${T.pathname}${o?`?${o}`:""}${T.hash||""}`,{replace:!0})},[T.hash,T.pathname,T.search,A]),w=s.useCallback(()=>{Q.current!=null&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>{D(),Q.current=null},gn)},[D]);s.useEffect(()=>{oe.current=I},[I]);const u=s.useCallback(async n=>{const o=j(ge);if(!t)return se(null),he(o,{identityKey:a}),null;try{const _=await He(o,{identityKey:a,force:n?.force===!0});return se(_),G?.(_),_}catch{return null}},[a,j,t,G]),V=s.useCallback((n,o,_)=>{const f=String(o||"").trim();if(_?.preferFallback&&f)return f;const y=ke(n,L).message;return y||f||"Unable to confirm checkout completion."},[L]),K=s.useCallback((n,o)=>!ke(n,o).allowReturnToApp,[]),Y=s.useCallback(async(n,o,_="public",f)=>{if(!n){g({type:"error",message:"Selected plan is missing a default plan version."});return}X(!0),g(null);try{const y=await fetch(j("/api/taskforce/billing/checkout-session"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({planVersionId:n,interval:o,pricingAudience:_})}),m=await y.json().catch(()=>({}));if(!y.ok){g({type:"error",message:String(m?.error||"Unable to start checkout for selected plan.")});return}const d=String(m?.checkoutState||"").trim().toLowerCase();if(d==="free"){g({type:"success",message:"Plan selected. Your access is ready."}),he(j(ge),{identityKey:a});const b=await u({force:!0}),R=String(b?.entitlementState||"").trim().toLowerCase();f?.autoContinueOnActivation===!0&&ye(R)&&await I?.();return}if(d==="updated"){g({type:"success",message:String(m?.message||"Your subscription was updated successfully.")}),he(j(ge),{identityKey:a});const b=await u({force:!0}),R=String(b?.entitlementState||"").trim().toLowerCase();f?.autoContinueOnActivation===!0&&ye(R)&&await I?.();return}if(d==="already_current_plan"){g({type:"success",message:String(m?.message||"You are already on this plan.")}),he(j(ge),{identityKey:a}),await u();return}const S=String(m?.returnBaseUrl||"").trim();if(c==="local"&&S)try{const b=window.location.origin,R=new URL(S,b).origin;if(R!==b){g({type:"error",message:`Checkout return is misconfigured for this runtime. Expected ${b} but got ${R}.`});return}}catch{g({type:"error",message:"Checkout return URL is invalid for this runtime."});return}const k=String(m?.url||"").trim();if(!k){g({type:"error",message:"Checkout did not return a redirect URL."});return}window.location.assign(k)}catch{g({type:"error",message:"Unable to start checkout for selected plan."})}finally{X(!1)}},[a,j,u,I,c]),ae=s.useCallback(async(n,o)=>{if(!n)return{confirmed:!1,errorMessage:"Checkout session is missing.",retryable:!1};const _=async()=>{he(j(ge),{identityKey:a});const f=await u({force:!0}),y=String(f?.entitlementState||"").trim().toLowerCase();if(!ye(y))return!1;const m=ce,d=z,S=Se,k=String(f?.planId||"").trim(),b=String(f?.planVersionId||"").trim(),R=Ie(f?.billingInterval??null),je=o?.preConfirmationSummary??null,Me=String(je?.entitlementState||"").trim().toLowerCase(),Ue=ye(Me),De=String(je?.planId||"").trim(),Fe=String(je?.planVersionId||"").trim(),Ve=Ie(je?.billingInterval??null);return m&&k&&k!==m||d&&b&&b!==d||S&&R&&R!==S||Ue&&!(!!m&&k===m&&De!==k)&&!(!!d&&b===d&&Fe!==b)&&!(!!S&&R===S&&Ve!==R)?!1:(o?.autoContinueOnActivation===!0&&await oe.current?.(),!0)};try{const f=await fetch(j("/api/taskforce/billing/checkout-session/confirm"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:n})}),y=await f.json().catch(()=>({}));if(!f.ok){const m=String(y?.code||"").trim(),d=Cn(f.status,m);return d&&await _()?{confirmed:!0}:{confirmed:!1,errorMessage:String(y?.error||"Unable to confirm checkout completion."),retryable:d}}return await _()?{confirmed:!0}:{confirmed:!0}}catch{return{confirmed:!1,errorMessage:"Unable to confirm checkout completion.",retryable:!0}}},[a,j,u,Se,ce,z]),ie=s.useCallback(async()=>{if(!t){A(`/login?mode=login&next=${encodeURIComponent(Ae())}`);return}X(!0),g({type:"info",message:"Opening billing portal..."});try{const n=await fetch(j("/api/taskforce/billing/portal-session"),{method:"POST",credentials:"include"}),o=await n.json().catch(()=>({}));if(!n.ok){g({type:"error",message:String(o?.error||"Failed to open billing portal.")});return}const _=String(o?.url||"").trim();if(!_){g({type:"error",message:"Portal session did not return a redirect URL."});return}window.location.assign(_)}catch{g({type:"error",message:"Failed to open billing portal."})}finally{X(!1)}},[j,t,A]),N=s.useCallback(async()=>{if(!(!I||re||H)){Ce(!0);try{await I()}finally{Ce(!1)}}},[re,H,I]);s.useEffect(()=>{u()},[u]),s.useEffect(()=>{i&&L==="missing_entitlement"&&D()},[D,L,i]),s.useEffect(()=>()=>{Q.current!=null&&window.clearTimeout(Q.current)},[]),s.useEffect(()=>{x!=="success"&&(Z.current=null)},[x]),s.useEffect(()=>{let n=!1;const o=new Set,_=async f=>{f<=0||await new Promise(y=>{const m=window.setTimeout(()=>{o.delete(m),y()},f);o.add(m)})};if(x==="success"){if(q.current=!0,g({type:"success",message:"Checkout completed successfully. Finalizing your plan..."}),!t&&!p)return()=>{n=!0,o.forEach(m=>window.clearTimeout(m)),o.clear()};if(!t)return g({type:"error",message:"Sign in to finish activating your plan."}),()=>{n=!0,o.forEach(m=>window.clearTimeout(m)),o.clear()};const y=ee||"__missing_session__";return Z.current===y?()=>{n=!0,o.forEach(m=>window.clearTimeout(m)),o.clear()}:((async()=>{const m=Date.now(),d=await u({force:!0});if(n)return;let S=ee?{confirmed:!1,errorMessage:"Unable to confirm checkout completion.",retryable:!0}:{confirmed:!1,errorMessage:"Checkout session is missing.",retryable:!1},k=0;for(;;){const b=k<Be.length?Be[k]:hn;if(k+=1,await _(b),n||(S=ee?await ae(ee,{autoContinueOnActivation:K(d,L),preConfirmationSummary:d}):{confirmed:!1,errorMessage:"Checkout session is missing.",retryable:!1},n))return;if(S.confirmed){Z.current=y,g({type:"success",message:"Checkout completed successfully."}),w();return}if(!S.retryable||Date.now()-m>=yn)break}if(!n&&!S.confirmed){const b=await u({force:!0});if(n)return;S.retryable||(Z.current=y),g({type:"error",message:V(b,S.errorMessage,{preferFallback:!S.retryable})}),S.retryable||w();return}})(),()=>{n=!0,o.forEach(m=>window.clearTimeout(m)),o.clear()})}if(x==="cancel"){(async()=>{const f=await u({force:!0});g({type:"error",message:V(f,"Checkout was canceled. No charge was made.")}),w()})();return}if((x==="start"||x==="free")&&t&&z&&!q.current){q.current=!0,(async()=>{const f=await u({force:!0});await Y(z,le,ue,{autoContinueOnActivation:K(f,L)})})();return}},[p,x,ae,L,t,u,le,z,ue,ee,V,w,K,Y]),s.useEffect(()=>{if(!(x==="success"||x==="cancel"||x==="start"||x==="free")){if(U){g({type:B.statusTone,message:U});return}g(n=>!n||n.type!=="error"?n:n.message===B.message?null:n)}},[x,U,B.message,B.statusTone]);const xe=s.useCallback(async n=>{if(!t){const _=n.pricingType==="free"?"free":"start",f=Ae({checkout:_,planId:n.planId,planVersionId:n.planVersionId,interval:n.interval,pricingAudience:n.pricingAudience});A(`/login?mode=register&planId=${encodeURIComponent(n.planId)}&planVersionId=${encodeURIComponent(n.planVersionId)}&interval=${encodeURIComponent(n.interval)}&pricingAudience=${encodeURIComponent(n.pricingAudience)}&next=${encodeURIComponent(f)}`);return}if(n.isCurrentPlan){if(!M?.stripeCustomerId){g({type:"success",message:"Your current plan does not use Stripe billing."});return}await ie();return}const o=K(M,L);if(n.pricingType==="free"){await Y(n.planVersionId,n.interval,n.pricingAudience,{autoContinueOnActivation:o});return}await Y(n.planVersionId,n.interval,n.pricingAudience,{autoContinueOnActivation:o})},[M,L,t,A,ie,K,Y]),fe=s.useCallback(()=>{if(i&&I){N();return}if(h){te();return}if(window.history.length>1){A(-1);return}A("/")},[te,h,N,i,A,I]),Ne=h?null:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:r.navAction,onClick:fe,disabled:H||re||t&&!i,children:i?"Take Me to Taskforce":"Back"}),t&&M?.stripeCustomerId&&e.jsx("button",{className:r.navAction,onClick:()=>{ie()},disabled:_e,children:"Manage billing"}),!t&&e.jsxs("button",{className:r.navAction,onClick:()=>A(`/login?mode=login&next=${encodeURIComponent(Ae())}`),children:[e.jsx(We,{size:16,style:{marginRight:"8px",verticalAlign:"text-bottom"}}),"Sign In"]})]}),ne=h?null:e.jsx(qe,{projectName:C,currentWorkspaceId:E,runtimeMode:c==="cloud"?"cloud":"local",theme:l,onBrandClick:fe,actions:Ne});return e.jsx(fn,{chrome:ne,heading:"Subscription Plans",subtitle:"Manage your subscription and explore available features. Your current plan is highlighted below.",variant:"site",theme:l,isAuthenticated:t,authSessionResolved:p,currentPlanId:String(M?.planId||ce||"").trim()||null,currentPlanVersionId:String(M?.planVersionId||z||"").trim()||null,currentEntitlementState:String(M?.entitlementState||"").trim()||null,markCurrentPlan:B.markCurrentPlan,canManageCurrentPlan:!!M?.stripeCustomerId,pricingEndpoint:pe,statusBanner:be,onBack:fe,backLabel:i?"Take Me to Taskforce":h?"Back to Board":"Back to App",backDisabled:H||re||t&&!i,topActions:null,shellOwnsScroll:W,showPageBackButton:!1,showHeaderBarWithChrome:!1,currentPlanCardActionMode:"manage",fallbackPricingSource:ve,onSelectPlan:xe})}export{Tn as PlansPage};
@@ -0,0 +1 @@
1
+ import{r as h,j as e}from"./vendor-react-CKJs5o3c.js";import{ContextAttachmentManager as g}from"./ContextAttachmentManager-Cj3c7X9y.js";import{f as v,aV as x,aZ as _}from"./index-I5zhdtgt.js";import{w as y,$ as j,aZ as w}from"./vendor-icons-D9Lpw-j4.js";import"./vendor-markdown-_lhNCyq-.js";import"./vendor-dnd-CJ-AjP-Y.js";import"./vendor-router-AqJMU8Lz.js";const I="_group_1y2qv_1",N="_list_1y2qv_9",b="_review_1y2qv_15",C="_icon_1y2qv_43",k="_openIcon_1y2qv_43",A="_copy_1y2qv_44",L="_kindLabel_1y2qv_45",q="_title_1y2qv_53",R="_loading_1y2qv_54",n={group:I,list:N,review:b,icon:C,openIcon:k,copy:A,kindLabel:L,title:q,loading:R};function U(o){return String(o.title||"").trim()||o.image?.displayName||"Image review"}function S({taskId:o,taskReferenceLabel:l,workspaceId:c,apiBaseUrl:r}){const[i,d]=h.useState(null),[m,p]=h.useState(!1);return h.useEffect(()=>{let a=!0;d(null),p(!1);const t=new URLSearchParams({workspaceId:c,taskId:o});return v(`/api/taskforce/annotated-attachments/sessions?${t.toString()}`,{credentials:"include"},r).then(async s=>{if(!s.ok)throw new Error("Failed to load image reviews.");return s.json()}).then(s=>{a&&d(Array.isArray(s?.sessions)?s.sessions:[])}).catch(()=>{a&&(d([]),p(!0))}),()=>{a=!1}},[r,o,c]),i!==null&&i.length===0&&!m?null:e.jsx("section",{className:n.group,"aria-label":"Image reviews",children:i===null?e.jsxs("div",{className:n.loading,"aria-live":"polite",children:[e.jsx(y,{size:14})," Loading image reviews"]}):m?e.jsx("div",{className:n.loading,role:"status",children:"Unable to load image reviews."}):e.jsx("div",{className:n.list,children:i.map(a=>{const t=a.image,s=a.annotations.length,u=!!(t?.assetId&&t.apiUrl);return e.jsxs("button",{type:"button",className:n.review,disabled:!u,onClick:()=>{t&&_({assetId:t.assetId,path:t.apiUrl,displayName:t.displayName,referenceLabel:t.referenceLabel||void 0},{taskId:o,taskReferenceLabel:l,sessionId:a.id})},children:[e.jsx("span",{className:n.icon,children:e.jsx(j,{size:14})}),e.jsxs("span",{className:n.copy,children:[e.jsx("span",{className:n.kindLabel,children:"Image review session"}),e.jsx("span",{className:`${n.title} tf-heading-card`,children:U(a)}),e.jsxs("span",{className:"tf-text-meta",children:[[t?.referenceLabel,t?.displayName].filter(Boolean).join(" · ")||"Image",a.updatedAt?` · Updated ${x(a.updatedAt,{month:"short",day:"numeric",year:"numeric"})}`:""]}),e.jsxs("span",{className:"tf-text-meta",children:[s," ",s===1?"marker":"markers"]})]}),e.jsx(w,{className:n.openIcon,size:14,"aria-hidden":"true"})]},a.id)})})})}function M(o){const{taskId:l,taskReferenceLabel:c,workspaceId:r,apiBaseUrl:i,showImageReviews:d=!1,contextFiles:m,onAddContextFile:p,onRemoveContextFile:a,onUpdateContextCaption:t,cardCoverAssetId:s,onSetCardCover:u,cardCoverDisabled:f}=o;return e.jsx(g,{ownerType:"task",ownerId:l,ownerReferenceLabel:c,workspaceId:r,apiBaseUrl:i,attachments:m,onAddAttachment:p,onRemoveAttachment:a,onUpdateAttachmentCaption:t,cardCoverAssetId:s,onSetCardCover:u,cardCoverDisabled:f,supplementalContent:d&&l&&r?e.jsx(S,{taskId:l,taskReferenceLabel:c,workspaceId:r,apiBaseUrl:i}):null})}export{M as TaskContextUpload};