@viswa-test/test-citation 0.0.254 → 0.0.255

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 (214) hide show
  1. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/helper.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  4. package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.module.css.js +1 -1
  8. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  9. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  11. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  13. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  14. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  15. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  16. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  17. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  18. package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
  19. package/dist/cjs/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
  20. package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
  21. package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  22. package/dist/cjs/features/RequirementAI/components/segment/segment.module.css.js +1 -1
  23. package/dist/cjs/features/RequirementAI/components/story-screen/CompletionPanel.js +1 -1
  24. package/dist/cjs/features/RequirementAI/components/story-screen/CompletionPanel.module.css.js +1 -1
  25. package/dist/cjs/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  26. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  27. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  28. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
  29. package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
  30. package/dist/cjs/service/onDemandApi.js +1 -1
  31. package/dist/cjs/service/redlineService.js +1 -1
  32. package/dist/features/CognitiveCompare/Guidelines/utils/helper.js +1 -1
  33. package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  34. package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  35. package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  36. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  37. package/dist/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.js +1 -1
  38. package/dist/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.module.css.js +1 -1
  39. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  40. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  41. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  42. package/dist/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
  43. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  44. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  45. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  46. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  47. package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  48. package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  49. package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
  50. package/dist/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
  51. package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
  52. package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  53. package/dist/features/RequirementAI/components/segment/segment.module.css.js +1 -1
  54. package/dist/features/RequirementAI/components/story-screen/CompletionPanel.js +1 -1
  55. package/dist/features/RequirementAI/components/story-screen/CompletionPanel.module.css.js +1 -1
  56. package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  57. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  58. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  59. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
  60. package/dist/hooks/useOnDemandCitationFetch.js +1 -1
  61. package/dist/service/onDemandApi.js +1 -1
  62. package/dist/service/redlineService.js +1 -1
  63. package/dist/types/src/CitationAccordionTest.d.ts +1 -0
  64. package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
  65. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  66. package/dist/types/src/CommonConstants/CommonConstants.d.ts +0 -8553
  67. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  68. package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
  69. package/dist/types/src/MockDeviationSummary.d.ts +1 -0
  70. package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
  71. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  72. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  73. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +1446 -905
  74. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  75. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts +33 -0
  76. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts.map +1 -0
  77. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/helper.d.ts.map +1 -1
  78. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
  79. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
  80. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +7 -23
  81. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  82. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  83. package/dist/types/src/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.d.ts.map +1 -1
  84. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts +0 -8
  85. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts.map +1 -1
  86. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -7
  87. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  88. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  89. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts +13 -17
  90. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
  91. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  92. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +3 -15
  93. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  94. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +2 -21
  95. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  96. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
  97. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts +1 -3
  98. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
  99. package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts +2 -3
  100. package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts.map +1 -1
  101. package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts +0 -1
  102. package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts.map +1 -1
  103. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +1 -8
  104. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
  105. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +1 -5
  106. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
  107. package/dist/types/src/features/RequirementAI/components/story-screen/CompletionPanel.d.ts +1 -3
  108. package/dist/types/src/features/RequirementAI/components/story-screen/CompletionPanel.d.ts.map +1 -1
  109. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +1 -3
  110. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  111. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +1 -2
  112. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  113. package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts +1 -18
  114. package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts.map +1 -1
  115. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +1 -32
  116. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  117. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +0 -8
  118. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
  119. package/dist/types/src/service/onDemandApi.d.ts.map +1 -1
  120. package/dist/types/src/service/redlineService.d.ts +0 -6
  121. package/dist/types/src/service/redlineService.d.ts.map +1 -1
  122. package/package.json +2 -2
  123. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  124. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  125. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +0 -2
  126. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +0 -1
  127. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +0 -2
  128. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +0 -1
  129. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +0 -2
  130. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +0 -1
  131. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +0 -2
  132. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +0 -1
  133. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +0 -2
  134. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +0 -1
  135. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +0 -2
  136. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +0 -1
  137. package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +0 -2
  138. package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +0 -1
  139. package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +0 -2
  140. package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +0 -1
  141. package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +0 -2
  142. package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +0 -1
  143. package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +0 -2
  144. package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +0 -1
  145. package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +0 -2
  146. package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +0 -1
  147. package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js +0 -2
  148. package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js.map +0 -1
  149. package/dist/cjs/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js +0 -2
  150. package/dist/cjs/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +0 -1
  151. package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  152. package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  153. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +0 -2
  154. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +0 -1
  155. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +0 -2
  156. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +0 -1
  157. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +0 -2
  158. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +0 -1
  159. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +0 -2
  160. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +0 -1
  161. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +0 -2
  162. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +0 -1
  163. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +0 -2
  164. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +0 -1
  165. package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +0 -2
  166. package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +0 -1
  167. package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +0 -2
  168. package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +0 -1
  169. package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +0 -2
  170. package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +0 -1
  171. package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +0 -2
  172. package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +0 -1
  173. package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +0 -2
  174. package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +0 -1
  175. package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js +0 -2
  176. package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js.map +0 -1
  177. package/dist/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js +0 -2
  178. package/dist/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +0 -1
  179. package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
  180. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
  181. package/dist/types/src/RedlineEditorTest2.d.ts +0 -3
  182. package/dist/types/src/RedlineEditorTest2.d.ts.map +0 -1
  183. package/dist/types/src/commonConstants.d.ts +0 -31103
  184. package/dist/types/src/commonConstants.d.ts.map +0 -1
  185. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -128
  186. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
  187. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -13
  188. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
  189. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +0 -5445
  190. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +0 -1
  191. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts +0 -13
  192. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +0 -1
  193. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts +0 -10
  194. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts.map +0 -1
  195. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +0 -14
  196. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +0 -1
  197. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts +0 -10
  198. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +0 -1
  199. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +0 -30
  200. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +0 -1
  201. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts +0 -4
  202. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts.map +0 -1
  203. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +0 -2
  204. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +0 -1
  205. package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts +0 -11
  206. package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts.map +0 -1
  207. package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts +0 -25
  208. package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts.map +0 -1
  209. package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts +0 -31
  210. package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts.map +0 -1
  211. package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts +0 -13
  212. package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts.map +0 -1
  213. package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts +0 -12
  214. package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t){if("string"!=typeof t||""===t.trim())return null;try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},r=function(t,r){var e;if("string"!=typeof t||"string"!=typeof r||""===r.trim())return"";try{var n=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(e=null==n?void 0:n[2])&&void 0!==e?e:""}catch(t){return""}},e=function(t){if("string"!=typeof t||""===t)return"";try{return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}catch(r){return t}},n=function(t,r,n){if("string"!=typeof t||""===t.trim())return t;if("string"!=typeof r||""===r.trim())return t;if(!n||"string"!=typeof n)return t;try{var a=e(n),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,function(){return"".concat(r,'="').concat(a,'"')}):t.replace(/<a\b/i,function(){return"<a ".concat(r,'="').concat(a,'"')})}catch(r){return t}};exports.mergeRulebookCitationsIntoMatchingLinks=function(a){if("string"!=typeof a||!a||!a.includes("rulebook_citation"))return a;try{var i=a;return Array.from(a.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)).forEach(function(a){var c,o=a[0],u=a[1]||"",s=r(u,"type");if("rulebook_citation"===s){var l=r(u,"reason"),f=r(u,"href").replace(/&amp;/gi,"&"),p=t(f),h=null===(c=((null==p?void 0:p.searchParams.get("citationNumber"))||"").match(/^rb_(.+)$/))||void 0===c?void 0:c[1];if(h){var g={citation_type:(null==p?void 0:p.searchParams.get("citation_type"))||"",phrase_to_highlight:(null==p?void 0:p.searchParams.get("phrase_to_highlight"))||""};if(g.citation_type||g.phrase_to_highlight){var v=!1,y=function(r){var e=t(r.replace(/&amp;/gi,"&"));return(null==e?void 0:e.searchParams.get("citationNumber"))!==h?r:(v=!0,function(r,e){if("string"!=typeof r||""===r.trim())return r;if(!e||"object"!=typeof e)return r;try{var n=t(r);if(!n)return r;Object.entries(e).forEach(function(t){var r=t[0],e=t[1];e&&n.searchParams.set(r,e)});var a="".concat(n.pathname).concat(n.search).concat(n.hash);return r.startsWith("./")?".".concat(a):!r.startsWith("/")&&a.startsWith("/")?a.slice(1):a}catch(t){return r}}(r,g))};i=i.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,n){var a=y(n);return a===n?t:'<a type="'.concat(e(s),'" reason="').concat(e(l),'" href="').concat(e(a),'">').concat(r,"</a>")}),v||(i=i.replace(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>/gi,function(t,e){if("rulebook_citation"===r(e,"type"))return t;var a=r(e,"href"),i=y(a);if(i===a)return t;var c=t.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(i).concat(r)});return n(n(c,"type",s),"reason",l)})),i=i.split(o).join("")}else i=i.split(o).join("")}else i=i.split(o).join("")}}),i}catch(t){return a}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t){if("string"!=typeof t||""===t.trim())return null;try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},r=function(t,r){var e;if("string"!=typeof t||"string"!=typeof r||""===r.trim())return"";try{var n=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(e=null==n?void 0:n[2])&&void 0!==e?e:""}catch(t){return""}},e=function(t){if("string"!=typeof t||""===t)return"";try{return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}catch(r){return t}},n=function(t,r,n){if("string"!=typeof t||""===t.trim())return t;if("string"!=typeof r||""===r.trim())return t;if(!n||"string"!=typeof n)return t;try{var a=e(n),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,function(){return"".concat(r,'="').concat(a,'"')}):t.replace(/<a\b/i,function(){return"<a ".concat(r,'="').concat(a,'"')})}catch(r){return t}};exports.mergeRulebookCitationsIntoMatchingLinks=function(a){if("string"!=typeof a||!a||!a.includes("citation_type"))return a;try{var i=a;return Array.from(a.matchAll(/<a\b([^>]*?)>([\s\S]*?)<\/a>/gi)).forEach(function(a){var c=a[0],o=a[1]||"",u=r(o,"href").replace(/&amp;/gi,"&"),s=t(u),l=r(o,"type"),f=null==s?void 0:s.searchParams.get("citation_type");if("rulebook_citation"===l||"il_rulebook_citation"===f){l||(l=f||"rulebook_citation");var h=r(o,"reason"),p=(null==s?void 0:s.searchParams.get("citationNumber"))||(null==s?void 0:s.searchParams.get("citation_number"))||"",g=p.match(/^rb_(.+)$/),v=g?g[1]:p;if(v){var y={citation_type:f||"",phrase_to_highlight:(null==s?void 0:s.searchParams.get("phrase_to_highlight"))||""};if(y.citation_type||y.phrase_to_highlight){var m=!1,_=function(r){return function(r){if("string"!=typeof r||!r)return null;var e=r.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(e)return e[1];try{var n=t(r.replace(/&amp;/gi,"&"));return(null==n?void 0:n.searchParams.get("citationNumber"))||(null==n?void 0:n.searchParams.get("citation_number"))||null}catch(t){return null}}(r)!==v?r:(m=!0,function(r,e){if("string"!=typeof r||""===r.trim())return r;if(!e||"object"!=typeof e)return r;try{var n=t(r);if(!n)return r;Object.entries(e).forEach(function(t){var r=t[0],e=t[1];e&&n.searchParams.set(r,e)});var a="".concat(n.pathname).concat(n.search).concat(n.hash);return r.startsWith("./")?".".concat(a):!r.startsWith("/")&&a.startsWith("/")?a.slice(1):a}catch(t){return r}}(r,y))};i=i.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,n){var a=_(n);return a===n?t:'<a type="'.concat(e(l),'" reason="').concat(e(h),'" href="').concat(e(a),'">').concat(r,"</a>")}),m||(i=i.replace(/<a\b([^>]*?)>/gi,function(e,a){var i,c=r(a,"type")||(null===(i=t(r(a,"href")))||void 0===i?void 0:i.searchParams.get("citation_type"));if("rulebook_citation"===c||"il_rulebook_citation"===c)return e;var o=r(a,"href"),u=_(o);if(u===o)return e;var s=e.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(u).concat(r)});return n(n(s,"type",l),"reason",h)})),i=i.split(c).join("")}else i=i.split(c).join("")}else i=i.split(c).join("")}}),i}catch(t){return a}};
2
2
  //# sourceMappingURL=helper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.processGuidelinesMarkdown=function(e){var t,a,n=e.guidelinesData,o=e.targetHighlights,r=void 0===o?[]:o,i=e.labelColor,c=void 0===i?"#FEF08A":i,l=(null===(a=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.artifactData)||void 0===a?void 0:a.userStorySnapshot)||[],u="";return l.forEach(function(e){var t;e.title&&(u+="### ".concat(e.title,"\n\n")),e.value&&(u+="".concat(e.value,"\n\n")),null===(t=e.sub_features)||void 0===t||t.forEach(function(e){e.title&&(u+="#### ".concat(e.title,"\n\n")),e.value&&(u+="".concat(e.value,"\n\n"))})}),r.forEach(function(e,t){var a=e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),n=new RegExp("(".concat(a,")"),"g");u=u.replace(n,'<mark id="guideline-target-'.concat(t,'" style="background-color: ').concat(c,'; border-radius: 3px; padding: 2px;">$1</mark>'))}),u};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.processGuidelinesMarkdown=function(t){var a,n,e=t.guidelinesData,o=t.targetHighlights,i=void 0===o?[]:o,r=t.labelColor,l=void 0===r?"#FEF08A":r,c="";if((null==e?void 0:e.learnings_data)&&Object.keys(e.learnings_data).length>0){var u=Object.keys(e.learnings_data)[0],d=e.learnings_data[u];(null==d?void 0:d.instruction_prompt)&&(c=d.instruction_prompt)}else{((null===(n=null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.artifactData)||void 0===n?void 0:n.userStorySnapshot)||[]).forEach(function(t){var a;t.title&&(c+="### ".concat(t.title,"\n\n")),t.value&&(c+="".concat(t.value,"\n\n")),null===(a=t.sub_features)||void 0===a||a.forEach(function(t){t.title&&(c+="#### ".concat(t.title,"\n\n")),t.value&&(c+="".concat(t.value,"\n\n"))})})}return i.forEach(function(t,a){var n=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e=new RegExp("(".concat(n,")"),"g");c=c.replace(e,'<mark id="guideline-target-'.concat(a,'" style="background-color: ').concat(l,'; border-radius: 3px; padding: 2px;">$1</mark>'))}),c};
