@viswa-test/test-citation 0.0.232 → 0.0.234

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 (54) hide show
  1. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  4. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  5. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  8. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  9. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  11. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.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/features/CognitiveCompare/CognitiveCompare.js +1 -1
  16. package/dist/features/CognitiveCompare/MoreFunctionsPopup.js +1 -1
  17. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  18. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  19. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  20. package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.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/UserStoryCard/CognitiveComponents/CognitiveComponent.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/components/InlineUpdatedComponent.js +1 -1
  28. package/dist/features/RequirementAI/utils/helpers.js +1 -1
  29. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  30. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  31. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -0
  32. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  33. package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts +2 -0
  34. package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts.map +1 -1
  35. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  36. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  37. package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
  38. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/Editor.d.ts.map +1 -1
  39. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +6 -2
  40. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
  41. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +6 -2
  42. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
  43. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +2 -2
  44. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  45. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +16 -10
  46. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  47. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +1 -2
  48. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  49. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +4 -0
  50. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  51. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  52. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +1 -0
  53. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  54. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var d=function(){return i("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},C=[{key:"connect",title:"Connect",icon:i("svg",e({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i("svg",e({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i(c,{})}],a=function(c){var a=c.open,h=c.anchorEl;c.sectionTitle,c.referenceSectionTitle;var p=c.onClose,g=c.onOpenCognitiveCompare,x=c.onOpenSideBySide,f=c.onConnect,m=c.isConnected,u=void 0!==m&&m,y=c.isOrphan,v=c.maintainRelativeOrder;return i(o,e({open:a,anchorEl:h,onClose:p,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:C.filter(function(e){return v||"side-by-side"!==e.key}).map(function(o){var c="connect"===o.key,C=c&&u,a=y&&("connect"===o.key||"side-by-side"===o.key),h=n(t,{children:[i(r,e({sx:e(e({width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}},a&&{opacity:.15}),C&&{"& svg path":{fill:"#15803D",fillOpacity:1}})},{children:o.icon})),n(r,e({sx:{minWidth:0,display:"flex",flexDirection:"column",flex:1}},{children:[i(l,e({sx:{fontSize:"12px",fontWeight:500,color:a?"#98A2B3":C?"#15803D":"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:c?u?"Disconnect":"Connect":o.title})),a&&i(l,e({sx:{mt:.35,fontSize:"10px",lineHeight:1.3,color:"#98A2B3",whiteSpace:"normal"}},{children:"No counterpart exists to connect to."}))]})),C&&!a&&i(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",ml:"auto"}},{children:i(d,{})}))]});return a?i(r,e({"aria-disabled":"true",sx:{px:1.25,py:1,minHeight:22,borderRadius:"10px",display:"flex",alignItems:"flex-start",gap:1,cursor:"not-allowed",userSelect:"none"}},{children:h}),o.key):i(s,e({onClick:function(){return e=o.key,void(y&&("connect"===e||"side-by-side"===e)||("connect"!==e?"side-by-side"!==e?g():x():f()));var e},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,bgcolor:C?"#F0FDF4":"transparent","&:hover":{bgcolor:C?"#DCFCE7":"#F9FAFB"}}},{children:h}),o.key)})}))};export{a as default};
1
+ import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var d=function(){return i("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},a=[{key:"connect",title:"Connect",icon:i("svg",e({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i("svg",e({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i(c,{})}],C=function(c){var C=c.open,h=c.anchorEl;c.sectionTitle,c.referenceSectionTitle;var p=c.onClose,g=c.onOpenCognitiveCompare,x=c.onOpenSideBySide,f=c.onConnect,u=c.isConnected,m=void 0!==u&&u,y=c.isOrphan,v=void 0!==y&&y,w=c.maintainRelativeOrder,k=c.isGuidelineMode,b=c.hasGuidelineMatches,F=k?!(void 0===b||b):v,M=k?"No highlights found in guidelines.":"No counterpart exists to connect to.";return i(o,e({open:C,anchorEl:h,onClose:p,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:a.filter(function(e){return w||"side-by-side"!==e.key}).map(function(o){var c="connect"===o.key,a=c&&m,C=("connect"===o.key||"side-by-side"===o.key)&&F,h=n(t,{children:[i(r,e({sx:e(e({width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}},C&&{opacity:.15}),a&&{"& svg path":{fill:"#15803D",fillOpacity:1}})},{children:o.icon})),n(r,e({sx:{minWidth:0,display:"flex",flexDirection:"column",flex:1}},{children:[i(l,e({sx:{fontSize:"12px",fontWeight:500,color:C?"#98A2B3":a?"#15803D":"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:c?m?"Disconnect":"Connect":o.title})),C&&i(l,e({sx:{mt:.35,fontSize:"10px",lineHeight:1.3,color:"#98A2B3",whiteSpace:"normal"}},{children:M}))]})),a&&!C&&i(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",ml:"auto"}},{children:i(d,{})}))]});return C?i(r,e({"aria-disabled":"true",sx:{px:1.25,py:1,minHeight:22,borderRadius:"10px",display:"flex",alignItems:"flex-start",gap:1,cursor:"not-allowed",userSelect:"none"}},{children:h}),o.key):i(s,e({onClick:function(){var e;("connect"===(e=o.key)||"side-by-side"===e)&&F||("connect"!==e?"side-by-side"!==e?g():x():f())},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,bgcolor:a?"#F0FDF4":"transparent","&:hover":{bgcolor:a?"#DCFCE7":"#F9FAFB"}}},{children:h}),o.key)})}))};export{C as default};
2
2
  //# sourceMappingURL=MoreFunctionsPopup.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as c,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var F,_,R,k,B,C,M,A,O,j,W,N,D,P,E,T=S.section,K=S.idx,z=S.columnKey,L=S.colRef,H=S.mb,G=void 0===H?1:H,V=S.isExpanded,X=S.onToggle,Y=S.navigation,q=S.parentNodeId,J=void 0===q?"":q,Q=p(),U=Q.showOpenNodeRef,Z=Q.resolvedMarkdownStyles,$=Q.maintainRelativeOrder,nn=Q.showDeviationBadges,en=void 0!==nn&&nn,on=Q.renderSubSectionAccordion,tn=Q.treeData,ln=Q.proposedSections,dn=Q.existingSections,rn=Q.deviationNumberRegistry,an=Q.deviationParentRegistry,cn=Q.getBadgeRef,un=Q.openSummaryPopup,sn=Q.getSectionCompareStyle,vn=Q.connectedSections,fn=Q.openMoreFunctionsPopup,pn=Q.isProposingFix,hn=Q.proposingFixNodeId,gn=Q.isRedlineFlow,xn=Q.isSideBySide,mn=Q.activeSideBySideSection,In=Q.scrollSyncLocked,yn=Q.unifiedNumbering,bn=Q.toggleScrollSyncLocked,wn=Q.summaryPopupAnchorEl,Sn="".concat(xn?"1":"0","-").concat(String(null!=mn?mn:"")),Fn=(null===(F=T.displayTitle)||void 0===F||F)&&h(T.title),_n=!(!pn||!hn||"left"!==z||T.id!==hn&&T.nodeId!==hn),Rn=g(T.content),kn="boolean"==typeof gn?gn:Rn,Bn=Rn,Cn=kn&&Rn,Mn=Cn?x(T.content):T.content,An=Cn?T.content:void 0,On=(null===(_=T.displayContent)||void 0===_||_||Rn)&&h(T.content),jn=!Fn&&!On,Wn=T.title;Fn||(Wn=On?"No Title Found":"No Matching Section Found");var Nn=T.evaluationResult;if(!Nn&&"right"===z)if($){var Dn=null===(R=T.refIndexes)||void 0===R?void 0:R[0],Pn=ln.find(function(n){return n.selfIndex===Dn});Nn=null==Pn?void 0:Pn.evaluationResult}else Nn=null===(k=ln[K])||void 0===k?void 0:k.evaluationResult;var En=null===(B=null==tn?void 0:tn.input_index_map)||void 0===B?void 0:B[0],Tn=null===(C=null==tn?void 0:tn.input_index_map)||void 0===C?void 0:C[1],Kn="left"===z?Tn:En,zn=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=zn(l.subsections,e);if(d)return d}}return null},Ln="left"===z?T:zn(ln,T.id),Hn="right"===z?T:zn(dn,T.id),Gn=o.useMemo(function(){if(!$)return 0;var n=1/0,e=function(i,o,t,l){var d;if(i){var r=i.nodeId||i.id;if(l&&"right"===z){var a=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var c=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),u=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(u).forEach(function(e){var i="".concat(r).concat(b).concat(e),o=null==rn?void 0:rn[i];null!=o&&o<n&&(n=o);var t="".concat(c).concat(b).concat(e),l=null==rn?void 0:rn[t];null!=l&&l<n&&(n=l)});for(var s=i.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),h=0;h<p;h++)e(s[h],v[h],f[h],!1)}};return e(T,Ln,Hn,!0),n!==1/0?n-1:0},[T,Ln,Hn,z,rn,$,ln]);if($)if("left"===z){var Vn=null===(M=T.refIndexes)||void 0===M?void 0:M[0],Xn=dn.findIndex(function(n){return n.selfIndex===Vn});Hn=-1!==Xn?dn[Xn]:zn(dn,T.id)}else{var Yn=null===(A=T.refIndexes)||void 0===A?void 0:A[0],qn=ln.findIndex(function(n){return n.selfIndex===Yn});Ln=-1!==qn?ln[qn]:zn(ln,T.id)}var Jn="left"===z?!Hn:!Ln,Qn=Nn||(null==Ln?void 0:Ln.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),Un=null!==(W=null===(j=null===(O=null==Qn?void 0:Qn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:w,Zn=m(Un).highlightBg,$n=(null==Qn?void 0:Qn.deviations)||{},ne=T.nodeId||T.id;if($&&"left"!==z){var ee=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(T.selfIndex)});ee.length>0?ne=ee[0].nodeId||ee[0].id:(null==Ln?void 0:Ln.id)&&(ne=Ln.nodeId||Ln.id)}var ie=Object.keys($n)[0],oe=ie?"".concat(ne).concat(b).concat(ie):null,te=oe?null==an?void 0:an[oe]:null,le=K+1;if($&&yn){var de="left"===z?yn.leftNums.get(null==T?void 0:T.id):yn.rightNums.get(null==T?void 0:T.id);Jn&&void 0!==de?le=de:null!=te&&te>=0?le=te:void 0!==de&&(le=de)}else null!=te&&te>=0&&(le=te);var re=Object.entries($n).map(function(n){var e=n[0],i=n[1],o="".concat(ne).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:rn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});re.sort(function(n,e){return n.currentIndex-e.currentIndex});var ae,ce,ue=re.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,c=e.deviationMap,u=e.refId,s=e.currentIndex;$&&void 0!==Gn&&(s-=Gn);var v=c[J],f=I(v);if(f)v="";else if(!v)return null;var p=K,h=K;if($)if("left"===z){var g=null===(i=T.refIndexes)||void 0===i?void 0:i[0],x=dn.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var y=dn.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId});h=-1!==y?y:K}}else{var w=null===(o=T.refIndexes)||void 0===o?void 0:o[0],S=ln.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))?C:K}var F="".concat(ne).concat(b).concat(a).concat(b).concat(p).concat(b).concat(h),_=c[Kn],R=Jn||I(_),k="".concat(le,".").concat(s),B=K;if("right"===z&&$){var C,M=null===(t=T.refIndexes)||void 0===t?void 0:t[0],A=ln.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))&&(B=C)}var O=sn?sn(B):null,j=(null==c?void 0:c.evaluation_outputs)||(null==Qn?void 0:Qn.evaluation_outputs),W=null!==(l=null==j?void 0:j.output_value)&&void 0!==l?l:null,N=null!==(r=null===(d=null==j?void 0:j.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Un,D=m(N),P=O?n(n({},O),{badgeBg:D.badgeBg,badgeBorder:D.badgeBorder,badgeText:D.badgeText}):n({},D),E=(null==c?void 0:c.deviation_summary)?{deviation_summary:c.deviation_summary,deviation_title:(null==c?void 0:c.deviation_title)||(null==Qn?void 0:Qn.deviation_title),deviation_impact:(null==c?void 0:c.deviation_impact)||(null==Qn?void 0:Qn.deviation_impact),deviation_explanation:(null==c?void 0:c.deviation_explanation)||(null==Qn?void 0:Qn.deviation_explanation),evaluation_outputs:j,cognitive_decisioning:(null==c?void 0:c.cognitive_decisioning)||(null==Qn?void 0:Qn.cognitive_decisioning)}:null,L=0,H=Mn||"";if(v&&H){var G=H.split(/\n{2,}/),V=G.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries($n).filter(function(n){n[0];var e=n[1][J];return e&&G[V].includes(e)}).sort(function(n,e){return G[V].indexOf(n[1][J])-G[V].indexOf(e[1][J])}),Y=X.filter(function(n){n[0];var e=n[1][J];return e&&(e.includes(v)||v.includes(e))});Y.length>1&&(L=Math.max(0,Y.findIndex(function(n){return n[0]===a})))}}var q=cn(z,u);return{id:u,actionId:F,label:k,highlight:v,side:z,style:P,stackIndex:L,score:W,isConnected:null==vn?void 0:vn.has(F),showScrollLockToggle:(null==vn?void 0:vn.has(F))||xn&&mn===F||!!wn&&wn===q.current,scrollSyncLocked:In,toggleScrollSyncLocked:bn,isOrphan:R,isMissingClause:f,badgeRef:q,onClick:function(n){n.stopPropagation(),fn&&fn(n,Ln||{id:"orphan-left",title:"",content:""},R,Hn||{id:"orphan-right",title:"",content:""},F,P)},onSummaryClick:function(n){n.stopPropagation(),un(n,F,R,E)}}}).filter(Boolean),se=en||!kn&&_n?ue:[],ve=ue.map(function(n){return n.highlight}).filter(Boolean),fe=T.id&&z===(null==Y?void 0:Y.columnKey)?Y:null,pe=o.useRef(!1);return t(function(){V||(pe.current=!1)},[V]),e(l,n({ref:L,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==fe?void 0:fe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(N=null==fe?void 0:fe.showAboveRef)||void 0===N?void 0:N.current)?window.getComputedStyle(fe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&V,onChange:function(){jn||(X(),U.current=T.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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:[i(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Fn&&i(a,n({title:Wn,placement:"top"},{children:i(c,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ae=Wn,ce="left"===z&&(null!==(P=null===(D=null==T?void 0:T.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===ce&&(ce=!1),ae?y(ae).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),ce&&i("span",n({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"}))]}),t)}):null)}))}))})),!jn&&e(u,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:Mn,overlayContent:An,sxStyles:Z,highlights:ve,maintainRelativeOrder:$,highlightBg:Zn,suppressHighlightBg:Bn,deviationBadges:se,collisionKey:Sn}),(T.subsections||[]).map(function(n,e){return on({section:n,keyPath:"".concat(K,"-").concat(e),depth:0,columnKey:z,parentNodeId:J,sectionOffset:Gn})})]}))]})),V&&(null==fe?void 0:fe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==fe?void 0:fe.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(fe.showBelowRef.current).color:void 0})}))}))]}),"".concat(z,"-sec-").concat(K))};export{S as default};
1
+ import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var R,F,_,k,B,C,M,A,O,j,W,N,D,P,E,T=S.section,K=S.idx,z=S.columnKey,L=S.colRef,H=S.mb,G=void 0===H?1:H,V=S.isExpanded,X=S.onToggle,Y=S.navigation,q=S.parentNodeId,J=void 0===q?"":q,Q=p(),U=Q.showOpenNodeRef,Z=Q.resolvedMarkdownStyles,$=Q.maintainRelativeOrder,nn=Q.showDeviationBadges,en=void 0!==nn&&nn,on=Q.renderSubSectionAccordion,tn=Q.treeData,ln=Q.proposedSections,dn=Q.existingSections,rn=Q.deviationNumberRegistry,an=Q.deviationParentRegistry,un=Q.getBadgeRef,cn=Q.openSummaryPopup,sn=Q.getSectionCompareStyle,vn=Q.connectedSections,fn=Q.openMoreFunctionsPopup,pn=Q.isProposingFix,hn=Q.proposingFixNodeId,gn=Q.isRedlineFlow,xn=Q.isSideBySide,mn=Q.activeSideBySideSection,In=Q.scrollSyncLocked,yn=Q.unifiedNumbering,bn=Q.toggleScrollSyncLocked,wn=Q.summaryPopupAnchorEl,Sn="".concat(xn?"1":"0","-").concat(String(null!=mn?mn:"")),Rn=(null===(R=T.displayTitle)||void 0===R||R)&&h(T.title),Fn=!(!pn||!hn||"left"!==z||T.id!==hn&&T.nodeId!==hn),_n=g(T.content),kn="boolean"==typeof gn?gn:_n,Bn=_n,Cn=kn&&_n,Mn=Cn?x(T.content):T.content,An=Cn?T.content:void 0,On=(null===(F=T.displayContent)||void 0===F||F||_n)&&h(T.content),jn=!Rn&&!On,Wn=T.title;Rn||(Wn=On?"No Title Found":"No Matching Section Found");var Nn=T.evaluationResult;if(!Nn&&"right"===z)if($){var Dn=null===(_=T.refIndexes)||void 0===_?void 0:_[0],Pn=ln.find(function(n){return n.selfIndex===Dn});Nn=null==Pn?void 0:Pn.evaluationResult}else Nn=null===(k=ln[K])||void 0===k?void 0:k.evaluationResult;var En=null===(B=null==tn?void 0:tn.input_index_map)||void 0===B?void 0:B[0],Tn=null===(C=null==tn?void 0:tn.input_index_map)||void 0===C?void 0:C[1],Kn="left"===z?Tn:En,zn=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=zn(l.subsections,e);if(d)return d}}return null},Ln="left"===z?T:zn(ln,T.id),Hn="right"===z?T:zn(dn,T.id),Gn=o.useMemo(function(){if(!$)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return y(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===z){var a=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[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),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[J];if(function(n,i){if("string"!=typeof i||I(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===z?t||o:l||o,a)){var c="".concat(r).concat(b).concat(i),v=null==rn?void 0:rn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(b).concat(i),p=null==rn?void 0:rn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}};return i(T,Ln,Hn,!0),n!==1/0?n-1:0},[T,Ln,Hn,z,J,rn,$,ln]);if($)if("left"===z){var Vn=null===(M=T.refIndexes)||void 0===M?void 0:M[0],Xn=dn.findIndex(function(n){return n.selfIndex===Vn});Hn=-1!==Xn?dn[Xn]:zn(dn,T.id)}else{var Yn=null===(A=T.refIndexes)||void 0===A?void 0:A[0],qn=ln.findIndex(function(n){return n.selfIndex===Yn});Ln=-1!==qn?ln[qn]:zn(ln,T.id)}var Jn="left"===z?!Hn:!Ln,Qn=Nn||(null==Ln?void 0:Ln.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),Un=null!==(W=null===(j=null===(O=null==Qn?void 0:Qn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:w,Zn=m(Un).highlightBg,$n=(null==Qn?void 0:Qn.deviations)||{},ne=T.nodeId||T.id;if($&&"left"!==z){var ee=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(T.selfIndex)});ee.length>0?ne=ee[0].nodeId||ee[0].id:(null==Ln?void 0:Ln.id)&&(ne=Ln.nodeId||Ln.id)}var ie=Object.keys($n)[0],oe=ie?"".concat(ne).concat(b).concat(ie):null,te=oe?null==an?void 0:an[oe]:null,le=K+1;if($&&yn){var de="left"===z?yn.leftNums.get(null==T?void 0:T.id):yn.rightNums.get(null==T?void 0:T.id);Jn&&void 0!==de?le=de:null!=te&&te>=0?le=te:void 0!==de&&(le=de)}else null!=te&&te>=0&&(le=te);var re=Object.entries($n).map(function(n){var e=n[0],i=n[1],o="".concat(ne).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:rn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});re.sort(function(n,e){return n.currentIndex-e.currentIndex});var ae,ue,ce=re.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex;$&&void 0!==Gn&&(s-=Gn),s=Math.max(1,s);var v=u[J],f=I(v);if(f)v="";else if(!v)return null;var p=K,h=K;if($)if("left"===z){var g=null===(i=T.refIndexes)||void 0===i?void 0:i[0],x=dn.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var y=dn.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId});h=-1!==y?y:K}}else{var w=null===(o=T.refIndexes)||void 0===o?void 0:o[0],S=ln.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))?C:K}var R="".concat(ne).concat(b).concat(a).concat(b).concat(p).concat(b).concat(h),F=u[Kn],_=Jn||I(F),k="".concat(le,".").concat(s),B=K;if("right"===z&&$){var C,M=null===(t=T.refIndexes)||void 0===t?void 0:t[0],A=ln.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))&&(B=C)}var O=sn?sn(B):null,j=(null==u?void 0:u.evaluation_outputs)||(null==Qn?void 0:Qn.evaluation_outputs),W=null!==(l=null==j?void 0:j.output_value)&&void 0!==l?l:null,N=null!==(r=null===(d=null==j?void 0:j.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Un,D=m(N),P=O?n(n({},O),{badgeBg:D.badgeBg,badgeBorder:D.badgeBorder,badgeText:D.badgeText}):n({},D),E=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Qn?void 0:Qn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Qn?void 0:Qn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Qn?void 0:Qn.deviation_explanation),evaluation_outputs:j,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Qn?void 0:Qn.cognitive_decisioning)}:null,L=0,H=Mn||"";if(v&&H){var G=H.split(/\n{2,}/),V=G.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries($n).filter(function(n){n[0];var e=n[1][J];return e&&G[V].includes(e)}).sort(function(n,e){return G[V].indexOf(n[1][J])-G[V].indexOf(e[1][J])}),Y=X.filter(function(n){n[0];var e=n[1][J];return e&&(e.includes(v)||v.includes(e))});Y.length>1&&(L=Math.max(0,Y.findIndex(function(n){return n[0]===a})))}}var q=un(z,c);return{id:c,actionId:R,label:k,highlight:v,side:z,style:P,stackIndex:L,score:W,isConnected:null==vn?void 0:vn.has(R),showScrollLockToggle:(null==vn?void 0:vn.has(R))||xn&&mn===R||!!wn&&wn===q.current,scrollSyncLocked:In,toggleScrollSyncLocked:bn,isOrphan:_,isMissingClause:f,badgeRef:q,onClick:function(n){n.stopPropagation(),fn&&fn(n,Ln||{id:"orphan-left",title:"",content:""},_,Hn||{id:"orphan-right",title:"",content:""},R,P)},onSummaryClick:function(n){n.stopPropagation(),cn(n,R,_,E)}}}).filter(Boolean),se=en||!kn&&Fn?ce:[],ve=ce.map(function(n){return n.highlight}).filter(Boolean),fe=T.id&&z===(null==Y?void 0:Y.columnKey)?Y:null,pe=o.useRef(!1);return t(function(){V||(pe.current=!1)},[V]),e(l,n({ref:L,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==fe?void 0:fe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(N=null==fe?void 0:fe.showAboveRef)||void 0===N?void 0:N.current)?window.getComputedStyle(fe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&V,onChange:function(){jn||(X(),U.current=T.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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:[i(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Rn&&i(a,n({title:Wn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ae=Wn,ue="left"===z&&(null!==(P=null===(D=null==T?void 0:T.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===ue&&(ue=!1),ae?y(ae).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),ue&&i("span",n({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"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:Mn,overlayContent:An,sxStyles:Z,highlights:ve,maintainRelativeOrder:$,highlightBg:Zn,suppressHighlightBg:Bn,deviationBadges:se,collisionKey:Sn}),(T.subsections||[]).map(function(n,e){return on({section:n,keyPath:"".concat(K,"-").concat(e),depth:0,columnKey:z,parentNodeId:J,sectionOffset:Gn})})]}))]})),V&&(null==fe?void 0:fe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==fe?void 0:fe.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(fe.showBelowRef.current).color:void 0})}))}))]}),"".concat(z,"-sec-").concat(K))};export{S as default};
2
2
  //# sourceMappingURL=SectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,generateColorPalette as m,isMissingStr as g,DEVIATION_BADGE_SEPARATOR as x}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var S=t.memo(function(t){var I,b,_,k,C,P,w,B,F,R,O=t.section,N=t.keyPath,j=t.depth,M=void 0===j?0:j,E=t.columnKey,K=void 0===E?"left":E,W=t.parentNodeId,L=void 0===W?"":W,z=t.sectionOffset,A=v(),D=A.expandedSubSections,H=A.setExpandedSubSections,T=A.maintainRelativeOrder,G=A.showDeviationBadges,U=void 0!==G&&G,q=A.proposedSections,J=A.existingSections,Q=A.treeData,V=A.deviationNumberRegistry,X=A.deviationParentRegistry,Y=A.connectedSections,Z=A.activeSideBySideSection,$=A.isSideBySide,nn=A.scrollSyncLocked,en=A.toggleScrollSyncLocked,tn=A.summaryPopupAnchorEl,on=A.resolvedMarkdownStyles,ln=A.getSubSectionRef,dn=A.getSubSectionCompareStyle,rn=A.getBadgeRef,an=A.openMoreFunctionsPopup,un=A.openSummaryPopup,cn=A.resetSideBySide,sn=A.setConnectedSections,vn=A.setConnectedLines,fn=A.cachedConnectedPositions,pn=A.isProposingFix,hn=A.proposingFixNodeId,mn=A.isRedlineFlow,gn=A.unifiedNumbering,xn=null!=Z?Z:"",yn=(null===(I=O.displayTitle)||void 0===I||I)&&f(O.title),Sn=!(!pn||!hn||"left"!==K||O.id!==hn&&O.nodeId!==hn),In=p(O.content),bn="boolean"==typeof mn?mn:In,_n=In,kn=bn&&In,Cn=kn?h(O.content):O.content,Pn=kn?O.content:void 0,wn=(null===(b=O.displayContent)||void 0===b||b||In)&&f(O.content),Bn=!yn&&!wn,Fn=yn?O.title:wn?"No Title Found":"No Matching Section Found",Rn=!!D[N],On=ln(K,N),Nn=N.split("-").map(Number)[0],jn=q[Nn],Mn=J[Nn],En=Nn,Kn=Nn,Wn=!1,Ln=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(T)if("left"===K){var zn=null===(_=null==jn?void 0:jn.refIndexes)||void 0===_?void 0:_[0],An=J.findIndex(function(n){return n.selfIndex===zn});-1!==An?(Mn=J[An],Kn=An):Wn=!0}else{var Dn=null===(k=null==Mn?void 0:Mn.refIndexes)||void 0===k?void 0:k[0],Hn=q.findIndex(function(n){return n.selfIndex===Dn});-1!==Hn?(jn=q[Hn],En=Hn):Wn=!0}var Tn=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Ln(n[e],i,String(e));if(t)return t}return null},Gn=null,Un=null,qn="",Jn="";if(T)"left"===K?(Gn=O,qn=N,(Qn=Ln(Mn,O.nodeId||O.id,String(Kn)))||(Qn=Tn(J,O.nodeId||O.id)),Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""):(Un=O,Jn=N,(Vn=Ln(jn,O.nodeId||O.id,String(En)))||(Vn=Tn(q,O.nodeId||O.id)),Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||"");else if("left"===K){Gn=O,qn=N;var Qn=Tn(J,O.nodeId||O.id);Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""}else{Un=O,Jn=N;var Vn=Tn(q,O.nodeId||O.id);Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||""}var Xn=(qn?dn(qn):null)||dn(N),Yn=null===(C=null==Q?void 0:Q.input_index_map)||void 0===C?void 0:C[0],Zn=null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[1],$n="left"===K?Zn:Yn,ni="left"===K?!Un:!Gn,ii=O.evaluationResult||(null==Gn?void 0:Gn.evaluationResult)||(null==Un?void 0:Un.evaluationResult),ei=(null==ii?void 0:ii.deviations)||{},ti=O.nodeId||O.id||(null==Gn?void 0:Gn.nodeId)||(null==Gn?void 0:Gn.id)||(null==Un?void 0:Un.nodeId)||(null==Un?void 0:Un.id);T&&"left"!==K&&(null==Gn?void 0:Gn.id)&&(ti=Gn.nodeId||Gn.id);var oi=Object.keys(ei)[0],li=oi?"".concat(ti).concat(x).concat(oi):null,di=li?null==X?void 0:X[li]:null,ri=Nn+1;if(T&&gn){var ai="left"===K?gn.leftNums.get(null==jn?void 0:jn.id):gn.rightNums.get(null==Mn?void 0:Mn.id);Wn&&void 0!==ai?ri=ai:null!=di&&di>=0?ri=di:void 0!==ai&&(ri=ai)}else null!=di&&di>=0&&(ri=di);var ui=null!==(F=null===(B=null===(w=null==ii?void 0:ii.evaluation_outputs)||void 0===w?void 0:w.metadata)||void 0===B?void 0:B.label_color)&&void 0!==F?F:y,ci=m(ui).highlightBg,si=Object.entries(ei).map(function(n){var i=n[0],e=n[1],t="".concat(ti).concat(x).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:V[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});si.sort(function(n,i){return n.currentIndex-i.currentIndex});var vi=si.map(function(i){var e,t,o,l=i.deviationKey,d=i.deviationMap,r=i.refId,a=i.currentIndex;T&&void 0!==z&&(a-=z);var u=d[L],c=g(u);if(c)u="";else if(!u)return null;var s=d[$n],v=ni||g(s),f="".concat(ri,".").concat(a),p="".concat(ti).concat(x).concat(l).concat(x).concat(qn).concat(x).concat(Jn),h=(null==d?void 0:d.evaluation_outputs)||(null==ii?void 0:ii.evaluation_outputs),y=null!==(e=null==h?void 0:h.output_value)&&void 0!==e?e:null,S=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:ui,I=m(S),b=n({},I),_=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==ii?void 0:ii.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==ii?void 0:ii.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==ii?void 0:ii.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==ii?void 0:ii.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==ii?void 0:ii.cognitive_decisioning)}:null,k=0,C=Cn||"";if(u&&C){var P=C.split(/\n{2,}/),w=P.findIndex(function(n){return n.includes(u)});if(-1!==w){var B=Object.entries(ei).filter(function(n){n[0];var i=n[1][L];return i&&P[w].includes(i)}).sort(function(n,i){return P[w].indexOf(n[1][L])-P[w].indexOf(i[1][L])}),F=B.filter(function(n){n[0];var i=n[1][L];return i&&(i.includes(u)||u.includes(i))});F.length>1&&(k=Math.max(0,F.findIndex(function(n){return n[0]===l})))}}var R=rn(K,r);return{id:r,actionId:p,label:f,highlight:u,side:K,style:b,stackIndex:k,score:y,isConnected:Y.has(p),showScrollLockToggle:Y.has(p)||$&&Z===p||!!tn&&tn===R.current,scrollSyncLocked:nn,toggleScrollSyncLocked:en,isOrphan:v,isMissingClause:c,badgeRef:R,onClick:function(i){i.stopPropagation();var e=Gn?n(n({},Gn),{title:(null==jn?void 0:jn.title)||(null==Gn?void 0:Gn.title)||""}):{id:"orphan-left",title:"",content:""},t=Un?n(n({},Un),{title:(null==Mn?void 0:Mn.title)||(null==Un?void 0:Un.title)||""}):{id:"orphan-right",title:"",content:""};an(i,e,v,t,p,b)},onSummaryClick:function(n){n.stopPropagation(),un(n,p,v,_)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),fi=o(function(){var n=new Set;return vi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[vi]),pi=U||!bn&&Sn?fi:[],hi=fi.map(function(n){return n.highlight}).filter(Boolean),mi=vi.find(function(n){return Y.has(n.actionId)}),gi=!!mi;if(!(yn||wn||O.subsections&&0!==O.subsections.length))return null;var xi=(null===(R=null==mi?void 0:mi.style)||void 0===R?void 0:R.badgeBorder)||(null==Xn?void 0:Xn.badgeBorder),yi=gi&&xi?{borderRadius:"4px",outline:"2px solid ".concat(xi),outlineOffset:"1px"}:{};return i(l,yn?n({ref:On,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},yi)},{children:e(d,n({disableGutters:!0,expanded:!Bn&&Rn,onChange:function(){if(!Bn){if(Rn){var i=String(Z||""),e=i.includes(qn)||i.includes(Jn);e||Y.forEach(function(n){(String(n).includes(qn)||String(n).includes(Jn))&&(e=!0)}),e&&(cn(),sn(new Set),vn([]),fn.current=[])}H(function(i){var e;return n(n({},i),((e={})[N]=!i[N],e))})}},sx:{mt:0,boxShadow:"none",border:Bn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Bn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Bn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Fn||"Untitled Subsection"}))})),!Bn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(O.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:M+1,columnKey:K,parentNodeId:L},"".concat(N,"-").concat(e))})]}))]}))}))}):n({ref:On,sx:{mt:0===M?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Bn&&e(l,n({sx:n({width:"100%"},yi)},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(O.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:M+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))}))});export{S as default};
1
+ import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,generateColorPalette as m,isMissingStr as g,DEVIATION_BADGE_SEPARATOR as x}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var S=t.memo(function(t){var I,b,_,k,C,P,w,B,F,O,R=t.section,N=t.keyPath,M=t.depth,j=void 0===M?0:M,E=t.columnKey,K=void 0===E?"left":E,W=t.parentNodeId,L=void 0===W?"":W,z=t.sectionOffset,A=v(),D=A.expandedSubSections,H=A.setExpandedSubSections,T=A.maintainRelativeOrder,G=A.showDeviationBadges,U=void 0!==G&&G,q=A.proposedSections,J=A.existingSections,Q=A.treeData,V=A.deviationNumberRegistry,X=A.deviationParentRegistry,Y=A.connectedSections,Z=A.activeSideBySideSection,$=A.isSideBySide,nn=A.scrollSyncLocked,en=A.toggleScrollSyncLocked,tn=A.summaryPopupAnchorEl,on=A.resolvedMarkdownStyles,ln=A.getSubSectionRef,dn=A.getSubSectionCompareStyle,rn=A.getBadgeRef,an=A.openMoreFunctionsPopup,un=A.openSummaryPopup,cn=A.resetSideBySide,sn=A.setConnectedSections,vn=A.setConnectedLines,fn=A.cachedConnectedPositions,pn=A.isProposingFix,hn=A.proposingFixNodeId,mn=A.isRedlineFlow,gn=A.unifiedNumbering,xn=null!=Z?Z:"",yn=(null===(I=R.displayTitle)||void 0===I||I)&&f(R.title),Sn=!(!pn||!hn||"left"!==K||R.id!==hn&&R.nodeId!==hn),In=p(R.content),bn="boolean"==typeof mn?mn:In,_n=In,kn=bn&&In,Cn=kn?h(R.content):R.content,Pn=kn?R.content:void 0,wn=(null===(b=R.displayContent)||void 0===b||b||In)&&f(R.content),Bn=!yn&&!wn,Fn=yn?R.title:wn?"No Title Found":"No Matching Section Found",On=!!D[N],Rn=ln(K,N),Nn=N.split("-").map(Number)[0],Mn=q[Nn],jn=J[Nn],En=Nn,Kn=Nn,Wn=!1,Ln=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(T)if("left"===K){var zn=null===(_=null==Mn?void 0:Mn.refIndexes)||void 0===_?void 0:_[0],An=J.findIndex(function(n){return n.selfIndex===zn});-1!==An?(jn=J[An],Kn=An):Wn=!0}else{var Dn=null===(k=null==jn?void 0:jn.refIndexes)||void 0===k?void 0:k[0],Hn=q.findIndex(function(n){return n.selfIndex===Dn});-1!==Hn?(Mn=q[Hn],En=Hn):Wn=!0}var Tn=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Ln(n[e],i,String(e));if(t)return t}return null},Gn=null,Un=null,qn="",Jn="";if(T)"left"===K?(Gn=R,qn=N,(Qn=Ln(jn,R.nodeId||R.id,String(Kn)))||(Qn=Tn(J,R.nodeId||R.id)),Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""):(Un=R,Jn=N,(Vn=Ln(Mn,R.nodeId||R.id,String(En)))||(Vn=Tn(q,R.nodeId||R.id)),Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||"");else if("left"===K){Gn=R,qn=N;var Qn=Tn(J,R.nodeId||R.id);Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""}else{Un=R,Jn=N;var Vn=Tn(q,R.nodeId||R.id);Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||""}var Xn=(qn?dn(qn):null)||dn(N),Yn=null===(C=null==Q?void 0:Q.input_index_map)||void 0===C?void 0:C[0],Zn=null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[1],$n="left"===K?Zn:Yn,ni="left"===K?!Un:!Gn,ii=R.evaluationResult||(null==Gn?void 0:Gn.evaluationResult)||(null==Un?void 0:Un.evaluationResult),ei=(null==ii?void 0:ii.deviations)||{},ti=R.nodeId||R.id||(null==Gn?void 0:Gn.nodeId)||(null==Gn?void 0:Gn.id)||(null==Un?void 0:Un.nodeId)||(null==Un?void 0:Un.id);T&&"left"!==K&&(null==Gn?void 0:Gn.id)&&(ti=Gn.nodeId||Gn.id);var oi=Object.keys(ei)[0],li=oi?"".concat(ti).concat(x).concat(oi):null,di=li?null==X?void 0:X[li]:null,ri=Nn+1;if(T&&gn){var ai="left"===K?gn.leftNums.get(null==Mn?void 0:Mn.id):gn.rightNums.get(null==jn?void 0:jn.id);Wn&&void 0!==ai?ri=ai:null!=di&&di>=0?ri=di:void 0!==ai&&(ri=ai)}else null!=di&&di>=0&&(ri=di);var ui=null!==(F=null===(B=null===(w=null==ii?void 0:ii.evaluation_outputs)||void 0===w?void 0:w.metadata)||void 0===B?void 0:B.label_color)&&void 0!==F?F:y,ci=m(ui).highlightBg,si=Object.entries(ei).map(function(n){var i=n[0],e=n[1],t="".concat(ti).concat(x).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:V[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});si.sort(function(n,i){return n.currentIndex-i.currentIndex});var vi=si.map(function(i){var e,t,o,l=i.deviationKey,d=i.deviationMap,r=i.refId,a=i.currentIndex;T&&void 0!==z&&(a-=z),a=Math.max(1,a);var u=d[L],c=g(u);if(c)u="";else if(!u)return null;var s=d[$n],v=ni||g(s),f="".concat(ri,".").concat(a),p="".concat(ti).concat(x).concat(l).concat(x).concat(qn).concat(x).concat(Jn),h=(null==d?void 0:d.evaluation_outputs)||(null==ii?void 0:ii.evaluation_outputs),y=null!==(e=null==h?void 0:h.output_value)&&void 0!==e?e:null,S=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:ui,I=m(S),b=n({},I),_=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==ii?void 0:ii.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==ii?void 0:ii.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==ii?void 0:ii.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==ii?void 0:ii.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==ii?void 0:ii.cognitive_decisioning)}:null,k=0,C=Cn||"";if(u&&C){var P=C.split(/\n{2,}/),w=P.findIndex(function(n){return n.includes(u)});if(-1!==w){var B=Object.entries(ei).filter(function(n){n[0];var i=n[1][L];return i&&P[w].includes(i)}).sort(function(n,i){return P[w].indexOf(n[1][L])-P[w].indexOf(i[1][L])}),F=B.filter(function(n){n[0];var i=n[1][L];return i&&(i.includes(u)||u.includes(i))});F.length>1&&(k=Math.max(0,F.findIndex(function(n){return n[0]===l})))}}var O=rn(K,r);return{id:r,actionId:p,label:f,highlight:u,side:K,style:b,stackIndex:k,score:y,isConnected:Y.has(p),showScrollLockToggle:Y.has(p)||$&&Z===p||!!tn&&tn===O.current,scrollSyncLocked:nn,toggleScrollSyncLocked:en,isOrphan:v,isMissingClause:c,badgeRef:O,onClick:function(i){i.stopPropagation();var e=Gn?n(n({},Gn),{title:(null==Mn?void 0:Mn.title)||(null==Gn?void 0:Gn.title)||""}):{id:"orphan-left",title:"",content:""},t=Un?n(n({},Un),{title:(null==jn?void 0:jn.title)||(null==Un?void 0:Un.title)||""}):{id:"orphan-right",title:"",content:""};an(i,e,v,t,p,b)},onSummaryClick:function(n){n.stopPropagation(),un(n,p,v,_)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),fi=o(function(){var n=new Set;return vi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[vi]),pi=U||!bn&&Sn?fi:[],hi=fi.map(function(n){return n.highlight}).filter(Boolean),mi=vi.find(function(n){return Y.has(n.actionId)}),gi=!!mi;if(!(yn||wn||R.subsections&&0!==R.subsections.length))return null;var xi=(null===(O=null==mi?void 0:mi.style)||void 0===O?void 0:O.badgeBorder)||(null==Xn?void 0:Xn.badgeBorder),yi=gi&&xi?{borderRadius:"4px",outline:"2px solid ".concat(xi),outlineOffset:"1px"}:{};return i(l,yn?n({ref:Rn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},yi)},{children:e(d,n({disableGutters:!0,expanded:!Bn&&On,onChange:function(){if(!Bn){if(On){var i=String(Z||""),e=i.includes(qn)||i.includes(Jn);e||Y.forEach(function(n){(String(n).includes(qn)||String(n).includes(Jn))&&(e=!0)}),e&&(cn(),sn(new Set),vn([]),fn.current=[])}H(function(i){var e;return n(n({},i),((e={})[N]=!i[N],e))})}},sx:{mt:0,boxShadow:"none",border:Bn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Bn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Bn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Fn||"Untitled Subsection"}))})),!Bn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))]}))}))}):n({ref:Rn,sx:{mt:0===j?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Bn&&e(l,n({sx:n({width:"100%"},yi)},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))}))});export{S as default};
2
2
  //# sourceMappingURL=SubSectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- import{useState as t,useRef as e,useCallback as n,useEffect as i}from"react";import{DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var c=function(c){var o=c.containerRef,l=c.leftContainerRef,u=c.rightContainerRef;c.svgContainerRef;var a=c.pathRefs,d=c.leftHeaderRef,s=c.rightHeaderRef,v=c.proposedSections,h=c.existingSections,g=c.visibleFields,f=c.leftRefs,p=c.rightRefs,b=c.sectionLeftRefs,y=c.sectionRightRefs,x=c.subSectionLeftRefs,m=c.subSectionRightRefs,R=c.lhsBadgeRefs,C=c.rhsBadgeRefs,A=c.sectionRowRefs,B=c.expandedSections,S=c.expandedSubSections,M=c.connectedSections,T=c.isSideBySide,I=c.activeSideBySideSection,L=c.maintainRelativeOrder,F=c.isGuidelineMode,H=c.cognitiveMap,w=c.getSectionCompareStyle,k=c.getSubSectionCompareStyle,E=c.getDeviationStyleByKey,N=c.isArrowVisible,Y=c.isAnimatingRef,D=c.isSideBySideRef,j=c.sideBySideCacheRef,O=c.sideBySideLineRef,z=c.activeSideBySideSectionRef,P=c.activeSideBySideRightSectionRef,Q=c.connectedLines,X=c.setConnectedLines,q=c.cachedConnectedPositions,G=c.calculateLinesRef,K=c.resizeTimerRef,V=c.scrollLock,J=c.scrollSyncLocked,U=c.handleResizeRef,W=c.activeProposed,Z=c.existingRule,$=c.analysisData,_=c.pendingScrollTargetRef,tt=c.pendingScrollCallbackRef,et=c.resolvedComparisonConfig,nt=c.getFieldData,it=t([]),rt=it[0],ct=it[1],ot=t(null),lt=ot[0],ut=ot[1],at=t([]),dt=at[0],st=at[1],vt=null!=Q?Q:dt,ht=null!=X?X:st,gt=t({width:0,height:0}),ft=gt[0],pt=gt[1],bt=e(!1),yt=e(!1),xt=e(!1),mt=e(null),Rt=e([]),Ct=null!=q?q:Rt,At=function(t,e,n,i,r,c,o){if(Math.abs(i-e)<=1)return c&&o?"M ".concat(t,",").concat(e," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r,",").concat(e):!c&&o?"M ".concat(r,",").concat(e," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i);var l=Math.min(15,Math.abs(r-t),Math.abs(i-e)/2),u=Math.min(15,Math.abs(n-r),Math.abs(i-e)/2),a=i>e?l:-l,d=i>e?u:-u,s=n>r?u:-u;return c&&o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i):!c&&o?"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i)},Bt=n(function(){var t,e,n,i,c,a,A,N,D,j,O,z,P,Q,X,q,G,K;if(!bt.current&&!Y.current){bt.current=!0;try{if(!o.current)return;var V=function(t){var e=t.split("-"),n=e[0];if(!B[n]&&!1===L)return!1;if(L&&!B["left-".concat(n)]&&!B["right-".concat(n)]&&!B[n])return!1;for(var i=n,r=1;r<e.length-1;r++)if(i+="-".concat(e[r]),!S[i])return!1;return!0},J=o.current.getBoundingClientRect();pt({width:J.width,height:J.height});var U=[];if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;r&&c&&(r.style.height="auto",c.style.height="auto",r.style.minHeight="0px",c.style.minHeight="0px")}),!Y.current){for(var W=0;W<Math.max(v.length,h.length);W++){var Z=null===(t=b.current[W])||void 0===t?void 0:t.current,$=null===(e=y.current[W])||void 0===e?void 0:e.current;Z&&(Z.style.height="auto",Z.style.minHeight="0px"),$&&($.style.height="auto",$.style.minHeight="0px")}L||Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var _={};g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=r.getBoundingClientRect(),l=c.getBoundingClientRect();_[i]=Math.max(o.height,l.height)}});var tt={left:{},right:{}},et={};if(!Y.current)if(L){if(T&&null!==I)if("number"==typeof I){var nt=I,it=v[nt],rt=null===(c=b.current[nt])||void 0===c?void 0:c.current;rt&&it&&(it.refIndexes||[]).forEach(function(t){var e,n=h.findIndex(function(e){return e.selfIndex===t}),i=null===(e=y.current[n])||void 0===e?void 0:e.current;if(i&&(B["left-".concat(nt)]||B["right-".concat(n)])){var r=Math.max(rt.getBoundingClientRect().height,i.getBoundingClientRect().height);tt.left[nt]=Math.max(tt.left[nt]||0,r),tt.right[n]=Math.max(tt.right[n]||0,r)}})}else{var ot=I.split(r)[2];if(ot){Z=null===(a=x.current[ot])||void 0===a?void 0:a.current,$=null===(A=m.current[ot])||void 0===A?void 0:A.current;if(Z&&$){lt=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);et[ot]=Math.max(et[ot]||0,lt)}}}}else{Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var c=i.getBoundingClientRect(),o=r.getBoundingClientRect(),l=Math.max(c.height,o.height);et[t]=l,i.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}});for(W=0;W<Math.min(v.length,h.length);W++){var Z=null===(n=b.current[W])||void 0===n?void 0:n.current,$=null===(i=y.current[W])||void 0===i?void 0:i.current;if(Z&&$){var lt=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);tt.left[W]=lt,tt.right[W]=lt}}}if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=_[i];r.style.minHeight="".concat(o,"px"),c.style.minHeight="".concat(o,"px")}}),Y.current||(Object.entries(tt.left).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=b.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(tt.right).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=y.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),L||Object.keys(et).forEach(function(t){var e,n,i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&et[t]){var c=et[t];i.style.minHeight="".concat(c,"px"),r.style.minHeight="".concat(c,"px")}})),!F){v.forEach(function(t,e){var n,i=null===(n=b.current[e])||void 0===n?void 0:n.current;if(i){var r=function(t,e){var n=(t.refIndexes||[]).map(function(t){return h.findIndex(function(e){return e.selfIndex===t})}).filter(function(t){return-1!==t});return!n.length&&h[e]?[e]:Array.from(new Set(n))}(t,e);r.forEach(function(n){var r,c,o,a,d,s,v,g,f,p,b=null===(r=y.current[n])||void 0===r?void 0:r.current;if(b){var x=i.getBoundingClientRect(),m=b.getBoundingClientRect(),R=x.right-J.left,C=m.left-J.left,A=x.top+18-J.top,B=m.top+18-J.top;if(L&&T&&I===e){var S=null!==(o=null===(c=l.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==o?o:0,M=null!==(d=null===(a=u.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,F=S+(null!==(v=null===(s=l.current)||void 0===s?void 0:s.clientHeight)&&void 0!==v?v:1/0),k=M+(null!==(f=null===(g=u.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0),E=function(t,e,n){return Math.max(e,Math.min(n,t))};A=E(x.top+18,S,F)-J.top,B=E(m.top+18,M,k)-J.top}var N=w(e);N&&U.push({id:"line-".concat(e,"-").concat(n),x1:R,y1:A,x2:C,y2:B,style:N,sectionIdx:e,targetRightIdx:n,isSubSection:!1,hasCognitive:!!((null==t?void 0:t.cognitiveData)||(null===(p=h[n])||void 0===p?void 0:p.cognitiveData)||(null==t?void 0:t.nodeId)&&H[t.nodeId])})}})}})}if(!F&&T&&"string"==typeof I&&I.includes(r)){var at=I.split(r),dt=at[0],st=at[1],vt=at[2],gt=(at[3],"".concat(dt).concat(r).concat(st)),ft=null===(N=R.current[gt])||void 0===N?void 0:N.current,yt=null===(D=C.current[gt])||void 0===D?void 0:D.current;if(ft&&yt){var xt=ft.getBoundingClientRect(),mt=yt.getBoundingClientRect(),Rt=xt.right-J.left,Bt=mt.left-J.left,Mt=xt.top+xt.height/2-J.top,Tt=mt.top+mt.height/2-J.top;if(L){var It=null!==(O=null===(j=l.current)||void 0===j?void 0:j.getBoundingClientRect().top)&&void 0!==O?O:0,Lt=null!==(P=null===(z=u.current)||void 0===z?void 0:z.getBoundingClientRect().top)&&void 0!==P?P:0,Ft=It+(null!==(X=null===(Q=l.current)||void 0===Q?void 0:Q.clientHeight)&&void 0!==X?X:1/0),Ht=Lt+(null!==(G=null===(q=u.current)||void 0===q?void 0:q.clientHeight)&&void 0!==G?G:1/0),wt=function(t,e,n){return Math.max(e,Math.min(n,t))};Mt=wt(xt.top+xt.height/2,It,Ft)-J.top,Tt=wt(mt.top+mt.height/2,Lt,Ht)-J.top}var kt=null!==(K=E(dt,st))&&void 0!==K?K:k(vt);kt&&U.push({id:"line-subsec-".concat(gt),x1:Rt,y1:Mt,x2:Bt,y2:Tt,style:kt,sectionIdx:Number(vt.split("-")[0]),isSubSection:!0,subSectionKeyPath:I})}}if(ct(U),d.current&&s.current){var Et=d.current.getBoundingClientRect(),Nt=s.current.getBoundingClientRect(),Yt=(Et.top+Et.height/2-J.top+Nt.top+Nt.height/2-J.top)/2;ut({x1:Et.right-J.left,x2:Nt.left-J.left,y:Yt})}else ut(null);if(M.size>0){var Dt=[],jt=l.current,Ot=u.current;if(jt&&Ot){var zt=[],Pt=jt.getBoundingClientRect().top,Qt=Ot.getBoundingClientRect().top,Xt=Pt+jt.clientHeight,qt=Qt+Ot.clientHeight,Gt=jt.scrollTop,Kt=Ot.scrollTop,Vt=J.top,Jt=function(t,e,n){return Math.max(e,Math.min(n,t))};M.forEach(function(t){var e,n,i,c,o,l,u,a,d;if(F){var s=null,g=null,f=null;if("string"==typeof t&&t.includes(r)){var p=t.split(r),b=p[0],y=p[1],x=p[2],m="".concat(b).concat(r).concat(y);s=null===(e=R.current[m])||void 0===e?void 0:e.current,f=null!==(n=E(b,y))&&void 0!==n?n:k(x),g=Number((null==x?void 0:x.split("-")[0])||0)}else g=Number(t),s=null===(i=R.current[g])||void 0===i?void 0:i.current,f=w(g);if(!s)return;document.querySelectorAll('[id^="guideline-target-"]').forEach(function(e,n){var i=s.getBoundingClientRect(),c=e.getBoundingClientRect(),o=i.right-J.left,l=c.left-J.left-0,u=o+75,a=i.top+i.height/2,d=c.top+c.height/2,v=a-Pt+Gt,h=d-Qt+Kt,g="conn-guide-".concat(t,"-").concat(n),p="";"string"==typeof t&&t.includes(r)?p=(t.split(r)[2]||"").split("-").map(function(t){return Number(t)+1}).join("."):p=String(Number(t)+1);var b=String.fromCharCode(97+n),y="".concat(p,"(").concat(b,")");zt.push({lhsScrollY:v,rhsScrollY:h,x1:o,x2:l,containerTop:Vt,leftIdx:t,rhsArrayIdx:n,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleBg:(null==f?void 0:f.badgeBg)||"#FFFFFF",styleText:(null==f?void 0:f.badgeText)||"#A16207",styleId:g,centerX:u});var x=Jt(a,Pt,Xt),m=Jt(d,Qt,qt),R=x-Vt,C=m-Vt,A=At(o,R,l,C,u,a>=Pt-4&&a<=Xt+4,d>=Qt-4&&d<=qt+4);Dt.push({id:g,pathD:A,style:f,leftIdx:t,rhsArrayIdx:n,x1:o,x2:l,y1:R,y2:C,centerX:u,matchLabel:y,isGuideline:!0})})}else if("string"==typeof t&&t.includes(r)){var A=t.split(r),B=(b=A[0],y=A[1],x=A[2],A[3],m="".concat(b).concat(r).concat(y),null===(c=R.current[m])||void 0===c?void 0:c.current),S=null===(o=C.current[m])||void 0===o?void 0:o.current;if(!B||!S)return;var M=B.getBoundingClientRect(),T=S.getBoundingClientRect(),I=null!==(l=E(b,y))&&void 0!==l?l:k(x),H=M.right-J.left,N=T.left-J.left-0,Y=H+75,D=M.top+M.height/2,j=T.top+T.height/2,O=D-Pt+Gt,z=j-Qt+Kt,P="conn-subsec-".concat(m),Q=(x||"").split("-").map(function(t){return Number(t)+1}).join("."),X="".concat(Q,"(a)");zt.push({lhsScrollY:O,rhsScrollY:z,x1:H,x2:N,containerTop:Vt,leftIdx:t,rhsArrayIdx:t,styleColor:(null==I?void 0:I.badgeBorder)||"#6366F1",styleBg:(null==I?void 0:I.badgeBg)||"#FFFFFF",styleText:(null==I?void 0:I.badgeText)||"#A16207",styleId:P,centerX:Y});var q=Jt(D,Pt,Xt),G=Jt(j,Qt,qt),K=At(H,$=q-Vt,N,_=G-Vt,Y,D>=Pt-4&&D<=Xt+4,j>=Qt-4&&j<=qt+4);Dt.push({id:P,pathD:K,style:I,leftIdx:t,rhsArrayIdx:t,x1:H,x2:N,y1:$,y2:_,matchLabel:X})}else if(L){var V=t,U=v[V];if(!(null===(d=null==U?void 0:U.refIndexes)||void 0===d?void 0:d.length))return;U.refIndexes.forEach(function(e,n){var i,r,c=h.findIndex(function(t){return t.selfIndex===e});if(-1!==c){var o=null===(i=R.current[V])||void 0===i?void 0:i.current,l=null===(r=C.current[c])||void 0===r?void 0:r.current;if(o&&l){var u=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=w(V),s=u.right-J.left,v=a.left-J.left-0,g=s+75,f=u.top+u.height/2,p=a.top+a.height/2,b=f-Pt+Gt,y=p-Qt+Kt,x="conn-".concat(V,"-").concat(c),m=String(Number(t)+1),A=String.fromCharCode(97+n),B="".concat(m,"(").concat(A,")");zt.push({lhsScrollY:b,rhsScrollY:y,x1:s,x2:v,containerTop:Vt,leftIdx:V,rhsArrayIdx:c,styleColor:(null==d?void 0:d.badgeBorder)||"#6366F1",styleBg:(null==d?void 0:d.badgeBg)||"#FFFFFF",styleText:(null==d?void 0:d.badgeText)||"#A16207",styleId:x,centerX:g});var S=Jt(f,Pt,Xt),M=Jt(p,Qt,qt),T=S-Vt,I=M-Vt,L=At(s,T,v,I,g,f>=Pt-4&&f<=Xt+4,p>=Qt-4&&p<=qt+4);Dt.push({id:x,pathD:L,style:d,leftIdx:V,rhsArrayIdx:c,x1:s,x2:v,y1:T,y2:I,matchLabel:B})}}})}else{var W=t,Z=W;B=null===(u=R.current[W])||void 0===u?void 0:u.current,S=null===(a=C.current[Z])||void 0===a?void 0:a.current;if(!B||!S)return;M=B.getBoundingClientRect(),T=S.getBoundingClientRect(),I=w(W),H=M.right-J.left,N=T.left-J.left-0,Y=H+75,D=M.top+M.height/2,j=T.top+T.height/2,O=D-Pt+Gt,z=j-Qt+Kt,P="conn-".concat(W,"-").concat(Z),Q=String(Number(t)+1),X="".concat(Q,"(a)");zt.push({lhsScrollY:O,rhsScrollY:z,x1:H,x2:N,containerTop:Vt,leftIdx:W,rhsArrayIdx:Z,styleColor:(null==I?void 0:I.badgeBorder)||"#6366F1",styleBg:(null==I?void 0:I.badgeBg)||"#FFFFFF",styleText:(null==I?void 0:I.badgeText)||"#A16207",styleId:P,centerX:Y});var $,_;q=Jt(D,Pt,Xt),G=Jt(j,Qt,qt),K=At(H,$=q-Vt,N,_=G-Vt,Y,D>=Pt-4&&D<=Xt+4,j>=Qt-4&&j<=qt+4);Dt.push({id:P,pathD:K,style:I,leftIdx:W,rhsArrayIdx:Z,x1:H,x2:N,y1:$,y2:_,matchLabel:X})}}),Ct.current=zt}ht(Dt),setTimeout(function(){return St()},10)}else ht([]),Ct.current=[],setTimeout(function(){return St()},10)}catch(t){console.error("Line render safe fail: ",t)}finally{bt.current=!1}}},[g,v,h,H,et,nt,w,E,L,T,I,M,B,S,F]),St=n(function(){var t,e,n,i,r,c,d,s,v,h,g,f,p,b,y,x,m,R,C,A=Ct.current;if(!A.length)return null===(t=a.current["guideline-up-stroke"])||void 0===t||t.setAttribute("visibility","hidden"),null===(e=a.current["guideline-up-badge"])||void 0===e||e.setAttribute("visibility","hidden"),null===(n=a.current["guideline-down-stroke"])||void 0===n||n.setAttribute("visibility","hidden"),void(null===(i=a.current["guideline-down-badge"])||void 0===i||i.setAttribute("visibility","hidden"));if(!Y.current){var B=null!==(c=null===(r=l.current)||void 0===r?void 0:r.scrollTop)&&void 0!==c?c:0,S=null!==(s=null===(d=u.current)||void 0===d?void 0:d.scrollTop)&&void 0!==s?s:0,M=null!==(h=null===(v=l.current)||void 0===v?void 0:v.clientHeight)&&void 0!==h?h:1/0,T=null!==(f=null===(g=u.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0,I=null!==(b=null===(p=l.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==b?b:0,L=null!==(x=null===(y=u.current)||void 0===y?void 0:y.getBoundingClientRect().top)&&void 0!==x?x:0,F=I+M,H=L+T,w=null===(m=o.current)||void 0===m?void 0:m.getBoundingClientRect(),k=null!==(R=null==w?void 0:w.top)&&void 0!==R?R:0,E=null!==(C=null==w?void 0:w.height)&&void 0!==C?C:1/0,N=function(t,e,n){return Math.max(e,Math.min(n,t))},D=0,j=0,O=0,z=0,P="#6366F1",Q="#A16207",X=!1;if(A.forEach(function(t){var e=t.lhsScrollY-B+I,n=t.rhsScrollY-S+L,i=a.current[t.styleId+"-stroke"],r=a.current[t.styleId+"-bg"],c=a.current[t.styleId+"-btn"],o=a.current[t.styleId+"-number"];if(i||r){var l=N(e,I,F),u=N(n,L,H),d=l-k,s=u-k,v=e>=I-4&&e<=F+4,h=n>=L-4&&n<=H+4,g=!0;X=!0;var f=t.centerX||t.x1+75;0===O&&(O=t.x1,z=d,P=t.styleColor,t.styleBg,Q=t.styleText||"#A16207"),n<L-4?(D++,g=!1):n>H+4&&(j++,g=!1);var p=At(t.x1,d,t.x2,s,f,v,h);i&&(g&&p?(i.setAttribute("visibility","visible"),i.setAttribute("d",p)):i.setAttribute("visibility","hidden")),r&&(g&&p?(r.setAttribute("visibility","visible"),r.setAttribute("d",p)):r.setAttribute("visibility","hidden")),c&&(v&&g?(c.setAttribute("visibility","visible"),c.setAttribute("y",String(d-12))):c.setAttribute("visibility","hidden")),o&&(v&&g?(o.setAttribute("visibility","visible"),o.setAttribute("transform","translate(".concat(t.x2-42,", ").concat(s,")"))):o.setAttribute("visibility","hidden"))}}),X){var q=a.current["guideline-up-stroke"],G=a.current["guideline-up-badge"],K=a.current["guideline-up-arrow"],V=a.current["guideline-up-text"],J=a.current["guideline-up-badge-rect"],U=O+75;if(D>0){var W=Math.max(15,L-k+15),Z=Math.min(15,Math.abs(U-O),Math.max(0,z-W)),$="M ".concat(O,",").concat(z," L ").concat(U-Z,",").concat(z," Q ").concat(U,",").concat(z," ").concat(U,",").concat(z-Z," L ").concat(U,",").concat(W);null==q||q.setAttribute("visibility","visible"),null==q||q.setAttribute("d",$),null==q||q.setAttribute("stroke",P),null==G||G.setAttribute("visibility","visible"),null==G||G.setAttribute("transform","translate(".concat(U,", ").concat(W,")")),K&&K.setAttribute("fill",P),V&&(V.textContent="+".concat(D),V.setAttribute("fill",Q)),J&&J.setAttribute("stroke",P)}else null==q||q.setAttribute("visibility","hidden"),null==G||G.setAttribute("visibility","hidden");var _=a.current["guideline-down-stroke"],tt=a.current["guideline-down-badge"],et=a.current["guideline-down-arrow"],nt=a.current["guideline-down-text"],it=a.current["guideline-down-badge-rect"];if(j>0){var rt=Math.min(E-15,H-k-15);Z=Math.min(15,Math.abs(U-O),Math.max(0,rt-z)),$="M ".concat(O,",").concat(z," L ").concat(U-Z,",").concat(z," Q ").concat(U,",").concat(z," ").concat(U,",").concat(z+Z," L ").concat(U,",").concat(rt);null==_||_.setAttribute("visibility","visible"),null==_||_.setAttribute("d",$),null==_||_.setAttribute("stroke",P),null==tt||tt.setAttribute("visibility","visible"),null==tt||tt.setAttribute("transform","translate(".concat(U,", ").concat(rt,")")),et&&et.setAttribute("fill",P),nt&&(nt.textContent="+".concat(j),nt.setAttribute("fill",Q)),it&&it.setAttribute("stroke",P)}else null==_||_.setAttribute("visibility","hidden"),null==tt||tt.setAttribute("visibility","hidden")}}},[]),Mt=n(function(){Ct.current.length>0&&!Y.current||(null!==mt.current&&clearTimeout(mt.current),mt.current=setTimeout(function(){G.current(),mt.current=null},50))},[]),Tt=n(function(t){if(null!==_.current&&tt.current&&Math.abs(t.currentTarget.scrollTop-_.current)<=2){var e=tt.current;_.current=null,tt.current=null,e()}if(!xt.current&&!V.current){if(L&&J&&(D.current||M.size>0)){var n=t.currentTarget,i=l.current,c=u.current,a=n===i?c:n===c?i:null;if(n&&a){var d=function(){var t,e,n,i,c,o,l,u,a,d,s,v=z.current,h=P.current;if(null===v)return{leftAnchor:null,rightAnchor:null};if("string"==typeof v&&v.includes(r)){var g=v.split(r),f="".concat(g[0]).concat(r).concat(g[1]);return{leftAnchor:(null===(t=R.current[f])||void 0===t?void 0:t.current)||(null===(e=x.current[g[2]])||void 0===e?void 0:e.current)||(null===(n=b.current[Number(g[2])])||void 0===n?void 0:n.current)||null,rightAnchor:(null===(i=C.current[f])||void 0===i?void 0:i.current)||(null===(c=m.current[g[3]])||void 0===c?void 0:c.current)||(null===(o=y.current[Number(g[3])])||void 0===o?void 0:o.current)||null}}var p=Number(v),B=null!==h?Number(h):p;return{leftAnchor:(null===(l=R.current[p])||void 0===l?void 0:l.current)||(null===(u=A.current[p])||void 0===u?void 0:u.current)||(null===(a=b.current[p])||void 0===a?void 0:a.current)||null,rightAnchor:(null===(d=C.current[B])||void 0===d?void 0:d.current)||(null===(s=y.current[B])||void 0===s?void 0:s.current)||null}}(),s=d.leftAnchor,v=d.rightAnchor,h=n===i?s:v,g=n===i?v:s,f=null;if(h&&g){var p=h.getBoundingClientRect(),B=g.getBoundingClientRect(),S=a.getBoundingClientRect(),T=p.top+p.height/2;f=B.top-S.top+a.scrollTop+B.height/2-(T-S.top)}else{var I=Math.max(0,n.scrollHeight-n.clientHeight),F=Math.max(0,a.scrollHeight-a.clientHeight);f=I>0?n.scrollTop/I*F:n.scrollTop}var H=Math.max(0,a.scrollHeight-a.clientHeight);f=Math.max(0,Math.min(f,H)),Math.abs(a.scrollTop-f)>1&&(xt.current=!0,a.scrollTop=f,requestAnimationFrame(function(){xt.current=!1}))}}L||Mt(),yt.current||(yt.current=!0,requestAnimationFrame(function(){var t,e,n,i,c,a,d;if(D.current){var s=l.current,v=u.current;if(s&&v&&O.current){if(!j.current){var h=z.current,g=void 0;if("string"==typeof h&&h.includes(r)){var f=h.split(r),p="".concat(f[0]).concat(r).concat(f[1]);g=null===(t=R.current[p])||void 0===t?void 0:t.current}else g=null===(e=R.current[h])||void 0===e?void 0:e.current;if(g){var b=g.getBoundingClientRect();j.current={badgeScreenY:b.top+b.height/2,initialScrollTop:s.scrollTop,leftTop:s.getBoundingClientRect().top,leftBottom:s.getBoundingClientRect().top+s.clientHeight,cTop:null!==(i=null===(n=o.current)||void 0===n?void 0:n.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(j.current){var y=j.current,x=s.scrollTop-y.initialScrollTop,m=y.badgeScreenY-x,C=((c=m,a=y.leftTop,d=y.leftBottom,Math.max(a,Math.min(d,c)))-y.cTop).toString(),A=m>=y.leftTop-4&&m<=y.leftBottom+4;O.current.setAttribute("y1",C),O.current.setAttribute("y2",C),O.current.setAttribute("visibility",A?"visible":"hidden")}}}St(),yt.current=!1}))}},[St,L,J,M,Mt]);return i(function(){G.current=Bt},[Bt]),i(function(){var t=setTimeout(Mt,250),e=function(){return U.current()};return window.addEventListener("resize",e),function(){clearTimeout(t),null!==mt.current&&clearTimeout(mt.current),null!==K.current&&clearTimeout(K.current),window.removeEventListener("resize",e)}},[W,Z,$,g,B,S,v,h,et,Mt,T,I,N,M]),{lines:rt,setLines:ct,overallConnector:lt,setOverallConnector:ut,connectedLines:vt,setConnectedLines:ht,svgDimensions:ft,cachedConnectedPositions:Ct,calculateLines:Bt,calculateLinesRef:G,calculateLinesDebounced:Mt,handleColumnScroll:Tt}};export{c as useLinesCalculator};
1
+ import{useState as t,useRef as e,useCallback as n,useEffect as i}from"react";import{DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var c=function(c){var l=c.containerRef,o=c.leftContainerRef,u=c.rightContainerRef;c.svgContainerRef;var a=c.pathRefs,d=c.leftHeaderRef,s=c.rightHeaderRef,v=c.proposedSections,h=c.existingSections,g=c.visibleFields,f=c.leftRefs,p=c.rightRefs,b=c.sectionLeftRefs,y=c.sectionRightRefs,x=c.subSectionLeftRefs,m=c.subSectionRightRefs,R=c.lhsBadgeRefs,C=c.rhsBadgeRefs,A=c.sectionRowRefs,B=c.expandedSections,S=c.expandedSubSections,M=c.connectedSections,T=c.isSideBySide,I=c.activeSideBySideSection,L=c.maintainRelativeOrder,F=c.isGuidelineMode,H=c.cognitiveMap,w=c.getSectionCompareStyle,k=c.getSubSectionCompareStyle,E=c.getDeviationStyleByKey,N=c.isArrowVisible,Y=c.isAnimatingRef,D=c.isSideBySideRef,j=c.sideBySideCacheRef,O=c.sideBySideLineRef,z=c.activeSideBySideSectionRef,P=c.activeSideBySideRightSectionRef,Q=c.connectedLines,X=c.setConnectedLines,q=c.cachedConnectedPositions,G=c.calculateLinesRef,K=c.resizeTimerRef,V=c.scrollLock,J=c.scrollSyncLocked,U=c.handleResizeRef,W=c.activeProposed,Z=c.existingRule,$=c.analysisData,_=c.pendingScrollTargetRef,tt=c.pendingScrollCallbackRef,et=c.resolvedComparisonConfig,nt=c.getFieldData,it=t([]),rt=it[0],ct=it[1],lt=t(null),ot=lt[0],ut=lt[1],at=t([]),dt=at[0],st=at[1],vt=null!=Q?Q:dt,ht=null!=X?X:st,gt=t({width:0,height:0}),ft=gt[0],pt=gt[1],bt=e(!1),yt=e(!1),xt=e(!1),mt=e(null),Rt=e([]),Ct=null!=q?q:Rt,At=function(t,e,n,i,r,c,l){if(Math.abs(i-e)<=1)return c&&l?"M ".concat(t,",").concat(e," L ").concat(n,",").concat(i):c&&!l?"M ".concat(t,",").concat(e," L ").concat(r,",").concat(e):!c&&l?"M ".concat(r,",").concat(e," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i);var o=Math.min(15,Math.abs(r-t),Math.abs(i-e)/2),u=Math.min(15,Math.abs(n-r),Math.abs(i-e)/2),a=i>e?o:-o,d=i>e?u:-u,s=n>r?u:-u;return c&&l?"M ".concat(t,",").concat(e," L ").concat(r-o,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):c&&!l?"M ".concat(t,",").concat(e," L ").concat(r-o,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i):!c&&l?"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i)},Bt=n(function(){var t,e,n,i,c,a,A,N,D,j,O,z,P,Q,X,q,G,K;if(!bt.current&&!Y.current){bt.current=!0;try{if(!l.current)return;var V=function(t){var e=t.split("-"),n=e[0];if(!B[n]&&!1===L)return!1;if(L&&!B["left-".concat(n)]&&!B["right-".concat(n)]&&!B[n])return!1;for(var i=n,r=1;r<e.length-1;r++)if(i+="-".concat(e[r]),!S[i])return!1;return!0},J=l.current.getBoundingClientRect();pt({width:J.width,height:J.height});var U=[];if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;r&&c&&(r.style.height="auto",c.style.height="auto",r.style.minHeight="0px",c.style.minHeight="0px")}),!Y.current){for(var W=0;W<Math.max(v.length,h.length);W++){var Z=null===(t=b.current[W])||void 0===t?void 0:t.current,$=null===(e=y.current[W])||void 0===e?void 0:e.current;Z&&(Z.style.height="auto",Z.style.minHeight="0px"),$&&($.style.height="auto",$.style.minHeight="0px")}L||Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var _={};g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var l=r.getBoundingClientRect(),o=c.getBoundingClientRect();_[i]=Math.max(l.height,o.height)}});var tt={left:{},right:{}},et={};if(!Y.current)if(L){if(T&&null!==I)if("number"==typeof I){var nt=I,it=v[nt],rt=null===(c=b.current[nt])||void 0===c?void 0:c.current;rt&&it&&(it.refIndexes||[]).forEach(function(t){var e,n=h.findIndex(function(e){return e.selfIndex===t}),i=null===(e=y.current[n])||void 0===e?void 0:e.current;if(i&&(B["left-".concat(nt)]||B["right-".concat(n)])){var r=Math.max(rt.getBoundingClientRect().height,i.getBoundingClientRect().height);tt.left[nt]=Math.max(tt.left[nt]||0,r),tt.right[n]=Math.max(tt.right[n]||0,r)}})}else{var lt=I.split(r)[2];if(lt){Z=null===(a=x.current[lt])||void 0===a?void 0:a.current,$=null===(A=m.current[lt])||void 0===A?void 0:A.current;if(Z&&$){ot=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);et[lt]=Math.max(et[lt]||0,ot)}}}}else{Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var c=i.getBoundingClientRect(),l=r.getBoundingClientRect(),o=Math.max(c.height,l.height);et[t]=o,i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}}});for(W=0;W<Math.min(v.length,h.length);W++){var Z=null===(n=b.current[W])||void 0===n?void 0:n.current,$=null===(i=y.current[W])||void 0===i?void 0:i.current;if(Z&&$){var ot=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);tt.left[W]=ot,tt.right[W]=ot}}}if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var l=_[i];r.style.minHeight="".concat(l,"px"),c.style.minHeight="".concat(l,"px")}}),Y.current||(Object.entries(tt.left).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=b.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(tt.right).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=y.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),L||Object.keys(et).forEach(function(t){var e,n,i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&et[t]){var c=et[t];i.style.minHeight="".concat(c,"px"),r.style.minHeight="".concat(c,"px")}})),!F){v.forEach(function(t,e){var n,i=null===(n=b.current[e])||void 0===n?void 0:n.current;if(i){var r=function(t,e){var n=(t.refIndexes||[]).map(function(t){return h.findIndex(function(e){return e.selfIndex===t})}).filter(function(t){return-1!==t});return!n.length&&h[e]?[e]:Array.from(new Set(n))}(t,e);r.forEach(function(n){var r,c,l,a,d,s,v,g,f,p,b=null===(r=y.current[n])||void 0===r?void 0:r.current;if(b){var x=i.getBoundingClientRect(),m=b.getBoundingClientRect(),R=x.right-J.left,C=m.left-J.left,A=x.top+18-J.top,B=m.top+18-J.top;if(L&&T&&I===e){var S=null!==(l=null===(c=o.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==l?l:0,M=null!==(d=null===(a=u.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,F=S+(null!==(v=null===(s=o.current)||void 0===s?void 0:s.clientHeight)&&void 0!==v?v:1/0),k=M+(null!==(f=null===(g=u.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0),E=function(t,e,n){return Math.max(e,Math.min(n,t))};A=E(x.top+18,S,F)-J.top,B=E(m.top+18,M,k)-J.top}var N=w(e);N&&U.push({id:"line-".concat(e,"-").concat(n),x1:R,y1:A,x2:C,y2:B,style:N,sectionIdx:e,targetRightIdx:n,isSubSection:!1,hasCognitive:!!((null==t?void 0:t.cognitiveData)||(null===(p=h[n])||void 0===p?void 0:p.cognitiveData)||(null==t?void 0:t.nodeId)&&H[t.nodeId])})}})}})}if(!F&&T&&"string"==typeof I&&I.includes(r)){var at=I.split(r),dt=at[0],st=at[1],vt=at[2],gt=(at[3],"".concat(dt).concat(r).concat(st)),ft=null===(N=R.current[gt])||void 0===N?void 0:N.current,yt=null===(D=C.current[gt])||void 0===D?void 0:D.current;if(ft&&yt){var xt=ft.getBoundingClientRect(),mt=yt.getBoundingClientRect(),Rt=xt.right-J.left,Bt=mt.left-J.left,Mt=xt.top+xt.height/2-J.top,Tt=mt.top+mt.height/2-J.top;if(L){var It=null!==(O=null===(j=o.current)||void 0===j?void 0:j.getBoundingClientRect().top)&&void 0!==O?O:0,Lt=null!==(P=null===(z=u.current)||void 0===z?void 0:z.getBoundingClientRect().top)&&void 0!==P?P:0,Ft=It+(null!==(X=null===(Q=o.current)||void 0===Q?void 0:Q.clientHeight)&&void 0!==X?X:1/0),Ht=Lt+(null!==(G=null===(q=u.current)||void 0===q?void 0:q.clientHeight)&&void 0!==G?G:1/0),wt=function(t,e,n){return Math.max(e,Math.min(n,t))};Mt=wt(xt.top+xt.height/2,It,Ft)-J.top,Tt=wt(mt.top+mt.height/2,Lt,Ht)-J.top}var kt=null!==(K=E(dt,st))&&void 0!==K?K:k(vt);kt&&U.push({id:"line-subsec-".concat(gt),x1:Rt,y1:Mt,x2:Bt,y2:Tt,style:kt,sectionIdx:Number(vt.split("-")[0]),isSubSection:!0,subSectionKeyPath:I})}}if(ct(U),d.current&&s.current){var Et=d.current.getBoundingClientRect(),Nt=s.current.getBoundingClientRect(),Yt=(Et.top+Et.height/2-J.top+Nt.top+Nt.height/2-J.top)/2;ut({x1:Et.right-J.left,x2:Nt.left-J.left,y:Yt})}else ut(null);if(M.size>0){var Dt=[],jt=o.current,Ot=u.current;if(jt&&Ot){var zt=[],Pt=jt.getBoundingClientRect().top,Qt=Ot.getBoundingClientRect().top,Xt=Pt+jt.clientHeight,qt=Qt+Ot.clientHeight,Gt=jt.scrollTop,Kt=Ot.scrollTop,Vt=J.top,Jt=function(t,e,n){return Math.max(e,Math.min(n,t))};M.forEach(function(t){var e,n,i,c,l,o,u,a,d;if(F){var s=null,g=null,f=null;if("string"==typeof t&&t.includes(r)){var p=t.split(r),b=p[0],y=p[1],x=p[2],m="".concat(b).concat(r).concat(y);s=null===(e=R.current[m])||void 0===e?void 0:e.current,f=null!==(n=E(b,y))&&void 0!==n?n:k(x),g=Number((null==x?void 0:x.split("-")[0])||0)}else g=Number(t),s=null===(i=R.current[g])||void 0===i?void 0:i.current,f=w(g);if(!s)return;var A=document.querySelectorAll('[id^="guideline-target-"]');A.forEach(function(e,n){var i=s.getBoundingClientRect(),c=e.getBoundingClientRect(),l=i.right-J.left,o=c.left-J.left-0,u=l+75,a=i.top+i.height/2,d=c.top+c.height/2,v=a-Pt+Gt,h=d-Qt+Kt,g="conn-guide-".concat(t,"-").concat(n),p="";"string"==typeof t&&t.includes(r)?p=(t.split(r)[2]||"").split("-").map(function(t){return Number(t)+1}).join("."):p=String(Number(t)+1);var b=String.fromCharCode(97+n),y=1===A.length?null:"".concat(p,"(").concat(b,")");zt.push({lhsScrollY:v,rhsScrollY:h,x1:l,x2:o,containerTop:Vt,leftIdx:t,rhsArrayIdx:n,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleBg:(null==f?void 0:f.badgeBg)||"#FFFFFF",styleText:(null==f?void 0:f.badgeText)||"#A16207",styleId:g,centerX:u});var x=Jt(a,Pt,Xt),m=Jt(d,Qt,qt),R=x-Vt,C=m-Vt,B=At(l,R,o,C,u,a>=Pt-4&&a<=Xt+4,d>=Qt-4&&d<=qt+4);Dt.push({id:g,pathD:B,style:f,leftIdx:t,rhsArrayIdx:n,x1:l,x2:o,y1:R,y2:C,centerX:u,matchLabel:y,isGuideline:!0})})}else if("string"==typeof t&&t.includes(r)){var B=t.split(r),S=(b=B[0],y=B[1],x=B[2],B[3],m="".concat(b).concat(r).concat(y),null===(c=R.current[m])||void 0===c?void 0:c.current),M=null===(l=C.current[m])||void 0===l?void 0:l.current;if(!S||!M)return;var T=S.getBoundingClientRect(),I=M.getBoundingClientRect(),H=null!==(o=E(b,y))&&void 0!==o?o:k(x),N=T.right-J.left,Y=I.left-J.left-0,D=N+75,j=T.top+T.height/2,O=I.top+I.height/2,z=j-Pt+Gt,P=O-Qt+Kt,Q="conn-subsec-".concat(m),X=((x||"").split("-").map(function(t){return Number(t)+1}).join("."),null);zt.push({lhsScrollY:z,rhsScrollY:P,x1:N,x2:Y,containerTop:Vt,leftIdx:t,rhsArrayIdx:t,styleColor:(null==H?void 0:H.badgeBorder)||"#6366F1",styleBg:(null==H?void 0:H.badgeBg)||"#FFFFFF",styleText:(null==H?void 0:H.badgeText)||"#A16207",styleId:Q,centerX:D});var q=Jt(j,Pt,Xt),G=Jt(O,Qt,qt),K=At(N,$=q-Vt,Y,_=G-Vt,D,j>=Pt-4&&j<=Xt+4,O>=Qt-4&&O<=qt+4);Dt.push({id:Q,pathD:K,style:H,leftIdx:t,rhsArrayIdx:t,x1:N,x2:Y,y1:$,y2:_,matchLabel:X})}else if(L){var V=t,U=v[V];if(!(null===(d=null==U?void 0:U.refIndexes)||void 0===d?void 0:d.length))return;U.refIndexes.forEach(function(e,n){var i,r,c=h.findIndex(function(t){return t.selfIndex===e});if(-1!==c){var l=null===(i=R.current[V])||void 0===i?void 0:i.current,o=null===(r=C.current[c])||void 0===r?void 0:r.current;if(l&&o){var u=l.getBoundingClientRect(),a=o.getBoundingClientRect(),d=w(V),s=u.right-J.left,v=a.left-J.left-0,g=s+75,f=u.top+u.height/2,p=a.top+a.height/2,b=f-Pt+Gt,y=p-Qt+Kt,x="conn-".concat(V,"-").concat(c),m=String(Number(t)+1),A=String.fromCharCode(97+n),B=1===U.refIndexes.length?null:"".concat(m,"(").concat(A,")");zt.push({lhsScrollY:b,rhsScrollY:y,x1:s,x2:v,containerTop:Vt,leftIdx:V,rhsArrayIdx:c,styleColor:(null==d?void 0:d.badgeBorder)||"#6366F1",styleBg:(null==d?void 0:d.badgeBg)||"#FFFFFF",styleText:(null==d?void 0:d.badgeText)||"#A16207",styleId:x,centerX:g});var S=Jt(f,Pt,Xt),M=Jt(p,Qt,qt),T=S-Vt,I=M-Vt,L=At(s,T,v,I,g,f>=Pt-4&&f<=Xt+4,p>=Qt-4&&p<=qt+4);Dt.push({id:x,pathD:L,style:d,leftIdx:V,rhsArrayIdx:c,x1:s,x2:v,y1:T,y2:I,matchLabel:B})}}})}else{var W=t,Z=W;S=null===(u=R.current[W])||void 0===u?void 0:u.current,M=null===(a=C.current[Z])||void 0===a?void 0:a.current;if(!S||!M)return;T=S.getBoundingClientRect(),I=M.getBoundingClientRect(),H=w(W),N=T.right-J.left,Y=I.left-J.left-0,D=N+75,j=T.top+T.height/2,O=I.top+I.height/2,z=j-Pt+Gt,P=O-Qt+Kt,Q="conn-".concat(W,"-").concat(Z),String(Number(t)+1),X=null;zt.push({lhsScrollY:z,rhsScrollY:P,x1:N,x2:Y,containerTop:Vt,leftIdx:W,rhsArrayIdx:Z,styleColor:(null==H?void 0:H.badgeBorder)||"#6366F1",styleBg:(null==H?void 0:H.badgeBg)||"#FFFFFF",styleText:(null==H?void 0:H.badgeText)||"#A16207",styleId:Q,centerX:D});var $,_;q=Jt(j,Pt,Xt),G=Jt(O,Qt,qt),K=At(N,$=q-Vt,Y,_=G-Vt,D,j>=Pt-4&&j<=Xt+4,O>=Qt-4&&O<=qt+4);Dt.push({id:Q,pathD:K,style:H,leftIdx:W,rhsArrayIdx:Z,x1:N,x2:Y,y1:$,y2:_,matchLabel:X})}}),Ct.current=zt}ht(Dt),setTimeout(function(){return St()},10)}else ht([]),Ct.current=[],setTimeout(function(){return St()},10)}catch(t){console.error("Line render safe fail: ",t)}finally{bt.current=!1}}},[g,v,h,H,et,nt,w,E,L,T,I,M,B,S,F]),St=n(function(){var t,e,n,i,r,c,d,s,v,h,g,f,p,b,y,x,m,R,C,A=Ct.current;if(!A.length)return null===(t=a.current["guideline-up-stroke"])||void 0===t||t.setAttribute("visibility","hidden"),null===(e=a.current["guideline-up-badge"])||void 0===e||e.setAttribute("visibility","hidden"),null===(n=a.current["guideline-down-stroke"])||void 0===n||n.setAttribute("visibility","hidden"),void(null===(i=a.current["guideline-down-badge"])||void 0===i||i.setAttribute("visibility","hidden"));if(!Y.current){var B=null!==(c=null===(r=o.current)||void 0===r?void 0:r.scrollTop)&&void 0!==c?c:0,S=null!==(s=null===(d=u.current)||void 0===d?void 0:d.scrollTop)&&void 0!==s?s:0,M=null!==(h=null===(v=o.current)||void 0===v?void 0:v.clientHeight)&&void 0!==h?h:1/0,T=null!==(f=null===(g=u.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0,I=null!==(b=null===(p=o.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==b?b:0,L=null!==(x=null===(y=u.current)||void 0===y?void 0:y.getBoundingClientRect().top)&&void 0!==x?x:0,F=I+M,H=L+T,w=null===(m=l.current)||void 0===m?void 0:m.getBoundingClientRect(),k=null!==(R=null==w?void 0:w.top)&&void 0!==R?R:0,E=null!==(C=null==w?void 0:w.height)&&void 0!==C?C:1/0,N=function(t,e,n){return Math.max(e,Math.min(n,t))},D=0,j=0,O=0,z=0,P="#6366F1",Q="#A16207",X=!1,q=0;if(A.forEach(function(t){var e=t.lhsScrollY-B+I,n=t.rhsScrollY-S+L,i=a.current[t.styleId+"-stroke"],r=a.current[t.styleId+"-bg"],c=a.current[t.styleId+"-btn"],l=a.current[t.styleId+"-number"];if(i||r){var o=N(e,I,F),u=N(n,L,H),d=o-k,s=u-k,v=e>=I-4&&e<=F+4,h=n>=L-4&&n<=H+4,g=!0;X=!0;var f=t.centerX||t.x1+75;0===O&&(O=t.x1,z=d,q=f,P=t.styleColor,t.styleBg,Q=t.styleText||"#A16207"),n<L-4?(D++,g=!1):n>H+4&&(j++,g=!1);var p=At(t.x1,d,t.x2,s,q,v,h);i&&(g&&p?(i.setAttribute("visibility","visible"),i.setAttribute("d",p)):i.setAttribute("visibility","hidden")),r&&(g&&p?(r.setAttribute("visibility","visible"),r.setAttribute("d",p)):r.setAttribute("visibility","hidden")),c&&(v&&g?(c.setAttribute("visibility","visible"),c.setAttribute("y",String(d-12))):c.setAttribute("visibility","hidden")),l&&(v&&g?(l.setAttribute("visibility","visible"),l.setAttribute("transform","translate(".concat(t.x2-42,", ").concat(s,")"))):l.setAttribute("visibility","hidden"))}}),X&&q>0){var G=a.current["guideline-up-stroke"],K=a.current["guideline-up-badge"],V=a.current["guideline-up-arrow"],J=a.current["guideline-up-text"],U=a.current["guideline-up-badge-rect"];if(D>0){var W=Math.max(15,L-k+15),Z=Math.min(15,Math.abs(q-O),Math.max(0,z-W)),$="M ".concat(O,",").concat(z," L ").concat(q-Z,",").concat(z," Q ").concat(q,",").concat(z," ").concat(q,",").concat(z-Z," L ").concat(q,",").concat(W);null==G||G.setAttribute("visibility","visible"),null==G||G.setAttribute("d",$),null==G||G.setAttribute("stroke",P),null==K||K.setAttribute("visibility","visible"),null==K||K.setAttribute("transform","translate(".concat(q,", ").concat(W,")")),V&&V.setAttribute("fill",P),J&&(J.textContent="+".concat(D),J.setAttribute("fill",Q)),U&&U.setAttribute("stroke",P)}else null==G||G.setAttribute("visibility","hidden"),null==K||K.setAttribute("visibility","hidden");var _=a.current["guideline-down-stroke"],tt=a.current["guideline-down-badge"],et=a.current["guideline-down-arrow"],nt=a.current["guideline-down-text"],it=a.current["guideline-down-badge-rect"];if(j>0){var rt=Math.min(E-15,H-k-15);Z=Math.min(15,Math.abs(q-O),Math.max(0,rt-z)),$="M ".concat(O,",").concat(z," L ").concat(q-Z,",").concat(z," Q ").concat(q,",").concat(z," ").concat(q,",").concat(z+Z," L ").concat(q,",").concat(rt);null==_||_.setAttribute("visibility","visible"),null==_||_.setAttribute("d",$),null==_||_.setAttribute("stroke",P),null==tt||tt.setAttribute("visibility","visible"),null==tt||tt.setAttribute("transform","translate(".concat(q,", ").concat(rt,")")),et&&et.setAttribute("fill",P),nt&&(nt.textContent="+".concat(j),nt.setAttribute("fill",Q)),it&&it.setAttribute("stroke",P)}else null==_||_.setAttribute("visibility","hidden"),null==tt||tt.setAttribute("visibility","hidden")}}},[]),Mt=n(function(){Ct.current.length>0&&!Y.current||(null!==mt.current&&clearTimeout(mt.current),mt.current=setTimeout(function(){G.current(),mt.current=null},50))},[]),Tt=n(function(t){if(null!==_.current&&tt.current&&Math.abs(t.currentTarget.scrollTop-_.current)<=2){var e=tt.current;_.current=null,tt.current=null,e()}if(!xt.current&&!V.current){if(L&&J&&(D.current||M.size>0)){var n=t.currentTarget,i=o.current,c=u.current,a=n===i?c:n===c?i:null;if(n&&a){var d=function(){var t,e,n,i,c,l,o,u,a,d,s,v=z.current,h=P.current;if(null===v)return{leftAnchor:null,rightAnchor:null};if("string"==typeof v&&v.includes(r)){var g=v.split(r),f="".concat(g[0]).concat(r).concat(g[1]);return{leftAnchor:(null===(t=R.current[f])||void 0===t?void 0:t.current)||(null===(e=x.current[g[2]])||void 0===e?void 0:e.current)||(null===(n=b.current[Number(g[2])])||void 0===n?void 0:n.current)||null,rightAnchor:(null===(i=C.current[f])||void 0===i?void 0:i.current)||(null===(c=m.current[g[3]])||void 0===c?void 0:c.current)||(null===(l=y.current[Number(g[3])])||void 0===l?void 0:l.current)||null}}var p=Number(v),B=null!==h?Number(h):p;return{leftAnchor:(null===(o=R.current[p])||void 0===o?void 0:o.current)||(null===(u=A.current[p])||void 0===u?void 0:u.current)||(null===(a=b.current[p])||void 0===a?void 0:a.current)||null,rightAnchor:(null===(d=C.current[B])||void 0===d?void 0:d.current)||(null===(s=y.current[B])||void 0===s?void 0:s.current)||null}}(),s=d.leftAnchor,v=d.rightAnchor,h=n===i?s:v,g=n===i?v:s,f=null;if(h&&g){var p=h.getBoundingClientRect(),B=g.getBoundingClientRect(),S=a.getBoundingClientRect(),T=p.top+p.height/2;f=B.top-S.top+a.scrollTop+B.height/2-(T-S.top)}else{var I=Math.max(0,n.scrollHeight-n.clientHeight),F=Math.max(0,a.scrollHeight-a.clientHeight);f=I>0?n.scrollTop/I*F:n.scrollTop}var H=Math.max(0,a.scrollHeight-a.clientHeight);f=Math.max(0,Math.min(f,H)),Math.abs(a.scrollTop-f)>1&&(xt.current=!0,a.scrollTop=f,requestAnimationFrame(function(){xt.current=!1}))}}L||Mt(),yt.current||(yt.current=!0,requestAnimationFrame(function(){var t,e,n,i,c,a,d;if(D.current){var s=o.current,v=u.current;if(s&&v&&O.current){if(!j.current){var h=z.current,g=void 0;if("string"==typeof h&&h.includes(r)){var f=h.split(r),p="".concat(f[0]).concat(r).concat(f[1]);g=null===(t=R.current[p])||void 0===t?void 0:t.current}else g=null===(e=R.current[h])||void 0===e?void 0:e.current;if(g){var b=g.getBoundingClientRect();j.current={badgeScreenY:b.top+b.height/2,initialScrollTop:s.scrollTop,leftTop:s.getBoundingClientRect().top,leftBottom:s.getBoundingClientRect().top+s.clientHeight,cTop:null!==(i=null===(n=l.current)||void 0===n?void 0:n.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(j.current){var y=j.current,x=s.scrollTop-y.initialScrollTop,m=y.badgeScreenY-x,C=((c=m,a=y.leftTop,d=y.leftBottom,Math.max(a,Math.min(d,c)))-y.cTop).toString(),A=m>=y.leftTop-4&&m<=y.leftBottom+4;O.current.setAttribute("y1",C),O.current.setAttribute("y2",C),O.current.setAttribute("visibility",A?"visible":"hidden")}}}St(),yt.current=!1}))}},[St,L,J,M,Mt]);return i(function(){G.current=Bt},[Bt]),i(function(){var t=setTimeout(Mt,250),e=function(){return U.current()};return window.addEventListener("resize",e),function(){clearTimeout(t),null!==mt.current&&clearTimeout(mt.current),null!==K.current&&clearTimeout(K.current),window.removeEventListener("resize",e)}},[W,Z,$,g,B,S,v,h,et,Mt,T,I,N,M]),{lines:rt,setLines:ct,overallConnector:ot,setOverallConnector:ut,connectedLines:vt,setConnectedLines:ht,svgDimensions:ft,cachedConnectedPositions:Ct,calculateLines:Bt,calculateLinesRef:G,calculateLinesDebounced:Mt,handleColumnScroll:Tt}};export{c as useLinesCalculator};
2
2
  //# sourceMappingURL=useLinesCalculator.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as l}from"react";import{LexicalComposer as n}from"@lexical/react/LexicalComposer";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{OnChangePlugin as s}from"@lexical/react/LexicalOnChangePlugin";import{TabIndentationPlugin as c}from"@lexical/react/LexicalTabIndentationPlugin";import{ListNode as m,ListItemNode as d}from"@lexical/list";import{ListPlugin as u}from"@lexical/react/LexicalListPlugin";import{LinkPlugin as p}from"@lexical/react/LexicalLinkPlugin";import{LinkNode as f}from"@lexical/link";import{QuoteNode as g,HeadingNode as x}from"@lexical/rich-text";import{TablePlugin as h}from"@lexical/react/LexicalTablePlugin";import{TableNode as v,TableRowNode as C,TableCellNode as y}from"@lexical/table";import{KEY_DOWN_COMMAND as b,$getSelection as j,$isRangeSelection as T,COMMAND_PRIORITY_CRITICAL as E,TextNode as N,$isTextNode as S}from"lexical";import"./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js";import{useRequirementAI as k}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import B from"./components/EditorContainer/EditorContainer.js";import P from"./components/EditorToolbar/EditorToolbar.js";import{LayoutPlugin as L}from"./plugins/LayoutPlugin.js";import _ from"./theme/theme.js";import"./theme/theme.css.js";import"./Editor.css.js";import D from"./components/Context/ContextMenu.js";import{MarkNode as H}from"@lexical/mark";import I from"./plugins/CommentPlugin/HTMLNode.js";import{DEFAULT_TOOLBAR_CONFIG as w}from"./constants/editorConfig.js";import{InitialHtml as M}from"./plugins/InitialHtml.js";import{InsertNode as R}from"./plugins/InsertNode.js";import{DeleteNode as F}from"./plugins/DeleteNode.js";import{HighlightSpanNode as A,HighlightButtonNode as W}from"./plugins/HighlightNode.js";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext";import{UpdateNode as O}from"./plugins/UpdateNode.js";import{ManualNode as V}from"./plugins/ManualNode.js";import{PreservedNode as U}from"./plugins/PreservedNode.js";import{InvisibleNode as X}from"./plugins/InvisibleNode.js";function Y(e){console.log(e)}function $({onEditBlocked:e}){const[t]=q();return l(()=>{const o=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 O||t instanceof V)return t.__id;t=t.getParent()}return null}return t.registerCommand(b,t=>{var i;if("Backspace"!==t.key&&"Delete"!==t.key)return!1;const l=j();if(!T(l))return!1;const n=l.getNodes().find(e=>!!o(e));if(n)return t.preventDefault(),null==e||e(r(n)||""),!0;if(l.isCollapsed()){const n=l.anchor.getNode(),a=l.focus.getNode(),s=o(n),c=o(a);if(s||c){const o=s?r(s):c?r(c):"";return null==e||e(o||""),t.preventDefault(),!0}if("Backspace"===t.key){const a=n.getPreviousSibling(),s=null===(i=null==a?void 0:a.getLastDescendant)||void 0===i?void 0:i.call(a),c=a&&["delete","insert","preserved"].includes(a.getType())?a:s&&o(s)?s:null;if(0===l.anchor.offset&&c)return null==e||e(r(c)||""),t.preventDefault(),!0}else if("Delete"===t.key){const i=n.getNextSibling(),a=null==i?void 0:i.getFirstDescendant(),s=i&&["delete","insert","preserved"].includes(i.getType())?i:a&&o(a)?a:null,c=n.getTextContent().length;if(l.anchor.offset===c&&s)return null==e||e(r(s)||""),t.preventDefault(),!0}}return!1},E)},[t]),null}function z({minHeight:l,height:b,placeholder:E,onFocus:q,onBlur:z,onChange:G,onToolbarButtonClick:J,toolbarConfig:K=w,editorRef:Q,editorState:Z,initialString:ee,customToolbar:te,plugins:oe,nodes:re,dynamicHeight:ie,artifactContext:le,commentsPanelState:ne,mode:ae,doNotShowBorderInViewMode:se,onEditBlocked:ce}){var me,de,ue;const pe=r(null),fe={namespace:"MyEditor",theme:_,onError:Y,nodes:[N,m,d,f,g,x,v,C,y,H,I,R,F,O,U,V,X,A,W],editorState:Z},[ge,xe]=i(null),[he,ve]=i(!1),{customStyles:Ce}=k(),ye=e=>{var t;null===(t=Q.current)||void 0===t||t.update(()=>{const t=j();T(t)&&t.getNodes().forEach(t=>{S(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e(t,{children:[(null===(me=null==Ce?void 0:Ce.textEditorStyles)||void 0===me?void 0:me.themeStyles)&&o("style",{children:null===(de=null==Ce?void 0:Ce.textEditorStyles)||void 0===de?void 0:de.themeStyles}),e("div",{ref:pe,className:"w-full lexical_editor_wrapper "+(se&&"readOnly"===ae?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=Q.current)||void 0===t||t.update(()=>{const t=j();T(t)&&!t.isCollapsed()?(ve(!0),xe({x:e.clientX,y:e.clientY})):(ve(!1),xe(null))})},style:{minHeight:l,height:b,...null===(ue=null==Ce?void 0:Ce.textEditorStyles)||void 0===ue?void 0:ue.textArea},children:[e(n,{initialConfig:fe,children:[" ","edit"===ae&&o($,{onEditBlocked:ce}),"edit"===ae&&o(P,{onToolbarButtonClick:J,editorWrapperRef:pe,toolbarConfig:K,customToolbar:te,editorRef:Q}),o(B,{placeholder:E}),o(c,{}),o(a,{}),o(u,{}),o(p,{}),o(h,{}),o(L,{onFocus:q,onBlur:z,editorRef:Q}),o(s,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,o)=>{G&&G(e,t,o)}}),ee&&o(M,{initialValue:ee.value,initialFormat:ee.type,mode:ae}),oe&&oe]}),ge&&he&&"edit"===ae&&o(D,{position:ge,options:[{label:"Change Color to Red",action:()=>ye("red")},{label:"Change Color to Blue",action:()=>ye("blue")}],onClose:()=>{xe(null)}})]})]})}export{z as default};
1
+ import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as n}from"react";import{LexicalComposer as l}from"@lexical/react/LexicalComposer";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{OnChangePlugin as s}from"@lexical/react/LexicalOnChangePlugin";import{TabIndentationPlugin as u}from"@lexical/react/LexicalTabIndentationPlugin";import{ListNode as m,ListItemNode as c}from"@lexical/list";import{ListPlugin as d}from"@lexical/react/LexicalListPlugin";import{LinkPlugin as p}from"@lexical/react/LexicalLinkPlugin";import{LinkNode as f}from"@lexical/link";import{QuoteNode as g,HeadingNode as x}from"@lexical/rich-text";import{TablePlugin as h}from"@lexical/react/LexicalTablePlugin";import{TableNode as C,TableRowNode as v,TableCellNode as y}from"@lexical/table";import{KEY_DOWN_COMMAND as b,$getSelection as S,$isRangeSelection as j,COMMAND_PRIORITY_CRITICAL as T,TextNode as E,$isTextNode as N}from"lexical";import"./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js";import{useRequirementAI as P}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import B from"./components/EditorContainer/EditorContainer.js";import L from"./components/EditorToolbar/EditorToolbar.js";import{LayoutPlugin as k}from"./plugins/LayoutPlugin.js";import I from"./theme/theme.js";import"./theme/theme.css.js";import"./Editor.css.js";import _ from"./components/Context/ContextMenu.js";import{MarkNode as H}from"@lexical/mark";import w from"./plugins/CommentPlugin/HTMLNode.js";import{DEFAULT_TOOLBAR_CONFIG as D}from"./constants/editorConfig.js";import{InitialHtml as M}from"./plugins/InitialHtml.js";import{InsertNode as R}from"./plugins/InsertNode.js";import{DeleteNode as A}from"./plugins/DeleteNode.js";import{HighlightSpanNode as F,HighlightButtonNode as W}from"./plugins/HighlightNode.js";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext";import{UpdateNode as O}from"./plugins/UpdateNode.js";import{ManualNode as V}from"./plugins/ManualNode.js";import{PreservedNode as U}from"./plugins/PreservedNode.js";import{InvisibleNode as X}from"./plugins/InvisibleNode.js";function Y(e){console.log(e)}function $({onEditBlocked:e}){const[t]=q();return n(()=>{const o=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 r(e){let t=e.getParent();for(;t;){if(t instanceof O||t instanceof V)return t.getId();t=t.getParent()}return null}return t.registerCommand(b,t=>{const i=S();if(!j(i))return!1;const n=i.getNodes().find(e=>!!o(e));if(n)return t.preventDefault(),null==e||e(r(n)||""),!0;if(i.isCollapsed()){const n=i.anchor.getNode(),l=o(n);if(l){const o=l?r(l):"";return null==e||e(o||""),t.preventDefault(),!0}if("Backspace"===t.key){const o=n.getPreviousSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null;if(0===i.anchor.offset&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}else if("Delete"===t.key){const o=n.getNextSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null,a=n.getTextContent().length;if(i.anchor.offset===a&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}}return!1},T)},[t]),null}function z({minHeight:n,height:b,placeholder:T,onFocus:q,onBlur:z,onChange:G,onToolbarButtonClick:J,toolbarConfig:K=D,editorRef:Q,editorState:Z,initialString:ee,customToolbar:te,plugins:oe,nodes:re,dynamicHeight:ie,artifactContext:ne,commentsPanelState:le,mode:ae,doNotShowBorderInViewMode:se,onEditBlocked:ue}){var me,ce,de;const pe=r(null),fe={namespace:"MyEditor",theme:I,onError:Y,nodes:[E,m,c,f,g,x,C,v,y,H,w,R,A,O,U,V,X,F,W],editorState:Z},[ge,xe]=i(null),[he,Ce]=i(!1),{customStyles:ve}=P(),ye=e=>{var t;null===(t=Q.current)||void 0===t||t.update(()=>{const t=S();j(t)&&t.getNodes().forEach(t=>{N(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e(t,{children:[(null===(me=null==ve?void 0:ve.textEditorStyles)||void 0===me?void 0:me.themeStyles)&&o("style",{children:null===(ce=null==ve?void 0:ve.textEditorStyles)||void 0===ce?void 0:ce.themeStyles}),e("div",{ref:pe,className:"w-full lexical_editor_wrapper "+(se&&"readOnly"===ae?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=Q.current)||void 0===t||t.update(()=>{const t=S();j(t)&&!t.isCollapsed()?(Ce(!0),xe({x:e.clientX,y:e.clientY})):(Ce(!1),xe(null))})},style:{minHeight:n,height:b,...null===(de=null==ve?void 0:ve.textEditorStyles)||void 0===de?void 0:de.textArea},children:[e(l,{initialConfig:fe,children:[" ","edit"===ae&&o($,{onEditBlocked:ue}),"edit"===ae&&o(L,{onToolbarButtonClick:J,editorWrapperRef:pe,toolbarConfig:K,customToolbar:te,editorRef:Q}),o(B,{placeholder:T}),o(u,{}),o(a,{}),o(d,{}),o(p,{}),o(h,{}),o(k,{onFocus:q,onBlur:z,editorRef:Q}),o(s,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,o)=>{G&&G(e,t,o)}}),ee&&o(M,{initialValue:ee.value,initialFormat:ee.type,mode:ae}),oe&&oe]}),ge&&he&&"edit"===ae&&o(_,{position:ge,options:[{label:"Change Color to Red",action:()=>ye("red")},{label:"Change Color to Blue",action:()=>ye("blue")}],onClose:()=>{xe(null)}})]})]})}export{z as default};
2
2
  //# sourceMappingURL=Editor.js.map
@@ -1,2 +1,2 @@
1
- import{ElementNode as t}from"lexical";class e extends t{static getType(){return"manual"}static clone(t){return new e(t.__id,t.__key)}constructor(t=crypto.randomUUID(),e){super(e),this.__id=t}createDOM(){const t=document.createElement("manual");return t.id=this.__id,t.className="PlaygroundEditorTheme__manual-node",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,{element:t}}updateDOM(t,e){return t.__id!==this.__id&&(e.id=this.__id),!1}static importDOM(){return{manual:()=>({conversion:r,priority:1})}}static importJSON(t){const r=new e(t.id);return r.setFormat(t.format),r.setIndent(t.indent),r.setDirection(t.direction),r}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id}}isInline(){return!0}getId(){return this.__id}}function r(t){const r=t.id||crypto.randomUUID();return{node:new e(r)}}export{e as ManualNode};
1
+ import{ElementNode as t}from"lexical";class s extends t{static getType(){return"manual"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.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,s){return t.__id!==this.__id&&(s.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}isInline(){return!0}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as ManualNode};
2
2
  //# sourceMappingURL=ManualNode.js.map
@@ -1,2 +1,2 @@
1
- import{ElementNode as t}from"lexical";class e extends t{static getType(){return"update"}static clone(t){return new e(t.__id,t.__key)}constructor(t=crypto.randomUUID(),e){super(e),this.__id=t}createDOM(){const t=document.createElement("upt");return t.id=this.__id,t.className="PlaygroundEditorTheme__update-node",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,{element:t}}updateDOM(t,e){return t.__id!==this.__id&&(e.id=this.__id),!1}static importDOM(){return{upt:()=>({conversion:r,priority:1})}}static importJSON(t){const r=new e(t.id);return r.setFormat(t.format),r.setIndent(t.indent),r.setDirection(t.direction),r}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id}}isInline(){return!0}getId(){return this.__id}}function r(t){const r=t.id||crypto.randomUUID();return{node:new e(r)}}export{e as UpdateNode};
1
+ import{ElementNode as t}from"lexical";class s extends t{static getType(){return"update"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.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,s){return t.__id!==this.__id&&(s.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}isInline(){return!0}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as UpdateNode};
2
2
  //# sourceMappingURL=UpdateNode.js.map
@@ -1,2 +1,2 @@
1
- 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)}();export{e as default};
1
+ 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)}();export{e as default};
2
2
  //# sourceMappingURL=theme.css.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as c}from"react/jsx-runtime";import a,{useMemo as t}from"react";import n from"../Popups/PopupDefaults.js";import l from"react-markdown";import r from"rehype-raw";import d from"./CitationComponent.module.css.js";import{ChevronUp as s}from"lucide-react";import{ReactComponent as o}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as m}from"../icons/aiMagic.svg.js";import p from"./CitationAnchor.js";import{resolveRedline as _}from"../../../../../service/redlineService.js";import{useRequirementAI as h}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const u=({text:e,item:c})=>i(l,{rehypePlugins:[r],components:{ol:({children:e})=>i("ol",{className:d["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:d["md-ul"],children:e}),li:({children:e})=>i("li",{className:d["md-li"],children:e}),a:({node:e,href:a,children:t})=>i(p,{href:a,children:t,metaData:{citations:c.citations,docData:c.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")});function v({item:l,title:r="Cognitive Decisioning AI",relevanceScore:p=0,showRelevanceScore:v=!0,reason:N="No reasoning provided.",impact:b="No Impact provided.",explaination:y="No explaination provided.",gap:f="None",onClose:g=()=>{},onActionTrigger:x,showResolveBtns:C=!1,sections:I,leftIcon:k,scoreIcon:A,className:j,customStyles:B={},actions:D,disableAllActions:H=!1,actionBtnDisabledStyle:R={},onBackClick:$,isImpactNeeded:T=!0,cognitiveTitle:w="Cognitive Integrity",labels:L={},redlineId:P,aiReasonId:S}){const E=t(()=>{const e=Number(p);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[p]),M=t(()=>{const e=L&&L.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),q=L&&L.impact||"Impact",G=L&&L.explanation||"Explaination",F=L&&L.decisionFactors||"Decision Making Factors",U=L&&L.gaps||"Gaps in Decision",W=L&&L.accept||"Accept",z=L&&L.reject||"Reject",J=L&&L.backAriaLabel||"Go back",{redlineDcoumentId:K,redlineConfig:O,updateRedlineDataParent:Q}=h(),V=async e=>{var i,c;null==x||x({status:"loading",action:e,metadata:{redlineId:P,aiReasonId:S}});try{const{updated_reqai:a}=await _({documentId:K,userEmail:null==O?void 0:O.userEmail,userName:null==O?void 0:O.userName,redlineId:null!=P?P:"",action:e,baseApiUrl:null==O?void 0:O.baseApiUrl,redlineConfigId:null!==(i=null==O?void 0:O.redlineConfigId)&&void 0!==i?i:""},null!==(c=null==O?void 0:O.token)&&void 0!==c?c:"");await(null==Q?void 0:Q(a)),null==x||x({status:"success",action:e,metadata:{redlineId:P,aiReasonId:S}})}catch(e){null==x||x({status:"failed",action:null,metadata:{redlineId:P,aiReasonId:S}})}},X=D||[{id:"reject",label:z,onClick:()=>V("reject"),className:d["btn-reject"]},{id:"accept",label:W,onClick:()=>V("accept"),className:d["btn-accept"]}];return e("div",{className:`${d["cite-acc"]} ${j||""}`,style:{...n.CitationAccordionDefaults.container,...null==B?void 0:B.container},children:[$&&e("div",{className:d["cite-acc__backHeader"],children:[i("button",{type:"button",className:d["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),$&&$()},"aria-label":J,children:"‹"}),i("span",{className:d["cite-acc__backTitle"],children:w})]}),i("div",{className:d["cite-body"],children:I&&I.length>0?I.map(c=>!1===c.show?null:e("div",{className:`${d["cite-acc__explain-body"]} ${c.bodyClassName||""}`,children:[e("div",{className:d["cite-acc__innerHeader"],style:{...n.CitationAccordionDefaults.innerHeader,...null==B?void 0:B.innerHeader},children:[i("div",{className:d["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:d["cite-acc__innerTitle"],children:c.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(s,{})})]}),i("div",{className:`${d["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...n.CitationAccordionDefaults.innerBody,...null==B?void 0:B.innerBody},children:"string"==typeof c.content?i(u,{text:c.content,item:c.item||l||{}}):c.content})]},c.id||c.title)):e(c,{children:[T&&e("div",{className:d["cite-acc__explain-body"],children:[e("div",{className:d["cite-acc__innerHeader"],children:[i("div",{className:d["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:d["cite-acc__innerTitle"],children:q})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(s,{})})]}),i("div",{className:`${d["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:b||"",item:l||{}})})]}),e("div",{className:d["cite-acc__explain-body"],children:[i("div",{className:d["cite-acc__innerHeader"],children:i("div",{className:d["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:d["cite-acc__innerTitle"],children:G})})})}),i("div",{className:`${d["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:y||"",item:{}})})]}),C&&i("div",{className:d["cite-acc__btn-container"],children:X.map(e=>{const c=H||e.disabled;return i("button",{className:e.className,onClick:c?void 0:e.onClick,disabled:c,style:{...e.style,...c?{opacity:.5,cursor:"not-allowed",...R,...e.disabledStyle}:{}},children:e.label},e.id)})}),e("div",{className:d["cite-acc__header"],children:[e("div",{className:d["cite-acc__headerLeft"],children:[i("span",{className:d["cite-acc__titleIcon"],children:k?"function"==typeof k?a.createElement(k):k:i(o,{})}),i("div",{className:d["cite-acc__title"],children:r})]}),i("div",{className:d["cite-acc__headerRight"],children:v&&e("span",{className:d["cite-acc__scoreBadge"],children:[A?"function"==typeof A?a.createElement(A):A:i(m,{}),e("span",{className:d["cite-acc__scoreText"],children:[E,"%"]})]})})]}),e("div",{className:d["cite-acc__explain-body"],children:[i("div",{className:d["cite-acc__innerHeader"],children:i("div",{className:d["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:d["cite-acc__innerTitle"],children:F})})})}),i("div",{className:`${d["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:N||"",item:l||{}})})]}),e("div",{className:`${d["cite-acc__explain-body"]} ${d["cite-acc__explain-body_border"]}`,children:[i("div",{className:d["cite-acc__innerHeader"],children:i("div",{className:d["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:d["cite-acc__innerTitle"],children:U})})})}),i("div",{className:`${d["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:M||"",item:l||{}})})]})]})})]})}export{v as default};
1
+ import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as n,useMemo as t}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import d from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as o}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import _ from"./CitationAnchor.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const u=({text:e,item:a})=>i(r,{rehypePlugins:[d],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:c,children:n})=>i(_,{href:c,children:n,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")});var N=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:_=!0,reason:N="No reasoning provided.",impact:b="No Impact provided.",explaination:y="No explaination provided.",gap:f="None",onClose:g=()=>{},onActionTrigger:x,showResolveBtns:I=!1,sections:C,leftIcon:A,scoreIcon:k,className:R,customStyles:j={},actions:B,disableAllActions:D=!1,actionBtnDisabledStyle:H={},onBackClick:$,isImpactNeeded:T=!0,cognitiveTitle:w="Cognitive Integrity",labels:L={},redlineId:S,aiReasonId:P}){const E=t(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),M=t(()=>{const e=L&&L.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),q=L&&L.impact||"Impact",G=L&&L.explanation||"Explaination",F=L&&L.decisionFactors||"Decision Making Factors",U=L&&L.gaps||"Gaps in Decision",W=L&&L.accept||"Accept",z=L&&L.reject||"Reject",J=L&&L.backAriaLabel||"Go back",{redlineDcoumentId:K,redlineConfig:O,updateRedlineDataParent:Q}=v(),V=async e=>{var i,a;null==x||x({status:"loading",action:e,metadata:{redlineId:S,aiReasonId:P}});try{const{updated_reqai:c}=await h({documentId:K,userEmail:null==O?void 0:O.userEmail,userName:null==O?void 0:O.userName,redlineId:null!=S?S:"",action:e,baseApiUrl:null==O?void 0:O.baseApiUrl,redlineConfigId:null!==(i=null==O?void 0:O.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==O?void 0:O.token)&&void 0!==a?a:"");await(null==Q?void 0:Q(c)),null==x||x({status:"success",action:e,metadata:{redlineId:S,aiReasonId:P}})}catch(e){null==x||x({status:"failed",action:null,metadata:{redlineId:S,aiReasonId:P}})}},X=B||[{id:"reject",label:z,onClick:()=>V("reject"),className:s["btn-reject"]},{id:"accept",label:W,onClick:()=>V("accept"),className:s["btn-accept"]}];return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[$&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),$&&$()},"aria-label":J,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:w})]}),i("div",{className:s["cite-body"],children:C&&C.length>0?C.map(a=>!1===a.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:a.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(o,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof a.content?i(u,{text:a.content,item:a.item||n||{}}):a.content})]},a.id||a.title)):e(a,{children:[T&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:q})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(o,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:b||"",item:n||{}})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:G})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:y||"",item:{}})})]}),I&&i("div",{className:s["cite-acc__btn-container"],children:X.map(e=>{const a=D||e.disabled;return i("button",{className:e.className,onClick:a?void 0:e.onClick,disabled:a,style:{...e.style,...a?{opacity:.5,cursor:"not-allowed",...H,...e.disabledStyle}:{}},children:e.label},e.id)})}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?c.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:_&&e("span",{className:s["cite-acc__scoreBadge"],children:[k?"function"==typeof k?c.createElement(k):k:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[E,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:F})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:N||"",item:n||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:U})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:M||"",item:n||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{N as default};
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as t,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{useState as s}from"react";import{ToneToggle as c}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as g}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as m}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as x}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const y=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],h=({toneIndex:n,configs:o=y})=>{const t=Math.min(n,o.length-1),{color:l,angle:r,arcD:d}=o[t]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return i("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},f=({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("div",{style:t,children:i})},b=["Lenient","Balanced","Aggressive"],S={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},I={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},k={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},A={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},T={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},D={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},R={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},E={display:"flex",gap:8,marginBottom:18},z={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},j={borderTop:"0.5px solid #eee",padding:"14px 0px"},L={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},M={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},_={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},F={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},H={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},N={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},O={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},P={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},U={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0};function q({onAssignClick:n,disableAssignButton:o=!1,onOpenCognitive:t,cognitiveIconSmall:l,cognitiveTootipTitle:r}){const d="20px";return i("div",{style:{...U,minWidth:"200px"},children:[i("div",{style:{padding:"8px",cursor:o?"not-allowed":"pointer",opacity:o?.5:1,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:o?void 0:n,children:[e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:i("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("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})]})}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&i("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[l&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r})]})]})}function $({onAssignClick:n,disableAssignButton:o=!1,onOpenCognitive:t,cognitiveIconSmall:l,cognitiveTootipTitle:r}){const[d,a]=s(!1);return i("div",{style:{position:"relative",display:"flex"},children:[e("button",{onClick:()=>a(!d),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:i("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("circle",{cx:"12",cy:"12",r:"1"}),e("circle",{cx:"12",cy:"5",r:"1"}),e("circle",{cx:"12",cy:"19",r:"1"})]})}),d&&e(q,{onAssignClick:n?()=>{a(!1),n&&n()}:void 0,disableAssignButton:o,onOpenCognitive:t?e=>{a(!1),t&&t(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:r})]})}function G({users:n,onClick:o}){const t=n.length;return i("div",{onClick:o,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==n?void 0:n[0].length)>9?(null==n?void 0:n[0].slice(0,9))+"...":null==n?void 0:n[0]}),t>1&&i("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",t-1]})]})}function V({onClose:U,aiReason:q,onActionTrigger:V,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=b,toneColorsConfig:Z=S,dialConfigs:ee=y,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:te={},customIcons:le={},onOpenCognitive:re,showTone:de=!0,cognitiveSectionStyle:ae={},cognitiveScoreBadgeStyle:se={},cognitiveScoreTextStyle:ce={},cognitiveStyles:pe={},cognitiveClassNames:ge={},cognitiveTitle:ue="Cognitive Integrity",cognitiveTootipTitle:ve="Cognitive Decisioning",cognitiveLeftIcon:me,cognitiveIconSmall:xe,showCognitiveRightArrow:ye=!0,isStreaming:he,onAssignClick:fe,disableAssignButton:be=!1,assignedUsers:Se,onReviewUsersClick:Ce,redlineId:Ie,aiReasonId:ke}){var we,Be,Ae,Te,De,Re,Ee,ze,We,je,Le,Me,_e,Fe,He,Ne,Oe,Pe,Ue;let qe=Y.findIndex(e=>e===K);-1===qe&&(qe=1);const[$e,Ge]=s(!0),[Ve,Je]=s(!1),[Ke,Qe]=s(!1),[Xe,Ye]=s(qe),[Ze]=s(qe),ei=Y[Xe],ii=Z[ei]||"#BA7517",ni=Xe!==Ze,oi=[{id:"iterate",icon:le.iterateIcon||e(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:le.acceptIcon||e(t,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:le.rejectIcon||e(l,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ti,redlineConfig:li,updateRedlineDataParent:ri}=v(),di=ie||oi;return i("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(we=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===we?void 0:we.root},children:[i("div",{style:{...I,...null===(Be=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Be?void 0:Be.header,marginBottom:Ke?"16px":"12px"},children:[i("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{children:le.summaryIcon||e(r,{size:16,color:"#E24B4A"})}),e("span",{style:{...k,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.title},children:X.summaryHeader||"Summary"})]}),Se&&Se.length>0&&e(G,{users:Se,onClick:e=>{e.stopPropagation(),null==Ce||Ce()}})]}),i("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(fe||re)&&e($,{onAssignClick:fe,disableAssignButton:be,onOpenCognitive:re,cognitiveIconSmall:xe,cognitiveTootipTitle:ve}),e("button",{onClick:U,style:{...W,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.closeBtn,color:"#64748B"},children:"✕"})]})]}),e(u,{title:null===(De=null==q?void 0:q.redlining_details)||void 0===De?void 0:De.redline_title,children:e("p",{style:{...w,...null===(Re=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Re?void 0:Re.bodyText},children:null===(Ee=null==q?void 0:q.redlining_details)||void 0===Ee?void 0:Ee.redline_title})}),e("p",{style:{...B,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.summary},children:null===(We=null==q?void 0:q.redlining_details)||void 0===We?void 0:We.redline_summary}),i("div",{style:{...A,...null===(je=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===je?void 0:je.impactContainer},children:[i("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i("button",{onClick:()=>Ge(!$e),style:{...D,...null===(Le=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Le?void 0:Le.impactToggle},children:[e("span",{style:{...R,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactToggleLabel},children:X.impactHeader||"Impact"}),e("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:$e?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#E24B4A"})})]}),e(f,{type:(null==q?void 0:q.severity)||"Medium",customStyles:te})]}),$e&&e(n,{children:e("div",{style:{...T,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactText},children:e(x,{message:`${null!==(He=null===(Fe=null==q?void 0:q.redlining_details)||void 0===Fe?void 0:Fe.redline_impact)&&void 0!==He?He:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ne=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactMarkdown})})})]}),e("div",{style:{...E,...null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.actionContainer},children:di.map(e=>{var n,o;const t=ne||e.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...e.disabledStyle}:{};return i("button",{style:{...z,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:e.color,...e.style,...l},onClick:t?void 0:()=>{var i;e.useLabel?(async e=>{var i,n,o;null==V||V({status:"loading",action:e,metadata:{redlineId:Ie,aiReasonId:ke}});try{const{updated_reqai:t}=await m({documentId:ti,userEmail:null==li?void 0:li.userEmail,userName:null==li?void 0:li.userName,redlineId:null!==(i=null==q?void 0:q.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==li?void 0:li.baseApiUrl,redlineConfigId:null!==(n=null==li?void 0:li.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==li?void 0:li.token)&&void 0!==o?o:"");await(null==ri?void 0:ri(t)),null==V||V({status:"success",action:e,metadata:{redlineId:Ie,aiReasonId:ke}})}catch(e){null==V||V({status:"failed",action:null,metadata:{redlineId:Ie,aiReasonId:ke}})}})(e.id.toLowerCase()):null===(i=e.onClick)||void 0===i||i.call(e)},disabled:t,children:[e.icon,e.label]},e.id)})}),de&&i("div",{style:{...j,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.toneContainer},children:[i("button",{onClick:()=>Je(!Ve),style:{...L,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.toneToggleBtn},children:[i("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e(h,{toneIndex:Xe,configs:ee}),e("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),e("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#111"})})]}),Ve&&i(n,{children:[e("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),e(c,{isDirty:ni,onToneChange:e=>{Ye(e)},toneColor:ii,toneIndex:Xe,onClickRegenerate:()=>null==Q?void 0:Q(ei),toneLabels:Y,isStreaming:he,aiReason:q})]})]}),re&&i("div",{className:null==ge?void 0:ge.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...M,...null==pe?void 0:pe.section,...ae},children:[i("div",{className:null==ge?void 0:ge.headerLeft,style:{..._,...null==pe?void 0:pe.headerLeft},children:[e("span",{className:null==ge?void 0:ge.titleIcon,style:{...F,...null==pe?void 0:pe.titleIcon},children:null!=me?me:e(p,{})}),e("div",{className:null==ge?void 0:ge.cognitiveTitle,style:{...H,...null==pe?void 0:pe.cognitiveTitle},children:ue})]}),i("div",{className:null==ge?void 0:ge.headerRight,style:{...N,...null==pe?void 0:pe.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?i("span",{className:null==ge?void 0:ge.scoreBadge,style:{...O,...null==pe?void 0:pe.scoreBadge,...se},children:[e(g,{}),i("span",{className:null==ge?void 0:ge.scoreText,style:{...P,...null==pe?void 0:pe.scoreText,...ce},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,ye&&e("span",{style:{display:"flex",alignItems:"center"},children:e(a,{size:16,color:"#64748B"})})]})]})]})}export{q as AssignMenu,G as DisplayUsers,$ as KebabMenu,V as default};
1
+ import{jsxs as e,jsx as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as l,XCircle as t,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{memo as s,useState as c}from"react";import{ToneToggle as p}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as g}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as v}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as y}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as h}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],f=({toneIndex:n,configs:o=x})=>{const l=Math.min(n,o.length-1),{color:t,angle:r,arcD:d}=o[l]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:t,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})},S=({type:e,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},l=o[e]||o.Medium;return i("div",{style:l,children:e})},b=["Lenient","Balanced","Aggressive"],I={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},k={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},w={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},B={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},T={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},A={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},R={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},D={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},E={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},z={display:"flex",gap:8,marginBottom:18},j={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},W={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},L={borderTop:"0.5px solid #eee",padding:"14px 0px"},M={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},H={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},_={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},F={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},N={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},U={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},O={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},P={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},q={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},$=s(function({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...q,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:n,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),o&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>o(e),children:[l&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:l}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),d&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),G=s(function({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,p]=c(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>p(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i($,{onAssignClick:n?()=>{p(!1),n&&n()}:void 0,onOpenCognitive:o?e=>{p(!1),o&&o(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),V=s(function({users:n,onClick:o}){const l=n.length;return e("div",{onClick:o,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==n?void 0:n[0].length)>9?(null==n?void 0:n[0].slice(0,9))+"...":null==n?void 0:n[0]}),l>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",l-1]})]})});var J=s(function({onClose:s,aiReason:q,onActionTrigger:$,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=b,toneColorsConfig:Z=I,dialConfigs:ee=x,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:le={},customIcons:te={},onOpenCognitive:re,onHistoryClick:de,historyIconSmall:ae,historyTootipTitle:se,showTone:ce=!0,cognitiveSectionStyle:pe={},cognitiveScoreBadgeStyle:ge={},cognitiveScoreTextStyle:ve={},cognitiveStyles:ue={},cognitiveClassNames:me={},cognitiveTitle:ye="Cognitive Integrity",cognitiveTootipTitle:he="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:fe,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:Ie,assignedUsers:Ce,onReviewUsersClick:ke,redlineId:we,aiReasonId:Be}){var Te,Ae,Re,De,Ee,ze,je,We,Le,Me,He,_e,Fe,Ne,Ue,Oe,Pe,qe,$e;let Ge=Y.findIndex(e=>e===K);-1===Ge&&(Ge=1);const[Ve,Je]=c(!0),[Ke,Qe]=c(!1),[Xe,Ye]=c(!1),[Ze,ei]=c(Ge),[ii]=c(Ge),ni=Y[Ze],oi=Z[ni]||"#BA7517",li=Ze!==ii,ti=[{id:"iterate",icon:te.iterateIcon||i(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:te.acceptIcon||i(l,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:te.rejectIcon||i(t,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ri,redlineConfig:di,updateRedlineDataParent:ai}=m(),si=ie||ti;return e("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.root},children:[e("div",{style:{...k,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.header,marginBottom:Xe?"16px":"12px"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:te.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...w,...null===(Re=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Re?void 0:Re.title},children:X.summaryHeader||"Summary"})]}),Ce&&Ce.length>0&&i(V,{users:Ce,onClick:e=>{e.stopPropagation(),null==ke||ke()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ie||re)&&i(G,{onAssignClick:Ie,onOpenCognitive:re,cognitiveIconSmall:fe,cognitiveTootipTitle:he,historyIconSmall:ae,onHistoryClick:de,historyTootipTitle:se}),i("button",{onClick:s,style:{...W,...null===(De=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===De?void 0:De.closeBtn,color:"#64748B"},children:"✕"})]})]}),i(u,{title:null===(Ee=null==q?void 0:q.redlining_details)||void 0===Ee?void 0:Ee.redline_title,children:i("p",{style:{...B,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.bodyText},children:null===(je=null==q?void 0:q.redlining_details)||void 0===je?void 0:je.redline_title})}),i("p",{style:{...T,...null===(We=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===We?void 0:We.summary},children:null===(Le=null==q?void 0:q.redlining_details)||void 0===Le?void 0:Le.redline_summary}),e("div",{style:{...A,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>Je(!Ve),style:{...D,...null===(He=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===He?void 0:He.impactToggle},children:[i("span",{style:{...E,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactToggleLabel},children:X.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(S,{type:(null==q?void 0:q.severity)||"Medium",customStyles:le})]}),Ve&&i(n,{children:i("div",{style:{...R,...null===(Fe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.impactText},children:i(h,{message:`${null!==(Ue=null===(Ne=null==q?void 0:q.redlining_details)||void 0===Ne?void 0:Ne.redline_impact)&&void 0!==Ue?Ue:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.impactMarkdown})})})]}),i("div",{style:{...z,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.actionContainer},children:si.map(i=>{var n,o;const l=ne||i.disabled,t=l?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...j,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:i.color,...i.style,...t},onClick:l?void 0:()=>{var e;i.useLabel?(async e=>{var i,n,o;null==$||$({status:"loading",action:e,metadata:{redlineId:we,aiReasonId:Be}});try{const{updated_reqai:l}=await y({documentId:ri,userEmail:null==di?void 0:di.userEmail,userName:null==di?void 0:di.userName,redlineId:null!==(i=null==q?void 0:q.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==di?void 0:di.baseApiUrl,redlineConfigId:null!==(n=null==di?void 0:di.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==di?void 0:di.token)&&void 0!==o?o:"");await(null==ai?void 0:ai(l)),null==$||$({status:"success",action:e,metadata:{redlineId:we,aiReasonId:Be}})}catch(e){null==$||$({status:"failed",action:null,metadata:{redlineId:we,aiReasonId:Be}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:l,children:[i.icon,i.label]},i.id)})}),ce&&e("div",{style:{...L,...null===(qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===qe?void 0:qe.toneContainer},children:[e("button",{onClick:()=>Qe(!Ke),style:{...M,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(f,{toneIndex:Ze,configs:ee}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ke?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),Ke&&e(n,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),i(p,{isDirty:li,onToneChange:e=>{ei(e)},toneColor:oi,toneIndex:Ze,onClickRegenerate:()=>null==Q?void 0:Q(ni),toneLabels:Y,isStreaming:be,aiReason:q})]})]}),re&&e("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...H,...null==ue?void 0:ue.section,...pe},children:[e("div",{className:null==me?void 0:me.headerLeft,style:{..._,...null==ue?void 0:ue.headerLeft},children:[i("span",{className:null==me?void 0:me.titleIcon,style:{...F,...null==ue?void 0:ue.titleIcon},children:null!=xe?xe:i(g,{})}),i("div",{className:null==me?void 0:me.cognitiveTitle,style:{...N,...null==ue?void 0:ue.cognitiveTitle},children:ye})]}),e("div",{className:null==me?void 0:me.headerRight,style:{...U,...null==ue?void 0:ue.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?e("span",{className:null==me?void 0:me.scoreBadge,style:{...O,...null==ue?void 0:ue.scoreBadge,...ge},children:[i(v,{}),e("span",{className:null==me?void 0:me.scoreText,style:{...P,...null==ue?void 0:ue.scoreText,...ve},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,Se&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var n,o,l,t,r,d,a,s,c,p;return e.isStreaming===i.isStreaming&&(e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&((null===(n=e.aiReason)||void 0===n?void 0:n.id)===(null===(o=i.aiReason)||void 0===o?void 0:o.id)&&((null===(l=e.aiReason)||void 0===l?void 0:l.resolving)===(null===(t=i.aiReason)||void 0===t?void 0:t.resolving)&&((null===(d=null===(r=e.aiReason)||void 0===r?void 0:r.redlining_details)||void 0===d?void 0:d.status)===(null===(s=null===(a=i.aiReason)||void 0===a?void 0:a.redlining_details)||void 0===s?void 0:s.status)&&((null===(c=e.assignedUsers)||void 0===c?void 0:c.length)===(null===(p=i.assignedUsers)||void 0===p?void 0:p.length)&&(!e.assignedUsers||!i.assignedUsers||e.assignedUsers.join(",")===i.assignedUsers.join(",")))))))))});export{$ as AssignMenu,V as DisplayUsers,G as KebabMenu,J as default};
2
2
  //# sourceMappingURL=DeviationSummary.js.map