@e-llm-studio/instant-learning 1.3.0-alpha.141 → 1.3.0-alpha.142

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"),i=require("react/jsx-runtime"),t=require("@e-llm-studio/citation"),n=require("react"),o=require("./_svg/ChevronDown.js"),r=require("./_svg/ChevronUp.js"),a=require("./_svg/BookIcon.js"),s=require("./_svg/CitationLinkSparkleIcon.js"),l=require("./MarkdownRenderer.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(n),p=c.default.memo(function(t){var n=t.text,o=t.highlights;if(!o||0===o.length||!n)return i.jsx("span",{children:n});var r=o.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),a=new RegExp("(".concat(r.join("|"),")"),"gi"),s=n.split(a);return i.jsx("span",{children:s.map(function(t,n){return o.some(function(e){return e.toLowerCase()===t.toLowerCase()})?i.jsx("span",e.__assign({style:{backgroundColor:"#fef08a",color:"#000"}},{children:t}),n):i.jsx("span",{children:t},n)})})}),x=c.default.memo(function(t){var n,o,r=t.citation,d=t.headerTitle,c=t.score,x=t.footerText,f=t.userPreferences,u=t.hasUserPreferences;return i.jsxs("div",e.__assign({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[c&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[i.jsx(s.CitationLinkSparkleIcon,{width:13,height:13}),i.jsxs("span",{children:["Citation Relevance ",c,"%"]})]})),i.jsxs("div",e.__assign({style:{flex:"1 1 auto",display:"flex",gap:u?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:u?"1 1 170px":"1 1 100%",minWidth:u?"100px":"100%",width:u?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i.jsx(a.default,{})," ",d]})),i.jsx("div",e.__assign({className:"citation-markdown-wrapper",style:{flex:u?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:i.jsx(l.default,{value:(null===(n=r.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(o=r.customMetaData)||void 0===o?void 0:o.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),i.jsx("div",e.__assign({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:x}))]})),u&&i.jsxs("div",e.__assign({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[i.jsx("div",e.__assign({style:{backgroundColor:"#fff"}},{children:i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:i.jsx("h3",e.__assign({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),i.jsx("div",e.__assign({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:f.slice(0,3).map(function(t,n){return i.jsx("div",e.__assign({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[i.jsxs("div",e.__assign({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),i.jsxs("div",e.__assign({style:{fontSize:"13px"}},{children:[i.jsx("span",{children:t.question}),i.jsx("span",e.__assign({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),i.jsx("br",{}),i.jsxs("span",e.__assign({style:{fontWeight:"700",color:"#111827"}},{children:['"',i.jsx(p,{text:t.answer,highlights:t.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),i.jsx("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))});exports.default=function(a){var s,l,d,c,p=a.citation,f=a.linkTitle,u=a.isOpen,g=a.onToggle,h=a.fontSize,m=n.useRef(null),b=n.useCallback(function(){g&&g()},[g]);n.useEffect(function(){u&&m.current&&setTimeout(function(){var e;null===(e=m.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[u]);var v=(null===(s=p.customMetaData)||void 0===s?void 0:s.citation_title)||"",_=(null===(l=p.customMetaData)||void 0===l?void 0:l.citation_relevance_score)||null,y="Referenced from ".concat(null===(d=p.customMetaData)||void 0===d?void 0:d.citation_reference)||"",j=(null===(c=p.customMetaData)||void 0===c?void 0:c.user_preference)||[],w=j.length>0;return i.jsxs("span",e.__assign({className:"citation-container",ref:m,onClick:function(e){return e.stopPropagation()}},{children:[i.jsx(t.CitationRenderer,{inLineCitation:!0,citationTitle:f,citationComponent:i.jsx(x,{citation:p,headerTitle:v,score:_,footerText:y,userPreferences:j,hasUserPreferences:w}),chevronDownComponent:i.jsx(o.default,{}),chevronUpComponent:i.jsx(r.default,{}),additionalCallbackForPillButton:b,isOpen:u,onToggle:g,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:h?"".concat(h,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:u?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),i.jsx("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@e-llm-studio/citation"),n=require("react"),o=require("./_svg/ChevronDown.js"),r=require("./_svg/ChevronUp.js"),a=require("./_svg/BookIcon.js"),s=require("./_svg/CitationLinkSparkleIcon.js"),l=require("./MarkdownRenderer.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(n),p=c.default.memo(function(t){var n=t.text,o=t.highlights,r=(null!=o?o:[]).filter(function(e){return"string"==typeof e&&e.length>0});if(0===r.length||!n)return i.jsx("span",{children:n});var a=r.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),s=new RegExp("(".concat(a.join("|"),")"),"gi"),l=n.split(s);return i.jsx("span",{children:l.map(function(t,n){return r.some(function(e){return e.toLowerCase()===t.toLowerCase()})?i.jsx("span",e.__assign({style:{backgroundColor:"#fef08a",color:"#000"}},{children:t}),n):i.jsx("span",{children:t},n)})})}),x=c.default.memo(function(t){var n,o,r=t.citation,d=t.headerTitle,c=t.score,x=t.footerText,f=t.userPreferences,u=t.hasUserPreferences;return i.jsxs("div",e.__assign({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[c&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[i.jsx(s.CitationLinkSparkleIcon,{width:13,height:13}),i.jsxs("span",{children:["Citation Relevance ",c,"%"]})]})),i.jsxs("div",e.__assign({style:{flex:"1 1 auto",display:"flex",gap:u?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:u?"1 1 170px":"1 1 100%",minWidth:u?"100px":"100%",width:u?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i.jsx(a.default,{})," ",d]})),i.jsx("div",e.__assign({className:"citation-markdown-wrapper",style:{flex:u?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:i.jsx(l.default,{value:(null===(n=r.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(o=r.customMetaData)||void 0===o?void 0:o.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),i.jsx("div",e.__assign({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:x}))]})),u&&i.jsxs("div",e.__assign({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[i.jsx("div",e.__assign({style:{backgroundColor:"#fff"}},{children:i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:i.jsx("h3",e.__assign({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),i.jsx("div",e.__assign({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:f.slice(0,3).map(function(t,n){return i.jsx("div",e.__assign({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[i.jsxs("div",e.__assign({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),i.jsxs("div",e.__assign({style:{fontSize:"13px"}},{children:[i.jsx("span",{children:t.question}),i.jsx("span",e.__assign({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),i.jsx("br",{}),i.jsxs("span",e.__assign({style:{fontWeight:"700",color:"#111827"}},{children:['"',i.jsx(p,{text:t.answer,highlights:t.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),i.jsx("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))});exports.default=function(a){var s,l,d,c,p=a.citation,f=a.linkTitle,u=a.isOpen,g=a.onToggle,h=a.fontSize,m=n.useRef(null),b=n.useCallback(function(){g&&g()},[g]);n.useEffect(function(){u&&m.current&&setTimeout(function(){var e;null===(e=m.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[u]);var v=(null===(s=p.customMetaData)||void 0===s?void 0:s.citation_title)||"",_=(null===(l=p.customMetaData)||void 0===l?void 0:l.citation_relevance_score)||null,y="Referenced from ".concat(null===(d=p.customMetaData)||void 0===d?void 0:d.citation_reference)||"",j=(null===(c=p.customMetaData)||void 0===c?void 0:c.user_preference)||[],w=j.length>0;return i.jsxs("span",e.__assign({className:"citation-container",ref:m,onClick:function(e){return e.stopPropagation()}},{children:[i.jsx(t.CitationRenderer,{inLineCitation:!0,citationTitle:f,citationComponent:i.jsx(x,{citation:p,headerTitle:v,score:_,footerText:y,userPreferences:j,hasUserPreferences:w}),chevronDownComponent:i.jsx(o.default,{}),chevronUpComponent:i.jsx(r.default,{}),additionalCallbackForPillButton:b,isOpen:u,onToggle:g,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:h?"".concat(h,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:u?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),i.jsx("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};
2
2
  //# sourceMappingURL=CitationLink.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{CitationRenderer as i}from"@e-llm-studio/citation";import n,{useRef as r,useCallback as l,useEffect as a}from"react";import d from"./_svg/ChevronDown.js";import c from"./_svg/ChevronUp.js";import s from"./_svg/BookIcon.js";import{CitationLinkSparkleIcon as p}from"./_svg/CitationLinkSparkleIcon.js";import f from"./MarkdownRenderer.js";var h=n.memo(function(t){var i=t.text,n=t.highlights;if(!n||0===n.length||!i)return o("span",{children:i});var r=n.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),l=new RegExp("(".concat(r.join("|"),")"),"gi"),a=i.split(l);return o("span",{children:a.map(function(t,i){var r=n.some(function(e){return e.toLowerCase()===t.toLowerCase()});return o("span",r?e({style:{backgroundColor:"#fef08a",color:"#000"}},{children:t}):{children:t},i)})})}),x=n.memo(function(i){var n,r,l=i.citation,a=i.headerTitle,d=i.score,c=i.footerText,x=i.userPreferences,u=i.hasUserPreferences;return t("div",e({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[d&&t("div",e({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[o(p,{width:13,height:13}),t("span",{children:["Citation Relevance ",d,"%"]})]})),t("div",e({style:{flex:"1 1 auto",display:"flex",gap:u?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[t("div",e({style:{display:"flex",flexDirection:"column",flex:u?"1 1 170px":"1 1 100%",minWidth:u?"100px":"100%",width:u?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[o(s,{})," ",a]})),o("div",e({className:"citation-markdown-wrapper",style:{flex:u?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:o(f,{value:(null===(n=l.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(r=l.customMetaData)||void 0===r?void 0:r.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),o("div",e({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:c}))]})),u&&t("div",e({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[o("div",e({style:{backgroundColor:"#fff"}},{children:o("div",e({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:o("h3",e({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),o("div",e({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:x.slice(0,3).map(function(i,n){return o("div",e({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:t("div",e({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[t("div",e({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),t("div",e({style:{fontSize:"13px"}},{children:[o("span",{children:i.question}),o("span",e({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),o("br",{}),t("span",e({style:{fontWeight:"700",color:"#111827"}},{children:['"',o(h,{text:i.answer,highlights:i.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),o("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))}),u=function(n){var s,p,f,h,u=n.citation,m=n.linkTitle,g=n.isOpen,v=n.onToggle,b=n.fontSize,y=r(null),w=l(function(){v&&v()},[v]);a(function(){g&&y.current&&setTimeout(function(){var e;null===(e=y.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[g]);var k=(null===(s=u.customMetaData)||void 0===s?void 0:s.citation_title)||"",C=(null===(p=u.customMetaData)||void 0===p?void 0:p.citation_relevance_score)||null,F="Referenced from ".concat(null===(f=u.customMetaData)||void 0===f?void 0:f.citation_reference)||"",S=(null===(h=u.customMetaData)||void 0===h?void 0:h.user_preference)||[],D=S.length>0;return t("span",e({className:"citation-container",ref:y,onClick:function(e){return e.stopPropagation()}},{children:[o(i,{inLineCitation:!0,citationTitle:m,citationComponent:o(x,{citation:u,headerTitle:k,score:C,footerText:F,userPreferences:S,hasUserPreferences:D}),chevronDownComponent:o(d,{}),chevronUpComponent:o(c,{}),additionalCallbackForPillButton:w,isOpen:g,onToggle:v,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:b?"".concat(b,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:g?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),o("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};export{u as default};
1
+ import{__assign as e}from"tslib";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{CitationRenderer as i}from"@e-llm-studio/citation";import n,{useRef as r,useCallback as l,useEffect as a}from"react";import d from"./_svg/ChevronDown.js";import c from"./_svg/ChevronUp.js";import s from"./_svg/BookIcon.js";import{CitationLinkSparkleIcon as p}from"./_svg/CitationLinkSparkleIcon.js";import f from"./MarkdownRenderer.js";var h=n.memo(function(o){var i=o.text,n=o.highlights,r=(null!=n?n:[]).filter(function(e){return"string"==typeof e&&e.length>0});if(0===r.length||!i)return t("span",{children:i});var l=r.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),a=new RegExp("(".concat(l.join("|"),")"),"gi"),d=i.split(a);return t("span",{children:d.map(function(o,i){var n=r.some(function(e){return e.toLowerCase()===o.toLowerCase()});return t("span",n?e({style:{backgroundColor:"#fef08a",color:"#000"}},{children:o}):{children:o},i)})})}),u=n.memo(function(i){var n,r,l=i.citation,a=i.headerTitle,d=i.score,c=i.footerText,u=i.userPreferences,x=i.hasUserPreferences;return o("div",e({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[d&&o("div",e({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[t(p,{width:13,height:13}),o("span",{children:["Citation Relevance ",d,"%"]})]})),o("div",e({style:{flex:"1 1 auto",display:"flex",gap:x?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[o("div",e({style:{display:"flex",flexDirection:"column",flex:x?"1 1 170px":"1 1 100%",minWidth:x?"100px":"100%",width:x?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[t(s,{})," ",a]})),t("div",e({className:"citation-markdown-wrapper",style:{flex:x?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:t(f,{value:(null===(n=l.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(r=l.customMetaData)||void 0===r?void 0:r.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),t("div",e({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:c}))]})),x&&o("div",e({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[t("div",e({style:{backgroundColor:"#fff"}},{children:t("div",e({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:t("h3",e({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),t("div",e({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:u.slice(0,3).map(function(i,n){return t("div",e({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:o("div",e({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[o("div",e({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),o("div",e({style:{fontSize:"13px"}},{children:[t("span",{children:i.question}),t("span",e({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),t("br",{}),o("span",e({style:{fontWeight:"700",color:"#111827"}},{children:['"',t(h,{text:i.answer,highlights:i.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),t("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))}),x=function(n){var s,p,f,h,x=n.citation,m=n.linkTitle,g=n.isOpen,v=n.onToggle,b=n.fontSize,y=r(null),w=l(function(){v&&v()},[v]);a(function(){g&&y.current&&setTimeout(function(){var e;null===(e=y.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[g]);var k=(null===(s=x.customMetaData)||void 0===s?void 0:s.citation_title)||"",C=(null===(p=x.customMetaData)||void 0===p?void 0:p.citation_relevance_score)||null,F="Referenced from ".concat(null===(f=x.customMetaData)||void 0===f?void 0:f.citation_reference)||"",S=(null===(h=x.customMetaData)||void 0===h?void 0:h.user_preference)||[],D=S.length>0;return o("span",e({className:"citation-container",ref:y,onClick:function(e){return e.stopPropagation()}},{children:[t(i,{inLineCitation:!0,citationTitle:m,citationComponent:t(u,{citation:x,headerTitle:k,score:C,footerText:F,userPreferences:S,hasUserPreferences:D}),chevronDownComponent:t(d,{}),chevronUpComponent:t(c,{}),additionalCallbackForPillButton:w,isOpen:g,onToggle:v,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:b?"".concat(b,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:g?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),t("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};export{x as default};
2
2
  //# sourceMappingURL=CitationLink.js.map
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  export type UserPreferenceItem = {
3
3
  question: string;
4
4
  answer: string;
5
- highlighted_text?: string[];
5
+ highlighted_text?: unknown[];
6
6
  };
7
7
  type CitationLinkProps = {
8
8
  citation: any;
@@ -1 +1 @@
1
- {"version":3,"file":"CitationLink.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/CitationLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAO9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAyOF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"CitationLink.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/CitationLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAO9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IAEf,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AA4OF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "1.3.0-alpha.141",
3
+ "version": "1.3.0-alpha.142",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",