2
2
  //# sourceMappingURL=processGuidelinesMarkdown.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react"),t=require("../CognitiveComparehelpers.js"),i={id:"",title:"",similarity:0,sections:[]};exports.useCognitiveTreeData=function(o,r,a,s,d,l){var u,v;void 0===d&&(d=!0);var c="string"==typeof a?a:JSON.stringify(a||{}),f=Boolean(l&&(null===(v=null===(u=l.data)||void 0===u?void 0:u.artifactData)||void 0===v?void 0:v.userStorySnapshot)),p=e.useMemo(function(){var e;if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var i=JSON.parse(c);try{var a=o.nodes||o,s=[],u=[],v=o.base_root_id,p=o.input_index_map||{0:"left",1:"right"},_=o[v]||a[v];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var I=o.content_mapping||{},g=function(n){return o[n]||a[n]},h=function(e,i,o){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(d)return e;var r=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!r.length)return e;var a=r.sort(function(n,e){return Number(n)-Number(e)}),s={},l={},u=null;return a.forEach(function(n){var r,a,d,v,c,f=e[n];if(f&&"object"==typeof f){u||(u=f);var _=!(null==f?void 0:f.status)||"pending"===f.status,I=function(n){var e,t=(null===(e=null==f?void 0:f.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==f?void 0:f.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},g=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var i=0,o=n;i<o.length;i++){var r=o[i];if(Array.isArray(r)&&r.some(function(n){return!t.isMissingStr(n)}))return r}return[]},h=_?g((null===(a=null==f?void 0:f.deviation_highlights)||void 0===a?void 0:a[i])||(null===(d=null==f?void 0:f.deviation_highlights)||void 0===d?void 0:d[p[0]]),I(i),I(p[0])):[],m=_?g((null===(v=null==f?void 0:f.deviation_highlights)||void 0===v?void 0:v[o])||(null===(c=null==f?void 0:f.deviation_highlights)||void 0===c?void 0:c[p[1]]),I(o),I(p[1])):[];s[n]=((r={})[p[0]]=h[0]||"",r[p[1]]=m[0]||"",r.deviation_summary=(null==f?void 0:f.deviation_summary)||"",r.deviation_title=null==f?void 0:f.deviation_title,r.deviation_impact=null==f?void 0:f.deviation_impact,r.deviation_explanation=null==f?void 0:f.deviation_explanation,r.evaluation_outputs=null==f?void 0:f.evaluation_outputs,r.cognitive_decisioning=null==f?void 0:f.cognitive_decisioning,r.deviation_highlights=null==f?void 0:f.deviation_highlights,r),l[n]=f}}),n.__assign(n.__assign({},e),{deviation_title:(null==u?void 0:u.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==u?void 0:u.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==u?void 0:u.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:s,deviation_entries:l})},m=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var s=e.get(a);s.subsections||(s.subsections=[]),s.subsections.some(function(e){return e.id===n.id})||s.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},s=0,d=n;s<d.length;s++){a(d[s])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},y=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=p[0],i=p[1];return e.length>0&&(t=e.includes(p[0])?p[0]:e[0],i=e.includes(p[1])?p[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},x=function(e,i,o,r){var a=i.attributes||{},s=i.data||{},d=!1!==a.display_title,l=!1!==a.display_content,u=d?t.safeStringify(s.title||""):"",v=l?t.safeStringify(s.content||""):"",c=l?t.safeStringify(s.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),_=!(!u.trim()&&!v.trim());return n.__assign(n.__assign({id:"".concat(e,"::").concat(i.contentId),nodeId:e,contentId:i.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:d,displayContent:l,subsections:[]},_?r:{score:void 0,relation:"not_defined"}),{evaluationResult:o,evaluationResults:o?[o]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},b=function(e,t){e.refIndexes=Array.from(new Set(n.__spreadArray(n.__spreadArray([],e.refIndexes||[],!0),t.refIndexes||[],!0))),e.refContentIds=Array.from(new Set(n.__spreadArray(n.__spreadArray([],e.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((e.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(e.subsections=n.__spreadArray(n.__spreadArray([],e.subsections||[],!0),[t],!1),i.add(o))});var o=n.__spreadArray(n.__spreadArray([],e.evaluationResults||(e.evaluationResult?[e.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return e.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!e.evaluationResult&&t.evaluationResult&&(e.evaluationResult=t.evaluationResult),!e.cognitiveData&&t.cognitiveData&&(e.cognitiveData=t.cognitiveData),e},R=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},C=function(e,o){var r,a=g(e);if(!a||!1===a.display_node)return[];if(f&&"1"===o)return[];var s=y(a),d=s.nodeLeftId,l=s.nodeRightId,u=t.getRationale(a),v=(null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.evaluation_result)||a.evaluation_result||null,c=h(v,d,l),_=c&&"object"==typeof c?n.__assign(n.__assign({},c),{nodeId:e}):c,m=t.resolveComparisonInputItems(a,o,p,I).map(function(n){return x(e,n,_,u)});if(a.next){var b=Object.values(a.next).flatMap(function(n){return C(n,o)});m.forEach(function(n){var e=b.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:b})}return m};if(r){var S=function(e,o){var r;void 0===o&&(o=0);var a=[],s=[];if(!e)return{refSections:a,baseSections:s};var d={},l={},u=-1,v=-1,c=function(a){var s=e[a],c=g(s);if(!c||!1===c.display_node)return"continue";var _=y(c),m=_.nodeLeftId,R=_.nodeRightId,C=t.getRationale(c),E=(null===(r=null==i?void 0:i[s])||void 0===r?void 0:r.evaluation_result)||c.evaluation_result||null,O=h(E,m,R),N=O&&"object"==typeof O?n.__assign(n.__assign({},O),{nodeId:s}):O,j=S(c.next,o+1),A=j.refSections,D=j.baseSections,M=t.resolveComparisonInputItems(c,"0",p,I).map(function(n){var e=x(s,n,N,C);return-1===e.selfIndex&&(e.selfIndex=v--),e}),P=[];if(!f){var k=t.resolveComparisonInputItems(c,"1",p,I);P=k.map(function(n){var e=x(s,n,N,C);return-1===e.selfIndex&&(e.selfIndex=u--),e})}M.forEach(function(n){P.forEach(function(e){var t,i,o,r,a,s,d,l;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(s=e.refContentIds)||void 0===s||s.push(n.contentId)),e.contentId&&!(null===(d=n.refContentIds)||void 0===d?void 0:d.includes(e.contentId))&&(null===(l=n.refContentIds)||void 0===l||l.push(e.contentId))})}),P.forEach(function(n){var e=A.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===o?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||s);d[t]=d[t]?b(d[t],n):n}),M.forEach(function(n){var e=D.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===o?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||s);l[t]=l[t]?b(l[t],n):n})};for(var _ in e)c(_);return a=Object.values(d),s=Object.values(l),a.sort(R),s.sort(R),{refSections:a,baseSections:s}},E=S(_.next),O=E.refSections,N=E.baseSections;f||(u=m(O)),s=N}else _.next&&Object.values(_.next).forEach(function(n){var e=g(n);e&&!1!==e.display_node&&(s.push.apply(s,C(n,"0")),f||u.push.apply(u,C(n,"1")))}),f||(u=m(u));var j=t.getSideData(_,"0",p,I),A=t.getSideData(_,"1",p,I);return{activeProposed:{title:j.title||"Uploaded Contract",description:_.decision_scope_description||"",sections:s},activeVariants:[{id:"tree-variant-1",title:f?(null===(e=null==l?void 0:l.data)||void 0===e?void 0:e.artifactTitle)||"Rulebook Guidelines":A.title||"Reference Template",similarity:0,sections:u,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[o,r,c,d,l]),_=p.activeProposed,I=p.activeVariants,g=p.parseError,h=(null==I?void 0:I[0])||i,m=e.useMemo(function(){return(null==_?void 0:_.sections)||[]},[null==_?void 0:_.sections]),y=e.useMemo(function(){return h.sections||[]},[h.sections]),x=m.length>0||y.length>0,b=e.useMemo(function(){return s.fields.filter(function(n){var e=n.key;return(!x||"description"!==e)&&(t.hasValue(null==_?void 0:_[e])||t.hasValue(h[e]))})},[_,h,x,s.fields]),R=e.useMemo(function(){var n,e,i={},a={},s={},d=0,l=null===(n=null==o?void 0:o.input_index_map)||void 0===n?void 0:n[0],u=null===(e=null==o?void 0:o.input_index_map)||void 0===e?void 0:e[1],v=function(n,e){if(!r){var t="left"===e?m.indexOf(n):y.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:m.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var a=n.selfIndex,s=m.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(a)});if(s){var d=s.selfIndex,l=void 0!==d&&d>=0?d+1:m.indexOf(s)+1;return{rootKey:"left-root:".concat(s.id),parentNum:l}}var u=void 0!==a&&a>=0?a+1:y.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:u}},c=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,o,r,v,f,_){if(e&&function(n,e,i){var o;((null===(o=null==n?void 0:n.evaluationResults)||void 0===o?void 0:o.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(o){var r=(null==o?void 0:o.deviations)||{};Object.keys(r).sort().forEach(function(d){var v=r[d];if(v){var c=!t.isMissingStr(v[l]),f=!t.isMissingStr(v[u]);if(c||f){var p=(null==o?void 0:o.nodeId)||n.nodeId||n.id,_="".concat(p).concat(t.DEVIATION_BADGE_SEPARATOR).concat(d);void 0===a[_]&&(void 0===s[e]&&(s[e]=1),a[_]={index:s[e]++,rootKey:e,parentNum:i})}}})})}(e,r,v),e&&!f){var I=(null==_?void 0:_.id)||"fallback_parent_".concat(d++);i[I]||(i[I]=[]),i[I].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==o?void 0:o.subsections)||[]).forEach(function(t){var i=c(null==n?void 0:n.subsections,t),a=c(null==o?void 0:o.subsections,t);p(t,i,a,r,v,!1,e||_)})};m.forEach(function(n){var e,t=v(n,"left"),i=t.rootKey,o=t.parentNum,a=null;if(r){var s=null===(e=n.refIndexes)||void 0===e?void 0:e[0];a=y.find(function(n){return n.selfIndex===s})}else a=y[m.indexOf(n)];p(n,n,a,i,o,!0,n)}),f||y.forEach(function(n){var e=v(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var _=Object.fromEntries(Object.entries(a).map(function(n){return[n[0],n[1].index]})),I=Object.fromEntries(Object.entries(a).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:i,registry:_,deviationParentRegistry:I}},[m,y,r,o,f]),C=R.parentDeviationRecord,S=R.registry,E=R.deviationParentRegistry;return{isGuidelineMode:f,activeProposed:_,activeVariants:I,existingRule:h,proposedSections:m,existingSections:y,visibleFields:b,parentDeviationRecord:C,deviationNumberRegistry:S,deviationParentRegistry:E,parseError:g}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react"),t=require("../CognitiveComparehelpers.js"),i={id:"",title:"",similarity:0,sections:[]};exports.useCognitiveTreeData=function(o,r,a,s,d,l){var u,v;void 0===d&&(d=!0);var c="string"==typeof a?a:JSON.stringify(a||{}),f=Boolean(l&&(l.learnings_data||(null===(v=null===(u=l.data)||void 0===u?void 0:u.artifactData)||void 0===v?void 0:v.userStorySnapshot))),p=e.useMemo(function(){if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var e=JSON.parse(c);try{var i=o.nodes||o,a=[],s=[],u=o.base_root_id,v=o.input_index_map||{0:"left",1:"right"},p=o[u]||i[u];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var _=o.content_mapping||{},I=function(n){return o[n]||i[n]},g=function(e,i,o){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(d)return e;var r=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!r.length)return e;var a=r.sort(function(n,e){return Number(n)-Number(e)}),s={},l={},u=null;return a.forEach(function(n){var r,a,d,c,f,p=e[n];if(p&&"object"==typeof p){u||(u=p);var _=!(null==p?void 0:p.status)||"pending"===p.status,I=function(n){var e,t=(null===(e=null==p?void 0:p.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==p?void 0:p.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},g=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var i=0,o=n;i<o.length;i++){var r=o[i];if(Array.isArray(r)&&r.some(function(n){return!t.isMissingStr(n)}))return r}return[]},h=_?g((null===(a=null==p?void 0:p.deviation_highlights)||void 0===a?void 0:a[i])||(null===(d=null==p?void 0:p.deviation_highlights)||void 0===d?void 0:d[v[0]]),I(i),I(v[0])):[],m=_?g((null===(c=null==p?void 0:p.deviation_highlights)||void 0===c?void 0:c[o])||(null===(f=null==p?void 0:p.deviation_highlights)||void 0===f?void 0:f[v[1]]),I(o),I(v[1])):[];s[n]=((r={})[v[0]]=h[0]||"",r[v[1]]=m[0]||"",r.deviation_summary=(null==p?void 0:p.deviation_summary)||"",r.deviation_title=null==p?void 0:p.deviation_title,r.deviation_impact=null==p?void 0:p.deviation_impact,r.deviation_explanation=null==p?void 0:p.deviation_explanation,r.evaluation_outputs=null==p?void 0:p.evaluation_outputs,r.cognitive_decisioning=null==p?void 0:p.cognitive_decisioning,r.deviation_highlights=null==p?void 0:p.deviation_highlights,r),l[n]=p}}),n.__assign(n.__assign({},e),{deviation_title:(null==u?void 0:u.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==u?void 0:u.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==u?void 0:u.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:s,deviation_entries:l})},h=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var s=e.get(a);s.subsections||(s.subsections=[]),s.subsections.some(function(e){return e.id===n.id})||s.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},s=0,d=n;s<d.length;s++){a(d[s])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},m=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=v[0],i=v[1];return e.length>0&&(t=e.includes(v[0])?v[0]:e[0],i=e.includes(v[1])?v[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},y=function(e,i,o,r){var a=i.attributes||{},s=i.data||{},d=!1!==a.display_title,l=!1!==a.display_content,u=d?t.safeStringify(s.title||""):"",v=l?t.safeStringify(s.content||""):"",c=l?t.safeStringify(s.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),_=!(!u.trim()&&!v.trim());return n.__assign(n.__assign({id:"".concat(e,"::").concat(i.contentId),nodeId:e,contentId:i.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:d,displayContent:l,subsections:[]},_?r:{score:void 0,relation:"not_defined"}),{evaluationResult:o,evaluationResults:o?[o]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},x=function(e,t){e.refIndexes=Array.from(new Set(n.__spreadArray(n.__spreadArray([],e.refIndexes||[],!0),t.refIndexes||[],!0))),e.refContentIds=Array.from(new Set(n.__spreadArray(n.__spreadArray([],e.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((e.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(e.subsections=n.__spreadArray(n.__spreadArray([],e.subsections||[],!0),[t],!1),i.add(o))});var o=n.__spreadArray(n.__spreadArray([],e.evaluationResults||(e.evaluationResult?[e.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return e.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!e.evaluationResult&&t.evaluationResult&&(e.evaluationResult=t.evaluationResult),!e.cognitiveData&&t.cognitiveData&&(e.cognitiveData=t.cognitiveData),e},b=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},R=function(i,o){var r,a=I(i);if(!a||!1===a.display_node)return[];if(f&&"1"===o)return[];var s=m(a),d=s.nodeLeftId,l=s.nodeRightId,u=t.getRationale(a),c=(null===(r=null==e?void 0:e[i])||void 0===r?void 0:r.evaluation_result)||a.evaluation_result||null,p=g(c,d,l),h=p&&"object"==typeof p?n.__assign(n.__assign({},p),{nodeId:i}):p,x=t.resolveComparisonInputItems(a,o,v,_).map(function(n){return y(i,n,h,u)});if(a.next){var b=Object.values(a.next).flatMap(function(n){return R(n,o)});x.forEach(function(n){var e=b.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:b})}return x};if(r){var C=function(i,o){var r;void 0===o&&(o=0);var a=[],s=[];if(!i)return{refSections:a,baseSections:s};var d={},l={},u=-1,c=-1,p=function(a){var s=i[a],p=I(s);if(!p||!1===p.display_node)return"continue";var h=m(p),b=h.nodeLeftId,R=h.nodeRightId,S=t.getRationale(p),E=(null===(r=null==e?void 0:e[s])||void 0===r?void 0:r.evaluation_result)||p.evaluation_result||null,O=g(E,b,R),N=O&&"object"==typeof O?n.__assign(n.__assign({},O),{nodeId:s}):O,j=C(p.next,o+1),A=j.refSections,D=j.baseSections,k=t.resolveComparisonInputItems(p,"0",v,_).map(function(n){var e=y(s,n,N,S);return-1===e.selfIndex&&(e.selfIndex=c--),e}),M=[];if(!f){var P=t.resolveComparisonInputItems(p,"1",v,_);M=P.map(function(n){var e=y(s,n,N,S);return-1===e.selfIndex&&(e.selfIndex=u--),e})}k.forEach(function(n){M.forEach(function(e){var t,i,o,r,a,s,d,l;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(s=e.refContentIds)||void 0===s||s.push(n.contentId)),e.contentId&&!(null===(d=n.refContentIds)||void 0===d?void 0:d.includes(e.contentId))&&(null===(l=n.refContentIds)||void 0===l||l.push(e.contentId))})}),M.forEach(function(n){var e=A.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===o?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||s);d[t]=d[t]?x(d[t],n):n}),k.forEach(function(n){var e=D.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===o?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||s);l[t]=l[t]?x(l[t],n):n})};for(var h in i)p(h);return a=Object.values(d),s=Object.values(l),a.sort(b),s.sort(b),{refSections:a,baseSections:s}},S=C(p.next),E=S.refSections,O=S.baseSections;f||(s=h(E)),a=O}else p.next&&Object.values(p.next).forEach(function(n){var e=I(n);e&&!1!==e.display_node&&(a.push.apply(a,R(n,"0")),f||s.push.apply(s,R(n,"1")))}),f||(s=h(s));var N=t.getSideData(p,"0",v,_),j=t.getSideData(p,"1",v,_),A={title:N.title||"Uploaded Contract",description:p.decision_scope_description||"",sections:a},D={id:"tree-variant-1",title:f?function(){var n,e;if((null==l?void 0:l.learnings_data)&&Object.keys(l.learnings_data).length>0){var t=Object.keys(l.learnings_data)[0];return(null===(n=l.learnings_data[t])||void 0===n?void 0:n.title)||"Rulebook Guidelines"}return(null===(e=null==l?void 0:l.data)||void 0===e?void 0:e.artifactTitle)||"Rulebook Guidelines"}():j.title||"Reference Template",similarity:0,sections:s,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}};return{activeProposed:A,activeVariants:[D],parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[o,r,c,d,l]),_=p.activeProposed,I=p.activeVariants,g=p.parseError,h=(null==I?void 0:I[0])||i,m=e.useMemo(function(){return(null==_?void 0:_.sections)||[]},[null==_?void 0:_.sections]),y=e.useMemo(function(){return h.sections||[]},[h.sections]),x=m.length>0||y.length>0,b=e.useMemo(function(){return s.fields.filter(function(n){var e=n.key;return(!x||"description"!==e)&&(t.hasValue(null==_?void 0:_[e])||t.hasValue(h[e]))})},[_,h,x,s.fields]),R=e.useMemo(function(){var n,e,i={},a={},s={},d=0,l=null===(n=null==o?void 0:o.input_index_map)||void 0===n?void 0:n[0],u=null===(e=null==o?void 0:o.input_index_map)||void 0===e?void 0:e[1],v=function(n,e){if(!r){var t="left"===e?m.indexOf(n):y.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:m.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var a=n.selfIndex,s=m.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(a)});if(s){var d=s.selfIndex,l=void 0!==d&&d>=0?d+1:m.indexOf(s)+1;return{rootKey:"left-root:".concat(s.id),parentNum:l}}var u=void 0!==a&&a>=0?a+1:y.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:u}},c=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,o,r,v,f,_){if(e&&function(n,e,i){var o;((null===(o=null==n?void 0:n.evaluationResults)||void 0===o?void 0:o.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(o){var r=(null==o?void 0:o.deviations)||{};Object.keys(r).sort().forEach(function(d){var v=r[d];if(v){var c=!t.isMissingStr(v[l]),f=!t.isMissingStr(v[u]);if(c||f){var p=(null==o?void 0:o.nodeId)||n.nodeId||n.id,_="".concat(p).concat(t.DEVIATION_BADGE_SEPARATOR).concat(d);void 0===a[_]&&(void 0===s[e]&&(s[e]=1),a[_]={index:s[e]++,rootKey:e,parentNum:i})}}})})}(e,r,v),e&&!f){var I=(null==_?void 0:_.id)||"fallback_parent_".concat(d++);i[I]||(i[I]=[]),i[I].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==o?void 0:o.subsections)||[]).forEach(function(t){var i=c(null==n?void 0:n.subsections,t),a=c(null==o?void 0:o.subsections,t);p(t,i,a,r,v,!1,e||_)})};m.forEach(function(n){var e,t=v(n,"left"),i=t.rootKey,o=t.parentNum,a=null;if(r){var s=null===(e=n.refIndexes)||void 0===e?void 0:e[0];a=y.find(function(n){return n.selfIndex===s})}else a=y[m.indexOf(n)];p(n,n,a,i,o,!0,n)}),f||y.forEach(function(n){var e=v(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var _=Object.fromEntries(Object.entries(a).map(function(n){return[n[0],n[1].index]})),I=Object.fromEntries(Object.entries(a).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:i,registry:_,deviationParentRegistry:I}},[m,y,r,o,f]),C=R.parentDeviationRecord,S=R.registry,E=R.deviationParentRegistry;return{isGuidelineMode:f,activeProposed:_,activeVariants:I,existingRule:h,proposedSections:m,existingSections:y,visibleFields:b,parentDeviationRecord:C,deviationNumberRegistry:S,deviationParentRegistry:E,parseError:g}};
