@e-llm-studio/citation 0.0.225-beta.1 → 0.0.226

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +90 -26
  2. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  3. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
  4. package/dist/cjs/features/RulebookCitations/RuleBookCitationApi.js +1 -1
  5. package/dist/cjs/features/RulebookCitations/RuleBookCitationWrapper.js +1 -1
  6. package/dist/cjs/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
  7. package/dist/cjs/features/TextualGuidelines/TextualGuidelines.module.css.js +1 -1
  8. package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
  9. package/dist/cjs/service/onDemandApi.js +1 -1
  10. package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  11. package/dist/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
  12. package/dist/features/RulebookCitations/RuleBookCitationApi.js +1 -1
  13. package/dist/features/RulebookCitations/RuleBookCitationWrapper.js +1 -1
  14. package/dist/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
  15. package/dist/features/TextualGuidelines/TextualGuidelines.module.css.js +1 -1
  16. package/dist/hooks/useOnDemandCitationFetch.js +1 -1
  17. package/dist/service/onDemandApi.js +1 -1
  18. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +4 -0
  19. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
  20. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.types.d.ts +162 -0
  21. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.types.d.ts.map +1 -0
  22. package/dist/types/src/features/RulebookCitations/RuleBookCitation.types.d.ts +40 -0
  23. package/dist/types/src/features/RulebookCitations/RuleBookCitation.types.d.ts.map +1 -0
  24. package/dist/types/src/features/RulebookCitations/RuleBookCitationApi.d.ts +2 -15
  25. package/dist/types/src/features/RulebookCitations/RuleBookCitationApi.d.ts.map +1 -1
  26. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapper.d.ts +19 -5
  27. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapper.d.ts.map +1 -1
  28. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapperTest.d.ts +0 -2
  29. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapperTest.d.ts.map +1 -1
  30. package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts +5 -1
  31. package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts.map +1 -1
  32. package/dist/types/src/features/TextualGuidelines/TextualGuidelines.types.d.ts +81 -0
  33. package/dist/types/src/features/TextualGuidelines/TextualGuidelines.types.d.ts.map +1 -0
  34. package/dist/types/src/hooks/useOnDemandCitationFetch.d.ts.map +1 -1
  35. package/dist/types/src/index.d.ts +3 -0
  36. package/dist/types/src/index.d.ts.map +1 -1
  37. package/dist/types/src/service/onDemandApi.d.ts +1 -1
  38. package/dist/types/src/service/onDemandApi.d.ts.map +1 -1
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -644,6 +644,7 @@ The CognitiveInternalgptReasoningComponent is a React component designed to rend
644
644
  - **Fullscreen Modal View** - Open a fullscreen modal for detailed examination of reasoning data
645
645
  - **Text Formatting Support** - Handle bold text, list items, headers, and special highlight tags
646
646
  - **Custom Icon Support** - Replace default icons with custom React components
647
+ - **Theming Support** - Customize component appearance using `themeTokens`, `classNames`, and `styles`
647
648
 
648
649
  ### Usage
649
650
 
