@viswa-test/test-citation 0.0.232 → 0.0.233

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 (70) hide show
  1. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  3. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  4. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  8. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  9. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  11. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  13. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  14. package/dist/cjs/features/RequirementAI/utils/helpers.js +1 -1
  15. package/dist/cjs/utils/tagHelper.js +2 -0
  16. package/dist/cjs/utils/tagHelper.js.map +1 -0
  17. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  18. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  19. package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  20. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
  21. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  22. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  23. package/dist/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  24. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  25. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  26. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  27. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  28. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  29. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  30. package/dist/features/RequirementAI/utils/helpers.js +1 -1
  31. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  32. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  33. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  34. package/dist/types/src/constants/deviationData.d.ts +887 -0
  35. package/dist/types/src/constants/deviationData.d.ts.map +1 -0
  36. package/dist/types/src/constants/treeData.d.ts +732 -0
  37. package/dist/types/src/constants/treeData.d.ts.map +1 -0
  38. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +867 -1647
  39. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  40. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  41. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  42. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/Editor.d.ts.map +1 -1
  43. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.d.ts.map +1 -1
  44. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +6 -2
  45. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
  46. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +6 -2
  47. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
  48. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  49. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +8 -0
  50. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +1 -0
  51. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +12 -6
  52. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  53. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +1 -2
  54. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  55. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +4 -0
  56. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  57. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  58. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +1 -0
  59. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  60. package/dist/types/src/utils/tagHelper.d.ts +5 -0
  61. package/dist/types/src/utils/tagHelper.d.ts.map +1 -0
  62. package/dist/utils/tagHelper.js +2 -0
  63. package/dist/utils/tagHelper.js.map +1 -0
  64. package/package.json +1 -1
  65. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  66. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  67. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  68. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  69. package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
  70. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),d=require("../CompareContext.js"),r=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i);exports.default=function(s){var c,v,f,p,g,x,h,I,m,_,y,b,A,S,R,w=s.section,j=s.idx,E=s.columnKey,B=s.colRef,C=s.mb,O=void 0===C?1:C,D=s.isExpanded,F=s.onToggle,T=s.navigation,k=s.parentNodeId,M=void 0===k?"":k,N=d.useCompareContext(),P=N.showOpenNodeRef,V=N.resolvedMarkdownStyles,W=N.maintainRelativeOrder,q=N.showDeviationBadges,G=void 0!==q&&q,L=N.renderSubSectionAccordion,z=N.treeData,K=N.proposedSections,H=N.existingSections,U=N.deviationNumberRegistry,X=N.deviationParentRegistry,Y=N.getBadgeRef,J=N.openSummaryPopup,Q=N.getSectionCompareStyle,Z=N.connectedSections,$=N.openMoreFunctionsPopup,nn=N.isProposingFix,en=N.proposingFixNodeId,on=N.isRedlineFlow,tn=N.isSideBySide,ln=N.activeSideBySideSection,dn=N.scrollSyncLocked,rn=N.unifiedNumbering,an=N.toggleScrollSyncLocked,sn=N.summaryPopupAnchorEl,un="".concat(tn?"1":"0","-").concat(String(null!=ln?ln:"")),cn=(null===(c=w.displayTitle)||void 0===c||c)&&r.hasValue(w.title),vn=!(!nn||!en||"left"!==E||w.id!==en&&w.nodeId!==en),fn=r.hasMeaningfulRedlineTags(w.content),pn="boolean"==typeof on?on:fn,gn=fn,xn=pn&&fn,hn=xn?r.stripRedlineTags(w.content):w.content,In=xn?w.content:void 0,mn=(null===(v=w.displayContent)||void 0===v||v||fn)&&r.hasValue(w.content),_n=!cn&&!mn,yn=w.title;cn||(yn=mn?"No Title Found":"No Matching Section Found");var bn=w.evaluationResult;if(!bn&&"right"===E)if(W){var An=null===(f=w.refIndexes)||void 0===f?void 0:f[0],Sn=K.find(function(n){return n.selfIndex===An});bn=null==Sn?void 0:Sn.evaluationResult}else bn=null===(p=K[j])||void 0===p?void 0:p.evaluationResult;var Rn=null===(g=null==z?void 0:z.input_index_map)||void 0===g?void 0:g[0],wn=null===(x=null==z?void 0:z.input_index_map)||void 0===x?void 0:x[1],jn="left"===E?wn:Rn,En=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=En(l.subsections,e);if(d)return d}}return null},Bn="left"===E?w:En(K,w.id),Cn="right"===E?w:En(H,w.id),On=u.default.useMemo(function(){if(!W)return 0;var n=1/0,e=function(i,o,t,l){var d;if(i){var a=i.nodeId||i.id;if(l&&"right"===E){var s=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});s.length>0&&(a=s[0].nodeId||s[0].id)}var u=i.nodeId||i.id||(null==o?void 0:o.nodeId)||(null==o?void 0:o.id)||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id),c=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(c).forEach(function(e){var i="".concat(a).concat(r.DEVIATION_BADGE_SEPARATOR).concat(e),o=null==U?void 0:U[i];null!=o&&o<n&&(n=o);var t="".concat(u).concat(r.DEVIATION_BADGE_SEPARATOR).concat(e),l=null==U?void 0:U[t];null!=l&&l<n&&(n=l)});for(var v=i.subsections||[],f=(null==o?void 0:o.subsections)||[],p=(null==t?void 0:t.subsections)||[],g=Math.max(v.length,f.length,p.length),x=0;x<g;x++)e(v[x],f[x],p[x],!1)}};return e(w,Bn,Cn,!0),n!==1/0?n-1:0},[w,Bn,Cn,E,U,W,K]);if(W)if("left"===E){var Dn=null===(h=w.refIndexes)||void 0===h?void 0:h[0],Fn=H.findIndex(function(n){return n.selfIndex===Dn});Cn=-1!==Fn?H[Fn]:En(H,w.id)}else{var Tn=null===(I=w.refIndexes)||void 0===I?void 0:I[0],kn=K.findIndex(function(n){return n.selfIndex===Tn});Bn=-1!==kn?K[kn]:En(K,w.id)}var Mn="left"===E?!Cn:!Bn,Nn=bn||(null==Bn?void 0:Bn.evaluationResult)||(null==Cn?void 0:Cn.evaluationResult),Pn=null!==(y=null===(_=null===(m=null==Nn?void 0:Nn.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,Vn=r.generateColorPalette(Pn).highlightBg,Wn=(null==Nn?void 0:Nn.deviations)||{},qn=w.nodeId||w.id;if(W&&"left"!==E){var Gn=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(w.selfIndex)});Gn.length>0?qn=Gn[0].nodeId||Gn[0].id:(null==Bn?void 0:Bn.id)&&(qn=Bn.nodeId||Bn.id)}var Ln=Object.keys(Wn)[0],zn=Ln?"".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(Ln):null,Kn=zn?null==X?void 0:X[zn]:null,Hn=j+1;if(W&&rn){var Un="left"===E?rn.leftNums.get(null==w?void 0:w.id):rn.rightNums.get(null==w?void 0:w.id);Mn&&void 0!==Un?Hn=Un:null!=Kn&&Kn>=0?Hn=Kn:void 0!==Un&&(Hn=Un)}else null!=Kn&&Kn>=0&&(Hn=Kn);var Xn=Object.entries(Wn).map(function(n){var e=n[0],i=n[1],o="".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:U[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});Xn.sort(function(n,e){return n.currentIndex-e.currentIndex});var Yn,Jn,Qn=Xn.map(function(e){var i,o,t,l,d,a,s=e.deviationKey,u=e.deviationMap,c=e.refId,v=e.currentIndex;W&&void 0!==On&&(v-=On);var f=u[M],p=r.isMissingStr(f);if(p)f="";else if(!f)return null;var g=j,x=j;if(W)if("left"===E){var h=null===(i=w.refIndexes)||void 0===i?void 0:i[0],I=H.findIndex(function(n){return n.selfIndex===h});if(-1!==I)x=I;else{var m=H.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId});x=-1!==m?m:j}}else{var _=null===(o=w.refIndexes)||void 0===o?void 0:o[0],y=K.findIndex(function(n){return n.selfIndex===_});if(-1!==y)g=y;else g=-1!==(C=K.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId}))?C:j}var b="".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(s).concat(r.DEVIATION_BADGE_SEPARATOR).concat(g).concat(r.DEVIATION_BADGE_SEPARATOR).concat(x),A=u[jn],S=Mn||r.isMissingStr(A),R="".concat(Hn,".").concat(v),B=j;if("right"===E&&W){var C,O=null===(t=w.refIndexes)||void 0===t?void 0:t[0],D=K.findIndex(function(n){return n.selfIndex===O});if(-1!==D)B=D;else-1!==(C=K.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId}))&&(B=C)}var F=Q?Q(B):null,T=(null==u?void 0:u.evaluation_outputs)||(null==Nn?void 0:Nn.evaluation_outputs),k=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,N=null!==(a=null===(d=null==T?void 0:T.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:Pn,P=r.generateColorPalette(N),V=F?n.__assign(n.__assign({},F),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n.__assign({},P),q=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Nn?void 0:Nn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Nn?void 0:Nn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Nn?void 0:Nn.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Nn?void 0:Nn.cognitive_decisioning)}:null,G=0,L=hn||"";if(f&&L){var z=L.split(/\n{2,}/),U=z.findIndex(function(n){return n.includes(f)});if(-1!==U){var X=Object.entries(Wn).filter(function(n){n[0];var e=n[1][M];return e&&z[U].includes(e)}).sort(function(n,e){return z[U].indexOf(n[1][M])-z[U].indexOf(e[1][M])}),nn=X.filter(function(n){n[0];var e=n[1][M];return e&&(e.includes(f)||f.includes(e))});nn.length>1&&(G=Math.max(0,nn.findIndex(function(n){return n[0]===s})))}}var en=Y(E,c);return{id:c,actionId:b,label:R,highlight:f,side:E,style:V,stackIndex:G,score:k,isConnected:null==Z?void 0:Z.has(b),showScrollLockToggle:(null==Z?void 0:Z.has(b))||tn&&ln===b||!!sn&&sn===en.current,scrollSyncLocked:dn,toggleScrollSyncLocked:an,isOrphan:S,isMissingClause:p,badgeRef:en,onClick:function(n){n.stopPropagation(),$&&$(n,Bn||{id:"orphan-left",title:"",content:""},S,Cn||{id:"orphan-right",title:"",content:""},b,V)},onSummaryClick:function(n){n.stopPropagation(),J(n,b,S,q)}}}).filter(Boolean),Zn=G||!pn&&vn?Qn:[],$n=Qn.map(function(n){return n.highlight}).filter(Boolean),ne=w.id&&E===(null==T?void 0:T.columnKey)?T:null,ee=u.default.useRef(!1);return i.useEffect(function(){D||(ee.current=!1)},[D]),e.jsxs(o.Box,n.__assign({ref:B,sx:{mb:O,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[D&&(null==ne?void 0:ne.showAbove)&&e.jsx("div",n.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ne?void 0:ne.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===E?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(t.ChevronUp,{color:(null===(b=null==ne?void 0:ne.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(ne.showAboveRef.current).color:void 0})}))})),e.jsxs(o.Accordion,n.__assign({disableGutters:!0,expanded:!_n&&D,onChange:function(){_n||(F(),P.current=w.id)},sx:{boxShadow:"none",border:_n?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:_n?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e.jsx(o.AccordionSummary,n.__assign({expandIcon:_n?null:e.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:_n?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:cn&&e.jsx(o.Tooltip,n.__assign({title:yn,placement:"top"},{children:e.jsx(o.Typography,n.__assign({component:"div",sx:{fontSize:"12px",color:_n?"#94A3B8":"#19213D",fontWeight:_n?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Yn=yn,Jn="left"===E&&(null!==(S=null===(A=null==w?void 0:w.refContentIds)||void 0===A?void 0:A.length)&&void 0!==S?S:1)>1,void 0===Jn&&(Jn=!1),Yn?r.safeStringify(Yn).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(i,o){return i.startsWith("**")&&i.endsWith("**")?e.jsx("strong",{children:i.slice(2,-2)},o):e.jsxs("div",n.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[e.jsx("span",{children:i}),Jn&&e.jsx("span",n.__assign({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),o)}):null)}))}))})),!_n&&e.jsxs(o.AccordionDetails,n.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[mn&&e.jsx(l.MemoizedMarkdown,{content:hn,overlayContent:In,sxStyles:V,highlights:$n,maintainRelativeOrder:W,highlightBg:Vn,suppressHighlightBg:gn,deviationBadges:Zn,collisionKey:un}),(w.subsections||[]).map(function(n,e){return L({section:n,keyPath:"".concat(j,"-").concat(e),depth:0,columnKey:E,parentNodeId:M,sectionOffset:On})})]}))]})),D&&(null==ne?void 0:ne.showBelow)&&e.jsx("div",n.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ne?void 0:ne.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===E?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(t.ChevronDown,{color:(null===(R=null==ne?void 0:ne.showBelowRef)||void 0===R?void 0:R.current)?window.getComputedStyle(ne.showBelowRef.current).color:void 0})}))}))]}),"".concat(E,"-sec-").concat(j))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),d=require("../CompareContext.js"),r=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i);exports.default=function(s){var c,v,f,p,g,x,h,I,m,_,y,b,S,A,R,w=s.section,j=s.idx,E=s.columnKey,B=s.colRef,C=s.mb,O=void 0===C?1:C,D=s.isExpanded,T=s.onToggle,F=s.navigation,k=s.parentNodeId,M=void 0===k?"":k,N=d.useCompareContext(),P=N.showOpenNodeRef,V=N.resolvedMarkdownStyles,W=N.maintainRelativeOrder,q=N.showDeviationBadges,G=void 0!==q&&q,L=N.renderSubSectionAccordion,z=N.treeData,K=N.proposedSections,H=N.existingSections,U=N.deviationNumberRegistry,X=N.deviationParentRegistry,Y=N.getBadgeRef,J=N.openSummaryPopup,Q=N.getSectionCompareStyle,Z=N.connectedSections,$=N.openMoreFunctionsPopup,nn=N.isProposingFix,en=N.proposingFixNodeId,on=N.isRedlineFlow,tn=N.isSideBySide,ln=N.activeSideBySideSection,dn=N.scrollSyncLocked,rn=N.unifiedNumbering,an=N.toggleScrollSyncLocked,sn=N.summaryPopupAnchorEl,un="".concat(tn?"1":"0","-").concat(String(null!=ln?ln:"")),cn=(null===(c=w.displayTitle)||void 0===c||c)&&r.hasValue(w.title),vn=!(!nn||!en||"left"!==E||w.id!==en&&w.nodeId!==en),fn=r.hasMeaningfulRedlineTags(w.content),pn="boolean"==typeof on?on:fn,gn=fn,xn=pn&&fn,hn=xn?r.stripRedlineTags(w.content):w.content,In=xn?w.content:void 0,mn=(null===(v=w.displayContent)||void 0===v||v||fn)&&r.hasValue(w.content),_n=!cn&&!mn,yn=w.title;cn||(yn=mn?"No Title Found":"No Matching Section Found");var bn=w.evaluationResult;if(!bn&&"right"===E)if(W){var Sn=null===(f=w.refIndexes)||void 0===f?void 0:f[0],An=K.find(function(n){return n.selfIndex===Sn});bn=null==An?void 0:An.evaluationResult}else bn=null===(p=K[j])||void 0===p?void 0:p.evaluationResult;var Rn=null===(g=null==z?void 0:z.input_index_map)||void 0===g?void 0:g[0],wn=null===(x=null==z?void 0:z.input_index_map)||void 0===x?void 0:x[1],jn="left"===E?wn:Rn,En=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=En(l.subsections,e);if(d)return d}}return null},Bn="left"===E?w:En(K,w.id),Cn="right"===E?w:En(H,w.id),On=u.default.useMemo(function(){if(!W)return 0;var n=1/0,e=function(n){var e=r.hasMeaningfulRedlineTags(n)?r.stripRedlineTags(n):n;return r.safeStringify(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var a=o.nodeId||o.id;if(d&&"right"===E){var s=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});s.length>0&&(a=s[0].nodeId||s[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),v=(null==c?void 0:c.deviations)||{};Object.keys(v).forEach(function(i){var d,s=null===(d=v[i])||void 0===d?void 0:d[M];if(function(n,i){if("string"!=typeof i||r.isMissingStr(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===E?t||o:l||o,s)){var c="".concat(a).concat(r.DEVIATION_BADGE_SEPARATOR).concat(i),f=null==U?void 0:U[c];null!=f&&f<n&&(n=f);var p="".concat(u).concat(r.DEVIATION_BADGE_SEPARATOR).concat(i),g=null==U?void 0:U[p];null!=g&&g<n&&(n=g)}});for(var f=o.subsections||[],p=(null==t?void 0:t.subsections)||[],g=(null==l?void 0:l.subsections)||[],x=Math.max(f.length,p.length,g.length),h=0;h<x;h++)i(f[h],p[h],g[h],!1)}};return i(w,Bn,Cn,!0),n!==1/0?n-1:0},[w,Bn,Cn,E,M,U,W,K]);if(W)if("left"===E){var Dn=null===(h=w.refIndexes)||void 0===h?void 0:h[0],Tn=H.findIndex(function(n){return n.selfIndex===Dn});Cn=-1!==Tn?H[Tn]:En(H,w.id)}else{var Fn=null===(I=w.refIndexes)||void 0===I?void 0:I[0],kn=K.findIndex(function(n){return n.selfIndex===Fn});Bn=-1!==kn?K[kn]:En(K,w.id)}var Mn="left"===E?!Cn:!Bn,Nn=bn||(null==Bn?void 0:Bn.evaluationResult)||(null==Cn?void 0:Cn.evaluationResult),Pn=null!==(y=null===(_=null===(m=null==Nn?void 0:Nn.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,Vn=r.generateColorPalette(Pn).highlightBg,Wn=(null==Nn?void 0:Nn.deviations)||{},qn=w.nodeId||w.id;if(W&&"left"!==E){var Gn=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(w.selfIndex)});Gn.length>0?qn=Gn[0].nodeId||Gn[0].id:(null==Bn?void 0:Bn.id)&&(qn=Bn.nodeId||Bn.id)}var Ln=Object.keys(Wn)[0],zn=Ln?"".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(Ln):null,Kn=zn?null==X?void 0:X[zn]:null,Hn=j+1;if(W&&rn){var Un="left"===E?rn.leftNums.get(null==w?void 0:w.id):rn.rightNums.get(null==w?void 0:w.id);Mn&&void 0!==Un?Hn=Un:null!=Kn&&Kn>=0?Hn=Kn:void 0!==Un&&(Hn=Un)}else null!=Kn&&Kn>=0&&(Hn=Kn);var Xn=Object.entries(Wn).map(function(n){var e=n[0],i=n[1],o="".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:U[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});Xn.sort(function(n,e){return n.currentIndex-e.currentIndex});var Yn,Jn,Qn=Xn.map(function(e){var i,o,t,l,d,a,s=e.deviationKey,u=e.deviationMap,c=e.refId,v=e.currentIndex;W&&void 0!==On&&(v-=On),v=Math.max(1,v);var f=u[M],p=r.isMissingStr(f);if(p)f="";else if(!f)return null;var g=j,x=j;if(W)if("left"===E){var h=null===(i=w.refIndexes)||void 0===i?void 0:i[0],I=H.findIndex(function(n){return n.selfIndex===h});if(-1!==I)x=I;else{var m=H.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId});x=-1!==m?m:j}}else{var _=null===(o=w.refIndexes)||void 0===o?void 0:o[0],y=K.findIndex(function(n){return n.selfIndex===_});if(-1!==y)g=y;else g=-1!==(C=K.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId}))?C:j}var b="".concat(qn).concat(r.DEVIATION_BADGE_SEPARATOR).concat(s).concat(r.DEVIATION_BADGE_SEPARATOR).concat(g).concat(r.DEVIATION_BADGE_SEPARATOR).concat(x),S=u[jn],A=Mn||r.isMissingStr(S),R="".concat(Hn,".").concat(v),B=j;if("right"===E&&W){var C,O=null===(t=w.refIndexes)||void 0===t?void 0:t[0],D=K.findIndex(function(n){return n.selfIndex===O});if(-1!==D)B=D;else-1!==(C=K.findIndex(function(n){return n.id===w.id||n.nodeId===w.nodeId||n.contentId===w.contentId}))&&(B=C)}var T=Q?Q(B):null,F=(null==u?void 0:u.evaluation_outputs)||(null==Nn?void 0:Nn.evaluation_outputs),k=null!==(l=null==F?void 0:F.output_value)&&void 0!==l?l:null,N=null!==(a=null===(d=null==F?void 0:F.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:Pn,P=r.generateColorPalette(N),V=T?n.__assign(n.__assign({},T),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n.__assign({},P),q=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Nn?void 0:Nn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Nn?void 0:Nn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Nn?void 0:Nn.deviation_explanation),evaluation_outputs:F,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Nn?void 0:Nn.cognitive_decisioning)}:null,G=0,L=hn||"";if(f&&L){var z=L.split(/\n{2,}/),U=z.findIndex(function(n){return n.includes(f)});if(-1!==U){var X=Object.entries(Wn).filter(function(n){n[0];var e=n[1][M];return e&&z[U].includes(e)}).sort(function(n,e){return z[U].indexOf(n[1][M])-z[U].indexOf(e[1][M])}),nn=X.filter(function(n){n[0];var e=n[1][M];return e&&(e.includes(f)||f.includes(e))});nn.length>1&&(G=Math.max(0,nn.findIndex(function(n){return n[0]===s})))}}var en=Y(E,c);return{id:c,actionId:b,label:R,highlight:f,side:E,style:V,stackIndex:G,score:k,isConnected:null==Z?void 0:Z.has(b),showScrollLockToggle:(null==Z?void 0:Z.has(b))||tn&&ln===b||!!sn&&sn===en.current,scrollSyncLocked:dn,toggleScrollSyncLocked:an,isOrphan:A,isMissingClause:p,badgeRef:en,onClick:function(n){n.stopPropagation(),$&&$(n,Bn||{id:"orphan-left",title:"",content:""},A,Cn||{id:"orphan-right",title:"",content:""},b,V)},onSummaryClick:function(n){n.stopPropagation(),J(n,b,A,q)}}}).filter(Boolean),Zn=G||!pn&&vn?Qn:[],$n=Qn.map(function(n){return n.highlight}).filter(Boolean),ne=w.id&&E===(null==F?void 0:F.columnKey)?F:null,ee=u.default.useRef(!1);return i.useEffect(function(){D||(ee.current=!1)},[D]),e.jsxs(o.Box,n.__assign({ref:B,sx:{mb:O,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[D&&(null==ne?void 0:ne.showAbove)&&e.jsx("div",n.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ne?void 0:ne.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===E?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(t.ChevronUp,{color:(null===(b=null==ne?void 0:ne.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(ne.showAboveRef.current).color:void 0})}))})),e.jsxs(o.Accordion,n.__assign({disableGutters:!0,expanded:!_n&&D,onChange:function(){_n||(T(),P.current=w.id)},sx:{boxShadow:"none",border:_n?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:_n?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e.jsx(o.AccordionSummary,n.__assign({expandIcon:_n?null:e.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:_n?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:cn&&e.jsx(o.Tooltip,n.__assign({title:yn,placement:"top"},{children:e.jsx(o.Typography,n.__assign({component:"div",sx:{fontSize:"12px",color:_n?"#94A3B8":"#19213D",fontWeight:_n?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Yn=yn,Jn="left"===E&&(null!==(A=null===(S=null==w?void 0:w.refContentIds)||void 0===S?void 0:S.length)&&void 0!==A?A:1)>1,void 0===Jn&&(Jn=!1),Yn?r.safeStringify(Yn).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(i,o){return i.startsWith("**")&&i.endsWith("**")?e.jsx("strong",{children:i.slice(2,-2)},o):e.jsxs("div",n.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[e.jsx("span",{children:i}),Jn&&e.jsx("span",n.__assign({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),o)}):null)}))}))})),!_n&&e.jsxs(o.AccordionDetails,n.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[mn&&e.jsx(l.MemoizedMarkdown,{content:hn,overlayContent:In,sxStyles:V,highlights:$n,maintainRelativeOrder:W,highlightBg:Vn,suppressHighlightBg:gn,deviationBadges:Zn,collisionKey:un}),(w.subsections||[]).map(function(n,e){return L({section:n,keyPath:"".concat(j,"-").concat(e),depth:0,columnKey:E,parentNodeId:M,sectionOffset:On})})]}))]})),D&&(null==ne?void 0:ne.showBelow)&&e.jsx("div",n.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ne?void 0:ne.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===E?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(t.ChevronDown,{color:(null===(R=null==ne?void 0:ne.showBelowRef)||void 0===R?void 0:R.current)?window.getComputedStyle(ne.showBelowRef.current).color:void 0})}))}))]}),"".concat(E,"-sec-").concat(j))};