2
2
  //# sourceMappingURL=useCompareData.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../store/ref.context.js");require("../UserStoryCard/cws/CwsEvent.js");var i,o=require("../UserStoryCard/cws/CwsEventProvider.js"),r=require("react-hot-toast");exports.SectionStatus=void 0,(i=exports.SectionStatus||(exports.SectionStatus={})).WAITING="waiting",i.IN_PROGRESS="in_progress",i.GENERATED="generated",i.FAILED="failed",i.GENERATE="generate",i.APPROVED="approved";const s=t.createContext(null),a="user-story-lib";exports.ToasterId=a,exports.default=({children:i,userStory:u,setUserStory:l,aiReasoning:d,setAiReasoning:c,citations:g,setCitations:C,apiCachingConfig:f,customStyles:p,customIcons:h,searchQueryList:v,searchQueryReasoningIdList:m,citationConfig:S,chatHistory:I,chatCitationConfigs:R,gptCitationConfigs:x,diffEditConfig:y,aiReasoningAccordionOpenStates:E,persistedDataFiles:A,inlineUpdateComponentConfig:b,segmentComponentConfig:j,onEditBlocked:w,inlineManualComponentConfig:P,redlineConfig:q,sectionStatusConfig:D,customSectionConfig:U,updateRedlineDataParent:N,redlineCollaborativeConfig:T})=>{const[_,k]=t.useState(0),[F,L]=t.useState(""),M=t.useMemo(()=>{if(0===u.length||0===d.length)return Array(u.length).fill(0);const e=Array.from({length:u.length},()=>[]);return d.forEach(t=>{const n=Number(t.relevance_score);if(isNaN(n)||n<=0)return;const i=`ai_reasoning$${t.id}`,o=u.findIndex(e=>{var t;return e.value.includes(i)||(null===(t=e.sub_features)||void 0===t?void 0:t.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(n)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,t)=>e+t,0)/e.length))},[u,d]),O=t.useCallback(e=>{var t;const n=u.findIndex(t=>t.artifactId===e);return-1===n?0:null!==(t=M[n])&&void 0!==t?t:0},[u,M]);return e.jsxs(s.Provider,{value:{chatHistory:I,userStory:u,setUserStory:l,aiReasoning:d,setAiReasoning:c,citations:g,setCitations:C,apiCachingConfig:f,customStyles:p,customIcons:h,searchQueryList:v,searchQueryReasoningIdList:m,citationConfig:S,getAvgScoreForStory:O,chatCitationConfigs:R,gptCitationConfigs:x,diffEditConfig:y,aiReasoningAccordionOpenStates:E,persistedDataFiles:A,currentHighlightIndex:_,setCurrentHighlightIndex:k,inlineUpdateComponentConfig:b,segmentComponentConfig:j,onEditBlocked:w,inlineManualComponentConfig:P,redlineConfig:q,redlineDcoumentId:F,setRedlineDocumentId:L,sectionStatusConfig:D,customSectionConfig:U,updateRedlineDataParent:N,redlineCollaborativeConfig:T},children:[e.jsx(r.Toaster,{position:"top-right",toasterId:a}),(null==T?void 0:T.initiateCollaborativeFlow)?e.jsx(o.default,{applicationId:null==T?void 0:T.modeId,baseUrl:null==T?void 0:T.cwsBaseUrl,authToken:null==T?void 0:T.authToken,children:e.jsx(n.RefProvider,{children:i})}):e.jsx(n.RefProvider,{children:i})]})},exports.useRequirementAI=()=>{const e=t.useContext(s);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),n=require("react"),i=require("../../store/ref.context.js");exports.SectionStatus=void 0,(e=exports.SectionStatus||(exports.SectionStatus={})).WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved";const o=n.createContext(null);exports.default=({children:e,userStory:r,setUserStory:s,aiReasoning:a,setAiReasoning:u,citations:c,setCitations:d,apiCachingConfig:g,customStyles:l,customIcons:f,searchQueryList:C,searchQueryReasoningIdList:p,citationConfig:h,chatHistory:m,chatCitationConfigs:S,gptCitationConfigs:R,diffEditConfig:I,aiReasoningAccordionOpenStates:v,persistedDataFiles:x,inlineUpdateComponentConfig:y,segmentComponentConfig:A,onEditBlocked:E,inlineManualComponentConfig:D,redlineConfig:P,sectionStatusConfig:N,customSectionConfig:_,updateRedlineDataParent:q})=>{const[b,j]=n.useState(0),[L,M]=n.useState(""),O=n.useMemo(()=>{if(0===r.length||0===a.length)return Array(r.length).fill(0);const e=Array.from({length:r.length},()=>[]);return a.forEach(t=>{const n=Number(t.relevance_score);if(isNaN(n)||n<=0)return;const i=`ai_reasoning$${t.id}`,o=r.findIndex(e=>{var t;return e.value.includes(i)||(null===(t=e.sub_features)||void 0===t?void 0:t.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(n)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,t)=>e+t,0)/e.length))},[r,a]),w=n.useCallback(e=>{var t;const n=r.findIndex(t=>t.artifactId===e);return-1===n?0:null!==(t=O[n])&&void 0!==t?t:0},[r,O]);return t.jsx(o.Provider,{value:{chatHistory:m,userStory:r,setUserStory:s,aiReasoning:a,setAiReasoning:u,citations:c,setCitations:d,apiCachingConfig:g,customStyles:l,customIcons:f,searchQueryList:C,searchQueryReasoningIdList:p,citationConfig:h,getAvgScoreForStory:w,chatCitationConfigs:S,gptCitationConfigs:R,diffEditConfig:I,aiReasoningAccordionOpenStates:v,persistedDataFiles:x,currentHighlightIndex:b,setCurrentHighlightIndex:j,inlineUpdateComponentConfig:y,segmentComponentConfig:A,onEditBlocked:E,inlineManualComponentConfig:D,redlineConfig:P,redlineDcoumentId:L,setRedlineDocumentId:M,sectionStatusConfig:N,customSectionConfig:_,updateRedlineDataParent:q},children:t.jsx(i.RefProvider,{children:e})})},exports.useRequirementAI=()=>{const e=n.useContext(o);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};
2
2
  //# sourceMappingURL=RequirementAIWrapper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./Editor/constants/editorConfig.js"),n=require("./Editor/Editor.js"),a=require("../../store/ref.context.js"),o=require("@lexical/html"),l=require("turndown"),s=require("turndown-plugin-gfm"),i=require("../UnsavedChangesPopup/UnsavedChangesPopup.js"),c=require("../../../../utils/tagHelper.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=new(u(l).default)({headingStyle:"atx",codeBlockStyle:"fenced"}),p=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d.keep(["ins","del","mark"]),d.addRule("ai-reasoning-link-passthrough",{filter:e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r},replacement:(e,t)=>{const r=t,n=r.getAttribute("href")||"",a=r.textContent||"";return`<a href="${o=n,p(o).replace(/"/g,"&quot;")}">${p(a)}</a>`;var o}}),d.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),d.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),d.use(s.tables);const h=e=>(e||"").replace(/\r\n/g,"\n").trim(),g=t.forwardRef(({type:l,value:s,handleUpdateState:u,onBlur:p,placeholder:g,minHeight:f,height:m,mode:E,doNotShowBorderInViewMode:v,onEditBlocked:S,onSaveUnsavedChanges:A,onDiscardUnsavedChanges:$,isSavingUnsavedChanges:y=!1},b)=>{const w=t.useRef(null),[x,C]=t.useState({type:l,value:s}),[q,N]=t.useState(0),[R,T]=t.useState(!1),_=t.useRef(s),B=t.useRef(s),j=t.useRef(Boolean(s)),{contentRef:I,setContentRef:L}=a.useRefStore();t.useEffect(()=>{C(e=>({...e,value:s})),_.current=s,B.current=s,j.current=Boolean(s),T(!1)},[s]),t.useImperativeHandle(b,()=>({requestClose:()=>!("edit"===E&&h(_.current)!==h(B.current))||(T(!0),!1)}),[E]);return t.useEffect(()=>{const e=()=>{I&&I.current&&N(I.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[I]),e.jsxs("div",{style:{position:"relative",width:"100%",height:m,minHeight:f},children:[R&&e.jsx(i.UnsavedChangesPopup,{isSaving:y,onSave:async()=>{await(null==A?void 0:A()),_.current=B.current,T(!1)},onDiscard:()=>{B.current=_.current,null==$||$(),T(!1)}}),e.jsx(n.default,{minHeight:f,height:m,placeholder:g||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=o.$generateHtmlFromNodes(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,"")),e.removeAttribute("class"),e.textContent=e.textContent||""})(e)});const n=["upt","manual","ins","del","preserved"];function a(e,t){const r=e.cloneNode(!0),o=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${o.size}%%`;o.set(n,a(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);o.forEach((e,t)=>{l=l.replace(t,e)});const s=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),i=e.tagName.toLowerCase();return s?`<${i} ${s}>${l}</${i}>`:`<${i}>${l}</${i}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const l=[];r.querySelectorAll("invisible").forEach((e,t)=>{l.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const s=[];["manual","upt"].forEach(e=>{r.querySelectorAll(e).forEach((e,t)=>{s.push(a(e,d)),e.replaceWith(r.createTextNode(`%%REVIEW_${s.length-1}%%`))})});const i=[];r.querySelectorAll("table").forEach((e,t)=>{i.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let p=d.turndown(r.body.innerHTML);for(let e=s.length-1;e>=0;e--)p=p.replace(`%%REVIEW\\_${e}%%`,` ${s[e]} `);l.forEach((e,t)=>{p=p.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),i.forEach((e,t)=>{p=p.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),p=p.replace(/\*{4}([^*]+)\*{4}/g,"**$1**"),p=p.replace(/\s+class="PlaygroundEditorTheme__[^"]*"/g,""),p=p.replace(/<span\s+style="white-space:\s*pre-wrap;?">([\s\S]*?)<\/span>/g,"$1"),p=p.replace(/\s+style="white-space:\s*pre-wrap;?"/g,""),p=p.replace(/<b>\s*<strong>([\s\S]*?)<\/strong>\s*<\/b>/g,"<strong>$1</strong>");["upt","manual","del","ins","preserved"].forEach(e=>{p=c.mergeTagAcrossParagraphs(p,e)}),p=c.unescapeTagIds(p,["manual","upt"]),j.current&&(_.current=p,j.current=!1),B.current=p,((e,t)=>{u(e,t)})("prompt",p)})},toolbarConfig:r.DEFAULT_TOOLBAR_CONFIG,editorRef:w,mode:E,initialString:{type:x.type,value:x.value},dynamicHeight:q,onBlur:p,doNotShowBorderInViewMode:v||!1,onEditBlocked:S})]})});g.displayName="RichTextEditor",exports.default=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./Editor/constants/editorConfig.js"),n=require("./Editor/Editor.js"),o=require("../../store/ref.context.js"),a=require("@lexical/html"),l=require("turndown"),i=require("turndown-plugin-gfm"),u=require("../UnsavedChangesPopup/UnsavedChangesPopup.js"),s=require("../../../../utils/tagHelper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=new(c(l).default)({headingStyle:"atx",codeBlockStyle:"fenced"});d.keep(["ins","del","mark"]),d.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),d.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),d.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),d.use(i.tables);const h=e=>(e||"").replace(/\r\n/g,"\n").trim(),p=t.forwardRef(({type:l,value:i,handleUpdateState:c,onBlur:p,placeholder:f,minHeight:g,height:E,mode:m,doNotShowBorderInViewMode:v,onEditBlocked:S,onSaveUnsavedChanges:A,onDiscardUnsavedChanges:y,isSavingUnsavedChanges:$=!1},b)=>{const w=t.useRef(null),[x,q]=t.useState({type:l,value:i}),[C,N]=t.useState(0),[R,T]=t.useState(!1),B=t.useRef(i),j=t.useRef(i),I=t.useRef(Boolean(i)),{contentRef:L,setContentRef:_}=o.useRefStore();t.useEffect(()=>{q(e=>({...e,value:i})),B.current=i,j.current=i,I.current=Boolean(i),T(!1)},[i]),t.useImperativeHandle(b,()=>({requestClose:()=>!("edit"===m&&h(B.current)!==h(j.current))||(T(!0),!1)}),[m]);return t.useEffect(()=>{const e=()=>{L&&L.current&&N(L.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[L]),e.jsxs("div",{style:{position:"relative",width:"100%",height:E,minHeight:g},children:[R&&e.jsx(u.UnsavedChangesPopup,{isSaving:$,onSave:async()=>{await(null==A?void 0:A()),B.current=j.current,T(!1)},onDiscard:()=>{j.current=B.current,null==y||y(),T(!1)}}),e.jsx(n.default,{minHeight:g,height:E,placeholder:f||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=a.$generateHtmlFromNodes(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),u=e.tagName.toLowerCase();return i?`<${u} ${i}>${l}</${u}>`:`<${u}>${l}</${u}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const l=[];r.querySelectorAll("invisible").forEach((e,t)=>{l.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const i=[];["manual","upt"].forEach(e=>{r.querySelectorAll(e).forEach((e,t)=>{i.push(o(e,d)),e.replaceWith(r.createTextNode(`%%REVIEW_${i.length-1}%%`))})});const u=[];r.querySelectorAll("table").forEach((e,t)=>{u.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let h=d.turndown(r.body.innerHTML);for(let e=i.length-1;e>=0;e--)h=h.replace(`%%REVIEW\\_${e}%%`,` ${i[e]} `);l.forEach((e,t)=>{h=h.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),u.forEach((e,t)=>{h=h.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),h=h.replace(/\*{4}([^*]+)\*{4}/g,"**$1**");["upt","manual","del","ins","preserved"].forEach(e=>{h=s.mergeTagAcrossParagraphs(h,e)}),h=s.unescapeTagIds(h,["manual","upt"]),I.current&&(B.current=h,I.current=!1),j.current=h,((e,t)=>{c(e,t)})("prompt",h)})},toolbarConfig:r.DEFAULT_TOOLBAR_CONFIG,editorRef:w,mode:m,initialString:{type:x.type,value:x.value},dynamicHeight:C,onBlur:p,doNotShowBorderInViewMode:v||!1,onEditBlocked:S})]})});p.displayName="RichTextEditor",exports.default=p;
