@e-llm-studio/citation 0.0.227 → 0.0.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -0
- package/dist/cjs/features/BPACitationRenderer/BPACitationRenderer.js +2 -0
- package/dist/cjs/features/BPACitationRenderer/BPACitationRenderer.js.map +1 -0
- package/dist/cjs/features/{ParentCitationComponent → BPACitationRenderer}/citationTypes.js +1 -1
- package/dist/cjs/features/DualCitation/RuleBookCitationComponent.js +1 -1
- package/dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js +2 -0
- package/dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js.map +1 -0
- package/dist/cjs/features/PromptemonViewer/PromptemonViewer.js +2 -0
- package/dist/cjs/features/PromptemonViewer/PromptemonViewer.js.map +1 -0
- package/dist/cjs/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
- package/dist/cjs/features/SplitterCitations/icons/icons.js +2 -0
- package/dist/cjs/features/SplitterCitations/icons/icons.js.map +1 -0
- package/dist/cjs/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/features/BPACitationRenderer/BPACitationRenderer.js +2 -0
- package/dist/features/BPACitationRenderer/BPACitationRenderer.js.map +1 -0
- package/dist/features/{ParentCitationComponent → BPACitationRenderer}/citationTypes.js +1 -1
- package/dist/features/DualCitation/RuleBookCitationComponent.js +1 -1
- package/dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js +2 -0
- package/dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js.map +1 -0
- package/dist/features/PromptemonViewer/PromptemonViewer.js +2 -0
- package/dist/features/PromptemonViewer/PromptemonViewer.js.map +1 -0
- package/dist/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
- package/dist/features/SplitterCitations/icons/icons.js +2 -0
- package/dist/features/SplitterCitations/icons/icons.js.map +1 -0
- package/dist/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/src/PromptemonBlockViewerTest.d.ts +3 -0
- package/dist/types/src/PromptemonBlockViewerTest.d.ts.map +1 -0
- package/dist/types/src/PromptemonViewerTest.d.ts +3 -0
- package/dist/types/src/PromptemonViewerTest.d.ts.map +1 -0
- package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.d.ts +5 -0
- package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.d.ts.map +1 -0
- package/dist/types/src/features/{ParentCitationComponent/ParentCitationComponent.types.d.ts → BPACitationRenderer/BPACitationRenderer.types.d.ts} +1 -1
- package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.types.d.ts.map +1 -0
- package/dist/types/src/features/BPACitationRenderer/BPACitationRendererTest.d.ts +6 -0
- package/dist/types/src/features/BPACitationRenderer/BPACitationRendererTest.d.ts.map +1 -0
- package/dist/types/src/features/BPACitationRenderer/DualRuleBookBqCitationTest.d.ts.map +1 -0
- package/dist/types/src/features/BPACitationRenderer/DualRuleBookGptCitationTest.d.ts.map +1 -0
- package/dist/types/src/features/BPACitationRenderer/ILRuleBookCitationTest.d.ts +4 -0
- package/dist/types/src/features/BPACitationRenderer/ILRuleBookCitationTest.d.ts.map +1 -0
- package/dist/types/src/features/{ParentCitationComponent → BPACitationRenderer}/citationTypes.d.ts +1 -0
- package/dist/types/src/features/BPACitationRenderer/citationTypes.d.ts.map +1 -0
- package/dist/types/src/features/DualCitation/RuleBookCitationComponent.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts +1 -1
- package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts.map +1 -1
- package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts +11 -0
- package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts.map +1 -0
- package/dist/types/src/features/PromptemonBlockViewer/index.d.ts +3 -0
- package/dist/types/src/features/PromptemonBlockViewer/index.d.ts.map +1 -0
- package/dist/types/src/features/PromptemonViewer/PromptemonViewer.d.ts +43 -0
- package/dist/types/src/features/PromptemonViewer/PromptemonViewer.d.ts.map +1 -0
- package/dist/types/src/features/PromptemonViewer/index.d.ts +3 -0
- package/dist/types/src/features/PromptemonViewer/index.d.ts.map +1 -0
- package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts +1 -21
- package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts.map +1 -1
- package/dist/types/src/features/SplitterCitations/icons/icons.d.ts +17 -0
- package/dist/types/src/features/SplitterCitations/icons/icons.d.ts.map +1 -0
- package/dist/types/src/features/SplitterCitations/types.d.ts +78 -0
- package/dist/types/src/features/SplitterCitations/types.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +6 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +15 -5
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/DualRuleBookBqCitationTest.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/DualRuleBookGptCitationTest.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -5
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.types.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -6
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/citationTypes.d.ts.map +0 -1
- /package/dist/cjs/features/{ParentCitationComponent → BPACitationRenderer}/citationTypes.js.map +0 -0
- /package/dist/features/{ParentCitationComponent → BPACitationRenderer}/citationTypes.js.map +0 -0
- /package/dist/types/src/features/{ParentCitationComponent → BPACitationRenderer}/DualRuleBookBqCitationTest.d.ts +0 -0
- /package/dist/types/src/features/{ParentCitationComponent → BPACitationRenderer}/DualRuleBookGptCitationTest.d.ts +0 -0
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
- [SplitterCitationsComponent](#splittercitationscomponent) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/SplitterCitations/README.md)
|
|
38
38
|
- [RuleBookCitationWrapper](#RuleBookCitationWrapper) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/RuleBookCitations/README.md)
|
|
39
39
|
-[ManageReminders](#ManageReminders) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ManageRemainders/README.md)
|
|
40
|
+
- [PromptemonBlockViewer](#promptemonblockviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonBlockViewer/PromptemonBlockViewerReadme.md)
|
|
41
|
+
- [PromptemonViewer](#promptemonviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonViewer/PromptemonViewerReadme.md)
|
|
40
42
|
4. [Common Use Cases](#common-use-cases)
|
|
41
43
|
5. [Development & Contribution](#development--contribution)
|
|
42
44
|
6. [License](#license)
|
|
@@ -3110,6 +3112,116 @@ Renders: `[3] ⠋` (spinner) until `isStreaming` becomes `false`.
|
|
|
3110
3112
|
|
|
3111
3113
|
---
|
|
3112
3114
|
|
|
3115
|
+
|
|
3116
|
+
---
|
|
3117
|
+
|
|
3118
|
+
## PromptemonBlockViewer
|
|
3119
|
+
|
|
3120
|
+
### Overview
|
|
3121
|
+
|
|
3122
|
+
A Monaco-based code editor component for viewing and highlighting prompt blocks. Supports XML tag highlighting, variable highlighting, dark/light theme toggling, and a fullscreen dialog with a description panel.
|
|
3123
|
+
|
|
3124
|
+
### Features
|
|
3125
|
+
|
|
3126
|
+
- **Monaco editor with custom syntax highlighting** — XML tags and `{{variables}}` highlighted with custom token colors
|
|
3127
|
+
- **XML tag highlighting** — Scrolls to and highlights a specific XML tag block
|
|
3128
|
+
- **Variable highlighting** — Highlights all occurrences of a `{{variable}}`
|
|
3129
|
+
- **Dark/light theme toggle** — Switch between themes with a toggle
|
|
3130
|
+
- **Fullscreen dialog** — Description panel on left, full editor on right
|
|
3131
|
+
|
|
3132
|
+
### Usage
|
|
3133
|
+
|
|
3134
|
+
```tsx
|
|
3135
|
+
import PromptemonBlockViewer from '@e-llm-studio/citation/PromptemonBlockViewer'
|
|
3136
|
+
|
|
3137
|
+
<PromptemonBlockViewer
|
|
3138
|
+
title="role"
|
|
3139
|
+
description="This APB establishes the core identity of the AI Assistant."
|
|
3140
|
+
content={`<Role>\nYou are a {{ORGANIZATION_NAME}} AI Assistant.\n</Role>`}
|
|
3141
|
+
height={300}
|
|
3142
|
+
selectedTag="Role"
|
|
3143
|
+
highlightVariable="{{ORGANIZATION_NAME}}"
|
|
3144
|
+
/>
|
|
3145
|
+
```
|
|
3146
|
+
|
|
3147
|
+
### Props
|
|
3148
|
+
|
|
3149
|
+
| Prop Name | Type | Required | Default | Description |
|
|
3150
|
+
|-----------|------|----------|---------|-------------|
|
|
3151
|
+
| `title` | `string` | ✅ | — | Title shown in header and fullscreen dialog |
|
|
3152
|
+
| `content` | `string` | ✅ | — | Prompt content to display in the editor |
|
|
3153
|
+
| `description` | `string` | ❌ | — | Description shown in fullscreen left panel |
|
|
3154
|
+
| `height` | `number` | ❌ | `250` | Height of mini editor in pixels |
|
|
3155
|
+
| `selectedTag` | `string` | ❌ | — | XML tag name to highlight and scroll to |
|
|
3156
|
+
| `highlightVariable` | `string` | ❌ | — | Variable string to highlight |
|
|
3157
|
+
|
|
3158
|
+
---
|
|
3159
|
+
|
|
3160
|
+
## PromptemonViewer
|
|
3161
|
+
|
|
3162
|
+
### Overview
|
|
3163
|
+
|
|
3164
|
+
A full-featured interface for viewing, editing, and managing Functional Prompt Blocks (FPBs). Combines a detailed left panel showing FPB metadata with a Monaco-based right panel for viewing prompt content and extracted segments. Consumer-controlled — all API calls and state management are handled by the consumer.
|
|
3165
|
+
|
|
3166
|
+
### Features
|
|
3167
|
+
|
|
3168
|
+
- **Full FPB metadata panel** — Title, description, categories, APBs, applicability, specifications
|
|
3169
|
+
- **Edit mode** — Inline editing with confirm/cancel flow
|
|
3170
|
+
- **Segment chips** — Shows extracted `{{variable}}` segments per APB after extraction
|
|
3171
|
+
- **Monaco editor** — Switches to segmentized content after extraction
|
|
3172
|
+
- **Extract Segments flow** — Loading overlay while extracting
|
|
3173
|
+
- **Save FPB** — Enabled after extraction, locks editing after save
|
|
3174
|
+
- **Category/Sub-category selection** — Consumer provides categories and handles creation
|
|
3175
|
+
|
|
3176
|
+
### Usage
|
|
3177
|
+
|
|
3178
|
+
```tsx
|
|
3179
|
+
import PromptemonViewer from '@e-llm-studio/citation/PromptemonViewer'
|
|
3180
|
+
|
|
3181
|
+
<PromptemonViewer
|
|
3182
|
+
block={myFPBBlock}
|
|
3183
|
+
onBlockUpdate={setBlock}
|
|
3184
|
+
isExtracting={isExtracting}
|
|
3185
|
+
isExtracted={isExtracted}
|
|
3186
|
+
onExtractSegments={handleExtractSegments}
|
|
3187
|
+
isSaving={isSaving}
|
|
3188
|
+
isSaved={isSaved}
|
|
3189
|
+
onSave={handleSave}
|
|
3190
|
+
onBack={() => navigate(-1)}
|
|
3191
|
+
categories={categories}
|
|
3192
|
+
subCategories={subCategories}
|
|
3193
|
+
selectedCategoryId={selectedCategoryId}
|
|
3194
|
+
selectedSubCategoryId={selectedSubCategoryId}
|
|
3195
|
+
onCategoryChange={(id) => setSelectedCategoryId(id)}
|
|
3196
|
+
onSubCategoryChange={(id) => setSelectedSubCategoryId(id)}
|
|
3197
|
+
/>
|
|
3198
|
+
```
|
|
3199
|
+
|
|
3200
|
+
### Props
|
|
3201
|
+
|
|
3202
|
+
| Prop Name | Type | Required | Description |
|
|
3203
|
+
|-----------|------|----------|-------------|
|
|
3204
|
+
| `block` | `any` | ✅ | FPB block object |
|
|
3205
|
+
| `onBlockUpdate` | `(updatedBlock: any) => void` | ✅ | Called when user confirms edits |
|
|
3206
|
+
| `isExtracting` | `boolean` | ✅ | Shows loading overlay while true |
|
|
3207
|
+
| `isExtracted` | `boolean` | ✅ | Shows segment chips and enables Save when true |
|
|
3208
|
+
| `onExtractSegments` | `() => void` | ✅ | Called when Extract Segments is clicked |
|
|
3209
|
+
| `isSaving` | `boolean` | ✅ | Shows "Saving..." while true |
|
|
3210
|
+
| `isSaved` | `boolean` | ✅ | Shows "Saved ✓" and locks editing when true |
|
|
3211
|
+
| `onSave` | `() => void` | ✅ | Called when Save FPB is clicked |
|
|
3212
|
+
| `onBack` | `() => void` | ✅ | Called when back/close is clicked |
|
|
3213
|
+
| `title` | `string` | ❌ | Title shown in top bar (default: "FPB Promptemon") |
|
|
3214
|
+
| `categories` | `SPBCategory[]` | ✅ | List of categories |
|
|
3215
|
+
| `subCategories` | `SPBSubCategory[]` | ✅ | List of sub-categories |
|
|
3216
|
+
| `selectedCategoryId` | `string` | ✅ | Currently selected category ID |
|
|
3217
|
+
| `selectedSubCategoryId` | `string` | ✅ | Currently selected sub-category ID |
|
|
3218
|
+
| `onCategoryChange` | `(id: string) => void` | ✅ | Called when category is selected |
|
|
3219
|
+
| `onSubCategoryChange` | `(id: string) => void` | ✅ | Called when sub-category is selected |
|
|
3220
|
+
| `onAddCategory` | `(data: { name: string; description: string }) => Promise<void>` | ❌ | Called when new category is created |
|
|
3221
|
+
| `onAddSubCategory` | `(data: { name: string; description: string; categoryId: string }) => Promise<void>` | ❌ | Called when new sub-category is created |
|
|
3222
|
+
| `showEditMode` | `boolean` | ❌ | `true` | Show/hide the edit pencil icon and edit mode |
|
|
3223
|
+
| `showExtractSegments` | `boolean` | ❌ | `true` | Show/hide the Extract Segments button and Show Segments toggle |
|
|
3224
|
+
|
|
3113
3225
|
## EmailCitation
|
|
3114
3226
|
|
|
3115
3227
|
A composable React UI component for rendering email-style citations with rich formatting, attachments, and highlight/quote handling. Part of the `@e-llm-studio/citation` package, this component is designed to display email content (subject, sender, recipients, body, attachments, timestamps) in an expandable, accessible, and customizable way.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),e=require("lucide-react"),a=require("@mui/material/Dialog"),o=require("@mui/material/DialogTitle"),l=require("@mui/material/DialogContent"),r=require("@mui/material/IconButton"),s=require("dayjs"),u=require("../ScannedDocCitation/ScannedDocCitation.js"),d=require("../InstantLearningCitation/InstantLearningCitationComponent.js"),c=require("../InstantLearningCitation/SlashLoader.js"),g=require("../CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),v=require("../RequirementAiCitations/ImageCitation/ImageCitationContent.js"),C=require("../RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),h=require("../ChatCitation/ChatCitationRenderer.js"),T=require("../DualCitation/RuleBookCitationComponent.js"),_=require("../CitationRenderer/CitationRenderer.js"),f=require("../SplitterCitations/SplitterCitationsComponent.js"),p=require("../DualCitation/SourceBQDataCompnent.js"),I=require("./citationTypes.js");function m(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var D=m(a),S=m(o),P=m(l),x=m(r),A=m(s),j=function(i,n,t){if(!i)throw new Error("[BPACitationRenderer] ".concat(n,': missing required field "').concat(t,'" in customMetaData'))},O=function(i,n){if(!Object.values(i).some(Boolean))throw new Error("[BPACitationRenderer] ".concat(n,': missing one of "').concat(Object.keys(i).join('", "'),'" in customMetaData'))},E=function(a){var o=a.children,l=a.content,r=t.useState(!1),s=r[0],u=r[1];return n.jsxs(n.Fragment,{children:[n.jsx("span",i.__assign({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",fontSize:"14px",fontWeight:400,color:"#526eff"},onClick:function(){return u(!0)}},{children:o})),n.jsxs(D.default,i.__assign({open:s,onClose:function(){return u(!1)},maxWidth:"md",fullWidth:!0},{children:[n.jsxs(S.default,i.__assign({style:{fontWeight:"bold"}},{children:["Guidelines",n.jsx(x.default,i.__assign({edge:"end",onClick:function(){return u(!1)},"aria-label":"close",style:{position:"absolute",top:5,right:16},size:"large"},{children:n.jsx(e.X,{})}))]})),n.jsx(P.default,i.__assign({style:{maxHeight:"70vh",overflow:"auto"}},{children:l}))]}))]})},b=function(a){var o,l,r,s,m,D,S,P,x,N,R,L,w,y,U,B,q,Y,k,H,G,W,z,F,M,K,Q,X=a.href,J=a.children,V=a.isStreaming,Z=a.onCitationToggle,$=a.chatCitationConfig,ii=a.scannedDocCitationConfig,ni=a.ruleBookCitationConfig,ti=a.ilCitationConfig,ei=a.gptCitationConfig,ai=a.scannedDocCitationData,oi=a.ilCitationData,li=a.chatCitationData,ri=a.gptCitationData,si=a.webCitationData,ui=a.imageCitationData,di=a.bqCitationData,ci=a.title,gi=a.citationIcon,vi=a.isDualCitationFlag,Ci=void 0!==vi&&vi,hi=t.useState(!1),Ti=hi[0],_i=hi[1];if(V)return n.jsxs("span",i.__assign({style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontWeight:500,color:"#6D28D9"}},{children:[n.jsx("span",{children:J}),n.jsx(c.default,{})]}));try{var fi=new URL(X,"http://example.com"),pi=null!==(o=fi.searchParams.get("citationNumber"))&&void 0!==o?o:fi.searchParams.get("citation_number"),Ii=null!==(l=fi.searchParams.get("decisionStrength"))&&void 0!==l?l:fi.searchParams.get("decision_strength"),mi=fi.searchParams.get("citation_type"),Di=Ci||mi===I.CITATION_TYPES.DUAL;if(!pi)return null;if(mi===I.CITATION_TYPES.SCANNED_DOC){var Si=null==ai?void 0:ai.pages;if(null==Si?void 0:Si.length)return n.jsx(u.default,i.__assign({pages:Si,subHeadingText:null==ai?void 0:ai.artifactTitle},ii));j(null==ai?void 0:ai.gsUrl,"scanned_doc_citation","gs_url");var Pi=[ai.gsUrl],xi=(null!==(r=null==ai?void 0:ai.highlightedCoordinates)&&void 0!==r?r:[]).map(function(i,n){return{pageIndex:n,bboxes:[i]}});return n.jsx(u.default,i.__assign({images:Pi,highlights:xi},ii))}if(mi===I.CITATION_TYPES.IL){j(null==oi?void 0:oi.ilLearning,"IL","il_learning");var Ai=J||(null==oi?void 0:oi.linkText)||(null==oi?void 0:oi.citationSource)||String(null!==(s=null==oi?void 0:oi.citationNumber)&&void 0!==s?s:1);return n.jsx(d.default,{ilLearning:oi.ilLearning,ilLearningHighlights:null==oi?void 0:oi.ilLearningHighlights,comparisonHighlights:null==oi?void 0:oi.comparisonHighlights,decisionStrength:Ii||(null==oi?void 0:oi.decisionStrength)||"",linkTitle:Ai,onCitationToggle:null!=Z?Z:function(){},config:ti})}if(mi===I.CITATION_TYPES.CHAT){var ji=null!=$?$:{},Oi=null===(D=null!==(m=null==li?void 0:li.chatData)&&void 0!==m?m:[])||void 0===D?void 0:D.map(function(n){return i.__assign(i.__assign({},n),{timeStamp:A.default(n.timeStamp)})}),Ei=!!(null==li?void 0:li.ruleBookContent);return n.jsx(h.default,{showRootContainer:null===(S=ji.showRootContainer)||void 0===S||S,reversePanels:ji.reversePanels,isRenderedCustomComponent:ji.isRenderedCustomComponent,modalContainerStyle:ji.modalContainerStyle,additionalData:ji.additionalData,closePreview:ji.closePreview,selectedIdFromReason:null!==(P=ji.selectedIdFromReason)&&void 0!==P?P:void 0,rootContainer:i.__assign(i.__assign({},ji.rootContainer),{relevanceScore:null==li?void 0:li.relevanceScore}),chatContainer:i.__assign(i.__assign({},ji.chatContainer),{chatData:Oi,summarizedTab:i.__assign(i.__assign({},null===(x=ji.chatContainer)||void 0===x?void 0:x.summarizedTab),{chip:i.__assign({isActive:!0,show:!0},null===(R=null===(N=ji.chatContainer)||void 0===N?void 0:N.summarizedTab)||void 0===R?void 0:R.chip)}),detailedTab:i.__assign(i.__assign({},null===(L=ji.chatContainer)||void 0===L?void 0:L.detailedTab),{chip:i.__assign({isActive:!1},null===(y=null===(w=ji.chatContainer)||void 0===w?void 0:w.detailedTab)||void 0===y?void 0:y.chip)})}),ruleBookContainer:Ei?i.__assign(i.__assign({},ji.ruleBookContainer),{data:{content:li.ruleBookContent,highlighted_texts:null!==(U=null==li?void 0:li.ruleBookHighlights)&&void 0!==U?U:[]}}):void 0})}if(mi===I.CITATION_TYPES.GPT){var bi=null==ri?void 0:ri.value,Ni=null!==(B=null==bi?void 0:bi.text)&&void 0!==B?B:null===(q=null==ri?void 0:ri.dataSources)||void 0===q?void 0:q[0],Ri=null!==(Y=null==bi?void 0:bi.label)&&void 0!==Y?Y:null===(k=null==ri?void 0:ri.trainingDataTitle)||void 0===k?void 0:k[0],Li=null!==(H=null==bi?void 0:bi.paraphrase)&&void 0!==H?H:null===(G=null==ri?void 0:ri.paraphrase)||void 0===G?void 0:G[0];O({data_sources:Ni,training_data_title:Ri},I.CITATION_TYPES.GPT);var wi={text:"",dataSource:Ni,trainingDataTitle:Ri,paraphrase:Li},yi=null!==(W=null==ei?void 0:ei.iconsConfig)&&void 0!==W?W:{ChevronDownIcon:e.ChevronDown,ChevronUpIcon:e.ChevronUp,MaximizeIcon:e.Maximize2,CloseIcon:e.X};return n.jsx(g.default,{item:wi,headerTitle:null!==(z=null==ei?void 0:ei.headerTitle)&&void 0!==z?z:"GPT - Gemini 3.5 Flash",iconsConfig:yi,previewCallback:null==ei?void 0:ei.previewCallback,DocumentTitle:null==ei?void 0:ei.DocumentTitle,disableMaximize:Di})}if(mi===I.CITATION_TYPES.WEB){!function(i,n,t){j(i,n,t);try{new URL(i)}catch(e){throw new Error("[BPACitationRenderer] ".concat(n,': "').concat(t,'" is not a valid URL: "').concat(i,'"'))}}(null==si?void 0:si.link,I.CITATION_TYPES.WEB,"link");var Ui=si.link,Bi=J||(null==si?void 0:si.citationSource)||Ui;return(null==si?void 0:si.screenshotUrl)?n.jsx(C.default,{url:Ui,label:Bi,gsUtilPath:null==si?void 0:si.gsUtilPath,signedUrl:si.screenshotUrl,relevanceScore:null==si?void 0:si.relevanceScore,visitIcon:e.ExternalLink,PreviewDialogCloseIcon:e.X}):n.jsx("a",i.__assign({href:Ui,target:"_blank",rel:"noreferrer"},{children:Bi}))}if(mi===I.CITATION_TYPES.IMAGE)return O({gs_util_path:null==ui?void 0:ui.gsUtilPath,signed_url:null==ui?void 0:ui.signedUrl},I.CITATION_TYPES.IMAGE),n.jsx(v.default,{citationTitle:J||(null==ui?void 0:ui.citationSource),gsUtilPath:null==ui?void 0:ui.gsUtilPath,signedUrl:null==ui?void 0:ui.signedUrl,relevanceScore:null==ui?void 0:ui.relevanceScore});if(mi===I.CITATION_TYPES.BQ_DATA)return O({href_params:null==di?void 0:di.hrefParams,source_obj:null==di?void 0:di.sourceObj},I.CITATION_TYPES.BQ_DATA),n.jsx(p.SourcesBQCitation,i.__assign({hrefParams:di.hrefParams,sourceObj:di.sourceObj,showChevron:!1,defaultOpen:!0},{children:J||""}));if(mi===I.CITATION_TYPES.RULEBOOK||mi===I.CITATION_TYPES.RULEBOOK_CHUNK){var qi=pi?parseInt(pi,10):0,Yi=n.jsx(T.default,{url:null!==(F=null==ni?void 0:ni.url)&&void 0!==F?F:"",data:{citationNumber:null!==(K=null===(M=null==ni?void 0:ni.data)||void 0===M?void 0:M.citationNumber)&&void 0!==K?K:qi,fileDetails:null===(Q=null==ni?void 0:ni.data)||void 0===Q?void 0:Q.fileDetails},msg:null==ni?void 0:ni.msg,citationIndex:null==ni?void 0:ni.citationIndex,guidelines:null==ni?void 0:ni.guidelines,additionalClassNames:null==ni?void 0:ni.additionalClassNames,headerTitle:null==ni?void 0:ni.headerTitle,InternalGptReasoningData:null==ni?void 0:ni.InternalGptReasoningData,isDataProvided:null==ni?void 0:ni.isDataProvided,textualContent:null==ni?void 0:ni.textualContent,phraseToHighlight:null==ni?void 0:ni.phraseToHighlight,IgptHeaderTitle:null==ni?void 0:ni.IgptHeaderTitle,isInternalGptReasoningLoading:null==ni?void 0:ni.isInternalGptReasoningLoading,onAccordionToggle:null==ni?void 0:ni.onAccordionToggle});return Ci?Yi:n.jsx(E,i.__assign({content:Yi},{children:J}))}if(mi===I.CITATION_TYPES.IL_RULEBOOK){var ki=n.jsx(T.default,{headerTitle:null==ni?void 0:ni.headerTitle,InternalGptReasoningData:null==ni?void 0:ni.InternalGptReasoningData,isDataProvided:null==ni?void 0:ni.isDataProvided,textualContent:null==ni?void 0:ni.textualContent,phraseToHighlight:null==ni?void 0:ni.phraseToHighlight,IgptHeaderTitle:null==ni?void 0:ni.IgptHeaderTitle,onAccordionToggle:null==ni?void 0:ni.onAccordionToggle,isInternalGptReasoningLoading:null==ni?void 0:ni.isInternalGptReasoningLoading});return Ci?ki:n.jsx(E,i.__assign({content:ki},{children:J}))}if(mi===I.CITATION_TYPES.DUAL){var Hi=fi.searchParams.get("left_citation_type"),Gi=fi.searchParams.get("right_citation_type");if(Hi===I.CITATION_TYPES.DUAL||Gi===I.CITATION_TYPES.DUAL)return console.error("left or right citation type cant be dual_citation"),null;var Wi=function(i,n){var t="".concat(i,"."),e="left"===i?"right.":"left.",a=new URLSearchParams;return fi.searchParams.forEach(function(i,n){"citation_type"!==n&&"left_citation_type"!==n&&"right_citation_type"!==n&&(n.startsWith(t)||n.startsWith(e)||a.set(n,i))}),fi.searchParams.forEach(function(i,n){n.startsWith(t)&&a.set(n.slice(t.length),i)}),n&&a.set("citation_type",n),"?".concat(a.toString())},zi=Wi("left",Hi),Fi=Wi("right",Gi),Mi=J||ci||"Source and Guidelines",Ki=function(i){switch(i){case I.CITATION_TYPES.SCANNED_DOC:return{scannedDocCitationData:ai,scannedDocCitationConfig:ii};case I.CITATION_TYPES.IL:return{ilCitationData:oi,ilCitationConfig:ti};case I.CITATION_TYPES.CHAT:return{chatCitationData:li,chatCitationConfig:$};case I.CITATION_TYPES.GPT:return{gptCitationData:ri,gptCitationConfig:ei};case I.CITATION_TYPES.WEB:return{webCitationData:si};case I.CITATION_TYPES.IMAGE:return{imageCitationData:ui};case I.CITATION_TYPES.BQ_DATA:return{bqCitationData:di};case I.CITATION_TYPES.RULEBOOK:return{ruleBookCitationConfig:ni};default:return{}}};return n.jsx(_.default,{inLineCitation:!0,citationTitle:Mi,citationIcon:gi,isOpen:Ti,onToggle:function(){return _i(function(i){return!i})},styles:{pillButton:{fontSize:"14px",margin:"0px",padding:"0px",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",background:"white",border:"none"},citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"}},citationComponent:n.jsx(f.default,{left:n.jsx(b,i.__assign({href:zi,onCitationToggle:Z},Ki(Hi),{isDualCitationFlag:!0})),right:n.jsx(b,i.__assign({href:Fi,onCitationToggle:Z,isDualCitationFlag:!0},Ki(Gi))),header:{title:Mi,showDocIcon:!1},openInFullscreen:!0,fullscreenOnly:!0,onFullscreenClose:function(){return _i(!1)}})})}console.warn('[BPACitationRenderer] unhandled citation_type: "'.concat(mi,'"'))}catch(i){return console.error(i),null}return null};exports.default=b;
|
|
2
|
+
//# sourceMappingURL=BPACitationRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BPACitationRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.CITATION_TYPES={SCANNED_DOC:"scanned_doc_citation",IL:"IL",CHAT:"chat_citation",GPT:"gpt_citation",WEB:"web_citation",IMAGE:"image_citation",BQ_DATA:"bq_data",RULEBOOK:"rulebook_citation",IL_RULEBOOK:"il_rulebook_citation",DUAL:"dual_citation"};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.CITATION_TYPES={SCANNED_DOC:"scanned_doc_citation",IL:"IL",CHAT:"chat_citation",GPT:"gpt_citation",WEB:"web_citation",IMAGE:"image_citation",BQ_DATA:"bq_data",RULEBOOK:"rulebook_citation",RULEBOOK_CHUNK:"rulebook_chunk",IL_RULEBOOK:"il_rulebook_citation",DUAL:"dual_citation"};
|
|
2
2
|
//# sourceMappingURL=citationTypes.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),l=require("lucide-react"),t=require("../TextualGuidelines/TextualGuideLinesComponent.js"),r=require("./RuleBookCitationApiComponent.js");exports.default=function(o){var a,s,d,u,c,v,g=o.data,f=o.msg,p=o.citationIndex,h=o.guidelines,x=void 0===h?[]:h,_=o.url,m=o.additionalClassNames,b=o.headerTitle,j=void 0===b?"Rule Book Citation":b,y=o.InternalGptReasoningData,C=void 0===y?[]:y,D=o.IgptHeaderTitle,S=o.isDataProvided,k=void 0!==S&&S,T=o.textualContent,w=o.phraseToHighlight,I=o.onAccordionToggle,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),l=require("lucide-react"),t=require("../TextualGuidelines/TextualGuideLinesComponent.js"),r=require("./RuleBookCitationApiComponent.js");exports.default=function(o){var a,s,d,u,c,v,g=o.data,f=o.msg,p=o.citationIndex,h=o.guidelines,x=void 0===h?[]:h,_=o.url,m=o.additionalClassNames,b=o.headerTitle,j=void 0===b?"Rule Book Citation":b,y=o.InternalGptReasoningData,C=void 0===y?[]:y,D=o.IgptHeaderTitle,S=o.isDataProvided,k=void 0!==S&&S,T=o.textualContent,w=o.phraseToHighlight,I=o.onAccordionToggle,R=o.isInternalGptReasoningLoading,L=void 0!==R&&R,q=Math.max((null!==(s=null!==(a=null==g?void 0:g.citationNumber)&&void 0!==a?a:p)&&void 0!==s?s:1)-1,0),A=(null==f?void 0:f.requestId)||(null==f?void 0:f.id)||"",G=n.useState(null),H=G[0],N=G[1],E=n.useState(null),B=E[0],U=E[1],O=n.useState(null),F=O[0],J=O[1],M=n.useState(!1),P=M[0],V=M[1],z=n.useState(null),W=z[0],K=z[1];n.useEffect(function(){var e,i,n,l;if(!k&&!H){if(null===(e=null==g?void 0:g.fileDetails)||void 0===e?void 0:e.file_id)return K(null),N(g.fileDetails.file_id),void U(g.fileDetails.phrase_to_highlight||null);var t=(null!==(l=null===(n=null===(i=null==f?void 0:f.artifactSearchData)||void 0===i?void 0:i.ruleBookData)||void 0===n?void 0:n.rulebook_citations)&&void 0!==l?l:[])[q];if(!t)return K("Citation not found at the specified index."),N(null),void U(null);if(!t.file_id)return K("Citation data is missing file_id."),N(null),void U(null);J(null),K(null),N(t.file_id),U(t.phrase_to_highlight||null)}},[k,A,q,H,null===(d=null==g?void 0:g.fileDetails)||void 0===d?void 0:d.file_id,null===(u=null==g?void 0:g.fileDetails)||void 0===u?void 0:u.phrase_to_highlight,null===(v=null===(c=null==f?void 0:f.artifactSearchData)||void 0===c?void 0:c.ruleBookData)||void 0===v?void 0:v.rulebook_citations]),n.useEffect(function(){if(!k)if(H){var i=Array.isArray(x)?x:Object.values(x||{}).flat();e.__awaiter(void 0,void 0,void 0,function(){var n,l,t,o,a,s,d,u;return e.__generator(this,function(e){switch(e.label){case 0:if(!(null==(n=i.find(function(e){return e.id===H}))?void 0:n.gcsUrl))return K("File URL not found."),[2];e.label=1;case 1:return e.trys.push([1,4,5,6]),V(!0),K(null),[4,r.getSignedUrl(n.gcsUrl,null!=_?_:"")];case 2:if(null==(l=e.sent())?void 0:l.error)throw new Error(l.error);return t=(null===(u=n.name)||void 0===u?void 0:u.toLowerCase().split(".").pop())||"",r.isJSONFile(t)?[4,r.getFileContent(n.gcsUrl,null!=_?_:"")]:[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=r.getNestedValue(a,"data.artifactData.userStorySnapshot[0].value"),J(s||""),[3,6];case 4:return d=e.sent(),console.error(d),K(d.message||"An error occurred while loading file contents."),J(null),[3,6];case 5:return V(!1),[7];case 6:return[2]}})})}else J(null)},[k,H,x,_]);var Q=!k&&P,X=k?w||null:B,Y=k?T||"":(null==F?void 0:F.replace(/\\\./g,"."))||"",Z=k?!!T:!!F;return i.jsxs("div",e.__assign({className:null==m?void 0:m.container,style:{width:"100%",minHeight:"100px",backgroundColor:"transparent"}},{children:[Q&&i.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[i.jsx(l.Loader2,{style:{animation:"spin 1s linear infinite"},size:24}),i.jsx("span",{children:"Loading content..."})]})),W&&!Q&&i.jsxs("div",e.__assign({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[i.jsx("strong",{children:"Error:"})," ",W]})),!Q&&!W&&Z&&i.jsx("div",e.__assign({style:{marginTop:"12px"}},{children:i.jsx(t.default,{TextualGuideLines:Y,HighlightedWords:X?[X]:[],InternalGptReasoningData:C,index:0,headerTitle:j,useVariantHighlight:!1,IgptHeaderTitle:D,onAccordionToggle:I,isInternalGptReasoningLoading:L})})),!Q&&!W&&!Z&&i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{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=RuleBookCitationComponent.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),o=require("react"),t=require("@mui/material"),i=require("@mui/icons-material/Close"),n=require("@mui/icons-material/Fullscreen"),s=require("@monaco-editor/react"),a=require("monaco-editor"),l=require("@mui/icons-material/DarkMode"),d=require("@mui/icons-material/LightMode");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var t=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,t.get?t:{enumerable:!0,get:function(){return e[o]}})}}),r.default=e,Object.freeze(r)}var c=g(i),f=g(n),h=g(s),x=u(a),p=g(l),m=g(d),b={base:"vs-dark",inherit:!0,rules:[{token:"tag",foreground:"714be3",fontStyle:"bold"},{token:"attribute.name",foreground:"87CEFA"},{token:"attribute.value",foreground:"98FB98"},{token:"variable",foreground:"00FFFF"},{token:"delimiter",foreground:"888888"},{token:"white",foreground:"AAAAAA"}],colors:{"editor.foreground":"#FFFFFF","editor.background":"#030202","editorLineNumber.foreground":"#858585","editorCursor.foreground":"#FFFFFF","editorIndentGuide.background":"#404040","editorIndentGuide.activeBackground":"#707070"}},_={base:"vs",inherit:!0,rules:[{token:"tag",foreground:"5928ED",fontStyle:"bold"},{token:"attribute.name",foreground:"AF00DB"},{token:"attribute.value",foreground:"008000"},{token:"variable",foreground:"B000B0"},{token:"delimiter",foreground:"808080"},{token:"white",foreground:"000000"}],colors:{"editor.foreground":"#000000","editor.background":"#FFFFFF","editorLineNumber.foreground":"#999999","editorCursor.foreground":"#000000","editorIndentGuide.background":"#CCCCCC","editorIndentGuide.activeBackground":"#999999"}},v=function(o){var i=o.isDarkMode,n=o.onChange;return r.jsx(t.Box,e.__assign({onClick:function(){return n(!i)},sx:{width:52,height:24,borderRadius:"12px",bgcolor:i?"#5928ed":"#f0f0f0",border:"1px solid",borderColor:i?"#5928ed":"#d1d5db",display:"flex",alignItems:"center",px:.4,cursor:"pointer",transition:"all 0.2s",justifyContent:i?"flex-end":"flex-start"}},{children:r.jsx(t.Box,e.__assign({sx:{width:18,height:18,borderRadius:"50%",bgcolor:i?"#1e1e2e":"#f59e0b",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"}},{children:i?r.jsx(p.default,{sx:{fontSize:11,color:"#fff"}}):r.jsx(m.default,{sx:{fontSize:11,color:"#fff"}})}))}))},j=function(i){var n=i.content,s=i.selectedTag,a=i.highlightVariable,l=i.isDarkMode,d=i.height,g=void 0===d?250:d,u=i.fontSize,c=void 0===u?12:u,f=o.useRef(),p=o.useRef();return o.useEffect(function(){if(s&&f.current&&p.current){var e=f.current,r=e.getModel();if(r){for(var o=r.getValue().split("\n"),t=-1,i=0;i<o.length;i++){var n=o[i].match(/<([^\s>\/]+(?:\s[^\s>\/]+)*)/);if(n&&n[1].trim().toLowerCase()===s.toLowerCase()){t=i+1;break}}if(t>0){var a=t,l="</".concat(s.toLowerCase(),">");for(i=t;i<o.length;i++)if(o[i].toLowerCase().includes(l)){a=i+1;break}e.setSelection(new p.current.Selection(t,1,t,1)),e.trigger(null,"editor.unfold",{}),e.revealLineInCenterIfOutsideViewport(t);var d=e.deltaDecorations([],[{range:new p.current.Range(t,1,a,o[a-1].length+1),options:{isWholeLine:!0,className:"promptemon-highlight",inlineClassName:"promptemon-highlight"}}]);setTimeout(function(){return e.deltaDecorations(d,[])},2e3)}}}},[s]),o.useEffect(function(){if(a&&f.current&&p.current){var e=f.current,r=e.getModel();if(r){for(var o=r.getValue().split("\n"),t=[],i=0;i<o.length;i++)for(var n=o[i].indexOf(a);-1!==n;)t.push(new x.Range(i+1,n+1,i+1,n+a.length+1)),n=o[i].indexOf(a,n+1);if(0!==t.length){e.revealLineInCenterIfOutsideViewport(t[0].startLineNumber);var s=e.deltaDecorations([],t.map(function(e){return{range:e,options:{inlineClassName:"promptemon-variable-highlight"}}}));setTimeout(function(){return e.deltaDecorations(s,[])},2e3)}}}},[a]),o.useEffect(function(){p.current&&p.current.editor.setTheme(l?"promptemonDark":"promptemonLight")},[l]),r.jsxs(r.Fragment,{children:[r.jsx("style",{children:"\n .promptemon-highlight { background-color: rgba(89, 40, 237, 0.15); }\n .promptemon-variable-highlight { background-color: rgba(0, 255, 255, 0.2); border-radius: 2px; }\n "}),r.jsxs(t.Box,e.__assign({sx:{width:"100%",height:g,display:"flex",flexDirection:"column"}},{children:[r.jsx(t.Box,{sx:{width:"100%",height:20,bgcolor:l?"#030202":"#fff",borderTopLeftRadius:8,borderTopRightRadius:8}}),r.jsx(t.Box,e.__assign({sx:{flex:1,minHeight:0,overflow:"hidden"}},{children:r.jsx(h.default,{onMount:function(e,r){f.current=e,p.current=r,r.editor.defineTheme("promptemonDark",b),r.editor.defineTheme("promptemonLight",_),r.editor.setTheme(l?"promptemonDark":"promptemonLight"),r.languages.register({id:"promptemonLang"}),r.languages.setMonarchTokensProvider("promptemonLang",{tokenizer:{root:[[/(<)([a-zA-Z0-9\-]+)(\s*)/,["delimiter","tag","white"],"@tagBody"],[/(<\/)([a-zA-Z0-9\-]+)(\s*)(>)/,["delimiter","tag","white","delimiter"]],[/{{[^}]+}}/,"variable"]],tagBody:[[/[a-zA-Z0-9\:\-]+(?=\=)/,"attribute.name"],[/=/,"delimiter"],[/(".*?"|'.*?')/,"attribute.value"],[/\s+/,"white"],[/(\/?>)/,{token:"delimiter",next:"@pop"}]]}}),r.languages.registerFoldingRangeProvider("promptemonLang",{provideFoldingRanges:function(e){var r=e.getLinesContent(),o=[],t=[];return r.forEach(function(e,r){var i=r+1,n=e.match(/<([a-zA-Z0-9\-]+)(\s[^>]*)?>/),s=e.match(/<\/([a-zA-Z0-9\-]+)>/);if(n&&!e.includes("/>")&&t.push({tag:n[1],start:i}),s)for(var a=s[1],l=t.length-1;l>=0;l--)if(t[l].tag===a){o.push({start:t[l].start,end:i}),t.splice(l,1);break}}),o}})},beforeMount:function(e){e.editor.defineTheme("promptemonDark",b),e.editor.defineTheme("promptemonLight",_),e.editor.setTheme(l?"promptemonDark":"promptemonLight")},theme:l?"promptemonDark":"promptemonLight",value:n,language:"promptemonLang",onChange:function(){},options:{fontSize:c,minimap:{enabled:!1},wordWrap:"on",lineNumbers:"on",readOnly:!0,domReadOnly:!0,scrollBeyondLastLine:!1,padding:{top:4,bottom:12},folding:!0,automaticLayout:!0,scrollbar:{vertical:"visible",horizontal:"visible",verticalScrollbarSize:8}}})})),r.jsx(t.Box,{sx:{width:"100%",height:20,bgcolor:l?"#030202":"#fff",borderBottomLeftRadius:8,borderBottomRightRadius:8}})]}))]})};exports.default=function(i){var n=i.title,s=i.description,a=i.content,l=i.height,d=void 0===l?250:l,g=i.selectedTag,u=i.highlightVariable,h=o.useState(!0),x=h[0],p=h[1],m=o.useState(!1),b=m[0],_=m[1];return r.jsxs(r.Fragment,{children:[r.jsxs(t.Box,e.__assign({sx:{border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"}},{children:[r.jsxs(t.Box,e.__assign({sx:{px:1.5,py:.75,bgcolor:"#f9fafb",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[r.jsx(t.Typography,e.__assign({sx:{fontSize:"0.72rem",color:"#374151",fontWeight:600}},{children:n})),r.jsxs(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75}},{children:[r.jsx(v,{isDarkMode:x,onChange:p}),r.jsx(t.Tooltip,e.__assign({title:"Fullscreen",placement:"top"},{children:r.jsx(t.Box,e.__assign({onClick:function(){return _(!0)},sx:{cursor:"pointer",display:"flex",alignItems:"center",p:.3,borderRadius:"4px","&:hover":{bgcolor:"#e5e7eb"}}},{children:r.jsx(f.default,{sx:{fontSize:"0.9rem",color:"#6b7280"}})}))}))]}))]})),r.jsx(t.Box,e.__assign({sx:{height:d,bgcolor:x?"#030202":"#fff"}},{children:r.jsx(j,{content:a,selectedTag:g,highlightVariable:u,isDarkMode:x,height:d,fontSize:12})}))]})),r.jsxs(t.Dialog,e.__assign({open:b,onClose:function(){return _(!1)},maxWidth:!1,PaperProps:{sx:{width:"82vw",height:"80vh",maxWidth:"none",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"}}},{children:[r.jsxs(t.Box,e.__assign({sx:{px:2.5,py:1.5,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0}},{children:[r.jsx(t.Typography,e.__assign({sx:{fontWeight:700,fontSize:"1rem",color:"#111827"}},{children:n})),r.jsx(t.IconButton,e.__assign({size:"small",onClick:function(){return _(!1)}},{children:r.jsx(c.default,{sx:{fontSize:"1.1rem",color:"#6B7280"}})}))]})),r.jsxs(t.Box,e.__assign({sx:{flex:1,display:"flex",overflow:"hidden",minHeight:0}},{children:[s&&r.jsxs(t.Box,e.__assign({sx:{width:"35%",flexShrink:0,borderRight:"1px solid #E5E7EB",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[r.jsxs(t.Box,e.__assign({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",gap:1}},{children:[r.jsx(t.Chip,{label:"APB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:10,height:20,borderRadius:1}}),r.jsx(t.Typography,e.__assign({sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"}},{children:n}))]})),r.jsx(t.Box,e.__assign({sx:{flex:1,p:2,overflowY:"auto"}},{children:r.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5}},{children:[r.jsx(t.Typography,e.__assign({sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827",mb:.75}},{children:"Description"})),r.jsx(t.Typography,e.__assign({sx:{fontSize:"0.73rem",color:"#6B7280",lineHeight:1.6}},{children:s}))]}))}))]})),r.jsxs(t.Box,e.__assign({sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[r.jsxs(t.Box,e.__assign({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[r.jsx(t.Typography,e.__assign({sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"}},{children:"Prompt Preview"})),r.jsx(v,{isDarkMode:x,onChange:p})]})),r.jsx(t.Box,e.__assign({sx:{flex:1,minHeight:0,p:1.5}},{children:r.jsx(j,{content:a,selectedTag:g,highlightVariable:u,isDarkMode:x,height:"100%",fontSize:13})}))]}))]}))]}))]})};
|
|
2
|
+
//# sourceMappingURL=PromptemonBlockViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromptemonBlockViewer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("@mui/icons-material/ExpandMore"),r=require("@mui/icons-material/EditOutlined"),s=require("@mui/icons-material/Close"),a=require("@mui/icons-material/ArrowBack"),l=require("@mui/icons-material/NavigateBefore"),d=require("@mui/icons-material/NavigateNext"),c=require("@mui/icons-material/InfoOutlined"),u=require("@mui/icons-material/AutoFixHighOutlined"),x=require("@mui/icons-material/Check"),g=require("@mui/icons-material/Add"),f=require("@mui/icons-material/DeleteOutline"),p=require("@monaco-editor/react"),h=require("monaco-editor"),_=require("@mui/icons-material/DarkMode"),m=require("@mui/icons-material/LightMode");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}}),n.default=e,Object.freeze(n)}var j=b(t),S=b(r),v=b(s),w=b(a),z=b(l),C=b(d),k=b(c),B=b(u),I=b(x),A=b(g),T=b(f),R=b(p),W=y(h),F=b(_),D=b(m),L={base:"vs-dark",inherit:!0,rules:[{token:"tag",foreground:"714be3",fontStyle:"bold"},{token:"attribute.name",foreground:"87CEFA"},{token:"attribute.value",foreground:"98FB98"},{token:"variable",foreground:"00FFFF"},{token:"delimiter",foreground:"888888"},{token:"white",foreground:"AAAAAA"}],colors:{"editor.foreground":"#FFFFFF","editor.background":"#030202","editorLineNumber.foreground":"#858585","editorCursor.foreground":"#FFFFFF","editorIndentGuide.background":"#404040","editorIndentGuide.activeBackground":"#707070"}},M={base:"vs",inherit:!0,rules:[{token:"tag",foreground:"5928ED",fontStyle:"bold"},{token:"attribute.name",foreground:"AF00DB"},{token:"attribute.value",foreground:"008000"},{token:"variable",foreground:"B000B0"},{token:"delimiter",foreground:"808080"},{token:"white",foreground:"000000"}],colors:{"editor.foreground":"#000000","editor.background":"#FFFFFF","editorLineNumber.foreground":"#999999","editorCursor.foreground":"#000000","editorIndentGuide.background":"#CCCCCC","editorIndentGuide.activeBackground":"#999999"}},O=function(t){var r=t.description,s=i.useState(!1),a=s[0],l=s[1],d=i.useState(!1),c=d[0],u=d[1],x=i.useRef(null);return i.useEffect(function(){var e=x.current;e&&u(e.scrollHeight>e.clientHeight+1)},[r,a]),n.jsxs(o.Box,e.__assign({sx:{mt:1.5,border:"1px solid #e5e7eb",borderRadius:2,bgcolor:"#fff",display:"flex",flexDirection:"column",px:1.25,py:1}},{children:[n.jsx(o.Typography,e.__assign({ref:x,component:"div",sx:e.__assign({fontSize:11,color:"#6b7280",lineHeight:1.5,overflowY:a?"auto":"hidden",maxHeight:a?"calc(1.6em * 5)":"calc(1.6em * 3)",whiteSpace:"normal",display:a?"block":"-webkit-box"},a?{}:{WebkitBoxOrient:"vertical",WebkitLineClamp:3})},{children:r})),c&&n.jsx(o.Typography,e.__assign({component:"span",onClick:function(){return l(function(e){return!e})},sx:{mt:.75,alignSelf:"flex-end",fontSize:10,color:"#7c3aed",cursor:"pointer",fontWeight:500}},{children:a?"View less":"View more"}))]}))},E=function(t){var r=t.value,s=t.onChange,a=t.onDelete,l=i.useState(!1),d=l[0],c=l[1];return n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"flex-start",gap:1,p:1,border:"1px solid #e5e7eb",borderRadius:"8px",bgcolor:"#fff"}},{children:[n.jsx(o.Box,e.__assign({sx:{width:18,height:18,borderRadius:"4px",bgcolor:"#f1f5f9",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,color:"#64748b",flexShrink:0,mt:.1}},{children:"a"})),d?n.jsx(o.TextField,{autoFocus:!0,value:r,onChange:function(e){return s(e.target.value)},onBlur:function(){return c(!1)},size:"small",fullWidth:!0,multiline:!0,sx:{"& .MuiOutlinedInput-input":{fontSize:12.5}}}):n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#374151",lineHeight:1.55,flex:1}},{children:r})),n.jsxs(o.Stack,e.__assign({direction:"row",gap:.25,sx:{flexShrink:0}},{children:[n.jsx(o.IconButton,e.__assign({size:"small",onClick:function(){return c(!0)},sx:{color:"#6b7280"}},{children:n.jsx(S.default,{sx:{fontSize:14}})})),n.jsx(o.IconButton,e.__assign({size:"small",onClick:a,sx:{color:"#dc2626"}},{children:n.jsx(T.default,{sx:{fontSize:14}})}))]}))]}))},V=function(i){var t=i.isDarkMode,r=i.onChange;return n.jsx(o.Box,e.__assign({onClick:function(){return r(!t)},sx:{width:52,height:24,borderRadius:"12px",bgcolor:t?"#5928ed":"#f0f0f0",border:"1px solid",borderColor:t?"#5928ed":"#d1d5db",display:"flex",alignItems:"center",px:.4,cursor:"pointer",transition:"all 0.2s",justifyContent:t?"flex-end":"flex-start"}},{children:n.jsx(o.Box,e.__assign({sx:{width:18,height:18,borderRadius:"50%",bgcolor:t?"#1e1e2e":"#f59e0b",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"}},{children:t?n.jsx(F.default,{sx:{fontSize:11,color:"#fff"}}):n.jsx(D.default,{sx:{fontSize:11,color:"#fff"}})}))}))},P=function(t){var r=t.content,s=t.selectedTag,a=t.highlightVariable,l=t.isDarkMode,d=t.height,c=void 0===d?250:d,u=t.fontSize,x=void 0===u?12:u,g=i.useRef(),f=i.useRef();return i.useEffect(function(){if(s&&g.current&&f.current){var e=g.current,n=e.getModel();if(n){for(var i=n.getValue().split("\n"),o=-1,t=0;t<i.length;t++){var r=i[t].match(/<([^\s>\/]+(?:\s[^\s>\/]+)*)/);if(r&&r[1].trim().toLowerCase()===s.toLowerCase()){o=t+1;break}}if(o>0){var a=o,l="</".concat(s.toLowerCase(),">");for(t=o;t<i.length;t++)if(i[t].toLowerCase().includes(l)){a=t+1;break}e.setSelection(new f.current.Selection(o,1,o,1)),e.trigger(null,"editor.unfold",{}),e.revealLineInCenterIfOutsideViewport(o);var d=e.deltaDecorations([],[{range:new f.current.Range(o,1,a,i[a-1].length+1),options:{isWholeLine:!0,className:"promptemon-viewer-highlight",inlineClassName:"promptemon-viewer-highlight"}}]);setTimeout(function(){return e.deltaDecorations(d,[])},2e3)}}}},[s]),i.useEffect(function(){if(a&&g.current&&f.current){var e=g.current,n=e.getModel();if(n){for(var i=n.getValue().split("\n"),o=[],t=0;t<i.length;t++)for(var r=i[t].indexOf(a);-1!==r;)o.push(new W.Range(t+1,r+1,t+1,r+a.length+1)),r=i[t].indexOf(a,r+1);if(0!==o.length){e.revealLineInCenterIfOutsideViewport(o[0].startLineNumber);var s=e.deltaDecorations([],o.map(function(e){return{range:e,options:{inlineClassName:"promptemon-viewer-variable-highlight"}}}));setTimeout(function(){return e.deltaDecorations(s,[])},2e3)}}}},[a]),i.useEffect(function(){f.current&&f.current.editor.setTheme(l?"promptemonViewerDark":"promptemonViewerLight")},[l]),n.jsxs(n.Fragment,{children:[n.jsx("style",{children:"\n .promptemon-viewer-highlight { background-color: rgba(89, 40, 237, 0.15); }\n .promptemon-viewer-variable-highlight { background-color: rgba(0, 255, 255, 0.2); border-radius: 2px; }\n "}),n.jsxs(o.Box,e.__assign({sx:{width:"100%",height:c,display:"flex",flexDirection:"column"}},{children:[n.jsx(o.Box,{sx:{width:"100%",height:20,bgcolor:l?"#030202":"#fff",borderTopLeftRadius:8,borderTopRightRadius:8}}),n.jsx(o.Box,e.__assign({sx:{flex:1,minHeight:0,overflow:"hidden"}},{children:n.jsx(R.default,{onMount:function(e,n){g.current=e,f.current=n,n.editor.defineTheme("promptemonViewerDark",L),n.editor.defineTheme("promptemonViewerLight",M),n.editor.setTheme(l?"promptemonViewerDark":"promptemonViewerLight"),n.languages.register({id:"promptemonViewerLang"}),n.languages.setMonarchTokensProvider("promptemonViewerLang",{tokenizer:{root:[[/(<)([a-zA-Z0-9\-]+)(\s*)/,["delimiter","tag","white"],"@tagBody"],[/(<\/)([a-zA-Z0-9\-]+)(\s*)(>)/,["delimiter","tag","white","delimiter"]],[/{{[^}]+}}/,"variable"]],tagBody:[[/[a-zA-Z0-9\:\-]+(?=\=)/,"attribute.name"],[/=/,"delimiter"],[/(".*?"|'.*?')/,"attribute.value"],[/\s+/,"white"],[/(\/?>)/,{token:"delimiter",next:"@pop"}]]}}),n.languages.registerFoldingRangeProvider("promptemonViewerLang",{provideFoldingRanges:function(e){var n=e.getLinesContent(),i=[],o=[];return n.forEach(function(e,n){var t=n+1,r=e.match(/<([a-zA-Z0-9\-]+)(\s[^>]*)?>/),s=e.match(/<\/([a-zA-Z0-9\-]+)>/);if(r&&!e.includes("/>")&&o.push({tag:r[1],start:t}),s)for(var a=s[1],l=o.length-1;l>=0;l--)if(o[l].tag===a){i.push({start:o[l].start,end:t}),o.splice(l,1);break}}),i}})},beforeMount:function(e){e.editor.defineTheme("promptemonViewerDark",L),e.editor.defineTheme("promptemonViewerLight",M),e.editor.setTheme(l?"promptemonViewerDark":"promptemonViewerLight")},theme:l?"promptemonViewerDark":"promptemonViewerLight",value:r,language:"promptemonViewerLang",onChange:function(){},options:{fontSize:x,minimap:{enabled:!1},wordWrap:"on",lineNumbers:"on",readOnly:!0,domReadOnly:!0,scrollBeyondLastLine:!1,padding:{top:4,bottom:12},folding:!0,automaticLayout:!0,scrollbar:{vertical:"visible",horizontal:"visible",verticalScrollbarSize:8}}})})),n.jsx(o.Box,{sx:{width:"100%",height:20,bgcolor:l?"#030202":"#fff",borderBottomLeftRadius:8,borderBottomRightRadius:8}})]}))]})},q=function(t){var r,s,a,l,d=t.block,c=t.isExtracted,u=t.isSaved,x=t.showEditMode,g=t.onBlockUpdate,f=t.onTagSelect,p=t.onVariableSelect,h=t.categories,_=t.subCategories,m=t.selectedCategoryId,b=t.selectedSubCategoryId,y=t.onCategoryChange,w=t.onSubCategoryChange,z=i.useState(!0),C=z[0],B=z[1],R=i.useState(!0),W=R[0],F=R[1],D=i.useState(!0),L=D[0],M=D[1],V=i.useState(!0),P=V[0],q=V[1],N=i.useState(!1),G=N[0],H=N[1],Z=i.useState(!0),U=Z[0],Y=Z[1],J=i.useState(!0),K=J[0],Q=J[1],X=i.useState(!1),$=X[0],ee=X[1],ne=i.useState(!1),ie=ne[0],oe=ne[1],te=i.useState(!1),re=te[0],se=te[1],ae=i.useState((null==d?void 0:d.title)||""),le=ae[0],de=ae[1],ce=i.useState((null==d?void 0:d.short_description)||""),ue=ce[0],xe=ce[1],ge=i.useState((null==d?void 0:d.members)||[]),fe=ge[0],pe=ge[1],he=i.useState(Array.isArray(null==d?void 0:d.when_to_apply)?d.when_to_apply:(null==d?void 0:d.when_to_apply)?[d.when_to_apply]:[]),_e=he[0],me=he[1],be=i.useState(Array.isArray(null==d?void 0:d.when_not_to_apply)?d.when_not_to_apply:(null==d?void 0:d.when_not_to_apply)?[d.when_not_to_apply]:[]),ye=be[0],je=be[1],Se=i.useState(!1),ve=Se[0],we=Se[1],ze=i.useState(""),Ce=ze[0],ke=ze[1],Be=i.useState(""),Ie=Be[0],Ae=Be[1],Te={boxShadow:"none",border:"1px solid #e5e7eb",borderRadius:"8px !important",mb:1.5,"&:before":{display:"none"},"&.Mui-expanded":{margin:"0 0 12px 0"}},Re={minHeight:44,px:2,borderRadius:2,"&.Mui-expanded":{minHeight:44},"& .MuiAccordionSummary-content":{my:"10px"}};return n.jsxs(o.Box,e.__assign({sx:{width:820,flexShrink:0,display:"flex",flexDirection:"column",overflow:"hidden",borderRight:"1px solid #e5e7eb"}},{children:[n.jsxs(o.Box,e.__assign({sx:{px:2.5,py:2,borderBottom:"1px solid #e5e7eb"}},{children:[n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",justifyContent:"space-between"},{children:[n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1,sx:{flex:1,minWidth:0}},{children:[n.jsx(o.Tooltip,e.__assign({title:"Functional Prompt Block",placement:"top"},{children:n.jsx(o.Chip,{label:"FPB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:11,height:22,borderRadius:1}})})),re?n.jsx(o.TextField,{value:le,onChange:function(e){return de(e.target.value)},size:"small",fullWidth:!0,sx:{"& .MuiOutlinedInput-input":{fontSize:15,fontWeight:700,py:.5}}}):n.jsx(o.Typography,e.__assign({sx:{fontWeight:700,fontSize:15,color:"#111827"}},{children:(null==d?void 0:d.title)||"—"}))]})),re?n.jsxs(o.Stack,e.__assign({direction:"row",gap:.5},{children:[n.jsx(o.IconButton,e.__assign({size:"small",sx:{color:"#6b7280"},onClick:function(){return se(!1)}},{children:n.jsx(v.default,{sx:{fontSize:16}})})),n.jsx(o.IconButton,e.__assign({size:"small",sx:{color:"#16a34a"},onClick:function(){g(e.__assign(e.__assign({},d),{title:le,short_description:ue,members:fe,when_to_apply:_e,when_not_to_apply:ye})),se(!1)}},{children:n.jsx(I.default,{sx:{fontSize:16}})}))]})):!u&&x&&n.jsx(o.IconButton,e.__assign({size:"small",sx:{color:"#6b7280"},onClick:function(){de((null==d?void 0:d.title)||""),xe((null==d?void 0:d.short_description)||""),pe((null==d?void 0:d.members)||[]),me(Array.isArray(null==d?void 0:d.when_to_apply)?d.when_to_apply:(null==d?void 0:d.when_to_apply)?[d.when_to_apply]:[]),je(Array.isArray(null==d?void 0:d.when_not_to_apply)?d.when_not_to_apply:(null==d?void 0:d.when_not_to_apply)?[d.when_not_to_apply]:[]),se(!0)}},{children:n.jsx(S.default,{sx:{fontSize:16}})}))]})),re&&n.jsx(o.Typography,e.__assign({sx:{fontSize:11,color:"#5928ed",mt:.5}},{children:"Editing — changes won't be saved until you confirm"})),re?n.jsx(o.TextField,{value:ue,onChange:function(e){return xe(e.target.value)},size:"small",fullWidth:!0,multiline:!0,minRows:3,sx:{mt:1.5,"& .MuiOutlinedInput-input":{fontSize:12}}}):n.jsx(O,{description:(null==d?void 0:d.short_description)||"—"}),n.jsxs(o.Box,e.__assign({sx:{mt:1.5,border:"0.5px solid #d1d5db",borderRadius:"8px",display:"flex",overflow:"hidden"}},{children:[n.jsx(o.Box,e.__assign({sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",borderRight:"1px solid #d1d5db",p:.5}},{children:n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:10,color:"#87898d"}},{children:"Total APBs :"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:10,fontWeight:700,color:"#5f5f5f"}},{children:(null===(r=null==d?void 0:d.members)||void 0===r?void 0:r.length)||0}))]}))})),n.jsx(o.Box,e.__assign({sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",p:.5}},{children:n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:10,color:"#87898d"}},{children:"Total Lines :"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:10,fontWeight:700,color:"#5f5f5f"}},{children:(null===(s=null==d?void 0:d.members)||void 0===s?void 0:s.reduce(function(e,n){var i,o;return e+((null!==(i=n.end_line)&&void 0!==i?i:0)-(null!==(o=n.start_line)&&void 0!==o?o:0)+1)},0))||0}))]}))}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,overflow:"auto",px:2,py:2,"&::-webkit-scrollbar":{width:4},"&::-webkit-scrollbar-thumb":{bgcolor:"#e5e7eb",borderRadius:2}}},{children:[n.jsxs(o.Accordion,e.__assign({expanded:C,onChange:function(){return B(function(e){return!e})},sx:Te,disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:18}}),sx:Re},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#374151"}},{children:"Categories"}))})),n.jsx(o.AccordionDetails,e.__assign({sx:{pt:0,px:2,pb:2}},{children:n.jsxs(o.Stack,e.__assign({gap:1.5},{children:[n.jsxs(o.Box,{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:12,color:"#6b7280",mb:.5}},{children:"Category"})),re?n.jsx(o.Select,e.__assign({fullWidth:!0,size:"small",value:m,onChange:function(e){y(e.target.value),w("")},sx:{fontSize:13,borderRadius:1.5,"& fieldset":{borderColor:"#e5e7eb"}}},{children:h.map(function(i){return n.jsx(o.MenuItem,e.__assign({value:i.category_id},{children:i.category_name}),i.category_id)})})):n.jsx(o.TextField,{fullWidth:!0,size:"small",value:(null===(a=h.find(function(e){return e.category_id===m}))||void 0===a?void 0:a.category_name)||"—",InputProps:{readOnly:!0},sx:{"& .MuiOutlinedInput-root":{fontSize:13,borderRadius:1.5,"& fieldset":{borderColor:"#e5e7eb"}}}})]}),n.jsxs(o.Box,{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:12,color:"#6b7280",mb:.5}},{children:"Sub-Category"})),re?n.jsx(o.Select,e.__assign({fullWidth:!0,size:"small",value:b,onChange:function(e){return w(e.target.value)},disabled:!m,sx:{fontSize:13,borderRadius:1.5,"& fieldset":{borderColor:"#e5e7eb"}}},{children:_.filter(function(e){return e.category_id===m}).map(function(i){return n.jsx(o.MenuItem,e.__assign({value:i.sub_category_id},{children:i.sub_category_name}),i.sub_category_id)})})):n.jsx(o.TextField,{fullWidth:!0,size:"small",value:(null===(l=_.find(function(e){return e.sub_category_id===b}))||void 0===l?void 0:l.sub_category_name)||"—",InputProps:{readOnly:!0},sx:{"& .MuiOutlinedInput-root":{fontSize:13,borderRadius:1.5,"& fieldset":{borderColor:"#e5e7eb"}}}})]})]}))}))]})),n.jsxs(o.Accordion,e.__assign({expanded:W,onChange:function(){return F(function(e){return!e})},sx:Te,disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:18}}),sx:Re},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#374151"}},{children:"Atomic Prompt Blocks (APBs)"}))})),n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,px:1,pb:2}},{children:[n.jsx(o.Stack,e.__assign({gap:1},{children:(re?fe:(null==d?void 0:d.members)||[]).map(function(i,t){return n.jsxs(o.Box,e.__assign({sx:{px:2,py:1,borderRadius:2,bgcolor:"#fff"}},{children:[n.jsxs(o.Box,e.__assign({sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:1,gap:1}},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:14,fontWeight:500,color:"#111827"}},{children:[t+1,". ",i.section_name]})),re?n.jsx(o.IconButton,e.__assign({size:"small",onClick:function(){return pe(function(e){return e.filter(function(e,n){return n!==t})})},sx:{color:"#dc2626",flexShrink:0}},{children:n.jsx(T.default,{sx:{fontSize:16}})})):n.jsx(o.Box,e.__assign({onClick:function(){return f(i.section_name.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}).join("_"))},sx:{fontSize:14,color:"#475569",cursor:"pointer",flexShrink:0}},{children:"↗"}))]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:12,lineHeight:1.5,color:"#64748b"}},{children:i.reason_for_inclusion})),c&&(r=i.segments||[],0===r.length?null:n.jsx(o.Box,e.__assign({sx:{mt:1}},{children:n.jsx(o.Box,e.__assign({sx:{display:"flex",flexWrap:"wrap",gap:1}},{children:r.map(function(e,i){return n.jsx(o.Chip,{clickable:!0,onClick:function(){return p(e.segmentized_text)},label:e.segmentized_text,sx:{borderRadius:1,bgcolor:"#eff6ff",color:"#3b82f6",border:"1px dashed #bfdbfe"}},i)})}))}))),n.jsx(o.Divider,{sx:{mt:2}})]}),t);var r})})),re&&n.jsxs(o.Box,e.__assign({onClick:function(){ke(""),Ae(""),we(!0)},sx:{mt:1,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,py:1,border:"1px dashed #d1d5db",borderRadius:1.5,cursor:"pointer",color:"#5928ed",fontSize:13,fontWeight:600,"&:hover":{bgcolor:"#f5f0ff"}}},{children:[n.jsx(A.default,{sx:{fontSize:16}})," Add APB"]}))]}))]})),n.jsxs(o.Accordion,e.__assign({expanded:L,onChange:function(){return M(function(e){return!e})},sx:Te,disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:18}}),sx:Re},{children:n.jsxs(o.Typography,e.__assign({sx:{fontSize:14,fontWeight:600,color:"#374151",display:"flex",alignItems:"center",flexDirection:"row"}},{children:["Applicability ",n.jsx("span",e.__assign({style:{color:"#94a3b8",fontWeight:400,fontSize:10,marginLeft:"12px"}},{children:"• When to apply / When not to apply"}))]}))})),n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,px:1.5,pb:1.5}},{children:[n.jsxs(o.Accordion,e.__assign({expanded:P,onChange:function(){return q(function(e){return!e})},sx:{boxShadow:"none",border:"1px solid #e5e7eb",borderRadius:"6px !important",mb:1,"&:before":{display:"none"},"&.Mui-expanded":{margin:"0 0 8px 0"}},disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:16}}),sx:e.__assign(e.__assign({},Re),{bgcolor:"#f9fafb",borderRadius:"6px"})},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,fontWeight:500,color:"#374151"}},{children:"When to Apply this FPB"}))})),n.jsx(o.AccordionDetails,e.__assign({sx:{pt:.5,px:2,pb:1.5}},{children:n.jsxs(o.Stack,e.__assign({gap:.75},{children:[(re?_e:Array.isArray(null==d?void 0:d.when_to_apply)?d.when_to_apply:(null==d?void 0:d.when_to_apply)?[d.when_to_apply]:["— Not yet available"]).map(function(i,t){return re?n.jsx(E,{value:i,onChange:function(e){return me(function(n){return n.map(function(n,i){return i===t?e:n})})},onDelete:function(){return me(function(e){return e.filter(function(e,n){return n!==t})})}},t):n.jsxs(o.Stack,e.__assign({direction:"row",gap:1,alignItems:"flex-start"},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:12,color:"#374151",fontWeight:700,mt:.1}},{children:[t+1,"."]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#374151",lineHeight:1.55}},{children:i}))]}),t)}),re&&n.jsxs(o.Box,e.__assign({onClick:function(){return me(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[""],!1)})},sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.5,py:.75,border:"1px dashed #d1d5db",borderRadius:1.5,cursor:"pointer",color:"#5928ed",fontSize:12.5,fontWeight:600,"&:hover":{bgcolor:"#f5f0ff"}}},{children:[n.jsx(A.default,{sx:{fontSize:15}})," Add When to Apply"]}))]}))}))]})),n.jsxs(o.Accordion,e.__assign({expanded:G,onChange:function(){return H(function(e){return!e})},sx:{boxShadow:"none",border:"1px solid #e5e7eb",borderRadius:"6px !important","&:before":{display:"none"}},disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:16}}),sx:e.__assign(e.__assign({},Re),{bgcolor:"#f9fafb",borderRadius:"6px"})},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,fontWeight:500,color:"#374151"}},{children:"When NOT to Apply this FPB"}))})),n.jsx(o.AccordionDetails,e.__assign({sx:{pt:.5,px:2,pb:1.5}},{children:re?n.jsxs(o.Stack,e.__assign({gap:.75},{children:[ye.map(function(e,i){return n.jsx(E,{value:e,onChange:function(e){return je(function(n){return n.map(function(n,o){return o===i?e:n})})},onDelete:function(){return je(function(e){return e.filter(function(e,n){return n!==i})})}},i)}),n.jsxs(o.Box,e.__assign({onClick:function(){return je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[""],!1)})},sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.5,py:.75,border:"1px dashed #d1d5db",borderRadius:1.5,cursor:"pointer",color:"#5928ed",fontSize:12.5,fontWeight:600,"&:hover":{bgcolor:"#f5f0ff"}}},{children:[n.jsx(A.default,{sx:{fontSize:15}})," Add When NOT to Apply"]}))]})):Array.isArray(null==d?void 0:d.when_not_to_apply)||(null==d?void 0:d.when_not_to_apply)?n.jsx(o.Stack,e.__assign({gap:.75},{children:(Array.isArray(null==d?void 0:d.when_not_to_apply)?d.when_not_to_apply:[d.when_not_to_apply]).map(function(i,t){return n.jsxs(o.Stack,e.__assign({direction:"row",gap:1,alignItems:"flex-start"},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:12,color:"#374151",fontWeight:700,mt:.1}},{children:[t+1,"."]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#374151",lineHeight:1.55}},{children:i}))]}),t)})})):n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#9ca3af",fontStyle:"italic"}},{children:"No conditions defined yet."}))}))]}))]}))]})),n.jsxs(o.Accordion,e.__assign({expanded:U,onChange:function(){return Y(function(e){return!e})},sx:Te,disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:18}}),sx:Re},{children:n.jsxs(o.Typography,e.__assign({sx:{fontSize:14,fontWeight:600,color:"#374151",display:"flex",alignItems:"center",flexDirection:"row"}},{children:["Specifications ",n.jsx("span",e.__assign({style:{color:"#94a3b8",fontWeight:400,fontSize:10,marginLeft:"12px"}},{children:"• Strict Rules / Input / Output"}))]}))})),n.jsx(o.AccordionDetails,e.__assign({sx:{pt:0,px:1.5,pb:1.5}},{children:[{label:"Guidelines",expanded:K,setExpanded:Q,content:null==d?void 0:d.additional_guidelines},{label:"Input",expanded:$,setExpanded:ee,content:null},{label:"Output",expanded:ie,setExpanded:oe,content:null}].map(function(i,t){var r=i.label,s=i.expanded,a=i.setExpanded,l=i.content;return n.jsxs(o.Accordion,e.__assign({expanded:s,onChange:function(){return a(function(e){return!e})},sx:{boxShadow:"none",border:"1px solid #e5e7eb",borderRadius:"6px !important",mb:t<2?1:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:t<2?"0 0 8px 0":0}},disableGutters:!0},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:n.jsx(j.default,{sx:{fontSize:16}}),sx:e.__assign(e.__assign({},Re),{bgcolor:"#f9fafb",borderRadius:"6px"})},{children:n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:.5},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,fontWeight:500,color:"#374151"}},{children:r})),"Guidelines"!==r&&n.jsx(k.default,{sx:{fontSize:13,color:"#9ca3af"}})]}))})),n.jsx(o.AccordionDetails,e.__assign({sx:{pt:.5,px:2,pb:1.5}},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:l?"#374151":"#9ca3af",fontStyle:l?"normal":"italic"}},{children:l||"No ".concat(r.toLowerCase()," defined yet.")}))}))]}),r)})}))]}))]})),n.jsxs(o.Dialog,e.__assign({open:ve,onClose:function(){return we(!1)},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px"}}},{children:[n.jsxs(o.Box,e.__assign({sx:{px:3,py:2,display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e5e7eb"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontWeight:700,fontSize:"1rem",color:"#111827"}},{children:"Add new APB"})),n.jsx(o.IconButton,e.__assign({size:"small",onClick:function(){return we(!1)}},{children:n.jsx(v.default,{sx:{fontSize:"1.1rem",color:"#6b7280"}})}))]})),n.jsxs(o.Box,e.__assign({sx:{px:3,py:2.5,display:"flex",flexDirection:"column",gap:2}},{children:[n.jsxs(o.Box,{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#374151",mb:.75}},{children:"Title"})),n.jsx(o.TextField,{fullWidth:!0,size:"small",placeholder:"Specify the title of APB",value:Ce,onChange:function(e){return ke(e.target.value)}})]}),n.jsxs(o.Box,{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#374151",mb:.75}},{children:"Description"})),n.jsx(o.TextField,{fullWidth:!0,size:"small",multiline:!0,minRows:3,placeholder:"Describe the APB",value:Ie,onChange:function(e){return Ae(e.target.value)}})]})]})),n.jsxs(o.Box,e.__assign({sx:{px:3,py:2,display:"flex",justifyContent:"flex-end",gap:1,borderTop:"1px solid #e5e7eb"}},{children:[n.jsx(o.Button,e.__assign({variant:"outlined",onClick:function(){return we(!1)},sx:{textTransform:"none",borderColor:"#d1d5db",color:"#374151"}},{children:"Cancel"})),n.jsx(o.Button,e.__assign({variant:"contained",onClick:function(){pe(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{section_name:Ce,reason_for_inclusion:Ie,content:""}],!1)}),we(!1)},sx:{textTransform:"none",bgcolor:"#5928ed","&:hover":{bgcolor:"#4c1d95"}}},{children:"Save"}))]}))]}))]}))};exports.default=function(t){var r,s,a,l,d,c=t.block,u=t.onBlockUpdate,x=t.isExtracting,g=t.isExtracted,f=t.onExtractSegments,p=t.isSaving,h=t.isSaved,_=t.onSave,m=t.onBack,b=t.title,y=void 0===b?"FPB Promptemon":b,j=t.categories,S=t.subCategories,k=t.selectedCategoryId,I=t.selectedSubCategoryId,A=t.onCategoryChange,T=t.onSubCategoryChange,R=t.showEditMode,W=void 0===R||R,F=t.showExtractSegments,D=void 0===F||F,L=i.useState(1),M=L[0],O=L[1],E=i.useState(!0),N=E[0],G=E[1],H=i.useState(""),Z=H[0],U=H[1],Y=i.useState(""),J=Y[0],K=Y[1],Q=(null===(r=null==c?void 0:c.members)||void 0===r?void 0:r.map(function(e){if(!g||!e.segments||0===e.segments.length)return e.content||"";var n=e.content||"";return e.segments.forEach(function(e){e.raw_text&&e.segmentized_text&&(n=n.split(e.raw_text).join(e.segmentized_text))}),n}).join("\n\n"))||"";return n.jsxs(o.Box,e.__assign({sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column",bgcolor:"#fff",overflow:"hidden"}},{children:[n.jsxs(o.Box,e.__assign({sx:{px:2.5,py:1.5,borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#fff",flexShrink:0}},{children:[n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1},{children:[n.jsx(o.IconButton,e.__assign({size:"small",sx:{color:"#6b7280"},onClick:m},{children:n.jsx(w.default,{sx:{fontSize:18}})})),n.jsx(o.Typography,e.__assign({sx:{fontSize:14,fontWeight:600,color:"#111827"}},{children:y}))]})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(o.Button,e.__assign({variant:"contained",size:"small",disabled:!g||p||h,onClick:_,sx:{textTransform:"none",fontSize:"0.78rem",fontWeight:600,bgcolor:"#5928ed",px:2,py:.6,"&:hover":{bgcolor:"#4c1d95"},"&.Mui-disabled":{bgcolor:"#5928ed",color:"#fff",opacity:.4}}},{children:p?"Saving...":h?"Saved ✓":"Save FPB"})),n.jsx(o.IconButton,e.__assign({size:"small",sx:{color:"#6b7280"},onClick:m},{children:n.jsx(v.default,{sx:{fontSize:18}})}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flex:1,overflow:"hidden"}},{children:[n.jsx(q,{block:c,isExtracted:g,isSaved:h,showEditMode:W,onBlockUpdate:u,onTagSelect:function(e){U(""),setTimeout(function(){return U(e)},50)},onVariableSelect:function(e){K(""),setTimeout(function(){return K(e)},50)},categories:j,subCategories:S,selectedCategoryId:k,selectedSubCategoryId:I,onCategoryChange:A,onSubCategoryChange:T}),n.jsxs(o.Box,e.__assign({sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",p:2,gap:1.5}},{children:[n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0}},{children:[n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#374151"}},{children:[(null==c?void 0:c.title)||"—"," APBs"]})),n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:.5},{children:[n.jsx(o.IconButton,e.__assign({size:"small",onClick:function(){return O(function(e){return Math.max(1,e-1)})},disabled:1===M,sx:{color:"#6b7280",p:.4}},{children:n.jsx(z.default,{sx:{fontSize:16}})})),n.jsxs(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#6b7280"}},{children:[M," of ",(null===(s=null==c?void 0:c.members)||void 0===s?void 0:s.length)||0]})),n.jsx(o.IconButton,e.__assign({size:"small",onClick:function(){return O(function(e){var n;return Math.min((null===(n=null==c?void 0:c.members)||void 0===n?void 0:n.length)||0,e+1)})},disabled:M===((null===(a=null==c?void 0:c.members)||void 0===a?void 0:a.length)||0),sx:{color:"#6b7280",p:.4}},{children:n.jsx(C.default,{sx:{fontSize:16}})}))]}))]})),n.jsx(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1.5},{children:D&&(g?n.jsxs(o.Stack,e.__assign({direction:"row",alignItems:"center",gap:1},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:12.5,color:"#6b7280"}},{children:"Show Segments"})),n.jsx(o.Box,e.__assign({sx:{width:36,height:20,borderRadius:"10px",bgcolor:"#7c3aed",display:"flex",alignItems:"center",px:.3,cursor:"pointer"}},{children:n.jsx(o.Box,{sx:{width:14,height:14,borderRadius:"50%",bgcolor:"#fff",ml:"auto"}})}))]})):n.jsxs(o.Box,e.__assign({onClick:f,sx:{display:"flex",alignItems:"center",gap:1,px:2,py:.85,borderRadius:1.5,bgcolor:"#7c3aed",cursor:x?"default":"pointer","&:hover":{bgcolor:"#6d28d9"},userSelect:"none",opacity:x?.7:1}},{children:[n.jsx(B.default,{sx:{fontSize:15,color:"#fff"}}),n.jsx(o.Typography,e.__assign({sx:{fontSize:13,fontWeight:600,color:"#fff"}},{children:x?"Extracting...":"Extract Segments"}))]})))}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,minHeight:0,position:"relative"}},{children:[x&&n.jsx(o.Box,e.__assign({sx:{position:"absolute",top:0,left:0,right:0,bottom:0,bgcolor:"rgba(0,0,0,0.6)",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1}},{children:n.jsx(o.Typography,e.__assign({sx:{color:"#fff",fontSize:14,fontWeight:600}},{children:"Extracting segments..."}))})),n.jsxs(o.Box,e.__assign({sx:{border:"1px solid #30363d",borderRadius:1,overflow:"hidden",height:"100%"}},{children:[n.jsxs(o.Box,e.__assign({sx:{px:2,py:1,borderBottom:"1px solid #30363d",display:"flex",alignItems:"center",gap:1,bgcolor:"#161b22",flexShrink:0}},{children:[n.jsx(o.Box,{sx:{width:12,height:12,borderRadius:"50%",bgcolor:"#ff5f57"}}),n.jsx(o.Box,{sx:{width:12,height:12,borderRadius:"50%",bgcolor:"#febc2e"}}),n.jsx(o.Box,{sx:{width:12,height:12,borderRadius:"50%",bgcolor:"#28c840"}}),n.jsxs(o.Typography,e.__assign({sx:{ml:1,fontSize:11,color:"#8b949e",fontFamily:"monospace"}},{children:[(null===(d=null===(l=null==c?void 0:c.members)||void 0===l?void 0:l[M-1])||void 0===d?void 0:d.section_name)||"—",".xml"]})),n.jsx(o.Box,{sx:{flex:1}}),n.jsx(V,{isDarkMode:N,onChange:G})]})),n.jsx(P,{content:Q,selectedTag:Z,highlightVariable:J,isDarkMode:N,height:"100%",fontSize:14})]}))]}))]}))]}))]}))};
|
|
2
|
+
//# sourceMappingURL=PromptemonViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromptemonViewer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),a=require("lucide-react"),s=require("./Splitter.module.css.js"),i=function(){return t.jsxs("svg",e.__assign({width:"21",height:"54",viewBox:"0 0 20 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M0.260742 1.57324L15.4268 10.8262C17.9563 12.3695 19.4999 15.1188 19.5 18.082V37.0273C19.4999 40.16 17.7767 43.0386 15.0156 44.5186L0.236328 52.4404L-0.5 52.835V1.10938L0.260742 1.57324Z",fill:"#F8FAFC",stroke:"#E0E0E0"}),t.jsx("path",{d:"M7.5 32L12.5 27L7.5 22",stroke:"#111827",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}))},o=function(){return t.jsxs("svg",e.__assign({width:"21",height:"54",viewBox:"0 0 21 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M1.26074 1.57324L16.4268 10.8262C18.9563 12.3695 20.4999 15.1188 20.5 18.082V37.0273C20.4999 40.16 18.7767 43.0386 16.0156 44.5186L1.23633 52.4404L0.5 52.835V1.10938L1.26074 1.57324Z",fill:"#F8FAFC",stroke:"#E0E0E0"}),t.jsx("path",{d:"M13.5 32L8.5 27L13.5 22",stroke:"black",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}))},l=function(){return t.jsxs("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 12 12",fill:"none"},{children:[t.jsx("path",{d:"M7.58186 3.15354C7.51731 2.83771 7.06604 2.83771 7.00148 3.15354C6.60544 5.09119 5.09119 6.60544 3.15355 7.00148C2.83771 7.06603 2.83771 7.5173 3.15355 7.58185C5.09119 7.97789 6.60544 9.49215 7.00148 11.4298C7.06604 11.7456 7.51731 11.7456 7.58186 11.4298C7.9779 9.49215 9.49215 7.97789 11.4298 7.58185C11.7456 7.5173 11.7456 7.06603 11.4298 7.00148C9.49215 6.60544 7.9779 5.09119 7.58186 3.15354Z",fill:"#087443"}),t.jsx("path",{d:"M2.20669 0.0156637C2.20243 -0.00522128 2.17258 -0.0052212 2.16832 0.0156638C1.94676 1.09964 1.09964 1.94676 0.0156679 2.16831C-0.0052166 2.17258 -0.0052166 2.20242 0.0156679 2.20669C1.09964 2.42825 1.94676 3.27536 2.16832 4.35934C2.17258 4.38022 2.20243 4.38022 2.20669 4.35934C2.42825 3.27536 3.27537 2.42824 4.35934 2.20669C4.38023 2.20242 4.38023 2.17258 4.35934 2.16831C3.27537 1.94676 2.42825 1.09964 2.20669 0.0156637Z",fill:"#087443"})]}))},c=function(){return t.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 16 16",fill:"none"},{children:t.jsx("path",{d:"M3.125 2.75C3.02554 2.75 2.93016 2.78951 2.85983 2.85983C2.78951 2.93016 2.75 3.02554 2.75 3.125V6.125C2.75 6.22446 2.71049 6.31984 2.64017 6.39016C2.56984 6.46049 2.47446 6.5 2.375 6.5C2.27554 6.5 2.18016 6.46049 2.10983 6.39016C2.03951 6.31984 2 6.22446 2 6.125V3.125C2 2.82663 2.11853 2.54048 2.3295 2.3295C2.54048 2.11853 2.82663 2 3.125 2H6.125C6.22446 2 6.31984 2.03951 6.39016 2.10983C6.46049 2.18016 6.5 2.27554 6.5 2.375C6.5 2.47446 6.46049 2.56984 6.39016 2.64017C6.31984 2.71049 6.22446 2.75 6.125 2.75H3.125ZM9.5 2.375C9.5 2.27554 9.53951 2.18016 9.60983 2.10983C9.68016 2.03951 9.77554 2 9.875 2H12.875C13.1734 2 13.4595 2.11853 13.6705 2.3295C13.8815 2.54048 14 2.82663 14 3.125V6.125C14 6.22446 13.9605 6.31984 13.8902 6.39016C13.8198 6.46049 13.7245 6.5 13.625 6.5C13.5255 6.5 13.4302 6.46049 13.3598 6.39016C13.2895 6.31984 13.25 6.22446 13.25 6.125V3.125C13.25 3.02554 13.2105 2.93016 13.1402 2.85983C13.0698 2.78951 12.9745 2.75 12.875 2.75H9.875C9.77554 2.75 9.68016 2.71049 9.60983 2.64017C9.53951 2.56984 9.5 2.47446 9.5 2.375ZM2.375 9.5C2.47446 9.5 2.56984 9.53951 2.64017 9.60983C2.71049 9.68016 2.75 9.77554 2.75 9.875V12.875C2.75 12.9745 2.78951 13.0698 2.85983 13.1402C2.93016 13.2105 3.02554 13.25 3.125 13.25H6.125C6.22446 13.25 6.31984 13.2895 6.39016 13.3598C6.46049 13.4302 6.5 13.5255 6.5 13.625C6.5 13.7245 6.46049 13.8198 6.39016 13.8902C6.31984 13.9605 6.22446 14 6.125 14H3.125C2.82663 14 2.54048 13.8815 2.3295 13.6705C2.11853 13.4595 2 13.1734 2 12.875V9.875C2 9.77554 2.03951 9.68016 2.10983 9.60983C2.18016 9.53951 2.27554 9.5 2.375 9.5ZM13.625 9.5C13.7245 9.5 13.8198 9.53951 13.8902 9.60983C13.9605 9.68016 14 9.77554 14 9.875V12.875C14 13.1734 13.8815 13.4595 13.6705 13.6705C13.4595 13.8815 13.1734 14 12.875 14H9.875C9.77554 14 9.68016 13.9605 9.60983 13.8902C9.53951 13.8198 9.5 13.7245 9.5 13.625C9.5 13.5255 9.53951 13.4302 9.60983 13.3598C9.68016 13.2895 9.77554 13.25 9.875 13.25H12.875C12.9745 13.25 13.0698 13.2105 13.1402 13.1402C13.2105 13.0698 13.25 12.9745 13.25 12.875V9.875C13.25 9.77554 13.2895 9.68016 13.3598 9.60983C13.4302 9.53951 13.5255 9.5 13.625 9.5Z",fill:"#7A5AF8",stroke:"#7A5AF8","stroke-width":"0.5"})}))};exports.default=function(d){var r=d.left,u=d.right,f=d.defaultLeftWidth,h=void 0===f?50:f,x=d.minLeftWidth,g=void 0===x?250:x,v=d.minRightWidth,C=void 0===v?250:v,p=d.className,_=void 0===p?"":p,m=d.height,j=void 0===m?"400px":m,w=d.width,N=void 0===w?"100%":w,H=d.header,L=d.onLeftWidthChange,k=d.openInFullscreen,M=void 0!==k&&k,A=d.onFullscreenClose,B=d.fullscreenOnly,b=void 0!==B&&B,F=n.useState(h),S=F[0],E=F[1],y=n.useState(!1),z=y[0],R=y[1],V=n.useState(!1),D=V[0],O=V[1],P=n.useState(!1),q=P[0],T=P[1],Z=n.useState(0),I=Z[0],W=Z[1],X=n.useState(0),G=X[0],J=X[1],K=n.useState(b||M),Q=K[0],U=K[1],Y=n.useRef(null),$=n.useRef(null),ee=n.useRef(null);n.useEffect(function(){var e=Y.current;e&&(Q?(e.showModal(),requestAnimationFrame(function(){if(ee.current){var e=ee.current.getBoundingClientRect().width;J(e),E(h),O(!1),T(!1)}})):(e.close(),E(h),O(!1),T(!1),null==A||A()))},[Q]),n.useEffect(function(){var e=ee.current;if(e&&Q){var t,n=new ResizeObserver(function(e){var n=e[0];t=requestAnimationFrame(function(){J(n.contentRect.width)})});return n.observe(e),function(){cancelAnimationFrame(t),n.disconnect()}}},[Q]),n.useEffect(function(){var e=$.current;if(e){var t,n=new ResizeObserver(function(e){var n=e[0];t=requestAnimationFrame(function(){W(n.contentRect.width)})});return n.observe(e),W(e.getBoundingClientRect().width),function(){cancelAnimationFrame(t),n.disconnect()}}},[]);var te=function(e){e.preventDefault(),R(!0)};n.useEffect(function(){var e=function(e){if(z){var t=Q?ee.current:$.current;if(t){var n=t.getBoundingClientRect(),a=n.width,s=e.clientX-n.left;if(s>=g&&a-s-4>=C)E(s/a*100),null==L||L(s)}}},t=function(){R(!1)};return z&&(document.addEventListener("mousemove",e),document.addEventListener("mouseup",t)),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[z,Q,g,C,L]);var ne=function(){D?(E(50),O(!1)):O(!0)},ae=function(){q?(E(50),T(!1)):T(!0)},se=Q?G:I,ie=S/100*se,oe=se-ie-4,le=Q?500:250,ce=q?{flex:1}:{width:"".concat(S,"%")},de=!D&&ie<=Math.max(g+10,le),re=!q&&oe<=Math.max(C+10,le),ue=function(e){return e>=80?s.default.confidenceScoreHigh:e>=60?s.default.confidenceScoreMedium:s.default.confidenceScoreLow},fe="number"==typeof j?"".concat(j,"px"):j,he="number"==typeof N?"".concat(N,"px"):N,xe=t.jsx("dialog",e.__assign({ref:Y,className:s.default.dialogOverlay,onClose:function(){return U(!1)}},{children:t.jsxs("div",e.__assign({ref:ee,className:s.default.dialogContent},{children:[H&&t.jsxs("div",e.__assign({className:s.default.header},{children:[t.jsxs("div",e.__assign({className:s.default.headerLeft},{children:[H.showDocIcon&&t.jsx(a.FileText,{className:s.default.headerIcon}),t.jsx("div",e.__assign({className:s.default.headerTitle},{children:H.title&&t.jsx(t.Fragment,{children:t.jsx("span",e.__assign({className:s.default.headerTitleText},{children:H.title}))})}))]})),t.jsxs("div",e.__assign({className:s.default.headerActions},{children:[void 0!==H.confidenceScore&&t.jsxs("div",e.__assign({className:"".concat(s.default.confidenceScore," ").concat(ue(H.confidenceScore))},{children:[t.jsx("div",e.__assign({style:{width:"16px",height:"16px"}},{children:t.jsx(l,{})})),t.jsxs("div",{children:[Math.round(H.confidenceScore),"%"]})]})),t.jsx("button",e.__assign({className:s.default.fullscreenButton,onClick:function(){return U(!1)},title:"Close fullscreen"},{children:t.jsx(a.X,{size:20,color:"#5928ed"})}))]}))]})),t.jsxs("div",e.__assign({className:"".concat(s.default.contentArea," ").concat(s.default.contentAreaHorizontal," ").concat(s.default.dialogContentArea)},{children:[!D&&t.jsx("div",e.__assign({className:s.default.panel,style:ce},{children:r})),D&&t.jsx("button",e.__assign({onClick:ne,className:"".concat(s.default.expandButton," ").concat(s.default.expandButtonHorizontal),title:"Expand left panel (50/50)"},{children:t.jsx(i,{})})),!D&&!q&&t.jsxs("div",e.__assign({onMouseDown:te,className:"".concat(s.default.divider," ").concat(s.default.dividerHorizontal," ").concat(z?s.default.dividerDragging:s.default.dividerIdle)},{children:[t.jsx("div",{className:"".concat(s.default.dividerHitArea," ").concat(s.default.dividerHitAreaHorizontal)}),de&&t.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),ne()},onMouseDown:function(e){return e.stopPropagation()},className:s.default.collapseButton,title:"Collapse left panel"},{children:t.jsx(o,{})})),re&&t.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),ae()},onMouseDown:function(e){return e.stopPropagation()},className:s.default.collapseButton,title:"Collapse right panel"},{children:t.jsx(i,{})}))]})),!q&&t.jsx("div",e.__assign({className:s.default.panel,style:{flex:1}},{children:u})),q&&t.jsx("button",e.__assign({onClick:ae,className:"".concat(s.default.expandButton," ").concat(s.default.expandButtonRightHorizontal),title:"Expand right panel (50/50)"},{children:t.jsx(o,{})})),z&&t.jsx("div",{className:"".concat(s.default.dragOverlay," ").concat(s.default.dragOverlayHorizontal)})]}))]}))}));return b?xe:t.jsxs(t.Fragment,{children:[t.jsxs("div",e.__assign({ref:$,className:"".concat(s.default.container," ").concat(s.default.containerHorizontal," ").concat(_),style:{height:fe,width:he}},{children:[H&&t.jsxs("div",e.__assign({className:s.default.header},{children:[t.jsxs("div",e.__assign({className:s.default.headerLeft},{children:[H.showDocIcon&&t.jsx(a.FileText,{className:s.default.headerIcon}),t.jsx("div",e.__assign({className:s.default.headerTitle},{children:H.title&&t.jsx("span",e.__assign({className:s.default.headerTitleText},{children:H.title}))}))]})),t.jsxs("div",e.__assign({className:s.default.headerActions},{children:[void 0!==H.confidenceScore&&t.jsxs("div",e.__assign({className:"".concat(s.default.confidenceScore," ").concat(ue(H.confidenceScore))},{children:[t.jsx("div",e.__assign({style:{width:"16px",height:"16px"}},{children:t.jsx(l,{})})),t.jsxs("div",{children:[Math.round(H.confidenceScore),"%"]})]})),t.jsx("button",e.__assign({className:s.default.fullscreenButton,onClick:function(){return U(!0)},title:"Open fullscreen"},{children:t.jsx(c,{})}))]}))]})),t.jsxs("div",e.__assign({className:"".concat(s.default.contentArea," ").concat(s.default.contentAreaHorizontal)},{children:[!D&&t.jsx("div",e.__assign({className:s.default.panel,style:ce},{children:r})),D&&t.jsx("button",e.__assign({onClick:ne,className:"".concat(s.default.expandButton," ").concat(s.default.expandButtonHorizontal),title:"Expand left panel (50/50)"},{children:t.jsx(i,{})})),!D&&!q&&t.jsxs("div",e.__assign({onMouseDown:te,className:"".concat(s.default.divider," ").concat(s.default.dividerHorizontal," ").concat(z?s.default.dividerDragging:s.default.dividerIdle)},{children:[t.jsx("div",{className:"".concat(s.default.dividerHitArea," ").concat(s.default.dividerHitAreaHorizontal)}),de&&t.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),ne()},onMouseDown:function(e){return e.stopPropagation()},className:s.default.collapseButton,title:"Collapse left panel"},{children:t.jsx(o,{})})),re&&t.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),ae()},onMouseDown:function(e){return e.stopPropagation()},className:s.default.collapseButton,title:"Collapse right panel"},{children:t.jsx(i,{})}))]})),!q&&t.jsx("div",e.__assign({className:s.default.panel,style:{flex:1}},{children:u})),q&&t.jsx("button",e.__assign({onClick:ae,className:"".concat(s.default.expandButton," ").concat(s.default.expandButtonRightHorizontal),title:"Expand right panel (50/50)"},{children:t.jsx(o,{})})),z&&t.jsx("div",{className:"".concat(s.default.dragOverlay," ").concat(s.default.dragOverlayHorizontal)})]}))]})),xe]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),l=require("react"),i=require("lucide-react"),t=require("./Splitter.module.css.js"),o=require("./icons/icons.js");exports.default=function(a){var s,d,c,u,r,v,f,g,h,_,p,x,m,j,y=a.left,B=a.right,N=a.defaultLeftWidth,C=void 0===N?50:N,I=a.minLeftWidth,S=void 0===I?250:I,b=a.minRightWidth,w=void 0===b?250:b,z=a.className,A=void 0===z?"":z,H=a.height,P=void 0===H?"400px":H,M=a.width,O=void 0===M?"100%":M,R=a.header,E=a.onLeftWidthChange,T=a.openInFullscreen,D=void 0!==T&&T,k=a.onFullscreenClose,F=a.fullscreenOnly,L=void 0!==F&&F,q=a.classNames,W=a.customStyles,X=a.iconProps,G=l.useState(C),J=G[0],K=G[1],Q=l.useState(!1),U=Q[0],V=Q[1],Y=l.useState(!1),Z=Y[0],$=Y[1],ee=l.useState(!1),ne=ee[0],le=ee[1],ie=l.useState(0),te=ie[0],oe=ie[1],ae=l.useState(0),se=ae[0],de=ae[1],ce=l.useState(L||D),ue=ce[0],re=ce[1],ve=l.useRef(null),fe=l.useRef(null),ge=l.useRef(null),he=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(Boolean).join(" ")},_e=null!==(s=null==X?void 0:X.collapse)&&void 0!==s?s:{};l.useEffect(function(){var e=ve.current;e&&(ue?(e.showModal(),requestAnimationFrame(function(){if(ge.current){var e=ge.current.getBoundingClientRect().width;de(e),K(C),$(!1),le(!1)}})):(e.close(),K(C),$(!1),le(!1),null==k||k()))},[ue]),l.useEffect(function(){var e=ge.current;if(e&&ue){var n,l=new ResizeObserver(function(e){var l=e[0];n=requestAnimationFrame(function(){de(l.contentRect.width)})});return l.observe(e),function(){cancelAnimationFrame(n),l.disconnect()}}},[ue]),l.useEffect(function(){var e=fe.current;if(e){var n,l=new ResizeObserver(function(e){var l=e[0];n=requestAnimationFrame(function(){oe(l.contentRect.width)})});return l.observe(e),oe(e.getBoundingClientRect().width),function(){cancelAnimationFrame(n),l.disconnect()}}},[]);var pe=function(e){e.preventDefault(),V(!0)};l.useEffect(function(){var e=function(e){if(U){var n=ue?ge.current:fe.current;if(n){var l=n.getBoundingClientRect(),i=l.width,t=e.clientX-l.left;if(t>=S&&i-t-4>=w)K(t/i*100),null==E||E(t)}}},n=function(){V(!1)};return U&&(document.addEventListener("mousemove",e),document.addEventListener("mouseup",n)),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n)}},[U,ue,S,w,E]);var xe=function(){Z?(K(50),$(!1)):$(!0)},me=function(){ne?(K(50),le(!1)):le(!0)},je=ue?se:te,ye=J/100*je,Be=je-ye-4,Ne=ue?500:250,Ce=ne?{flex:1}:{width:"".concat(J,"%")},Ie=!Z&&ye<=Math.max(S+10,Ne),Se=!ne&&Be<=Math.max(w+10,Ne),be=function(e){return(null==W?void 0:W.confidenceBadge)?"":e>=80?t.default.confidenceScoreHigh:e>=60?t.default.confidenceScoreMedium:t.default.confidenceScoreLow},we="number"==typeof P?"".concat(P,"px"):P,ze="number"==typeof O?"".concat(O,"px"):O,Ae=n.jsx("dialog",e.__assign({ref:ve,className:he(t.default.dialogOverlay,null==q?void 0:q.dialogOverlay),style:null==W?void 0:W.dialogOverlay,onClose:function(){return re(!1)}},{children:n.jsxs("div",e.__assign({ref:ge,className:he(t.default.dialogContent,null==q?void 0:q.dialogContent),style:null==W?void 0:W.dialogContent},{children:[R&&n.jsxs("div",e.__assign({className:he(t.default.header,null==q?void 0:q.header),style:null==W?void 0:W.header},{children:[n.jsxs("div",e.__assign({className:t.default.headerLeft},{children:[R.showDocIcon&&n.jsx(i.FileText,{className:he(t.default.headerIcon,null==q?void 0:q.headerIcon),style:e.__assign(e.__assign({},null==W?void 0:W.headerIcon),(null===(d=null==X?void 0:X.headerIcon)||void 0===d?void 0:d.color)?{color:X.headerIcon.color}:{})}),n.jsx("div",e.__assign({className:t.default.headerTitle},{children:R.title&&n.jsx("span",e.__assign({className:he(t.default.headerTitleText,null==q?void 0:q.headerTitle),style:null==W?void 0:W.headerTitle},{children:R.title}))}))]})),n.jsxs("div",e.__assign({className:he(t.default.headerActions,null==q?void 0:q.headerActions),style:null==W?void 0:W.headerActions},{children:[void 0!==R.confidenceScore&&n.jsxs("div",e.__assign({className:he(t.default.confidenceScore,be(R.confidenceScore),null==q?void 0:q.confidenceBadge),style:null==W?void 0:W.confidenceBadge},{children:[n.jsx("div",e.__assign({style:{width:"16px",height:"16px"}},{children:n.jsx(o.AIMagicIcon,{color:null===(c=null==X?void 0:X.magic)||void 0===c?void 0:c.color,size:null===(u=null==X?void 0:X.magic)||void 0===u?void 0:u.size})})),n.jsxs("div",{children:[Math.round(R.confidenceScore),"%"]})]})),n.jsx("button",e.__assign({className:he(t.default.fullscreenButton,null==q?void 0:q.fullscreenButton),style:null==W?void 0:W.fullscreenButton,onClick:function(){return re(!1)},title:"Close fullscreen"},{children:n.jsx(i.X,{size:20,color:null!==(v=null===(r=null==X?void 0:X.close)||void 0===r?void 0:r.color)&&void 0!==v?v:"#5928ed"})}))]}))]})),n.jsxs("div",e.__assign({className:"".concat(t.default.contentArea," ").concat(t.default.contentAreaHorizontal," ").concat(t.default.dialogContentArea)},{children:[!Z&&n.jsx("div",e.__assign({className:he(t.default.panel,null!==(f=null==q?void 0:q.leftPanel)&&void 0!==f?f:null==q?void 0:q.panel),style:e.__assign(e.__assign({},Ce),null!==(g=null==W?void 0:W.leftPanel)&&void 0!==g?g:null==W?void 0:W.panel)},{children:y})),Z&&n.jsx("button",e.__assign({onClick:xe,className:"".concat(t.default.expandButton," ").concat(t.default.expandButtonHorizontal),title:"Expand left panel (50/50)"},{children:n.jsx(o.SidebarOpenIcon,e.__assign({},_e))})),!Z&&!ne&&n.jsxs("div",e.__assign({onMouseDown:pe,className:he(t.default.divider,t.default.dividerHorizontal,U?t.default.dividerDragging:t.default.dividerIdle,null==q?void 0:q.divider),style:null==W?void 0:W.divider},{children:[n.jsx("div",{className:"".concat(t.default.dividerHitArea," ").concat(t.default.dividerHitAreaHorizontal)}),Ie&&n.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),xe()},onMouseDown:function(e){return e.stopPropagation()},className:he(t.default.collapseButton,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Collapse left panel"},{children:n.jsx(o.SidebarCloseIcon,e.__assign({},_e))})),Se&&n.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),me()},onMouseDown:function(e){return e.stopPropagation()},className:he(t.default.collapseButton,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Collapse right panel"},{children:n.jsx(o.SidebarOpenIcon,e.__assign({},_e))}))]})),!ne&&n.jsx("div",e.__assign({className:he(t.default.panel,null!==(h=null==q?void 0:q.rightPanel)&&void 0!==h?h:null==q?void 0:q.panel),style:e.__assign({flex:1},null!==(_=null==W?void 0:W.rightPanel)&&void 0!==_?_:null==W?void 0:W.panel)},{children:B})),ne&&n.jsx("button",e.__assign({onClick:me,className:"".concat(t.default.expandButton," ").concat(t.default.expandButtonRightHorizontal),title:"Expand right panel (50/50)"},{children:n.jsx(o.SidebarCloseIcon,e.__assign({},_e))})),U&&n.jsx("div",{className:"".concat(t.default.dragOverlay," ").concat(t.default.dragOverlayHorizontal)})]}))]}))}));return L?Ae:n.jsxs(n.Fragment,{children:[n.jsxs("div",e.__assign({ref:fe,className:he(t.default.container,t.default.containerHorizontal,A,null==q?void 0:q.container),style:e.__assign({height:we,width:ze},null==W?void 0:W.container)},{children:[R&&n.jsxs("div",e.__assign({className:he(t.default.header,null==q?void 0:q.header),style:null==W?void 0:W.header},{children:[n.jsxs("div",e.__assign({className:t.default.headerLeft},{children:[R.showDocIcon&&n.jsx(i.FileText,{className:he(t.default.headerIcon,null==q?void 0:q.headerIcon),style:e.__assign(e.__assign({},null==W?void 0:W.headerIcon),(null===(p=null==X?void 0:X.headerIcon)||void 0===p?void 0:p.color)?{color:X.headerIcon.color}:{})}),n.jsx("div",e.__assign({className:t.default.headerTitle},{children:R.title&&n.jsx("span",e.__assign({className:he(t.default.headerTitleText,null==q?void 0:q.headerTitle),style:null==W?void 0:W.headerTitle},{children:R.title}))}))]})),n.jsxs("div",e.__assign({className:he(t.default.headerActions,null==q?void 0:q.headerActions),style:null==W?void 0:W.headerActions},{children:[void 0!==R.confidenceScore&&n.jsxs("div",e.__assign({className:he(t.default.confidenceScore,be(R.confidenceScore),null==q?void 0:q.confidenceBadge),style:null==W?void 0:W.confidenceBadge},{children:[n.jsx("div",e.__assign({style:{width:"16px",height:"16px"}},{children:n.jsx(o.AIMagicIcon,{color:null===(x=null==X?void 0:X.magic)||void 0===x?void 0:x.color,size:null===(m=null==X?void 0:X.magic)||void 0===m?void 0:m.size})})),n.jsxs("div",{children:[Math.round(R.confidenceScore),"%"]})]})),n.jsx("button",e.__assign({className:he(t.default.fullscreenButton,null==q?void 0:q.fullscreenButton),style:null==W?void 0:W.fullscreenButton,onClick:function(){return re(!0)},title:"Open fullscreen"},{children:n.jsx(o.MaximizeIcon,{color:null===(j=null==X?void 0:X.maximize)||void 0===j?void 0:j.color})}))]}))]})),function(){var l,i,a,s;return n.jsxs("div",e.__assign({className:"".concat(t.default.contentArea," ").concat(t.default.contentAreaHorizontal)},{children:[!Z&&n.jsx("div",e.__assign({className:he(t.default.panel,null!==(l=null==q?void 0:q.leftPanel)&&void 0!==l?l:null==q?void 0:q.panel),style:e.__assign(e.__assign({},Ce),null!==(i=null==W?void 0:W.leftPanel)&&void 0!==i?i:null==W?void 0:W.panel)},{children:y})),Z&&n.jsx("button",e.__assign({onClick:xe,className:he((null==W?void 0:W.collapseButton)?"":t.default.expandButton,t.default.expandButtonHorizontal,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Expand left panel (50/50)"},{children:n.jsx(o.SidebarOpenIcon,e.__assign({},_e))})),!Z&&!ne&&n.jsxs("div",e.__assign({onMouseDown:pe,className:he(t.default.divider,t.default.dividerHorizontal,U?t.default.dividerDragging:t.default.dividerIdle,null==q?void 0:q.divider),style:null==W?void 0:W.divider},{children:[n.jsx("div",{className:"".concat(t.default.dividerHitArea," ").concat(t.default.dividerHitAreaHorizontal)}),Ie&&n.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),xe()},onMouseDown:function(e){return e.stopPropagation()},className:he(t.default.collapseButton,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Collapse left panel"},{children:n.jsx(o.SidebarCloseIcon,e.__assign({},_e))})),Se&&n.jsx("button",e.__assign({onClick:function(e){e.stopPropagation(),me()},onMouseDown:function(e){return e.stopPropagation()},className:he(t.default.collapseButton,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Collapse right panel"},{children:n.jsx(o.SidebarOpenIcon,e.__assign({},_e))}))]})),!ne&&n.jsx("div",e.__assign({className:he(t.default.panel,null!==(a=null==q?void 0:q.rightPanel)&&void 0!==a?a:null==q?void 0:q.panel),style:e.__assign({flex:1},null!==(s=null==W?void 0:W.rightPanel)&&void 0!==s?s:null==W?void 0:W.panel)},{children:B})),ne&&n.jsx("button",e.__assign({onClick:me,className:he((null==W?void 0:W.collapseButton)?"":t.default.expandButton,t.default.expandButtonRightHorizontal,null==q?void 0:q.collapseButton),style:null==W?void 0:W.collapseButton,title:"Expand right panel (50/50)"},{children:n.jsx(o.SidebarCloseIcon,e.__assign({},_e))})),U&&n.jsx("div",{className:"".concat(t.default.dragOverlay," ").concat(t.default.dragOverlayHorizontal)})]}))}()]})),Ae]})};
|
|
2
2
|
//# sourceMappingURL=SplitterCitationsComponent.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var C=require("tslib"),e=require("react/jsx-runtime");exports.AIMagicIcon=function(i){var o=i.color,r=void 0===o?"#087443":o,t=i.size,s=void 0===t?14:t;return e.jsxs("svg",C.__assign({xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 12 12",fill:"none"},{children:[e.jsx("path",{d:"M7.58186 3.15354C7.51731 2.83771 7.06604 2.83771 7.00148 3.15354C6.60544 5.09119 5.09119 6.60544 3.15355 7.00148C2.83771 7.06603 2.83771 7.5173 3.15355 7.58185C5.09119 7.97789 6.60544 9.49215 7.00148 11.4298C7.06604 11.7456 7.51731 11.7456 7.58186 11.4298C7.9779 9.49215 9.49215 7.97789 11.4298 7.58185C11.7456 7.5173 11.7456 7.06603 11.4298 7.00148C9.49215 6.60544 7.9779 5.09119 7.58186 3.15354Z",fill:r}),e.jsx("path",{d:"M2.20669 0.0156637C2.20243 -0.00522128 2.17258 -0.0052212 2.16832 0.0156638C1.94676 1.09964 1.09964 1.94676 0.0156679 2.16831C-0.0052166 2.17258 -0.0052166 2.20242 0.0156679 2.20669C1.09964 2.42825 1.94676 3.27536 2.16832 4.35934C2.17258 4.38022 2.20243 4.38022 2.20669 4.35934C2.42825 3.27536 3.27537 2.42824 4.35934 2.20669C4.38023 2.20242 4.38023 2.17258 4.35934 2.16831C3.27537 1.94676 2.42825 1.09964 2.20669 0.0156637Z",fill:r})]}))},exports.MaximizeIcon=function(i){var o=i.color,r=void 0===o?"#7A5AF8":o;return e.jsx("svg",C.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 16 16",fill:"none"},{children:e.jsx("path",{d:"M3.125 2.75C3.02554 2.75 2.93016 2.78951 2.85983 2.85983C2.78951 2.93016 2.75 3.02554 2.75 3.125V6.125C2.75 6.22446 2.71049 6.31984 2.64017 6.39016C2.56984 6.46049 2.47446 6.5 2.375 6.5C2.27554 6.5 2.18016 6.46049 2.10983 6.39016C2.03951 6.31984 2 6.22446 2 6.125V3.125C2 2.82663 2.11853 2.54048 2.3295 2.3295C2.54048 2.11853 2.82663 2 3.125 2H6.125C6.22446 2 6.31984 2.03951 6.39016 2.10983C6.46049 2.18016 6.5 2.27554 6.5 2.375C6.5 2.47446 6.46049 2.56984 6.39016 2.64017C6.31984 2.71049 6.22446 2.75 6.125 2.75H3.125ZM9.5 2.375C9.5 2.27554 9.53951 2.18016 9.60983 2.10983C9.68016 2.03951 9.77554 2 9.875 2H12.875C13.1734 2 13.4595 2.11853 13.6705 2.3295C13.8815 2.54048 14 2.82663 14 3.125V6.125C14 6.22446 13.9605 6.31984 13.8902 6.39016C13.8198 6.46049 13.7245 6.5 13.625 6.5C13.5255 6.5 13.4302 6.46049 13.3598 6.39016C13.2895 6.31984 13.25 6.22446 13.25 6.125V3.125C13.25 3.02554 13.2105 2.93016 13.1402 2.85983C13.0698 2.78951 12.9745 2.75 12.875 2.75H9.875C9.77554 2.75 9.68016 2.71049 9.60983 2.64017C9.53951 2.56984 9.5 2.47446 9.5 2.375ZM2.375 9.5C2.47446 9.5 2.56984 9.53951 2.64017 9.60983C2.71049 9.68016 2.75 9.77554 2.75 9.875V12.875C2.75 12.9745 2.78951 13.0698 2.85983 13.1402C2.93016 13.2105 3.02554 13.25 3.125 13.25H6.125C6.22446 13.25 6.31984 13.2895 6.39016 13.3598C6.46049 13.4302 6.5 13.5255 6.5 13.625C6.5 13.7245 6.46049 13.8198 6.39016 13.8902C6.31984 13.9605 6.22446 14 6.125 14H3.125C2.82663 14 2.54048 13.8815 2.3295 13.6705C2.11853 13.4595 2 13.1734 2 12.875V9.875C2 9.77554 2.03951 9.68016 2.10983 9.60983C2.18016 9.53951 2.27554 9.5 2.375 9.5ZM13.625 9.5C13.7245 9.5 13.8198 9.53951 13.8902 9.60983C13.9605 9.68016 14 9.77554 14 9.875V12.875C14 13.1734 13.8815 13.4595 13.6705 13.6705C13.4595 13.8815 13.1734 14 12.875 14H9.875C9.77554 14 9.68016 13.9605 9.60983 13.8902C9.53951 13.8198 9.5 13.7245 9.5 13.625C9.5 13.5255 9.53951 13.4302 9.60983 13.3598C9.68016 13.2895 9.77554 13.25 9.875 13.25H12.875C12.9745 13.25 13.0698 13.2105 13.1402 13.1402C13.2105 13.0698 13.25 12.9745 13.25 12.875V9.875C13.25 9.77554 13.2895 9.68016 13.3598 9.60983C13.4302 9.53951 13.5255 9.5 13.625 9.5Z",fill:r,stroke:r,strokeWidth:"0.5"})}))},exports.SidebarCloseIcon=function(i){var o=i.fill,r=void 0===o?"#F8FAFC":o,t=i.stroke,s=void 0===t?"#E0E0E0":t,n=i.arrowStroke,l=void 0===n?"black":n;return e.jsxs("svg",C.__assign({width:"21",height:"54",viewBox:"0 0 21 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("path",{d:"M1.26074 1.57324L16.4268 10.8262C18.9563 12.3695 20.4999 15.1188 20.5 18.082V37.0273C20.4999 40.16 18.7767 43.0386 16.0156 44.5186L1.23633 52.4404L0.5 52.835V1.10938L1.26074 1.57324Z",fill:r,stroke:s}),e.jsx("path",{d:"M13.5 32L8.5 27L13.5 22",stroke:l,strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}))},exports.SidebarOpenIcon=function(i){var o=i.fill,r=void 0===o?"#F8FAFC":o,t=i.stroke,s=void 0===t?"#E0E0E0":t,n=i.arrowStroke,l=void 0===n?"#111827":n;return e.jsxs("svg",C.__assign({width:"21",height:"54",viewBox:"0 0 20 54",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("path",{d:"M0.260742 1.57324L15.4268 10.8262C17.9563 12.3695 19.4999 15.1188 19.5 18.082V37.0273C19.4999 40.16 17.7767 43.0386 15.0156 44.5186L0.236328 52.4404L-0.5 52.835V1.10938L0.260742 1.57324Z",fill:r,stroke:s}),e.jsx("path",{d:"M7.5 32L12.5 27L7.5 22",stroke:l,strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}))};
|
|
2
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("lucide-react"),l=require("./TextualGuidelines.module.css.js"),a=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),s=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(Boolean).join(" ")},o=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},r=function(e,n){var i=e.map(o).filter(Boolean),t=n.map(o).filter(Boolean);if(0===i.length||0===t.length)return 0;var l=new Set(i),a=new Set(t),s=0;return l.forEach(function(e){a.has(e)&&s++}),2*s/(l.size+a.size)},h=function(i){var t=0;return i.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(i){var a="bold-".concat(t);return t+=i.length,i.startsWith("**")&&i.endsWith("**")||i.startsWith("__")&&i.endsWith("__")?n.jsx("strong",e.__assign({className:l.default.boldText},{children:i.slice(2,-2)}),a):i})};exports.default=function(o){o.index;var d=o.TextualGuideLines,c=o.HighlightedWords,u=o.InternalGptReasoningData,g=o.headerTitle,v=void 0===g?"Textual Guidelines":g,x=o.IgptHeaderTitle,f=void 0===x?"GPT - Gemini 3.1 Flash Lite":x,_=o.useVariantHighlight,m=void 0!==_&&_,p=o.fuzzyThreshold,I=void 0===p?.8:p,j=o.onAccordionToggle,C=o.isInternalGptReasoningLoading,y=void 0!==C&&C,b=o.themeTokens,L=o.classNames,N=o.styles,w=i.useState(0),T=w[0],k=w[1],A=i.useState(new Set),z=A[0],B=A[1],V=i.useRef([]),D=[];c.forEach(function(e){(function(e,n,i){void 0===i&&(i=.8);var t=n.trim().split(/\s+/).filter(Boolean);if(0===t.length)return[];for(var l,a=[],s=/\S+/g;null!==(l=s.exec(e));)a.push({word:l[0],start:l.index,end:l.index+l[0].length});for(var o=t.length,h=[],d=Math.max(1,o-1);d<=o+2;d++)for(var c=0;c<=a.length-d;c++){var u=a.slice(c,c+d),g=r(t,u.map(function(e){return e.word}));g>=i&&h.push({startIndex:u[0].start,endIndex:u[u.length-1].end,score:g})}if(0===h.length)return[];h.sort(function(e,n){return n.score-e.score});for(var v=[],x=function(e){v.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||v.push(e)},f=0,_=h;f<_.length;f++)x(_[f]);return v})(d,e,I).forEach(function(e){return D.push(e)})}),D.sort(function(e,n){return e.startIndex-n.startIndex});for(var G=[],M=0,R=D;M<R.length;M++){var E=R[M],S=G.at(-1);(!S||E.startIndex>=S.endIndex)&&G.push(E)}var U=G.map(function(e,n){return{text:d.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),q=U.length;i.useEffect(function(){q>0&&(k(0),setTimeout(function(){var e;null===(e=V.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[q]);var H,P,W,F,K=function(e,n){B(function(i){var t=new Set(i),l=!t.has(e);return t.has(e)?t.delete(e):t.add(e),null==j||j({highlightIndex:e,phrase:n,isExpanded:l}),t})};return n.jsxs("div",e.__assign({className:s(l.default.expandedContainer,null==L?void 0:L.container),style:e.__assign(e.__assign({},b),null==N?void 0:N.container)},{children:[n.jsxs("div",e.__assign({className:s(l.default.expandedHeader,null==L?void 0:L.header),style:null==N?void 0:N.header},{children:[n.jsx("span",e.__assign({className:s(l.default.headerTitle,null==L?void 0:L.headerTitle),style:null==N?void 0:N.headerTitle},{children:v})),n.jsx("div",e.__assign({className:s(l.default.headerActions,null==L?void 0:L.headerActions),style:null==N?void 0:N.headerActions},{children:q>=1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({className:s(l.default.navCounter,null==L?void 0:L.navCounter),style:null==N?void 0:N.navCounter},{children:[T+1," / ",q]})),n.jsx("button",e.__assign({onClick:function(){if(0!==q){var e=T>0?T-1:q-1;k(e),setTimeout(function(){var n;null===(n=V.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:T<=0,className:s(l.default.navButton,null==L?void 0:L.navButtonPrev),style:null==N?void 0:N.navButtonPrev},{children:n.jsx(t.ChevronUp,{size:14,className:l.default.navButtonIcon})})),n.jsx("button",e.__assign({onClick:function(){if(0!==q){var e=T<q-1?T+1:0;k(e),setTimeout(function(){var n;null===(n=V.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:T>=q-1,className:s(l.default.navButton,null==L?void 0:L.navButtonNext),style:null==N?void 0:N.navButtonNext},{children:n.jsx(t.ChevronDown,{size:14,className:l.default.navButtonIcon})}))]})}))]})),n.jsx("div",e.__assign({className:s(l.default.contentArea,null==L?void 0:L.contentArea),style:null==N?void 0:N.contentArea},{children:n.jsx("div",e.__assign({className:s(l.default.contentInner,null==L?void 0:L.contentInner),style:null==N?void 0:N.contentInner},{children:(H=d.split("\n"),P=0,W=0,F=[],H.forEach(function(i){var o=P,r=P+i.length;P+=i.length+1;var c=/^(\s*)(-|\*|\d+\.)\s+/.exec(i),g=/^(Title|Description|Training-basis):\s*/i.exec(i);g&&(W=0),c&&(W+=1);var v=!!c,x=!!g,_=c?c[0].length:0,p=o+_,I=U.filter(function(e){return e.startIndex<r&&e.endIndex>p}),j="line-".concat(o),C=function(i,t,a,o){x?F.push(n.jsx("span",e.__assign({className:s(l.default.headerLine,null==L?void 0:L.headerLine),style:null==N?void 0:N.headerLine},{children:i}),t)):v?F.push(n.jsxs("span",e.__assign({className:s(l.default.listItemLine,null==L?void 0:L.listItemLine),style:e.__assign({paddingLeft:c[1]?"1rem":"0"},null==N?void 0:N.listItemLine)},{children:[a&&n.jsxs("span",e.__assign({className:s(l.default.listCounter,null==L?void 0:L.listCounter),style:null==N?void 0:N.listCounter},{children:[W,"."]})),n.jsx("span",{children:i})]}),t)):F.push(n.jsx("span",e.__assign({className:s(l.default.blockLine,null==L?void 0:L.blockLine),style:null==N?void 0:N.blockLine},{children:i}),t))},b=v&&1===I.length&&I[0].startIndex<=p&&I[0].endIndex>=r;if(0===I.length)C(h(i.substring(_)),j,!0);else if(b){var w=I[0],k=w.highlightIndex===T,A=z.has(w.highlightIndex),B=m?k?"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightActiveVariant):"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightVariantRow):k?"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightActive):l.default.highlightBlockRow;F.push(n.jsxs("span",e.__assign({ref:function(e){V.current[w.highlightIndex]=e},className:"".concat(l.default.listItemLine," ").concat(B),role:"button",tabIndex:0,onClick:function(){return K(w.highlightIndex,w.text)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||K(w.highlightIndex,w.text)},style:{paddingLeft:c[1]?"1rem":"0"}},{children:[n.jsxs("span",e.__assign({className:l.default.listCounter},{children:[W,"."]})),n.jsx("span",{children:h(d.substring(p,r))}),A?n.jsx(t.ChevronUp,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}}):n.jsx(t.ChevronDown,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}})]}),j)),A&&u[w.highlightIndex]?F.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(a.default,{item:e.__assign(e.__assign({},u[w.highlightIndex]),{confidence_score:void 0}),headerTitle:f||"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:t.ChevronDown,ChevronUpIcon:t.ChevronUp,MaximizeIcon:t.Maximize2,CloseIcon:t.X},bodyHeight:"100%",disableMaximize:!0,index:w.highlightIndex})}),"expanded-".concat(w.highlightIndex))):A&&y&&F.push(n.jsxs("div",e.__assign({className:l.default.loadingContainer},{children:[n.jsx(t.Loader2,{size:16,className:l.default.spinnerIcon}),n.jsx("span",{children:"Loading..."})]}),"loading-".concat(w.highlightIndex)))}else{var D=p,G=[],M=!0,R=I[0],E=R.highlightIndex===T;m?E?"".concat(l.default.highlight," ").concat(l.default.highlightActiveVariant):l.default.highlightVariant:E?"".concat(l.default.highlight," ").concat(l.default.highlightActive):l.default.highlight,v&&R.startIndex;for(var S=function(i){var o=Math.max(i.startIndex,p),c=Math.min(i.endIndex,r);if(o>=c)return"continue";if(o>D){var g=d.substring(D,o);G.push(n.jsx("span",{children:h(g)},"t-".concat(D)))}var v=i.highlightIndex===T,x=m?v?s(l.default.highlight,l.default.highlightActiveVariant,null==L?void 0:L.highlight,null==L?void 0:L.highlightActiveVariant):s(l.default.highlightVariant,null==L?void 0:L.highlightVariant):v?s(l.default.highlight,l.default.highlightActive,null==L?void 0:L.highlight,null==L?void 0:L.highlightActive):s(l.default.highlight,null==L?void 0:L.highlight),_=m?v?e.__assign(e.__assign({},null==N?void 0:N.highlight),null==N?void 0:N.highlightActiveVariant):e.__assign({},null==N?void 0:N.highlightVariant):v?e.__assign(e.__assign({},null==N?void 0:N.highlight),null==N?void 0:N.highlightActive):e.__assign({},null==N?void 0:N.highlight),I=z.has(i.highlightIndex);if(G.push(n.jsxs("span",e.__assign({ref:function(e){V.current[i.highlightIndex]=e},className:x,role:"button",tabIndex:0,onClick:function(){return K(i.highlightIndex,i.text)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||K(i.highlightIndex,i.text)},style:e.__assign({display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"},_)},{children:[d.substring(o,c),I?n.jsx(t.ChevronUp,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}}):n.jsx(t.ChevronDown,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}})]}),"h-".concat(i.highlightIndex))),D=c,I&&u[i.highlightIndex]){var b=M?j:"".concat(j,"-chunk-").concat(o);C(G,b,M),M=!1,G=[],F.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(a.default,{item:e.__assign(e.__assign({},u[i.highlightIndex]),{confidence_score:void 0}),headerTitle:f||"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:t.ChevronDown,ChevronUpIcon:t.ChevronUp,MaximizeIcon:t.Maximize2,CloseIcon:t.X},bodyHeight:"100%",disableMaximize:!0,index:i.highlightIndex})}),"expanded-".concat(i.highlightIndex)))}else I&&y&&(b=M?j:"".concat(j,"-chunk-").concat(o),C(G,b,M),M=!1,G=[],F.push(n.jsxs("div",e.__assign({className:l.default.loadingContainer},{children:[n.jsx(t.Loader2,{size:16,className:l.default.spinnerIcon}),n.jsx("span",{children:"Loading..."})]}),"loading-".concat(i.highlightIndex))))},q=0,H=I;q<H.length;q++)S(H[q]);if(D<r&&G.push(n.jsx("span",{children:h(d.substring(D,r))},"t-end-".concat(r))),G.length>0||M){var X=M?j:"".concat(j,"-tail");C(G,X,M)}}}),F)}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("lucide-react"),l=require("./TextualGuidelines.module.css.js"),a=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),s=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(Boolean).join(" ")},o=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},r=function(e,n){var i=e.map(o).filter(Boolean),t=n.map(o).filter(Boolean);if(0===i.length||0===t.length)return 0;var l=new Set(i),a=new Set(t),s=0;return l.forEach(function(e){a.has(e)&&s++}),2*s/(l.size+a.size)},h=function(i){var t=0;return i.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(i){var a="bold-".concat(t);return t+=i.length,i.startsWith("**")&&i.endsWith("**")||i.startsWith("__")&&i.endsWith("__")?n.jsx("strong",e.__assign({className:l.default.boldText},{children:i.slice(2,-2)}),a):i})};exports.default=function(o){o.index;var d=o.TextualGuideLines,c=o.HighlightedWords,u=o.InternalGptReasoningData,g=o.headerTitle,v=void 0===g?"Textual Guidelines":g,x=o.IgptHeaderTitle,f=void 0===x?"GPT - Gemini 3.1 Flash Lite":x,_=o.useVariantHighlight,m=void 0!==_&&_,I=o.fuzzyThreshold,p=void 0===I?.8:I,j=o.onAccordionToggle,C=o.isInternalGptReasoningLoading,b=void 0!==C&&C,y=o.themeTokens,L=o.classNames,N=o.styles,w=i.useState(0),T=w[0],k=w[1],A=i.useState(new Set),z=A[0],B=A[1],V=i.useRef([]),D=[];c.forEach(function(e){(function(e,n,i){void 0===i&&(i=.8);var t=n.trim().split(/\s+/).filter(Boolean);if(0===t.length)return[];for(var l,a=[],s=/\S+/g;null!==(l=s.exec(e));)a.push({word:l[0],start:l.index,end:l.index+l[0].length});for(var o=t.length,h=[],d=Math.max(1,o-1);d<=o+2;d++)for(var c=0;c<=a.length-d;c++){var u=a.slice(c,c+d),g=r(t,u.map(function(e){return e.word}));g>=i&&h.push({startIndex:u[0].start,endIndex:u[u.length-1].end,score:g})}if(0===h.length)return[];h.sort(function(e,n){return n.score-e.score||n.endIndex-n.startIndex-(e.endIndex-e.startIndex)});for(var v=[],x=function(e){v.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||v.push(e)},f=0,_=h;f<_.length;f++)x(_[f]);return v})(d,e,p).forEach(function(e){return D.push(e)})}),D.sort(function(e,n){return e.startIndex-n.startIndex});for(var G=[],M=0,R=D;M<R.length;M++){var E=R[M],S=G.at(-1);(!S||E.startIndex>=S.endIndex)&&G.push(E)}var U=G.map(function(e,n){return{text:d.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),q=U.length;i.useEffect(function(){q>0&&(k(0),setTimeout(function(){var e;null===(e=V.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[q]);var H,P,W,F,K=function(e,n){B(function(i){var t=new Set(i),l=!t.has(e);return t.has(e)?t.delete(e):t.add(e),null==j||j({highlightIndex:e,phrase:n,isExpanded:l}),t})};return n.jsxs("div",e.__assign({className:s(l.default.expandedContainer,null==L?void 0:L.container),style:e.__assign(e.__assign({},y),null==N?void 0:N.container)},{children:[n.jsxs("div",e.__assign({className:s(l.default.expandedHeader,null==L?void 0:L.header),style:null==N?void 0:N.header},{children:[n.jsx("span",e.__assign({className:s(l.default.headerTitle,null==L?void 0:L.headerTitle),style:null==N?void 0:N.headerTitle},{children:v})),n.jsx("div",e.__assign({className:s(l.default.headerActions,null==L?void 0:L.headerActions),style:null==N?void 0:N.headerActions},{children:q>=1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({className:s(l.default.navCounter,null==L?void 0:L.navCounter),style:null==N?void 0:N.navCounter},{children:[T+1," / ",q]})),n.jsx("button",e.__assign({onClick:function(){if(0!==q){var e=T>0?T-1:q-1;k(e),setTimeout(function(){var n;null===(n=V.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:T<=0,className:s(l.default.navButton,null==L?void 0:L.navButtonPrev),style:null==N?void 0:N.navButtonPrev},{children:n.jsx(t.ChevronUp,{size:14,className:l.default.navButtonIcon})})),n.jsx("button",e.__assign({onClick:function(){if(0!==q){var e=T<q-1?T+1:0;k(e),setTimeout(function(){var n;null===(n=V.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:T>=q-1,className:s(l.default.navButton,null==L?void 0:L.navButtonNext),style:null==N?void 0:N.navButtonNext},{children:n.jsx(t.ChevronDown,{size:14,className:l.default.navButtonIcon})}))]})}))]})),n.jsx("div",e.__assign({className:s(l.default.contentArea,null==L?void 0:L.contentArea),style:null==N?void 0:N.contentArea},{children:n.jsx("div",e.__assign({className:s(l.default.contentInner,null==L?void 0:L.contentInner),style:null==N?void 0:N.contentInner},{children:(H=d.split("\n"),P=0,W=0,F=[],H.forEach(function(i){var o=P,r=P+i.length;P+=i.length+1;var c=/^(\s*)(-|\*|\d+\.)\s+/.exec(i),g=/^(Title|Description|Training-basis):\s*/i.exec(i);g&&(W=0),c&&(W+=1);var v=!!c,x=!!g,_=c?c[0].length:0,I=o+_,p=U.filter(function(e){return e.startIndex<r&&e.endIndex>I}),j="line-".concat(o),C=function(i,t,a,o){x?F.push(n.jsx("span",e.__assign({className:s(l.default.headerLine,null==L?void 0:L.headerLine),style:null==N?void 0:N.headerLine},{children:i}),t)):v?F.push(n.jsxs("span",e.__assign({className:s(l.default.listItemLine,null==L?void 0:L.listItemLine),style:e.__assign({paddingLeft:c[1]?"1rem":"0"},null==N?void 0:N.listItemLine)},{children:[a&&n.jsxs("span",e.__assign({className:s(l.default.listCounter,null==L?void 0:L.listCounter),style:null==N?void 0:N.listCounter},{children:[W,"."]})),n.jsx("span",{children:i})]}),t)):F.push(n.jsx("span",e.__assign({className:s(l.default.blockLine,null==L?void 0:L.blockLine),style:null==N?void 0:N.blockLine},{children:i}),t))},y=v&&1===p.length&&p[0].startIndex<=I&&p[0].endIndex>=r;if(0===p.length)C(h(i.substring(_)),j,!0);else if(y){var w=p[0],k=w.highlightIndex===T,A=z.has(w.highlightIndex),B=m?k?"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightActiveVariant):"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightVariantRow):k?"".concat(l.default.highlightBlockRow," ").concat(l.default.highlightActive):l.default.highlightBlockRow;F.push(n.jsxs("span",e.__assign({ref:function(e){V.current[w.highlightIndex]=e},className:"".concat(l.default.listItemLine," ").concat(B),role:"button",tabIndex:0,onClick:function(){return K(w.highlightIndex,w.text)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||K(w.highlightIndex,w.text)},style:{paddingLeft:c[1]?"1rem":"0"}},{children:[n.jsxs("span",e.__assign({className:l.default.listCounter},{children:[W,"."]})),n.jsx("span",{children:h(d.substring(I,r))}),A?n.jsx(t.ChevronUp,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}}):n.jsx(t.ChevronDown,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}})]}),j)),A&&u[w.highlightIndex]?F.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(a.default,{item:e.__assign(e.__assign({},u[w.highlightIndex]),{confidence_score:void 0}),headerTitle:f||"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:t.ChevronDown,ChevronUpIcon:t.ChevronUp,MaximizeIcon:t.Maximize2,CloseIcon:t.X},bodyHeight:"100%",disableMaximize:!0,index:w.highlightIndex})}),"expanded-".concat(w.highlightIndex))):A&&b&&F.push(n.jsxs("div",e.__assign({className:l.default.loadingContainer},{children:[n.jsx(t.Loader2,{size:16,className:l.default.spinnerIcon}),n.jsx("span",{children:"Loading..."})]}),"loading-".concat(w.highlightIndex)))}else{var D=I,G=[],M=!0,R=p[0],E=R.highlightIndex===T;m?E?"".concat(l.default.highlight," ").concat(l.default.highlightActiveVariant):l.default.highlightVariant:E?"".concat(l.default.highlight," ").concat(l.default.highlightActive):l.default.highlight,v&&R.startIndex;for(var S=function(i){var o=Math.max(i.startIndex,I),c=Math.min(i.endIndex,r);if(o>=c)return"continue";if(o>D){var g=d.substring(D,o);G.push(n.jsx("span",{children:h(g)},"t-".concat(D)))}var v=i.highlightIndex===T,x=m?v?s(l.default.highlight,l.default.highlightActiveVariant,null==L?void 0:L.highlight,null==L?void 0:L.highlightActiveVariant):s(l.default.highlightVariant,null==L?void 0:L.highlightVariant):v?s(l.default.highlight,l.default.highlightActive,null==L?void 0:L.highlight,null==L?void 0:L.highlightActive):s(l.default.highlight,null==L?void 0:L.highlight),_=m?v?e.__assign(e.__assign({},null==N?void 0:N.highlight),null==N?void 0:N.highlightActiveVariant):e.__assign({},null==N?void 0:N.highlightVariant):v?e.__assign(e.__assign({},null==N?void 0:N.highlight),null==N?void 0:N.highlightActive):e.__assign({},null==N?void 0:N.highlight),p=z.has(i.highlightIndex);if(G.push(n.jsxs("span",e.__assign({ref:function(e){V.current[i.highlightIndex]=e},className:x,role:"button",tabIndex:0,onClick:function(){return K(i.highlightIndex,i.text)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||K(i.highlightIndex,i.text)},style:e.__assign({cursor:"pointer"},_)},{children:[d.substring(o,c),p?n.jsx(t.ChevronUp,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}}):n.jsx(t.ChevronDown,{size:12,style:{verticalAlign:"middle",marginLeft:"2px"}})]}),"h-".concat(i.highlightIndex))),D=c,p&&u[i.highlightIndex]){var y=M?j:"".concat(j,"-chunk-").concat(o);C(G,y,M),M=!1,G=[],F.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(a.default,{item:e.__assign(e.__assign({},u[i.highlightIndex]),{confidence_score:void 0}),headerTitle:f||"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:t.ChevronDown,ChevronUpIcon:t.ChevronUp,MaximizeIcon:t.Maximize2,CloseIcon:t.X},bodyHeight:"100%",disableMaximize:!0,index:i.highlightIndex})}),"expanded-".concat(i.highlightIndex)))}else p&&b&&(y=M?j:"".concat(j,"-chunk-").concat(o),C(G,y,M),M=!1,G=[],F.push(n.jsxs("div",e.__assign({className:l.default.loadingContainer},{children:[n.jsx(t.Loader2,{size:16,className:l.default.spinnerIcon}),n.jsx("span",{children:"Loading..."})]}),"loading-".concat(i.highlightIndex))))},q=0,H=p;q<H.length;q++)S(H[q]);if(D<r&&G.push(n.jsx("span",{children:h(d.substring(D,r))},"t-end-".concat(r))),G.length>0||M){var X=M?j:"".concat(j,"-tail");C(G,X,M)}}}),F)}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=TextualGuideLinesComponent.js.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),o=require("./features/Bookemon/Bookemon.js"),r=require("./features/PdfEditorCitation/PdfEditorCitation.js"),n=require("./features/CitationRenderer/CitationRenderer.js"),a=require("./features/CitationRenderer/MarkdownRenderer.js"),s=require("./features/CodeCitation/_components/CodeEditor.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),o=require("./features/Bookemon/Bookemon.js"),r=require("./features/PdfEditorCitation/PdfEditorCitation.js"),n=require("./features/CitationRenderer/CitationRenderer.js"),a=require("./features/CitationRenderer/MarkdownRenderer.js"),s=require("./features/CodeCitation/_components/CodeEditor.js"),u=require("./features/PaginatedTable/PaginatedTable.js"),C=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),p=require("./features/ChatCitation/ChatCitationRenderer.js"),l=require("./features/CognitiveDecisioning/CognitiveDecisioningWrapper.js"),d=require("./features/PdfViewer/PdfViewer.js"),f=require("./features/CognitiveDecisioning/FaqCitation/FaqCitation.js"),x=require("./features/RequirementAiCitations/ImageCitation/ImageCitationContent.js"),g=require("./features/RequirementAiCitations/VideoCitation/VideoCitationContent.js"),m=require("./features/RequirementAiCitations/FileCitation/FileCitationContent.js"),c=require("./features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),q=require("./features/MarkdownWithImageCitation/MarkdownWithImageCitation.js"),j=require("./features/RequirementAiCitations/AiReasoning/AiReasoningCitation.js"),R=require("./features/TableCitation/TableCitationContent.js"),S=require("./features/CitationViewer/CitationsViewer.js"),w=require("./features/ExcelCitation/ExcelCitations.js"),I=require("./features/ScannedDocCitation/ScannedDocCitation.js"),T=require("./features/ChatDrawer/ChatDrawer.js"),D=require("./features/ChatDrawer/constants/ChatDrawer.js"),P=require("./features/SplitterCitations/SplitterCitationsComponent.js"),b=require("./features/DualCitation/SourceBQDataCompnent.js"),E=require("./features/CognitiveCompare/CognitiveCompare.js"),V=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),A=require("./features/TextualGuidelines/TextualGuideLinesComponent.js"),W=require("./features/RulebookCitations/RuleBookCitationWrapper.js"),h=require("./features/IngestionStatus/IngestionStatusComponent.js"),k=require("./features/ManageRemainders/ManageReminders.js"),v=require("./features/PromptemonBlockViewer/PromptemonBlockViewer.js"),B=require("./features/PromptemonViewer/PromptemonViewer.js"),F=require("./features/GptWebCitation/GptWebCitation.js"),G=require("./hooks/useOnDemandCitationFetch.js"),U=require("./features/InstantLearningCitation/InstantLearningCitationComponent.js"),_=require("./features/BPACitationRenderer/BPACitationRenderer.js"),M=require("./features/GptWebCitation/utils/citationData.utils.js"),L=require("./features/GptWebCitation/types.js");exports.CodeCitation=e.default,exports.ProjectAccordian=t.default,exports.BookCitation=i.default,exports.Bookemon=o.default,exports.PdfCitation=r.PdfEditorCitation,exports.CitationRenderer=n.default,exports.MarkdownRenderer=a.default,Object.defineProperty(exports,"DiagnosticSeverity",{enumerable:!0,get:function(){return s.DiagnosticSeverity}}),exports.PaginatedTable=u.default,exports.InternalgptReasoningComponent=C.default,exports.NonWebReasoningComponent=C.default,exports.ChatCitation=p.default,exports.CognitiveDecisioningCard=l.default,exports.PdfViewer=d.default,exports.FaqCitation=f.default,exports.ImageCitationContent=x.default,exports.VideoCitationContent=g.default,exports.FileCitationContent=m.default,exports.WebCitationWithImageContent=c.default,exports.MarkdownWithImageCitation=q.default,exports.AiReasoningCitation=j.default,exports.TableCitationContent=R.default,exports.CitationsViewer=S.default,exports.ExcelCitation=w.default,exports.ScannedDocCitation=I.default,exports.ChatDrawer=T.default,exports.FILE_INGESTION_STATUS=D.FILE_INGESTION_STATUS,exports.SUMMARY_EXPAND_HEIGHT_NUDGE=D.SUMMARY_EXPAND_HEIGHT_NUDGE,exports.TRUNCATE_THRESHOLD=D.TRUNCATE_THRESHOLD,exports.SplitterCitationsComponent=P.default,exports.SourcesBQCitation=b.SourcesBQCitation,exports.findSourceCitation=b.findSourceCitation,exports.parseSourcesBQHref=b.parseSourcesBQHref,exports.CognitiveCompare=E.default,exports.CognitiveInternalgptCoreComponent=V.default,exports.TextualGuideLinesComponent=A.default,exports.RuleBookCitationWrapper=W.default,exports.IngestionStatusChip=h.IngestionStatusChip,exports.IngestionStatusComponent=h.IngestionStatusComponent,exports.ManageReminders=k.ManageReminders,exports.PromptemonBlockViewer=v.default,exports.PromptemonViewer=B.default,exports.GptWebCitation=F.default,exports.useOnDemandCitationFetch=G.useOnDemandCitationFetch,exports.InstantLearningCitationWrapper=U.default,exports.BPACitationRenderer=_.default,exports.extractLearnedFromUrl=M.extractLearnedFromUrl,exports.extractRelevanceScoreFromContent=M.extractRelevanceScoreFromContent,exports.extractTopicFromContent=M.extractTopicFromContent,exports.getWebCitationImageUrl=M.getWebCitationImageUrl,exports.mapCitationDataToDisplay=M.mapCitationDataToDisplay,exports.resolveSkeletonVisitUrl=M.resolveSkeletonVisitUrl,exports.sanitizeExternalUrl=M.sanitizeExternalUrl,Object.defineProperty(exports,"CitationType",{enumerable:!0,get:function(){return L.CitationType}}),exports.allowsGptCitationView=L.allowsGptCitationView,exports.allowsWebCitationView=L.allowsWebCitationView,exports.showsCitationViewToggle=L.showsCitationViewToggle;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as t,jsx as n,Fragment as e}from"react/jsx-runtime";import{useState as o}from"react";import{ChevronDown as a,ChevronUp as l,Maximize2 as r,X as d,ExternalLink as c}from"lucide-react";import s from"@mui/material/Dialog";import u from"@mui/material/DialogTitle";import g from"@mui/material/DialogContent";import v from"@mui/material/IconButton";import h from"dayjs";import m from"../ScannedDocCitation/ScannedDocCitation.js";import C from"../InstantLearningCitation/InstantLearningCitationComponent.js";import p from"../InstantLearningCitation/SlashLoader.js";import f from"../CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js";import D from"../RequirementAiCitations/ImageCitation/ImageCitationContent.js";import T from"../RequirementAiCitations/WebCitation/WebCitationWithImageContent.js";import I from"../ChatCitation/ChatCitationRenderer.js";import b from"../DualCitation/RuleBookCitationComponent.js";import _ from"../CitationRenderer/CitationRenderer.js";import P from"../SplitterCitations/SplitterCitationsComponent.js";import{SourcesBQCitation as R}from"../DualCitation/SourceBQDataCompnent.js";import{CITATION_TYPES as S}from"./citationTypes.js";var A=function(i,t,n){if(!i)throw new Error("[BPACitationRenderer] ".concat(t,': missing required field "').concat(n,'" in customMetaData'))},L=function(i,t){if(!Object.values(i).some(Boolean))throw new Error("[BPACitationRenderer] ".concat(t,': missing one of "').concat(Object.keys(i).join('", "'),'" in customMetaData'))},w=function(a){var l=a.children,r=a.content,c=o(!1),h=c[0],m=c[1];return t(e,{children:[n("span",i({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",fontSize:"14px",fontWeight:400,color:"#526eff"},onClick:function(){return m(!0)}},{children:l})),t(s,i({open:h,onClose:function(){return m(!1)},maxWidth:"md",fullWidth:!0},{children:[t(u,i({style:{fontWeight:"bold"}},{children:["Guidelines",n(v,i({edge:"end",onClick:function(){return m(!1)},"aria-label":"close",style:{position:"absolute",top:5,right:16},size:"large"},{children:n(d,{})}))]})),n(g,i({style:{maxHeight:"70vh",overflow:"auto"}},{children:r}))]}))]})},x=function(e){var s,u,g,v,U,y,B,j,k,H,G,O,E,W,N,z,F,M,q,K,Q,J,V,X,Y,Z,$,ii=e.href,ti=e.children,ni=e.isStreaming,ei=e.onCitationToggle,oi=e.chatCitationConfig,ai=e.scannedDocCitationConfig,li=e.ruleBookCitationConfig,ri=e.ilCitationConfig,di=e.gptCitationConfig,ci=e.scannedDocCitationData,si=e.ilCitationData,ui=e.chatCitationData,gi=e.gptCitationData,vi=e.webCitationData,hi=e.imageCitationData,mi=e.bqCitationData,Ci=e.title,pi=e.citationIcon,fi=e.isDualCitationFlag,Di=void 0!==fi&&fi,Ti=o(!1),Ii=Ti[0],bi=Ti[1];if(ni)return t("span",i({style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontWeight:500,color:"#6D28D9"}},{children:[n("span",{children:ti}),n(p,{})]}));try{var _i=new URL(ii,"http://example.com"),Pi=null!==(s=_i.searchParams.get("citationNumber"))&&void 0!==s?s:_i.searchParams.get("citation_number"),Ri=null!==(u=_i.searchParams.get("decisionStrength"))&&void 0!==u?u:_i.searchParams.get("decision_strength"),Si=_i.searchParams.get("citation_type"),Ai=Di||Si===S.DUAL;if(!Pi)return null;if(Si===S.SCANNED_DOC){var Li=null==ci?void 0:ci.pages;if(null==Li?void 0:Li.length)return n(m,i({pages:Li,subHeadingText:null==ci?void 0:ci.artifactTitle},ai));A(null==ci?void 0:ci.gsUrl,"scanned_doc_citation","gs_url");var wi=[ci.gsUrl],xi=(null!==(g=null==ci?void 0:ci.highlightedCoordinates)&&void 0!==g?g:[]).map(function(i,t){return{pageIndex:t,bboxes:[i]}});return n(m,i({images:wi,highlights:xi},ai))}if(Si===S.IL){A(null==si?void 0:si.ilLearning,"IL","il_learning");var Ui=ti||(null==si?void 0:si.linkText)||(null==si?void 0:si.citationSource)||String(null!==(v=null==si?void 0:si.citationNumber)&&void 0!==v?v:1);return n(C,{ilLearning:si.ilLearning,ilLearningHighlights:null==si?void 0:si.ilLearningHighlights,comparisonHighlights:null==si?void 0:si.comparisonHighlights,decisionStrength:Ri||(null==si?void 0:si.decisionStrength)||"",linkTitle:Ui,onCitationToggle:null!=ei?ei:function(){},config:ri})}if(Si===S.CHAT){var yi=null!=oi?oi:{},Bi=null===(y=null!==(U=null==ui?void 0:ui.chatData)&&void 0!==U?U:[])||void 0===y?void 0:y.map(function(t){return i(i({},t),{timeStamp:h(t.timeStamp)})}),ji=!!(null==ui?void 0:ui.ruleBookContent);return n(I,{showRootContainer:null===(B=yi.showRootContainer)||void 0===B||B,reversePanels:yi.reversePanels,isRenderedCustomComponent:yi.isRenderedCustomComponent,modalContainerStyle:yi.modalContainerStyle,additionalData:yi.additionalData,closePreview:yi.closePreview,selectedIdFromReason:null!==(j=yi.selectedIdFromReason)&&void 0!==j?j:void 0,rootContainer:i(i({},yi.rootContainer),{relevanceScore:null==ui?void 0:ui.relevanceScore}),chatContainer:i(i({},yi.chatContainer),{chatData:Bi,summarizedTab:i(i({},null===(k=yi.chatContainer)||void 0===k?void 0:k.summarizedTab),{chip:i({isActive:!0,show:!0},null===(G=null===(H=yi.chatContainer)||void 0===H?void 0:H.summarizedTab)||void 0===G?void 0:G.chip)}),detailedTab:i(i({},null===(O=yi.chatContainer)||void 0===O?void 0:O.detailedTab),{chip:i({isActive:!1},null===(W=null===(E=yi.chatContainer)||void 0===E?void 0:E.detailedTab)||void 0===W?void 0:W.chip)})}),ruleBookContainer:ji?i(i({},yi.ruleBookContainer),{data:{content:ui.ruleBookContent,highlighted_texts:null!==(N=null==ui?void 0:ui.ruleBookHighlights)&&void 0!==N?N:[]}}):void 0})}if(Si===S.GPT){var ki=null==gi?void 0:gi.value,Hi=null!==(z=null==ki?void 0:ki.text)&&void 0!==z?z:null===(F=null==gi?void 0:gi.dataSources)||void 0===F?void 0:F[0],Gi=null!==(M=null==ki?void 0:ki.label)&&void 0!==M?M:null===(q=null==gi?void 0:gi.trainingDataTitle)||void 0===q?void 0:q[0],Oi=null!==(K=null==ki?void 0:ki.paraphrase)&&void 0!==K?K:null===(Q=null==gi?void 0:gi.paraphrase)||void 0===Q?void 0:Q[0];L({data_sources:Hi,training_data_title:Gi},S.GPT);var Ei={text:"",dataSource:Hi,trainingDataTitle:Gi,paraphrase:Oi},Wi=null!==(J=null==di?void 0:di.iconsConfig)&&void 0!==J?J:{ChevronDownIcon:a,ChevronUpIcon:l,MaximizeIcon:r,CloseIcon:d};return n(f,{item:Ei,headerTitle:null!==(V=null==di?void 0:di.headerTitle)&&void 0!==V?V:"GPT - Gemini 3.5 Flash",iconsConfig:Wi,previewCallback:null==di?void 0:di.previewCallback,DocumentTitle:null==di?void 0:di.DocumentTitle,disableMaximize:Ai})}if(Si===S.WEB){!function(i,t,n){A(i,t,n);try{new URL(i)}catch(e){throw new Error("[BPACitationRenderer] ".concat(t,': "').concat(n,'" is not a valid URL: "').concat(i,'"'))}}(null==vi?void 0:vi.link,S.WEB,"link");var Ni=vi.link,zi=ti||(null==vi?void 0:vi.citationSource)||Ni;return(null==vi?void 0:vi.screenshotUrl)?n(T,{url:Ni,label:zi,gsUtilPath:null==vi?void 0:vi.gsUtilPath,signedUrl:vi.screenshotUrl,relevanceScore:null==vi?void 0:vi.relevanceScore,visitIcon:c,PreviewDialogCloseIcon:d}):n("a",i({href:Ni,target:"_blank",rel:"noreferrer"},{children:zi}))}if(Si===S.IMAGE)return L({gs_util_path:null==hi?void 0:hi.gsUtilPath,signed_url:null==hi?void 0:hi.signedUrl},S.IMAGE),n(D,{citationTitle:ti||(null==hi?void 0:hi.citationSource),gsUtilPath:null==hi?void 0:hi.gsUtilPath,signedUrl:null==hi?void 0:hi.signedUrl,relevanceScore:null==hi?void 0:hi.relevanceScore});if(Si===S.BQ_DATA)return L({href_params:null==mi?void 0:mi.hrefParams,source_obj:null==mi?void 0:mi.sourceObj},S.BQ_DATA),n(R,i({hrefParams:mi.hrefParams,sourceObj:mi.sourceObj,showChevron:!1,defaultOpen:!0},{children:ti||""}));if(Si===S.RULEBOOK||Si===S.RULEBOOK_CHUNK){var Fi=Pi?parseInt(Pi,10):0,Mi=n(b,{url:null!==(X=null==li?void 0:li.url)&&void 0!==X?X:"",data:{citationNumber:null!==(Z=null===(Y=null==li?void 0:li.data)||void 0===Y?void 0:Y.citationNumber)&&void 0!==Z?Z:Fi,fileDetails:null===($=null==li?void 0:li.data)||void 0===$?void 0:$.fileDetails},msg:null==li?void 0:li.msg,citationIndex:null==li?void 0:li.citationIndex,guidelines:null==li?void 0:li.guidelines,additionalClassNames:null==li?void 0:li.additionalClassNames,headerTitle:null==li?void 0:li.headerTitle,InternalGptReasoningData:null==li?void 0:li.InternalGptReasoningData,isDataProvided:null==li?void 0:li.isDataProvided,textualContent:null==li?void 0:li.textualContent,phraseToHighlight:null==li?void 0:li.phraseToHighlight,IgptHeaderTitle:null==li?void 0:li.IgptHeaderTitle,isInternalGptReasoningLoading:null==li?void 0:li.isInternalGptReasoningLoading,onAccordionToggle:null==li?void 0:li.onAccordionToggle});return Di?Mi:n(w,i({content:Mi},{children:ti}))}if(Si===S.IL_RULEBOOK){var qi=n(b,{headerTitle:null==li?void 0:li.headerTitle,InternalGptReasoningData:null==li?void 0:li.InternalGptReasoningData,isDataProvided:null==li?void 0:li.isDataProvided,textualContent:null==li?void 0:li.textualContent,phraseToHighlight:null==li?void 0:li.phraseToHighlight,IgptHeaderTitle:null==li?void 0:li.IgptHeaderTitle,onAccordionToggle:null==li?void 0:li.onAccordionToggle,isInternalGptReasoningLoading:null==li?void 0:li.isInternalGptReasoningLoading});return Di?qi:n(w,i({content:qi},{children:ti}))}if(Si===S.DUAL){var Ki=_i.searchParams.get("left_citation_type"),Qi=_i.searchParams.get("right_citation_type");if(Ki===S.DUAL||Qi===S.DUAL)return console.error("left or right citation type cant be dual_citation"),null;var Ji=function(i,t){var n="".concat(i,"."),e="left"===i?"right.":"left.",o=new URLSearchParams;return _i.searchParams.forEach(function(i,t){"citation_type"!==t&&"left_citation_type"!==t&&"right_citation_type"!==t&&(t.startsWith(n)||t.startsWith(e)||o.set(t,i))}),_i.searchParams.forEach(function(i,t){t.startsWith(n)&&o.set(t.slice(n.length),i)}),t&&o.set("citation_type",t),"?".concat(o.toString())},Vi=Ji("left",Ki),Xi=Ji("right",Qi),Yi=ti||Ci||"Source and Guidelines",Zi=function(i){switch(i){case S.SCANNED_DOC:return{scannedDocCitationData:ci,scannedDocCitationConfig:ai};case S.IL:return{ilCitationData:si,ilCitationConfig:ri};case S.CHAT:return{chatCitationData:ui,chatCitationConfig:oi};case S.GPT:return{gptCitationData:gi,gptCitationConfig:di};case S.WEB:return{webCitationData:vi};case S.IMAGE:return{imageCitationData:hi};case S.BQ_DATA:return{bqCitationData:mi};case S.RULEBOOK:return{ruleBookCitationConfig:li};default:return{}}};return n(_,{inLineCitation:!0,citationTitle:Yi,citationIcon:pi,isOpen:Ii,onToggle:function(){return bi(function(i){return!i})},styles:{pillButton:{fontSize:"14px",margin:"0px",padding:"0px",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",background:"white",border:"none"},citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"}},citationComponent:n(P,{left:n(x,i({href:Vi,onCitationToggle:ei},Zi(Ki),{isDualCitationFlag:!0})),right:n(x,i({href:Xi,onCitationToggle:ei,isDualCitationFlag:!0},Zi(Qi))),header:{title:Yi,showDocIcon:!1},openInFullscreen:!0,fullscreenOnly:!0,onFullscreenClose:function(){return bi(!1)}})})}console.warn('[BPACitationRenderer] unhandled citation_type: "'.concat(Si,'"'))}catch(i){return console.error(i),null}return null};export{x as default};
|
|
2
|
+
//# sourceMappingURL=BPACitationRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BPACitationRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t={SCANNED_DOC:"scanned_doc_citation",IL:"IL",CHAT:"chat_citation",GPT:"gpt_citation",WEB:"web_citation",IMAGE:"image_citation",BQ_DATA:"bq_data",RULEBOOK:"rulebook_citation",IL_RULEBOOK:"il_rulebook_citation",DUAL:"dual_citation"};export{t as CITATION_TYPES};
|
|
1
|
+
var t={SCANNED_DOC:"scanned_doc_citation",IL:"IL",CHAT:"chat_citation",GPT:"gpt_citation",WEB:"web_citation",IMAGE:"image_citation",BQ_DATA:"bq_data",RULEBOOK:"rulebook_citation",RULEBOOK_CHUNK:"rulebook_chunk",IL_RULEBOOK:"il_rulebook_citation",DUAL:"dual_citation"};export{t as CITATION_TYPES};
|
|
2
2
|
//# sourceMappingURL=citationTypes.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i,__awaiter as e,__generator as l}from"tslib";import{jsxs as n,jsx as
|
|
1
|
+
import{__assign as i,__awaiter as e,__generator as l}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r}from"react";import{Loader2 as a}from"lucide-react";import d from"../TextualGuidelines/TextualGuideLinesComponent.js";import{getNestedValue as u,isJSONFile as s,getFileContent as c,getSignedUrl as v}from"./RuleBookCitationApiComponent.js";var f=function(f){var g,p,h,m,x,b,y=f.data,_=f.msg,C=f.citationIndex,D=f.guidelines,k=void 0===D?[]:D,T=f.url,I=f.additionalClassNames,R=f.headerTitle,w=void 0===R?"Rule Book Citation":R,A=f.InternalGptReasoningData,G=void 0===A?[]:A,H=f.IgptHeaderTitle,L=f.isDataProvided,j=void 0!==L&&L,B=f.textualContent,N=f.phraseToHighlight,S=f.onAccordionToggle,E=f.isInternalGptReasoningLoading,U=void 0!==E&&E,O=Math.max((null!==(p=null!==(g=null==y?void 0:y.citationNumber)&&void 0!==g?g:C)&&void 0!==p?p:1)-1,0),q=(null==_?void 0:_.requestId)||(null==_?void 0:_.id)||"",z=o(null),F=z[0],J=z[1],M=o(null),P=M[0],V=M[1],W=o(null),K=W[0],Q=W[1],X=o(!1),Y=X[0],Z=X[1],$=o(null),ii=$[0],ei=$[1];r(function(){var i,e,l,n;if(!j&&!F){if(null===(i=null==y?void 0:y.fileDetails)||void 0===i?void 0:i.file_id)return ei(null),J(y.fileDetails.file_id),void V(y.fileDetails.phrase_to_highlight||null);var t=(null!==(n=null===(l=null===(e=null==_?void 0:_.artifactSearchData)||void 0===e?void 0:e.ruleBookData)||void 0===l?void 0:l.rulebook_citations)&&void 0!==n?n:[])[O];if(!t)return ei("Citation not found at the specified index."),J(null),void V(null);if(!t.file_id)return ei("Citation data is missing file_id."),J(null),void V(null);Q(null),ei(null),J(t.file_id),V(t.phrase_to_highlight||null)}},[j,q,O,F,null===(h=null==y?void 0:y.fileDetails)||void 0===h?void 0:h.file_id,null===(m=null==y?void 0:y.fileDetails)||void 0===m?void 0:m.phrase_to_highlight,null===(b=null===(x=null==_?void 0:_.artifactSearchData)||void 0===x?void 0:x.ruleBookData)||void 0===b?void 0:b.rulebook_citations]),r(function(){if(!j)if(F){var i=Array.isArray(k)?k:Object.values(k||{}).flat();e(void 0,void 0,void 0,function(){var e,n,t,o,r,a,d,f;return l(this,function(l){switch(l.label){case 0:if(!(null==(e=i.find(function(i){return i.id===F}))?void 0:e.gcsUrl))return ei("File URL not found."),[2];l.label=1;case 1:return l.trys.push([1,4,5,6]),Z(!0),ei(null),[4,v(e.gcsUrl,null!=T?T:"")];case 2:if(null==(n=l.sent())?void 0:n.error)throw new Error(n.error);return t=(null===(f=e.name)||void 0===f?void 0:f.toLowerCase().split(".").pop())||"",s(t)?[4,c(e.gcsUrl,null!=T?T:"")]:[2];case 3:if(!(null==(o=l.sent())?void 0:o.trim()))throw new Error("Empty file content returned from the backend.");return r=JSON.parse(o),a=u(r,"data.artifactData.userStorySnapshot[0].value"),Q(a||""),[3,6];case 4:return d=l.sent(),console.error(d),ei(d.message||"An error occurred while loading file contents."),Q(null),[3,6];case 5:return Z(!1),[7];case 6:return[2]}})})}else Q(null)},[j,F,k,T]);var li=!j&&Y,ni=j?N||null:P,ti=j?B||"":(null==K?void 0:K.replace(/\\\./g,"."))||"",oi=j?!!B:!!K;return n("div",i({className:null==I?void 0:I.container,style:{width:"100%",minHeight:"100px",backgroundColor:"transparent"}},{children:[li&&n("div",i({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[t(a,{style:{animation:"spin 1s linear infinite"},size:24}),t("span",{children:"Loading content..."})]})),ii&&!li&&n("div",i({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[t("strong",{children:"Error:"})," ",ii]})),!li&&!ii&&oi&&t("div",i({style:{marginTop:"12px"}},{children:t(d,{TextualGuideLines:ti,HighlightedWords:ni?[ni]:[],InternalGptReasoningData:G,index:0,headerTitle:w,useVariantHighlight:!1,IgptHeaderTitle:H,onAccordionToggle:S,isInternalGptReasoningLoading:U})})),!li&&!ii&&!oi&&t("div",i({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available."})),t("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};export{f as default};
|
|
2
2
|
//# sourceMappingURL=RuleBookCitationComponent.js.map
|