@e-llm-studio/citation 0.0.221-beta.3 → 0.0.221-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=function(e){return e.endsWith("/")?e.slice(0,-1):e};exports.getFileContent=function(n,r){var o,i;return e.__awaiter(this,void 0,void 0,function(){var s,a,c,l;return e.__generator(this,function(e){switch(e.label){case 0:return s=t(r),a=n.startsWith("gs://")?n.replace("gs://",""):n,[4,fetch("".concat(s,"/gcs/get-file-content"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({file_path:a})})];case 1:if(!(c=e.sent()).ok)throw new Error("Failed to fetch file content: ".concat(c.statusText));return[4,c.json()];case 2:return l=e.sent(),[2,null!==(i=null===(o=null==l?void 0:l.responseData)||void 0===o?void 0:o.content)&&void 0!==i?i:""]}})})},exports.getNestedValue=function(e,t){var n;try{for(var r=t.split("."),o=e,i=0,s=r;i<s.length;i++){var a=s[i],c=a.match(/^(\w+)\[(\d+)\]$/);if(c){var l=c[1],u=c[2];o=null===(n=null==o?void 0:o[l])||void 0===n?void 0:n[Number(u)]}else o=null==o?void 0:o[a];if(null==o)return null}return o}catch(e){return console.error("Nested extraction error",e),null}},exports.getSignedUrl=function(n,r){return e.__awaiter(this,void 0,void 0,function(){var o,i,s;return e.__generator(this,function(e){switch(e.label){case 0:return o=n.startsWith("gs://")?n:"gs://".concat(n),i=t(r),[4,fetch("".concat(i,"/gcs/get-signed-url/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({gsutil_url:o})})];case 1:if(!(s=e.sent()).ok)throw new Error("Failed to get signed URL: ".concat(s.statusText));return[4,s.json()];case 2:return[2,e.sent()]}})})},exports.isJSONFile=function(e){var t;return null!==(t=null==e?void 0:e.toLowerCase().includes("json"))&&void 0!==t&&t};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=function(e){return e.endsWith("/")?e.slice(0,-1):e};exports.getFileContent=function(n,r){var o,i,s,l,a;return e.__awaiter(this,void 0,void 0,function(){var c,u,d,v;return e.__generator(this,function(e){switch(e.label){case 0:return c=t(r),u=n.startsWith("gs://")?n.replace("gs://",""):n,[4,fetch("".concat(c,"/gcs/get-file-content"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({file_path:u})})];case 1:if(!(d=e.sent()).ok)throw new Error("Failed to fetch file content: ".concat(d.statusText));return[4,d.json()];case 2:return v=e.sent(),[2,null!==(a=null!==(s=null!==(i=null===(o=null==v?void 0:v.responseData)||void 0===o?void 0:o.content)&&void 0!==i?i:null==v?void 0:v.content)&&void 0!==s?s:null===(l=null==v?void 0:v.responseData)||void 0===l?void 0:l.file_content)&&void 0!==a?a:""]}})})},exports.getNestedValue=function(e,t){var n;try{for(var r=t.split("."),o=e,i=0,s=r;i<s.length;i++){var l=s[i],a=l.match(/^(\w+)\[(\d+)\]$/);if(a){var c=a[1],u=a[2];o=null===(n=null==o?void 0:o[c])||void 0===n?void 0:n[Number(u)]}else o=null==o?void 0:o[l];if(null==o)return null}return o}catch(e){return console.error("Nested extraction error",e),null}},exports.getSignedUrl=function(n,r){return e.__awaiter(this,void 0,void 0,function(){var o,i,s;return e.__generator(this,function(e){switch(e.label){case 0:return o=n.startsWith("gs://")?n:"gs://".concat(n),i=t(r),[4,fetch("".concat(i,"/gcs/get-signed-url/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({gsutil_url:o})})];case 1:if(!(s=e.sent()).ok)throw new Error("Failed to get signed URL: ".concat(s.statusText));return[4,s.json()];case 2:return[2,e.sent()]}})})},exports.isJSONFile=function(e){var t;return null!==(t=null==e?void 0:e.toLowerCase().includes("json"))&&void 0!==t&&t};
2
2
  //# sourceMappingURL=RuleBookCitationApi.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),l=require("react"),n=require("lucide-react"),t=require("../TextualGuidelines/TextualGuideLinesComponent.js"),r=require("./RuleBookCitationApi.js");exports.default=function(a){var o,s,d,u,c,v=a.data,f=a.msg,g=a.citationIndex,h=a.guidelines,p=void 0===h?[]:h,x=a.url,_=a.additionalClassNames;console.log("Latest code");var m=null!==(s=null!==(o=null==v?void 0:v.citationNumber)&&void 0!==o?o:g)&&void 0!==s?s:0,b=(null==f?void 0:f.requestId)||(null==f?void 0:f.id)||"",j=l.useState(null),y=j[0],C=j[1],S=l.useState(null),D=S[0],k=S[1],q=l.useState(null),w=q[0],N=q[1],L=l.useState(!1),A=L[0],R=L[1],T=l.useState(null),B=T[0],E=T[1];l.useEffect(function(){var e,i,l,n;if(!y){if(null===(e=null==v?void 0:v.fileDetails)||void 0===e?void 0:e.file_id)return E(null),C(v.fileDetails.file_id),void k(v.fileDetails.phrase_to_highlight||null);var t=(null!==(n=null===(l=null===(i=null==f?void 0:f.artifactSearchData)||void 0===i?void 0:i.ruleBookData)||void 0===l?void 0:l.rulebook_citations)&&void 0!==n?n:[])[m];if(!t)return E("Citation not found at the specified index."),C(null),void k(null);if(!t.file_id)return E("Citation data is missing file_id."),C(null),void k(null);N(null),E(null),C(t.file_id),k(t.phrase_to_highlight||null)}},[b,m,y,null===(d=null==v?void 0:v.fileDetails)||void 0===d?void 0:d.file_id,null===(u=null==v?void 0:v.fileDetails)||void 0===u?void 0:u.phrase_to_highlight]),l.useEffect(function(){if(y){var i=Array.isArray(p)?p:Object.values(p||{}).flat();e.__awaiter(void 0,void 0,void 0,function(){var l,n,t,a,o,s,d,u;return e.__generator(this,function(e){switch(e.label){case 0:if(!(null==(l=i.find(function(e){return e.id===y}))?void 0:l.gcsUrl))return[2];e.label=1;case 1:return e.trys.push([1,4,5,6]),R(!0),E(null),[4,r.getSignedUrl(l.gcsUrl,x)];case 2:if(null==(n=e.sent())?void 0:n.error)throw new Error(n.error);return t=(null===(u=l.name)||void 0===u?void 0:u.toLowerCase().split(".").pop())||"",r.isJSONFile(t)?[4,r.getFileContent(l.gcsUrl,x)]:[2];case 3:return a=e.sent(),o=JSON.parse(a),s=r.getNestedValue(o,"data.artifactData.userStorySnapshot[0].value"),N(s||""),[3,6];case 4:return d=e.sent(),console.error(d),E(d.message||"An error occurred while loading file contents."),N(null),[3,6];case 5:return R(!1),[7];case 6:return[2]}})})}else N(null)},[y,p,x]);var G=A,H=(null==w?void 0:w.replace(/\\\./g,"."))||"";return i.jsxs("div",e.__assign({className:null!==(c=null==_?void 0:_.container)&&void 0!==c?c:"",style:{width:"100%",minHeight:"100px"}},{children:[G&&i.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[i.jsx(n.Loader2,{style:{animation:"spin 1s linear infinite"},size:24}),i.jsx("span",{children:"Loading content..."})]})),B&&!G&&i.jsxs("div",e.__assign({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[i.jsx("strong",{children:"Error:"})," ",B]})),!G&&!B&&w&&i.jsx("div",e.__assign({style:{marginTop:"12px"}},{children:i.jsx(t.default,{TextualGuideLines:H,HighlightedWords:D?[D]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1})})),!G&&!B&&!w&&i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available."})),i.jsx("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),l=require("react"),t=require("lucide-react"),n=require("../TextualGuidelines/TextualGuideLinesComponent.js"),r=require("./RuleBookCitationApi.js");exports.default=function(o){var a,s,d,u,c,f=o.data,v=o.msg,g=o.citationIndex,h=o.guidelines,p=void 0===h?[]:h,x=o.url,_=o.additionalClassNames;console.log("Latest code");var m=Math.max((null!==(s=null!==(a=null==f?void 0:f.citationNumber)&&void 0!==a?a:g)&&void 0!==s?s:1)-1,0),b=(null==v?void 0:v.requestId)||(null==v?void 0:v.id)||"",j=l.useState(null),y=j[0],C=j[1],S=l.useState(null),w=S[0],D=S[1],k=l.useState(null),q=k[0],N=k[1],E=l.useState(!1),L=E[0],A=E[1],R=l.useState(null),T=R[0],B=R[1];l.useEffect(function(){var e,i,l,t;if(!y){if(null===(e=null==f?void 0:f.fileDetails)||void 0===e?void 0:e.file_id)return B(null),C(f.fileDetails.file_id),void D(f.fileDetails.phrase_to_highlight||null);var n=(null!==(t=null===(l=null===(i=null==v?void 0:v.artifactSearchData)||void 0===i?void 0:i.ruleBookData)||void 0===l?void 0:l.rulebook_citations)&&void 0!==t?t:[])[m];if(!n)return B("Citation not found at the specified index."),C(null),void D(null);if(!n.file_id)return B("Citation data is missing file_id."),C(null),void D(null);N(null),B(null),C(n.file_id),D(n.phrase_to_highlight||null)}},[b,m,y,null===(d=null==f?void 0:f.fileDetails)||void 0===d?void 0:d.file_id,null===(u=null==f?void 0:f.fileDetails)||void 0===u?void 0:u.phrase_to_highlight]),l.useEffect(function(){if(y){var i=Array.isArray(p)?p:Object.values(p||{}).flat();e.__awaiter(void 0,void 0,void 0,function(){var l,t,n,o,a,s,d,u;return e.__generator(this,function(e){switch(e.label){case 0:if(!(null==(l=i.find(function(e){return e.id===y}))?void 0:l.gcsUrl))return[2];e.label=1;case 1:return e.trys.push([1,4,5,6]),A(!0),B(null),[4,r.getSignedUrl(l.gcsUrl,x)];case 2:if(null==(t=e.sent())?void 0:t.error)throw new Error(t.error);return n=(null===(u=l.name)||void 0===u?void 0:u.toLowerCase().split(".").pop())||"",r.isJSONFile(n)?[4,r.getFileContent(l.gcsUrl,x)]:[2];case 3:if(!(null==(o=e.sent())?void 0:o.trim()))throw new Error("Empty file content returned from the backend.");return a=JSON.parse(o),s=r.getNestedValue(a,"data.artifactData.userStorySnapshot[0].value"),N(s||""),[3,6];case 4:return d=e.sent(),console.error(d),B(d.message||"An error occurred while loading file contents."),N(null),[3,6];case 5:return A(!1),[7];case 6:return[2]}})})}else N(null)},[y,p,x]);var G=L,H=(null==q?void 0:q.replace(/\\\./g,"."))||"";return i.jsxs("div",e.__assign({className:null!==(c=null==_?void 0:_.container)&&void 0!==c?c:"",style:{width:"100%",minHeight:"100px"}},{children:[G&&i.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[i.jsx(t.Loader2,{style:{animation:"spin 1s linear infinite"},size:24}),i.jsx("span",{children:"Loading content..."})]})),T&&!G&&i.jsxs("div",e.__assign({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[i.jsx("strong",{children:"Error:"})," ",T]})),!G&&!T&&q&&i.jsx("div",e.__assign({style:{marginTop:"12px"}},{children:i.jsx(n.default,{TextualGuideLines:H,HighlightedWords:w?[w]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1})})),!G&&!T&&!q&&i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available."})),i.jsx("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};
2
2
  //# sourceMappingURL=RuleBookCitationWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as t,__generator as n}from"tslib";var e=function(t){return t.endsWith("/")?t.slice(0,-1):t};function r(t){var n;return null!==(n=null==t?void 0:t.toLowerCase().includes("json"))&&void 0!==n&&n}function o(r,o){return t(this,void 0,void 0,function(){var t,i,s;return n(this,function(n){switch(n.label){case 0:return t=r.startsWith("gs://")?r:"gs://".concat(r),i=e(o),[4,fetch("".concat(i,"/gcs/get-signed-url/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({gsutil_url:t})})];case 1:if(!(s=n.sent()).ok)throw new Error("Failed to get signed URL: ".concat(s.statusText));return[4,s.json()];case 2:return[2,n.sent()]}})})}function i(r,o){var i,s;return t(this,void 0,void 0,function(){var t,c,a,l;return n(this,function(n){switch(n.label){case 0:return t=e(o),c=r.startsWith("gs://")?r.replace("gs://",""):r,[4,fetch("".concat(t,"/gcs/get-file-content"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({file_path:c})})];case 1:if(!(a=n.sent()).ok)throw new Error("Failed to fetch file content: ".concat(a.statusText));return[4,a.json()];case 2:return l=n.sent(),[2,null!==(s=null===(i=null==l?void 0:l.responseData)||void 0===i?void 0:i.content)&&void 0!==s?s:""]}})})}function s(t,n){var e;try{for(var r=n.split("."),o=t,i=0,s=r;i<s.length;i++){var c=s[i],a=c.match(/^(\w+)\[(\d+)\]$/);if(a){var l=a[1],u=a[2];o=null===(e=null==o?void 0:o[l])||void 0===e?void 0:e[Number(u)]}else o=null==o?void 0:o[c];if(null==o)return null}return o}catch(t){return console.error("Nested extraction error",t),null}}export{i as getFileContent,s as getNestedValue,o as getSignedUrl,r as isJSONFile};
1
+ import{__awaiter as t,__generator as n}from"tslib";var e=function(t){return t.endsWith("/")?t.slice(0,-1):t};function o(t){var n;return null!==(n=null==t?void 0:t.toLowerCase().includes("json"))&&void 0!==n&&n}function r(o,r){return t(this,void 0,void 0,function(){var t,i,l;return n(this,function(n){switch(n.label){case 0:return t=o.startsWith("gs://")?o:"gs://".concat(o),i=e(r),[4,fetch("".concat(i,"/gcs/get-signed-url/"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({gsutil_url:t})})];case 1:if(!(l=n.sent()).ok)throw new Error("Failed to get signed URL: ".concat(l.statusText));return[4,l.json()];case 2:return[2,n.sent()]}})})}function i(o,r){var i,l,s,c,a;return t(this,void 0,void 0,function(){var t,u,d,v;return n(this,function(n){switch(n.label){case 0:return t=e(r),u=o.startsWith("gs://")?o.replace("gs://",""):o,[4,fetch("".concat(t,"/gcs/get-file-content"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({file_path:u})})];case 1:if(!(d=n.sent()).ok)throw new Error("Failed to fetch file content: ".concat(d.statusText));return[4,d.json()];case 2:return v=n.sent(),[2,null!==(a=null!==(s=null!==(l=null===(i=null==v?void 0:v.responseData)||void 0===i?void 0:i.content)&&void 0!==l?l:null==v?void 0:v.content)&&void 0!==s?s:null===(c=null==v?void 0:v.responseData)||void 0===c?void 0:c.file_content)&&void 0!==a?a:""]}})})}function l(t,n){var e;try{for(var o=n.split("."),r=t,i=0,l=o;i<l.length;i++){var s=l[i],c=s.match(/^(\w+)\[(\d+)\]$/);if(c){var a=c[1],u=c[2];r=null===(e=null==r?void 0:r[a])||void 0===e?void 0:e[Number(u)]}else r=null==r?void 0:r[s];if(null==r)return null}return r}catch(t){return console.error("Nested extraction error",t),null}}export{i as getFileContent,l as getNestedValue,r as getSignedUrl,o as isJSONFile};
2
2
  //# sourceMappingURL=RuleBookCitationApi.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i,__awaiter as e,__generator as l}from"tslib";import{jsxs as n,jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as o}from"react";import{Loader2 as a}from"lucide-react";import d from"../TextualGuidelines/TextualGuideLinesComponent.js";import{getNestedValue as s,isJSONFile as u,getFileContent as c,getSignedUrl as f}from"./RuleBookCitationApi.js";var v=function(v){var p,g,h,m,x,b=v.data,y=v.msg,_=v.citationIndex,C=v.guidelines,D=void 0===C?[]:C,k=v.url,w=v.additionalClassNames;console.log("Latest code");var j=null!==(g=null!==(p=null==b?void 0:b.citationNumber)&&void 0!==p?p:_)&&void 0!==g?g:0,A=(null==y?void 0:y.requestId)||(null==y?void 0:y.id)||"",L=t(null),N=L[0],R=L[1],T=t(null),B=T[0],G=T[1],H=t(null),I=H[0],S=H[1],U=t(!1),E=U[0],O=U[1],q=t(null),z=q[0],J=q[1];o(function(){var i,e,l,n;if(!N){if(null===(i=null==b?void 0:b.fileDetails)||void 0===i?void 0:i.file_id)return J(null),R(b.fileDetails.file_id),void G(b.fileDetails.phrase_to_highlight||null);var r=(null!==(n=null===(l=null===(e=null==y?void 0:y.artifactSearchData)||void 0===e?void 0:e.ruleBookData)||void 0===l?void 0:l.rulebook_citations)&&void 0!==n?n:[])[j];if(!r)return J("Citation not found at the specified index."),R(null),void G(null);if(!r.file_id)return J("Citation data is missing file_id."),R(null),void G(null);S(null),J(null),R(r.file_id),G(r.phrase_to_highlight||null)}},[A,j,N,null===(h=null==b?void 0:b.fileDetails)||void 0===h?void 0:h.file_id,null===(m=null==b?void 0:b.fileDetails)||void 0===m?void 0:m.phrase_to_highlight]),o(function(){if(N){var i=Array.isArray(D)?D:Object.values(D||{}).flat();e(void 0,void 0,void 0,function(){var e,n,r,t,o,a,d,v;return l(this,function(l){switch(l.label){case 0:if(!(null==(e=i.find(function(i){return i.id===N}))?void 0:e.gcsUrl))return[2];l.label=1;case 1:return l.trys.push([1,4,5,6]),O(!0),J(null),[4,f(e.gcsUrl,k)];case 2:if(null==(n=l.sent())?void 0:n.error)throw new Error(n.error);return r=(null===(v=e.name)||void 0===v?void 0:v.toLowerCase().split(".").pop())||"",u(r)?[4,c(e.gcsUrl,k)]:[2];case 3:return t=l.sent(),o=JSON.parse(t),a=s(o,"data.artifactData.userStorySnapshot[0].value"),S(a||""),[3,6];case 4:return d=l.sent(),console.error(d),J(d.message||"An error occurred while loading file contents."),S(null),[3,6];case 5:return O(!1),[7];case 6:return[2]}})})}else S(null)},[N,D,k]);var V=E,W=(null==I?void 0:I.replace(/\\\./g,"."))||"";return n("div",i({className:null!==(x=null==w?void 0:w.container)&&void 0!==x?x:"",style:{width:"100%",minHeight:"100px"}},{children:[V&&n("div",i({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[r(a,{style:{animation:"spin 1s linear infinite"},size:24}),r("span",{children:"Loading content..."})]})),z&&!V&&n("div",i({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[r("strong",{children:"Error:"})," ",z]})),!V&&!z&&I&&r("div",i({style:{marginTop:"12px"}},{children:r(d,{TextualGuideLines:W,HighlightedWords:B?[B]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1})})),!V&&!z&&!I&&r("div",i({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available."})),r("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};export{v as default};
1
+ import{__assign as i,__awaiter as e,__generator as l}from"tslib";import{jsxs as n,jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as o}from"react";import{Loader2 as a}from"lucide-react";import d from"../TextualGuidelines/TextualGuideLinesComponent.js";import{getNestedValue as u,isJSONFile as s,getFileContent as c,getSignedUrl as f}from"./RuleBookCitationApi.js";var v=function(v){var p,h,g,m,x,b=v.data,y=v.msg,_=v.citationIndex,C=v.guidelines,D=void 0===C?[]:C,k=v.url,w=v.additionalClassNames;console.log("Latest code");var j=Math.max((null!==(h=null!==(p=null==b?void 0:b.citationNumber)&&void 0!==p?p:_)&&void 0!==h?h:1)-1,0),A=(null==y?void 0:y.requestId)||(null==y?void 0:y.id)||"",L=t(null),N=L[0],R=L[1],T=t(null),B=T[0],E=T[1],G=t(null),H=G[0],I=G[1],S=t(!1),U=S[0],O=S[1],q=t(null),z=q[0],J=q[1];o(function(){var i,e,l,n;if(!N){if(null===(i=null==b?void 0:b.fileDetails)||void 0===i?void 0:i.file_id)return J(null),R(b.fileDetails.file_id),void E(b.fileDetails.phrase_to_highlight||null);var r=(null!==(n=null===(l=null===(e=null==y?void 0:y.artifactSearchData)||void 0===e?void 0:e.ruleBookData)||void 0===l?void 0:l.rulebook_citations)&&void 0!==n?n:[])[j];if(!r)return J("Citation not found at the specified index."),R(null),void E(null);if(!r.file_id)return J("Citation data is missing file_id."),R(null),void E(null);I(null),J(null),R(r.file_id),E(r.phrase_to_highlight||null)}},[A,j,N,null===(g=null==b?void 0:b.fileDetails)||void 0===g?void 0:g.file_id,null===(m=null==b?void 0:b.fileDetails)||void 0===m?void 0:m.phrase_to_highlight]),o(function(){if(N){var i=Array.isArray(D)?D:Object.values(D||{}).flat();e(void 0,void 0,void 0,function(){var e,n,r,t,o,a,d,v;return l(this,function(l){switch(l.label){case 0:if(!(null==(e=i.find(function(i){return i.id===N}))?void 0:e.gcsUrl))return[2];l.label=1;case 1:return l.trys.push([1,4,5,6]),O(!0),J(null),[4,f(e.gcsUrl,k)];case 2:if(null==(n=l.sent())?void 0:n.error)throw new Error(n.error);return r=(null===(v=e.name)||void 0===v?void 0:v.toLowerCase().split(".").pop())||"",s(r)?[4,c(e.gcsUrl,k)]:[2];case 3:if(!(null==(t=l.sent())?void 0:t.trim()))throw new Error("Empty file content returned from the backend.");return o=JSON.parse(t),a=u(o,"data.artifactData.userStorySnapshot[0].value"),I(a||""),[3,6];case 4:return d=l.sent(),console.error(d),J(d.message||"An error occurred while loading file contents."),I(null),[3,6];case 5:return O(!1),[7];case 6:return[2]}})})}else I(null)},[N,D,k]);var M=U,V=(null==H?void 0:H.replace(/\\\./g,"."))||"";return n("div",i({className:null!==(x=null==w?void 0:w.container)&&void 0!==x?x:"",style:{width:"100%",minHeight:"100px"}},{children:[M&&n("div",i({style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",gap:"8px"}},{children:[r(a,{style:{animation:"spin 1s linear infinite"},size:24}),r("span",{children:"Loading content..."})]})),z&&!M&&n("div",i({style:{padding:"12px",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",borderRadius:"4px",color:"#991b1b",marginBottom:"12px"}},{children:[r("strong",{children:"Error:"})," ",z]})),!M&&!z&&H&&r("div",i({style:{marginTop:"12px"}},{children:r(d,{TextualGuideLines:V,HighlightedWords:B?[B]:[],InternalGptReasoningData:[],index:0,headerTitle:"Rule Book Citation",useVariantHighlight:!1})})),!M&&!z&&!H&&r("div",i({style:{padding:"12px",backgroundColor:"#f3f4f6",border:"1px solid #d1d5db",borderRadius:"4px",color:"#6b7280",textAlign:"center"}},{children:"No content available."})),r("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}))};export{v as default};
2
2
  //# sourceMappingURL=RuleBookCitationWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleBookCitationWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/features/RulebookCitations/RuleBookCitationWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAKL,UAAU,EAEX,MAAM,uBAAuB,CAAC;AAE/B,UAAU,4BAA4B;IACpC,IAAI,CAAC,EAAE;QACL,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,mBAAmB,EAAE,MAAM,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,oBAAoB,CAAC,EAAE;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAqQnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"RuleBookCitationWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/features/RulebookCitations/RuleBookCitationWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAKL,UAAU,EAEX,MAAM,uBAAuB,CAAC;AAE/B,UAAU,4BAA4B;IACpC,IAAI,CAAC,EAAE;QACL,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,mBAAmB,EAAE,MAAM,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,oBAAoB,CAAC,EAAE;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA0QnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.221-beta.3",
3
+ "version": "0.0.221-beta.4",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",