@e-llm-studio/citation 0.0.127 → 0.0.129
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 +116 -0
- package/dist/cjs/features/Bookemon/BookDetailsCard/BookDetailsCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookElementsCard/BookElementsCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.js +1 -1
- package/dist/cjs/features/ChatCitation/ChatCitationRenderer.js +1 -1
- package/dist/cjs/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/cjs/features/ChatCitation/components/AssistantChatItem.js +1 -1
- package/dist/cjs/features/ChatCitation/components/ChatCitation.js +1 -1
- package/dist/cjs/features/ChatCitation/components/SummarizedView.js +1 -1
- package/dist/cjs/features/ChatCitation/components/UserChatItem.js +1 -1
- package/dist/cjs/features/ChatCitation/utils/helpers.js +1 -1
- package/dist/features/Bookemon/BookDetailsCard/BookDetailsCard.js +1 -1
- package/dist/features/Bookemon/BookElementsCard/BookElementsCard.js +1 -1
- package/dist/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.js +1 -1
- package/dist/features/ChatCitation/ChatCitationRenderer.js +1 -1
- package/dist/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/features/ChatCitation/components/AssistantChatItem.js +1 -1
- package/dist/features/ChatCitation/components/ChatCitation.js +1 -1
- package/dist/features/ChatCitation/components/SummarizedView.js +1 -1
- package/dist/features/ChatCitation/components/UserChatItem.js +1 -1
- package/dist/features/ChatCitation/utils/helpers.js +1 -1
- package/dist/types/src/features/Bookemon/BookDetailsCard/BookDetailsCard.d.ts +1 -0
- package/dist/types/src/features/Bookemon/BookDetailsCard/BookDetailsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookElementsCard/BookElementsCard.d.ts +1 -0
- package/dist/types/src/features/Bookemon/BookElementsCard/BookElementsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookOverviewCard/BookOverviewCard.d.ts +1 -0
- package/dist/types/src/features/Bookemon/BookOverviewCard/BookOverviewCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.d.ts +1 -0
- package/dist/types/src/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/ChatCitationRenderer.d.ts +7 -2
- package/dist/types/src/features/ChatCitation/ChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/InternalChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/components/AssistantChatItem.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/components/ChatCitation.d.ts +2 -1
- package/dist/types/src/features/ChatCitation/components/ChatCitation.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/components/SummarizedView.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/components/UserChatItem.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/types/citations.types.d.ts +3 -1
- package/dist/types/src/features/ChatCitation/types/citations.types.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/utils/helpers.d.ts.map +1 -1
- package/dist/types/src/features/ReviewPanel/ReviewPanel.d.ts +52 -0
- package/dist/types/src/features/ReviewPanel/ReviewPanel.d.ts.map +1 -0
- package/dist/types/src/features/ReviewPanel/ReviewPanelTest/ReviewPanelTest.d.ts +4 -0
- package/dist/types/src/features/ReviewPanel/ReviewPanelTest/ReviewPanelTest.d.ts.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
- [PdfViewer](#pdfviewer) [<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/PdfViewer/PdfViewerReadme.md)
|
|
25
25
|
- [ProjectAccordion](#projectaccordion) [<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/ProjectAccordion/README.md)
|
|
26
26
|
- [UploadData](#uploaddata) [<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/UploadData/README.md)
|
|
27
|
+
- [ReviewPanel](#reviewpanel) [<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/ReviewPanel/README.md)
|
|
28
|
+
- [TableCitationContent](#tablecitationcontent) [<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/TableCitation/README.md)
|
|
27
29
|
4. [Common Use Cases](#common-use-cases)
|
|
28
30
|
5. [Development & Contribution](#development--contribution)
|
|
29
31
|
6. [License](#license)
|
|
@@ -1233,6 +1235,120 @@ const MyComponent = () => {
|
|
|
1233
1235
|
|
|
1234
1236
|
---
|
|
1235
1237
|
|
|
1238
|
+
## ReviewPanel
|
|
1239
|
+
|
|
1240
|
+
### Overview
|
|
1241
|
+
|
|
1242
|
+
ReviewPanel is a flexible and accessible component for displaying and managing a list of items with review status tracking. It allows users to navigate through items, track completion status, and customize rendering and styling. The component supports both controlled and uncontrolled modes, making it suitable for various use cases from simple item lists to complex review workflows.
|
|
1243
|
+
|
|
1244
|
+
### Features
|
|
1245
|
+
|
|
1246
|
+
- **Flexible item rendering** - Custom `renderItem` prop for complete control over item appearance
|
|
1247
|
+
- **Expand/collapse functionality** - Collapsible item list with smooth animations
|
|
1248
|
+
- **Navigation and status tracking** - Previous/next buttons and visual status indicators
|
|
1249
|
+
- **Controlled and uncontrolled modes** - Flexible state management options
|
|
1250
|
+
- **Customizable theming** - Light and dark modes using CSS variables
|
|
1251
|
+
- **Accessibility support** - Full keyboard navigation and ARIA attributes
|
|
1252
|
+
|
|
1253
|
+
### Usage
|
|
1254
|
+
|
|
1255
|
+
```tsx
|
|
1256
|
+
import { ReviewPanel } from '@e-llm-studio/citation/ReviewPanel'
|
|
1257
|
+
|
|
1258
|
+
const items = [
|
|
1259
|
+
{ id: '1', label: 'Item 1' },
|
|
1260
|
+
{ id: '2', label: 'Item 2' },
|
|
1261
|
+
{ id: '3', label: 'Item 3' },
|
|
1262
|
+
];
|
|
1263
|
+
|
|
1264
|
+
function App() {
|
|
1265
|
+
return (
|
|
1266
|
+
<ReviewPanel
|
|
1267
|
+
data={items}
|
|
1268
|
+
itemConfig={{
|
|
1269
|
+
textKey: 'label',
|
|
1270
|
+
showStatusIcon: true,
|
|
1271
|
+
}}
|
|
1272
|
+
theme="dark"
|
|
1273
|
+
/>
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
### Props
|
|
1279
|
+
|
|
1280
|
+
| Prop Name | Type | Default | Description |
|
|
1281
|
+
|-----------|------|---------|-------------|
|
|
1282
|
+
| `data` | `T[]` | Required | Array of items to display in the review panel |
|
|
1283
|
+
| `renderItem` | `(params) => ReactNode` | `undefined` | Custom render function for items. If not provided, uses default rendering |
|
|
1284
|
+
| `itemConfig` | `DefaultItemConfig<T>` | `{}` | Configuration for default item rendering including textKey, showStatusIcon, and showRightBadge |
|
|
1285
|
+
| `activeIndex` | `number` | `undefined` | Current active item index (controlled mode). When undefined, component manages state internally |
|
|
1286
|
+
| `onActiveChange` | `(index: number) => void` | `undefined` | Callback fired when active index changes |
|
|
1287
|
+
| `expanded` | `boolean` | `undefined` | Whether the item list is expanded (controlled mode). When undefined, component manages state internally |
|
|
1288
|
+
| `onExpandedChange` | `(expanded: boolean) => void` | `undefined` | Callback fired when expanded state changes |
|
|
1289
|
+
| `headerLeftSlot` | `ReactNode` | `undefined` | Custom content to display on the left side of the header |
|
|
1290
|
+
| `headerRightSlot` | `(params) => ReactNode` | `undefined` | Custom content to display on the right side of the header |
|
|
1291
|
+
| `footerSlot` | `ReactNode` | `undefined` | Custom content to display in the footer section |
|
|
1292
|
+
| `getItemStatus` | `(item: T, index: number) => ReviewStatus` | `undefined` | Function to determine the review status of each item |
|
|
1293
|
+
| `theme` | `'light' \| 'dark'` | `'dark'` | Color theme for the component |
|
|
1294
|
+
| `classes` | `ReviewPanelClasses` | `undefined` | Custom CSS class names for component sections |
|
|
1295
|
+
| `keyExtractor` | `(item: T, index: number) => string` | `(_, i) => i.toString()` | Function to extract unique key for each item |
|
|
1296
|
+
| `className` | `string` | `undefined` | Custom CSS class for the root container |
|
|
1297
|
+
|
|
1298
|
+
---
|
|
1299
|
+
|
|
1300
|
+
## TableCitationContent
|
|
1301
|
+
|
|
1302
|
+
### Overview
|
|
1303
|
+
|
|
1304
|
+
TableCitationContent is a component for rendering tabular data citations with flexible styling and formatting. It automatically discovers columns from data, handles smart formatting for numbers and booleans, and provides built-in support for highlighting specific rows and columns. The component is designed to display structured data in a clean, organized table format with responsive scrolling and sticky headers, making it ideal for presenting data citations, validation results, and metrics in applications.
|
|
1305
|
+
|
|
1306
|
+
### Features
|
|
1307
|
+
|
|
1308
|
+
- **Automatic column discovery** - Dynamically generates headers from the keys provided in the data rows
|
|
1309
|
+
- **Smart data formatting** - Automatically formats numbers to fixed decimals and booleans to visual icons (✓/✕)
|
|
1310
|
+
- **Theming via CSS Variables** - Easily customize appearance using CSS custom properties without modifying source code
|
|
1311
|
+
- **Highlighting for rows and columns** - Built-in support for highlighting specific rows or columns for emphasis
|
|
1312
|
+
- **Sticky headers and responsive scrolling** - Keeps table headers visible while scrolling through large datasets with horizontal and vertical scroll support
|
|
1313
|
+
- **Data validation UI** - Built-in support for highlighting "failed" cells using the `markFailed` property
|
|
1314
|
+
|
|
1315
|
+
### Usage
|
|
1316
|
+
|
|
1317
|
+
```tsx
|
|
1318
|
+
import TableCitationContent from '@e-llm-studio/citation/TableCitationContent';
|
|
1319
|
+
|
|
1320
|
+
const tableData = [
|
|
1321
|
+
{ id: 1, name: "Project Alpha", status: true },
|
|
1322
|
+
{ id: 2, name: "Project Beta", status: false },
|
|
1323
|
+
];
|
|
1324
|
+
|
|
1325
|
+
function App() {
|
|
1326
|
+
return (
|
|
1327
|
+
<TableCitationContent
|
|
1328
|
+
title="Deployment Status"
|
|
1329
|
+
timestamp="Feb 04, 2026"
|
|
1330
|
+
rows={tableData}
|
|
1331
|
+
onClose={() => console.log('Closed')}
|
|
1332
|
+
/>
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
```
|
|
1336
|
+
|
|
1337
|
+
### Props
|
|
1338
|
+
|
|
1339
|
+
| Prop Name | Type | Description |
|
|
1340
|
+
|-----------|------|-------------|
|
|
1341
|
+
| `rows` | `Record<string, any>[]` | Array of objects representing the table data. Required prop. |
|
|
1342
|
+
| `title` | `string` | The main title displayed in the header. |
|
|
1343
|
+
| `timestamp` | `string` | Sub-header text for dates or versions. |
|
|
1344
|
+
| `highlightColumns` | `string[]` | List of column keys to apply a highlight background. |
|
|
1345
|
+
| `highlightRowIndex` | `number` | Zero-based index of a specific row to highlight. |
|
|
1346
|
+
| `onClose` | `() => void` | Callback function triggered when the close button is clicked. |
|
|
1347
|
+
| `CloseIcon` | `React.ElementType` | Custom React component to use as the close icon. |
|
|
1348
|
+
| `className` | `string` | Custom CSS class to apply to the root container. |
|
|
1349
|
+
|
|
1350
|
+
---
|
|
1351
|
+
|
|
1236
1352
|
## Common Use Cases
|
|
1237
1353
|
|
|
1238
1354
|
### RAG (Retrieval Augmented Generation) Applications
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("../utils/highlight.js"),s=require("../../../utils/sanitizeHtml.js"),r={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}};exports.default=function(l){var o,a,g,d,c,u,h,p,x,_,m,b,v,y=l.data,f=l.highlightTerms,j=l.onHighlightMatch,T=i.useState(!1),C=T[0],w=T[1],N=i.useState(!1),S=N[0],k=N[1],H=i.useMemo(function(){return C?y.subjectCategories||[]:(y.subjectCategories||[]).slice(0,10)},[C,y.subjectCategories]);return i.useEffect(function(){var t,i;if(f&&0!==f.length){var n=e.__spreadArray(e.__spreadArray([y.isbn,y.isbn10,y.imprint,y.publisher,y.publishingDate,y.age],null!==(t=y.subjectCategories)&&void 0!==t?t:[],!0),null!==(i=y.reviews)&&void 0!==i?i:[],!0).some(function(e){if(!e)return!1;var t=String(e).toLowerCase();return f.some(function(e){return t.includes(e.toLowerCase())})});null==j||j(n)}},[f,y]),t.jsxs("div",e.__assign({style:r.container,className:"book-details-container"},{children:[t.jsx("p",e.__assign({style:r.sectionTitle,className:"book-details-section-title"},{children:"Product Details"})),t.jsxs("div",e.__assign({style:r.detailsContainer,className:"book-details-details-container"},{children:[t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"ISBN:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(o=y.isbn)&&void 0!==o?o:"NA",f))}}):null!==(a=y.isbn)&&void 0!==a?a:"NA"]})),t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"ISBN 10:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(g=y.isbn10)&&void 0!==g?g:"NA",f))}}):null!==(d=y.isbn10)&&void 0!==d?d:"NA"]})),t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"Imprint:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(c=y.imprint)&&void 0!==c?c:"NA",f))}}):null!==(u=y.imprint)&&void 0!==u?u:"NA"]})),t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"Publisher:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(h=y.publisher)&&void 0!==h?h:"NA",f))}}):null!==(p=y.publisher)&&void 0!==p?p:"NA"]})),t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"Publishing Date:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(x=y.publishingDate)&&void 0!==x?x:"NA",f))}}):null!==(_=y.publishingDate)&&void 0!==_?_:"NA"]})),t.jsxs("p",e.__assign({style:r.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:r.boldText},{children:"Age:"}))," ",f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(m=y.age)&&void 0!==m?m:"NA",f))}}):null!==(b=y.age)&&void 0!==b?b:"NA"]}))]})),t.jsxs("div",e.__assign({style:r.categoriesContainer},{children:[t.jsx("p",e.__assign({style:r.sectionTitle,className:"book-details-section-title"},{children:"Subject Categories"})),t.jsxs("div",e.__assign({style:r.categoriesList,className:"book-details-categories-list"},{children:[H.map(function(i,l){return t.jsx("span",e.__assign({style:r.category,className:"book-details-category"},{children:f&&f.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(i,f))}}):i}),l)}),y.subjectCategories&&y.subjectCategories.length>10&&t.jsx("button",e.__assign({style:r.button,onClick:function(){return w(!C)},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:C?"View less":"View more"}))]}))]})),t.jsxs("div",e.__assign({style:r.reviewsContainer},{children:[t.jsx("p",e.__assign({style:r.sectionTitle,className:"book-details-section-title"},{children:"Book Marketing Collateral"})),t.jsxs("div",e.__assign({style:r.reviewsList,className:"book-details-reviews-list"},{children:[y.reviews&&y.reviews.length>0?(v=y.reviews.filter(function(e){return e.replace(/<[^>]+>/g,"").trim().replace(/&[#A-Za-z0-9]+;/g,"").trim().length>0}),(S?v:v.slice(0,3)).map(function(i,l){return t.jsx("div",e.__assign({style:r.reviewCard,className:"book-details-review-card"},{children:t.jsx("div",{style:r.reviewText,dangerouslySetInnerHTML:{__html:f&&f.length>0?s.sanitizeHtml(n.highlightTermsFunc(i,f)):i}})}),l)})):t.jsx("p",e.__assign({style:r.reviewText},{children:"No Book Marketing Collateral available for this book."})),y.reviews&&y.reviews.length>3&&t.jsx("button",e.__assign({style:r.button,onClick:function(){return k(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:S?"View less":"View more"}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookDetailsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material/Pagination"),a=require("@mui/material/Skeleton"),s=require("react"),i=require("react-markdown"),r=require("../utils/highlight.js"),o=require("../../../utils/sanitizeHtml.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=l(n),d=l(a),c=l(i),g={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},quotesPadding:{paddingLeft:"12px"},quoteCard:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"16px",backgroundColor:"#F8FAFC",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",marginBottom:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},quoteText:{fontStyle:"italic",color:"#475569",fontSize:"14px",fontWeight:400,marginBottom:"12px"},quoteMeta:{color:"#475569",fontSize:"12px",fontWeight:400},quoteAuthor:{fontSize:"10px",fontWeight:600,color:"#475569",marginTop:"8px",marginBottom:"18px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},geoLocationsContainer:{marginTop:"24px",marginBottom:"24px"},geoText:{fontSize:"14px",fontWeight:500,cursor:"pointer",color:"#532BED"},geoDivider:{margin:"0 8px",color:"#475abb",backgroundColor:"#475abb",width:"1px",height:"18px",display:"inline-block"},geoLocationFlex:{display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"8px"},charactersContainer:{marginTop:"16px"},charactersGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px",marginBottom:"16px",paddingLeft:"12px"},characterCard:{border:"1px solid #E5E7EB",borderRadius:"8px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",display:"flex",alignItems:"flex-start",gap:"12px",padding:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},avatar:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"9999px",fontSize:"14px",fontWeight:600,flexShrink:0},charName:{fontStyle:"normal",fontWeight:600,color:"#101827",fontSize:"16px"},charDesc:{fontStyle:"normal",fontWeight:400,fontSize:"14px",color:"#6B7280"},retryButton:{backgroundColor:"#5928EC",color:"#fff",padding:"6px 10px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:"500"}};exports.default=function(n){n.data;var a=n.updateQuotesToHighLight,i=n.handleFetchManuscriptElements,l=n.BookIsbn,x=n.title,p=n.highlightTerms,h=n.onHighlightMatch,f=s.useRef(!0);s.useEffect(function(){return function(){f.current=!1}},[]);var _=s.useState([]),y=_[0],v=_[1],m=s.useState(1),b=m[0],j=m[1],S=s.useState(!1),T=S[0],C=S[1],w=s.useState(!0),k=w[0],L=w[1],q=s.useState(0),B=q[0],M=q[1],D=s.useState([]),F=D[0],E=D[1],H=s.useState(1),z=H[0],I=H[1],P=s.useState(!1),W=P[0],R=P[1],N=s.useState(!0),A=N[0],G=N[1],K=s.useState(0),Y=K[0],O=K[1],Q=s.useState([]),J=Q[0],U=Q[1],V=s.useState(1),X=V[0],Z=V[1],$=s.useState(!1),ee=$[0],te=$[1],ne=s.useState(!0),ae=ne[0],se=ne[1],ie=s.useState(0),re=ie[0],oe=ie[1],le=s.useState({list:"",index:-1,page:1}),ue=le[0],de=le[1],ce=s.useRef(!1);s.useEffect(function(){var t,n,a;p&&0!==p.length&&(ce.current||e.__spreadArray(e.__spreadArray(e.__spreadArray([],null!==(t=null==y?void 0:y.map(function(e){return e.text}))&&void 0!==t?t:[],!0),null!==(n=null==J?void 0:J.map(function(e){return e.name}))&&void 0!==n?n:[],!0),null!==(a=null==F?void 0:F.flatMap(function(e){return[e.name,e.description]}))&&void 0!==a?a:[],!0).some(function(e){return!!e&&p.some(function(t){return e.toLowerCase().includes(t.toLowerCase())})})&&(null==h||h(!0),ce.current=!0))},[p]),s.useEffect(function(){ce.current=!1},[p]);var ge=function(t){var n=t.endpoint,a=t.page,s=t.isbn,r=t.setData,o=t.setLoading,l=t.setHasMore,u=t.setTotalPage,d=t.title;return e.__awaiter(void 0,void 0,void 0,function(){var t,c,g,x;return e.__generator(this,function(e){switch(e.label){case 0:o(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,i({endpoint:n,page:a,pageSize:10,isbn:s,title:d})];case 2:return t=e.sent(),f.current?(r((null==t?void 0:t.data)||[]),u((null===(c=null==t?void 0:t.pagination)||void 0===c?void 0:c.totalPages)||0),l(!(null===(g=null==t?void 0:t.pagination)||void 0===g?void 0:g.hasNext)&&!(null===(x=null==t?void 0:t.pagination)||void 0===x?void 0:x.hasPrevious)),[3,4]):[2];case 3:return f.current&&o(!1),[7];case 4:return[2]}})})};return s.useEffect(function(){ge({endpoint:"notable-quotes",page:b,isbn:l,setData:v,setLoading:C,setHasMore:L,setTotalPage:M,title:x})},[b]),s.useEffect(function(){ge({endpoint:"notable-characters",page:z,isbn:l,setData:E,setLoading:R,setHasMore:G,setTotalPage:O,title:x})},[z]),s.useEffect(function(){ge({endpoint:"geo-locations",page:X,isbn:l,setData:U,setLoading:te,setHasMore:se,setTotalPage:oe,title:x})},[X]),t.jsxs("div",{children:[t.jsxs("div",e.__assign({style:{marginBottom:"24px"}},{children:[t.jsx("p",e.__assign({style:g.sectionTitle},{children:"Notable Quotes"})),t.jsxs("div",e.__assign({style:g.quotesPadding},{children:[T?t.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",rowGap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({style:g.quoteCard},{children:[t.jsx(d.default,{variant:"text",width:"60%",height:28}),t.jsx(d.default,{variant:"text",width:"40%",height:20}),t.jsx(d.default,{variant:"text",width:"25%",height:20}),t.jsx(d.default,{variant:"text",width:"30%",height:20})]}),n)})})):0===y.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic"}},{children:["No notable quotes found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"notable-quotes",page:b,isbn:l,setData:v,setLoading:C,setHasMore:L,setTotalPage:M,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:y.map(function(n,s){var i="notable"===ue.list&&ue.page===b&&ue.index===s;return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.quoteCard),{borderColor:i?"rgb(83, 43, 237)":"#CBD5E1"}),onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),de({list:"notable",page:b,index:s}),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,a(n.text,"Notable Quotes",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight quote:",t),[3,4];case 4:return[2]}})})}},{children:[p&&p.length>0?t.jsx("p",{style:g.quoteText,dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.text,p))}}):t.jsx("p",e.__assign({style:g.quoteText},{children:null==n?void 0:n.text})),t.jsxs("p",e.__assign({style:g.quoteMeta},{children:[n.chapter," ",t.jsx("br",{})," ",n.page]})),t.jsxs("p",e.__assign({style:g.quoteAuthor},{children:["— ",null==n?void 0:n.author]}))]}),s)})}),t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!k&&t.jsx(u.default,{disabled:T,count:B,page:b,onChange:function(e,t){return j(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:g.geoLocationsContainer},{children:[t.jsx("p",e.__assign({style:g.sectionTitle},{children:"Key Geo Locations"})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.quotesPadding),{marginBottom:"8px"})},{children:[ee?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(e){return t.jsx(d.default,{variant:"rectangular",width:100,height:20,style:{borderRadius:"8px"}},e)})})):0===J.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key geo locations found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"geo-locations",page:X,isbn:l,setData:U,setLoading:te,setHasMore:se,setTotalPage:oe,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:J.map(function(n,s){var i="geo_location"===ue.list&&ue.page===X&&ue.index===s;return t.jsxs("span",e.__assign({style:g.geoLocationFlex},{children:[t.jsx("span",e.__assign({style:e.__assign(e.__assign({},g.geoText),{fontWeight:i?"700":"",textDecoration:i?"underline":""}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),de({list:"geo_location",page:X,index:s}),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,a(n.name,"Key Geo Locations",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight location:",t),[3,4];case 4:return[2]}})})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.name,p))}}):null==n?void 0:n.name})),s<J.length-1&&t.jsx("span",{style:g.geoDivider})]}),s)})}),t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!ae&&t.jsx(u.default,{disabled:ee,count:re,page:X,onChange:function(e,t){return Z(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:g.charactersContainer},{children:[t.jsx("p",e.__assign({style:g.sectionTitle},{children:"Key Characters"})),W?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.characterCard),{flexBasis:"40%"})},{children:[t.jsx(d.default,{variant:"circular",style:e.__assign(e.__assign({},g.avatar),{flexShrink:0})}),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsx(d.default,{variant:"text",style:{flex:"1",flexShrink:0}}),t.jsx(d.default,{variant:"text",style:{flex:"1"}}),t.jsx(d.default,{variant:"text",style:{flex:"1"}}),t.jsx(d.default,{variant:"text",style:{flex:"1"}})]}))]}),n)})})):0===F.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key characters found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"notable-characters",page:z,isbn:l,setData:E,setLoading:R,setHasMore:G,setTotalPage:O,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:t.jsx("div",e.__assign({style:g.charactersGrid},{children:F.map(function(n,s){var i=e.__assign(e.__assign({},g.avatar),{backgroundColor:n.bg,color:n.color}),l="key_character"===ue.list&&ue.page===z&&ue.index===s;return t.jsxs("div",e.__assign({onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},style:e.__assign(e.__assign({},g.characterCard),{borderColor:l?"rgb(83, 43, 237)":"#E5E7EB"}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:de({list:"key_character",page:z,index:s}),e.label=1;case 1:return e.trys.push([1,4,,5]),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,a(n.name,"Key Characters",n.chunkIds,0)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[3,5];case 4:return t=e.sent(),console.error("Failed to highlight character:",t),[3,5];case 5:return[2]}})})}},{children:[t.jsx("div",e.__assign({style:i},{children:n.initials})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column"}},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.charName),{margin:0})},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(n.name,p))}}):n.name})),t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.charDesc),{margin:0,marginTop:"4px"})},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.description,p))}}):t.jsx(c.default,e.__assign({components:{p:function(n){n.node;var a=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},a))}}},{children:null==n?void 0:n.description}))}))]}))]}),s)})}))}),t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!A&&t.jsx(u.default,{count:Y,disabled:W,page:z,onChange:function(e,t){return I(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material/Pagination"),s=require("@mui/material/Skeleton"),a=require("react"),i=require("react-markdown"),r=require("../utils/highlight.js"),o=require("../../../utils/sanitizeHtml.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=l(n),u=l(s),d=l(i),g={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},quotesPadding:{paddingLeft:"12px"},quoteCard:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"16px",backgroundColor:"#F8FAFC",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",marginBottom:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},quoteText:{fontStyle:"italic",color:"#475569",fontSize:"14px",fontWeight:400,marginBottom:"12px"},quoteMeta:{color:"#475569",fontSize:"12px",fontWeight:400},quoteAuthor:{fontSize:"10px",fontWeight:600,color:"#475569",marginTop:"8px",marginBottom:"18px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},geoLocationsContainer:{marginTop:"24px",marginBottom:"24px"},geoText:{fontSize:"14px",fontWeight:500,cursor:"pointer",color:"#532BED"},geoDivider:{margin:"0 8px",color:"#475abb",backgroundColor:"#475abb",width:"1px",height:"18px",display:"inline-block"},geoLocationFlex:{display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"8px"},charactersContainer:{marginTop:"16px"},charactersGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px",marginBottom:"16px",paddingLeft:"12px"},characterCard:{border:"1px solid #E5E7EB",borderRadius:"8px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",display:"flex",alignItems:"flex-start",gap:"12px",padding:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},avatar:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"9999px",fontSize:"14px",fontWeight:600,flexShrink:0},charName:{fontStyle:"normal",fontWeight:600,color:"#101827",fontSize:"16px"},charDesc:{fontStyle:"normal",fontWeight:400,fontSize:"14px",color:"#6B7280"},retryButton:{backgroundColor:"#5928EC",color:"#fff",padding:"6px 10px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:"500"}};exports.default=function(n){n.data;var s=n.updateQuotesToHighLight,i=n.handleFetchManuscriptElements,l=n.BookIsbn,x=n.title,p=n.highlightTerms,h=n.onHighlightMatch,f=a.useRef(!0);a.useEffect(function(){return function(){f.current=!1}},[]);var _=a.useState([]),m=_[0],y=_[1],v=a.useState(1),b=v[0],j=v[1],k=a.useState(!1),S=k[0],T=k[1],C=a.useState(!0),w=C[0],q=C[1],L=a.useState(0),N=L[0],B=L[1],M=a.useState([]),D=M[0],F=M[1],E=a.useState(1),H=E[0],z=E[1],I=a.useState(!1),P=I[0],W=I[1],R=a.useState(!0),A=R[0],G=R[1],K=a.useState(0),Y=K[0],O=K[1],Q=a.useState([]),J=Q[0],U=Q[1],V=a.useState(1),X=V[0],Z=V[1],$=a.useState(!1),ee=$[0],te=$[1],ne=a.useState(!0),se=ne[0],ae=ne[1],ie=a.useState(0),re=ie[0],oe=ie[1],le=a.useState({list:"",index:-1,page:1}),ce=le[0],ue=le[1],de=a.useRef(!1);a.useEffect(function(){var t,n,s;p&&0!==p.length&&(de.current||e.__spreadArray(e.__spreadArray(e.__spreadArray([],null!==(t=null==m?void 0:m.map(function(e){return e.text}))&&void 0!==t?t:[],!0),null!==(n=null==J?void 0:J.map(function(e){return e.name}))&&void 0!==n?n:[],!0),null!==(s=null==D?void 0:D.flatMap(function(e){return[e.name,e.description]}))&&void 0!==s?s:[],!0).some(function(e){return!!e&&p.some(function(t){return e.toLowerCase().includes(t.toLowerCase())})})&&(null==h||h(!0),de.current=!0))},[p]),a.useEffect(function(){de.current=!1},[p]);var ge=function(t){var n=t.endpoint,s=t.page,a=t.isbn,r=t.setData,o=t.setLoading,l=t.setHasMore,c=t.setTotalPage,u=t.title;return e.__awaiter(void 0,void 0,void 0,function(){var t,d,g,x;return e.__generator(this,function(e){switch(e.label){case 0:o(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,i({endpoint:n,page:s,pageSize:10,isbn:a,title:u})];case 2:return t=e.sent(),f.current?(r((null==t?void 0:t.data)||[]),c((null===(d=null==t?void 0:t.pagination)||void 0===d?void 0:d.totalPages)||0),l(!(null===(g=null==t?void 0:t.pagination)||void 0===g?void 0:g.hasNext)&&!(null===(x=null==t?void 0:t.pagination)||void 0===x?void 0:x.hasPrevious)),[3,4]):[2];case 3:return f.current&&o(!1),[7];case 4:return[2]}})})};return a.useEffect(function(){ge({endpoint:"notable-quotes",page:b,isbn:l,setData:y,setLoading:T,setHasMore:q,setTotalPage:B,title:x})},[b]),a.useEffect(function(){ge({endpoint:"notable-characters",page:H,isbn:l,setData:F,setLoading:W,setHasMore:G,setTotalPage:O,title:x})},[H]),a.useEffect(function(){ge({endpoint:"geo-locations",page:X,isbn:l,setData:U,setLoading:te,setHasMore:ae,setTotalPage:oe,title:x})},[X]),t.jsxs("div",e.__assign({className:"book-elements-container"},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"24px"}},{children:[t.jsx("p",e.__assign({style:g.sectionTitle,className:"book-elements-section-title"},{children:"Notable Quotes"})),t.jsxs("div",e.__assign({style:g.quotesPadding},{children:[S?t.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",rowGap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:g.quoteCard},{children:[t.jsx(u.default,{variant:"text",width:"60%",height:28}),t.jsx(u.default,{variant:"text",width:"40%",height:20}),t.jsx(u.default,{variant:"text",width:"25%",height:20}),t.jsx(u.default,{variant:"text",width:"30%",height:20})]}),n)})})):0===m.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic"}},{children:["No notable quotes found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"notable-quotes",page:b,isbn:l,setData:y,setLoading:T,setHasMore:q,setTotalPage:B,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:m.map(function(n,a){var i="notable"===ce.list&&ce.page===b&&ce.index===a;return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:e.__assign(e.__assign({},g.quoteCard),{borderColor:i?"rgb(83, 43, 237)":"#CBD5E1"}),onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),ue({list:"notable",page:b,index:a}),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,s(n.text,"Notable Quotes",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight quote:",t),[3,4];case 4:return[2]}})})}},{children:[p&&p.length>0?t.jsx("p",{style:g.quoteText,className:"book-elements-quote-text",dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.text,p))}}):t.jsx("p",e.__assign({style:g.quoteText,className:"book-elements-quote-text"},{children:null==n?void 0:n.text})),t.jsxs("p",e.__assign({style:g.quoteMeta,className:"book-elements-quote-meta"},{children:[n.chapter," ",t.jsx("br",{})," ",n.page]})),t.jsxs("p",e.__assign({style:g.quoteAuthor},{children:["— ",null==n?void 0:n.author]}))]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!w&&t.jsx(c.default,{disabled:S,count:N,page:b,onChange:function(e,t){return j(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:g.geoLocationsContainer},{children:[t.jsx("p",e.__assign({style:g.sectionTitle,className:"book-elements-section-title"},{children:"Key Geo Locations"})),t.jsxs("div",e.__assign({className:"book-elements-geo-wrapper",style:e.__assign(e.__assign({},g.quotesPadding),{marginBottom:"8px"})},{children:[ee?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(e){return t.jsx(u.default,{variant:"rectangular",width:100,height:20,style:{borderRadius:"8px"}},e)})})):0===J.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key geo locations found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"geo-locations",page:X,isbn:l,setData:U,setLoading:te,setHasMore:ae,setTotalPage:oe,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:J.map(function(n,a){var i="geo_location"===ce.list&&ce.page===X&&ce.index===a;return t.jsxs("span",e.__assign({style:g.geoLocationFlex},{children:[t.jsx("span",e.__assign({className:"book-elements-geo-text",style:e.__assign(e.__assign({},g.geoText),{fontWeight:i?"700":"",textDecoration:i?"underline":""}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),ue({list:"geo_location",page:X,index:a}),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,s(n.name,"Key Geo Locations",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight location:",t),[3,4];case 4:return[2]}})})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.name,p))}}):null==n?void 0:n.name})),a<J.length-1&&t.jsx("span",{style:g.geoDivider})]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!se&&t.jsx(c.default,{disabled:ee,count:re,page:X,onChange:function(e,t){return Z(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:g.charactersContainer},{children:[t.jsx("p",e.__assign({style:g.sectionTitle,className:"book-elements-section-title"},{children:"Key Characters"})),P?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.characterCard),{flexBasis:"40%"})},{children:[t.jsx(u.default,{variant:"circular",style:e.__assign(e.__assign({},g.avatar),{flexShrink:0})}),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsx(u.default,{variant:"text",style:{flex:"1",flexShrink:0}}),t.jsx(u.default,{variant:"text",style:{flex:"1"}}),t.jsx(u.default,{variant:"text",style:{flex:"1"}}),t.jsx(u.default,{variant:"text",style:{flex:"1"}})]}))]}),n)})})):0===D.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key characters found. ",t.jsx("button",e.__assign({style:g.retryButton,onClick:function(){return ge({endpoint:"notable-characters",page:H,isbn:l,setData:F,setLoading:W,setHasMore:G,setTotalPage:O,title:x})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:t.jsx("div",e.__assign({className:"book-elements-characters-grid",style:g.charactersGrid},{children:D.map(function(n,a){var i=e.__assign(e.__assign({},g.avatar),{backgroundColor:n.bg,color:n.color}),l="key_character"===ce.list&&ce.page===H&&ce.index===a;return t.jsxs("div",e.__assign({onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},className:"book-elements-character-card",style:e.__assign(e.__assign({},g.characterCard),{borderColor:l?"rgb(83, 43, 237)":"#E5E7EB"}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,i;return e.__generator(this,function(e){switch(e.label){case 0:ue({list:"key_character",page:H,index:a}),e.label=1;case 1:return e.trys.push([1,4,,5]),(null===(i=null==n?void 0:n.chunkIds)||void 0===i?void 0:i.length)>0?[4,s(n.name,"Key Characters",n.chunkIds,0)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[3,5];case 4:return t=e.sent(),console.error("Failed to highlight character:",t),[3,5];case 5:return[2]}})})}},{children:[t.jsx("div",e.__assign({style:i},{children:n.initials})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column"}},{children:[t.jsx("p",e.__assign({className:"book-elements-char-name",style:e.__assign(e.__assign({},g.charName),{margin:0})},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(n.name,p))}}):n.name})),t.jsx("p",e.__assign({className:"book-elements-char-desc",style:e.__assign(e.__assign({},g.charDesc),{margin:0,marginTop:"4px"})},{children:p&&p.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(r.highlightTermsFunc(null==n?void 0:n.description,p))}}):t.jsx(d.default,e.__assign({components:{p:function(n){n.node;var s=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},s))}}},{children:null==n?void 0:n.description}))}))]}))]}),a)})}))}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!A&&t.jsx(c.default,{count:Y,disabled:P,page:H,onChange:function(e,t){return z(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookElementsCard.js.map
|
|
@@ -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"),i=require("react-markdown"),l=require("remark-breaks"),s=require("../utils/highlight.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),l=require("remark-breaks"),s=require("../utils/highlight.js"),o=require("../../../utils/sanitizeHtml.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(i),c=r(l),u={card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",padding:"24px"},title:{fontSize:"16px",fontWeight:"bold",marginBottom:"24px"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:"24px",marginBottom:"24px"},gridItem:{backgroundColor:"#F8FAFC",border:"1px solid #DFE5EC",borderRadius:"8px",padding:"12px 8px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px"},gridItemHeight:{height:"50px"},label:{fontSize:"14px",fontWeight:400,color:"#64748B",margin:0},value:{fontWeight:"bold",fontSize:"14px",color:"#434C55",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px"},section:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",border:"1px solid #DEE4EB"},sectionLabel:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"8px",whiteSpace:"pre-line"},summaryText:{marginTop:"0px"},sectionText:{fontSize:"16px",fontWeight:400,lineHeight:"1.625",color:"#64748B",marginBottom:"8px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none"},lineClamp:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},container:{fontFamily:"Inter, sans-serif",color:"#434C54",marginBottom:"8px"},partContainer:{marginBottom:"8px"},partTitle:{fontSize:"16px",fontWeight:"600",marginBottom:"10px"},chapterList:{listStyle:"none",paddingLeft:"20px",margin:0},chapterItem:{marginBottom:"6px"},chapterLink:{textDecoration:"none",color:"#63748A",fontSize:"16px",lineHeight:"1.5"},chapterLinkHover:{textDecoration:"underline"},singleChapter:{marginBottom:"4px",fontSize:"16px"},chapterNumber:{color:"#63748A"}};exports.default=function(i){var l,r,d,g,p,m,h,_,x,v,f,b,y=i.data,j=i.highlightTerms,k=i.onHighlightMatch,T=n.useState(!1),C=T[0],S=T[1],L=n.useState(!1),B=L[0],N=L[1],H=n.useState(!1),w=H[0],D=H[1],F=n.useState(!1),I=F[0],z=F[1],M=n.useRef(null),O=(null==y?void 0:y.tableOfContent)&&y.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),A=null===(g=null===(d=null===(r=null===(l=null==y?void 0:y.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===r?void 0:r.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===d?void 0:d.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===g?void 0:g.replace(/overflow:\s*hidden;?/g,"");return n.useLayoutEffect(function(){if(M.current){var e=M.current.scrollHeight>M.current.clientHeight;z(e)}},[null==y?void 0:y.bookDescription,B]),n.useEffect(function(){var t,n;if(j&&0!==j.length){var i=e.__spreadArray([y.title,y.author,y.summary,y.bookDescription],null!==(n=null===(t=y.tableOfContent)||void 0===t?void 0:t.map(function(e){return e.title}))&&void 0!==n?n:[],!0).some(function(e){return!!e&&j.some(function(t){return e.toLowerCase().includes(t.toLowerCase())})});null==k||k(i)}},[j,y]),t.jsxs("div",e.__assign({style:u.card,className:"book-card-container"},{children:[t.jsxs("div",e.__assign({style:u.grid,className:"book-card-grid"},{children:[t.jsxs("div",e.__assign({style:u.gridItem},{children:[t.jsx("p",e.__assign({style:u.label},{children:"Book Title"})),j&&j.length>0?t.jsx("p",{style:u.value,className:"book-card-value",title:null==y?void 0:y.title,dangerouslySetInnerHTML:{__html:o.sanitizeHtml(s.highlightTermsFunc(null!==(p=null==y?void 0:y.title)&&void 0!==p?p:"NA",j))}}):t.jsx("p",e.__assign({style:u.value,className:"book-card-value",title:null==y?void 0:y.title},{children:null!==(m=null==y?void 0:y.title)&&void 0!==m?m:"NA"}))]})),t.jsxs("div",e.__assign({style:u.gridItem},{children:[t.jsx("p",e.__assign({style:u.label},{children:"Book Author"})),j&&j.length>0?t.jsx("p",{style:u.value,className:"book-card-value",title:null==y?void 0:y.author,dangerouslySetInnerHTML:{__html:o.sanitizeHtml(s.highlightTermsFunc(null!==(h=null==y?void 0:y.author)&&void 0!==h?h:"NA",j))}}):t.jsx("p",e.__assign({style:u.value,className:"book-card-value",title:null==y?void 0:y.author},{children:null!==(_=null==y?void 0:y.author)&&void 0!==_?_:"NA"}))]})),t.jsxs("div",e.__assign({style:u.gridItem},{children:[t.jsx("p",e.__assign({style:u.label},{children:"Total Sections"})),t.jsx("p",e.__assign({style:u.value,className:"book-card-value"},{children:null!==(x=null==y?void 0:y.totalSectionCount)&&void 0!==x?x:"NA"}))]})),t.jsxs("div",e.__assign({style:u.gridItem},{children:[t.jsx("p",e.__assign({style:u.label},{children:"Total Pages"})),t.jsx("p",e.__assign({style:u.value,className:"book-card-value"},{children:null!==(v=null==y?void 0:y.totalPages)&&void 0!==v?v:"NA"}))]})),t.jsxs("div",e.__assign({style:u.gridItem},{children:[t.jsx("p",e.__assign({style:u.label},{children:"Reading Time"})),t.jsx("p",e.__assign({style:u.value,className:"book-card-value"},{children:null!==(f=null==y?void 0:y.readingTime)&&void 0!==f?f:"NA"}))]}))]})),(null==y?void 0:y.bookDescription)&&(null==y?void 0:y.bookDescription.length)>0&&t.jsxs("div",e.__assign({style:u.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:u.sectionLabel},{children:"Book Description"})),t.jsx("div",e.__assign({ref:M,className:"book-card-section-text",style:e.__assign(e.__assign(e.__assign({},u.sectionText),u.summaryText),B?{}:u.lineClamp)},{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:j&&j.length>0?o.sanitizeHtml(s.highlightTermsFunc(A||"",j)):A}})})),(I||B)&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},u.button),{marginBottom:"10px"}),onClick:function(){return N(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:B?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:u.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:u.sectionLabel},{children:"AI Book Summary"})),t.jsx("p",e.__assign({className:"book-card-section-text",style:e.__assign(e.__assign({},u.sectionText),C?{}:u.lineClamp)},{children:j&&j.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:o.sanitizeHtml(s.highlightTermsFunc((null==y?void 0:y.summary)||"",j))}}):t.jsx(a.default,e.__assign({remarkPlugins:[c.default],components:{p:function(n){n.node;var i=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:null==y?void 0:y.summary}))})),(null==y?void 0:y.summary)&&(null==y?void 0:y.summary.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},u.button),{marginBottom:"10px"}),onClick:function(){return S(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:C?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},u.section),{marginTop:"10px"})},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},u.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),t.jsx("div",e.__assign({style:e.__assign(e.__assign({},u.container),w?{}:u.lineClamp)},{children:(null==y?void 0:y.tableOfContent)&&!O?null===(b=null==y?void 0:y.tableOfContent)||void 0===b?void 0:b.map(function(n,i){return t.jsx("div",e.__assign({style:u.partContainer},{children:n.children?t.jsxs(t.Fragment,{children:[t.jsx("p",{style:u.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:j&&j.length>0?o.sanitizeHtml(s.highlightTermsFunc(n.title,j)):n.title}}),t.jsx("ul",e.__assign({style:u.chapterList},{children:n.children.map(function(n,i){return t.jsx("li",e.__assign({style:u.chapterItem},{children:t.jsx("span",{style:u.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:j&&j.length>0?o.sanitizeHtml(s.highlightTermsFunc(n.title,j)):n.title}})}),i)})}))]}):t.jsx("div",e.__assign({style:u.singleChapter},{children:t.jsx("span",{style:u.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:j&&j.length>0?o.sanitizeHtml(s.highlightTermsFunc(n.title,j)):n.title}})}))}),i)}):t.jsx("p",e.__assign({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==y?void 0:y.tableOfContent)&&!O&&(null==y?void 0:y.tableOfContent.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},u.button),{marginBottom:"10px"}),onClick:function(){return D(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:w?"View Less":"View More"}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),l=require("../utils/highlight.js"),t=require("../../../utils/sanitizeHtml.js"),r={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},card:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:500,fontSize:"14px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word",marginBottom:"24px",width:"fit-content"},tag:{padding:"4px 12px",fontSize:"14px",fontWeight:500,color:"#3B82F6",backgroundColor:"#F3F8FF",borderRadius:"6px"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",height:"35px",width:"35px",borderRadius:"50%",backgroundColor:"#E5E7EB",color:"#4B5563",fontWeight:600,flexShrink:0,fontSize:"12px"},contributorName:{fontWeight:600,color:"#111827",marginTop:"8px",fontSize:"14px"},contributorRole:{fontSize:"12px",color:"#6B7280"},grid:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"24px",marginBottom:"24px",padding:"0 12px"},awardMeta:{fontSize:"14px",color:"#4B5563"},awardDesc:{fontSize:"14px",color:"#4B5563"},awardContainer:{display:"flex",gap:"8px"},awardInfo:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:600,fontSize:"12px",borderRadius:"4px",color:"#434C54",maxWidth:"100%",wordBreak:"break-word",width:"fit-content"},listContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"30px",marginBottom:"24px"},awardContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"16px"}};exports.default=function(a){var o,s,d,p=a.data,u=a.highlightTerms,c=a.onHighlightMatch,g=p.publisher,h=p.contributors,m=p.awards,x=void 0===m?[]:m,v=function(e){var n=e.trim().split(/\s+/).map(function(e){var n;return null===(n=e[0])||void 0===n?void 0:n.toUpperCase()}).join("");return n.length>3?"".concat(n.slice(0,3)):n};return i.useEffect(function(){var n,i,l,t,r,a,o,s,d,g,h,m;if(u&&0!==u.length){var x=e.__spreadArray(e.__spreadArray(e.__spreadArray(e.__spreadArray([null!==(i=null===(n=p.publisher)||void 0===n?void 0:n.name)&&void 0!==i?i:""],null!==(t=null===(l=p.publisher)||void 0===l?void 0:l.tags)&&void 0!==t?t:[],!0),null!==(o=null===(a=null===(r=p.contributors)||void 0===r?void 0:r.primary)||void 0===a?void 0:a.flatMap(function(n){var i;return e.__spreadArray([n.name,n.role],null!==(i=n.tags)&&void 0!==i?i:[],!0)}))&&void 0!==o?o:[],!0),null!==(g=null===(d=null===(s=p.contributors)||void 0===s?void 0:s.additional)||void 0===d?void 0:d.flatMap(function(n){var i;return e.__spreadArray([n.name,n.role],null!==(i=n.tags)&&void 0!==i?i:[],!0)}))&&void 0!==g?g:[],!0),null!==(m=null===(h=p.awards)||void 0===h?void 0:h.flatMap(function(e){return[e.title,e.org,String(e.year),e.country]}))&&void 0!==m?m:[],!0).some(function(e){return!!e&&u.some(function(n){return e.toLowerCase().includes(n.toLowerCase())})});null==c||c(x)}},[u,p]),n.jsxs("div",e.__assign({className:"book-people-container"},{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Publishers"})),n.jsxs("div",e.__assign({style:r.card,className:"book-people-card"},{children:[n.jsx("span",e.__assign({style:{color:"rgb(67, 76, 85)"}},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(g.name,u))}}):g.name})),(null==g?void 0:g.tags)&&(null==g?void 0:g.tags.length)>0&&n.jsx("div",e.__assign({style:{display:"flex",gap:"8px",marginTop:"18px"}},{children:null===(o=null==g?void 0:g.tags)||void 0===o?void 0:o.map(function(i,a){return n.jsx("span",e.__assign({style:r.tag},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(i,u))}}):i}),a)})}))]})),n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Contributors"})),n.jsx("div",e.__assign({style:r.listContainerWrapper,className:"book-people-list-wrapper"},{children:null===(s=null==h?void 0:h.primary)||void 0===s?void 0:s.map(function(i,a){var o;return n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},{children:[n.jsx("div",e.__assign({style:r.avatar,className:"book-people-avatar"},{children:v(null==i?void 0:i.name)})),n.jsx("span",e.__assign({style:r.contributorName,className:"book-people-name"},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.name,u))}}):null==i?void 0:i.name})),n.jsx("span",e.__assign({style:r.contributorRole,className:"book-people-role"},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.role,u))}}):null==i?void 0:i.role})),n.jsx("div",e.__assign({style:{display:"flex",gap:"8px",marginTop:"8px"}},{children:null===(o=null==i?void 0:i.tags)||void 0===o?void 0:o.map(function(i,a){return n.jsx("span",e.__assign({style:r.tag},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(i,u))}}):i}),a)})}))]}),a)})})),h.additional&&h.additional.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Additional Contributors"})),n.jsx("div",e.__assign({style:r.listContainerWrapper,className:"book-people-list-wrapper"},{children:null===(d=null==h?void 0:h.additional)||void 0===d?void 0:d.map(function(i,a){return n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},{children:[n.jsx("div",e.__assign({style:r.avatar,className:"book-people-avatar"},{children:v(null==i?void 0:i.name)})),n.jsx("span",e.__assign({style:r.contributorName,className:"book-people-name"},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.name,u))}}):null==i?void 0:i.name})),n.jsx("span",e.__assign({style:r.contributorRole,className:"book-people-role"},{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.role,u))}}):null==i?void 0:i.role}))]}),a)})}))]}),x.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Awards"})),n.jsx("div",e.__assign({style:r.awardContainerWrapper,className:"book-people-award-wrapper"},{children:null==x?void 0:x.map(function(i,a){return n.jsx("div",e.__assign({style:r.awardInfo},{children:n.jsx("span",{children:u&&u.length>0?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.title,u))}}):null==i?void 0:i.title})}),a)})}))]})]}))};
|
|
2
2
|
//# sourceMappingURL=BookPeopleAwardsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),t=require("./InternalChatCitationRenderer.js"),i=require("./components/wrappers/Modal.js"),a=require("./components/IconContainer.js"),r=require("lucide-react");function s(o){return o&&"object"==typeof o&&"default"in o?o:{default:o}}var l=s(require("@mui/icons-material/SwapHoriz"));exports.default=function(s){var d,u,c,_,p,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),t=require("./InternalChatCitationRenderer.js"),i=require("./components/wrappers/Modal.js"),a=require("./components/IconContainer.js"),r=require("lucide-react");function s(o){return o&&"object"==typeof o&&"default"in o?o:{default:o}}var l=s(require("@mui/icons-material/SwapHoriz"));exports.default=function(s){var d,u,c,_,v,C,p,h=e.useState(!1),g=h[0],y=h[1],x=e.useState(),f=x[0],j=x[1];function m(o){y(!0),j(o)}function b(){y(!1),j(void 0)}function A(o){j(o)}var k=e.useMemo(function(){var o;return!!(null===(o=s.ruleBookContainer)||void 0===o?void 0:o.data)},[null===(d=s.ruleBookContainer)||void 0===d?void 0:d.data]),w=e.useMemo(function(){var o;return!!((null===(o=s.tableComponent)||void 0===o?void 0:o.rows)&&Object.keys(s.tableComponent.rows).length>0)},[s.tableComponent]);return console.log("tableComponent data:",s.tableComponent),console.log("isTableDataPresent:",w),console.log("rootContainer",s.rootContainer),console.log("chatCitation",s.chatContainer),n.jsxs(n.Fragment,{children:[n.jsx(t.default,o.__assign({},s,{showRootContainer:s.showRootContainer,tableComponent:s.tableComponent,additionalData:o.__assign(o.__assign({},s.additionalData),{isExpanded:!1}),isRenderedCustomComponent:s.isRenderedCustomComponent||!1,closePreview:s.closePreview,chatContainer:o.__assign(o.__assign({},s.chatContainer),{show:!0,secondaryActions:function(e){var t,i,l,d,u;return o.__spreadArray(o.__spreadArray(o.__spreadArray([],e,!0),null!==(i=null===(t=s.chatContainer)||void 0===t?void 0:t.additionalSecondaryActions)&&void 0!==i?i:[],!0),[(null===(u=null===(d=null===(l=s.chatContainer)||void 0===l?void 0:l.detailedTab)||void 0===d?void 0:d.chip)||void 0===u?void 0:u.isActive)&&n.jsx("span",{style:{width:"1px",height:"100%",border:"1px solid #E2E8F0"}}),n.jsx(a.default,o.__assign({onClick:function(){return m("chat")},style:{cursor:"pointer"}},{children:n.jsx(r.Maximize2,{size:16,color:"#64748B"})}))],!1)}}),ruleBookContainer:k?o.__assign(o.__assign(o.__assign({},s.ruleBookContainer),null!==(c=null===(u=s.ruleBookContainer)||void 0===u?void 0:u.additionalSecondaryActions)&&void 0!==c?c:[]),{show:!0,secondaryActions:function(e){return o.__spreadArray(o.__spreadArray([],e,!0),[n.jsx("span",{style:{width:"1px",border:"1px solid #E2E8F0"}}),n.jsx(a.default,o.__assign({onClick:function(){return m("rulebook")},style:{cursor:"pointer"}},{children:n.jsx(r.Maximize2,{size:16,color:"#64748B"})}))],!1)}}):void 0})),n.jsx(i.Modal,o.__assign({isOpen:g,onClose:b},{children:n.jsx(t.default,o.__assign({},s,{showRootContainer:s.showRootContainer,tableComponent:s.tableComponent,additionalData:o.__assign(o.__assign({},s.additionalData),{isExpanded:!0}),rootContainer:o.__assign(o.__assign({},s.rootContainer),{secondaryActions:function(e){return o.__spreadArray(o.__spreadArray([],e,!0),[n.jsx(a.default,o.__assign({onClick:b,style:{cursor:"pointer"}},{children:n.jsx(r.X,{size:20,color:"#64748B"})}))],!1)}}),chatContainer:o.__assign(o.__assign({},s.chatContainer),{show:void 0===f?void 0:"chat"===f,secondaryActions:function(e){var t,i,r;return o.__spreadArray(o.__spreadArray([],e,!0),[(null===(r=null===(i=null===(t=s.chatContainer)||void 0===t?void 0:t.detailedTab)||void 0===i?void 0:i.chip)||void 0===r?void 0:r.isActive)&&(k||w)&&n.jsx("span",{style:{width:"1px",height:"100%",border:"1px solid #E2E8F0"}}),(k||w)&&n.jsx(a.default,o.__assign({style:{cursor:"pointer"},onClick:function(){return A("rulebook")}},{children:n.jsx(l.default,{style:{color:"gray",fontSize:22}})}))],!1)},slotStyles:o.__assign(o.__assign({},s.chatContainer.slotStyles),{chatDataContainer:o.__assign(o.__assign({},null===(_=s.chatContainer.slotStyles)||void 0===_?void 0:_.chatDataContainer),{maxHeight:void 0})})}),ruleBookContainer:k?o.__assign(o.__assign({},s.ruleBookContainer),{show:void 0===f?void 0:"rulebook"===f,secondaryActions:function(e){return o.__spreadArray(o.__spreadArray([],e,!0),[n.jsx("span",{style:{width:"1px",border:"1px solid #E2E8F0"}}),n.jsx(a.default,o.__assign({style:{cursor:"pointer"},onClick:function(){return A("chat")}},{children:n.jsx(l.default,{style:{color:"gray",fontSize:22}})}))],!1)},slotStyles:o.__assign(o.__assign({},null===(v=s.ruleBookContainer)||void 0===v?void 0:v.slotStyles),{dataContainer:o.__assign(o.__assign({},null===(p=null===(C=s.ruleBookContainer)||void 0===C?void 0:C.slotStyles)||void 0===p?void 0:p.dataContainer),{maxHeight:void 0})})}):void 0}))}))]})};
|
|
2
2
|
//# sourceMappingURL=ChatCitationRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),l=require("react/jsx-runtime"),o=require("./components/ChatCitation.js"),i=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),s=require("./components/DetailedView.js"),d=require("./components/SummarizedView.js"),a=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=g(require("@mui/icons-material/CloseOutlined"));exports.default=function(g){var p,x,m,y,_,C,w,k,j,S,q,A,T,R,I,D,V,F,z,P,E,B,H,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,oe,ie,ne=g.rootContainer,te=g.chatContainer,re=g.ruleBookContainer,se=g.renderer,de=g.additionalData,ae=g.tableComponent,ue=g.closePreview,ve=g.isRenderedCustomComponent,ce=void 0!==ve&&ve,he=g.showRootContainer,fe=void 0===he||he,ge=g.reversePanels,be=void 0!==ge&&ge,pe=u.useState(0),xe=pe[0],me=pe[1],ye=u.useState(0),_e=ye[0],Ce=ye[1],we=u.useState(0),ke=we[0],je=we[1],Se=u.useState(0),qe=Se[0],Ae=Se[1],Te=u.useRef(null),Re=u.useRef(null),Ie=u.useMemo(function(){return e.__assign(e.__assign({},v.defaultRenderer),se)},[se]),De=u.useMemo(function(){return!!((null==ae?void 0:ae.rows)&&Object.keys(ae.rows).length>0)},[ae]),Ve=u.useMemo(function(){var e;return null!==(e=null==de?void 0:de.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==de?void 0:de.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l;if((null==re?void 0:re.show)&&Te.current){var o=null===(e=Te.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(me((null==o?void 0:o.length)||0),Ce(0),o&&o.length>0)(i=o[0]).style.backgroundColor="#ffff5c",i.scrollIntoView({behavior:"smooth",block:"center"})}if(te.show&&Re.current){var i,n=null===(l=Re.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(je((null==n?void 0:n.length)||0),Ae(0),n&&n.length>0)(i=n[0]).style.backgroundColor="#ffff5c",i.scrollIntoView({behavior:"smooth",block:"center"})}},[te.show,null==re?void 0:re.show,null==re?void 0:re.data,null==te?void 0:te.chatData]);var Fe=u.useCallback(function(){var e;if(_e+1<xe){var l=null===(e=Te.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[_e].style.backgroundColor="#ffffb8";var o=_e+1;Ce(o);var i=l[o];i.style.backgroundColor="#ffff5c",null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}},[_e,xe]),ze=u.useCallback(function(){var e;if(!(_e-1<0)){var l=null===(e=Te.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[_e].style.backgroundColor="#ffffb8";var o=_e-1,i=l[o];i.style.backgroundColor="#ffff5c",Ce(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}}},[_e]),Pe=u.useCallback(function(){var e;if(qe+1<ke){var l=null===(e=Re.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[qe].style.backgroundColor="#ffffb8";var o=qe+1,i=l[o];i.style.backgroundColor="#ffff5c",Ae(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}},[qe,ke]),Ee=u.useCallback(function(){var e;if(!(qe-1<0)){var l=null===(e=Re.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[qe].style.backgroundColor="#ffffb8";var o=qe-1,i=l[o];i.style.backgroundColor="#ffff5c",Ae(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}}},[qe]),Be=i.getColorCode((null==ne?void 0:ne.relevanceScore)||0),He=u.useMemo(function(){var o,i=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Be.border,backgroundColor:Be.background,color:Be.text},null===(o=null==ne?void 0:ne.slotStyles)||void 0===o?void 0:o.relevanceScore)},{children:[(null==ne?void 0:ne.relevanceTitle)||"Decision Strength",":"," ",(null==ne?void 0:ne.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:ue},{children:l.jsx(b.default,{})}),"close-preview");return ce&&!(null==de?void 0:de.isExpanded)?[i,n]:[i]},[ce,Be.background,Be.border,Be.text,null==ne?void 0:ne.relevanceScore,null===(p=null==ne?void 0:ne.slotStyles)||void 0===p?void 0:p.relevanceScore,null==ne?void 0:ne.relevanceTitle]),Me=u.useMemo(function(){return[xe>0&&l.jsx(r.default,{currentItemNumber:_e+1,totalItems:xe,disableNext:_e+1>=xe,onNext:Fe,onPrevious:ze,disablePrevious:_e<=0},"rulebook-nav")]},[_e,Fe,ze,xe]),Ne=u.useMemo(function(){return(null==de?void 0:de.RuleBookContainerHeight)?de.RuleBookContainerHeight:!(!Ve||(null==de?void 0:de.isExpanded))&&"600px"},[null==de?void 0:de.RuleBookContainerHeight,Ve]),We=u.useMemo(function(){var e,o;return[(null===(o=null===(e=null==te?void 0:te.detailedTab)||void 0===e?void 0:e.chip)||void 0===o?void 0:o.isActive)&&ke>0&&l.jsx(r.default,{currentItemNumber:qe+1,totalItems:ke,onNext:Pe,onPrevious:Ee,disableNext:qe+1>=ke,disablePrevious:qe<=0},"chat-nav")]},[null===(m=null===(x=null==te?void 0:te.detailedTab)||void 0===x?void 0:x.chip)||void 0===m?void 0:m.isActive,qe,Pe,Ee,ke]),Ye=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:be?Ve?"column-reverse":"row-reverse":Ve?"column":"row",gap:"12px",height:Ne||"100%",minHeight:0},null===(y=null==ne?void 0:ne.slotStyles)||void 0===y?void 0:y.container)},{children:[De&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(_=null==te?void 0:te.slotStyles)||void 0===_?void 0:_.outerContainer)},{children:l.jsx(o.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==de?void 0:de.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==ae?void 0:ae.rows)&&l.jsx(f.BigQueryTable,{rows:ae.rows,columns:ae.columns||[]})}))}))})),(null==re?void 0:re.data)&&(re.show||void 0===re.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(C=null==re?void 0:re.slotStyles)||void 0===C?void 0:C.outerContainer)},{children:l.jsx(o.default,e.__assign({title:null!==(w=null==re?void 0:re.title)&&void 0!==w?w:"Rule book",icon:null==re?void 0:re.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(k=null==re?void 0:re.slotStyles)||void 0===k?void 0:k.title)},secondaryActions:(null==re?void 0:re.secondaryActions)?re.secondaryActions(Me):Me},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(j=null==re?void 0:re.slotStyles)||void 0===j?void 0:j.dataContainer)},{children:l.jsx("div",e.__assign({style:{position:"absolute",padding:"12px",inset:0,overflowY:"auto"},ref:Te},{children:l.jsx(a.default,{data:re.data,renderers:null!==(S=null==re?void 0:re.renderer)&&void 0!==S?S:Ie})}))}))}))})),(te.show||void 0===te.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(q=null==te?void 0:te.slotStyles)||void 0===q?void 0:q.outerContainer)},{children:l.jsx(o.default,e.__assign({title:null!==(A=null==te?void 0:te.title)&&void 0!==A?A:"Chat",icon:null==te?void 0:te.chatIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(T=null==te?void 0:te.slotStyles)||void 0===T?void 0:T.title)},primaryActions:[((null===(I=null===(R=null==te?void 0:te.summarizedTab)||void 0===R?void 0:R.chip)||void 0===I?void 0:I.show)||void 0===(null===(V=null===(D=null==te?void 0:te.summarizedTab)||void 0===D?void 0:D.chip)||void 0===V?void 0:V.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(F=null==te?void 0:te.summarizedTab)||void 0===F?void 0:F.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(z=null==te?void 0:te.detailedTab)||void 0===z?void 0:z.chip))],secondaryActions:te.secondaryActions?null==te?void 0:te.secondaryActions(We):We},{children:l.jsxs("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(P=null==te?void 0:te.slotStyles)||void 0===P?void 0:P.chatDataContainer)},{children:[(null===(B=null===(E=null==te?void 0:te.detailedTab)||void 0===E?void 0:E.chip)||void 0===B?void 0:B.isActive)&&l.jsx("div",e.__assign({ref:Re,style:{position:(null==de?void 0:de.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(s.default,{chatData:te.chatData,assistantChatProps:e.__assign(e.__assign({},null===(M=null===(H=null==te?void 0:te.detailedTab)||void 0===H?void 0:H.view)||void 0===M?void 0:M.assistantChatProps),{renderers:null!==(Y=null===(W=null===(N=null==te?void 0:te.detailedTab)||void 0===N?void 0:N.detailedViewRenderer)||void 0===W?void 0:W.assistantText)&&void 0!==Y?Y:Ie}),userChatItemProps:e.__assign(e.__assign({},null===(K=null===(O=null==te?void 0:te.detailedTab)||void 0===O?void 0:O.view)||void 0===K?void 0:K.userChatItemProps),{renderers:null!==(G=null===(U=null===(Q=null==te?void 0:te.detailedTab)||void 0===Q?void 0:Q.detailedViewRenderer)||void 0===U?void 0:U.userText)&&void 0!==G?G:Ie})})})),(null===(L=null===(J=null==te?void 0:te.summarizedTab)||void 0===J?void 0:J.chip)||void 0===L?void 0:L.show)&&(null===(Z=null===(X=null==te?void 0:te.summarizedTab)||void 0===X?void 0:X.chip)||void 0===Z?void 0:Z.isActive)&&l.jsx(d.default,e.__assign({chatData:te.chatData},null===($=null==te?void 0:te.summarizedTab)||void 0===$?void 0:$.view,{renderer:null!==(le=null===(ee=null==te?void 0:te.summarizedTab)||void 0===ee?void 0:ee.summarizedViewRenderer)&&void 0!==le?le:Ie}))]}))}))}))]}));return fe?l.jsx(o.default,e.__assign({title:null==ne?void 0:ne.title,slotStyles:{title:null===(oe=null==ne?void 0:ne.slotStyles)||void 0===oe?void 0:oe.title},icon:null!==(ie=null==ne?void 0:ne.icon)&&void 0!==ie?ie:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==ne?void 0:ne.secondaryActions)?ne.secondaryActions(He):He},{children:Ye})):Ye};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),l=require("react/jsx-runtime"),o=require("./components/ChatCitation.js"),i=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),s=require("./components/DetailedView.js"),d=require("./components/SummarizedView.js"),a=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=g(require("@mui/icons-material/CloseOutlined"));exports.default=function(g){var p,x,m,y,_,C,w,k,j,S,q,A,T,R,I,D,V,F,z,P,E,B,H,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,oe,ie,ne,te,re=g.rootContainer,se=g.chatContainer,de=g.ruleBookContainer,ae=g.renderer,ue=g.additionalData,ve=g.tableComponent,ce=g.closePreview,he=g.isRenderedCustomComponent,fe=void 0!==he&&he,ge=g.showRootContainer,be=void 0===ge||ge,pe=g.reversePanels,xe=void 0!==pe&&pe,me=u.useState(0),ye=me[0],_e=me[1],Ce=u.useState(0),we=Ce[0],ke=Ce[1],je=u.useState(0),Se=je[0],qe=je[1],Ae=u.useState(0),Te=Ae[0],Re=Ae[1],Ie=u.useRef(null),De=u.useRef(null),Ve=u.useMemo(function(){return e.__assign(e.__assign(e.__assign({},v.defaultRenderer),ae),{highlight:function(o){var i;return l.jsx("span",e.__assign({"data-highlight":"true",style:{backgroundColor:null!==(i=null==se?void 0:se.highlightColor)&&void 0!==i?i:"#ffffb8",borderRadius:"2px"}},{children:o.children}))}})},[ae,null==se?void 0:se.highlightColor]),Fe=u.useMemo(function(){return!!((null==ve?void 0:ve.rows)&&Object.keys(ve.rows).length>0)},[ve]),ze=u.useMemo(function(){var e;return null!==(e=null==ue?void 0:ue.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==ue?void 0:ue.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l;if((null==de?void 0:de.show)&&Ie.current){var o=null===(e=Ie.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(_e((null==o?void 0:o.length)||0),ke(0),o&&o.length>0)(i=o[0]).style.backgroundColor="#ffff5c",i.scrollIntoView({behavior:"smooth",block:"center"})}if(se.show&&De.current){var i,n=null===(l=De.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(qe((null==n?void 0:n.length)||0),Re(0),n&&n.length>0)(i=n[0]).style.backgroundColor="#ffff5c",i.scrollIntoView({behavior:"smooth",block:"center"})}},[se.show,null==de?void 0:de.show,null==de?void 0:de.data,null==se?void 0:se.chatData]);var Pe=u.useCallback(function(){var e;if(we+1<ye){var l=null===(e=Ie.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[we].style.backgroundColor="#ffffb8";var o=we+1;ke(o);var i=l[o];i.style.backgroundColor="#ffff5c",null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}},[we,ye]),Ee=u.useCallback(function(){var e;if(!(we-1<0)){var l=null===(e=Ie.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[we].style.backgroundColor="#ffffb8";var o=we-1,i=l[o];i.style.backgroundColor="#ffff5c",ke(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}}},[we]),Be=u.useCallback(function(){var e;if(Te+1<Se){var l=null===(e=De.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[Te].style.backgroundColor="#ffffb8";var o=Te+1,i=l[o];i.style.backgroundColor="#ffff5c",Re(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}},[Te,Se]),He=u.useCallback(function(){var e;if(!(Te-1<0)){var l=null===(e=De.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[Te].style.backgroundColor="#ffffb8";var o=Te-1,i=l[o];i.style.backgroundColor="#ffff5c",Re(o),null==i||i.scrollIntoView({behavior:"smooth",block:"center"})}}},[Te]),Me=i.getColorCode((null==re?void 0:re.relevanceScore)||0),Ne=u.useMemo(function(){var o,i=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Me.border,backgroundColor:Me.background,color:Me.text},null===(o=null==re?void 0:re.slotStyles)||void 0===o?void 0:o.relevanceScore)},{children:[(null==re?void 0:re.relevanceTitle)||"Decision Strength",":"," ",(null==re?void 0:re.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:ce},{children:l.jsx(b.default,{})}),"close-preview");return fe&&!(null==ue?void 0:ue.isExpanded)?[i,n]:[i]},[fe,Me.background,Me.border,Me.text,null==re?void 0:re.relevanceScore,null===(p=null==re?void 0:re.slotStyles)||void 0===p?void 0:p.relevanceScore,null==re?void 0:re.relevanceTitle]),We=u.useMemo(function(){return[ye>0&&l.jsx(r.default,{currentItemNumber:we+1,totalItems:ye,disableNext:we+1>=ye,onNext:Pe,onPrevious:Ee,disablePrevious:we<=0},"rulebook-nav")]},[we,Pe,Ee,ye]),Ye=u.useMemo(function(){return(null==ue?void 0:ue.RuleBookContainerHeight)?ue.RuleBookContainerHeight:!(!ze||(null==ue?void 0:ue.isExpanded))&&"600px"},[null==ue?void 0:ue.RuleBookContainerHeight,ze]),Oe=u.useMemo(function(){var e,o;return[(null===(o=null===(e=null==se?void 0:se.detailedTab)||void 0===e?void 0:e.chip)||void 0===o?void 0:o.isActive)&&Se>0&&l.jsx(r.default,{currentItemNumber:Te+1,totalItems:Se,onNext:Be,onPrevious:He,disableNext:Te+1>=Se,disablePrevious:Te<=0},"chat-nav")]},[null===(m=null===(x=null==se?void 0:se.detailedTab)||void 0===x?void 0:x.chip)||void 0===m?void 0:m.isActive,Te,Be,He,Se]),Ke=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:xe?ze?"column-reverse":"row-reverse":ze?"column":"row",gap:"12px",height:Ye||"100%",minHeight:0},null===(y=null==re?void 0:re.slotStyles)||void 0===y?void 0:y.container)},{children:[Fe&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(_=null==se?void 0:se.slotStyles)||void 0===_?void 0:_.outerContainer)},{children:l.jsx(o.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==ue?void 0:ue.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==ve?void 0:ve.rows)&&l.jsx(f.BigQueryTable,{rows:ve.rows,columns:ve.columns||[]})}))}))})),(null==de?void 0:de.data)&&(de.show||void 0===de.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(C=null==de?void 0:de.slotStyles)||void 0===C?void 0:C.outerContainer)},{children:l.jsx(o.default,e.__assign({title:null!==(w=null==de?void 0:de.title)&&void 0!==w?w:"Rule book",icon:null==de?void 0:de.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(k=null==de?void 0:de.slotStyles)||void 0===k?void 0:k.title)},secondaryActions:(null==de?void 0:de.secondaryActions)?de.secondaryActions(We):We},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(j=null==de?void 0:de.slotStyles)||void 0===j?void 0:j.dataContainer)},{children:l.jsx("div",e.__assign({style:{position:"absolute",padding:"12px",inset:0,overflowY:"auto"},ref:Ie},{children:l.jsx(a.default,{data:de.data,renderers:null!==(S=null==de?void 0:de.renderer)&&void 0!==S?S:Ve})}))}))}))})),(se.show||void 0===se.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(q=null==se?void 0:se.slotStyles)||void 0===q?void 0:q.outerContainer)},{children:l.jsx(o.default,e.__assign({title:null!==(A=null==se?void 0:se.title)&&void 0!==A?A:"Chat",icon:null==se?void 0:se.chatIcon,containerStyles:null===(T=null==se?void 0:se.slotStyles)||void 0===T?void 0:T.container,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(R=null==se?void 0:se.slotStyles)||void 0===R?void 0:R.title)},primaryActions:[((null===(D=null===(I=null==se?void 0:se.summarizedTab)||void 0===I?void 0:I.chip)||void 0===D?void 0:D.show)||void 0===(null===(F=null===(V=null==se?void 0:se.summarizedTab)||void 0===V?void 0:V.chip)||void 0===F?void 0:F.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(z=null==se?void 0:se.summarizedTab)||void 0===z?void 0:z.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(P=null==se?void 0:se.detailedTab)||void 0===P?void 0:P.chip))],secondaryActions:se.secondaryActions?null==se?void 0:se.secondaryActions(Oe):Oe},{children:l.jsxs("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(E=null==se?void 0:se.slotStyles)||void 0===E?void 0:E.chatDataContainer)},{children:[(null===(H=null===(B=null==se?void 0:se.detailedTab)||void 0===B?void 0:B.chip)||void 0===H?void 0:H.isActive)&&l.jsx("div",e.__assign({ref:De,style:{position:(null==ue?void 0:ue.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(s.default,{chatData:se.chatData,assistantChatProps:e.__assign(e.__assign({},null===(N=null===(M=null==se?void 0:se.detailedTab)||void 0===M?void 0:M.view)||void 0===N?void 0:N.assistantChatProps),{renderers:null!==(O=null===(Y=null===(W=null==se?void 0:se.detailedTab)||void 0===W?void 0:W.detailedViewRenderer)||void 0===Y?void 0:Y.assistantText)&&void 0!==O?O:Ve}),userChatItemProps:e.__assign(e.__assign({},null===(Q=null===(K=null==se?void 0:se.detailedTab)||void 0===K?void 0:K.view)||void 0===Q?void 0:Q.userChatItemProps),{renderers:null!==(J=null===(G=null===(U=null==se?void 0:se.detailedTab)||void 0===U?void 0:U.detailedViewRenderer)||void 0===G?void 0:G.userText)&&void 0!==J?J:Ve})})})),(null===(X=null===(L=null==se?void 0:se.summarizedTab)||void 0===L?void 0:L.chip)||void 0===X?void 0:X.show)&&(null===($=null===(Z=null==se?void 0:se.summarizedTab)||void 0===Z?void 0:Z.chip)||void 0===$?void 0:$.isActive)&&l.jsx(d.default,e.__assign({chatData:se.chatData},null===(ee=null==se?void 0:se.summarizedTab)||void 0===ee?void 0:ee.view,{renderer:null!==(oe=null===(le=null==se?void 0:se.summarizedTab)||void 0===le?void 0:le.summarizedViewRenderer)&&void 0!==oe?oe:Ve}))]}))}))}))]}));return be?l.jsx(o.default,e.__assign({title:null==re?void 0:re.title,slotStyles:{title:null===(ie=null==re?void 0:re.slotStyles)||void 0===ie?void 0:ie.title},containerStyles:null===(ne=null==re?void 0:re.slotStyles)||void 0===ne?void 0:ne.container,icon:null!==(te=null==re?void 0:re.icon)&&void 0!==te?te:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==re?void 0:re.secondaryActions)?re.secondaryActions(Ne):Ne},{children:Ke})):Ke};
|
|
2
2
|
//# sourceMappingURL=InternalChatCitationRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),s=require("../assets/cw_chat.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var i=require("../utils/helpers.js"),r=require("./MarkdownRenderer.js"),a={rootRow:{display:"flex",gap:4},avatar:{width:24,height:24,flexShrink:0},contentColumn:{display:"flex",flexDirection:"column",gap:4},messageText:{fontSize:14,fontWeight:400},footerText:{fontSize:10,fontWeight:400,color:"#94A3B8"}};exports.default=function(l){var n=l.chatDetails,o=l.image,h=l.timestampFormat,d=void 0===h?"h:mm A | D MMM YYYY":h,g=l.maxWidthOfTextInPercent,u=void 0===g?60:g;l.slotClassname;var m=l.slotProps,c=l.slotStyles,x=l.renderers,_=Array.isArray(n.highlighted_text)?n.highlighted_text:[n.highlighted_text],f=i.highlightContent(n.message,_,"user-chat-highlight");return t.jsx("div",e.__assign({style:{maxWidth:"".concat(u,"%")}},{children:t.jsxs("div",e.__assign({style:a.rootRow},{children:[null!=o?o:t.jsx("span",e.__assign({style:a.avatar},{children:t.jsx("img",{src:s.default,alt:"CW Chat"})})),t.jsxs("div",e.__assign({style:a.contentColumn},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},a.messageText),null==c?void 0:c.message)},null==m?void 0:m.message,{children:t.jsx(r.default,{content:f,renderers:x})})),t.jsxs("p",e.__assign({style:e.__assign(e.__assign({},a.footerText),null==c?void 0:c.footerText)},null==m?void 0:m.footerText,{children:[n.userName," |"," ",n.timeStamp.format(d)]}))]}))]}))}))};
|
|
2
2
|
//# sourceMappingURL=AssistantChatItem.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={container:{border:"1px solid #E2E8F0",padding:12,paddingBottom:0,borderRadius:8,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column"},headerRow:{display:"flex",flexDirection:"row",gap:16,justifyContent:"space-between",alignItems:"center",height:18},leftRow:{display:"flex",flexDirection:"row",gap:12,alignItems:"center"},iconTitleRow:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"},titleText:{fontSize:14,fontWeight:700,color:"#5928ED"},actionsRow:{display:"flex",flexDirection:"row",gap:6,alignItems:"center"},body:{paddingTop:12,paddingBottom:12,flex:1}};exports.default=function(s){var t=s.title,o=void 0===t?"User Chat":t,r=s.icon,l=s.slotStyles,a=s.primaryActions,d=s.secondaryActions,c=s.children;return i.jsxs("div",e.__assign({style:n.container},{children:[i.jsxs("div",e.__assign({style:e.__assign(e.__assign({},n.headerRow),{overflowX:"auto",minHeight:"2.18rem",overflowY:"hidden",scrollbarWidth:"thin"})},{children:[i.jsxs("div",e.__assign({style:n.leftRow},{children:[i.jsxs("div",e.__assign({style:n.iconTitleRow},{children:[i.jsx("span",{children:r}),i.jsx("span",e.__assign({style:e.__assign(e.__assign({},n.titleText),null==l?void 0:l.title)},{children:o}))]})),i.jsx("div",e.__assign({style:n.actionsRow},{children:null==a?void 0:a.filter(function(e){return void 0!==e}).map(function(e,n){return i.jsx("span",{children:e},n)})}))]})),i.jsx("div",e.__assign({style:e.__assign(e.__assign({},n.actionsRow),{gap:16,alignItems:"center"})},{children:null==d?void 0:d.filter(function(e){return void 0!==e}).map(function(e,n){return i.jsx("span",{children:e},n)})}))]})),i.jsx("div",e.__assign({style:n.body,id:"body"},{children:c}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n={container:{border:"1px solid #E2E8F0",padding:12,paddingBottom:0,borderRadius:8,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column"},headerRow:{display:"flex",flexDirection:"row",gap:16,justifyContent:"space-between",alignItems:"center",height:18},leftRow:{display:"flex",flexDirection:"row",gap:12,alignItems:"center"},iconTitleRow:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"},titleText:{fontSize:14,fontWeight:700,color:"#5928ED"},actionsRow:{display:"flex",flexDirection:"row",gap:6,alignItems:"center"},body:{paddingTop:12,paddingBottom:12,flex:1}};exports.default=function(s){var t=s.title,o=void 0===t?"User Chat":t,r=s.icon,l=s.slotStyles,a=s.primaryActions,d=s.secondaryActions,c=s.children,g=s.containerStyles;return i.jsxs("div",e.__assign({style:e.__assign(e.__assign({},n.container),g)},{children:[i.jsxs("div",e.__assign({style:e.__assign(e.__assign({},n.headerRow),{overflowX:"auto",minHeight:"2.18rem",overflowY:"hidden",scrollbarWidth:"thin"})},{children:[i.jsxs("div",e.__assign({style:n.leftRow},{children:[i.jsxs("div",e.__assign({style:n.iconTitleRow},{children:[i.jsx("span",{children:r}),i.jsx("span",e.__assign({style:e.__assign(e.__assign({},n.titleText),null==l?void 0:l.title)},{children:o}))]})),i.jsx("div",e.__assign({style:n.actionsRow},{children:null==a?void 0:a.filter(function(e){return void 0!==e}).map(function(e,n){return i.jsx("span",{children:e},n)})}))]})),i.jsx("div",e.__assign({style:e.__assign(e.__assign({},n.actionsRow),{gap:16,alignItems:"center"})},{children:null==d?void 0:d.filter(function(e){return void 0!==e}).map(function(e,n){return i.jsx("span",{children:e},n)})}))]})),i.jsx("div",e.__assign({style:n.body,id:"body"},{children:c}))]}))};
|
|
2
2
|
//# sourceMappingURL=ChatCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),r=require("./MarkdownRenderer.js"),s=require("../utils/helpers.js");exports.default=function(l){var n=l.chatData,a=l.slotStyles,d=l.slotProps,g=l.renderer,h=i.useMemo(function(){for(var e=[],t=0;t<n.length;t+=2)e.push([n[t],n[t+1]]);return e},[n]);return t.jsx("div",e.__assign({style:{paddingLeft:"16px",paddingRight:"16px"}},{children:t.jsx("ol",e.__assign({style:null==a?void 0:a.ul},null==d?void 0:d.ul,{children:h.map(function(i,l){return t.jsx("li",e.__assign({style:e.__assign({display:"list-item",marginLeft:"16px",padding:"16px",paddingLeft:0},null==a?void 0:a.li)},null==d?void 0:d.li,{children:t.jsx("div",e.__assign({style:{display:"flex",flexDirection:"row",alignItems:"start",gap:"4px"}},{children:t.jsx("span",e.__assign({style:e.__assign({fontSize:"14px",fontWeight:"600"},null==a?void 0:a.text)},null==d?void 0:d.text,{children:t.jsx(r.default,{content:s.highlightContent("".concat(i[0].message,': "').concat(i[1].message,'"'),e.__spreadArray(e.__spreadArray([],Array.isArray(i[0].highlighted_text)?i[0].highlighted_text:[i[0].highlighted_text],!0),Array.isArray(i[1].highlighted_text)?i[1].highlighted_text:[i[1].highlighted_text],!0)),renderers:g})}))}))}),l)})}))}))};
|
|
2
2
|
//# sourceMappingURL=SummarizedView.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("../utils/helpers.js"),s=require("./MarkdownRenderer.js"),r=require("./UserInitialsAsAvatar.js");exports.default=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("../utils/helpers.js"),s=require("./MarkdownRenderer.js"),r=require("./UserInitialsAsAvatar.js");exports.default=function(l){var n=l.chatDetails,a=l.image,o=l.timestampFormat,h=void 0===o?"h:mm A | D MMM YYYY":o,d=l.maxWidthOfTextInPercent,g=void 0===d?60:d;l.slotClassname;var m=l.slotProps,x=l.slotStyles,u=l.renderers,f=Array.isArray(n.highlighted_text)?n.highlighted_text:[n.highlighted_text],c=i.highlightContent(n.message,f,"user-chat-highlight"),p=n.timeStamp&&"function"==typeof n.timeStamp.format?n.timeStamp.format(h):String(n.timeStamp);return t.jsx("div",e.__assign({style:{maxWidth:"".concat(g,"%")}},{children:t.jsxs("div",e.__assign({style:{display:"flex",gap:"4px"}},{children:[t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"4px"}},{children:[t.jsx("p",e.__assign({style:e.__assign({fontWeight:400,fontSize:14,textAlign:"right"},null==x?void 0:x.message)},null==m?void 0:m.message,{children:t.jsx(s.default,{content:c,renderers:u})})),t.jsxs("p",e.__assign({style:e.__assign({fontWeight:400,fontSize:10,color:"#94A3B8",textAlign:"right"},null==x?void 0:x.footerText)},null==m?void 0:m.footerText,{children:[n.userName," |"," ",p]}))]})),null!=a?a:t.jsx(r.default,{username:n.userName,containerStyle:{flexShrink:0,width:28,height:28},textStyle:{fontSize:12}})]}))}))};
|
|
2
2
|
//# sourceMappingURL=UserChatItem.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.getColorCode=function(e){return e>80?{border:"#22c55e",background:"#f0fdf4",text:"#16a34a",combined:""}:e<=80&&e>=60?{border:"#eab308",background:"#fefce8",text:"#eab308",combined:""}:{border:"#ef4444",background:"#fef2f2",text:"#dc2626",combined:""}},exports.highlightContent=function(e,t,n){if(void 0===n&&(n=void 0),!e||0===t.length)return e;var r=t.filter(function(e){return e.trim().length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).sort(function(e,t){return t.length-e.length});if(0===r.length)return e;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.getColorCode=function(e){return e>80?{border:"#22c55e",background:"#f0fdf4",text:"#16a34a",combined:""}:e<=80&&e>=60?{border:"#eab308",background:"#fefce8",text:"#eab308",combined:""}:{border:"#ef4444",background:"#fef2f2",text:"#dc2626",combined:""}},exports.highlightContent=function(e,t,n){if(void 0===n&&(n=void 0),!e||0===t.length)return e;var r=t.filter(function(e){return e.trim().length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).sort(function(e,t){return t.length-e.length});if(0===r.length)return e;var i=new RegExp("(".concat(r.join("|"),")"),"gi");return e.replace(i,function(e){return e.split("\n").map(function(e){return 0===e.trim().length?e:"<highlight ".concat(n?'class="'.concat(n,'"'):"",">").concat(e,"</highlight>")}).join("\n")})},exports.removeAgentNameLines=function(e){return e.split("\n").filter(function(e){return!e.includes("AgentName:")}).join("\n")},exports.removeMetadataTags=function(e){return e?e.replace(/\[\[citations:.*?\]\]|\[\[filename:.*?\]\]|\[\[cat_id:.*?\]\]|\[\[rationale_index:.*?\]\]/g,"").replace(/\s*\]\s*$/,"").trim():""};
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as e,__assign as t}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as r,useMemo as o,useEffect as l}from"react";import{highlightTermsFunc as s}from"../utils/highlight.js";import{sanitizeHtml as a}from"../../../utils/sanitizeHtml.js";var d={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}},
|
|
1
|
+
import{__spreadArray as e,__assign as t}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as r,useMemo as o,useEffect as l}from"react";import{highlightTermsFunc as s}from"../utils/highlight.js";import{sanitizeHtml as a}from"../../../utils/sanitizeHtml.js";var d={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}},c=function(c){var u,g,p,h,m,b,f,v,x,y,C,w,T,N=c.data,k=c.highlightTerms,S=c.onHighlightMatch,I=r(!1),L=I[0],_=I[1],A=r(!1),M=A[0],B=A[1],D=o(function(){return L?N.subjectCategories||[]:(N.subjectCategories||[]).slice(0,10)},[L,N.subjectCategories]);return l(function(){var t,n;if(k&&0!==k.length){var i=e(e([N.isbn,N.isbn10,N.imprint,N.publisher,N.publishingDate,N.age],null!==(t=N.subjectCategories)&&void 0!==t?t:[],!0),null!==(n=N.reviews)&&void 0!==n?n:[],!0).some(function(e){if(!e)return!1;var t=String(e).toLowerCase();return k.some(function(e){return t.includes(e.toLowerCase())})});null==S||S(i)}},[k,N]),n("div",t({style:d.container,className:"book-details-container"},{children:[i("p",t({style:d.sectionTitle,className:"book-details-section-title"},{children:"Product Details"})),n("div",t({style:d.detailsContainer,className:"book-details-details-container"},{children:[n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"ISBN:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(u=N.isbn)&&void 0!==u?u:"NA",k))}}):null!==(g=N.isbn)&&void 0!==g?g:"NA"]})),n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"ISBN 10:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(p=N.isbn10)&&void 0!==p?p:"NA",k))}}):null!==(h=N.isbn10)&&void 0!==h?h:"NA"]})),n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"Imprint:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(m=N.imprint)&&void 0!==m?m:"NA",k))}}):null!==(b=N.imprint)&&void 0!==b?b:"NA"]})),n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"Publisher:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(f=N.publisher)&&void 0!==f?f:"NA",k))}}):null!==(v=N.publisher)&&void 0!==v?v:"NA"]})),n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"Publishing Date:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(x=N.publishingDate)&&void 0!==x?x:"NA",k))}}):null!==(y=N.publishingDate)&&void 0!==y?y:"NA"]})),n("p",t({style:d.detailsContainerItem},{children:[i("span",t({style:d.boldText},{children:"Age:"}))," ",k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(C=N.age)&&void 0!==C?C:"NA",k))}}):null!==(w=N.age)&&void 0!==w?w:"NA"]}))]})),n("div",t({style:d.categoriesContainer},{children:[i("p",t({style:d.sectionTitle,className:"book-details-section-title"},{children:"Subject Categories"})),n("div",t({style:d.categoriesList,className:"book-details-categories-list"},{children:[D.map(function(e,n){return i("span",t({style:d.category,className:"book-details-category"},{children:k&&k.length>0?i("span",{dangerouslySetInnerHTML:{__html:a(s(e,k))}}):e}),n)}),N.subjectCategories&&N.subjectCategories.length>10&&i("button",t({style:d.button,onClick:function(){return _(!L)},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:L?"View less":"View more"}))]}))]})),n("div",t({style:d.reviewsContainer},{children:[i("p",t({style:d.sectionTitle,className:"book-details-section-title"},{children:"Book Marketing Collateral"})),n("div",t({style:d.reviewsList,className:"book-details-reviews-list"},{children:[N.reviews&&N.reviews.length>0?(T=N.reviews.filter(function(e){return e.replace(/<[^>]+>/g,"").trim().replace(/&[#A-Za-z0-9]+;/g,"").trim().length>0}),(M?T:T.slice(0,3)).map(function(e,n){return i("div",t({style:d.reviewCard,className:"book-details-review-card"},{children:i("div",{style:d.reviewText,dangerouslySetInnerHTML:{__html:k&&k.length>0?a(s(e,k)):e}})}),n)})):i("p",t({style:d.reviewText},{children:"No Book Marketing Collateral available for this book."})),N.reviews&&N.reviews.length>3&&i("button",t({style:d.button,onClick:function(){return B(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:M?"View less":"View more"}))]}))]}))]}))};export{c as default};
|
|
2
2
|
//# sourceMappingURL=BookDetailsCard.js.map
|