@e-llm-studio/requirement-ai 0.0.362 → 0.0.363
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/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +1 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +1 -0
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +1 -0
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.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("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),a=require("./pdfCitationUtils.js"),r=require("../RequirementAIWrapper/RequirementAIWrapper.js"),o=require("./pdfCitation.module.css.js"),l=require("./CitationPdfViewer.js");exports.default=function({citation:n,isCitationLoading:d=!1,renderMode:s,pdfViewHeaderAction:u,citationId:c}){var g,f,h,p,m;const{queryClient:v,useGetSignedUrlQuery:x,useGetSignedUrlMutation:w}=r.useRequirementAI().apiCachingConfig,[C,U]=i.useState(!1),V=null==n?void 0:n.customMetadata,_=null!==(g=null==V?void 0:V.value)&&void 0!==g?g:[],j=null!==(f=null==V?void 0:V.artifact_url)&&void 0!==f?f:"",q=null!==(h=null==V?void 0:V.artifact_title)&&void 0!==h?h:"",y=null!==(p=null==V?void 0:V.artifact_format)&&void 0!==p?p:"pdf",P=_.flatMap(e=>e.highlighted_text.map(e=>e.text)),A="docx"===y,S=["getSignedUrl",j],{data:I}=x(j,S),{mutate:M,isPending:N}=w(j),H=null!=I?I:"",D=!!j&&N&&!H;return j||console.warn("Artifact preview details not found in header message or message data",j),i.useEffect(()=>{if(!j)return void U(!0);const e=v.getQueryData(S);e||N||M({gsUtilPath:j}),e&&U(!1)},[j,v,S,N,M]),i.useEffect(()=>{H&&U(!1)},[H]),null!==(m=(()=>{try{const i=a.mapToHighlightAreas(_),r=i.length>0;if(D||d)return e.jsx("div",{className:o.default.loaderContainer,children:e.jsx(t.Loader2,{className:o.default.loaderIcon,size:28})});const n=_.some(e=>!!e.gs_url),g=_.some(e=>null!==e.page_no&&void 0!==e.page_no),f=_.some(e=>Array.isArray(e.highlighted_coordinates)&&e.highlighted_coordinates.length>0),h=i.length>0;return!(n||g||f||h)&&console.warn("No valid coordinates or gs_url found for this citation.",{hasValidGsUrl:n,hasValidPageNo:g,hasHighlightedCoords:f,hasCoordinatesPages:h,pages:_,artifactUrl:j}),(r||!g||C)&&(C||!r)?(console.warn("Error in loading PDF or no valid highlight coordinates found. Rendering fallback viewer without highlights.",{artifactUrl:j,hasValidCoordinates:r,coordinatesPages:i,pages:_}),e.jsx(l.default,{artifactUrl:j,pdfUrl:"",pdfName:q,pages:_,coordinatesPages:[],pdfViewHeaderAction:u,renderMode:null!=s?s:"fallback",isDocx:A,hasValidCoordinates:!1,customStyles:a.citationViewerStyles,highlightText:P,citationId:c})):e.jsx(l.default,{artifactUrl:j,pdfUrl:H,pdfName:q,pages:_,coordinatesPages:i,pdfViewHeaderAction:u,renderMode:null!=s?s:"default",isDocx:A,hasValidCoordinates:r,jumpToPageValue:1,customStyles:a.citationViewerStyles,highlightText:P,citationId:c})}catch(e){return console.warn("Error rendering citation",e),null}})())&&void 0!==m?m:null};
|
|
2
|
+
//# sourceMappingURL=CitationPdfRendererWrapper.js.map
|
package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfRendererWrapper.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("@e-llm-studio/citation"),a=require("./pdfCitationUtils.js");const o={pdfViewer:{height:"50%",maxHeight:"50%",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}},l={pdfViewerWrapper:"shadow-sm"},r=()=>e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx(i.Loader2,{className:"animate-spin text-purple-500",size:28})});exports.default=({artifactUrl:i,pdfUrl:s,pdfName:n,pages:d,coordinatesPages:c,activeCitationIndex:u,onActiveCitationChange:h,pdfViewHeaderAction:f,isLoading:p,hasValidCoordinates:g,renderMode:x="default",useCoordinates:m=!0,jumpToPageValue:C,customStyles:b,customClasses:v,isDocx:j=!1,highlightText:k,citationId:P})=>{if(p)return e.jsx(r,{});const w=j||"fallback"===x?"":s,A="fallback"===x||!1===g?[]:c,V="fallback"!==x&&m,N=a.stringToNumber(P),y=f?{icon:f.icon,tooltip:f.tooltip,onClick:()=>{f.onClick({artifactUrl:i,artifactId:i,fileName:null!=n?n:"",pages:d,currentCitationIndex:null!=N?N:0})}}:void 0;return e.jsx(t.PdfViewer,{pdfUrl:w,pdfName:n,fallbackPages:d,highlightCordinatePages:A,highlightText:null!=k?k:[],highlightPages:{},useCoordinates:V,activeCitationIndex:u,headerAction:y,onActiveCitationChange:h,highlightColor:"oklch(0.78 0.16 95 / 0.35)",activeHighlightColor:"oklch(0.75 0.17 95 / 0.45)",jumpToPageValue:C,customStyles:null!=b?b:o,customClasses:null!=v?v:l})};
|
|
2
|
+
//# sourceMappingURL=CitationPdfViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfViewer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.citationViewerStyles={pdfViewer:{height:"550px",maxHeight:"550px",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}},exports.mapToHighlightAreas=(e=[])=>Array.isArray(e)?null==e?void 0:e.flatMap(e=>{var r,i;const o=null==e?void 0:e.page_no;return!(null===(r=null==e?void 0:e.highlighted_coordinates)||void 0===r?void 0:r.length)&&o?[{pageNumber:o,pageIndex:o-1}]:o&&(null===(i=null==e?void 0:e.highlighted_coordinates)||void 0===i?void 0:i.length)?e.highlighted_coordinates.map(e=>({pageIndex:o-1,pageNumber:o,left:100*e.xmin,top:100*e.ymin,width:100*(e.xmax-e.xmin),height:100*(e.ymax-e.ymin)})):[]}):[],exports.stringToNumber=function(e,r=0){if("number"==typeof e)return Number.isFinite(e)?e:r;if(!e||"string"!=typeof e||!e.trim())return r;let i="";try{i=e.trim().replace(/[^\d.-]/g,"").replace(/(?!^)-/g,"")}catch(e){return console.error("Regex processing failed",e),r}const o=Number(i);return Number.isFinite(o)?o:r};
|
|
2
|
+
//# sourceMappingURL=pdfCitationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfCitationUtils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("react-markdown"),i=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),o=require("../../shared/useMarkdownSearch.js"),r=require("lucide-react"),d=require("@mui/material"),a=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),p=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),y=require("./components/InlineUpdatedComponent.js"),j=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),I=require("./components/InlineManualComponent.js"),b=require("./components/HighlightButtonComponent.js"),w=require("../../../../utils/tagHelper.js"),R=require("../common/TableWrapper.js");function $(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=$(n),k=$(t),A=$(i),q=$(a);const L=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:t,isHighConfidence:i,customStyle:o,customIcons:r})=>{var d;const{expandedInfo:a,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(t.id);u&&c.current.set(g,u);const v=(null===(d=null==a?void 0:a.aiReason)||void 0===d?void 0:d.id)===t.id,m=i?(null==r?void 0:r.highConfidence)||e.jsx(h.default,{}):(null==r?void 0:r.lowConfidence)||e.jsx(p.default,{});return e.jsxs("button",{className:l.default.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:t)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]})},_=({children:t,node:i,customStyles:o,customIcons:r})=>{var d,a;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,h=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:h?{cssText:h}:void 0,children:t}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:l.default.tableExpandedCell,children:e.jsx("div",{className:l.default.tableExpandedCellInner,children:e.jsx("div",{className:l.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const U=["del","ins"];function H(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,t)=>`@@CODE_SPAN_${n.push(t)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,t)=>{var i;const l=null!==(i=n[Number(t)])&&void 0!==i?i:"";return`<code>${o=l,o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var o})}function P(e){return function(e,n,t){const i=n.join("|");return e.replace(new RegExp(`<(${i})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,i)=>`<${n}>${t(i)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:H(e)).join(""))}function D(e){let n=e.trim();n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const t=[];let i="",l=!1;for(const e of n)l?(i+=e,l=!1):"\\"!==e?"|"!==e?i+=e:(t.push(i.trim()),i=""):(i+=e,l=!0);return t.push(i.trim()),t}function F(e){return e.trim().includes("|")&&D(e).length>1}function O(e){const n=D(e);return n.length>1&&n.every(e=>/^:?-{3,}:?$/.test(e.replace(/\s+/g,"")))}function W(e){if(!e)return;const n=e.replace(/\s+/g,"");return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":"left"}function B(e,n){return Array.from({length:n},(n,t)=>{var i;return null!==(i=e[t])&&void 0!==i?i:""})}function V(e,n,t){return`<${e}${function(e){return e?` align="${e}"`:""}(t)}>${H(n)}</${e}>`}function z(e,n,t){const i=Math.max(e.length,n.length,...t.map(e=>e.length)),l=B(e,i),o=B(n,i).map(W);return`\n\n<table>${`<thead><tr>${l.map((e,n)=>V("th",e,o[n])).join("")}</tr></thead>`}${t.length?`<tbody>${t.map(e=>`<tr>${B(e,i).map((e,n)=>V("td",e,o[n])).join("")}</tr>`).join("")}</tbody>`:""}</table>\n\n`}const G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Q(e,n){const t=[],i=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,o;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!N.default.isValidElement(e))return e;const r="string"==typeof e.type?e.type.toLowerCase():"";if(i.has(r))return t.push(e),null;if(G.has(r))return e;const d=null===(o=N.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===o?void 0:o.flat().filter(e=>null!=e);return d&&0!==d.length?N.default.cloneElement(e,void 0,d):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:t}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:t,noMarkdownContent:i,useMarkdown:a=!0,isParent:h,scenario:p,showUserStoryDiff:x=!1,aiReasoningsForBlock:$,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:H,lowConfidenceIcon:W,customStyles:B,customIcons:V,contextVariant:G,aiReasoningDiffView:J,userStoryCitations:K,artifactId:X,isCraflow:Y,onCraAccept:Z,onCraReject:ee,onCitationLinkClick:ne,craFlowConfig:te,isDisplayHighlightControl:ie=!1,showConfidenceScore:le=!0,CDNeededInChip:oe,blockId:re,storyId:de,showWaitingIconInChip:ae,menuActions:se})=>{var ce;console.log("userstorywithcitation blockid ",re,se);const ue=n.useRef(null),{userStory:ge,inlineUpdateComponentConfig:he,getAvgScoreForStory:pe,setUserStory:ve,aiReasoning:me,setAiReasoning:fe,customIcons:Ce,searchQueryList:xe,searchQueryReasoningIdList:ye,currentHighlightIndex:je,segmentComponentConfig:Se,inlineManualComponentConfig:Ie,diffEditConfig:be,customSectionConfig:we}=g.useRequirementAI(),Re=null!=V?V:null==Ce?void 0:Ce.userStoryIcons;null==B||B.searchHighlight;const{search:$e,clear:Ne}=o.useMarkdownSearch(ue),[ke,Ae]=n.useState("1"),[qe,Le]=n.useState(null),Ee=n.useRef(new Map),[Me,Te]=n.useState(new Set),_e=n.useCallback((e,n)=>{Le(e&&n?{rowId:e,aiReason:n}:null)},[]),Ue=X?pe(X):0,[He,Pe]=n.useState([]),De=n.useCallback(e=>{Te(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})},[]),Fe=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Fe).join(""):N.default.isValidElement(e)?Fe(e.props.children):"",Oe=e=>{let n=function(e){const n=e.split("\n"),t=[];let i=!1;for(let e=0;e<n.length;e++){const l=n[e];if(/^\s*(```|~~~)/.test(l)){i=!i,t.push(l);continue}const o=n[e+1];if(!i&&void 0!==o&&F(l)&&O(o)){const i=D(l),r=D(o),d=[];for(e+=2;e<n.length&&F(n[e])&&!O(n[e]);)d.push(D(n[e])),e++;e--,t.push(z(i,r,d));continue}t.push(l)}return t.join("\n")}(function(e){return e.replace(/\\r\\n|\\n|\\r/g,"\n")}(e));return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,t)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(t.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,t,i,l)=>{const o=i.match(/<table[\s\S]*?<\/table>/i);if(o){return`<segment${t} data-table="${btoa(encodeURIComponent(o[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,t)=>{if(/<table[\s>]/i.test(t)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(t))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,t,i,l)=>{const o=n.substring(0,l),r=o.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(o.substring(r+1))||/^\s+\d+\.\s/.test(o.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(o.substring(r+1));if(d||a){let e=i;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${t}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,t=[];let i;const l=new RegExp(n.source,n.flags);for(;null!==(i=l.exec(e));){const e=i[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),l=e.match(/<changed>([\s\S]*?)<\/changed>/i),o=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;t.push({index:i.index,endIndex:i.index+i[0].length,deletedItemCount:o((null==n?void 0:n[1])||""),changedItemCount:o((null==l?void 0:l[1])||"")})}if(0===t.length)return e;let o=e;for(let e=t.length-1;e>=0;e--){const n=t[e],i=n.changedItemCount-n.deletedItemCount;if(0===i)continue;const l=o.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of l){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<t.length?t[e+1].index:o.length;let s=o.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,t)=>`${n}${parseInt(t,10)+i}. `),o=o.substring(0,d)+s+o.substring(a)}return o}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:t!==n}),`<deleted>${t}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:t!==n,preview:n.substring(0,120)}),`<changed>${t}</changed>`}),n}(n),n=P(n),n},We=n.useMemo(()=>t?Oe(t):t,[t]);n.useEffect(()=>{Pe($||me)},[$,me]);const Be=n.useMemo(()=>{const t=Boolean(null==we?void 0:we.negateList),i=(e,n)=>{let t=0;return N.default.Children.map(e,e=>{if(!N.default.isValidElement(e))return e;const i=n(t);return t+=1,N.default.cloneElement(e,{"data-list-marker":i})})};return{span:({node:n,children:t,...i})=>{var l,o,r,d,a;const s=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==o?o:null==i?void 0:i["highlight-id"],c="string"==typeof s&&Me.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==i?void 0:i["highlight-color"];return e.jsx("span",{style:{...null!==(a=null==B?void 0:B.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:t})},button:({node:n,children:t,...i})=>{var l,o,r,d,a,s;const c=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l.action)&&void 0!==o?o:null==i?void 0:i.action,u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-id"])&&void 0!==d?d:null==i?void 0:i["highlight-id"],g=null!==(s=null===(a=null==n?void 0:n.properties)||void 0===a?void 0:a["highlight-type"])&&void 0!==s?s:null==i?void 0:i["highlight-type"];return"highlight"===c?e.jsx(b.default,{highlightId:u,handleHighlightSpan:De,icon:"web"===g?null==Re?void 0:Re.webCitationIcon:"doc"===g?null==Re?void 0:Re.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==B?void 0:B.webButton:"doc"===g?null==B?void 0:B.docButton:{}}):null},upt:({node:n,children:t,...i})=>{var l,o;const r=null==i?void 0:i.id,d=r?null===(o=null===(l=r.split("$"))||void 0===l?void 0:l[1])||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"):null,a=me.find(e=>e.id.toString()===d);if(!a)return t||e.jsx(e.Fragment,{});const s="data-main"in i,c=i["data-status"];return e.jsx(e.Fragment,{children:e.jsx(y.default,{aiReason:a,customStyles:null==B?void 0:B.inlineUpdatedComponent,handleClickCognitiveDecision:null==he?void 0:he.handleClickCognitiveDecision,handleClickUpdatedPill:null==he?void 0:he.handleClickUpdatedPill,handleClickOutputValue:null==he?void 0:he.handleClickOutputValue,customIcons:null==he?void 0:he.customIcons,CDNeededInChip:oe,showWaitingIconInChip:ae,showChip:s,status:c,containerRef:ue,children:t||e.jsx(e.Fragment,{})})})},del:({node:n,children:t,...i})=>{var o;const{cleanedChildren:r,extractedNodes:d}=Q(t,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.deleted,style:null!==(o=null==B?void 0:B.deleted)&&void 0!==o?o:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:r}),d]})},ins:({children:n,...t})=>{var i;const{cleanedChildren:o,extractedNodes:r}=Q(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.inserted,style:null!==(i=null==B?void 0:B.inserted)&&void 0!==i?i:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:o}),r]})},preserved:({children:n,...t})=>e.jsx("span",{className:l.default.preserved,style:null==B?void 0:B.preserved,...t,children:n}),manual:({children:n,...t})=>{var i;const l=null===(i=null==t?void 0:t.id)||void 0===i?void 0:i.replaceAll("@","<").replaceAll("#",">"),o=me.find(e=>e.id.toString()===l),r=t["data-status"];return o?e.jsx(I.default,{aiReason:o,handleClick:null==Ie?void 0:Ie.handleClick,status:r,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...t})=>e.jsx(e.Fragment,{}),h1:({node:n,...t})=>e.jsx("h1",{className:l.default.heading1,style:null==B?void 0:B.heading1,children:t.children}),h2:({node:n,...t})=>e.jsx("h2",{className:l.default.heading2,style:null==B?void 0:B.heading2,children:t.children}),h3:({node:n,...t})=>e.jsx("h3",{className:l.default.heading3,style:null==B?void 0:B.heading3,children:t.children}),b:({node:n,...t})=>e.jsx("b",{className:l.default.bold,style:null==B?void 0:B.bold,children:null==t?void 0:t.children}),p:({node:n,...t})=>e.jsx("p",{...t,className:l.default.paragraph,style:null==B?void 0:B.paragraph,children:t.children}),updated:({node:n,...t})=>e.jsx(s.default,{...t,showUserStoryDiff:x,currentUpdatedTagId:ke,setCurrentUpdatedTagId:Ae,userStory:ge,setUserStory:ve,setAiReasoning:fe,node:n,isCraflow:Y,onCraAccept:Z,onCraReject:ee,diffEditConfig:be,customStyles:null==B?void 0:B.updatedContent,craFlowConfig:te}),ol:({node:n,...o})=>{var r,d,a;const s=null!==(a=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.start)&&void 0!==d?d:null==o?void 0:o.start)&&void 0!==a?a:void 0,c=Number(null!=s?s:1);return t?e.jsx("div",{role:"list",className:l.default.negatedOrderedList,style:null==B?void 0:B.olist,children:i(o.children,e=>`${c+e}.`)}):e.jsx("ol",{className:l.default.orderedList,style:null==B?void 0:B.olist,...s?{start:Number(s)}:{},children:null==o?void 0:o.children})},ul:({node:n,...o})=>t?e.jsx("div",{role:"list",className:l.default.negatedUnorderedList,style:null==B?void 0:B.ulist,children:i(o.children,()=>"•")}):e.jsx("ul",{className:l.default.unorderedList,style:null==B?void 0:B.ulist,children:null==o?void 0:o.children}),li:({node:n,...i})=>{if(t){const n=i["data-list-marker"],{children:t,"data-list-marker":o,...r}=i;return e.jsxs("div",{...r,role:"listitem",className:`${l.default.paragraph} ${l.default.negatedListItem}`,style:null==B?void 0:B.paragraph,children:[n&&e.jsxs("span",{className:l.default.negatedListMarker,children:[n," "]}),t]})}return e.jsx("li",{children:null==i?void 0:i.children})},table:({children:n})=>e.jsx(R.default,{menuConfig:null==se?void 0:se.table,menuStyles:null==B?void 0:B.tableMenu,tableStyle:null==B?void 0:B.table,blockId:re,storyId:de,children:n}),tr:({node:n,children:t})=>e.jsx(_,{node:n,children:t,customStyles:B}),td:({node:n,children:t})=>{var i;const{style:l,...o}=null!==(i=null==n?void 0:n.properties)&&void 0!==i?i:{};return e.jsx(L.Provider,{value:!0,children:e.jsx("td",{...o,style:l?{cssText:l}:void 0,children:t})})},th:({node:n,children:t})=>{var i;const{style:l,...o}=null!==(i=null==n?void 0:n.properties)&&void 0!==i?i:{};return e.jsx(L.Provider,{value:!0,children:e.jsx("th",{...o,style:l?{cssText:l}:void 0,children:t})})},recommendation:({node:n,...t})=>{var i;const l=`The AI has selected this content based on: ${(null===(i=null==t?void 0:t.children)||void 0===i?void 0:i[0])||""}`;return e.jsx(f.default,{...t,customStyles:null==B?void 0:B.recommendationBlock,label:l})},a:({inline:t,children:i,node:o,...r})=>{var d;const a=n.useContext(L)||"true"===(null==r?void 0:r.table),s=`${null==r?void 0:r.href}`,[c,u]=s.split("$"),g=null==u?void 0:u.split("?")[0];if("ai_reasoning"===c){const n=(null!==(d=x?J:me)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(g)),t=ye.includes(g);if(n){if(a)return e.jsx(T,{aiReason:n,customStyle:null==B?void 0:B.tableAiReasoning,customIcons:Re,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const l=Fe(i),o="source"!==l.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:t,inlineLabel:l,isInlineCitation:o,customIcons:Re,customStyles:{aiReasoningContent:null==B?void 0:B.aiReasoningContent,aiReasoningAccordion:null==B?void 0:B.aiReasoningAccordion,aiReasoningMarkdown:null==B?void 0:B.aiReasoningMarkdown,aiReasoningPill:null==B?void 0:B.aiReasoningPill,webCitation:null==B?void 0:B.webCitation,stormeeCitation:null==B?void 0:B.stormeeCitation,waveformCitation:null==B?void 0:B.waveformCitation,imageCitation:null==B?void 0:B.imageCitation,fileCitation:null==B?void 0:B.fileCitation,appModCitation:null==B?void 0:B.appModCitation,rcaCitation:null==B?void 0:B.rcaCitation,readFileCitation:null==B?void 0:B.readFileCitation,loadingCitations:null==B?void 0:B.loadingCitations,chatCitation:null==B?void 0:B.chatCitation,bigEnoughCitation:null==B?void 0:B.bigEnoughCitation}})}}return ne?e.jsx("button",{className:l.default.citationLink,style:null==B?void 0:B.citationLink,onClick:()=>ne((null==r?void 0:r.href)||""),children:i}):null},code:({inline:n,children:t,className:i,node:o,...r})=>/language-(\w+)/.exec(i||"")||(null==i?void 0:i.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:l.default.blockCode,style:null==B?void 0:B.code,children:t})}):e.jsx("code",{className:l.default.inlineCode,style:null==B?void 0:B.code,children:t}),learned:({children:n})=>e.jsx(d.Tooltip,{title:n,placement:"top",children:e.jsx(r.Info,{size:16,className:l.default.learned})}),generatedcode:({node:n,...t})=>{const i=(null==t?void 0:t.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const t=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(t).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?t(e.props.children):""};n=t(e.children)}}catch(t){console.error("Error decoding generated code:",t),n=String(e.children)}return n})(t);return e.jsx(c.default,{title:"Generated Code",code:l,language:i,customStyles:{pill:null==B?void 0:B.generatedCodePill,content:null==B?void 0:B.generatedCodeContent}})},updatedsegment:({node:n,children:t,...i})=>{var l,o,r,d;const a=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(i),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:q.default.sanitize(s)}}):e.jsx("div",{children:t});return e.jsx(j.default,{id:a,node:n,children:c,props:i,segmentComponentConfig:Se,customStyles:B,customIcons:V,extractText:Fe,isUpdatedSegment:!0})},segment:({node:n,children:t,...i})=>{var l,o,r,d;const a=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e.jsx(j.default,{id:a,node:n,children:t,props:i,segmentComponentConfig:Se,customStyles:B,customIcons:V,extractText:Fe,blockId:re,storyId:de})}}},[He,te,me,K,ke,x,t,V,xe,ye,B,Se,Me,De,re,de,null==we?void 0:we.negateList,ne]),Ve=n.useMemo(()=>{let e=w.escapeTagIds(We,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=w.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[We]);return n.useEffect(()=>{if(!ue.current)return;if(!xe.length)return void Ne();const e=ue.current,n=Math.min(je,xe.length-1);let t;const i=()=>{requestAnimationFrame(()=>{$e([xe[n].replace(/\*/g,"")])})};i();const l=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{e.querySelector(`.${o.HIGHLIGHT_CLASS}`)||i()},50)});return l.observe(e,{childList:!0,subtree:!0}),()=>{l.disconnect(),clearTimeout(t)}},[xe,ye,je,ie]),e.jsx(E.Provider,{value:{expandedInfo:qe,setExpanded:_e,reasonToRow:Ee},children:e.jsxs("div",{ref:ue,className:`${l.default.container} ${"approving"!==p?l.default.wrapper:""} ${U||""}`,style:null==B?void 0:B.container,children:[a?e.jsx(S.MarkdownContextProvider,{children:e.jsx(k.default,{components:Be,rehypePlugins:[A.default],children:Ve})}):i,Ue>0&&le&&e.jsx("div",{className:l.default.confidenceScoreContainer,style:null==B?void 0:B.confidenceScoreContainer,children:e.jsxs("span",{className:l.default.confidenceScore,style:null==B?void 0:B.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==B?void 0:B.confidenceScoreIconColor)||"#166534"}),Ue,"%"]})}),M&&e.jsx("div",{className:l.default.citationLoader,style:null==B?void 0:B.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==B?void 0:B.citationLoadingContainer,icon:null==B?void 0:B.citationLoadingIcon,text:null==B?void 0:B.citationLoadingText}})}),h&&e.jsx("div",{style:{...null===(ce=null==B?void 0:B.attachedContext)||void 0===ce?void 0:ce.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==B?void 0:B.attachedContext,variant:G})})]})})},exports.splitNestedDiffNodes=Q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("react-markdown"),i=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),o=require("../../shared/useMarkdownSearch.js"),r=require("lucide-react"),d=require("@mui/material"),a=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),p=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),I=require("./components/InlineManualComponent.js"),b=require("./components/HighlightButtonComponent.js"),w=require("../../../../utils/tagHelper.js"),R=require("../common/TableWrapper.js");function $(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=$(n),k=$(t),A=$(i),q=$(a);const L=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:t,isHighConfidence:i,customStyle:o,customIcons:r})=>{var d;const{expandedInfo:a,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(t.id);u&&c.current.set(g,u);const v=(null===(d=null==a?void 0:a.aiReason)||void 0===d?void 0:d.id)===t.id,m=i?(null==r?void 0:r.highConfidence)||e.jsx(h.default,{}):(null==r?void 0:r.lowConfidence)||e.jsx(p.default,{});return e.jsxs("button",{className:l.default.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:t)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]})},_=({children:t,node:i,customStyles:o,customIcons:r})=>{var d,a;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,h=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:h?{cssText:h}:void 0,children:t}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:l.default.tableExpandedCell,children:e.jsx("div",{className:l.default.tableExpandedCellInner,children:e.jsx("div",{className:l.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const U=["del","ins"];function H(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,t)=>`@@CODE_SPAN_${n.push(t)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,t)=>{var i;const l=null!==(i=n[Number(t)])&&void 0!==i?i:"";return`<code>${o=l,o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var o})}function P(e){return function(e,n,t){const i=n.join("|");return e.replace(new RegExp(`<(${i})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,i)=>`<${n}>${t(i)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:H(e)).join(""))}function D(e){let n=e.trim();n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const t=[];let i="",l=!1;for(const e of n)l?(i+=e,l=!1):"\\"!==e?"|"!==e?i+=e:(t.push(i.trim()),i=""):(i+=e,l=!0);return t.push(i.trim()),t}function F(e){return e.trim().includes("|")&&D(e).length>1}function O(e){const n=D(e);return n.length>1&&n.every(e=>/^:?-{3,}:?$/.test(e.replace(/\s+/g,"")))}function W(e){if(!e)return;const n=e.replace(/\s+/g,"");return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":"left"}function B(e,n){return Array.from({length:n},(n,t)=>{var i;return null!==(i=e[t])&&void 0!==i?i:""})}function V(e,n,t){return`<${e}${function(e){return e?` align="${e}"`:""}(t)}>${H(n)}</${e}>`}function z(e,n,t){const i=Math.max(e.length,n.length,...t.map(e=>e.length)),l=B(e,i),o=B(n,i).map(W);return`\n\n<table>${`<thead><tr>${l.map((e,n)=>V("th",e,o[n])).join("")}</tr></thead>`}${t.length?`<tbody>${t.map(e=>`<tr>${B(e,i).map((e,n)=>V("td",e,o[n])).join("")}</tr>`).join("")}</tbody>`:""}</table>\n\n`}function G(e){const n=e.split("\n"),t=[];let i=!1;for(let e=0;e<n.length;e++){const l=n[e];if(/^\s*(```|~~~)/.test(l)){i=!i,t.push(l);continue}const o=n[e+1];if(!i&&void 0!==o&&F(l)&&O(o)){const i=D(l),r=D(o),d=[];for(e+=2;e<n.length&&F(n[e])&&!O(n[e]);)d.push(D(n[e])),e++;e--,t.push(z(i,r,d));continue}t.push(l)}return t.join("\n")}function Q(e){return e.split(/(<segment\b[^>]*>[\s\S]*?<\/segment>)/gi).map((e,n)=>n%2==1?e:G(e)).join("")}const J=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function K(e,n){const t=[],i=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,o;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!N.default.isValidElement(e))return e;const r="string"==typeof e.type?e.type.toLowerCase():"";if(i.has(r))return t.push(e),null;if(J.has(r))return e;const d=null===(o=N.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===o?void 0:o.flat().filter(e=>null!=e);return d&&0!==d.length?N.default.cloneElement(e,void 0,d):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:t}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.convertMarkdownTablesOutsideSegments=Q,exports.default=({message:t,noMarkdownContent:i,useMarkdown:a=!0,isParent:h,scenario:p,showUserStoryDiff:x=!1,aiReasoningsForBlock:$,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:H,lowConfidenceIcon:D,customStyles:F,customIcons:O,contextVariant:W,aiReasoningDiffView:B,userStoryCitations:V,artifactId:z,isCraflow:J,onCraAccept:X,onCraReject:Y,onCitationLinkClick:Z,craFlowConfig:ee,isDisplayHighlightControl:ne=!1,showConfidenceScore:te=!0,CDNeededInChip:ie,blockId:le,storyId:oe,showWaitingIconInChip:re,menuActions:de})=>{var ae;console.log("userstorywithcitation blockid ",le,de);const se=n.useRef(null),{userStory:ce,inlineUpdateComponentConfig:ue,getAvgScoreForStory:ge,setUserStory:he,aiReasoning:pe,setAiReasoning:ve,customIcons:me,searchQueryList:fe,searchQueryReasoningIdList:Ce,currentHighlightIndex:xe,segmentComponentConfig:je,inlineManualComponentConfig:ye,diffEditConfig:Se,customSectionConfig:Ie}=g.useRequirementAI(),be=null!=O?O:null==me?void 0:me.userStoryIcons;null==F||F.searchHighlight;const{search:we,clear:Re}=o.useMarkdownSearch(se),[$e,Ne]=n.useState("1"),[ke,Ae]=n.useState(null),qe=n.useRef(new Map),[Le,Ee]=n.useState(new Set),Me=n.useCallback((e,n)=>{Ae(e&&n?{rowId:e,aiReason:n}:null)},[]),Te=z?ge(z):0,[_e,Ue]=n.useState([]),He=n.useCallback(e=>{Ee(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})},[]),Pe=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Pe).join(""):N.default.isValidElement(e)?Pe(e.props.children):"",De=e=>{let n=Q(function(e){return e.replace(/\\r\\n|\\n|\\r/g,"\n")}(e));return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,t)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(t.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,t,i,l)=>{const o=G(i.trim()).match(/<table[\s\S]*?<\/table>/i);if(o){return`<segment${t} data-table="${btoa(encodeURIComponent(o[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,t)=>{if(/<table[\s>]/i.test(t)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(t))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,t,i,l)=>{const o=n.substring(0,l),r=o.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(o.substring(r+1))||/^\s+\d+\.\s/.test(o.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(o.substring(r+1));if(d||a){let e=i;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${t}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,t=[];let i;const l=new RegExp(n.source,n.flags);for(;null!==(i=l.exec(e));){const e=i[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),l=e.match(/<changed>([\s\S]*?)<\/changed>/i),o=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;t.push({index:i.index,endIndex:i.index+i[0].length,deletedItemCount:o((null==n?void 0:n[1])||""),changedItemCount:o((null==l?void 0:l[1])||"")})}if(0===t.length)return e;let o=e;for(let e=t.length-1;e>=0;e--){const n=t[e],i=n.changedItemCount-n.deletedItemCount;if(0===i)continue;const l=o.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of l){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<t.length?t[e+1].index:o.length;let s=o.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,t)=>`${n}${parseInt(t,10)+i}. `),o=o.substring(0,d)+s+o.substring(a)}return o}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:t!==n}),`<deleted>${t}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:t!==n,preview:n.substring(0,120)}),`<changed>${t}</changed>`}),n}(n),n=P(n),n},Fe=n.useMemo(()=>t?De(t):t,[t]);n.useEffect(()=>{Ue($||pe)},[$,pe]);const Oe=n.useMemo(()=>{const t=Boolean(null==Ie?void 0:Ie.negateList),i=(e,n)=>{let t=0;return N.default.Children.map(e,e=>{if(!N.default.isValidElement(e))return e;const i=n(t);return t+=1,N.default.cloneElement(e,{"data-list-marker":i})})};return{span:({node:n,children:t,...i})=>{var l,o,r,d,a;const s=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==o?o:null==i?void 0:i["highlight-id"],c="string"==typeof s&&Le.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==i?void 0:i["highlight-color"];return e.jsx("span",{style:{...null!==(a=null==F?void 0:F.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:t})},button:({node:n,children:t,...i})=>{var l,o,r,d,a,s;const c=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l.action)&&void 0!==o?o:null==i?void 0:i.action,u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-id"])&&void 0!==d?d:null==i?void 0:i["highlight-id"],g=null!==(s=null===(a=null==n?void 0:n.properties)||void 0===a?void 0:a["highlight-type"])&&void 0!==s?s:null==i?void 0:i["highlight-type"];return"highlight"===c?e.jsx(b.default,{highlightId:u,handleHighlightSpan:He,icon:"web"===g?null==be?void 0:be.webCitationIcon:"doc"===g?null==be?void 0:be.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==F?void 0:F.webButton:"doc"===g?null==F?void 0:F.docButton:{}}):null},upt:({node:n,children:t,...i})=>{var l,o;const r=null==i?void 0:i.id,d=r?null===(o=null===(l=r.split("$"))||void 0===l?void 0:l[1])||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"):null,a=pe.find(e=>e.id.toString()===d);if(!a)return t||e.jsx(e.Fragment,{});const s="data-main"in i,c=i["data-status"];return e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:a,customStyles:null==F?void 0:F.inlineUpdatedComponent,handleClickCognitiveDecision:null==ue?void 0:ue.handleClickCognitiveDecision,handleClickUpdatedPill:null==ue?void 0:ue.handleClickUpdatedPill,handleClickOutputValue:null==ue?void 0:ue.handleClickOutputValue,customIcons:null==ue?void 0:ue.customIcons,CDNeededInChip:ie,showWaitingIconInChip:re,showChip:s,status:c,containerRef:se,children:t||e.jsx(e.Fragment,{})})})},del:({node:n,children:t,...i})=>{var o;const{cleanedChildren:r,extractedNodes:d}=K(t,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.deleted,style:null!==(o=null==F?void 0:F.deleted)&&void 0!==o?o:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:r}),d]})},ins:({children:n,...t})=>{var i;const{cleanedChildren:o,extractedNodes:r}=K(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.inserted,style:null!==(i=null==F?void 0:F.inserted)&&void 0!==i?i:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:o}),r]})},preserved:({children:n,...t})=>e.jsx("span",{className:l.default.preserved,style:null==F?void 0:F.preserved,...t,children:n}),manual:({children:n,...t})=>{var i;const l=null===(i=null==t?void 0:t.id)||void 0===i?void 0:i.replaceAll("@","<").replaceAll("#",">"),o=pe.find(e=>e.id.toString()===l),r=t["data-status"];return o?e.jsx(I.default,{aiReason:o,handleClick:null==ye?void 0:ye.handleClick,status:r,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...t})=>e.jsx(e.Fragment,{}),h1:({node:n,...t})=>e.jsx("h1",{className:l.default.heading1,style:null==F?void 0:F.heading1,children:t.children}),h2:({node:n,...t})=>e.jsx("h2",{className:l.default.heading2,style:null==F?void 0:F.heading2,children:t.children}),h3:({node:n,...t})=>e.jsx("h3",{className:l.default.heading3,style:null==F?void 0:F.heading3,children:t.children}),b:({node:n,...t})=>e.jsx("b",{className:l.default.bold,style:null==F?void 0:F.bold,children:null==t?void 0:t.children}),p:({node:n,...t})=>e.jsx("p",{...t,className:l.default.paragraph,style:null==F?void 0:F.paragraph,children:t.children}),updated:({node:n,...t})=>e.jsx(s.default,{...t,showUserStoryDiff:x,currentUpdatedTagId:$e,setCurrentUpdatedTagId:Ne,userStory:ce,setUserStory:he,setAiReasoning:ve,node:n,isCraflow:J,onCraAccept:X,onCraReject:Y,diffEditConfig:Se,customStyles:null==F?void 0:F.updatedContent,craFlowConfig:ee}),ol:({node:n,...o})=>{var r,d,a;const s=null!==(a=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.start)&&void 0!==d?d:null==o?void 0:o.start)&&void 0!==a?a:void 0,c=Number(null!=s?s:1);return t?e.jsx("div",{role:"list",className:l.default.negatedOrderedList,style:null==F?void 0:F.olist,children:i(o.children,e=>`${c+e}.`)}):e.jsx("ol",{className:l.default.orderedList,style:null==F?void 0:F.olist,...s?{start:Number(s)}:{},children:null==o?void 0:o.children})},ul:({node:n,...o})=>t?e.jsx("div",{role:"list",className:l.default.negatedUnorderedList,style:null==F?void 0:F.ulist,children:i(o.children,()=>"•")}):e.jsx("ul",{className:l.default.unorderedList,style:null==F?void 0:F.ulist,children:null==o?void 0:o.children}),li:({node:n,...i})=>{if(t){const n=i["data-list-marker"],{children:t,"data-list-marker":o,...r}=i;return e.jsxs("div",{...r,role:"listitem",className:`${l.default.paragraph} ${l.default.negatedListItem}`,style:null==F?void 0:F.paragraph,children:[n&&e.jsxs("span",{className:l.default.negatedListMarker,children:[n," "]}),t]})}return e.jsx("li",{children:null==i?void 0:i.children})},table:({children:n})=>e.jsx(R.default,{menuConfig:null==de?void 0:de.table,menuStyles:null==F?void 0:F.tableMenu,tableStyle:null==F?void 0:F.table,blockId:le,storyId:oe,children:n}),tr:({node:n,children:t})=>e.jsx(_,{node:n,children:t,customStyles:F}),td:({node:n,children:t})=>{var i;const{style:l,...o}=null!==(i=null==n?void 0:n.properties)&&void 0!==i?i:{};return e.jsx(L.Provider,{value:!0,children:e.jsx("td",{...o,style:l?{cssText:l}:void 0,children:t})})},th:({node:n,children:t})=>{var i;const{style:l,...o}=null!==(i=null==n?void 0:n.properties)&&void 0!==i?i:{};return e.jsx(L.Provider,{value:!0,children:e.jsx("th",{...o,style:l?{cssText:l}:void 0,children:t})})},recommendation:({node:n,...t})=>{var i;const l=`The AI has selected this content based on: ${(null===(i=null==t?void 0:t.children)||void 0===i?void 0:i[0])||""}`;return e.jsx(f.default,{...t,customStyles:null==F?void 0:F.recommendationBlock,label:l})},a:({inline:t,children:i,node:o,...r})=>{var d;const a=n.useContext(L)||"true"===(null==r?void 0:r.table),s=`${null==r?void 0:r.href}`,[c,u]=s.split("$"),g=null==u?void 0:u.split("?")[0];if("ai_reasoning"===c){const n=(null!==(d=x?B:pe)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(g)),t=Ce.includes(g);if(n){if(a)return e.jsx(T,{aiReason:n,customStyle:null==F?void 0:F.tableAiReasoning,customIcons:be,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const l=Pe(i),o="source"!==l.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:t,inlineLabel:l,isInlineCitation:o,customIcons:be,customStyles:{aiReasoningContent:null==F?void 0:F.aiReasoningContent,aiReasoningAccordion:null==F?void 0:F.aiReasoningAccordion,aiReasoningMarkdown:null==F?void 0:F.aiReasoningMarkdown,aiReasoningPill:null==F?void 0:F.aiReasoningPill,webCitation:null==F?void 0:F.webCitation,stormeeCitation:null==F?void 0:F.stormeeCitation,waveformCitation:null==F?void 0:F.waveformCitation,imageCitation:null==F?void 0:F.imageCitation,fileCitation:null==F?void 0:F.fileCitation,appModCitation:null==F?void 0:F.appModCitation,rcaCitation:null==F?void 0:F.rcaCitation,readFileCitation:null==F?void 0:F.readFileCitation,loadingCitations:null==F?void 0:F.loadingCitations,chatCitation:null==F?void 0:F.chatCitation,bigEnoughCitation:null==F?void 0:F.bigEnoughCitation}})}}return Z?e.jsx("button",{className:l.default.citationLink,style:null==F?void 0:F.citationLink,onClick:()=>Z((null==r?void 0:r.href)||""),children:i}):null},code:({inline:n,children:t,className:i,node:o,...r})=>/language-(\w+)/.exec(i||"")||(null==i?void 0:i.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:l.default.blockCode,style:null==F?void 0:F.code,children:t})}):e.jsx("code",{className:l.default.inlineCode,style:null==F?void 0:F.code,children:t}),learned:({children:n})=>e.jsx(d.Tooltip,{title:n,placement:"top",children:e.jsx(r.Info,{size:16,className:l.default.learned})}),generatedcode:({node:n,...t})=>{const i=(null==t?void 0:t.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const t=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(t).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?t(e.props.children):""};n=t(e.children)}}catch(t){console.error("Error decoding generated code:",t),n=String(e.children)}return n})(t);return e.jsx(c.default,{title:"Generated Code",code:l,language:i,customStyles:{pill:null==F?void 0:F.generatedCodePill,content:null==F?void 0:F.generatedCodeContent}})},updatedsegment:({node:n,children:t,...i})=>{var l,o,r,d;const a=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(i),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:q.default.sanitize(s)}}):e.jsx("div",{children:t});return e.jsx(y.default,{id:a,node:n,children:c,props:i,segmentComponentConfig:je,customStyles:F,customIcons:O,extractText:Pe,isUpdatedSegment:!0})},segment:({node:n,children:t,...i})=>{var l,o,r,d;const a=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e.jsx(y.default,{id:a,node:n,children:t,props:i,segmentComponentConfig:je,customStyles:F,customIcons:O,extractText:Pe,blockId:le,storyId:oe})}}},[_e,ee,pe,V,$e,x,t,O,fe,Ce,F,je,Le,He,le,oe,null==Ie?void 0:Ie.negateList,Z]),We=n.useMemo(()=>{let e=w.escapeTagIds(Fe,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=w.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[Fe]);return n.useEffect(()=>{if(!se.current)return;if(!fe.length)return void Re();const e=se.current,n=Math.min(xe,fe.length-1);let t;const i=()=>{requestAnimationFrame(()=>{we([fe[n].replace(/\*/g,"")])})};i();const l=new MutationObserver(()=>{clearTimeout(t),t=setTimeout(()=>{e.querySelector(`.${o.HIGHLIGHT_CLASS}`)||i()},50)});return l.observe(e,{childList:!0,subtree:!0}),()=>{l.disconnect(),clearTimeout(t)}},[fe,Ce,xe,ne]),e.jsx(E.Provider,{value:{expandedInfo:ke,setExpanded:Me,reasonToRow:qe},children:e.jsxs("div",{ref:se,className:`${l.default.container} ${"approving"!==p?l.default.wrapper:""} ${U||""}`,style:null==F?void 0:F.container,children:[a?e.jsx(S.MarkdownContextProvider,{children:e.jsx(k.default,{components:Oe,rehypePlugins:[A.default],children:We})}):i,Te>0&&te&&e.jsx("div",{className:l.default.confidenceScoreContainer,style:null==F?void 0:F.confidenceScoreContainer,children:e.jsxs("span",{className:l.default.confidenceScore,style:null==F?void 0:F.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==F?void 0:F.confidenceScoreIconColor)||"#166534"}),Te,"%"]})}),M&&e.jsx("div",{className:l.default.citationLoader,style:null==F?void 0:F.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==F?void 0:F.citationLoadingContainer,icon:null==F?void 0:F.citationLoadingIcon,text:null==F?void 0:F.citationLoadingText}})}),h&&e.jsx("div",{style:{...null===(ae=null==F?void 0:F.attachedContext)||void 0===ae?void 0:ae.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==F?void 0:F.attachedContext,variant:W})})]})})},exports.splitNestedDiffNodes=K;
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Loader2 as i}from"lucide-react";import{useState as t,useEffect as a}from"react";import{mapToHighlightAreas as o,citationViewerStyles as r}from"./pdfCitationUtils.js";import{useRequirementAI as n}from"../RequirementAIWrapper/RequirementAIWrapper.js";import l from"./pdfCitation.module.css.js";import d from"./CitationPdfViewer.js";function s({citation:s,isCitationLoading:c=!1,renderMode:u,pdfViewHeaderAction:g,citationId:f}){var h,m,p,v,C;const{queryClient:U,useGetSignedUrlQuery:w,useGetSignedUrlMutation:P}=n().apiCachingConfig,[V,_]=t(!1),x=null==s?void 0:s.customMetadata,y=null!==(h=null==x?void 0:x.value)&&void 0!==h?h:[],A=null!==(m=null==x?void 0:x.artifact_url)&&void 0!==m?m:"",j=null!==(p=null==x?void 0:x.artifact_title)&&void 0!==p?p:"",I=null!==(v=null==x?void 0:x.artifact_format)&&void 0!==v?v:"pdf",M=y.flatMap(e=>e.highlighted_text.map(e=>e.text)),N="docx"===I,S=["getSignedUrl",A],{data:D}=w(A,S),{mutate:H,isPending:q}=P(A),G=null!=D?D:"",R=!!A&&q&&!G;A||console.warn("Artifact preview details not found in header message or message data",A);return a(()=>{if(!A)return void _(!0);const e=U.getQueryData(S);e||q||H({gsUtilPath:A}),e&&_(!1)},[A,U,S,q,H]),a(()=>{G&&_(!1)},[G]),null!==(C=(()=>{try{const t=o(y),a=t.length>0;if(R||c)return e("div",{className:l.loaderContainer,children:e(i,{className:l.loaderIcon,size:28})});const n=y.some(e=>!!e.gs_url),s=y.some(e=>null!==e.page_no&&void 0!==e.page_no),h=y.some(e=>Array.isArray(e.highlighted_coordinates)&&e.highlighted_coordinates.length>0),m=t.length>0;return!(n||s||h||m)&&console.warn("No valid coordinates or gs_url found for this citation.",{hasValidGsUrl:n,hasValidPageNo:s,hasHighlightedCoords:h,hasCoordinatesPages:m,pages:y,artifactUrl:A}),(a||!s||V)&&(V||!a)?(console.warn("Error in loading PDF or no valid highlight coordinates found. Rendering fallback viewer without highlights.",{artifactUrl:A,hasValidCoordinates:a,coordinatesPages:t,pages:y}),e(d,{artifactUrl:A,pdfUrl:"",pdfName:j,pages:y,coordinatesPages:[],pdfViewHeaderAction:g,renderMode:null!=u?u:"fallback",isDocx:N,hasValidCoordinates:!1,customStyles:r,highlightText:M,citationId:f})):e(d,{artifactUrl:A,pdfUrl:G,pdfName:j,pages:y,coordinatesPages:t,pdfViewHeaderAction:g,renderMode:null!=u?u:"default",isDocx:N,hasValidCoordinates:a,jumpToPageValue:1,customStyles:r,highlightText:M,citationId:f})}catch(e){return console.warn("Error rendering citation",e),null}})())&&void 0!==C?C:null}export{s as default};
|
|
2
|
+
//# sourceMappingURL=CitationPdfRendererWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfRendererWrapper.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Loader2 as i}from"lucide-react";import{PdfViewer as t}from"@e-llm-studio/citation";import{stringToNumber as o}from"./pdfCitationUtils.js";const a={pdfViewer:{height:"50%",maxHeight:"50%",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}},l={pdfViewerWrapper:"shadow-sm"},r=()=>e("div",{className:"h-full flex items-center justify-center",children:e(i,{className:"animate-spin text-purple-500",size:28})}),n=({artifactUrl:i,pdfUrl:n,pdfName:s,pages:d,coordinatesPages:c,activeCitationIndex:f,onActiveCitationChange:h,pdfViewHeaderAction:p,isLoading:u,hasValidCoordinates:g,renderMode:m="default",useCoordinates:C=!0,jumpToPageValue:x,customStyles:b,customClasses:k,isDocx:v=!1,highlightText:A,citationId:w})=>{if(u)return e(r,{});const P=v||"fallback"===m?"":n,V="fallback"===m||!1===g?[]:c,j="fallback"!==m&&C,I=o(w),N=p?{icon:p.icon,tooltip:p.tooltip,onClick:()=>{p.onClick({artifactUrl:i,artifactId:i,fileName:null!=s?s:"",pages:d,currentCitationIndex:null!=I?I:0})}}:void 0;return e(t,{pdfUrl:P,pdfName:s,fallbackPages:d,highlightCordinatePages:V,highlightText:null!=A?A:[],highlightPages:{},useCoordinates:j,activeCitationIndex:f,headerAction:N,onActiveCitationChange:h,highlightColor:"oklch(0.78 0.16 95 / 0.35)",activeHighlightColor:"oklch(0.75 0.17 95 / 0.45)",jumpToPageValue:x,customStyles:null!=b?b:a,customClasses:null!=k?k:l})};export{n as default};
|
|
2
|
+
//# sourceMappingURL=CitationPdfViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfViewer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=(e=[])=>Array.isArray(e)?null==e?void 0:e.flatMap(e=>{var i,r;const o=null==e?void 0:e.page_no;return!(null===(i=null==e?void 0:e.highlighted_coordinates)||void 0===i?void 0:i.length)&&o?[{pageNumber:o,pageIndex:o-1}]:o&&(null===(r=null==e?void 0:e.highlighted_coordinates)||void 0===r?void 0:r.length)?e.highlighted_coordinates.map(e=>({pageIndex:o-1,pageNumber:o,left:100*e.xmin,top:100*e.ymin,width:100*(e.xmax-e.xmin),height:100*(e.ymax-e.ymin)})):[]}):[],i={pdfViewer:{height:"550px",maxHeight:"550px",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}};function r(e,i=0){if("number"==typeof e)return Number.isFinite(e)?e:i;if(!e||"string"!=typeof e||!e.trim())return i;let r="";try{r=e.trim().replace(/[^\d.-]/g,"").replace(/(?!^)-/g,"")}catch(e){return console.error("Regex processing failed",e),i}const o=Number(r);return Number.isFinite(o)?o:i}export{i as citationViewerStyles,e as mapToHighlightAreas,r as stringToNumber};
|
|
2
|
+
//# sourceMappingURL=pdfCitationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfCitationUtils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import t,{createContext as o,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import h from"rehype-raw";import p from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as g,HIGHLIGHT_CLASS as m}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as C}from"@mui/material";import f from"dompurify";import y from"../../shared/UpdatedAnimationContent.js";import b from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as I}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../../icons/CognitiveDecision.js";import $ from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as N}from"../ai-reasoning/AiReasoningCitation.js";import k from"../../icons/RelevanceScoreIcon.js";import x from"../RecommendationBlock/RecommendationBlock.js";import A from"../UserStoryCard/AttachedContext.js";import j from"../ai-reasoning/AiReasoningCitationContent.js";import L from"./components/InlineUpdatedComponent.js";import E from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as M}from"../../store/markdown-context.js";import U from"./components/InlineManualComponent.js";import T from"./components/HighlightButtonComponent.js";import{escapeTagIds as P,splitTagAcrossParagraphs as D}from"../../../../utils/tagHelper.js";import _ from"../common/TableWrapper.js";const H=o(!1),W=o({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),B=o({rowId:""}),F=({aiReason:n,isHighConfidence:t,customStyle:o,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(W),{rowId:u}=c(B),h=String(n.id);u&&s.current.set(h,u);const g=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,m=t?(null==l?void 0:l.highConfidence)||e(S,{}):(null==l?void 0:l.lowConfidence)||e($,{});return i("button",{className:p.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(g?null:u,g?null:n)},children:[m,e("i",g?{className:`pi pi-angle-up ${t?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${t?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`})]})},O=({children:n,node:t,customStyles:o,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(W),h=(null==u?void 0:u.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,m=null!==(a=null===(d=null==t?void 0:t.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(B.Provider,{value:{rowId:s},children:[e("tr",{style:m?{cssText:m}:void 0,children:n}),h&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:g||1,className:p.tableExpandedCell,children:e("div",{className:p.tableExpandedCellInner,children:e("div",{className:p.tableExpandedCellContent,children:e(j,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const V=["del","ins"];function q(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;const o=null!==(t=n[Number(i)])&&void 0!==t?t:"";return`<code>${l=o,l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var l})}function z(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,V,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:q(e)).join(""))}function G(e){let n=e.trim();n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const i=[];let t="",o=!1;for(const e of n)o?(t+=e,o=!1):"\\"!==e?"|"!==e?t+=e:(i.push(t.trim()),t=""):(t+=e,o=!0);return i.push(t.trim()),i}function Q(e){return e.trim().includes("|")&&G(e).length>1}function J(e){const n=G(e);return n.length>1&&n.every(e=>/^:?-{3,}:?$/.test(e.replace(/\s+/g,"")))}function K(e){if(!e)return;const n=e.replace(/\s+/g,"");return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":"left"}function X(e,n){return Array.from({length:n},(n,i)=>{var t;return null!==(t=e[i])&&void 0!==t?t:""})}function Y(e,n,i){return`<${e}${function(e){return e?` align="${e}"`:""}(i)}>${q(n)}</${e}>`}function Z(e,n,i){const t=Math.max(e.length,n.length,...i.map(e=>e.length)),o=X(e,t),l=X(n,t).map(K);return`\n\n<table>${`<thead><tr>${o.map((e,n)=>Y("th",e,l[n])).join("")}</tr></thead>`}${i.length?`<tbody>${i.map(e=>`<tr>${X(e,t).map((e,n)=>Y("td",e,l[n])).join("")}</tr>`).join("")}</tbody>`:""}</table>\n\n`}const ee=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ne(e,n){const i=[],o=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!t.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(o.has(d))return i.push(e),null;if(ee.has(d))return e;const a=null===(r=t.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?t.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const ie=({message:o,noMarkdownContent:S,useMarkdown:$=!0,isParent:j,scenario:B,showUserStoryDiff:V=!1,aiReasoningsForBlock:q,isCitationLoadingDisplay:K=!1,className:X,highConfidenceIcon:Y,lowConfidenceIcon:ee,customStyles:ie,customIcons:te,contextVariant:oe,aiReasoningDiffView:le,userStoryCitations:re,artifactId:de,isCraflow:ae,onCraAccept:se,onCraReject:ce,onCitationLinkClick:ue,craFlowConfig:he,isDisplayHighlightControl:pe=!1,showConfidenceScore:ge=!0,CDNeededInChip:me,blockId:ve,storyId:Ce,showWaitingIconInChip:fe,menuActions:ye})=>{var be;console.log("userstorywithcitation blockid ",ve,ye);const we=l(null),{userStory:Ie,inlineUpdateComponentConfig:Se,getAvgScoreForStory:$e,setUserStory:Re,aiReasoning:Ne,setAiReasoning:ke,customIcons:xe,searchQueryList:Ae,searchQueryReasoningIdList:je,currentHighlightIndex:Le,segmentComponentConfig:Ee,inlineManualComponentConfig:Me,diffEditConfig:Ue,customSectionConfig:Te}=I(),Pe=null!=te?te:null==xe?void 0:xe.userStoryIcons;null==ie||ie.searchHighlight;const{search:De,clear:_e}=g(we),[He,We]=r("1"),[Be,Fe]=r(null),Oe=l(new Map),[Ve,qe]=r(new Set),ze=d((e,n)=>{Fe(e&&n?{rowId:e,aiReason:n}:null)},[]),Ge=de?$e(de):0,[Qe,Je]=r([]),Ke=d(e=>{qe(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Xe=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Xe).join(""):t.isValidElement(e)?Xe(e.props.children):"",Ye=e=>{let n=function(e){const n=e.split("\n"),i=[];let t=!1;for(let e=0;e<n.length;e++){const o=n[e];if(/^\s*(```|~~~)/.test(o)){t=!t,i.push(o);continue}const l=n[e+1];if(!t&&void 0!==l&&Q(o)&&J(l)){const t=G(o),r=G(l),d=[];for(e+=2;e<n.length&&Q(n[e])&&!J(n[e]);)d.push(G(n[e])),e++;e--,i.push(Z(t,r,d));continue}i.push(o)}return i.join("\n")}(function(e){return e.replace(/\\r\\n|\\n|\\r/g,"\n")}(e));return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,o)=>{const l=t.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,o)=>{const l=n.substring(0,o),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=z(n),n},Ze=a(()=>o?Ye(o):o,[o]);s(()=>{Je(q||Ne)},[q,Ne]);const en=a(()=>{const o=Boolean(null==Te?void 0:Te.negateList),l=(e,n)=>{let i=0;return t.Children.map(e,e=>{if(!t.isValidElement(e))return e;const o=n(i);return i+=1,t.cloneElement(e,{"data-list-marker":o})})};return{span:({node:n,children:i,...t})=>{var o,l,r,d,a;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&Ve.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==t?void 0:t["highlight-color"];return e("span",{style:{...null!==(a=null==ie?void 0:ie.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:t,...o})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==o?void 0:o.action,h=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==o?void 0:o["highlight-id"],p=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==o?void 0:o["highlight-type"];return"highlight"===u?e(T,{highlightId:h,handleHighlightSpan:Ke,icon:"web"===p?null==Pe?void 0:Pe.webCitationIcon:"doc"===p?null==Pe?void 0:Pe.fileCitationIcon:e(n,{}),customStyles:"web"===p?null==ie?void 0:ie.webButton:"doc"===p?null==ie?void 0:ie.docButton:{}}):null},upt:({node:i,children:t,...o})=>{var l,r;const d=null==o?void 0:o.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=Ne.find(e=>e.id.toString()===a);if(!s)return t||e(n,{});const c="data-main"in o,u=o["data-status"];return e(n,{children:e(L,{aiReason:s,customStyles:null==ie?void 0:ie.inlineUpdatedComponent,handleClickCognitiveDecision:null==Se?void 0:Se.handleClickCognitiveDecision,handleClickUpdatedPill:null==Se?void 0:Se.handleClickUpdatedPill,handleClickOutputValue:null==Se?void 0:Se.handleClickOutputValue,customIcons:null==Se?void 0:Se.customIcons,CDNeededInChip:me,showWaitingIconInChip:fe,showChip:c,status:u,containerRef:we,children:t||e(n,{})})})},del:({node:t,children:o,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=ne(o,["ins"]);return i(n,{children:[e("span",{className:p.deleted,style:null!==(r=null==ie?void 0:ie.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:t,...o})=>{var l;const{cleanedChildren:r,extractedNodes:d}=ne(t,["del"]);return i(n,{children:[e("span",{className:p.inserted,style:null!==(l=null==ie?void 0:ie.inserted)&&void 0!==l?l:{},...o,onClick:()=>{o.onclick&&o.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:p.preserved,style:null==ie?void 0:ie.preserved,...i,children:n}),manual:({children:i,...t})=>{var o;const l=null===(o=null==t?void 0:t.id)||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"),r=Ne.find(e=>e.id.toString()===l),d=t["data-status"];return r?e(U,{aiReason:r,handleClick:null==Me?void 0:Me.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...t})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:p.heading1,style:null==ie?void 0:ie.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:p.heading2,style:null==ie?void 0:ie.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:p.heading3,style:null==ie?void 0:ie.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:p.bold,style:null==ie?void 0:ie.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:p.paragraph,style:null==ie?void 0:ie.paragraph,children:i.children}),updated:({node:n,...i})=>e(y,{...i,showUserStoryDiff:V,currentUpdatedTagId:He,setCurrentUpdatedTagId:We,userStory:Ie,setUserStory:Re,setAiReasoning:ke,node:n,isCraflow:ae,onCraAccept:se,onCraReject:ce,diffEditConfig:Ue,customStyles:null==ie?void 0:ie.updatedContent,craFlowConfig:he}),ol:({node:n,...i})=>{var t,r,d;const a=null!==(d=null!==(r=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==r?r:null==i?void 0:i.start)&&void 0!==d?d:void 0,s=Number(null!=a?a:1);return o?e("div",{role:"list",className:p.negatedOrderedList,style:null==ie?void 0:ie.olist,children:l(i.children,e=>`${s+e}.`)}):e("ol",{className:p.orderedList,style:null==ie?void 0:ie.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>o?e("div",{role:"list",className:p.negatedUnorderedList,style:null==ie?void 0:ie.ulist,children:l(i.children,()=>"•")}):e("ul",{className:p.unorderedList,style:null==ie?void 0:ie.ulist,children:null==i?void 0:i.children}),li:({node:n,...t})=>{if(o){const e=t["data-list-marker"],{children:n,"data-list-marker":o,...l}=t;return i("div",{...l,role:"listitem",className:`${p.paragraph} ${p.negatedListItem}`,style:null==ie?void 0:ie.paragraph,children:[e&&i("span",{className:p.negatedListMarker,children:[e," "]}),n]})}return e("li",{children:null==t?void 0:t.children})},table:({children:n})=>e(_,{menuConfig:null==ye?void 0:ye.table,menuStyles:null==ie?void 0:ie.tableMenu,tableStyle:null==ie?void 0:ie.table,blockId:ve,storyId:Ce,children:n}),tr:({node:n,children:i})=>e(O,{node:n,children:i,customStyles:ie}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(H.Provider,{value:!0,children:e("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(H.Provider,{value:!0,children:e("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e(x,{...i,customStyles:null==ie?void 0:ie.recommendationBlock,label:o})},a:({inline:n,children:i,node:t,...o})=>{var l;const r=c(H)||"true"===(null==o?void 0:o.table),d=`${null==o?void 0:o.href}`,[a,s]=d.split("$"),u=null==s?void 0:s.split("?")[0];if("ai_reasoning"===a){const n=(null!==(l=V?le:Ne)&&void 0!==l?l:[]).find(e=>e.id.toString()===decodeURIComponent(u)),t=je.includes(u);if(n){if(r)return e(F,{aiReason:n,customStyle:null==ie?void 0:ie.tableAiReasoning,customIcons:Pe,isHighConfidence:n.relevance_score>=N});const o=Xe(i),l="source"!==o.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:t,inlineLabel:o,isInlineCitation:l,customIcons:Pe,customStyles:{aiReasoningContent:null==ie?void 0:ie.aiReasoningContent,aiReasoningAccordion:null==ie?void 0:ie.aiReasoningAccordion,aiReasoningMarkdown:null==ie?void 0:ie.aiReasoningMarkdown,aiReasoningPill:null==ie?void 0:ie.aiReasoningPill,webCitation:null==ie?void 0:ie.webCitation,stormeeCitation:null==ie?void 0:ie.stormeeCitation,waveformCitation:null==ie?void 0:ie.waveformCitation,imageCitation:null==ie?void 0:ie.imageCitation,fileCitation:null==ie?void 0:ie.fileCitation,appModCitation:null==ie?void 0:ie.appModCitation,rcaCitation:null==ie?void 0:ie.rcaCitation,readFileCitation:null==ie?void 0:ie.readFileCitation,loadingCitations:null==ie?void 0:ie.loadingCitations,chatCitation:null==ie?void 0:ie.chatCitation,bigEnoughCitation:null==ie?void 0:ie.bigEnoughCitation}})}}return ue?e("button",{className:p.citationLink,style:null==ie?void 0:ie.citationLink,onClick:()=>ue((null==o?void 0:o.href)||""),children:i}):null},code:({inline:n,children:i,className:t,node:o,...l})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e("div",{children:e("code",{className:p.blockCode,style:null==ie?void 0:ie.code,children:i})}):e("code",{className:p.inlineCode,style:null==ie?void 0:ie.code,children:i}),learned:({children:n})=>e(C,{title:n,placement:"top",children:e(v,{size:16,className:p.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(b,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==ie?void 0:ie.generatedCodePill,content:null==ie?void 0:ie.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=e("div",s?{dangerouslySetInnerHTML:{__html:f.sanitize(s)}}:{children:i});return e(E,{id:a,node:n,children:c,props:t,segmentComponentConfig:Ee,customStyles:ie,customIcons:te,extractText:Xe,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(E,{id:a,node:n,children:i,props:t,segmentComponentConfig:Ee,customStyles:ie,customIcons:te,extractText:Xe,blockId:ve,storyId:Ce})}}},[Qe,he,Ne,re,He,V,o,te,Ae,je,ie,Ee,Ve,Ke,ve,Ce,null==Te?void 0:Te.negateList,ue]),nn=a(()=>{let e=P(Ze,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=D(e,n,"upt"===n)}),e},[Ze]);return s(()=>{if(!we.current)return;if(!Ae.length)return void _e();const e=we.current,n=Math.min(Le,Ae.length-1);let i;const t=()=>{requestAnimationFrame(()=>{De([Ae[n].replace(/\*/g,"")])})};t();const o=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{e.querySelector(`.${m}`)||t()},50)});return o.observe(e,{childList:!0,subtree:!0}),()=>{o.disconnect(),clearTimeout(i)}},[Ae,je,Le,pe]),e(W.Provider,{value:{expandedInfo:Be,setExpanded:ze,reasonToRow:Oe},children:i("div",{ref:we,className:`${p.container} ${"approving"!==B?p.wrapper:""} ${X||""}`,style:null==ie?void 0:ie.container,children:[$?e(M,{children:e(u,{components:en,rehypePlugins:[h],children:nn})}):S,Ge>0&&ge&&e("div",{className:p.confidenceScoreContainer,style:null==ie?void 0:ie.confidenceScoreContainer,children:i("span",{className:p.confidenceScore,style:null==ie?void 0:ie.confidenceScore,children:[e(k,{size:14,color:(null==ie?void 0:ie.confidenceScoreIconColor)||"#166534"}),Ge,"%"]})}),K&&e("div",{className:p.citationLoader,style:null==ie?void 0:ie.citationLoaderContainer,children:e(w,{customStyles:{container:null==ie?void 0:ie.citationLoadingContainer,icon:null==ie?void 0:ie.citationLoadingIcon,text:null==ie?void 0:ie.citationLoadingText}})}),j&&e("div",{style:{...null===(be=null==ie?void 0:ie.attachedContext)||void 0===be?void 0:be.wrapper},className:"flex mt-5",children:e(A,{customStyles:null==ie?void 0:ie.attachedContext,variant:oe})})]})})};export{ie as default,ne as splitNestedDiffNodes};
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import t,{createContext as o,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import h from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as g,HIGHLIGHT_CLASS as m}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as C}from"@mui/material";import f from"dompurify";import y from"../../shared/UpdatedAnimationContent.js";import b from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as I}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../../icons/CognitiveDecision.js";import $ from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as N}from"../ai-reasoning/AiReasoningCitation.js";import k from"../../icons/RelevanceScoreIcon.js";import x from"../RecommendationBlock/RecommendationBlock.js";import A from"../UserStoryCard/AttachedContext.js";import j from"../ai-reasoning/AiReasoningCitationContent.js";import L from"./components/InlineUpdatedComponent.js";import E from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as M}from"../../store/markdown-context.js";import U from"./components/InlineManualComponent.js";import T from"./components/HighlightButtonComponent.js";import{escapeTagIds as P,splitTagAcrossParagraphs as D}from"../../../../utils/tagHelper.js";import _ from"../common/TableWrapper.js";const H=o(!1),W=o({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),B=o({rowId:""}),F=({aiReason:n,isHighConfidence:t,customStyle:o,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(W),{rowId:u}=c(B),p=String(n.id);u&&s.current.set(p,u);const g=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,m=t?(null==l?void 0:l.highConfidence)||e(S,{}):(null==l?void 0:l.lowConfidence)||e($,{});return i("button",{className:h.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(g?null:u,g?null:n)},children:[m,e("i",g?{className:`pi pi-angle-up ${t?h.aiReasoningIconHighConfidence:h.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${t?h.aiReasoningIconHighConfidence:h.aiReasoningIconLowConfidence}`})]})},O=({children:n,node:t,customStyles:o,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(W),p=(null==u?void 0:u.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,m=null!==(a=null===(d=null==t?void 0:t.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(B.Provider,{value:{rowId:s},children:[e("tr",{style:m?{cssText:m}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:g||1,className:h.tableExpandedCell,children:e("div",{className:h.tableExpandedCellInner,children:e("div",{className:h.tableExpandedCellContent,children:e(j,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const V=["del","ins"];function q(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;const o=null!==(t=n[Number(i)])&&void 0!==t?t:"";return`<code>${l=o,l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var l})}function z(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,V,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:q(e)).join(""))}function G(e){let n=e.trim();n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const i=[];let t="",o=!1;for(const e of n)o?(t+=e,o=!1):"\\"!==e?"|"!==e?t+=e:(i.push(t.trim()),t=""):(t+=e,o=!0);return i.push(t.trim()),i}function Q(e){return e.trim().includes("|")&&G(e).length>1}function J(e){const n=G(e);return n.length>1&&n.every(e=>/^:?-{3,}:?$/.test(e.replace(/\s+/g,"")))}function K(e){if(!e)return;const n=e.replace(/\s+/g,"");return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":"left"}function X(e,n){return Array.from({length:n},(n,i)=>{var t;return null!==(t=e[i])&&void 0!==t?t:""})}function Y(e,n,i){return`<${e}${function(e){return e?` align="${e}"`:""}(i)}>${q(n)}</${e}>`}function Z(e,n,i){const t=Math.max(e.length,n.length,...i.map(e=>e.length)),o=X(e,t),l=X(n,t).map(K);return`\n\n<table>${`<thead><tr>${o.map((e,n)=>Y("th",e,l[n])).join("")}</tr></thead>`}${i.length?`<tbody>${i.map(e=>`<tr>${X(e,t).map((e,n)=>Y("td",e,l[n])).join("")}</tr>`).join("")}</tbody>`:""}</table>\n\n`}function ee(e){const n=e.split("\n"),i=[];let t=!1;for(let e=0;e<n.length;e++){const o=n[e];if(/^\s*(```|~~~)/.test(o)){t=!t,i.push(o);continue}const l=n[e+1];if(!t&&void 0!==l&&Q(o)&&J(l)){const t=G(o),r=G(l),d=[];for(e+=2;e<n.length&&Q(n[e])&&!J(n[e]);)d.push(G(n[e])),e++;e--,i.push(Z(t,r,d));continue}i.push(o)}return i.join("\n")}function ne(e){return e.split(/(<segment\b[^>]*>[\s\S]*?<\/segment>)/gi).map((e,n)=>n%2==1?e:ee(e)).join("")}const ie=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function te(e,n){const i=[],o=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!t.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(o.has(d))return i.push(e),null;if(ie.has(d))return e;const a=null===(r=t.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?t.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const oe=({message:o,noMarkdownContent:S,useMarkdown:$=!0,isParent:j,scenario:B,showUserStoryDiff:V=!1,aiReasoningsForBlock:q,isCitationLoadingDisplay:G=!1,className:Q,highConfidenceIcon:J,lowConfidenceIcon:K,customStyles:X,customIcons:Y,contextVariant:Z,aiReasoningDiffView:ie,userStoryCitations:oe,artifactId:le,isCraflow:re,onCraAccept:de,onCraReject:ae,onCitationLinkClick:se,craFlowConfig:ce,isDisplayHighlightControl:ue=!1,showConfidenceScore:pe=!0,CDNeededInChip:he,blockId:ge,storyId:me,showWaitingIconInChip:ve,menuActions:Ce})=>{var fe;console.log("userstorywithcitation blockid ",ge,Ce);const ye=l(null),{userStory:be,inlineUpdateComponentConfig:we,getAvgScoreForStory:Ie,setUserStory:Se,aiReasoning:$e,setAiReasoning:Re,customIcons:Ne,searchQueryList:ke,searchQueryReasoningIdList:xe,currentHighlightIndex:Ae,segmentComponentConfig:je,inlineManualComponentConfig:Le,diffEditConfig:Ee,customSectionConfig:Me}=I(),Ue=null!=Y?Y:null==Ne?void 0:Ne.userStoryIcons;null==X||X.searchHighlight;const{search:Te,clear:Pe}=g(ye),[De,_e]=r("1"),[He,We]=r(null),Be=l(new Map),[Fe,Oe]=r(new Set),Ve=d((e,n)=>{We(e&&n?{rowId:e,aiReason:n}:null)},[]),qe=le?Ie(le):0,[ze,Ge]=r([]),Qe=d(e=>{Oe(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Je=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Je).join(""):t.isValidElement(e)?Je(e.props.children):"",Ke=e=>{let n=ne(function(e){return e.replace(/\\r\\n|\\n|\\r/g,"\n")}(e));return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,o)=>{const l=ee(t.trim()).match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,o)=>{const l=n.substring(0,o),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=z(n),n},Xe=a(()=>o?Ke(o):o,[o]);s(()=>{Ge(q||$e)},[q,$e]);const Ye=a(()=>{const o=Boolean(null==Me?void 0:Me.negateList),l=(e,n)=>{let i=0;return t.Children.map(e,e=>{if(!t.isValidElement(e))return e;const o=n(i);return i+=1,t.cloneElement(e,{"data-list-marker":o})})};return{span:({node:n,children:i,...t})=>{var o,l,r,d,a;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&Fe.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==t?void 0:t["highlight-color"];return e("span",{style:{...null!==(a=null==X?void 0:X.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:t,...o})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==o?void 0:o.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==o?void 0:o["highlight-id"],h=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==o?void 0:o["highlight-type"];return"highlight"===u?e(T,{highlightId:p,handleHighlightSpan:Qe,icon:"web"===h?null==Ue?void 0:Ue.webCitationIcon:"doc"===h?null==Ue?void 0:Ue.fileCitationIcon:e(n,{}),customStyles:"web"===h?null==X?void 0:X.webButton:"doc"===h?null==X?void 0:X.docButton:{}}):null},upt:({node:i,children:t,...o})=>{var l,r;const d=null==o?void 0:o.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=$e.find(e=>e.id.toString()===a);if(!s)return t||e(n,{});const c="data-main"in o,u=o["data-status"];return e(n,{children:e(L,{aiReason:s,customStyles:null==X?void 0:X.inlineUpdatedComponent,handleClickCognitiveDecision:null==we?void 0:we.handleClickCognitiveDecision,handleClickUpdatedPill:null==we?void 0:we.handleClickUpdatedPill,handleClickOutputValue:null==we?void 0:we.handleClickOutputValue,customIcons:null==we?void 0:we.customIcons,CDNeededInChip:he,showWaitingIconInChip:ve,showChip:c,status:u,containerRef:ye,children:t||e(n,{})})})},del:({node:t,children:o,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=te(o,["ins"]);return i(n,{children:[e("span",{className:h.deleted,style:null!==(r=null==X?void 0:X.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:t,...o})=>{var l;const{cleanedChildren:r,extractedNodes:d}=te(t,["del"]);return i(n,{children:[e("span",{className:h.inserted,style:null!==(l=null==X?void 0:X.inserted)&&void 0!==l?l:{},...o,onClick:()=>{o.onclick&&o.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:h.preserved,style:null==X?void 0:X.preserved,...i,children:n}),manual:({children:i,...t})=>{var o;const l=null===(o=null==t?void 0:t.id)||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"),r=$e.find(e=>e.id.toString()===l),d=t["data-status"];return r?e(U,{aiReason:r,handleClick:null==Le?void 0:Le.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...t})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:h.heading1,style:null==X?void 0:X.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:h.heading2,style:null==X?void 0:X.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:h.heading3,style:null==X?void 0:X.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:h.bold,style:null==X?void 0:X.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:h.paragraph,style:null==X?void 0:X.paragraph,children:i.children}),updated:({node:n,...i})=>e(y,{...i,showUserStoryDiff:V,currentUpdatedTagId:De,setCurrentUpdatedTagId:_e,userStory:be,setUserStory:Se,setAiReasoning:Re,node:n,isCraflow:re,onCraAccept:de,onCraReject:ae,diffEditConfig:Ee,customStyles:null==X?void 0:X.updatedContent,craFlowConfig:ce}),ol:({node:n,...i})=>{var t,r,d;const a=null!==(d=null!==(r=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==r?r:null==i?void 0:i.start)&&void 0!==d?d:void 0,s=Number(null!=a?a:1);return o?e("div",{role:"list",className:h.negatedOrderedList,style:null==X?void 0:X.olist,children:l(i.children,e=>`${s+e}.`)}):e("ol",{className:h.orderedList,style:null==X?void 0:X.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>o?e("div",{role:"list",className:h.negatedUnorderedList,style:null==X?void 0:X.ulist,children:l(i.children,()=>"•")}):e("ul",{className:h.unorderedList,style:null==X?void 0:X.ulist,children:null==i?void 0:i.children}),li:({node:n,...t})=>{if(o){const e=t["data-list-marker"],{children:n,"data-list-marker":o,...l}=t;return i("div",{...l,role:"listitem",className:`${h.paragraph} ${h.negatedListItem}`,style:null==X?void 0:X.paragraph,children:[e&&i("span",{className:h.negatedListMarker,children:[e," "]}),n]})}return e("li",{children:null==t?void 0:t.children})},table:({children:n})=>e(_,{menuConfig:null==Ce?void 0:Ce.table,menuStyles:null==X?void 0:X.tableMenu,tableStyle:null==X?void 0:X.table,blockId:ge,storyId:me,children:n}),tr:({node:n,children:i})=>e(O,{node:n,children:i,customStyles:X}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(H.Provider,{value:!0,children:e("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(H.Provider,{value:!0,children:e("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e(x,{...i,customStyles:null==X?void 0:X.recommendationBlock,label:o})},a:({inline:n,children:i,node:t,...o})=>{var l;const r=c(H)||"true"===(null==o?void 0:o.table),d=`${null==o?void 0:o.href}`,[a,s]=d.split("$"),u=null==s?void 0:s.split("?")[0];if("ai_reasoning"===a){const n=(null!==(l=V?ie:$e)&&void 0!==l?l:[]).find(e=>e.id.toString()===decodeURIComponent(u)),t=xe.includes(u);if(n){if(r)return e(F,{aiReason:n,customStyle:null==X?void 0:X.tableAiReasoning,customIcons:Ue,isHighConfidence:n.relevance_score>=N});const o=Je(i),l="source"!==o.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:t,inlineLabel:o,isInlineCitation:l,customIcons:Ue,customStyles:{aiReasoningContent:null==X?void 0:X.aiReasoningContent,aiReasoningAccordion:null==X?void 0:X.aiReasoningAccordion,aiReasoningMarkdown:null==X?void 0:X.aiReasoningMarkdown,aiReasoningPill:null==X?void 0:X.aiReasoningPill,webCitation:null==X?void 0:X.webCitation,stormeeCitation:null==X?void 0:X.stormeeCitation,waveformCitation:null==X?void 0:X.waveformCitation,imageCitation:null==X?void 0:X.imageCitation,fileCitation:null==X?void 0:X.fileCitation,appModCitation:null==X?void 0:X.appModCitation,rcaCitation:null==X?void 0:X.rcaCitation,readFileCitation:null==X?void 0:X.readFileCitation,loadingCitations:null==X?void 0:X.loadingCitations,chatCitation:null==X?void 0:X.chatCitation,bigEnoughCitation:null==X?void 0:X.bigEnoughCitation}})}}return se?e("button",{className:h.citationLink,style:null==X?void 0:X.citationLink,onClick:()=>se((null==o?void 0:o.href)||""),children:i}):null},code:({inline:n,children:i,className:t,node:o,...l})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e("div",{children:e("code",{className:h.blockCode,style:null==X?void 0:X.code,children:i})}):e("code",{className:h.inlineCode,style:null==X?void 0:X.code,children:i}),learned:({children:n})=>e(C,{title:n,placement:"top",children:e(v,{size:16,className:h.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(b,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==X?void 0:X.generatedCodePill,content:null==X?void 0:X.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=e("div",s?{dangerouslySetInnerHTML:{__html:f.sanitize(s)}}:{children:i});return e(E,{id:a,node:n,children:c,props:t,segmentComponentConfig:je,customStyles:X,customIcons:Y,extractText:Je,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(E,{id:a,node:n,children:i,props:t,segmentComponentConfig:je,customStyles:X,customIcons:Y,extractText:Je,blockId:ge,storyId:me})}}},[ze,ce,$e,oe,De,V,o,Y,ke,xe,X,je,Fe,Qe,ge,me,null==Me?void 0:Me.negateList,se]),Ze=a(()=>{let e=P(Xe,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=D(e,n,"upt"===n)}),e},[Xe]);return s(()=>{if(!ye.current)return;if(!ke.length)return void Pe();const e=ye.current,n=Math.min(Ae,ke.length-1);let i;const t=()=>{requestAnimationFrame(()=>{Te([ke[n].replace(/\*/g,"")])})};t();const o=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{e.querySelector(`.${m}`)||t()},50)});return o.observe(e,{childList:!0,subtree:!0}),()=>{o.disconnect(),clearTimeout(i)}},[ke,xe,Ae,ue]),e(W.Provider,{value:{expandedInfo:He,setExpanded:Ve,reasonToRow:Be},children:i("div",{ref:ye,className:`${h.container} ${"approving"!==B?h.wrapper:""} ${Q||""}`,style:null==X?void 0:X.container,children:[$?e(M,{children:e(u,{components:Ye,rehypePlugins:[p],children:Ze})}):S,qe>0&&pe&&e("div",{className:h.confidenceScoreContainer,style:null==X?void 0:X.confidenceScoreContainer,children:i("span",{className:h.confidenceScore,style:null==X?void 0:X.confidenceScore,children:[e(k,{size:14,color:(null==X?void 0:X.confidenceScoreIconColor)||"#166534"}),qe,"%"]})}),G&&e("div",{className:h.citationLoader,style:null==X?void 0:X.citationLoaderContainer,children:e(w,{customStyles:{container:null==X?void 0:X.citationLoadingContainer,icon:null==X?void 0:X.citationLoadingIcon,text:null==X?void 0:X.citationLoadingText}})}),j&&e("div",{style:{...null===(fe=null==X?void 0:X.attachedContext)||void 0===fe?void 0:fe.wrapper},className:"flex mt-5",children:e(A,{customStyles:null==X?void 0:X.attachedContext,variant:Z})})]})})};export{ne as convertMarkdownTablesOutsideSegments,oe as default,te as splitNestedDiffNodes};
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -128,6 +128,7 @@ interface UserStoryWithCitationsProps {
|
|
|
128
128
|
showWaitingIconInChip?: boolean;
|
|
129
129
|
menuActions?: MenuActions;
|
|
130
130
|
}
|
|
131
|
+
export declare function convertMarkdownTablesOutsideSegments(md: string): string;
|
|
131
132
|
export declare function splitNestedDiffNodes(children: React.ReactNode, nestedTagNames: string[]): {
|
|
132
133
|
cleanedChildren: React.ReactNode;
|
|
133
134
|
extractedNodes: React.ReactNode[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStoryWithCitation.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuF,MAAM,OAAO,CAAC;AAW5G,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,aAAa,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC7Y,OAA+B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AASzI,OAAwB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAclE,OAAO,EAAE,WAAW,EAAwB,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAiBjG,MAAM,WAAW,iCAAiC;IAChD,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACtC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE;QAChB,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC9B,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACvC,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACxC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC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Y,CAAC,EAAE,iCAAiC,CAAC;IACjD,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,cAAc,CAAC,EAAC,UAAU,GAAG,QAAQ,CAAC;IACtC,mBAAmB,CAAC,EAAC,OAAO,CAAC;IAI7B,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAKzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAE7C,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC,aAAa,CAAC,EAAE;QACd,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE,UAAU,EAAE,CAAC;QAC3B,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACpE,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;QAC5F,oBAAoB,EAAE,OAAO,CAAC;KAC/B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,CAAC,EAAC,MAAM,CAAA;IACf,OAAO,CAAC,EAAC,MAAM,CAAA;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAE/B,WAAW,CAAC,EAAC,WAAW,CAAC;CAE1B;
|
|
1
|
+
{"version":3,"file":"UserStoryWithCitation.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuF,MAAM,OAAO,CAAC;AAW5G,OAAO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