@e-llm-studio/citation 0.0.233-beta.1 → 0.0.234

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"),l=require("react/jsx-runtime"),i=require("./components/ChatCitation.js"),o=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),d=require("./components/DetailedView.js"),a=require("./components/SummarizedView.js"),s=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(require("@mui/icons-material/CloseOutlined")),m=function(e,l,i){if(void 0===i&&(i="smooth"),l){for(var o=e.parentElement;o;){var n=window.getComputedStyle(o).overflowY;if(("auto"===n||"scroll"===n)&&o.scrollHeight>o.clientHeight)break;if(o===l){o=null;break}o=o.parentElement}var t=null!=o?o:l,r=e.getBoundingClientRect(),d=t.getBoundingClientRect(),a=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,a),behavior:i})}},x={chatData:[]};exports.default=function(g){var b,y,_,C,w,S,j,k,A,q,T,D,R,F,E,I,z,B,P,H,V,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,ie,oe,ne,te,re,de,ae,se,ue,ve,ce,he=g.rootContainer,fe=g.chatContainer,ge=void 0===fe?x:fe,pe=g.ruleBookContainer,me=g.renderer,xe=g.additionalData,be=g.tableComponent,ye=g.closePreview,_e=g.isRenderedCustomComponent,Ce=void 0!==_e&&_e,we=g.showRootContainer,Se=void 0===we||we,je=g.reversePanels,ke=void 0!==je&&je,Ae=u.useState(0),qe=Ae[0],Te=Ae[1],De=u.useState(0),Re=De[0],Fe=De[1],Ee=u.useState(0),Ie=Ee[0],ze=Ee[1],Be=u.useState(0),Pe=Be[0],He=Be[1],Ve=u.useRef(null),Me=u.useRef(null),Ne=u.useRef(null),We=u.useMemo(function(){return e.__assign(e.__assign({},v.defaultRenderer),me)},[me]),Ye=u.useMemo(function(){return!!((null==be?void 0:be.rows)&&Object.keys(be.rows).length>0)},[be]),Oe=u.useMemo(function(){var e;return null!==(e=null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l,i;if((null==pe?void 0:pe.show)&&Ve.current){var o=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(Te((null==o?void 0:o.length)||0),Fe(0),o&&o.length>0){var n=o[0];n.style.backgroundColor="#ffff5c",m(n,Ve.current)}}if((null==ge?void 0:ge.show)&&(null==Me?void 0:Me.current)){var t=null===(l=Me.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(ze((null==t?void 0:t.length)||0),He(0),t&&t.length>0){var r=t[0];r.style.backgroundColor="#ffff5c";var d=requestAnimationFrame(function(){m(r,Ne.current)});return function(){return cancelAnimationFrame(d)}}var a=null==xe?void 0:xe.targetIndex;if(void 0!==a&&a>=0&&(null===(i=Me.current)||void 0===i?void 0:i.firstElementChild)){var s=Me.current.firstElementChild.children[a];if(s){var u=requestAnimationFrame(function(){m(s,Ne.current)});return function(){return cancelAnimationFrame(u)}}}}},[null==ge?void 0:ge.show,null==pe?void 0:pe.show,null==pe?void 0:pe.data,null==ge?void 0:ge.chatData,null==xe?void 0:xe.targetIndex]);var Ke=u.useCallback(function(){var e;if(Re+1<qe){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[Re].style.backgroundColor="#ffffb8";var i=Re+1;Fe(i);var o=l[i];o.style.backgroundColor="#ffff5c",m(o,Ve.current)}},[Re,qe]),Qe=u.useCallback(function(){var e;if(!(Re-1<0)){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[Re].style.backgroundColor="#ffffb8";var i=Re-1,o=l[i];o.style.backgroundColor="#ffff5c",Fe(i),m(o,Ve.current)}}},[Re]),Ue=u.useCallback(function(){var e;if(Pe+1<Ie){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[Pe].style.backgroundColor="#ffffb8";var i=Pe+1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),m(o,Ne.current)}},[Pe,Ie]),Ge=u.useCallback(function(){var e;if(!(Pe-1<0)){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[Pe].style.backgroundColor="#ffffb8";var i=Pe-1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),m(o,Ne.current)}}},[Pe]),Je=o.getColorCode((null==he?void 0:he.relevanceScore)||0),Le=u.useMemo(function(){var i,o=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Je.border,backgroundColor:Je.background,color:Je.text},null===(i=null==he?void 0:he.slotStyles)||void 0===i?void 0:i.relevanceScore)},{children:[(null==he?void 0:he.relevanceTitle)||"Decision Strength",":"," ",(null==he?void 0:he.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:ye},{children:l.jsx(p.default,{})}),"close-preview");return Ce&&!(null==xe?void 0:xe.isExpanded)?[o,n]:[o]},[Ce,Je.background,Je.border,Je.text,null==he?void 0:he.relevanceScore,null===(b=null==he?void 0:he.slotStyles)||void 0===b?void 0:b.relevanceScore,null==he?void 0:he.relevanceTitle]),Xe=u.useMemo(function(){return[qe>0&&l.jsx(r.default,{currentItemNumber:Re+1,totalItems:qe,disableNext:Re+1>=qe,onNext:Ke,onPrevious:Qe,disablePrevious:Re<=0},"rulebook-nav")]},[Re,Ke,Qe,qe]),Ze=u.useMemo(function(){return(null==xe?void 0:xe.RuleBookContainerHeight)?xe.RuleBookContainerHeight:!(!Oe||(null==xe?void 0:xe.isExpanded))&&"600px"},[null==xe?void 0:xe.RuleBookContainerHeight,Oe]),$e=u.useMemo(function(){var e,i;return[(null===(i=null===(e=null==ge?void 0:ge.detailedTab)||void 0===e?void 0:e.chip)||void 0===i?void 0:i.isActive)&&Ie>0&&l.jsx(r.default,{currentItemNumber:Pe+1,totalItems:Ie,onNext:Ue,onPrevious:Ge,disableNext:Pe+1>=Ie,disablePrevious:Pe<=0},"chat-nav")]},[null===(_=null===(y=null==ge?void 0:ge.detailedTab)||void 0===y?void 0:y.chip)||void 0===_?void 0:_.isActive,Pe,Ue,Ge,Ie]),el=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:ke?Oe?"column-reverse":"row-reverse":Oe?"column":"row",gap:[(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show),Ye].filter(Boolean).length>1?"12px":"0",height:Ze||"100%",minHeight:0},null===(C=null==he?void 0:he.slotStyles)||void 0===C?void 0:C.container)},{children:[Ye&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(w=null==ge?void 0:ge.slotStyles)||void 0===w?void 0:w.outerContainer)},{children:l.jsx(i.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==xe?void 0:xe.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==be?void 0:be.rows)&&l.jsx(f.BigQueryTable,{rows:be.rows,columns:be.columns||[]})}))}))})),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(S=null==pe?void 0:pe.slotStyles)||void 0===S?void 0:S.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(j=null==pe?void 0:pe.title)&&void 0!==j?j:"Rule book",icon:null==pe?void 0:pe.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(k=null==pe?void 0:pe.slotStyles)||void 0===k?void 0:k.title),body:null===(A=null==pe?void 0:pe.slotStyles)||void 0===A?void 0:A.body},secondaryActions:(null==pe?void 0:pe.secondaryActions)?pe.secondaryActions(Xe):Xe},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(q=null==pe?void 0:pe.slotStyles)||void 0===q?void 0:q.dataContainer)},{children:l.jsx("div",e.__assign({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Ve},{children:l.jsx(s.default,{data:pe.data,renderers:null!==(T=null==pe?void 0:pe.renderer)&&void 0!==T?T:We})}))}))}))})),(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(D=null==ge?void 0:ge.slotStyles)||void 0===D?void 0:D.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(R=null==ge?void 0:ge.title)&&void 0!==R?R:"Chat",icon:null==ge?void 0:ge.chatIcon,containerStyles:null===(F=null==ge?void 0:ge.slotStyles)||void 0===F?void 0:F.container,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(E=null==ge?void 0:ge.slotStyles)||void 0===E?void 0:E.title),body:null===(I=null==ge?void 0:ge.slotStyles)||void 0===I?void 0:I.body},primaryActions:[((null===(B=null===(z=null==ge?void 0:ge.summarizedTab)||void 0===z?void 0:z.chip)||void 0===B?void 0:B.show)||void 0===(null===(H=null===(P=null==ge?void 0:ge.summarizedTab)||void 0===P?void 0:P.chip)||void 0===H?void 0:H.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(V=null==ge?void 0:ge.summarizedTab)||void 0===V?void 0:V.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(M=null==ge?void 0:ge.detailedTab)||void 0===M?void 0:M.chip))],secondaryActions:ge.secondaryActions?null==ge?void 0:ge.secondaryActions($e):$e},{children:l.jsxs("div",e.__assign({ref:Ne,style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(N=null==ge?void 0:ge.slotStyles)||void 0===N?void 0:N.chatDataContainer)},{children:[(null===(Y=null===(W=null==ge?void 0:ge.detailedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.isActive)&&l.jsx("div",e.__assign({ref:Me,style:{position:(null==xe?void 0:xe.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(d.default,{chatData:null!==(O=ge.chatData)&&void 0!==O?O:[],assistantChatProps:e.__assign(e.__assign({},null===(Q=null===(K=null==ge?void 0:ge.detailedTab)||void 0===K?void 0:K.view)||void 0===Q?void 0:Q.assistantChatProps),{renderers:null!==(J=null===(G=null===(U=null==ge?void 0:ge.detailedTab)||void 0===U?void 0:U.detailedViewRenderer)||void 0===G?void 0:G.assistantText)&&void 0!==J?J:We}),userChatItemProps:e.__assign(e.__assign({},null===(X=null===(L=null==ge?void 0:ge.detailedTab)||void 0===L?void 0:L.view)||void 0===X?void 0:X.userChatItemProps),{renderers:null!==(ee=null===($=null===(Z=null==ge?void 0:ge.detailedTab)||void 0===Z?void 0:Z.detailedViewRenderer)||void 0===$?void 0:$.userText)&&void 0!==ee?ee:We})})})),(null===(ie=null===(le=null==ge?void 0:ge.summarizedTab)||void 0===le?void 0:le.chip)||void 0===ie?void 0:ie.show)&&(null===(ne=null===(oe=null==ge?void 0:ge.summarizedTab)||void 0===oe?void 0:oe.chip)||void 0===ne?void 0:ne.isActive)&&l.jsx(a.default,e.__assign({chatData:null!==(te=ge.chatData)&&void 0!==te?te:[]},null===(re=null==ge?void 0:ge.summarizedTab)||void 0===re?void 0:re.view,{renderer:null!==(ae=null===(de=null==ge?void 0:ge.summarizedTab)||void 0===de?void 0:de.summarizedViewRenderer)&&void 0!==ae?ae:We}))]}))}))}))]}));return Se?l.jsx(i.default,e.__assign({title:null==he?void 0:he.title,slotStyles:{title:null===(se=null==he?void 0:he.slotStyles)||void 0===se?void 0:se.title,body:null===(ue=null==he?void 0:he.slotStyles)||void 0===ue?void 0:ue.body},containerStyles:null===(ve=null==he?void 0:he.slotStyles)||void 0===ve?void 0:ve.container,icon:null!==(ce=null==he?void 0:he.icon)&&void 0!==ce?ce:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==he?void 0:he.secondaryActions)?he.secondaryActions(Le):Le},{children:el})):el};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),l=require("react/jsx-runtime"),i=require("./components/ChatCitation.js"),o=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),d=require("./components/DetailedView.js"),s=require("./components/SummarizedView.js"),a=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(require("@mui/icons-material/CloseOutlined")),b=function(e,l,i){if(void 0===i&&(i="smooth"),l){for(var o=e.parentElement;o;){var n=window.getComputedStyle(o).overflowY;if(("auto"===n||"scroll"===n)&&o.scrollHeight>o.clientHeight)break;if(o===l){o=null;break}o=o.parentElement}var t=null!=o?o:l,r=e.getBoundingClientRect(),d=t.getBoundingClientRect(),s=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,s),behavior:i})}},x={chatData:[]};exports.default=function(g){var m,y,_,C,w,S,j,k,q,A,T,D,R,F,z,B,E,I,P,H,V,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,ie,oe,ne,te,re,de,se,ae,ue,ve,ce,he=g.rootContainer,fe=g.chatContainer,ge=void 0===fe?x:fe,pe=g.ruleBookContainer,be=g.renderer,xe=g.additionalData,me=g.tableComponent,ye=g.closePreview,_e=g.isRenderedCustomComponent,Ce=void 0!==_e&&_e,we=g.showRootContainer,Se=void 0===we||we,je=g.reversePanels,ke=void 0!==je&&je,qe=u.useState(0),Ae=qe[0],Te=qe[1],De=u.useState(0),Re=De[0],Fe=De[1],ze=u.useState(0),Be=ze[0],Ee=ze[1],Ie=u.useState(0),Pe=Ie[0],He=Ie[1],Ve=u.useRef(null),Me=u.useRef(null),Ne=u.useRef(null),We=u.useMemo(function(){return e.__assign(e.__assign({},v.defaultRenderer),be)},[be]),Ye=u.useMemo(function(){return!!((null==me?void 0:me.rows)&&Object.keys(me.rows).length>0)},[me]),Oe=u.useMemo(function(){var e;return null!==(e=null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l;if((null==pe?void 0:pe.show)&&Ve.current){var i=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(Te((null==i?void 0:i.length)||0),Fe(0),i&&i.length>0){var o=i[0];o.style.backgroundColor="#ffff5c",b(o,Ve.current)}}if((null==ge?void 0:ge.show)&&(null==Me?void 0:Me.current)){var n=null===(l=Me.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Ee((null==n?void 0:n.length)||0),He(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){b(t,Ne.current)});return function(){return cancelAnimationFrame(r)}}}},[null==ge?void 0:ge.show,null==pe?void 0:pe.show,null==pe?void 0:pe.data,null==ge?void 0:ge.chatData]);var Ke=u.useCallback(function(){var e;if(Re+1<Ae){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[Re].style.backgroundColor="#ffffb8";var i=Re+1;Fe(i);var o=l[i];o.style.backgroundColor="#ffff5c",b(o,Ve.current)}},[Re,Ae]),Qe=u.useCallback(function(){var e;if(!(Re-1<0)){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[Re].style.backgroundColor="#ffffb8";var i=Re-1,o=l[i];o.style.backgroundColor="#ffff5c",Fe(i),b(o,Ve.current)}}},[Re]),Ue=u.useCallback(function(){var e;if(Pe+1<Be){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[Pe].style.backgroundColor="#ffffb8";var i=Pe+1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),b(o,Ne.current)}},[Pe,Be]),Ge=u.useCallback(function(){var e;if(!(Pe-1<0)){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[Pe].style.backgroundColor="#ffffb8";var i=Pe-1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),b(o,Ne.current)}}},[Pe]),Je=o.getColorCode((null==he?void 0:he.relevanceScore)||0),Le=u.useMemo(function(){var i,o=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Je.border,backgroundColor:Je.background,color:Je.text},null===(i=null==he?void 0:he.slotStyles)||void 0===i?void 0:i.relevanceScore)},{children:[(null==he?void 0:he.relevanceTitle)||"Decision Strength",":"," ",(null==he?void 0:he.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:ye},{children:l.jsx(p.default,{})}),"close-preview");return Ce&&!(null==xe?void 0:xe.isExpanded)?[o,n]:[o]},[Ce,Je.background,Je.border,Je.text,null==he?void 0:he.relevanceScore,null===(m=null==he?void 0:he.slotStyles)||void 0===m?void 0:m.relevanceScore,null==he?void 0:he.relevanceTitle]),Xe=u.useMemo(function(){return[Ae>0&&l.jsx(r.default,{currentItemNumber:Re+1,totalItems:Ae,disableNext:Re+1>=Ae,onNext:Ke,onPrevious:Qe,disablePrevious:Re<=0},"rulebook-nav")]},[Re,Ke,Qe,Ae]),Ze=u.useMemo(function(){return(null==xe?void 0:xe.RuleBookContainerHeight)?xe.RuleBookContainerHeight:!(!Oe||(null==xe?void 0:xe.isExpanded))&&"600px"},[null==xe?void 0:xe.RuleBookContainerHeight,Oe]),$e=u.useMemo(function(){var e,i;return[(null===(i=null===(e=null==ge?void 0:ge.detailedTab)||void 0===e?void 0:e.chip)||void 0===i?void 0:i.isActive)&&Be>0&&l.jsx(r.default,{currentItemNumber:Pe+1,totalItems:Be,onNext:Ue,onPrevious:Ge,disableNext:Pe+1>=Be,disablePrevious:Pe<=0},"chat-nav")]},[null===(_=null===(y=null==ge?void 0:ge.detailedTab)||void 0===y?void 0:y.chip)||void 0===_?void 0:_.isActive,Pe,Ue,Ge,Be]),el=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:ke?Oe?"column-reverse":"row-reverse":Oe?"column":"row",gap:[(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show),Ye].filter(Boolean).length>1?"12px":"0",height:Ze||"100%",minHeight:0},null===(C=null==he?void 0:he.slotStyles)||void 0===C?void 0:C.container)},{children:[Ye&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(w=null==ge?void 0:ge.slotStyles)||void 0===w?void 0:w.outerContainer)},{children:l.jsx(i.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==xe?void 0:xe.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==me?void 0:me.rows)&&l.jsx(f.BigQueryTable,{rows:me.rows,columns:me.columns||[]})}))}))})),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(S=null==pe?void 0:pe.slotStyles)||void 0===S?void 0:S.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(j=null==pe?void 0:pe.title)&&void 0!==j?j:"Rule book",icon:null==pe?void 0:pe.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(k=null==pe?void 0:pe.slotStyles)||void 0===k?void 0:k.title),body:null===(q=null==pe?void 0:pe.slotStyles)||void 0===q?void 0:q.body},secondaryActions:(null==pe?void 0:pe.secondaryActions)?pe.secondaryActions(Xe):Xe},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(A=null==pe?void 0:pe.slotStyles)||void 0===A?void 0:A.dataContainer)},{children:l.jsx("div",e.__assign({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Ve},{children:l.jsx(a.default,{data:pe.data,renderers:null!==(T=null==pe?void 0:pe.renderer)&&void 0!==T?T:We})}))}))}))})),(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(D=null==ge?void 0:ge.slotStyles)||void 0===D?void 0:D.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(R=null==ge?void 0:ge.title)&&void 0!==R?R:"Chat",icon:null==ge?void 0:ge.chatIcon,containerStyles:null===(F=null==ge?void 0:ge.slotStyles)||void 0===F?void 0:F.container,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(z=null==ge?void 0:ge.slotStyles)||void 0===z?void 0:z.title),body:null===(B=null==ge?void 0:ge.slotStyles)||void 0===B?void 0:B.body},primaryActions:[((null===(I=null===(E=null==ge?void 0:ge.summarizedTab)||void 0===E?void 0:E.chip)||void 0===I?void 0:I.show)||void 0===(null===(H=null===(P=null==ge?void 0:ge.summarizedTab)||void 0===P?void 0:P.chip)||void 0===H?void 0:H.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(V=null==ge?void 0:ge.summarizedTab)||void 0===V?void 0:V.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(M=null==ge?void 0:ge.detailedTab)||void 0===M?void 0:M.chip))],secondaryActions:ge.secondaryActions?null==ge?void 0:ge.secondaryActions($e):$e},{children:l.jsxs("div",e.__assign({ref:Ne,style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(N=null==ge?void 0:ge.slotStyles)||void 0===N?void 0:N.chatDataContainer)},{children:[(null===(Y=null===(W=null==ge?void 0:ge.detailedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.isActive)&&l.jsx("div",e.__assign({ref:Me,style:{position:(null==xe?void 0:xe.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(d.default,{chatData:null!==(O=ge.chatData)&&void 0!==O?O:[],assistantChatProps:e.__assign(e.__assign({},null===(Q=null===(K=null==ge?void 0:ge.detailedTab)||void 0===K?void 0:K.view)||void 0===Q?void 0:Q.assistantChatProps),{renderers:null!==(J=null===(G=null===(U=null==ge?void 0:ge.detailedTab)||void 0===U?void 0:U.detailedViewRenderer)||void 0===G?void 0:G.assistantText)&&void 0!==J?J:We}),userChatItemProps:e.__assign(e.__assign({},null===(X=null===(L=null==ge?void 0:ge.detailedTab)||void 0===L?void 0:L.view)||void 0===X?void 0:X.userChatItemProps),{renderers:null!==(ee=null===($=null===(Z=null==ge?void 0:ge.detailedTab)||void 0===Z?void 0:Z.detailedViewRenderer)||void 0===$?void 0:$.userText)&&void 0!==ee?ee:We})})})),(null===(ie=null===(le=null==ge?void 0:ge.summarizedTab)||void 0===le?void 0:le.chip)||void 0===ie?void 0:ie.show)&&(null===(ne=null===(oe=null==ge?void 0:ge.summarizedTab)||void 0===oe?void 0:oe.chip)||void 0===ne?void 0:ne.isActive)&&l.jsx(s.default,e.__assign({chatData:null!==(te=ge.chatData)&&void 0!==te?te:[]},null===(re=null==ge?void 0:ge.summarizedTab)||void 0===re?void 0:re.view,{renderer:null!==(se=null===(de=null==ge?void 0:ge.summarizedTab)||void 0===de?void 0:de.summarizedViewRenderer)&&void 0!==se?se:We}))]}))}))}))]}));return Se?l.jsx(i.default,e.__assign({title:null==he?void 0:he.title,slotStyles:{title:null===(ae=null==he?void 0:he.slotStyles)||void 0===ae?void 0:ae.title,body:null===(ue=null==he?void 0:he.slotStyles)||void 0===ue?void 0:ue.body},containerStyles:null===(ve=null==he?void 0:he.slotStyles)||void 0===ve?void 0:ve.container,icon:null!==(ce=null==he?void 0:he.icon)&&void 0!==ce?ce:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==he?void 0:he.secondaryActions)?he.secondaryActions(Le):Le},{children:el})):el};
2
2
  //# sourceMappingURL=InternalChatCitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),e=require("../service/onDemandApi.js"),o=function(n,i,t){var e;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(e=n.find(function(n){var e,o=function(n){var i,t,e,o,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(a=null!==(o=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(e=null==n?void 0:n.customMetadata)||void 0===e?void 0:e.type)&&void 0!==o?o:null==n?void 0:n.type)&&void 0!==a?a:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(e=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===e?void 0:e.toString())===t.toString()&&i.some(function(n){return null==o?void 0:o.includes(n)})}))&&void 0!==e?e:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var l=a.msg,r=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,h=(null==l?void 0:l.requestId)||(null==l?void 0:l.id)||"",y=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(r)},[r]),g=function(){switch(r){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return r}}(),p=(null==l?void 0:l.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]},[h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]):i.useMemo(function(){return["onDemandCitationFetch",h,g,u]},[h,g,u]),C=i.useMemo(function(){return o(null==l?void 0:l.citations,y,u)},[null==l?void 0:l.citations,y,u]),b=Boolean(s&&h&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==l?void 0:l.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,o,a,r,c,s,d;return n.__generator(this,function(n){switch(n.label){case 0:return[4,e.fetchOnDemandCitation(h,g,u,null!==(t=null==l?void 0:l.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(o=null==l?void 0:l.isEcgPayloadActive)&&void 0!==o&&o,null!==(a=null==l?void 0:l.ecg_agent_name)&&void 0!==a?a:"",null!==(r=null==l?void 0:l.customCitationId)&&void 0!==r?r:"",null!==(c=null==l?void 0:l.plan_id)&&void 0!==c?c:"",null!==(s=null==l?void 0:l.ui_chat_history)&&void 0!==s?s:void 0)];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(d=i.error)||void 0===d?void 0:d.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==l?void 0:l.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,e,a,r,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==l?void 0:l.customCitationId)?null!==(a=null!==(e=s.find(function(n){var i,t,e=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof e&&e.includes(l.customCitationId)}))&&void 0!==e?e:s[0])&&void 0!==a?a:null:null!==(c=null!==(r=o(s,y,u))&&void 0!==r?r:s[0])&&void 0!==c?c:null:null},[null==l?void 0:l.customCitationId,u,y,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),e=require("../service/onDemandApi.js"),o=function(n,i,t){var e;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(e=n.find(function(n){var e,o=function(n){var i,t,e,o,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(a=null!==(o=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(e=null==n?void 0:n.customMetadata)||void 0===e?void 0:e.type)&&void 0!==o?o:null==n?void 0:n.type)&&void 0!==a?a:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(e=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===e?void 0:e.toString())===t.toString()&&i.some(function(n){return null==o?void 0:o.includes(n)})}))&&void 0!==e?e:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var l=a.msg,r=a.citationType,u=a.citationNumber,c=a.enabled,d=void 0!==c&&c,s=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,y=(null==l?void 0:l.requestId)||(null==l?void 0:l.id)||"",g=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(r)},[r]),h=function(){switch(r){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return r}}(),p=(null==l?void 0:l.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",y,h,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]},[y,h,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]):i.useMemo(function(){return["onDemandCitationFetch",y,h,u]},[y,h,u]),C=i.useMemo(function(){return o(null==l?void 0:l.citations,g,u)},[null==l?void 0:l.citations,g,u]),b=Boolean(d&&y&&h&&v&&_&&!Number.isNaN(u)&&!C),A=s,N=!0===(null==l?void 0:l.isStreamEnd),w=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,o,a,r,c,d,s,g;return n.__generator(this,function(n){switch(n.label){case 0:return[4,e.fetchOnDemandCitation(y,h,u,null!==(t=null==l?void 0:l.content)&&void 0!==t?t:"",A,v,null!=f?f:"",_,null!=m?m:"",null!==(o=null==l?void 0:l.isEcgPayloadActive)&&void 0!==o&&o,"boolean"==typeof(null==l?void 0:l.isReqPayloadActive)&&l.isReqPayloadActive,null!==(a=null==l?void 0:l.ecg_agent_name)&&void 0!==a?a:"",null!==(r=null==l?void 0:l.customCitationId)&&void 0!==r?r:"",null!==(c=null==l?void 0:l.plan_id)&&void 0!==c?c:"",null!==(d=null==l?void 0:l.ui_chat_history)&&void 0!==d?d:void 0,null!==(s=null==l?void 0:l.mmvf_list)&&void 0!==s?s:void 0,Array.isArray(null==l?void 0:l.files)?l.files:[],"string"==typeof(null==l?void 0:l.metadata)&&l.metadata.trim()?l.metadata:"")];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(g=i.error)||void 0===g?void 0:g.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&N&&Boolean(null==l?void 0:l.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),q=i.useMemo(function(){var n,i,t,e,a,r,c,d=null!==(t=null===(i=null===(n=w.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(d)&&0!==d.length?(null==l?void 0:l.customCitationId)?null!==(a=null!==(e=d.find(function(n){var i,t,e=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof e&&e.includes(l.customCitationId)}))&&void 0!==e?e:d[0])&&void 0!==a?a:null:null!==(c=null!==(r=o(d,g,u))&&void 0!==r?r:d[0])&&void 0!==c?c:null:null},[null==l?void 0:l.customCitationId,u,g,w.data]);return{citation:null!=C?C:q,isFetching:w.isFetching,isLoading:w.isLoading,isComplete:w.isSuccess,status:w.status,refetch:w.refetch}};
