@e-llm-studio/citation 0.0.84 → 0.0.86
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/CodeCitation/CodeCitation.js +1 -1
- package/dist/cjs/utils/themeManager.js +2 -0
- package/dist/cjs/utils/themeManager.js.map +1 -0
- package/dist/features/BookCitation/BookCitation.js +1 -1
- package/dist/features/CodeCitation/CodeCitation.js +1 -1
- package/dist/types/src/features/BookCitation/BookCitation.d.ts.map +1 -1
- package/dist/types/src/features/CodeCitation/CodeCitation.d.ts.map +1 -1
- package/dist/types/src/utils/themeManager.d.ts +13 -0
- package/dist/types/src/utils/themeManager.d.ts.map +1 -0
- package/dist/utils/themeManager.js +2 -0
- package/dist/utils/themeManager.js.map +1 -0
- 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"),a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.mjs.js"),a=require("react/jsx-runtime"),n=require("react"),t=require("./BookCitation.module.css.js"),i=require("./text-cleaner.js");exports.default=function(o){var s=o.title,c=o.author,r=o.paragraphs,l=o.chevronUpComponent,d=o.chevronDownComponent,u=o.externalLinkComponent,f=o.textToHighlight,h=o.pageNumber,v=o.totalPageNumber,m=void 0===v?null:v,p=o.citationTitle;o.customStyle;var g=o.handleExternalLinkClick,x=o.bookCoverImage,_=o.partialMatch,j=void 0!==_&&_,N=o.citationNumber,b=void 0===N?1:N,C=o.defaultState,k=void 0!==C&&C,E=o.isNonHighlightedBlur,T=void 0!==E&&E,q=o.toggleBlur,y=void 0===q?T:q,A=o.fixedWidth,L=void 0===A||A,w=o.isBookemon,I=void 0!==w&&w,B=n.useState(k),M=B[0],H=B[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"];n.useEffect((function(){if(M){var e,a="quotes-citations-".concat(null!=b?b:""),n=!1;return requestAnimationFrame((function(){requestAnimationFrame((function(){e=function(){var e=document.getElementById(a);if(e&&!n){e.scrollIntoView({behavior:"smooth",block:"center"});var t=setTimeout((function(){if(!n){var a=e.getBoundingClientRect(),t=window.innerHeight/2;Math.abs(a.top-t)>40&&e.scrollIntoView({behavior:"auto",block:"center"})}}),400);return function(){return clearTimeout(t)}}}()||void 0}))})),function(){n=!0,e&&e()}}}),[M,f,b]);var S=function(e){void 0===e&&(e="");var a=document.createElement("div");a.innerHTML=e;var n=a.textContent||a.innerText||"";return(n=(n=n.replace(/<\/?[^>]+(>|$)/g,"")).replace(/\s+/g," ")).trim()};function O(e){var a=document.createElement("div");a.innerHTML=e;var n=t.default.highlighted,i=function(e,a){var o,s;if(void 0===a&&(a=!1),e.nodeType===Node.TEXT_NODE){if(!a&&(null===(o=e.textContent)||void 0===o?void 0:o.trim())){var c=document.createElement("span");c.classList.add(t.default.blurred),c.textContent=e.textContent,null===(s=e.parentNode)||void 0===s||s.replaceChild(c,e)}}else if(e.nodeType===Node.ELEMENT_NODE){var r=e,l=r.classList.contains(n);Array.from(r.childNodes).forEach((function(e){return i(e,a||l)}))}};return Array.from(a.childNodes).forEach((function(e){return i(e)})),a.innerHTML}function R(e,a,n,i,o,s){void 0===o&&(o=[]),void 0===s&&(s=!1);var c,r=t.default.highlighted,l=t.default.highlightedInline,d=t.default.highlightedBlock,u="".concat(r," ").concat(l),f="".concat(r," ").concat(d),h=a,v=(c=document.createElement("textarea"),function(e){return c.innerHTML=e,c.value});if(o.length>0){if(s){return o.forEach((function(e){e&&(h=function(e,a,n){for(var t='<span id="'.concat(n,'" class="').concat(u,'">'),i="</span>",o=e,s=0,c=new RegExp("(<(?:".concat(W.join("|"),")[^>]*>.*?)(?=<(?:").concat(W.join("|"),")|$)"),"gi"),r=(a.match(c)||[a]).map((function(e){var a=e.match(/^<([a-zA-Z0-9]+)([^>]*)>/);if(a&&W.includes(a[1].toLowerCase())){var n=a[0].length;return a[0]+t+e.slice(n)+i}return t+e+i})).join("");;){var l=o.indexOf(a,s);if(-1===l)break;o=o.slice(0,l)+r+o.slice(l+a.length),s=l+r.length}var f=d;return o.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,(function(e,a,n){if(W.some((function(e){return new RegExp("<".concat(e,"\\b[^>]*>"),"i").test(n)}))){var t=a.match(/\sclass\s*=\s*(['"])(.*?)\1/);if(t){var i=t[2],o=i.split(/\s+/).includes(f)?i:"".concat(i," ").concat(f);a=a.replace(t[0],' class="'.concat(o,'"'))}else a+=' class="'.concat(f,'"')}return"<span".concat(a,">").concat(n,"</span>")}))}(h,e,"Annotation"===n?"quotes-annotations-".concat(null!=i?i:""):"quotes-citations-".concat(null!=i?i:"")))})),T&&y?O(h):h}return o.forEach((function(e){var t=v(e).trim();if(t&&v(a).trim().toLowerCase()===t.toLowerCase()){var o="Annotation"===n?"quotes-annotations-".concat(null!=i?i:""):"quotes-citations-".concat(null!=i?i:"");h='<span id="'.concat(o,'" class="').concat(f,'">').concat(a,"</span>")}})),T&&y?O(h):h}var m=f;if(!e||!a)return"Annotation"===n?a:'<span id="quotes-citations" class="'.concat(m,'">').concat(a,"</span>");var p=Array.from(e.matchAll(/`([^`]+)`/g));if(0===p.length)return"Annotation"===n?a:'<span id="quotes-citations" class="'.concat(m,'">').concat(a,"</span>");h=a;var g=!1;return p.forEach((function(e){var a=v(e[1]).trim();if(a){var t=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp("(".concat(t,")"),"gi");h.match(i)&&(g=!0,h=h.replace(i,'<span id="'.concat("Annotation"===n?"quotes-annotations":"quotes-citations",'" class="').concat(m,'">$1</span>')))}})),g?h:"Annotation"===n?a:'<span id="quotes-citations" class="'.concat(m,'">').concat(a,"</span>")}return a.jsx(a.Fragment,{children:a.jsxs("span",e.__assign({className:"".concat(t.default.relativeWrapper," ").concat(I?t.default.height95percent+" "+t.default.displayFlex:t.default.height100percent)},{children:[!k&&a.jsx("div",e.__assign({className:t.default.citationButtonWrapper},{children:a.jsxs("div",e.__assign({onClick:function(){return H((function(e){return!e}))},className:t.default.citationButton},{children:[a.jsx("span",e.__assign({className:t.default.citationText},{children:p})),M?l:d]}))})),M&&a.jsx("div",e.__assign({className:t.default.expandedWrapper},{children:a.jsx("div",e.__assign({className:"".concat(t.default.expandableContainer," ").concat(L?t.default.expandableContainerWidth:"")},{children:a.jsx("div",e.__assign({className:t.default.expandableContent},{children:a.jsxs("div",e.__assign({className:t.default.bookBodyContent},{children:[!k&&a.jsx("div",e.__assign({className:t.default.header},{children:a.jsxs("div",e.__assign({className:t.default.bookInfo},{children:[x&&a.jsx("div",e.__assign({className:t.default.bookImageWrapper},{children:a.jsx("img",{src:x,alt:s||"Book cover",className:t.default.bookImage})})),a.jsxs("div",e.__assign({className:t.default.bookTextInfo},{children:[a.jsx("h1",e.__assign({className:t.default.bookTitle},{children:s})),c||Array.isArray(c)&&a.jsxs("p",e.__assign({className:t.default.bookAuthor},{children:["by"," ",Array.isArray(c)?c.join(", "):c||""]}))]})),a.jsx("div",e.__assign({onClick:g,className:t.default.externalLink},{children:u}))]}))})),a.jsx("div",e.__assign({className:t.default.relativeContainer},{children:a.jsx("div",e.__assign({className:t.default.container},{children:a.jsxs("div",e.__assign({className:"".concat(t.default.contentWrapper," ").concat(t.default.customScrollbarClass," ").concat(I?"":t.default.maxheight38rem)},{children:[a.jsx("div",{className:t.default.gradientOverlayLeft}),a.jsx("div",{className:t.default.gradientOverlayRight}),a.jsxs("div",e.__assign({className:t.default.contentWrapper},{children:[r.map((function(e,n){i.cleanScannedText(e);var o=(j?e.includes(f[0]):f.some((function(a){return S(e).toLowerCase()===S(a).toLowerCase()})))?R(r.join("\n"),e,"Citation",b,f,j):e;return a.jsx("div",{className:"".concat(t.default.paragraph," ").concat(0!==n?t.default.textIndent:""),dangerouslySetInnerHTML:{__html:o}},n)})),h&&a.jsx("div",e.__assign({className:t.default.pageIndex},{children:a.jsxs("div",e.__assign({className:t.default.pageLabel},{children:[h," ",m&&"of ".concat(m)]}))}))]}))]}))}))}))]}))}))}))}))]}))})};
|
|
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"),t=require("react/jsx-runtime"),n=require("react"),i=require("./CodeCitation.module.css.js"),a=require("./_components/CodeEditor.js"),s=require("../../utils/codeCitations.utils.js"),o=require("./_components/ThemeToggle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.mjs.js"),t=require("react/jsx-runtime"),n=require("react"),i=require("./CodeCitation.module.css.js"),a=require("./_components/CodeEditor.js"),s=require("../../utils/codeCitations.utils.js"),o=require("./_components/ThemeToggle.js"),r=require("./_components/CodeCitationPopup.js"),l=require("./_components/HighlightedCodeDetails.js"),d=require("../../node_modules/axios/lib/axios.js"),u=require("./_components/Spinner.js"),c=require("../../constants/diagnosticStylesBySeverity.js"),g=require("../../utils/themeManager.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(n);exports.default=function(h){var m=h.baseUrlForCodeRetrieval,p=h.assistantName,x=h.organizationName,S=h.userId,v=h.taskId,_=h.repoUrl,I=h.inLineCitation,C=h.citationTitle,y=h.filename,j=h.filepath,b=h.citationContainerTitle,F=h.showThemeToggle,T=h.customCode,k=h.isDarkModeEnabled,D=h.chevronUpComponent,P=h.chevronDownComponent,w=h.isHighlightingEnabled,E=h.FileDetailsComponent,L=h.additionalCallbackForPillButton,H=h.CustomCodeRenderComponent,q=h.fileSummarySectionTitle,M=h.showFullscreenIcon,B=h.showFileSummaryIButton,N=h.editorHeight,W=h.editorWidth,z=h.styles,V=void 0===z?{}:z,R=h.diagnostics,J=h.diagnosticStylesBySeverity,U=h.datasource,A=void 0===U?"codebase":U,O=h.externalFilesData,Y=h.startIndex,G=h.endIndex,K=n.useRef(!1),Q=s.getLanguageFromFileName(y),X=n.useState(!1),Z=X[0],$=X[1],ee=n.useState((function(){return g.themeManager.getTheme(k)})),te=ee[0],ne=ee[1];n.useEffect((function(){return g.themeManager.subscribe(ne)}),[]);var ie=n.useState(!1),ae=ie[0],se=ie[1],oe=n.useState(!1),re=oe[0],le=oe[1],de=n.useState(!1),ue=de[0],ce=de[1],ge=n.useState(!1),he=ge[0],fe=ge[1],me=n.useState(null),pe=me[0],xe=me[1],Se=n.useState(""),ve=Se[0],_e=Se[1],Ie=n.useState(""),Ce=Ie[0],ye=Ie[1],je=n.useState({startIndex:-1,endIndex:-1}),be=je[0],Fe=je[1],Te=n.useState({}),ke=Te[0],De=Te[1],Pe=n.useState(!1),we=Pe[0],Ee=Pe[1],Le=n.useState(!1),He=Le[0],qe=Le[1],Me=n.useState({startIndex:-1,endIndex:-1}),Be=Me[0],Ne=Me[1],We=n.useState({startIndex:-1,endIndex:-1}),ze=We[0],Ve=We[1],Re=f.default.useMemo((function(){return e.__assign(e.__assign({},c.DEFAULT_DIAGNOSTIC_STYLES_BY_SEVERITY),J)}),[J]);n.useEffect((function(){Ve({startIndex:null!=Y?Y:-1,endIndex:null!=G?G:-1})}),[Y,G]),n.useEffect((function(){O&&T&&(xe(O),K.current=!0)}),[O,T]),n.useEffect((function(){if("undefined"!=typeof window&&!K.current){K.current=!0;var t=new URL(j,"http://example.com"),n=t.searchParams,i=void 0!==Y?Y:n.has("startLine")?Number(n.get("startLine")):-1,a=void 0!==G?G:n.has("endLine")?Number(n.get("endLine")):-1;Ve({startIndex:i,endIndex:a}),Fe({startIndex:i,endIndex:a}),Ne({startIndex:i,endIndex:a}),t.searchParams.delete("startLine"),t.searchParams.delete("endLine"),t.searchParams.delete("validation");var s=t.pathname+t.search,o=null==s?void 0:s.replace(/^\//,"");ye(o),console.log("Params going to API:",{file_path:o,assistant_name:p,organization_name:x,user_id:S,task_id:v,chunks_search:!1,technical_details_only:!0,repo_url:_});T||we||e.__awaiter(void 0,void 0,void 0,(function(){var t,n,i,a,s,r;return e.__generator(this,(function(l){switch(l.label){case 0:qe(!1),Ee(!0),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,d.default.get("".concat(m,"/analyzer/get_file_details"),{params:e.__assign({file_path:String(o),assistant_name:String(p),organization_name:String(x),user_id:String(S),task_id:String(v),repo_url:String(_),chunks_search:!1,technical_details_only:!0},"codebase"!==A&&{datasource:A})})];case 2:return t=l.sent(),n=(null==t?void 0:t.data[0])||(null==t?void 0:t.data),!pe&&n&&(xe(n),Object.keys(null==t?void 0:t.data)&&(i=(null===(r=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s[0])||void 0===r?void 0:r.content)||(null==t?void 0:t.data.content),_e(i))),Ee(!1),[2,t.data];case 3:return a=l.sent(),qe(!0),console.error("Error in retrieving file details: ",a),[3,4];case 4:return Ee(!1),[2]}}))}))}}),[]);return t.jsxs(t.Fragment,{children:[t.jsxs("span",e.__assign({onClick:function(e){return function(e){e.preventDefault(),e.stopPropagation(),L&&L(),$((function(e){return!e})),se((function(e){return!e}))}(e)},className:i.default.pillButton,style:V.pillButton},{children:[t.jsx("span",e.__assign({style:V.citationTitle},{children:C})),I&&(Z?D:P)]})),(!I||re)&&t.jsx(r.default,{open:ae,onClose:function(){Ve({startIndex:null==Be?void 0:Be.startIndex,endIndex:null==Be?void 0:Be.endIndex}),le(!1),se(!1),Fe({startIndex:-1,endIndex:-1}),De({})},title:C,customStyles:{popupContainer:{width:"100vw",height:"100vh",borderRadius:"0.75rem",fontFamily:"Plus Jakarta Sans, sans-serif"},popupTitleContainer:{color:"#d63384",fontFamily:"Plus Jakarta Sans, sans-serif",position:"relative",textAlign:"left",fontWeight:"700"},topLeftTitle:{backgroundColor:"#f9f9f9",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",fontWeight:"bold",padding:"5px",margin:"0px"},bottomLeftTitle:{backgroundColor:"#f9f9f9",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",fontWeight:"bold",padding:"5px",margin:"0px"}},editorChildren:t.jsx(a.default,{startIndex:null==ze?void 0:ze.startIndex,endIndex:null==ze?void 0:ze.endIndex,language:Q,editorHeight:N,editorWidth:W,code:T||ve,isHighlightingEnabled:w,isDarkModeEnabled:te,highlightCodeStatsLine:be,setHighlightCodeStatsLine:Fe,highlightCodeStatsVariable:ke,setHighlightCodeStatsVariable:De,isExpanded:Z,highlightIndexes:ze,diagnostics:R,diagnosticStylesBySeverity:Re}),fileDetails:pe,setHighlightIndexes:Ve,highlightCodeStatsLine:be,setHighlightCodeStatsLine:Fe,highlightCodeStatsVariable:ke,setHighlightCodeStatsVariable:De,filepath:Ce,datasource:A}),I&&Z&&t.jsx("div",e.__assign({className:i.default.citationWrapper,style:V.citationWrapper},{children:t.jsxs("div",e.__assign({className:i.default.citationContent,style:V.citationContent},{children:[!ue&&b?t.jsxs("div",e.__assign({className:i.default.citationContainerTitle,style:V.citationContainerTitle},{children:[t.jsx("span",{children:b}),F?t.jsx(o.default,{darkMode:te,onToggle:function(e){return function(e){e.stopPropagation(),e.preventDefault(),g.themeManager.setTheme(!te)}(e)},toggleFullscreen:function(e){e.stopPropagation(),e.preventDefault(),se(!0),le(!0)},handleOpenFileDetailSection:function(e){e.stopPropagation(),e.preventDefault(),fe(!0)},showFullscreenIcon:M,showFileSummaryIButton:B}):t.jsx(t.Fragment,{})]})):t.jsx(t.Fragment,{}),t.jsxs("div",e.__assign({style:{zIndex:-1e3,color:"#000",overflow:"hidden",display:"flex",flexDirection:"column",height:N,width:W,fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[!ue&&!he&&H,we?t.jsx(u.default,{}):t.jsx(t.Fragment,{}),He?t.jsx("div",e.__assign({style:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",color:"#242424"}},{children:"Something went wrong"})):t.jsx(t.Fragment,{}),!ue&&!he&&!H&&!we&&!He&&t.jsx(a.default,{startIndex:null==ze?void 0:ze.startIndex,endIndex:null==ze?void 0:ze.endIndex,language:Q,editorHeight:N,editorWidth:W,code:null!=T?T:ve,isHighlightingEnabled:w,isDarkModeEnabled:te,openHighlightedCodeDetails:function(){ce(!0)},highlightCodeStatsVariable:ke,setHighlightCodeStatsVariable:De,isExpanded:Z,highlightIndexes:ze,diagnostics:R,diagnosticStylesBySeverity:Re}),he&&t.jsx(l.default,{FileDetailsComponent:E,fileSummarySectionTitle:q,isDarkMode:te,editorHeight:N,editorWidth:W,code:null==pe?void 0:pe.content.split("\n").slice((null==ze?void 0:ze.startIndex)-1,null==ze?void 0:ze.endIndex).join("\n"),language:Q,onClose:function(e){e.stopPropagation(),e.preventDefault(),fe(!1)},summary:null==pe?void 0:pe.summary,filepath:Ce,citationTitle:C})]}))]}))}))]})};
|
|
2
2
|
//# sourceMappingURL=CodeCitation.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=new(function(){function e(){this.listeners=new Set,this.isDarkTheme=!0,this.isInitialized=!1}return e.prototype.subscribe=function(e){var t=this;return this.listeners.add(e),function(){return t.listeners.delete(e)}},e.prototype.setTheme=function(e){this.isDarkTheme=e,this.listeners.forEach((function(t){return t(e)}))},e.prototype.getTheme=function(e){return this.isInitialized||void 0===e||(this.setTheme(e),this.isInitialized=!0),this.isDarkTheme},e}());exports.themeManager=e;
|
|
2
|
+
//# sourceMappingURL=themeManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeManager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as o,useEffect as
|
|
1
|
+
import{__assign as n}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as o,useEffect as i}from"react";import c from"./BookCitation.module.css.js";import{cleanScannedText as r}from"./text-cleaner.js";var s=function(s){var l=s.title,d=s.author,u=s.paragraphs,m=s.chevronUpComponent,h=s.chevronDownComponent,v=s.externalLinkComponent,p=s.textToHighlight,f=s.pageNumber,g=s.totalPageNumber,N=void 0===g?null:g,b=s.citationTitle;s.customStyle;var x=s.handleExternalLinkClick,C=s.bookCoverImage,k=s.partialMatch,E=void 0!==k&&k,A=s.citationNumber,L=void 0===A?1:A,T=s.defaultState,y=void 0!==T&&T,q=s.isNonHighlightedBlur,w=void 0!==q&&q,I=s.toggleBlur,B=void 0===I?w:I,j=s.fixedWidth,H=void 0===j||j,M=s.isBookemon,W=void 0!==M&&M,O=o(y),R=O[0],S=O[1],$=["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(R){var n,e="quotes-citations-".concat(null!=L?L:""),t=!1;return requestAnimationFrame((function(){requestAnimationFrame((function(){n=function(){var n=document.getElementById(e);if(n&&!t){n.scrollIntoView({behavior:"smooth",block:"center"});var a=setTimeout((function(){if(!t){var e=n.getBoundingClientRect(),a=window.innerHeight/2;Math.abs(e.top-a)>40&&n.scrollIntoView({behavior:"auto",block:"center"})}}),400);return function(){return clearTimeout(a)}}}()||void 0}))})),function(){t=!0,n&&n()}}}),[R,p,L]);var _=function(n){void 0===n&&(n="");var e=document.createElement("div");e.innerHTML=n;var t=e.textContent||e.innerText||"";return(t=(t=t.replace(/<\/?[^>]+(>|$)/g,"")).replace(/\s+/g," ")).trim()};function D(n){var e=document.createElement("div");e.innerHTML=n;var t=c.highlighted,a=function(n,e){var o,i;if(void 0===e&&(e=!1),n.nodeType===Node.TEXT_NODE){if(!e&&(null===(o=n.textContent)||void 0===o?void 0:o.trim())){var r=document.createElement("span");r.classList.add(c.blurred),r.textContent=n.textContent,null===(i=n.parentNode)||void 0===i||i.replaceChild(r,n)}}else if(n.nodeType===Node.ELEMENT_NODE){var s=n,l=s.classList.contains(t);Array.from(s.childNodes).forEach((function(n){return a(n,e||l)}))}};return Array.from(e.childNodes).forEach((function(n){return a(n)})),e.innerHTML}function F(n,e,t,a,o,i){void 0===o&&(o=[]),void 0===i&&(i=!1);var r,s=c.highlighted,l=c.highlightedInline,d=c.highlightedBlock,u="".concat(s," ").concat(l),m="".concat(s," ").concat(d),h=e,v=(r=document.createElement("textarea"),function(n){return r.innerHTML=n,r.value});if(o.length>0){if(i){return o.forEach((function(n){n&&(h=function(n,e,t){for(var a='<span id="'.concat(t,'" class="').concat(u,'">'),o="</span>",i=n,c=0,r=new RegExp("(<(?:".concat($.join("|"),")[^>]*>.*?)(?=<(?:").concat($.join("|"),")|$)"),"gi"),s=(e.match(r)||[e]).map((function(n){var e=n.match(/^<([a-zA-Z0-9]+)([^>]*)>/);if(e&&$.includes(e[1].toLowerCase())){var t=e[0].length;return e[0]+a+n.slice(t)+o}return a+n+o})).join("");;){var l=i.indexOf(e,c);if(-1===l)break;i=i.slice(0,l)+s+i.slice(l+e.length),c=l+s.length}var m=d;return i.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,(function(n,e,t){if($.some((function(n){return new RegExp("<".concat(n,"\\b[^>]*>"),"i").test(t)}))){var a=e.match(/\sclass\s*=\s*(['"])(.*?)\1/);if(a){var o=a[2],i=o.split(/\s+/).includes(m)?o:"".concat(o," ").concat(m);e=e.replace(a[0],' class="'.concat(i,'"'))}else e+=' class="'.concat(m,'"')}return"<span".concat(e,">").concat(t,"</span>")}))}(h,n,"Annotation"===t?"quotes-annotations-".concat(null!=a?a:""):"quotes-citations-".concat(null!=a?a:"")))})),w&&B?D(h):h}return o.forEach((function(n){var o=v(n).trim();if(o&&v(e).trim().toLowerCase()===o.toLowerCase()){var i="Annotation"===t?"quotes-annotations-".concat(null!=a?a:""):"quotes-citations-".concat(null!=a?a:"");h='<span id="'.concat(i,'" class="').concat(m,'">').concat(e,"</span>")}})),w&&B?D(h):h}var p=m;if(!n||!e)return"Annotation"===t?e:'<span id="quotes-citations" class="'.concat(p,'">').concat(e,"</span>");var f=Array.from(n.matchAll(/`([^`]+)`/g));if(0===f.length)return"Annotation"===t?e:'<span id="quotes-citations" class="'.concat(p,'">').concat(e,"</span>");h=e;var g=!1;return f.forEach((function(n){var e=v(n[1]).trim();if(e){var a=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("(".concat(a,")"),"gi");h.match(o)&&(g=!0,h=h.replace(o,'<span id="'.concat("Annotation"===t?"quotes-annotations":"quotes-citations",'" class="').concat(p,'">$1</span>')))}})),g?h:"Annotation"===t?e:'<span id="quotes-citations" class="'.concat(p,'">').concat(e,"</span>")}return e(t,{children:a("span",n({className:"".concat(c.relativeWrapper," ").concat(W?c.height95percent+" "+c.displayFlex:c.height100percent)},{children:[!y&&e("div",n({className:c.citationButtonWrapper},{children:a("div",n({onClick:function(){return S((function(n){return!n}))},className:c.citationButton},{children:[e("span",n({className:c.citationText},{children:b})),R?m:h]}))})),R&&e("div",n({className:c.expandedWrapper},{children:e("div",n({className:"".concat(c.expandableContainer," ").concat(H?c.expandableContainerWidth:"")},{children:e("div",n({className:c.expandableContent},{children:a("div",n({className:c.bookBodyContent},{children:[!y&&e("div",n({className:c.header},{children:a("div",n({className:c.bookInfo},{children:[C&&e("div",n({className:c.bookImageWrapper},{children:e("img",{src:C,alt:l||"Book cover",className:c.bookImage})})),a("div",n({className:c.bookTextInfo},{children:[e("h1",n({className:c.bookTitle},{children:l})),d||Array.isArray(d)&&a("p",n({className:c.bookAuthor},{children:["by"," ",Array.isArray(d)?d.join(", "):d||""]}))]})),e("div",n({onClick:x,className:c.externalLink},{children:v}))]}))})),e("div",n({className:c.relativeContainer},{children:e("div",n({className:c.container},{children:a("div",n({className:"".concat(c.contentWrapper," ").concat(c.customScrollbarClass," ").concat(W?"":c.maxheight38rem)},{children:[e("div",{className:c.gradientOverlayLeft}),e("div",{className:c.gradientOverlayRight}),a("div",n({className:c.contentWrapper},{children:[u.map((function(n,t){r(n);var a=(E?n.includes(p[0]):p.some((function(e){return _(n).toLowerCase()===_(e).toLowerCase()})))?F(u.join("\n"),n,"Citation",L,p,E):n;return e("div",{className:"".concat(c.paragraph," ").concat(0!==t?c.textIndent:""),dangerouslySetInnerHTML:{__html:a}},t)})),f&&e("div",n({className:c.pageIndex},{children:a("div",n({className:c.pageLabel},{children:[f," ",N&&"of ".concat(N)]}))}))]}))]}))}))}))]}))}))}))}))]}))})};export{s as default};
|
|
2
2
|
//# sourceMappingURL=BookCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as n}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as i,Fragment as o,jsx as a}from"react/jsx-runtime";import
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as n}from"../../node_modules/tslib/tslib.es6.mjs.js";import{jsxs as i,Fragment as o,jsx as a}from"react/jsx-runtime";import r,{useRef as l,useState as s,useEffect as d}from"react";import c from"./CodeCitation.module.css.js";import u from"./_components/CodeEditor.js";import{getLanguageFromFileName as h}from"../../utils/codeCitations.utils.js";import g from"./_components/ThemeToggle.js";import m from"./_components/CodeCitationPopup.js";import p from"./_components/HighlightedCodeDetails.js";import f from"../../node_modules/axios/lib/axios.js";import v from"./_components/Spinner.js";import{DEFAULT_DIAGNOSTIC_STYLES_BY_SEVERITY as x}from"../../constants/diagnosticStylesBySeverity.js";import{themeManager as I}from"../../utils/themeManager.js";var C=function(C){var y=C.baseUrlForCodeRetrieval,S=C.assistantName,b=C.organizationName,_=C.userId,k=C.taskId,D=C.repoUrl,P=C.inLineCitation,T=C.citationTitle,w=C.filename,j=C.filepath,F=C.citationContainerTitle,H=C.showThemeToggle,L=C.customCode,E=C.isDarkModeEnabled,B=C.chevronUpComponent,W=C.chevronDownComponent,N=C.isHighlightingEnabled,z=C.FileDetailsComponent,M=C.additionalCallbackForPillButton,V=C.CustomCodeRenderComponent,J=C.fileSummarySectionTitle,R=C.showFullscreenIcon,U=C.showFileSummaryIButton,A=C.editorHeight,O=C.editorWidth,q=C.styles,G=void 0===q?{}:q,K=C.diagnostics,Q=C.diagnosticStylesBySeverity,X=C.datasource,Y=void 0===X?"codebase":X,Z=C.externalFilesData,$=C.startIndex,ee=C.endIndex,te=l(!1),ne=h(w),ie=s(!1),oe=ie[0],ae=ie[1],re=s((function(){return I.getTheme(E)})),le=re[0],se=re[1];d((function(){return I.subscribe(se)}),[]);var de=s(!1),ce=de[0],ue=de[1],he=s(!1),ge=he[0],me=he[1],pe=s(!1),fe=pe[0],ve=pe[1],xe=s(!1),Ie=xe[0],Ce=xe[1],ye=s(null),Se=ye[0],be=ye[1],_e=s(""),ke=_e[0],De=_e[1],Pe=s(""),Te=Pe[0],we=Pe[1],je=s({startIndex:-1,endIndex:-1}),Fe=je[0],He=je[1],Le=s({}),Ee=Le[0],Be=Le[1],We=s(!1),Ne=We[0],ze=We[1],Me=s(!1),Ve=Me[0],Je=Me[1],Re=s({startIndex:-1,endIndex:-1}),Ue=Re[0],Ae=Re[1],Oe=s({startIndex:-1,endIndex:-1}),qe=Oe[0],Ge=Oe[1],Ke=r.useMemo((function(){return e(e({},x),Q)}),[Q]);d((function(){Ge({startIndex:null!=$?$:-1,endIndex:null!=ee?ee:-1})}),[$,ee]),d((function(){Z&&L&&(be(Z),te.current=!0)}),[Z,L]),d((function(){if("undefined"!=typeof window&&!te.current){te.current=!0;var i=new URL(j,"http://example.com"),o=i.searchParams,a=void 0!==$?$:o.has("startLine")?Number(o.get("startLine")):-1,r=void 0!==ee?ee:o.has("endLine")?Number(o.get("endLine")):-1;Ge({startIndex:a,endIndex:r}),He({startIndex:a,endIndex:r}),Ae({startIndex:a,endIndex:r}),i.searchParams.delete("startLine"),i.searchParams.delete("endLine"),i.searchParams.delete("validation");var l=i.pathname+i.search,s=null==l?void 0:l.replace(/^\//,"");we(s),console.log("Params going to API:",{file_path:s,assistant_name:S,organization_name:b,user_id:_,task_id:k,chunks_search:!1,technical_details_only:!0,repo_url:D});L||Ne||t(void 0,void 0,void 0,(function(){var t,i,o,a,r,l;return n(this,(function(n){switch(n.label){case 0:Je(!1),ze(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,f.get("".concat(y,"/analyzer/get_file_details"),{params:e({file_path:String(s),assistant_name:String(S),organization_name:String(b),user_id:String(_),task_id:String(k),repo_url:String(D),chunks_search:!1,technical_details_only:!0},"codebase"!==Y&&{datasource:Y})})];case 2:return t=n.sent(),i=(null==t?void 0:t.data[0])||(null==t?void 0:t.data),!Se&&i&&(be(i),Object.keys(null==t?void 0:t.data)&&(o=(null===(l=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r[0])||void 0===l?void 0:l.content)||(null==t?void 0:t.data.content),De(o))),ze(!1),[2,t.data];case 3:return a=n.sent(),Je(!0),console.error("Error in retrieving file details: ",a),[3,4];case 4:return ze(!1),[2]}}))}))}}),[]);return i(o,{children:[i("span",e({onClick:function(e){return function(e){e.preventDefault(),e.stopPropagation(),M&&M(),ae((function(e){return!e})),ue((function(e){return!e}))}(e)},className:c.pillButton,style:G.pillButton},{children:[a("span",e({style:G.citationTitle},{children:T})),P&&(oe?B:W)]})),(!P||ge)&&a(m,{open:ce,onClose:function(){Ge({startIndex:null==Ue?void 0:Ue.startIndex,endIndex:null==Ue?void 0:Ue.endIndex}),me(!1),ue(!1),He({startIndex:-1,endIndex:-1}),Be({})},title:T,customStyles:{popupContainer:{width:"100vw",height:"100vh",borderRadius:"0.75rem",fontFamily:"Plus Jakarta Sans, sans-serif"},popupTitleContainer:{color:"#d63384",fontFamily:"Plus Jakarta Sans, sans-serif",position:"relative",textAlign:"left",fontWeight:"700"},topLeftTitle:{backgroundColor:"#f9f9f9",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",fontWeight:"bold",padding:"5px",margin:"0px"},bottomLeftTitle:{backgroundColor:"#f9f9f9",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"1rem",fontWeight:"bold",padding:"5px",margin:"0px"}},editorChildren:a(u,{startIndex:null==qe?void 0:qe.startIndex,endIndex:null==qe?void 0:qe.endIndex,language:ne,editorHeight:A,editorWidth:O,code:L||ke,isHighlightingEnabled:N,isDarkModeEnabled:le,highlightCodeStatsLine:Fe,setHighlightCodeStatsLine:He,highlightCodeStatsVariable:Ee,setHighlightCodeStatsVariable:Be,isExpanded:oe,highlightIndexes:qe,diagnostics:K,diagnosticStylesBySeverity:Ke}),fileDetails:Se,setHighlightIndexes:Ge,highlightCodeStatsLine:Fe,setHighlightCodeStatsLine:He,highlightCodeStatsVariable:Ee,setHighlightCodeStatsVariable:Be,filepath:Te,datasource:Y}),P&&oe&&a("div",e({className:c.citationWrapper,style:G.citationWrapper},{children:i("div",e({className:c.citationContent,style:G.citationContent},{children:[!fe&&F?i("div",e({className:c.citationContainerTitle,style:G.citationContainerTitle},{children:[a("span",{children:F}),H?a(g,{darkMode:le,onToggle:function(e){return function(e){e.stopPropagation(),e.preventDefault(),I.setTheme(!le)}(e)},toggleFullscreen:function(e){e.stopPropagation(),e.preventDefault(),ue(!0),me(!0)},handleOpenFileDetailSection:function(e){e.stopPropagation(),e.preventDefault(),Ce(!0)},showFullscreenIcon:R,showFileSummaryIButton:U}):a(o,{})]})):a(o,{}),i("div",e({style:{zIndex:-1e3,color:"#000",overflow:"hidden",display:"flex",flexDirection:"column",height:A,width:O,fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[!fe&&!Ie&&V,a(Ne?v:o,{}),Ve?a("div",e({style:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",color:"#242424"}},{children:"Something went wrong"})):a(o,{}),!fe&&!Ie&&!V&&!Ne&&!Ve&&a(u,{startIndex:null==qe?void 0:qe.startIndex,endIndex:null==qe?void 0:qe.endIndex,language:ne,editorHeight:A,editorWidth:O,code:null!=L?L:ke,isHighlightingEnabled:N,isDarkModeEnabled:le,openHighlightedCodeDetails:function(){ve(!0)},highlightCodeStatsVariable:Ee,setHighlightCodeStatsVariable:Be,isExpanded:oe,highlightIndexes:qe,diagnostics:K,diagnosticStylesBySeverity:Ke}),Ie&&a(p,{FileDetailsComponent:z,fileSummarySectionTitle:J,isDarkMode:le,editorHeight:A,editorWidth:O,code:null==Se?void 0:Se.content.split("\n").slice((null==qe?void 0:qe.startIndex)-1,null==qe?void 0:qe.endIndex).join("\n"),language:ne,onClose:function(e){e.stopPropagation(),e.preventDefault(),Ce(!1)},summary:null==Se?void 0:Se.summary,filepath:Te,citationTitle:T})]}))]}))}))]})};export{C as default};
|
|
2
2
|
//# sourceMappingURL=CodeCitation.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,EAAuB,MAAM,OAAO,CAAC;AAIlE,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,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;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,EAAuB,MAAM,OAAO,CAAC;AAIlE,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,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoc7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/CodeCitation/CodeCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAoB,aAAa,EAAa,MAAM,OAAO,CAAC;AAS1E,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/CodeCitation/CodeCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAoB,aAAa,EAAa,MAAM,OAAO,CAAC;AAS1E,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAIhH,UAAU,iBAAiB;IACvB,uBAAuB,EAAE,MAAM,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,2BAA2B,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9C,yBAAyB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5C,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,yBAAyB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5C,sBAAsB,CAAC,EAAE,GAAG,CAAC;IAC7B,+BAA+B,CAAC,EAAE,GAAG,CAAC;IACtC,uBAAuB,EAAE,MAAM,CAAA;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sBAAsB,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B,0BAA0B,CAAC,EAAE,2BAA2B,CAAC;IACzD,MAAM,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,sBAAsB,CAAC,EAAE,aAAa,CAAC;KAC1C,CAAC;IACF,UAAU,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC;IAC/B,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8R7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ThemeCallback = (isDarkTheme: boolean) => void;
|
|
2
|
+
declare class ThemeManager {
|
|
3
|
+
private listeners;
|
|
4
|
+
private isDarkTheme;
|
|
5
|
+
private isInitialized;
|
|
6
|
+
constructor();
|
|
7
|
+
subscribe(callback: ThemeCallback): () => void;
|
|
8
|
+
setTheme(isDarkTheme: boolean): void;
|
|
9
|
+
getTheme(initialTheme?: boolean): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const themeManager: ThemeManager;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=themeManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeManager.d.ts","sourceRoot":"","sources":["../../../../src/utils/themeManager.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;AAEpD,cAAM,YAAY;IACd,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,aAAa,CAAU;;IAQ/B,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI;IAK9C,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IAKpC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO;CAS5C;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=new(function(){function e(){this.listeners=new Set,this.isDarkTheme=!0,this.isInitialized=!1}return e.prototype.subscribe=function(e){var t=this;return this.listeners.add(e),function(){return t.listeners.delete(e)}},e.prototype.setTheme=function(e){this.isDarkTheme=e,this.listeners.forEach((function(t){return t(e)}))},e.prototype.getTheme=function(e){return this.isInitialized||void 0===e||(this.setTheme(e),this.isInitialized=!0),this.isDarkTheme},e}());export{e as themeManager};
|
|
2
|
+
//# sourceMappingURL=themeManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeManager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|