2
2
  //# sourceMappingURL=RichTextEditor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("lucide-react"),a=require("./ClinicalTrialSection.module.css.js");exports.default=({title:s,note:n="This content is provided by the scientific team and not generated from uploaded documents.",fields:t,value:i,readonly:d=!0,isSaving:r=!1,styles:u,onChange:o,onSave:c,onCancel:m})=>{const v=(e,l)=>{d||null==o||o({...i,[e]:l})},y=t.find(e=>"summary"===e.key),x=t.filter(e=>"summary"!==e.key),f=t.some(e=>{var l;return(null!==(l=i[e.key])&&void 0!==l?l:"").trim().length>0});return e.jsxs("div",{className:a.default.container,style:null==u?void 0:u.container,children:[e.jsxs("div",{className:a.default.noteContainer,style:null==u?void 0:u.noteContainer,children:[e.jsx(l.Info,{size:18,className:a.default.noteIcon,style:null==u?void 0:u.noteIcon}),e.jsxs("span",{className:a.default.noteText,style:null==u?void 0:u.noteText,children:[e.jsx("strong",{children:"Note:"})," ",n]})]}),d?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default.fieldsRow,style:null==u?void 0:u.fieldsRow,children:x.map(l=>e.jsxs("div",{className:a.default.field,style:null==u?void 0:u.field,children:[e.jsx("label",{className:a.default.label,style:null==u?void 0:u.label,children:l.label}),e.jsx("div",{className:a.default.readonlyValue,style:null==u?void 0:u.readonlyValue,children:i[l.key]||"-"})]},l.key))}),y&&e.jsxs("div",{className:a.default.field,style:null==u?void 0:u.field,children:[e.jsx("label",{className:a.default.label,style:null==u?void 0:u.label,children:y.label}),e.jsx("div",{className:a.default.readonlySummary,style:null==u?void 0:u.readonlySummary,children:i.summary||"-"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default.fieldsRow,style:null==u?void 0:u.fieldsRow,children:x.map(l=>{var s;return e.jsxs("div",{className:a.default.field,style:null==u?void 0:u.field,children:[e.jsx("label",{className:a.default.label,style:null==u?void 0:u.label,children:l.label}),"select"===l.type?e.jsxs("select",{className:a.default.input,style:null==u?void 0:u.input,value:i[l.key]||"",onChange:e=>v(l.key,e.target.value),children:[e.jsxs("option",{value:"",children:["Select ",l.label]}),null===(s=l.options)||void 0===s?void 0:s.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))]}):e.jsx("input",{className:a.default.input,style:null==u?void 0:u.input,placeholder:l.placeholder,value:i[l.key]||"",onChange:e=>v(l.key,e.target.value)})]},l.key)})}),y&&e.jsx("div",{className:a.default.summaryContainer,style:null==u?void 0:u.summaryContainer,children:e.jsx("textarea",{className:a.default.summaryTextarea,style:null==u?void 0:u.summaryTextarea,placeholder:(null==y?void 0:y.placeholder)||"Add section summary here",value:i.summary||"",onChange:e=>v("summary",e.target.value)})}),e.jsxs("div",{className:a.default.actionBar,style:null==u?void 0:u.actionBar,children:[e.jsxs("button",{type:"button",className:a.default.cancelButton,style:null==u?void 0:u.cancelButton,onClick:m,children:[e.jsx(l.X,{size:18}),e.jsx("span",{children:"Cancel"})]}),e.jsx("button",{type:"button",className:a.default.saveButton,style:null==u?void 0:u.saveButton,onClick:c,disabled:r||!f,children:r?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:18,className:a.default.spinner,style:null==u?void 0:u.spinner}),e.jsx("span",{children:"Saving..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Save,{size:18}),e.jsx("span",{children:"Save"})]})})]})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("lucide-react"),a=require("./ClinicalTrialSection.module.css.js");exports.default=({title:s,note:n="This content is provided by the scientific team and not generated from uploaded documents.",fields:t,value:i,readonly:d=!0,isSaving:u=!1,styles:r,onChange:o,onSave:c,onCancel:m})=>{const v=(e,l)=>{d||null==o||o({...i,[e]:l})},y=t.find(e=>"summary"===e.key),x=t.filter(e=>"summary"!==e.key);return e.jsxs("div",{className:a.default.container,style:null==r?void 0:r.container,children:[e.jsxs("div",{className:a.default.noteContainer,style:null==r?void 0:r.noteContainer,children:[e.jsx(l.Info,{size:18,className:a.default.noteIcon,style:null==r?void 0:r.noteIcon}),e.jsxs("span",{className:a.default.noteText,style:null==r?void 0:r.noteText,children:[e.jsx("strong",{children:"Note:"})," ",n]})]}),d?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default.fieldsRow,style:null==r?void 0:r.fieldsRow,children:x.map(l=>e.jsxs("div",{className:a.default.field,style:null==r?void 0:r.field,children:[e.jsx("label",{className:a.default.label,style:null==r?void 0:r.label,children:l.label}),e.jsx("div",{className:a.default.readonlyValue,style:null==r?void 0:r.readonlyValue,children:i[l.key]||"-"})]},l.key))}),y&&e.jsxs("div",{className:a.default.field,style:null==r?void 0:r.field,children:[e.jsx("label",{className:a.default.label,style:null==r?void 0:r.label,children:y.label}),e.jsx("div",{className:a.default.readonlySummary,style:null==r?void 0:r.readonlySummary,children:i.summary||"-"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default.fieldsRow,style:null==r?void 0:r.fieldsRow,children:x.map(l=>{var s;return e.jsxs("div",{className:a.default.field,style:null==r?void 0:r.field,children:[e.jsx("label",{className:a.default.label,style:null==r?void 0:r.label,children:l.label}),"select"===l.type?e.jsxs("select",{className:a.default.input,style:null==r?void 0:r.input,value:i[l.key]||"",onChange:e=>v(l.key,e.target.value),children:[e.jsxs("option",{value:"",children:["Select ",l.label]}),null===(s=l.options)||void 0===s?void 0:s.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))]}):e.jsx("input",{className:a.default.input,style:null==r?void 0:r.input,placeholder:l.placeholder,value:i[l.key]||"",onChange:e=>v(l.key,e.target.value)})]},l.key)})}),y&&e.jsx("div",{className:a.default.summaryContainer,style:null==r?void 0:r.summaryContainer,children:e.jsx("textarea",{className:a.default.summaryTextarea,style:null==r?void 0:r.summaryTextarea,placeholder:(null==y?void 0:y.placeholder)||"Add section summary here",value:i.summary||"",onChange:e=>v("summary",e.target.value)})}),e.jsxs("div",{className:a.default.actionBar,style:null==r?void 0:r.actionBar,children:[e.jsxs("button",{type:"button",className:a.default.cancelButton,style:null==r?void 0:r.cancelButton,onClick:m,children:[e.jsx(l.X,{size:18}),e.jsx("span",{children:"Cancel"})]}),e.jsx("button",{type:"button",className:a.default.saveButton,style:null==r?void 0:r.saveButton,onClick:c,disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:18,className:a.default.spinner,style:null==r?void 0:r.spinner}),e.jsx("span",{children:"Saving..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Save,{size:18}),e.jsx("span",{children:"Save"})]})})]})]})]})};
2
2
  //# sourceMappingURL=ClinicalTrialSection.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const i=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;i&&e.setAttribute("nonce",i),e.appendChild(document.createTextNode(".ClinicalTrialSection-module_container__oXyDo{display:flex;flex-direction:column;gap:20px;padding:20px;width:100%}.ClinicalTrialSection-module_noteContainer__fjKfZ{align-items:center;background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;display:flex;gap:8px;padding:12px 16px}.ClinicalTrialSection-module_noteIcon__uO955{color:#6b7280;flex-shrink:0}.ClinicalTrialSection-module_noteText__ZNtmw{color:#4b5563;font-size:14px;line-height:20px}.ClinicalTrialSection-module_fieldsRow__S5DzE{display:flex;gap:24px;width:100%}.ClinicalTrialSection-module_field__KuTr6{display:flex;flex:1;flex-direction:column}.ClinicalTrialSection-module_label__xPB0g{color:#111827;font-size:14px;font-weight:600;line-height:20px;margin-bottom:8px}.ClinicalTrialSection-module_input__nGvpX{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;height:48px;outline:none;padding:0 16px;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_input__nGvpX::placeholder{color:#9ca3af}.ClinicalTrialSection-module_input__nGvpX:focus{border-color:#3b82f6}.ClinicalTrialSection-module_summaryContainer__kdXAi{width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;line-height:20px;min-height:150px;outline:none;padding:16px;resize:vertical;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd::placeholder{color:#9ca3af}.ClinicalTrialSection-module_summaryTextarea__QbEXd:focus{border-color:#3b82f6}.ClinicalTrialSection-module_actionBar__V8LoA{align-items:center;display:flex;gap:24px;justify-content:flex-end;margin-top:20px}.ClinicalTrialSection-module_cancelButton__GsyN4{align-items:center;background:#0000;border:none;color:#ef4444;cursor:pointer;display:flex;font-size:16px;font-weight:500;gap:6px}.ClinicalTrialSection-module_cancelButton__GsyN4:hover{opacity:.8}.ClinicalTrialSection-module_saveButton__P5AIo{align-items:center;background:#0000;border:none;color:#4f46e5;cursor:pointer;display:flex;font-size:16px;font-weight:600;gap:6px}.ClinicalTrialSection-module_saveButton__P5AIo:hover{opacity:.8}.ClinicalTrialSection-module_saveButton__P5AIo:disabled{color:#9ca3af;cursor:not-allowed;opacity:.6;pointer-events:none}.ClinicalTrialSection-module_saveButton__P5AIo:disabled:hover{opacity:.6}.ClinicalTrialSection-module_readonlyValue__31toE{align-items:center;background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;display:flex;font-size:14px;line-height:20px;min-height:48px;padding:0 16px}.ClinicalTrialSection-module_readonlySummary__WF5q6{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;font-size:14px;line-height:22px;min-height:150px;padding:16px;white-space:pre-wrap;word-break:break-word}.ClinicalTrialSection-module_spinner__AL39r{animation:ClinicalTrialSection-module_spin__kH9hF 1s linear infinite}@keyframes ClinicalTrialSection-module_spin__kH9hF{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}(),exports.default={container:"ClinicalTrialSection-module_container__oXyDo",noteContainer:"ClinicalTrialSection-module_noteContainer__fjKfZ",noteIcon:"ClinicalTrialSection-module_noteIcon__uO955",noteText:"ClinicalTrialSection-module_noteText__ZNtmw",fieldsRow:"ClinicalTrialSection-module_fieldsRow__S5DzE",field:"ClinicalTrialSection-module_field__KuTr6",label:"ClinicalTrialSection-module_label__xPB0g",input:"ClinicalTrialSection-module_input__nGvpX",summaryContainer:"ClinicalTrialSection-module_summaryContainer__kdXAi",summaryTextarea:"ClinicalTrialSection-module_summaryTextarea__QbEXd",actionBar:"ClinicalTrialSection-module_actionBar__V8LoA",cancelButton:"ClinicalTrialSection-module_cancelButton__GsyN4",saveButton:"ClinicalTrialSection-module_saveButton__P5AIo",readonlyValue:"ClinicalTrialSection-module_readonlyValue__31toE",readonlySummary:"ClinicalTrialSection-module_readonlySummary__WF5q6",spinner:"ClinicalTrialSection-module_spinner__AL39r",spin:"ClinicalTrialSection-module_spin__kH9hF"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const i=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;i&&e.setAttribute("nonce",i),e.appendChild(document.createTextNode(".ClinicalTrialSection-module_container__oXyDo{display:flex;flex-direction:column;gap:20px;padding:20px;width:100%}.ClinicalTrialSection-module_noteContainer__fjKfZ{align-items:center;background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;display:flex;gap:8px;padding:12px 16px}.ClinicalTrialSection-module_noteIcon__uO955{color:#6b7280;flex-shrink:0}.ClinicalTrialSection-module_noteText__ZNtmw{color:#4b5563;font-size:14px;line-height:20px}.ClinicalTrialSection-module_fieldsRow__S5DzE{display:flex;gap:24px;width:100%}.ClinicalTrialSection-module_field__KuTr6{display:flex;flex:1;flex-direction:column}.ClinicalTrialSection-module_label__xPB0g{color:#111827;font-size:14px;font-weight:600;line-height:20px;margin-bottom:8px}.ClinicalTrialSection-module_input__nGvpX{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;height:48px;outline:none;padding:0 16px;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_input__nGvpX::placeholder{color:#9ca3af}.ClinicalTrialSection-module_input__nGvpX:focus{border-color:#3b82f6}.ClinicalTrialSection-module_summaryContainer__kdXAi{width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;line-height:20px;min-height:150px;outline:none;padding:16px;resize:vertical;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd::placeholder{color:#9ca3af}.ClinicalTrialSection-module_summaryTextarea__QbEXd:focus{border-color:#3b82f6}.ClinicalTrialSection-module_actionBar__V8LoA{align-items:center;display:flex;gap:24px;justify-content:flex-end;margin-top:20px}.ClinicalTrialSection-module_cancelButton__GsyN4{align-items:center;background:#0000;border:none;color:#ef4444;cursor:pointer;display:flex;font-size:16px;font-weight:500;gap:6px}.ClinicalTrialSection-module_cancelButton__GsyN4:hover{opacity:.8}.ClinicalTrialSection-module_saveButton__P5AIo{align-items:center;background:#0000;border:none;color:#4f46e5;cursor:pointer;display:flex;font-size:16px;font-weight:600;gap:6px}.ClinicalTrialSection-module_saveButton__P5AIo:hover{opacity:.8}.ClinicalTrialSection-module_readonlyValue__31toE{align-items:center;background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;display:flex;font-size:14px;line-height:20px;min-height:48px;padding:0 16px}.ClinicalTrialSection-module_readonlySummary__WF5q6{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;font-size:14px;line-height:22px;min-height:150px;padding:16px;white-space:pre-wrap;word-break:break-word}.ClinicalTrialSection-module_spinner__AL39r{animation:ClinicalTrialSection-module_spin__kH9hF 1s linear infinite}@keyframes ClinicalTrialSection-module_spin__kH9hF{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}(),exports.default={container:"ClinicalTrialSection-module_container__oXyDo",noteContainer:"ClinicalTrialSection-module_noteContainer__fjKfZ",noteIcon:"ClinicalTrialSection-module_noteIcon__uO955",noteText:"ClinicalTrialSection-module_noteText__ZNtmw",fieldsRow:"ClinicalTrialSection-module_fieldsRow__S5DzE",field:"ClinicalTrialSection-module_field__KuTr6",label:"ClinicalTrialSection-module_label__xPB0g",input:"ClinicalTrialSection-module_input__nGvpX",summaryContainer:"ClinicalTrialSection-module_summaryContainer__kdXAi",summaryTextarea:"ClinicalTrialSection-module_summaryTextarea__QbEXd",actionBar:"ClinicalTrialSection-module_actionBar__V8LoA",cancelButton:"ClinicalTrialSection-module_cancelButton__GsyN4",saveButton:"ClinicalTrialSection-module_saveButton__P5AIo",readonlyValue:"ClinicalTrialSection-module_readonlyValue__31toE",readonlySummary:"ClinicalTrialSection-module_readonlySummary__WF5q6",spinner:"ClinicalTrialSection-module_spinner__AL39r",spin:"ClinicalTrialSection-module_spin__kH9hF"};