2
2
  //# sourceMappingURL=SectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),d=require("../CompareContext.js"),a=require("../CognitiveComparehelpers.js"),r=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i).default.memo(function(s){var c,v,f,g,p,h,_,m,x,y,S=s.section,I=s.keyPath,b=s.depth,A=void 0===b?0:b,O=s.columnKey,P=void 0===O?"left":O,R=s.parentNodeId,B=void 0===R?"":R,k=s.sectionOffset,C=d.useCompareContext(),E=C.expandedSubSections,j=C.setExpandedSubSections,w=C.maintainRelativeOrder,F=C.showDeviationBadges,M=void 0!==F&&F,D=C.proposedSections,N=C.existingSections,T=C.treeData,q=C.deviationNumberRegistry,L=C.deviationParentRegistry,V=C.connectedSections,K=C.activeSideBySideSection,W=C.isSideBySide,G=C.scrollSyncLocked,z=C.toggleScrollSyncLocked,H=C.summaryPopupAnchorEl,U=C.resolvedMarkdownStyles,J=C.getSubSectionRef,Q=C.getSubSectionCompareStyle,X=C.getBadgeRef,Y=C.openMoreFunctionsPopup,Z=C.openSummaryPopup,$=C.resetSideBySide,nn=C.setConnectedSections,en=C.setConnectedLines,tn=C.cachedConnectedPositions,on=C.isProposingFix,ln=C.proposingFixNodeId,dn=C.isRedlineFlow,an=C.unifiedNumbering,rn=null!=K?K:"",sn=(null===(c=S.displayTitle)||void 0===c||c)&&a.hasValue(S.title),un=!(!on||!ln||"left"!==P||S.id!==ln&&S.nodeId!==ln),cn=a.hasMeaningfulRedlineTags(S.content),vn="boolean"==typeof dn?dn:cn,fn=cn,gn=vn&&cn,pn=gn?a.stripRedlineTags(S.content):S.content,hn=gn?S.content:void 0,_n=(null===(v=S.displayContent)||void 0===v||v||cn)&&a.hasValue(S.content),mn=!sn&&!_n,xn=sn?S.title:_n?"No Title Found":"No Matching Section Found",yn=!!E[I],Sn=J(P,I),In=I.split("-").map(Number)[0],bn=D[In],An=N[In],On=In,Pn=In,Rn=!1,Bn=function(n,e,i){if(!n||!e)return null;if(n.id===e||n.nodeId===e||n.contentId===e)return{section:n,keyPath:i};for(var t=(n.subsections||[]).map(function(n,e){return{section:n,keyPath:"".concat(i,"-").concat(e)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===e||n.section.nodeId===e||n.section.contentId===e?{value:n}:void(n.section.subsections||[]).forEach(function(e,i){t.push({section:e,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(w)if("left"===P){var kn=null===(f=null==bn?void 0:bn.refIndexes)||void 0===f?void 0:f[0],Cn=N.findIndex(function(n){return n.selfIndex===kn});-1!==Cn?(An=N[Cn],Pn=Cn):Rn=!0}else{var En=null===(g=null==An?void 0:An.refIndexes)||void 0===g?void 0:g[0],jn=D.findIndex(function(n){return n.selfIndex===En});-1!==jn?(bn=D[jn],On=jn):Rn=!0}var wn=function(n,e){if(!e||!n)return null;for(var i=0;i<n.length;i++){var t=Bn(n[i],e,String(i));if(t)return t}return null},Fn=null,Mn=null,Dn="",Nn="";if(w)"left"===P?(Fn=S,Dn=I,(Tn=Bn(An,S.nodeId||S.id,String(Pn)))||(Tn=wn(N,S.nodeId||S.id)),Mn=(null==Tn?void 0:Tn.section)||null,Nn=(null==Tn?void 0:Tn.keyPath)||""):(Mn=S,Nn=I,(qn=Bn(bn,S.nodeId||S.id,String(On)))||(qn=wn(D,S.nodeId||S.id)),Fn=(null==qn?void 0:qn.section)||null,Dn=(null==qn?void 0:qn.keyPath)||"");else if("left"===P){Fn=S,Dn=I;var Tn=wn(N,S.nodeId||S.id);Mn=(null==Tn?void 0:Tn.section)||null,Nn=(null==Tn?void 0:Tn.keyPath)||""}else{Mn=S,Nn=I;var qn=wn(D,S.nodeId||S.id);Fn=(null==qn?void 0:qn.section)||null,Dn=(null==qn?void 0:qn.keyPath)||""}var Ln=(Dn?Q(Dn):null)||Q(I),Vn=null===(p=null==T?void 0:T.input_index_map)||void 0===p?void 0:p[0],Kn=null===(h=null==T?void 0:T.input_index_map)||void 0===h?void 0:h[1],Wn="left"===P?Kn:Vn,Gn="left"===P?!Mn:!Fn,zn=S.evaluationResult||(null==Fn?void 0:Fn.evaluationResult)||(null==Mn?void 0:Mn.evaluationResult),Hn=(null==zn?void 0:zn.deviations)||{},Un=S.nodeId||S.id||(null==Fn?void 0:Fn.nodeId)||(null==Fn?void 0:Fn.id)||(null==Mn?void 0:Mn.nodeId)||(null==Mn?void 0:Mn.id);w&&"left"!==P&&(null==Fn?void 0:Fn.id)&&(Un=Fn.nodeId||Fn.id);var Jn=Object.keys(Hn)[0],Qn=Jn?"".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Jn):null,Xn=Qn?null==L?void 0:L[Qn]:null,Yn=In+1;if(w&&an){var Zn="left"===P?an.leftNums.get(null==bn?void 0:bn.id):an.rightNums.get(null==An?void 0:An.id);Rn&&void 0!==Zn?Yn=Zn:null!=Xn&&Xn>=0?Yn=Xn:void 0!==Zn&&(Yn=Zn)}else null!=Xn&&Xn>=0&&(Yn=Xn);var $n=null!==(x=null===(m=null===(_=null==zn?void 0:zn.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===m?void 0:m.label_color)&&void 0!==x?x:r.DEFAULT_DEVIAION_COLOR,ne=a.generateColorPalette($n).highlightBg,ee=Object.entries(Hn).map(function(n){var e=n[0],i=n[1],t="".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:t,currentIndex:q[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});ee.sort(function(n,e){return n.currentIndex-e.currentIndex});var ie=ee.map(function(e){var i,t,o,l=e.deviationKey,d=e.deviationMap,r=e.refId,s=e.currentIndex;w&&void 0!==k&&(s-=k);var u=d[B],c=a.isMissingStr(u);if(c)u="";else if(!u)return null;var v=d[Wn],f=Gn||a.isMissingStr(v),g="".concat(Yn,".").concat(s),p="".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(l).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Dn).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Nn),h=(null==d?void 0:d.evaluation_outputs)||(null==zn?void 0:zn.evaluation_outputs),_=null!==(i=null==h?void 0:h.output_value)&&void 0!==i?i:null,m=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:$n,x=a.generateColorPalette(m),y=n.__assign({},x),S=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==zn?void 0:zn.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==zn?void 0:zn.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==zn?void 0:zn.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==zn?void 0:zn.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==zn?void 0:zn.cognitive_decisioning)}:null,I=0,b=pn||"";if(u&&b){var A=b.split(/\n{2,}/),O=A.findIndex(function(n){return n.includes(u)});if(-1!==O){var R=Object.entries(Hn).filter(function(n){n[0];var e=n[1][B];return e&&A[O].includes(e)}).sort(function(n,e){return A[O].indexOf(n[1][B])-A[O].indexOf(e[1][B])}),C=R.filter(function(n){n[0];var e=n[1][B];return e&&(e.includes(u)||u.includes(e))});C.length>1&&(I=Math.max(0,C.findIndex(function(n){return n[0]===l})))}}var E=X(P,r);return{id:r,actionId:p,label:g,highlight:u,side:P,style:y,stackIndex:I,score:_,isConnected:V.has(p),showScrollLockToggle:V.has(p)||W&&K===p||!!H&&H===E.current,scrollSyncLocked:G,toggleScrollSyncLocked:z,isOrphan:f,isMissingClause:c,badgeRef:E,onClick:function(e){e.stopPropagation();var i=Fn?n.__assign(n.__assign({},Fn),{title:(null==bn?void 0:bn.title)||(null==Fn?void 0:Fn.title)||""}):{id:"orphan-left",title:"",content:""},t=Mn?n.__assign(n.__assign({},Mn),{title:(null==An?void 0:An.title)||(null==Mn?void 0:Mn.title)||""}):{id:"orphan-right",title:"",content:""};Y(e,i,f,t,p,y)},onSummaryClick:function(n){n.stopPropagation(),Z(n,p,f,S)}}}).filter(Boolean).sort(function(n,e){return parseFloat(n.label)-parseFloat(e.label)}),te=i.useMemo(function(){var n=new Set;return ie.filter(function(e){return!n.has(e.id)&&(n.add(e.id),!0)})},[ie]),oe=M||!vn&&un?te:[],le=te.map(function(n){return n.highlight}).filter(Boolean),de=ie.find(function(n){return V.has(n.actionId)}),ae=!!de;if(!(sn||_n||S.subsections&&0!==S.subsections.length))return null;var re=(null===(y=null==de?void 0:de.style)||void 0===y?void 0:y.badgeBorder)||(null==Ln?void 0:Ln.badgeBorder),se=ae&&re?{borderRadius:"4px",outline:"2px solid ".concat(re),outlineOffset:"1px"}:{};return sn?e.jsx(t.Box,n.__assign({ref:Sn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:e.jsx(t.Box,n.__assign({sx:n.__assign({width:"100%"},se)},{children:e.jsxs(t.Accordion,n.__assign({disableGutters:!0,expanded:!mn&&yn,onChange:function(){if(!mn){if(yn){var e=String(K||""),i=e.includes(Dn)||e.includes(Nn);i||V.forEach(function(n){(String(n).includes(Dn)||String(n).includes(Nn))&&(i=!0)}),i&&($(),nn(new Set),en([]),tn.current=[])}j(function(e){var i;return n.__assign(n.__assign({},e),((i={})[I]=!e[I],i))})}},sx:{mt:0,boxShadow:"none",border:mn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[e.jsx(t.AccordionSummary,n.__assign({expandIcon:mn?null:e.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:e.jsx(t.Typography,n.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:mn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:xn||"Untitled Subsection"}))})),!mn&&e.jsxs(t.AccordionDetails,n.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[_n&&e.jsx(l.MemoizedMarkdown,{content:pn,overlayContent:hn,sxStyles:U,deviationBadges:oe,maintainRelativeOrder:w,highlightBg:ne,suppressHighlightBg:fn,highlights:le,collisionKey:rn}),(S.subsections||[]).map(function(n,i){return e.jsx(u,{section:n,keyPath:"".concat(I,"-").concat(i),depth:A+1,columnKey:P,parentNodeId:B},"".concat(I,"-").concat(i))})]}))]}))}))})):e.jsx(t.Box,n.__assign({ref:Sn,sx:{mt:0===A?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!mn&&e.jsxs(t.Box,n.__assign({sx:n.__assign({width:"100%"},se)},{children:[_n&&e.jsx(l.MemoizedMarkdown,{content:pn,overlayContent:hn,sxStyles:U,deviationBadges:oe,maintainRelativeOrder:w,highlightBg:ne,suppressHighlightBg:fn,highlights:le,collisionKey:rn}),(S.subsections||[]).map(function(n,i){return e.jsx(u,{section:n,keyPath:"".concat(I,"-").concat(i),depth:A+1,columnKey:P,parentNodeId:B,sectionOffset:k},"".concat(I,"-").concat(i))})]}))}))});exports.default=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),d=require("../CompareContext.js"),a=require("../CognitiveComparehelpers.js"),r=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i).default.memo(function(s){var c,v,f,g,p,h,_,m,x,y,S=s.section,I=s.keyPath,b=s.depth,A=void 0===b?0:b,O=s.columnKey,P=void 0===O?"left":O,R=s.parentNodeId,B=void 0===R?"":R,k=s.sectionOffset,C=d.useCompareContext(),E=C.expandedSubSections,j=C.setExpandedSubSections,w=C.maintainRelativeOrder,M=C.showDeviationBadges,F=void 0!==M&&M,D=C.proposedSections,N=C.existingSections,T=C.treeData,q=C.deviationNumberRegistry,L=C.deviationParentRegistry,V=C.connectedSections,K=C.activeSideBySideSection,W=C.isSideBySide,G=C.scrollSyncLocked,z=C.toggleScrollSyncLocked,H=C.summaryPopupAnchorEl,U=C.resolvedMarkdownStyles,J=C.getSubSectionRef,Q=C.getSubSectionCompareStyle,X=C.getBadgeRef,Y=C.openMoreFunctionsPopup,Z=C.openSummaryPopup,$=C.resetSideBySide,nn=C.setConnectedSections,en=C.setConnectedLines,tn=C.cachedConnectedPositions,on=C.isProposingFix,ln=C.proposingFixNodeId,dn=C.isRedlineFlow,an=C.unifiedNumbering,rn=null!=K?K:"",sn=(null===(c=S.displayTitle)||void 0===c||c)&&a.hasValue(S.title),un=!(!on||!ln||"left"!==P||S.id!==ln&&S.nodeId!==ln),cn=a.hasMeaningfulRedlineTags(S.content),vn="boolean"==typeof dn?dn:cn,fn=cn,gn=vn&&cn,pn=gn?a.stripRedlineTags(S.content):S.content,hn=gn?S.content:void 0,_n=(null===(v=S.displayContent)||void 0===v||v||cn)&&a.hasValue(S.content),mn=!sn&&!_n,xn=sn?S.title:_n?"No Title Found":"No Matching Section Found",yn=!!E[I],Sn=J(P,I),In=I.split("-").map(Number)[0],bn=D[In],An=N[In],On=In,Pn=In,Rn=!1,Bn=function(n,e,i){if(!n||!e)return null;if(n.id===e||n.nodeId===e||n.contentId===e)return{section:n,keyPath:i};for(var t=(n.subsections||[]).map(function(n,e){return{section:n,keyPath:"".concat(i,"-").concat(e)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===e||n.section.nodeId===e||n.section.contentId===e?{value:n}:void(n.section.subsections||[]).forEach(function(e,i){t.push({section:e,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(w)if("left"===P){var kn=null===(f=null==bn?void 0:bn.refIndexes)||void 0===f?void 0:f[0],Cn=N.findIndex(function(n){return n.selfIndex===kn});-1!==Cn?(An=N[Cn],Pn=Cn):Rn=!0}else{var En=null===(g=null==An?void 0:An.refIndexes)||void 0===g?void 0:g[0],jn=D.findIndex(function(n){return n.selfIndex===En});-1!==jn?(bn=D[jn],On=jn):Rn=!0}var wn=function(n,e){if(!e||!n)return null;for(var i=0;i<n.length;i++){var t=Bn(n[i],e,String(i));if(t)return t}return null},Mn=null,Fn=null,Dn="",Nn="";if(w)"left"===P?(Mn=S,Dn=I,(Tn=Bn(An,S.nodeId||S.id,String(Pn)))||(Tn=wn(N,S.nodeId||S.id)),Fn=(null==Tn?void 0:Tn.section)||null,Nn=(null==Tn?void 0:Tn.keyPath)||""):(Fn=S,Nn=I,(qn=Bn(bn,S.nodeId||S.id,String(On)))||(qn=wn(D,S.nodeId||S.id)),Mn=(null==qn?void 0:qn.section)||null,Dn=(null==qn?void 0:qn.keyPath)||"");else if("left"===P){Mn=S,Dn=I;var Tn=wn(N,S.nodeId||S.id);Fn=(null==Tn?void 0:Tn.section)||null,Nn=(null==Tn?void 0:Tn.keyPath)||""}else{Fn=S,Nn=I;var qn=wn(D,S.nodeId||S.id);Mn=(null==qn?void 0:qn.section)||null,Dn=(null==qn?void 0:qn.keyPath)||""}var Ln=(Dn?Q(Dn):null)||Q(I),Vn=null===(p=null==T?void 0:T.input_index_map)||void 0===p?void 0:p[0],Kn=null===(h=null==T?void 0:T.input_index_map)||void 0===h?void 0:h[1],Wn="left"===P?Kn:Vn,Gn="left"===P?!Fn:!Mn,zn=S.evaluationResult||(null==Mn?void 0:Mn.evaluationResult)||(null==Fn?void 0:Fn.evaluationResult),Hn=(null==zn?void 0:zn.deviations)||{},Un=S.nodeId||S.id||(null==Mn?void 0:Mn.nodeId)||(null==Mn?void 0:Mn.id)||(null==Fn?void 0:Fn.nodeId)||(null==Fn?void 0:Fn.id);w&&"left"!==P&&(null==Mn?void 0:Mn.id)&&(Un=Mn.nodeId||Mn.id);var Jn=Object.keys(Hn)[0],Qn=Jn?"".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Jn):null,Xn=Qn?null==L?void 0:L[Qn]:null,Yn=In+1;if(w&&an){var Zn="left"===P?an.leftNums.get(null==bn?void 0:bn.id):an.rightNums.get(null==An?void 0:An.id);Rn&&void 0!==Zn?Yn=Zn:null!=Xn&&Xn>=0?Yn=Xn:void 0!==Zn&&(Yn=Zn)}else null!=Xn&&Xn>=0&&(Yn=Xn);var $n=null!==(x=null===(m=null===(_=null==zn?void 0:zn.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===m?void 0:m.label_color)&&void 0!==x?x:r.DEFAULT_DEVIAION_COLOR,ne=a.generateColorPalette($n).highlightBg,ee=Object.entries(Hn).map(function(n){var e=n[0],i=n[1],t="".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:t,currentIndex:q[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});ee.sort(function(n,e){return n.currentIndex-e.currentIndex});var ie=ee.map(function(e){var i,t,o,l=e.deviationKey,d=e.deviationMap,r=e.refId,s=e.currentIndex;w&&void 0!==k&&(s-=k),s=Math.max(1,s);var u=d[B],c=a.isMissingStr(u);if(c)u="";else if(!u)return null;var v=d[Wn],f=Gn||a.isMissingStr(v),g="".concat(Yn,".").concat(s),p="".concat(Un).concat(a.DEVIATION_BADGE_SEPARATOR).concat(l).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Dn).concat(a.DEVIATION_BADGE_SEPARATOR).concat(Nn),h=(null==d?void 0:d.evaluation_outputs)||(null==zn?void 0:zn.evaluation_outputs),_=null!==(i=null==h?void 0:h.output_value)&&void 0!==i?i:null,m=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:$n,x=a.generateColorPalette(m),y=n.__assign({},x),S=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==zn?void 0:zn.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==zn?void 0:zn.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==zn?void 0:zn.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==zn?void 0:zn.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==zn?void 0:zn.cognitive_decisioning)}:null,I=0,b=pn||"";if(u&&b){var A=b.split(/\n{2,}/),O=A.findIndex(function(n){return n.includes(u)});if(-1!==O){var R=Object.entries(Hn).filter(function(n){n[0];var e=n[1][B];return e&&A[O].includes(e)}).sort(function(n,e){return A[O].indexOf(n[1][B])-A[O].indexOf(e[1][B])}),C=R.filter(function(n){n[0];var e=n[1][B];return e&&(e.includes(u)||u.includes(e))});C.length>1&&(I=Math.max(0,C.findIndex(function(n){return n[0]===l})))}}var E=X(P,r);return{id:r,actionId:p,label:g,highlight:u,side:P,style:y,stackIndex:I,score:_,isConnected:V.has(p),showScrollLockToggle:V.has(p)||W&&K===p||!!H&&H===E.current,scrollSyncLocked:G,toggleScrollSyncLocked:z,isOrphan:f,isMissingClause:c,badgeRef:E,onClick:function(e){e.stopPropagation();var i=Mn?n.__assign(n.__assign({},Mn),{title:(null==bn?void 0:bn.title)||(null==Mn?void 0:Mn.title)||""}):{id:"orphan-left",title:"",content:""},t=Fn?n.__assign(n.__assign({},Fn),{title:(null==An?void 0:An.title)||(null==Fn?void 0:Fn.title)||""}):{id:"orphan-right",title:"",content:""};Y(e,i,f,t,p,y)},onSummaryClick:function(n){n.stopPropagation(),Z(n,p,f,S)}}}).filter(Boolean).sort(function(n,e){return parseFloat(n.label)-parseFloat(e.label)}),te=i.useMemo(function(){var n=new Set;return ie.filter(function(e){return!n.has(e.id)&&(n.add(e.id),!0)})},[ie]),oe=F||!vn&&un?te:[],le=te.map(function(n){return n.highlight}).filter(Boolean),de=ie.find(function(n){return V.has(n.actionId)}),ae=!!de;if(!(sn||_n||S.subsections&&0!==S.subsections.length))return null;var re=(null===(y=null==de?void 0:de.style)||void 0===y?void 0:y.badgeBorder)||(null==Ln?void 0:Ln.badgeBorder),se=ae&&re?{borderRadius:"4px",outline:"2px solid ".concat(re),outlineOffset:"1px"}:{};return sn?e.jsx(t.Box,n.__assign({ref:Sn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:e.jsx(t.Box,n.__assign({sx:n.__assign({width:"100%"},se)},{children:e.jsxs(t.Accordion,n.__assign({disableGutters:!0,expanded:!mn&&yn,onChange:function(){if(!mn){if(yn){var e=String(K||""),i=e.includes(Dn)||e.includes(Nn);i||V.forEach(function(n){(String(n).includes(Dn)||String(n).includes(Nn))&&(i=!0)}),i&&($(),nn(new Set),en([]),tn.current=[])}j(function(e){var i;return n.__assign(n.__assign({},e),((i={})[I]=!e[I],i))})}},sx:{mt:0,boxShadow:"none",border:mn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[e.jsx(t.AccordionSummary,n.__assign({expandIcon:mn?null:e.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:e.jsx(t.Typography,n.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:mn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:xn||"Untitled Subsection"}))})),!mn&&e.jsxs(t.AccordionDetails,n.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[_n&&e.jsx(l.MemoizedMarkdown,{content:pn,overlayContent:hn,sxStyles:U,deviationBadges:oe,maintainRelativeOrder:w,highlightBg:ne,suppressHighlightBg:fn,highlights:le,collisionKey:rn}),(S.subsections||[]).map(function(n,i){return e.jsx(u,{section:n,keyPath:"".concat(I,"-").concat(i),depth:A+1,columnKey:P,parentNodeId:B,sectionOffset:k},"".concat(I,"-").concat(i))})]}))]}))}))})):e.jsx(t.Box,n.__assign({ref:Sn,sx:{mt:0===A?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!mn&&e.jsxs(t.Box,n.__assign({sx:n.__assign({width:"100%"},se)},{children:[_n&&e.jsx(l.MemoizedMarkdown,{content:pn,overlayContent:hn,sxStyles:U,deviationBadges:oe,maintainRelativeOrder:w,highlightBg:ne,suppressHighlightBg:fn,highlights:le,collisionKey:rn}),(S.subsections||[]).map(function(n,i){return e.jsx(u,{section:n,keyPath:"".concat(I,"-").concat(i),depth:A+1,columnKey:P,parentNodeId:B,sectionOffset:k},"".concat(I,"-").concat(i))})]}))}))});exports.default=u;
