@viswa-test/test-citation 0.0.22 → 0.0.23
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.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConfig.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js +2 -0
- package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/ResizableSplitPane.js +2 -0
- package/dist/cjs/features/CognitiveCompare/ResizableSplitPane.js.map +1 -0
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +2 -0
- package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConfig.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js +2 -0
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js.map +1 -0
- package/dist/features/CognitiveCompare/ResizableSplitPane.js +2 -0
- package/dist/features/CognitiveCompare/ResizableSplitPane.js.map +1 -0
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +1 -0
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts +27 -0
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConfig.d.ts +23 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConfig.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +44 -2
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +4 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts +4 -2
- package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts +13 -0
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/ResizableSplitPane.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/ResizableSplitPane.d.ts.map +1 -0
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +3 -2
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +3 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +5 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("lucide-react"),l=require("react"),t=require("./ResizableSplitPane.js"),o=require("../PdfViewer/PdfViewer.js");exports.default=function(r){var a,u,d,s=r.href,c=r.children,g=r.metaData,v=r.chevronUpComponent,h=void 0===v?null:v,p=r.chevronDownComponent,f=void 0===p?null:p,m=r.customStyle,_=void 0===m?{}:m,x=r.defaultState,j=void 0!==x&&x,b=l.useState(j),w=b[0],y=b[1],P="string"==typeof c&&(null===(a=null==c?void 0:c.split("\n"))||void 0===a?void 0:a.length)>1?c.split("\n").join(" "):c,C=null!=h?h:function(e){var l,t;return n.jsx(i.ChevronUp,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(u=null==_?void 0:_.arrow)&&void 0!==u?u:{}),S=null!=f?f:function(e){var l,t;return n.jsx(i.ChevronDown,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(d=null==_?void 0:_.arrow)&&void 0!==d?d:{}),D=["contract","clause"];return n.jsxs("span",e.__assign({style:e.__assign({display:"inline"},_.relativeWrapper||{})},{children:[n.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},_.citationButtonWrapper||{})},{children:n.jsxs("button",e.__assign({type:"button",onClick:function(){return y(function(e){return!e})},style:e.__assign({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},_.citationButton||{})},{children:[n.jsx("span",{children:P}),n.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:w?C:S}))]}))})),w&&n.jsx(n.Fragment,{children:n.jsx(function(){var e,i,l,r,a,u,d;console.log("citation details",s,c,g,P);var v=function(e){try{return new URL(e,window.location.origin).searchParams.get("citationNumber")}catch(e){return null}}(s);if(!v)return null;var h=(null===(e=null==g?void 0:g.citations)||void 0===e?void 0:e[v])||{},p=(null===(i=null==g?void 0:g.docData)||void 0===i?void 0:i.documents)||{},f=(null===(l=null==g?void 0:g.docData)||void 0===l?void 0:l.input_index_map)||{},m=null==f?void 0:f[0],_=null==f?void 0:f[1],x=m?p[m]:null,j=_?p[_]:null,b=m?h[m]:null,w=_?h[_]:null;if(D.includes(P[0])){console.log("leftDocument",x,"rightDocument",j);var y=b?n.jsx(o.default,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:x.title,pdfUrl:x.signed_url,highlightText:[null!==(r=null==b?void 0:b.highlighted_text)&&void 0!==r?r:""],highlightPages:{1:null===(a=null==b?void 0:b.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,C=w?n.jsx(o.default,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:j.title,pdfUrl:j.signed_url,jumpToPageValue:1,highlightText:[null!==(u=null==w?void 0:w.highlighted_text)&&void 0!==u?u:""],highlightPages:{1:null===(d=null==w?void 0:w.custom_metadata)||void 0===d?void 0:d.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return n.jsx("div",{children:n.jsx(t.default,{leftComponent:y,rightComponent:C})})}return n.jsx(n.Fragment,{children:"HEllo issue here"})},{})})]}))};
|
|
2
|
+
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationAnchor.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(i),g=u(l),h={id:"",title:""};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var u,v,x,f,p,_,m,y,F=l.componentHeaderText,S=void 0===F?"Learning Comparison":F,E=l.treeData,b=l.comparisonConfig,w=l.leftColumnTitleText,C=l.rightColumnTitleText,j=l.markdownStyles,R=i.useState(null),A=R[0],D=R[1],I=i.useMemo(function(){return(null==E?void 0:E.cognitive_decisioning)||{}},[E]);i.useRef(null);var B=i.useState(null),T=B[0],M=B[1],O=i.useRef(null),k=i.useState({width:0,height:0}),N=k[0],L=k[1],z=i.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),j)},[j]),H=i.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),W=H[0],P=H[1],q=i.useRef(null),U=i.useRef(null),G=i.useRef(!1),V=i.useRef(null);i.useEffect(function(){V.current=null},[W.sectionIdx,W.open]);var K=i.useCallback(function(){var e;if(W.anchorEl&&W.refSectionTitle){var n=W.anchorEl.getBoundingClientRect(),i=(null===(e=null==O?void 0:O.current)||void 0===e?void 0:e.offsetHeight)||0,t=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<i&&r>o;null!==V.current?!0===V.current&&(l=r>=i||r>=o):l=!(o>=i||o>=r),V.current=l;var s=l?r:o,a=Math.min(i||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-t/2,g=Math.max(12,Math.min(d,window.innerWidth-t-12)),h=Math.max(14,Math.min(u-g,t-10-4));M({top:c,left:g,arrowLeft:h,openAbove:l,maxHeight:s})}},[W.anchorEl,W.refSectionTitle]);i.useEffect(function(){if(W.open){window.addEventListener("resize",K);var e=requestAnimationFrame(K),n=null;return O.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(K)})).observe(O.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",K),n&&n.disconnect()}}},[W.open,K]),i.useEffect(function(){var n=q.current;if(n&&W.open){var i=function(n){O.current&&O.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",i,{capture:!0}),window.addEventListener("scroll",i,{capture:!0}),function(){n.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0})}}},[W.open]);var Y=i.useMemo(function(){var n,i,t,o,r,l,s,c,u,d,g,h;return{fields:null!==(n=null==b?void 0:b.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(i=null==b?void 0:b.thresholds)||void 0===i?void 0:i.high)&&void 0!==t?t:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(r=null===(o=null==b?void 0:b.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==b?void 0:b.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==b?void 0:b.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==b?void 0:b.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==b?void 0:b.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(g=null==b?void 0:b.relationStyles)||void 0===g?void 0:g.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(h=null==b?void 0:b.relationStyles)||void 0===h?void 0:h.low)||{})}}},[b]),J=i.useMemo(function(){if(E&&Object.keys(E).length>0)try{var n=function(n){var i,t,o,r,l=[],a=[],c=n.base_root_id,u=n.input_index_map||{0:"left",1:"right"},d=n[c];if(!d||!1===d.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(i){var t=n[i];if(t&&!1!==t.display_node){var o=s.getRationale(t),r=s.getSideData(t,"0",u),c=s.getSideData(t,"1",u),d=r.title.trim()||r.content.trim(),h=c.title.trim()||c.content.trim();l.push(e.__assign({id:i,title:d?r.title:"",content:d?r.content:"",subsections:[]},d?o:{score:void 0,relation:"not_defined"})),a.push(e.__assign({id:i,title:h?c.title:"",content:h?c.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),t.next&&Object.values(t.next).forEach(g)}};return d.next&&Object.values(d.next).forEach(g),{activeProposed:{title:(null===(t=null===(i=d.comparison_inputs)||void 0===i?void 0:i[u[0]])||void 0===t?void 0:t.title)||"Uploaded Contract",description:d.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=d.comparison_inputs)||void 0===o?void 0:o[u[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:a,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:d.decision_scope_description||""},fields:{}}}}]}}(E);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[E]),Q=J.activeProposed,X=J.activeVariants,Z=J.parseError;i.useEffect(function(){Z&&D("Failed to load comparison: ".concat(Z))},[Z]);var $=i.useState(null),ee=$[0];$[1];var ne=i.useState({}),ie=ne[0],te=ne[1],oe=X[0]||h,re=null===(x=null===(u=null==E?void 0:E.documents)||void 0===u?void 0:u[null===(v=null==E?void 0:E.input_index_map)||void 0===v?void 0:v[0]])||void 0===x?void 0:x.title,le=null===(_=null===(f=null==E?void 0:E.documents)||void 0===f?void 0:f[null===(p=null==E?void 0:E.input_index_map)||void 0===p?void 0:p[1]])||void 0===_?void 0:_.title,se=s.safeStringify(w||re||"Uploaded Contract"),ae=s.safeStringify(C||le||"Reference Template"),ce=i.useMemo(function(){return Q.sections||[]},[Q.sections]),ue=i.useMemo(function(){return oe.sections||[]},[oe.sections]),de=ce.length>0||ue.length>0,ge=oe.analysis,he=s.safeStringify(null===(y=null===(m=null==ge?void 0:ge.rule_difference_comparison)||void 0===m?void 0:m.summary)||void 0===y?void 0:y.overall_summary),ve=!!he.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xe=i.useRef({}),fe=function(e){return xe.current[e]||(xe.current[e]=d.default.createRef()),xe.current[e]},pe=i.useRef(null),_e=i.useRef(null),me=i.useRef(null),ye=i.useState([]),Fe=ye[0],Se=ye[1],Ee=i.useState(null),be=Ee[0],we=Ee[1],Ce=i.useMemo(function(){return Y.fields.filter(function(e){var n=e.key;return(!de||"description"!==n)&&(s.hasValue(Q[n])||s.hasValue(oe[n]))})},[Q,oe,de,Y.fields]),je=i.useRef({}),Re=i.useRef({}),Ae=i.useRef({}),De=i.useRef({});Ce.forEach(function(e){var n=e.key;je.current[n]||(je.current[n]=d.default.createRef()),Re.current[n]||(Re.current[n]=d.default.createRef())});for(var Ie=0;Ie<Math.max(ce.length,ue.length);Ie+=1)Ae.current[Ie]||(Ae.current[Ie]=d.default.createRef()),De.current[Ie]||(De.current[Ie]=d.default.createRef());i.useEffect(function(){if(ee){var e=Y.fields.find(function(e){return e.analysisKey===ee||e.key===ee});if(e){var n=je.current[e.key]||Re.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ee,Y.fields]);var Be=i.useCallback(function(e){var n,i,t,o,r,l,s,a,c,u=null===(n=null==ge?void 0:ge.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],g=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var h=d.mappings[0]||{};return{score:d.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=h.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!g}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!g}},[ge]),Te=i.useCallback(function(n){var i,t,o=ce[n],r=ue[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,a=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,c=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!a&&!c)return e.__assign(e.__assign({},Y.relationStyles.noContent),{label:"Not Defined"});var u=Be("description");if(null!=(null!==(i=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==i?i:null==r?void 0:r.cognitiveRelevanceScore)){var d=s.cognitiveScoreToRelation(),g=d.score,h=d.relation;return s.getStyleForRelation(g,h,!0,Y)}var v=l?o.relation:a?r.relation:u.relation,x=null!==(t=null==o?void 0:o.score)&&void 0!==t?t:null==r?void 0:r.score,f="number"==typeof x?x:u.score;return s.getStyleForRelation(f,v,!0,Y)},[ce,ue,Y,Be]),Me=i.useCallback(function(){var e,n,i,t,o,r,l,a,c,u,d;if(!G.current){G.current=!0;try{if(!pe.current)return;var g=pe.current.getBoundingClientRect();L({width:g.width,height:g.height});var h=[];Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(ce.length,ue.length);v++){var x=null===(e=Ae.current[v])||void 0===e?void 0:e.current,f=null===(n=De.current[v])||void 0===n?void 0:n.current;x&&f&&(x.style.height="auto",f.style.height="auto",x.style.minHeight="0px",f.style.minHeight="0px")}var p={};Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=o.getBoundingClientRect(),s=r.getBoundingClientRect();p[t]=Math.max(l.height,s.height)}});var _=[];for(v=0;v<Math.min(ce.length,ue.length);v++){x=null===(i=Ae.current[v])||void 0===i?void 0:i.current,f=null===(t=De.current[v])||void 0===t?void 0:t.current;if(x&&f){var m=x.getBoundingClientRect(),y=f.getBoundingClientRect();_[v]=Math.max(m.height,y.height)}}Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=p[t];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<_.length;v++){x=null===(o=Ae.current[v])||void 0===o?void 0:o.current,f=null===(r=De.current[v])||void 0===r?void 0:r.current;if(x&&f){var F=_[v];x.style.minHeight="".concat(F,"px"),f.style.minHeight="".concat(F,"px")}}Ce.forEach(function(e){var n,i,t=e.key,o=e.analysisKey,r=null===(n=je.current[t])||void 0===n?void 0:n.current,l=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(r&&l){var a=r.getBoundingClientRect(),c=l.getBoundingClientRect(),u=Be(o),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,Y);if(!d)return;var v=a.top+a.height/2-g.top;h.push({id:"field-".concat(t),x1:a.right-g.left,y1:v,x2:c.left-g.left,y2:v,style:d})}});for(v=0;v<Math.min(ce.length,ue.length);v++){var S=null===(l=Ae.current[v])||void 0===l?void 0:l.current,E=null===(a=De.current[v])||void 0===a?void 0:a.current;if(S&&E){var b=S.querySelector(".MuiAccordionSummary-root"),w=E.querySelector(".MuiAccordionSummary-root");if(b&&w){var C=b.getBoundingClientRect(),j=w.getBoundingClientRect(),R=(C.top+C.height/2-g.top+j.top+j.height/2-g.top)/2,A=(null===(c=ue[v])||void 0===c?void 0:c.id)||"sec-".concat(v),D=Te(v);D&&h.push({id:A,x1:C.right-g.left,y1:R,x2:j.left-g.left,y2:R,style:D,sectionIdx:v,hasCognitive:!(!(null===(u=ce[v])||void 0===u?void 0:u.cognitiveData)&&!(null===(d=ue[v])||void 0===d?void 0:d.cognitiveData))})}}}if(Se(h),_e.current&&me.current){var I=_e.current.getBoundingClientRect(),B=me.current.getBoundingClientRect(),T=(I.top+I.height/2-g.top+B.top+B.height/2-g.top)/2;we({x1:I.right-g.left,x2:B.left-g.left,y:T})}else we(null)}catch(e){console.error("Line render safe fail: ",e)}finally{G.current=!1}}},[Ce,ce,ue,Y,Be,Te]),Oe=i.useCallback(function(){window.requestAnimationFrame(Me)},[Me]);i.useEffect(function(){var e=setTimeout(Oe,250);window.addEventListener("resize",Oe);var n=null,i=null;return q.current&&(n=new ResizeObserver(Oe)).observe(q.current),pe.current&&(i=new ResizeObserver(Oe)).observe(pe.current),function(){clearTimeout(e),window.removeEventListener("resize",Oe),null==n||n.disconnect(),null==i||i.disconnect()}},[Q,oe,ge,Ce,ie,ce,ue,Y,Oe]);var ke=function(i,r,l,a){var c,u=!s.hasValue(i.title)&&!s.hasValue(i.content);return n.jsx(t.Box,e.__assign({ref:a,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!u&&!!ie[r],onChange:function(){return!u&&(n=r,void te(function(i){var t;return e.__assign(e.__assign({},i),((t={})[n]=!i[n],t))}));var n},sx:{boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:u?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:u?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(t.Tooltip,e.__assign({title:i.title||"No Matching Section Found",placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"12px",color:u?"#94A3B8":"#19213D",fontWeight:u?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(c=i.title||"No Matching Section Found",c?s.safeStringify(c).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(d.default.Fragment,{children:e},i)}):null)}))}))})),!u&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(i,o){return n.jsx(t.Box,e.__assign({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(o))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n.jsxs(t.Box,e.__assign({ref:U,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[W.open&&n.jsx(c.default,{open:W.open,popupRef:O,position:T,onClose:function(){M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:j,sectionTitle:W.sectionTitle,referenceSectionTitle:W.refSectionTitle,cognitiveData:W.cognitiveData,anchorEl:W.anchorEl,sectionAnchorEl:W.sectionAnchorEl,scrollContainerEl:q.current,badgeStyle:W.badgeStyle}),n.jsx(t.Snackbar,e.__assign({open:!!A,autoHideDuration:8e3,onClose:function(){return D(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return D(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:A}))})),n.jsx(t.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:S}))}))})),n.jsx(t.Box,e.__assign({ref:q,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:he&&ve?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n.jsxs(t.Box,e.__assign({ref:pe,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:N.width||"100%",height:N.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[be&&n.jsxs("g",{children:[n.jsx("line",{x1:be.x1,y1:be.y,x2:Math.max(be.x1,(be.x1+be.x2)/2-70),y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(be.x2,(be.x1+be.x2)/2+70),y1:be.y,x2:be.x2,y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Fe.map(function(i,l){var a=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n.jsxs("g",{children:[n.jsx("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n.jsxs(t.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),W.open&&W.sectionIdx===i.sectionIdx)return M(null),void P(function(n){return e.__assign(e.__assign({},n),{open:!1})});!function(e,n,i,t,o){var r,l;e.stopPropagation(),M(null);var a=s.safeStringify(n.id)||s.safeStringify(i.id)||"",c=(a?I[a]:null)||n.cognitiveData||i.cognitiveData||null,u=null!==(l=null===(r=xe.current[t])||void 0===r?void 0:r.current)&&void 0!==l?l:null;P({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:i.title||"NA",cognitiveData:c,anchorEl:e.currentTarget,sectionAnchorEl:u,badgeStyle:o||null,sectionIdx:t})}(n,ce[i.sectionIdx]||{title:"",content:""},ue[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(r.ButtonCognitiveIcon,{})}))})),W.open&&W.sectionIdx===i.sectionIdx?n.jsx(o.ChevronUp,{size:12,color:i.style.badgeText}):n.jsx(o.ChevronDown,{size:12,color:i.style.badgeText})]}))]}))}))}))]},l):null})]})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:_e,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:se,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:se}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ce.map(function(e,n){return{section:e,idx:n}}).map(function(i){var o=i.section,r=i.idx;return n.jsx(t.Box,e.__assign({ref:fe(r)},{children:ke(o,r,"left",Ae.current[r]||d.default.createRef())}),"left-row-".concat(r))})}))]})),n.jsx(t.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[n.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(o.ChevronDown,{size:11})]}))}))})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:me,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:ae,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:ae}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ue.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,i=e.idx;return ke(n,i,"right",De.current[i]||d.default.createRef())})}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js"),u=require("./MoreFunctionsPopup.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),x=d(l),p={id:"",title:""},v={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var d,g,h,_,m,y,b,S,F=l.componentHeaderText,E=void 0===F?"Learning Comparison":F,w=l.treeData,I=l.comparisonConfig,j=l.leftColumnTitleText,C=l.rightColumnTitleText,R=l.markdownStyles,B=l.maintainRelativeOrder,T=void 0!==B&&B,D=l.popupConfig,A=t.useState(null),k=A[0],O=A[1],M=t.useState(!1),N=M[0],L=M[1],z=t.useState(!1),H=z[0],W=z[1],P=t.useRef(!1),q=t.useMemo(function(){return(null==w?void 0:w.cognitive_decisioning)||{}},[w]),V=t.useState(null),U=V[0],G=V[1],Y=t.useRef(null),X=t.useState({width:0,height:0}),K=X[0],J=X[1],Q=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),R)},[R]),Z=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),$=Z[0],ee=Z[1],ne=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),te=ne[0],ie=ne[1],re=t.useRef(null),oe=t.useRef(null),le=t.useRef(!1),se=t.useRef(null);t.useEffect(function(){se.current=null},[$.sectionIdx,$.open]);var ae=t.useCallback(function(){G(null),ee(v)},[]),ce=t.useCallback(function(){ie(v)},[]),ue=t.useCallback(function(){var e;if($.anchorEl&&$.refSectionTitle){var n=$.anchorEl.getBoundingClientRect(),t=(null===(e=null==Y?void 0:Y.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==se.current?!0===se.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),se.current=l;var s=l?o:r,a=Math.min(t||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-i/2,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),x=Math.max(14,Math.min(u-f,i-10-4));G({top:c,left:f,arrowLeft:x,openAbove:l,maxHeight:s})}},[$.anchorEl,$.refSectionTitle]);t.useEffect(function(){if($.open){window.addEventListener("resize",ue);var e=requestAnimationFrame(ue),n=null;return Y.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(ue)})).observe(Y.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ue),n&&n.disconnect()}}},[$.open,ue]),t.useEffect(function(){var e=re.current;if(e&&$.open){var n=function(e){Y.current&&Y.current.contains(e.target)||(G(null),ae())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[$.open,ae]),t.useEffect(function(){var e=re.current;if(e&&te.open){var n=function(){ce()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[te.open,ce]);var de=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,x;return{fields:null!==(n=null==I?void 0:I.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==I?void 0:I.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==I?void 0:I.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==I?void 0:I.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==I?void 0:I.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==I?void 0:I.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==I?void 0:I.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==I?void 0:I.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(x=null==I?void 0:I.relationStyles)||void 0===x?void 0:x.low)||{})}}},[I]),fe=t.useMemo(function(){if(w&&Object.keys(w).length>0)try{var n=function(n,t){var i,r,o,l,a,c,u,d;void 0===t&&(t=!1);var f=[],x=[],p=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},g=n[p];if(!g||!1===g.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,i){var r=n[t];if(!r)return null;var o=s.getSideData(r,i,v),l=!!o.title.trim(),a=!!o.content.trim(),c=s.getRationale(r),u=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=h(e,i);t&&u.push(t)}});var d=!(!l&&!a);return e.__assign({id:t,title:l?o.title:"",content:a?o.content:"",subsections:u},d?c:{score:void 0,relation:"not_defined"})};if(t){var _={},m={},y=-1,b=-1;for(var S in n)if(!["base_root_id","documents","input_index_map",p].includes(S)){var F=n[S];if(F&&!1!==F.display_node){var E=s.getRationale(F),w=s.getSideData(F,"0",v),I=s.getSideData(F,"1",v),j=w.title.trim()||w.content.trim(),C=I.title.trim()||I.content.trim(),R=Number(null!==(r=null===(i=w.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),B=Number(null!==(l=null===(o=I.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),T=m[B]||e.__assign(e.__assign({id:S,title:C?I.title:"",content:C?I.content:"",subsections:[]},C?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:B}),D=_[R]||e.__assign(e.__assign({id:S,title:j?w.title:"",content:j?w.content:"",subsections:[]},j?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:R});Number(B)>=0&&Number(R)>=0&&(T.refIndexes.includes(Number(R))||T.refIndexes.push(Number(R)),D.refIndexes.includes(Number(B))||D.refIndexes.push(Number(B))),m[B]=T,_[R]=D}}x=Object.values(m).map(function(e){return e}),f=Object.values(_).map(function(e){return e}),x.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else g.next&&Object.values(g.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(f.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),x.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(c=null===(a=g.comparison_inputs)||void 0===a?void 0:a[v[0]])||void 0===c?void 0:c.title)||"Uploaded Contract",description:g.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(u=g.comparison_inputs)||void 0===u?void 0:u[v[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:x,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:g.decision_scope_description||""},fields:{}}}}]}}(w,T);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[w,T]),xe=fe.activeProposed,pe=fe.activeVariants,ve=fe.parseError;t.useEffect(function(){ve&&O("Failed to load comparison: ".concat(ve))},[ve]);var ge=t.useState(null),he=ge[0];ge[1];var _e=t.useState({}),me=_e[0],ye=_e[1],be=t.useState({}),Se=be[0],Fe=be[1],Ee=(null==pe?void 0:pe[0])||p,we=null===(h=null===(d=null==w?void 0:w.documents)||void 0===d?void 0:d[null===(g=null==w?void 0:w.input_index_map)||void 0===g?void 0:g[0]])||void 0===h?void 0:h.title,Ie=null===(y=null===(_=null==w?void 0:w.documents)||void 0===_?void 0:_[null===(m=null==w?void 0:w.input_index_map)||void 0===m?void 0:m[1]])||void 0===y?void 0:y.title,je=s.safeStringify(j||we||"Uploaded Contract"),Ce=s.safeStringify(C||Ie||"Reference Template"),Re=t.useMemo(function(){return(null==xe?void 0:xe.sections)||[]},[null==xe?void 0:xe.sections]),Be=t.useMemo(function(){return Ee.sections||[]},[Ee.sections]),Te=Re.length>0||Be.length>0,De=Ee.analysis,Ae=s.safeStringify(null===(S=null===(b=null==De?void 0:De.rule_difference_comparison)||void 0===b?void 0:b.summary)||void 0===S?void 0:S.overall_summary),ke=!!Ae.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Oe=t.useRef({}),Me=function(e){return Oe.current[e]||(Oe.current[e]=f.default.createRef()),Oe.current[e]},Ne=t.useCallback(function(e,n,t,i,r){var o,l,a=s.safeStringify(n.id)||s.safeStringify(t.id)||"",c=(a?q[a]:null)||n.cognitiveData||t.cognitiveData||{section_id:a,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=Oe.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:c,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==w?void 0:w.documents,input_index_map:null==w?void 0:w.input_index_map}}},[q]),Le=t.useCallback(function(e){ce(),G(null),ee(e)},[ce]),ze=t.useCallback(function(){null!==te.sectionIdx&&te.anchorEl?Le(e.__assign(e.__assign({},te),{open:!0})):ce()},[te,ce,Le]);t.useCallback(function(e){ce(),O("".concat(e," is coming soon."))},[ce]);var He=t.useRef(null),We=t.useRef(null),Pe=t.useRef(null),qe=t.useState([]),Ve=qe[0],Ue=qe[1],Ge=t.useState(null),Ye=Ge[0],Xe=Ge[1],Ke=t.useRef(null),Je=t.useState(null),Qe=Je[0],Ze=Je[1],$e=t.useCallback(function(){var e=te.sectionIdx;ce(),null!==e&&(N&&Ye===e?(L(!1),Xe(null),W(!1)):(P.current=!0,Xe(e),L(!0),W(!1),setTimeout(function(){var n,t=null===(n=Oe.current[e])||void 0===n?void 0:n.current;t&&t.scrollIntoView({behavior:"smooth",block:"center"})},50),setTimeout(function(){W(!0),P.current=!1},600)))},[ce,te.sectionIdx,N,Ye]),en=t.useMemo(function(){return de.fields.filter(function(e){var n=e.key;return(!Te||"description"!==n)&&(s.hasValue(null==xe?void 0:xe[n])||s.hasValue(Ee[n]))})},[xe,Ee,Te,de.fields]),nn=t.useRef({}),tn=t.useRef({}),rn=t.useRef({}),on=t.useRef({}),ln=t.useRef({}),sn=t.useRef({}),an=t.useRef({});en.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Re.length,Be.length);t+=1)rn.current[t]||(rn.current[t]=f.default.createRef()),on.current[t]||(on.current[t]=f.default.createRef()),ln.current[t]||(ln.current[t]=f.default.createRef()),sn.current[t]||(sn.current[t]=f.default.createRef()),an.current[t]||(an.current[t]=f.default.createRef());nn.current[n]||(nn.current[n]=f.default.createRef()),tn.current[n]||(tn.current[n]=f.default.createRef())});for(var cn=0;cn<Math.max(Re.length,Be.length);cn+=1)rn.current[cn]||(rn.current[cn]=f.default.createRef()),on.current[cn]||(on.current[cn]=f.default.createRef()),ln.current[cn]||(ln.current[cn]=f.default.createRef()),sn.current[cn]||(sn.current[cn]=f.default.createRef()),an.current[cn]||(an.current[cn]=f.default.createRef());t.useEffect(function(){if(he){var e=de.fields.find(function(e){return e.analysisKey===he||e.key===he});if(e){var n=nn.current[e.key]||tn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[he,de.fields]);var un=t.useCallback(function(e){var n,t,i,r,o,l,s,a,c,u=null===(n=null==De?void 0:De.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],f=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==d?void 0:d.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var x=d.mappings[0]||{};return{score:d.score,relation:x.relation||"",highlightsA:(null===(l=x.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=x.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}},[De]),dn=t.useCallback(function(n){var t,i,r,o,l=Re[n],a=Be[n],c=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,d=s.safeStringify(null==l?void 0:l.id)||s.safeStringify(null==a?void 0:a.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!c&&!u&&!f)return e.__assign(e.__assign({},de.relationStyles.noContent),{label:"Not Defined"});var x=un("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=q[d])||void 0===r?void 0:r.relevance_score:void 0)){var p=s.cognitiveScoreToRelation(),v=p.score,g=p.relation;return s.getStyleForRelation(v,g,!0,de)}var h=c?l.relation:u?a.relation:x.relation,_=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==a?void 0:a.score,m="number"==typeof _?_:x.score;return s.getStyleForRelation(m,h,!0,de)},[Re,Be,q,de,un]),fn=t.useCallback(function(){var e,n,t,i,r,o,l,a,c,u,d,f,x;if(!le.current){le.current=!0;try{if(!He.current)return;if(Object.values(Oe.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Object.values(an.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),T&&N&&null!==Ye){var p=Re[Ye],v=(null==p?void 0:p.refIndexes)||[];if(v.length>0){var g=v[0],h=Be.findIndex(function(e){return e.selfIndex===g});if(-1!==h){var _=null===(e=Oe.current[Ye])||void 0===e?void 0:e.current,m=null===(n=an.current[h])||void 0===n?void 0:n.current;if(_&&m){var y=_.getBoundingClientRect().top-m.getBoundingClientRect().top;if(m.style.transition="padding-top 0.3s ease-in-out",y>1)m.style.paddingTop="".concat(y,"px");else if(y<-1){var b=m.parentElement;b&&(P.current=!0,b.scrollTo({top:b.scrollTop+Math.abs(y),behavior:"smooth"}),setTimeout(function(){P.current=!1},400))}}}}}var S=He.current.getBoundingClientRect();J({width:S.width,height:S.height});var F=[];if(en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!T)for(var E=0;E<Math.min(Re.length,Be.length);E++){var w=null===(t=rn.current[E])||void 0===t?void 0:t.current,I=null===(i=on.current[E])||void 0===i?void 0:i.current;w&&I&&(w.style.height="auto",I.style.height="auto",w.style.minHeight="0px",I.style.minHeight="0px")}var j={};en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();j[i]=Math.max(l.height,s.height)}});var C=[];if(!T)for(E=0;E<Math.min(Re.length,Be.length);E++){w=null===(r=rn.current[E])||void 0===r?void 0:r.current,I=null===(o=on.current[E])||void 0===o?void 0:o.current;if(w&&I){var R=w.getBoundingClientRect(),B=I.getBoundingClientRect();C[E]=Math.max(R.height,B.height)}}if(en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=j[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!T)for(E=0;E<C.length;E++){w=null===(l=rn.current[E])||void 0===l?void 0:l.current,I=null===(a=on.current[E])||void 0===a?void 0:a.current;if(w&&I){var D=C[E];w.style.minHeight="".concat(D,"px"),I.style.minHeight="".concat(D,"px")}}if(en.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=nn.current[i])||void 0===n?void 0:n.current,l=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(o&&l){var a=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=un(r),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,de);if(!d)return;var f=a.top+a.height/2-S.top;F.push({id:"field-".concat(i),x1:a.right-S.left,y1:f,x2:c.left-S.left,y2:f,style:d})}}),T)Re.forEach(function(e,n){var t;(null===(t=rn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Be.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=ln.current[n])||void 0===t?void 0:t.current,l=null===(i=sn.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),c=s.right-S.left,u=a.left-S.left,d=s.top+s.height/2-S.top,f=a.top+a.height/2-S.top,x=dn(n);x&&F.push({id:"line-".concat(n,"-").concat(r),x1:c,y1:d,x2:u,y2:f,style:x,sectionIdx:n,targetRightIdx:r})}}})});else for(E=0;E<Math.min(Re.length,Be.length);E++){var A=null===(c=rn.current[E])||void 0===c?void 0:c.current,k=null===(u=on.current[E])||void 0===u?void 0:u.current;if(A&&k){var O=A.querySelector(".MuiAccordionSummary-root"),M=k.querySelector(".MuiAccordionSummary-root");if(O&&M){var L=O.getBoundingClientRect(),z=M.getBoundingClientRect(),H=(L.top+L.height/2-S.top+z.top+z.height/2-S.top)/2,W=(null===(d=Be[E])||void 0===d?void 0:d.id)||"sec-".concat(E),V=dn(E);V&&F.push({id:W,x1:L.right-S.left,y1:H,x2:z.left-S.left,y2:H,style:V,sectionIdx:E,hasCognitive:!!((null===(f=Re[E])||void 0===f?void 0:f.cognitiveData)||(null===(x=Be[E])||void 0===x?void 0:x.cognitiveData)||W&&q[W])})}}}if(Ue(F),We.current&&Pe.current){var U=We.current.getBoundingClientRect(),G=Pe.current.getBoundingClientRect(),Y=(U.top+U.height/2-S.top+G.top+G.height/2-S.top)/2;Ze({x1:U.right-S.left,x2:G.left-S.left,y:Y})}else Ze(null)}catch(e){console.error("Line render safe fail: ",e)}finally{le.current=!1}}},[en,Re,Be,q,de,un,dn,T,N,Ye,Se]),xn=t.useCallback(function(){null!==Ke.current&&window.cancelAnimationFrame(Ke.current),Ke.current=window.requestAnimationFrame(function(){fn(),Ke.current=null})},[fn]),pn=t.useCallback(function(){xn(),N&&!P.current&&(L(!1),Xe(null),W(!1))},[xn,N]);t.useEffect(function(){var e=setTimeout(xn,250);window.addEventListener("resize",xn);var n=null,t=null;return re.current&&(n=new ResizeObserver(xn)).observe(re.current),He.current&&(t=new ResizeObserver(xn)).observe(He.current),function(){clearTimeout(e),window.removeEventListener("resize",xn),null==n||n.disconnect(),null==t||t.disconnect()}},[xe,Ee,De,en,me,Re,Be,de,xn]);var vn=function(t,o,l,a,c){void 0===c&&(c=1);var u,d=T?!!me["".concat(l,"-").concat(o)]:!!me[String(o)],p=s.hasValue(t.title),v=s.hasValue(t.content),g=!p&&!v,h=t.title;return p||(h=v?"No Title Found":"No Matching Section Found"),n.jsx(i.Box,e.__assign({ref:a,sx:e.__assign(e.__assign({mb:c},T?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!g&&d,onChange:function(){return!g&&function(n,t){ye(function(i){var r=e.__assign({},i);if(!T){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),s=!i[l];if(r[l]=s,"left"===t)((null==(a=Re[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=Be.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var a,c=null==(a=Be[n])?void 0:a.selfIndex;Re.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c))&&(r["left-".concat(n)]=s)})}return r})}(o,l)},sx:{boxShadow:"none",border:g?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:g?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:g?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:g?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(i.Tooltip,e.__assign({title:h,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:g?"#94A3B8":"#19213D",fontWeight:g?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=h,u?s.safeStringify(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(f.default.Fragment,{children:e},t)}):null)}))}))})),!g&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},gn=function(t,o,l){void 0===l&&(l=0);var a=s.hasValue(t.title),c=s.hasValue(t.content),u=!a&&!c,d=a?t.title:c?"No Title Found":"No Matching Section Found",f=!!Se[o];return t.title?n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!u&&f,onChange:function(){return!u&&Fe(function(n){var t;return e.__assign(e.__assign({},n),((t={})[o]=!n[o],t))})},sx:{mt:1,boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:600,color:u?"#94A3B8":"#19213D"}},{children:d||"Untitled Subsection"}))})),!u&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1}},{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),l+1)})]}))]}),o):n.jsx(i.Box,e.__assign({sx:{mt:0===l?1:.75}},{children:!u&&n.jsxs("div",{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),l+1)})]})}),o)};return n.jsxs(i.Box,e.__assign({ref:oe,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},T?{}:{overflow:"visible"}),{position:"relative"})},{children:[T&&n.jsx(u.default,{open:te.open,anchorEl:te.anchorEl,sectionTitle:te.sectionTitle,referenceSectionTitle:te.refSectionTitle,onClose:ce,onOpenCognitiveCompare:ze,onOpenSideBySide:$e}),$.open&&n.jsx(c.default,{open:$.open,popupRef:Y,position:U,popupConfig:D,onClose:function(){G(null),ee(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:R,sectionTitle:$.sectionTitle,referenceSectionTitle:$.refSectionTitle,cognitiveData:$.cognitiveData,anchorEl:$.anchorEl,sectionAnchorEl:$.sectionAnchorEl,scrollContainerEl:re.current,badgeStyle:$.badgeStyle,docData:$.docData}),n.jsx(i.Snackbar,e.__assign({open:!!k,autoHideDuration:8e3,onClose:function(){return O(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return O(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:k}))})),n.jsx(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:E}))}))})),n.jsx(i.Box,e.__assign({ref:re,onScroll:pn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:T?"hidden":"auto",borderTop:Ae&&ke?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},T?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:He,sx:e.__assign({display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},T?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:K.width||"100%",height:K.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Qe&&n.jsxs("g",{children:[n.jsx("line",{x1:Qe.x1,y1:Qe.y,x2:Math.max(Qe.x1,(Qe.x1+Qe.x2)/2-70),y2:Qe.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Qe.x2,(Qe.x1+Qe.x2)/2+70),y1:Qe.y,x2:Qe.x2,y2:Qe.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Ve.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!T)return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-100,y:t.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){var n=Re[t.sectionIdx]||{title:"",content:""},i=Be[t.sectionIdx]||{title:"",content:""};Le(Ne(e.currentTarget,n,i,t.sectionIdx,t.style))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),n.jsx(r.ChevronDown,{size:11})]}))}))}))]},t.id);var a=Re[t.sectionIdx];return!(null===(l=null==a?void 0:a.refIndexes)||void 0===l?void 0:l.length)||(null==a?void 0:a.selfIndex)<0?null:N&&Ye===t.sectionIdx&&H?n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id):null})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},T?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:We,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:je,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:je}))}))})),n.jsx(i.Box,e.__assign({onScroll:pn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},T?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Te&&Re.map(function(t,o){var l;if(!T)return n.jsx(i.Box,e.__assign({ref:Me(o)},{children:vn(t,o,"left",rn.current[o])}),"left-row-".concat(o));var s=t,a=dn(o),c=!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0,u="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null;return n.jsx(i.Box,e.__assign({ref:Me(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:rn.current[o],sx:{width:"100%"}},{children:vn(t,o,"left",f.default.createRef(),0)})),a&&n.jsxs(i.Box,e.__assign({ref:ln.current[o],onClick:function(e){var n=Be.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),te.open&&te.sectionIdx===i?ce():(ae(),ie(Ne(e.currentTarget,n,t,i,r)))}(e,t,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==u&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:u})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:c?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(r.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},T?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Pe,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:Ce,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ce}))}))})),n.jsx(i.Box,e.__assign({onScroll:pn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},T?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Te&&Be.map(function(t,r){if(!T)return vn(t,r,"right",on.current[r]);var o=t,l=Re.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(o.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return n.jsx(i.Box,e.__assign({ref:an.current[r],sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:on.current[r],sx:{width:"100%"}},{children:vn(t,r,"right",f.default.createRef(),0)})),n.jsx(i.Box,e.__assign({ref:sn.current[r],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:l.length>0?l.join(", "):"-"}))]}))}),"right-row-".concat(r))})}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],i={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}};exports.DEFAULT_COMPARISON_CONFIG=i,exports.DEFAULT_FIELD_CONFIG=e,exports.DEFAULT_POPUP_CONFIG={tabs:{deviation:{key:"deviation",label:"Deviation Analysis",subtitle:"Why this is a deviation?",placeholderTitle:"Deviation Analysis",placeholderBody:"Deviation analysis content will appear here..."},association:{key:"association",label:"Association Logic",subtitle:"Why these sections are paired?"}},decisionStrengthLabel:"Decision Strength",sectionTitles:{decisioningFactors:"Decision Making Factors",gaps:"Gaps in Decision"},emptyStateMessage:"No cognitive decisioning data available for this section.",accentColor:"#5928ED"},exports.SHARED_MARKDOWN_STYLES={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConfig.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=function(i){return null==i?"":"string"==typeof i?i:Array.isArray(i)?i.map(n).join("\n\n"):"object"==typeof i?JSON.stringify(i):String(i)},e=function(i){return null!=i&&("string"==typeof i?i.trim().length>0:!Array.isArray(i)||i.length>0&&i.some(function(i){return e(i)}))},t=function(i){return i&&"string"==typeof i?"N/A"===i.toUpperCase()?"N/A":i.split("_").map(function(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}).join(" "):"Unknown"};exports.cognitiveScoreToRelation=function(i){return{score:0,relation:"N/A"}},exports.formatRelationToLabel=t,exports.getRationale=function(i){if(!i.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=i.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}},exports.getSideData=function(i,e,t){var s,o=t[e],r=null===(s=null==i?void 0:i.comparison_inputs)||void 0===s?void 0:s[o];return{title:n((null==r?void 0:r.title)||""),content:n((null==r?void 0:r.content)||""),attributes:(null==r?void 0:r.additional_attributes)||null,subsections:(null==r?void 0:r.subsections)||[]}},exports.getStyleForRelation=function(n,e,s,o){var r=100*(n||0),a=o.thresholds,l=o.relationStyles;if(!s)return null;var c=t(e),u=(e||"").toLowerCase();return"n/a"===u||u.includes("no_deviation")?i.__assign(i.__assign({},l.low),{label:c}):u.includes("deviation")||u.includes("high_risk")||u.includes("critical")?i.__assign(i.__assign({},l.high),{label:c}):r>=a.exact?i.__assign(i.__assign({},l.exact),{label:c}):r>=a.high?i.__assign(i.__assign({},l.high),{label:c}):r>=a.medium?i.__assign(i.__assign({},l.medium),{label:c}):i.__assign(i.__assign({},l.low),{label:c})},exports.hasValue=e,exports.safeStringify=n;
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),s=require("lucide-react"),t=require("react-dom"),r=require("../../assests/svg/SparkleIcon.js"),a=require("react-markdown"),l=require("./CitationAnchor.js"),c=require("./CognitiveCompareConfig.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=d(t),p=d(a),g=10;exports.default=function(t){var a,d,h,u,f,b,_=t.open,v=t.onClose,m=t.sectionTitle,y=t.referenceSectionTitle,j=t.cognitiveData,F=t.relevanceScore,w=t.anchorEl,B=t.badgeStyle,E=t.popupRef,C=t.position,S=t.markdownStyles,k=t.docData,D=t.popupConfig,T=e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),S),R=i.useMemo(function(){var o,i;return e.__assign(e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG),D),{tabs:{deviation:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==D?void 0:D.tabs)||void 0===o?void 0:o.deviation),association:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.tabs.association),null===(i=null==D?void 0:D.tabs)||void 0===i?void 0:i.association)},sectionTitles:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.sectionTitles),null==D?void 0:D.sectionTitles)})},[D]),z=null==j?void 0:j.isMissingRationale,A=i.useState(z?R.tabs.deviation.key:R.tabs.association.key),I=A[0],W=A[1];i.useEffect(function(){_&&W(z?R.tabs.deviation.key:R.tabs.association.key)},[_,z,R.tabs.deviation.key,R.tabs.association.key]);var P=i.useMemo(function(){if(!B)return{border:R.accentColor,shadow:"".concat(R.accentColor,"2E")};var e=B.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:R.accentColor,shadow:"".concat(R.accentColor,"2E")}},[B,R.accentColor]);i.useEffect(function(){if(_){var e=function(e){var o;(null===(o=E.current)||void 0===o?void 0:o.contains(e.target))||(null==w?void 0:w.contains(e.target))||v()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[_,v,w,E]);var L=i.useMemo(function(){return{a:function(e){var i=e.href,n=void 0===i?"":i,s=e.children;return o.jsx(l.default,{href:n,children:s,metaData:{citations:null==j?void 0:j.citations,docData:k}})}}},[_,j]);if(!_||!j)return null;var O=null!==(d=null!==(a=j.relevance_score)&&void 0!==a?a:F)&&void 0!==d?d:0,q=j.decisioning,H=Array.isArray(q)?q:"string"==typeof q&&q.trim()?[q]:[],U=j.gap,M=Array.isArray(U)?U:"string"==typeof U&&U.trim()?[U]:[],N=null!==(h=null==C?void 0:C.arrowLeft)&&void 0!==h?h:60,G=o.jsxs(n.Box,e.__assign({ref:E,sx:{position:"fixed",top:null!==(u=null==C?void 0:C.top)&&void 0!==u?u:-9999,left:null!==(f=null==C?void 0:C.left)&&void 0!==f?f:-9999,zIndex:9999,width:"min(".concat(880,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(P.border),boxShadow:"0px 8px 32px ".concat(P.shadow,", 0px 0px 0px 3px ").concat(P.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==C?void 0:C.maxHeight)?"min(60vh, ".concat(C.maxHeight,"px)"):"60vh",visibility:C?"visible":"hidden"}},{children:[C&&(C.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:N-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(P.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:N-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:N-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(P.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:N-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,e.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[o.jsxs(n.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,e.__assign({component:"span",title:m,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:m})),o.jsx(n.Box,e.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,e.__assign({component:"span",title:y||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:y||"Reference Section"}))]})),o.jsx(n.Box,e.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(b=Object.values(R.tabs).find(function(e){return e.key===I}))||void 0===b?void 0:b.subtitle}))}))]})),o.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(r.default,{}),R.decisionStrengthLabel," ",O,"%"]})),o.jsx(n.IconButton,e.__assign({onClick:v,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(s.X,{size:22})}))]}))]})),o.jsx(n.Box,e.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(z?[R.tabs.deviation]:[R.tabs.deviation,R.tabs.association]).map(function(i){var s=I===i.key;return o.jsx(n.Box,e.__assign({onClick:function(){return W(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:s?600:400,color:s?R.accentColor:"#667085",backgroundColor:s?"".concat(R.accentColor,"14"):"transparent",borderBottom:s?"2px solid ".concat(R.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key)})})),o.jsx(n.Box,e.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(P.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:P.border},scrollbarWidth:"thin",scrollbarColor:"".concat(P.border,"55 transparent")}},{children:I===R.tabs.deviation.key?o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:R.tabs.deviation.placeholderTitle})),o.jsx(n.Typography,e.__assign({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:R.tabs.deviation.placeholderBody}))]})):o.jsxs(o.Fragment,{children:[H.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:R.sectionTitles.decisioningFactors}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},T)},{children:o.jsx(p.default,e.__assign({components:L},{children:H.join("\n\n")}))}))}))}))]})),M.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:R.sectionTitles.gaps}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},T)},{children:o.jsx(p.default,e.__assign({components:L},{children:M.join("\n\n")}))}))}))}))]})),0===H.length&&0===M.length&&o.jsx(n.Box,e.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:R.emptyStateMessage}))}))]})}))]}));return x.default.createPortal(G,document.body)};
|
|
2
2
|
//# sourceMappingURL=CognitivePopup.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("@mui/material"),t=require("../../assests/svg/ButtonCognitiveIcon.js"),o=[{key:"connect",title:"Connect",icon:i.jsx("svg",e.__assign({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("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","fill-opacity":"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i.jsx("svg",e.__assign({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("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","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i.jsx(t.ButtonCognitiveIcon,{})}];exports.default=function(t){var s=t.open,r=t.anchorEl;t.sectionTitle,t.referenceSectionTitle;var C=t.onClose,l=t.onOpenCognitiveCompare,c=t.onOpenSideBySide;return i.jsx(n.Menu,e.__assign({open:s,anchorEl:r,onClose:C,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:o.map(function(t){return i.jsxs(n.MenuItem,e.__assign({onClick:function(){var e;"connect"!==(e=t.key)?"side-by-side"!==e?l():c():C()},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,"&:hover":{bgcolor:"#F9FAFB"}}},{children:[i.jsx(n.Box,e.__assign({sx:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}}},{children:t.icon})),i.jsx(n.Box,e.__assign({sx:{minWidth:0,display:"flex",alignItems:"center"}},{children:i.jsx(n.Typography,e.__assign({sx:{fontSize:"12px",fontWeight:500,color:"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:t.title}))}))]}),t.key)})}))};
|
|
2
|
+
//# sourceMappingURL=MoreFunctionsPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoreFunctionsPopup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),s=require("react");exports.default=function(n){var t=n.leftComponent,l=n.rightComponent,r=s.useRef(null),a=s.useState(50),o=a[0],d=a[1],u=s.useState(!1),c=u[0],_=u[1],h=null!=t,g=null!=l,x=s.useCallback(function(){h&&g&&_(!0)},[h,g]),f=s.useCallback(function(e){if(c&&r.current){var i=r.current.getBoundingClientRect(),s=(e.clientX-i.left)/i.width*100;s=Math.max(25,Math.min(75,s)),d(s)}},[c]),v=s.useCallback(function(){_(!1)},[]),p={minWidth:0,minHeight:0,height:"100%",overflow:"hidden",display:"flex",flexDirection:"column"};return i.jsxs("div",e.__assign({ref:r,onMouseMove:f,onMouseUp:v,onMouseLeave:v,style:{display:"flex",width:"calc(100% - 4px)",height:"400px",border:"1px solid #ddd",overflow:"hidden",userSelect:c?"none":"auto"}},{children:[h&&!g&&i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"100%"})},{children:t})),!h&&g&&i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"100%"})},{children:l})),h&&g&&i.jsxs(i.Fragment,{children:[i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"".concat(o,"%"),flexShrink:0})},{children:t})),i.jsx("div",{onMouseDown:x,style:{width:"6px",background:"#D0D5DD",cursor:"col-resize",flexShrink:0}}),i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{flex:1})},{children:l}))]})]}))};
|
|
2
|
+
//# sourceMappingURL=ResizableSplitPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableSplitPane.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(t){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(t){var l=t.pdfUrl,o=t.plugins,a=t.onLoad,d=t.customStyles,u=t.onPageChange,p=t.defaultScale;return r.jsx("div",e.__assign({style:e.__assign(e.__assign({},i.pdfStyles.pdfConatiner),null==d?void 0:d.pdfContainer)},{children:r.jsx(s.Worker,e.__assign({workerUrl:n},{children:r.jsx(s.Viewer,{fileUrl:l,defaultScale:p,plugins:o,onDocumentLoad:a,onPageChange:u})}))}))},exports.pdfWorker=n;
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",width:"100%",minWidth:0,boxSizing:"border-box"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("./PdfStyle.js"),s=require("../../assests/svg/PdfViewerIcons.js"),t=require("@mui/material");exports.default=function(o){o.highlightIndex;var l=o.totalHighlights,r=o.controls,d=o.currentPosition,a=o.pdfName,c=o.onClose,p=o.pdfUrl,x=o.viewerRef,g=o.customStyles,u=o.customClasses,h=o.customIcons,f=o.headerAction,_=o.isZoomEnabled,j=void 0===_||_,v=o.showHighlightsAction,m=void 0===v||v,y=r.ZoomInButton,b=r.ZoomOutButton,w=r.ZoomPopover,k=r.goToPrevious,I=r.goToNext,C={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0};return n.jsxs("div",e.__assign({style:e.__assign(e.__assign({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},i.pdfStyles.header),null==g?void 0:g.header)},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flex:1,minWidth:0,overflow:"hidden"}},{children:[n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==g?void 0:g.pdfIconWrapper),{flexShrink:0})},{children:(null==h?void 0:h.pdfIcon)||n.jsx(s.DefaultPdfIcon,{})})),n.jsx(t.Tooltip,e.__assign({title:a||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n.jsx("span",e.__assign({style:e.__assign({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==g?void 0:g.pdfName),className:null==u?void 0:u.pdfName},{children:a}))}))}))]})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:m?"16px":"2px",color:"#4B5563",flexShrink:0,whiteSpace:"nowrap",minWidth:"fit-content"}},{children:[j&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(b,{}),n.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n.jsx(w,{})})),n.jsx(y,{})]})),!!l&&m&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("span",e.__assign({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[d," of ",l]})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:d<=1?"not-allowed":"pointer",padding:"2px 4px",color:d<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:k,disabled:d<=1},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:d===l?"not-allowed":"pointer",padding:"2px 4px",color:d===l?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:I,disabled:d===l},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n.jsx("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[(null==f?void 0:f.icon)&&(null==f?void 0:f.onClick)?n.jsx(t.Tooltip,e.__assign({title:(null==f?void 0:f.tooltip)||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({onClick:f.onClick,style:e.__assign({display:"flex",alignItems:"center",cursor:"pointer"},C)},{children:f.icon}))})):n.jsx("button",e.__assign({onClick:function(){var e=null==x?void 0:x.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:C,title:"Full Screen"},{children:(null==h?void 0:h.fullScreenIcon)||n.jsx(s.DefaultFullScreenIcon,{})})),p&&n.jsx("a",e.__assign({href:p,target:"_blank",rel:"noopener noreferrer",style:C,title:"Open in new tab"},{children:(null==h?void 0:h.downloadIcon)||n.jsx(s.DefaultDownloadIcon,{})})),c&&n.jsx("button",e.__assign({onClick:c,style:C,title:"Close"},{children:(null==h?void 0:h.closeIcon)||n.jsx(s.DefaultCloseIcon,{})}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=PdfToolbar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var l=require("react"),s=require("../ScannedDocCitation/ScannedDocCitation.js"),c=function(e){switch(e){case"ActualSize":return t.SpecialZoomLevel.ActualSize;case"PageFit":return t.SpecialZoomLevel.PageFit;case"PageWidth":return t.SpecialZoomLevel.PageWidth;default:return null!=e?e:t.SpecialZoomLevel.PageWidth}};exports.default=function(u){var d,g=u.pdfUrl,h=u.highlightText,f=u.highlightPages,v=u.highlightCordinatePages,p=u.highlightColor,m=void 0===p?"yellow":p,x=u.activeHighlightColor,C=void 0===x?"#f7dc51":x,S=u.jumpToPageValue,P=void 0===S?0:S,y=u.pdfName,T=u.onClose,_=u.customStyles,q=u.customClasses,w=u.customIcons,A=u.useCoordinates,b=u.fallbackPages,j=u.activeCitationIndex,H=u.onActiveCitationChange,I=u.headerAction,Z=u.isZoomEnabled,L=void 0===Z||Z,z=u.showHighlightsAction,F=void 0===z||z,N=u.defaultScale,E=void 0===N?t.SpecialZoomLevel.ActualSize:N,R=l.useRef(null),V=l.useMemo(function(){if(A)return new Set(v.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(f).forEach(function(i){i>0&&e.add(i-1)}),e},[f]),W=(d=h)&&0!==d.length?d.filter(function(e){return!d.some(function(i){return i!==e&&i.includes(e)})}):d,D=a.PdfHighlightControls(W,A?{}:f,R,V,A,A?v:[],m,C),B=D.highlightIndex,O=D.cursorIndex,U=D.setCursorIndex,k=D.orderedKeys,M=D.totalHighlights,J=D.getValidPosition,K=D.tryJump,G=D.jumpToPage,Q=D.zoomTo,X=D.plugins,Y=D.controls,$=D.hideNonTargetHighlights,ee=D.deduplicateHighlights,ie=J(O);l.useEffect(function(){void 0!==j&&j!==O&&U(j)},[j]);var te=e.__assign(e.__assign({},Y),{goToNext:function(){Y.goToNext(),H&&H(O+1)},goToPrevious:function(){Y.goToPrevious(),H&&H(O-1)}});if(!g)return i.jsx(s.default,{pages:b,activeCitationIndex:j,onActiveCitationChange:H,headerAction:I});return i.jsxs("div",e.__assign({ref:R,className:(null==q?void 0:q.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},n.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==_?void 0:_.pdfViewer)},{children:[i.jsx(r.default,{highlightIndex:B,totalHighlights:M,controls:te,currentPosition:ie,pdfName:y,onClose:T,pdfUrl:g,viewerRef:R,customStyles:_,customClasses:q,customIcons:w,headerAction:I,isZoomEnabled:L,showHighlightsAction:F}),i.jsx(o.default,{defaultScale:c(E),pdfUrl:g,plugins:X,customStyles:_,onLoad:function(){if(Q(t.SpecialZoomLevel.ActualSize),P>0){var e=P-1,i=k[e],o=f[i],r=v[e];U(e),console.log(r,"cordinateTargetHighlight"),A&&r.pageIndex>0&&G(r.pageIndex),o>0&&(setTimeout(function(){$(V),ee(o-1)},1e3),A||G(o-1))}else if(!A&&f){var n=k.find(function(e){return f[e]>0});if(void 0!==n){var a=f[n]-1;G(a),setTimeout(function(){$(V),ee(a)},1e3)}}requestAnimationFrame(function(){K(),A||function(){if(R.current){var e=P-1,i=k[e],t=f[i],o=t>0?t-1:0,r={};k.forEach(function(e,i){var t=f[e];t>0&&(r[t]||(r[t]=[]),r[t].push(i))});var n=(r[t]||[]).indexOf(e),a=0,l=function(){var e,i;if(!(++a>40)){var t=null===(e=R.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(t){var r=null===(i=R.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(o,'"]'));if(r){var s=t.getBoundingClientRect(),c=r.getBoundingClientRect();if(c.top<s.bottom&&c.bottom>s.top){var u=r.querySelectorAll(".rpv-search__highlight")[n];if(u){var d=u.getBoundingClientRect(),g=t.scrollTop+(d.top-s.top)-t.clientHeight/2+d.height/2;t.scrollTo({top:g,behavior:"smooth"})}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}};setTimeout(l,500)}}()})},onPageChange:function(e){var i=e.currentPage;V.has(i)?(ee(i),$(V)):$(V)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as l}from"tslib";import{jsxs as i,jsx as n,Fragment as o}from"react/jsx-runtime";import{ChevronUp as t,ChevronDown as e}from"lucide-react";import{useState as r}from"react";import a from"./ResizableSplitPane.js";import d from"../PdfViewer/PdfViewer.js";var u=function(u){var c,s,v,h=u.href,g=u.children,p=u.metaData,m=u.chevronUpComponent,f=void 0===m?null:m,b=u.chevronDownComponent,_=void 0===b?null:b,w=u.customStyle,y=void 0===w?{}:w,x=u.defaultState,P=r(void 0!==x&&x),C=P[0],S=P[1],D="string"==typeof g&&(null===(c=null==g?void 0:g.split("\n"))||void 0===c?void 0:c.length)>1?g.split("\n").join(" "):g,j=null!=f?f:function(l){var i,o;return n(t,{size:null!==(i=null==l?void 0:l.fontSize)&&void 0!==i?i:16,color:null!==(o=null==l?void 0:l.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(s=null==y?void 0:y.arrow)&&void 0!==s?s:{}),z=null!=_?_:function(l){var i,o;return n(e,{size:null!==(i=null==l?void 0:l.fontSize)&&void 0!==i?i:16,color:null!==(o=null==l?void 0:l.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(v=null==y?void 0:y.arrow)&&void 0!==v?v:{}),T=["contract","clause"];return i("span",l({style:l({display:"inline"},y.relativeWrapper||{})},{children:[n("div",l({style:l({display:"inline",marginTop:0},y.citationButtonWrapper||{})},{children:i("button",l({type:"button",onClick:function(){return S(function(l){return!l})},style:l({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},y.citationButton||{})},{children:[n("span",{children:D}),n("span",l({style:{display:"flex",alignItems:"center"}},{children:C?j:z}))]}))})),C&&n(o,{children:n(function(){var l,i,t,e,r,u,c;console.log("citation details",h,g,p,D);var s=function(l){try{return new URL(l,window.location.origin).searchParams.get("citationNumber")}catch(l){return null}}(h);if(!s)return null;var v=(null===(l=null==p?void 0:p.citations)||void 0===l?void 0:l[s])||{},m=(null===(i=null==p?void 0:p.docData)||void 0===i?void 0:i.documents)||{},f=(null===(t=null==p?void 0:p.docData)||void 0===t?void 0:t.input_index_map)||{},b=null==f?void 0:f[0],_=null==f?void 0:f[1],w=b?m[b]:null,y=_?m[_]:null,x=b?v[b]:null,P=_?v[_]:null;if(T.includes(D[0])){console.log("leftDocument",w,"rightDocument",y);var C=x?n(d,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:w.title,pdfUrl:w.signed_url,highlightText:[null!==(e=null==x?void 0:x.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(r=null==x?void 0:x.custom_metadata)||void 0===r?void 0:r.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,S=P?n(d,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:y.title,pdfUrl:y.signed_url,jumpToPageValue:1,highlightText:[null!==(u=null==P?void 0:P.highlighted_text)&&void 0!==u?u:""],highlightPages:{1:null===(c=null==P?void 0:P.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return n("div",{children:n(a,{leftComponent:C,rightComponent:S})})}return n(o,{children:"HEllo issue here"})},{})})]}))};export{u as default};
|
|
2
|
+
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationAnchor.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as o,useMemo as r,useRef as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as u,Typography as h,Tooltip as v,Accordion as p,AccordionSummary as f,AccordionDetails as g}from"@mui/material";import{ChevronUp as x,ChevronDown as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import w from"react-markdown";import{safeStringify as F,hasValue as b,getStyleForRelation as E,cognitiveScoreToRelation as S,getRationale as C,getSideData as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as A,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as I}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import R from"./CognitivePopup.js";var T={id:"",title:""},B=function(B){var k,M,z,H,W,j,L,O,P=B.componentHeaderText,N=void 0===P?"Learning Comparison":P,q=B.treeData,V=B.comparisonConfig,K=B.leftColumnTitleText,U=B.rightColumnTitleText,Y=B.markdownStyles,G=o(null),J=G[0],Q=G[1],X=r(function(){return(null==q?void 0:q.cognitive_decisioning)||{}},[q]);l(null);var Z=o(null),$=Z[0],ee=Z[1],ne=l(null),te=o({width:0,height:0}),ie=te[0],oe=te[1],re=r(function(){return e(e({},A),Y)},[Y]),le=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),ce=le[0],ae=le[1],de=l(null),se=l(null),ue=l(!1),he=l(null);c(function(){he.current=null},[ce.sectionIdx,ce.open]);var ve=a(function(){var e;if(ce.anchorEl&&ce.refSectionTitle){var n=ce.anchorEl.getBoundingClientRect(),t=(null===(e=null==ne?void 0:ne.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==he.current?!0===he.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),he.current=l;var c=l?r:o,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,s=n.left+n.width/2,u=s-i/2,h=Math.max(12,Math.min(u,window.innerWidth-i-12)),v=Math.max(14,Math.min(s-h,i-10-4));ee({top:d,left:h,arrowLeft:v,openAbove:l,maxHeight:c})}},[ce.anchorEl,ce.refSectionTitle]);c(function(){if(ce.open){window.addEventListener("resize",ve);var e=requestAnimationFrame(ve),n=null;return ne.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(ve)})).observe(ne.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ve),n&&n.disconnect()}}},[ce.open,ve]),c(function(){var n=de.current;if(n&&ce.open){var t=function(n){ne.current&&ne.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),ee(null),ae(function(n){return e(e({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",t,{capture:!0}),window.addEventListener("scroll",t,{capture:!0}),function(){n.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("scroll",t,{capture:!0})}}},[ce.open]);var pe=r(function(){var n,t,i,o,r,l,c,a,d,s,u,h;return{fields:null!==(n=null==V?void 0:V.fields)&&void 0!==n?n:D,thresholds:{high:null!==(i=null===(t=null==V?void 0:V.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:I.thresholds.high,medium:null!==(r=null===(o=null==V?void 0:V.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:I.thresholds.medium,exact:null!==(c=null===(l=null==V?void 0:V.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:I.thresholds.exact},relationStyles:{noContent:e(e({},I.relationStyles.noContent),(null===(a=null==V?void 0:V.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},I.relationStyles.high),(null===(d=null==V?void 0:V.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},I.relationStyles.exact),(null===(s=null==V?void 0:V.relationStyles)||void 0===s?void 0:s.exact)||{}),medium:e(e({},I.relationStyles.medium),(null===(u=null==V?void 0:V.relationStyles)||void 0===u?void 0:u.medium)||{}),low:e(e({},I.relationStyles.low),(null===(h=null==V?void 0:V.relationStyles)||void 0===h?void 0:h.low)||{})}}},[V]),fe=r(function(){if(q&&Object.keys(q).length>0)try{var n=function(n){var t,i,o,r,l=[],c=[],a=n.base_root_id,d=n.input_index_map||{0:"left",1:"right"},s=n[a];if(!s||!1===s.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var u=function(t){var i=n[t];if(i&&!1!==i.display_node){var o=C(i),r=_(i,"0",d),a=_(i,"1",d),s=r.title.trim()||r.content.trim(),h=a.title.trim()||a.content.trim();l.push(e({id:t,title:s?r.title:"",content:s?r.content:"",subsections:[]},s?o:{score:void 0,relation:"not_defined"})),c.push(e({id:t,title:h?a.title:"",content:h?a.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),i.next&&Object.values(i.next).forEach(u)}};return s.next&&Object.values(s.next).forEach(u),{activeProposed:{title:(null===(i=null===(t=s.comparison_inputs)||void 0===t?void 0:t[d[0]])||void 0===i?void 0:i.title)||"Uploaded Contract",description:s.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=s.comparison_inputs)||void 0===o?void 0:o[d[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:s.decision_scope_description||""},fields:{}}}}]}}(q);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[q]),ge=fe.activeProposed,xe=fe.activeVariants,me=fe.parseError;c(function(){me&&Q("Failed to load comparison: ".concat(me))},[me]);var ye=o(null),we=ye[0];ye[1];var Fe=o({}),be=Fe[0],Ee=Fe[1],Se=xe[0]||T,Ce=null===(z=null===(k=null==q?void 0:q.documents)||void 0===k?void 0:k[null===(M=null==q?void 0:q.input_index_map)||void 0===M?void 0:M[0]])||void 0===z?void 0:z.title,_e=null===(j=null===(H=null==q?void 0:q.documents)||void 0===H?void 0:H[null===(W=null==q?void 0:q.input_index_map)||void 0===W?void 0:W[1]])||void 0===j?void 0:j.title,Ae=F(K||Ce||"Uploaded Contract"),De=F(U||_e||"Reference Template"),Ie=r(function(){return ge.sections||[]},[ge.sections]),Re=r(function(){return Se.sections||[]},[Se.sections]),Te=Ie.length>0||Re.length>0,Be=Se.analysis,ke=F(null===(O=null===(L=null==Be?void 0:Be.rule_difference_comparison)||void 0===L?void 0:L.summary)||void 0===O?void 0:O.overall_summary),Me=!!ke.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ze=l({}),He=function(e){return ze.current[e]||(ze.current[e]=i.createRef()),ze.current[e]},We=l(null),je=l(null),Le=l(null),Oe=o([]),Pe=Oe[0],Ne=Oe[1],qe=o(null),Ve=qe[0],Ke=qe[1],Ue=r(function(){return pe.fields.filter(function(e){var n=e.key;return(!Te||"description"!==n)&&(b(ge[n])||b(Se[n]))})},[ge,Se,Te,pe.fields]),Ye=l({}),Ge=l({}),Je=l({}),Qe=l({});Ue.forEach(function(e){var n=e.key;Ye.current[n]||(Ye.current[n]=i.createRef()),Ge.current[n]||(Ge.current[n]=i.createRef())});for(var Xe=0;Xe<Math.max(Ie.length,Re.length);Xe+=1)Je.current[Xe]||(Je.current[Xe]=i.createRef()),Qe.current[Xe]||(Qe.current[Xe]=i.createRef());c(function(){if(we){var e=pe.fields.find(function(e){return e.analysisKey===we||e.key===we});if(e){var n=Ye.current[e.key]||Ge.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[we,pe.fields]);var Ze=a(function(e){var n,t,i,o,r,l,c,a,d,s=null===(n=null==Be?void 0:Be.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var u=s[e],h=(null==u?void 0:u.relation)||(null===(i=null===(t=null==u?void 0:u.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==u?void 0:u.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==u?void 0:u.mappings)&&u.mappings.length>0;if(u.mappings){var v=u.mappings[0]||{};return{score:u.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=v.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!h}}return{score:u.score,relation:u.relation||"",highlightsA:(null===(a=u.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=u.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!h}},[Be]),$e=a(function(n){var t,i,o=Ie[n],r=Re[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,c=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,a=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!c&&!a)return e(e({},pe.relationStyles.noContent),{label:"Not Defined"});var d=Ze("description");if(null!=(null!==(t=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==t?t:null==r?void 0:r.cognitiveRelevanceScore)){var s=S(),u=s.score,h=s.relation;return E(u,h,!0,pe)}var v=l?o.relation:c?r.relation:d.relation,p=null!==(i=null==o?void 0:o.score)&&void 0!==i?i:null==r?void 0:r.score,f="number"==typeof p?p:d.score;return E(f,v,!0,pe)},[Ie,Re,pe,Ze]),en=a(function(){var e,n,t,i,o,r,l,c,a,d,s;if(!ue.current){ue.current=!0;try{if(!We.current)return;var u=We.current.getBoundingClientRect();oe({width:u.width,height:u.height});var h=[];Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(Ie.length,Re.length);v++){var p=null===(e=Je.current[v])||void 0===e?void 0:e.current,f=null===(n=Qe.current[v])||void 0===n?void 0:n.current;p&&f&&(p.style.height="auto",f.style.height="auto",p.style.minHeight="0px",f.style.minHeight="0px")}var g={};Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x=[];for(v=0;v<Math.min(Ie.length,Re.length);v++){p=null===(t=Je.current[v])||void 0===t?void 0:t.current,f=null===(i=Qe.current[v])||void 0===i?void 0:i.current;if(p&&f){var m=p.getBoundingClientRect(),y=f.getBoundingClientRect();x[v]=Math.max(m.height,y.height)}}Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=g[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<x.length;v++){p=null===(o=Je.current[v])||void 0===o?void 0:o.current,f=null===(r=Qe.current[v])||void 0===r?void 0:r.current;if(p&&f){var w=x[v];p.style.minHeight="".concat(w,"px"),f.style.minHeight="".concat(w,"px")}}Ue.forEach(function(e){var n,t,i=e.key,o=e.analysisKey,r=null===(n=Ye.current[i])||void 0===n?void 0:n.current,l=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(r&&l){var c=r.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Ze(o),s=E(d.score,d.relation,d.hasContent,pe);if(!s)return;var v=c.top+c.height/2-u.top;h.push({id:"field-".concat(i),x1:c.right-u.left,y1:v,x2:a.left-u.left,y2:v,style:s})}});for(v=0;v<Math.min(Ie.length,Re.length);v++){var F=null===(l=Je.current[v])||void 0===l?void 0:l.current,b=null===(c=Qe.current[v])||void 0===c?void 0:c.current;if(F&&b){var S=F.querySelector(".MuiAccordionSummary-root"),C=b.querySelector(".MuiAccordionSummary-root");if(S&&C){var _=S.getBoundingClientRect(),A=C.getBoundingClientRect(),D=(_.top+_.height/2-u.top+A.top+A.height/2-u.top)/2,I=(null===(a=Re[v])||void 0===a?void 0:a.id)||"sec-".concat(v),R=$e(v);R&&h.push({id:I,x1:_.right-u.left,y1:D,x2:A.left-u.left,y2:D,style:R,sectionIdx:v,hasCognitive:!(!(null===(d=Ie[v])||void 0===d?void 0:d.cognitiveData)&&!(null===(s=Re[v])||void 0===s?void 0:s.cognitiveData))})}}}if(Ne(h),je.current&&Le.current){var T=je.current.getBoundingClientRect(),B=Le.current.getBoundingClientRect(),k=(T.top+T.height/2-u.top+B.top+B.height/2-u.top)/2;Ke({x1:T.right-u.left,x2:B.left-u.left,y:k})}else Ke(null)}catch(e){console.error("Line render safe fail: ",e)}finally{ue.current=!1}}},[Ue,Ie,Re,pe,Ze,$e]),nn=a(function(){window.requestAnimationFrame(en)},[en]);c(function(){var e=setTimeout(nn,250);window.addEventListener("resize",nn);var n=null,t=null;return de.current&&(n=new ResizeObserver(nn)).observe(de.current),We.current&&(t=new ResizeObserver(nn)).observe(We.current),function(){clearTimeout(e),window.removeEventListener("resize",nn),null==n||n.disconnect(),null==t||t.disconnect()}},[ge,Se,Be,Ue,be,Ie,Re,pe,nn]);var tn=function(o,r,l,c){var a,s=!b(o.title)&&!b(o.content);return t(d,e({ref:c,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n(p,e({disableGutters:!0,expanded:!s&&!!be[r],onChange:function(){return!s&&(n=r,void Ee(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))}));var n},sx:{boxShadow:"none",border:s?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:s?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(f,e({expandIcon:s?null:t(m,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:s?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(v,e({title:o.title||"No Matching Section Found",placement:"top"},{children:t(h,e({sx:{fontSize:"12px",color:s?"#94A3B8":"#19213D",fontWeight:s?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(a=o.title||"No Matching Section Found",a?F(a).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!s&&n(g,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(h,e({component:"div",sx:re},{children:t(w,{children:F(o.content).replace(/\\n/g,"\n")})})),(o.subsections||[]).map(function(n,i){return t(d,e({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:t(h,e({component:"div",sx:re},{children:t(w,{children:F(n).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(i))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n(d,e({ref:se,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[ce.open&&t(R,{open:ce.open,popupRef:ne,position:$,onClose:function(){ee(null),ae(function(n){return e(e({},n),{open:!1})})},markdownStyles:Y,sectionTitle:ce.sectionTitle,referenceSectionTitle:ce.refSectionTitle,cognitiveData:ce.cognitiveData,anchorEl:ce.anchorEl,sectionAnchorEl:ce.sectionAnchorEl,scrollContainerEl:de.current,badgeStyle:ce.badgeStyle}),t(s,e({open:!!J,autoHideDuration:8e3,onClose:function(){return Q(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(u,e({onClose:function(){return Q(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:J}))})),t(d,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(h,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:N}))}))})),t(d,e({ref:de,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:ke&&Me?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n(d,e({ref:We,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:ie.width||"100%",height:ie.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Ve&&n("g",{children:[t("line",{x1:Ve.x1,y1:Ve.y,x2:Math.max(Ve.x1,(Ve.x1+Ve.x2)/2-70),y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Ve.x2,(Ve.x1+Ve.x2)/2+70),y1:Ve.y,x2:Ve.x2,y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Pe.map(function(i,o){var r=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),t("foreignObject",e({x:r-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({onClick:function(n){if(n.stopPropagation(),ce.open&&ce.sectionIdx===i.sectionIdx)return ee(null),void ae(function(n){return e(e({},n),{open:!1})});!function(e,n,t,i,o){var r,l;e.stopPropagation(),ee(null);var c=F(n.id)||F(t.id)||"",a=(c?X[c]:null)||n.cognitiveData||t.cognitiveData||null,d=null!==(l=null===(r=ze.current[i])||void 0===r?void 0:r.current)&&void 0!==l?l:null;ae({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e.currentTarget,sectionAnchorEl:d,badgeStyle:o||null,sectionIdx:i})}(n,Ie[i.sectionIdx]||{title:"",content:""},Re[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&t(d,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:t("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:t(y,{})}))})),ce.open&&ce.sectionIdx===i.sectionIdx?t(x,{size:12,color:i.style.badgeText}):t(m,{size:12,color:i.style.badgeText})]}))]}))}))}))]},o):null})]})),n(d,e({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[t(d,e({ref:je,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:Ae,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:Ae}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Ie.map(function(e,n){return{section:e,idx:n}}).map(function(n){var o=n.section,r=n.idx;return t(d,e({ref:He(r)},{children:tn(o,r,"left",Je.current[r]||i.createRef())}),"left-row-".concat(r))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(m,{size:11})]}))}))})),n(d,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[t(d,e({ref:Le,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:De,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:De}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Re.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,t=e.idx;return tn(n,t,"right",Qe.current[t]||i.createRef())})}))]}))]}))}))}))]}))};export{B as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as r,useRef as o,useMemo as l,useEffect as c,useCallback as d}from"react";import{Box as a,Snackbar as u,Alert as s,Typography as f,Tooltip as v,Accordion as p,AccordionSummary as h,AccordionDetails as x}from"@mui/material";import{ChevronDown as g,EllipsisVertical as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import b from"react-markdown";import{safeStringify as w,hasValue as F,getStyleForRelation as E,getRationale as I,getSideData as S,cognitiveScoreToRelation as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as _,DEFAULT_FIELD_CONFIG as R,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import D from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";var B={id:"",title:""},k={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null},z=function(z){var H,M,W,j,L,N,O,P,V=z.componentHeaderText,X=void 0===V?"Learning Comparison":V,Y=z.treeData,q=z.comparisonConfig,U=z.leftColumnTitleText,K=z.rightColumnTitleText,G=z.markdownStyles,J=z.maintainRelativeOrder,Q=void 0!==J&&J,Z=z.popupConfig,$=r(null),ee=$[0],ne=$[1],te=r(!1),ie=te[0],re=te[1],oe=r(!1),le=oe[0],ce=oe[1],de=o(!1),ae=l(function(){return(null==Y?void 0:Y.cognitive_decisioning)||{}},[Y]),ue=r(null),se=ue[0],fe=ue[1],ve=o(null),pe=r({width:0,height:0}),he=pe[0],xe=pe[1],ge=l(function(){return e(e({},_),G)},[G]),me=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),ye=me[0],be=me[1],we=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),Fe=we[0],Ee=we[1],Ie=o(null),Se=o(null),Ce=o(!1),_e=o(null);c(function(){_e.current=null},[ye.sectionIdx,ye.open]);var Re=d(function(){fe(null),be(k)},[]),Te=d(function(){Ee(k)},[]),De=d(function(){var e;if(ye.anchorEl&&ye.refSectionTitle){var n=ye.anchorEl.getBoundingClientRect(),t=(null===(e=null==ve?void 0:ve.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==_e.current?!0===_e.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),_e.current=l;var c=l?o:r,d=Math.min(t||9999,c),a=l?n.top-12-d:n.bottom+12,u=n.left+n.width/2,s=u-i/2,f=Math.max(12,Math.min(s,window.innerWidth-i-12)),v=Math.max(14,Math.min(u-f,i-10-4));fe({top:a,left:f,arrowLeft:v,openAbove:l,maxHeight:c})}},[ye.anchorEl,ye.refSectionTitle]);c(function(){if(ye.open){window.addEventListener("resize",De);var e=requestAnimationFrame(De),n=null;return ve.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(De)})).observe(ve.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",De),n&&n.disconnect()}}},[ye.open,De]),c(function(){var e=Ie.current;if(e&&ye.open){var n=function(e){ve.current&&ve.current.contains(e.target)||(fe(null),Re())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[ye.open,Re]),c(function(){var e=Ie.current;if(e&&Fe.open){var n=function(){Te()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[Fe.open,Te]);var Ae=l(function(){var n,t,i,r,o,l,c,d,a,u,s,f;return{fields:null!==(n=null==q?void 0:q.fields)&&void 0!==n?n:R,thresholds:{high:null!==(i=null===(t=null==q?void 0:q.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(r=null==q?void 0:q.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(c=null===(l=null==q?void 0:q.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:T.thresholds.exact},relationStyles:{noContent:e(e({},T.relationStyles.noContent),(null===(d=null==q?void 0:q.relationStyles)||void 0===d?void 0:d.noContent)||{}),high:e(e({},T.relationStyles.high),(null===(a=null==q?void 0:q.relationStyles)||void 0===a?void 0:a.high)||{}),exact:e(e({},T.relationStyles.exact),(null===(u=null==q?void 0:q.relationStyles)||void 0===u?void 0:u.exact)||{}),medium:e(e({},T.relationStyles.medium),(null===(s=null==q?void 0:q.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},T.relationStyles.low),(null===(f=null==q?void 0:q.relationStyles)||void 0===f?void 0:f.low)||{})}}},[q]),Be=l(function(){if(Y&&Object.keys(Y).length>0)try{var n=function(n,t){var i,r,o,l,c,d,a,u;void 0===t&&(t=!1);var s=[],f=[],v=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},h=n[v];if(!h||!1===h.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var x=function(t,i){var r=n[t];if(!r)return null;var o=S(r,i,p),l=!!o.title.trim(),c=!!o.content.trim(),d=I(r),a=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=x(e,i);t&&a.push(t)}});var u=!(!l&&!c);return e({id:t,title:l?o.title:"",content:c?o.content:"",subsections:a},u?d:{score:void 0,relation:"not_defined"})};if(t){var g={},m={},y=-1,b=-1;for(var w in n)if(!["base_root_id","documents","input_index_map",v].includes(w)){var F=n[w];if(F&&!1!==F.display_node){var E=I(F),C=S(F,"0",p),_=S(F,"1",p),R=C.title.trim()||C.content.trim(),T=_.title.trim()||_.content.trim(),D=Number(null!==(r=null===(i=C.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),A=Number(null!==(l=null===(o=_.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),B=m[A]||e(e({id:w,title:T?_.title:"",content:T?_.content:"",subsections:[]},T?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:A}),k=g[D]||e(e({id:w,title:R?C.title:"",content:R?C.content:"",subsections:[]},R?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D});Number(A)>=0&&Number(D)>=0&&(B.refIndexes.includes(Number(D))||B.refIndexes.push(Number(D)),k.refIndexes.includes(Number(A))||k.refIndexes.push(Number(A))),m[A]=B,g[D]=k}}f=Object.values(m).map(function(e){return e}),s=Object.values(g).map(function(e){return e}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),s.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else h.next&&Object.values(h.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(s.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),f.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(d=null===(c=h.comparison_inputs)||void 0===c?void 0:c[p[0]])||void 0===d?void 0:d.title)||"Uploaded Contract",description:h.decision_scope_description||"",sections:s},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(a=h.comparison_inputs)||void 0===a?void 0:a[p[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:h.decision_scope_description||""},fields:{}}}}]}}(Y,Q);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[Y,Q]),ke=Be.activeProposed,ze=Be.activeVariants,He=Be.parseError;c(function(){He&&ne("Failed to load comparison: ".concat(He))},[He]);var Me=r(null),We=Me[0];Me[1];var je=r({}),Le=je[0],Ne=je[1],Oe=r({}),Pe=Oe[0],Ve=Oe[1],Xe=(null==ze?void 0:ze[0])||B,Ye=null===(W=null===(H=null==Y?void 0:Y.documents)||void 0===H?void 0:H[null===(M=null==Y?void 0:Y.input_index_map)||void 0===M?void 0:M[0]])||void 0===W?void 0:W.title,qe=null===(N=null===(j=null==Y?void 0:Y.documents)||void 0===j?void 0:j[null===(L=null==Y?void 0:Y.input_index_map)||void 0===L?void 0:L[1]])||void 0===N?void 0:N.title,Ue=w(U||Ye||"Uploaded Contract"),Ke=w(K||qe||"Reference Template"),Ge=l(function(){return(null==ke?void 0:ke.sections)||[]},[null==ke?void 0:ke.sections]),Je=l(function(){return Xe.sections||[]},[Xe.sections]),Qe=Ge.length>0||Je.length>0,Ze=Xe.analysis,$e=w(null===(P=null===(O=null==Ze?void 0:Ze.rule_difference_comparison)||void 0===O?void 0:O.summary)||void 0===P?void 0:P.overall_summary),en=!!$e.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),nn=o({}),tn=function(e){return nn.current[e]||(nn.current[e]=i.createRef()),nn.current[e]},rn=d(function(e,n,t,i,r){var o,l,c=w(n.id)||w(t.id)||"",d=(c?ae[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},a=null!==(l=null===(o=nn.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:d,anchorEl:e,sectionAnchorEl:a,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==Y?void 0:Y.documents,input_index_map:null==Y?void 0:Y.input_index_map}}},[ae]),on=d(function(e){Te(),fe(null),be(e)},[Te]),ln=d(function(){null!==Fe.sectionIdx&&Fe.anchorEl?on(e(e({},Fe),{open:!0})):Te()},[Fe,Te,on]);d(function(e){Te(),ne("".concat(e," is coming soon."))},[Te]);var cn=o(null),dn=o(null),an=o(null),un=r([]),sn=un[0],fn=un[1],vn=r(null),pn=vn[0],hn=vn[1],xn=o(null),gn=r(null),mn=gn[0],yn=gn[1],bn=d(function(){var e=Fe.sectionIdx;Te(),null!==e&&(ie&&pn===e?(re(!1),hn(null),ce(!1)):(de.current=!0,hn(e),re(!0),ce(!1),setTimeout(function(){var n,t=null===(n=nn.current[e])||void 0===n?void 0:n.current;t&&t.scrollIntoView({behavior:"smooth",block:"center"})},50),setTimeout(function(){ce(!0),de.current=!1},600)))},[Te,Fe.sectionIdx,ie,pn]),wn=l(function(){return Ae.fields.filter(function(e){var n=e.key;return(!Qe||"description"!==n)&&(F(null==ke?void 0:ke[n])||F(Xe[n]))})},[ke,Xe,Qe,Ae.fields]),Fn=o({}),En=o({}),In=o({}),Sn=o({}),Cn=o({}),_n=o({}),Rn=o({});wn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Ge.length,Je.length);t+=1)In.current[t]||(In.current[t]=i.createRef()),Sn.current[t]||(Sn.current[t]=i.createRef()),Cn.current[t]||(Cn.current[t]=i.createRef()),_n.current[t]||(_n.current[t]=i.createRef()),Rn.current[t]||(Rn.current[t]=i.createRef());Fn.current[n]||(Fn.current[n]=i.createRef()),En.current[n]||(En.current[n]=i.createRef())});for(var Tn=0;Tn<Math.max(Ge.length,Je.length);Tn+=1)In.current[Tn]||(In.current[Tn]=i.createRef()),Sn.current[Tn]||(Sn.current[Tn]=i.createRef()),Cn.current[Tn]||(Cn.current[Tn]=i.createRef()),_n.current[Tn]||(_n.current[Tn]=i.createRef()),Rn.current[Tn]||(Rn.current[Tn]=i.createRef());c(function(){if(We){var e=Ae.fields.find(function(e){return e.analysisKey===We||e.key===We});if(e){var n=Fn.current[e.key]||En.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[We,Ae.fields]);var Dn=d(function(e){var n,t,i,r,o,l,c,d,a,u=null===(n=null==Ze?void 0:Ze.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=u[e],f=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==s?void 0:s.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var v=s.mappings[0]||{};return{score:s.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=v.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(d=s.highlights)||void 0===d?void 0:d.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[Ze]),An=d(function(n){var t,i,r,o,l=Ge[n],c=Je[n],d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,a=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,u=w(null==l?void 0:l.id)||w(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!d&&!a&&!s)return e(e({},Ae.relationStyles.noContent),{label:"Not Defined"});var f=Dn("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==i?i:u?null===(r=ae[u])||void 0===r?void 0:r.relevance_score:void 0)){var v=C(),p=v.score,h=v.relation;return E(p,h,!0,Ae)}var x=d?l.relation:a?c.relation:f.relation,g=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof g?g:f.score;return E(m,x,!0,Ae)},[Ge,Je,ae,Ae,Dn]),Bn=d(function(){var e,n,t,i,r,o,l,c,d,a,u,s,f;if(!Ce.current){Ce.current=!0;try{if(!cn.current)return;if(Object.values(nn.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Object.values(Rn.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Q&&ie&&null!==pn){var v=Ge[pn],p=(null==v?void 0:v.refIndexes)||[];if(p.length>0){var h=p[0],x=Je.findIndex(function(e){return e.selfIndex===h});if(-1!==x){var g=null===(e=nn.current[pn])||void 0===e?void 0:e.current,m=null===(n=Rn.current[x])||void 0===n?void 0:n.current;if(g&&m){var y=g.getBoundingClientRect().top-m.getBoundingClientRect().top;if(m.style.transition="padding-top 0.3s ease-in-out",y>1)m.style.paddingTop="".concat(y,"px");else if(y<-1){var b=m.parentElement;b&&(de.current=!0,b.scrollTo({top:b.scrollTop+Math.abs(y),behavior:"smooth"}),setTimeout(function(){de.current=!1},400))}}}}}var w=cn.current.getBoundingClientRect();xe({width:w.width,height:w.height});var F=[];if(wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!Q)for(var I=0;I<Math.min(Ge.length,Je.length);I++){var S=null===(t=In.current[I])||void 0===t?void 0:t.current,C=null===(i=Sn.current[I])||void 0===i?void 0:i.current;S&&C&&(S.style.height="auto",C.style.height="auto",S.style.minHeight="0px",C.style.minHeight="0px")}var _={};wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();_[i]=Math.max(l.height,c.height)}});var R=[];if(!Q)for(I=0;I<Math.min(Ge.length,Je.length);I++){S=null===(r=In.current[I])||void 0===r?void 0:r.current,C=null===(o=Sn.current[I])||void 0===o?void 0:o.current;if(S&&C){var T=S.getBoundingClientRect(),D=C.getBoundingClientRect();R[I]=Math.max(T.height,D.height)}}if(wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=_[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!Q)for(I=0;I<R.length;I++){S=null===(l=In.current[I])||void 0===l?void 0:l.current,C=null===(c=Sn.current[I])||void 0===c?void 0:c.current;if(S&&C){var A=R[I];S.style.minHeight="".concat(A,"px"),C.style.minHeight="".concat(A,"px")}}if(wn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Fn.current[i])||void 0===n?void 0:n.current,l=null===(t=En.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),d=l.getBoundingClientRect(),a=Dn(r),u=E(a.score,a.relation,a.hasContent,Ae);if(!u)return;var s=c.top+c.height/2-w.top;F.push({id:"field-".concat(i),x1:c.right-w.left,y1:s,x2:d.left-w.left,y2:s,style:u})}}),Q)Ge.forEach(function(e,n){var t;(null===(t=In.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Je.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=Cn.current[n])||void 0===t?void 0:t.current,l=null===(i=_n.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),d=l.getBoundingClientRect(),a=c.right-w.left,u=d.left-w.left,s=c.top+c.height/2-w.top,f=d.top+d.height/2-w.top,v=An(n);v&&F.push({id:"line-".concat(n,"-").concat(r),x1:a,y1:s,x2:u,y2:f,style:v,sectionIdx:n,targetRightIdx:r})}}})});else for(I=0;I<Math.min(Ge.length,Je.length);I++){var B=null===(d=In.current[I])||void 0===d?void 0:d.current,k=null===(a=Sn.current[I])||void 0===a?void 0:a.current;if(B&&k){var z=B.querySelector(".MuiAccordionSummary-root"),H=k.querySelector(".MuiAccordionSummary-root");if(z&&H){var M=z.getBoundingClientRect(),W=H.getBoundingClientRect(),j=(M.top+M.height/2-w.top+W.top+W.height/2-w.top)/2,L=(null===(u=Je[I])||void 0===u?void 0:u.id)||"sec-".concat(I),N=An(I);N&&F.push({id:L,x1:M.right-w.left,y1:j,x2:W.left-w.left,y2:j,style:N,sectionIdx:I,hasCognitive:!!((null===(s=Ge[I])||void 0===s?void 0:s.cognitiveData)||(null===(f=Je[I])||void 0===f?void 0:f.cognitiveData)||L&&ae[L])})}}}if(fn(F),dn.current&&an.current){var O=dn.current.getBoundingClientRect(),P=an.current.getBoundingClientRect(),V=(O.top+O.height/2-w.top+P.top+P.height/2-w.top)/2;yn({x1:O.right-w.left,x2:P.left-w.left,y:V})}else yn(null)}catch(e){console.error("Line render safe fail: ",e)}finally{Ce.current=!1}}},[wn,Ge,Je,ae,Ae,Dn,An,Q,ie,pn,Pe]),kn=d(function(){null!==xn.current&&window.cancelAnimationFrame(xn.current),xn.current=window.requestAnimationFrame(function(){Bn(),xn.current=null})},[Bn]),zn=d(function(){kn(),ie&&!de.current&&(re(!1),hn(null),ce(!1))},[kn,ie]);c(function(){var e=setTimeout(kn,250);window.addEventListener("resize",kn);var n=null,t=null;return Ie.current&&(n=new ResizeObserver(kn)).observe(Ie.current),cn.current&&(t=new ResizeObserver(kn)).observe(cn.current),function(){clearTimeout(e),window.removeEventListener("resize",kn),null==n||n.disconnect(),null==t||t.disconnect()}},[ke,Xe,Ze,wn,Le,Ge,Je,Ae,kn]);var Hn=function(r,o,l,c,d){void 0===d&&(d=1);var u,s=Q?!!Le["".concat(l,"-").concat(o)]:!!Le[String(o)],m=F(r.title),y=F(r.content),E=!m&&!y,I=r.title;return m||(I=y?"No Title Found":"No Matching Section Found"),t(a,e({ref:c,sx:e(e({mb:d},Q?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n(p,e({disableGutters:!0,expanded:!E&&s,onChange:function(){return!E&&function(n,t){Ne(function(i){var r=e({},i);if(!Q){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),c=!i[l];if(r[l]=c,"left"===t)((null==(d=Ge[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=Je.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var d,a=null==(d=Je[n])?void 0:d.selfIndex;Ge.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a))&&(r["left-".concat(n)]=c)})}return r})}(o,l)},sx:{boxShadow:"none",border:E?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:E?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(h,e({expandIcon:E?null:t(g,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:E?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(v,e({title:I,placement:"top"},{children:t(f,e({sx:{fontSize:"12px",color:E?"#94A3B8":"#19213D",fontWeight:E?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=I,u?w(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!E&&n(x,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(f,e({component:"div",sx:ge},{children:t(b,{children:w(r.content).replace(/\\n/g,"\n")})})),(r.subsections||[]).map(function(e,n){return Mn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},Mn=function(i,r,o){void 0===o&&(o=0);var l=F(i.title),c=F(i.content),d=!l&&!c,u=l?i.title:c?"No Title Found":"No Matching Section Found",s=!!Pe[r];return i.title?n(p,e({disableGutters:!0,expanded:!d&&s,onChange:function(){return!d&&Ve(function(n){var t;return e(e({},n),((t={})[r]=!n[r],t))})},sx:{mt:1,boxShadow:"none",border:d?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[t(h,e({expandIcon:d?null:t(g,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:t(f,e({sx:{fontSize:"11px",fontWeight:600,color:d?"#94A3B8":"#19213D"}},{children:u||"Untitled Subsection"}))})),!d&&n(x,e({sx:{pt:0,pb:1}},{children:[c&&t(f,e({component:"div",sx:ge},{children:t(b,{children:w(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Mn(e,"".concat(r,"-").concat(n),o+1)})]}))]}),r):t(a,e({sx:{mt:0===o?1:.75}},{children:!d&&n("div",{children:[c&&t(f,e({component:"div",sx:ge},{children:t(b,{children:w(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Mn(e,"".concat(r,"-").concat(n),o+1)})]})}),r)};return n(a,e({ref:Se,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Q?{}:{overflow:"visible"}),{position:"relative"})},{children:[Q&&t(A,{open:Fe.open,anchorEl:Fe.anchorEl,sectionTitle:Fe.sectionTitle,referenceSectionTitle:Fe.refSectionTitle,onClose:Te,onOpenCognitiveCompare:ln,onOpenSideBySide:bn}),ye.open&&t(D,{open:ye.open,popupRef:ve,position:se,popupConfig:Z,onClose:function(){fe(null),be(function(n){return e(e({},n),{open:!1})})},markdownStyles:G,sectionTitle:ye.sectionTitle,referenceSectionTitle:ye.refSectionTitle,cognitiveData:ye.cognitiveData,anchorEl:ye.anchorEl,sectionAnchorEl:ye.sectionAnchorEl,scrollContainerEl:Ie.current,badgeStyle:ye.badgeStyle,docData:ye.docData}),t(u,e({open:!!ee,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(s,e({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ee}))})),t(a,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(a,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(f,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:X}))}))})),t(a,e({ref:Ie,onScroll:zn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Q?"hidden":"auto",borderTop:$e&&en?"none":"1.5px solid #EEF0F4"}},{children:t(a,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Q?{flex:1,minHeight:0}:{})},{children:n(a,e({ref:cn,sx:e({display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Q?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:he.width||"100%",height:he.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[mn&&n("g",{children:[t("line",{x1:mn.x1,y1:mn.y,x2:Math.max(mn.x1,(mn.x1+mn.x2)/2-70),y2:mn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(mn.x2,(mn.x1+mn.x2)/2+70),y1:mn.y,x2:mn.x2,y2:mn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),sn.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!Q)return n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(a,e({onClick:function(e){var n=Ge[i.sectionIdx]||{title:"",content:""},t=Je[i.sectionIdx]||{title:"",content:""};on(rn(e.currentTarget,n,t,i.sectionIdx,i.style))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,t(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),t(g,{size:11})]}))}))}))]},i.id);var l=Ge[i.sectionIdx];return!(null===(r=null==l?void 0:l.refIndexes)||void 0===r?void 0:r.length)||(null==l?void 0:l.selfIndex)<0?null:ie&&pn===i.sectionIdx&&le?n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id):null})]})),n(a,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Q?{flex:1,overflow:"visible"}:{})},{children:[t(a,e({ref:dn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:t(v,e({title:Ue,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ue}))}))})),t(a,e({onScroll:zn,sx:e({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Qe&&Ge.map(function(r,o){var l;if(!Q)return t(a,e({ref:tn(o)},{children:Hn(r,o,"left",In.current[o])}),"left-row-".concat(o));var c=r,d=An(o),u=!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0,s="number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null;return t(a,e({ref:tn(o),sx:{mb:1}},{children:n(a,e({sx:{position:"relative",width:"100%"}},{children:[t(a,e({ref:In.current[o],sx:{width:"100%"}},{children:Hn(r,o,"left",i.createRef(),0)})),d&&n(a,e({ref:Cn.current[o],onClick:function(e){var n=Je.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),Fe.open&&Fe.sectionIdx===i?Te():(Re(),Ee(rn(e.currentTarget,n,t,i,r)))}(e,r,n,o,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==s&&t(a,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:s})),t(a,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:u?"No Deviation Found":0==d.deviationLabel||void 0===d.deviationLabel?"Same":"".concat(d.deviationLabel,"% Deviation")})),t(m,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),t(a,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(a,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[t(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(g,{size:11})]}))}))})),n(a,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Q?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[t(a,e({ref:an,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:t(v,e({title:Ke,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ke}))}))})),t(a,e({onScroll:zn,sx:e({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Qe&&Je.map(function(r,o){if(!Q)return Hn(r,o,"right",Sn.current[o]);var l=r,c=Ge.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return t(a,e({ref:Rn.current[o],sx:{mb:1}},{children:n(a,e({sx:{position:"relative",width:"100%"}},{children:[t(a,e({ref:Sn.current[o],sx:{width:"100%"}},{children:Hn(r,o,"right",i.createRef(),0)})),t(a,e({ref:_n.current[o],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))})}))]}))]}))}))}))]}))};export{z as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],
|
|
1
|
+
var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],i={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}},t={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}},a={tabs:{deviation:{key:"deviation",label:"Deviation Analysis",subtitle:"Why this is a deviation?",placeholderTitle:"Deviation Analysis",placeholderBody:"Deviation analysis content will appear here..."},association:{key:"association",label:"Association Logic",subtitle:"Why these sections are paired?"}},decisionStrengthLabel:"Decision Strength",sectionTitles:{decisioningFactors:"Decision Making Factors",gaps:"Gaps in Decision"},emptyStateMessage:"No cognitive decisioning data available for this section.",accentColor:"#5928ED"};export{i as DEFAULT_COMPARISON_CONFIG,e as DEFAULT_FIELD_CONFIG,a as DEFAULT_POPUP_CONFIG,t as SHARED_MARKDOWN_STYLES};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConfig.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";var i=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(i).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},
|
|
1
|
+
import{__assign as n}from"tslib";var i=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(i).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},t=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return t(n)}))},e=function(n,t,e){var r,o=e[t],a=null===(r=null==n?void 0:n.comparison_inputs)||void 0===r?void 0:r[o];return{title:i((null==a?void 0:a.title)||""),content:i((null==a?void 0:a.content)||""),attributes:(null==a?void 0:a.additional_attributes)||null,subsections:(null==a?void 0:a.subsections)||[]}},r=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var i=n.mapping_rationale,t=parseInt(i.decision_strength||"0");return{cognitiveData:{decisioning:i.decisioning_factors||[],gap:i.gaps_in_decision||[],relevance_score:t,citations:i.citations},score:0,relation:"N/A"}},o=function(n){return n&&"string"==typeof n?"N/A"===n.toUpperCase()?"N/A":n.split("_").map(function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}).join(" "):"Unknown"},a=function(i,t,e,r){var a=100*(i||0),l=r.thresholds,s=r.relationStyles;if(!e)return null;var c=o(t),u=(t||"").toLowerCase();return"n/a"===u||u.includes("no_deviation")?n(n({},s.low),{label:c}):u.includes("deviation")||u.includes("high_risk")||u.includes("critical")?n(n({},s.high),{label:c}):a>=l.exact?n(n({},s.exact),{label:c}):a>=l.high?n(n({},s.high),{label:c}):a>=l.medium?n(n({},s.medium),{label:c}):n(n({},s.low),{label:c})},l=function(n){return{score:0,relation:"N/A"}};export{l as cognitiveScoreToRelation,o as formatRelationToLabel,r as getRationale,e as getSideData,a as getStyleForRelation,t as hasValue,i as safeStringify};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|