@viswa-test/test-citation 0.0.142 → 0.0.143

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("../CognitiveComparehelpers.js");exports.useSideBySide=function(t){var r=t.maintainRelativeOrder,i=t.proposedSections,l=t.existingSections,u=t.leftContainerRef,o=t.rightContainerRef,c=t.scrollContainerRef,s=t.sectionLeftRefs,d=t.sectionRightRefs,a=t.subSectionLeftRefs,v=t.subSectionRightRefs,p=t.lhsBadgeRefs,f=t.rhsBadgeRefs,g=t.sectionRowRefs,h=t.sectionRightRowRefs,R=t.rhsTopSpacerRef,S=t.rhsBottomSpacerRef,y=t.lhsTopSpacerRef,A=t.lhsBottomSpacerRef,T=t.calculateLinesRef,B=t.setConnectedSections,m=t.setConnectedLines,E=t.cachedConnectedPositions,x=t.closeMoreFunctionsPopup,C=t.setErrorToast,I=t.moreFunctions,O=t.closeSummaryPopup,b=e.useState(!0),_=b[0],D=b[1],N=e.useState(!1),P=N[0],V=N[1],G=e.useState(!1),w=G[0],L=G[1],q=e.useState(!1),F=q[0],M=q[1],H=e.useState(null),k=H[0],j=H[1],z=e.useRef(!1),J=e.useRef(null),K=e.useRef(!1),Q=e.useRef(null),U=e.useRef(null),W=e.useRef(null),X=e.useRef(new Set),Y=function(){X.current.forEach(function(e){n.resetClauseHighlight(e)}),X.current.clear()},Z=function(e,t,r){var i,l,c,R,S,y,A,T,B,m,E,x,C=null,I=null,O=null,b=null,_=null,D=null,N=function(e,n){if(!e||!n)return!0;var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return t.bottom>=r.top&&t.top<=r.bottom};if(e){var P=t.split(n.DEVIATION_BADGE_SEPARATOR),V="".concat(P[0]).concat(n.DEVIATION_BADGE_SEPARATOR).concat(P[1]);C=(null===(i=a.current[P[2]])||void 0===i?void 0:i.current)||(null===(l=s.current[Number(P[2])])||void 0===l?void 0:l.current)||null,I=(null===(c=v.current[P[3]])||void 0===c?void 0:c.current)||(null===(R=d.current[Number(P[3])])||void 0===R?void 0:R.current)||null,O=(null===(S=p.current[V])||void 0===S?void 0:S.current)||C,b=(null===(y=f.current[V])||void 0===y?void 0:y.current)||I}else{var G=Number(t),w=null!==r?Number(r):G;C=(null===(A=s.current[G])||void 0===A?void 0:A.current)||null,I=(null===(T=d.current[w])||void 0===T?void 0:T.current)||null,_=(null===(B=p.current[G])||void 0===B?void 0:B.current)||null,D=(null===(m=f.current[w])||void 0===m?void 0:m.current)||null,O=_||(null===(E=g.current[G])||void 0===E?void 0:E.current)||C,b=D||(null===(x=h.current[w])||void 0===x?void 0:x.current)||I}if(C&&(C.style.paddingTop="0px"),I&&(I.style.paddingTop="0px"),e||(_&&(_.style.marginTop="0px"),D&&(D.style.marginTop="0px")),!e&&_&&D){var L=u.current,q=o.current;if(!N(_,L)||!N(D,q))return;var F=_.getBoundingClientRect(),M=D.getBoundingClientRect(),H=F.top-M.top;if(Math.abs(H)>32)return;H>0?D.style.marginTop="".concat(H,"px"):H<0&&(_.style.marginTop="".concat(Math.abs(H),"px"))}else if(O&&b&&C&&I){F=O.getBoundingClientRect(),M=b.getBoundingClientRect();(H=F.top-M.top)>0?I.style.paddingTop="".concat(H,"px"):H<0&&(C.style.paddingTop="".concat(Math.abs(H),"px"))}};e.useEffect(function(){K.current=_},[_]),e.useEffect(function(){Q.current=k},[k]);var $=e.useCallback(function(){var e,t,r,i,l,u,o,c;Y(),D(!1),K.current=!1,J.current=null;var g=Q.current,h=U.current;if(null!==g)if("string"==typeof g&&g.includes(n.DEVIATION_BADGE_SEPARATOR)){var T=g.split(n.DEVIATION_BADGE_SEPARATOR);(B=(null===(e=a.current[T[2]])||void 0===e?void 0:e.current)||(null===(t=s.current[Number(T[2])])||void 0===t?void 0:t.current))&&(B.style.paddingTop="0px")}else{var B;(B=null===(r=s.current[g])||void 0===r?void 0:r.current)&&(B.style.paddingTop="0px");var m=null===(i=p.current[g])||void 0===i?void 0:i.current;m&&(m.style.marginTop="0px")}if(null!==h)if("string"==typeof h&&h.includes(n.DEVIATION_BADGE_SEPARATOR)){T=h.split(n.DEVIATION_BADGE_SEPARATOR);(E=(null===(l=v.current[T[3]])||void 0===l?void 0:l.current)||(null===(u=d.current[Number(T[3])])||void 0===u?void 0:u.current))&&(E.style.paddingTop="0px")}else{var E;(E=null===(o=d.current[h])||void 0===o?void 0:o.current)&&(E.style.paddingTop="0px");var x=null===(c=f.current[h])||void 0===c?void 0:c.current;x&&(x.style.marginTop="0px")}j(null),Q.current=null,U.current=null,V(!1),M(!1),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),y.current&&(y.current.style.height="0px"),A.current&&(A.current.style.height="0px")},[]),ee=e.useCallback(function(e,t,a){var v,I,O=null===(v=null==a?void 0:a.toggleIfSame)||void 0===v||v,b=null==a?void 0:a.onReady,N=null!==(I=null==a?void 0:a.sourceSide)&&void 0!==I?I:"left";x(),null!=e&&(t?C("No counterpart exists for this section."):(Y(),_&&k===e?O?$():null==b||b():(B(new Set([e])),m([]),E.current=[],M(!0),z.current=!0,j(e),Q.current=e,D(!0),K.current=!0,V(!1),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),y.current&&(y.current.style.height="0px"),A.current&&(A.current.style.height="0px"),requestAnimationFrame(function(){var t,a,v,B,m,E,x,C,I="string"==typeof e&&e.includes(n.DEVIATION_BADGE_SEPARATOR),O=null,_=null,D=null;if(I){var P=e.split(n.DEVIATION_BADGE_SEPARATOR),G="".concat(P[0]).concat(n.DEVIATION_BADGE_SEPARATOR).concat(P[1]);O=(null===(t=p.current[G])||void 0===t?void 0:t.current)||null,_=(null===(a=f.current[G])||void 0===a?void 0:a.current)||null,D=_?e:null}else if(O=(null===(v=s.current[e])||void 0===v?void 0:v.current)||(null===(B=g.current[e])||void 0===B?void 0:B.current)||null,r){var w=i[e],L=(null==w?void 0:w.refIndexes)||[];if(L.length>0){var q=L[0],F=l.findIndex(function(e){return e.selfIndex===q});-1!==F&&(_=(null===(x=d.current[F])||void 0===x?void 0:x.current)||(null===(C=h.current[F])||void 0===C?void 0:C.current)||null,D=F)}}else _=(null===(m=d.current[e])||void 0===m?void 0:m.current)||(null===(E=h.current[e])||void 0===E?void 0:E.current)||null,D=_?e:null;U.current=D;var H=u.current,k=o.current,j=function(){Z(I,e,D),V(!0),T.current&&T.current(),z.current=!1,"right"===N&&k?k.dispatchEvent(new Event("scroll")):H&&H.dispatchEvent(new Event("scroll")),M(!1),null==b||b()};if(!O||!H)return z.current=!1,M(!1),void(null==b||b());if(_&&k){if(!r){var J=0;J="right"===N?_?_.getBoundingClientRect().top:0:O?O.getBoundingClientRect().top:0;var K=c.current,Q=(null==K?void 0:K.getBoundingClientRect().top)||0,W=K?K.scrollTop+J-Q-150:0;return K?void n.smoothScrollTo(K,W,200,j):void j()}var X=O.getBoundingClientRect().top-H.getBoundingClientRect().top+H.scrollTop,Y=_.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop,$=200;if("left"===N){var ee=Y-(X-H.scrollTop);ee<0&&R.current&&(R.current.style.height="".concat(Math.abs(ee),"px")),requestAnimationFrame(function(){var e,t=k.scrollHeight-k.clientHeight;if(ee<0)e=0;else{if(ee>t){var r=ee-t;return S.current&&(S.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){n.smoothScrollTo(k,ee,$,j)})}e=ee}n.smoothScrollTo(k,e,$,j)})}else{var ne=X-(Y-k.scrollTop);ne<0&&y.current&&(y.current.style.height="".concat(Math.abs(ne),"px")),requestAnimationFrame(function(){var e,t=H.scrollHeight-H.clientHeight;if(ne<0)e=0;else{if(ne>t){var r=ne-t;return A.current&&(A.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){n.smoothScrollTo(H,ne,$,j)})}e=ne}n.smoothScrollTo(H,e,$,j)})}}else j()}))))},[k,x,l,_,r,i,$]);return e.useCallback(function(){var e,n=I.sectionIdx,t=I.isOrphan;if(O(),null!=n){var r="left";I.anchorEl&&(null===(e=o.current)||void 0===e?void 0:e.contains(I.anchorEl))&&(r="right"),ee(n,t,{sourceSide:r})}},[ee,I.isOrphan,I.sectionIdx,I.anchorEl,O]),{isSideBySide:_,setIsSideBySide:D,isArrowVisible:P,setIsArrowVisible:V,isResizing:w,setIsResizing:L,isSideBySideLoading:F,setIsSideBySideLoading:M,activeSideBySideSection:k,setActiveSideBySideSection:j,scrollLock:z,sideBySideCacheRef:J,isSideBySideRef:K,activeSideBySideSectionRef:Q,activeSideBySideRightSectionRef:U,sideBySideLineRef:W,highlightedClauseRefs:X,clearClauseHighlight:Y,applyAlignmentPadding:Z,resetSideBySide:$,activateSideBySide:ee}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../CognitiveComparehelpers.js");exports.useSideBySide=function(n){var r=n.maintainRelativeOrder,i=n.proposedSections,u=n.existingSections,l=n.leftContainerRef,o=n.rightContainerRef,c=n.scrollContainerRef,s=n.sectionLeftRefs,d=n.sectionRightRefs,a=n.subSectionLeftRefs,v=n.subSectionRightRefs,f=n.lhsBadgeRefs,p=n.rhsBadgeRefs,g=n.sectionRowRefs,h=n.sectionRightRowRefs,R=n.rhsTopSpacerRef,S=n.rhsBottomSpacerRef,A=n.lhsTopSpacerRef,E=n.lhsBottomSpacerRef,T=n.calculateLinesRef,y=n.setConnectedSections,B=n.setConnectedLines,m=n.cachedConnectedPositions,I=n.closeMoreFunctionsPopup,x=n.setErrorToast,O=n.moreFunctions,C=n.closeSummaryPopup,_=e.useState(!0),D=_[0],N=_[1],b=e.useState(!1),P=b[0],V=b[1],G=e.useState(!1),w=G[0],H=G[1],L=e.useState(!1),q=L[0],F=L[1],M=e.useState(null),k=M[0],j=M[1],z=e.useRef(!1),J=e.useRef(null),K=e.useRef(!1),Q=e.useRef(null),U=e.useRef(null),W=e.useRef(null),X=e.useRef(new Set),Y=function(){X.current.forEach(function(e){t.resetClauseHighlight(e)}),X.current.clear()},Z=function(e,n){var r,i,u,l,o,c,f;null!==e&&("string"==typeof e&&e.includes(t.DEVIATION_BADGE_SEPARATOR)?(f=(null===(r=a.current[e.split(t.DEVIATION_BADGE_SEPARATOR)[2]])||void 0===r?void 0:r.current)||(null===(i=s.current[Number(e.split(t.DEVIATION_BADGE_SEPARATOR)[2])])||void 0===i?void 0:i.current))&&(f.style.paddingTop="0px"):(f=null===(u=s.current[Number(e)])||void 0===u?void 0:u.current)&&(f.style.paddingTop="0px"));null!==n&&("string"==typeof n&&n.includes(t.DEVIATION_BADGE_SEPARATOR)?(f=(null===(l=v.current[n.split(t.DEVIATION_BADGE_SEPARATOR)[3]])||void 0===l?void 0:l.current)||(null===(o=d.current[Number(n.split(t.DEVIATION_BADGE_SEPARATOR)[3])])||void 0===o?void 0:o.current))&&(f.style.paddingTop="0px"):(f=null===(c=d.current[Number(n)])||void 0===c?void 0:c.current)&&(f.style.paddingTop="0px"))},$=function(e,n,r){var i,u,l,o,c,R,S,A,E,T,y,B,m=null,I=null,x=null,O=null;if(e){var C=n.split(t.DEVIATION_BADGE_SEPARATOR),_="".concat(C[0]).concat(t.DEVIATION_BADGE_SEPARATOR).concat(C[1]);m=(null===(i=a.current[C[2]])||void 0===i?void 0:i.current)||(null===(u=s.current[Number(C[2])])||void 0===u?void 0:u.current)||null,I=(null===(l=v.current[C[3]])||void 0===l?void 0:l.current)||(null===(o=d.current[Number(C[3])])||void 0===o?void 0:o.current)||null,x=(null===(c=f.current[_])||void 0===c?void 0:c.current)||m,O=(null===(R=p.current[_])||void 0===R?void 0:R.current)||I}else{var D=Number(n),N=null!==r?Number(r):null!==U.current?Number(U.current):D;m=(null===(S=s.current[D])||void 0===S?void 0:S.current)||null,I=(null===(A=d.current[N])||void 0===A?void 0:A.current)||null,x=(null===(E=f.current[D])||void 0===E?void 0:E.current)||(null===(T=g.current[D])||void 0===T?void 0:T.current)||m,O=(null===(y=p.current[N])||void 0===y?void 0:y.current)||(null===(B=h.current[N])||void 0===B?void 0:B.current)||I}if(x&&O&&m&&I){m.style.paddingTop="0px",I.style.paddingTop="0px",x.offsetHeight;var b=x.getBoundingClientRect(),P=O.getBoundingClientRect(),V=Math.round(b.top-P.top);V>0?I.style.paddingTop="".concat(V,"px"):V<0&&(m.style.paddingTop="".concat(Math.abs(V),"px"))}};e.useEffect(function(){K.current=D},[D]),e.useEffect(function(){Q.current=k},[k]);var ee=e.useCallback(function(){Y(),N(!1),K.current=!1,J.current=null,Z(Q.current,U.current),j(null),Q.current=null,U.current=null,V(!1),F(!1),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),A.current&&(A.current.style.height="0px"),E.current&&(E.current.style.height="0px")},[]),te=e.useCallback(function(e,n,s){var d,a,v=null===(d=null==s?void 0:s.toggleIfSame)||void 0===d||d,O=null==s?void 0:s.onReady,C=null!==(a=null==s?void 0:s.sourceSide)&&void 0!==a?a:"left";I(),null!=e&&(n?x("No counterpart exists for this section."):(Y(),D&&k===e?v?ee():null==O||O():(Z(Q.current,U.current),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),A.current&&(A.current.style.height="0px"),E.current&&(E.current.style.height="0px"),l.current&&l.current.offsetHeight,y(new Set([e])),B([]),m.current=[],F(!0),z.current=!0,j(e),Q.current=e,N(!0),K.current=!0,V(!1),requestAnimationFrame(function(){var n,s,d,a,v,y="string"==typeof e&&e.includes(t.DEVIATION_BADGE_SEPARATOR),B=null,m=null,I=null;if(y){var x=e.split(t.DEVIATION_BADGE_SEPARATOR),_="".concat(x[0]).concat(t.DEVIATION_BADGE_SEPARATOR).concat(x[1]);B=(null===(n=f.current[_])||void 0===n?void 0:n.current)||null,m=(null===(s=p.current[_])||void 0===s?void 0:s.current)||null,I=m?e:null}else if(B=(null===(d=g.current[e])||void 0===d?void 0:d.current)||null,r){var D=i[e],N=(null==D?void 0:D.refIndexes)||[];if(N.length>0){var b=N[0],P=u.findIndex(function(e){return e.selfIndex===b});-1!==P&&(m=(null===(v=h.current[P])||void 0===v?void 0:v.current)||null,I=P)}}else m=(null===(a=h.current[e])||void 0===a?void 0:a.current)||null,I=m?e:null;U.current=I;var G=l.current,w=o.current,H=function(){$(y,e,I),V(!0),T.current&&T.current(),z.current=!1,"right"===C&&w?w.dispatchEvent(new Event("scroll")):G&&G.dispatchEvent(new Event("scroll")),F(!1),null==O||O()};if(!B||!G)return z.current=!1,F(!1),void(null==O||O());if(m&&w){if(!r){var L=0;L="right"===C?m?m.getBoundingClientRect().top:0:B?B.getBoundingClientRect().top:0;var q=c.current,M=(null==q?void 0:q.getBoundingClientRect().top)||0,k=q?q.scrollTop+L-M-150:0;return q?void t.smoothScrollTo(q,k,200,H):void H()}var j=B.getBoundingClientRect().top-G.getBoundingClientRect().top+G.scrollTop,J=m.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,K=200;if("left"===C){var Q=J-(j-G.scrollTop);Q<0&&R.current&&(R.current.style.height="".concat(Math.abs(Q),"px")),requestAnimationFrame(function(){var e,n=w.scrollHeight-w.clientHeight;if(Q<0)e=0;else{if(Q>n){var r=Q-n;return S.current&&(S.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){t.smoothScrollTo(w,Q,K,H)})}e=Q}t.smoothScrollTo(w,e,K,H)})}else{var W=j-(J-w.scrollTop);W<0&&A.current&&(A.current.style.height="".concat(Math.abs(W),"px")),requestAnimationFrame(function(){var e,n=G.scrollHeight-G.clientHeight;if(W<0)e=0;else{if(W>n){var r=W-n;return E.current&&(E.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){t.smoothScrollTo(G,W,K,H)})}e=W}t.smoothScrollTo(G,e,K,H)})}}else H()}))))},[k,I,u,D,r,i,ee]);return e.useCallback(function(){var e,t=O.sectionIdx,n=O.isOrphan;if(C(),null!=t){var r="left";O.anchorEl&&(null===(e=o.current)||void 0===e?void 0:e.contains(O.anchorEl))&&(r="right"),te(t,n,{sourceSide:r})}},[te,O.isOrphan,O.sectionIdx,O.anchorEl,C]),{isSideBySide:D,setIsSideBySide:N,isArrowVisible:P,setIsArrowVisible:V,isResizing:w,setIsResizing:H,isSideBySideLoading:q,setIsSideBySideLoading:F,activeSideBySideSection:k,setActiveSideBySideSection:j,scrollLock:z,sideBySideCacheRef:J,isSideBySideRef:K,activeSideBySideSectionRef:Q,activeSideBySideRightSectionRef:U,sideBySideLineRef:W,highlightedClauseRefs:X,clearClauseHighlight:Y,applyAlignmentPadding:$,resetSideBySide:ee,activateSideBySide:te}};
2
2
  //# sourceMappingURL=useSideBySide.js.map