2
2
  //# sourceMappingURL=SubSectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("@lexical/react/LexicalComposer"),r=require("@lexical/react/LexicalHistoryPlugin"),l=require("@lexical/react/LexicalOnChangePlugin"),n=require("@lexical/react/LexicalTabIndentationPlugin"),o=require("@lexical/list"),a=require("@lexical/react/LexicalListPlugin"),u=require("@lexical/react/LexicalLinkPlugin"),s=require("@lexical/link"),d=require("@lexical/rich-text"),c=require("@lexical/react/LexicalTablePlugin"),g=require("@lexical/table"),p=require("lexical");require("./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js");var x=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("./components/EditorContainer/EditorContainer.js"),m=require("./components/EditorToolbar/EditorToolbar.js"),h=require("./plugins/LayoutPlugin.js"),C=require("./theme/theme.js");require("./theme/theme.css.js"),require("./Editor.css.js");var N=require("./components/Context/ContextMenu.js"),q=require("@lexical/mark"),v=require("./plugins/CommentPlugin/HTMLNode.js"),j=require("./constants/editorConfig.js"),b=require("./plugins/InitialHtml.js"),y=require("./plugins/InsertNode.js"),T=require("./plugins/DeleteNode.js"),L=require("./plugins/HighlightNode.js"),P=require("@lexical/react/LexicalComposerContext"),S=require("./plugins/UpdateNode.js"),E=require("./plugins/ManualNode.js"),I=require("./plugins/PreservedNode.js"),_=require("./plugins/InvisibleNode.js");function k(e){console.log(e)}function R({onEditBlocked:e}){const[i]=P.useLexicalComposerContext();return t.useEffect(()=>{const t=e=>{let t=e;for(;t;){if(["preserved","insert","delete"].includes(t.getType()))return t;t=t.getParent()}return!1};function r(e){let t=e.getParent();for(;t;){if(t instanceof S.UpdateNode||t instanceof E.ManualNode)return t.__id;t=t.getParent()}return null}return i.registerCommand(p.KEY_DOWN_COMMAND,i=>{var l;if("Backspace"!==i.key&&"Delete"!==i.key)return!1;const n=p.$getSelection();if(!p.$isRangeSelection(n))return!1;const o=n.getNodes().find(e=>!!t(e));if(o)return i.preventDefault(),null==e||e(r(o)||""),!0;if(n.isCollapsed()){const o=n.anchor.getNode(),a=n.focus.getNode(),u=t(o),s=t(a);if(u||s){const t=u?r(u):s?r(s):"";return null==e||e(t||""),i.preventDefault(),!0}if("Backspace"===i.key){const a=o.getPreviousSibling(),u=null===(l=null==a?void 0:a.getLastDescendant)||void 0===l?void 0:l.call(a),s=a&&["delete","insert","preserved"].includes(a.getType())?a:u&&t(u)?u:null;if(0===n.anchor.offset&&s)return null==e||e(r(s)||""),i.preventDefault(),!0}else if("Delete"===i.key){const l=o.getNextSibling(),a=null==l?void 0:l.getFirstDescendant(),u=l&&["delete","insert","preserved"].includes(l.getType())?l:a&&t(a)?a:null,s=o.getTextContent().length;if(n.anchor.offset===s&&u)return null==e||e(r(u)||""),i.preventDefault(),!0}}return!1},p.COMMAND_PRIORITY_CRITICAL)},[i]),null}exports.default=function({minHeight:P,height:B,placeholder:D,onFocus:M,onBlur:H,onChange:O,onToolbarButtonClick:A,toolbarConfig:w=j.DEFAULT_TOOLBAR_CONFIG,editorRef:$,editorState:F,initialString:U,customToolbar:W,plugins:Y,nodes:V,dynamicHeight:G,artifactContext:K,commentsPanelState:Q,mode:X,doNotShowBorderInViewMode:z,onEditBlocked:J}){var Z,ee,te;const ie=t.useRef(null),re={namespace:"MyEditor",theme:C.default,onError:k,nodes:[p.TextNode,o.ListNode,o.ListItemNode,s.LinkNode,d.QuoteNode,d.HeadingNode,g.TableNode,g.TableRowNode,g.TableCellNode,q.MarkNode,v.default,y.InsertNode,T.DeleteNode,S.UpdateNode,I.PreservedNode,E.ManualNode,_.InvisibleNode,L.HighlightSpanNode,L.HighlightButtonNode],editorState:F},[le,ne]=t.useState(null),[oe,ae]=t.useState(!1),{customStyles:ue}=x.useRequirementAI(),se=e=>{var t;null===(t=$.current)||void 0===t||t.update(()=>{const t=p.$getSelection();p.$isRangeSelection(t)&&t.getNodes().forEach(t=>{p.$isTextNode(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e.jsxs(e.Fragment,{children:[(null===(Z=null==ue?void 0:ue.textEditorStyles)||void 0===Z?void 0:Z.themeStyles)&&e.jsx("style",{children:null===(ee=null==ue?void 0:ue.textEditorStyles)||void 0===ee?void 0:ee.themeStyles}),e.jsxs("div",{ref:ie,className:"w-full lexical_editor_wrapper "+(z&&"readOnly"===X?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=$.current)||void 0===t||t.update(()=>{const t=p.$getSelection();p.$isRangeSelection(t)&&!t.isCollapsed()?(ae(!0),ne({x:e.clientX,y:e.clientY})):(ae(!1),ne(null))})},style:{minHeight:P,height:B,...null===(te=null==ue?void 0:ue.textEditorStyles)||void 0===te?void 0:te.textArea},children:[e.jsxs(i.LexicalComposer,{initialConfig:re,children:[" ","edit"===X&&e.jsx(R,{onEditBlocked:J}),"edit"===X&&e.jsx(m.default,{onToolbarButtonClick:A,editorWrapperRef:ie,toolbarConfig:w,customToolbar:W,editorRef:$}),e.jsx(f.default,{placeholder:D}),e.jsx(n.TabIndentationPlugin,{}),e.jsx(r.HistoryPlugin,{}),e.jsx(a.ListPlugin,{}),e.jsx(u.LinkPlugin,{}),e.jsx(c.TablePlugin,{}),e.jsx(h.LayoutPlugin,{onFocus:M,onBlur:H,editorRef:$}),e.jsx(l.OnChangePlugin,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,i)=>{O&&O(e,t,i)}}),U&&e.jsx(b.InitialHtml,{initialValue:U.value,initialFormat:U.type,mode:X}),Y&&Y]}),le&&oe&&"edit"===X&&e.jsx(N.default,{position:le,options:[{label:"Change Color to Red",action:()=>se("red")},{label:"Change Color to Blue",action:()=>se("blue")}],onClose:()=>{ne(null)}})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("@lexical/react/LexicalComposer"),l=require("@lexical/react/LexicalHistoryPlugin"),n=require("@lexical/react/LexicalOnChangePlugin"),r=require("@lexical/react/LexicalTabIndentationPlugin"),o=require("@lexical/list"),a=require("@lexical/react/LexicalListPlugin"),u=require("@lexical/react/LexicalLinkPlugin"),s=require("@lexical/link"),d=require("@lexical/rich-text"),c=require("@lexical/react/LexicalTablePlugin"),g=require("@lexical/table"),p=require("lexical");require("./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js");var x=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("./components/EditorContainer/EditorContainer.js"),m=require("./components/EditorToolbar/EditorToolbar.js"),h=require("./plugins/LayoutPlugin.js"),C=require("./theme/theme.js");require("./theme/theme.css.js"),require("./Editor.css.js");var N=require("./components/Context/ContextMenu.js"),q=require("@lexical/mark"),j=require("./plugins/CommentPlugin/HTMLNode.js"),v=require("./constants/editorConfig.js"),T=require("./plugins/InitialHtml.js"),S=require("./plugins/InsertNode.js"),y=require("./plugins/DeleteNode.js"),b=require("./plugins/HighlightNode.js"),P=require("@lexical/react/LexicalComposerContext"),L=require("./plugins/UpdateNode.js"),I=require("./plugins/ManualNode.js"),E=require("./plugins/PreservedNode.js"),R=require("./plugins/InvisibleNode.js");function _(e){console.log(e)}function B({onEditBlocked:e}){const[i]=P.useLexicalComposerContext();return t.useEffect(()=>{const t=e=>{let t=e;for(;t;){if(["preserved","insert","delete"].includes(t.getType()))return t;if(["update","manual"].includes(t.getType())&&t.getStatus()&&"pending"===t.getStatus())return t;t=t.getParent()}return!1};function l(e){var t;let i=e.getParent();for(;i;){if(i instanceof L.UpdateNode||i instanceof I.ManualNode)return null===(t=i.getId())||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">");i=i.getParent()}return null}return i.registerCommand(p.KEY_DOWN_COMMAND,i=>{const n=p.$getSelection();if(!p.$isRangeSelection(n))return!1;const r=n.getNodes().find(e=>!!t(e));if(r)return i.preventDefault(),null==e||e(l(r)||""),!0;if(n.isCollapsed()){const r=n.anchor.getNode(),o=t(r);if(o){const t=o?l(o):"";return null==e||e(t||""),i.preventDefault(),!0}if("Backspace"===i.key){const t=r.getPreviousSibling(),o=t&&(["delete","insert","preserved"].includes(t.getType())||["update","manual"].includes(t.getType())&&t.getStatus()&&"pending"===t.getStatus())?t:null;if(0===n.anchor.offset&&o)return null==e||e(l(o)||""),i.preventDefault(),!0}else if("Delete"===i.key){const t=r.getNextSibling(),o=t&&(["delete","insert","preserved"].includes(t.getType())||["update","manual"].includes(t.getType())&&t.getStatus()&&"pending"===t.getStatus())?t:null,a=r.getTextContent().length;if(n.anchor.offset===a&&o)return null==e||e(l(o)||""),i.preventDefault(),!0}}return!1},p.COMMAND_PRIORITY_CRITICAL)},[i]),null}exports.default=function({minHeight:P,height:M,placeholder:k,onFocus:H,onBlur:D,onChange:A,onToolbarButtonClick:O,toolbarConfig:w=v.DEFAULT_TOOLBAR_CONFIG,editorRef:$,editorState:F,initialString:U,customToolbar:W,plugins:Y,nodes:V,dynamicHeight:G,artifactContext:K,commentsPanelState:Q,mode:X,doNotShowBorderInViewMode:z,onEditBlocked:J}){var Z,ee,te;const ie=t.useRef(null),le={namespace:"MyEditor",theme:C.default,onError:_,nodes:[p.TextNode,o.ListNode,o.ListItemNode,s.LinkNode,d.QuoteNode,d.HeadingNode,g.TableNode,g.TableRowNode,g.TableCellNode,q.MarkNode,j.default,S.InsertNode,y.DeleteNode,L.UpdateNode,E.PreservedNode,I.ManualNode,R.InvisibleNode,b.HighlightSpanNode,b.HighlightButtonNode],editorState:F},[ne,re]=t.useState(null),[oe,ae]=t.useState(!1),{customStyles:ue}=x.useRequirementAI(),se=e=>{var t;null===(t=$.current)||void 0===t||t.update(()=>{const t=p.$getSelection();p.$isRangeSelection(t)&&t.getNodes().forEach(t=>{p.$isTextNode(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e.jsxs(e.Fragment,{children:[(null===(Z=null==ue?void 0:ue.textEditorStyles)||void 0===Z?void 0:Z.themeStyles)&&e.jsx("style",{children:null===(ee=null==ue?void 0:ue.textEditorStyles)||void 0===ee?void 0:ee.themeStyles}),e.jsxs("div",{ref:ie,className:"w-full lexical_editor_wrapper "+(z&&"readOnly"===X?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=$.current)||void 0===t||t.update(()=>{const t=p.$getSelection();p.$isRangeSelection(t)&&!t.isCollapsed()?(ae(!0),re({x:e.clientX,y:e.clientY})):(ae(!1),re(null))})},style:{minHeight:P,height:M,...null===(te=null==ue?void 0:ue.textEditorStyles)||void 0===te?void 0:te.textArea},children:[e.jsxs(i.LexicalComposer,{initialConfig:le,children:[" ","edit"===X&&e.jsx(B,{onEditBlocked:J}),"edit"===X&&e.jsx(m.default,{onToolbarButtonClick:O,editorWrapperRef:ie,toolbarConfig:w,customToolbar:W,editorRef:$}),e.jsx(f.default,{placeholder:k}),e.jsx(r.TabIndentationPlugin,{}),e.jsx(l.HistoryPlugin,{}),e.jsx(a.ListPlugin,{}),e.jsx(u.LinkPlugin,{}),e.jsx(c.TablePlugin,{}),e.jsx(h.LayoutPlugin,{onFocus:H,onBlur:D,editorRef:$}),e.jsx(n.OnChangePlugin,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,i)=>{A&&A(e,t,i)}}),U&&e.jsx(T.InitialHtml,{initialValue:U.value,initialFormat:U.type,mode:X}),Y&&Y]}),ne&&oe&&"edit"===X&&e.jsx(N.default,{position:ne,options:[{label:"Change Color to Red",action:()=>se("red")},{label:"Change Color to Blue",action:()=>se("blue")}],onClose:()=>{re(null)}})]})]})};
