@e-llm-studio/citation 0.0.73 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/BookCitation/BookCitation.js +1 -1
- package/dist/cjs/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/features/BookCitation/BookCitation.js +1 -1
- package/dist/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/types/src/features/BookCitation/BookCitation.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookOverviewCard/BookOverviewCard.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.mjs.js"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.mjs.js"),n=require("react/jsx-runtime"),a=require("react"),t=require("./BookCitation.module.css.js"),s=require("./text-cleaner.js");exports.default=function(i){var o=i.title,l=i.author,r=i.paragraphs,c=i.chevronUpComponent,d=i.chevronDownComponent,u=i.externalLinkComponent,p=i.textToHighlight,v=i.pageNumber,f=i.totalPageNumber,g=void 0===f?null:f,m=i.citationTitle,h=i.customStyle,x=void 0===h?{}:h,_=i.handleExternalLinkClick,b=i.bookCoverImage,y=i.partialMatch,j=void 0!==y&&y,k=i.citationNumber,N=void 0===k?1:k,C=i.defaultState,q=void 0!==C&&C;i.isNonHighlightedBlur,i.toggleBlur;var A=a.useState(q),L=A[0],T=A[1],w=["address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","li","main","nav","noscript","ol","p","pre","section","table","tfoot","ul","video"];a.useEffect((function(){if(L){var e=document.getElementById("quotes-citations-".concat(null!=N?N:""));e&&e.scrollIntoView({behavior:"smooth",block:"center"})}}),[L,p,N]);var B=function(e){void 0===e&&(e="");var n=document.createElement("div");n.innerHTML=e;var a=n.textContent||n.innerText||"";return(a=(a=a.replace(/<\/?[^>]+(>|$)/g,"")).replace(/\s+/g," ")).trim()};function E(n,a,t,s,i,o){var l;void 0===i&&(i=[]),void 0===o&&(o=!1);var r,c,d=e.__assign(e.__assign({},x.highlightedText),{backgroundColor:(null===(l=x.highlightedText)||void 0===l?void 0:l.backgroundColor)||"#eaea79",display:o?"inline":"block",padding:o?"":"2px 4px"}),u=(void 0===(r=d)&&(r={}),Object.entries(r).map((function(e){var n=e[0],a=e[1];return"".concat(n.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})),":").concat(a)})).join(";")),p=a,v=(c=document.createElement("textarea"),function(e){return c.innerHTML=e,c.value});if(i.length>0){if(o){return i.forEach((function(e){e&&(p=function(e,n,a){for(var t='<span id="'.concat(a,'" style="').concat(u,'">'),s="</span>",i=e,o=0,l=new RegExp("(<(?:".concat(w.join("|"),")[^>]*>.*?)(?=<(?:").concat(w.join("|"),")|$)"),"gi"),r=(n.match(l)||[n]).map((function(e){var n=e.match(/^<([a-zA-Z0-9]+)([^>]*)>/);if(n&&w.includes(n[1].toLowerCase())){var a=n[0].length;return n[0]+t+e.slice(a)+s}return t+e+s})).join("");;){var c=i.indexOf(n,o);if(-1===c)break;i=i.slice(0,c)+r+i.slice(c+n.length),o=c+r.length}return i.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,(function(e,n,a){return w.some((function(e){return new RegExp("<".concat(e,"\\b[^>]*>"),"i").test(a)}))&&(/style\s*=/.test(n)?/display\s*:\s*inline\b/.test(n)?n=n.replace(/display\s*:\s*inline\b/,"display:inline-block"):/display\s*:\s*inline-block\b/.test(n)||(n=n.replace(/style\s*=\s*(['"])(.*?)\1/,(function(e,n,a){return"style=".concat(n).concat(a.trim()," display:inline-block;").concat(n)}))):n+=' style="display:inline-block;"'),"<span".concat(n,">").concat(a,"</span>")}))}(p,e,"Annotation"===t?"quotes-annotations-".concat(null!=s?s:""):"quotes-citations-".concat(null!=s?s:"")))})),p}return i.forEach((function(e){var n=v(e).trim();n&&v(a).trim().toLowerCase()===n.toLowerCase()&&(p='<span id="'.concat("Annotation"===t?"quotes-annotations-".concat(null!=s?s:""):"quotes-citations-".concat(null!=s?s:""),'" style="').concat(u,'">').concat(a,"</span>"))})),p}if(!n||!a)return"Annotation"===t?a:'<span id="quotes-citations" style="'.concat(u,'">').concat(a,"</span>");var f=Array.from(n.matchAll(/`([^`]+)`/g));if(0===f.length)return"Annotation"===t?a:'<span id="quotes-citations" style="'.concat(u,'">').concat(a,"</span>");p=a;var g=!1;return f.forEach((function(e){var n=v(e[1]).trim();if(n){var a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp("(".concat(a,")"),"gi");p.match(s)&&(g=!0,p=p.replace(s,'<span id="'.concat("Annotation"===t?"quotes-annotations":"quotes-citations",'" style="').concat(u,'">$1</span>')))}})),g?p:"Annotation"===t?a:'<span id="quotes-citations" style="'.concat(u,'">').concat(a,"</span>")}return n.jsx(n.Fragment,{children:n.jsxs("span",e.__assign({className:t.default.relativeWrapper,style:null==x?void 0:x.relativeWrapper},{children:[!q&&n.jsx("div",e.__assign({className:t.default.citationButtonWrapper,style:x.citationButtonWrapper},{children:n.jsxs("div",e.__assign({onClick:function(){return T((function(e){return!e}))},className:t.default.citationButton,style:x.citationButton},{children:[n.jsx("span",e.__assign({className:t.default.citationText},{children:m})),L?c:d]}))})),L&&n.jsx("div",e.__assign({className:t.default.expandedWrapper,style:null==x?void 0:x.expandedWrapper},{children:n.jsx("div",e.__assign({className:t.default.expandableContainer,style:null==x?void 0:x.expandableContainer},{children:n.jsx("div",e.__assign({className:t.default.expandableContent,style:null==x?void 0:x.expandableContent},{children:n.jsxs("div",e.__assign({className:t.default.bookBodyContent,style:null==x?void 0:x.bookBodyContent},{children:[!q&&n.jsx("div",e.__assign({className:t.default.header},{children:n.jsxs("div",e.__assign({className:t.default.bookInfo},{children:[b&&n.jsx("div",e.__assign({className:t.default.bookImageWrapper},{children:n.jsx("img",{src:b,alt:o||"Book cover",className:t.default.bookImage})})),n.jsxs("div",e.__assign({className:t.default.bookTextInfo},{children:[n.jsx("h1",e.__assign({className:t.default.bookTitle,style:null==x?void 0:x.bookHeader},{children:o})),l||Array.isArray(l)&&n.jsxs("p",e.__assign({className:t.default.bookAuthor,style:null==x?void 0:x.bookHeader},{children:["by"," ",Array.isArray(l)?l.join(", "):l||""]}))]})),n.jsx("div",e.__assign({onClick:_,className:t.default.externalLink},{children:u}))]}))})),n.jsx("div",e.__assign({className:"relative",style:x.relative},{children:n.jsx("div",e.__assign({className:t.default.container},{children:n.jsxs("div",e.__assign({className:"".concat(t.default.contentWrapper," ").concat(t.default.customScrollbarClass),style:x.customScrollbarClass},{children:[n.jsx("div",{className:t.default.gradientOverlayLeft}),n.jsx("div",{className:t.default.gradientOverlayRight}),n.jsxs("div",e.__assign({className:t.default.contentWrapper},{children:[r.map((function(e,a){s.cleanScannedText(e);var i=!1;return i=j?e.includes(p[0]):p.some((function(n){return B(e).toLowerCase()===B(n).toLowerCase()})),n.jsx("div",{className:"".concat(t.default.paragraph," ").concat(0!==a?t.default.textIndent:""),dangerouslySetInnerHTML:{__html:i?E(r.join("\n"),e,"Citation",N,p,j):e}},a)})),v&&n.jsx("div",e.__assign({className:t.default.pageIndex},{children:n.jsxs("div",e.__assign({className:t.default.pageLabel},{children:[v," ",g&&"of ".concat(g)]}))}))]}))]}))}))}))]}))}))}))}))]}))})};
|
|
2
2
|
//# sourceMappingURL=BookCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/tslib/tslib.es6.mjs.js"),n=require("react/jsx-runtime"),t=require("react"),i=require("../../../node_modules/react-markdown/lib/react-markdown.js"),s=require("../../../node_modules/remark-breaks/lib/index.js"),o={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(r){var l,a,d,u,c,g,_=r.data,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/tslib/tslib.es6.mjs.js"),n=require("react/jsx-runtime"),t=require("react"),i=require("../../../node_modules/react-markdown/lib/react-markdown.js"),s=require("../../../node_modules/remark-breaks/lib/index.js"),o={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(r){var l,a,d,u,c,g,p,_,x,m,h=r.data,v=t.useState(!1),f=v[0],y=v[1],b=t.useState(!1),j=b[0],k=b[1],C=t.useState(!1),T=C[0],S=C[1],B=t.useState(!1),w=B[0],L=B[1],D=t.useRef(null),I=(null==h?void 0:h.tableOfContent)&&h.tableOfContent.every((function(e){return!e.title||""===e.title.trim()})),O=null===(u=null===(d=null===(a=null===(l=null==h?void 0:h.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===a?void 0:a.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===d?void 0:d.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===u?void 0:u.replace(/overflow:\s*hidden;?/g,"");return t.useLayoutEffect((function(){if(D.current){var e=D.current.scrollHeight>D.current.clientHeight;L(e)}}),[null==h?void 0:h.bookDescription,j]),n.jsxs("div",e.__assign({style:o.card},{children:[n.jsxs("div",e.__assign({style:o.grid},{children:[n.jsxs("div",e.__assign({style:o.gridItem},{children:[n.jsx("p",e.__assign({style:o.label},{children:"Book Title"})),n.jsx("p",e.__assign({style:o.value,title:null==h?void 0:h.title},{children:null!==(c=null==h?void 0:h.title)&&void 0!==c?c:"NA"}))]})),n.jsxs("div",e.__assign({style:o.gridItem},{children:[n.jsx("p",e.__assign({style:o.label},{children:"Book Author"})),n.jsx("p",e.__assign({style:o.value,title:null==h?void 0:h.author},{children:null!==(g=null==h?void 0:h.author)&&void 0!==g?g:"NA"}))]})),n.jsxs("div",e.__assign({style:o.gridItem},{children:[n.jsx("p",e.__assign({style:o.label},{children:"Total Sections"})),n.jsx("p",e.__assign({style:o.value},{children:null!==(p=null==h?void 0:h.totalSectionCount)&&void 0!==p?p:"NA"}))]})),n.jsxs("div",e.__assign({style:o.gridItem},{children:[n.jsx("p",e.__assign({style:o.label},{children:"Total Pages"})),n.jsx("p",e.__assign({style:o.value},{children:null!==(_=null==h?void 0:h.totalPages)&&void 0!==_?_:"NA"}))]})),n.jsxs("div",e.__assign({style:o.gridItem},{children:[n.jsx("p",e.__assign({style:o.label},{children:"Reading Time"})),n.jsx("p",e.__assign({style:o.value},{children:null!==(x=null==h?void 0:h.readingTime)&&void 0!==x?x:"NA"}))]}))]})),(null==h?void 0:h.bookDescription)&&(null==h?void 0:h.bookDescription.length)>0&&n.jsxs("div",e.__assign({style:o.section},{children:[n.jsx("p",e.__assign({style:o.sectionLabel},{children:"Book Description"})),n.jsx("div",e.__assign({ref:D,style:e.__assign(e.__assign(e.__assign({},o.sectionText),o.summaryText),j?{}:o.lineClamp)},{children:n.jsx("div",{dangerouslySetInnerHTML:{__html:O}})})),(w||j)&&n.jsx("button",e.__assign({style:e.__assign(e.__assign({},o.button),{marginBottom:"10px"}),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:j?"View Less":"View More"}))]})),n.jsxs("div",e.__assign({style:o.section},{children:[n.jsx("p",e.__assign({style:o.sectionLabel},{children:"AI Book Summary"})),n.jsx("p",e.__assign({style:e.__assign(e.__assign({},o.sectionText),f?{}:o.lineClamp)},{children:n.jsx(i.ReactMarkdown,e.__assign({remarkPlugins:[s.default],components:{p:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:null==h?void 0:h.summary}))})),(null==h?void 0:h.summary)&&(null==h?void 0:h.summary.length)>0&&n.jsx("button",e.__assign({style:e.__assign(e.__assign({},o.button),{marginBottom:"10px"}),onClick:function(){return y((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"}))]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},o.section),{marginTop:"10px"})},{children:[n.jsx("p",e.__assign({style:e.__assign(e.__assign({},o.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),n.jsx("div",e.__assign({style:e.__assign(e.__assign({},o.container),T?{}:o.lineClamp)},{children:(null==h?void 0:h.tableOfContent)&&!I?null===(m=null==h?void 0:h.tableOfContent)||void 0===m?void 0:m.map((function(t,i){return n.jsx("div",e.__assign({style:o.partContainer},{children:t.children?n.jsxs(n.Fragment,{children:[n.jsx("p",{style:o.partTitle,dangerouslySetInnerHTML:{__html:t.title}}),n.jsx("ul",e.__assign({style:o.chapterList},{children:t.children.map((function(t,i){return n.jsx("li",e.__assign({style:o.chapterItem},{children:n.jsx("span",{style:o.chapterLink,dangerouslySetInnerHTML:{__html:t.title}})}),i)}))}))]}):n.jsx("div",e.__assign({style:o.singleChapter},{children:n.jsx("span",{style:o.chapterLink,dangerouslySetInnerHTML:{__html:t.title}})}))}),i)})):n.jsx("p",e.__assign({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==h?void 0:h.tableOfContent)&&!I&&(null==h?void 0:h.tableOfContent.length)>0&&n.jsx("button",e.__assign({style:e.__assign(e.__assign({},o.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:T?"View Less":"View More"}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as n,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as o,useEffect as i}from"react";import r from"./BookCitation.module.css.js";import{cleanScannedText as c}from"./text-cleaner.js";var l=function(l){var s=l.title,d=l.author,u=l.paragraphs,p=l.chevronUpComponent,
|
|
1
|
+
import{__assign as e}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as n,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as o,useEffect as i}from"react";import r from"./BookCitation.module.css.js";import{cleanScannedText as c}from"./text-cleaner.js";var l=function(l){var s=l.title,d=l.author,u=l.paragraphs,p=l.chevronUpComponent,m=l.chevronDownComponent,v=l.externalLinkComponent,h=l.textToHighlight,f=l.pageNumber,g=l.totalPageNumber,b=void 0===g?null:g,y=l.citationTitle,k=l.customStyle,N=void 0===k?{}:k,x=l.handleExternalLinkClick,C=l.bookCoverImage,A=l.partialMatch,L=void 0!==A&&A,j=l.citationNumber,q=void 0===j?1:j,w=l.defaultState,B=void 0!==w&&w;l.isNonHighlightedBlur,l.toggleBlur;var T=o(B),E=T[0],I=T[1],W=["address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","li","main","nav","noscript","ol","p","pre","section","table","tfoot","ul","video"];i((function(){if(E){var e=document.getElementById("quotes-citations-".concat(null!=q?q:""));e&&e.scrollIntoView({behavior:"smooth",block:"center"})}}),[E,h,q]);var H=function(e){void 0===e&&(e="");var n=document.createElement("div");n.innerHTML=e;var t=n.textContent||n.innerText||"";return(t=(t=t.replace(/<\/?[^>]+(>|$)/g,"")).replace(/\s+/g," ")).trim()};function S(n,t,a,o,i,r){var c;void 0===i&&(i=[]),void 0===r&&(r=!1);var l,s,d=e(e({},N.highlightedText),{backgroundColor:(null===(c=N.highlightedText)||void 0===c?void 0:c.backgroundColor)||"#eaea79",display:r?"inline":"block",padding:r?"":"2px 4px"}),u=(void 0===(l=d)&&(l={}),Object.entries(l).map((function(e){var n=e[0],t=e[1];return"".concat(n.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})),":").concat(t)})).join(";")),p=t,m=(s=document.createElement("textarea"),function(e){return s.innerHTML=e,s.value});if(i.length>0){if(r){return i.forEach((function(e){e&&(p=function(e,n,t){for(var a='<span id="'.concat(t,'" style="').concat(u,'">'),o="</span>",i=e,r=0,c=new RegExp("(<(?:".concat(W.join("|"),")[^>]*>.*?)(?=<(?:").concat(W.join("|"),")|$)"),"gi"),l=(n.match(c)||[n]).map((function(e){var n=e.match(/^<([a-zA-Z0-9]+)([^>]*)>/);if(n&&W.includes(n[1].toLowerCase())){var t=n[0].length;return n[0]+a+e.slice(t)+o}return a+e+o})).join("");;){var s=i.indexOf(n,r);if(-1===s)break;i=i.slice(0,s)+l+i.slice(s+n.length),r=s+l.length}return i.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,(function(e,n,t){return W.some((function(e){return new RegExp("<".concat(e,"\\b[^>]*>"),"i").test(t)}))&&(/style\s*=/.test(n)?/display\s*:\s*inline\b/.test(n)?n=n.replace(/display\s*:\s*inline\b/,"display:inline-block"):/display\s*:\s*inline-block\b/.test(n)||(n=n.replace(/style\s*=\s*(['"])(.*?)\1/,(function(e,n,t){return"style=".concat(n).concat(t.trim()," display:inline-block;").concat(n)}))):n+=' style="display:inline-block;"'),"<span".concat(n,">").concat(t,"</span>")}))}(p,e,"Annotation"===a?"quotes-annotations-".concat(null!=o?o:""):"quotes-citations-".concat(null!=o?o:"")))})),p}return i.forEach((function(e){var n=m(e).trim();n&&m(t).trim().toLowerCase()===n.toLowerCase()&&(p='<span id="'.concat("Annotation"===a?"quotes-annotations-".concat(null!=o?o:""):"quotes-citations-".concat(null!=o?o:""),'" style="').concat(u,'">').concat(t,"</span>"))})),p}if(!n||!t)return"Annotation"===a?t:'<span id="quotes-citations" style="'.concat(u,'">').concat(t,"</span>");var v=Array.from(n.matchAll(/`([^`]+)`/g));if(0===v.length)return"Annotation"===a?t:'<span id="quotes-citations" style="'.concat(u,'">').concat(t,"</span>");p=t;var h=!1;return v.forEach((function(e){var n=m(e[1]).trim();if(n){var t=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("(".concat(t,")"),"gi");p.match(o)&&(h=!0,p=p.replace(o,'<span id="'.concat("Annotation"===a?"quotes-annotations":"quotes-citations",'" style="').concat(u,'">$1</span>')))}})),h?p:"Annotation"===a?t:'<span id="quotes-citations" style="'.concat(u,'">').concat(t,"</span>")}return n(t,{children:a("span",e({className:r.relativeWrapper,style:null==N?void 0:N.relativeWrapper},{children:[!B&&n("div",e({className:r.citationButtonWrapper,style:N.citationButtonWrapper},{children:a("div",e({onClick:function(){return I((function(e){return!e}))},className:r.citationButton,style:N.citationButton},{children:[n("span",e({className:r.citationText},{children:y})),E?p:m]}))})),E&&n("div",e({className:r.expandedWrapper,style:null==N?void 0:N.expandedWrapper},{children:n("div",e({className:r.expandableContainer,style:null==N?void 0:N.expandableContainer},{children:n("div",e({className:r.expandableContent,style:null==N?void 0:N.expandableContent},{children:a("div",e({className:r.bookBodyContent,style:null==N?void 0:N.bookBodyContent},{children:[!B&&n("div",e({className:r.header},{children:a("div",e({className:r.bookInfo},{children:[C&&n("div",e({className:r.bookImageWrapper},{children:n("img",{src:C,alt:s||"Book cover",className:r.bookImage})})),a("div",e({className:r.bookTextInfo},{children:[n("h1",e({className:r.bookTitle,style:null==N?void 0:N.bookHeader},{children:s})),d||Array.isArray(d)&&a("p",e({className:r.bookAuthor,style:null==N?void 0:N.bookHeader},{children:["by"," ",Array.isArray(d)?d.join(", "):d||""]}))]})),n("div",e({onClick:x,className:r.externalLink},{children:v}))]}))})),n("div",e({className:"relative",style:N.relative},{children:n("div",e({className:r.container},{children:a("div",e({className:"".concat(r.contentWrapper," ").concat(r.customScrollbarClass),style:N.customScrollbarClass},{children:[n("div",{className:r.gradientOverlayLeft}),n("div",{className:r.gradientOverlayRight}),a("div",e({className:r.contentWrapper},{children:[u.map((function(e,t){c(e);var a=!1;return a=L?e.includes(h[0]):h.some((function(n){return H(e).toLowerCase()===H(n).toLowerCase()})),n("div",{className:"".concat(r.paragraph," ").concat(0!==t?r.textIndent:""),dangerouslySetInnerHTML:{__html:a?S(u.join("\n"),e,"Citation",q,h,L):e}},t)})),f&&n("div",e({className:r.pageIndex},{children:a("div",e({className:r.pageLabel},{children:[f," ",b&&"of ".concat(b)]}))}))]}))]}))}))}))]}))}))}))}))]}))})};export{l as default};
|
|
2
2
|
//# sourceMappingURL=BookCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as t}from"../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as n,jsx as i,Fragment as o}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{__assign as e,__rest as t}from"../../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as n,jsx as i,Fragment as o}from"react/jsx-runtime";import{useState as l,useRef as r,useLayoutEffect as d}from"react";import{ReactMarkdown as a}from"../../../node_modules/react-markdown/lib/react-markdown.js";import c from"../../../node_modules/remark-breaks/lib/index.js";var 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"}},s=function(s){var p,m,g,h,v,x,f,y,b,k,C=s.data,T=l(!1),B=T[0],S=T[1],w=l(!1),L=w[0],D=w[1],I=l(!1),O=I[0],M=I[1],F=l(!1),_=F[0],z=F[1],A=r(null),H=(null==C?void 0:C.tableOfContent)&&C.tableOfContent.every((function(e){return!e.title||""===e.title.trim()})),W=null===(h=null===(g=null===(m=null===(p=null==C?void 0:C.bookDescription)||void 0===p?void 0:p.replace(/display:\s*-webkit-box;?/g,""))||void 0===m?void 0:m.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===g?void 0:g.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===h?void 0:h.replace(/overflow:\s*hidden;?/g,"");return d((function(){if(A.current){var e=A.current.scrollHeight>A.current.clientHeight;z(e)}}),[null==C?void 0:C.bookDescription,L]),n("div",e({style:u.card},{children:[n("div",e({style:u.grid},{children:[n("div",e({style:u.gridItem},{children:[i("p",e({style:u.label},{children:"Book Title"})),i("p",e({style:u.value,title:null==C?void 0:C.title},{children:null!==(v=null==C?void 0:C.title)&&void 0!==v?v:"NA"}))]})),n("div",e({style:u.gridItem},{children:[i("p",e({style:u.label},{children:"Book Author"})),i("p",e({style:u.value,title:null==C?void 0:C.author},{children:null!==(x=null==C?void 0:C.author)&&void 0!==x?x:"NA"}))]})),n("div",e({style:u.gridItem},{children:[i("p",e({style:u.label},{children:"Total Sections"})),i("p",e({style:u.value},{children:null!==(f=null==C?void 0:C.totalSectionCount)&&void 0!==f?f:"NA"}))]})),n("div",e({style:u.gridItem},{children:[i("p",e({style:u.label},{children:"Total Pages"})),i("p",e({style:u.value},{children:null!==(y=null==C?void 0:C.totalPages)&&void 0!==y?y:"NA"}))]})),n("div",e({style:u.gridItem},{children:[i("p",e({style:u.label},{children:"Reading Time"})),i("p",e({style:u.value},{children:null!==(b=null==C?void 0:C.readingTime)&&void 0!==b?b:"NA"}))]}))]})),(null==C?void 0:C.bookDescription)&&(null==C?void 0:C.bookDescription.length)>0&&n("div",e({style:u.section},{children:[i("p",e({style:u.sectionLabel},{children:"Book Description"})),i("div",e({ref:A,style:e(e(e({},u.sectionText),u.summaryText),L?{}:u.lineClamp)},{children:i("div",{dangerouslySetInnerHTML:{__html:W}})})),(_||L)&&i("button",e({style:e(e({},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:L?"View Less":"View More"}))]})),n("div",e({style:u.section},{children:[i("p",e({style:u.sectionLabel},{children:"AI Book Summary"})),i("p",e({style:e(e({},u.sectionText),B?{}:u.lineClamp)},{children:i(a,e({remarkPlugins:[c],components:{p:function(n){n.node;var o=t(n,["node"]);return i("p",e({style:{marginTop:"0"}},o))}}},{children:null==C?void 0:C.summary}))})),(null==C?void 0:C.summary)&&(null==C?void 0:C.summary.length)>0&&i("button",e({style:e(e({},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:B?"View Less":"View More"}))]})),n("div",e({style:e(e({},u.section),{marginTop:"10px"})},{children:[i("p",e({style:e(e({},u.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),i("div",e({style:e(e({},u.container),O?{}:u.lineClamp)},{children:(null==C?void 0:C.tableOfContent)&&!H?null===(k=null==C?void 0:C.tableOfContent)||void 0===k?void 0:k.map((function(t,l){return i("div",e({style:u.partContainer},{children:t.children?n(o,{children:[i("p",{style:u.partTitle,dangerouslySetInnerHTML:{__html:t.title}}),i("ul",e({style:u.chapterList},{children:t.children.map((function(t,n){return i("li",e({style:u.chapterItem},{children:i("span",{style:u.chapterLink,dangerouslySetInnerHTML:{__html:t.title}})}),n)}))}))]}):i("div",e({style:u.singleChapter},{children:i("span",{style:u.chapterLink,dangerouslySetInnerHTML:{__html:t.title}})}))}),l)})):i("p",e({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==C?void 0:C.tableOfContent)&&!H&&(null==C?void 0:C.tableOfContent.length)>0&&i("button",e({style:e(e({},u.button),{marginBottom:"10px"}),onClick:function(){return M((function(e){return!e}))},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:O?"View Less":"View More"}))]}))]}))};export{s as default};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/BookCitation/BookCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAI1E,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACZ,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACjC,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,UAAU,CAAC,EAAG,OAAO,CAAA;CACtB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"BookCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/BookCitation/BookCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAI1E,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACZ,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACjC,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,UAAU,CAAC,EAAG,OAAO,CAAA;CACtB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwf7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookOverviewCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/Bookemon/BookOverviewCard/BookOverviewCard.tsx"],"names":[],"mappings":"AA0IA,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;CACrB;AAED,QAAA,MAAM,gBAAgB,aAAc,qBAAqB,
|
|
1
|
+
{"version":3,"file":"BookOverviewCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/Bookemon/BookOverviewCard/BookOverviewCard.tsx"],"names":[],"mappings":"AA0IA,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;CACrB;AAED,QAAA,MAAM,gBAAgB,aAAc,qBAAqB,4CAoKxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|