@e-llm-studio/citation 0.0.135 → 0.0.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),l=require("remark-breaks"),o=require("rehype-raw"),s=require("../utils/highlight.js"),r=require("../../../utils/sanitizeHtml.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(i),c=a(l),d=a(o),g={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,o,a,h,m,p,_,x,v,f,y,b,j,k,T,S=i.data,C=i.highlightTerms,N=i.onHighlightMatch,H=n.useState(!1),L=H[0],B=H[1],w=n.useState(!1),F=w[0],I=w[1],z=n.useState(!1),M=z[0],D=z[1],O=n.useState(!1),A=O[0],E=O[1],W=n.useRef(null),q=n.useRef(null),P=(null==S?void 0:S.tableOfContent)&&S.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),R=null===(h=null===(a=null===(o=null===(l=null==S?void 0:S.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===o?void 0:o.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===a?void 0:a.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===h?void 0:h.replace(/overflow:\s*hidden;?/g,"");return n.useLayoutEffect(function(){if(W.current){var e=W.current.scrollHeight>W.current.clientHeight;E(e)}},[null==S?void 0:S.bookDescription,F]),n.useEffect(function(){var e;if(null==C?void 0:C.length){var t=C.map(function(e){return e.toLowerCase()}),n=function(e){return e&&t.some(function(t){return e.toLowerCase().includes(t)})},i=n(S.title),l=n(S.author),o=n(S.bookDescription),s=n(S.summary),r=n(S.totalSectionCount.toString()),a=n(S.totalPages.toString()),u=n(S.readingTime),c=null===(e=null==S?void 0:S.tableOfContent)||void 0===e?void 0:e.some(function(e){var t;return n(null==e?void 0:e.title)||(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.some(function(e){return n(null==e?void 0:e.title)}))}),d=i||l||o||s||r||a||u||c;null==N||N(d),d&&(o&&I(!0),s&&B(!0),c&&D(!0))}},[C,S]),t.jsxs("div",e.__assign({ref:q,style:g.card,className:"book-card-container"},{children:[t.jsxs("div",e.__assign({style:g.grid,className:"book-card-grid"},{children:[t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Title"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.title,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(m=null==S?void 0:S.title)&&void 0!==m?m:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.title},{children:null!==(p=null==S?void 0:S.title)&&void 0!==p?p:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Author"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.author,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(_=null==S?void 0:S.author)&&void 0!==_?_:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.author},{children:null!==(x=null==S?void 0:S.author)&&void 0!==x?x:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Sections"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(v=String(null==S?void 0:S.totalSectionCount))&&void 0!==v?v:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(f=null==S?void 0:S.totalSectionCount)&&void 0!==f?f:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Pages"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(y=null==S?void 0:S.totalPages)&&void 0!==y?y:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(b=null==S?void 0:S.totalPages)&&void 0!==b?b:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Reading Time"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(j=null==S?void 0:S.readingTime)&&void 0!==j?j:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(k=null==S?void 0:S.readingTime)&&void 0!==k?k:"NA"}))]}))]})),(null==S?void 0:S.bookDescription)&&(null==S?void 0:S.bookDescription.length)>0&&t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"Book Description"})),t.jsx("div",e.__assign({ref:W,className:"book-card-section-text",style:e.__assign(e.__assign(e.__assign({},g.sectionText),g.summaryText),F?{}:g.lineClamp)},{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(R||"",C)):R}})})),(A||F)&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return I(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:F?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"AI Book Summary"})),t.jsx("p",e.__assign({className:"book-card-section-text",style:e.__assign(e.__assign({},g.sectionText),L?{}:g.lineClamp)},{children:t.jsx(u.default,e.__assign({remarkPlugins:[c.default],rehypePlugins:[d.default],components:{p:function(n){n.node;var i=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:s.processTextWithHighlight(null==S?void 0:S.summary,C)}))})),(null==S?void 0:S.summary)&&(null==S?void 0:S.summary.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),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:L?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.section),{marginTop:"10px"})},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),t.jsx("div",e.__assign({style:e.__assign(e.__assign({},g.container),M?{}:g.lineClamp)},{children:(null==S?void 0:S.tableOfContent)&&!P?null===(T=null==S?void 0:S.tableOfContent)||void 0===T?void 0:T.map(function(n,i){return t.jsx("div",e.__assign({style:g.partContainer},{children:n.children?t.jsxs(t.Fragment,{children:[t.jsx("p",{style:g.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}}),t.jsx("ul",e.__assign({style:g.chapterList},{children:n.children.map(function(n,i){return t.jsx("li",e.__assign({style:g.chapterItem},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}),i)})}))]}):t.jsx("div",e.__assign({style:g.singleChapter},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):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==S?void 0:S.tableOfContent)&&!P&&(null==S?void 0:S.tableOfContent.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.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:M?"View Less":"View More"}))]}))]}))};
|
|
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"),o=require("rehype-raw"),s=require("../utils/highlight.js"),r=require("../../../utils/sanitizeHtml.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(i),c=a(l),d=a(o),g={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,o,a,h,m,p,_,x,v,f,y,b,j,k,T,S=i.data,C=i.highlightTerms,N=i.onHighlightMatch,H=n.useState(!1),L=H[0],B=H[1],w=n.useState(!1),F=w[0],I=w[1],z=n.useState(!1),M=z[0],D=z[1],O=n.useState(!1),A=O[0],E=O[1],W=n.useRef(null),q=n.useRef(null),P=(null==S?void 0:S.tableOfContent)&&S.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),R=null===(h=null===(a=null===(o=null===(l=null==S?void 0:S.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===o?void 0:o.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===a?void 0:a.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===h?void 0:h.replace(/overflow:\s*hidden;?/g,""),V=function(e){return null!=e?String(e):""};return n.useLayoutEffect(function(){if(W.current){var e=W.current.scrollHeight>W.current.clientHeight;E(e)}},[null==S?void 0:S.bookDescription,F]),n.useEffect(function(){var e;if(null==C?void 0:C.length){var t=C.map(function(e){return e.toLowerCase()}),n=function(e){return e&&t.some(function(t){return e.toLowerCase().includes(t)})},i=n(S.title),l=n(S.author),o=n(S.bookDescription),s=n(S.summary),r=n(V(null==S?void 0:S.totalSectionCount)),a=n(V(null==S?void 0:S.totalPages)),u=n(S.readingTime),c=null===(e=null==S?void 0:S.tableOfContent)||void 0===e?void 0:e.some(function(e){var t;return n(null==e?void 0:e.title)||(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.some(function(e){return n(null==e?void 0:e.title)}))}),d=i||l||o||s||r||a||u||c;null==N||N(d),d&&(o&&I(!0),s&&B(!0),c&&D(!0))}},[C,S]),t.jsxs("div",e.__assign({ref:q,style:g.card,className:"book-card-container"},{children:[t.jsxs("div",e.__assign({style:g.grid,className:"book-card-grid"},{children:[t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Title"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.title,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(m=null==S?void 0:S.title)&&void 0!==m?m:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.title},{children:null!==(p=null==S?void 0:S.title)&&void 0!==p?p:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Author"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.author,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(_=null==S?void 0:S.author)&&void 0!==_?_:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.author},{children:null!==(x=null==S?void 0:S.author)&&void 0!==x?x:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Sections"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(v=String(null==S?void 0:S.totalSectionCount))&&void 0!==v?v:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(f=null==S?void 0:S.totalSectionCount)&&void 0!==f?f:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Pages"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(y=null==S?void 0:S.totalPages)&&void 0!==y?y:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(b=null==S?void 0:S.totalPages)&&void 0!==b?b:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Reading Time"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(j=null==S?void 0:S.readingTime)&&void 0!==j?j:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(k=null==S?void 0:S.readingTime)&&void 0!==k?k:"NA"}))]}))]})),(null==S?void 0:S.bookDescription)&&(null==S?void 0:S.bookDescription.length)>0&&t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"Book Description"})),t.jsx("div",e.__assign({ref:W,className:"book-card-section-text",style:e.__assign(e.__assign(e.__assign({},g.sectionText),g.summaryText),F?{}:g.lineClamp)},{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(R||"",C)):R}})})),(A||F)&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return I(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:F?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"AI Book Summary"})),t.jsx("p",e.__assign({className:"book-card-section-text",style:e.__assign(e.__assign({},g.sectionText),L?{}:g.lineClamp)},{children:t.jsx(u.default,e.__assign({remarkPlugins:[c.default],rehypePlugins:[d.default],components:{p:function(n){n.node;var i=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:s.processTextWithHighlight(null==S?void 0:S.summary,C)}))})),(null==S?void 0:S.summary)&&(null==S?void 0:S.summary.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),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:L?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.section),{marginTop:"10px"})},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),t.jsx("div",e.__assign({style:e.__assign(e.__assign({},g.container),M?{}:g.lineClamp)},{children:(null==S?void 0:S.tableOfContent)&&!P?null===(T=null==S?void 0:S.tableOfContent)||void 0===T?void 0:T.map(function(n,i){return t.jsx("div",e.__assign({style:g.partContainer},{children:n.children?t.jsxs(t.Fragment,{children:[t.jsx("p",{style:g.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}}),t.jsx("ul",e.__assign({style:g.chapterList},{children:n.children.map(function(n,i){return t.jsx("li",e.__assign({style:g.chapterItem},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}),i)})}))]}):t.jsx("div",e.__assign({style:g.singleChapter},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):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==S?void 0:S.tableOfContent)&&!P&&(null==S?void 0:S.tableOfContent.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.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:M?"View Less":"View More"}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as t}from"tslib";import{jsxs as n,jsx as l,Fragment as o}from"react/jsx-runtime";import{useState as i,useRef as r,useLayoutEffect as a,useEffect as d}from"react";import c from"react-markdown";import u from"remark-breaks";import s from"rehype-raw";import{highlightTermsFunc as p,processTextWithHighlight as m}from"../utils/highlight.js";import{sanitizeHtml as
|
|
1
|
+
import{__assign as e,__rest as t}from"tslib";import{jsxs as n,jsx as l,Fragment as o}from"react/jsx-runtime";import{useState as i,useRef as r,useLayoutEffect as a,useEffect as d}from"react";import c from"react-markdown";import u from"remark-breaks";import s from"rehype-raw";import{highlightTermsFunc as p,processTextWithHighlight as m}from"../utils/highlight.js";import{sanitizeHtml as h}from"../../../utils/sanitizeHtml.js";var g={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"}},v=function(v){var f,y,b,x,k,T,C,S,N,L,B,w,I,D,M,_=v.data,H=v.highlightTerms,O=v.onHighlightMatch,A=i(!1),z=A[0],F=A[1],W=i(!1),E=W[0],P=W[1],V=i(!1),j=V[0],R=V[1],q=i(!1),G=q[0],J=q[1],K=r(null),Q=r(null),U=(null==_?void 0:_.tableOfContent)&&_.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),X=null===(x=null===(b=null===(y=null===(f=null==_?void 0:_.bookDescription)||void 0===f?void 0:f.replace(/display:\s*-webkit-box;?/g,""))||void 0===y?void 0:y.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===b?void 0:b.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===x?void 0:x.replace(/overflow:\s*hidden;?/g,""),Y=function(e){return null!=e?String(e):""};return a(function(){if(K.current){var e=K.current.scrollHeight>K.current.clientHeight;J(e)}},[null==_?void 0:_.bookDescription,E]),d(function(){var e;if(null==H?void 0:H.length){var t=H.map(function(e){return e.toLowerCase()}),n=function(e){return e&&t.some(function(t){return e.toLowerCase().includes(t)})},l=n(_.title),o=n(_.author),i=n(_.bookDescription),r=n(_.summary),a=n(Y(null==_?void 0:_.totalSectionCount)),d=n(Y(null==_?void 0:_.totalPages)),c=n(_.readingTime),u=null===(e=null==_?void 0:_.tableOfContent)||void 0===e?void 0:e.some(function(e){var t;return n(null==e?void 0:e.title)||(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.some(function(e){return n(null==e?void 0:e.title)}))}),s=l||o||i||r||a||d||c||u;null==O||O(s),s&&(i&&P(!0),r&&F(!0),u&&R(!0))}},[H,_]),n("div",e({ref:Q,style:g.card,className:"book-card-container"},{children:[n("div",e({style:g.grid,className:"book-card-grid"},{children:[n("div",e({style:g.gridItem},{children:[l("p",e({style:g.label},{children:"Book Title"})),H&&H.length>0?l("p",{style:g.value,className:"book-card-value",title:null==_?void 0:_.title,dangerouslySetInnerHTML:{__html:h(p(null!==(k=null==_?void 0:_.title)&&void 0!==k?k:"NA",H))}}):l("p",e({style:g.value,className:"book-card-value",title:null==_?void 0:_.title},{children:null!==(T=null==_?void 0:_.title)&&void 0!==T?T:"NA"}))]})),n("div",e({style:g.gridItem},{children:[l("p",e({style:g.label},{children:"Book Author"})),H&&H.length>0?l("p",{style:g.value,className:"book-card-value",title:null==_?void 0:_.author,dangerouslySetInnerHTML:{__html:h(p(null!==(C=null==_?void 0:_.author)&&void 0!==C?C:"NA",H))}}):l("p",e({style:g.value,className:"book-card-value",title:null==_?void 0:_.author},{children:null!==(S=null==_?void 0:_.author)&&void 0!==S?S:"NA"}))]})),n("div",e({style:g.gridItem},{children:[l("p",e({style:g.label},{children:"Total Sections"})),H&&H.length>0?l("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:h(p(null!==(N=String(null==_?void 0:_.totalSectionCount))&&void 0!==N?N:"NA",H))}}):l("p",e({style:g.value,className:"book-card-value"},{children:null!==(L=null==_?void 0:_.totalSectionCount)&&void 0!==L?L:"NA"}))]})),n("div",e({style:g.gridItem},{children:[l("p",e({style:g.label},{children:"Total Pages"})),H&&H.length>0?l("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:h(p(String(null!==(B=null==_?void 0:_.totalPages)&&void 0!==B?B:"NA"),H))}}):l("p",e({style:g.value,className:"book-card-value"},{children:null!==(w=null==_?void 0:_.totalPages)&&void 0!==w?w:"NA"}))]})),n("div",e({style:g.gridItem},{children:[l("p",e({style:g.label},{children:"Reading Time"})),H&&H.length>0?l("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:h(p(String(null!==(I=null==_?void 0:_.readingTime)&&void 0!==I?I:"NA"),H))}}):l("p",e({style:g.value,className:"book-card-value"},{children:null!==(D=null==_?void 0:_.readingTime)&&void 0!==D?D:"NA"}))]}))]})),(null==_?void 0:_.bookDescription)&&(null==_?void 0:_.bookDescription.length)>0&&n("div",e({style:g.section,className:"book-card-section"},{children:[l("p",e({style:g.sectionLabel},{children:"Book Description"})),l("div",e({ref:K,className:"book-card-section-text",style:e(e(e({},g.sectionText),g.summaryText),E?{}:g.lineClamp)},{children:l("div",{dangerouslySetInnerHTML:{__html:H&&H.length>0?h(p(X||"",H)):X}})})),(G||E)&&l("button",e({style:e(e({},g.button),{marginBottom:"10px"}),onClick:function(){return P(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:E?"View Less":"View More"}))]})),n("div",e({style:g.section,className:"book-card-section"},{children:[l("p",e({style:g.sectionLabel},{children:"AI Book Summary"})),l("p",e({className:"book-card-section-text",style:e(e({},g.sectionText),z?{}:g.lineClamp)},{children:l(c,e({remarkPlugins:[u],rehypePlugins:[s],components:{p:function(n){n.node;var o=t(n,["node"]);return l("p",e({style:{marginTop:"0"}},o))}}},{children:m(null==_?void 0:_.summary,H)}))})),(null==_?void 0:_.summary)&&(null==_?void 0:_.summary.length)>0&&l("button",e({style:e(e({},g.button),{marginBottom:"10px"}),onClick:function(){return F(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:z?"View Less":"View More"}))]})),n("div",e({style:e(e({},g.section),{marginTop:"10px"})},{children:[l("p",e({style:e(e({},g.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),l("div",e({style:e(e({},g.container),j?{}:g.lineClamp)},{children:(null==_?void 0:_.tableOfContent)&&!U?null===(M=null==_?void 0:_.tableOfContent)||void 0===M?void 0:M.map(function(t,i){return l("div",e({style:g.partContainer},{children:t.children?n(o,{children:[l("p",{style:g.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:H&&H.length>0?h(p(t.title,H)):t.title}}),l("ul",e({style:g.chapterList},{children:t.children.map(function(t,n){return l("li",e({style:g.chapterItem},{children:l("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:H&&H.length>0?h(p(t.title,H)):t.title}})}),n)})}))]}):l("div",e({style:g.singleChapter},{children:l("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:H&&H.length>0?h(p(t.title,H)):t.title}})}))}),i)}):l("p",e({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==_?void 0:_.tableOfContent)&&!U&&(null==_?void 0:_.tableOfContent.length)>0&&l("button",e({style:e(e({},g.button),{marginBottom:"10px"}),onClick:function(){return R(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:j?"View Less":"View More"}))]}))]}))};export{v as default};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookOverviewCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/Bookemon/BookOverviewCard/BookOverviewCard.tsx"],"names":[],"mappings":"AAMA,OAAO,wBAAwB,CAAC;AAwIhC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,iBAAiB,EAAG,MAAM,CAAC;IAC3B,eAAe,EAAG,MAAM,CAAC;IACzB,cAAc,EAAG,GAAG,EAAE,CAAA;CACvB;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAED,QAAA,MAAM,gBAAgB,+CAAgD,qBAAqB,
|
|
1
|
+
{"version":3,"file":"BookOverviewCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/Bookemon/BookOverviewCard/BookOverviewCard.tsx"],"names":[],"mappings":"AAMA,OAAO,wBAAwB,CAAC;AAwIhC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,iBAAiB,EAAG,MAAM,CAAC;IAC3B,eAAe,EAAG,MAAM,CAAC;IACzB,cAAc,EAAG,GAAG,EAAE,CAAA;CACvB;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAED,QAAA,MAAM,gBAAgB,+CAAgD,qBAAqB,4CAqP1F,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|