@viswa-test/test-citation 0.0.248 → 0.0.250

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 (80) hide show
  1. package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  2. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  3. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  4. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
  8. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
  9. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
  11. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
  12. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
  13. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
  14. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
  15. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
  16. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
  17. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
  18. package/dist/cjs/service/redlineService.js +1 -1
  19. package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  20. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  21. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  22. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  23. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  24. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  25. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
  26. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
  27. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  28. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
  29. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
  30. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
  31. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
  32. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
  33. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
  34. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
  35. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
  36. package/dist/service/redlineService.js +1 -1
  37. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  38. package/dist/types/src/constants/deviationData.d.ts +887 -0
  39. package/dist/types/src/constants/deviationData.d.ts.map +1 -0
  40. package/dist/types/src/constants/treeData.d.ts +732 -0
  41. package/dist/types/src/constants/treeData.d.ts.map +1 -0
  42. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +548 -1251
  43. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  44. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +10 -1
  45. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  46. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  47. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +8 -0
  48. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +1 -0
  49. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  50. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +1 -1
  51. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
  52. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  53. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  54. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts +9 -0
  55. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts.map +1 -0
  56. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  57. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +14 -0
  58. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -0
  59. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts +10 -0
  60. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -0
  61. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +30 -0
  62. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -0
  63. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts +4 -0
  64. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts.map +1 -0
  65. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -0
  66. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -0
  67. package/dist/types/src/methodsToExpose.d.ts +1 -1
  68. package/dist/types/src/service/ProjectService.d.ts +2 -2
  69. package/dist/types/src/service/SavedDataSetService.d.ts +3 -3
  70. package/dist/types/src/service/redlineService.d.ts +6 -0
  71. package/dist/types/src/service/redlineService.d.ts.map +1 -1
  72. package/package.json +3 -3
  73. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  74. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  75. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  76. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  77. package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
  78. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
  79. package/dist/types/src/commonConstants.d.ts +0 -31103
  80. package/dist/types/src/commonConstants.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));const o="https://dev.appmod.ai/backend/legal_mode";exports.createRedlineDocument=async(e,t)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:a}=await n.default.post(`${o}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[createRedlineDocument] Response:",a),a}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,t)=>{try{console.log("[resolveRedline] Request:",e);const{data:a}=await n.default.post(`${o}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[resolveRedline] Response:",a),a}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,t)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:a}=await n.default.put(`${o}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[updateRedlineDocument] Response:",a),a}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.fetchRedlineDocumentSection=async(e,o)=>{try{console.log("[fetchRedlineDocumentSection] Request:",e);const{data:t}=await n.default.get(`${e.baseApiUrl}/redlining/segment/${e.documentId}/${e.sectionId}?redline_config_id=${e.redlineConfigId}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[fetchRedlineDocumentSection] Response:",t),t}catch(e){console.log("[fetchRedlineDocumentSection] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,o)=>{try{console.log("[resolveRedline] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[resolveRedline] Response:",t),t}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,o)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:t}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[updateRedlineDocument] Response:",t),t}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
2
2
  //# sourceMappingURL=redlineService.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as n,useState as t,useMemo as i,useCallback as o,useContext as r}from"react";import{RefProvider as s}from"../../store/ref.context.js";var a;!function(e){e.WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved"}(a||(a={}));const c=n(null),g=({children:n,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,chatHistory:I,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F})=>{const[G,H]=t(0),[O,Q]=t(""),U=i(()=>{if(0===r.length||0===g.length)return Array(r.length).fill(0);const e=Array.from({length:r.length},()=>[]);return g.forEach(n=>{const t=Number(n.relevance_score);if(isNaN(t)||t<=0)return;const i=`ai_reasoning$${n.id}`,o=r.findIndex(e=>{var n;return e.value.includes(i)||(null===(n=e.sub_features)||void 0===n?void 0:n.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(t)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,n)=>e+n,0)/e.length))},[r,g]),b=o(e=>{var n;const t=r.findIndex(n=>n.artifactId===e);return-1===t?0:null!==(n=U[t])&&void 0!==n?n:0},[r,U]);return e(c.Provider,{value:{chatHistory:I,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,getAvgScoreForStory:b,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,currentHighlightIndex:G,setCurrentHighlightIndex:H,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,redlineDcoumentId:O,setRedlineDocumentId:Q,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F},children:e(s,{children:n})})},u=()=>{const e=r(c);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};export{a as SectionStatus,g as default,u as useRequirementAI};
1
+ import{jsxs as e,jsx as n}from"react/jsx-runtime";import{createContext as t,useState as i,useMemo as o,useCallback as r,useContext as s}from"react";import{RefProvider as a}from"../../store/ref.context.js";import"../UserStoryCard/cws/CwsEvent.js";import l from"../UserStoryCard/cws/CwsEventProvider.js";import{Toaster as d}from"react-hot-toast";var c;!function(e){e.WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved"}(c||(c={}));const u=t(null),g="user-story-lib",f=({children:t,userStory:s,setUserStory:c,aiReasoning:f,setAiReasoning:C,citations:m,setCitations:p,apiCachingConfig:h,customStyles:v,customIcons:I,searchQueryList:y,searchQueryReasoningIdList:R,citationConfig:S,chatHistory:E,chatCitationConfigs:A,gptCitationConfigs:w,diffEditConfig:D,aiReasoningAccordionOpenStates:b,persistedDataFiles:U,inlineUpdateComponentConfig:x,segmentComponentConfig:N,onEditBlocked:P,inlineManualComponentConfig:F,redlineConfig:L,sectionStatusConfig:T,customSectionConfig:_,updateRedlineDataParent:j,redlineCollaborativeConfig:k})=>{const[G,H]=i(0),[O,Q]=i(""),B=o(()=>{if(0===s.length||0===f.length)return Array(s.length).fill(0);const e=Array.from({length:s.length},()=>[]);return f.forEach(n=>{const t=Number(n.relevance_score);if(isNaN(t)||t<=0)return;const i=`ai_reasoning$${n.id}`,o=s.findIndex(e=>{var n;return e.value.includes(i)||(null===(n=e.sub_features)||void 0===n?void 0:n.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(t)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,n)=>e+n,0)/e.length))},[s,f]),M=r(e=>{var n;const t=s.findIndex(n=>n.artifactId===e);return-1===t?0:null!==(n=B[t])&&void 0!==n?n:0},[s,B]);return e(u.Provider,{value:{chatHistory:E,userStory:s,setUserStory:c,aiReasoning:f,setAiReasoning:C,citations:m,setCitations:p,apiCachingConfig:h,customStyles:v,customIcons:I,searchQueryList:y,searchQueryReasoningIdList:R,citationConfig:S,getAvgScoreForStory:M,chatCitationConfigs:A,gptCitationConfigs:w,diffEditConfig:D,aiReasoningAccordionOpenStates:b,persistedDataFiles:U,currentHighlightIndex:G,setCurrentHighlightIndex:H,inlineUpdateComponentConfig:x,segmentComponentConfig:N,onEditBlocked:P,inlineManualComponentConfig:F,redlineConfig:L,redlineDcoumentId:O,setRedlineDocumentId:Q,sectionStatusConfig:T,customSectionConfig:_,updateRedlineDataParent:j,redlineCollaborativeConfig:k},children:[n(d,{position:"top-right",toasterId:g}),(null==k?void 0:k.initiateCollaborativeFlow)?n(l,{applicationId:null==k?void 0:k.modeId,baseUrl:null==k?void 0:k.cwsBaseUrl,authToken:null==k?void 0:k.authToken,children:n(a,{children:t})}):n(a,{children:t})]})},C=()=>{const e=s(u);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};export{c as SectionStatus,g as ToasterId,f as default,C as useRequirementAI};
2
2
  //# sourceMappingURL=RequirementAIWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as c}from"react/jsx-runtime";import a,{memo as t,useMemo as n}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import o from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as d}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import h from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as _}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as u}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const N=({text:e,item:c})=>i(r,{rehypePlugins:[o],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:a,children:t})=>i(h,{href:a,children:t,metaData:{citations:c.citations,docData:c.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")}),y=({text:e,markdownStyles:c,citationStyles:a,customIcons:t})=>i(_,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:c,citationStyles:a,customIcons:t});var b=t(function({item:t,title:r="Cognitive Decisioning AI",relevanceScore:o=0,showRelevanceScore:h=!0,reason:_="No reasoning provided.",impact:b="No Impact provided.",explaination:g="No explaination provided.",gap:f="None",onClose:x=()=>{},onActionTrigger:I,showResolveBtns:C=!1,sections:k,leftIcon:A,scoreIcon:S,className:R,customStyles:j={},markdownStyles:w,citationStyles:H,customIcons:B,actions:D,disableAllActions:T=!1,actionBtnDisabledStyle:$={},onBackClick:L,isImpactNeeded:P=!0,cognitiveTitle:M="Cognitive Integrity",labels:E={},chatHistory:q,openInFullscreenOnClick:F=!1,redlineId:G,aiReasonId:W}){const U=n(()=>{const e=Number(o);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[o]),O=n(()=>{const e=E&&E.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),z=E&&E.impact||"Impact",J=E&&E.explanation||"Explaination",K=E&&E.decisionFactors||"Decision Making Factors",Q=E&&E.gaps||"Gaps in Decision",V=E&&E.accept||"Accept",X=E&&E.reject||"Reject",Y=E&&E.backAriaLabel||"Go back",{redlineDcoumentId:Z,redlineConfig:ee,updateRedlineDataParent:ie}=v(),ce=async e=>{var i,c;null==I||I({status:"loading",action:e,metadata:{redlineId:G,aiReasonId:W}});try{const{updated_reqai:a}=await u({documentId:Z,userEmail:null==ee?void 0:ee.userEmail,userName:null==ee?void 0:ee.userName,redlineId:null!=G?G:"",action:e,baseApiUrl:null==ee?void 0:ee.baseApiUrl,redlineConfigId:null!==(i=null==ee?void 0:ee.redlineConfigId)&&void 0!==i?i:""},null!==(c=null==ee?void 0:ee.token)&&void 0!==c?c:"");await(null==ie?void 0:ie(a)),null==I||I({status:"success",action:e,metadata:{redlineId:G,aiReasonId:W}})}catch(i){null==I||I({status:"failed",action:e,metadata:{redlineId:G,aiReasonId:W}})}},ae=D||[{id:"reject",label:X,onClick:()=>ce("reject"),className:s["btn-reject"]},{id:"accept",label:V,onClick:()=>ce("accept"),className:s["btn-accept"]}],te=q&&q.length>0;return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[L&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),L&&L()},"aria-label":Y,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:M})]}),i("div",{className:s["cite-body"],children:k&&k.length>0?k.map(c=>!1===c.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${c.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:c.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),x&&x()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof c.content?i(N,{text:c.content,item:c.item||t||{}}):c.content})]},c.id||c.title)):e(c,{children:[P&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:z})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),x&&x()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(N,{text:b||"",item:t||{}})})]}),g&&"No explaination provided."!==g&&e(c,{children:[e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:J})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(N,{text:g||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),C&&i("div",{className:s["cite-acc__btn-container"],children:ae.map(e=>{const c=T||e.disabled;return i("button",{className:e.className,onClick:c?void 0:e.onClick,disabled:c,style:{...e.style,...c?{opacity:.5,cursor:"not-allowed",...$,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?a.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:h&&e("span",{className:s["cite-acc__scoreBadge"],children:[S?"function"==typeof S?a.createElement(S):S:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[U,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:K})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:te?i(y,{text:_||"",markdownStyles:w,citationStyles:H,customIcons:B}):i(N,{text:_||"",item:t||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:Q})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:te?i(y,{text:O||"",markdownStyles:w,citationStyles:H,customIcons:B}):i(N,{text:O||"",item:t||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{b as default};
1
+ import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as t,useMemo as n}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import o from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as d}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import u from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as v}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as _}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import N from"../cws/CwsEvent.js";const y=({text:e,item:a})=>i(r,{rehypePlugins:[o],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:c,children:t})=>i(u,{href:c,children:t,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")}),b=({text:e,markdownStyles:a,citationStyles:c,customIcons:t})=>i(v,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:a,citationStyles:c,customIcons:t});var g=t(function({item:t,title:r="Cognitive Decisioning AI",relevanceScore:o=0,showRelevanceScore:u=!0,reason:v="No reasoning provided.",impact:g="No Impact provided.",explaination:f="No explaination provided.",gap:x="None",onClose:I=()=>{},onActionTrigger:C,showResolveBtns:k=!1,sections:S,leftIcon:A,scoreIcon:w,className:R,customStyles:j={},markdownStyles:B,citationStyles:D,customIcons:H,actions:$,disableAllActions:T=!1,actionBtnDisabledStyle:L={},onBackClick:P,isImpactNeeded:E=!0,cognitiveTitle:M="Cognitive Integrity",labels:q={},chatHistory:F,openInFullscreenOnClick:G=!1,redlineId:W,aiReasonId:U}){const O=n(()=>{const e=Number(o);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[o]),z=n(()=>{const e=q&&q.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(x)?e:x},[x]),J=q&&q.impact||"Impact",K=q&&q.explanation||"Explaination",Q=q&&q.decisionFactors||"Decision Making Factors",V=q&&q.gaps||"Gaps in Decision",X=q&&q.accept||"Accept",Y=q&&q.reject||"Reject",Z=q&&q.backAriaLabel||"Go back",{redlineDcoumentId:ee,redlineConfig:ie,updateRedlineDataParent:ae}=_(),ce=async e=>{var i,a,c,t,n,l;null==C||C({status:"loading",action:e,metadata:{redlineId:W,aiReasonId:U}});try{const{updated_reqai:r}=await h({documentId:ee,userEmail:null==ie?void 0:ie.userEmail,userName:null==ie?void 0:ie.userName,redlineId:null!=W?W:"",action:e,baseApiUrl:null==ie?void 0:ie.baseApiUrl,redlineConfigId:null!==(i=null==ie?void 0:ie.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==ie?void 0:ie.token)&&void 0!==a?a:"");await(null==ae?void 0:ae(r)),null===(c=N.emit)||void 0===c||c.call(N,`redline-edit:${ee}:${null===(l=null===(n=null===(t=null==r?void 0:r.artifactData)||void 0===t?void 0:t.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===l?void 0:l.artifactId}`,{updatedBy:null==ie?void 0:ie.userName}),null==C||C({status:"success",action:e,metadata:{redlineId:W,aiReasonId:U}})}catch(i){null==C||C({status:"failed",action:e,metadata:{redlineId:W,aiReasonId:U}})}},te=$||[{id:"reject",label:Y,onClick:()=>ce("reject"),className:s["btn-reject"]},{id:"accept",label:X,onClick:()=>ce("accept"),className:s["btn-accept"]}],ne=F&&F.length>0;return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[P&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),P&&P()},"aria-label":Z,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:M})]}),i("div",{className:s["cite-body"],children:S&&S.length>0?S.map(a=>!1===a.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:a.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),I&&I()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof a.content?i(y,{text:a.content,item:a.item||t||{}}):a.content})]},a.id||a.title)):e(a,{children:[E&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:J})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),I&&I()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(y,{text:g||"",item:t||{}})})]}),f&&"No explaination provided."!==f&&e(a,{children:[e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:K})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(y,{text:f||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),k&&i("div",{className:s["cite-acc__btn-container"],children:te.map(e=>{const a=T||e.disabled;return i("button",{className:e.className,onClick:a?void 0:e.onClick,disabled:a,style:{...e.style,...a?{opacity:.5,cursor:"not-allowed",...L,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?c.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:u&&e("span",{className:s["cite-acc__scoreBadge"],children:[w?"function"==typeof w?c.createElement(w):w:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[O,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:Q})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:ne?i(b,{text:v||"",markdownStyles:B,citationStyles:D,customIcons:H}):i(y,{text:v||"",item:t||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:V})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:ne?i(b,{text:z||"",markdownStyles:B,citationStyles:D,customIcons:H}):i(y,{text:z||"",item:t||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{g as default};
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{PenLine as n,CheckCircle as o,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import s,{memo as c,useState as p}from"react";import{ToneToggle as g}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as h}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";import{Tooltip as v}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as x}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as f}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const y=[{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"}],w=({toneIndex:t,configs:n=y})=>{const o=Math.min(t,n.length-1),{color:l,angle:r,arcD:d}=n[o]||n[1]||n[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},S=({type:e,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[e]||n.Medium;return i("div",{style:o,children:e})},b=["Lenient","Balanced","Aggressive"],k={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},I={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},B={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},T={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},A={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},E={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},R={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},W={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},z={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},L={display:"flex",gap:8,marginBottom:18},j={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"},F={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},D={borderTop:"0.5px solid #eee",padding:"14px 0px"},M={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},H={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},_={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},O={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},N={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},P={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},$={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},V={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},U={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=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...U,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:t,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("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:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>n(e),children:[o&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:o}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),G=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,c]=p(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>c(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e("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:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i(q,{onAssignClick:t?()=>{c(!1),t&&t()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),J=c(function({users:t,onClick:n}){const o=t.length;return e("div",{onClick:n,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==t?void 0:t[0].length)>9?(null==t?void 0:t[0].slice(0,9))+"...":null==t?void 0:t[0]}),o>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}),K=c(function({steps:t}){if(!(null==t?void 0:t.length))return null;const n=t.length>=3;return i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:n?"6px 8px":"8px 10px",background:"#F8FAFC",gap:n?4:8,overflow:"hidden"},children:t.map((o,l)=>{const r=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(l),d=l===t.length-1;return e(s.Fragment,{children:[e("div",{title:o.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:n?4:6,overflow:"hidden"},children:[(a=o.status,e("svg","approved"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i("polyline",{points:"22 4 12 14.01 9 11.01"})]}:"rejected"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m15 9-6 6"}),i("path",{d:"m9 9 6 6"})]}:{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("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"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),i("span",{style:{minWidth:0,color:"#475569",fontSize:n?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.initials&&i("span",{style:{width:n?20:22,height:n?20:22,minWidth:n?20:22,borderRadius:"50%",background:r.bg,color:r.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n?9:10,fontWeight:700,lineHeight:1},children:o.initials})]}),!d&&e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"18",height:n?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:n?14:18},children:[i("path",{d:"M5 12h14"}),i("path",{d:"m12 5 7 7-7 7"})]})]},o.id);var a})})})});var Q=c(function({onClose:s,aiReason:c,onActionTrigger:U,onIterate:q,initialTone:Q,onRegenerate:X,labels:Y={},toneLevelsConfig:Z=b,toneColorsConfig:ee=k,dialConfigs:ie=y,actions:te,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:le={},customIcons:re={},onOpenCognitive:de,onHistoryClick:ae,historyIconSmall:se,historyTootipTitle:ce,showTone:pe=!0,cognitiveSectionStyle:ge={},cognitiveScoreBadgeStyle:he={},cognitiveScoreTextStyle:ue={},cognitiveStyles:ve={},cognitiveClassNames:me={},cognitiveTitle:xe="Cognitive Integrity",cognitiveTootipTitle:fe="Cognitive Decisioning",cognitiveLeftIcon:ye,cognitiveIconSmall:we,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:ke,assignedUsers:Ce,onReviewUsersClick:Ie,redlineId:Be,aiReasonId:Te,displayVariant:Ae="default",reviewTitle:Ee,reviewSubtitle:Re,reviewStatusIcon:We=e("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:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("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"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ze=[],showReviewProgress:Le=!1,showOriginalText:je=!1,originalText:Fe,originalTextHeader:De="Original text",hideSummaryText:Me=!1,hideSeverityChip:He=!1}){var _e,Oe,Ne,Pe,$e,Ve,Ue,qe,Ge,Je,Ke,Qe,Xe,Ye,Ze,ei,ii,ti,ni,oi;let li=Z.findIndex(e=>e===Q);-1===li&&(li=1);const[ri,di]=p(!0),[ai,si]=p(!1),[ci,pi]=p(!1),[gi,hi]=p(li),[ui]=p(li),[vi,mi]=p(!0),xi="review"===Ae,fi=Z[gi],yi=ee[fi]||"#BA7517",wi=gi!==ui,Si=[{id:"iterate",icon:re.iterateIcon||i(n,{size:16,color:"#64748B"}),label:Y.btnIterate||"Iterate",color:"#64748B",onClick:q},{id:"accept",icon:re.acceptIcon||i(o,{size:16,color:"#10B981"}),label:Y.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:re.rejectIcon||i(l,{size:16,color:"#DC2626"}),label:Y.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:bi,redlineConfig:ki,updateRedlineDataParent:Ci}=m(),Ii=te||Si;return e("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.root},children:[e("div",{style:{...I,...null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.header,marginBottom:xi?14:ci?"16px":"12px",...xi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[e("div",xi?{style:{minWidth:0,flex:"1 1 auto"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[i("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:We||re.summaryIcon||"⏳"}),i("span",{children:Ee||"Redline In Review"})]}),i("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Re||(null===(Ne=null==c?void 0:c.redlining_details)||void 0===Ne?void 0:Ne.redline_title)})]}:{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:re.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...B,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.title},children:Y.summaryHeader||"Summary"})]}),Ce&&Ce.length>0&&i(J,{users:Ce,onClick:e=>{e.stopPropagation(),null==Ie||Ie()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ke||de||ae)&&i(G,{onAssignClick:ke,onOpenCognitive:de,cognitiveIconSmall:we,cognitiveTootipTitle:fe,historyIconSmall:se,onHistoryClick:ae,historyTootipTitle:ce}),i("button",{onClick:s,style:{...F,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),xi&&Le&&ze.length>0&&i(K,{steps:ze}),!Me&&!xi&&i(t,{children:i(v,{title:null===(Ve=null==c?void 0:c.redlining_details)||void 0===Ve?void 0:Ve.redline_title,children:i("p",{style:{...T,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.bodyText},children:null===(qe=null==c?void 0:c.redlining_details)||void 0===qe?void 0:qe.redline_title})})}),i("p",{style:{...A,...null===(Ge=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ge?void 0:Ge.summary},children:null===(Je=null==c?void 0:c.redlining_details)||void 0===Je?void 0:Je.redline_summary}),e("div",{style:{...E,...null===(Ke=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>di(!ri),style:{...W,...null===(Qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.impactToggle},children:[i("span",{style:{...z,...null===(Xe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactToggleLabel},children:Y.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ri?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(S,{type:(null==c?void 0:c.severity)||"Medium",customStyles:le})]}),ri&&i(t,{children:i("div",{style:{...R,...null===(Ye=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.impactText},children:i(f,{message:`${null!==(ei=null===(Ze=null==c?void 0:c.redlining_details)||void 0===Ze?void 0:Ze.redline_impact)&&void 0!==ei?ei:Y.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ii=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ii?void 0:ii.impactMarkdown})})})]}),xi&&je&&e("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e("button",{onClick:()=>mi(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:[i("span",{children:De}),i(d,{size:18,color:"#1E293B",style:{transform:vi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),vi&&e("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:["“",Fe||"","”"]})]}),i("div",{style:{...L,...null===(ti=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ti?void 0:ti.actionContainer},children:Ii.map(i=>{var t,n;const o=ne||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...j,...null===(n=null==oe?void 0:oe.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;null==U||U({status:"loading",action:e,metadata:{redlineId:Be,aiReasonId:Te}});try{const{updated_reqai:o}=await x({documentId:bi,userEmail:null==ki?void 0:ki.userEmail,userName:null==ki?void 0:ki.userName,redlineId:null!==(i=null==c?void 0:c.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ki?void 0:ki.baseApiUrl,redlineConfigId:null!==(t=null==ki?void 0:ki.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==ki?void 0:ki.token)&&void 0!==n?n:"");await(null==Ci?void 0:Ci(o)),null==U||U({status:"success",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}catch(i){null==U||U({status:"failed",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}})(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)})}),pe&&e("div",{style:{...D,...null===(ni=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ni?void 0:ni.toneContainer},children:[e("button",{onClick:()=>si(!ai),style:{...M,...null===(oi=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===oi?void 0:oi.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(w,{toneIndex:gi,configs:ie}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:Y.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ai?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),ai&&e(t,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:Y.toneDescription||"Controls how assertively AI is redlining"}),i(g,{isDirty:wi,onToneChange:e=>{hi(e)},toneColor:yi,toneIndex:gi,onClickRegenerate:()=>null==X?void 0:X(fi),toneLabels:Z,isStreaming:be,aiReason:c})]})]}),de&&e("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),de&&de(e)},style:{...H,...null==ve?void 0:ve.section,...ge},children:[e("div",{className:null==me?void 0:me.headerLeft,style:{..._,...null==ve?void 0:ve.headerLeft},children:[i("span",{className:null==me?void 0:me.titleIcon,style:{...O,...null==ve?void 0:ve.titleIcon},children:null!=ye?ye:i(h,{})}),i("div",{className:null==me?void 0:me.cognitiveTitle,style:{...N,...null==ve?void 0:ve.cognitiveTitle},children:xe})]}),e("div",{className:null==me?void 0:me.headerRight,style:{...P,...null==ve?void 0:ve.headerRight},children:[void 0!==(null==c?void 0:c.relevance_score)&&null!==(null==c?void 0:c.relevance_score)?e("span",{className:null==me?void 0:me.scoreBadge,style:{...$,...null==ve?void 0:ve.scoreBadge,...he},children:[i(u,{}),e("span",{className:null==me?void 0:me.scoreText,style:{...V,...null==ve?void 0:ve.scoreText,...ue},children:[Math.round(Number(c.relevance_score)),"%"]})]}):null,Se&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{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});export{q as AssignMenu,J as DisplayUsers,G as KebabMenu,Q as default};
1
+ import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{PenLine as n,CheckCircle as o,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import s,{memo as c,useState as p}from"react";import{ToneToggle as g}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as h}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";import{Tooltip as v}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as x}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as f}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import y from"../cws/CwsEvent.js";const w=[{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"}],S=({toneIndex:t,configs:n=w})=>{const o=Math.min(t,n.length-1),{color:l,angle:r,arcD:d}=n[o]||n[1]||n[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},b=({type:e,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[e]||n.Medium;return i("div",{style:o,children:e})},k=["Lenient","Balanced","Aggressive"],C={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},I={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},B={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},T={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},A={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},E={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},R={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},W={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},z={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},j={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},L={display:"flex",gap:8,marginBottom:18},D={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"},F={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},M={borderTop:"0.5px solid #eee",padding:"14px 0px"},H={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},_={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},O={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},N={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},$={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},P={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},V={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},U={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},q={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},G=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...q,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:t,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("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:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>n(e),children:[o&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:o}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),J=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,c]=p(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>c(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e("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:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i(G,{onAssignClick:t?()=>{c(!1),t&&t()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),K=c(function({users:t,onClick:n}){const o=t.length;return e("div",{onClick:n,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==t?void 0:t[0].length)>9?(null==t?void 0:t[0].slice(0,9))+"...":null==t?void 0:t[0]}),o>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}),Q=c(function({steps:t}){if(!(null==t?void 0:t.length))return null;const n=t.length>=3;return i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:n?"6px 8px":"8px 10px",background:"#F8FAFC",gap:n?4:8,overflow:"hidden"},children:t.map((o,l)=>{const r=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(l),d=l===t.length-1;return e(s.Fragment,{children:[e("div",{title:o.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:n?4:6,overflow:"hidden"},children:[(a=o.status,e("svg","approved"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i("polyline",{points:"22 4 12 14.01 9 11.01"})]}:"rejected"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m15 9-6 6"}),i("path",{d:"m9 9 6 6"})]}:{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("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"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),i("span",{style:{minWidth:0,color:"#475569",fontSize:n?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.initials&&i("span",{style:{width:n?20:22,height:n?20:22,minWidth:n?20:22,borderRadius:"50%",background:r.bg,color:r.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n?9:10,fontWeight:700,lineHeight:1},children:o.initials})]}),!d&&e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"18",height:n?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:n?14:18},children:[i("path",{d:"M5 12h14"}),i("path",{d:"m12 5 7 7-7 7"})]})]},o.id);var a})})})});var X=c(function({onClose:s,aiReason:c,onActionTrigger:q,onIterate:G,initialTone:X,onRegenerate:Y,labels:Z={},toneLevelsConfig:ee=k,toneColorsConfig:ie=C,dialConfigs:te=w,actions:ne,disableAllActions:oe=!1,customStyles:le={},severityChipStyles:re={},customIcons:de={},onOpenCognitive:ae,onHistoryClick:se,historyIconSmall:ce,historyTootipTitle:pe,showTone:ge=!0,cognitiveSectionStyle:he={},cognitiveScoreBadgeStyle:ue={},cognitiveScoreTextStyle:ve={},cognitiveStyles:me={},cognitiveClassNames:xe={},cognitiveTitle:fe="Cognitive Integrity",cognitiveTootipTitle:ye="Cognitive Decisioning",cognitiveLeftIcon:we,cognitiveIconSmall:Se,showCognitiveRightArrow:be=!0,isStreaming:ke,onAssignClick:Ce,assignedUsers:Ie,onReviewUsersClick:Be,redlineId:Te,aiReasonId:Ae,displayVariant:Ee="default",reviewTitle:Re,reviewSubtitle:We,reviewStatusIcon:ze=e("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:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("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"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:je=[],showReviewProgress:Le=!1,showOriginalText:De=!1,originalText:Fe,originalTextHeader:Me="Original text",hideSummaryText:He=!1,hideSeverityChip:_e=!1}){var Oe,Ne,$e,Pe,Ve,Ue,qe,Ge,Je,Ke,Qe,Xe,Ye,Ze,ei,ii,ti,ni,oi,li;let ri=ee.findIndex(e=>e===X);-1===ri&&(ri=1);const[di,ai]=p(!0),[si,ci]=p(!1),[pi,gi]=p(!1),[hi,ui]=p(ri),[vi]=p(ri),[mi,xi]=p(!0),fi="review"===Ee,yi=ee[hi],wi=ie[yi]||"#BA7517",Si=hi!==vi,bi=[{id:"iterate",icon:de.iterateIcon||i(n,{size:16,color:"#64748B"}),label:Z.btnIterate||"Iterate",color:"#64748B",onClick:G},{id:"accept",icon:de.acceptIcon||i(o,{size:16,color:"#10B981"}),label:Z.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:de.rejectIcon||i(l,{size:16,color:"#DC2626"}),label:Z.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ki,redlineConfig:Ci,updateRedlineDataParent:Ii}=m(),Bi=ne||bi;return e("div",{onClick:e=>{e.stopPropagation()},style:{...I,...null===(Oe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.root},children:[e("div",{style:{...B,...null===(Ne=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.header,marginBottom:fi?14:pi?"16px":"12px",...fi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[e("div",fi?{style:{minWidth:0,flex:"1 1 auto"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[i("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:ze||de.summaryIcon||"⏳"}),i("span",{children:Re||"Redline In Review"})]}),i("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:We||(null===($e=null==c?void 0:c.redlining_details)||void 0===$e?void 0:$e.redline_title)})]}:{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:de.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...T,...null===(Pe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.title},children:Z.summaryHeader||"Summary"})]}),Ie&&Ie.length>0&&i(K,{users:Ie,onClick:e=>{e.stopPropagation(),null==Be||Be()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ce||ae||se)&&i(J,{onAssignClick:Ce,onOpenCognitive:ae,cognitiveIconSmall:Se,cognitiveTootipTitle:ye,historyIconSmall:ce,onHistoryClick:se,historyTootipTitle:pe}),i("button",{onClick:s,style:{...F,...null===(Ve=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),fi&&Le&&je.length>0&&i(Q,{steps:je}),!He&&!fi&&i(t,{children:i(v,{title:null===(Ue=null==c?void 0:c.redlining_details)||void 0===Ue?void 0:Ue.redline_title,children:i("p",{style:{...A,...null===(qe=null==le?void 0:le.DeviationSummaryStyles)||void 0===qe?void 0:qe.bodyText},children:null===(Ge=null==c?void 0:c.redlining_details)||void 0===Ge?void 0:Ge.redline_title})})}),i("p",{style:{...E,...null===(Je=null==le?void 0:le.DeviationSummaryStyles)||void 0===Je?void 0:Je.summary},children:null===(Ke=null==c?void 0:c.redlining_details)||void 0===Ke?void 0:Ke.redline_summary}),e("div",{style:{...R,...null===(Qe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>ai(!di),style:{...z,...null===(Xe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactToggle},children:[i("span",{style:{...j,...null===(Ye=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.impactToggleLabel},children:Z.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:di?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(b,{type:(null==c?void 0:c.severity)||"Medium",customStyles:re})]}),di&&i(t,{children:i("div",{style:{...W,...null===(Ze=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ze?void 0:Ze.impactText},children:i(f,{message:`${null!==(ii=null===(ei=null==c?void 0:c.redlining_details)||void 0===ei?void 0:ei.redline_impact)&&void 0!==ii?ii:Z.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ti=null==le?void 0:le.DeviationSummaryStyles)||void 0===ti?void 0:ti.impactMarkdown})})})]}),fi&&De&&e("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e("button",{onClick:()=>xi(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:[i("span",{children:Me}),i(d,{size:18,color:"#1E293B",style:{transform:mi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),mi&&e("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:["“",Fe||"","”"]})]}),i("div",{style:{...L,...null===(ni=null==le?void 0:le.DeviationSummaryStyles)||void 0===ni?void 0:ni.actionContainer},children:Bi.map(i=>{var t,n;const o=oe||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==le?void 0:le.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...D,...null===(n=null==le?void 0:le.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==q||q({status:"loading",action:e,metadata:{redlineId:Te,aiReasonId:Ae}});try{const{updated_reqai:d}=await x({documentId:ki,userEmail:null==Ci?void 0:Ci.userEmail,userName:null==Ci?void 0:Ci.userName,redlineId:null!==(i=null==c?void 0:c.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==Ci?void 0:Ci.baseApiUrl,redlineConfigId:null!==(t=null==Ci?void 0:Ci.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==Ci?void 0:Ci.token)&&void 0!==n?n:"");await(null==Ii?void 0:Ii(d)),y.emit(`redline-edit:${ki}:${null===(r=null===(l=null===(o=null==d?void 0:d.artifactData)||void 0===o?void 0:o.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===r?void 0:r.artifactId}`,{updatedBy:null==Ci?void 0:Ci.userName}),null==q||q({status:"success",action:e,metadata:{redlineId:Te,aiReasonId:Ae}})}catch(i){null==q||q({status:"failed",action:e,metadata:{redlineId:Te,aiReasonId:Ae}})}})(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)})}),ge&&e("div",{style:{...M,...null===(oi=null==le?void 0:le.DeviationSummaryStyles)||void 0===oi?void 0:oi.toneContainer},children:[e("button",{onClick:()=>ci(!si),style:{...H,...null===(li=null==le?void 0:le.DeviationSummaryStyles)||void 0===li?void 0:li.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(S,{toneIndex:hi,configs:te}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:Z.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:si?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),si&&e(t,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:Z.toneDescription||"Controls how assertively AI is redlining"}),i(g,{isDirty:Si,onToneChange:e=>{ui(e)},toneColor:wi,toneIndex:hi,onClickRegenerate:()=>null==Y?void 0:Y(yi),toneLabels:ee,isStreaming:ke,aiReason:c})]})]}),ae&&e("div",{className:null==xe?void 0:xe.section,onClick:e=>{e.stopPropagation(),ae&&ae(e)},style:{..._,...null==me?void 0:me.section,...he},children:[e("div",{className:null==xe?void 0:xe.headerLeft,style:{...O,...null==me?void 0:me.headerLeft},children:[i("span",{className:null==xe?void 0:xe.titleIcon,style:{...N,...null==me?void 0:me.titleIcon},children:null!=we?we:i(h,{})}),i("div",{className:null==xe?void 0:xe.cognitiveTitle,style:{...$,...null==me?void 0:me.cognitiveTitle},children:fe})]}),e("div",{className:null==xe?void 0:xe.headerRight,style:{...P,...null==me?void 0:me.headerRight},children:[void 0!==(null==c?void 0:c.relevance_score)&&null!==(null==c?void 0:c.relevance_score)?e("span",{className:null==xe?void 0:xe.scoreBadge,style:{...V,...null==me?void 0:me.scoreBadge,...ue},children:[i(u,{}),e("span",{className:null==xe?void 0:xe.scoreText,style:{...U,...null==me?void 0:me.scoreText,...ve},children:[Math.round(Number(c.relevance_score)),"%"]})]}):null,be&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{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});export{G as AssignMenu,K as DisplayUsers,J as KebabMenu,X as default};
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o}from"react";import{styles as r}from"./IterateComponent.js";function n({onBack:n,onApply:i,historicalClausesData:l=[],isLoadingHistory:a,headerTitle:d="Historical Recommendations",customStyles:s={}}){const c={...r,...s},p=({clause:r})=>{const[n,l]=o(!1),[a,d]=o(!1),[s,p]=o(!1),h=r.title||r.filename,x=r.content||r.excerpt||"",f=((e=0)=>e>=80?{bg:"#dcfce7",text:"#166534",border:"#bbf7d0"}:e>=50?{bg:"#fef9c3",text:"#854d0e",border:"#fef08a"}:{bg:"#fee2e2",text:"#991b1b",border:"#fecaca"})(r.relevance_score),g=x.length>120,u=s&&h;return e("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...c.clauseCard,display:"flex",flexDirection:"column",gap:6,textAlign:"left",backgroundColor:a?"#f8fafc":"#fff",borderColor:a?"#cbd5e1":"#dde5f0",transition:"all 0.2s ease"},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"8px"},children:[e("div",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{position:"relative",flex:1,minWidth:0},children:[t("p",{style:{...c.clauseFilename,margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%"},children:h}),u&&t("div",{style:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1E293B",color:"#fff",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:400,zIndex:50,boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",whiteSpace:"normal",wordBreak:"break-word",width:"max-content",maxWidth:"220px",pointerEvents:"none",lineHeight:1.4},children:h})]}),void 0!==r.relevance_score&&e("div",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:12,border:`1px solid ${f.border}`,backgroundColor:f.bg,color:f.text,whiteSpace:"nowrap",flexShrink:0},children:[r.relevance_score,"% Match"]})]}),e("div",{onClick:e=>e.stopPropagation(),style:{...c.clauseExcerpt,margin:0,display:n?"block":"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:n?"unset":3,overflowY:n?"auto":"hidden",overflowX:"hidden",maxHeight:n?"150px":"none",paddingRight:n?"4px":"0px",cursor:"auto"},children:['"',x,'"']}),e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginTop:"4px"},children:[t("div",{children:g&&t("span",{onClick:e=>l(!n),style:{fontSize:12,color:"#2563EB",fontWeight:500,cursor:"pointer"},children:n?"View Less":"...View More"})}),t("button",{onClick:()=>null==i?void 0:i({type:"history",value:r}),style:{backgroundColor:"#F8FAFC",color:"#0F172A",border:"1px solid #E2E8F0",borderRadius:"6px",padding:"4px 12px",fontSize:"12px",fontWeight:400,cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 1px 2px rgba(0,0,0,0.05)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#F1F5F9",e.currentTarget.style.borderColor="#CBD5E1"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#F8FAFC",e.currentTarget.style.borderColor="#E2E8F0"},children:"Proceed"})]})]})};return e("div",{style:c.card,children:[e("div",{style:c.header,children:[t("button",{onClick:n,style:c.backBtn,"aria-label":"Go back",children:"‹"}),t("span",{style:c.headerTitle,children:d})]}),t("div",{style:{...c.body,paddingTop:12,paddingBottom:16},children:e("div",a?{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"8px",color:"#64748B",fontSize:13},children:[t("style",{children:"\n @keyframes iterateSpinner {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "}),t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"iterateSpinner 1s linear infinite"},children:t("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),"Fetching recommendations..."]}:{style:{display:"flex",flexDirection:"column",gap:10,maxHeight:"40vh",overflowY:"auto",paddingRight:"4px"},children:[null==l?void 0:l.map(e=>t(p,{clause:e},e.id)),(!l||0===l.length)&&t("p",{style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"},children:"No clauses found"})]})})]})}export{n as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as n}from"react";import{styles as i}from"./IterateComponent.js";function l({onBack:l,onApply:a,historicalClausesData:d=[],isLoadingHistory:s,headerTitle:c="Historical Recommendations",customStyles:p={}}){const x={...i,...p},u=({clause:i,index:l})=>{const[d,s]=o(!1),[c,p]=o(!1),[u,f]=o(!1),h=r(null),[g,b]=o(!1),m=i.title||i.filename,y=i.content||i.excerpt||"",v=((e=0)=>e>=80?{bg:"#dcfce7",text:"#166534",border:"#bbf7d0"}:e>=50?{bg:"#fef9c3",text:"#854d0e",border:"#fef08a"}:{bg:"#fee2e2",text:"#991b1b",border:"#fecaca"})(i.relevance_score),w=u&&m,k=0===l;return n(()=>{const e=h.current;if(!e)return;const t=()=>{d||b(e.scrollHeight>e.clientHeight)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[y,d]),e("div",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{...x.clauseCard,display:"flex",flexDirection:"column",gap:6,textAlign:"left",backgroundColor:c?"#f8fafc":"#fff",borderColor:c?"#cbd5e1":"#dde5f0",transition:"all 0.2s ease"},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"8px"},children:[e("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{position:"relative",flex:1,minWidth:0},children:[t("p",{style:{...x.clauseFilename,margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%",cursor:"default"},children:m}),w&&t("div",{style:{position:"absolute",top:k?"100%":"auto",bottom:k?"auto":"100%",marginTop:k?"6px":"0px",marginBottom:k?"0px":"6px",left:0,backgroundColor:"#1E293B",color:"#fff",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:400,zIndex:50,boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",whiteSpace:"normal",wordBreak:"break-word",width:"max-content",maxWidth:"220px",pointerEvents:"none",lineHeight:1.4},children:m})]}),void 0!==i.relevance_score&&e("div",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:12,border:`1px solid ${v.border}`,backgroundColor:v.bg,color:v.text,whiteSpace:"nowrap",flexShrink:0},children:[i.relevance_score,"% Match"]})]}),e("div",{ref:h,onClick:e=>e.stopPropagation(),style:{...x.clauseExcerpt,margin:0,display:d?"block":"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:d?"unset":3,overflowY:d?"auto":"hidden",overflowX:"hidden",maxHeight:d?"100px":"none",paddingRight:d?"4px":"0px",cursor:"auto"},children:['"',y,'"']}),e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginTop:"4px"},children:[t("div",{children:(g||d)&&t("span",{onClick:e=>{e.stopPropagation(),d&&h.current&&(h.current.scrollTop=0),s(!d)},style:{fontSize:12,color:"#2563EB",fontWeight:500,cursor:"pointer"},children:d?"View Less":"...View More"})}),t("button",{onClick:()=>null==a?void 0:a({type:"history",value:i}),style:{backgroundColor:"#F8FAFC",color:"#0F172A",border:"1px solid #CBD5E1",borderRadius:"6px",padding:"4px 12px",fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 1px 2px rgba(0,0,0,0.05)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#F1F5F9",e.currentTarget.style.borderColor="#94A3B8"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#F8FAFC",e.currentTarget.style.borderColor="#CBD5E1"},children:"Proceed"})]})]})};return e("div",{style:x.card,children:[e("div",{style:x.header,children:[t("button",{onClick:l,style:x.backBtn,"aria-label":"Go back",children:"‹"}),t("span",{style:x.headerTitle,children:c})]}),t("div",{style:{...x.body,paddingTop:12,paddingBottom:16},children:e("div",s?{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"8px",color:"#64748B",fontSize:13},children:[t("style",{children:"\n @keyframes iterateSpinner {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "}),t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"iterateSpinner 1s linear infinite"},children:t("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),"Fetching recommendations..."]}:{style:{display:"flex",flexDirection:"column",gap:10,maxHeight:"40vh",overflowY:"auto",paddingRight:"4px"},children:[null==d?void 0:d.map((e,o)=>t(u,{clause:e,index:o},e.id)),(!d||0===d.length)&&t("p",{style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"},children:"No clauses found"})]})})]})}export{l as default};
2
2
  //# sourceMappingURL=HistoryMenu.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as n,CheckCircle as l,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";function a({onClose:a,editorInfo:s,headerText:c,btnsConfig:u,labelText:p,onActionTrigger:v,aiReason:f=null}){var b,g;const{redlineDcoumentId:m,redlineConfig:y,updateRedlineDataParent:h}=o(),I=async e=>{var i,n,l;null==v||v({status:"loading",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}});try{const{updated_reqai:t}=await d({documentId:m,userEmail:null==y?void 0:y.userEmail,userName:null==y?void 0:y.userName,redlineId:null!==(i=null==f?void 0:f.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==y?void 0:y.baseApiUrl,redlineConfigId:null!==(n=null==y?void 0:y.redlineConfigId)&&void 0!==n?n:""},null!==(l=null==y?void 0:y.token)&&void 0!==l?l:"");await(null==h?void 0:h(t)),null==v||v({status:"success",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}catch(i){null==v||v({status:"failed",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}};return e("div",{style:r.popup,children:[e("div",{style:r.header,children:[i("span",{style:r.title,children:c||"Manually Edited"}),i("button",{onClick:a,style:r.closeButton,"aria-label":"Close",children:"✕"})]}),e("div",{style:r.content,children:[e("div",{style:r.labelRow,children:[i(n,{}),i("span",{style:r.label,children:p||"Edited By"})]}),i("div",{style:r.editorInfo,children:s}),i("div",{style:r.divider}),e("div",{style:r.actions,children:[null==u?void 0:u.map(i=>e("button",{style:{...r.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==f?void 0:f.redline_id,id:null==f?void 0:f.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(b=null==f?void 0:f.redlining_details)||void 0===b?void 0:b.status)||"rejected"===(null===(g=null==f?void 0:f.redlining_details)||void 0===g?void 0:g.status))&&e("div",{style:r.resolveActions,children:[e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},disabled:null==f?void 0:f.resolving,onClick:()=>I("accept"),children:[i(l,{size:16,color:"#10B981"})," ","Adopt"]}),e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},onClick:()=>I("reject"),disabled:null==f?void 0:f.resolving,children:[i(t,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})}const r={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"}};export{a as default};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as l,CheckCircle as n,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";import a from"../cws/CwsEvent.js";import"react";function r({onClose:r,editorInfo:c,headerText:u,btnsConfig:v,labelText:p,onActionTrigger:f,aiReason:b=null}){var g,m;const{redlineDcoumentId:y,redlineConfig:h,updateRedlineDataParent:I}=o(),x=async e=>{var i,l,n,t,o,r,s;null==f||f({status:"loading",action:e,metadata:{redlineId:null==b?void 0:b.redline_id,aiReasonId:null==b?void 0:b.id}});try{const{updated_reqai:c}=await d({documentId:y,userEmail:null==h?void 0:h.userEmail,userName:null==h?void 0:h.userName,redlineId:null!==(i=null==b?void 0:b.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==h?void 0:h.baseApiUrl,redlineConfigId:null!==(l=null==h?void 0:h.redlineConfigId)&&void 0!==l?l:""},null!==(n=null==h?void 0:h.token)&&void 0!==n?n:"");await(null==I?void 0:I(c)),null===(t=a.emit)||void 0===t||t.call(a,`redline-edit:${y}:${null===(s=null===(r=null===(o=null==c?void 0:c.artifactData)||void 0===o?void 0:o.userStorySnapshot)||void 0===r?void 0:r[0])||void 0===s?void 0:s.artifactId}`,{updatedBy:null==h?void 0:h.userName}),null==f||f({status:"success",action:e,metadata:{redlineId:null==b?void 0:b.redline_id,aiReasonId:null==b?void 0:b.id}})}catch(i){null==f||f({status:"failed",action:e,metadata:{redlineId:null==b?void 0:b.redline_id,aiReasonId:null==b?void 0:b.id}})}};return e("div",{style:s.popup,children:[e("div",{style:s.header,children:[i("span",{style:s.title,children:u||"Manually Edited"}),i("button",{onClick:r,style:s.closeButton,"aria-label":"Close",children:"✕"})]}),e("div",{style:s.content,children:[e("div",{style:s.labelRow,children:[i(l,{}),i("span",{style:s.label,children:p||"Edited By"})]}),i("div",{style:s.editorInfo,children:c}),i("div",{style:s.divider}),e("div",{style:s.actions,children:[null==v?void 0:v.map(i=>e("button",{style:{...s.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==b?void 0:b.redline_id,id:null==b?void 0:b.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(g=null==b?void 0:b.redlining_details)||void 0===g?void 0:g.status)||"rejected"===(null===(m=null==b?void 0:b.redlining_details)||void 0===m?void 0:m.status))&&e("div",{style:s.resolveActions,children:[e("button",{style:{...s.actionBtn,...(null==b?void 0:b.resolving)?s.actionBtnDisabled:{}},disabled:null==b?void 0:b.resolving,onClick:()=>x("accept"),children:[i(n,{size:16,color:"#10B981"})," ","Adopt"]}),e("button",{style:{...s.actionBtn,...(null==b?void 0:b.resolving)?s.actionBtnDisabled:{}},onClick:()=>x("reject"),disabled:null==b?void 0:b.resolving,children:[i(t,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})}const s={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"}};export{r as default};
2
2
  //# sourceMappingURL=ManualEditPopup.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Undo2 as o,Hourglass as n}from"lucide-react";import r,{useState as l}from"react";import a from"./PopupDefaults.js";import{Tooltip as d}from"@mui/material";import{AiReasonMarkdownWrapper as s}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{DisplayUsers as c,KebabMenu as h}from"./DeviationSummary.js";import{resolveRedline as p}from"../../../../../service/redlineService.js";import{useRequirementAI as g}from"../../RequirementAIWrapper/RequirementAIWrapper.js";function u(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const f=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),b=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),k=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),m=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),v=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),y=({open:t})=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),x=({color:i="#3b82f6"})=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M1.5 3.5v4h4",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M8 5v3.5l2 1.5",stroke:i,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),w=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),C=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function B({title:o,open:n,onToggle:r,children:l}){return t("div",{children:[t("div",{onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:o}),e(y,{open:n})]}),e("div",{style:{maxHeight:n?100:0,opacity:n?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:n&&e(i,{children:l})})]})}function S({icon:e,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:l={}}){const a={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?l:{}};return t("button",{onClick:r?void 0:o,disabled:r,style:a,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[e,i]})}function I({steps:i}){if(!(null==i?void 0:i.length))return null;const o=i.length>=3;return e("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:o?"6px 8px":"8px 10px",background:"#F8FAFC",gap:o?4:8,overflow:"hidden"},children:i.map((l,a)=>{const d=(e=>{const t=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return t[e%t.length]})(a),s=a===i.length-1;return t(r.Fragment,{children:[t("span",{title:l.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:o?4:6,overflow:"hidden"},children:[(c=l.status,"approved"===c?t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===c?t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m15 9-6 6"}),e("path",{d:"m9 9 6 6"})]}):e(n,{size:o?14:16,color:"#F59E0B",style:{flexShrink:0}})),e("span",{style:{minWidth:0,color:"#475569",fontSize:o?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.label}),l.initials&&e("span",{style:{width:o?20:22,height:o?20:22,minWidth:o?20:22,borderRadius:"50%",background:d.bg,color:d.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:o?9:10,fontWeight:700,lineHeight:1},children:l.initials})]}),!s&&t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"18",height:o?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:o?14:18},children:[e("path",{d:"M5 12h14"}),e("path",{d:"m12 5 7 7-7 7"})]})]},l.id);var c})})})}function L({status:i,onClose:r,impactText:y,secondText:L,actionTakenByName:T,actionTakenAtTime:W="NA",onHistory:R,onIterate:j,onActionTrigger:M,disableAllActions:A=!1,impactTitle:D="Impact",customConfigs:F={},customStyles:E={},secondaryTitle:z,onAssignClick:H,onReviewUsersClick:N,assignedUsers:U,redlineId:O,aiReasonId:P,cognitiveIconSmall:$,cognitiveTootipTitle:q="Cognitive Decisioning",historyIconSmall:V,onHistoryClick:_,historyTootipTitle:Y,onOpenCognitive:G,displayVariant:J="default",reviewTitle:K,reviewSubtitle:Q,reviewStatusIcon:X=e(n,{size:18}),reviewSteps:Z=[],showReviewProgress:ee=!1,showOriginalText:te=!1,originalText:ie,originalTextHeader:oe="Original text",hideMeta:ne=!1}){const[re,le]=l(!0),[ae,de]=l(!0),[se,ce]=l(!1);l(!1);const[he,pe]=l(!0),ge="review"===J||"review"===i,{redlineDcoumentId:ue,redlineConfig:fe,updateRedlineDataParent:be}=g(),ke={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e(m,{}),StatusIcon:e(f,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e(x,{}),label:"History",onClick:R},{icon:e(o,{size:17}),label:"Revert",useLabel:!0},{icon:e(C,{}),label:"Iterate",onClick:j}],fallbackText:"No original text available"},me={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e(v,{}),StatusIcon:e(b,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e(x,{color:"#3b82f6"}),label:"History",onClick:R},{icon:e(w,{}),label:"Reinstate",useLabel:!0},{icon:e(C,{}),label:"Iterate",onClick:j}],fallbackText:"No rejected recommendation available"},ve={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e(m,{}),StatusIcon:e(o,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e(x,{}),label:"History",onClick:R},{icon:e(C,{}),label:"Iterate",onClick:j}],fallbackText:"No reverted redline available"},ye={headerBg:"#F8FAFC",headerBorder:"#E2E8F0",titleColor:"#1E293B",label:K||"Redline In Review",metaLabel:"Current Status",UserIcon:e(n,{size:16,color:"#94A3B8"}),StatusIcon:X,secondTitle:oe,secondBg:"#F8FAFC",secondBorder:"#CBD5E1",impactBox:!0,actions:[{icon:e(x,{}),label:"History",onClick:R},{icon:e(f,{}),label:"Approve",action:"accept",useLabel:!0},{icon:e(b,{}),label:"Reject",action:"reject",useLabel:!0},{icon:e(C,{}),label:"Iterate",onClick:j}],fallbackText:"No original text available"};let xe;xe=ge?ye:"accepted"===i?ke:"rejected"===i?me:ve;const we={...xe,...F[i]||{}},Ce=ge&&Q||z;return t("div",{style:{...a.RedlineCardDefaults.root,animation:se?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":a.RedlineCardDefaults.root.animation,...E.root},children:[t("div",{style:{...a.RedlineCardDefaults.header,background:we.headerBg,borderBottom:`1.5px solid ${we.headerBorder}`,...E.header},children:[t("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:we.StatusIcon}),t("div",{children:[e("span",{style:{fontSize:15,fontWeight:700,color:we.titleColor,letterSpacing:"-0.01em"},children:we.label}),e(d,{title:Ce,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:Ce})})]}),U&&U.length>0&&e(c,{users:U,onClick:e=>{e.stopPropagation(),null==N||N()}})]}),t("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(H||G||_)&&e(h,{onAssignClick:H,onOpenCognitive:G,cognitiveIconSmall:$,cognitiveTootipTitle:q,historyIconSmall:V,onHistoryClick:_,historyTootipTitle:Y}),e("button",{onClick:()=>{ce(!0),r()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e(k,{})})]})]}),ge&&ee&&Z.length>0&&e("div",{style:{padding:"10px 14px 0"},children:e(I,{steps:Z})}),t("div",{style:{...a.RedlineCardDefaults.body,...E.body},children:[!ge&&!ne&&t("div",{style:{...a.RedlineCardDefaults.meta,...E.meta},children:[t("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[we.UserIcon,e("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:we.metaLabel})]}),t("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e(d,{title:T,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:T})}),e("span",{children:u(W)})]})]}),!ge&&!ne&&e("div",{style:{...a.RedlineCardDefaults.divider,...E.divider}}),e(B,{title:D,open:re,onToggle:()=>le(e=>!e),children:e("div",{style:{...a.RedlineCardDefaults.impactText,...E.impactText},children:e(s,{message:`${y||""} [View chat](chat_citation$all)`,customStyles:E.impactMarkdown})})}),e("div",{style:{...a.RedlineCardDefaults.divider,...E.divider}}),e(B,{title:ge&&te?oe:we.secondTitle,open:ge&&te?he:ae,onToggle:()=>{ge&&te?pe(e=>!e):de(e=>!e)},children:(ge&&te?ie:L)?e("div",{style:{...a.RedlineCardDefaults.secondSection,background:we.secondBg,border:`1.5px solid ${we.secondBorder}`,...E.secondSection},children:ge&&te?ie:L}):t("div",{style:{...a.RedlineCardDefaults.fallbackSectionStyle,...E.fallbackSectionStyle},children:[we.fallbackText," "]})}),e("div",{style:{...a.RedlineCardDefaults.actionsContainer,...E.actionsContainer},children:we.actions.map(t=>e(S,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;null==M||M({status:"loading",action:e,metadata:{redlineId:O,aiReasonId:P}});try{const{updated_reqai:o}=await p({documentId:ue,userEmail:null==fe?void 0:fe.userEmail,userName:null==fe?void 0:fe.userName,redlineId:null!=O?O:"",action:e,baseApiUrl:null==fe?void 0:fe.baseApiUrl,redlineConfigId:null!==(t=null==fe?void 0:fe.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==fe?void 0:fe.token)&&void 0!==i?i:"");await(null==be?void 0:be(o)),null==M||M({status:"success",action:e,metadata:{redlineId:O,aiReasonId:P}})}catch(t){null==M||M({status:"failed",action:e,metadata:{redlineId:O,aiReasonId:P}})}})((t.action||t.label).toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...E.actionBtn},disabled:A||t.disabled,disabledStyle:E.actionBtnDisabled},t.label))})]})]})}export{f as ApprovedIcon,y as ChevronIcon,k as CloseIcon,x as HistoryIcon,C as IterateIcon,L as RedlineCard,w as ReinstateIcon,b as RejectedIcon,m as UserApprovedIcon,v as UserRejectedIcon,u as formatDate};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Undo2 as o,Hourglass as n}from"lucide-react";import r,{useState as l}from"react";import a from"./PopupDefaults.js";import{Tooltip as d}from"@mui/material";import{AiReasonMarkdownWrapper as s}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{DisplayUsers as c,KebabMenu as h}from"./DeviationSummary.js";import{resolveRedline as p}from"../../../../../service/redlineService.js";import{useRequirementAI as u}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import g from"../cws/CwsEvent.js";function f(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const b=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),v=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),m=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),x=({open:t})=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),w=({color:i="#3b82f6"})=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M1.5 3.5v4h4",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M8 5v3.5l2 1.5",stroke:i,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),C=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),B=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function S({title:o,open:n,onToggle:r,children:l}){return t("div",{children:[t("div",{onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:o}),e(x,{open:n})]}),e("div",{style:{maxHeight:n?100:0,opacity:n?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:n&&e(i,{children:l})})]})}function I({icon:e,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:l={}}){const a={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?l:{}};return t("button",{onClick:r?void 0:o,disabled:r,style:a,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[e,i]})}function L({steps:i}){if(!(null==i?void 0:i.length))return null;const o=i.length>=3;return e("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:o?"6px 8px":"8px 10px",background:"#F8FAFC",gap:o?4:8,overflow:"hidden"},children:i.map((l,a)=>{const d=(e=>{const t=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return t[e%t.length]})(a),s=a===i.length-1;return t(r.Fragment,{children:[t("span",{title:l.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:o?4:6,overflow:"hidden"},children:[(c=l.status,"approved"===c?t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===c?t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m15 9-6 6"}),e("path",{d:"m9 9 6 6"})]}):e(n,{size:o?14:16,color:"#F59E0B",style:{flexShrink:0}})),e("span",{style:{minWidth:0,color:"#475569",fontSize:o?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.label}),l.initials&&e("span",{style:{width:o?20:22,height:o?20:22,minWidth:o?20:22,borderRadius:"50%",background:d.bg,color:d.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:o?9:10,fontWeight:700,lineHeight:1},children:l.initials})]}),!s&&t("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"18",height:o?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:o?14:18},children:[e("path",{d:"M5 12h14"}),e("path",{d:"m12 5 7 7-7 7"})]})]},l.id);var c})})})}function T({status:i,onClose:r,impactText:x,secondText:T,actionTakenByName:W,actionTakenAtTime:R="NA",onHistory:j,onIterate:M,onActionTrigger:A,disableAllActions:D=!1,impactTitle:F="Impact",customConfigs:E={},customStyles:z={},secondaryTitle:H,onAssignClick:N,onReviewUsersClick:U,assignedUsers:O,redlineId:P,aiReasonId:$,cognitiveIconSmall:q,cognitiveTootipTitle:V="Cognitive Decisioning",historyIconSmall:_,onHistoryClick:Y,historyTootipTitle:G,onOpenCognitive:J,displayVariant:K="default",reviewTitle:Q,reviewSubtitle:X,reviewStatusIcon:Z=e(n,{size:18}),reviewSteps:ee=[],showReviewProgress:te=!1,showOriginalText:ie=!1,originalText:oe,originalTextHeader:ne="Original text",hideMeta:re=!1}){const[le,ae]=l(!0),[de,se]=l(!0),[ce,he]=l(!1);l(!1);const[pe,ue]=l(!0),ge="review"===K||"review"===i,{redlineDcoumentId:fe,redlineConfig:be,updateRedlineDataParent:ke}=u(),ve={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e(m,{}),StatusIcon:e(b,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e(w,{}),label:"History",onClick:j},{icon:e(o,{size:17}),label:"Revert",useLabel:!0},{icon:e(B,{}),label:"Iterate",onClick:M}],fallbackText:"No original text available"},me={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e(y,{}),StatusIcon:e(k,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e(w,{color:"#3b82f6"}),label:"History",onClick:j},{icon:e(C,{}),label:"Reinstate",useLabel:!0},{icon:e(B,{}),label:"Iterate",onClick:M}],fallbackText:"No rejected recommendation available"},ye={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e(m,{}),StatusIcon:e(o,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e(w,{}),label:"History",onClick:j},{icon:e(B,{}),label:"Iterate",onClick:M}],fallbackText:"No reverted redline available"},xe={headerBg:"#F8FAFC",headerBorder:"#E2E8F0",titleColor:"#1E293B",label:Q||"Redline In Review",metaLabel:"Current Status",UserIcon:e(n,{size:16,color:"#94A3B8"}),StatusIcon:Z,secondTitle:ne,secondBg:"#F8FAFC",secondBorder:"#CBD5E1",impactBox:!0,actions:[{icon:e(w,{}),label:"History",onClick:j},{icon:e(b,{}),label:"Approve",action:"accept",useLabel:!0},{icon:e(k,{}),label:"Reject",action:"reject",useLabel:!0},{icon:e(B,{}),label:"Iterate",onClick:M}],fallbackText:"No original text available"};let we;we=ge?xe:"accepted"===i?ve:"rejected"===i?me:ye;const Ce={...we,...E[i]||{}},Be=ge&&X||H;return t("div",{style:{...a.RedlineCardDefaults.root,animation:ce?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":a.RedlineCardDefaults.root.animation,...z.root},children:[t("div",{style:{...a.RedlineCardDefaults.header,background:Ce.headerBg,borderBottom:`1.5px solid ${Ce.headerBorder}`,...z.header},children:[t("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Ce.StatusIcon}),t("div",{children:[e("span",{style:{fontSize:15,fontWeight:700,color:Ce.titleColor,letterSpacing:"-0.01em"},children:Ce.label}),e(d,{title:Be,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:Be})})]}),O&&O.length>0&&e(c,{users:O,onClick:e=>{e.stopPropagation(),null==U||U()}})]}),t("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(N||J||Y)&&e(h,{onAssignClick:N,onOpenCognitive:J,cognitiveIconSmall:q,cognitiveTootipTitle:V,historyIconSmall:_,onHistoryClick:Y,historyTootipTitle:G}),e("button",{onClick:()=>{he(!0),r()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e(v,{})})]})]}),ge&&te&&ee.length>0&&e("div",{style:{padding:"10px 14px 0"},children:e(L,{steps:ee})}),t("div",{style:{...a.RedlineCardDefaults.body,...z.body},children:[!ge&&!re&&t("div",{style:{...a.RedlineCardDefaults.meta,...z.meta},children:[t("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[Ce.UserIcon,e("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:Ce.metaLabel})]}),t("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e(d,{title:W,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:W})}),e("span",{children:f(R)})]})]}),!ge&&!re&&e("div",{style:{...a.RedlineCardDefaults.divider,...z.divider}}),e(S,{title:F,open:le,onToggle:()=>ae(e=>!e),children:e("div",{style:{...a.RedlineCardDefaults.impactText,...z.impactText},children:e(s,{message:`${x||""} [View chat](chat_citation$all)`,customStyles:z.impactMarkdown})})}),e("div",{style:{...a.RedlineCardDefaults.divider,...z.divider}}),e(S,{title:ge&&ie?ne:Ce.secondTitle,open:ge&&ie?pe:de,onToggle:()=>{ge&&ie?ue(e=>!e):se(e=>!e)},children:(ge&&ie?oe:T)?e("div",{style:{...a.RedlineCardDefaults.secondSection,background:Ce.secondBg,border:`1.5px solid ${Ce.secondBorder}`,...z.secondSection},children:ge&&ie?oe:T}):t("div",{style:{...a.RedlineCardDefaults.fallbackSectionStyle,...z.fallbackSectionStyle},children:[Ce.fallbackText," "]})}),e("div",{style:{...a.RedlineCardDefaults.actionsContainer,...z.actionsContainer},children:Ce.actions.map(t=>e(I,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i,o,n,r,l;null==A||A({status:"loading",action:e,metadata:{redlineId:P,aiReasonId:$}});try{const{updated_reqai:a}=await p({documentId:fe,userEmail:null==be?void 0:be.userEmail,userName:null==be?void 0:be.userName,redlineId:null!=P?P:"",action:e,baseApiUrl:null==be?void 0:be.baseApiUrl,redlineConfigId:null!==(t=null==be?void 0:be.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==be?void 0:be.token)&&void 0!==i?i:"");await(null==ke?void 0:ke(a)),null===(o=g.emit)||void 0===o||o.call(g,`redline-edit:${fe}:${null===(l=null===(r=null===(n=null==a?void 0:a.artifactData)||void 0===n?void 0:n.userStorySnapshot)||void 0===r?void 0:r[0])||void 0===l?void 0:l.artifactId}`,{updatedBy:null==be?void 0:be.userName}),null==A||A({status:"success",action:e,metadata:{redlineId:P,aiReasonId:$}})}catch(t){null==A||A({status:"failed",action:e,metadata:{redlineId:P,aiReasonId:$}})}})((t.action||t.label).toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...z.actionBtn},disabled:D||t.disabled,disabledStyle:z.actionBtnDisabled},t.label))})]})]})}export{b as ApprovedIcon,x as ChevronIcon,v as CloseIcon,w as HistoryIcon,B as IterateIcon,T as RedlineCard,C as ReinstateIcon,k as RejectedIcon,m as UserApprovedIcon,y as UserRejectedIcon,f as formatDate};
2
2
  //# sourceMappingURL=RedlineStatusCard.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{X as n}from"lucide-react";function o({children:o,onRefresh:t,onCancel:i}){return e("div",{style:{width:360,background:"#fff",borderRadius:12,border:"1px solid #e5e7eb",boxShadow:"0 10px 30px rgba(0, 0, 0, 0.12)",padding:12,fontFamily:"Inter"},children:[i&&r("div",{style:{display:"flex",justifyContent:"flex-end"},children:r("button",{onClick:i,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:15,color:"#6b7280"},children:r(n,{})})}),r("div",{style:{fontSize:14,color:"#374151",lineHeight:1.6,marginBottom:5},children:o}),r("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:t&&r("button",{onClick:t,style:{padding:"8px",borderRadius:8,border:"none",background:"#2563eb",color:"#fff",cursor:"pointer",fontSize:16},children:"Refresh"})})]})}export{o as default};
2
+ //# sourceMappingURL=RedlineToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedlineToast.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useState as n,useRef as o,useEffect as i}from"react";import{ChevronUp as a,ChevronDown as s,Users as r,ExternalLink as d,Download as u,Share2 as c,Copy as v,LoaderCircle as p,PencilIcon as m,Plus as y,Trash2 as h,X as g,Ellipsis as S,Hourglass as C,Check as f,ChevronUpIcon as I,ChevronDownIcon as b,Info as N,Bookmark as w}from"lucide-react";import E from"showdown";import{Tooltip as D,Menu as B,MenuItem as A}from"@mui/material";import T from"../../icons/Illustration.svg.js";import{v4 as x}from"uuid";import U from"./UserStoryCard.module.css.js";import{formatMarkdown as k,indentMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as R,postprocessUserStoryAfterEdit as _}from"../../utils/user-story.utils.js";import M from"../../shared/AtomicButton.js";import L from"../RichTextEditor/RichTextEditor.js";import W from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as O,useRequirementAI as z}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as V}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as j}from"./TitleEditor/TitleEditor.js";import{updateRedlineDocument as G,getRedlineDocumentId as $,createRedlineDocument as H}from"../../../../service/redlineService.js";import F from"./ClinicalTrialSection.js";import{CompletionPanel as q}from"../story-screen/CompletionPanel.js";import Q from"../../icons/CDIcon.js";const Y={[O.WAITING]:"WAITING TO GENERATE",[O.IN_PROGRESS]:"IN PROGRESS",[O.GENERATED]:"GENERATED",[O.FAILED]:"FAILED",[O.GENERATE]:"GENERATE",[O.APPROVED]:"APPROVED"};function Z(e){const l=[],n=/<learned>(.*?)<\/learned>/g;let o,i=0,a=0;for(;null!==(o=n.exec(e));){const[,s]=o,r=o.index;r>i&&l.push(t("span",{children:e.slice(i,r)},"text-pre-"+a++)),l.push(t(D,{title:s,placement:"top",children:t(N,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${x()}`)),i=n.lastIndex}return i<(null==e?void 0:e.length)&&l.push(t("span",{children:e.slice(i)},"text-post-"+a++)),l}function J(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const K=({displayName:l})=>{var n;const{customStyles:o}=z(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e("div",{className:U.displayName,style:null==i?void 0:i.wrapper,children:[t(w,{className:U.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e("span",{style:null==i?void 0:i.label,children:[l,":"]})]})},X=({isUserStoryCurrentlyUpdated:I,artifactId:b,artifactTitleId:N,parentUserStory:w,currentUserStory:$,onUserStoryChange:H,parentIndex:ee,currentIndex:te,enableDownload:le,isDiffEditReviewMode:ne,showUserStoryDiff:oe,handleDownloadUserStory:ie,handleOpenSendDialog:ae,updateUserStoryArtifact:se,selectedArtifactId:re,isDisplayHighlightControl:de,elementDisplayConfig:ue,_resolvedConfig:ce,showWrapper:ve=!1,defaultExpanded:pe,actionItemsConfig:me,onDelete:ye,contextVariant:he,expandedSubFeatures:ge,showDisplayName:Se=!0,allowTitleEdit:Ce=!0,showConfidenceScore:fe=!0,showBorderTop:Ie=!0,sectionStatusConfig:be,showCompletionPanel:Ne=!1,completionPanelConfig:we,showAddSectionButton:Ee=!1,disableEditPlan:De=!1,useMuiTooltip:Be=!1,approveButtonConfig:Ae,editButtonConfig:Te,CDNeededInChip:xe,blockNumber:Ue,showWaitingIconInChip:ke,showAssignSection:Pe=!1,disableAssignSection:Re=!1,onAssignSectionClick:_e})=>{var Me,Le,We,Oe,ze,Ve,je,Ge,$e,He,Fe,qe,Qe,Ye,Ze,Je,Ke,Xe,et,tt,lt,nt,ot,it;const{isLoadingSectionData:at=!1,onLoadSectionData:st,status:rt,onStatusClick:dt,completedCount:ut,totalCount:ct,isNoDataAvailable:vt=!1}=null!=be?be:{},{searchQueryList:pt,citations:mt,customStyles:yt,onEditBlocked:ht,redlineDcoumentId:gt,redlineConfig:St,customSectionConfig:Ct,updateRedlineDataParent:ft,aiReasoning:It}=z(),bt=null==yt?void 0:yt.userStoryCardStyles,Nt=null==bt?void 0:bt.customSectionEditButton,wt=null==bt?void 0:bt.statusStyles,Et=null===(Me=null==yt?void 0:yt.userStoryCardStyles)||void 0===Me?void 0:Me.userStoryEditStyles,Dt=null===(Le=null==yt?void 0:yt.userStoryScreenStyles)||void 0===Le?void 0:Le.userStoryContentStyles,Bt=null==bt?void 0:bt.progressHeaderStyles,At=null==bt?void 0:bt.clinicalTrialSectionStyles,Tt=null==bt?void 0:bt.CompletionStyles,xt=null==bt?void 0:bt.noDataStyles,Ut=null==bt?void 0:bt.approveButtonStyles,kt=null!==(Oe=null===(We=null==Ct?void 0:Ct.shouldRender)||void 0===We?void 0:We.call(Ct,$))&&void 0!==Oe&&Oe,Pt=null===(ze=null==Ct?void 0:Ct.getValue)||void 0===ze?void 0:ze.call(Ct,$),Rt=null!==(je=null===(Ve=null==Ct?void 0:Ct.getFields)||void 0===Ve?void 0:Ve.call(Ct,$))&&void 0!==je?je:[],_t=null!==(Ge=null==Ct?void 0:Ct.isEditDisabled)&&void 0!==Ge&&Ge,Mt=null!==(He=null===($e=null==Ct?void 0:Ct.isSaving)||void 0===$e?void 0:$e.call(Ct,$))&&void 0!==He&&He,Lt=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(Fe=$.completion_percentage)&&void 0!==Fe?Fe:0,Tt),Wt={[O.WAITING]:null==wt?void 0:wt.waiting,[O.IN_PROGRESS]:null==wt?void 0:wt.inProgress,[O.GENERATED]:null==wt?void 0:wt.generated,[O.FAILED]:null==wt?void 0:wt.failed,[O.GENERATE]:null==wt?void 0:wt.generate,[O.APPROVED]:null==wt?void 0:wt.approved},[Ot,zt]=n({...structuredClone($),value:k($.value)||""}),[Vt,jt]=n({userStory:!!$.isDefaultEdit}),[Gt,$t]=n(!1),[Ht,Ft]=n(!1),[qt,Qt]=n(null),[Yt,Zt]=n(null),{userStory:Jt,customIcons:Kt}=z(),[Xt,el]=n(null!=pe?pe:""===ee||re===$.artifactId||!!$.isDefaultOpen),[tl,ll]=n(!1),[nl,ol]=n(null),[il,al]=n(null),[sl,rl]=n(!1),dl=o(null),ul=o(null),[cl,vl]=n(!1),[pl,ml]=n(!1),yl=o(null),[hl,gl]=n(!1),[Sl,Cl]=n($.value);i(()=>{I&&el(I)},[I]),i(()=>{zt({...structuredClone($),value:k($.value)||""})},[$]),i(()=>{pt.length>0?el(!0):void 0===pe&&re&&el(re===$.artifactId)},[pt,re,$.artifactId]),i(()=>{ge&&ge.length>0&&el(ge.includes($.artifactId)||""===ee||re===$.artifactId||!!$.isDefaultOpen)},[ge]);const fl=()=>{ol(null)},Il=()=>{al(null)},bl=()=>{Xt&&Vt.userStory&&ul.current&&!ul.current.requestClose()||el(e=>!e)},Nl=async()=>{var e,t;try{"userStory"==="userStory"&&(H(Ot),console.log("I am changing RTE editor values",Ot)),await(null===(e=null==Te?void 0:Te.onSaveEditedSection)||void 0===e?void 0:e.call(Te,Ot)),await se(mt,Jt,b,null===(t=yl.current)||void 0===t?void 0:t.signal)}finally{}};const wl=null!=(null==$?void 0:$.big_enough)&&!Number.isNaN($.big_enough)&&!!(null==$?void 0:$.big_enough_decision_factors),El=null!==(qe=null==$?void 0:$.completion_percentage)&&void 0!==qe?qe:0,Dl=!!(null==$?void 0:$.completion_decision_factors),Bl=""===ee,Al=null!=ce?ce:J(ue,Bl),Tl=!ne&&!oe;i(()=>{if(!Yt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Yt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Yt]),i(()=>{$.isDefaultEdit&&jt(e=>({...e,userStory:!0}))},[$.isDefaultEdit]),console.log("block number in userstory card ",Ue),console.log("[TESTING-CURRENT-USER-STORY] \n",$,"\n[TESTING-USER-STORY] \n",Jt);return i(()=>Cl($.value),[$.value]),e("div",{className:U.card,"data-block-id":"user-story-card-wrapper-"+Ue,style:null==bt?void 0:bt.cardStyle,id:`story-card-${$.title}`,"data-expanded":Xt,children:[e("div",{className:U.titleSection,style:null==bt?void 0:bt.titleSection,children:[e("div",{className:U.titleRow,style:null==bt?void 0:bt.titleRow,onClick:bl,children:[e("div",{className:U.titleLeft,style:null==bt?void 0:bt.titleLeft,onMouseEnter:()=>vl(!0),onMouseLeave:()=>vl(!1),children:[Se&&t(K,{displayName:N}),Gt&&Tl?t(j,{title:$.title,onSave:e=>(async(e,t)=>{var l;try{let n={...$};$.artifactId===t?n.title=e:n.sub_features=(null===(l=$.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],zt(n),H(n),$t(!1)}catch(e){console.error("Failed to save title",e)}})(e,$.artifactId),onCancel:()=>{$t(!1)},inputStyle:null==Et?void 0:Et.inlineTitleInput,confirmButtonStyle:null==Et?void 0:Et.inlineTitleConfirm,cancelButtonStyle:null==Et?void 0:Et.inlineTitleCancel},"inline-title-editor"):e("div",{className:U.storyTitleWrapper,children:[t(D,{title:Z($.title),arrow:!0,children:t("h2",{title:Be?void 0:$.title,className:U.storyTitle,style:null==bt?void 0:bt.storyTitle,children:Z($.title)},$.artifactId)}),Ne&&(Dl?t(q,{customIcons:null==Kt?void 0:Kt.userStoryIcons,customStyles:null==bt?void 0:bt.aiReasoningCitaionStyles,currentUserStory:$,panelStyles:null==bt?void 0:bt.CompletionStyles,onToggleStateChange:ml,completionPanelConfig:we,children:e("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==Tt?void 0:Tt.badge,...Lt},children:[e("span",{children:[El,"% Completed"]}),t("span",{style:{display:"flex",alignItems:"center"},children:t(Q,{color:"currentColor"})}),t(pl?a:s,{size:14,style:null==Tt?void 0:Tt.chevronStyle})]})}):t("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==Tt?void 0:Tt.badge,...Lt},children:e("span",{children:[El,"% Completed"]})})),Ce&&t("button",{type:"button",className:U.titleEditButton,style:null==Et?void 0:Et.titleEditButton,onClick:e=>{e.stopPropagation(),$t(!0),Xt||el(!0)},"aria-label":"Edit title",title:"Edit title",children:t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]}),(rt||void 0!==ut&&void 0!==ct)&&e("div",{className:U.statusContainer,children:[void 0!==ut&&void 0!==ct&&e("div",{className:U.completedBadge,children:["Completed: ",ut,"/",ct]}),rt&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==dt||dt()},onMouseEnter:()=>gl(!0),onMouseLeave:()=>gl(!1),className:U.statusButton,style:{...null===(Qe=Wt[rt])||void 0===Qe?void 0:Qe.default,...hl&&(null===(Ye=Wt[rt])||void 0===Ye?void 0:Ye.hover)},children:Y[rt]})]}),e("div",{className:U.titleActions,style:null==bt?void 0:bt.titleActions,onClick:e=>e.stopPropagation(),children:[(Al.showProgressPercentage||Al.showGapBox)&&ve&&e("div",{className:U.progressHeader,style:null==Bt?void 0:Bt.wrapper,children:[Al.showProgressPercentage&&e("div",{className:U.progressPercentage,style:null==Bt?void 0:Bt.percentage,children:[null!==(Je=null!==(Ze=null==$?void 0:$.confidenceScore)&&void 0!==Ze?Ze:null==Al?void 0:Al.confidenceValue)&&void 0!==Je?Je:"0","%"]}),Al.showGapBox&&e("div",{className:U.gapBox,style:null==Bt?void 0:Bt.gapBox,children:[null!==(Xe=null!==(Ke=null==$?void 0:$.gapValue)&&void 0!==Ke?Ke:null==Al?void 0:Al.gapBoxValue)&&void 0!==Xe?Xe:"2"," ","Gaps"]})]}),wl&&t(V,{customIcons:null==Kt?void 0:Kt.userStoryIcons,customStyles:null==bt?void 0:bt.aiReasoningCitaionStyles,currentUserStory:$,panelStyles:null==bt?void 0:bt.BigEnoughStyles}),Pe&&t("button",{type:"button",className:U.iconButton,style:null==bt?void 0:bt.iconButton,disabled:Re,onClick:e=>{e.stopPropagation(),null==_e||_e($)},"aria-label":"Assign section users",title:"Assign section users",children:t(r,{size:16})}),!Vt.userStory&&e(l,{children:[!1!==(null==Al?void 0:Al.showShareButton)&&t("button",{className:U.iconButton,style:null==bt?void 0:bt.iconButton,onClick:e=>{ol(e.currentTarget)},children:t(d,{size:16})}),e(B,{id:"user-story-share-menu",anchorEl:nl,open:!!nl,onClose:()=>ol(null),style:null==bt?void 0:bt.userStoryShareMenu,children:[le&&t(A,{style:null==bt?void 0:bt.userStoryMenuItem,onClick:async()=>{ll(!0),ie&&(await Promise.all([ie("pdf"),ie("doc")]),ll(!1))},children:e("div",{ref:dl,className:U.menuItemContent,style:null==bt?void 0:bt.menuItemContent,children:[t(u,{size:16,color:null==bt?void 0:bt.menuIconColor}),t("p",{style:null==bt?void 0:bt.menuLabel,children:"Download"})]})}),t(A,{style:null==bt?void 0:bt.userStoryMenuItem,onClick:async()=>{let e=$;w&&(e={...$,value:`${R(null==w?void 0:w.value,$.title)} \n${$.value}`}),null==ae||ae(!0,[e],$.artifactId),fl()},children:e("div",{style:null==bt?void 0:bt.menuItemContent,className:U.menuItemContentPadded,children:[t(c,{size:16,color:null==bt?void 0:bt.menuIconColor}),t("p",{style:null==bt?void 0:bt.menuLabel,children:"Send"})]})}),t(A,{style:null==bt?void 0:bt.userStoryMenuItem,onClick:async()=>{const e=(new E.Converter).makeHtml(k($.value)||$.value),t=function(e){const t=(new E.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(k($.value)||$.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{fl()}},children:e("div",{style:null==bt?void 0:bt.menuItemContent,className:U.menuItemContentPadded,children:[t(v,{size:16,color:null==bt?void 0:bt.menuIconColor}),t("p",{style:null==bt?void 0:bt.menuLabel,children:"Copy"})]})})]})]}),!sl&&Vt.userStory&&Xt?t(M,{type:"outline",children:"Cancel",style:null==bt?void 0:bt.cancelButton,onClick:()=>{var e;null===(e=yl.current)||void 0===e||e.abort(),jt(e=>({...e,userStory:!1}))}}):t(l,{}),Vt.userStory&&Xt?t(M,{type:"fill",children:sl?e("span",{className:U.savingSpinner,style:null==bt?void 0:bt.savingSpinner,children:[t(p,{className:U.spinAnimation,style:null==bt?void 0:bt.spinAnimation}),t("span",{children:"Saving..."})]}):"Save",isDisable:sl,style:sl?null==bt?void 0:bt.savingButton:null==bt?void 0:bt.saveButton,onClick:async()=>{rl(!0),await Nl();let e=await(async()=>{var e,t,l,n,o;let i=Ot.value;console.log("[V] valueToUpdate before",i),i=i.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",i);try{if(null==St?void 0:St.callUpdateDocument){const{updated_reqai:a}=await G({documentId:gt,sectionId:$.artifactId,baseApiUrl:null==St?void 0:St.baseApiUrl,updatedContent:i,userEmail:St.userEmail,userName:St.userName,redlineConfigId:null!==(e=St.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==St?void 0:St.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==a?void 0:a.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==ft?void 0:ft(a))}}catch(e){console.error("failed to update redline document",e),i=Sl}return i=i.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),i})();const t={...Ot,value:e};H({...t,isDefaultEdit:!1}),Cl(t.value),jt(e=>({...e,userStory:!1})),rl(!1)}}):!ne&&!oe&&!De&&Xt&&!1!==(null==Al?void 0:Al.showEditButton)&&t("button",{className:U.iconButton,style:null==bt?void 0:bt.editButton,onClick:()=>jt(e=>({...e,userStory:!0})),children:t(m,{color:null==bt?void 0:bt.pencilIconColor,size:16})}),Ee&&Bl&&Xt&&!ne&&!oe&&!1!==(null==Al?void 0:Al.showEditButton)&&e("button",{type:"button",className:U.addSectionButton,style:null==Et?void 0:Et.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=$.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:x(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...$,sub_features:[...null!==(n=$.sub_features)&&void 0!==n?n:[],i]};zt(a),H(a),el(!0),Zt(i.title)},"aria-label":"Add section",title:"Add section",children:[t(y,{size:14}),t("span",{className:U.addSectionLabel,children:"Add Section"})]}),!Bl&&!ne&&!De&&!oe&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==ye||ye()},className:U.iconButton,style:null==Et?void 0:Et.deleteButton,"aria-label":"Delete section",title:"Delete section",children:t(h,{size:16})}),kt&&t("button",{type:"button",className:U.iconButton,style:null==Nt?void 0:Nt.button,disabled:_t,onClick:e=>{if(e.stopPropagation(),Ht)return Qt(null),void Ft(!1);Qt(structuredClone(null!=Pt?Pt:{})),el(!0),Ft(!0)},children:Ht?t(g,{size:16,color:null==bt?void 0:bt.pencilIconColor,style:null==Nt?void 0:Nt.cancelIcon}):t(m,{size:16,color:null==bt?void 0:bt.pencilIconColor,style:null==Nt?void 0:Nt.editIcon})}),(null==Al?void 0:Al.actionItemsButton)&&e(l,{children:[t("span",{className:U.actionItemBtn,style:null==bt?void 0:bt.actionItemBtn,onClick:e=>{e.stopPropagation(),al(e.currentTarget)},children:t(S,{})}),t(B,{id:"user-story-action-menu",anchorEl:il,open:!!il,onClose:Il,style:null==bt?void 0:bt.userStoryShareMenu,children:null==me?void 0:me.items.map((l,n)=>t(A,{style:null==bt?void 0:bt.userStoryMenuItem,onClick:()=>{l.onclick($),Il()},children:e("div",{className:U.menuItemContent,style:{...null==bt?void 0:bt.menuItemContent,...!l.isActive&&{cursor:"not-allowed",opacity:.5}},children:[t("span",{className:U.menuItemIcon,style:null==bt?void 0:bt.menuItemIcon,children:l.icon}),t("p",{style:null==bt?void 0:bt.menuLabel,children:l.name}),t("span",{className:U.menuItemRight,style:null==bt?void 0:bt.menuItemRight})]})},`action-item-${n}-${l.name}`))})]}),t("button",{type:"button",onClick:e=>{e.stopPropagation(),bl()},style:null==bt?void 0:bt.chevronButton,className:U.chevronButton,children:t(Xt?a:s,{className:U.chevronIcon,color:null==bt?void 0:bt.chevronIconColor})})]})]}),t("div",{className:U.divider,style:null==bt?void 0:bt.dividerStyle})]}),Xt&&t("div",{className:U.cardContent,style:{...null==bt?void 0:bt.cardContentStyle,borderTop:Ie?"1px solid #E5E5E5":"none"},children:e("div",at?{className:U.loadingContainer,children:[t("div",{className:U.loadingIconWrapper,children:t(C,{size:28,color:"#5B3DF5",className:U.spinAnimation})}),e("div",{children:[t("h3",{className:U.loadingTitle,children:"Section generation in progress.."}),t("p",{className:U.loadingSubtitle,children:"This may take a few minutes"})]}),t("button",{type:"button",onClick:()=>null==st?void 0:st(),className:U.viewStatusButton,children:"View Status"})]}:vt?{className:U.noDataContainer,style:null==xt?void 0:xt.container,children:[t("img",{src:T,alt:"No data available",className:U.noDataIllustration,style:null==xt?void 0:xt.illustration}),t("h3",{className:U.noDataTitle,style:null==xt?void 0:xt.title,children:"No Data Available for This Section"}),t("p",{className:U.noDataSubtitle,style:null==xt?void 0:xt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}:{className:U.contentInner,style:null==bt?void 0:bt.contentInner,children:[e("div",{className:U.descriptionSection,style:null==bt?void 0:bt.descriptionSection,children:[t("div",{className:U.justifyBetween,style:null==bt?void 0:bt.justifyBetween}),Vt.userStory?t(L,{ref:ul,minHeight:"100%",height:"100%",type:"string",value:k(Sl)||"",handleUpdateState:(e,t)=>{const l=_(P(t));zt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Vt.userStory?"edit":"readOnly",onEditBlocked:ht,onSaveUnsavedChanges:async()=>{await Nl(),el(!1)},onDiscardUnsavedChanges:()=>{zt({...structuredClone($),value:k($.value)||""}),jt(e=>({...e,userStory:!1})),el(!1)},isSavingUnsavedChanges:sl}):kt?t(F,{styles:At,fields:Rt,readonly:!Ht,isSaving:Mt,value:null!==(et=null!=qt?qt:Pt)&&void 0!==et?et:{},onChange:Qt,onSave:async()=>{var e;qt&&(await(null===(e=null==Ct?void 0:Ct.onSave)||void 0===e?void 0:e.call(Ct,$,qt)),Qt(null),Ft(!1))},onCancel:()=>{Qt(null),Ft(!1)}}):e(l,{children:[t(W,{showUserStoryDiff:oe,isParent:""===ee,message:k($.value)||"",artifactId:$.artifactId,customStyles:Dt,isDisplayHighlightControl:de,contextVariant:he,showConfidenceScore:fe,CDNeededInChip:xe,blockId:Ue,showWaitingIconInChip:ke}),(Ae||Te)&&e("div",{className:U.actionButtonsContainer,style:null==Ut?void 0:Ut.container,children:[Te&&!Vt.userStory&&e(l,{children:[t("button",{type:"button",className:U.actionButton,style:null==Ut?void 0:Ut.button,disabled:Te.disabled||Te.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=Te.onClick)||void 0===t||t.call(Te),jt(e=>({...e,userStory:!0})),el(!0)},children:Te.isLoading?e(l,{children:[t(p,{size:16,className:U.actionButtonSpinner,style:null==Ut?void 0:Ut.icon}),t("span",{style:null==Ut?void 0:Ut.text,children:null!==(tt=Te.label)&&void 0!==tt?tt:"Edit"})]}):e(l,{children:[t(m,{size:16,style:null==Ut?void 0:Ut.icon}),t("span",{style:null==Ut?void 0:Ut.text,children:null!==(lt=Te.label)&&void 0!==lt?lt:"Edit"})]})}),Ae&&t("span",{className:U.actionButtonDivider})]}),Ae&&t("button",{type:"button",className:U.actionButton,style:null==Ut?void 0:Ut.button,disabled:Ae.disabled||Ae.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=Ae.onClick)||void 0===t||t.call(Ae)},children:Ae.isLoading?e(l,{children:[t(p,{size:16,className:U.actionButtonSpinner,style:null==Ut?void 0:Ut.icon}),t("span",{style:null==Ut?void 0:Ut.text,children:null!==(nt=Ae.label)&&void 0!==nt?nt:"Approve"})]}):e(l,{children:[t(f,{size:16,style:null==Ut?void 0:Ut.icon}),t("span",{style:null==Ut?void 0:Ut.text,children:null!==(ot=Ae.label)&&void 0!==ot?ot:"Approve"})]})})]})]})]}),null===(it=Ot.sub_features)||void 0===it?void 0:it.map((e,l)=>{console.log("UserStoryCardWrapper: sub",e);const n=J(ue,!1,e.artifactId);return t(X,{artifactId:b,isUserStoryCurrentlyUpdated:I,artifactTitleId:`${N}-${String.fromCharCode(65+l)}`,parentUserStory:$,parentIndex:`${ee}${ee&&"."}${te}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const l=[...$.sub_features||[]];l[e]=t,H({...$,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:ne,showUserStoryDiff:oe,updateUserStoryArtifact:se,handleDownloadUserStory:ie,handleOpenSendDialog:ae,isDisplayHighlightControl:de,elementDisplayConfig:ue,_resolvedConfig:n,actionItemsConfig:me,onDelete:()=>(e=>{const t=($.sub_features||[]).filter((t,l)=>l!==e),l={...$,sub_features:t};zt(l),H(l)})(l),expandedSubFeatures:ge,disableEditPlan:De,useMuiTooltip:Be,blockNumber:e.blockNumber,showAssignSection:Pe,onAssignSectionClick:_e},e.artifactId)})]})})]})},ee=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:h,actionItemsConfig:g,contextVariant:S,showDisplayName:C,allowTitleEdit:f,showConfidenceScore:N,showBorderTop:w,defaultExpanded:E,showCompletionPanel:D=!1,completionPanelConfig:B,showAddSectionButton:A=!1,disableEditPlan:T=!1,useMuiTooltip:x=!1,approveButtonConfig:k,editButtonConfig:P,CDNeededInChip:R,showWaitingIconInChip:_,setRedlineDocumentIdParent:M,showAssignSection:L,onAssignSectionClick:W,disableAssignSection:O})=>{const{userStory:V,setUserStory:j,customStyles:G,searchQueryList:F,currentHighlightIndex:q,setCurrentHighlightIndex:Q,segmentComponentConfig:Y,sectionStatusConfig:Z,redlineConfig:K,setRedlineDocumentId:ee}=z(),te=null==G?void 0:G.userStoryCardStyles,le=0===q,ne=q===F.length-1;return i(()=>{if(!(null==K?void 0:K.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await $({baseApiUrl:K.documentBaseApiUrl||"",comparisonId:K.documentComparisonId||""});if(t)ee(t);else{const{document_id:t}=await H({baseApiUrl:K.baseApiUrl,changelogConfigId:K.changelogConfigId,comparisonId:K.documentComparisonId,artifactId:K.artifactId,inputData:K.inputData,redlineConfigId:K.redlineConfigId,userEmail:K.userEmail,userName:K.userName},null!==(e=null==K?void 0:K.token)&&void 0!==e?e:"");t&&(ee(t),null==M||M(t))}})()},[]),e("div",{className:U.userStoryCardWrapper,style:m?{...null==te?void 0:te.userStoryCardWrapper,position:"relative"}:null==te?void 0:te.userStoryCardWrapper,children:[m&&t(l,{children:F.length>0&&t("div",{className:U.wrapper,children:t("div",{className:U.highlightNavigation,children:e("div",{className:U.navigationContainer,children:[e("span",{className:U.navCounter,children:[q+1," of ",F.length]}),e("div",{className:U.navButtons,children:[t("button",{onClick:()=>{q>0&&Q(e=>e-1)},className:U.navButton,disabled:le,children:t(I,{size:20,className:U.navIcon})}),t("button",{onClick:()=>{q<F.length-1&&Q(e=>e+1)},className:U.navButton,disabled:ne,children:t(b,{size:20,className:U.navIcon})})]})]})})})}),V.map((e,l)=>{console.log("UserStoryCardWrapper: userstory",e);const i=J(y,!0);return t(X,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:e,onUserStoryChange:e=>{j(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:i,showWrapper:h,defaultExpanded:E,actionItemsConfig:g,contextVariant:S,showDisplayName:C,allowTitleEdit:f,showConfidenceScore:N,showBorderTop:w,sectionStatusConfig:Z,showCompletionPanel:D,completionPanelConfig:B,showAddSectionButton:A,disableEditPlan:T,useMuiTooltip:x,approveButtonConfig:k,CDNeededInChip:R,editButtonConfig:P,showWaitingIconInChip:_,showAssignSection:L,disableAssignSection:O,onAssignSectionClick:W},e.artifactId)})]})};export{X as StoryCard,ee as UserStoryCardWrapper,X as default,Z as replaceLearnedTagsWithInfo};
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useState as n,useRef as o,useEffect as i}from"react";import{ChevronUp as a,ChevronDown as s,Users as r,ExternalLink as d,Download as u,Share2 as c,Copy as v,LoaderCircle as p,PencilIcon as m,RefreshCw as h,Plus as y,Trash2 as g,X as f,Ellipsis as C,Hourglass as S,Check as I,ChevronUpIcon as b,ChevronDownIcon as w,Info as N,Bookmark as E}from"lucide-react";import D from"showdown";import{Tooltip as B,Menu as A,MenuItem as T}from"@mui/material";import x from"../../icons/Illustration.svg.js";import{v4 as U}from"uuid";import k from"./UserStoryCard.module.css.js";import{formatMarkdown as P,indentMarkdown as R}from"../../utils/helpers.js";import{replaceTitleSection as _,postprocessUserStoryAfterEdit as M}from"../../utils/user-story.utils.js";import W from"../../shared/AtomicButton.js";import L from"../RichTextEditor/RichTextEditor.js";import j from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as $,useRequirementAI as O,ToasterId as z}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as V}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as G}from"./TitleEditor/TitleEditor.js";import{fetchRedlineDocumentSection as F,updateRedlineDocument as H,getRedlineDocumentId as q,createRedlineDocument as Y}from"../../../../service/redlineService.js";import Q from"./ClinicalTrialSection.js";import{CompletionPanel as Z}from"../story-screen/CompletionPanel.js";import J from"../../icons/CDIcon.js";import K from"./cws/CwsEvent.js";import X from"./cws/useCwsEvent.js";import ee from"react-hot-toast";import te from"./Popups/RedlineToast.js";const le={[$.WAITING]:"WAITING TO GENERATE",[$.IN_PROGRESS]:"IN PROGRESS",[$.GENERATED]:"GENERATED",[$.FAILED]:"FAILED",[$.GENERATE]:"GENERATE",[$.APPROVED]:"APPROVED"};function ne(e){const l=[],n=/<learned>(.*?)<\/learned>/g;let o,i=0,a=0;for(;null!==(o=n.exec(e));){const[,s]=o,r=o.index;r>i&&l.push(t("span",{children:e.slice(i,r)},"text-pre-"+a++)),l.push(t(B,{title:s,placement:"top",children:t(N,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${U()}`)),i=n.lastIndex}return i<(null==e?void 0:e.length)&&l.push(t("span",{children:e.slice(i)},"text-post-"+a++)),l}function oe(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const ie=({displayName:l})=>{var n;const{customStyles:o}=O(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e("div",{className:k.displayName,style:null==i?void 0:i.wrapper,children:[t(E,{className:k.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e("span",{style:null==i?void 0:i.label,children:[l,":"]})]})},ae=({isUserStoryCurrentlyUpdated:b,artifactId:w,artifactTitleId:N,parentUserStory:E,currentUserStory:q,onUserStoryChange:Y,parentIndex:se,currentIndex:re,enableDownload:de,isDiffEditReviewMode:ue,showUserStoryDiff:ce,handleDownloadUserStory:ve,handleOpenSendDialog:pe,updateUserStoryArtifact:me,selectedArtifactId:he,isDisplayHighlightControl:ye,elementDisplayConfig:ge,_resolvedConfig:fe,showWrapper:Ce=!1,defaultExpanded:Se,actionItemsConfig:Ie,onDelete:be,contextVariant:we,expandedSubFeatures:Ne,showDisplayName:Ee=!0,allowTitleEdit:De=!0,showConfidenceScore:Be=!0,showBorderTop:Ae=!0,sectionStatusConfig:Te,showCompletionPanel:xe=!1,completionPanelConfig:Ue,showAddSectionButton:ke=!1,disableEditPlan:Pe=!1,useMuiTooltip:Re=!1,approveButtonConfig:_e,editButtonConfig:Me,CDNeededInChip:We,blockNumber:Le,showWaitingIconInChip:je,showAssignSection:$e=!1,disableAssignSection:Oe=!1,onAssignSectionClick:ze})=>{var Ve,Ge,Fe,He,qe,Ye,Qe,Ze,Je,Ke,Xe,et,tt,lt,nt,ot,it,at,st,rt,dt,ut,ct,vt;const{isLoadingSectionData:pt=!1,onLoadSectionData:mt,status:ht,onStatusClick:yt,completedCount:gt,totalCount:ft,isNoDataAvailable:Ct=!1}=null!=Te?Te:{},{searchQueryList:St,citations:It,customStyles:bt,onEditBlocked:wt,redlineDcoumentId:Nt,redlineConfig:Et,customSectionConfig:Dt,updateRedlineDataParent:Bt,aiReasoning:At,redlineCollaborativeConfig:Tt}=O(),xt=null==bt?void 0:bt.userStoryCardStyles,Ut=null==xt?void 0:xt.customSectionEditButton,kt=null==xt?void 0:xt.statusStyles,Pt=null===(Ve=null==bt?void 0:bt.userStoryCardStyles)||void 0===Ve?void 0:Ve.userStoryEditStyles,Rt=null===(Ge=null==bt?void 0:bt.userStoryScreenStyles)||void 0===Ge?void 0:Ge.userStoryContentStyles,_t=null==xt?void 0:xt.progressHeaderStyles,Mt=null==xt?void 0:xt.clinicalTrialSectionStyles,Wt=null==xt?void 0:xt.CompletionStyles,Lt=null==xt?void 0:xt.noDataStyles,jt=null==xt?void 0:xt.approveButtonStyles,$t=null!==(He=null===(Fe=null==Dt?void 0:Dt.shouldRender)||void 0===Fe?void 0:Fe.call(Dt,q))&&void 0!==He&&He,Ot=null===(qe=null==Dt?void 0:Dt.getValue)||void 0===qe?void 0:qe.call(Dt,q),zt=null!==(Qe=null===(Ye=null==Dt?void 0:Dt.getFields)||void 0===Ye?void 0:Ye.call(Dt,q))&&void 0!==Qe?Qe:[],Vt=null!==(Ze=null==Dt?void 0:Dt.isEditDisabled)&&void 0!==Ze&&Ze,Gt=null!==(Ke=null===(Je=null==Dt?void 0:Dt.isSaving)||void 0===Je?void 0:Je.call(Dt,q))&&void 0!==Ke&&Ke,Ft=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(Xe=q.completion_percentage)&&void 0!==Xe?Xe:0,Wt),Ht={[$.WAITING]:null==kt?void 0:kt.waiting,[$.IN_PROGRESS]:null==kt?void 0:kt.inProgress,[$.GENERATED]:null==kt?void 0:kt.generated,[$.FAILED]:null==kt?void 0:kt.failed,[$.GENERATE]:null==kt?void 0:kt.generate,[$.APPROVED]:null==kt?void 0:kt.approved},[qt,Yt]=n({...structuredClone(q),value:P(q.value)||""}),[Qt,Zt]=n({userStory:!!q.isDefaultEdit}),[Jt,Kt]=n(!1),[Xt,el]=n(!1),[tl,ll]=n(null),[nl,ol]=n(null),{userStory:il,customIcons:al}=O(),[sl,rl]=n(null!=Se?Se:""===se||he===q.artifactId||!!q.isDefaultOpen),[dl,ul]=n(!1),[cl,vl]=n(null),[pl,ml]=n(null),[hl,yl]=n(!1),gl=o(null),fl=o(null),[Cl,Sl]=n(!1),[Il,bl]=n(!1),wl=o(null),[Nl,El]=n(!1),[Dl,Bl]=n(q.value);i(()=>{b&&rl(b)},[b]),i(()=>{Yt({...structuredClone(q),value:P(q.value)||""})},[q]),i(()=>{St.length>0?rl(!0):void 0===Se&&he&&rl(he===q.artifactId)},[St,he,q.artifactId]),i(()=>{Ne&&Ne.length>0&&rl(Ne.includes(q.artifactId)||""===se||he===q.artifactId||!!q.isDefaultOpen)},[Ne]);const Al=()=>{vl(null)},Tl=()=>{ml(null)},xl=()=>{sl&&Qt.userStory&&fl.current&&!fl.current.requestClose()||rl(e=>!e)},Ul=async()=>{var e,t;try{"userStory"==="userStory"&&(Y(qt),console.log("I am changing RTE editor values",qt)),await(null===(e=null==Me?void 0:Me.onSaveEditedSection)||void 0===e?void 0:e.call(Me,qt)),await me(It,il,w,null===(t=wl.current)||void 0===t?void 0:t.signal)}finally{}};const kl=null!=(null==q?void 0:q.big_enough)&&!Number.isNaN(q.big_enough)&&!!(null==q?void 0:q.big_enough_decision_factors),Pl=null!==(et=null==q?void 0:q.completion_percentage)&&void 0!==et?et:0,Rl=!!(null==q?void 0:q.completion_decision_factors),_l=""===se,Ml=null!=fe?fe:oe(ge,_l),Wl=!ue&&!ce;i(()=>{if(!nl)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${nl}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[nl]);const[Ll,jl]=n(0),[$l,Ol]=n(!1),zl=async()=>{var e,t;let l=!0;if(Ol(e=>(l=!e,!0)),l){let l;jl(e=>(l=e,e));try{const{updated_reqai:n}=await F({documentId:Nt,sectionId:q.artifactId,baseApiUrl:null==Et?void 0:Et.baseApiUrl,redlineConfigId:null!==(e=null==Et?void 0:Et.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Et?void 0:Et.token)&&void 0!==t?t:"");await(null==Bt?void 0:Bt(n)),jl(e=>l===e?0:1)}catch(e){}Ol(!1)}};i(()=>{q.isDefaultEdit&&Zt(e=>({...e,userStory:!0}))},[q.isDefaultEdit]),console.log("block number in userstory card ",Le),console.log("[TESTING-CURRENT-USER-STORY] \n",q,"\n[TESTING-USER-STORY] \n",il),X(`redline-edit:${Nt}:${q.artifactId}`,async({updatedBy:l})=>{var n;null===(n=wl.current)||void 0===n||n.abort(),jl(e=>e+1),Zt(n=>n.userStory?(ee.custom(n=>e(te,{onCancel:()=>ee.dismiss(n.id),onRefresh:()=>{ee.dismiss(n.id),zl()},children:["This ",t("span",{style:{fontWeight:600},children:q.title})," section has been updated by ",t("span",{style:{fontWeight:600},children:l})," while you were editing. Please refresh to view the latest version."]}),{duration:1e4,toasterId:z}),{...il,userStory:!1}):(zl().then(()=>{ee.custom(n=>e(te,{onCancel:()=>ee.dismiss(n.id),children:[t("span",{style:{fontWeight:600},children:q.title})," updated,",t("br",{}),l," saved changes. Your unsaved edits are untouched."]}),{duration:1e4,toasterId:z})}),n))});return i(()=>Bl(q.value),[q.value]),e("div",{className:k.card,"data-block-id":"user-story-card-wrapper-"+Le,style:null==xt?void 0:xt.cardStyle,id:`story-card-${q.title}`,"data-expanded":sl,children:[e("div",{className:k.titleSection,style:null==xt?void 0:xt.titleSection,children:[e("div",{className:k.titleRow,style:null==xt?void 0:xt.titleRow,onClick:xl,children:[e("div",{className:k.titleLeft,style:null==xt?void 0:xt.titleLeft,onMouseEnter:()=>Sl(!0),onMouseLeave:()=>Sl(!1),children:[Ee&&t(ie,{displayName:N}),Jt&&Wl?t(G,{title:q.title,onSave:e=>(async(e,t)=>{var l;try{let n={...q};q.artifactId===t?n.title=e:n.sub_features=(null===(l=q.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],Yt(n),Y(n),Kt(!1)}catch(e){console.error("Failed to save title",e)}})(e,q.artifactId),onCancel:()=>{Kt(!1)},inputStyle:null==Pt?void 0:Pt.inlineTitleInput,confirmButtonStyle:null==Pt?void 0:Pt.inlineTitleConfirm,cancelButtonStyle:null==Pt?void 0:Pt.inlineTitleCancel},"inline-title-editor"):e("div",{className:k.storyTitleWrapper,children:[t(B,{title:ne(q.title),arrow:!0,children:t("h2",{title:Re?void 0:q.title,className:k.storyTitle,style:null==xt?void 0:xt.storyTitle,children:ne(q.title)},q.artifactId)}),xe&&(Rl?t(Z,{customIcons:null==al?void 0:al.userStoryIcons,customStyles:null==xt?void 0:xt.aiReasoningCitaionStyles,currentUserStory:q,panelStyles:null==xt?void 0:xt.CompletionStyles,onToggleStateChange:bl,completionPanelConfig:Ue,children:e("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==Wt?void 0:Wt.badge,...Ft},children:[e("span",{children:[Pl,"% Completed"]}),t("span",{style:{display:"flex",alignItems:"center"},children:t(J,{color:"currentColor"})}),t(Il?a:s,{size:14,style:null==Wt?void 0:Wt.chevronStyle})]})}):t("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==Wt?void 0:Wt.badge,...Ft},children:e("span",{children:[Pl,"% Completed"]})})),De&&t("button",{type:"button",className:k.titleEditButton,style:null==Pt?void 0:Pt.titleEditButton,onClick:e=>{e.stopPropagation(),Kt(!0),sl||rl(!0)},"aria-label":"Edit title",title:"Edit title",children:t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]}),(ht||void 0!==gt&&void 0!==ft)&&e("div",{className:k.statusContainer,children:[void 0!==gt&&void 0!==ft&&e("div",{className:k.completedBadge,children:["Completed: ",gt,"/",ft]}),ht&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==yt||yt()},onMouseEnter:()=>El(!0),onMouseLeave:()=>El(!1),className:k.statusButton,style:{...null===(tt=Ht[ht])||void 0===tt?void 0:tt.default,...Nl&&(null===(lt=Ht[ht])||void 0===lt?void 0:lt.hover)},children:le[ht]})]}),e("div",{className:k.titleActions,style:null==xt?void 0:xt.titleActions,onClick:e=>e.stopPropagation(),children:[(Ml.showProgressPercentage||Ml.showGapBox)&&Ce&&e("div",{className:k.progressHeader,style:null==_t?void 0:_t.wrapper,children:[Ml.showProgressPercentage&&e("div",{className:k.progressPercentage,style:null==_t?void 0:_t.percentage,children:[null!==(ot=null!==(nt=null==q?void 0:q.confidenceScore)&&void 0!==nt?nt:null==Ml?void 0:Ml.confidenceValue)&&void 0!==ot?ot:"0","%"]}),Ml.showGapBox&&e("div",{className:k.gapBox,style:null==_t?void 0:_t.gapBox,children:[null!==(at=null!==(it=null==q?void 0:q.gapValue)&&void 0!==it?it:null==Ml?void 0:Ml.gapBoxValue)&&void 0!==at?at:"2"," ","Gaps"]})]}),kl&&t(V,{customIcons:null==al?void 0:al.userStoryIcons,customStyles:null==xt?void 0:xt.aiReasoningCitaionStyles,currentUserStory:q,panelStyles:null==xt?void 0:xt.BigEnoughStyles}),$e&&t("button",{type:"button",className:k.iconButton,style:null==xt?void 0:xt.iconButton,disabled:Oe,onClick:e=>{e.stopPropagation(),null==ze||ze(q)},"aria-label":"Assign section users",title:"Assign section users",children:t(r,{size:16})}),!Qt.userStory&&e(l,{children:[!1!==(null==Ml?void 0:Ml.showShareButton)&&t("button",{className:k.iconButton,style:null==xt?void 0:xt.iconButton,onClick:e=>{vl(e.currentTarget)},children:t(d,{size:16})}),e(A,{id:"user-story-share-menu",anchorEl:cl,open:!!cl,onClose:()=>vl(null),style:null==xt?void 0:xt.userStoryShareMenu,children:[de&&t(T,{style:null==xt?void 0:xt.userStoryMenuItem,onClick:async()=>{ul(!0),ve&&(await Promise.all([ve("pdf"),ve("doc")]),ul(!1))},children:e("div",{ref:gl,className:k.menuItemContent,style:null==xt?void 0:xt.menuItemContent,children:[t(u,{size:16,color:null==xt?void 0:xt.menuIconColor}),t("p",{style:null==xt?void 0:xt.menuLabel,children:"Download"})]})}),t(T,{style:null==xt?void 0:xt.userStoryMenuItem,onClick:async()=>{let e=q;E&&(e={...q,value:`${_(null==E?void 0:E.value,q.title)} \n${q.value}`}),null==pe||pe(!0,[e],q.artifactId),Al()},children:e("div",{style:null==xt?void 0:xt.menuItemContent,className:k.menuItemContentPadded,children:[t(c,{size:16,color:null==xt?void 0:xt.menuIconColor}),t("p",{style:null==xt?void 0:xt.menuLabel,children:"Send"})]})}),t(T,{style:null==xt?void 0:xt.userStoryMenuItem,onClick:async()=>{const e=(new D.Converter).makeHtml(P(q.value)||q.value),t=function(e){const t=(new D.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(P(q.value)||q.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{Al()}},children:e("div",{style:null==xt?void 0:xt.menuItemContent,className:k.menuItemContentPadded,children:[t(v,{size:16,color:null==xt?void 0:xt.menuIconColor}),t("p",{style:null==xt?void 0:xt.menuLabel,children:"Copy"})]})})]})]}),!hl&&Qt.userStory&&sl?t(W,{type:"outline",children:"Cancel",style:null==xt?void 0:xt.cancelButton,onClick:()=>{var e;null===(e=wl.current)||void 0===e||e.abort(),Zt(e=>({...e,userStory:!1}))}}):t(l,{}),Qt.userStory&&sl?t(W,{type:"fill",children:hl?e("span",{className:k.savingSpinner,style:null==xt?void 0:xt.savingSpinner,children:[t(p,{className:k.spinAnimation,style:null==xt?void 0:xt.spinAnimation}),t("span",{children:"Saving..."})]}):"Save",isDisable:hl,style:hl?null==xt?void 0:xt.savingButton:null==xt?void 0:xt.saveButton,onClick:async()=>{yl(!0),await Ul();let e=await(async()=>{var e,t,l,n,o,i,a,s;let r=qt.value;console.log("[V] valueToUpdate before",r),r=r.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",r);try{if(null==Et?void 0:Et.callUpdateDocument){const{updated_reqai:d}=await H({documentId:Nt,sectionId:q.artifactId,baseApiUrl:null==Et?void 0:Et.baseApiUrl,updatedContent:r,userEmail:Et.userEmail,userName:Et.userName,redlineConfigId:null!==(e=Et.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Et?void 0:Et.token)&&void 0!==t?t:"");r=null===(o=null===(n=null===(l=null==d?void 0:d.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==Bt?void 0:Bt(d)),K.emit(`redline-edit:${Nt}:${null===(s=null===(a=null===(i=null==d?void 0:d.artifactData)||void 0===i?void 0:i.userStorySnapshot)||void 0===a?void 0:a[0])||void 0===s?void 0:s.artifactId}`,{updatedBy:null==Et?void 0:Et.userName})}}catch(e){console.error("failed to update redline document",e),r=Dl}return r=r.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),r})();const t={...qt,value:e};Y({...t,isDefaultEdit:!1}),Bl(t.value),Zt(e=>({...e,userStory:!1})),yl(!1)}}):!Ll&&!ue&&!ce&&!Pe&&sl&&!1!==(null==Ml?void 0:Ml.showEditButton)&&t("button",{className:k.iconButton,style:null==xt?void 0:xt.editButton,onClick:()=>Zt(e=>({...e,userStory:!0})),children:t(m,{color:null==xt?void 0:xt.pencilIconColor,size:16})}),(null==Tt?void 0:Tt.initiateCollaborativeFlow)&&!!Ll&&t(B,{title:"Fetch latest section",children:t(h,{color:$l?"#d3d3d3":"black",onClick:zl})}),ke&&_l&&sl&&!ue&&!ce&&!1!==(null==Ml?void 0:Ml.showEditButton)&&e("button",{type:"button",className:k.addSectionButton,style:null==Pt?void 0:Pt.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=q.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:U(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...q,sub_features:[...null!==(n=q.sub_features)&&void 0!==n?n:[],i]};Yt(a),Y(a),rl(!0),ol(i.title)},"aria-label":"Add section",title:"Add section",children:[t(y,{size:14}),t("span",{className:k.addSectionLabel,children:"Add Section"})]}),!_l&&!ue&&!Pe&&!ce&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==be||be()},className:k.iconButton,style:null==Pt?void 0:Pt.deleteButton,"aria-label":"Delete section",title:"Delete section",children:t(g,{size:16})}),$t&&t("button",{type:"button",className:k.iconButton,style:null==Ut?void 0:Ut.button,disabled:Vt,onClick:e=>{if(e.stopPropagation(),Xt)return ll(null),void el(!1);ll(structuredClone(null!=Ot?Ot:{})),rl(!0),el(!0)},children:Xt?t(f,{size:16,color:null==xt?void 0:xt.pencilIconColor,style:null==Ut?void 0:Ut.cancelIcon}):t(m,{size:16,color:null==xt?void 0:xt.pencilIconColor,style:null==Ut?void 0:Ut.editIcon})}),(null==Ml?void 0:Ml.actionItemsButton)&&e(l,{children:[t("span",{className:k.actionItemBtn,style:null==xt?void 0:xt.actionItemBtn,onClick:e=>{e.stopPropagation(),ml(e.currentTarget)},children:t(C,{})}),t(A,{id:"user-story-action-menu",anchorEl:pl,open:!!pl,onClose:Tl,style:null==xt?void 0:xt.userStoryShareMenu,children:null==Ie?void 0:Ie.items.map((l,n)=>t(T,{style:null==xt?void 0:xt.userStoryMenuItem,onClick:()=>{l.onclick(q),Tl()},children:e("div",{className:k.menuItemContent,style:{...null==xt?void 0:xt.menuItemContent,...!l.isActive&&{cursor:"not-allowed",opacity:.5}},children:[t("span",{className:k.menuItemIcon,style:null==xt?void 0:xt.menuItemIcon,children:l.icon}),t("p",{style:null==xt?void 0:xt.menuLabel,children:l.name}),t("span",{className:k.menuItemRight,style:null==xt?void 0:xt.menuItemRight})]})},`action-item-${n}-${l.name}`))})]}),t("button",{type:"button",onClick:e=>{e.stopPropagation(),xl()},style:null==xt?void 0:xt.chevronButton,className:k.chevronButton,children:t(sl?a:s,{className:k.chevronIcon,color:null==xt?void 0:xt.chevronIconColor})})]})]}),t("div",{className:k.divider,style:null==xt?void 0:xt.dividerStyle})]}),sl&&t("div",{className:k.cardContent,style:{...null==xt?void 0:xt.cardContentStyle,borderTop:Ae?"1px solid #E5E5E5":"none"},children:e("div",pt?{className:k.loadingContainer,children:[t("div",{className:k.loadingIconWrapper,children:t(S,{size:28,color:"#5B3DF5",className:k.spinAnimation})}),e("div",{children:[t("h3",{className:k.loadingTitle,children:"Section generation in progress.."}),t("p",{className:k.loadingSubtitle,children:"This may take a few minutes"})]}),t("button",{type:"button",onClick:()=>null==mt?void 0:mt(),className:k.viewStatusButton,children:"View Status"})]}:Ct?{className:k.noDataContainer,style:null==Lt?void 0:Lt.container,children:[t("img",{src:x,alt:"No data available",className:k.noDataIllustration,style:null==Lt?void 0:Lt.illustration}),t("h3",{className:k.noDataTitle,style:null==Lt?void 0:Lt.title,children:"No Data Available for This Section"}),t("p",{className:k.noDataSubtitle,style:null==Lt?void 0:Lt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}:{className:k.contentInner,style:null==xt?void 0:xt.contentInner,children:[e("div",{className:k.descriptionSection,style:null==xt?void 0:xt.descriptionSection,children:[t("div",{className:k.justifyBetween,style:null==xt?void 0:xt.justifyBetween}),Qt.userStory?t(L,{ref:fl,minHeight:"100%",height:"100%",type:"string",value:P(Dl)||"",handleUpdateState:(e,t)=>{const l=M(R(t));Yt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Qt.userStory?"edit":"readOnly",onEditBlocked:wt,onSaveUnsavedChanges:async()=>{await Ul(),rl(!1)},onDiscardUnsavedChanges:()=>{Yt({...structuredClone(q),value:P(q.value)||""}),Zt(e=>({...e,userStory:!1})),rl(!1)},isSavingUnsavedChanges:hl}):$t?t(Q,{styles:Mt,fields:zt,readonly:!Xt,isSaving:Gt,value:null!==(st=null!=tl?tl:Ot)&&void 0!==st?st:{},onChange:ll,onSave:async()=>{var e;tl&&(await(null===(e=null==Dt?void 0:Dt.onSave)||void 0===e?void 0:e.call(Dt,q,tl)),ll(null),el(!1))},onCancel:()=>{ll(null),el(!1)}}):e(l,{children:[t(j,{showUserStoryDiff:ce,isParent:""===se,message:P(q.value)||"",artifactId:q.artifactId,customStyles:Rt,isDisplayHighlightControl:ye,contextVariant:we,showConfidenceScore:Be,CDNeededInChip:We,blockId:Le,showWaitingIconInChip:je}),(_e||Me)&&e("div",{className:k.actionButtonsContainer,style:null==jt?void 0:jt.container,children:[Me&&!Qt.userStory&&e(l,{children:[t("button",{type:"button",className:k.actionButton,style:null==jt?void 0:jt.button,disabled:Me.disabled||Me.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=Me.onClick)||void 0===t||t.call(Me),Zt(e=>({...e,userStory:!0})),rl(!0)},children:Me.isLoading?e(l,{children:[t(p,{size:16,className:k.actionButtonSpinner,style:null==jt?void 0:jt.icon}),t("span",{style:null==jt?void 0:jt.text,children:null!==(rt=Me.label)&&void 0!==rt?rt:"Edit"})]}):e(l,{children:[t(m,{size:16,style:null==jt?void 0:jt.icon}),t("span",{style:null==jt?void 0:jt.text,children:null!==(dt=Me.label)&&void 0!==dt?dt:"Edit"})]})}),_e&&t("span",{className:k.actionButtonDivider})]}),_e&&t("button",{type:"button",className:k.actionButton,style:null==jt?void 0:jt.button,disabled:_e.disabled||_e.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=_e.onClick)||void 0===t||t.call(_e)},children:_e.isLoading?e(l,{children:[t(p,{size:16,className:k.actionButtonSpinner,style:null==jt?void 0:jt.icon}),t("span",{style:null==jt?void 0:jt.text,children:null!==(ut=_e.label)&&void 0!==ut?ut:"Approve"})]}):e(l,{children:[t(I,{size:16,style:null==jt?void 0:jt.icon}),t("span",{style:null==jt?void 0:jt.text,children:null!==(ct=_e.label)&&void 0!==ct?ct:"Approve"})]})})]})]})]}),null===(vt=qt.sub_features)||void 0===vt?void 0:vt.map((e,l)=>{console.log("UserStoryCardWrapper: sub",e);const n=oe(ge,!1,e.artifactId);return t(ae,{artifactId:w,isUserStoryCurrentlyUpdated:b,artifactTitleId:`${N}-${String.fromCharCode(65+l)}`,parentUserStory:q,parentIndex:`${se}${se&&"."}${re}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const l=[...q.sub_features||[]];l[e]=t,Y({...q,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:ue,showUserStoryDiff:ce,updateUserStoryArtifact:me,handleDownloadUserStory:ve,handleOpenSendDialog:pe,isDisplayHighlightControl:ye,elementDisplayConfig:ge,_resolvedConfig:n,actionItemsConfig:Ie,onDelete:()=>(e=>{const t=(q.sub_features||[]).filter((t,l)=>l!==e),l={...q,sub_features:t};Yt(l),Y(l)})(l),expandedSubFeatures:Ne,disableEditPlan:Pe,useMuiTooltip:Re,blockNumber:e.blockNumber,showAssignSection:$e,onAssignSectionClick:ze},e.artifactId)})]})})]})},se=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:h,showWrapper:y,actionItemsConfig:g,contextVariant:f,showDisplayName:C,allowTitleEdit:S,showConfidenceScore:I,showBorderTop:N,defaultExpanded:E,showCompletionPanel:D=!1,completionPanelConfig:B,showAddSectionButton:A=!1,disableEditPlan:T=!1,useMuiTooltip:x=!1,approveButtonConfig:U,editButtonConfig:P,CDNeededInChip:R,showWaitingIconInChip:_,setRedlineDocumentIdParent:M,showAssignSection:W,onAssignSectionClick:L,disableAssignSection:j})=>{const{userStory:$,setUserStory:z,customStyles:V,searchQueryList:G,currentHighlightIndex:F,setCurrentHighlightIndex:H,segmentComponentConfig:Q,sectionStatusConfig:Z,redlineConfig:J,setRedlineDocumentId:K}=O(),X=null==V?void 0:V.userStoryCardStyles,ee=0===F,te=F===G.length-1;return i(()=>{if(!(null==J?void 0:J.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await q({baseApiUrl:J.documentBaseApiUrl||"",comparisonId:J.documentComparisonId||""});if(t)K(t);else{const{document_id:t}=await Y({baseApiUrl:J.baseApiUrl,changelogConfigId:J.changelogConfigId,comparisonId:J.documentComparisonId,artifactId:J.artifactId,inputData:J.inputData,redlineConfigId:J.redlineConfigId,userEmail:J.userEmail,userName:J.userName},null!==(e=null==J?void 0:J.token)&&void 0!==e?e:"");t&&(K(t),null==M||M(t))}})()},[]),e("div",{className:k.userStoryCardWrapper,style:m?{...null==X?void 0:X.userStoryCardWrapper,position:"relative"}:null==X?void 0:X.userStoryCardWrapper,children:[m&&t(l,{children:G.length>0&&t("div",{className:k.wrapper,children:t("div",{className:k.highlightNavigation,children:e("div",{className:k.navigationContainer,children:[e("span",{className:k.navCounter,children:[F+1," of ",G.length]}),e("div",{className:k.navButtons,children:[t("button",{onClick:()=>{F>0&&H(e=>e-1)},className:k.navButton,disabled:ee,children:t(b,{size:20,className:k.navIcon})}),t("button",{onClick:()=>{F<G.length-1&&H(e=>e+1)},className:k.navButton,disabled:te,children:t(w,{size:20,className:k.navIcon})})]})]})})})}),$.map((e,l)=>{console.log("UserStoryCardWrapper: userstory",e);const i=oe(h,!0);return t(ae,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:e,onUserStoryChange:e=>{z(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:h,_resolvedConfig:i,showWrapper:y,defaultExpanded:E,actionItemsConfig:g,contextVariant:f,showDisplayName:C,allowTitleEdit:S,showConfidenceScore:I,showBorderTop:N,sectionStatusConfig:Z,showCompletionPanel:D,completionPanelConfig:B,showAddSectionButton:A,disableEditPlan:T,useMuiTooltip:x,approveButtonConfig:U,CDNeededInChip:R,editButtonConfig:P,showWaitingIconInChip:_,showAssignSection:W,disableAssignSection:j,onAssignSectionClick:L},e.artifactId)})]})};export{ae as StoryCard,se as UserStoryCardWrapper,ae as default,ne as replaceLearnedTagsWithInfo};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -0,0 +1,2 @@
1
+ import{SocketManager as t}from"./SocketManager.js";class e{static initialize(i){if("string"!=typeof i.applicationId||!i.applicationId.trim()||"string"!=typeof i.authToken||!i.authToken.trim()||"string"!=typeof i.baseUrl||!i.baseUrl.trim())return;const n=t.getInstance();n.getInitStatus()||(n.initialize(i),n.setListener(e.dispatch))}static dispatch(t){const i=e.handlers.get(t.type);i&&i.forEach(e=>{e(t.payload)})}static on(t,i){if("string"!=typeof t||!t.trim()||"function"!=typeof i)throw Error("invalid event or handler type");return e.handlers.has(t)||e.handlers.set(t,new Set),e.handlers.get(t).add(i),()=>e.off(t,i)}static off(t,i){if("string"!=typeof t||!t.trim()||"function"!=typeof i)throw Error("invalid event or handler type");const n=e.handlers.get(t);n&&(n.delete(i),0===n.size&&e.handlers.delete(t))}static emit(e,i){if("string"!=typeof e||!e.trim())throw Error("invalid event type");t.getInstance().publish(e,i)}static isInitialized(){return t.getInstance().getInitStatus()}static destroy(){e.handlers.clear(),t.getInstance().destroy()}}e.handlers=new Map;export{e as default};
2
+ //# sourceMappingURL=CwsEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CwsEvent.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{jsx as r,Fragment as t}from"react/jsx-runtime";import{useEffect as e}from"react";import i from"./CwsEvent.js";function a({baseUrl:a,applicationId:o,children:n,authToken:l}){return e(()=>(i.initialize({baseUrl:a,applicationId:o,authToken:l}),()=>{i.destroy()}),[l,o,a]),r(t,{children:n})}export{a as default};
2
+ //# sourceMappingURL=CwsEventProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CwsEventProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import t from"axios";import{io as i}from"socket.io-client";class s{constructor(){this.isInitialized=!1}static getInstance(){return s.instance||(s.instance=new s),s.instance}async initialize(t){this.isInitialized||(this.applicationId=t.applicationId,this.authToken=t.authToken,this.isInitialized=!0,this.socket=i(t.baseUrl,{path:"/cwsEvent/socket-cwsEvent",autoConnect:!0,reconnection:!0,transports:["websocket"],auth:{token:this.authToken}}),this.socket.on("connect",()=>{console.log("Connected:",this.socket.id),this.socket.emit("subscribe",{applicationId:this.applicationId})}),this.socket.on("message",t=>{var i;null===(i=this.listener)||void 0===i||i.call(this,t)}))}async wakeupServer(i){try{await t.get(i),console.log("Server wakeup successful")}catch(t){console.error("Server wakeup failed",t)}}setListener(t){this.listener=t}publish(t,i){this.socket.emit("publish",{applicationId:this.applicationId,type:t,payload:i})}disconnect(){this.socket.disconnect()}getInitStatus(){return this.isInitialized}destroy(){this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.listener=void 0,this.socket=void 0,this.applicationId="",this.authToken="",this.isInitialized=!1,s.instance=void 0)}}export{s as SocketManager};
2
+ //# sourceMappingURL=SocketManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocketManager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{useEffect as o}from"react";import t from"./CwsEvent.js";function r(r,e){o(()=>t.on(r,e),[r,e])}export{r as default};
2
+ //# sourceMappingURL=useCwsEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCwsEvent.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}