2
2
  //# sourceMappingURL=useOnDemandCitationFetch.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n,":").concat(p?l:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),a=require("../types/onDemandApi.types.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=s(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(n.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:a.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:a.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:a.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:a.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:a.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:a.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var a=n.default.create({baseURL:r,timeout:t});return a.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),a.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),a},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,s){return e.__awaiter(void 0,void 0,void 0,function(){var n,o,i,p,_,d,g;return e.__generator(this,function(E){switch(E.label){case 0:switch(E.trys.push([0,13,,15]),n=(null==s?void 0:s.baseURL)?u(s.baseURL):l,i=(o=s||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,n.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=E.sent(),[3,12];case 3:return[4,n.post(t,i,p)];case 5:return[4,n.put(t,i,p)];case 7:return[4,n.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,n.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(g=E.sent()).type&&Object.values(a.NetworkErrorType).includes(g.type)?[2,{responseData:null,error:g}]:[4,c(g)];case 14:return[2,{responseData:null,error:E.sent()}];case 15:return[2]}})})},d=function(r,s,n){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,g,E,f,y,v,h,m,R,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=n||{}).data,u=i.params,l=i.config,d=i.errorMessage,g=i.baseURL,E=i.cacheOption,f=i.shouldCache,y=null!==(N=null==E?void 0:E.ttl)&&void 0!==N?N:o,v=(null==E?void 0:E.key)||p(r,s,u),(null==E?void 0:E.forceRefresh)||(null==E?void 0:E.skipCache)?[3,2]:[4,t.apiCache.get(v)];case 1:if(h=T.sent())return[2,{responseData:h.data,error:null,cacheMeta:{isFromCache:!0,timestamp:h.timestamp,ttl:h.ttl,cacheKey:v}}];T.label=2;case 2:return m=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,s,{data:c,config:m,baseURL:g})];case 3:return R=T.sent(),!(null==E?void 0:E.skipCache)&&null!=R.responseData&&(!f||f(R.responseData))?[4,t.apiCache.set(v,R.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:R.responseData,error:R.error?{errorMessage:R.error.type===a.NetworkErrorType.INTERNET_DISCONNECTED||R.error.type===a.NetworkErrorType.SLOW_CONNECTION||R.error.type===a.NetworkErrorType.TIMEOUT?R.error.message:R.error.type===a.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||R.error.message,errorObjData:R.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:v}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return a.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,a,s,n,o,i,c,u,p,l,_,g,E,f,y,v,h){return e.__awaiter(void 0,void 0,void 0,function(){var n,m,R,N;return e.__generator(this,function(T){return n="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,m=p?g:"".concat(n,"_").concat(a),[2,d(R="post",N="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",metadata:l?h:void 0,arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign(e.__assign(e.__assign({llm_formatted_response:s,request_id:r,max_concurrent_citations:10,citation_id:m},p&&_&&{ecg_agent_name:_}),p&&E&&{plan_id:E}),p&&f&&{ui_chat_history:f}),l&&y&&{mmvf_list:y}),l&&v&&{files:v})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(R,":").concat(N,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?g:a,":").concat(p?_:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