@@ -673,6 +674,17 @@ const reasoningData = {
673
674
  - Auto-scrolls to active highlight
674
675
  - previewCallback we can use this to pass a callback for external link opening or pdf opening
675
676
  - DocumentTitle : pdf title or document title
677
+ - `themeTokens` can be used to pass CSS variable based theming
678
+ - `classNames` can be used to override classes for individual sections
679
+ - `styles` can be used to pass inline style overrides for individual sections
680
+
681
+ ### Additional Props
682
+
683
+ | Prop | Type | Default | Description |
684
+ |------|------|---------|-------------|
685
+ | `themeTokens` | `CognitiveReasoningThemeTokens` | `undefined` | Optional CSS variable based theme tokens |
686
+ | `classNames` | `CognitiveReasoningClassNames` | `undefined` | Optional class overrides for individual sections |
687
+ | `styles` | `CognitiveReasoningStyles` | `undefined` | Optional inline style overrides for individual sections |
676
688
 
677
689
  ---
678
690
 
@@ -2623,54 +2635,106 @@ function App() {
2623
2635
 
2624
2636
  A React component used to render Rule Book citation content with highlighted citation phrases.
2625
2637
 
2626
- The component fetches citation metadata, resolves the associated Rule Book file, extracts textual guideline content, and displays it using the `TextualGuideLinesComponent`.
2638
+ The component resolves Rule Book citation information either from the provided `data.fileDetails` or from `msg.artifactSearchData.ruleBookData.rulebook_citations`. It then locates the corresponding guideline file, fetches its contents, extracts the Rule Book text, and renders it using `TextualGuideLinesComponent`.
2639
+
2627
2640
 
2628
2641
  ### Usage
2629
2642
 
2630
2643
  ```tsx
2631
- import { RuleBookCitationWrapper } from "<library-name>";
2644
+ import RuleBookCitationWrapper from "<library-name>";
2632
2645
 
2633
- const sourceAttachments = [
2634
- {
2635
- id: "file-001",
2636
- name: "RuleBook.json",
2637
- gcsUrl: "gs://bucket/rulebook.json",
2638
- is_guideline_file: true,
2639
- },
2640
- ];
2646
+ <RuleBookCitationWrapper
2647
+ data={{
2648
+ citationNumber: 1,
2649
+ }}
2650
+ msg={message}
2651
+ guidelines={guidelines}
2652
+ getSignedUrl={getSignedUrl}
2653
+ getFileContent={getFileContent}
2654
+ />
2655
+ ```
2656
+
2657
+ ---
2641
2658
 
2659
+ #### Using Direct File Details
2660
+
2661
+ If the citation metadata is already available, it can be passed directly:
2662
+
2663
+ ```tsx
2642
2664
  <RuleBookCitationWrapper
2643
- requestId="citation-request-id"
2644
- citationIndex={0}
2645
- accessToken="access-token"
2646
- sourceAttachments={sourceAttachments}
2665
+ data={{
2666
+ citationNumber: 1,
2667
+ fileDetails: {
2668
+ file_id: "rulebook-file-id",
2669
+ phrase_to_highlight: "Expected Behaviour",
2670
+ },
2671
+ }}
2672
+ guidelines={guidelines}
2673
+ getSignedUrl={getSignedUrl}
2674
+ getFileContent={getFileContent}
2647
2675
  />
2648
2676
  ```
2649
2677
 
2678
+ In this case, the component skips citation lookup from `msg` and directly loads the corresponding Rule Book file.
2679
+
2650
2680
  ### Props
2651
2681
 
2652
- ### `RuleBookCitationWrapperProps`
2682
+ #### `RuleBookCitationWrapperProps`
2653
2683
 
2654
2684
  | Prop | Type | Default | Description |
2655
- |---|---|---|---|
2656
- | `requestId` | `string \| null` | `undefined` | Identifier used to fetch citation metadata |
2657
- | `citationIndex` | `number` | `0` | Index of the citation to display |
2658
- | `accessToken` | `string` | | Authentication token used for citation API requests |
2659
- | `sourceAttachments` | `SourceAttachment[] \| Record<string, SourceAttachment[]>` | `[]` | Source files containing Rule Book metadata |
2685
+ |------|------|---------|-------------|
2686
+ | `data` | `RuleBookCitationData` | `undefined` | Citation metadata. If `fileDetails` is provided, citation lookup is skipped. |
2687
+ | `msg` | `any` | `undefined` | Message object containing `artifactSearchData.ruleBookData.rulebook_citations`. Used when `fileDetails` is absent. |
2688
+ | `citationIndex` | `number` | `undefined` | Optional fallback citation index when `data.citationNumber` is unavailable. |
2689
+ | `guidelines` | `Guidelines` | `[]` | Guideline attachments used to locate the Rule Book file. |
2690
+ | `additionalClassNames` | `{ container?: string }` | `undefined` | Additional CSS classes applied to the outer container. |
2691
+ | `getSignedUrl` | `(gcsUrl: string) => Promise<SignedUrlResponse>` | `Required` | Consumer-provided function that returns a signed URL response. |
2692
+ | `getFileContent` | `(filePath: string) => Promise<string>` | `Required` | Consumer-provided function that returns the JSON file contents. |
2693
+ | `themeTokens` | `RuleBookCitationThemeTokens` | `undefined` | CSS custom properties used for theming. |
2694
+ | `classNames` | `RuleBookCitationClassNames` | `undefined` | Custom CSS classes for internal elements. |
2695
+ | `styles` | `RuleBookCitationStyles` | `undefined` | Inline style overrides for internal elements. |
2696
+
2697
+ ---
2698
+
2699
+ ### RuleBookCitationData
2700
+
2701
+ | Property | Type | Description |
2702
+ |----------|------|-------------|
2703
+ | `citationNumber` | `number` | Citation number (1-based). Internally converted to a zero-based index. |
2704
+ | `fileDetails.file_id` | `string` | File identifier corresponding to a guideline attachment. |
2705
+ | `fileDetails.phrase_to_highlight` | `string` | Phrase highlighted inside the Rule Book content. |
2706
+
2707
+ ---
2708
+
2709
+ ### Guidelines
2710
+
2711
+ The component supports both of the following formats:
2712
+
2713
+ ```ts
2714
+ type Guidelines =
2715
+ | SourceAttachment[]
2716
+ | Record<string, SourceAttachment[]>;
2717
+ ```
2660
2718
 
2661
2719
  ---
2662
2720
 
2663
2721
  ### SourceAttachment
2664
2722
 
2665
- | Prop | Type | Description |
2666
- |---|---|---|
2667
- | `id` | `string` | File identifier matching citation `file_id` |
2668
- | `gcsUrl` | `string` | GCS location of the Rule Book file |
2669
- | `name` | `string` | Optional file name |
2670
- | `is_guideline_file` | `boolean` | Indicates whether the file contains guideline/rule book content |
2723
+ | Property | Type | Description |
2724
+ |----------|------|-------------|
2725
+ | `id` | `string` | Unique identifier matching the citation `file_id`. |
2726
+ | `gcsUrl` | `string` | GCS path of the Rule Book file. |
2727
+ | `name` | `string` | File name used to determine the file extension. |
2728
+ | `is_guideline_file` | `boolean` | Indicates whether the attachment is a guideline file. |
2671
2729
 
2672
2730
  ---
2673
2731
 
2732
+ ### Notes
2733
+ - `url` is no longer required
2734
+ - The component no longer makes network calls directly
2735
+ - Signed URL resolution and file content fetching must be provided through `getSignedUrl` and `getFileContent`
2736
+ - Theming can also be applied to the nested `TextualGuideLinesComponent` through `themeTokens`, `classNames`, and `styles`
2737
+
2674
2738
  ## SplitterCitationsComponent
2675
2739
 
2676
2740
  A responsive, draggable split-pane layout component for React. Renders two panels side-by-side (horizontal) or stacked (vertical) with a draggable divider. Automatically switches to vertical layout when the container is narrower than 500 px. Supports panel collapse/expand and an optional header with a confidence score badge.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),s=require("react"),i=require("lucide-react"),t=require("./CognitiveNonWebSearchReasoning.module.css.js"),a=function(s){return s.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(s,i){return s.startsWith("**")&&s.endsWith("**")||s.startsWith("__")&&s.endsWith("__")?n.jsx("strong",e.__assign({className:t.default.boldText},{children:s.slice(2,-2)}),i):s})};exports.default=function(l){var r=l.item,o=l.headerTitle;l.index;var d=l.iconsConfig,c=l.DocumentTitle,u=l.previewCallback,h=l.bodyHeight,g=l.disableMaximize,f=void 0!==g&&g,x=l.splitterCustomStyle,_=void 0!==x&&x,m=r.dataSource,p=r.confidence_score,v=r.trainingDataTitle,j=null==d?void 0:d.ChevronDownIcon,b=null==d?void 0:d.ChevronUpIcon,N=null==d?void 0:d.MaximizeIcon,C=null==d?void 0:d.CloseIcon,y=s.useMemo(function(){var n=(m?m.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),s=0,i=n.map(function(e){var n=e.startsWith("<highlight>"),i={text:n?e.replace(/<\/?highlight>/g,""):e,isHighlight:n,highlightIndex:n?s:-1};return n&&s++,i}),t=i.filter(function(e){return e.isHighlight}).length,a=[],l=[];return i.forEach(function(n){var s=n.text,i=n.isHighlight,t=n.highlightIndex;s.split("\n").forEach(function(n,s){s>0&&((l.length>0||a.length>0)&&a.push(e.__spreadArray([],l,!0)),l=[]),n&&l.push({text:n,isHighlight:i,highlightIndex:t})})}),l.length>0&&a.push(e.__spreadArray([],l,!0)),{processedLines:a.map(function(e){var n=e.map(function(e){return e.text}).join(""),s=n.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:e,isListItem:!!s,isHeader:!!n.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==s?void 0:s[1])||"",content:(null==s?void 0:s[3])||n}}),totalHighlights:t}},[m]),I=y.processedLines,k=y.totalHighlights,w=s.useState(0),H=w[0],T=w[1],L=s.useRef(null),z=s.useRef(null),R=s.useRef(null),S=s.useRef([]),D=s.useRef([]);s.useEffect(function(){S.current=S.current.slice(0,k),D.current=D.current.slice(0,k)},[k]),s.useEffect(function(){if(k>0){T(0);var e=setTimeout(function(){var e;null===(e=S.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(e)}}},[k]);var B=function(e,n){setTimeout(function(){var s=n?D.current[e]:S.current[e];null==s||s.scrollIntoView({behavior:"smooth",block:"center"})},50)},F=function(e){if(void 0===e&&(e=!1),k){var n=H>0?H-1:k-1;T(n),B(n,e)}},A=function(e){if(void 0===e&&(e=!1),k){var n=H<k-1?H+1:0;T(n),B(n,e)}},E=function(s){var i=s?D:S,l=0;return I.map(function(s,r){s.isHeader&&(l=0),s.isListItem&&(l+=1);var o=function(){return s.segments.map(function(l,r){var o=l.isHighlight&&l.highlightIndex===H,d=l.text;return s.isListItem&&0===r&&(d=l.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),l.isHighlight?n.jsx("span",e.__assign({ref:function(e){e&&(i.current[l.highlightIndex]=e)},className:"".concat(t.default.highlight).concat(o?" ".concat(t.default.highlightActive):"")},{children:a(d)}),r):n.jsx("span",{children:a(d)},r)})};return s.isHeader?n.jsx("span",e.__assign({className:t.default.headerLine},{children:o()}),r):s.isListItem?n.jsxs("span",e.__assign({className:t.default.listItemLine,style:{paddingLeft:s.indent?"1rem":"0"}},{children:[n.jsxs("span",e.__assign({className:t.default.listCounter},{children:[l,"."]})),n.jsx("span",{children:o()})]}),r):n.jsx("span",e.__assign({className:t.default.blockLine},{children:o()}),r)})},W=function(s){return k>1?n.jsxs("div",e.__assign({className:s?t.default.modalNavContainer:t.default.navigationContainer},{children:[b&&n.jsx("button",e.__assign({onClick:function(){return F(s)},className:s?t.default.modalNavButton:t.default.navButton},{children:n.jsx(b,{className:t.default.navIcon})})),n.jsxs("span",e.__assign({className:t.default.navCounter},{children:[H+1,"/",k]})),j&&n.jsx("button",e.__assign({onClick:function(){return A(s)},className:s?t.default.modalNavButton:t.default.navButton},{children:n.jsx(j,{className:t.default.navIcon})}))]})):null},q=null!=p?n.jsxs("span",e.__assign({className:t.default.confidenceBadge},{children:[n.jsx("span",e.__assign({className:t.default.confidenceStar},{children:"✦"})),n.jsxs("span",e.__assign({className:t.default.confidenceScore},{children:[p,"%"]}))]})):null,M=_?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,U=n.jsxs(n.Fragment,{children:[v&&n.jsx("div",e.__assign({className:t.default.footer,style:M},{children:n.jsx("span",e.__assign({className:t.default.trainingTitle},{children:v}))})),c&&n.jsx("div",e.__assign({className:t.default.modalFooterSource,style:M},{children:n.jsxs("button",e.__assign({type:"button",onClick:function(){return null==u?void 0:u()},className:t.default.trainingTitleLink},{children:[c,n.jsx(i.ExternalLink,{size:16,color:"#2563eb"})]}))}))]});return n.jsxs(n.Fragment,{children:[n.jsxs("div",e.__assign({className:t.default.expandedContainer,style:e.__assign(e.__assign({},h?{height:"".concat(h),display:"flex",flexDirection:"column"}:void 0),_?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0)},{children:[n.jsxs("div",e.__assign({className:t.default.expandedHeader,style:_?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0},{children:[n.jsx("span",e.__assign({className:t.default.headerTitle},{children:o})),n.jsxs("div",e.__assign({className:t.default.headerActions},{children:[_?k>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[H+1," / ",k]})),n.jsx("button",e.__assign({onClick:function(){return F(!0)},disabled:H<=0,style:{padding:"2px 4px",cursor:H<=0?"not-allowed":"pointer",opacity:H<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){return A(!0)},disabled:H>=k-1,style:{padding:"2px 4px",cursor:H>=k-1?"not-allowed":"pointer",opacity:H>=k-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronDown,{size:14,color:"#64748b"})}))]}):W(!0),q,!f&&N&&n.jsx("button",e.__assign({onClick:function(){var e;return null===(e=R.current)||void 0===e?void 0:e.showModal()},className:t.default.maximizeButton,title:"View fullscreen"},{children:n.jsx(N,{className:t.default.maximizeIcon})}))]}))]})),n.jsx("div",e.__assign({ref:L,className:t.default.contentArea,style:e.__assign(e.__assign({},h?{flex:1,maxHeight:"none",overflowY:"auto",minHeight:0}:void 0),_?{padding:"1rem 1.5rem"}:void 0)},{children:n.jsx("div",e.__assign({className:t.default.contentInner},{children:E(!1)}))})),U]})),!f&&n.jsx("dialog",e.__assign({ref:R,className:t.default.modalDialog,onClick:function(e){var n;e.target===R.current&&(null===(n=R.current)||void 0===n||n.close())}},{children:n.jsxs("div",e.__assign({className:t.default.modalContainer},{children:[n.jsxs("div",e.__assign({className:t.default.modalHeader},{children:[n.jsx("span",e.__assign({className:t.default.modalHeaderTitle},{children:o})),n.jsxs("div",e.__assign({className:t.default.modalHeaderActions},{children:[_?k>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[H+1," / ",k]})),"just chill",n.jsx("button",e.__assign({onClick:function(){return F(!0)},disabled:H<=0,style:{padding:"2px 4px",cursor:H<=0?"not-allowed":"pointer",opacity:H<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){return A(!0)},disabled:H>=k-1,style:{padding:"2px 4px",cursor:H>=k-1?"not-allowed":"pointer",opacity:H>=k-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronDown,{size:14,color:"#64748b"})}))]}):W(!0),q,C&&n.jsx("button",e.__assign({onClick:function(){var e;return null===(e=R.current)||void 0===e?void 0:e.close()},className:t.default.closeButton,title:"Close"},{children:n.jsx(C,{className:t.default.closeIcon})}))]}))]})),n.jsx("div",e.__assign({ref:z,className:t.default.modalContent},{children:n.jsx("div",e.__assign({className:t.default.modalContentInner},{children:E(!0)}))})),v&&n.jsx("div",e.__assign({className:t.default.modalFooter},{children:n.jsx("span",e.__assign({className:t.default.trainingTitle},{children:v}))})),c&&n.jsx("div",e.__assign({className:t.default.modalFooterSource},{children:n.jsxs("button",e.__assign({type:"button",onClick:function(){var e;null==u||u(),null===(e=R.current)||void 0===e||e.close()},className:t.default.trainingTitleLink},{children:[c,n.jsx(i.ExternalLink,{size:16,color:"#2563eb"})]}))}))]}))}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),l=require("lucide-react"),t=require("./CognitiveNonWebSearchReasoning.module.css.js"),s=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.filter(Boolean).join(" ")},a=function(i){return i.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(i,l){return i.startsWith("**")&&i.endsWith("**")||i.startsWith("__")&&i.endsWith("__")?e.jsx("strong",n.__assign({className:t.default.boldText},{children:i.slice(2,-2)}),l):i})};exports.default=function(o){var d=o.item,r=o.headerTitle;o.index;var u=o.iconsConfig,c=o.DocumentTitle,v=o.previewCallback,g=o.bodyHeight,h=o.disableMaximize,m=void 0!==h&&h,_=o.splitterCustomStyle,f=void 0!==_&&_,x=o.themeTokens,p=o.classNames,j=o.styles,y=d.dataSource,b=d.confidence_score,C=d.trainingDataTitle,N=null==u?void 0:u.ChevronDownIcon,I=null==u?void 0:u.ChevronUpIcon,k=null==u?void 0:u.MaximizeIcon,T=null==u?void 0:u.CloseIcon,H=i.useMemo(function(){var e=(y?y.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),i=0,l=e.map(function(n){var e=n.startsWith("<highlight>"),l={text:e?n.replace(/<\/?highlight>/g,""):n,isHighlight:e,highlightIndex:e?i:-1};return e&&i++,l}),t=l.filter(function(n){return n.isHighlight}).length,s=[],a=[];return l.forEach(function(e){var i=e.text,l=e.isHighlight,t=e.highlightIndex;i.split("\n").forEach(function(e,i){i>0&&((a.length>0||s.length>0)&&s.push(n.__spreadArray([],a,!0)),a=[]),e&&a.push({text:e,isHighlight:l,highlightIndex:t})})}),a.length>0&&s.push(n.__spreadArray([],a,!0)),{processedLines:s.map(function(n){var e=n.map(function(n){return n.text}).join(""),i=e.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:n,isListItem:!!i,isHeader:!!e.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==i?void 0:i[1])||"",content:(null==i?void 0:i[3])||e}}),totalHighlights:t}},[y]),L=H.processedLines,w=H.totalHighlights,B=i.useState(0),S=B[0],z=B[1],A=i.useRef(null),F=i.useRef(null),R=i.useRef(null),D=i.useRef([]),E=i.useRef([]);i.useEffect(function(){D.current=D.current.slice(0,w),E.current=E.current.slice(0,w)},[w]),i.useEffect(function(){if(w>0){z(0);var n=setTimeout(function(){var n;null===(n=D.current[0])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(n)}}},[w]);var W=function(n,e){setTimeout(function(){var i=e?E.current[n]:D.current[n];null==i||i.scrollIntoView({behavior:"smooth",block:"center"})},50)},q=function(n){if(void 0===n&&(n=!1),w){var e=S>0?S-1:w-1;z(e),W(e,n)}},M=function(n){if(void 0===n&&(n=!1),w){var e=S<w-1?S+1:0;z(e),W(e,n)}},U=function(i){var l=i?E:D,o=0;return L.map(function(i,d){i.isHeader&&(o=0),i.isListItem&&(o+=1);var r=function(){return i.segments.map(function(o,d){var r=o.isHighlight&&o.highlightIndex===S,u=o.text;return i.isListItem&&0===d&&(u=o.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),o.isHighlight?e.jsx("span",n.__assign({ref:function(n){n&&(l.current[o.highlightIndex]=n)},className:s(t.default.highlight,r?t.default.highlightActive:void 0,null==p?void 0:p.highlight,r?null==p?void 0:p.highlightActive:void 0),style:r?n.__assign(n.__assign({},null==j?void 0:j.highlight),null==j?void 0:j.highlightActive):null==j?void 0:j.highlight},{children:a(u)}),d):e.jsx("span",{children:a(u)},d)})};return i.isHeader?e.jsx("span",n.__assign({className:s(t.default.headerLine,null==p?void 0:p.headerLine),style:null==j?void 0:j.headerLine},{children:r()}),d):i.isListItem?e.jsxs("span",n.__assign({className:s(t.default.listItemLine,null==p?void 0:p.listItemLine),style:n.__assign({paddingLeft:i.indent?"1rem":"0"},null==j?void 0:j.listItemLine)},{children:[e.jsxs("span",n.__assign({className:s(t.default.listCounter,null==p?void 0:p.listCounter),style:null==j?void 0:j.listCounter},{children:[o,"."]})),e.jsx("span",{children:r()})]}),d):e.jsx("span",n.__assign({className:s(t.default.blockLine,null==p?void 0:p.blockLine),style:null==j?void 0:j.blockLine},{children:r()}),d)})},V=function(i){return w>1?e.jsxs("div",n.__assign({className:s(i?t.default.modalNavContainer:t.default.navigationContainer,i?null==p?void 0:p.modalNavContainer:null==p?void 0:p.navigationContainer),style:i?null==j?void 0:j.modalNavContainer:null==j?void 0:j.navigationContainer},{children:[I&&e.jsx("button",n.__assign({onClick:function(){return q(i)},className:s(i?t.default.modalNavButton:t.default.navButton,null==p?void 0:p.navButton),style:null==j?void 0:j.navButton},{children:e.jsx(I,{className:s(t.default.navIcon,null==p?void 0:p.navIcon),style:null==j?void 0:j.navIcon})})),e.jsxs("span",n.__assign({className:s(t.default.navCounter,null==p?void 0:p.navCounter),style:null==j?void 0:j.navCounter},{children:[S+1,"/",w]})),N&&e.jsx("button",n.__assign({onClick:function(){return M(i)},className:s(i?t.default.modalNavButton:t.default.navButton,null==p?void 0:p.navButton),style:null==j?void 0:j.navButton},{children:e.jsx(N,{className:s(t.default.navIcon,null==p?void 0:p.navIcon),style:null==j?void 0:j.navIcon})}))]})):null},$=null!=b?e.jsxs("span",n.__assign({className:s(t.default.confidenceBadge,null==p?void 0:p.confidenceBadge),style:null==j?void 0:j.confidenceBadge},{children:[e.jsx("span",n.__assign({className:t.default.confidenceStar},{children:"✦"})),e.jsxs("span",n.__assign({className:t.default.confidenceScore},{children:[b,"%"]}))]})):null,O=f?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,P=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",n.__assign({className:s(t.default.footer,null==p?void 0:p.footer),style:n.__assign(n.__assign({},O),null==j?void 0:j.footer)},{children:e.jsx("span",n.__assign({className:s(t.default.trainingTitle,null==p?void 0:p.trainingTitle),style:null==j?void 0:j.trainingTitle},{children:C}))})),c&&e.jsx("div",n.__assign({className:s(t.default.modalFooterSource,null==p?void 0:p.modalFooterSource),style:n.__assign(n.__assign({},O),null==j?void 0:j.modalFooterSource)},{children:e.jsxs("button",n.__assign({type:"button",onClick:function(){return null==v?void 0:v()},className:s(t.default.trainingTitleLink,null==p?void 0:p.trainingTitleLink),style:null==j?void 0:j.trainingTitleLink},{children:[c,e.jsx(l.ExternalLink,{size:16,color:"#2563eb"})]}))}))]});return e.jsxs(e.Fragment,{children:[e.jsxs("div",n.__assign({className:s(t.default.expandedContainer,null==p?void 0:p.expandedContainer),style:n.__assign(n.__assign(n.__assign(n.__assign({},x),g?{height:"".concat(g),display:"flex",flexDirection:"column"}:void 0),f?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0),null==j?void 0:j.expandedContainer)},{children:[e.jsxs("div",n.__assign({className:s(t.default.expandedHeader,null==p?void 0:p.expandedHeader),style:n.__assign(n.__assign({},f?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0),null==j?void 0:j.expandedHeader)},{children:[e.jsx("span",n.__assign({className:s(t.default.headerTitle,null==p?void 0:p.headerTitle),style:null==j?void 0:j.headerTitle},{children:r})),e.jsxs("div",n.__assign({className:s(t.default.headerActions,null==p?void 0:p.headerActions),style:null==j?void 0:j.headerActions},{children:[f?w>1&&e.jsxs(e.Fragment,{children:[e.jsxs("span",n.__assign({style:{fontSize:"12px",color:"#888"}},{children:[S+1," / ",w]})),e.jsx("button",n.__assign({onClick:function(){return q(!0)},disabled:S<=0,style:{padding:"2px 4px",cursor:S<=0?"not-allowed":"pointer",opacity:S<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e.jsx(l.ChevronUp,{size:14,color:"#64748b"})})),e.jsx("button",n.__assign({onClick:function(){return M(!0)},disabled:S>=w-1,style:{padding:"2px 4px",cursor:S>=w-1?"not-allowed":"pointer",opacity:S>=w-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e.jsx(l.ChevronDown,{size:14,color:"#64748b"})}))]}):V(!1),$,!m&&k&&e.jsx("button",n.__assign({onClick:function(){var n;return null===(n=R.current)||void 0===n?void 0:n.showModal()},className:s(t.default.maximizeButton,null==p?void 0:p.maximizeButton),style:null==j?void 0:j.maximizeButton,title:"View fullscreen"},{children:e.jsx(k,{className:t.default.maximizeIcon})}))]}))]})),e.jsx("div",n.__assign({ref:A,className:s(t.default.contentArea,null==p?void 0:p.contentArea),style:n.__assign(n.__assign(n.__assign({},g?{flex:1,maxHeight:"none",overflowY:"auto",minHeight:0}:void 0),f?{padding:"1rem 1.5rem"}:void 0),null==j?void 0:j.contentArea)},{children:e.jsx("div",n.__assign({className:s(t.default.contentInner,null==p?void 0:p.contentInner),style:null==j?void 0:j.contentInner},{children:U(!1)}))})),P]})),!m&&e.jsx("dialog",n.__assign({ref:R,className:t.default.modalDialog,onClick:function(n){var e;n.target===R.current&&(null===(e=R.current)||void 0===e||e.close())}},{children:e.jsxs("div",n.__assign({className:s(t.default.modalContainer,null==p?void 0:p.modalContainer),style:null==j?void 0:j.modalContainer},{children:[e.jsxs("div",n.__assign({className:s(t.default.modalHeader,null==p?void 0:p.modalHeader),style:null==j?void 0:j.modalHeader},{children:[e.jsx("span",n.__assign({className:s(t.default.modalHeaderTitle,null==p?void 0:p.modalHeaderTitle),style:null==j?void 0:j.modalHeaderTitle},{children:r})),e.jsxs("div",n.__assign({className:s(t.default.modalHeaderActions,null==p?void 0:p.modalHeaderActions),style:null==j?void 0:j.modalHeaderActions},{children:[f?w>1&&e.jsxs(e.Fragment,{children:[e.jsxs("span",n.__assign({style:{fontSize:"12px",color:"#888"}},{children:[S+1," / ",w]})),e.jsx("button",n.__assign({onClick:function(){return q(!0)},disabled:S<=0,style:{padding:"2px 4px",cursor:S<=0?"not-allowed":"pointer",opacity:S<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e.jsx(l.ChevronUp,{size:14,color:"#64748b"})})),e.jsx("button",n.__assign({onClick:function(){return M(!0)},disabled:S>=w-1,style:{padding:"2px 4px",cursor:S>=w-1?"not-allowed":"pointer",opacity:S>=w-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e.jsx(l.ChevronDown,{size:14,color:"#64748b"})}))]}):V(!0),$,T&&e.jsx("button",n.__assign({onClick:function(){var n;return null===(n=R.current)||void 0===n?void 0:n.close()},className:s(t.default.closeButton,null==p?void 0:p.closeButton),style:null==j?void 0:j.closeButton,title:"Close"},{children:e.jsx(T,{className:s(t.default.closeIcon,null==p?void 0:p.closeIcon),style:null==j?void 0:j.closeIcon})}))]}))]})),e.jsx("div",n.__assign({ref:F,className:s(t.default.modalContent,null==p?void 0:p.modalContent),style:null==j?void 0:j.modalContent},{children:e.jsx("div",n.__assign({className:s(t.default.modalContentInner,null==p?void 0:p.modalContentInner),style:null==j?void 0:j.modalContentInner},{children:U(!0)}))})),C&&e.jsx("div",n.__assign({className:s(t.default.modalFooter,null==p?void 0:p.modalFooter),style:null==j?void 0:j.modalFooter},{children:e.jsx("span",n.__assign({className:s(t.default.trainingTitle,null==p?void 0:p.trainingTitle),style:null==j?void 0:j.trainingTitle},{children:C}))})),c&&e.jsx("div",n.__assign({className:s(t.default.modalFooterSource,null==p?void 0:p.modalFooterSource),style:null==j?void 0:j.modalFooterSource},{children:e.jsxs("button",n.__assign({type:"button",onClick:function(){var n;null==v||v(),null===(n=R.current)||void 0===n||n.close()},className:s(t.default.trainingTitleLink,null==p?void 0:p.trainingTitleLink),style:null==j?void 0:j.trainingTitleLink},{children:[c,e.jsx(l.ExternalLink,{size:16,color:"#2563eb"})]}))}))]}))}))]})};
2
2
  //# sourceMappingURL=CognitiveInternalgptCoreComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const o=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;o&&e.setAttribute("nonce",o),e.appendChild(document.createTextNode(".CognitiveNonWebSearchReasoning-module_container__koQEN{display:flex;flex-direction:column;gap:.5rem}.CognitiveNonWebSearchReasoning-module_itemRow__lRmgs{align-items:flex-start;display:flex;font-size:.875rem;gap:.5rem}.CognitiveNonWebSearchReasoning-module_indexNumber__wP5hg{color:#475467;font-weight:500}.CognitiveNonWebSearchReasoning-module_textContent__327fx{color:#475467;flex:1;max-width:none}.CognitiveNonWebSearchReasoning-module_paraphraseButton__VS6Qe{align-items:center;background:#0000;border:none;border-radius:.375rem;cursor:pointer;display:inline-flex;gap:.25rem;justify-content:flex-start;padding:.125rem .375rem}.CognitiveNonWebSearchReasoning-module_paraphraseText__n5dty{color:#2563eb;font-weight:500;text-align:start}.CognitiveNonWebSearchReasoning-module_paraphraseStar__YUnqR{color:#2563eb;padding-right:.25rem}.CognitiveNonWebSearchReasoning-module_chevronIcon__ZeXjw{color:#2563eb;height:1rem;transition:transform .2s;width:1rem}.CognitiveNonWebSearchReasoning-module_chevronIconRotated__WkRiP{transform:rotate(180deg)}.CognitiveNonWebSearchReasoning-module_expandedContainer__2UPr9{border:solid #e5e7eb;border-radius:.5rem;border-width:1px 1px 2px;margin-left:1.5rem;margin-top:.5rem;overflow:hidden}.CognitiveNonWebSearchReasoning-module_expandedHeader__QjKjb{align-items:center;background-color:#f2f4f7;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;padding:.25rem .75rem}.CognitiveNonWebSearchReasoning-module_headerTitle__VvMwI{font-size:.875rem;font-weight:400}.CognitiveNonWebSearchReasoning-module_headerActions__j1P4u{align-items:center;display:flex;gap:.5rem}.CognitiveNonWebSearchReasoning-module_navigationContainer__G0VtG{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:.5rem;display:flex;padding:.25rem}.CognitiveNonWebSearchReasoning-module_navButton__aOaMv{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_navButton__aOaMv:hover{background-color:#f3f4f6}.CognitiveNonWebSearchReasoning-module_navIcon__uLme4{color:#6b7280;height:1.25rem;width:1.25rem}.CognitiveNonWebSearchReasoning-module_navCounter__nj1Xc{color:#4b5563;font-size:.875rem;min-width:2.25rem;text-align:center}.CognitiveNonWebSearchReasoning-module_confidenceBadge__-ElB3{align-items:center;background-color:#f0fdf4;border:2px solid #3ac894;border-radius:9999px;display:inline-flex;gap:.25rem;padding:.25rem .5rem}.CognitiveNonWebSearchReasoning-module_confidenceStar__4Rq0S{color:#059669;font-size:.75rem}.CognitiveNonWebSearchReasoning-module_confidenceScore__uLcnK{color:#059669;font-size:.875rem;font-weight:600}.CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-:hover{background-color:#e5e7eb}.CognitiveNonWebSearchReasoning-module_maximizeIcon__eFZez{color:#6b7280;height:1.25rem;width:1.25rem}.CognitiveNonWebSearchReasoning-module_contentArea__hVoLL{font-size:.875rem;max-height:11rem;overflow-y:auto;padding:.5rem .75rem;scroll-behavior:smooth}.CognitiveNonWebSearchReasoning-module_contentInner__df-34{line-height:1.5rem}.CognitiveNonWebSearchReasoning-module_footer__CNE8q{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end}.CognitiveNonWebSearchReasoning-module_trainingTitle__CHFlh{font-size:.875rem;font-style:italic;font-weight:300}.CognitiveNonWebSearchReasoning-module_trainingTitleLink__0lu-U{align-items:center;background:none;border:none;cursor:pointer;display:inline-flex;font-size:.8rem;font-weight:600;gap:.25rem}.CognitiveNonWebSearchReasoning-module_modalDialog__eGApe{background:#0000;border:none;left:50%;margin:0;max-height:none;max-width:none;overflow:visible;padding:0;position:fixed;top:50%;transform:translate(-50%,-50%)}.CognitiveNonWebSearchReasoning-module_modalDialog__eGApe::backdrop{background-color:#0006}.CognitiveNonWebSearchReasoning-module_modalContainer__-dZ01{background-color:#fff;border-radius:.75rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-height:80vh;max-width:900px;overflow:hidden;width:80vw}.CognitiveNonWebSearchReasoning-module_modalHeader__qglof{align-items:center;background-color:#f2f4f7;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;padding:.75rem .5rem .75rem 1rem;width:100%}.CognitiveNonWebSearchReasoning-module_modalHeaderTitle__hDo1X{font-size:1rem;font-weight:500}.CognitiveNonWebSearchReasoning-module_modalHeaderActions__NGmip{align-items:center;display:flex;gap:.5rem}.CognitiveNonWebSearchReasoning-module_modalNavContainer__Q-OrP{align-items:center;background-color:#f3f4f6;border:1px solid #e5e7eb;border-radius:.5rem;display:flex;padding:.25rem}.CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24:hover{background-color:#e5e7eb}.CognitiveNonWebSearchReasoning-module_closeButton__S23zi{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_closeButton__S23zi:hover{background-color:#e5e7eb}.CognitiveNonWebSearchReasoning-module_closeIcon__f7kaG{color:#4b5563;height:1.25rem;width:1.25rem}.CognitiveNonWebSearchReasoning-module_modalContent__4U2Jv{flex:1;font-size:.875rem;overflow-y:auto;padding:.75rem 1rem;scroll-behavior:smooth}.CognitiveNonWebSearchReasoning-module_modalContentInner__63tzo{line-height:1.75rem}.CognitiveNonWebSearchReasoning-module_modalFooter__hXBqn{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;flex-shrink:0;justify-content:flex-end;padding:.5rem 1rem}.CognitiveNonWebSearchReasoning-module_modalFooterSource__MOlgt{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;flex-shrink:0;justify-content:flex-start;padding:1rem}.CognitiveNonWebSearchReasoning-module_blockLine__FwGYE{display:block}.CognitiveNonWebSearchReasoning-module_headerLine__0j5p4{display:block;font-weight:400}.CognitiveNonWebSearchReasoning-module_listItemLine__yKx2O{display:block}.CognitiveNonWebSearchReasoning-module_listCounter__esNpx{display:inline-block;font-weight:500;text-align:left;width:1.5rem}.CognitiveNonWebSearchReasoning-module_boldText__suAp2{font-weight:600}.CognitiveNonWebSearchReasoning-module_highlight__EMAz5{background-color:#fef08a;border-radius:.25rem;padding:0 .125rem;transition:all .2s}.CognitiveNonWebSearchReasoning-module_highlightActive__FFvuU{background-color:#fde047;border:1px solid #eab308;box-shadow:0 1px 2px 0 #0000000d}.CognitiveNonWebSearchReasoning-module_highlightActiveVariant__-gqMp{background-color:#e0e7ff;border:1px solid #5c75f4;box-shadow:0 1px 2px 0 #0000000d;color:#6366f1;font-weight:500}.CognitiveNonWebSearchReasoning-module_highlightVariant__PYgtJ{background-color:#eef2ff;border-radius:.25rem;color:#6366f1;font-weight:500;padding:0 .125rem;transition:all .2s}.CognitiveNonWebSearchReasoning-module_highlightButton__XvkBb{border:none;cursor:pointer;display:inline;font:inherit}"));const n=document.head||document.getElementsByTagName("head")[0]||document.documentElement;n&&n.appendChild(e)}(),exports.default={container:"CognitiveNonWebSearchReasoning-module_container__koQEN",itemRow:"CognitiveNonWebSearchReasoning-module_itemRow__lRmgs",indexNumber:"CognitiveNonWebSearchReasoning-module_indexNumber__wP5hg",textContent:"CognitiveNonWebSearchReasoning-module_textContent__327fx",paraphraseButton:"CognitiveNonWebSearchReasoning-module_paraphraseButton__VS6Qe",paraphraseText:"CognitiveNonWebSearchReasoning-module_paraphraseText__n5dty",paraphraseStar:"CognitiveNonWebSearchReasoning-module_paraphraseStar__YUnqR",chevronIcon:"CognitiveNonWebSearchReasoning-module_chevronIcon__ZeXjw",chevronIconRotated:"CognitiveNonWebSearchReasoning-module_chevronIconRotated__WkRiP",expandedContainer:"CognitiveNonWebSearchReasoning-module_expandedContainer__2UPr9",expandedHeader:"CognitiveNonWebSearchReasoning-module_expandedHeader__QjKjb",headerTitle:"CognitiveNonWebSearchReasoning-module_headerTitle__VvMwI",headerActions:"CognitiveNonWebSearchReasoning-module_headerActions__j1P4u",navigationContainer:"CognitiveNonWebSearchReasoning-module_navigationContainer__G0VtG",navButton:"CognitiveNonWebSearchReasoning-module_navButton__aOaMv",navIcon:"CognitiveNonWebSearchReasoning-module_navIcon__uLme4",navCounter:"CognitiveNonWebSearchReasoning-module_navCounter__nj1Xc",confidenceBadge:"CognitiveNonWebSearchReasoning-module_confidenceBadge__-ElB3",confidenceStar:"CognitiveNonWebSearchReasoning-module_confidenceStar__4Rq0S",confidenceScore:"CognitiveNonWebSearchReasoning-module_confidenceScore__uLcnK",maximizeButton:"CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-",maximizeIcon:"CognitiveNonWebSearchReasoning-module_maximizeIcon__eFZez",contentArea:"CognitiveNonWebSearchReasoning-module_contentArea__hVoLL",contentInner:"CognitiveNonWebSearchReasoning-module_contentInner__df-34",footer:"CognitiveNonWebSearchReasoning-module_footer__CNE8q",trainingTitle:"CognitiveNonWebSearchReasoning-module_trainingTitle__CHFlh",trainingTitleLink:"CognitiveNonWebSearchReasoning-module_trainingTitleLink__0lu-U",modalDialog:"CognitiveNonWebSearchReasoning-module_modalDialog__eGApe",modalContainer:"CognitiveNonWebSearchReasoning-module_modalContainer__-dZ01",modalHeader:"CognitiveNonWebSearchReasoning-module_modalHeader__qglof",modalHeaderTitle:"CognitiveNonWebSearchReasoning-module_modalHeaderTitle__hDo1X",modalHeaderActions:"CognitiveNonWebSearchReasoning-module_modalHeaderActions__NGmip",modalNavContainer:"CognitiveNonWebSearchReasoning-module_modalNavContainer__Q-OrP",modalNavButton:"CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24",closeButton:"CognitiveNonWebSearchReasoning-module_closeButton__S23zi",closeIcon:"CognitiveNonWebSearchReasoning-module_closeIcon__f7kaG",modalContent:"CognitiveNonWebSearchReasoning-module_modalContent__4U2Jv",modalContentInner:"CognitiveNonWebSearchReasoning-module_modalContentInner__63tzo",modalFooter:"CognitiveNonWebSearchReasoning-module_modalFooter__hXBqn",modalFooterSource:"CognitiveNonWebSearchReasoning-module_modalFooterSource__MOlgt",blockLine:"CognitiveNonWebSearchReasoning-module_blockLine__FwGYE",headerLine:"CognitiveNonWebSearchReasoning-module_headerLine__0j5p4",listItemLine:"CognitiveNonWebSearchReasoning-module_listItemLine__yKx2O",listCounter:"CognitiveNonWebSearchReasoning-module_listCounter__esNpx",boldText:"CognitiveNonWebSearchReasoning-module_boldText__suAp2",highlight:"CognitiveNonWebSearchReasoning-module_highlight__EMAz5",highlightActive:"CognitiveNonWebSearchReasoning-module_highlightActive__FFvuU",highlightActiveVariant:"CognitiveNonWebSearchReasoning-module_highlightActiveVariant__-gqMp",highlightVariant:"CognitiveNonWebSearchReasoning-module_highlightVariant__PYgtJ",highlightButton:"CognitiveNonWebSearchReasoning-module_highlightButton__XvkBb"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const o=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;o&&e.setAttribute("nonce",o),e.appendChild(document.createTextNode(".CognitiveNonWebSearchReasoning-module_container__koQEN{display:flex;flex-direction:column;gap:var(--cr-container-gap,.5rem)}.CognitiveNonWebSearchReasoning-module_itemRow__lRmgs{align-items:flex-start;display:flex;font-size:var(--cr-item-row-font-size,.875rem);gap:.5rem}.CognitiveNonWebSearchReasoning-module_indexNumber__wP5hg{color:var(--cr-index-color,#475467);font-weight:var(--cr-index-font-weight,500)}.CognitiveNonWebSearchReasoning-module_textContent__327fx{color:var(--cr-text-content-color,#475467);flex:1;max-width:none}.CognitiveNonWebSearchReasoning-module_paraphraseButton__VS6Qe{align-items:center;background:var(--cr-paraphrase-button-bg,#0000);border:none;border-radius:var(--cr-paraphrase-button-border-radius,.375rem);cursor:pointer;display:inline-flex;gap:.25rem;justify-content:flex-start;padding:.125rem .375rem}.CognitiveNonWebSearchReasoning-module_paraphraseText__n5dty{color:var(--cr-paraphrase-color,#2563eb);font-weight:var(--cr-paraphrase-font-weight,500);text-align:start}.CognitiveNonWebSearchReasoning-module_paraphraseStar__YUnqR{color:var(--cr-paraphrase-color,#2563eb);padding-right:.25rem}.CognitiveNonWebSearchReasoning-module_chevronIcon__ZeXjw{color:var(--cr-chevron-color,#2563eb);height:1rem;transition:transform .2s;width:1rem}.CognitiveNonWebSearchReasoning-module_chevronIconRotated__WkRiP{transform:rotate(180deg)}.CognitiveNonWebSearchReasoning-module_expandedContainer__2UPr9{background-color:var(--cr-expanded-container-bg,#0000);border:solid var(--cr-expanded-container-border,#e5e7eb);border-radius:var(--cr-expanded-container-border-radius,.5rem);border-width:1px 1px 2px;margin-left:var(--cr-expanded-container-margin-left,1.5rem);margin-top:var(--cr-expanded-container-margin-top,.5rem);overflow:hidden}.CognitiveNonWebSearchReasoning-module_expandedHeader__QjKjb{align-items:center;background-color:var(--cr-header-bg,#f2f4f7);border-bottom:1px solid var(--cr-header-border,#e5e7eb);display:flex;justify-content:space-between;padding:var(--cr-header-padding,.25rem .75rem)}.CognitiveNonWebSearchReasoning-module_headerTitle__VvMwI{color:var(--cr-header-title-color,inherit);font-size:var(--cr-header-title-font-size,.875rem);font-weight:var(--cr-header-title-font-weight,400)}.CognitiveNonWebSearchReasoning-module_headerActions__j1P4u{align-items:center;display:flex;gap:.5rem}.CognitiveNonWebSearchReasoning-module_navigationContainer__G0VtG{align-items:center;background-color:var(--cr-nav-container-bg,#fff);border:1px solid var(--cr-nav-container-border,#e5e7eb);border-radius:.5rem;display:flex;padding:.25rem}.CognitiveNonWebSearchReasoning-module_navButton__aOaMv{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_navButton__aOaMv:hover{background-color:var(--cr-nav-button-hover-bg,#f3f4f6)}.CognitiveNonWebSearchReasoning-module_navIcon__uLme4{color:var(--cr-nav-icon-color,#6b7280);height:var(--cr-nav-icon-size,1.25rem);width:var(--cr-nav-icon-size,1.25rem)}.CognitiveNonWebSearchReasoning-module_navCounter__nj1Xc{color:var(--cr-nav-counter-color,#4b5563);font-size:var(--cr-nav-counter-font-size,.875rem);min-width:2.25rem;text-align:center}.CognitiveNonWebSearchReasoning-module_confidenceBadge__-ElB3{align-items:center;background-color:var(--cr-confidence-badge-bg,#f0fdf4);border:2px solid var(--cr-confidence-badge-border,#3ac894);border-radius:9999px;display:inline-flex;gap:.25rem;padding:.25rem .5rem}.CognitiveNonWebSearchReasoning-module_confidenceStar__4Rq0S{color:var(--cr-confidence-star-color,#059669);font-size:.75rem}.CognitiveNonWebSearchReasoning-module_confidenceScore__uLcnK{color:var(--cr-confidence-score-color,#059669);font-size:.875rem;font-weight:600}.CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-:hover{background-color:var(--cr-maximize-button-hover-bg,#e5e7eb)}.CognitiveNonWebSearchReasoning-module_maximizeIcon__eFZez{color:var(--cr-maximize-icon-color,#6b7280);height:1.25rem;width:1.25rem}.CognitiveNonWebSearchReasoning-module_contentArea__hVoLL{background-color:var(--cr-content-area-bg,#0000);color:var(--cr-content-area-color,inherit);font-size:var(--cr-content-area-font-size,.875rem);max-height:var(--cr-content-area-max-height,11rem);overflow-y:auto;padding:var(--cr-content-area-padding,.5rem .75rem);scroll-behavior:smooth}.CognitiveNonWebSearchReasoning-module_contentInner__df-34{line-height:var(--cr-content-line-height,1.5rem)}.CognitiveNonWebSearchReasoning-module_footer__CNE8q{align-items:center;background-color:var(--cr-footer-bg,#f2f4f7);border-top:1px solid var(--cr-footer-border,#e5e7eb);display:flex;justify-content:flex-end}.CognitiveNonWebSearchReasoning-module_trainingTitle__CHFlh{color:var(--cr-training-title-color,inherit);font-size:var(--cr-training-title-font-size,.875rem);font-style:italic;font-weight:300}.CognitiveNonWebSearchReasoning-module_trainingTitleLink__0lu-U{align-items:center;background:none;border:none;color:var(--cr-training-link-color,inherit);cursor:pointer;display:inline-flex;font-size:var(--cr-training-link-font-size,.8rem);font-weight:600;gap:.25rem}.CognitiveNonWebSearchReasoning-module_modalDialog__eGApe{background:#0000;border:none;left:50%;margin:0;max-height:none;max-width:none;overflow:visible;padding:0;position:fixed;top:50%;transform:translate(-50%,-50%)}.CognitiveNonWebSearchReasoning-module_modalDialog__eGApe::backdrop{background-color:#0006}.CognitiveNonWebSearchReasoning-module_modalContainer__-dZ01{background-color:var(--cr-modal-container-bg,#fff);border-radius:var(--cr-modal-container-border-radius,.75rem);box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-height:80vh;max-width:900px;overflow:hidden;width:80vw}.CognitiveNonWebSearchReasoning-module_modalHeader__qglof{align-items:center;background-color:var(--cr-modal-header-bg,#f2f4f7);border-bottom:1px solid var(--cr-modal-header-border,#e5e7eb);display:flex;justify-content:space-between;padding:.75rem .5rem .75rem 1rem;width:100%}.CognitiveNonWebSearchReasoning-module_modalHeaderTitle__hDo1X{color:var(--cr-modal-header-title-color,inherit);font-size:var(--cr-modal-header-title-font-size,1rem);font-weight:500}.CognitiveNonWebSearchReasoning-module_modalHeaderActions__NGmip{align-items:center;display:flex;gap:.5rem}.CognitiveNonWebSearchReasoning-module_modalNavContainer__Q-OrP{align-items:center;background-color:var(--cr-modal-nav-container-bg,#f3f4f6);border:1px solid var(--cr-nav-container-border,#e5e7eb);border-radius:.5rem;display:flex;padding:.25rem}.CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24:hover{background-color:var(--cr-modal-nav-button-hover-bg,#e5e7eb)}.CognitiveNonWebSearchReasoning-module_closeButton__S23zi{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.CognitiveNonWebSearchReasoning-module_closeButton__S23zi:hover{background-color:var(--cr-close-button-hover-bg,#e5e7eb)}.CognitiveNonWebSearchReasoning-module_closeIcon__f7kaG{color:var(--cr-close-icon-color,#4b5563);height:1.25rem;width:1.25rem}.CognitiveNonWebSearchReasoning-module_modalContent__4U2Jv{background-color:var(--cr-modal-content-bg,#0000);color:var(--cr-modal-content-color,inherit);flex:1;font-size:var(--cr-modal-content-font-size,.875rem);overflow-y:auto;padding:.75rem 1rem;scroll-behavior:smooth}.CognitiveNonWebSearchReasoning-module_modalContentInner__63tzo{line-height:var(--cr-modal-content-line-height,1.75rem)}.CognitiveNonWebSearchReasoning-module_modalFooter__hXBqn{justify-content:flex-end;padding:.5rem 1rem}.CognitiveNonWebSearchReasoning-module_modalFooterSource__MOlgt,.CognitiveNonWebSearchReasoning-module_modalFooter__hXBqn{align-items:center;background-color:var(--cr-modal-footer-bg,#f2f4f7);border-top:1px solid var(--cr-modal-footer-border,#e5e7eb);display:flex;flex-shrink:0}.CognitiveNonWebSearchReasoning-module_modalFooterSource__MOlgt{justify-content:flex-start;padding:1rem}.CognitiveNonWebSearchReasoning-module_blockLine__FwGYE{display:block}.CognitiveNonWebSearchReasoning-module_headerLine__0j5p4{display:block;font-weight:var(--cr-header-line-font-weight,400)}.CognitiveNonWebSearchReasoning-module_listItemLine__yKx2O{display:block}.CognitiveNonWebSearchReasoning-module_listCounter__esNpx{display:inline-block;font-weight:var(--cr-list-counter-font-weight,500);text-align:left;width:var(--cr-list-counter-width,1.5rem)}.CognitiveNonWebSearchReasoning-module_boldText__suAp2{font-weight:var(--cr-bold-font-weight,600)}.CognitiveNonWebSearchReasoning-module_highlight__EMAz5{background-color:var(--cr-highlight-bg,#fef08a);border-radius:.25rem;padding:0 .125rem;transition:all .2s}.CognitiveNonWebSearchReasoning-module_highlightActive__FFvuU{background-color:var(--cr-highlight-active-bg,#fde047);border:1px solid var(--cr-highlight-active-border,#eab308);box-shadow:0 1px 2px 0 #0000000d}.CognitiveNonWebSearchReasoning-module_highlightActiveVariant__-gqMp{background-color:#e0e7ff;border:1px solid #5c75f4;box-shadow:0 1px 2px 0 #0000000d;color:#6366f1;font-weight:500}.CognitiveNonWebSearchReasoning-module_highlightVariant__PYgtJ{background-color:#eef2ff;border-radius:.25rem;color:#6366f1;font-weight:500;padding:0 .125rem;transition:all .2s}.CognitiveNonWebSearchReasoning-module_highlightButton__XvkBb{border:none;cursor:pointer;display:inline;font:inherit}"));const n=document.head||document.getElementsByTagName("head")[0]||document.documentElement;n&&n.appendChild(e)}(),exports.default={container:"CognitiveNonWebSearchReasoning-module_container__koQEN",itemRow:"CognitiveNonWebSearchReasoning-module_itemRow__lRmgs",indexNumber:"CognitiveNonWebSearchReasoning-module_indexNumber__wP5hg",textContent:"CognitiveNonWebSearchReasoning-module_textContent__327fx",paraphraseButton:"CognitiveNonWebSearchReasoning-module_paraphraseButton__VS6Qe",paraphraseText:"CognitiveNonWebSearchReasoning-module_paraphraseText__n5dty",paraphraseStar:"CognitiveNonWebSearchReasoning-module_paraphraseStar__YUnqR",chevronIcon:"CognitiveNonWebSearchReasoning-module_chevronIcon__ZeXjw",chevronIconRotated:"CognitiveNonWebSearchReasoning-module_chevronIconRotated__WkRiP",expandedContainer:"CognitiveNonWebSearchReasoning-module_expandedContainer__2UPr9",expandedHeader:"CognitiveNonWebSearchReasoning-module_expandedHeader__QjKjb",headerTitle:"CognitiveNonWebSearchReasoning-module_headerTitle__VvMwI",headerActions:"CognitiveNonWebSearchReasoning-module_headerActions__j1P4u",navigationContainer:"CognitiveNonWebSearchReasoning-module_navigationContainer__G0VtG",navButton:"CognitiveNonWebSearchReasoning-module_navButton__aOaMv",navIcon:"CognitiveNonWebSearchReasoning-module_navIcon__uLme4",navCounter:"CognitiveNonWebSearchReasoning-module_navCounter__nj1Xc",confidenceBadge:"CognitiveNonWebSearchReasoning-module_confidenceBadge__-ElB3",confidenceStar:"CognitiveNonWebSearchReasoning-module_confidenceStar__4Rq0S",confidenceScore:"CognitiveNonWebSearchReasoning-module_confidenceScore__uLcnK",maximizeButton:"CognitiveNonWebSearchReasoning-module_maximizeButton__Xwwu-",maximizeIcon:"CognitiveNonWebSearchReasoning-module_maximizeIcon__eFZez",contentArea:"CognitiveNonWebSearchReasoning-module_contentArea__hVoLL",contentInner:"CognitiveNonWebSearchReasoning-module_contentInner__df-34",footer:"CognitiveNonWebSearchReasoning-module_footer__CNE8q",trainingTitle:"CognitiveNonWebSearchReasoning-module_trainingTitle__CHFlh",trainingTitleLink:"CognitiveNonWebSearchReasoning-module_trainingTitleLink__0lu-U",modalDialog:"CognitiveNonWebSearchReasoning-module_modalDialog__eGApe",modalContainer:"CognitiveNonWebSearchReasoning-module_modalContainer__-dZ01",modalHeader:"CognitiveNonWebSearchReasoning-module_modalHeader__qglof",modalHeaderTitle:"CognitiveNonWebSearchReasoning-module_modalHeaderTitle__hDo1X",modalHeaderActions:"CognitiveNonWebSearchReasoning-module_modalHeaderActions__NGmip",modalNavContainer:"CognitiveNonWebSearchReasoning-module_modalNavContainer__Q-OrP",modalNavButton:"CognitiveNonWebSearchReasoning-module_modalNavButton__6cQ24",closeButton:"CognitiveNonWebSearchReasoning-module_closeButton__S23zi",closeIcon:"CognitiveNonWebSearchReasoning-module_closeIcon__f7kaG",modalContent:"CognitiveNonWebSearchReasoning-module_modalContent__4U2Jv",modalContentInner:"CognitiveNonWebSearchReasoning-module_modalContentInner__63tzo",modalFooter:"CognitiveNonWebSearchReasoning-module_modalFooter__hXBqn",modalFooterSource:"CognitiveNonWebSearchReasoning-module_modalFooterSource__MOlgt",blockLine:"CognitiveNonWebSearchReasoning-module_blockLine__FwGYE",headerLine:"CognitiveNonWebSearchReasoning-module_headerLine__0j5p4",listItemLine:"CognitiveNonWebSearchReasoning-module_listItemLine__yKx2O",listCounter:"CognitiveNonWebSearchReasoning-module_listCounter__esNpx",boldText:"CognitiveNonWebSearchReasoning-module_boldText__suAp2",highlight:"CognitiveNonWebSearchReasoning-module_highlight__EMAz5",highlightActive:"CognitiveNonWebSearchReasoning-module_highlightActive__FFvuU",highlightActiveVariant:"CognitiveNonWebSearchReasoning-module_highlightActiveVariant__-gqMp",highlightVariant:"CognitiveNonWebSearchReasoning-module_highlightVariant__PYgtJ",highlightButton:"CognitiveNonWebSearchReasoning-module_highlightButton__XvkBb"};
2
2
  //# sourceMappingURL=CognitiveNonWebSearchReasoning.module.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");exports.getCitationsData=function(e,r,n){return t.__awaiter(this,void 0,void 0,function(){var o;return t.__generator(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(n,"/api/citations/").concat(e),{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)}})];case 1:if(!(o=t.sent()).ok)throw new Error("Failed to fetch citations: ".concat(o.statusText));return[4,o.json()];case 2:return[2,t.sent()]}})})},exports.getFileContent=function(e){return t.__awaiter(this,void 0,void 0,function(){var r;return t.__generator(this,function(t){switch(t.label){case 0:return[4,fetch(e,{method:"GET",headers:{Accept:"application/json"}})];case 1:if(!(r=t.sent()).ok)throw new Error("Failed to fetch file content: ".concat(r.statusText));return[4,r.text()];case 2:return[2,t.sent()]}})})},exports.getNestedValue=function(t,e){var r;try{for(var n=e.split("."),o=t,i=0,a=n;i<a.length;i++){var s=a[i],c=s.match(/^(\w+)\[(\d+)\]$/);if(c){var u=c[1],l=c[2];o=null===(r=null==o?void 0:o[u])||void 0===r?void 0:r[Number(l)]}else o=null==o?void 0:o[s];if(null==o)return null}return o}catch(t){return console.error("Nested extraction error",t),null}},exports.getSignedUrl=function(e,r){return t.__awaiter(this,void 0,void 0,function(){var n;return t.__generator(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(r,"/backend/gcs/get-signed-url/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({gsutil_url:e,expiration_hours:3})})];case 1:if(!(n=t.sent()).ok)throw new Error("Failed to get signed URL: ".concat(n.statusText));return[4,n.json()];case 2:return[2,t.sent()]}})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getNestedValue=function(e,r){var l;try{for(var t=r.split("."),n=e,o=0,u=t;o<u.length;o++){var i=u[o],s=i.match(/^(\w+)\[(\d+)\]$/);if(s){var d=s[1],v=s[2];n=null===(l=null==n?void 0:n[d])||void 0===l?void 0:l[Number(v)]}else n=null==n?void 0:n[i];if(null==n)return null}return n}catch(e){return console.error("Nested extraction error",e),null}},exports.isJSONFile=function(e){var r;return null!==(r=null==e?void 0:e.toLowerCase().includes("json"))&&void 0!==r&&r};
2
2
  //# sourceMappingURL=RuleBookCitationApi.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react"),i=require("../TextualGuidelines/TextualGuideLinesComponent.js"),s=require("./RuleBookCitationApi.js");exports.default=function(a){var o=a.requestId,l=a.citationIndex,u=void 0===l?0:l,d=a.accessToken,c=a.sourceAttachments,f=void 0===c?[]:c,g=a.url,v=t.useState(null),h=v[0],p=v[1],x=t.useState(null),_=x[0],m=x[1],w=t.useState(null),b=w[0],j=w[1],y=t.useState(!1),S=y[0],C=y[1],q=t.useState(!1),E=q[0],R=q[1],A=t.useState(null),L=A[0],k=A[1];t.useEffect(function(){if(!o)return p(null),m(null),j(null),void k(null);if(!g)throw new Error("Base URL is required");e.__awaiter(void 0,void 0,void 0,function(){var r,t,n,i,a,l,c;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,3,4]),C(!0),k(null),[4,s.getCitationsData(o,d,g)];case 1:if(r=e.sent(),t=null!==(c=null!==(a=null==r?void 0:r.citations)&&void 0!==a?a:null===(l=null==r?void 0:r.responseData)||void 0===l?void 0:l.citations)&&void 0!==c?c:[],!(n=null==t?void 0:t[u]))throw new Error("Citation not found at the specified index.");if(!n.file_id)throw new Error("Citation data is missing a valid file_id.");return p(n.file_id),m(n.phrase_to_highlight||null),[3,4];case 2:return i=e.sent(),console.error(i),k(i.message||"An error occurred while fetching citations."),p(null),m(null),[3,4];case 3:return C(!1),[7];case 4:return[2]}})})},[o,u,d]),t.useEffect(function(){if(h){var r=Array.isArray(f)?f:Object.values(f||{}).flat();e.__awaiter(void 0,void 0,void 0,function(){var t,n,i,a,o,l,u,d,c;return e.__generator(this,function(e){switch(e.label){case 0:if(e.trys.push([0,3,4,5]),R(!0),k(null),!(null==(t=r.find(function(e){return e.id===h}))?void 0:t.gcsUrl))throw new Error("File URL missing for ID: ".concat(h));return[4,s.getSignedUrl(t.gcsUrl,g)];case 1:if(n=e.sent(),!(i=null!==(c=null===(d=null==n?void 0:n.responseData)||void 0===d?void 0:d.signed_url)&&void 0!==c?c:null==n?void 0:n.signed_url))throw new Error("Signed URL not received");return[4,s.getFileContent(i)];case 2:if(a=e.sent(),o=JSON.parse(a),!(l=s.getNestedValue(o,"data.artifactData.userStorySnapshot[0].value")))throw new Error("Failed to extract content from standard JSON path.");return j(l),[3,5];case 3:return u=e.sent(),console.error(u),k(u.message||"An error occurred while loading file contents."),j(null),[3,5];case 4:return R(!1),[7];case 5:return[2]}})})}else j(null)},[h,f]);var D=S||E;return r.jsxs("div",e.__assign({style:{width:"100%",minHeight:"100px"}},{children:[D&&r.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[r.jsx(n.Loader2,{style:{animation:"spin 1s linear infinite"},size:24}),r.jsx("span",{children:"Loading content..."})]})),L&&!D&&r.jsxs("div",e.__assign({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[r.jsx("strong",{children:"Error:"})," ",L]})),!D&&!L&&b&&r.jsx("div",e.__assign({style:{marginTop:"12px"}},{children:r.jsx(i.default,{TextualGuideLines:b,HighlightedWords:_?[_]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1})})),!D&&!L&&!b&&r.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available. Please provide a valid requestId and ensure source attachments are loaded."})),r.jsx("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react"),l=require("../TextualGuidelines/TextualGuideLinesComponent.js"),t=require("./RuleBookCitationApi.js"),o=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.filter(Boolean).join(" ")};exports.default=function(a){var s,d,u,c,v=a.data,g=a.msg,f=a.citationIndex,p=a.guidelines,h=void 0===p?[]:p,_=a.additionalClassNames,b=a.getSignedUrl,m=a.getFileContent,x=a.themeTokens,y=a.classNames,j=a.styles;console.log("Latest code 4.0");var C=Math.max((null!==(d=null!==(s=null==v?void 0:v.citationNumber)&&void 0!==s?s:f)&&void 0!==d?d:1)-1,0),N=(null==g?void 0:g.requestId)||(null==g?void 0:g.id)||"",S=r.useState(null),k=S[0],w=S[1],D=r.useState(null),T=D[0],q=D[1],E=r.useState(null),I=E[0],A=E[1],G=r.useState(!1),L=G[0],O=G[1],R=r.useState(null),B=R[0],U=R[1];r.useEffect(function(){var e,i,r,n;if(!k){if(null===(e=null==v?void 0:v.fileDetails)||void 0===e?void 0:e.file_id)return U(null),w(v.fileDetails.file_id),void q(v.fileDetails.phrase_to_highlight||null);var l=(null!==(n=null===(r=null===(i=null==g?void 0:g.artifactSearchData)||void 0===i?void 0:i.ruleBookData)||void 0===r?void 0:r.rulebook_citations)&&void 0!==n?n:[])[C];if(!l)return U("Citation not found at the specified index."),w(null),void q(null);if(!l.file_id)return U("Citation data is missing file_id."),w(null),void q(null);A(null),U(null),w(l.file_id),q(l.phrase_to_highlight||null)}},[N,C,k,null===(u=null==v?void 0:v.fileDetails)||void 0===u?void 0:u.file_id,null===(c=null==v?void 0:v.fileDetails)||void 0===c?void 0:c.phrase_to_highlight]),r.useEffect(function(){if(k){var i=Array.isArray(h)?h:Object.values(h||{}).flat();e.__awaiter(void 0,void 0,void 0,function(){var r,n,l,o,a,s,d,u;return e.__generator(this,function(e){switch(e.label){case 0:if(!(null==(r=i.find(function(e){return e.id===k}))?void 0:r.gcsUrl))return[2];if(!b||!m)return U("Required API handlers (getSignedUrl/getFileContent) were not provided."),[2];e.label=1;case 1:return e.trys.push([1,4,5,6]),O(!0),U(null),[4,b(r.gcsUrl)];case 2:if(null==(n=e.sent())?void 0:n.error)throw new Error(n.error);return l=(null===(u=r.name)||void 0===u?void 0:u.toLowerCase().split(".").pop())||"",t.isJSONFile(l)?[4,m(r.gcsUrl)]:[2];case 3:if(!(null==(o=e.sent())?void 0:o.trim()))throw new Error("Empty file content returned from the backend.");return a=JSON.parse(o),s=t.getNestedValue(a,"data.artifactData.userStorySnapshot[0].value"),A(s||""),[3,6];case 4:return d=e.sent(),console.error(d),U(d.message||"An error occurred while loading file contents."),A(null),[3,6];case 5:return O(!1),[7];case 6:return[2]}})})}else A(null)},[k,h,b,m]);var H=L,W=(null==I?void 0:I.replace(/\\\./g,"."))||"",F=x?Object.fromEntries(Object.entries(x).filter(function(e){return e[0].startsWith("--tg-")})):void 0;return i.jsxs("div",e.__assign({className:o(null==_?void 0:_.container,null==y?void 0:y.container),style:e.__assign(e.__assign({width:"100%",minHeight:"var(--rb-container-min-height, 100px)",backgroundColor:"var(--rb-container-bg, transparent)"},x),null==j?void 0:j.container)},{children:[H&&i.jsxs("div",e.__assign({className:o(null==y?void 0:y.loadingContainer),style:e.__assign({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"var(--rb-loading-gap, 8px)",color:"var(--rb-loading-color, inherit)"},null==j?void 0:j.loadingContainer)},{children:[i.jsx(n.Loader2,{className:o(null==y?void 0:y.loadingIcon),style:e.__assign({animation:"spin 1s linear infinite"},null==j?void 0:j.loadingIcon),size:24}),i.jsx("span",e.__assign({className:o(null==y?void 0:y.loadingText),style:null==j?void 0:j.loadingText},{children:"Loading content..."}))]})),B&&!H&&i.jsxs("div",e.__assign({className:o(null==y?void 0:y.errorContainer),style:e.__assign({padding:"var(--rb-error-padding, 12px)",backgroundColor:"var(--rb-error-bg, #fee2e2)",border:"1px solid var(--rb-error-border, #fca5a5)",borderRadius:"var(--rb-error-border-radius, 4px)",color:"var(--rb-error-color, #991b1b)",marginBottom:"12px"},null==j?void 0:j.errorContainer)},{children:[i.jsx("strong",{children:"Error:"})," ",B]})),!H&&!B&&I&&i.jsx("div",e.__assign({className:o(null==y?void 0:y.contentWrapper),style:e.__assign({marginTop:"var(--rb-content-margin-top, 12px)"},null==j?void 0:j.contentWrapper)},{children:i.jsx(l.default,{TextualGuideLines:W,HighlightedWords:T?[T]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1,themeTokens:F,classNames:null==y?void 0:y.textualGuidelines,styles:null==j?void 0:j.textualGuidelines})})),!H&&!B&&!I&&i.jsx("div",e.__assign({className:o(null==y?void 0:y.emptyContainer),style:e.__assign({padding:"var(--rb-empty-padding, 12px)",backgroundColor:"var(--rb-empty-bg, #f3f4f6)",border:"1px solid var(--rb-empty-border, #d1d5db)",borderRadius:"var(--rb-empty-border-radius, 4px)",color:"var(--rb-empty-color, #6b7280)",textAlign:"center"},null==j?void 0:j.emptyContainer)},{children:"No content available."})),i.jsx("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};
2
2
  //# sourceMappingURL=RuleBookCitationWrapper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),r=require("./TextualGuidelines.module.css.js"),s=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),a=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},o=function(e,n){var t=e.map(a).filter(Boolean),i=n.map(a).filter(Boolean);if(0===t.length||0===i.length)return 0;var r=new Set(t),s=new Set(i),o=0;return r.forEach(function(e){s.has(e)&&o++}),2*o/(r.size+s.size)},l=function(t){var i=0;return t.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(t){var s="bold-".concat(i);return i+=t.length,t.startsWith("**")&&t.endsWith("**")||t.startsWith("__")&&t.endsWith("__")?n.jsx("strong",e.__assign({className:r.default.boldText},{children:t.slice(2,-2)}),s):t})};exports.default=function(a){a.index;var d=a.TextualGuideLines,c=a.HighlightedWords,h=a.InternalGptReasoningData,u=a.headerTitle,g=void 0===u?"Textual Guidelines":u,x=a.useVariantHighlight,f=void 0!==x&&x,p=a.fuzzyThreshold,v=void 0===p?.8:p,m=t.useState(0),I=m[0],_=m[1],b=t.useState(new Set),j=b[0],y=b[1],w=t.useRef([]),C=[];c.forEach(function(e){(function(e,n,t){void 0===t&&(t=.8);var i=n.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var r,s=[],a=/\S+/g;null!==(r=a.exec(e));)s.push({word:r[0],start:r.index,end:r.index+r[0].length});for(var l=i.length,d=[],c=Math.max(1,l-1);c<=l+2;c++)for(var h=0;h<=s.length-c;h++){var u=s.slice(h,h+c),g=o(i,u.map(function(e){return e.word}));g>=t&&d.push({startIndex:u[0].start,endIndex:u[u.length-1].end,score:g})}if(0===d.length)return[];d.sort(function(e,n){return n.score-e.score});for(var x=[],f=function(e){x.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||x.push(e)},p=0,v=d;p<v.length;p++)f(v[p]);return x})(d,e,v).forEach(function(e){return C.push(e)})}),C.sort(function(e,n){return e.startIndex-n.startIndex});for(var k=[],T=0,z=C;T<z.length;T++){var N=z[T],S=k.at(-1);(!S||N.startIndex>=S.endIndex)&&k.push(N)}var D=k.map(function(e,n){return{text:d.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),L=D.length;t.useEffect(function(){L>0&&(_(0),setTimeout(function(){var e;null===(e=w.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[L]);var M,q,E,G,R=function(e){y(function(n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return n.jsxs("div",e.__assign({className:r.default.expandedContainer,style:{marginLeft:"1rem",display:"flex",flexDirection:"column",height:"100%",border:"none"}},{children:[n.jsxs("div",e.__assign({className:r.default.expandedHeader,style:{backgroundColor:"white",border:"none"}},{children:[n.jsx("span",e.__assign({className:r.default.headerTitle,style:{backgroundColor:"white"}},{children:g})),n.jsx("div",e.__assign({className:r.default.headerActions},{children:L>=1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[I+1," / ",L]})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I>0?I-1:L-1;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I<=0,style:{padding:"2px 4px",cursor:I<=0?"not-allowed":"pointer",opacity:I<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I<L-1?I+1:0;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I>=L-1,style:{padding:"2px 4px",cursor:I>=L-1?"not-allowed":"pointer",opacity:I>=L-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronDown,{size:14,color:"#64748b"})}))]})}))]})),n.jsx("div",e.__assign({className:r.default.contentArea,style:{flex:1,maxHeight:"none",height:"auto",overflowY:"auto",border:"1px solid #eee",borderRadius:"4px",padding:"1rem"}},{children:n.jsx("div",e.__assign({className:r.default.contentInner},{children:(M=d.split("\n"),q=0,E=0,G=[],M.forEach(function(t){var a=q,o=q+t.length;q+=t.length+1;var c=/^(\s*)(-|\*|\d+\.)\s+/.exec(t),u=/^(Title|Description|Training-basis):\s*/i.exec(t);u&&(E=0),c&&(E+=1);var g=!!c,x=!!u,p=c?c[0].length:0,v=a+p,m=D.filter(function(e){return e.startIndex<o&&e.endIndex>v}),_="line-".concat(a),b=function(t,i,s){x?G.push(n.jsx("span",e.__assign({className:r.default.headerLine},{children:t}),i)):g?G.push(n.jsxs("span",e.__assign({className:r.default.listItemLine,style:{paddingLeft:c[1]?"1rem":"0"}},{children:[s&&n.jsxs("span",e.__assign({className:r.default.listCounter},{children:[E,"."]})),n.jsx("span",{children:t})]}),i)):G.push(n.jsx("span",e.__assign({className:r.default.blockLine},{children:t}),i))};if(0===m.length)b(l(t.substring(p)),_,!0);else{for(var y=v,C=[],k=!0,T=function(t){var a=Math.max(t.startIndex,v),c=Math.min(t.endIndex,o);if(a>=c)return"continue";if(a>y){var u=d.substring(y,a);C.push(n.jsx("span",{children:l(u)},"t-".concat(y)))}var g=t.highlightIndex===I,x=f?g?"".concat(r.default.highlight," ").concat(r.default.highlightActiveVariant):r.default.highlightVariant:g?"".concat(r.default.highlight," ").concat(r.default.highlightActive):r.default.highlight,p=j.has(t.highlightIndex);if(C.push(n.jsxs("span",e.__assign({ref:function(e){w.current[t.highlightIndex]=e},className:x,role:"button",tabIndex:0,onClick:function(){return R(t.highlightIndex)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||R(t.highlightIndex)},style:{display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"}},{children:[d.substring(a,c),p?n.jsx(i.ChevronUp,{size:12,style:{flexShrink:0}}):n.jsx(i.ChevronDown,{size:12,style:{flexShrink:0}})]}),"h-".concat(t.highlightIndex))),y=c,p&&h[t.highlightIndex]){var m=k?_:"".concat(_,"-chunk-").concat(a);b(C,m,k),k=!1,C=[],G.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(s.default,{item:e.__assign(e.__assign({},h[t.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:i.ChevronDown,ChevronUpIcon:i.ChevronUp,MaximizeIcon:i.Maximize2,CloseIcon:i.X},bodyHeight:"100%",disableMaximize:!0,index:t.highlightIndex})}),"expanded-".concat(t.highlightIndex)))}},z=0,N=m;z<N.length;z++)T(N[z]);if(y<o&&C.push(n.jsx("span",{children:l(d.substring(y,o))},"t-end-".concat(o))),C.length>0||k){var S=k?_:"".concat(_,"-tail");b(C,S,k)}}}),G)}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),l=require("./TextualGuidelines.module.css.js"),s=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),a=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.filter(Boolean).join(" ")},r=function(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"")},o=function(n,e){var t=n.map(r).filter(Boolean),i=e.map(r).filter(Boolean);if(0===t.length||0===i.length)return 0;var l=new Set(t),s=new Set(i),a=0;return l.forEach(function(n){s.has(n)&&a++}),2*a/(l.size+s.size)},d=function(t){var i=0;return t.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(t){var s="bold-".concat(i);return i+=t.length,t.startsWith("**")&&t.endsWith("**")||t.startsWith("__")&&t.endsWith("__")?e.jsx("strong",n.__assign({className:l.default.boldText},{children:t.slice(2,-2)}),s):t})};exports.default=function(r){r.index;var h=r.TextualGuideLines,u=r.HighlightedWords,c=r.InternalGptReasoningData,g=r.headerTitle,v=void 0===g?"Textual Guidelines":g,f=r.useVariantHighlight,x=void 0!==f&&f,_=r.fuzzyThreshold,m=void 0===_?.8:_,p=r.themeTokens,I=r.classNames,j=r.styles,b=t.useState(0),y=b[0],C=b[1],N=t.useState(new Set),T=N[0],k=N[1],w=t.useRef([]),B=[];u.forEach(function(n){(function(n,e,t){void 0===t&&(t=.8);var i=e.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var l,s=[],a=/\S+/g;null!==(l=a.exec(n));)s.push({word:l[0],start:l.index,end:l.index+l[0].length});for(var r=i.length,d=[],h=Math.max(1,r-1);h<=r+2;h++)for(var u=0;u<=s.length-h;u++){var c=s.slice(u,u+h),g=o(i,c.map(function(n){return n.word}));g>=t&&d.push({startIndex:c[0].start,endIndex:c[c.length-1].end,score:g})}if(0===d.length)return[];d.sort(function(n,e){return e.score-n.score});for(var v=[],f=function(n){v.some(function(e){return n.startIndex<e.endIndex&&n.endIndex>e.startIndex})||v.push(n)},x=0,_=d;x<_.length;x++)f(_[x]);return v})(h,n,m).forEach(function(n){return B.push(n)})}),B.sort(function(n,e){return n.startIndex-e.startIndex});for(var L=[],z=0,A=B;z<A.length;z++){var V=A[z],S=L.at(-1);(!S||V.startIndex>=S.endIndex)&&L.push(V)}var D=L.map(function(n,e){return{text:h.substring(n.startIndex,n.endIndex),startIndex:n.startIndex,endIndex:n.endIndex,highlightIndex:e}}),M=D.length;t.useEffect(function(){M>0&&(C(0),setTimeout(function(){var n;null===(n=w.current[0])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50))},[M]);var q,E,G,W,H=function(n){k(function(e){var t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t})};return e.jsxs("div",n.__assign({className:a(l.default.expandedContainer,null==I?void 0:I.container),style:n.__assign(n.__assign({},p),null==j?void 0:j.container)},{children:[e.jsxs("div",n.__assign({className:a(l.default.expandedHeader,null==I?void 0:I.header),style:null==j?void 0:j.header},{children:[e.jsx("span",n.__assign({className:a(l.default.headerTitle,null==I?void 0:I.headerTitle),style:null==j?void 0:j.headerTitle},{children:v})),e.jsx("div",n.__assign({className:a(l.default.headerActions,null==I?void 0:I.headerActions),style:null==j?void 0:j.headerActions},{children:M>=1&&e.jsxs(e.Fragment,{children:[e.jsxs("span",n.__assign({className:a(l.default.navCounter,null==I?void 0:I.navCounter),style:null==j?void 0:j.navCounter},{children:[y+1," / ",M]})),e.jsx("button",n.__assign({onClick:function(){if(0!==M){var n=y>0?y-1:M-1;C(n),setTimeout(function(){var e;null===(e=w.current[n])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:y<=0,className:a(l.default.navButton,null==I?void 0:I.navButtonPrev),style:null==j?void 0:j.navButtonPrev},{children:e.jsx(i.ChevronUp,{size:14,className:l.default.navButtonIcon})})),e.jsx("button",n.__assign({onClick:function(){if(0!==M){var n=y<M-1?y+1:0;C(n),setTimeout(function(){var e;null===(e=w.current[n])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:y>=M-1,className:a(l.default.navButton,null==I?void 0:I.navButtonNext),style:null==j?void 0:j.navButtonNext},{children:e.jsx(i.ChevronDown,{size:14,className:l.default.navButtonIcon})}))]})}))]})),e.jsx("div",n.__assign({className:a(l.default.contentArea,null==I?void 0:I.contentArea),style:null==j?void 0:j.contentArea},{children:e.jsx("div",n.__assign({className:a(l.default.contentInner,null==I?void 0:I.contentInner),style:null==j?void 0:j.contentInner},{children:(q=h.split("\n"),E=0,G=0,W=[],q.forEach(function(t){var r=E,o=E+t.length;E+=t.length+1;var u=/^(\s*)(-|\*|\d+\.)\s+/.exec(t),g=/^(Title|Description|Training-basis):\s*/i.exec(t);g&&(G=0),u&&(G+=1);var v=!!u,f=!!g,_=u?u[0].length:0,m=r+_,p=D.filter(function(n){return n.startIndex<o&&n.endIndex>m}),b="line-".concat(r),C=function(t,i,s){f?W.push(e.jsx("span",n.__assign({className:a(l.default.headerLine,null==I?void 0:I.headerLine),style:null==j?void 0:j.headerLine},{children:t}),i)):v?W.push(e.jsxs("span",n.__assign({className:a(l.default.listItemLine,null==I?void 0:I.listItemLine),style:n.__assign({paddingLeft:u[1]?"1rem":"0"},null==j?void 0:j.listItemLine)},{children:[s&&e.jsxs("span",n.__assign({className:a(l.default.listCounter,null==I?void 0:I.listCounter),style:null==j?void 0:j.listCounter},{children:[G,"."]})),e.jsx("span",{children:t})]}),i)):W.push(e.jsx("span",n.__assign({className:a(l.default.blockLine,null==I?void 0:I.blockLine),style:null==j?void 0:j.blockLine},{children:t}),i))};if(0===p.length)C(d(t.substring(_)),b,!0);else{for(var N=m,k=[],B=!0,L=function(t){var r=Math.max(t.startIndex,m),u=Math.min(t.endIndex,o);if(r>=u)return"continue";if(r>N){var g=h.substring(N,r);k.push(e.jsx("span",{children:d(g)},"t-".concat(N)))}var v=t.highlightIndex===y,f=x?v?a(l.default.highlight,l.default.highlightActiveVariant,null==I?void 0:I.highlight,null==I?void 0:I.highlightActiveVariant):a(l.default.highlightVariant,null==I?void 0:I.highlightVariant):v?a(l.default.highlight,l.default.highlightActive,null==I?void 0:I.highlight,null==I?void 0:I.highlightActive):a(l.default.highlight,null==I?void 0:I.highlight),_=x?v?n.__assign(n.__assign({},null==j?void 0:j.highlight),null==j?void 0:j.highlightActiveVariant):n.__assign({},null==j?void 0:j.highlightVariant):v?n.__assign(n.__assign({},null==j?void 0:j.highlight),null==j?void 0:j.highlightActive):n.__assign({},null==j?void 0:j.highlight),p=T.has(t.highlightIndex);if(k.push(e.jsxs("span",n.__assign({ref:function(n){w.current[t.highlightIndex]=n},className:f,role:"button",tabIndex:0,onClick:function(){return H(t.highlightIndex)},onKeyDown:function(n){"Enter"!==n.key&&" "!==n.key||H(t.highlightIndex)},style:n.__assign({display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"},_)},{children:[h.substring(r,u),p?e.jsx(i.ChevronUp,{size:12,style:{flexShrink:0}}):e.jsx(i.ChevronDown,{size:12,style:{flexShrink:0}})]}),"h-".concat(t.highlightIndex))),N=u,p&&c[t.highlightIndex]){var L=B?b:"".concat(b,"-chunk-").concat(r);C(k,L,B),B=!1,k=[],W.push(e.jsx("div",n.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:e.jsx(s.default,{item:n.__assign(n.__assign({},c[t.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:i.ChevronDown,ChevronUpIcon:i.ChevronUp,MaximizeIcon:i.Maximize2,CloseIcon:i.X},bodyHeight:"100%",disableMaximize:!0,index:t.highlightIndex})}),"expanded-".concat(t.highlightIndex)))}},z=0,A=p;z<A.length;z++)L(A[z]);if(N<o&&k.push(e.jsx("span",{children:d(h.substring(N,o))},"t-end-".concat(o))),k.length>0||B){var V=B?b:"".concat(b,"-tail");C(k,V,B)}}}),W)}))}))]}))};
2
2
  //# sourceMappingURL=TextualGuideLinesComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const o=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;o&&e.setAttribute("nonce",o),e.appendChild(document.createTextNode(".TextualGuidelines-module_container__RJDOE{display:flex;flex-direction:column;gap:.5rem}.TextualGuidelines-module_itemRow__kQWzv{align-items:flex-start;display:flex;font-size:.875rem;gap:.5rem}.TextualGuidelines-module_indexNumber__tprYt{color:#475467;font-weight:500}.TextualGuidelines-module_textContent__3JD9T{color:#475467;flex:1;max-width:none}.TextualGuidelines-module_paraphraseButton__FuN0v{align-items:center;background:#0000;border:none;border-radius:.375rem;cursor:pointer;display:inline-flex;gap:.25rem;justify-content:flex-start;padding:.125rem .375rem}.TextualGuidelines-module_paraphraseText__o5VEv{color:#2563eb;font-weight:500;text-align:start}.TextualGuidelines-module_paraphraseStar__omUYz{color:#2563eb;padding-right:.25rem}.TextualGuidelines-module_chevronIcon__jxUNm{color:#2563eb;height:1rem;transition:transform .2s;width:1rem}.TextualGuidelines-module_chevronIconRotated__oyLRq{transform:rotate(180deg)}.TextualGuidelines-module_expandedContainer__ku2Qy{border:solid #e5e7eb;border-radius:.5rem;border-width:1px 1px 2px;margin-left:1.5rem;margin-top:.5rem;overflow:hidden}.TextualGuidelines-module_expandedHeader__5OOd1{align-items:center;background-color:#f2f4f7;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;padding:.25rem .75rem}.TextualGuidelines-module_headerTitle__6vpFm{font-size:.875rem;font-weight:400}.TextualGuidelines-module_headerActions__tAYsZ{align-items:center;display:flex;gap:.5rem}.TextualGuidelines-module_navigationContainer__DAz7T{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:.5rem;display:flex;padding:.25rem}.TextualGuidelines-module_navButton__wpCGR{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.TextualGuidelines-module_navButton__wpCGR:hover{background-color:#f3f4f6}.TextualGuidelines-module_navIcon__Aa93S{color:#6b7280;height:1.25rem;width:1.25rem}.TextualGuidelines-module_navCounter__MbQnG{color:#4b5563;font-size:.875rem;min-width:2.25rem;text-align:center}.TextualGuidelines-module_confidenceBadge__ue2t4{align-items:center;background-color:#f0fdf4;border:2px solid #3ac894;border-radius:9999px;display:inline-flex;gap:.25rem;padding:.25rem .5rem}.TextualGuidelines-module_confidenceStar__vucHk{color:#059669;font-size:.75rem}.TextualGuidelines-module_confidenceScore__rK7mq{color:#059669;font-size:.875rem;font-weight:600}.TextualGuidelines-module_maximizeButton__Lg43k{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.TextualGuidelines-module_maximizeButton__Lg43k:hover{background-color:#e5e7eb}.TextualGuidelines-module_maximizeIcon__RETCs{color:#6b7280;height:1.25rem;width:1.25rem}.TextualGuidelines-module_contentArea__2k4vh{font-size:.875rem;max-height:11rem;overflow-y:auto;padding:.5rem .75rem;scroll-behavior:smooth}.TextualGuidelines-module_contentInner__2uMSz{line-height:1.5rem}.TextualGuidelines-module_footer__AQG-E{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end}.TextualGuidelines-module_trainingTitle__HH--J{font-size:.875rem;font-style:italic;font-weight:300}.TextualGuidelines-module_trainingTitleLink__s7Oqw{align-items:center;background:none;border:none;cursor:pointer;display:inline-flex;font-size:.8rem;font-weight:600;gap:.25rem}.TextualGuidelines-module_modalDialog__OtQxY{background:#0000;border:none;left:50%;margin:0;max-height:none;max-width:none;overflow:visible;padding:0;position:fixed;top:50%;transform:translate(-50%,-50%)}.TextualGuidelines-module_modalDialog__OtQxY::backdrop{background-color:#0006}.TextualGuidelines-module_modalContainer__sEVUZ{background-color:#fff;border-radius:.75rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-height:80vh;max-width:900px;overflow:hidden;width:80vw}.TextualGuidelines-module_modalHeader__BN8z5{align-items:center;background-color:#f2f4f7;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;padding:.75rem .5rem .75rem 1rem;width:100%}.TextualGuidelines-module_modalHeaderTitle__gJp9R{font-size:1rem;font-weight:500}.TextualGuidelines-module_modalHeaderActions__oupri{align-items:center;display:flex;gap:.5rem}.TextualGuidelines-module_modalNavContainer__UTxad{align-items:center;background-color:#f3f4f6;border:1px solid #e5e7eb;border-radius:.5rem;display:flex;padding:.25rem}.TextualGuidelines-module_modalNavButton__DLNmC{align-items:center;background:#0000;border:none;border-radius:9999px;cursor:pointer;display:flex;justify-content:center;padding:0;transition:background-color .2s}.TextualGuidelines-module_modalNavButton__DLNmC:hover{background-color:#e5e7eb}.TextualGuidelines-module_closeButton__hkkeO{align-items:center;background:#0000;border:none;border-radius:.25rem;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:background-color .2s}.TextualGuidelines-module_closeButton__hkkeO:hover{background-color:#e5e7eb}.TextualGuidelines-module_closeIcon__qhupP{color:#4b5563;height:1.25rem;width:1.25rem}.TextualGuidelines-module_modalContent__wzOBu{flex:1;font-size:.875rem;overflow-y:auto;padding:.75rem 1rem;scroll-behavior:smooth}.TextualGuidelines-module_modalContentInner__Txziz{line-height:1.75rem}.TextualGuidelines-module_modalFooter__jkbjh{justify-content:flex-end;padding:.5rem 1rem}.TextualGuidelines-module_modalFooterSource__9PLRg,.TextualGuidelines-module_modalFooter__jkbjh{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;flex-shrink:0}.TextualGuidelines-module_modalFooterSource__9PLRg{justify-content:flex-start;padding:1rem}.TextualGuidelines-module_blockLine__f-gTN{display:block}.TextualGuidelines-module_headerLine__Ic1ja{display:block;font-weight:400}.TextualGuidelines-module_listItemLine__2E-57{display:block}.TextualGuidelines-module_listCounter__Ws3UU{display:inline-block;font-weight:500;text-align:left;width:1.5rem}.TextualGuidelines-module_boldText__vZBdP{font-weight:600}.TextualGuidelines-module_highlight__CGXvE{background-color:#fef08a;border-radius:.25rem;padding:0 .125rem;transition:all .2s}.TextualGuidelines-module_highlightActive__--Ns5{background-color:#fde047;border:1px solid #eab308;box-shadow:0 1px 2px 0 #0000000d}.TextualGuidelines-module_highlightActiveVariant__6gPK9{background-color:#e0e7ff;border:1px solid #5c75f4;box-shadow:0 1px 2px 0 #0000000d;color:#6366f1;font-weight:500}.TextualGuidelines-module_highlightVariant__7YZ7W{background-color:#eef2ff;border-radius:.25rem;color:#6366f1;font-weight:500;padding:0 .125rem;transition:all .2s}.TextualGuidelines-module_highlightButton__zjZxQ{border:none;cursor:pointer;display:inline;font:inherit}"));const i=document.head||document.getElementsByTagName("head")[0]||document.documentElement;i&&i.appendChild(e)}(),exports.default={container:"TextualGuidelines-module_container__RJDOE",itemRow:"TextualGuidelines-module_itemRow__kQWzv",indexNumber:"TextualGuidelines-module_indexNumber__tprYt",textContent:"TextualGuidelines-module_textContent__3JD9T",paraphraseButton:"TextualGuidelines-module_paraphraseButton__FuN0v",paraphraseText:"TextualGuidelines-module_paraphraseText__o5VEv",paraphraseStar:"TextualGuidelines-module_paraphraseStar__omUYz",chevronIcon:"TextualGuidelines-module_chevronIcon__jxUNm",chevronIconRotated:"TextualGuidelines-module_chevronIconRotated__oyLRq",expandedContainer:"TextualGuidelines-module_expandedContainer__ku2Qy",expandedHeader:"TextualGuidelines-module_expandedHeader__5OOd1",headerTitle:"TextualGuidelines-module_headerTitle__6vpFm",headerActions:"TextualGuidelines-module_headerActions__tAYsZ",navigationContainer:"TextualGuidelines-module_navigationContainer__DAz7T",navButton:"TextualGuidelines-module_navButton__wpCGR",navIcon:"TextualGuidelines-module_navIcon__Aa93S",navCounter:"TextualGuidelines-module_navCounter__MbQnG",confidenceBadge:"TextualGuidelines-module_confidenceBadge__ue2t4",confidenceStar:"TextualGuidelines-module_confidenceStar__vucHk",confidenceScore:"TextualGuidelines-module_confidenceScore__rK7mq",maximizeButton:"TextualGuidelines-module_maximizeButton__Lg43k",maximizeIcon:"TextualGuidelines-module_maximizeIcon__RETCs",contentArea:"TextualGuidelines-module_contentArea__2k4vh",contentInner:"TextualGuidelines-module_contentInner__2uMSz",footer:"TextualGuidelines-module_footer__AQG-E",trainingTitle:"TextualGuidelines-module_trainingTitle__HH--J",trainingTitleLink:"TextualGuidelines-module_trainingTitleLink__s7Oqw",modalDialog:"TextualGuidelines-module_modalDialog__OtQxY",modalContainer:"TextualGuidelines-module_modalContainer__sEVUZ",modalHeader:"TextualGuidelines-module_modalHeader__BN8z5",modalHeaderTitle:"TextualGuidelines-module_modalHeaderTitle__gJp9R",modalHeaderActions:"TextualGuidelines-module_modalHeaderActions__oupri",modalNavContainer:"TextualGuidelines-module_modalNavContainer__UTxad",modalNavButton:"TextualGuidelines-module_modalNavButton__DLNmC",closeButton:"TextualGuidelines-module_closeButton__hkkeO",closeIcon:"TextualGuidelines-module_closeIcon__qhupP",modalContent:"TextualGuidelines-module_modalContent__wzOBu",modalContentInner:"TextualGuidelines-module_modalContentInner__Txziz",modalFooter:"TextualGuidelines-module_modalFooter__jkbjh",modalFooterSource:"TextualGuidelines-module_modalFooterSource__9PLRg",blockLine:"TextualGuidelines-module_blockLine__f-gTN",headerLine:"TextualGuidelines-module_headerLine__Ic1ja",listItemLine:"TextualGuidelines-module_listItemLine__2E-57",listCounter:"TextualGuidelines-module_listCounter__Ws3UU",boldText:"TextualGuidelines-module_boldText__vZBdP",highlight:"TextualGuidelines-module_highlight__CGXvE",highlightActive:"TextualGuidelines-module_highlightActive__--Ns5",highlightActiveVariant:"TextualGuidelines-module_highlightActiveVariant__6gPK9",highlightVariant:"TextualGuidelines-module_highlightVariant__7YZ7W",highlightButton:"TextualGuidelines-module_highlightButton__zjZxQ"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".TextualGuidelines-module_expandedContainer__ku2Qy{background-color:var(--tg-container-bg,#0000);border:none;display:flex;flex-direction:column;height:100%;margin-left:var(--tg-container-margin-left,1rem)}.TextualGuidelines-module_expandedHeader__5OOd1{align-items:center;background-color:var(--tg-header-bg,#fff);border:var(--tg-header-border,none);display:flex;justify-content:space-between;padding:var(--tg-header-padding,.25rem .75rem)}.TextualGuidelines-module_headerTitle__6vpFm{background-color:var(--tg-header-title-bg,#fff);color:var(--tg-header-title-color,inherit);font-size:var(--tg-header-title-font-size,.875rem);font-weight:var(--tg-header-title-font-weight,400)}.TextualGuidelines-module_headerActions__tAYsZ{align-items:center;display:flex;gap:.5rem}.TextualGuidelines-module_navCounter__MbQnG{color:var(--tg-nav-counter-color,#888);font-size:var(--tg-nav-counter-font-size,12px)}.TextualGuidelines-module_navButton__wpCGR{align-items:center;background:var(--tg-nav-button-bg,#fff);border:1px solid var(--tg-nav-button-border,#ddd);border-radius:var(--tg-nav-button-border-radius,3px);cursor:pointer;display:flex;padding:2px 4px}.TextualGuidelines-module_navButton__wpCGR:disabled{cursor:not-allowed;opacity:.4}.TextualGuidelines-module_navButtonIcon__urm3b{color:var(--tg-nav-button-icon-color,#64748b)}.TextualGuidelines-module_contentArea__2k4vh{background-color:var(--tg-content-bg,#0000);border:1px solid var(--tg-content-border,#eee);border-radius:var(--tg-content-border-radius,4px);color:var(--tg-content-text-color,inherit);flex:1;height:auto;max-height:none;overflow-y:auto;padding:var(--tg-content-padding,1rem)}.TextualGuidelines-module_contentInner__2uMSz{line-height:var(--tg-content-line-height,1.5rem)}.TextualGuidelines-module_blockLine__f-gTN{display:block}.TextualGuidelines-module_headerLine__Ic1ja{display:block;font-weight:var(--tg-header-line-font-weight,400)}.TextualGuidelines-module_listItemLine__2E-57{display:block}.TextualGuidelines-module_listCounter__Ws3UU{display:inline-block;font-weight:var(--tg-list-counter-font-weight,500);text-align:left;width:var(--tg-list-counter-width,1.5rem)}.TextualGuidelines-module_boldText__vZBdP{font-weight:var(--tg-bold-text-font-weight,600)}.TextualGuidelines-module_highlight__CGXvE{background-color:var(--tg-highlight-bg,#fef08a);border-radius:var(--tg-highlight-border-radius,.25rem);color:var(--tg-highlight-color,inherit);padding:0 .125rem;transition:all .2s}.TextualGuidelines-module_highlightActive__--Ns5{background-color:var(--tg-highlight-active-bg,#fde047);border:1px solid var(--tg-highlight-active-border,#eab308);box-shadow:var(--tg-highlight-active-shadow,0 1px 2px 0 #0000000d);color:var(--tg-highlight-active-color,inherit)}.TextualGuidelines-module_highlightVariant__7YZ7W{background-color:var(--tg-highlight-variant-bg,#eef2ff);border-radius:var(--tg-highlight-border-radius,.25rem);color:var(--tg-highlight-variant-color,#6366f1);font-weight:500;padding:0 .125rem;transition:all .2s}.TextualGuidelines-module_highlightActiveVariant__6gPK9{background-color:var(--tg-highlight-variant-active-bg,#e0e7ff);border:1px solid var(--tg-highlight-variant-active-border,#5c75f4);box-shadow:0 1px 2px 0 #0000000d;color:var(--tg-highlight-variant-active-color,#6366f1);font-weight:500}.TextualGuidelines-module_highlightButton__zjZxQ{border:none;cursor:pointer;display:inline;font:inherit}"));const i=document.head||document.getElementsByTagName("head")[0]||document.documentElement;i&&i.appendChild(e)}(),exports.default={expandedContainer:"TextualGuidelines-module_expandedContainer__ku2Qy",expandedHeader:"TextualGuidelines-module_expandedHeader__5OOd1",headerTitle:"TextualGuidelines-module_headerTitle__6vpFm",headerActions:"TextualGuidelines-module_headerActions__tAYsZ",navCounter:"TextualGuidelines-module_navCounter__MbQnG",navButton:"TextualGuidelines-module_navButton__wpCGR",navButtonIcon:"TextualGuidelines-module_navButtonIcon__urm3b",contentArea:"TextualGuidelines-module_contentArea__2k4vh",contentInner:"TextualGuidelines-module_contentInner__2uMSz",blockLine:"TextualGuidelines-module_blockLine__f-gTN",headerLine:"TextualGuidelines-module_headerLine__Ic1ja",listItemLine:"TextualGuidelines-module_listItemLine__2E-57",listCounter:"TextualGuidelines-module_listCounter__Ws3UU",boldText:"TextualGuidelines-module_boldText__vZBdP",highlight:"TextualGuidelines-module_highlight__CGXvE",highlightActive:"TextualGuidelines-module_highlightActive__--Ns5",highlightVariant:"TextualGuidelines-module_highlightVariant__7YZ7W",highlightActiveVariant:"TextualGuidelines-module_highlightActiveVariant__6gPK9",highlightButton:"TextualGuidelines-module_highlightButton__zjZxQ"};
2
2
  //# sourceMappingURL=TextualGuidelines.module.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),e=require("../service/onDemandApi.js"),o=function(n,i,t){var e;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(e=n.find(function(n){var e,o=function(n){var i,t,e,o,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var r=null!==(a=null!==(o=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(e=null==n?void 0:n.customMetadata)||void 0===e?void 0:e.type)&&void 0!==o?o:null==n?void 0:n.type)&&void 0!==a?a:"";return r||console.warn("[getCitationType] citation has no resolvable type field",n),r}(n);return(null===(e=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===e?void 0:e.toString())===t.toString()&&i.some(function(n){return null==o?void 0:o.includes(n)})}))&&void 0!==e?e:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var r=a.msg,l=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,y=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",h=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(l)},[l]),g=function(){switch(l){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return l}}(),p=(null==r?void 0:r.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",y,g,null==r?void 0:r.customCitationId]},[y,g,null==r?void 0:r.customCitationId]):i.useMemo(function(){return["onDemandCitationFetch",y,g,u]},[y,g,u]),C=i.useMemo(function(){return o(null==r?void 0:r.citations,h,u)},[null==r?void 0:r.citations,h,u]),b=Boolean(s&&y&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==r?void 0:r.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,o,a,l,c,s;return n.__generator(this,function(n){switch(n.label){case 0:return[4,e.fetchOnDemandCitation(y,g,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(o=null==r?void 0:r.isEcgPayloadActive)&&void 0!==o&&o,null!==(a=null==r?void 0:r.ecg_agent_name)&&void 0!==a?a:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"")];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(s=i.error)||void 0===s?void 0:s.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,e,a,l,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(e=s.find(function(n){var i,t,e=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof e&&e.includes(r.customCitationId)}))&&void 0!==e?e:s[0])&&void 0!==a?a:null:null!==(c=null!==(l=o(s,h,u))&&void 0!==l?l:s[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,h,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),o=require("../service/onDemandApi.js"),e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,e=function(n){var i,t,o,e,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var r=null!==(a=null!==(e=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==e?e:null==n?void 0:n.type)&&void 0!==a?a:"";return r||console.warn("[getCitationType] citation has no resolvable type field",n),r}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==e?void 0:e.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var r=a.msg,l=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,h=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",y=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(l)},[l]),g=function(){switch(l){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return l}}(),p=(null==r?void 0:r.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",h,g,null==r?void 0:r.customCitationId]},[h,g,null==r?void 0:r.customCitationId]):i.useMemo(function(){return["onDemandCitationFetch",h,g,u]},[h,g,u]),C=i.useMemo(function(){return e(null==r?void 0:r.citations,y,u)},[null==r?void 0:r.citations,y,u]),b=Boolean(s&&h&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==r?void 0:r.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,e,a,l,c,s,d;return n.__generator(this,function(n){switch(n.label){case 0:return[4,o.fetchOnDemandCitation(h,g,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(e=null==r?void 0:r.isEcgPayloadActive)&&void 0!==e&&e,null!==(a=null==r?void 0:r.ecg_agent_name)&&void 0!==a?a:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"",null!==(s=null==r?void 0:r.ui_chat_history)&&void 0!==s?s:void 0)];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(d=i.error)||void 0===d?void 0:d.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,o,a,l,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=s.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:s[0])&&void 0!==a?a:null:null!==(c=null!==(l=e(s,y,u))&&void 0!==l?l:s[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,y,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
2
2
  //# sourceMappingURL=useOnDemandCitationFetch.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,v,h,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,v=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(v)];case 1:if(h=T.sent())return[2,{responseData:h.data,error:null,cacheMeta:{isFromCache:!0,timestamp:h.timestamp,ttl:h.ttl,cacheKey:v}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(v,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:v}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E){return e.__awaiter(void 0,void 0,void 0,function(){var s,g,f,y;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,g=p?_:"".concat(s,"_").concat(n),[2,d(f="post",y="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:g},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(f,":").concat(y,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n)},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n)},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
2
2
  //# sourceMappingURL=onDemandApi.js.map
@@ -1,2 +1,2 @@
1
- import{__spreadArray as e,__assign as n}from"tslib";import{jsxs as i,jsx as t,Fragment as l}from"react/jsx-runtime";import{useMemo as r,useState as o,useRef as a,useEffect as c}from"react";import{ExternalLink as s,ChevronUp as d,ChevronDown as u}from"lucide-react";import h from"./CognitiveNonWebSearchReasoning.module.css.js";var m=function(e){return e.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")||e.startsWith("__")&&e.endsWith("__")?t("strong",n({className:h.boldText},{children:e.slice(2,-2)}),i):e})},p=function(p){var g=p.item,v=p.headerTitle;p.index;var f=p.iconsConfig,b=p.DocumentTitle,x=p.previewCallback,N=p.bodyHeight,C=p.disableMaximize,I=void 0!==C&&C,y=p.splitterCustomStyle,k=void 0!==y&&y,H=g.dataSource,w=g.confidence_score,T=g.trainingDataTitle,L=null==f?void 0:f.ChevronDownIcon,z=null==f?void 0:f.ChevronUpIcon,S=null==f?void 0:f.MaximizeIcon,_=null==f?void 0:f.CloseIcon,B=r(function(){var n=(H?H.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),i=0,t=n.map(function(e){var n=e.startsWith("<highlight>"),t={text:n?e.replace(/<\/?highlight>/g,""):e,isHighlight:n,highlightIndex:n?i:-1};return n&&i++,t}),l=t.filter(function(e){return e.isHighlight}).length,r=[],o=[];return t.forEach(function(n){var i=n.text,t=n.isHighlight,l=n.highlightIndex;i.split("\n").forEach(function(n,i){i>0&&((o.length>0||r.length>0)&&r.push(e([],o,!0)),o=[]),n&&o.push({text:n,isHighlight:t,highlightIndex:l})})}),o.length>0&&r.push(e([],o,!0)),{processedLines:r.map(function(e){var n=e.map(function(e){return e.text}).join(""),i=n.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:e,isListItem:!!i,isHeader:!!n.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==i?void 0:i[1])||"",content:(null==i?void 0:i[3])||n}}),totalHighlights:l}},[H]),D=B.processedLines,R=B.totalHighlights,W=o(0),j=W[0],A=W[1],F=a(null),M=a(null),V=a(null),E=a([]),$=a([]);c(function(){E.current=E.current.slice(0,R),$.current=$.current.slice(0,R)},[R]),c(function(){if(R>0){A(0);var e=setTimeout(function(){var e;null===(e=E.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(e)}}},[R]);var U=function(e,n){setTimeout(function(){var i=n?$.current[e]:E.current[e];null==i||i.scrollIntoView({behavior:"smooth",block:"center"})},50)},Y=function(e){if(void 0===e&&(e=!1),R){var n=j>0?j-1:R-1;A(n),U(n,e)}},q=function(e){if(void 0===e&&(e=!1),R){var n=j<R-1?j+1:0;A(n),U(n,e)}},G=function(e){var l=e?$:E,r=0;return D.map(function(e,o){e.isHeader&&(r=0),e.isListItem&&(r+=1);var a=function(){return e.segments.map(function(i,r){var o=i.isHighlight&&i.highlightIndex===j,a=i.text;return e.isListItem&&0===r&&(a=i.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),i.isHighlight?t("span",n({ref:function(e){e&&(l.current[i.highlightIndex]=e)},className:"".concat(h.highlight).concat(o?" ".concat(h.highlightActive):"")},{children:m(a)}),r):t("span",{children:m(a)},r)})};return e.isHeader?t("span",n({className:h.headerLine},{children:a()}),o):e.isListItem?i("span",n({className:h.listItemLine,style:{paddingLeft:e.indent?"1rem":"0"}},{children:[i("span",n({className:h.listCounter},{children:[r,"."]})),t("span",{children:a()})]}),o):t("span",n({className:h.blockLine},{children:a()}),o)})},J=function(e){return R>1?i("div",n({className:e?h.modalNavContainer:h.navigationContainer},{children:[z&&t("button",n({onClick:function(){return Y(e)},className:e?h.modalNavButton:h.navButton},{children:t(z,{className:h.navIcon})})),i("span",n({className:h.navCounter},{children:[j+1,"/",R]})),L&&t("button",n({onClick:function(){return q(e)},className:e?h.modalNavButton:h.navButton},{children:t(L,{className:h.navIcon})}))]})):null},K=null!=w?i("span",n({className:h.confidenceBadge},{children:[t("span",n({className:h.confidenceStar},{children:"✦"})),i("span",n({className:h.confidenceScore},{children:[w,"%"]}))]})):null,O=k?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,P=i(l,{children:[T&&t("div",n({className:h.footer,style:O},{children:t("span",n({className:h.trainingTitle},{children:T}))})),b&&t("div",n({className:h.modalFooterSource,style:O},{children:i("button",n({type:"button",onClick:function(){return null==x?void 0:x()},className:h.trainingTitleLink},{children:[b,t(s,{size:16,color:"#2563eb"})]}))}))]});return i(l,{children:[i("div",n({className:h.expandedContainer,style:n(n({},N?{height:"".concat(N),display:"flex",flexDirection:"column"}:void 0),k?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0)},{children:[i("div",n({className:h.expandedHeader,style:k?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0},{children:[t("span",n({className:h.headerTitle},{children:v})),i("div",n({className:h.headerActions},{children:[k?R>1&&i(l,{children:[i("span",n({style:{fontSize:"12px",color:"#888"}},{children:[j+1," / ",R]})),t("button",n({onClick:function(){return Y(!0)},disabled:j<=0,style:{padding:"2px 4px",cursor:j<=0?"not-allowed":"pointer",opacity:j<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(d,{size:14,color:"#64748b"})})),t("button",n({onClick:function(){return q(!0)},disabled:j>=R-1,style:{padding:"2px 4px",cursor:j>=R-1?"not-allowed":"pointer",opacity:j>=R-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(u,{size:14,color:"#64748b"})}))]}):J(!0),K,!I&&S&&t("button",n({onClick:function(){var e;return null===(e=V.current)||void 0===e?void 0:e.showModal()},className:h.maximizeButton,title:"View fullscreen"},{children:t(S,{className:h.maximizeIcon})}))]}))]})),t("div",n({ref:F,className:h.contentArea,style:n(n({},N?{flex:1,maxHeight:"none",overflowY:"auto",minHeight:0}:void 0),k?{padding:"1rem 1.5rem"}:void 0)},{children:t("div",n({className:h.contentInner},{children:G(!1)}))})),P]})),!I&&t("dialog",n({ref:V,className:h.modalDialog,onClick:function(e){var n;e.target===V.current&&(null===(n=V.current)||void 0===n||n.close())}},{children:i("div",n({className:h.modalContainer},{children:[i("div",n({className:h.modalHeader},{children:[t("span",n({className:h.modalHeaderTitle},{children:v})),i("div",n({className:h.modalHeaderActions},{children:[k?R>1&&i(l,{children:[i("span",n({style:{fontSize:"12px",color:"#888"}},{children:[j+1," / ",R]})),"just chill",t("button",n({onClick:function(){return Y(!0)},disabled:j<=0,style:{padding:"2px 4px",cursor:j<=0?"not-allowed":"pointer",opacity:j<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(d,{size:14,color:"#64748b"})})),t("button",n({onClick:function(){return q(!0)},disabled:j>=R-1,style:{padding:"2px 4px",cursor:j>=R-1?"not-allowed":"pointer",opacity:j>=R-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(u,{size:14,color:"#64748b"})}))]}):J(!0),K,_&&t("button",n({onClick:function(){var e;return null===(e=V.current)||void 0===e?void 0:e.close()},className:h.closeButton,title:"Close"},{children:t(_,{className:h.closeIcon})}))]}))]})),t("div",n({ref:M,className:h.modalContent},{children:t("div",n({className:h.modalContentInner},{children:G(!0)}))})),T&&t("div",n({className:h.modalFooter},{children:t("span",n({className:h.trainingTitle},{children:T}))})),b&&t("div",n({className:h.modalFooterSource},{children:i("button",n({type:"button",onClick:function(){var e;null==x||x(),null===(e=V.current)||void 0===e||e.close()},className:h.trainingTitleLink},{children:[b,t(s,{size:16,color:"#2563eb"})]}))}))]}))}))]})};export{p as default};
1
+ import{__spreadArray as n,__assign as e}from"tslib";import{jsxs as l,jsx as i,Fragment as o}from"react/jsx-runtime";import{useMemo as t,useState as r,useRef as a,useEffect as d}from"react";import{ExternalLink as s,ChevronUp as c,ChevronDown as u}from"lucide-react";import v from"./CognitiveNonWebSearchReasoning.module.css.js";var h=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.filter(Boolean).join(" ")},m=function(n){return n.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(n,l){return n.startsWith("**")&&n.endsWith("**")||n.startsWith("__")&&n.endsWith("__")?i("strong",e({className:v.boldText},{children:n.slice(2,-2)}),l):n})},g=function(g){var p=g.item,f=g.headerTitle;g.index;var x=g.iconsConfig,y=g.DocumentTitle,b=g.previewCallback,N=g.bodyHeight,C=g.disableMaximize,I=void 0!==C&&C,k=g.splitterCustomStyle,T=void 0!==k&&k,H=g.themeTokens,L=g.classNames,B=g.styles,w=p.dataSource,z=p.confidence_score,S=p.trainingDataTitle,A=null==x?void 0:x.ChevronDownIcon,F=null==x?void 0:x.ChevronUpIcon,_=null==x?void 0:x.MaximizeIcon,D=null==x?void 0:x.CloseIcon,R=t(function(){var e=(w?w.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),l=0,i=e.map(function(n){var e=n.startsWith("<highlight>"),i={text:e?n.replace(/<\/?highlight>/g,""):n,isHighlight:e,highlightIndex:e?l:-1};return e&&l++,i}),o=i.filter(function(n){return n.isHighlight}).length,t=[],r=[];return i.forEach(function(e){var l=e.text,i=e.isHighlight,o=e.highlightIndex;l.split("\n").forEach(function(e,l){l>0&&((r.length>0||t.length>0)&&t.push(n([],r,!0)),r=[]),e&&r.push({text:e,isHighlight:i,highlightIndex:o})})}),r.length>0&&t.push(n([],r,!0)),{processedLines:t.map(function(n){var e=n.map(function(n){return n.text}).join(""),l=e.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:n,isListItem:!!l,isHeader:!!e.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==l?void 0:l[1])||"",content:(null==l?void 0:l[3])||e}}),totalHighlights:o}},[w]),W=R.processedLines,j=R.totalHighlights,M=r(0),V=M[0],E=M[1],$=a(null),U=a(null),Y=a(null),q=a([]),G=a([]);d(function(){q.current=q.current.slice(0,j),G.current=G.current.slice(0,j)},[j]),d(function(){if(j>0){E(0);var n=setTimeout(function(){var n;null===(n=q.current[0])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(n)}}},[j]);var J=function(n,e){setTimeout(function(){var l=e?G.current[n]:q.current[n];null==l||l.scrollIntoView({behavior:"smooth",block:"center"})},50)},K=function(n){if(void 0===n&&(n=!1),j){var e=V>0?V-1:j-1;E(e),J(e,n)}},O=function(n){if(void 0===n&&(n=!1),j){var e=V<j-1?V+1:0;E(e),J(e,n)}},P=function(n){var o=n?G:q,t=0;return W.map(function(n,r){n.isHeader&&(t=0),n.isListItem&&(t+=1);var a=function(){return n.segments.map(function(l,t){var r=l.isHighlight&&l.highlightIndex===V,a=l.text;return n.isListItem&&0===t&&(a=l.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),l.isHighlight?i("span",e({ref:function(n){n&&(o.current[l.highlightIndex]=n)},className:h(v.highlight,r?v.highlightActive:void 0,null==L?void 0:L.highlight,r?null==L?void 0:L.highlightActive:void 0),style:r?e(e({},null==B?void 0:B.highlight),null==B?void 0:B.highlightActive):null==B?void 0:B.highlight},{children:m(a)}),t):i("span",{children:m(a)},t)})};return n.isHeader?i("span",e({className:h(v.headerLine,null==L?void 0:L.headerLine),style:null==B?void 0:B.headerLine},{children:a()}),r):n.isListItem?l("span",e({className:h(v.listItemLine,null==L?void 0:L.listItemLine),style:e({paddingLeft:n.indent?"1rem":"0"},null==B?void 0:B.listItemLine)},{children:[l("span",e({className:h(v.listCounter,null==L?void 0:L.listCounter),style:null==B?void 0:B.listCounter},{children:[t,"."]})),i("span",{children:a()})]}),r):i("span",e({className:h(v.blockLine,null==L?void 0:L.blockLine),style:null==B?void 0:B.blockLine},{children:a()}),r)})},Q=function(n){return j>1?l("div",e({className:h(n?v.modalNavContainer:v.navigationContainer,n?null==L?void 0:L.modalNavContainer:null==L?void 0:L.navigationContainer),style:n?null==B?void 0:B.modalNavContainer:null==B?void 0:B.navigationContainer},{children:[F&&i("button",e({onClick:function(){return K(n)},className:h(n?v.modalNavButton:v.navButton,null==L?void 0:L.navButton),style:null==B?void 0:B.navButton},{children:i(F,{className:h(v.navIcon,null==L?void 0:L.navIcon),style:null==B?void 0:B.navIcon})})),l("span",e({className:h(v.navCounter,null==L?void 0:L.navCounter),style:null==B?void 0:B.navCounter},{children:[V+1,"/",j]})),A&&i("button",e({onClick:function(){return O(n)},className:h(n?v.modalNavButton:v.navButton,null==L?void 0:L.navButton),style:null==B?void 0:B.navButton},{children:i(A,{className:h(v.navIcon,null==L?void 0:L.navIcon),style:null==B?void 0:B.navIcon})}))]})):null},X=null!=z?l("span",e({className:h(v.confidenceBadge,null==L?void 0:L.confidenceBadge),style:null==B?void 0:B.confidenceBadge},{children:[i("span",e({className:v.confidenceStar},{children:"✦"})),l("span",e({className:v.confidenceScore},{children:[z,"%"]}))]})):null,Z=T?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,nn=l(o,{children:[S&&i("div",e({className:h(v.footer,null==L?void 0:L.footer),style:e(e({},Z),null==B?void 0:B.footer)},{children:i("span",e({className:h(v.trainingTitle,null==L?void 0:L.trainingTitle),style:null==B?void 0:B.trainingTitle},{children:S}))})),y&&i("div",e({className:h(v.modalFooterSource,null==L?void 0:L.modalFooterSource),style:e(e({},Z),null==B?void 0:B.modalFooterSource)},{children:l("button",e({type:"button",onClick:function(){return null==b?void 0:b()},className:h(v.trainingTitleLink,null==L?void 0:L.trainingTitleLink),style:null==B?void 0:B.trainingTitleLink},{children:[y,i(s,{size:16,color:"#2563eb"})]}))}))]});return l(o,{children:[l("div",e({className:h(v.expandedContainer,null==L?void 0:L.expandedContainer),style:e(e(e(e({},H),N?{height:"".concat(N),display:"flex",flexDirection:"column"}:void 0),T?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0),null==B?void 0:B.expandedContainer)},{children:[l("div",e({className:h(v.expandedHeader,null==L?void 0:L.expandedHeader),style:e(e({},T?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0),null==B?void 0:B.expandedHeader)},{children:[i("span",e({className:h(v.headerTitle,null==L?void 0:L.headerTitle),style:null==B?void 0:B.headerTitle},{children:f})),l("div",e({className:h(v.headerActions,null==L?void 0:L.headerActions),style:null==B?void 0:B.headerActions},{children:[T?j>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[V+1," / ",j]})),i("button",e({onClick:function(){return K(!0)},disabled:V<=0,style:{padding:"2px 4px",cursor:V<=0?"not-allowed":"pointer",opacity:V<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(c,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return O(!0)},disabled:V>=j-1,style:{padding:"2px 4px",cursor:V>=j-1?"not-allowed":"pointer",opacity:V>=j-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):Q(!1),X,!I&&_&&i("button",e({onClick:function(){var n;return null===(n=Y.current)||void 0===n?void 0:n.showModal()},className:h(v.maximizeButton,null==L?void 0:L.maximizeButton),style:null==B?void 0:B.maximizeButton,title:"View fullscreen"},{children:i(_,{className:v.maximizeIcon})}))]}))]})),i("div",e({ref:$,className:h(v.contentArea,null==L?void 0:L.contentArea),style:e(e(e({},N?{flex:1,maxHeight:"none",overflowY:"auto",minHeight:0}:void 0),T?{padding:"1rem 1.5rem"}:void 0),null==B?void 0:B.contentArea)},{children:i("div",e({className:h(v.contentInner,null==L?void 0:L.contentInner),style:null==B?void 0:B.contentInner},{children:P(!1)}))})),nn]})),!I&&i("dialog",e({ref:Y,className:v.modalDialog,onClick:function(n){var e;n.target===Y.current&&(null===(e=Y.current)||void 0===e||e.close())}},{children:l("div",e({className:h(v.modalContainer,null==L?void 0:L.modalContainer),style:null==B?void 0:B.modalContainer},{children:[l("div",e({className:h(v.modalHeader,null==L?void 0:L.modalHeader),style:null==B?void 0:B.modalHeader},{children:[i("span",e({className:h(v.modalHeaderTitle,null==L?void 0:L.modalHeaderTitle),style:null==B?void 0:B.modalHeaderTitle},{children:f})),l("div",e({className:h(v.modalHeaderActions,null==L?void 0:L.modalHeaderActions),style:null==B?void 0:B.modalHeaderActions},{children:[T?j>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[V+1," / ",j]})),i("button",e({onClick:function(){return K(!0)},disabled:V<=0,style:{padding:"2px 4px",cursor:V<=0?"not-allowed":"pointer",opacity:V<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(c,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return O(!0)},disabled:V>=j-1,style:{padding:"2px 4px",cursor:V>=j-1?"not-allowed":"pointer",opacity:V>=j-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):Q(!0),X,D&&i("button",e({onClick:function(){var n;return null===(n=Y.current)||void 0===n?void 0:n.close()},className:h(v.closeButton,null==L?void 0:L.closeButton),style:null==B?void 0:B.closeButton,title:"Close"},{children:i(D,{className:h(v.closeIcon,null==L?void 0:L.closeIcon),style:null==B?void 0:B.closeIcon})}))]}))]})),i("div",e({ref:U,className:h(v.modalContent,null==L?void 0:L.modalContent),style:null==B?void 0:B.modalContent},{children:i("div",e({className:h(v.modalContentInner,null==L?void 0:L.modalContentInner),style:null==B?void 0:B.modalContentInner},{children:P(!0)}))})),S&&i("div",e({className:h(v.modalFooter,null==L?void 0:L.modalFooter),style:null==B?void 0:B.modalFooter},{children:i("span",e({className:h(v.trainingTitle,null==L?void 0:L.trainingTitle),style:null==B?void 0:B.trainingTitle},{children:S}))})),y&&i("div",e({className:h(v.modalFooterSource,null==L?void 0:L.modalFooterSource),style:null==B?void 0:B.modalFooterSource},{children:l("button",e({type:"button",onClick:function(){var n;null==b||b(),null===(n=Y.current)||void 0===n||n.close()},className:h(v.trainingTitleLink,null==L?void 0:L.trainingTitleLink),style:null==B?void 0:B.trainingTitleLink},{children:[y,i(s,{size:16,color:"#2563eb"})]}))}))]}))}))]})};export{g as default};
2
2
  //# sourceMappingURL=CognitiveInternalgptCoreComponent.js.map