@@ -1,2 +1,2 @@
1
- import{useState as e,useRef as n,useEffect as t,useCallback as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var o=function(o){var c=o.maintainRelativeOrder,d=o.proposedSections,s=o.existingSections,a=o.leftContainerRef,v=o.rightContainerRef,p=o.scrollContainerRef,g=o.sectionLeftRefs,f=o.sectionRightRefs,h=o.subSectionLeftRefs,y=o.subSectionRightRefs,R=o.lhsBadgeRefs,S=o.rhsBadgeRefs,m=o.sectionRowRefs,x=o.sectionRightRowRefs,B=o.rhsTopSpacerRef,C=o.rhsBottomSpacerRef,T=o.lhsTopSpacerRef,b=o.lhsBottomSpacerRef,I=o.calculateLinesRef,A=o.setConnectedSections,E=o.setConnectedLines,w=o.cachedConnectedPositions,L=o.closeMoreFunctionsPopup,F=o.setErrorToast,N=o.moreFunctions,M=o.closeSummaryPopup,q=e(!0),H=q[0],P=q[1],O=e(!1),z=O[0],V=O[1],j=e(!1),k=j[0],D=j[1],G=e(!1),J=G[0],K=G[1],Q=e(null),U=Q[0],W=Q[1],X=n(!1),Y=n(null),Z=n(!1),$=n(null),_=n(null),ee=n(null),ne=n(new Set),te=function(){ne.current.forEach(function(e){u(e)}),ne.current.clear()},re=function(e,n,t){var r,l,u,o,c,d,s,p,B,C,T,b,I=null,A=null,E=null,w=null,L=null,F=null,N=function(e,n){if(!e||!n)return!0;var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return t.bottom>=r.top&&t.top<=r.bottom};if(e){var M=n.split(i),q="".concat(M[0]).concat(i).concat(M[1]);I=(null===(r=h.current[M[2]])||void 0===r?void 0:r.current)||(null===(l=g.current[Number(M[2])])||void 0===l?void 0:l.current)||null,A=(null===(u=y.current[M[3]])||void 0===u?void 0:u.current)||(null===(o=f.current[Number(M[3])])||void 0===o?void 0:o.current)||null,E=(null===(c=R.current[q])||void 0===c?void 0:c.current)||I,w=(null===(d=S.current[q])||void 0===d?void 0:d.current)||A}else{var H=Number(n),P=null!==t?Number(t):H;I=(null===(s=g.current[H])||void 0===s?void 0:s.current)||null,A=(null===(p=f.current[P])||void 0===p?void 0:p.current)||null,L=(null===(B=R.current[H])||void 0===B?void 0:B.current)||null,F=(null===(C=S.current[P])||void 0===C?void 0:C.current)||null,E=L||(null===(T=m.current[H])||void 0===T?void 0:T.current)||I,w=F||(null===(b=x.current[P])||void 0===b?void 0:b.current)||A}if(I&&(I.style.paddingTop="0px"),A&&(A.style.paddingTop="0px"),e||(L&&(L.style.marginTop="0px"),F&&(F.style.marginTop="0px")),!e&&L&&F){var O=a.current,z=v.current;if(!N(L,O)||!N(F,z))return;var V=L.getBoundingClientRect(),j=F.getBoundingClientRect(),k=V.top-j.top;if(Math.abs(k)>32)return;k>0?F.style.marginTop="".concat(k,"px"):k<0&&(L.style.marginTop="".concat(Math.abs(k),"px"))}else if(E&&w&&I&&A){V=E.getBoundingClientRect(),j=w.getBoundingClientRect();(k=V.top-j.top)>0?A.style.paddingTop="".concat(k,"px"):k<0&&(I.style.paddingTop="".concat(Math.abs(k),"px"))}};t(function(){Z.current=H},[H]),t(function(){$.current=U},[U]);var ie=r(function(){var e,n,t,r,l,u,o,c;te(),P(!1),Z.current=!1,Y.current=null;var d=$.current,s=_.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var a=d.split(i);(v=(null===(e=h.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=g.current[Number(a[2])])||void 0===n?void 0:n.current))&&(v.style.paddingTop="0px")}else{var v;(v=null===(t=g.current[d])||void 0===t?void 0:t.current)&&(v.style.paddingTop="0px");var p=null===(r=R.current[d])||void 0===r?void 0:r.current;p&&(p.style.marginTop="0px")}if(null!==s)if("string"==typeof s&&s.includes(i)){a=s.split(i);(m=(null===(l=y.current[a[3]])||void 0===l?void 0:l.current)||(null===(u=f.current[Number(a[3])])||void 0===u?void 0:u.current))&&(m.style.paddingTop="0px")}else{var m;(m=null===(o=f.current[s])||void 0===o?void 0:o.current)&&(m.style.paddingTop="0px");var x=null===(c=S.current[s])||void 0===c?void 0:c.current;x&&(x.style.marginTop="0px")}W(null),$.current=null,_.current=null,V(!1),K(!1),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px")},[]),le=r(function(e,n,t){var r,u,o=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,h=null==t?void 0:t.onReady,y=null!==(u=null==t?void 0:t.sourceSide)&&void 0!==u?u:"left";L(),null!=e&&(n?F("No counterpart exists for this section."):(te(),H&&U===e?o?ie():null==h||h():(A(new Set([e])),E([]),w.current=[],K(!0),X.current=!0,W(e),$.current=e,P(!0),Z.current=!0,V(!1),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),requestAnimationFrame(function(){var n,t,r,u,o,A,E,w,L="string"==typeof e&&e.includes(i),F=null,N=null,M=null;if(L){var q=e.split(i),H="".concat(q[0]).concat(i).concat(q[1]);F=(null===(n=R.current[H])||void 0===n?void 0:n.current)||null,N=(null===(t=S.current[H])||void 0===t?void 0:t.current)||null,M=N?e:null}else if(F=(null===(r=g.current[e])||void 0===r?void 0:r.current)||(null===(u=m.current[e])||void 0===u?void 0:u.current)||null,c){var P=d[e],O=(null==P?void 0:P.refIndexes)||[];if(O.length>0){var z=O[0],j=s.findIndex(function(e){return e.selfIndex===z});-1!==j&&(N=(null===(E=f.current[j])||void 0===E?void 0:E.current)||(null===(w=x.current[j])||void 0===w?void 0:w.current)||null,M=j)}}else N=(null===(o=f.current[e])||void 0===o?void 0:o.current)||(null===(A=x.current[e])||void 0===A?void 0:A.current)||null,M=N?e:null;_.current=M;var k=a.current,D=v.current,G=function(){re(L,e,M),V(!0),I.current&&I.current(),X.current=!1,"right"===y&&D?D.dispatchEvent(new Event("scroll")):k&&k.dispatchEvent(new Event("scroll")),K(!1),null==h||h()};if(!F||!k)return X.current=!1,K(!1),void(null==h||h());if(N&&D){if(!c){var J=0;J="right"===y?N?N.getBoundingClientRect().top:0:F?F.getBoundingClientRect().top:0;var Q=p.current,U=(null==Q?void 0:Q.getBoundingClientRect().top)||0,W=Q?Q.scrollTop+J-U-150:0;return Q?void l(Q,W,200,G):void G()}var Y=F.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop,Z=N.getBoundingClientRect().top-D.getBoundingClientRect().top+D.scrollTop,$=200;if("left"===y){var ee=Z-(Y-k.scrollTop);ee<0&&B.current&&(B.current.style.height="".concat(Math.abs(ee),"px")),requestAnimationFrame(function(){var e,n=D.scrollHeight-D.clientHeight;if(ee<0)e=0;else{if(ee>n){var t=ee-n;return C.current&&(C.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(D,ee,$,G)})}e=ee}l(D,e,$,G)})}else{var ne=Y-(Z-D.scrollTop);ne<0&&T.current&&(T.current.style.height="".concat(Math.abs(ne),"px")),requestAnimationFrame(function(){var e,n=k.scrollHeight-k.clientHeight;if(ne<0)e=0;else{if(ne>n){var t=ne-n;return b.current&&(b.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(k,ne,$,G)})}e=ne}l(k,e,$,G)})}}else G()}))))},[U,L,s,H,c,d,ie]);return r(function(){var e,n=N.sectionIdx,t=N.isOrphan;if(M(),null!=n){var r="left";N.anchorEl&&(null===(e=v.current)||void 0===e?void 0:e.contains(N.anchorEl))&&(r="right"),le(n,t,{sourceSide:r})}},[le,N.isOrphan,N.sectionIdx,N.anchorEl,M]),{isSideBySide:H,setIsSideBySide:P,isArrowVisible:z,setIsArrowVisible:V,isResizing:k,setIsResizing:D,isSideBySideLoading:J,setIsSideBySideLoading:K,activeSideBySideSection:U,setActiveSideBySideSection:W,scrollLock:X,sideBySideCacheRef:Y,isSideBySideRef:Z,activeSideBySideSectionRef:$,activeSideBySideRightSectionRef:_,sideBySideLineRef:ee,highlightedClauseRefs:ne,clearClauseHighlight:te,applyAlignmentPadding:re,resetSideBySide:ie,activateSideBySide:le}};export{o as useSideBySide};
1
+ import{useState as e,useRef as n,useEffect as t,useCallback as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var c=function(c){var o=c.maintainRelativeOrder,d=c.proposedSections,s=c.existingSections,a=c.leftContainerRef,v=c.rightContainerRef,p=c.scrollContainerRef,f=c.sectionLeftRefs,g=c.sectionRightRefs,h=c.subSectionLeftRefs,S=c.subSectionRightRefs,R=c.lhsBadgeRefs,y=c.rhsBadgeRefs,m=c.sectionRowRefs,x=c.sectionRightRowRefs,B=c.rhsTopSpacerRef,C=c.rhsBottomSpacerRef,b=c.lhsTopSpacerRef,T=c.lhsBottomSpacerRef,I=c.calculateLinesRef,N=c.setConnectedSections,A=c.setConnectedLines,E=c.cachedConnectedPositions,w=c.closeMoreFunctionsPopup,L=c.setErrorToast,F=c.moreFunctions,H=c.closeSummaryPopup,q=e(!0),M=q[0],P=q[1],O=e(!1),z=O[0],V=O[1],j=e(!1),k=j[0],D=j[1],G=e(!1),J=G[0],K=G[1],Q=e(null),U=Q[0],W=Q[1],X=n(!1),Y=n(null),Z=n(!1),$=n(null),_=n(null),ee=n(null),ne=n(new Set),te=function(){ne.current.forEach(function(e){u(e)}),ne.current.clear()},re=function(e,n){var t,r,l,u,c,o,d;null!==e&&("string"==typeof e&&e.includes(i)?(d=(null===(t=h.current[e.split(i)[2]])||void 0===t?void 0:t.current)||(null===(r=f.current[Number(e.split(i)[2])])||void 0===r?void 0:r.current))&&(d.style.paddingTop="0px"):(d=null===(l=f.current[Number(e)])||void 0===l?void 0:l.current)&&(d.style.paddingTop="0px"));null!==n&&("string"==typeof n&&n.includes(i)?(d=(null===(u=S.current[n.split(i)[3]])||void 0===u?void 0:u.current)||(null===(c=g.current[Number(n.split(i)[3])])||void 0===c?void 0:c.current))&&(d.style.paddingTop="0px"):(d=null===(o=g.current[Number(n)])||void 0===o?void 0:o.current)&&(d.style.paddingTop="0px"))},ie=function(e,n,t){var r,l,u,c,o,d,s,a,v,p,B,C,b=null,T=null,I=null,N=null;if(e){var A=n.split(i),E="".concat(A[0]).concat(i).concat(A[1]);b=(null===(r=h.current[A[2]])||void 0===r?void 0:r.current)||(null===(l=f.current[Number(A[2])])||void 0===l?void 0:l.current)||null,T=(null===(u=S.current[A[3]])||void 0===u?void 0:u.current)||(null===(c=g.current[Number(A[3])])||void 0===c?void 0:c.current)||null,I=(null===(o=R.current[E])||void 0===o?void 0:o.current)||b,N=(null===(d=y.current[E])||void 0===d?void 0:d.current)||T}else{var w=Number(n),L=null!==t?Number(t):null!==_.current?Number(_.current):w;b=(null===(s=f.current[w])||void 0===s?void 0:s.current)||null,T=(null===(a=g.current[L])||void 0===a?void 0:a.current)||null,I=(null===(v=R.current[w])||void 0===v?void 0:v.current)||(null===(p=m.current[w])||void 0===p?void 0:p.current)||b,N=(null===(B=y.current[L])||void 0===B?void 0:B.current)||(null===(C=x.current[L])||void 0===C?void 0:C.current)||T}if(I&&N&&b&&T){b.style.paddingTop="0px",T.style.paddingTop="0px",I.offsetHeight;var F=I.getBoundingClientRect(),H=N.getBoundingClientRect(),q=Math.round(F.top-H.top);q>0?T.style.paddingTop="".concat(q,"px"):q<0&&(b.style.paddingTop="".concat(Math.abs(q),"px"))}};t(function(){Z.current=M},[M]),t(function(){$.current=U},[U]);var le=r(function(){te(),P(!1),Z.current=!1,Y.current=null,re($.current,_.current),W(null),$.current=null,_.current=null,V(!1),K(!1),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px"),T.current&&(T.current.style.height="0px")},[]),ue=r(function(e,n,t){var r,u,c=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,f=null==t?void 0:t.onReady,g=null!==(u=null==t?void 0:t.sourceSide)&&void 0!==u?u:"left";w(),null!=e&&(n?L("No counterpart exists for this section."):(te(),M&&U===e?c?le():null==f||f():(re($.current,_.current),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px"),T.current&&(T.current.style.height="0px"),a.current&&a.current.offsetHeight,N(new Set([e])),A([]),E.current=[],K(!0),X.current=!0,W(e),$.current=e,P(!0),Z.current=!0,V(!1),requestAnimationFrame(function(){var n,t,r,u,c,h="string"==typeof e&&e.includes(i),S=null,N=null,A=null;if(h){var E=e.split(i),w="".concat(E[0]).concat(i).concat(E[1]);S=(null===(n=R.current[w])||void 0===n?void 0:n.current)||null,N=(null===(t=y.current[w])||void 0===t?void 0:t.current)||null,A=N?e:null}else if(S=(null===(r=m.current[e])||void 0===r?void 0:r.current)||null,o){var L=d[e],F=(null==L?void 0:L.refIndexes)||[];if(F.length>0){var H=F[0],q=s.findIndex(function(e){return e.selfIndex===H});-1!==q&&(N=(null===(c=x.current[q])||void 0===c?void 0:c.current)||null,A=q)}}else N=(null===(u=x.current[e])||void 0===u?void 0:u.current)||null,A=N?e:null;_.current=A;var M=a.current,P=v.current,O=function(){ie(h,e,A),V(!0),I.current&&I.current(),X.current=!1,"right"===g&&P?P.dispatchEvent(new Event("scroll")):M&&M.dispatchEvent(new Event("scroll")),K(!1),null==f||f()};if(!S||!M)return X.current=!1,K(!1),void(null==f||f());if(N&&P){if(!o){var z=0;z="right"===g?N?N.getBoundingClientRect().top:0:S?S.getBoundingClientRect().top:0;var j=p.current,k=(null==j?void 0:j.getBoundingClientRect().top)||0,D=j?j.scrollTop+z-k-150:0;return j?void l(j,D,200,O):void O()}var G=S.getBoundingClientRect().top-M.getBoundingClientRect().top+M.scrollTop,J=N.getBoundingClientRect().top-P.getBoundingClientRect().top+P.scrollTop,Q=200;if("left"===g){var U=J-(G-M.scrollTop);U<0&&B.current&&(B.current.style.height="".concat(Math.abs(U),"px")),requestAnimationFrame(function(){var e,n=P.scrollHeight-P.clientHeight;if(U<0)e=0;else{if(U>n){var t=U-n;return C.current&&(C.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(P,U,Q,O)})}e=U}l(P,e,Q,O)})}else{var W=G-(J-P.scrollTop);W<0&&b.current&&(b.current.style.height="".concat(Math.abs(W),"px")),requestAnimationFrame(function(){var e,n=M.scrollHeight-M.clientHeight;if(W<0)e=0;else{if(W>n){var t=W-n;return T.current&&(T.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(M,W,Q,O)})}e=W}l(M,e,Q,O)})}}else O()}))))},[U,w,s,M,o,d,le]);return r(function(){var e,n=F.sectionIdx,t=F.isOrphan;if(H(),null!=n){var r="left";F.anchorEl&&(null===(e=v.current)||void 0===e?void 0:e.contains(F.anchorEl))&&(r="right"),ue(n,t,{sourceSide:r})}},[ue,F.isOrphan,F.sectionIdx,F.anchorEl,H]),{isSideBySide:M,setIsSideBySide:P,isArrowVisible:z,setIsArrowVisible:V,isResizing:k,setIsResizing:D,isSideBySideLoading:J,setIsSideBySideLoading:K,activeSideBySideSection:U,setActiveSideBySideSection:W,scrollLock:X,sideBySideCacheRef:Y,isSideBySideRef:Z,activeSideBySideSectionRef:$,activeSideBySideRightSectionRef:_,sideBySideLineRef:ee,highlightedClauseRefs:ne,clearClauseHighlight:te,applyAlignmentPadding:ie,resetSideBySide:le,activateSideBySide:ue}};export{c as useSideBySide};
2
2
  //# sourceMappingURL=useSideBySide.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+CAiLzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+CAoLzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSideBySide.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useSideBySide.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,aAAa,mfAavB,GAAG;;;;;;;;;;;;;sBAUgD,MAAM;0BAAoB,MAAM;iBAAW,MAAM;oBAAc,MAAM;cAAQ,MAAM;;;;;;;;mCAe/F,OAAO,OAAO,GAAG,kBAAkB,GAAG;;8BAwI/D,MAAM,GAAG,MAAM,YACV,OAAO;;yBACmC,IAAI;;;CA0PnE,CAAA"}
1
+ {"version":3,"file":"useSideBySide.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useSideBySide.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,aAAa,mfAavB,GAAG;;;;;;;;;;;;;sBASgD,MAAM;0BAAoB,MAAM;iBAAW,MAAM;oBAAc,MAAM;cAAQ,MAAM;;;;;;;;mCAuC/F,OAAO,OAAO,GAAG,kBAAkB,GAAG;;8BAiF/D,MAAM,GAAG,MAAM,YACV,OAAO;;yBACmC,IAAI;;;CAyPnE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.142",
3
+ "version": "0.0.143",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",