2
2
  //# sourceMappingURL=onDemandApi.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as l,jsx as i}from"react/jsx-runtime";import e from"./components/ChatCitation.js";import{getColorCode as n}from"./utils/helpers.js";import t from"./components/Chip.js";import r from"./assets/message-chat-square.svg.js";import"@mui/icons-material/KeyboardArrowDown";import"@mui/icons-material/KeyboardArrowUp";import"@mui/icons-material/Clear";import d from"./components/InViewNavigation.js";import a from"./components/DetailedView.js";import u from"./components/SummarizedView.js";import v from"./components/RuleBook.js";import{useState as s,useRef as c,useMemo as h,useEffect as f,useCallback as m}from"react";import{defaultRenderer as p}from"./constants/renderer.js";import g from"./components/IconContainer.js";import{Table as y}from"lucide-react";import{BigQueryTable as b}from"./BigQueryTable.js";import x from"@mui/icons-material/CloseOutlined";var w=function(o,l,i){if(void 0===i&&(i="smooth"),l){for(var e=o.parentElement;e;){var n=window.getComputedStyle(e).overflowY;if(("auto"===n||"scroll"===n)&&e.scrollHeight>e.clientHeight)break;if(e===l){e=null;break}e=e.parentElement}var t=null!=e?e:l,r=o.getBoundingClientRect(),d=t.getBoundingClientRect(),a=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,a),behavior:i})}},C={chatData:[]};function S(S){var k,A,D,T,F,R,I,E,j,z,B,H,P,V,q,N,W,Y,K,O,M,Q,U,G,J,L,X,Z,$,_,oo,lo,io,eo,no,to,ro,ao,uo,vo,so,co,ho,fo,mo,po,go,yo,bo=S.rootContainer,xo=S.chatContainer,wo=void 0===xo?C:xo,Co=S.ruleBookContainer,So=S.renderer,ko=S.additionalData,Ao=S.tableComponent,Do=S.closePreview,To=S.isRenderedCustomComponent,Fo=void 0!==To&&To,Ro=S.showRootContainer,Io=void 0===Ro||Ro,Eo=S.reversePanels,jo=void 0!==Eo&&Eo,zo=s(0),Bo=zo[0],Ho=zo[1],Po=s(0),Vo=Po[0],qo=Po[1],No=s(0),Wo=No[0],Yo=No[1],Ko=s(0),Oo=Ko[0],Mo=Ko[1],Qo=c(null),Uo=c(null),Go=c(null),Jo=h(function(){return o(o({},p),So)},[So]),Lo=h(function(){return!!((null==Ao?void 0:Ao.rows)&&Object.keys(Ao.rows).length>0)},[Ao]),Xo=h(function(){var o;return null!==(o=null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked)&&void 0!==o&&o},[null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked]);f(function(){var o,l,i;if((null==Co?void 0:Co.show)&&Qo.current){var e=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(Ho((null==e?void 0:e.length)||0),qo(0),e&&e.length>0){var n=e[0];n.style.backgroundColor="#ffff5c",w(n,Qo.current)}}if((null==wo?void 0:wo.show)&&(null==Uo?void 0:Uo.current)){var t=null===(l=Uo.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Yo((null==t?void 0:t.length)||0),Mo(0),t&&t.length>0){var r=t[0];r.style.backgroundColor="#ffff5c";var d=requestAnimationFrame(function(){w(r,Go.current)});return function(){return cancelAnimationFrame(d)}}var a=null==ko?void 0:ko.targetIndex;if(void 0!==a&&a>=0&&(null===(i=Uo.current)||void 0===i?void 0:i.firstElementChild)){var u=Uo.current.firstElementChild.children[a];if(u){var v=requestAnimationFrame(function(){w(u,Go.current)});return function(){return cancelAnimationFrame(v)}}}}},[null==wo?void 0:wo.show,null==Co?void 0:Co.show,null==Co?void 0:Co.data,null==wo?void 0:wo.chatData,null==ko?void 0:ko.targetIndex]);var Zo=m(function(){var o;if(Vo+1<Bo){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(!l)return;l[Vo].style.backgroundColor="#ffffb8";var i=Vo+1;qo(i);var e=l[i];e.style.backgroundColor="#ffff5c",w(e,Qo.current)}},[Vo,Bo]),$o=m(function(){var o;if(!(Vo-1<0)){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(l){l[Vo].style.backgroundColor="#ffffb8";var i=Vo-1,e=l[i];e.style.backgroundColor="#ffff5c",qo(i),w(e,Qo.current)}}},[Vo]),_o=m(function(){var o;if(Oo+1<Wo){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(!l)return;l[Oo].style.backgroundColor="#ffffb8";var i=Oo+1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}},[Oo,Wo]),ol=m(function(){var o;if(!(Oo-1<0)){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(l){l[Oo].style.backgroundColor="#ffffb8";var i=Oo-1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}}},[Oo]),ll=n((null==bo?void 0:bo.relevanceScore)||0),il=h(function(){var e,n=l("span",o({style:o({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:ll.border,backgroundColor:ll.background,color:ll.text},null===(e=null==bo?void 0:bo.slotStyles)||void 0===e?void 0:e.relevanceScore)},{children:[(null==bo?void 0:bo.relevanceTitle)||"Decision Strength",":"," ",(null==bo?void 0:bo.relevanceScore)||0,"%"]}),"relevance-score"),t=i("span",o({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:Do},{children:i(x,{})}),"close-preview");return Fo&&!(null==ko?void 0:ko.isExpanded)?[n,t]:[n]},[Fo,ll.background,ll.border,ll.text,null==bo?void 0:bo.relevanceScore,null===(k=null==bo?void 0:bo.slotStyles)||void 0===k?void 0:k.relevanceScore,null==bo?void 0:bo.relevanceTitle]),el=h(function(){return[Bo>0&&i(d,{currentItemNumber:Vo+1,totalItems:Bo,disableNext:Vo+1>=Bo,onNext:Zo,onPrevious:$o,disablePrevious:Vo<=0},"rulebook-nav")]},[Vo,Zo,$o,Bo]),nl=h(function(){return(null==ko?void 0:ko.RuleBookContainerHeight)?ko.RuleBookContainerHeight:!(!Xo||(null==ko?void 0:ko.isExpanded))&&"600px"},[null==ko?void 0:ko.RuleBookContainerHeight,Xo]),tl=h(function(){var o,l;return[(null===(l=null===(o=null==wo?void 0:wo.detailedTab)||void 0===o?void 0:o.chip)||void 0===l?void 0:l.isActive)&&Wo>0&&i(d,{currentItemNumber:Oo+1,totalItems:Wo,onNext:_o,onPrevious:ol,disableNext:Oo+1>=Wo,disablePrevious:Oo<=0},"chat-nav")]},[null===(D=null===(A=null==wo?void 0:wo.detailedTab)||void 0===A?void 0:A.chip)||void 0===D?void 0:D.isActive,Oo,_o,ol,Wo]),rl=l("div",o({style:o({display:"flex",flexDirection:jo?Xo?"column-reverse":"row-reverse":Xo?"column":"row",gap:[(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show),Lo].filter(Boolean).length>1?"12px":"0",height:nl||"100%",minHeight:0},null===(T=null==bo?void 0:bo.slotStyles)||void 0===T?void 0:T.container)},{children:[Lo&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(F=null==wo?void 0:wo.slotStyles)||void 0===F?void 0:F.outerContainer)},{children:i(e,o({title:"Invoice Data Preview",icon:i(g,{children:i(y,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:i("div",o({style:{height:"100%",maxHeight:(null==ko?void 0:ko.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==Ao?void 0:Ao.rows)&&i(b,{rows:Ao.rows,columns:Ao.columns||[]})}))}))})),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(R=null==Co?void 0:Co.slotStyles)||void 0===R?void 0:R.outerContainer)},{children:i(e,o({title:null!==(I=null==Co?void 0:Co.title)&&void 0!==I?I:"Rule book",icon:null==Co?void 0:Co.ruleBookIcon,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(E=null==Co?void 0:Co.slotStyles)||void 0===E?void 0:E.title),body:null===(j=null==Co?void 0:Co.slotStyles)||void 0===j?void 0:j.body},secondaryActions:(null==Co?void 0:Co.secondaryActions)?Co.secondaryActions(el):el},{children:i("div",o({style:o({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(z=null==Co?void 0:Co.slotStyles)||void 0===z?void 0:z.dataContainer)},{children:i("div",o({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Qo},{children:i(v,{data:Co.data,renderers:null!==(B=null==Co?void 0:Co.renderer)&&void 0!==B?B:Jo})}))}))}))})),(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(H=null==wo?void 0:wo.slotStyles)||void 0===H?void 0:H.outerContainer)},{children:i(e,o({title:null!==(P=null==wo?void 0:wo.title)&&void 0!==P?P:"Chat",icon:null==wo?void 0:wo.chatIcon,containerStyles:null===(V=null==wo?void 0:wo.slotStyles)||void 0===V?void 0:V.container,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(q=null==wo?void 0:wo.slotStyles)||void 0===q?void 0:q.title),body:null===(N=null==wo?void 0:wo.slotStyles)||void 0===N?void 0:N.body},primaryActions:[((null===(Y=null===(W=null==wo?void 0:wo.summarizedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.show)||void 0===(null===(O=null===(K=null==wo?void 0:wo.summarizedTab)||void 0===K?void 0:K.chip)||void 0===O?void 0:O.show))&&i(t,o({label:"Summarized"},null===(M=null==wo?void 0:wo.summarizedTab)||void 0===M?void 0:M.chip)),i(t,o({label:"Detailed"},null===(Q=null==wo?void 0:wo.detailedTab)||void 0===Q?void 0:Q.chip))],secondaryActions:wo.secondaryActions?null==wo?void 0:wo.secondaryActions(tl):tl},{children:l("div",o({ref:Go,style:o({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(U=null==wo?void 0:wo.slotStyles)||void 0===U?void 0:U.chatDataContainer)},{children:[(null===(J=null===(G=null==wo?void 0:wo.detailedTab)||void 0===G?void 0:G.chip)||void 0===J?void 0:J.isActive)&&i("div",o({ref:Uo,style:{position:(null==ko?void 0:ko.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:i(a,{chatData:null!==(L=wo.chatData)&&void 0!==L?L:[],assistantChatProps:o(o({},null===(Z=null===(X=null==wo?void 0:wo.detailedTab)||void 0===X?void 0:X.view)||void 0===Z?void 0:Z.assistantChatProps),{renderers:null!==(oo=null===(_=null===($=null==wo?void 0:wo.detailedTab)||void 0===$?void 0:$.detailedViewRenderer)||void 0===_?void 0:_.assistantText)&&void 0!==oo?oo:Jo}),userChatItemProps:o(o({},null===(io=null===(lo=null==wo?void 0:wo.detailedTab)||void 0===lo?void 0:lo.view)||void 0===io?void 0:io.userChatItemProps),{renderers:null!==(to=null===(no=null===(eo=null==wo?void 0:wo.detailedTab)||void 0===eo?void 0:eo.detailedViewRenderer)||void 0===no?void 0:no.userText)&&void 0!==to?to:Jo})})})),(null===(ao=null===(ro=null==wo?void 0:wo.summarizedTab)||void 0===ro?void 0:ro.chip)||void 0===ao?void 0:ao.show)&&(null===(vo=null===(uo=null==wo?void 0:wo.summarizedTab)||void 0===uo?void 0:uo.chip)||void 0===vo?void 0:vo.isActive)&&i(u,o({chatData:null!==(so=wo.chatData)&&void 0!==so?so:[]},null===(co=null==wo?void 0:wo.summarizedTab)||void 0===co?void 0:co.view,{renderer:null!==(fo=null===(ho=null==wo?void 0:wo.summarizedTab)||void 0===ho?void 0:ho.summarizedViewRenderer)&&void 0!==fo?fo:Jo}))]}))}))}))]}));return Io?i(e,o({title:null==bo?void 0:bo.title,slotStyles:{title:null===(mo=null==bo?void 0:bo.slotStyles)||void 0===mo?void 0:mo.title,body:null===(po=null==bo?void 0:bo.slotStyles)||void 0===po?void 0:po.body},containerStyles:null===(go=null==bo?void 0:bo.slotStyles)||void 0===go?void 0:go.container,icon:null!==(yo=null==bo?void 0:bo.icon)&&void 0!==yo?yo:i(g,{children:i("img",{src:r,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==bo?void 0:bo.secondaryActions)?bo.secondaryActions(il):il},{children:rl})):rl}export{S as default};