2
2
  //# sourceMappingURL=Editor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/html"),o=require("lexical");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(require("showdown"));exports.InitialHtml=({initialValue:a,initialFormat:l,mode:n})=>{const[s]=t.useLexicalComposerContext();return e.useEffect(()=>{if(a){if(l&&"html"!==l){var e=new i.default.Converter;a=e.makeHtml(a)}s.update(()=>{const e=o.$getRoot();e.clear();const t=(new DOMParser).parseFromString(a||"","text/html");r.$generateNodesFromDOM(s,t).forEach(t=>{try{o.$isParagraphNode(t)&&t.setFormat("justify"),e.append(t)}catch(e){console.error("Error appending node to root: ",e)}})})}},[a,s]),e.useEffect(()=>{s.setEditable("edit"===n)},[s,n]),null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/html"),a=require("lexical"),o=require("showdown"),i=require("../../../../../../utils/tagHelper.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(o);exports.InitialHtml=({initialValue:o,initialFormat:l,mode:n})=>{const[u]=r.useLexicalComposerContext();return e.useEffect(()=>{if(o){if(o=(()=>{let e=i.escapeTagIds(o,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(r=>{e=i.splitTagAcrossParagraphs(e,r)}),e})(),l&&"html"!==l){var e=new s.default.Converter;o=e.makeHtml(o)}u.update(()=>{const e=a.$getRoot();e.clear();const r=(new DOMParser).parseFromString(o||"","text/html");t.$generateNodesFromDOM(u,r).forEach(r=>{try{a.$isParagraphNode(r)&&r.setFormat("justify"),e.append(r)}catch(e){console.error("Error appending node to root: ",e)}})})}},[o,u]),e.useEffect(()=>{u.setEditable("edit"===n)},[u,n]),null};
2
2
  //# sourceMappingURL=InitialHtml.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lexical");class t extends e.ElementNode{static getType(){return"manual"}static clone(e){return new t(e.__id,e.__key)}constructor(e=crypto.randomUUID(),t){super(t),this.__id=e}createDOM(){const e=document.createElement("manual");return e.id=this.__id,e.className="PlaygroundEditorTheme__manual-node",e}exportDOM(){const e=document.createElement("manual");return e.id=this.__id,{element:e}}updateDOM(e,t){return e.__id!==this.__id&&(t.id=this.__id),!1}static importDOM(){return{manual:()=>({conversion:r,priority:1})}}static importJSON(e){const r=new t(e.id);return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id}}isInline(){return!0}getId(){return this.__id}}function r(e){const r=e.id||crypto.randomUUID();return{node:new t(r)}}exports.ManualNode=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("lexical");class e extends t.ElementNode{static getType(){return"manual"}static clone(t){return new e(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),e="",s){super(s),this.__id=t,this.__status=e}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__manual-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,{element:t}}updateDOM(t,e){return t.__id!==this.__id&&(e.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?e.dataset.status=this.__status:delete e.dataset.status,e.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:s,priority:1})}}static importJSON(t){var s;return new e(t.id,null!==(s=t.status)&&void 0!==s?s:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}isInline(){return!0}}function s(t){var s;return{node:new e(t.id||crypto.randomUUID(),null!==(s=t.dataset.status)&&void 0!==s?s:"")}}exports.ManualNode=e;
2
2
  //# sourceMappingURL=ManualNode.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lexical");class t extends e.ElementNode{static getType(){return"update"}static clone(e){return new t(e.__id,e.__key)}constructor(e=crypto.randomUUID(),t){super(t),this.__id=e}createDOM(){const e=document.createElement("upt");return e.id=this.__id,e.className="PlaygroundEditorTheme__update-node",e}exportDOM(){const e=document.createElement("upt");return e.id=this.__id,{element:e}}updateDOM(e,t){return e.__id!==this.__id&&(t.id=this.__id),!1}static importDOM(){return{upt:()=>({conversion:r,priority:1})}}static importJSON(e){const r=new t(e.id);return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id}}isInline(){return!0}getId(){return this.__id}}function r(e){const r=e.id||crypto.randomUUID();return{node:new t(r)}}exports.UpdateNode=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("lexical");class e extends t.ElementNode{static getType(){return"update"}static clone(t){return new e(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),e="",s){super(s),this.__id=t,this.__status=e}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__update-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,{element:t}}updateDOM(t,e){return t.__id!==this.__id&&(e.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?e.dataset.status=this.__status:delete e.dataset.status,e.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:s,priority:1})}}static importJSON(t){var s;return new e(t.id,null!==(s=t.status)&&void 0!==s?s:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}isInline(){return!0}}function s(t){var s;return{node:new e(t.id||crypto.randomUUID(),null!==(s=t.dataset.status)&&void 0!==s?s:"")}}exports.UpdateNode=e;