2
2
  //# sourceMappingURL=ClinicalTrialSection.module.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),e=require("lucide-react"),n=require("react"),o=require("./ResizableSplitPane.js"),l=require("../icons/PdfViewerIcons.js"),t=require("@e-llm-studio/citation"),a=require("react-markdown"),r=require("rehype-raw"),d=require("@mui/material"),u=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function s(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var c=s(a),v=s(r);const p=i=>{if(i)try{const e=new URL(i).hostname.replace(/^www\./i,""),n=e.split(".")[0];return n?n.charAt(0).toUpperCase()+n.slice(1):e}catch(i){return}},x=(i,e)=>{const n=((i,e)=>(null==i?void 0:i.payloadCitationId)||(null==e?void 0:e.payloadCitationId)||(null==e?void 0:e.citation_uuid)||"")(i,e)||("function"==typeof(null===(o=globalThis.crypto)||void 0===o?void 0:o.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const e=Math.floor(16*Math.random());return("x"===i?e:e%4+8).toString(16)}));var o;return i&&"object"==typeof i&&(i.payloadCitationId=n),e&&"object"==typeof e&&(e.payloadCitationId=n,e.citation_uuid||(e.citation_uuid=n)),n},g=({href:l,metaData:a,citationTitle:r,isFullscreen:s,secondaryCitation:g})=>{var h,f,m,b,y,C,j,_,w,F,T,I,D,S,P,k,M,U,W,z,R;const A=n.useMemo(()=>{var i;return null===(i=(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).find(i=>`pdf_citation$${i.id}`===l))||void 0===i?void 0:i.data},[l,null==a?void 0:a.citations]),q=null!==(y=null===(b=null===(m=null===(f=null===(h=null==a?void 0:a.guidelinesData)||void 0===h?void 0:h.artifactData)||void 0===f?void 0:f.userStorySnapshot)||void 0===m?void 0:m[0])||void 0===b?void 0:b.value)&&void 0!==y?y:"",E=n.useMemo(()=>{const i=null==g?void 0:g.phraseToHighlight;if(!i)return q;const e=q.toLowerCase().indexOf(i.toLowerCase());return-1===e?q:[q.slice(0,e),'<mark style="background-color: #FEF08A; padding: 0 2px;">',q.slice(e,e+i.length),"</mark>",q.slice(e+i.length)].join("")},[q,null==g?void 0:g.phraseToHighlight]),B=n.useMemo(()=>{var i;const e=Array.isArray(null==a?void 0:a.gptCitations)?a.gptCitations:[],n=((i="")=>{const e=i.match(/gpt_citation\$(\d+)/i);return(null==e?void 0:e[1])||""})(null==g?void 0:g.href);if(!n)return null;const o=e.find(i=>String(null==i?void 0:i.id)===n),l=(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.extraMetaData)||{},t=(i=>Object.keys(i||{}).sort((i,e)=>Number(i)-Number(e)))(l),r=t[Number((null==g?void 0:g.occurrenceIndex)||0)]||t[0];return r?l[r]:null},[null==a?void 0:a.gptCitations,null==g?void 0:g.href,null==g?void 0:g.occurrenceIndex]),G=(null===(w=null===(_=null===(j=null===(C=null==B?void 0:B.aiReasoningCitation)||void 0===C?void 0:C.gpt_citation)||void 0===j?void 0:j[0])||void 0===_?void 0:_.customMetaData)||void 0===w?void 0:w.value)||{},N=(null===(I=null===(T=null===(F=null==B?void 0:B.aiReasoningCitation)||void 0===F?void 0:F.gpt_citation)||void 0===T?void 0:T[0])||void 0===I?void 0:I.customMetaData)||{},L=n.useMemo(()=>x(B,G),[G,B]),[O,H]=n.useState(),[V,$]=n.useState("pending"),[X,J]=n.useState(!0),{apiCachingConfig:K,citationConfig:Q}=u.useRequirementAI(),{getGptWebCitation:Y,gptWebCitationPartialPayload:Z}=K||{},ii=(null===(D=null==Q?void 0:Q.gptWeb)||void 0===D?void 0:D.displayMode)||t.CitationType.GPT_WEB,ei=null===(S=null==g?void 0:g.href)||void 0===S?void 0:S.includes("gpt_citation"),ni=n.useMemo(()=>({...Z,citationId:L,citationUrl:null==G?void 0:G.citationUrl,content:(null==B?void 0:B.Reasoning)||(null==G?void 0:G.text),citationType:null==G?void 0:G.citationType,citatioNumber:Number((null==N?void 0:N.citation_number)||0)}),[Z,L,null==N?void 0:N.citation_number,null==G?void 0:G.citationType,null==G?void 0:G.citationUrl,null==G?void 0:G.text,null==B?void 0:B.Reasoning]),oi=n.useMemo(()=>({item:{confidence_score:Number((null==B?void 0:B.Confidence_score)||0),text:(null==G?void 0:G.paraphrase)||(null==g?void 0:g.title)||"Web citation reasoning",dataSource:(null==G?void 0:G.text)||(null==B?void 0:B.Reasoning)||"",paraphrase:(null==G?void 0:G.paraphrase)||""},headerTitle:(null==G?void 0:G.label)||"GPT Web Citation",index:Number((null==N?void 0:N.citation_number)||1)-1,iconsConfig:{ChevronDownIcon:e.ChevronDown,ChevronUpIcon:e.ChevronUp,MaximizeIcon:e.Maximize2,CloseIcon:e.X}}),[null==g?void 0:g.title,null==N?void 0:N.citation_number,null==G?void 0:G.label,null==G?void 0:G.paraphrase,null==G?void 0:G.text,null==B?void 0:B.Confidence_score,null==B?void 0:B.Reasoning]);if(n.useEffect(()=>{let i=!0;return(async()=>{var e,n;if(ei&&(null==G?void 0:G.citationUrl)&&ii!==t.CitationType.GPT&&(ii!==t.CitationType.GPT_WEB||X))if(Y){$("pending");try{const o=await Y(ni);if(!i)return;H(null!==(n=null!==(e=null==o?void 0:o.data)&&void 0!==e?e:null==o?void 0:o.responseData)&&void 0!==n?n:o),$("success")}catch(e){if(!i)return;$("error"),console.error("Failed to load GPT web citation",e)}}else $("error")})(),()=>{i=!1}},[Y,ni,ii,ei,null==G?void 0:G.citationUrl,X]),!A)return null;const li=(null===(P=null==a?void 0:a.docData)||void 0===P?void 0:P.documents)||{},ti=(null===(k=null==a?void 0:a.docData)||void 0===k?void 0:k.input_index_map)||{},ai=Object.values(ti).find(i=>{const e=null==li?void 0:li[i];return(null==A?void 0:A[i])&&("application/pdf"===(null==e?void 0:e.mime_type)||"base"===(null==e?void 0:e.role))}),ri=Object.keys(A).find(i=>{const e=null==li?void 0:li[i];return"application/pdf"===(null==e?void 0:e.mime_type)||"base"===(null==e?void 0:e.role)})||Object.keys(A)[0],di=ai||ri||(null==ti?void 0:ti[0]),ui=Object.values(ti).find(i=>i!==di),si=di?li[di]:null,ci=ui?li[ui]:null,vi=di?A[di]:null,pi=ui?A[ui]:null,xi="rulebook_citation"===((null===(M=null==g?void 0:g.type)||void 0===M?void 0:M.toLowerCase())||"")||Boolean(null==g?void 0:g.phraseToHighlight),gi=g?i.jsxs("div",{style:{height:"100%",overflow:"auto",padding:"16px",boxSizing:"border-box",backgroundColor:"#FFFFFF",color:"#101828",fontFamily:'"Inter", sans-serif',fontSize:"13px",lineHeight:1.6},children:[i.jsx("div",{style:{fontWeight:700,marginBottom:"8px"},children:xi?"Guideline Citation":"Web/GPT Citation"}),xi?i.jsx(i.Fragment,{children:i.jsx(d.Box,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",overflow:"visible"},children:i.jsx(c.default,{rehypePlugins:[v.default],children:E})})}):ei?i.jsx(t.GptWebCitation,{gptCitation:oi,defaultCitationUrl:(null==G?void 0:G.citationUrl)||"",citationType:ii,webCitationData:O,sourceLabel:`Source: Web Citation > ${(null==G?void 0:G.paraphrase)||(null==G?void 0:G.label)||"Web Citation"}`,learnedFrom:p(null==G?void 0:G.citationUrl),showWebCitation:X,webCitationStatus:V,onGenerateWebCitation:()=>J(!0),onToggleCitationView:()=>J(i=>!i),showExpandImageButton:!0,showGptMaximizeButton:!0,iconsConfig:{MaximizeIcon:e.Maximize2,ExternalLinkIcon:e.ExternalLink},isFixedHeight:!1}):i.jsx("div",{children:"No secondary citation preview available."})]}):null;if(["Contract","clause"].includes(r)){const e=vi?i.jsx(t.PdfViewer,{pdfName:null==si?void 0:si.title,pdfUrl:null==si?void 0:si.signed_url,highlightText:[null!==(U=null==vi?void 0:vi.highlighted_text)&&void 0!==U?U:""],highlightPages:{1:null===(W=null==vi?void 0:vi.custom_metadata)||void 0===W?void 0:W.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=gi||(pi?i.jsx(t.PdfViewer,{pdfName:null==ci?void 0:ci.title,pdfUrl:null==ci?void 0:ci.signed_url,jumpToPageValue:1,highlightText:[null!==(z=null==pi?void 0:pi.highlighted_text)&&void 0!==z?z:""],highlightPages:{1:null===(R=null==pi?void 0:pi.custom_metadata)||void 0===R?void 0:R.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null);return vi||pi||gi?i.jsx("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:i.jsx(o.default,{leftComponent:e,rightComponent:n,isFullscreen:s})}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"})}return i.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=({href:o,children:t,metaData:a,secondaryCitation:r,chevronUpComponent:d=null,chevronDownComponent:u=null,customStyle:s={},defaultState:c=!1})=>{var v,p,x;const[h,f]=n.useState(c),[m,b]=n.useState(!1),y="string"==typeof t&&(null===(v=null==t?void 0:t.split("\n"))||void 0===v?void 0:v.length)>1?t.split("\n").join(" "):t,C="string"==typeof t?t:t[0],j=null!=d?d:(n=>{var o,l;return i.jsx(e.ChevronUp,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(l=null==n?void 0:n.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(p=null==s?void 0:s.arrow)&&void 0!==p?p:{}),_=null!=u?u:(n=>{var o,l;return i.jsx(e.ChevronDown,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(l=null==n?void 0:n.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(x=null==s?void 0:s.arrow)&&void 0!==x?x:{}),w=n.useMemo(()=>(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).some(i=>`pdf_citation$${i.id}`===o),[o,null==a?void 0:a.citations]);return["contract","clause"].includes(C.toLowerCase())&&w?i.jsxs("span",{style:{display:"inline",...s.relativeWrapper||{}},children:[i.jsx("div",{style:{display:"inline",marginTop:0,...s.citationButtonWrapper||{}},children:i.jsxs("button",{type:"button",onClick:()=>f(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...s.citationButton||{}},children:[i.jsx("span",{children:y}),i.jsx("span",{style:{display:"flex",alignItems:"center"},children:h?j:_})]})}),h&&i.jsxs("div",{style:m?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:i.jsx("button",{onClick:()=>{b(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:m?i.jsx(l.DefaultFullScreenCloseIcon,{}):i.jsx(l.DefaultFullScreenIcon,{})})}),i.jsx("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:i.jsx(g,{href:o,children:t,metaData:a,citationTitle:C,isFullscreen:m,secondaryCitation:r})})]})]}):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),l=require("react"),n=require("./ResizableSplitPane.js"),t=require("../icons/PdfViewerIcons.js"),o=require("@e-llm-studio/citation");const r=({href:i,metaData:t,citationTitle:r,isFullscreen:d})=>{var a,s,u,c,p,h;const g=l.useMemo(()=>{var e;return null===(e=t.citations.find(e=>`pdf_citation$${e.id}`===i))||void 0===e?void 0:e.data},[i]);if(!g)return null;const v=(null===(a=null==t?void 0:t.docData)||void 0===a?void 0:a.documents)||{},x=(null===(s=null==t?void 0:t.docData)||void 0===s?void 0:s.input_index_map)||{},f=null==x?void 0:x[0],m=null==x?void 0:x[1],j=f?v[f]:null,y=m?v[m]:null,b=f?g[f]:null,C=m?g[m]:null;if(["Contract","clause"].includes(r)){const i=b?e.jsx(o.PdfViewer,{pdfName:j.title,pdfUrl:j.signed_url,highlightText:[null!==(u=null==b?void 0:b.highlighted_text)&&void 0!==u?u:""],highlightPages:{1:null===(c=null==b?void 0:b.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,l=C?e.jsx(o.PdfViewer,{pdfName:y.title,pdfUrl:y.signed_url,jumpToPageValue:1,highlightText:[null!==(p=null==C?void 0:C.highlighted_text)&&void 0!==p?p:""],highlightPages:{1:null===(h=null==C?void 0:C.custom_metadata)||void 0===h?void 0:h.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return b||C?e.jsx("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:e.jsx(n.default,{leftComponent:i,rightComponent:l,isFullscreen:d})}):e.jsx("div",{children:"Missing PDF Citation. Please try again later"})}return e.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=({href:n,children:o,metaData:d,chevronUpComponent:a=null,chevronDownComponent:s=null,customStyle:u={},defaultState:c=!1})=>{var p,h,g;const[v,x]=l.useState(c),[f,m]=l.useState(!1),j="string"==typeof o&&(null===(p=null==o?void 0:o.split("\n"))||void 0===p?void 0:p.length)>1?o.split("\n").join(" "):o,y="string"==typeof o?o:o[0],b=null!=a?a:(l=>{var n,t;return e.jsx(i.ChevronUp,{size:null!==(n=null==l?void 0:l.fontSize)&&void 0!==n?n:16,color:null!==(t=null==l?void 0:l.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(h=null==u?void 0:u.arrow)&&void 0!==h?h:{}),C=null!=s?s:(l=>{var n,t;return e.jsx(i.ChevronDown,{size:null!==(n=null==l?void 0:l.fontSize)&&void 0!==n?n:16,color:null!==(t=null==l?void 0:l.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(g=null==u?void 0:u.arrow)&&void 0!==g?g:{});return e.jsxs("span",{style:{display:"inline",...u.relativeWrapper||{}},children:[e.jsx("div",{style:{display:"inline",marginTop:0,...u.citationButtonWrapper||{}},children:e.jsxs("button",{type:"button",onClick:()=>x(e=>!e),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...u.citationButton||{}},children:[e.jsx("span",{children:j}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:v?b:C})]})}),v&&e.jsxs("div",{style:f?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:e.jsx("button",{onClick:()=>{m(e=>!e)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:f?e.jsx(t.DefaultFullScreenCloseIcon,{}):e.jsx(t.DefaultFullScreenIcon,{})})}),e.jsx("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:e.jsx(r,{href:n,children:o,metaData:d,citationTitle:y,isFullscreen:f})})]})]})};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),t=require("../Popups/PopupDefaults.js"),i=require("react-markdown"),n=require("rehype-raw"),c=require("./CitationComponent.module.css.js"),l=require("lucide-react"),s=require("../icons/cognitiveBrain.svg.js"),r=require("../icons/aiMagic.svg.js"),d=require("./CitationAnchor.js"),o=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),u=require("../../../../../service/redlineService.js"),m=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../cws/CwsEvent.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=x(a),f=x(i),v=x(n);const _=(e="")=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),g=(e,a)=>{const t=e.match(new RegExp(`${a}=(["'])(.*?)\\1`,"i"));return(null==t?void 0:t[2])||""},j=(e,a)=>{const t=[...e.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)].map(e=>{var a;return{fullMatch:e[0],attributes:e[1],label:e[2],index:null!==(a=e.index)&&void 0!==a?a:0}}),i=t.find(e=>{return a=e.attributes,g(a,"href").startsWith("pdf_citation$");var a}),n=t.find(e=>{return a=e.attributes,g(a,"href").includes("gpt_citation")||a.includes("phrase_to_highlight=");var a});if(!i||!n)return e;const c=((e,a,t,i,n)=>{const c=g(t,"href"),l=g(t,"type")||(c.includes("gpt_citation")?"gpt_citation":""),s=g(t,"reason"),r=c.split("?")[1]||"",d=r&&new URLSearchParams(r).get("phrase_to_highlight")||"",o=c.includes("gpt_citation")&&void 0!==n?` data-secondary-occurrence-index="${n}"`:"";return`<a${e} data-dual-citation="true" data-secondary-href="${_(c)}" data-secondary-type="${_(l)}" data-secondary-title="${_(i)}" data-secondary-reason="${_(s)}" data-secondary-phrase-to-highlight="${_(d)}"${o}>${a}</a>`})(i.attributes,i.label,n.attributes,n.label,g(n.attributes,"href").includes("gpt_citation")?a():void 0),l=(n.index>i.index?e.slice(i.index+i.fullMatch.length,n.index):e.slice(n.index+n.fullMatch.length,i.index)).trim()?n.label:"";return e.replace(i.fullMatch,c).replace(n.fullMatch,l)},y=(e,a)=>{var t,i;const n=a.replace(/-([a-z])/g,(e,a)=>a.toUpperCase());return null!==(i=null!==(t=null==e?void 0:e[a])&&void 0!==t?t:null==e?void 0:e[n])&&void 0!==i?i:""},N=({text:t,item:i})=>{const n=a.useMemo(()=>(e=>{let a=0;const t=()=>a++;return e.split("\n").map(e=>j(e,t)).join("\n")})(t),[t]);return e.jsx(f.default,{rehypePlugins:[v.default],components:{ol:({children:a})=>e.jsx("ol",{className:c.default["md-ol"],children:a}),ul:({children:a})=>e.jsx("ul",{className:c.default["md-ul"],children:a}),li:({children:a})=>e.jsx("li",{className:c.default["md-li"],children:a}),a:({node:a,href:t,children:n})=>{const c=(null==a?void 0:a.properties)||{},l=y(c,"data-secondary-href");return e.jsx(d.default,{href:t,children:n,secondaryCitation:l?{href:l,title:y(c,"data-secondary-title"),type:y(c,"data-secondary-type"),reason:y(c,"data-secondary-reason"),phraseToHighlight:y(c,"data-secondary-phrase-to-highlight"),occurrenceIndex:Number(y(c,"data-secondary-occurrence-index")||0)}:void 0,metaData:{citations:i.citations,docData:i.docData,guidelinesData:i.guidelinesData,gptCitations:i.gptCitations}})}},children:n.replace(/<br\s*\/?>/gi,"\n")})},b=({text:a,markdownStyles:t,citationStyles:i,customIcons:n})=>e.jsx(o.AiReasonMarkdownWrapper,{message:a.replace(/<br\s*\/?>/gi,"\n"),customStyles:t,citationStyles:i,customIcons:n}),I=(e,a)=>e.disableAllActions===a.disableAllActions&&(e.redlineId===a.redlineId&&(e.aiReasonId===a.aiReasonId&&(e.relevanceScore===a.relevanceScore&&(e.reason===a.reason&&(e.impact===a.impact&&(e.explaination===a.explaination&&e.gap===a.gap)))))),C=a.memo(function({item:i,title:n="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:o=!0,reason:u="No reasoning provided.",impact:m="No Impact provided.",explaination:p="No explaination provided.",gap:x="None",onClose:f=()=>{},showResolveBtns:v=!1,sections:_,leftIcon:g,scoreIcon:j,className:y,customStyles:I={},markdownStyles:C,citationStyles:R,customIcons:A,actions:k,disableAllActions:$=!1,actionBtnDisabledStyle:D={},onBackClick:S,isImpactNeeded:q=!0,cognitiveTitle:w="Cognitive Integrity",labels:M={},chatHistory:T,resolveRedlineAction:H}){const B=a.useMemo(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),P=a.useMemo(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const a=e.trim().toLowerCase();return"none"===a||"no gap"===a||"no gaps"===a||"n/a"===a})(x)?e:x},[x]),L=M&&M.impact||"Impact",E=M&&M.explanation||"Explaination",U=M&&M.decisionFactors||"Decision Making Factors",W=M&&M.gaps||"Gaps in Decision",F=M&&M.accept||"Accept",G=M&&M.reject||"Reject",z=M&&M.backAriaLabel||"Go back",O=k||[{id:"reject",label:G,onClick:()=>H("reject"),className:c.default["btn-reject"]},{id:"accept",label:F,onClick:()=>H("accept"),className:c.default["btn-accept"]}],J=T&&T.length>0;return e.jsxs("div",{className:`${c.default["cite-acc"]} ${y||""}`,style:{...t.default.CitationAccordionDefaults.container,...null==I?void 0:I.container},children:[S&&e.jsxs("div",{className:c.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:c.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),S&&S()},"aria-label":z,children:"‹"}),e.jsx("span",{className:c.default["cite-acc__backTitle"],children:w})]}),e.jsx("div",{className:c.default["cite-body"],children:_&&_.length>0?_.map(a=>!1===a.show?null:e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],style:{...t.default.CitationAccordionDefaults.innerHeader,...null==I?void 0:I.innerHeader},children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:a.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),f&&f()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...t.default.CitationAccordionDefaults.innerBody,...null==I?void 0:I.innerBody},children:"string"==typeof a.content?e.jsx(N,{text:a.content,item:a.item||i||{}}):a.content})]},a.id||a.title)):e.jsxs(e.Fragment,{children:[q&&e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:L})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),f&&f()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:m||"",item:i||{}})})]}),p&&"No explaination provided."!==p&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:E})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:p||"",item:{}})})]}),e.jsx("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),v&&e.jsx("div",{className:c.default["cite-acc__btn-container"],children:O.map(a=>{const t=$||a.disabled;return e.jsx("button",{className:a.className,onClick:t?void 0:a.onClick,disabled:t,style:{...a.style,...t?{opacity:.5,cursor:"not-allowed",...D,...a.disabledStyle}:{}},children:a.label},a.id)})})]}),e.jsxs("div",{className:c.default["cite-acc__header"],children:[e.jsxs("div",{className:c.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:c.default["cite-acc__titleIcon"],children:g?"function"==typeof g?h.default.createElement(g):g:e.jsx(s.ReactComponent,{})}),e.jsx("div",{className:c.default["cite-acc__title"],children:n})]}),e.jsx("div",{className:c.default["cite-acc__headerRight"],children:o&&e.jsxs("span",{className:c.default["cite-acc__scoreBadge"],children:[j?"function"==typeof j?h.default.createElement(j):j:e.jsx(r.ReactComponent,{}),e.jsxs("span",{className:c.default["cite-acc__scoreText"],children:[B,"%"]})]})})]}),e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:U})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:u||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:u||"",item:i||{}})})]}),e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${c.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:W})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:P||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:P||"",item:i||{}})})]})]})})]})},I);var R=a.memo(function(t){const{redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}=m.useRequirementAI(),l=a.useRef({redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}),s=a.useRef({onActionTrigger:t.onActionTrigger,redlineId:t.redlineId,aiReasonId:t.aiReasonId});l.current={redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c},s.current={onActionTrigger:t.onActionTrigger,redlineId:t.redlineId,aiReasonId:t.aiReasonId};const r=a.useCallback(async e=>{var a,t,i,n,c,r;const{redlineDcoumentId:d,redlineConfig:o,updateRedlineDataParent:m}=l.current,{onActionTrigger:x,redlineId:h,aiReasonId:f}=s.current;null==x||x({status:"loading",action:e,metadata:{redlineId:h,aiReasonId:f}});try{const{updated_reqai:l}=await u.resolveRedline({documentId:d,userEmail:null==o?void 0:o.userEmail,userName:null==o?void 0:o.userName,redlineId:null!=h?h:"",action:e,baseApiUrl:null==o?void 0:o.baseApiUrl,redlineConfigId:null!==(a=null==o?void 0:o.redlineConfigId)&&void 0!==a?a:""},null!==(t=null==o?void 0:o.token)&&void 0!==t?t:"");await(null==m?void 0:m(l)),null===(i=p.default.emit)||void 0===i||i.call(p.default,`redline-edit:${d}:${null===(r=null===(c=null===(n=null==l?void 0:l.artifactData)||void 0===n?void 0:n.userStorySnapshot)||void 0===c?void 0:c[0])||void 0===r?void 0:r.artifactId}`,{updatedBy:null==o?void 0:o.userName}),null==x||x({status:"success",action:e,metadata:{redlineId:h,aiReasonId:f}})}catch(a){null==x||x({status:"failed",action:e,metadata:{redlineId:h,aiReasonId:f}})}},[]);return e.jsx(C,{...t,resolveRedlineAction:r})},I);exports.default=R;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),i=require("../Popups/PopupDefaults.js"),t=require("react-markdown"),c=require("rehype-raw"),n=require("./CitationComponent.module.css.js"),l=require("lucide-react"),s=require("../icons/cognitiveBrain.svg.js"),d=require("../icons/aiMagic.svg.js"),r=require("./CitationAnchor.js"),o=require("../../../../../service/redlineService.js"),u=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=m(a),f=m(t),p=m(c);const _=({text:a,item:i})=>e.jsx(f.default,{rehypePlugins:[p.default],components:{ol:({children:a})=>e.jsx("ol",{className:n.default["md-ol"],children:a}),ul:({children:a})=>e.jsx("ul",{className:n.default["md-ul"],children:a}),li:({children:a})=>e.jsx("li",{className:n.default["md-li"],children:a}),a:({node:a,href:t,children:c})=>e.jsx(r.default,{href:t,children:c,metaData:{citations:i.citations,docData:i.docData}})},children:a.replace(/<br\s*\/?>/gi,"\n")});var j=a.memo(function({item:t,title:c="Cognitive Decisioning AI",relevanceScore:r=0,showRelevanceScore:m=!0,reason:f="No reasoning provided.",impact:p="No Impact provided.",explaination:j="No explaination provided.",gap:h="None",onClose:v=()=>{},onActionTrigger:N,showResolveBtns:b=!1,sections:y,leftIcon:g,scoreIcon:I,className:C,customStyles:A={},actions:k,disableAllActions:R=!1,actionBtnDisabledStyle:q={},onBackClick:B,isImpactNeeded:D=!0,cognitiveTitle:H="Cognitive Integrity",labels:$={},redlineId:T,aiReasonId:w}){const L=a.useMemo(()=>{const e=Number(r);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[r]),M=a.useMemo(()=>{const e=$&&$.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const a=e.trim().toLowerCase();return"none"===a||"no gap"===a||"no gaps"===a||"n/a"===a})(h)?e:h},[h]),P=$&&$.impact||"Impact",S=$&&$.explanation||"Explaination",E=$&&$.decisionFactors||"Decision Making Factors",U=$&&$.gaps||"Gaps in Decision",F=$&&$.accept||"Accept",G=$&&$.reject||"Reject",W=$&&$.backAriaLabel||"Go back",{redlineDcoumentId:O,redlineConfig:z,updateRedlineDataParent:J}=u.useRequirementAI(),K=async e=>{var a,i;null==N||N({status:"loading",action:e,metadata:{redlineId:T,aiReasonId:w}});try{const{updated_reqai:t}=await o.resolveRedline({documentId:O,userEmail:null==z?void 0:z.userEmail,userName:null==z?void 0:z.userName,redlineId:null!=T?T:"",action:e,baseApiUrl:null==z?void 0:z.baseApiUrl,redlineConfigId:null!==(a=null==z?void 0:z.redlineConfigId)&&void 0!==a?a:""},null!==(i=null==z?void 0:z.token)&&void 0!==i?i:"");await(null==J?void 0:J(t)),null==N||N({status:"success",action:e,metadata:{redlineId:T,aiReasonId:w}})}catch(a){null==N||N({status:"failed",action:e,metadata:{redlineId:T,aiReasonId:w}})}},Q=k||[{id:"reject",label:G,onClick:()=>K("reject"),className:n.default["btn-reject"]},{id:"accept",label:F,onClick:()=>K("accept"),className:n.default["btn-accept"]}];return e.jsxs("div",{className:`${n.default["cite-acc"]} ${C||""}`,style:{...i.default.CitationAccordionDefaults.container,...null==A?void 0:A.container},children:[B&&e.jsxs("div",{className:n.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:n.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),B&&B()},"aria-label":W,children:"‹"}),e.jsx("span",{className:n.default["cite-acc__backTitle"],children:H})]}),e.jsx("div",{className:n.default["cite-body"],children:y&&y.length>0?y.map(a=>!1===a.show?null:e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],style:{...i.default.CitationAccordionDefaults.innerHeader,...null==A?void 0:A.innerHeader},children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:a.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),v&&v()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...i.default.CitationAccordionDefaults.innerBody,...null==A?void 0:A.innerBody},children:"string"==typeof a.content?e.jsx(_,{text:a.content,item:a.item||t||{}}):a.content})]},a.id||a.title)):e.jsxs(e.Fragment,{children:[D&&e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:P})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),v&&v()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(_,{text:p||"",item:t||{}})})]}),e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:S})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(_,{text:j||"",item:{}})})]}),b&&e.jsx("div",{className:n.default["cite-acc__btn-container"],children:Q.map(a=>{const i=R||a.disabled;return e.jsx("button",{className:a.className,onClick:i?void 0:a.onClick,disabled:i,style:{...a.style,...i?{opacity:.5,cursor:"not-allowed",...q,...a.disabledStyle}:{}},children:a.label},a.id)})}),e.jsxs("div",{className:n.default["cite-acc__header"],children:[e.jsxs("div",{className:n.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:n.default["cite-acc__titleIcon"],children:g?"function"==typeof g?x.default.createElement(g):g:e.jsx(s.ReactComponent,{})}),e.jsx("div",{className:n.default["cite-acc__title"],children:c})]}),e.jsx("div",{className:n.default["cite-acc__headerRight"],children:m&&e.jsxs("span",{className:n.default["cite-acc__scoreBadge"],children:[I?"function"==typeof I?x.default.createElement(I):I:e.jsx(d.ReactComponent,{}),e.jsxs("span",{className:n.default["cite-acc__scoreText"],children:[L,"%"]})]})})]}),e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:E})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(_,{text:f||"",item:t||{}})})]}),e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${n.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:U})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(_,{text:M||"",item:t||{}})})]})]})})]})},(e,a)=>e.disableAllActions===a.disableAllActions&&(e.redlineId===a.redlineId&&(e.aiReasonId===a.aiReasonId&&(e.relevanceScore===a.relevanceScore&&(e.reason===a.reason&&(e.impact===a.impact&&(e.explaination===a.explaination&&e.gap===a.gap)))))));exports.default=j;
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),c=require("../cws/CwsEvent.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=p(t);const g=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],u=({toneIndex:i,configs:t=g})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},v=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],m={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},y={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},f={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},j={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},b={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},C={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},k={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},I={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},T={display:"flex",gap:8,marginBottom:18},B={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},A={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},E={borderTop:"0.5px solid #eee",padding:"14px 0px"},R={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},W={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},D={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},F={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},z={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},L={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},M={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},H={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},_={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},q=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{..._,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(q,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),N=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(x.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var $=t.memo(function({onClose:p,aiReason:x,onActionTrigger:_,onIterate:q,initialTone:$,onRegenerate:V,labels:U={},toneLevelsConfig:G=h,toneColorsConfig:K=m,dialConfigs:X=g,actions:J,disableAllActions:Q=!1,customStyles:Y={},severityChipStyles:Z={},customIcons:ee={},onOpenCognitive:ie,onHistoryClick:te,historyIconSmall:ne,historyTootipTitle:oe,showTone:le=!0,cognitiveSectionStyle:re={},cognitiveScoreBadgeStyle:se={},cognitiveScoreTextStyle:de={},cognitiveStyles:ae={},cognitiveClassNames:ce={},cognitiveTitle:pe="Cognitive Integrity",cognitiveTootipTitle:xe="Cognitive Decisioning",cognitiveLeftIcon:ge,cognitiveIconSmall:ue,showCognitiveRightArrow:ve=!0,isStreaming:he,onAssignClick:me,assignedUsers:ye,onReviewUsersClick:fe,redlineId:je,aiReasonId:we,displayVariant:Se="default",reviewTitle:be,reviewSubtitle:Ce,reviewStatusIcon:ke=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:Ie=[],showReviewProgress:Te=!1,showOriginalText:Be=!1,originalText:Ae,originalTextHeader:Ee="Original text",hideSummaryText:Re=!1,hideSeverityChip:We=!1}){var De,Fe,ze,Le,Me,He,_e,qe,Oe,Ne,Pe,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe,Ye;let Ze=G.findIndex(e=>e===$);-1===Ze&&(Ze=1);const[ei,ii]=t.useState(!0),[ti,ni]=t.useState(!1),[oi,li]=t.useState(!1),[ri,si]=t.useState(Ze),[di]=t.useState(Ze),[ai,ci]=t.useState(!0),pi="review"===Se,xi=G[ri],gi=K[xi]||"#BA7517",ui=ri!==di,vi=[{id:"iterate",icon:ee.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:U.btnIterate||"Iterate",color:"#64748B",onClick:q},{id:"accept",icon:ee.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:U.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:ee.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:U.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:mi,updateRedlineDataParent:yi}=s.useRequirementAI(),fi=J||vi;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...y,...null===(De=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===De?void 0:De.root},children:[e.jsxs("div",{style:{...f,...null===(Fe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.header,marginBottom:pi?14:oi?"16px":"12px",...pi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[pi?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:ke||ee.summaryIcon||"⏳"}),e.jsx("span",{children:be||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Ce||(null===(ze=null==x?void 0:x.redlining_details)||void 0===ze?void 0:ze.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:ee.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...j,...null===(Le=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Le?void 0:Le.title},children:U.summaryHeader||"Summary"})]}),ye&&ye.length>0&&e.jsx(N,{users:ye,onClick:e=>{e.stopPropagation(),null==fe||fe()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(me||ie||te)&&e.jsx(O,{onAssignClick:me,onOpenCognitive:ie,cognitiveIconSmall:ue,cognitiveTootipTitle:xe,historyIconSmall:ne,onHistoryClick:te,historyTootipTitle:oe}),e.jsx("button",{onClick:p,style:{...A,...null===(Me=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Me?void 0:Me.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),pi&&Te&&Ie.length>0&&e.jsx(P,{steps:Ie}),!Re&&!pi&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(He=null==x?void 0:x.redlining_details)||void 0===He?void 0:He.redline_title,children:e.jsx("p",{style:{...w,...null===(_e=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===_e?void 0:_e.bodyText},children:null===(qe=null==x?void 0:x.redlining_details)||void 0===qe?void 0:qe.redline_title})})}),e.jsx("p",{style:{...S,...null===(Oe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(Ne=null==x?void 0:x.redlining_details)||void 0===Ne?void 0:Ne.redline_summary}),e.jsxs("div",{style:{...b,...null===(Pe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ii(!ei),style:{...k,...null===($e=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggle},children:[e.jsx("span",{style:{...I,...null===(Ve=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactToggleLabel},children:U.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ei?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(v,{type:(null==x?void 0:x.severity)||"Medium",customStyles:Z})]}),ei&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...C,...null===(Ue=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ke=null===(Ge=null==x?void 0:x.redlining_details)||void 0===Ge?void 0:Ge.redline_impact)&&void 0!==Ke?Ke:U.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Xe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactMarkdown})})})]}),pi&&Be&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ci(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ee}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:ai?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),ai&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Ae||"","”"]})]}),e.jsx("div",{style:{...T,...null===(Je=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Je?void 0:Je.actionContainer},children:fi.map(i=>{var t,n;const o=Q||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...B,...null===(n=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{var e,t;if(i.useLabel)try{await(null===(e=i.onClick)||void 0===e?void 0:e.call(i))}finally{await(async e=>{var i,t,n,o,l,r;null==_||_({status:"loading",action:e,metadata:{redlineId:je,aiReasonId:we}});try{const{updated_reqai:s}=await d.resolveRedline({documentId:hi,userEmail:null==mi?void 0:mi.userEmail,userName:null==mi?void 0:mi.userName,redlineId:null!==(i=null==x?void 0:x.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==mi?void 0:mi.baseApiUrl,redlineConfigId:null!==(t=null==mi?void 0:mi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==mi?void 0:mi.token)&&void 0!==n?n:"");await(null==yi?void 0:yi(s)),c.default.emit(`redline-edit:${hi}:${null===(r=null===(l=null===(o=null==s?void 0:s.artifactData)||void 0===o?void 0:o.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===r?void 0:r.artifactId}`,{updatedBy:null==mi?void 0:mi.userName}),null==_||_({status:"success",action:e,metadata:{redlineId:je,aiReasonId:we}})}catch(i){null==_||_({status:"failed",action:e,metadata:{redlineId:je,aiReasonId:we}})}})(i.id.toLowerCase())}else await(null===(t=i.onClick)||void 0===t?void 0:t.call(i))},disabled:o,children:[i.icon,i.label]},i.id)})}),le&&e.jsxs("div",{style:{...E,...null===(Qe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneContainer},children:[e.jsxs("button",{onClick:()=>ni(!ti),style:{...R,...null===(Ye=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u,{toneIndex:ri,configs:X}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:U.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ti?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ti&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:U.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:ui,onToneChange:e=>{si(e)},toneColor:gi,toneIndex:ri,onClickRegenerate:()=>null==V?void 0:V(xi),toneLabels:G,isStreaming:he,aiReason:x})]})]}),ie&&e.jsxs("div",{className:null==ce?void 0:ce.section,onClick:e=>{e.stopPropagation(),ie&&ie(e)},style:{...W,...null==ae?void 0:ae.section,...re},children:[e.jsxs("div",{className:null==ce?void 0:ce.headerLeft,style:{...D,...null==ae?void 0:ae.headerLeft},children:[e.jsx("span",{className:null==ce?void 0:ce.titleIcon,style:{...F,...null==ae?void 0:ae.titleIcon},children:null!=ge?ge:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ce?void 0:ce.cognitiveTitle,style:{...z,...null==ae?void 0:ae.cognitiveTitle},children:pe})]}),e.jsxs("div",{className:null==ce?void 0:ce.headerRight,style:{...L,...null==ae?void 0:ae.headerRight},children:[void 0!==(null==x?void 0:x.relevance_score)&&null!==(null==x?void 0:x.relevance_score)?e.jsxs("span",{className:null==ce?void 0:ce.scoreBadge,style:{...M,...null==ae?void 0:ae.scoreBadge,...se},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ce?void 0:ce.scoreText,style:{...H,...null==ae?void 0:ae.scoreText,...de},children:[Math.round(Number(x.relevance_score)),"%"]})]}):null,ve&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=q,exports.DisplayUsers=N,exports.KebabMenu=O,exports.default=$;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(t);const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],g=({toneIndex:i,configs:t=x})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],v={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},m={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},y={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},f={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},j={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},w={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},S={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},b={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},k={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},B={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},A={borderTop:"0.5px solid #eee",padding:"14px 0px"},E={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},R={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},W={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},L={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},D={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},F={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},z={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},M={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},H={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},_=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{...H,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(_,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),q=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(p.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var N=t.memo(function({onClose:c,aiReason:p,onActionTrigger:H,onIterate:_,initialTone:N,onRegenerate:$,labels:V={},toneLevelsConfig:U=h,toneColorsConfig:G=v,dialConfigs:K=x,actions:X,disableAllActions:J=!1,customStyles:Q={},severityChipStyles:Y={},customIcons:Z={},onOpenCognitive:ee,onHistoryClick:ie,historyIconSmall:te,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:le={},cognitiveScoreBadgeStyle:re={},cognitiveScoreTextStyle:se={},cognitiveStyles:de={},cognitiveClassNames:ae={},cognitiveTitle:ce="Cognitive Integrity",cognitiveTootipTitle:pe="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:ge,showCognitiveRightArrow:ue=!0,isStreaming:he,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:fe,aiReasonId:je,displayVariant:we="default",reviewTitle:Se,reviewSubtitle:be,reviewStatusIcon:Ce=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ke=[],showReviewProgress:Ie=!1,showOriginalText:Te=!1,originalText:Be,originalTextHeader:Ae="Original text",hideSummaryText:Ee=!1,hideSeverityChip:Re=!1}){var We,Le,De,Fe,ze,Me,He,_e,Oe,qe,Pe,Ne,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe;let Ye=U.findIndex(e=>e===N);-1===Ye&&(Ye=1);const[Ze,ei]=t.useState(!0),[ii,ti]=t.useState(!1),[ni,oi]=t.useState(!1),[li,ri]=t.useState(Ye),[si]=t.useState(Ye),[di,ai]=t.useState(!0),ci="review"===we,pi=U[li],xi=G[pi]||"#BA7517",gi=li!==si,ui=[{id:"iterate",icon:Z.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:V.btnIterate||"Iterate",color:"#64748B",onClick:_},{id:"accept",icon:Z.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:V.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Z.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:V.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:vi,updateRedlineDataParent:mi}=s.useRequirementAI(),yi=async e=>{var i,t,n;null==H||H({status:"loading",action:e,metadata:{redlineId:fe,aiReasonId:je}});try{const{updated_reqai:o}=await d.resolveRedline({documentId:hi,userEmail:null==vi?void 0:vi.userEmail,userName:null==vi?void 0:vi.userName,redlineId:null!==(i=null==p?void 0:p.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==vi?void 0:vi.baseApiUrl,redlineConfigId:null!==(t=null==vi?void 0:vi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==vi?void 0:vi.token)&&void 0!==n?n:"");await(null==mi?void 0:mi(o)),null==H||H({status:"success",action:e,metadata:{redlineId:fe,aiReasonId:je}})}catch(i){null==H||H({status:"failed",action:e,metadata:{redlineId:fe,aiReasonId:je}})}},fi=X||ui;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...m,...null===(We=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===We?void 0:We.root},children:[e.jsxs("div",{style:{...y,...null===(Le=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Le?void 0:Le.header,marginBottom:ci?14:ni?"16px":"12px",...ci&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[ci?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:Ce||Z.summaryIcon||"⏳"}),e.jsx("span",{children:Se||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:be||(null===(De=null==p?void 0:p.redlining_details)||void 0===De?void 0:De.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Z.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...f,...null===(Fe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.title},children:V.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||ee||ie)&&e.jsx(O,{onAssignClick:ve,onOpenCognitive:ee,cognitiveIconSmall:ge,cognitiveTootipTitle:pe,historyIconSmall:te,onHistoryClick:ie,historyTootipTitle:ne}),e.jsx("button",{onClick:c,style:{...B,...null===(ze=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===ze?void 0:ze.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),ci&&Ie&&ke.length>0&&e.jsx(P,{steps:ke}),!Ee&&!ci&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(Me=null==p?void 0:p.redlining_details)||void 0===Me?void 0:Me.redline_title,children:e.jsx("p",{style:{...j,...null===(He=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===He?void 0:He.bodyText},children:null===(_e=null==p?void 0:p.redlining_details)||void 0===_e?void 0:_e.redline_title})})}),e.jsx("p",{style:{...w,...null===(Oe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(qe=null==p?void 0:p.redlining_details)||void 0===qe?void 0:qe.redline_summary}),e.jsxs("div",{style:{...S,...null===(Pe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ei(!Ze),style:{...C,...null===(Ne=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactToggle},children:[e.jsx("span",{style:{...k,...null===($e=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggleLabel},children:V.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ze?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==p?void 0:p.severity)||"Medium",customStyles:Y})]}),Ze&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...b,...null===(Ve=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ge=null===(Ue=null==p?void 0:p.redlining_details)||void 0===Ue?void 0:Ue.redline_impact)&&void 0!==Ge?Ge:V.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ke=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactMarkdown})})})]}),ci&&Te&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ai(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ae}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:di?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),di&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Be||"","”"]})]}),e.jsx("div",{style:{...I,...null===(Xe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.actionContainer},children:fi.map(i=>{var t,n;const o=J||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...T,...null===(n=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{if(i.onClick){return void(!0===await i.onClick()&&i.useLabel&&await yi(i.id.toLowerCase()))}i.useLabel&&await yi(i.id.toLowerCase())},disabled:o,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...A,...null===(Je=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Je?void 0:Je.toneContainer},children:[e.jsxs("button",{onClick:()=>ti(!ii),style:{...E,...null===(Qe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(g,{toneIndex:li,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:V.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ii?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ii&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:V.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:gi,onToneChange:e=>{ri(e)},toneColor:xi,toneIndex:li,onClickRegenerate:()=>null==$?void 0:$(pi),toneLabels:U,isStreaming:he,aiReason:p})]})]}),ee&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),ee&&ee(e)},style:{...R,...null==de?void 0:de.section,...le},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...W,...null==de?void 0:de.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...L,...null==de?void 0:de.titleIcon},children:null!=xe?xe:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...D,...null==de?void 0:de.cognitiveTitle},children:ce})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...F,...null==de?void 0:de.headerRight},children:[void 0!==(null==p?void 0:p.relevance_score)&&null!==(null==p?void 0:p.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...z,...null==de?void 0:de.scoreBadge,...re},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...M,...null==de?void 0:de.scoreText,...se},children:[Math.round(Number(p.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=_,exports.DisplayUsers=q,exports.KebabMenu=O,exports.default=N;
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./PopupDefaults.js"),o=require("../icons/History.svg.js"),i=require("../icons/message-chat-square.svg.js"),r=require("./ToneToggle.js");const a=[{id:"chat",icon:e.jsx(i.ReactComponent,{}),label:"Chat",description:"Type on what basis you want to iterate"},{id:"risk",icon:e.jsx(i.ReactComponent,{}),label:"Shift the risk",description:"Adjust how aggressive or lenient the language is"},{id:"history",icon:e.jsx(o.ReactComponent,{}),label:"Historical Recommendations",description:"Pull from past recommended clauses"}],s=["Lenient","Balanced","Aggressive"],l={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},d=["Grounded","Innovative"];function c({chatTitle:n,chatBody:t,mergedStyles:o=f}){return e.jsx("div",{style:o.body,children:e.jsxs("div",{style:o.chatBanner,children:[e.jsx("p",{style:o.chatBannerTitle,children:n}),e.jsx("p",{style:o.chatBannerBody,children:t})]})})}function g({initialTone:t,onRiskRegenerate:o,riskMode:i,toneLevelsConfig:a=s,toneColorsConfig:c=l,riskModesConfig:g=d,mergedStyles:p=f,isStreaming:h,aiReason:x}){let u=a.findIndex(e=>e===t);-1===u&&(u=1);const[y,b]=n.useState(i||g[0]||"Grounded"),[m,k]=n.useState(u),[C]=n.useState(u),j=a[m],S=c[j]||"#BA7517",v=m!==C||i!==y;return e.jsxs("div",{style:p.body,children:[e.jsx("div",{style:{display:"flex",gap:8,marginBottom:16},children:g.map(n=>e.jsxs("button",{onClick:()=>b(n),style:{flex:1,display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid "+(y===n?"#7c5cbf":"#e0ddd8"),background:"#fff",cursor:"pointer",fontSize:13,fontWeight:500,color:"#1a1a1a"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:"50%",border:"2px solid "+(y===n?"#7c5cbf":"#ccc"),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:y===n&&e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#7c5cbf"}})}),n.charAt(0).toUpperCase()+n.slice(1)]},n))}),e.jsx(r.ToneToggle,{onToneChange:e=>k(e),toneColor:S,isDirty:v,toneIndex:m,onClickRegenerate:()=>null==o?void 0:o({tone:j,mode:y}),isStreaming:h,aiReason:x})]})}function p({type:n,onRiskRegenerate:t,initialTone:o,riskMode:i,chatTitle:r,chatBody:a,toneLevelsConfig:s,toneColorsConfig:l,riskModesConfig:d,mergedStyles:p=f,isStreaming:h,aiReason:x}){return"chat"===n?e.jsx(c,{chatTitle:r,chatBody:a,mergedStyles:p}):"risk"===n?e.jsx(g,{onRiskRegenerate:t,initialTone:o,riskMode:i,toneLevelsConfig:s,toneColorsConfig:l,riskModesConfig:d,mergedStyles:p,isStreaming:h,aiReason:x}):null}const f={card:{background:"#fff",border:"0.5px solid #e8e7e3",borderRadius:14,width:300,fontFamily:"system-ui, sans-serif"},header:{display:"flex",alignItems:"center",gap:8,padding:"14px 16px",borderBottom:"0.5px solid #e8e7e3"},backBtn:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#888",padding:0,lineHeight:1},headerTitle:{fontSize:14,fontWeight:500,color:"#1a1a1a"},row:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",cursor:"pointer",border:"none",textAlign:"left",gap:10,boxSizing:"border-box",backgroundColor:"transparent"},rowLeft:{display:"flex",alignItems:"flex-start",gap:10,flex:1},icon:{fontSize:16,color:"#666",marginTop:1,flexShrink:0},label:{margin:0,fontSize:14,fontWeight:500,color:"#1a1a1a"},desc:{margin:"2px 0 0",fontSize:12,color:"#888",lineHeight:1.4},chevron:{fontSize:18,color:"#aaa",flexShrink:0,display:"inline-block",transition:"transform 0.2s"},body:{padding:"0 16px 14px 16px"},chatBanner:{background:"#eef4fd",border:"1px solid #c5d8f7",borderRadius:10,padding:"12px 14px",marginBottom:10},chatBannerTitle:{margin:"0 0 6px",fontSize:14,fontWeight:600,color:"#3a5a8a"},chatBannerBody:{margin:0,fontSize:13,color:"#4a6080",lineHeight:1.5},applyBtn:{display:"flex",padding:"7px 10.5px",justifyContent:"center",alignItems:"center",gap:"7px",marginTop:8,fontSize:13,borderRadius:6,border:"1px solid #2563EB",background:"#2563EB",color:"#fff"},rangeLabel:{fontSize:12,color:"#888"},segmentedControl:{border:"1px solid #F2F4F7",display:"flex",background:"#F9FAFB",borderRadius:4,padding:6,gap:8},segmentedBtn:{flex:1,padding:"7px 0",fontSize:13,fontWeight:500,color:"#888",background:"transparent",border:"none",borderRadius:8,cursor:"pointer",transition:"background 0.15s, color 0.15s"},segmentedBtnActive:{background:"#dce8fa",color:"#2a4a7a",fontWeight:700},clauseCard:{background:"#fff",border:"1px solid #dde5f0",borderRadius:12,padding:"12px 14px",textAlign:"left",width:"100%"},clauseFilename:{margin:"0 0 6px",fontSize:13,fontWeight:600,color:"#2a4a7a"},clauseExcerpt:{margin:0,fontSize:13,color:"#4a5a70",fontStyle:"italic",lineHeight:1.5}};exports.DEFAULT_RISK_MODES=d,exports.default=function({onBack:o,onChatClick:i,onRiskRegenerate:r,initialTone:c,riskMode:g,onApply:h,onTabToggle:x,menuItemsConfig:u=a,chatTitle:y="Chat mode active",chatBody:b="You are now chatting about this redline, continue the conversation in the left panel to refine or update it",headerTitle:m="How would you like to iterate?",customStyles:k={},toneLevelsConfig:C=s,toneColorsConfig:j=l,riskModesConfig:S=d,isStreaming:v,aiReason:B}){const[R,T]=n.useState(null),w={...t.default.IterateMenuDefaults.styles,...f,...k};return e.jsxs("div",{style:w.card,children:[e.jsxs("div",{style:w.header,children:[e.jsx("button",{onClick:o,style:w.backBtn,"aria-label":"Go back",children:"‹"}),e.jsx("span",{style:w.headerTitle,children:m})]}),e.jsx("div",{style:{width:"100%",maxHeight:"300px",overflow:"auto"},children:u.map((n,t)=>{const o=R===n.id;return e.jsxs("div",{style:{borderBottom:t<u.length-1?"0.5px solid #e8e7e3":"none"},children:[e.jsxs("button",{onClick:()=>{var e;"history"!==(e=n.id)?T(n=>n===e?null:("chat"===e&&(null==i||i()),x&&x(e),e)):x&&x(e)},style:w.row,children:[e.jsx("div",{style:w.rowLeft,children:e.jsxs("div",{children:[e.jsx("p",{style:w.label,children:n.label}),e.jsx("p",{style:w.desc,children:n.description})]})}),e.jsx("span",{style:{...w.chevron,transform:o?"rotate(90deg)":"rotate(0deg)"},children:"›"})]}),e.jsx("div",{style:{maxHeight:o?400:0,overflow:"auto",transition:"max-height 0.25s ease"},children:e.jsx(p,{type:n.id,onRiskRegenerate:r,initialTone:c,riskMode:g,chatTitle:y,chatBody:b,toneLevelsConfig:C,toneColorsConfig:j,riskModesConfig:S,mergedStyles:w,aiReason:B,isStreaming:v})})]},n.id)})})]})},exports.menuItems=a,exports.styles=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("./PopupDefaults.js"),i=require("../icons/History.svg.js"),o=require("../icons/message-chat-square.svg.js"),a=require("./ToneToggle.js");const r=[{id:"chat",icon:e.jsx(o.ReactComponent,{}),label:"Chat",description:"Type on what basis you want to iterate"},{id:"risk",icon:e.jsx(o.ReactComponent,{}),label:"Shift the risk",description:"Adjust how aggressive or lenient the language is"},{id:"history",icon:e.jsx(i.ReactComponent,{}),label:"Historical Recommendations",description:"Pull from past recommended clauses"}],s=[{id:"1",filename:"Mutual_DA2.pdf",excerpt:'"...shall protect Confidential Information using at least the same degree of care as it uses to protect its own confidential information, but no less than reasonable c..."',tab:"Balanced"},{id:"2",filename:"Tech NDA.pdf",excerpt:'"...protect confidential information using reasonable care and appropriate safeguards..."',tab:"Balanced"},{id:"3",filename:"Corp NDA.pdf",excerpt:'"...shall use best efforts to protect any disclosed confidential materials from unauthorised access or disclosure..."',tab:"Aggressive"},{id:"4",filename:"Vendor Agreement.pdf",excerpt:'"...may use disclosed information solely for the stated purpose with no special handling required..."',tab:"Lenient"}],l=["Lenient","Balanced","Aggressive"],d={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},c=["Grounded","Innovative"];function g({chatTitle:t,chatBody:n,mergedStyles:i=u}){return e.jsx("div",{style:i.body,children:e.jsxs("div",{style:i.chatBanner,children:[e.jsx("p",{style:i.chatBannerTitle,children:t}),e.jsx("p",{style:i.chatBannerBody,children:n})]})})}function p({initialTone:n,onRiskRegenerate:i,riskMode:o,toneLevelsConfig:r=l,toneColorsConfig:s=d,riskModesConfig:g=c,mergedStyles:p=u,isStreaming:f,aiReason:h}){let x=r.findIndex(e=>e===n);-1===x&&(x=1);const[y,m]=t.useState(o||g[0]||"Grounded"),[b,C]=t.useState(x),[j]=t.useState(x),k=r[b],v=s[k]||"#BA7517",S=b!==j||o!==y;return e.jsxs("div",{style:p.body,children:[e.jsx("div",{style:{display:"flex",gap:8,marginBottom:16},children:g.map(t=>e.jsxs("button",{onClick:()=>m(t),style:{flex:1,display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid "+(y===t?"#7c5cbf":"#e0ddd8"),background:"#fff",cursor:"pointer",fontSize:13,fontWeight:500,color:"#1a1a1a"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:"50%",border:"2px solid "+(y===t?"#7c5cbf":"#ccc"),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:y===t&&e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#7c5cbf"}})}),t.charAt(0).toUpperCase()+t.slice(1)]},t))}),e.jsx(a.ToneToggle,{onToneChange:e=>C(e),toneColor:v,isDirty:S,toneIndex:b,onClickRegenerate:()=>null==i?void 0:i({tone:k,mode:y}),isStreaming:f,aiReason:h})]})}function f({onApply:n,historicalClausesData:i=s,toneLevelsConfig:o=l,mergedStyles:a=u}){const r=o.length>1?o[1]:o[0]||"Balanced",[d,c]=t.useState(r),g=i.filter(e=>e.tab===d);return e.jsxs("div",{style:a.body,children:[e.jsx("div",{style:a.segmentedControl,children:o.map(t=>e.jsx("button",{onClick:()=>c(t),style:{...a.segmentedBtn,...d===t?a.segmentedBtnActive:{}},children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,marginTop:12},children:[g.map(t=>e.jsxs("button",{onClick:()=>null==n?void 0:n({type:"history",value:t.excerpt}),style:a.clauseCard,children:[e.jsx("p",{style:a.clauseFilename,children:t.filename}),e.jsx("p",{style:a.clauseExcerpt,children:t.excerpt})]},t.id)),0===g.length&&e.jsx("p",{style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"},children:"No clauses for this tone"})]})]})}function h({type:t,onRiskRegenerate:n,initialTone:i,riskMode:o,onApply:a,chatTitle:r,chatBody:s,historicalClausesData:l,toneLevelsConfig:d,toneColorsConfig:c,riskModesConfig:h,mergedStyles:x=u,isStreaming:y,aiReason:m}){return"chat"===t?e.jsx(g,{chatTitle:r,chatBody:s,mergedStyles:x}):"risk"===t?e.jsx(p,{onRiskRegenerate:n,initialTone:i,riskMode:o,toneLevelsConfig:d,toneColorsConfig:c,riskModesConfig:h,mergedStyles:x,isStreaming:y,aiReason:m}):"history"===t?e.jsx(f,{onApply:a,historicalClausesData:l,toneLevelsConfig:d,mergedStyles:x}):null}const u={card:{background:"#fff",border:"0.5px solid #e8e7e3",borderRadius:14,width:300,fontFamily:"system-ui, sans-serif"},header:{display:"flex",alignItems:"center",gap:8,padding:"14px 16px",borderBottom:"0.5px solid #e8e7e3"},backBtn:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#888",padding:0,lineHeight:1},headerTitle:{fontSize:14,fontWeight:500,color:"#1a1a1a"},row:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",cursor:"pointer",border:"none",textAlign:"left",gap:10,boxSizing:"border-box",backgroundColor:"transparent"},rowLeft:{display:"flex",alignItems:"flex-start",gap:10,flex:1},icon:{fontSize:16,color:"#666",marginTop:1,flexShrink:0},label:{margin:0,fontSize:14,fontWeight:500,color:"#1a1a1a"},desc:{margin:"2px 0 0",fontSize:12,color:"#888",lineHeight:1.4},chevron:{fontSize:18,color:"#aaa",flexShrink:0,display:"inline-block",transition:"transform 0.2s"},body:{padding:"0 16px 14px 16px"},chatBanner:{background:"#eef4fd",border:"1px solid #c5d8f7",borderRadius:10,padding:"12px 14px",marginBottom:10},chatBannerTitle:{margin:"0 0 6px",fontSize:14,fontWeight:600,color:"#3a5a8a"},chatBannerBody:{margin:0,fontSize:13,color:"#4a6080",lineHeight:1.5},applyBtn:{display:"flex",padding:"7px 10.5px",justifyContent:"center",alignItems:"center",gap:"7px",marginTop:8,fontSize:13,borderRadius:6,border:"1px solid #2563EB",background:"#2563EB",color:"#fff"},rangeLabel:{fontSize:12,color:"#888"},segmentedControl:{border:"1px solid #F2F4F7",display:"flex",background:"#F9FAFB",borderRadius:4,padding:6,gap:8},segmentedBtn:{flex:1,padding:"7px 0",fontSize:13,fontWeight:500,color:"#888",background:"transparent",border:"none",borderRadius:8,cursor:"pointer",transition:"background 0.15s, color 0.15s"},segmentedBtnActive:{background:"#dce8fa",color:"#2a4a7a",fontWeight:700},clauseCard:{background:"#fff",border:"1px solid #dde5f0",borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",width:"100%"},clauseFilename:{margin:"0 0 6px",fontSize:13,fontWeight:600,color:"#2a4a7a"},clauseExcerpt:{margin:0,fontSize:13,color:"#4a5a70",fontStyle:"italic",lineHeight:1.5}};exports.default=function({onBack:i,onChatClick:o,onRiskRegenerate:a,initialTone:g,riskMode:p,onApply:f,onTabToggle:x,menuItemsConfig:y=r,historicalClausesConfig:m=s,chatTitle:b="Chat mode active",chatBody:C="You are now chatting about this redline, continue the conversation in the left panel to refine or update it",headerTitle:j="How would you like to iterate?",customStyles:k={},toneLevelsConfig:v=l,toneColorsConfig:S=d,riskModesConfig:B=c,isStreaming:R,aiReason:T}){const[A,w]=t.useState(null),z={...n.default.IterateMenuDefaults.styles,...u,...k};return e.jsxs("div",{style:z.card,children:[e.jsxs("div",{style:z.header,children:[e.jsx("button",{onClick:i,style:z.backBtn,"aria-label":"Go back",children:"‹"}),e.jsx("span",{style:z.headerTitle,children:j})]}),e.jsx("div",{style:{width:"100%",maxHeight:"300px",overflow:"auto"},children:y.map((t,n)=>{const i=A===t.id;return e.jsxs("div",{style:{borderBottom:n<y.length-1?"0.5px solid #e8e7e3":"none"},children:[e.jsxs("button",{onClick:()=>{return e=t.id,w(t=>t===e?null:("chat"===e&&(null==o||o()),x&&x(e),e));var e},style:z.row,children:[e.jsx("div",{style:z.rowLeft,children:e.jsxs("div",{children:[e.jsx("p",{style:z.label,children:t.label}),e.jsx("p",{style:z.desc,children:t.description})]})}),e.jsx("span",{style:{...z.chevron,transform:i?"rotate(90deg)":"rotate(0deg)"},children:"›"})]}),e.jsx("div",{style:{maxHeight:i?400:0,overflow:"hidden",transition:"max-height 0.25s ease"},children:e.jsx(h,{type:t.id,onRiskRegenerate:a,initialTone:g,riskMode:p,onApply:f,chatTitle:b,chatBody:C,historicalClausesData:m,toneLevelsConfig:v,toneColorsConfig:S,riskModesConfig:B,mergedStyles:z,aiReason:T,isStreaming:R})})]},t.id)})})]})};
2
2
  //# sourceMappingURL=IterateComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),l=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),n=require("../../../../../service/redlineService.js"),d=require("../cws/CwsEvent.js");require("react");const t={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};exports.default=function({onClose:o,editorInfo:r,headerText:a,btnsConfig:s,labelText:c,onActionTrigger:u,aiReason:v=null}){var p,f;const{redlineDcoumentId:x,redlineConfig:b,updateRedlineDataParent:g}=l.useRequirementAI(),y=async e=>{var i,l,t,o,r,a,s;null==u||u({status:"loading",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}});try{const{updated_reqai:c}=await n.resolveRedline({documentId:x,userEmail:null==b?void 0:b.userEmail,userName:null==b?void 0:b.userName,redlineId:null!==(i=null==v?void 0:v.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==b?void 0:b.baseApiUrl,redlineConfigId:null!==(l=null==b?void 0:b.redlineConfigId)&&void 0!==l?l:""},null!==(t=null==b?void 0:b.token)&&void 0!==t?t:"");await(null==g?void 0:g(c)),null===(o=d.default.emit)||void 0===o||o.call(d.default,`redline-edit:${x}:${null===(s=null===(a=null===(r=null==c?void 0:c.artifactData)||void 0===r?void 0:r.userStorySnapshot)||void 0===a?void 0:a[0])||void 0===s?void 0:s.artifactId}`,{updatedBy:null==b?void 0:b.userName}),null==u||u({status:"success",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}})}catch(i){null==u||u({status:"failed",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}})}};return e.jsxs("div",{style:t.popup,children:[e.jsxs("div",{style:t.header,children:[e.jsx("span",{style:t.title,children:a||"Manually Edited"}),e.jsx("button",{onClick:o,style:t.closeButton,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{style:t.content,children:[e.jsxs("div",{style:t.labelRow,children:[e.jsx(i.UserPen,{}),e.jsx("span",{style:t.label,children:c||"Edited By"})]}),e.jsx("div",{style:t.editorInfo,children:r}),e.jsx("div",{style:t.divider}),e.jsxs("div",{style:t.actions,children:[null==s?void 0:s.map(i=>e.jsxs("button",{style:{...t.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==v?void 0:v.redline_id,id:null==v?void 0:v.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(p=null==v?void 0:v.redlining_details)||void 0===p?void 0:p.status)||"rejected"===(null===(f=null==v?void 0:v.redlining_details)||void 0===f?void 0:f.status))&&e.jsxs("div",{style:t.resolveActions,children:[e.jsxs("button",{style:{...t.actionBtn,...(null==v?void 0:v.resolving)?t.actionBtnDisabled:{}},disabled:null==v?void 0:v.resolving,onClick:()=>y("accept"),children:[e.jsx(i.CheckCircle,{size:16,color:"#10B981"})," ","Adopt"]}),e.jsxs("button",{style:{...t.actionBtn,...(null==v?void 0:v.resolving)?t.actionBtnDisabled:{}},onClick:()=>y("reject"),disabled:null==v?void 0:v.resolving,children:[e.jsx(i.XCircle,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),l=require("../../../../../service/redlineService.js");const t={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};exports.default=function({onClose:d,editorInfo:o,headerText:r,btnsConfig:s,labelText:a,onActionTrigger:c,aiReason:u=null}){var v,p;const{redlineDcoumentId:x,redlineConfig:f,updateRedlineDataParent:b}=n.useRequirementAI(),g=async e=>{var i,n,t;null==c||c({status:"loading",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}});try{const{updated_reqai:d}=await l.resolveRedline({documentId:x,userEmail:null==f?void 0:f.userEmail,userName:null==f?void 0:f.userName,redlineId:null!==(i=null==u?void 0:u.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==f?void 0:f.baseApiUrl,redlineConfigId:null!==(n=null==f?void 0:f.redlineConfigId)&&void 0!==n?n:""},null!==(t=null==f?void 0:f.token)&&void 0!==t?t:"");await(null==b?void 0:b(d)),null==c||c({status:"success",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}catch(i){null==c||c({status:"failed",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}};return e.jsxs("div",{style:t.popup,children:[e.jsxs("div",{style:t.header,children:[e.jsx("span",{style:t.title,children:r||"Manually Edited"}),e.jsx("button",{onClick:d,style:t.closeButton,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{style:t.content,children:[e.jsxs("div",{style:t.labelRow,children:[e.jsx(i.UserPen,{}),e.jsx("span",{style:t.label,children:a||"Edited By"})]}),e.jsx("div",{style:t.editorInfo,children:o}),e.jsx("div",{style:t.divider}),e.jsxs("div",{style:t.actions,children:[null==s?void 0:s.map(i=>e.jsxs("button",{style:{...t.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==u?void 0:u.redline_id,id:null==u?void 0:u.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(v=null==u?void 0:u.redlining_details)||void 0===v?void 0:v.status)||"rejected"===(null===(p=null==u?void 0:u.redlining_details)||void 0===p?void 0:p.status))&&e.jsxs("div",{style:t.resolveActions,children:[e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},disabled:null==u?void 0:u.resolving,onClick:()=>g("accept"),children:[e.jsx(i.CheckCircle,{size:16,color:"#10B981"})," ","Adopt"]}),e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},onClick:()=>g("reject"),disabled:null==u?void 0:u.resolving,children:[e.jsx(i.XCircle,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})};
2
2
  //# sourceMappingURL=ManualEditPopup.js.map