1
+ import{__assign as o}from"tslib";import{jsxs as l,jsx as i}from"react/jsx-runtime";import e from"./components/ChatCitation.js";import{getColorCode as n}from"./utils/helpers.js";import t from"./components/Chip.js";import r from"./assets/message-chat-square.svg.js";import"@mui/icons-material/KeyboardArrowDown";import"@mui/icons-material/KeyboardArrowUp";import"@mui/icons-material/Clear";import d from"./components/InViewNavigation.js";import a from"./components/DetailedView.js";import u from"./components/SummarizedView.js";import v from"./components/RuleBook.js";import{useState as s,useRef as c,useMemo as h,useEffect as f,useCallback as m}from"react";import{defaultRenderer as p}from"./constants/renderer.js";import g from"./components/IconContainer.js";import{Table as y}from"lucide-react";import{BigQueryTable as b}from"./BigQueryTable.js";import x from"@mui/icons-material/CloseOutlined";var w=function(o,l,i){if(void 0===i&&(i="smooth"),l){for(var e=o.parentElement;e;){var n=window.getComputedStyle(e).overflowY;if(("auto"===n||"scroll"===n)&&e.scrollHeight>e.clientHeight)break;if(e===l){e=null;break}e=e.parentElement}var t=null!=e?e:l,r=o.getBoundingClientRect(),d=t.getBoundingClientRect(),a=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,a),behavior:i})}},C={chatData:[]};function S(S){var k,A,D,T,R,F,j,z,I,B,E,H,P,V,q,N,W,Y,K,O,M,Q,U,G,J,L,X,Z,$,_,oo,lo,io,eo,no,to,ro,ao,uo,vo,so,co,ho,fo,mo,po,go,yo,bo=S.rootContainer,xo=S.chatContainer,wo=void 0===xo?C:xo,Co=S.ruleBookContainer,So=S.renderer,ko=S.additionalData,Ao=S.tableComponent,Do=S.closePreview,To=S.isRenderedCustomComponent,Ro=void 0!==To&&To,Fo=S.showRootContainer,jo=void 0===Fo||Fo,zo=S.reversePanels,Io=void 0!==zo&&zo,Bo=s(0),Eo=Bo[0],Ho=Bo[1],Po=s(0),Vo=Po[0],qo=Po[1],No=s(0),Wo=No[0],Yo=No[1],Ko=s(0),Oo=Ko[0],Mo=Ko[1],Qo=c(null),Uo=c(null),Go=c(null),Jo=h(function(){return o(o({},p),So)},[So]),Lo=h(function(){return!!((null==Ao?void 0:Ao.rows)&&Object.keys(Ao.rows).length>0)},[Ao]),Xo=h(function(){var o;return null!==(o=null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked)&&void 0!==o&&o},[null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked]);f(function(){var o,l;if((null==Co?void 0:Co.show)&&Qo.current){var i=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(Ho((null==i?void 0:i.length)||0),qo(0),i&&i.length>0){var e=i[0];e.style.backgroundColor="#ffff5c",w(e,Qo.current)}}if((null==wo?void 0:wo.show)&&(null==Uo?void 0:Uo.current)){var n=null===(l=Uo.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Yo((null==n?void 0:n.length)||0),Mo(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){w(t,Go.current)});return function(){return cancelAnimationFrame(r)}}}},[null==wo?void 0:wo.show,null==Co?void 0:Co.show,null==Co?void 0:Co.data,null==wo?void 0:wo.chatData]);var Zo=m(function(){var o;if(Vo+1<Eo){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(!l)return;l[Vo].style.backgroundColor="#ffffb8";var i=Vo+1;qo(i);var e=l[i];e.style.backgroundColor="#ffff5c",w(e,Qo.current)}},[Vo,Eo]),$o=m(function(){var o;if(!(Vo-1<0)){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(l){l[Vo].style.backgroundColor="#ffffb8";var i=Vo-1,e=l[i];e.style.backgroundColor="#ffff5c",qo(i),w(e,Qo.current)}}},[Vo]),_o=m(function(){var o;if(Oo+1<Wo){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(!l)return;l[Oo].style.backgroundColor="#ffffb8";var i=Oo+1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}},[Oo,Wo]),ol=m(function(){var o;if(!(Oo-1<0)){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(l){l[Oo].style.backgroundColor="#ffffb8";var i=Oo-1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}}},[Oo]),ll=n((null==bo?void 0:bo.relevanceScore)||0),il=h(function(){var e,n=l("span",o({style:o({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:ll.border,backgroundColor:ll.background,color:ll.text},null===(e=null==bo?void 0:bo.slotStyles)||void 0===e?void 0:e.relevanceScore)},{children:[(null==bo?void 0:bo.relevanceTitle)||"Decision Strength",":"," ",(null==bo?void 0:bo.relevanceScore)||0,"%"]}),"relevance-score"),t=i("span",o({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:Do},{children:i(x,{})}),"close-preview");return Ro&&!(null==ko?void 0:ko.isExpanded)?[n,t]:[n]},[Ro,ll.background,ll.border,ll.text,null==bo?void 0:bo.relevanceScore,null===(k=null==bo?void 0:bo.slotStyles)||void 0===k?void 0:k.relevanceScore,null==bo?void 0:bo.relevanceTitle]),el=h(function(){return[Eo>0&&i(d,{currentItemNumber:Vo+1,totalItems:Eo,disableNext:Vo+1>=Eo,onNext:Zo,onPrevious:$o,disablePrevious:Vo<=0},"rulebook-nav")]},[Vo,Zo,$o,Eo]),nl=h(function(){return(null==ko?void 0:ko.RuleBookContainerHeight)?ko.RuleBookContainerHeight:!(!Xo||(null==ko?void 0:ko.isExpanded))&&"600px"},[null==ko?void 0:ko.RuleBookContainerHeight,Xo]),tl=h(function(){var o,l;return[(null===(l=null===(o=null==wo?void 0:wo.detailedTab)||void 0===o?void 0:o.chip)||void 0===l?void 0:l.isActive)&&Wo>0&&i(d,{currentItemNumber:Oo+1,totalItems:Wo,onNext:_o,onPrevious:ol,disableNext:Oo+1>=Wo,disablePrevious:Oo<=0},"chat-nav")]},[null===(D=null===(A=null==wo?void 0:wo.detailedTab)||void 0===A?void 0:A.chip)||void 0===D?void 0:D.isActive,Oo,_o,ol,Wo]),rl=l("div",o({style:o({display:"flex",flexDirection:Io?Xo?"column-reverse":"row-reverse":Xo?"column":"row",gap:[(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show),Lo].filter(Boolean).length>1?"12px":"0",height:nl||"100%",minHeight:0},null===(T=null==bo?void 0:bo.slotStyles)||void 0===T?void 0:T.container)},{children:[Lo&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(R=null==wo?void 0:wo.slotStyles)||void 0===R?void 0:R.outerContainer)},{children:i(e,o({title:"Invoice Data Preview",icon:i(g,{children:i(y,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:i("div",o({style:{height:"100%",maxHeight:(null==ko?void 0:ko.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==Ao?void 0:Ao.rows)&&i(b,{rows:Ao.rows,columns:Ao.columns||[]})}))}))})),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(F=null==Co?void 0:Co.slotStyles)||void 0===F?void 0:F.outerContainer)},{children:i(e,o({title:null!==(j=null==Co?void 0:Co.title)&&void 0!==j?j:"Rule book",icon:null==Co?void 0:Co.ruleBookIcon,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(z=null==Co?void 0:Co.slotStyles)||void 0===z?void 0:z.title),body:null===(I=null==Co?void 0:Co.slotStyles)||void 0===I?void 0:I.body},secondaryActions:(null==Co?void 0:Co.secondaryActions)?Co.secondaryActions(el):el},{children:i("div",o({style:o({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(B=null==Co?void 0:Co.slotStyles)||void 0===B?void 0:B.dataContainer)},{children:i("div",o({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Qo},{children:i(v,{data:Co.data,renderers:null!==(E=null==Co?void 0:Co.renderer)&&void 0!==E?E:Jo})}))}))}))})),(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(H=null==wo?void 0:wo.slotStyles)||void 0===H?void 0:H.outerContainer)},{children:i(e,o({title:null!==(P=null==wo?void 0:wo.title)&&void 0!==P?P:"Chat",icon:null==wo?void 0:wo.chatIcon,containerStyles:null===(V=null==wo?void 0:wo.slotStyles)||void 0===V?void 0:V.container,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(q=null==wo?void 0:wo.slotStyles)||void 0===q?void 0:q.title),body:null===(N=null==wo?void 0:wo.slotStyles)||void 0===N?void 0:N.body},primaryActions:[((null===(Y=null===(W=null==wo?void 0:wo.summarizedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.show)||void 0===(null===(O=null===(K=null==wo?void 0:wo.summarizedTab)||void 0===K?void 0:K.chip)||void 0===O?void 0:O.show))&&i(t,o({label:"Summarized"},null===(M=null==wo?void 0:wo.summarizedTab)||void 0===M?void 0:M.chip)),i(t,o({label:"Detailed"},null===(Q=null==wo?void 0:wo.detailedTab)||void 0===Q?void 0:Q.chip))],secondaryActions:wo.secondaryActions?null==wo?void 0:wo.secondaryActions(tl):tl},{children:l("div",o({ref:Go,style:o({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(U=null==wo?void 0:wo.slotStyles)||void 0===U?void 0:U.chatDataContainer)},{children:[(null===(J=null===(G=null==wo?void 0:wo.detailedTab)||void 0===G?void 0:G.chip)||void 0===J?void 0:J.isActive)&&i("div",o({ref:Uo,style:{position:(null==ko?void 0:ko.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:i(a,{chatData:null!==(L=wo.chatData)&&void 0!==L?L:[],assistantChatProps:o(o({},null===(Z=null===(X=null==wo?void 0:wo.detailedTab)||void 0===X?void 0:X.view)||void 0===Z?void 0:Z.assistantChatProps),{renderers:null!==(oo=null===(_=null===($=null==wo?void 0:wo.detailedTab)||void 0===$?void 0:$.detailedViewRenderer)||void 0===_?void 0:_.assistantText)&&void 0!==oo?oo:Jo}),userChatItemProps:o(o({},null===(io=null===(lo=null==wo?void 0:wo.detailedTab)||void 0===lo?void 0:lo.view)||void 0===io?void 0:io.userChatItemProps),{renderers:null!==(to=null===(no=null===(eo=null==wo?void 0:wo.detailedTab)||void 0===eo?void 0:eo.detailedViewRenderer)||void 0===no?void 0:no.userText)&&void 0!==to?to:Jo})})})),(null===(ao=null===(ro=null==wo?void 0:wo.summarizedTab)||void 0===ro?void 0:ro.chip)||void 0===ao?void 0:ao.show)&&(null===(vo=null===(uo=null==wo?void 0:wo.summarizedTab)||void 0===uo?void 0:uo.chip)||void 0===vo?void 0:vo.isActive)&&i(u,o({chatData:null!==(so=wo.chatData)&&void 0!==so?so:[]},null===(co=null==wo?void 0:wo.summarizedTab)||void 0===co?void 0:co.view,{renderer:null!==(fo=null===(ho=null==wo?void 0:wo.summarizedTab)||void 0===ho?void 0:ho.summarizedViewRenderer)&&void 0!==fo?fo:Jo}))]}))}))}))]}));return jo?i(e,o({title:null==bo?void 0:bo.title,slotStyles:{title:null===(mo=null==bo?void 0:bo.slotStyles)||void 0===mo?void 0:mo.title,body:null===(po=null==bo?void 0:bo.slotStyles)||void 0===po?void 0:po.body},containerStyles:null===(go=null==bo?void 0:bo.slotStyles)||void 0===go?void 0:go.container,icon:null!==(yo=null==bo?void 0:bo.icon)&&void 0!==yo?yo:i(g,{children:i("img",{src:r,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==bo?void 0:bo.secondaryActions)?bo.secondaryActions(il):il},{children:rl})):rl}export{S as default};
2
2
  //# sourceMappingURL=InternalChatCitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as n,__generator as i}from"tslib";import{useMemo as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{fetchOnDemandCitation as a}from"../service/onDemandApi.js";var e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,a=function(n){var i,t,o,a,e;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(e=null!==(a=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==a?a:null==n?void 0:n.type)&&void 0!==e?e:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==a?void 0:a.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)},l=function(l){var r=l.msg,c=l.citationType,u=l.citationNumber,d=l.enabled,s=void 0!==d&&d,v=l.accessToken,f=l.baseUrl,_=l.orgName,m=l.citationAssistantProcessingName,g=l.citationAgentName,h=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",y=t(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(c)},[c]),p=function(){switch(c){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return c}}(),C=(null==r?void 0:r.isEcgPayloadActive)?t(function(){return["onDemandCitationFetch",h,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]},[h,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]):t(function(){return["onDemandCitationFetch",h,p,u]},[h,p,u]),b=t(function(){return e(null==r?void 0:r.citations,y,u)},[null==r?void 0:r.citations,y,u]),N=Boolean(s&&h&&p&&f&&_&&!Number.isNaN(u)&&!b),w=v,A=!0===(null==r?void 0:r.isStreamEnd),k=o({queryKey:C,queryFn:function(){return n(void 0,void 0,void 0,function(){var n,t,o,e,l,c,d,s;return i(this,function(i){switch(i.label){case 0:return[4,a(h,p,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",w,f,null!=m?m:"",_,null!=g?g:"",null!==(o=null==r?void 0:r.isEcgPayloadActive)&&void 0!==o&&o,null!==(e=null==r?void 0:r.ecg_agent_name)&&void 0!==e?e:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"",null!==(d=null==r?void 0:r.ui_chat_history)&&void 0!==d?d:void 0)];case 1:if((n=i.sent()).error||!n.responseData)throw new Error((null===(s=n.error)||void 0===s?void 0:s.errorMessage)||"Failed to fetch on-demand citation");return[2,n.responseData]}})})},enabled:N&&A&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),F=t(function(){var n,i,t,o,a,l,c,d=null!==(t=null===(i=null===(n=k.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(d)&&0!==d.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=d.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:d[0])&&void 0!==a?a:null:null!==(c=null!==(l=e(d,y,u))&&void 0!==l?l:d[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,y,k.data]);return{citation:null!=b?b:F,isFetching:k.isFetching,isLoading:k.isLoading,isComplete:k.isSuccess,status:k.status,refetch:k.refetch}};export{l as useOnDemandCitationFetch};
1
+ import{__awaiter as n,__generator as i}from"tslib";import{useMemo as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{fetchOnDemandCitation as a}from"../service/onDemandApi.js";var e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,a=function(n){var i,t,o,a,e;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(e=null!==(a=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==a?a:null==n?void 0:n.type)&&void 0!==e?e:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==a?void 0:a.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)},l=function(l){var r=l.msg,u=l.citationType,c=l.citationNumber,d=l.enabled,s=void 0!==d&&d,v=l.accessToken,f=l.baseUrl,_=l.orgName,m=l.citationAssistantProcessingName,y=l.citationAgentName,g=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",h=t(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(u)},[u]),p=function(){switch(u){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return u}}(),b=(null==r?void 0:r.isEcgPayloadActive)?t(function(){return["onDemandCitationFetch",g,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]},[g,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]):t(function(){return["onDemandCitationFetch",g,p,c]},[g,p,c]),C=t(function(){return e(null==r?void 0:r.citations,h,c)},[null==r?void 0:r.citations,h,c]),A=Boolean(s&&g&&p&&f&&_&&!Number.isNaN(c)&&!C),N=v,w=!0===(null==r?void 0:r.isStreamEnd),k=o({queryKey:b,queryFn:function(){return n(void 0,void 0,void 0,function(){var n,t,o,e,l,u,d,s,v;return i(this,function(i){switch(i.label){case 0:return[4,a(g,p,c,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",N,f,null!=m?m:"",_,null!=y?y:"",null!==(o=null==r?void 0:r.isEcgPayloadActive)&&void 0!==o&&o,"boolean"==typeof(null==r?void 0:r.isReqPayloadActive)&&r.isReqPayloadActive,null!==(e=null==r?void 0:r.ecg_agent_name)&&void 0!==e?e:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(u=null==r?void 0:r.plan_id)&&void 0!==u?u:"",null!==(d=null==r?void 0:r.ui_chat_history)&&void 0!==d?d:void 0,null!==(s=null==r?void 0:r.mmvf_list)&&void 0!==s?s:void 0,Array.isArray(null==r?void 0:r.files)?r.files:[],"string"==typeof(null==r?void 0:r.metadata)&&r.metadata.trim()?r.metadata:"")];case 1:if((n=i.sent()).error||!n.responseData)throw new Error((null===(v=n.error)||void 0===v?void 0:v.errorMessage)||"Failed to fetch on-demand citation");return[2,n.responseData]}})})},enabled:A&&w&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),F=t(function(){var n,i,t,o,a,l,u,d=null!==(t=null===(i=null===(n=k.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(d)&&0!==d.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=d.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:d[0])&&void 0!==a?a:null:null!==(u=null!==(l=e(d,h,c))&&void 0!==l?l:d[0])&&void 0!==u?u:null:null},[null==r?void 0:r.customCitationId,c,h,k.data]);return{citation:null!=C?C:F,isFetching:k.isFetching,isLoading:k.isLoading,isComplete:k.isSuccess,status:k.status,refetch:k.refetch}};export{l as useOnDemandCitationFetch};
2
2
  //# sourceMappingURL=useOnDemandCitationFetch.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as r,__assign as t}from"tslib";import n from"axios";import{apiCache as s}from"./apicache.service.js";import{NetworkErrorType as o}from"../types/onDemandApi.types.js";export{NetworkErrorType}from"../types/onDemandApi.types.js";var a=72e5,i=function(n,s,o,a,i,c,u,l,p,d,E,m,g,v){return e(void 0,void 0,void 0,function(){var e,i,R,h;return r(this,function(r){return e="artifact_chunks"===s||"scanned_doc_citation"===s?"artifact_chunks":s,i=d?m:"".concat(e,"_").concat(o),[2,f(R="post",h="/api/chat/chatResponse",{baseURL:c,data:{name:u||"citationsprocessing",organizationName:l,prompt:"",useAgent:{agent_name:p||"ProcessCitationsAgent",arguments:t(t({citation_type:s,is_primary_agent_request:!1},d&&{check_possible_citation_payload:!1}),{ui_request_body:t(t(t({llm_formatted_response:a,request_id:n,max_concurrent_citations:10,citation_id:i},d&&E&&{ecg_agent_name:E}),d&&g&&{plan_id:g}),d&&v&&{ui_chat_history:v})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(R,":").concat(h,":onDemandCitation:").concat(n,":").concat(s,":").concat(d?m:o,":").concat(d?E:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},c=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},u=function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){if(n.isAxiosError(t)){if("ECONNABORTED"===(e=t).code)return[2,{type:o.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:t}];if(e.message.includes("net::ERR_NETWORK_CHANGED")||e.message.includes("net::ERR_INTERNET_DISCONNECTED")||e.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:o.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:t}];if(e.message.includes("Network Error")||"ERR_NETWORK"===e.code||e.message.includes("net::ERR_CONNECTION_REFUSED")||e.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:o.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:t}];if(e.response&&e.response.status>=500)return[2,{type:o.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(e.response.status,")."),status:e.response.status,originalError:t}];if(e.response&&e.response.status>=400&&e.response.status<500)return[2,{type:o.SERVER_ERROR,message:c(e.response.data)||"Request failed with status code ".concat(e.response.status),status:e.response.status,originalError:t}]}return[2,{type:o.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:t}]})})},l=function(t,s){void 0===s&&(s=18e4);var o=n.create({baseURL:t,timeout:s});return o.interceptors.request.use(function(t){return e(void 0,void 0,void 0,function(){return r(this,function(e){return[2,t]})})},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),[2,Promise.reject(e)]}})})}),o.interceptors.response.use(function(e){return e},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),console.error("API Request Failed:",e),[2,Promise.reject(e)]}})})}),o},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},d=l(),E=function(n,s,a){return e(void 0,void 0,void 0,function(){var e,i,c,p,E,f,m;return r(this,function(r){switch(r.label){case 0:switch(r.trys.push([0,13,,15]),e=(null==a?void 0:a.baseURL)?l(a.baseURL):d,c=(i=a||{}).data,p=i.config,E=void 0,n.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,e.get(s,p)];case 2:case 4:case 6:case 8:case 10:return E=r.sent(),[3,12];case 3:return[4,e.post(s,c,p)];case 5:return[4,e.put(s,c,p)];case 7:return[4,e.patch(s,c,p)];case 9:return f=t(t({},p),{data:c}),[4,e.delete(s,f)];case 11:throw new Error("Unsupported method: ".concat(n));case 12:return[2,{responseData:E.data,error:null}];case 13:return(m=r.sent()).type&&Object.values(o).includes(m.type)?[2,{responseData:null,error:m}]:[4,u(m)];case 14:return[2,{responseData:null,error:r.sent()}];case 15:return[2]}})})},f=function(n,i,c){return e(void 0,void 0,void 0,function(){var e,u,l,d,f,m,g,v,R,h,_,y,N,O;return r(this,function(r){switch(r.label){case 0:return u=(e=c||{}).data,l=e.params,d=e.config,f=e.errorMessage,m=e.baseURL,g=e.cacheOption,v=e.shouldCache,R=null!==(O=null==g?void 0:g.ttl)&&void 0!==O?O:a,h=(null==g?void 0:g.key)||p(n,i,l),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,s.get(h)];case 1:if(_=r.sent())return[2,{responseData:_.data,error:null,cacheMeta:{isFromCache:!0,timestamp:_.timestamp,ttl:_.ttl,cacheKey:h}}];r.label=2;case 2:return y=t(t({},d),l&&{params:l}),[4,E(n,i,{data:u,config:y,baseURL:m})];case 3:return N=r.sent(),!(null==g?void 0:g.skipCache)&&null!=N.responseData&&(!v||v(N.responseData))?[4,s.set(h,N.responseData,R)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,{responseData:N.responseData,error:N.error?{errorMessage:N.error.type===o.INTERNET_DISCONNECTED||N.error.type===o.SLOW_CONNECTION||N.error.type===o.TIMEOUT?N.error.message:N.error.type===o.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":f||N.error.message,errorObjData:N.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:R,cacheKey:h}}]}})})};export{a as DEFAULT_CACHE_TTL,l as createApiInstance,i as fetchOnDemandCitation,p as generateCacheKey,E as makeApiRequest,f as makeApiRequestWithTTLCache};
1
+ import{__awaiter as e,__generator as r,__assign as t}from"tslib";import n from"axios";import{apiCache as s}from"./apicache.service.js";import{NetworkErrorType as a}from"../types/onDemandApi.types.js";export{NetworkErrorType}from"../types/onDemandApi.types.js";var o=72e5,i=function(n,s,a,o,i,c,u,l,p,d,f,E,g,v,R,h,_,y){return e(void 0,void 0,void 0,function(){var e,i,N,O;return r(this,function(r){return e="artifact_chunks"===s||"scanned_doc_citation"===s?"artifact_chunks":s,i=d?g:"".concat(e,"_").concat(a),[2,m(N="post",O="/api/chat/chatResponse",{baseURL:c,data:{name:u||"citationsprocessing",organizationName:l,prompt:"",useAgent:{agent_name:p||"ProcessCitationsAgent",metadata:f?y:void 0,arguments:t(t({citation_type:s,is_primary_agent_request:!1},d&&{check_possible_citation_payload:!1}),{ui_request_body:t(t(t(t(t({llm_formatted_response:o,request_id:n,max_concurrent_citations:10,citation_id:i},d&&E&&{ecg_agent_name:E}),d&&v&&{plan_id:v}),d&&R&&{ui_chat_history:R}),f&&h&&{mmvf_list:h}),f&&_&&{files:_})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(N,":").concat(O,":onDemandCitation:").concat(n,":").concat(s,":").concat(d?g:a,":").concat(d?E:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},c=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},u=function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){if(n.isAxiosError(t)){if("ECONNABORTED"===(e=t).code)return[2,{type:a.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:t}];if(e.message.includes("net::ERR_NETWORK_CHANGED")||e.message.includes("net::ERR_INTERNET_DISCONNECTED")||e.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:a.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:t}];if(e.message.includes("Network Error")||"ERR_NETWORK"===e.code||e.message.includes("net::ERR_CONNECTION_REFUSED")||e.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:a.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:t}];if(e.response&&e.response.status>=500)return[2,{type:a.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(e.response.status,")."),status:e.response.status,originalError:t}];if(e.response&&e.response.status>=400&&e.response.status<500)return[2,{type:a.SERVER_ERROR,message:c(e.response.data)||"Request failed with status code ".concat(e.response.status),status:e.response.status,originalError:t}]}return[2,{type:a.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:t}]})})},l=function(t,s){void 0===s&&(s=18e4);var a=n.create({baseURL:t,timeout:s});return a.interceptors.request.use(function(t){return e(void 0,void 0,void 0,function(){return r(this,function(e){return[2,t]})})},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),[2,Promise.reject(e)]}})})}),a.interceptors.response.use(function(e){return e},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),console.error("API Request Failed:",e),[2,Promise.reject(e)]}})})}),a},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},d=l(),f=function(n,s,o){return e(void 0,void 0,void 0,function(){var e,i,c,p,f,m,E;return r(this,function(r){switch(r.label){case 0:switch(r.trys.push([0,13,,15]),e=(null==o?void 0:o.baseURL)?l(o.baseURL):d,c=(i=o||{}).data,p=i.config,f=void 0,n.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,e.get(s,p)];case 2:case 4:case 6:case 8:case 10:return f=r.sent(),[3,12];case 3:return[4,e.post(s,c,p)];case 5:return[4,e.put(s,c,p)];case 7:return[4,e.patch(s,c,p)];case 9:return m=t(t({},p),{data:c}),[4,e.delete(s,m)];case 11:throw new Error("Unsupported method: ".concat(n));case 12:return[2,{responseData:f.data,error:null}];case 13:return(E=r.sent()).type&&Object.values(a).includes(E.type)?[2,{responseData:null,error:E}]:[4,u(E)];case 14:return[2,{responseData:null,error:r.sent()}];case 15:return[2]}})})},m=function(n,i,c){return e(void 0,void 0,void 0,function(){var e,u,l,d,m,E,g,v,R,h,_,y,N,O;return r(this,function(r){switch(r.label){case 0:return u=(e=c||{}).data,l=e.params,d=e.config,m=e.errorMessage,E=e.baseURL,g=e.cacheOption,v=e.shouldCache,R=null!==(O=null==g?void 0:g.ttl)&&void 0!==O?O:o,h=(null==g?void 0:g.key)||p(n,i,l),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,s.get(h)];case 1:if(_=r.sent())return[2,{responseData:_.data,error:null,cacheMeta:{isFromCache:!0,timestamp:_.timestamp,ttl:_.ttl,cacheKey:h}}];r.label=2;case 2:return y=t(t({},d),l&&{params:l}),[4,f(n,i,{data:u,config:y,baseURL:E})];case 3:return N=r.sent(),!(null==g?void 0:g.skipCache)&&null!=N.responseData&&(!v||v(N.responseData))?[4,s.set(h,N.responseData,R)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,{responseData:N.responseData,error:N.error?{errorMessage:N.error.type===a.INTERNET_DISCONNECTED||N.error.type===a.SLOW_CONNECTION||N.error.type===a.TIMEOUT?N.error.message:N.error.type===a.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":m||N.error.message,errorObjData:N.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:R,cacheKey:h}}]}})})};export{o as DEFAULT_CACHE_TTL,l as createApiInstance,i as fetchOnDemandCitation,p as generateCacheKey,f as makeApiRequest,m as makeApiRequestWithTTLCache};
2
2
  //# sourceMappingURL=onDemandApi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChatCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/ChatCitation/InternalChatCitationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,qBAAqB,CAAC;AAM7B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA8CD,KAAK,iCAAiC,GAAG,iBAAiB,GAAG;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACnD,aAAa,EACb,aAAoC,EACpC,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,yBAAiC,EACjC,iBAAwB,EACxB,aAAmB,EACpB,EAAE,iCAAiC,2CAkhBnC"}
1
+ {"version":3,"file":"InternalChatCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/ChatCitation/InternalChatCitationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,qBAAqB,CAAC;AAM7B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA8CD,KAAK,iCAAiC,GAAG,iBAAiB,GAAG;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACnD,aAAa,EACb,aAAoC,EACpC,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,yBAAiC,EACjC,iBAAwB,EACxB,aAAmB,EACpB,EAAE,iCAAiC,2CAsgBnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOnDemandCitationFetch.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useOnDemandCitationFetch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,yCAAyC,CAAC;AA2EjD,eAAO,MAAM,wBAAwB,uIAUlC,8BAA8B;;;;;;;CAiGhC,CAAC"}
1
+ {"version":3,"file":"useOnDemandCitationFetch.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useOnDemandCitationFetch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,yCAAyC,CAAC;AA2EjD,eAAO,MAAM,wBAAwB,uIAUlC,8BAA8B;;;;;;;CAqGhC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from "axios";
2
- import type { NetworkError, CachedAPIResponse, CacheOptions, OnDemandCitationFetchApiResponse } from "../types/onDemandApi.types";
2
+ import type { NetworkError, CachedAPIResponse, CacheOptions, OnDemandCitationFetchApiResponse, UIMediaValidationFeedbackItem } from "../types/onDemandApi.types";
3
3
  export { NetworkErrorType } from "../types/onDemandApi.types";
4
4
  export type { NetworkError, ApiError, StandardAPIResponse, CachedAPIResponse, OnDemandCitationFetchResponse, OnDemandCitationFetchApiResponse, CacheOptions, } from "../types/onDemandApi.types";
5
5
  export declare const DEFAULT_CACHE_TTL: number;
6
- export declare const fetchOnDemandCitation: (requestId: string, citationType: string, citationNumber: number, llmFormattedResponse: string, token: string, baseUrl: string, citationAssistantProcessingName: string, orgName: string, citationAgentName: string, isEcgPayloadActive: boolean, ecg_agent_name: string, customCitationId: string, plan_id: string, ui_chat_history?: any) => Promise<CachedAPIResponse<any>>;
6
+ export declare const fetchOnDemandCitation: (requestId: string, citationType: string, citationNumber: number, llmFormattedResponse: string, token: string, baseUrl: string, citationAssistantProcessingName: string, orgName: string, citationAgentName: string, isEcgPayloadActive: boolean, isReqPayloadActive: boolean, ecg_agent_name: string, customCitationId: string, plan_id: string, ui_chat_history?: any, mmvf_list?: UIMediaValidationFeedbackItem[], files?: string[], metadata?: string) => Promise<CachedAPIResponse<any>>;
7
7
  export declare const getOnDemandCitation: (requestId: string, citationType: string, citationNumber: number, token: string, baseUrl: string) => Promise<OnDemandCitationFetchApiResponse>;
8
8
  export declare const createApiInstance: (baseURL?: string, timeout?: number) => AxiosInstance;
9
9
  export declare const generateCacheKey: (method: string, url: string, params?: any) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"onDemandApi.d.ts","sourceRoot":"","sources":["../../../../src/service/onDemandApi.ts"],"names":[],"mappings":"AACA,OAAc,EAAc,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAG5F,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gCAAgC,EACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,iBAAiB,QAAqB,CAAC;AAIpD,eAAO,MAAM,qBAAqB,cACrB,MAAM,gBACH,MAAM,kBACJ,MAAM,wBACA,MAAM,SACrB,MAAM,WACL,MAAM,mCACkB,MAAM,WAC9B,MAAM,qBACI,MAAM,sBACL,OAAO,kBACX,MAAM,oBACJ,MAAM,WACf,MAAM,oBACI,GAAG,KACpB,QAAQ,kBAAkB,GAAG,CAAC,CAwDhC,CAAC;AAGF,eAAO,MAAM,mBAAmB,cACnB,MAAM,gBACH,MAAM,kBACJ,MAAM,SAChB,MAAM,WACJ,MAAM,KACb,QAAQ,gCAAgC,CAiB1C,CAAC;AAmHF,eAAO,MAAM,iBAAiB,aAAc,MAAM,YAAW,MAAM,KAAY,aAsC9E,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,OACT,MAAM,WACF,GAAG,WACyC,CAAC;AAKxD,eAAO,MAAM,cAAc,cACjB,MAAM,OACT,MAAM,YACD;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;;WAGM,YAAY,GAAG,IAAI;EAuD3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,0DAG7B,MAAM,OACT,MAAM;WAEF,GAAG;aACD,GAAG;;;;;kFAM+D,OAAO;yCA4ErF,CAAC"}
1
+ {"version":3,"file":"onDemandApi.d.ts","sourceRoot":"","sources":["../../../../src/service/onDemandApi.ts"],"names":[],"mappings":"AACA,OAAc,EAAc,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAG5F,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,iBAAiB,QAAqB,CAAC;AAIpD,eAAO,MAAM,qBAAqB,cACrB,MAAM,gBACH,MAAM,kBACJ,MAAM,wBACA,MAAM,SACrB,MAAM,WACL,MAAM,mCACkB,MAAM,WAC9B,MAAM,qBACI,MAAM,sBACL,OAAO,sBACP,OAAO,kBACX,MAAM,oBACJ,MAAM,WACf,MAAM,oBACI,GAAG,cACV,6BAA6B,EAAE,UAClC,MAAM,EAAE,aACN,MAAM,KACf,QAAQ,kBAAkB,GAAG,CAAC,CA2DhC,CAAC;AAGF,eAAO,MAAM,mBAAmB,cACnB,MAAM,gBACH,MAAM,kBACJ,MAAM,SAChB,MAAM,WACJ,MAAM,KACb,QAAQ,gCAAgC,CAiB1C,CAAC;AAmHF,eAAO,MAAM,iBAAiB,aAAc,MAAM,YAAW,MAAM,KAAY,aAsC9E,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,OACT,MAAM,WACF,GAAG,WACyC,CAAC;AAKxD,eAAO,MAAM,cAAc,cACjB,MAAM,OACT,MAAM,YACD;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;;WAGM,YAAY,GAAG,IAAI;EAuD3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,0DAG7B,MAAM,OACT,MAAM;WAEF,GAAG;aACD,GAAG;;;;;kFAM+D,OAAO;yCA4ErF,CAAC"}
@@ -34,6 +34,11 @@ export interface OnDemandCitationFetchResponse {
34
34
  final_status?: boolean;
35
35
  }
36
36
  export type OnDemandCitationFetchApiResponse = CachedAPIResponse<OnDemandCitationFetchResponse>;
37
+ export interface UIMediaValidationFeedbackItem {
38
+ reason: string;
39
+ title: string;
40
+ description: string;
41
+ }
37
42
  export interface CacheOptions {
38
43
  /**
39
44
  * Custom cache key. If not provided, it will be derived
@@ -1 +1 @@
1
- {"version":3,"file":"onDemandApi.types.d.ts","sourceRoot":"","sources":["../../../../src/types/onDemandApi.types.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,qBAAqB,0BAA0B;IAC/C,kBAAkB,uBAAuB;IACzC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAClE,SAAS,CAAC,EAAE;QACV,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAAC,6BAA6B,CAAC,CAAC;AAEhG,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"onDemandApi.types.d.ts","sourceRoot":"","sources":["../../../../src/types/onDemandApi.types.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,qBAAqB,0BAA0B;IAC/C,kBAAkB,uBAAuB;IACzC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAClE,SAAS,CAAC,EAAE;QACV,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAAC,6BAA6B,CAAC,CAAC;AAEhG,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.233-beta.1",
3
+ "version": "0.0.234",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",