2
2
  //# sourceMappingURL=UpdateNode.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__delete-node{text-decoration:var(--delete-node-text-decoration,line-through);text-decoration-color:var(--delete-node-decoration-color,#dc2626);text-decoration-thickness:var(--delete-node-decoration-thickness,2px)}.PlaygroundEditorTheme__insert-node{background-color:var(--insert-node-bg,#dbeafe);border-radius:var(--insert-node-border-radius,2px);color:var(--insert-node-color,#1e3a8a);padding:var(--insert-node-padding,1px 2px);text-decoration:var(--insert-node-text-decoration,none)}.PlaygroundEditorTheme__highlight-button{display:none}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}(),exports.default=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__highlight-button{display:none}.PlaygroundEditorTheme__insert-node{background-color:#8cbeff;text-decoration:none}.PlaygroundEditorTheme__delete-node{text-decoration:line-through;text-decoration-color:#dc2626}[class^=PlaygroundEditorTheme__update-node]>.PlaygroundEditorTheme__insert-node{background-color:#f3e8ff}.PlaygroundEditorTheme__manual-node-accepted,[class^=PlaygroundEditorTheme__manual-node]>.PlaygroundEditorTheme__insert-node{background-color:#8cbeff}.PlaygroundEditorTheme__manual-node-rejected{text-decoration:underline;text-decoration-color:red}.PlaygroundEditorTheme__update-node-accepted{background-color:#f3e8ff;-webkit-box-decoration-break:clone;box-decoration-break:clone;display:inline}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}(),exports.default=e;
2
2
  //# sourceMappingURL=theme.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./Editor/constants/editorConfig.js"),n=require("./Editor/Editor.js"),o=require("../../store/ref.context.js"),a=require("@lexical/html"),l=require("turndown"),i=require("turndown-plugin-gfm"),u=require("../UnsavedChangesPopup/UnsavedChangesPopup.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=new(c(l).default)({headingStyle:"atx",codeBlockStyle:"fenced"});s.keep(["ins","del","mark"]),s.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),s.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),s.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),s.use(i.tables);const d=e=>(e||"").replace(/\r\n/g,"\n").trim(),h=t.forwardRef(({type:l,value:i,handleUpdateState:c,onBlur:h,placeholder:p,minHeight:f,height:g,mode:E,doNotShowBorderInViewMode:m,onEditBlocked:v,onSaveUnsavedChanges:S,onDiscardUnsavedChanges:A,isSavingUnsavedChanges:y=!1},$)=>{const b=t.useRef(null),[w,x]=t.useState({type:l,value:i}),[q,C]=t.useState(0),[N,R]=t.useState(!1),B=t.useRef(i),T=t.useRef(i),L=t.useRef(Boolean(i)),{contentRef:_,setContentRef:j}=o.useRefStore();t.useEffect(()=>{x(e=>({...e,value:i})),B.current=i,T.current=i,L.current=Boolean(i),R(!1)},[i]),t.useImperativeHandle($,()=>({requestClose:()=>!("edit"===E&&d(B.current)!==d(T.current))||(R(!0),!1)}),[E]);return t.useEffect(()=>{const e=()=>{_&&_.current&&C(_.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[_]),e.jsxs("div",{style:{position:"relative",width:"100%",height:g,minHeight:f},children:[N&&e.jsx(u.UnsavedChangesPopup,{isSaving:y,onSave:async()=>{await(null==S?void 0:S()),B.current=T.current,R(!1)},onDiscard:()=>{T.current=B.current,null==A||A(),R(!1)}}),e.jsx(n.default,{minHeight:f,height:g,placeholder:p||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=a.$generateHtmlFromNodes(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),u=e.tagName.toLowerCase();return i?`<${u} ${i}>${l}</${u}>`:`<${u}>${l}</${u}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const l=[];r.querySelectorAll("invisible").forEach((e,t)=>{l.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const i=[];r.querySelectorAll("upt, manual").forEach((e,t)=>{i.push(o(e,s)),e.replaceWith(r.createTextNode(`%%REVIEW_${t}%%`))});const u=[];r.querySelectorAll("table").forEach((e,t)=>{u.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let d=s.turndown(r.body.innerHTML);l.forEach((e,t)=>{d=d.replace(`%%INVISIBLE\\_${t}%%`,` ${e} `)}),i.forEach((e,t)=>{d=d.replace(`%%REVIEW\\_${t}%%`,` ${e} `)}),u.forEach((e,t)=>{d=d.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),d=d.replace(/\*{4}([^*]+)\*{4}/g,"**$1**"),L.current&&(B.current=d,L.current=!1),T.current=d,((e,t)=>{c(e,t)})("prompt",d)})},toolbarConfig:r.DEFAULT_TOOLBAR_CONFIG,editorRef:b,mode:E,initialString:{type:w.type,value:w.value},dynamicHeight:q,onBlur:h,doNotShowBorderInViewMode:m||!1,onEditBlocked:v})]})});h.displayName="RichTextEditor",exports.default=h;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./Editor/constants/editorConfig.js"),n=require("./Editor/Editor.js"),o=require("../../store/ref.context.js"),a=require("@lexical/html"),l=require("turndown"),i=require("turndown-plugin-gfm"),u=require("../UnsavedChangesPopup/UnsavedChangesPopup.js"),s=require("../../../../utils/tagHelper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=new(c(l).default)({headingStyle:"atx",codeBlockStyle:"fenced"});d.keep(["ins","del","mark"]),d.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),d.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),d.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),d.use(i.tables);const h=e=>(e||"").replace(/\r\n/g,"\n").trim(),p=t.forwardRef(({type:l,value:i,handleUpdateState:c,onBlur:p,placeholder:f,minHeight:g,height:E,mode:m,doNotShowBorderInViewMode:v,onEditBlocked:S,onSaveUnsavedChanges:A,onDiscardUnsavedChanges:y,isSavingUnsavedChanges:$=!1},b)=>{const w=t.useRef(null),[x,q]=t.useState({type:l,value:i}),[C,N]=t.useState(0),[R,T]=t.useState(!1),B=t.useRef(i),j=t.useRef(i),I=t.useRef(Boolean(i)),{contentRef:L,setContentRef:_}=o.useRefStore();t.useEffect(()=>{q(e=>({...e,value:i})),B.current=i,j.current=i,I.current=Boolean(i),T(!1)},[i]),t.useImperativeHandle(b,()=>({requestClose:()=>!("edit"===m&&h(B.current)!==h(j.current))||(T(!0),!1)}),[m]);return t.useEffect(()=>{const e=()=>{L&&L.current&&N(L.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[L]),e.jsxs("div",{style:{position:"relative",width:"100%",height:E,minHeight:g},children:[R&&e.jsx(u.UnsavedChangesPopup,{isSaving:$,onSave:async()=>{await(null==A?void 0:A()),B.current=j.current,T(!1)},onDiscard:()=>{j.current=B.current,null==y||y(),T(!1)}}),e.jsx(n.default,{minHeight:g,height:E,placeholder:f||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=a.$generateHtmlFromNodes(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),u=e.tagName.toLowerCase();return i?`<${u} ${i}>${l}</${u}>`:`<${u}>${l}</${u}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const l=[];r.querySelectorAll("invisible").forEach((e,t)=>{l.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const i=[];r.querySelectorAll("upt, manual").forEach((e,t)=>{i.push(o(e,d)),e.replaceWith(r.createTextNode(`%%REVIEW_${t}%%`))});const u=[];r.querySelectorAll("table").forEach((e,t)=>{u.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let h=d.turndown(r.body.innerHTML);i.forEach((e,t)=>{h=h.replace(`%%REVIEW\\_${t}%%`,` ${e} `)}),l.forEach((e,t)=>{h=h.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),u.forEach((e,t)=>{h=h.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),h=h.replace(/\*{4}([^*]+)\*{4}/g,"**$1**");["upt","manual","del","ins","preserved"].forEach(e=>{h=s.mergeTagAcrossParagraphs(h,e)}),h=s.unescapeTagIds(h,["manual","upt"]),I.current&&(B.current=h,I.current=!1),j.current=h,((e,t)=>{c(e,t)})("prompt",h)})},toolbarConfig:r.DEFAULT_TOOLBAR_CONFIG,editorRef:w,mode:m,initialString:{type:x.type,value:x.value},dynamicHeight:C,onBlur:p,doNotShowBorderInViewMode:v||!1,onEditBlocked:S})]})});p.displayName="RichTextEditor",exports.default=p;
2
2
  //# sourceMappingURL=RichTextEditor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("react"),o=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var t=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),s=require("@mui/material"),r=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),a=require("../../../../../service/redlineService.js"),d=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");const c=[{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"}],p=({toneIndex:i,configs:n=c})=>{const o=Math.min(i,n.length-1),{color:t,angle:l,arcD:s}=n[o]||n[1]||n[0],r=(l-90)*Math.PI/180,a=11+9*Math.cos(r),d=13+9*Math.sin(r);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:s,stroke:t,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:a,y2:d,stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:n={}})=>{const o={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"},...n},t=o[i]||o.Medium;return e.jsx("div",{style:t,children:i})},x=["Lenient","Balanced","Aggressive"],g={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},v={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},m={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},h={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},y={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},f={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},j={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},b={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},C={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},k={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"},w={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},B={borderTop:"0.5px solid #eee",padding:"14px 0px"},A={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},T={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},R={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},D={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},E={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},z={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},W={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},L={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},M={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};function _({onAssignClick:i,disableAssignButton:n=!1,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l}){const s="20px";return e.jsxs("div",{style:{...M,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:n?"not-allowed":"pointer",opacity:n?.5:1,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:n?void 0:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),o&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>o(e),children:[t&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]})]})}function q({onAssignClick:i,disableAssignButton:o=!1,onOpenCognitive:t,cognitiveIconSmall:l,cognitiveTootipTitle:s}){const[r,a]=n.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>a(!r),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),r&&e.jsx(_,{onAssignClick:i?()=>{a(!1),i&&i()}:void 0,disableAssignButton:o,onOpenCognitive:t?e=>{a(!1),t&&t(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:s})]})}function F({users:i,onClick:n}){const o=i.length;return e.jsxs("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:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),o>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}exports.AssignMenu=_,exports.DisplayUsers=F,exports.KebabMenu=q,exports.default=function({onClose:M,aiReason:_,onActionTrigger:H,onIterate:N,initialTone:P,onRegenerate:O,labels:U={},toneLevelsConfig:$=x,toneColorsConfig:G=g,dialConfigs:K=c,actions:V,disableAllActions:X=!1,customStyles:J={},severityChipStyles:Q={},customIcons:Y={},onOpenCognitive:Z,showTone:ee=!0,cognitiveSectionStyle:ie={},cognitiveScoreBadgeStyle:ne={},cognitiveScoreTextStyle:oe={},cognitiveStyles:te={},cognitiveClassNames:le={},cognitiveTitle:se="Cognitive Integrity",cognitiveTootipTitle:re="Cognitive Decisioning",cognitiveLeftIcon:ae,cognitiveIconSmall:de,showCognitiveRightArrow:ce=!0,isStreaming:pe,onAssignClick:ue,disableAssignButton:xe=!1,assignedUsers:ge,onReviewUsersClick:ve,redlineId:me,aiReasonId:he}){var ye,fe,je,Se,be,Ce,Ie,ke,we,Be,Ae,Te,Re,De,Ee,ze,We,Le,Me;let _e=$.findIndex(e=>e===P);-1===_e&&(_e=1);const[qe,Fe]=n.useState(!0),[He,Ne]=n.useState(!1),[Pe,Oe]=n.useState(!1),[Ue,$e]=n.useState(_e),[Ge]=n.useState(_e),Ke=$[Ue],Ve=G[Ke]||"#BA7517",Xe=Ue!==Ge,Je=[{id:"iterate",icon:Y.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:U.btnIterate||"Iterate",color:"#64748B",onClick:N},{id:"accept",icon:Y.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:U.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Y.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:U.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:Qe,redlineConfig:Ye,updateRedlineDataParent:Ze}=r.useRequirementAI(),ei=V||Je;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...v,...null===(ye=null==J?void 0:J.DeviationSummaryStyles)||void 0===ye?void 0:ye.root},children:[e.jsxs("div",{style:{...m,...null===(fe=null==J?void 0:J.DeviationSummaryStyles)||void 0===fe?void 0:fe.header,marginBottom:Pe?"16px":"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Y.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...h,...null===(je=null==J?void 0:J.DeviationSummaryStyles)||void 0===je?void 0:je.title},children:U.summaryHeader||"Summary"})]}),ge&&ge.length>0&&e.jsx(F,{users:ge,onClick:e=>{e.stopPropagation(),null==ve||ve()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ue||Z)&&e.jsx(q,{onAssignClick:ue,disableAssignButton:xe,onOpenCognitive:Z,cognitiveIconSmall:de,cognitiveTootipTitle:re}),e.jsx("button",{onClick:M,style:{...w,...null===(Se=null==J?void 0:J.DeviationSummaryStyles)||void 0===Se?void 0:Se.closeBtn,color:"#64748B"},children:"✕"})]})]}),e.jsx(s.Tooltip,{title:null===(be=null==_?void 0:_.redlining_details)||void 0===be?void 0:be.redline_title,children:e.jsx("p",{style:{...y,...null===(Ce=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ce?void 0:Ce.bodyText},children:null===(Ie=null==_?void 0:_.redlining_details)||void 0===Ie?void 0:Ie.redline_title})}),e.jsx("p",{style:{...f,...null===(ke=null==J?void 0:J.DeviationSummaryStyles)||void 0===ke?void 0:ke.summary},children:null===(we=null==_?void 0:_.redlining_details)||void 0===we?void 0:we.redline_summary}),e.jsxs("div",{style:{...j,...null===(Be=null==J?void 0:J.DeviationSummaryStyles)||void 0===Be?void 0:Be.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>Fe(!qe),style:{...b,...null===(Ae=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.impactToggle},children:[e.jsx("span",{style:{...C,...null===(Te=null==J?void 0:J.DeviationSummaryStyles)||void 0===Te?void 0:Te.impactToggleLabel},children:U.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:qe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==_?void 0:_.severity)||"Medium",customStyles:Q})]}),qe&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...S,...null===(Re=null==J?void 0:J.DeviationSummaryStyles)||void 0===Re?void 0:Re.impactText},children:e.jsx(d.AiReasonMarkdownWrapper,{message:`${null!==(Ee=null===(De=null==_?void 0:_.redlining_details)||void 0===De?void 0:De.redline_impact)&&void 0!==Ee?Ee:U.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ze=null==J?void 0:J.DeviationSummaryStyles)||void 0===ze?void 0:ze.impactMarkdown})})})]}),e.jsx("div",{style:{...I,...null===(We=null==J?void 0:J.DeviationSummaryStyles)||void 0===We?void 0:We.actionContainer},children:ei.map(i=>{var n,o;const t=X||i.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==J?void 0:J.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...k,...null===(o=null==J?void 0:J.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:i.color,...i.style,...l},onClick:t?void 0:()=>{var e;i.useLabel?(async e=>{var i,n,o;null==H||H({status:"loading",action:e,metadata:{redlineId:me,aiReasonId:he}});try{const{updated_reqai:t}=await a.resolveRedline({documentId:Qe,userEmail:null==Ye?void 0:Ye.userEmail,userName:null==Ye?void 0:Ye.userName,redlineId:null!==(i=null==_?void 0:_.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==Ye?void 0:Ye.baseApiUrl,redlineConfigId:null!==(n=null==Ye?void 0:Ye.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==Ye?void 0:Ye.token)&&void 0!==o?o:"");await(null==Ze?void 0:Ze(t)),null==H||H({status:"success",action:e,metadata:{redlineId:me,aiReasonId:he}})}catch(e){null==H||H({status:"failed",action:null,metadata:{redlineId:me,aiReasonId:he}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:t,children:[i.icon,i.label]},i.id)})}),ee&&e.jsxs("div",{style:{...B,...null===(Le=null==J?void 0:J.DeviationSummaryStyles)||void 0===Le?void 0:Le.toneContainer},children:[e.jsxs("button",{onClick:()=>Ne(!He),style:{...A,...null===(Me=null==J?void 0:J.DeviationSummaryStyles)||void 0===Me?void 0:Me.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p,{toneIndex:Ue,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:U.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:He?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),He&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:U.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(o.ToneToggle,{isDirty:Xe,onToneChange:e=>{$e(e)},toneColor:Ve,toneIndex:Ue,onClickRegenerate:()=>null==O?void 0:O(Ke),toneLabels:$,isStreaming:pe,aiReason:_})]})]}),Z&&e.jsxs("div",{className:null==le?void 0:le.section,onClick:e=>{e.stopPropagation(),Z&&Z(e)},style:{...T,...null==te?void 0:te.section,...ie},children:[e.jsxs("div",{className:null==le?void 0:le.headerLeft,style:{...R,...null==te?void 0:te.headerLeft},children:[e.jsx("span",{className:null==le?void 0:le.titleIcon,style:{...D,...null==te?void 0:te.titleIcon},children:null!=ae?ae:e.jsx(t.ReactComponent,{})}),e.jsx("div",{className:null==le?void 0:le.cognitiveTitle,style:{...E,...null==te?void 0:te.cognitiveTitle},children:se})]}),e.jsxs("div",{className:null==le?void 0:le.headerRight,style:{...z,...null==te?void 0:te.headerRight},children:[void 0!==(null==_?void 0:_.relevance_score)&&null!==(null==_?void 0:_.relevance_score)?e.jsxs("span",{className:null==le?void 0:le.scoreBadge,style:{...W,...null==te?void 0:te.scoreBadge,...ne},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==le?void 0:le.scoreText,style:{...L,...null==te?void 0:te.scoreText,...oe},children:[Math.round(Number(_.relevance_score)),"%"]})]}):null,ce&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("react"),o=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var t=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),s=require("@mui/material"),r=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),a=require("../../../../../service/redlineService.js"),d=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");const c=[{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"}],p=({toneIndex:i,configs:n=c})=>{const o=Math.min(i,n.length-1),{color:t,angle:l,arcD:s}=n[o]||n[1]||n[0],r=(l-90)*Math.PI/180,a=11+9*Math.cos(r),d=13+9*Math.sin(r);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:s,stroke:t,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:a,y2:d,stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})},x=({type:i,customStyles:n={}})=>{const o={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"},...n},t=o[i]||o.Medium;return e.jsx("div",{style:t,children:i})},u=["Lenient","Balanced","Aggressive"],g={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},v={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},m={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},y={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},h={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},f={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},j={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},b={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},k={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"},w={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},B={borderTop:"0.5px solid #eee",padding:"14px 0px"},T={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},A={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},R={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},D={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},E={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},z={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},W={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},L={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},M={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};function H({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:t,historyIconSmall:l,onHistoryClick:s,historyTootipTitle:r}){const a="20px";return e.jsxs("div",{style:{...M,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e.jsxs("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&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:o}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),s&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>s(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r})]})]})}function _({onAssignClick:i,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:a}){const[d,c]=n.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!d),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),d&&e.jsx(H,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:o?e=>{c(!1),o&&o(e)}:void 0,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:a})]})}function q({users:i,onClick:n}){const o=i.length;return e.jsxs("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:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),o>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}exports.AssignMenu=H,exports.DisplayUsers=q,exports.KebabMenu=_,exports.default=function({onClose:M,aiReason:H,onActionTrigger:F,onIterate:N,initialTone:O,onRegenerate:P,labels:U={},toneLevelsConfig:$=u,toneColorsConfig:G=g,dialConfigs:K=c,actions:V,disableAllActions:X=!1,customStyles:J={},severityChipStyles:Q={},customIcons:Y={},onOpenCognitive:Z,onHistoryClick:ee,historyIconSmall:ie,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:te={},cognitiveScoreBadgeStyle:le={},cognitiveScoreTextStyle:se={},cognitiveStyles:re={},cognitiveClassNames:ae={},cognitiveTitle:de="Cognitive Integrity",cognitiveTootipTitle:ce="Cognitive Decisioning",cognitiveLeftIcon:pe,cognitiveIconSmall:xe,showCognitiveRightArrow:ue=!0,isStreaming:ge,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:he,aiReasonId:fe}){var je,Se,Ce,be,Ie,ke,we,Be,Te,Ae,Re,De,Ee,ze,We,Le,Me,He,_e;let qe=$.findIndex(e=>e===O);-1===qe&&(qe=1);const[Fe,Ne]=n.useState(!0),[Oe,Pe]=n.useState(!1),[Ue,$e]=n.useState(!1),[Ge,Ke]=n.useState(qe),[Ve]=n.useState(qe),Xe=$[Ge],Je=G[Xe]||"#BA7517",Qe=Ge!==Ve,Ye=[{id:"iterate",icon:Y.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:U.btnIterate||"Iterate",color:"#64748B",onClick:N},{id:"accept",icon:Y.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:U.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Y.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:U.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:Ze,redlineConfig:ei,updateRedlineDataParent:ii}=r.useRequirementAI(),ni=V||Ye;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...v,...null===(je=null==J?void 0:J.DeviationSummaryStyles)||void 0===je?void 0:je.root},children:[e.jsxs("div",{style:{...m,...null===(Se=null==J?void 0:J.DeviationSummaryStyles)||void 0===Se?void 0:Se.header,marginBottom:Ue?"16px":"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Y.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...y,...null===(Ce=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ce?void 0:Ce.title},children:U.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||Z)&&e.jsx(_,{onAssignClick:ve,onOpenCognitive:Z,cognitiveIconSmall:xe,cognitiveTootipTitle:ce,historyIconSmall:ie,onHistoryClick:ee,historyTootipTitle:ne}),e.jsx("button",{onClick:M,style:{...w,...null===(be=null==J?void 0:J.DeviationSummaryStyles)||void 0===be?void 0:be.closeBtn,color:"#64748B"},children:"✕"})]})]}),e.jsx(s.Tooltip,{title:null===(Ie=null==H?void 0:H.redlining_details)||void 0===Ie?void 0:Ie.redline_title,children:e.jsx("p",{style:{...h,...null===(ke=null==J?void 0:J.DeviationSummaryStyles)||void 0===ke?void 0:ke.bodyText},children:null===(we=null==H?void 0:H.redlining_details)||void 0===we?void 0:we.redline_title})}),e.jsx("p",{style:{...f,...null===(Be=null==J?void 0:J.DeviationSummaryStyles)||void 0===Be?void 0:Be.summary},children:null===(Te=null==H?void 0:H.redlining_details)||void 0===Te?void 0:Te.redline_summary}),e.jsxs("div",{style:{...j,...null===(Ae=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>Ne(!Fe),style:{...C,...null===(Re=null==J?void 0:J.DeviationSummaryStyles)||void 0===Re?void 0:Re.impactToggle},children:[e.jsx("span",{style:{...b,...null===(De=null==J?void 0:J.DeviationSummaryStyles)||void 0===De?void 0:De.impactToggleLabel},children:U.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Fe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(x,{type:(null==H?void 0:H.severity)||"Medium",customStyles:Q})]}),Fe&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...S,...null===(Ee=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ee?void 0:Ee.impactText},children:e.jsx(d.AiReasonMarkdownWrapper,{message:`${null!==(We=null===(ze=null==H?void 0:H.redlining_details)||void 0===ze?void 0:ze.redline_impact)&&void 0!==We?We:U.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Le=null==J?void 0:J.DeviationSummaryStyles)||void 0===Le?void 0:Le.impactMarkdown})})})]}),e.jsx("div",{style:{...I,...null===(Me=null==J?void 0:J.DeviationSummaryStyles)||void 0===Me?void 0:Me.actionContainer},children:ni.map(i=>{var n,o;const t=X||i.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==J?void 0:J.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...k,...null===(o=null==J?void 0:J.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:i.color,...i.style,...l},onClick:t?void 0:()=>{var e;i.useLabel?(async e=>{var i,n,o;null==F||F({status:"loading",action:e,metadata:{redlineId:he,aiReasonId:fe}});try{const{updated_reqai:t}=await a.resolveRedline({documentId:Ze,userEmail:null==ei?void 0:ei.userEmail,userName:null==ei?void 0:ei.userName,redlineId:null!==(i=null==H?void 0:H.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ei?void 0:ei.baseApiUrl,redlineConfigId:null!==(n=null==ei?void 0:ei.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==ei?void 0:ei.token)&&void 0!==o?o:"");await(null==ii?void 0:ii(t)),null==F||F({status:"success",action:e,metadata:{redlineId:he,aiReasonId:fe}})}catch(e){null==F||F({status:"failed",action:null,metadata:{redlineId:he,aiReasonId:fe}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:t,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...B,...null===(He=null==J?void 0:J.DeviationSummaryStyles)||void 0===He?void 0:He.toneContainer},children:[e.jsxs("button",{onClick:()=>Pe(!Oe),style:{...T,...null===(_e=null==J?void 0:J.DeviationSummaryStyles)||void 0===_e?void 0:_e.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p,{toneIndex:Ge,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:U.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Oe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),Oe&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:U.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(o.ToneToggle,{isDirty:Qe,onToneChange:e=>{Ke(e)},toneColor:Je,toneIndex:Ge,onClickRegenerate:()=>null==P?void 0:P(Xe),toneLabels:$,isStreaming:ge,aiReason:H})]})]}),Z&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),Z&&Z(e)},style:{...A,...null==re?void 0:re.section,...te},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...R,...null==re?void 0:re.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...D,...null==re?void 0:re.titleIcon},children:null!=pe?pe:e.jsx(t.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...E,...null==re?void 0:re.cognitiveTitle},children:de})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...z,...null==re?void 0:re.headerRight},children:[void 0!==(null==H?void 0:H.relevance_score)&&null!==(null==H?void 0:H.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...W,...null==re?void 0:re.scoreBadge,...le},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...L,...null==re?void 0:re.scoreText,...se},children:[Math.round(Number(H.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})};
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../story-screen/BigEnoughPanel.js"),m=require("./TitleEditor/TitleEditor.js"),h=require("../../../../service/redlineService.js"),y=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),x=require("../../icons/CDIcon.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=g(n);const I={[p.SectionStatus.WAITING]:"WAITING TO GENERATE",[p.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[p.SectionStatus.GENERATED]:"GENERATED",[p.SectionStatus.FAILED]:"FAILED",[p.SectionStatus.GENERATE]:"GENERATE",[p.SectionStatus.APPROVED]:"APPROVED"};function j(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function w(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 b=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},N=({isUserStoryCurrentlyUpdated:n,artifactId:g,artifactTitleId:D,parentUserStory:E,currentUserStory:B,onUserStoryChange:T,parentIndex:k,currentIndex:A,enableDownload:U,isDiffEditReviewMode:P,showUserStoryDiff:R,handleDownloadUserStory:M,handleOpenSendDialog:F,updateUserStoryArtifact:_,selectedArtifactId:q,isDisplayHighlightControl:L,elementDisplayConfig:V,_resolvedConfig:W,showWrapper:z=!1,defaultExpanded:O,actionItemsConfig:$,onDelete:G,contextVariant:H,expandedSubFeatures:Q,showDisplayName:X=!0,allowTitleEdit:Z=!0,showConfidenceScore:J=!0,showBorderTop:K=!0,sectionStatusConfig:Y,showCompletionPanel:ee=!1,showAddSectionButton:te=!1,disableEditPlan:le=!1,useMuiTooltip:ne=!1,approveButtonConfig:oe,CDNeededInChip:ie,onAssignSectionClick:se})=>{var ae,re,de,ue,ce,ve,pe,fe,me,he,ye,Se,xe,ge,Ce,Ie,je,we;const{isLoadingSectionData:be=!1,onLoadSectionData:Ne,status:De,onStatusClick:Ee,completedCount:Be,totalCount:Te,isNoDataAvailable:ke=!1}=null!=Y?Y:{},{searchQueryList:Ae,citations:Ue,customStyles:Pe,onEditBlocked:Re,redlineDcoumentId:Me,redlineConfig:Fe,customSectionConfig:_e,updateRedlineDataParent:qe}=p.useRequirementAI(),Le=null==Pe?void 0:Pe.userStoryCardStyles,Ve=null==Le?void 0:Le.customSectionEditButton,We=null==Le?void 0:Le.statusStyles,ze=null===(ae=null==Pe?void 0:Pe.userStoryCardStyles)||void 0===ae?void 0:ae.userStoryEditStyles,Oe=null===(re=null==Pe?void 0:Pe.userStoryScreenStyles)||void 0===re?void 0:re.userStoryContentStyles,$e=null==Le?void 0:Le.progressHeaderStyles,Ge=null==Le?void 0:Le.clinicalTrialSectionStyles,He=null==Le?void 0:Le.CompletionStyles,Qe=null==Le?void 0:Le.noDataStyles,Xe=null==Le?void 0:Le.approveButtonStyles,Ze=null!==(ue=null===(de=null==_e?void 0:_e.shouldRender)||void 0===de?void 0:de.call(_e,B))&&void 0!==ue&&ue,Je=null===(ce=null==_e?void 0:_e.getValue)||void 0===ce?void 0:ce.call(_e,B),Ke=null!==(pe=null===(ve=null==_e?void 0:_e.getFields)||void 0===ve?void 0:ve.call(_e,B))&&void 0!==pe?pe:[],Ye=null!==(fe=null==_e?void 0:_e.isEditDisabled)&&void 0!==fe&&fe,et=null!==(he=null===(me=null==_e?void 0:_e.isSaving)||void 0===me?void 0:me.call(_e,B))&&void 0!==he&&he,tt=(lt=null!==(ye=B.completion_percentage)&&void 0!==ye?ye:0,nt=He,lt>=80?null==nt?void 0:nt.highCompletion:lt>=50?null==nt?void 0:nt.mediumCompletion:null==nt?void 0:nt.lowCompletion);var lt,nt;const ot={[p.SectionStatus.WAITING]:null==We?void 0:We.waiting,[p.SectionStatus.IN_PROGRESS]:null==We?void 0:We.inProgress,[p.SectionStatus.GENERATED]:null==We?void 0:We.generated,[p.SectionStatus.FAILED]:null==We?void 0:We.failed,[p.SectionStatus.GENERATE]:null==We?void 0:We.generate,[p.SectionStatus.APPROVED]:null==We?void 0:We.approved},[it,st]=t.useState({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),[at,rt]=t.useState({userStory:!!B.isDefaultEdit}),[dt,ut]=t.useState(!1),[ct,vt]=t.useState(!1),[pt,ft]=t.useState(null),[mt,ht]=t.useState(null),{userStory:yt,customIcons:St}=p.useRequirementAI(),[xt,gt]=t.useState(null!=O?O:""===k||q===B.artifactId||!!B.isDefaultOpen),[Ct,It]=t.useState(!1),[jt,wt]=t.useState(null),[bt,Nt]=t.useState(null),[Dt,Et]=t.useState(!1),Bt=t.useRef(null),Tt=t.useRef(null),[kt,At]=t.useState(!1),[Ut,Pt]=t.useState(!1),Rt=t.useRef(null),[Mt,Ft]=t.useState(B.value);t.useEffect(()=>{n&&gt(n)},[n]),t.useEffect(()=>{st({...structuredClone(B),value:r.formatMarkdown(B.value)||""})},[B]),t.useEffect(()=>{Ae.length>0?gt(!0):void 0===O&&(q?gt(q===B.artifactId):Q&&Q.length>0&&gt(Q.includes(B.artifactId)))},[Ae,q,B.artifactId,Q]);const _t=()=>{wt(null)},qt=()=>{Nt(null)},Lt=()=>{xt&&at.userStory&&Tt.current&&!Tt.current.requestClose()||gt(e=>!e)},Vt=async()=>{var e;try{"userStory"==="userStory"&&(T(it),console.log("I am changing RTE editor values",it)),await _(Ue,yt,g,null===(e=Rt.current)||void 0===e?void 0:e.signal)}finally{}};const Wt=null!=(null==B?void 0:B.big_enough)&&!Number.isNaN(B.big_enough)&&!!(null==B?void 0:B.big_enough_decision_factors),zt=null!==(Se=null==B?void 0:B.completion_percentage)&&void 0!==Se?Se:0,Ot=!!(null==B?void 0:B.completion_decision_factors),$t=""===k,Gt=null!=W?W:w(V,$t),Ht=!P&&!R;t.useEffect(()=>{if(!mt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${mt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[mt]),t.useEffect(()=>{B.isDefaultEdit&&rt(e=>({...e,userStory:!0}))},[B.isDefaultEdit]);return t.useEffect(()=>Ft(B.value),[B.value]),e.jsxs("div",{className:a.default.card,style:null==Le?void 0:Le.cardStyle,id:`story-card-${B.title}`,"data-expanded":xt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==Le?void 0:Le.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==Le?void 0:Le.titleRow,onClick:Lt,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==Le?void 0:Le.titleLeft,onMouseEnter:()=>At(!0),onMouseLeave:()=>At(!1),children:[X&&e.jsx(b,{displayName:D}),dt&&Ht?e.jsx(m.InlineTitleEditor,{title:B.title,onSave:e=>(async(e,t)=>{var l;try{let n={...B};B.artifactId===t?n.title=e:n.sub_features=(null===(l=B.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],st(n),T(n),ut(!1)}catch(e){console.error("Failed to save title",e)}})(e,B.artifactId),onCancel:()=>{ut(!1)},inputStyle:null==ze?void 0:ze.inlineTitleInput,confirmButtonStyle:null==ze?void 0:ze.inlineTitleConfirm,cancelButtonStyle:null==ze?void 0:ze.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:j(B.title),arrow:!0,children:e.jsx("h2",{title:ne?void 0:B.title,className:a.default.storyTitle,style:null==Le?void 0:Le.storyTitle,children:j(B.title)},B.artifactId)}),ee&&!Ze&&(Ot?e.jsx(S.CompletionPanel,{customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Le?void 0:Le.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Le?void 0:Le.CompletionStyles,onToggleStateChange:Pt,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==He?void 0:He.badge,...tt},children:[e.jsxs("span",{children:[zt,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(x.default,{color:"currentColor"})}),Ut?e.jsx(l.ChevronUp,{size:14,style:null==He?void 0:He.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==He?void 0:He.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==He?void 0:He.badge,...tt},children:e.jsxs("span",{children:[zt,"% Completed"]})})),Z&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==ze?void 0:ze.titleEditButton,onClick:e=>{e.stopPropagation(),ut(!0),xt||gt(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("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"})})})]})]}),(De||void 0!==Be&&void 0!==Te)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==Be&&void 0!==Te&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",Be,"/",Te]}),De&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Ee||Ee()},className:a.default.statusButton,style:ot[De],children:I[De]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==Le?void 0:Le.titleActions,onClick:e=>e.stopPropagation(),children:[(Gt.showProgressPercentage||Gt.showGapBox)&&z&&e.jsxs("div",{className:a.default.progressHeader,style:null==$e?void 0:$e.wrapper,children:[Gt.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==$e?void 0:$e.percentage,children:[null!==(ge=null!==(xe=null==B?void 0:B.confidenceScore)&&void 0!==xe?xe:null==Gt?void 0:Gt.confidenceValue)&&void 0!==ge?ge:"0","%"]}),Gt.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==$e?void 0:$e.gapBox,children:[null!==(Ie=null!==(Ce=null==B?void 0:B.gapValue)&&void 0!==Ce?Ce:null==Gt?void 0:Gt.gapBoxValue)&&void 0!==Ie?Ie:"2"," ","Gaps"]})]}),Wt&&e.jsx(f.BigEnoughPanel,{customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Le?void 0:Le.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Le?void 0:Le.BigEnoughStyles}),e.jsx(o.Tooltip,{title:"Assign Section",arrow:!0,placement:"top",slotProps:{tooltip:{sx:{bgcolor:"#1E293B",color:"#FFFFFF",fontSize:"14px",fontWeight:400,px:2,py:2,borderRadius:"18px",boxShadow:"0px 8px 20px rgba(0,0,0,0.18)"}},arrow:{sx:{color:"#1E293B"}}},children:e.jsx("div",{style:{border:"1px solid #D1D5DB",padding:"5px 15px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",background:"#FFFFFF"},onClick:se,children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-users-round-icon lucide-users-round",children:[e.jsx("path",{d:"M18 21a8 8 0 0 0-16 0"}),e.jsx("circle",{cx:"10",cy:"8",r:"5"}),e.jsx("path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3"})]})})}),!at.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==Gt?void 0:Gt.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Le?void 0:Le.iconButton,onClick:e=>{wt(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:jt,open:!!jt,onClose:()=>wt(null),style:null==Le?void 0:Le.userStoryShareMenu,children:[U&&e.jsx(o.MenuItem,{style:null==Le?void 0:Le.userStoryMenuItem,onClick:async()=>{It(!0),M&&(await Promise.all([M("pdf"),M("doc")]),It(!1))},children:e.jsxs("div",{ref:Bt,className:a.default.menuItemContent,style:null==Le?void 0:Le.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==Le?void 0:Le.menuIconColor}),e.jsx("p",{style:null==Le?void 0:Le.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==Le?void 0:Le.userStoryMenuItem,onClick:async()=>{let e=B;E&&(e={...B,value:`${d.replaceTitleSection(null==E?void 0:E.value,B.title)} \n${B.value}`}),null==F||F(!0,[e],B.artifactId),_t()},children:e.jsxs("div",{style:null==Le?void 0:Le.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==Le?void 0:Le.menuIconColor}),e.jsx("p",{style:null==Le?void 0:Le.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==Le?void 0:Le.userStoryMenuItem,onClick:async()=>{const e=(new C.default.Converter).makeHtml(r.formatMarkdown(B.value)||B.value),t=function(e){const t=(new C.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(B.value)||B.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{_t()}},children:e.jsxs("div",{style:null==Le?void 0:Le.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==Le?void 0:Le.menuIconColor}),e.jsx("p",{style:null==Le?void 0:Le.menuLabel,children:"Copy"})]})})]})]}),!Dt&&at.userStory&&xt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==Le?void 0:Le.cancelButton,onClick:()=>{var e;null===(e=Rt.current)||void 0===e||e.abort(),rt(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),at.userStory&&xt?e.jsx(u.default,{type:"fill",children:Dt?e.jsxs("span",{className:a.default.savingSpinner,style:null==Le?void 0:Le.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==Le?void 0:Le.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:Dt,style:Dt?null==Le?void 0:Le.savingButton:null==Le?void 0:Le.saveButton,onClick:async()=>{Et(!0),await Vt();let e=await(async()=>{var e,t,l,n,o;let i=it.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==Fe?void 0:Fe.callUpdateDocument){const{updated_reqai:s}=await h.updateRedlineDocument({documentId:Me,sectionId:B.artifactId,baseApiUrl:null==Fe?void 0:Fe.baseApiUrl,updatedContent:i,userEmail:Fe.userEmail,userName:Fe.userName,redlineConfigId:null!==(e=Fe.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Fe?void 0:Fe.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==s?void 0:s.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==qe?void 0:qe(s))}}catch(e){console.error("failed to update redline document",e),i=Mt}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={...it,value:e};T({...t,isDefaultEdit:!1}),Ft(t.value),rt(e=>({...e,userStory:!1})),Et(!1)}}):!P&&!R&&!le&&xt&&!1!==(null==Gt?void 0:Gt.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Le?void 0:Le.editButton,onClick:()=>rt(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==Le?void 0:Le.pencilIconColor,size:16})}),te&&$t&&xt&&!P&&!R&&!1!==(null==Gt?void 0:Gt.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==ze?void 0:ze.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=B.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...B,sub_features:[...null!==(n=B.sub_features)&&void 0!==n?n:[],i]};st(a),T(a),gt(!0),ht(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!$t&&!P&&!le&&!R&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==G||G()},className:a.default.iconButton,style:null==ze?void 0:ze.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),Ze&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==Ve?void 0:Ve.button,disabled:Ye,onClick:e=>{if(e.stopPropagation(),ct)return ft(null),void vt(!1);ft(structuredClone(null!=Je?Je:{})),gt(!0),vt(!0)},children:ct?e.jsx(l.X,{size:16,color:null==Le?void 0:Le.pencilIconColor,style:null==Ve?void 0:Ve.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==Le?void 0:Le.pencilIconColor,style:null==Ve?void 0:Ve.editIcon})}),(null==Gt?void 0:Gt.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==Le?void 0:Le.actionItemBtn,onClick:e=>{e.stopPropagation(),Nt(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:bt,open:!!bt,onClose:qt,style:null==Le?void 0:Le.userStoryShareMenu,children:null==$?void 0:$.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==Le?void 0:Le.userStoryMenuItem,onClick:()=>{t.onclick(B),qt()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==Le?void 0:Le.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==Le?void 0:Le.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==Le?void 0:Le.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==Le?void 0:Le.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),Lt()},style:null==Le?void 0:Le.chevronButton,className:a.default.chevronButton,children:xt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==Le?void 0:Le.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==Le?void 0:Le.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==Le?void 0:Le.dividerStyle})]}),xt&&e.jsx("div",{className:a.default.cardContent,style:{...null==Le?void 0:Le.cardContentStyle,borderTop:K?"1px solid #E5E5E5":"none"},children:be?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==Ne?void 0:Ne(),className:a.default.viewStatusButton,children:"View Status"})]}):ke?e.jsxs("div",{className:a.default.noDataContainer,style:null==Qe?void 0:Qe.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==Qe?void 0:Qe.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==Qe?void 0:Qe.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.noDataSubtitle,style:null==Qe?void 0:Qe.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==Le?void 0:Le.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==Le?void 0:Le.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==Le?void 0:Le.justifyBetween}),at.userStory?e.jsx(c.default,{ref:Tt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown(Mt)||"",handleUpdateState:(e,t)=>{const l=r.indentMarkdown(t);st(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:at.userStory?"edit":"readOnly",onEditBlocked:Re,onSaveUnsavedChanges:async()=>{await Vt(),gt(!1)},onDiscardUnsavedChanges:()=>{st({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),rt(e=>({...e,userStory:!1})),gt(!1)},isSavingUnsavedChanges:Dt}):Ze?e.jsx(y.default,{styles:Ge,fields:Ke,readonly:!ct,isSaving:et,value:null!==(je=null!=pt?pt:Je)&&void 0!==je?je:{},onChange:ft,onSave:async()=>{var e;pt&&(await(null===(e=null==_e?void 0:_e.onSave)||void 0===e?void 0:e.call(_e,B,pt)),ft(null),vt(!1))},onCancel:()=>{ft(null),vt(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:R,isParent:""===k,message:r.formatMarkdown(B.value)||"",artifactId:B.artifactId,customStyles:Oe,isDisplayHighlightControl:L,contextVariant:H,showConfidenceScore:J,CDNeededInChip:ie}),oe&&e.jsx("div",{className:a.default.approveButtonContainer,style:null==Xe?void 0:Xe.container,children:e.jsx("button",{type:"button",className:a.default.approveButton,style:null==Xe?void 0:Xe.button,disabled:oe.disabled||oe.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=null==oe?void 0:oe.onClick)||void 0===t||t.call(oe)},children:oe.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.spinner,style:null==Xe?void 0:Xe.icon}),e.jsx("span",{style:null==Xe?void 0:Xe.text,children:oe.label})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{style:null==Xe?void 0:Xe.text,children:oe.label}),e.jsx(l.Check,{size:16,style:null==Xe?void 0:Xe.icon})]})})})]})]}),null===(we=it.sub_features)||void 0===we?void 0:we.map((t,l)=>{const o=w(V,!1,t.artifactId);return e.jsx(N,{artifactId:g,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${D}-${String.fromCharCode(65+l)}`,parentUserStory:B,parentIndex:`${k}${k&&"."}${A}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...B.sub_features||[]];l[e]=t,T({...B,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:_,handleDownloadUserStory:M,handleOpenSendDialog:F,isDisplayHighlightControl:L,elementDisplayConfig:V,_resolvedConfig:o,actionItemsConfig:$,onDelete:()=>(e=>{const t=(B.sub_features||[]).filter((t,l)=>l!==e),l={...B,sub_features:t};st(l),T(l)})(l),expandedSubFeatures:Q,disableEditPlan:le,useMuiTooltip:ne},t.artifactId)})]})})]})};exports.StoryCard=N,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:S,actionItemsConfig:x,contextVariant:g,showDisplayName:C,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:b,defaultExpanded:D,showCompletionPanel:E=!1,showAddSectionButton:B=!1,disableEditPlan:T=!1,useMuiTooltip:k=!1,approveButtonConfig:A,CDNeededInChip:U,setRedlineDocumentIdParent:P})=>{const{userStory:R,setUserStory:M,customStyles:F,searchQueryList:_,currentHighlightIndex:q,setCurrentHighlightIndex:L,segmentComponentConfig:V,sectionStatusConfig:W,redlineConfig:z,setRedlineDocumentId:O}=p.useRequirementAI(),$=null==F?void 0:F.userStoryCardStyles,G=0===q,H=q===_.length-1;return t.useEffect(()=>{if(!(null==z?void 0:z.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await h.getRedlineDocumentId({baseApiUrl:z.documentBaseApiUrl||"",comparisonId:z.documentComparisonId||""});if(t)O(t);else{const{document_id:t}=await h.createRedlineDocument({baseApiUrl:z.baseApiUrl,changelogConfigId:z.changelogConfigId,comparisonId:z.documentComparisonId,artifactId:z.artifactId,inputData:z.inputData,redlineConfigId:z.redlineConfigId,userEmail:z.userEmail,userName:z.userName},null!==(e=null==z?void 0:z.token)&&void 0!==e?e:"");t&&(O(t),null==P||P(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:m?{...null==$?void 0:$.userStoryCardWrapper,position:"relative"}:null==$?void 0:$.userStoryCardWrapper,children:[m&&e.jsx(e.Fragment,{children:_.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[q+1," of ",_.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{q>0&&L(e=>e-1)},className:a.default.navButton,disabled:G,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{q<_.length-1&&L(e=>e+1)},className:a.default.navButton,disabled:H,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),R.map((t,l)=>{const a=w(y,!0);return e.jsx(N,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{M(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:a,showWrapper:S,defaultExpanded:D,actionItemsConfig:x,contextVariant:g,showDisplayName:C,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:b,sectionStatusConfig:W,showCompletionPanel:E,showAddSectionButton:B,disableEditPlan:T,useMuiTooltip:k,approveButtonConfig:A,CDNeededInChip:U},t.artifactId)})]})},exports.default=N,exports.replaceLearnedTagsWithInfo=j;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../story-screen/BigEnoughPanel.js"),m=require("./TitleEditor/TitleEditor.js"),y=require("../../../../service/redlineService.js"),h=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),g=require("../../icons/CDIcon.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=x(n);const I={[p.SectionStatus.WAITING]:"WAITING TO GENERATE",[p.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[p.SectionStatus.GENERATED]:"GENERATED",[p.SectionStatus.FAILED]:"FAILED",[p.SectionStatus.GENERATE]:"GENERATE",[p.SectionStatus.APPROVED]:"APPROVED"};function j(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function w(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 N=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},b=({isUserStoryCurrentlyUpdated:n,artifactId:x,artifactTitleId:D,parentUserStory:E,currentUserStory:B,onUserStoryChange:T,parentIndex:U,currentIndex:A,enableDownload:k,isDiffEditReviewMode:P,showUserStoryDiff:R,handleDownloadUserStory:M,handleOpenSendDialog:_,updateUserStoryArtifact:q,selectedArtifactId:L,isDisplayHighlightControl:F,elementDisplayConfig:$,_resolvedConfig:V,showWrapper:O=!1,defaultExpanded:z,actionItemsConfig:W,onDelete:G,contextVariant:H,expandedSubFeatures:Q,showDisplayName:X=!0,allowTitleEdit:Z=!0,showConfidenceScore:J=!0,showBorderTop:K=!0,sectionStatusConfig:Y,showCompletionPanel:ee=!1,showAddSectionButton:te=!1,disableEditPlan:le=!1,useMuiTooltip:ne=!1,approveButtonConfig:oe,CDNeededInChip:ie})=>{var se,ae,re,de,ue,ce,ve,pe,fe,me,ye,he,Se,ge,xe,Ce,Ie,je;const{isLoadingSectionData:we=!1,onLoadSectionData:Ne,status:be,onStatusClick:De,completedCount:Ee,totalCount:Be,isNoDataAvailable:Te=!1}=null!=Y?Y:{},{searchQueryList:Ue,citations:Ae,customStyles:ke,onEditBlocked:Pe,redlineDcoumentId:Re,redlineConfig:Me,customSectionConfig:_e,updateRedlineDataParent:qe,aiReasoning:Le}=p.useRequirementAI(),Fe=null==ke?void 0:ke.userStoryCardStyles,$e=null==Fe?void 0:Fe.customSectionEditButton,Ve=null==Fe?void 0:Fe.statusStyles,Oe=null===(se=null==ke?void 0:ke.userStoryCardStyles)||void 0===se?void 0:se.userStoryEditStyles,ze=null===(ae=null==ke?void 0:ke.userStoryScreenStyles)||void 0===ae?void 0:ae.userStoryContentStyles,We=null==Fe?void 0:Fe.progressHeaderStyles,Ge=null==Fe?void 0:Fe.clinicalTrialSectionStyles,He=null==Fe?void 0:Fe.CompletionStyles,Qe=null==Fe?void 0:Fe.noDataStyles,Xe=null==Fe?void 0:Fe.approveButtonStyles,Ze=null!==(de=null===(re=null==_e?void 0:_e.shouldRender)||void 0===re?void 0:re.call(_e,B))&&void 0!==de&&de,Je=null===(ue=null==_e?void 0:_e.getValue)||void 0===ue?void 0:ue.call(_e,B),Ke=null!==(ve=null===(ce=null==_e?void 0:_e.getFields)||void 0===ce?void 0:ce.call(_e,B))&&void 0!==ve?ve:[],Ye=null!==(pe=null==_e?void 0:_e.isEditDisabled)&&void 0!==pe&&pe,et=null!==(me=null===(fe=null==_e?void 0:_e.isSaving)||void 0===fe?void 0:fe.call(_e,B))&&void 0!==me&&me,tt=(lt=null!==(ye=B.completion_percentage)&&void 0!==ye?ye:0,nt=He,lt>=80?null==nt?void 0:nt.highCompletion:lt>=50?null==nt?void 0:nt.mediumCompletion:null==nt?void 0:nt.lowCompletion);var lt,nt;const ot={[p.SectionStatus.WAITING]:null==Ve?void 0:Ve.waiting,[p.SectionStatus.IN_PROGRESS]:null==Ve?void 0:Ve.inProgress,[p.SectionStatus.GENERATED]:null==Ve?void 0:Ve.generated,[p.SectionStatus.FAILED]:null==Ve?void 0:Ve.failed,[p.SectionStatus.GENERATE]:null==Ve?void 0:Ve.generate,[p.SectionStatus.APPROVED]:null==Ve?void 0:Ve.approved},[it,st]=t.useState({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),[at,rt]=t.useState({userStory:!!B.isDefaultEdit}),[dt,ut]=t.useState(!1),[ct,vt]=t.useState(!1),[pt,ft]=t.useState(null),[mt,yt]=t.useState(null),{userStory:ht,customIcons:St}=p.useRequirementAI(),[gt,xt]=t.useState(null!=z?z:""===U||L===B.artifactId||!!B.isDefaultOpen),[Ct,It]=t.useState(!1),[jt,wt]=t.useState(null),[Nt,bt]=t.useState(null),[Dt,Et]=t.useState(!1),Bt=t.useRef(null),Tt=t.useRef(null),[Ut,At]=t.useState(!1),[kt,Pt]=t.useState(!1),Rt=t.useRef(null),[Mt,_t]=t.useState(B.value);t.useEffect(()=>{n&&xt(n)},[n]),t.useEffect(()=>{st({...structuredClone(B),value:r.formatMarkdown(B.value)||""})},[B]),t.useEffect(()=>{Ue.length>0?xt(!0):void 0===z&&(L?xt(L===B.artifactId):Q&&Q.length>0&&xt(Q.includes(B.artifactId)))},[Ue,L,B.artifactId,Q]);const qt=()=>{wt(null)},Lt=()=>{bt(null)},Ft=()=>{gt&&at.userStory&&Tt.current&&!Tt.current.requestClose()||xt(e=>!e)},$t=async()=>{var e;try{"userStory"==="userStory"&&(T(it),console.log("I am changing RTE editor values",it)),await q(Ae,ht,x,null===(e=Rt.current)||void 0===e?void 0:e.signal)}finally{}};const Vt=null!=(null==B?void 0:B.big_enough)&&!Number.isNaN(B.big_enough)&&!!(null==B?void 0:B.big_enough_decision_factors),Ot=null!==(he=null==B?void 0:B.completion_percentage)&&void 0!==he?he:0,zt=!!(null==B?void 0:B.completion_decision_factors),Wt=""===U,Gt=null!=V?V:w($,Wt),Ht=!P&&!R;t.useEffect(()=>{if(!mt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${mt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[mt]),t.useEffect(()=>{B.isDefaultEdit&&rt(e=>({...e,userStory:!0}))},[B.isDefaultEdit]);return t.useEffect(()=>_t(B.value),[B.value]),e.jsxs("div",{className:a.default.card,style:null==Fe?void 0:Fe.cardStyle,id:`story-card-${B.title}`,"data-expanded":gt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==Fe?void 0:Fe.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==Fe?void 0:Fe.titleRow,onClick:Ft,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==Fe?void 0:Fe.titleLeft,onMouseEnter:()=>At(!0),onMouseLeave:()=>At(!1),children:[X&&e.jsx(N,{displayName:D}),dt&&Ht?e.jsx(m.InlineTitleEditor,{title:B.title,onSave:e=>(async(e,t)=>{var l;try{let n={...B};B.artifactId===t?n.title=e:n.sub_features=(null===(l=B.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],st(n),T(n),ut(!1)}catch(e){console.error("Failed to save title",e)}})(e,B.artifactId),onCancel:()=>{ut(!1)},inputStyle:null==Oe?void 0:Oe.inlineTitleInput,confirmButtonStyle:null==Oe?void 0:Oe.inlineTitleConfirm,cancelButtonStyle:null==Oe?void 0:Oe.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:j(B.title),arrow:!0,children:e.jsx("h2",{title:ne?void 0:B.title,className:a.default.storyTitle,style:null==Fe?void 0:Fe.storyTitle,children:j(B.title)},B.artifactId)}),ee&&!Ze&&(zt?e.jsx(S.CompletionPanel,{customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Fe?void 0:Fe.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Fe?void 0:Fe.CompletionStyles,onToggleStateChange:Pt,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==He?void 0:He.badge,...tt},children:[e.jsxs("span",{children:[Ot,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(g.default,{color:"currentColor"})}),kt?e.jsx(l.ChevronUp,{size:14,style:null==He?void 0:He.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==He?void 0:He.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==He?void 0:He.badge,...tt},children:e.jsxs("span",{children:[Ot,"% Completed"]})})),Z&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==Oe?void 0:Oe.titleEditButton,onClick:e=>{e.stopPropagation(),ut(!0),gt||xt(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("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"})})})]})]}),(be||void 0!==Ee&&void 0!==Be)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==Ee&&void 0!==Be&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",Ee,"/",Be]}),be&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==De||De()},className:a.default.statusButton,style:ot[be],children:I[be]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==Fe?void 0:Fe.titleActions,onClick:e=>e.stopPropagation(),children:[(Gt.showProgressPercentage||Gt.showGapBox)&&O&&e.jsxs("div",{className:a.default.progressHeader,style:null==We?void 0:We.wrapper,children:[Gt.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==We?void 0:We.percentage,children:[null!==(ge=null!==(Se=null==B?void 0:B.confidenceScore)&&void 0!==Se?Se:null==Gt?void 0:Gt.confidenceValue)&&void 0!==ge?ge:"0","%"]}),Gt.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==We?void 0:We.gapBox,children:[null!==(Ce=null!==(xe=null==B?void 0:B.gapValue)&&void 0!==xe?xe:null==Gt?void 0:Gt.gapBoxValue)&&void 0!==Ce?Ce:"2"," ","Gaps"]})]}),Vt&&e.jsx(f.BigEnoughPanel,{customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Fe?void 0:Fe.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Fe?void 0:Fe.BigEnoughStyles}),!at.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==Gt?void 0:Gt.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Fe?void 0:Fe.iconButton,onClick:e=>{wt(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:jt,open:!!jt,onClose:()=>wt(null),style:null==Fe?void 0:Fe.userStoryShareMenu,children:[k&&e.jsx(o.MenuItem,{style:null==Fe?void 0:Fe.userStoryMenuItem,onClick:async()=>{It(!0),M&&(await Promise.all([M("pdf"),M("doc")]),It(!1))},children:e.jsxs("div",{ref:Bt,className:a.default.menuItemContent,style:null==Fe?void 0:Fe.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==Fe?void 0:Fe.menuIconColor}),e.jsx("p",{style:null==Fe?void 0:Fe.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==Fe?void 0:Fe.userStoryMenuItem,onClick:async()=>{let e=B;E&&(e={...B,value:`${d.replaceTitleSection(null==E?void 0:E.value,B.title)} \n${B.value}`}),null==_||_(!0,[e],B.artifactId),qt()},children:e.jsxs("div",{style:null==Fe?void 0:Fe.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==Fe?void 0:Fe.menuIconColor}),e.jsx("p",{style:null==Fe?void 0:Fe.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==Fe?void 0:Fe.userStoryMenuItem,onClick:async()=>{const e=(new C.default.Converter).makeHtml(r.formatMarkdown(B.value)||B.value),t=function(e){const t=(new C.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(B.value)||B.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{qt()}},children:e.jsxs("div",{style:null==Fe?void 0:Fe.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==Fe?void 0:Fe.menuIconColor}),e.jsx("p",{style:null==Fe?void 0:Fe.menuLabel,children:"Copy"})]})})]})]}),!Dt&&at.userStory&&gt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==Fe?void 0:Fe.cancelButton,onClick:()=>{var e;null===(e=Rt.current)||void 0===e||e.abort(),rt(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),at.userStory&&gt?e.jsx(u.default,{type:"fill",children:Dt?e.jsxs("span",{className:a.default.savingSpinner,style:null==Fe?void 0:Fe.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==Fe?void 0:Fe.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:Dt,style:Dt?null==Fe?void 0:Fe.savingButton:null==Fe?void 0:Fe.saveButton,onClick:async()=>{Et(!0),await $t();let e=await(async()=>{var e,t,l,n,o;let i=it.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==Me?void 0:Me.callUpdateDocument){const{updated_reqai:s}=await y.updateRedlineDocument({documentId:Re,sectionId:B.artifactId,baseApiUrl:null==Me?void 0:Me.baseApiUrl,updatedContent:i,userEmail:Me.userEmail,userName:Me.userName,redlineConfigId:null!==(e=Me.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Me?void 0:Me.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==s?void 0:s.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==qe?void 0:qe(s))}}catch(e){console.error("failed to update redline document",e),i=Mt}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={...it,value:e};T({...t,isDefaultEdit:!1}),_t(t.value),rt(e=>({...e,userStory:!1})),Et(!1)}}):!P&&!R&&!le&&gt&&!1!==(null==Gt?void 0:Gt.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Fe?void 0:Fe.editButton,onClick:()=>rt(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==Fe?void 0:Fe.pencilIconColor,size:16})}),te&&Wt&&gt&&!P&&!R&&!1!==(null==Gt?void 0:Gt.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==Oe?void 0:Oe.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=B.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...B,sub_features:[...null!==(n=B.sub_features)&&void 0!==n?n:[],i]};st(a),T(a),xt(!0),yt(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!Wt&&!P&&!le&&!R&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==G||G()},className:a.default.iconButton,style:null==Oe?void 0:Oe.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),Ze&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==$e?void 0:$e.button,disabled:Ye,onClick:e=>{if(e.stopPropagation(),ct)return ft(null),void vt(!1);ft(structuredClone(null!=Je?Je:{})),xt(!0),vt(!0)},children:ct?e.jsx(l.X,{size:16,color:null==Fe?void 0:Fe.pencilIconColor,style:null==$e?void 0:$e.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==Fe?void 0:Fe.pencilIconColor,style:null==$e?void 0:$e.editIcon})}),(null==Gt?void 0:Gt.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==Fe?void 0:Fe.actionItemBtn,onClick:e=>{e.stopPropagation(),bt(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:Nt,open:!!Nt,onClose:Lt,style:null==Fe?void 0:Fe.userStoryShareMenu,children:null==W?void 0:W.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==Fe?void 0:Fe.userStoryMenuItem,onClick:()=>{t.onclick(B),Lt()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==Fe?void 0:Fe.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==Fe?void 0:Fe.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==Fe?void 0:Fe.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==Fe?void 0:Fe.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),Ft()},style:null==Fe?void 0:Fe.chevronButton,className:a.default.chevronButton,children:gt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==Fe?void 0:Fe.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==Fe?void 0:Fe.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==Fe?void 0:Fe.dividerStyle})]}),gt&&e.jsx("div",{className:a.default.cardContent,style:{...null==Fe?void 0:Fe.cardContentStyle,borderTop:K?"1px solid #E5E5E5":"none"},children:we?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==Ne?void 0:Ne(),className:a.default.viewStatusButton,children:"View Status"})]}):Te?e.jsxs("div",{className:a.default.noDataContainer,style:null==Qe?void 0:Qe.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==Qe?void 0:Qe.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==Qe?void 0:Qe.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.noDataSubtitle,style:null==Qe?void 0:Qe.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==Fe?void 0:Fe.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==Fe?void 0:Fe.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==Fe?void 0:Fe.justifyBetween}),at.userStory?e.jsx(c.default,{ref:Tt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown((Qt=Mt,Qt.replace(/<(upt|manual)\s+id="([^"]+)"[^>]*>/gs,(e,t,l)=>{if(/\sdata-status=/.test(e))return e;const n=function(e){var t;const l=e.split("$"),n=l[1]||l[0];for(const e of Le)if(e.id===n)return(null===(t=e.redlining_details)||void 0===t?void 0:t.status)||"";return""}(l);return e.replace(/>$/,` data-status="${n}">`)})))||"",handleUpdateState:(e,t)=>{const l=r.indentMarkdown(t);st(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:at.userStory?"edit":"readOnly",onEditBlocked:Pe,onSaveUnsavedChanges:async()=>{await $t(),xt(!1)},onDiscardUnsavedChanges:()=>{st({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),rt(e=>({...e,userStory:!1})),xt(!1)},isSavingUnsavedChanges:Dt}):Ze?e.jsx(h.default,{styles:Ge,fields:Ke,readonly:!ct,isSaving:et,value:null!==(Ie=null!=pt?pt:Je)&&void 0!==Ie?Ie:{},onChange:ft,onSave:async()=>{var e;pt&&(await(null===(e=null==_e?void 0:_e.onSave)||void 0===e?void 0:e.call(_e,B,pt)),ft(null),vt(!1))},onCancel:()=>{ft(null),vt(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:R,isParent:""===U,message:r.formatMarkdown(B.value)||"",artifactId:B.artifactId,customStyles:ze,isDisplayHighlightControl:F,contextVariant:H,showConfidenceScore:J,CDNeededInChip:ie}),oe&&e.jsx("div",{className:a.default.approveButtonContainer,style:null==Xe?void 0:Xe.container,children:e.jsx("button",{type:"button",className:a.default.approveButton,style:null==Xe?void 0:Xe.button,disabled:oe.disabled||oe.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=null==oe?void 0:oe.onClick)||void 0===t||t.call(oe)},children:oe.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.spinner,style:null==Xe?void 0:Xe.icon}),e.jsx("span",{style:null==Xe?void 0:Xe.text,children:oe.label})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{style:null==Xe?void 0:Xe.text,children:oe.label}),e.jsx(l.Check,{size:16,style:null==Xe?void 0:Xe.icon})]})})})]})]}),null===(je=it.sub_features)||void 0===je?void 0:je.map((t,l)=>{const o=w($,!1,t.artifactId);return e.jsx(b,{artifactId:x,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${D}-${String.fromCharCode(65+l)}`,parentUserStory:B,parentIndex:`${U}${U&&"."}${A}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...B.sub_features||[]];l[e]=t,T({...B,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:q,handleDownloadUserStory:M,handleOpenSendDialog:_,isDisplayHighlightControl:F,elementDisplayConfig:$,_resolvedConfig:o,actionItemsConfig:W,onDelete:()=>(e=>{const t=(B.sub_features||[]).filter((t,l)=>l!==e),l={...B,sub_features:t};st(l),T(l)})(l),expandedSubFeatures:Q,disableEditPlan:le,useMuiTooltip:ne},t.artifactId)})]})})]});var Qt};exports.StoryCard=b,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:h,showWrapper:S,actionItemsConfig:g,contextVariant:x,showDisplayName:C,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:N,defaultExpanded:D,showCompletionPanel:E=!1,showAddSectionButton:B=!1,disableEditPlan:T=!1,useMuiTooltip:U=!1,approveButtonConfig:A,CDNeededInChip:k,setRedlineDocumentIdParent:P})=>{const{userStory:R,setUserStory:M,customStyles:_,searchQueryList:q,currentHighlightIndex:L,setCurrentHighlightIndex:F,segmentComponentConfig:$,sectionStatusConfig:V,redlineConfig:O,setRedlineDocumentId:z}=p.useRequirementAI(),W=null==_?void 0:_.userStoryCardStyles,G=0===L,H=L===q.length-1;return t.useEffect(()=>{if(!(null==O?void 0:O.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await y.getRedlineDocumentId({baseApiUrl:O.documentBaseApiUrl||"",comparisonId:O.documentComparisonId||""});if(t)z(t);else{const{document_id:t}=await y.createRedlineDocument({baseApiUrl:O.baseApiUrl,changelogConfigId:O.changelogConfigId,comparisonId:O.documentComparisonId,artifactId:O.artifactId,inputData:O.inputData,redlineConfigId:O.redlineConfigId,userEmail:O.userEmail,userName:O.userName},null!==(e=null==O?void 0:O.token)&&void 0!==e?e:"");t&&(z(t),null==P||P(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:m?{...null==W?void 0:W.userStoryCardWrapper,position:"relative"}:null==W?void 0:W.userStoryCardWrapper,children:[m&&e.jsx(e.Fragment,{children:q.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[L+1," of ",q.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{L>0&&F(e=>e-1)},className:a.default.navButton,disabled:G,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{L<q.length-1&&F(e=>e+1)},className:a.default.navButton,disabled:H,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),R.map((t,l)=>{const a=w(h,!0);return e.jsx(b,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{M(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:h,_resolvedConfig:a,showWrapper:S,defaultExpanded:D,actionItemsConfig:g,contextVariant:x,showDisplayName:C,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:N,sectionStatusConfig:V,showCompletionPanel:E,showAddSectionButton:B,disableEditPlan:T,useMuiTooltip:U,approveButtonConfig:A,CDNeededInChip:k},t.artifactId)})]})},exports.default=b,exports.replaceLearnedTagsWithInfo=j;
2
2
  //# sourceMappingURL=UserStoryCard.js.map