@e-llm-studio/instant-learning 0.0.303 → 0.0.305

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"),n=require("react/jsx-runtime"),t=require("@mui/material"),a=require("react"),o=require("./_components/ChatComponents/ChatComponent.js"),i=require("./_components/ILPopup.js"),s=require("./_components/VariantLoadingOverlay.js"),r=require("./_components/templates/RuleComparison/RuleComparison.js"),l=require("./_components/templates/RuleComparison/AgentComposerRuleComparison.js"),d=require("./_components/ChatComponents/NormalChat.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(a);exports.default=function(u){var g=u.open,h=u.chatAssistantName,m=u.organizationName,p=u.baseUrl,f=u.baseWebsocketUrl,C=u.closeFunction,v=u.ThinkingBulbIconComponent,x=u.customSections,S=u.customMetaData,b=u.chatTitle,k=void 0===b?"Instant Learning On-The-Job":b,w=u.formTitle,y=void 0===w?"Instant Learning On-The-Job Form":w,M=u.onSave,I=u.headerMessageHandlers,R=u.aiResponse,_=u.setAIResponse,j=u.width,T=void 0===j?"90vw":j,F=u.height,A=void 0===F?"90vh":F,D=u.sendMessageInChat,V=void 0===D?"":D,L=u.setSendMessageInChat,E=u.validateCustom,B=u.onResetChat,W=u.template,q=u.templateProps,P=u.initialChatMessage,z=u.setCitations,O=u.isLoading,N=void 0!==O&&O,U=u.isLocked,J=void 0!==U&&U,H=u.saveButtonConfig,G=void 0===H?{label:"Save Learning",loadingLabel:"Saving Learning..."}:H,X=u.saveButtonColor,Y=u.saveWithoutValBtnConfig,K=void 0===Y?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:Y,Q=u.textareaPlaceholder,Z=u.setCurrentRequestId,$=u.showSavedMessage,ee=void 0!==$&&$,ne=u.savedMessage,te=void 0===ne?"Thank you teacher for teaching me, your learning has been saved successfully.":ne,ae=u.isError,oe=void 0!==ae&&ae,ie=u.errorMessage,se=void 0===ie?"I'm sorry, I couldn't save your changes. Please try again.":ie,re=u.isSaving,le=void 0!==re&&re,de=u.isAiStreaming,ue=u.setIsAiStreaming,ce=u.showConfirmReset,ge=void 0!==ce&&ce,he=u.setShowConfirmReset,me=u.confirmReset,pe=u.isLoadingVariants,fe=u.isFormDirty,Ce=u.onResetRequest,ve=u.mainText,xe=void 0===ve?"Adding a variant":ve,Se=u.subText,be=void 0===Se?"This may take a moment as we update the learning with the new variant.":Se,ke=u.showComparison,we=void 0!==ke&&ke,ye=u.setShowComparison,Me=u.showAgentComposerRuleComparison,Ie=void 0!==Me&&Me,Re=u.setShowAgentComposerRuleComparison,_e=u.isFetchingComparison,je=u.handleOpenComparison,Te=u.proposedRule,Fe=u.variants,Ae=u.onAddAsVariant,De=u.isCopyEnabled,Ve=u.showSaveWithoutValidation,Le=void 0!==Ve&&Ve,Ee=u.onSaveWithoutValidation,Be=u.onComparisonLinkClick,We=u.targetComparisonVariantId,qe=u.highlightedComparisonField,Pe=u.onSubmitFeedback,ze=u.isUseNormalChat,Oe=void 0!==ze&&ze,Ne=u.userDetails,Ue=u.handleGlobalClickCapture,Je=u.isGlobalEditActive,He=u.socketTimeOutInMilliSeconds,Ge=u.initialDraftMessage,Xe=a.useState(g),Ye=Xe[0],Ke=Xe[1],Qe=a.useState(!1);Qe[0];var Ze=Qe[1],$e=a.useState(!1),en=$e[0],nn=$e[1],tn=a.useState(!1),an=tn[0];tn[1];var on=a.useState(45),sn=on[0],rn=on[1],ln=a.useState("right"),dn=ln[0],un=ln[1],cn=c.default.useRef(dn),gn=a.useState(!1),hn=gn[0],mn=gn[1],pn=a.useState(0),fn=pn[0],Cn=pn[1],vn=a.useState(40),xn=vn[0],Sn=vn[1];a.useEffect(function(){cn.current=dn},[dn]),a.useEffect(function(){Ke(g)},[g]);var bn=a.useCallback(function(e){e.preventDefault(),mn(!0),Cn(e.clientX),Sn(sn)},[sn]),kn=a.useCallback(function(e){if(hn){var n=document.querySelector("[data-dialog-content]");if(n){var t=n.getBoundingClientRect(),a=(e.clientX-fn)/t.width*100,o=Math.max(20,Math.min(80,xn+a));rn(o),o>xn&&un("right"),o<xn&&un("left")}}},[hn,fn,xn]),wn=a.useCallback(function(){mn(!1)},[]);a.useEffect(function(){if(hn)return document.addEventListener("mousemove",kn),document.addEventListener("mouseup",wn),function(){document.removeEventListener("mousemove",kn),document.removeEventListener("mouseup",wn)}},[hn,kn,wn]);var yn=function(e,n){J&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==fe?void 0:fe())?(Ke(!1),C()):null==Ce||Ce())},Mn=a.useCallback(function(e){rn(function(n){var t;if("number"==typeof e)return e>n&&un("right"),e<n&&un("left"),e;var a=cn.current,o=null!==(t={20:30,30:"left"===a?20:50,50:"left"===a?30:75,75:"left"===a?50:100,100:75}[n])&&void 0!==t?t:40;return 100===o&&un("left"),20===o&&un("right"),o})},[]),In=a.useCallback(function(){je&&(Mn(30),je())},[Mn,je]);return n.jsx(t.Dialog,e.__assign({open:Ye,onClose:yn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:T,height:A,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:n.jsxs(t.DialogContent,e.__assign({"data-dialog-content":!0,onClickCapture:Ue,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n.jsx(t.Box,e.__assign({sx:{width:"".concat(sn,"%"),maxWidth:"".concat(sn,"%"),transition:hn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===sn?"none":"flex",flexDirection:"column"}},{children:Oe?n.jsx(d.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:Ze,ThinkingBulbIconComponent:v,isFormSaveClicked:en,setIsFormSavedClicked:nn,onResetLearningData:function(){},sendMessageInChat:V,setSendMessageInChat:L,isFormValidating:an,chatTitle:k,customMetaData:S,headerMessageHandlers:I,aiResponse:R,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:M,chatSize:sn,movingTowards:dn,setChatSize:Mn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:In,isCopyEnabled:De,onComparisonLinkClick:Be,onSubmitFeedback:Pe}):n.jsx(o.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:Ze,ThinkingBulbIconComponent:v,isFormSaveClicked:en,setIsFormSavedClicked:nn,onResetLearningData:function(){},sendMessageInChat:V,setSendMessageInChat:L,isFormValidating:an,chatTitle:k,customMetaData:S,headerMessageHandlers:I,aiResponse:R,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:M,chatSize:sn,movingTowards:dn,setChatSize:Mn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:In,isCopyEnabled:De,onComparisonLinkClick:Be,onSubmitFeedback:Pe,userDetails:Ne,isGlobalEditActive:Je,socketTimeOutInMilliSeconds:He,initialDraftMessage:Ge})})),n.jsx(t.Box,{sx:{width:"2px",cursor:"col-resize",backgroundColor:hn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:bn}),n.jsxs(t.Box,e.__assign({sx:{width:"".concat(100-sn,"%"),maxWidth:"".concat(100-sn,"%"),transition:hn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===sn?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n.jsx(s.default,{isLoading:_e||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n.jsx(s.default,{isLoading:pe||!1,mainText:xe,subText:be}),Ie?n.jsx(l.default,{proposedRule:Te,variants:Fe,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ae||Ae(),Mn(40),null==Re||Re(!1)},onSkip:function(){Mn(40),null==Re||Re(!1)},onBack:function(){Mn(40),null==Re||Re(!1)},targetVariantId:We,highlightedField:qe}):we?n.jsx(r.default,{variants:Fe,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ae||Ae(),Mn(40),null==ye||ye(!1)},onSkip:function(){Mn(40),null==ye||ye(!1)},onBack:function(){Mn(40),null==ye||ye(!1)},targetVariantId:We}):n.jsx(i.default,{setIsFormSavedClicked:nn,customSections:x,onSave:M,formHeader:y,onClose:function(){return yn(0,"manualClose")},validateCustom:E,template:W,templateProps:q,isLoading:N,isAiStreaming:de,saveButtonConfig:G,saveButtonColor:X,showSaveWithoutValidation:Le,saveWithoutValBtnConfig:K,onSaveWithoutValidation:Ee}),n.jsx(t.Dialog,e.__assign({open:ge,onClose:function(){return null==he?void 0:he(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:n.jsxs(t.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n.jsx("p",e.__assign({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),n.jsxs(t.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n.jsx("button",e.__assign({onClick:function(){return null==he?void 0:he(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:me,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@mui/material"),a=require("react"),o=require("./_components/ChatComponents/ChatComponent.js"),i=require("./_components/ILPopup.js"),s=require("./_components/VariantLoadingOverlay.js"),r=require("./_components/templates/RuleComparison/RuleComparison.js"),l=require("./_components/templates/RuleComparison/AgentComposerRuleComparison.js"),d=require("./_components/ChatComponents/NormalChat.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(a);exports.default=function(u){var g=u.open,h=u.chatAssistantName,m=u.organizationName,p=u.baseUrl,f=u.baseWebsocketUrl,C=u.closeFunction,v=u.ThinkingBulbIconComponent,x=u.customSections,S=u.customMetaData,b=u.chatTitle,k=void 0===b?"Instant Learning On-The-Job":b,w=u.formTitle,M=void 0===w?"Instant Learning On-The-Job Form":w,y=u.onSave,R=u.headerMessageHandlers,I=u.aiResponse,_=u.setAIResponse,j=u.width,F=void 0===j?"90vw":j,T=u.height,V=void 0===T?"90vh":T,A=u.sendMessageInChat,D=void 0===A?"":A,L=u.setSendMessageInChat,E=u.validateCustom,B=u.onResetChat,W=u.template,q=u.templateProps,P=u.initialChatMessage,z=u.setCitations,O=u.isLoading,N=void 0!==O&&O,U=u.isLocked,J=void 0!==U&&U,H=u.saveButtonConfig,G=void 0===H?{label:"Save Learning",loadingLabel:"Saving Learning..."}:H,X=u.saveButtonColor,Y=u.saveWithoutValBtnConfig,K=void 0===Y?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:Y,Q=u.textareaPlaceholder,Z=u.setCurrentRequestId,$=u.showSavedMessage,ee=void 0!==$&&$,ne=u.savedMessage,te=void 0===ne?"Thank you teacher for teaching me, your learning has been saved successfully.":ne,ae=u.isError,oe=void 0!==ae&&ae,ie=u.errorMessage,se=void 0===ie?"I'm sorry, I couldn't save your changes. Please try again.":ie,re=u.isSaving,le=void 0!==re&&re,de=u.isAiStreaming,ue=u.setIsAiStreaming,ce=u.showConfirmReset,ge=void 0!==ce&&ce,he=u.setShowConfirmReset,me=u.confirmReset,pe=u.isLoadingVariants,fe=u.isFormDirty,Ce=u.onResetRequest,ve=u.mainText,xe=void 0===ve?"Adding a variant":ve,Se=u.subText,be=void 0===Se?"This may take a moment as we update the learning with the new variant.":Se,ke=u.showComparison,we=void 0!==ke&&ke,Me=u.setShowComparison,ye=u.showAgentComposerRuleComparison,Re=void 0!==ye&&ye,Ie=u.setShowAgentComposerRuleComparison,_e=u.isFetchingComparison,je=u.handleOpenComparison,Fe=u.proposedRule,Te=u.variants,Ve=u.onAddAsVariant,Ae=u.isCopyEnabled,De=u.showSaveWithoutValidation,Le=void 0!==De&&De,Ee=u.onSaveWithoutValidation,Be=u.onComparisonLinkClick,We=u.targetComparisonVariantId,qe=u.highlightedComparisonField,Pe=u.onSubmitFeedback,ze=u.isUseNormalChat,Oe=void 0!==ze&&ze,Ne=u.userDetails,Ue=u.handleGlobalClickCapture,Je=u.isGlobalEditActive,He=u.socketTimeOutInMilliSeconds,Ge=u.initialDraftMessage,Xe=u.onValidateSession,Ye=a.useState(g),Ke=Ye[0],Qe=Ye[1],Ze=a.useState(!1);Ze[0];var $e=Ze[1],en=a.useState(!1),nn=en[0],tn=en[1],an=a.useState(!1),on=an[0];an[1];var sn=a.useState(45),rn=sn[0],ln=sn[1],dn=a.useState("right"),un=dn[0],cn=dn[1],gn=c.default.useRef(un),hn=a.useState(!1),mn=hn[0],pn=hn[1],fn=a.useState(0),Cn=fn[0],vn=fn[1],xn=a.useState(40),Sn=xn[0],bn=xn[1];a.useEffect(function(){gn.current=un},[un]),a.useEffect(function(){Qe(g)},[g]);var kn=a.useCallback(function(e){e.preventDefault(),pn(!0),vn(e.clientX),bn(rn)},[rn]),wn=a.useCallback(function(e){if(mn){var n=document.querySelector("[data-dialog-content]");if(n){var t=n.getBoundingClientRect(),a=(e.clientX-Cn)/t.width*100,o=Math.max(20,Math.min(80,Sn+a));ln(o),o>Sn&&cn("right"),o<Sn&&cn("left")}}},[mn,Cn,Sn]),Mn=a.useCallback(function(){pn(!1)},[]);a.useEffect(function(){if(mn)return document.addEventListener("mousemove",wn),document.addEventListener("mouseup",Mn),function(){document.removeEventListener("mousemove",wn),document.removeEventListener("mouseup",Mn)}},[mn,wn,Mn]);var yn=function(e,n){J&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==fe?void 0:fe())?(Qe(!1),C()):null==Ce||Ce())},Rn=a.useCallback(function(e){ln(function(n){var t;if("number"==typeof e)return e>n&&cn("right"),e<n&&cn("left"),e;var a=gn.current,o=null!==(t={20:30,30:"left"===a?20:50,50:"left"===a?30:75,75:"left"===a?50:100,100:75}[n])&&void 0!==t?t:40;return 100===o&&cn("left"),20===o&&cn("right"),o})},[]),In=a.useCallback(function(){je&&(Rn(30),je())},[Rn,je]);return n.jsx(t.Dialog,e.__assign({open:Ke,onClose:yn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:F,height:V,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:n.jsxs(t.DialogContent,e.__assign({"data-dialog-content":!0,onClickCapture:Ue,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n.jsx(t.Box,e.__assign({sx:{width:"".concat(rn,"%"),maxWidth:"".concat(rn,"%"),transition:mn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===rn?"none":"flex",flexDirection:"column"}},{children:Oe?n.jsx(d.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:$e,ThinkingBulbIconComponent:v,isFormSaveClicked:nn,setIsFormSavedClicked:tn,onResetLearningData:function(){},sendMessageInChat:D,setSendMessageInChat:L,isFormValidating:on,chatTitle:k,customMetaData:S,headerMessageHandlers:R,aiResponse:I,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:y,chatSize:rn,movingTowards:un,setChatSize:Rn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:In,isCopyEnabled:Ae,onComparisonLinkClick:Be,onSubmitFeedback:Pe}):n.jsx(o.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:$e,ThinkingBulbIconComponent:v,isFormSaveClicked:nn,setIsFormSavedClicked:tn,onResetLearningData:function(){},sendMessageInChat:D,setSendMessageInChat:L,isFormValidating:on,chatTitle:k,customMetaData:S,headerMessageHandlers:R,aiResponse:I,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:y,chatSize:rn,movingTowards:un,setChatSize:Rn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:In,isCopyEnabled:Ae,onComparisonLinkClick:Be,onSubmitFeedback:Pe,userDetails:Ne,isGlobalEditActive:Je,socketTimeOutInMilliSeconds:He,initialDraftMessage:Ge,onValidateSession:Xe,onCloseSessionModal:me})})),n.jsx(t.Box,{sx:{width:"2px",cursor:"col-resize",backgroundColor:mn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:kn}),n.jsxs(t.Box,e.__assign({sx:{width:"".concat(100-rn,"%"),maxWidth:"".concat(100-rn,"%"),transition:mn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===rn?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n.jsx(s.default,{isLoading:_e||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n.jsx(s.default,{isLoading:pe||!1,mainText:xe,subText:be}),Re?n.jsx(l.default,{proposedRule:Fe,variants:Te,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ve||Ve(),Rn(40),null==Ie||Ie(!1)},onSkip:function(){Rn(40),null==Ie||Ie(!1)},onBack:function(){Rn(40),null==Ie||Ie(!1)},targetVariantId:We,highlightedField:qe}):we?n.jsx(r.default,{proposedRule:Fe,variants:Te,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ve||Ve(),Rn(40),null==Me||Me(!1)},onSkip:function(){Rn(40),null==Me||Me(!1)},onBack:function(){Rn(40),null==Me||Me(!1)},targetVariantId:We,highlightedField:qe}):n.jsx(i.default,{setIsFormSavedClicked:tn,customSections:x,onSave:y,formHeader:M,onClose:function(){return yn(0,"manualClose")},validateCustom:E,template:W,templateProps:q,isLoading:N,isAiStreaming:de,saveButtonConfig:G,saveButtonColor:X,showSaveWithoutValidation:Le,saveWithoutValBtnConfig:K,onSaveWithoutValidation:Ee}),n.jsx(t.Dialog,e.__assign({open:ge,onClose:function(){return null==he?void 0:he(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:n.jsxs(t.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n.jsx("p",e.__assign({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),n.jsxs(t.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n.jsx("button",e.__assign({onClick:function(){return null==he?void 0:he(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:me,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};
2
2
  //# sourceMappingURL=ILOTJ.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");require("react/jsx-runtime"),require("@mui/material"),require("lucide-react"),require("react"),require("uuid"),require("./_components/templates/TemplatesMap/templatesMap.js"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw");var r=require("axios");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("./_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("./_components/MarkdownComponents/MarkdownElements.js"),require("./_components/CitationLink.js"),require("@e-llm-studio/citation"),require("./store/CitationsContext.js"),require("@viswa-test/test-citation");var i=t(r);exports.getVariantInfo=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 e.trys.push([0,2,,3]),[4,i.default.post("https://devllmstudio.creativeworkspace.ai/instant_learning/give-variant-info",r)];case 1:return[2,e.sent().data];case 2:throw t=e.sent(),console.error("Error getting variant info:",t),t;case 3:return[2]}})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");require("react/jsx-runtime"),require("@mui/material"),require("lucide-react"),require("react"),require("uuid"),require("./_components/templates/TemplatesMap/templatesMap.js"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw");var r=require("axios");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("./_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("./_components/MarkdownComponents/MarkdownElements.js"),require("./_components/CitationLink.js"),require("@e-llm-studio/citation"),require("./store/CitationsContext.js"),require("./_components/templates/RuleComparison/RuleComparison.js");var i=t(r);exports.getVariantInfo=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 e.trys.push([0,2,,3]),[4,i.default.post("https://devllmstudio.creativeworkspace.ai/instant_learning/give-variant-info",r)];case 1:return[2,e.sent().data];case 2:throw t=e.sent(),console.error("Error getting variant info:",t),t;case 3:return[2]}})})};
2
2
  //# sourceMappingURL=ILOTJTest.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),a=require("@mui/material"),i=require("@mui/material/Tooltip"),s=require("react-markdown"),r=require("rehype-raw"),o=require("axios"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),v=require("../MessageRendering/MessageRendering.js"),h=require("../atoms/SkeletonLoader/SkeletonLoader.js"),m=require("../MessageRendering/ClickableChatComponents.js"),f=require("../AudioWaveform.js"),g=require("./ChatComponent.module.css.js"),p=require("../../InstantLearning.module.css.js"),_=require("../_svg/ScrollToBottom.js"),C=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),y=require("../_svg/SparkleIcon.js"),S=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w,j=b(i),k=b(s),E=b(r),T=b(o);exports.autoGeneratePrompt=function(e,t){return T.default.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:t||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(i){var s=i.chatAssistantName,r=i.organizationName,o=i.baseUrl,b=i.baseWebsocketUrl,R=i.setIsNewChatClicked;i.ThinkingBulbIconComponent;var M=i.isFormSaveClicked,I=i.setIsFormSavedClicked,A=i.onResetLearningData,q=i.sendMessageInChat,D=i.setSendMessageInChat,N=i.isFormValidating,L=i.chatTitle,F=i.customMetaData,W=i.headerMessageHandlers;i.aiResponse;var P=i.setAIResponse,B=i.onResetChat,z=i.initialChatMessage,H=void 0===z?"":z,U=i.onSave,G=i.chatSize,O=i.setChatSize,Z=i.movingTowards,K=i.setCitations,V=i.textareaPlaceholder,Q=void 0===V?"Tell me more about this learning...":V,J=i.setCurrentRequestId,$=i.showSavedMessage,X=void 0!==$&&$,Y=i.savedMessage,ee=i.isError,te=void 0!==ee&&ee,ne=i.errorMessage,ae=void 0===ne?"There was an error saving your changes.":ne;i.isSaving;var ie=i.isHighlighted,se=void 0!==ie&&ie,re=i.onStreamingStateChange,oe=i.onViewComparison;i.isCopyEnabled;var le=i.onComparisonLinkClick,ue=i.onSubmitFeedback,de=i.userDetails,ce=i.isGlobalEditActive,ve=i.socketTimeOutInMilliSeconds,he=i.initialDraftMessage,me=void 0===he?"":he,fe=s,ge=n.useRef("".concat(fe,"-").concat(r,"-").concat(l.v4())),pe=n.useRef("".concat(l.v4())),_e=o,Ce=n.useRef(null),xe=n.useRef(!0),ye=n.useRef(null),Se=n.useRef(null),be=n.useState(me),we=be[0],je=be[1],ke=n.useState([]),Ee=ke[0],Te=ke[1],Re=n.useState(!1),Me=Re[0],Ie=Re[1],Ae=n.useState(!1);Ae[0];var qe=Ae[1],De=n.useState(!0),Ne=De[0],Le=De[1],Fe=n.useState(!0);Fe[0];var We=Fe[1],Pe=n.useState("");Pe[0];var Be=Pe[1],ze=n.useState(""),He=ze[0],Ue=ze[1],Ge=n.useState(!1),Oe=Ge[0],Ze=Ge[1],Ke=n.useState(!1),Ve=Ke[0],Qe=Ke[1],Je=n.useState(!0),$e=Je[0],Xe=Je[1],Ye=n.useState("100%");Ye[0];var et=Ye[1],tt=n.useState(null),nt=tt[0],at=tt[1],it=n.useState(!1);it[0];var st=it[1],rt=n.useState(!1),ot=rt[0],lt=rt[1],ut=n.useRef(null),dt=n.useRef(new Set),ct=n.useState(null),vt=ct[0],ht=ct[1],mt=n.useState(!1),ft=mt[0],gt=mt[1],pt=n.useState(!1);pt[0],pt[1];var _t=n.useState(null);_t[0],_t[1],n.useRef(null),n.useRef(null);var Ct=n.useRef(new Map),xt=n.useRef(""),yt=n.useRef(new Map),St=n.useRef(!1),bt=n.useRef(0),wt=n.useRef(null);a.keyframes(w||(w=e.__makeTemplateObject(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var jt=n.useMemo(function(){return""===(null==we?void 0:we.trim())||Oe},[we,Oe]),kt=n.useMemo(function(){return N},[N]),Et=n.useMemo(function(){var e;return Ee.length>0&&"user"===(null===(e=Ee[Ee.length-1])||void 0===e?void 0:e.role)},[Ee]),Tt=n.useMemo(function(){return jt||N||!!ce||Et},[jt,N,ce,Et]);n.useEffect(function(){me&&!we&&(je(me),Qe(!0),setTimeout(function(){if(Se.current){Se.current.focus();var e=me.length;Se.current.setSelectionRange(e,e)}},400))},[me]),n.useEffect(function(){null==re||re(Oe)},[Oe,re]),n.useEffect(function(){return function(){wt.current&&clearTimeout(wt.current)}},[]),n.useEffect(function(){var e=Ce.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;Xe(n-t-a<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[Ee]);var Rt=C.useHeaderObserver({handlers:W,setResult:P}).processHeaderMessage;n.useEffect(function(){X&&lt(!0)},[X]),n.useEffect(function(){if(ft){var e=setTimeout(function(){gt(!1)},3e3);return function(){return clearTimeout(e)}}},[ft]),n.useEffect(function(){M&&!ce&&(Ft(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),I(!1))},[M]),n.useEffect(function(){if(q)try{if(q.startsWith("__SKELETON__:")){var t=q.split(":"),n=t[1],a=t.slice(2).join(":"),i={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:a};return Te(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[i],!1)}),Ft(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,n),ht(n),D&&D(""),void setTimeout(function(){ht(null)},2e3)}if(q.startsWith("__SKELETON_END__::")){var s=q.split("::")[1]||"";return Te(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||s}):t})}),void(D&&D(""))}var r=l.v4();Ft(new KeyboardEvent("keydown",{key:"Enter"}),!1,q,!1,r),ht(r),D&&D(""),setTimeout(function(){return ht(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[q]),n.useEffect(function(){It(),At();var e=function(){var e,t=(null===(e=null==ut?void 0:ut.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");et(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Mt=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";ye.current&&ye.current.scrollIntoView({behavior:t,block:"end"}),xe.current&&setTimeout(function(){ye.current&&xe.current&&ye.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!Oe){var t="";if(ot?t=Y||"Thank you teacher for teaching me, your rule has been saved successfully.":te&&(t=ae||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};Te(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),lt(!1),setTimeout(function(){return Mt("smooth")},100)}}},[ot,te,Oe,Y,ae,Mt]),n.useEffect(function(){xe.current&&Mt("smooth")},[Mt]);var It=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(_e,"/api/chatbot/getChatSettings?name=").concat(fe,"&organizationName=").concat(r),headers:{}};T.default.request(e).then(function(e){var t,n,a;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&We(!0)}).catch(function(e){console.error(e)})},At=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(_e,"/api/chat/history?name=").concat(fe,"&organizationName=").concat(r);try{n={method:"GET",params:{guestSessionId:ge.current},withCredentials:!0},T.default.get(t,n).then(function(e){var t=e.data;t.length>0?(Te(t),Mt()):We(!0)}).catch(function(e){console.error(e)})}catch(e){Ie(!1),console.error(e)}return[2]})})};function qt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Dt=function(t,n,a,i,s,r,o){var u,d,c,v,h,m,f,g,p,_,C,x,y,S,b,w,j,k,E,T,R,M,I,A,q,D,N,L,F,W;if(null===(d=null===(u=null==t?void 0:t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var P={header_message:t.chatStream.continueChatResult.header_message,responsedata:null===(h=null===(v=null===(c=null==t?void 0:t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===h?void 0:h.content};Rt(P)}var B=null===(m=null==t?void 0:t.chatStream)||void 0===m?void 0:m.continueChatResult,z=null==B?void 0:B.isEnd,H=(null===(f=null==B?void 0:B.message)||void 0===f?void 0:f.citations)||[];z&&H.length>0&&K&&K(H);var U={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))qe(!0),U.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var a=e.substring(n+13);return null==a?void 0:a.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==t?void 0:t.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==U.content&&(Ie(!1),Te(e.__spreadArray(e.__spreadArray([],Ee,!0),[{role:"user",content:s,time:i,isFirstQuestionSent:r||!1,id:o||(null===(w=null===(b=null==t?void 0:t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===w?void 0:w.requestId)||"",reply:""},U],!1)));else{qe(!1);var G=null===(k=null===(j=null==t?void 0:t.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===k?void 0:k.requestId;"string"==typeof G&&G&&J&&J(G);var O=function(t,n,a,i){var s,r,o,u,d,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},m=(null===(s=null==t?void 0:t.chatStream)||void 0===s?void 0:s.continueChatResult)||{},f=null==m?void 0:m.requestId,g=null==m?void 0:m.preserve_message,p=null==m?void 0:m.isEnd,_=(null===(r=null==m?void 0:m.message)||void 0===r?void 0:r.content)||"",C=null==m?void 0:m.is_orchestrator,x=null==m?void 0:m.thinking_break,y=(null===(o=null==m?void 0:m.message)||void 0===o?void 0:o.citations)||[];if(f&&g&&_&&!p){var S=i.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),i.current.set(f,S))}var b=(f&&i.current.get(f)||[]).join("\n\n"),w="";if(p)w=b&&""!==b.trim()?b:_;else if(g)w=b;else{var j=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),k=!1===C||x||0!==y.length?"":j;w=b?"".concat(b,"\n\n").concat(k):k}if(h.content=qt(w),!0===(null==m?void 0:m.thinking_break)&&!0===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)&&n.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1}),!1===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){if(m.explainability_id&&m.responded_by){var E=m.explainability_id,T=m.responded_by;a.has(E)||a.set(E,{responded_by:T,index:n.length})}a.has(m.explainability_id)?n[null==(R=a.get(m.explainability_id))?void 0:R.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(u=m.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:n=e.__spreadArray(e.__spreadArray([],n,!0),[{responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(d=m.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){var R;m.explainability_id&&m.responded_by&&(E=m.explainability_id,T=m.responded_by,a.has(E)||a.set(E,{responded_by:T,index:n.length})),a.has(m.explainability_id)?n[null==(R=a.get(m.explainability_id))?void 0:R.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(c=m.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:n.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(v=m.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},h)}(t,a,n,yt);O.time=new Date,O.citations=H,O.isEnd=null===(T=null===(E=null==t?void 0:t.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===T?void 0:T.isEnd,O.requestId=null===(M=null===(R=null==t?void 0:t.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===M?void 0:M.requestId,O.sessionId=ge.current,null===(I=O.orchestratorAndAgentsMessages)||void 0===I||I.forEach(function(e){e&&e.header_message&&Rt(e)}),(""!==(null==O?void 0:O.content)||(null==O?void 0:O.orchestratorAndAgentsMessages)&&(null==O?void 0:O.orchestratorAndAgentsMessages.length)>0)&&(Ie(!1),Te(e.__spreadArray(e.__spreadArray([],Ee,!0),[{role:"user",content:s||"",time:i,isFirstQuestionSent:r||!1,id:o||(null===(q=null===(A=null==t?void 0:t.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===q?void 0:q.requestId)||"",requestId:null!==(L=null===(N=null===(D=null==t?void 0:t.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===N?void 0:N.requestId)&&void 0!==L?L:""},O],!1))),Le(null===(W=null===(F=null==t?void 0:t.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===W?void 0:W.isEnd)}},Nt=n.useCallback(function(t){void 0===t&&(t="inactivity"),console.error("Stream failed or timed out due to: ".concat(t)),St.current=!1,Le(!0),Ze(!1),st(!1),Ie(!1),qe(!1),xt.current&&b&&(u.stopStreaming(xt.current,b,!1),yt.current.delete(xt.current)),Te(function(n){var a=e.__spreadArray([],n,!0).reverse().find(function(e){return"user"===e.role}),i=((null==a?void 0:a.content)||"").replace(/"/g,"&quot;"),s=e.__spreadArray([],n,!0),r=s[s.length-1];r&&"assistant"===r.role&&!r.isEnd&&s.pop();var o="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===t?o="Something went wrong—teaching is taking longer than expected.":"websocket_error"===t&&(o="I lost connection to the server while working on that."),e.__spreadArray(e.__spreadArray([],s,!0),[{role:"assistant",content:"".concat(o,' Please try again.\n\n<button class="clickable-button" data-value="').concat(i,'">Retry</button>'),id:l.v4(),time:new Date,isEnd:!0,citations:[]}],!1)})},[ve,b]),Lt=n.useCallback(function(){wt.current&&(clearTimeout(wt.current),wt.current=null),ve&&ve>0&&(wt.current=setTimeout(function(){return Nt("inactivity")},ve))},[Nt,ve]),Ft=function(t,n,a,i,s,o){var d,c,v,h,m,f,g=(void 0!==a?a:we||"").trim(),p="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey)&&!ce;p&&(null===(d=null==t?void 0:t.preventDefault)||void 0===d||d.call(t));var _="user"===(null===(c=Ee[Ee.length-1])||void 0===c?void 0:c.role);if(!(!g||Oe||St.current||_||(null==t?void 0:t.key)&&!p)){if(St.current=!0,"I want to add a rule description"===g){Le(!1),xe.current=!0,Ze(!0),!nt&&g&&at(a||"manual_entry");var C=new Date;return Te(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var a;return e.__assign(e.__assign({},t),{content:null===(a=qt(t.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:g,time:C,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Mt("smooth"),void setTimeout(function(){Te(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),Mt("smooth"),setTimeout(function(){Ze(!1),Le(!0)},500)},500)}Le(!1),xe.current=!0,Ze(!0),!nt&&g&&at(a||"manual_entry");var x=new Date;Te(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=qt(t.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return s&&n.some(function(e){return e.id===s})?n.map(function(t){return t.id===s?e.__assign(e.__assign({},t),{content:g}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:g,time:x,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Mt("smooth");var y=new Map,S=[],w={WEBSOCKET_URL:b,organizationName:r,chatAssistantName:fe,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(v=null==de?void 0:de.name)&&void 0!==v?v:"Guest User",userEmailId:null!==(h=null==de?void 0:de.email)&&void 0!==h?h:"guestUser@example.com",userId:null!==(m=null==de?void 0:de.id)&&void 0!==m?m:"Guest User",query:g,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:ge.current,chatPreviewId:pe.current,customMetaData:F,aiModel:"",enableLogs:!0,onStreamEvent:function(e){var t,a,i,r,o,l,u=null===(a=null===(t=null==e?void 0:e.chatStream)||void 0===t?void 0:t.continueChatResult)||void 0===a?void 0:a.requestId,d=null===(r=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===r?void 0:r.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(u,",").concat(d)),Lt();var c=null===(l=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===l?void 0:l.error_state;if(Array.isArray(c)&&c.length>0)return console.error("Agent returned an error_state during stream:",c),void Nt("agent_error");Dt(e,y,S,x,g,n,s)},onStreamEnd:function(t){var n,a,i=null===(a=null===(n=null==t?void 0:t.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===a?void 0:a.requestId;console.log("✅ [Stream Completed] RequestID: ".concat(i)),wt.current&&clearTimeout(wt.current),St.current=!1,Le(!0),Ze(!1),st(!1);var s=Date.now(),r=Ct.current.get(xt.current);if(r){var o=Math.round((s-r)/1e3).toFixed(1);Te(function(t){var n=e.__spreadArray([],t,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===n)return t;var a=t.length-1-n;return t.map(function(t,n){return n===a?e.__assign(e.__assign({},t),{finalTimeTaken:o}):t})})}},onError:function(e){wt.current&&clearTimeout(wt.current),console.error("Stream error:",e),Nt("websocket_error")}};if(g)Ie(!0),null===(f=Se.current)||void 0===f||f.blur(),je(""),Mt(),Ue(s?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Ct.current.set(w.requestId,Date.now()),xt.current=w.requestId,Lt(),bt.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(bt.current,") | RequestID: ").concat(w.requestId,' | Query: "').concat(g,'"')),u.startChatStream(w);o&&o(!1)}},Wt=n.useRef(null);n.useLayoutEffect(function(){Wt.current=Ft});var Pt=n.useCallback(function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return null===(t=Wt.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([Wt],n,!1))},[]),Bt=n.useMemo(function(){return{p:function(n){n.node;var a=n.children;return e.__rest(n,["node","children"]),t.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:a}))},button:function(n){n.node;var a=n.className,i=n.children,s=e.__rest(n,["node","className","children"]),r=C.extractTextFromChildren(i),o=s["data-value"],l=nt===r||nt===o,u=!!nt||!!ce,d="Tester Genie"===r;return t.jsx(m.ActionableButton,e.__assign({},s,{className:a,handleStream:Pt,isStreamEnd:Ne,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":nt?"false":void 0},{children:t.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,d&&t.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),t.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),t.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),t.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),t.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Pt,Ne,nt,ce]),zt=n.useMemo(function(){return Ee.some(function(e){return e.isSkeleton})},[Ee]),Ht=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return ue?[4,ue(t)]:[3,2];case 1:n.sent(),Te(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Mt("smooth")},100),n.label=2;case 2:return[2]}})})};return t.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:se&&!zt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:Ce,className:g.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:ut,className:g.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:function(){var e="".concat(_e,"/api/chat/resetHistory?name=").concat(fe,"&organizationName=").concat(r);try{var t={method:"GET",params:{guestSessionId:ge.current},withCredentials:!0};T.default.get(e,t).then(function(){R(!0),Be(""),at(null),dt.current.clear(),yt.current.clear(),pe.current="".concat(l.v4()),Te([]),We(!0),null==B||B(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){ge.current="".concat(fe,"-").concat(r,"-").concat(l.v4())})}catch(e){Ie(!1),console.error(e)}},isStreamEnd:Ne,chatTitle:L,onResize:O,chatSize:G,movingTowards:Z})})),t.jsxs("div",e.__assign({className:g.default.messagesList},{children:[t.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:t.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:t.jsx("span",{children:t.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:Bt},{children:H}))})}))}))]})),Ee.length>0&&Ee.map(function(n,a){var i,s;return t.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===n.role?t.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:t.jsx(y.default,{})})):t.jsx("div",{className:g.default.userSpacer}),t.jsx("div",e.__assign({className:g.default.messageContent},{children:"assistant"===n.role?t.jsxs(t.Fragment,{children:[n.orchestratorAndAgentsMessages&&n.orchestratorAndAgentsMessages.length>0&&t.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==n?void 0:n.orchestratorAndAgentsMessages,isStreamEnd:Ne,finalTimeTaken:null==n?void 0:n.finalTimeTaken},null!==(i=null==n?void 0:n.finalTimeTaken)&&void 0!==i?i:null==n?void 0:n.id),t.jsx(v.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Ee,handleStream:Ft,isLastMessage:a===Ee.length-1,onSave:U,citations:null==n?void 0:n.citations,setChatSize:O,chatSize:G,isStreamEnd:Ne,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:oe,onTypeResponseClick:function(){var e;gt(!0),null===(e=Se.current)||void 0===e||e.focus()},onComparisonLinkClick:le,baseURL:_e,onFeedbackSubmit:Ht,isGlobalEditActive:ce}),n.hasOwnProperty("isEnd")&&!(null==n?void 0:n.isEnd)&&(null===(s=null==n?void 0:n.content)||void 0===s?void 0:s.length)>0&&t.jsxs(t.Fragment,{children:[t.jsx(h.Skeleton,{variant:"text",width:"50%",height:20}),t.jsx("div",{style:{marginTop:"10px"}}),t.jsx(h.Skeleton,{variant:"text",width:"100%",height:40})]}),t.jsx("div",e.__assign({className:g.default.timestamp},{children:n.time&&!isNaN(new Date(n.time).getTime())?new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):t.jsxs("div",e.__assign({className:g.default.userMessageWrapper},{children:[t.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:n.isSkeleton||zt||n.id!==vt?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[n.isSkeleton?t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[t.jsx(h.Skeleton,{variant:"text",width:"100%",height:16}),t.jsx(h.Skeleton,{variant:"text",width:"80%",height:16})]})):t.jsx(v.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Ee,handleStream:Ft,isLastMessage:a===Ee.length-1,onSave:U,citations:null==n?void 0:n.citations,isStreamEnd:Ne,isGlobalEditActive:ce,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:oe,onComparisonLinkClick:le,baseURL:_e,onFeedbackSubmit:Ht}),t.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:t.jsx(S.UserIcon,{})}))]})),t.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),n.id)}),Me&&t.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:t.jsx("span",{children:He})}))]})),t.jsx("div",{ref:ye,style:{float:"left",clear:"both"}})]}))]})),t.jsx("div",e.__assign({className:g.default.inputAreaWrapper},{children:t.jsx(j.default,e.__assign({title:N?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(kt?g.default.disabled:""),style:ft?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Ee.length>0&&!$e&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Mt("smooth")},className:g.default.scrollToBottomBtn},{children:t.jsx(_.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:Se,placeholder:Q,value:we||"",onChange:function(e){je(e.target.value)},onFocus:function(){return Qe(!0)},onBlur:function(){return Qe(!1)},onKeyDown:function(e){return Ft(e)},disabled:kt,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ve||we&&we.length>40?"120px":"50px",height:Ve||we&&we.length>40?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){Tt||Ft(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Tt,className:"".concat(g.default.sendButton," ").concat(Tt?g.default.disabled:g.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))})),t.jsxs("div",e.__assign({className:g.default.footerTools},{children:[t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),s=require("@mui/material"),a=require("@mui/material/Tooltip"),i=require("react-markdown"),r=require("rehype-raw"),o=require("axios"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),v=require("../MessageRendering/MessageRendering.js"),h=require("../atoms/SkeletonLoader/SkeletonLoader.js"),g=require("../MessageRendering/ClickableChatComponents.js"),m=require("../AudioWaveform.js"),f=require("./ChatComponent.module.css.js"),p=require("../../InstantLearning.module.css.js"),_=require("../_svg/ScrollToBottom.js"),C=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),y=require("../_svg/SparkleIcon.js"),S=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w,k=b(a),j=b(i),E=b(r),T=b(o);exports.autoGeneratePrompt=function(e,n){return T.default.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(a){var i=a.chatAssistantName,r=a.organizationName,o=a.baseUrl,b=a.baseWebsocketUrl,R=a.setIsNewChatClicked;a.ThinkingBulbIconComponent;var M=a.isFormSaveClicked,A=a.setIsFormSavedClicked,I=a.onResetLearningData,D=a.sendMessageInChat,q=a.setSendMessageInChat,N=a.isFormValidating,F=a.chatTitle,L=a.customMetaData,W=a.headerMessageHandlers;a.aiResponse;var B=a.setAIResponse,P=a.onResetChat,z=a.initialChatMessage,O=void 0===z?"":z,H=a.onSave,U=a.chatSize,G=a.setChatSize,Z=a.movingTowards,K=a.setCitations,V=a.textareaPlaceholder,Q=void 0===V?"Tell me more about this learning...":V,J=a.setCurrentRequestId,$=a.showSavedMessage,X=void 0!==$&&$,Y=a.savedMessage,ee=a.isError,ne=void 0!==ee&&ee,te=a.errorMessage,se=void 0===te?"There was an error saving your changes.":te;a.isSaving;var ae=a.isHighlighted,ie=void 0!==ae&&ae,re=a.onStreamingStateChange,oe=a.onViewComparison;a.isCopyEnabled;var le=a.onComparisonLinkClick,ue=a.onSubmitFeedback,de=a.userDetails,ce=a.isGlobalEditActive,ve=a.socketTimeOutInMilliSeconds,he=a.initialDraftMessage,ge=void 0===he?"":he,me=a.onValidateSession,fe=a.onCloseSessionModal,pe=i,_e=t.useRef("".concat(pe,"-").concat(r,"-").concat(l.v4())),Ce=t.useRef("".concat(l.v4())),xe=o,ye=t.useRef(null),Se=t.useRef(!0),be=t.useRef(null),we=t.useRef(null),ke=t.useState(ge),je=ke[0],Ee=ke[1],Te=t.useState([]),Re=Te[0],Me=Te[1],Ae=t.useState(!1),Ie=Ae[0],De=Ae[1],qe=t.useState(!1);qe[0];var Ne=qe[1],Fe=t.useState(!0),Le=Fe[0],We=Fe[1],Be=t.useState(!0);Be[0];var Pe=Be[1],ze=t.useState("");ze[0];var Oe=ze[1],He=t.useState(""),Ue=He[0],Ge=He[1],Ze=t.useState(!1),Ke=Ze[0],Ve=Ze[1],Qe=t.useState(!1),Je=Qe[0],$e=Qe[1],Xe=t.useState(!0),Ye=Xe[0],en=Xe[1],nn=t.useState("100%");nn[0];var tn=nn[1],sn=t.useState(null),an=sn[0],rn=sn[1],on=t.useState(!1);on[0];var ln=on[1],un=t.useState(!1),dn=un[0],cn=un[1],vn=t.useRef(null),hn=t.useRef(new Set),gn=t.useState(null),mn=gn[0],fn=gn[1],pn=t.useState(!1),_n=pn[0],Cn=pn[1],xn=t.useState(!1);xn[0],xn[1];var yn=t.useState(null);yn[0],yn[1],t.useRef(null),t.useRef(null);var Sn=t.useRef(new Map),bn=t.useRef(""),wn=t.useRef(new Map),kn=t.useRef(!1),jn=t.useRef(0),En=t.useRef(null),Tn=t.useRef(null),Rn=t.useState(!1),Mn=Rn[0],An=Rn[1];s.keyframes(w||(w=e.__makeTemplateObject(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var In=t.useMemo(function(){return""===(null==je?void 0:je.trim())||Ke},[je,Ke]),Dn=t.useMemo(function(){return N},[N]),qn=t.useMemo(function(){var e;return Re.length>0&&"user"===(null===(e=Re[Re.length-1])||void 0===e?void 0:e.role)},[Re]),Nn=t.useMemo(function(){return In||N||!!ce||qn},[In,N,ce,qn]);t.useEffect(function(){ge&&!je&&(Ee(ge),$e(!0),setTimeout(function(){if(we.current){we.current.focus();var e=ge.length;we.current.setSelectionRange(e,e)}},400))},[ge]),t.useEffect(function(){null==re||re(Ke)},[Ke,re]),t.useEffect(function(){return function(){En.current&&clearTimeout(En.current)}},[]),t.useEffect(function(){var e=ye.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,s=e.clientHeight;en(t-n-s<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Re]);var Fn=C.useHeaderObserver({handlers:W,setResult:B}).processHeaderMessage;t.useEffect(function(){X&&cn(!0)},[X]),t.useEffect(function(){if(_n){var e=setTimeout(function(){Cn(!1)},3e3);return function(){return clearTimeout(e)}}},[_n]),t.useEffect(function(){M&&!ce&&(Gn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),A(!1))},[M]),t.useEffect(function(){if(D)try{if(D.startsWith("__SKELETON__:")){var n=D.split(":"),t=n[1],s=n.slice(2).join(":"),a={role:"user",content:"",id:t,time:new Date,isSkeleton:!0,skeletonContent:s};return Me(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[a],!1)}),Gn(new KeyboardEvent("keydown",{key:"Enter"}),!1,s,!1,t),fn(t),q&&q(""),void setTimeout(function(){fn(null)},2e3)}if(D.startsWith("__SKELETON_END__::")){var i=D.split("::")[1]||"";return Me(function(n){return n.map(function(n){return n.isSkeleton?e.__assign(e.__assign({},n),{isSkeleton:!1,content:n.skeletonContent||i}):n})}),void(q&&q(""))}var r=l.v4();Gn(new KeyboardEvent("keydown",{key:"Enter"}),!1,D,!1,r),fn(r),q&&q(""),setTimeout(function(){return fn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[D]),t.useEffect(function(){Wn(),Bn();var e=function(){var e,n=(null===(e=null==vn?void 0:vn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");tn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Ln=t.useCallback(function(e){var n="string"==typeof e?e:"smooth";be.current&&be.current.scrollIntoView({behavior:n,block:"end"}),Se.current&&setTimeout(function(){be.current&&Se.current&&be.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);t.useEffect(function(){if(!Ke){var n="";if(dn?n=Y||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(n=se||"I'm sorry, I couldn't save your changes. Please try again."),n){var t={role:"assistant",content:n,id:l.v4(),citations:[],time:new Date};Me(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[t],!1)}),cn(!1),setTimeout(function(){return Ln("smooth")},100)}}},[dn,ne,Ke,Y,se,Ln]),t.useEffect(function(){Se.current&&Ln("smooth")},[Ln]);var Wn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(xe,"/api/chatbot/getChatSettings?name=").concat(pe,"&organizationName=").concat(r),headers:{}};T.default.request(e).then(function(e){var n,t,s;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(s=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===s?void 0:s.chatInitialMessage)&&Pe(!0)}).catch(function(e){console.error(e)})},Bn=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){n="".concat(xe,"/api/chat/history?name=").concat(pe,"&organizationName=").concat(r);try{t={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0},T.default.get(n,t).then(function(e){var n=e.data;n.length>0?(Me(n),Ln()):Pe(!0)}).catch(function(e){console.error(e)})}catch(e){De(!1),console.error(e)}return[2]})})},Pn=function(){var e="".concat(xe,"/api/chat/resetHistory?name=").concat(pe,"&organizationName=").concat(r);try{var n={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0};T.default.get(e,n).then(function(){R(!0),Oe(""),rn(null),hn.current.clear(),wn.current.clear(),Ce.current="".concat(l.v4()),Me([]),Pe(!0),Tn.current=null,null==P||P(),I&&I()}).catch(function(e){console.error(e)}).finally(function(){_e.current="".concat(pe,"-").concat(r,"-").concat(l.v4())})}catch(e){De(!1),console.error(e)}};function zn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var On=function(n,t,s,a,i,r,o){var u,d,c,v,h,g,m,f,p,_,C,x,y,S,b,w,k,j,E,T,R,M,A,I,D,q,N,F,L,W;if(null===(d=null===(u=null==n?void 0:n.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var B={header_message:n.chatStream.continueChatResult.header_message,responsedata:null===(h=null===(v=null===(c=null==n?void 0:n.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===h?void 0:h.content};Fn(B)}var P=null===(g=null==n?void 0:n.chatStream)||void 0===g?void 0:g.continueChatResult,z=null==P?void 0:P.isEnd,O=(null===(m=null==P?void 0:P.message)||void 0===m?void 0:m.citations)||[];z&&O.length>0&&K&&K(O);var H={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(f=null==n?void 0:n.chatStream)||void 0===f?void 0:f.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))Ne(!0),H.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var s=e.substring(t+13);return null==s?void 0:s.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==n?void 0:n.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==H.content&&(De(!1),Me(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i,time:a,isFirstQuestionSent:r||!1,id:o||(null===(w=null===(b=null==n?void 0:n.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===w?void 0:w.requestId)||"",reply:""},H],!1)));else{Ne(!1);var U=null===(j=null===(k=null==n?void 0:n.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===j?void 0:j.requestId;"string"==typeof U&&U&&J&&J(U);var G=function(n,t,s,a){var i,r,o,u,d,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},g=(null===(i=null==n?void 0:n.chatStream)||void 0===i?void 0:i.continueChatResult)||{},m=null==g?void 0:g.requestId,f=null==g?void 0:g.preserve_message,p=null==g?void 0:g.isEnd,_=(null===(r=null==g?void 0:g.message)||void 0===r?void 0:r.content)||"",C=null==g?void 0:g.is_orchestrator,x=null==g?void 0:g.thinking_break,y=(null===(o=null==g?void 0:g.message)||void 0===o?void 0:o.citations)||[];if(m&&f&&_&&!p){var S=a.current.get(m)||[];S[S.length-1]!==_&&(S.push(_),a.current.set(m,S))}var b=(m&&a.current.get(m)||[]).join("\n\n"),w="";if(p)w=b&&""!==b.trim()?b:_;else if(f)w=b;else{var k=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),j=!1===C||x||0!==y.length?"":k;w=b?"".concat(b,"\n\n").concat(j):j}if(h.content=zn(w),!0===(null==g?void 0:g.thinking_break)&&!0===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)&&t.push({responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1}),!1===(null==g?void 0:g.thinking_break)&&!1===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)){if(g.explainability_id&&g.responded_by){var E=g.explainability_id,T=g.responded_by;s.has(E)||s.set(E,{responded_by:T,index:t.length})}s.has(g.explainability_id)?t[null==(R=s.get(g.explainability_id))?void 0:R.index]={responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!0,explainability_id:null!==(u=g.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:t=e.__spreadArray(e.__spreadArray([],t,!0),[{responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!0,explainability_id:null!==(d=g.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==g?void 0:g.thinking_break)&&!1===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)){var R;g.explainability_id&&g.responded_by&&(E=g.explainability_id,T=g.responded_by,s.has(E)||s.set(E,{responded_by:T,index:t.length})),s.has(g.explainability_id)?t[null==(R=s.get(g.explainability_id))?void 0:R.index]={responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1,explainability_id:null!==(c=g.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:t.push({responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1,explainability_id:null!==(v=g.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:t},h)}(n,s,t,wn);G.time=new Date,G.citations=O,G.isEnd=null===(T=null===(E=null==n?void 0:n.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===T?void 0:T.isEnd,G.requestId=null===(M=null===(R=null==n?void 0:n.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===M?void 0:M.requestId,G.sessionId=_e.current,null===(A=G.orchestratorAndAgentsMessages)||void 0===A||A.forEach(function(e){e&&e.header_message&&Fn(e)}),(""!==(null==G?void 0:G.content)||(null==G?void 0:G.orchestratorAndAgentsMessages)&&(null==G?void 0:G.orchestratorAndAgentsMessages.length)>0)&&(De(!1),Me(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i||"",time:a,isFirstQuestionSent:r||!1,id:o||(null===(D=null===(I=null==n?void 0:n.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===D?void 0:D.requestId)||"",requestId:null!==(F=null===(N=null===(q=null==n?void 0:n.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===N?void 0:N.requestId)&&void 0!==F?F:""},G],!1))),We(null===(W=null===(L=null==n?void 0:n.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Hn=t.useCallback(function(n){void 0===n&&(n="inactivity"),console.error("Stream failed or timed out due to: ".concat(n)),kn.current=!1,We(!0),Ve(!1),ln(!1),De(!1),Ne(!1),bn.current&&b&&(u.stopStreaming(bn.current,b,!1),wn.current.delete(bn.current)),Me(function(t){var s=e.__spreadArray([],t,!0).reverse().find(function(e){return"user"===e.role}),a=((null==s?void 0:s.content)||"").replace(/"/g,"&quot;"),i=e.__spreadArray([],t,!0),r=i[i.length-1];r&&"assistant"===r.role&&!r.isEnd&&i.pop();var o="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===n?o="Something went wrong—teaching is taking longer than expected.":"websocket_error"===n&&(o="I lost connection to the server while working on that."),e.__spreadArray(e.__spreadArray([],i,!0),[{role:"assistant",content:"".concat(o,' Please try again.\n\n<button class="clickable-button" data-value="').concat(a,'">Retry</button>'),id:l.v4(),time:new Date,isEnd:!0,citations:[]}],!1)})},[ve,b]),Un=t.useCallback(function(){En.current&&(clearTimeout(En.current),En.current=null),ve&&ve>0&&(En.current=setTimeout(function(){return Hn("inactivity")},ve))},[Hn,ve]),Gn=function(n,t,s,a,i,o){return e.__awaiter(void 0,void 0,void 0,function(){var a,d,c,v,h,g,m,f,p,_,C,x,y,S,w;return e.__generator(this,function(k){switch(k.label){case 0:if(a=(void 0!==s?s:je||"").trim(),(d="Enter"===(null==n?void 0:n.key)&&!(null==n?void 0:n.shiftKey)&&!ce)&&(null===(_=null==n?void 0:n.preventDefault)||void 0===_||_.call(n)),c="user"===(null===(C=Re[Re.length-1])||void 0===C?void 0:C.role),!a||Ke||kn.current||c||(null==n?void 0:n.key)&&!d)return[2];if(Tn.current||(Tn.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Tn.current))),!me)return[3,5];De(!0),Ge("Validating session..."),k.label=1;case 1:return k.trys.push([1,3,,4]),[4,me(Tn.current)];case 2:return k.sent()?[3,4]:(An(!0),De(!1),o&&o(!1),[2]);case 3:return v=k.sent(),console.error("Validation error:",v),An(!0),De(!1),o&&o(!1),[2];case 4:De(!1),k.label=5;case 5:return kn.current=!0,"I want to add a rule description"===a?(We(!1),Se.current=!0,Ve(!0),!an&&a&&rn(s||"manual_entry"),h=new Date,Me(function(n){return e.__spreadArray(e.__spreadArray([],n.map(function(n,t){var s;return e.__assign(e.__assign({},n),{content:null===(s=zn(n.content))||void 0===s?void 0:s.replace("WaitMessage: ","")})}),!0),[{role:"user",content:a,time:h,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Ln("smooth"),setTimeout(function(){Me(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),Ln("smooth"),setTimeout(function(){Ve(!1),We(!0)},500)},500),[2]):(We(!1),Se.current=!0,Ve(!0),!an&&a&&rn(s||"manual_entry"),g=new Date,Me(function(n){var t=n.map(function(n){var t;return e.__assign(e.__assign({},n),{content:null===(t=zn(n.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return i&&t.some(function(e){return e.id===i})?t.map(function(n){return n.id===i?e.__assign(e.__assign({},n),{content:a}):n}):e.__spreadArray(e.__spreadArray([],t,!0),[{role:"user",content:a,time:g,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Ln("smooth"),m=new Map,f=[],p={WEBSOCKET_URL:b,organizationName:r,chatAssistantName:pe,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(x=null==de?void 0:de.name)&&void 0!==x?x:"Guest User",userEmailId:null!==(y=null==de?void 0:de.email)&&void 0!==y?y:"guestUser@example.com",userId:null!==(S=null==de?void 0:de.id)&&void 0!==S?S:"Guest User",query:a,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:_e.current,chatPreviewId:Ce.current,customMetaData:L,aiModel:"",enableLogs:!0,onStreamEvent:function(e){var n,s,r,o,l,u,d=null===(s=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===s?void 0:s.requestId,c=null===(o=null===(r=null==e?void 0:e.chatStream)||void 0===r?void 0:r.continueChatResult)||void 0===o?void 0:o.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(c)),Un();var v=null===(u=null===(l=null==e?void 0:e.chatStream)||void 0===l?void 0:l.continueChatResult)||void 0===u?void 0:u.error_state;if(Array.isArray(v)&&v.length>0)return console.error("Agent returned an error_state during stream:",v),void Hn("agent_error");On(e,m,f,g,a,t,i)},onStreamEnd:function(n){var t,s,a=null===(s=null===(t=null==n?void 0:n.chatStream)||void 0===t?void 0:t.continueChatResult)||void 0===s?void 0:s.requestId;console.log("✅ [Stream Completed] RequestID: ".concat(a)),En.current&&clearTimeout(En.current),kn.current=!1,We(!0),Ve(!1),ln(!1);var i=Date.now(),r=Sn.current.get(bn.current);if(r){var o=Math.round((i-r)/1e3).toFixed(1);Me(function(n){var t=e.__spreadArray([],n,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===t)return n;var s=n.length-1-t;return n.map(function(n,t){return t===s?e.__assign(e.__assign({},n),{finalTimeTaken:o}):n})})}},onError:function(e){En.current&&clearTimeout(En.current),console.error("Stream error:",e),Hn("websocket_error")}},a&&(De(!0),null===(w=we.current)||void 0===w||w.blur(),Ee(""),Ln(),Ge(i?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Sn.current.set(p.requestId,Date.now()),bn.current=p.requestId,Un(),jn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(jn.current,") | RequestID: ").concat(p.requestId,' | Query: "').concat(a,'"')),u.startChatStream(p)),o&&o(!1),[2])}})})},Zn=t.useRef(null);t.useLayoutEffect(function(){Zn.current=Gn});var Kn=t.useCallback(function(){for(var n,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return null===(n=Zn.current)||void 0===n?void 0:n.call.apply(n,e.__spreadArray([Zn],t,!1))},[]),Vn=t.useMemo(function(){return{p:function(t){t.node;var s=t.children;return e.__rest(t,["node","children"]),n.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:s}))},button:function(t){t.node;var s=t.className,a=t.children,i=e.__rest(t,["node","className","children"]),r=C.extractTextFromChildren(a),o=i["data-value"],l=an===r||an===o,u=!!an||!!ce,d="Tester Genie"===r;return n.jsx(g.ActionableButton,e.__assign({},i,{className:s,handleStream:Kn,isStreamEnd:Le,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":an?"false":void 0},{children:n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[a,d&&n.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),n.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),n.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),n.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),n.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Kn,Le,an,ce]),Qn=t.useMemo(function(){return Re.some(function(e){return e.isSkeleton})},[Re]),Jn=function(n){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(t){switch(t.label){case 0:return ue?[4,ue(n)]:[3,2];case 1:t.sent(),Me(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Ln("smooth")},100),t.label=2;case 2:return[2]}})})};return n.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(f.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!Qn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[n.jsxs("div",e.__assign({ref:ye,className:f.default.scrollWrapper},{children:[n.jsx("div",e.__assign({ref:vn,className:f.default.stickyHeader},{children:n.jsx(c.default,{resetChatHistory:Pn,isStreamEnd:Le,chatTitle:F,onResize:G,chatSize:U,movingTowards:Z})})),n.jsxs("div",e.__assign({className:f.default.messagesList},{children:[n.jsxs("div",e.__assign({className:f.default.initialMessageRow},{children:[n.jsx("div",e.__assign({className:f.default.iconWrapper},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:f.default.welcomeTextWrapper},{children:n.jsx("div",e.__assign({className:f.default.welcomeMarkdownWrapper},{children:n.jsx("span",{children:n.jsx(j.default,e.__assign({rehypePlugins:[E.default],components:Vn},{children:O}))})}))}))]})),Re.length>0&&Re.map(function(t,s){var a,i;return n.jsxs("div",e.__assign({className:f.default.messageRow},{children:["assistant"===t.role?n.jsx("div",e.__assign({className:f.default.assistantIconContainer},{children:n.jsx(y.default,{})})):n.jsx("div",{className:f.default.userSpacer}),n.jsx("div",e.__assign({className:f.default.messageContent},{children:"assistant"===t.role?n.jsxs(n.Fragment,{children:[t.orchestratorAndAgentsMessages&&t.orchestratorAndAgentsMessages.length>0&&n.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==t?void 0:t.orchestratorAndAgentsMessages,isStreamEnd:Le,finalTimeTaken:null==t?void 0:t.finalTimeTaken},null!==(a=null==t?void 0:t.finalTimeTaken)&&void 0!==a?a:null==t?void 0:t.id),n.jsx(v.default,{index:s,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:Re,handleStream:Gn,isLastMessage:s===Re.length-1,onSave:H,citations:null==t?void 0:t.citations,setChatSize:G,chatSize:U,isStreamEnd:Le,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onTypeResponseClick:function(){var e;Cn(!0),null===(e=we.current)||void 0===e||e.focus()},onComparisonLinkClick:le,baseURL:xe,onFeedbackSubmit:Jn,isGlobalEditActive:ce}),t.hasOwnProperty("isEnd")&&!(null==t?void 0:t.isEnd)&&(null===(i=null==t?void 0:t.content)||void 0===i?void 0:i.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx(h.Skeleton,{variant:"text",width:"50%",height:20}),n.jsx("div",{style:{marginTop:"10px"}}),n.jsx(h.Skeleton,{variant:"text",width:"100%",height:40})]}),n.jsx("div",e.__assign({className:f.default.timestamp},{children:t.time&&!isNaN(new Date(t.time).getTime())?new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):n.jsxs("div",e.__assign({className:f.default.userMessageWrapper},{children:[n.jsxs("div",e.__assign({className:f.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:t.isSkeleton||Qn||t.id!==mn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[t.isSkeleton?n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[n.jsx(h.Skeleton,{variant:"text",width:"100%",height:16}),n.jsx(h.Skeleton,{variant:"text",width:"80%",height:16})]})):n.jsx(v.default,{index:s,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:Re,handleStream:Gn,isLastMessage:s===Re.length-1,onSave:H,citations:null==t?void 0:t.citations,isStreamEnd:Le,isGlobalEditActive:ce,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onComparisonLinkClick:le,baseURL:xe,onFeedbackSubmit:Jn}),n.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:n.jsx(S.UserIcon,{})}))]})),n.jsx("div",e.__assign({className:f.default.userTimestamp},{children:new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),t.id)}),Ie&&n.jsxs("div",e.__assign({className:f.default.loadingRow},{children:[n.jsx("div",e.__assign({className:f.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:f.default.loadingTextWrapper},{children:n.jsx("span",{children:Ue})}))]})),n.jsx("div",{ref:be,style:{float:"left",clear:"both"}})]}))]})),n.jsx("div",e.__assign({className:f.default.inputAreaWrapper},{children:n.jsx(k.default,e.__assign({title:N?"Please wait for the validation to be completed.":""},{children:n.jsxs("div",e.__assign({className:"".concat(f.default.inputBoxContainer," ").concat(Dn?f.default.disabled:""),style:_n?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Re.length>0&&!Ye&&n.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Ln("smooth")},className:f.default.scrollToBottomBtn},{children:n.jsx(_.ScrollToBottom,{})})),n.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[n.jsx("textarea",{ref:we,placeholder:Q,value:je||"",onChange:function(e){Ee(e.target.value)},onFocus:function(){return $e(!0)},onBlur:function(){return $e(!1)},onKeyDown:function(e){return Gn(e)},disabled:Dn,className:"no-scrollbar ".concat(f.default.chatTextarea),style:{minHeight:Je||je&&je.length>40?"120px":"50px",height:Je||je&&je.length>40?"120px":"50px",maxHeight:"120px"}}),n.jsx("span",e.__assign({className:f.default.sendButtonWrapper},{children:n.jsx("button",e.__assign({onClick:function(e){Nn||Gn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Nn,className:"".concat(f.default.sendButton," ").concat(Nn?f.default.disabled:f.default.active)},{children:n.jsx(x.SendButton,{})}))}))]}))]}))}))})),n.jsxs("div",e.__assign({className:f.default.footerTools},{children:[n.jsx(k.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:f.default.footerToolItem},{children:n.jsx(m.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n.jsx(k.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:f.default.footerToolItem},{children:n.jsx(m.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),n.jsx(s.Dialog,e.__assign({open:Mn,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:n.jsxs(s.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"10px"}},{children:"Session Expired"})),n.jsx("p",e.__assign({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),n.jsxs(s.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n.jsx("button",e.__assign({onClick:function(){An(!1),Pn()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Reset Session"})),n.jsx("button",e.__assign({onClick:function(){An(!1),null==fe||fe()},style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Discard & Close"}))]}))]}))}))]}))};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),r=require("@mui/material"),s=require("lucide-react"),t=require("@viswa-test/test-citation"),o=function(n){var s=n.data,t=n.isSelected,o=n.onClick;return i.jsxs(r.Box,e.__assign({id:"variant-card-".concat(s.id),onClick:o,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:t?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:s.isLoading?.7:1,border:t?"1.4px solid #2563EB":"1.4px solid transparent",boxShadow:t?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:t?"#2563EB":"#CBD5E1",boxShadow:t?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[i.jsx(r.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:s.isLoading?i.jsx(r.Skeleton,{variant:"rounded",width:80,height:20}):i.jsx(r.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1",textTransform:"capitalize"}},{children:s.similarityScoreText||"0% Similarity"}))})),i.jsx(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:i.jsxs(r.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[s.isLoading?i.jsx(r.Skeleton,{width:"90%"}):i.jsx(r.Typography,e.__assign({title:s.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:s.title})),s.scope&&i.jsx(r.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:s.scope}))]}))}))]}))};exports.default=function(a){var l=a.variants,x=void 0===l?[]:l,c=a.onSelectVariant,d=a.onSkip,g=a.onBack,p=a.targetVariantId,f=n.useState(p||null),h=f[0],u=f[1],_=n.useRef(null);n.useEffect(function(){p&&u(p)},[p]);var m=function(e){_.current&&_.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},b=n.useMemo(function(){if(h){var e=String(h).trim();return x.find(function(i){return i.id&&String(i.id).trim()===e})||x[0]}return x.length>0?x[0]:null},[h,x]);n.useEffect(function(){if(h&&_.current){var e=h.trim();setTimeout(function(){var i=document.getElementById("variant-card-".concat(e)),n=_.current;if(i&&n){var r=i.offsetLeft-n.offsetLeft-n.clientWidth/2+i.clientWidth/2;n.scrollTo({left:r,behavior:"smooth"})}},150)}},[h,x]);n.useEffect(function(){!h&&!p&&x.length>0&&!x[0].isLoading&&u(x[0].id)},[x,h,p]);var y=n.useState(!1),F=y[0],v=y[1],j=n.useState(!1),B=j[0],w=j[1];n.useEffect(function(){var e=_.current;if(e){var i=function(){v(e.scrollLeft>0),w(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return i(),e.addEventListener("scroll",i),window.addEventListener("resize",i),function(){e.removeEventListener("scroll",i),window.removeEventListener("resize",i)}}},[x]);var S=(null==b?void 0:b.intentTreeData)||null,E=(null==b?void 0:b.behaviorTreeData)||null;return i.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#FFFFFF",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[i.jsxs(r.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF"}},{children:[i.jsxs(r.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[i.jsx(r.IconButton,e.__assign({onClick:g,size:"small"},{children:i.jsx(s.ArrowLeft,{})})),i.jsx(r.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),i.jsx(r.IconButton,e.__assign({onClick:d,size:"small"},{children:i.jsx(r.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),i.jsx(r.Box,e.__assign({sx:{bgcolor:"#F6F7F9B2"}},{children:x.length>1&&i.jsxs(r.Box,e.__assign({sx:{pb:2}},{children:[i.jsxs(r.Box,e.__assign({sx:{px:3,display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[i.jsx(r.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),i.jsxs(r.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[i.jsx(r.IconButton,e.__assign({onClick:function(){return m("left")},size:"small",disabled:!F},{children:i.jsx(s.ArrowLeft,{size:18})})),i.jsx(r.IconButton,e.__assign({onClick:function(){return m("right")},size:"small",disabled:!B},{children:i.jsx(s.ArrowRight,{size:18})}))]}))]})),i.jsx(r.Box,e.__assign({ref:_,sx:{display:"flex",gap:1,overflowX:"auto",px:3,"&::-webkit-scrollbar":{display:"none"}}},{children:x.map(function(e){return i.jsx(o,{data:e,isSelected:(null==b?void 0:b.id)===e.id,onClick:function(){return u((i=e).id),void c(i);var i}},e.id)})}))]}))})),i.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:3,margin:3,overflowY:"auto",backgroundColor:"#fff","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"}}},{children:[S&&i.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:[i.jsxs(r.Box,e.__assign({sx:{px:3,py:1.5,bgcolor:"#F8F9FB",borderBottom:"1px solid #E2E8F0",textAlign:"center"}},{children:[i.jsx(r.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#0F172A",mb:.5}},{children:"Is the learning's intent matching?"})),i.jsx(r.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"Checking if the learning you are creating is same as the existing learning."}))]})),i.jsx(t.CognitiveCompare,{treeData:S,componentHeaderText:"Is the learning's intent matching?",displayConfig:{isHeaderVisible:!1,isToggleVisible:!1,maintainRelativeOrder:!1}})]})),E&&i.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:[i.jsxs(r.Box,e.__assign({sx:{px:3,py:1.5,bgcolor:"#F8F9FB",borderBottom:"1px solid #E2E8F0",textAlign:"center"}},{children:[i.jsx(r.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#0F172A",mb:.5}},{children:"Is the learning behavior matching?"})),i.jsx(r.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"Checking if the variant you are trying to add is similar, overlapping or conflicting with the existing variant."}))]})),i.jsx(t.CognitiveCompare,{treeData:E,componentHeaderText:"Is the learning behavior matching?",displayConfig:{isHeaderVisible:!1,isToggleVisible:!1,maintainRelativeOrder:!1}})]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../_svg/SparkleIcon.js"),s=require("@e-llm-studio/citation"),l=require("../../_svg/ButtonCognitiveIcon.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},d=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},p=a(t).default.forwardRef(function(t,r){var o=t.label,s=t.content,l=t.highlights,a=void 0===l?[]:l,c=t.styleVariant,d=t.isHighlighted,p=void 0!==d&&d,x=Array.isArray(s)?s.join("\n"):s||"",g="#B91C1C"===c.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===c.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return n.jsxs(i.Box,e.__assign({sx:{mb:1.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),n.jsx(i.Box,e.__assign({ref:r,sx:{p:"4px 12px",borderRadius:"6px",border:p?"1.5px solid ".concat(g.borderColor):"1px solid ".concat(c.border),boxShadow:p?"0px 0px 0px 2px ".concat(g.shadow):"none",bgcolor:c.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:n.jsx(i.Box,{children:function(){if(!x)return n.jsx(i.Typography,e.__assign({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!a||0===a.length)return x;var t=a.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===t.length)return x;var r=new RegExp("(".concat(t.join("|"),")"),"gi");return x.split(r).map(function(t,r){return a.some(function(e){return e&&e.toLowerCase()===t.toLowerCase()})?n.jsx(i.Box,e.__assign({component:"span",sx:{bgcolor:c.highlightBg,borderRadius:"2px",px:"2px"}},{children:t}),r):t})}()})}))]}))}),x=function(t){var r=t.data,o=t.isSelected,s=t.isCognitiveOpen,a=t.onToggleCognitive,c=t.onClick,d=r.summaryText||r.description||"",p=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),x=p?d.replace(p[0],"").trim():d,g=!!p;return n.jsxs(i.Box,e.__assign({id:"variant-card-".concat(r.id),onClick:c,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:r.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:r.isLoading?n.jsx(i.Skeleton,{variant:"rounded",width:80,height:20}):n.jsxs(i.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==r.similarity?r.similarity:0,"% Similarity"]}))})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[n.jsx(i.Typography,e.__assign({title:r.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:r.title})),r.scope&&n.jsx(i.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:r.scope}))]})),r.isLoading?n.jsxs(i.Box,{children:[n.jsx(i.Skeleton,{width:"90%"}),n.jsx(i.Skeleton,{width:"60%"})]}):n.jsxs(i.Box,e.__assign({title:x,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:x})),g&&n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),o||c(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:n.jsx("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))};exports.default=function(a){var g,h,u=a.proposedRule,f=a.variants,_=void 0===f?[]:f,y=a.onSelectVariant;a.onAddAsVariant;var b=a.onSkip,m=a.onBack,v=a.targetVariantId,w=a.highlightedField,F=t.useState(v||null),B=F[0],j=F[1],C=t.useState(!1),E=C[0],S=C[1],k=t.useState(null),A=k[0],R=k[1],T=t.useRef(null),L=t.useRef(null);t.useEffect(function(){if(v&&j(v),R(null!=w?w:null),w){var e=setTimeout(function(){return R(null)},6e3);return function(){return clearTimeout(e)}}},[v,w]);var D=function(e){T.current&&T.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},I=t.useMemo(function(){return e.__spreadArray([],_,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[_]),W=t.useMemo(function(){if(B){var e=String(B).trim();return _.find(function(n){return n.id&&String(n.id).trim()===e})||I[0]}return I.length>0?I[0]:null},[B,_,I]);t.useEffect(function(){if(B&&T.current){var e=B.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=T.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[B,I]);var z=W||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},H=null==W?void 0:W.analysis,M=(null===(h=null===(g=null==H?void 0:H.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===h?void 0:h.overall_summary)||"",O=M.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),q=!!O,V=O?O[1]:"",N=c("reason",V)||"",P=c("gap",V)||"",U=c("relevance_score",V)||"",Y=t.useMemo(function(){return{ul:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("ol",e.__assign({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(t){var i=t.href,r=t.children,o=e.__rest(t,["href","children"]);if(!i)return n.jsx("a",e.__assign({},o,{children:r}));var s=i||"";try{s=decodeURIComponent(i)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var l="",a="",c=s.match(/variant_id=([^?&]+)/);c&&(l=c[1]);var d=s.match(/field_name=([^&]+)/);return d&&(a=d[1]),n.jsxs("button",e.__assign({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),j(l),R(a),setTimeout(function(){return R(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[r,n.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return n.jsx("a",e.__assign({href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},o,{children:r}))}}},[]);t.useEffect(function(){!B&&!v&&I.length>0&&!I[0].isLoading&&j(I[0].id)},[I,B,v]);var $=t.useRef(null),J=t.useState([]),X=J[0],G=J[1],K=t.useState(!1),Q=K[0],Z=K[1],ee=t.useState(!1),ne=ee[0],te=ee[1];t.useEffect(function(){var e=T.current;if(e){var n=function(){Z(e.scrollLeft>0),te(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[I]);var ie={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)},re={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)};t.useEffect(function(){if(A){var e="when_to_apply"===A?"wta":"when_not_to_apply"===A?"wnta":A,n=ie[e]||re[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[A]);var oe=function(e){var n,t,i,r,o,s=null===(n=null==H?void 0:H.rule_difference_comparison)||void 0===n?void 0:n.fields,l="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,a=!(!u[l]&&!z[l]);if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var c=s[e];if(c.mappings){var d=c.mappings[0]||{};return{score:c.score,relation:d.relation||"",highlightsA:(null===(t=d.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=d.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:a}}return{score:c.score,relation:c.relation||"",highlightsA:(null===(r=c.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=c.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:a}},se=["title","scope","description","when_to_apply","when_not_to_apply"],le=function(){if($.current){var e=$.current.getBoundingClientRect(),n=[];se.forEach(function(t){var i="when_to_apply"===t?ie.wta:"when_not_to_apply"===t?ie.wnta:ie[t],r="when_to_apply"===t?re.wta:"when_not_to_apply"===t?re.wnta:re[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),s=r.current.getBoundingClientRect(),l=Math.max(o.height,s.height);i.current.style.height="".concat(l,"px"),r.current.style.height="".concat(l,"px");var a=i.current.getBoundingClientRect(),c=r.current.getBoundingClientRect(),p=oe(t),x=d(p.score,p.relation,p.hasContent),g=a.top+a.height/2-e.top;n.push({x1:a.right-e.left,y1:g,x2:c.left-e.left,y2:g,style:x})}}),G(n)}};return t.useEffect(function(){var e=setTimeout(le,250);window.addEventListener("resize",le);var n=null;return $.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){le()})})).observe($.current),function(){clearTimeout(e),window.removeEventListener("resize",le),n&&n.disconnect()}},[u,z,H,E]),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:m,size:"small"},{children:n.jsx(r.ArrowLeft,{})})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),n.jsx(i.IconButton,e.__assign({onClick:b,size:"small"},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),I.length>1&&n.jsxs(i.Box,e.__assign({sx:{px:3,pb:.25}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:function(){return D("left")},size:"small",disabled:!Q},{children:n.jsx(r.ArrowLeft,{size:18})})),n.jsx(i.IconButton,e.__assign({onClick:function(){return D("right")},size:"small",disabled:!ne},{children:n.jsx(r.ArrowRight,{size:18})}))]}))]})),n.jsx(i.Box,e.__assign({ref:T,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:I.map(function(e){return n.jsx(x,{data:e,isSelected:(null==W?void 0:W.id)===e.id,isCognitiveOpen:E,onToggleCognitive:function(){S(function(e){var n=!e;return n&&L.current&&L.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return j((n=e).id),y(n),void S(!1);var n}},e.id)})}))]})),n.jsx(i.Box,e.__assign({ref:L,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:M&&q&&E?"none":"1.5px solid #EEF0F4"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[M&&q&&E&&n.jsx(i.Box,e.__assign({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:n.jsx(s.CognitiveDecisioningCard,{headerIcon:n.jsx(l.ButtonCognitiveIcon,{}),reasoning:N,gap:P,score:U,mdComponents:Y,isOpen:!0,onToggle:function(){return S(!1)}})})),n.jsxs(i.Box,e.__assign({ref:$,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:X.map(function(t,r){var o=(t.x1+t.x2)/2,s=t.y1;return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder,strokeWidth:"1"}),n.jsx("foreignObject",e.__assign({x:o-125,y:s-16,width:"250",height:"32"},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:t.style.label}))}))}))]},r)})})),n.jsxs(i.Box,e.__assign({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?ie.wta:"when_not_to_apply"===e?ie.wnta:ie[e],o=u["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsA,styleVariant:i,isHighlighted:A===e},"left-".concat(e))})}))]})),n.jsx(i.Box,{sx:{width:"1px"}}),n.jsxs(i.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:n.jsxs(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[n.jsx("div",e.__assign({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.jsx(o.default,{})})),"Existing Learning"]}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?re.wta:"when_not_to_apply"===e?re.wnta:re[e],o=z["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsB,styleVariant:i,isHighlighted:A===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};
2
2
  //# sourceMappingURL=RuleComparison.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{Dialog as t,DialogContent as i,Box as a}from"@mui/material";import s,{useState as r,useEffect as l,useCallback as d}from"react";import c from"./_components/ChatComponents/ChatComponent.js";import u from"./_components/ILPopup.js";import m from"./_components/VariantLoadingOverlay.js";import h from"./_components/templates/RuleComparison/RuleComparison.js";import g from"./_components/templates/RuleComparison/AgentComposerRuleComparison.js";import p from"./_components/ChatComponents/NormalChat.js";var f=function(f){var C=f.open,v=f.chatAssistantName,S=f.organizationName,x=f.baseUrl,b=f.baseWebsocketUrl,k=f.closeFunction,w=f.ThinkingBulbIconComponent,M=f.customSections,y=f.customMetaData,I=f.chatTitle,R=void 0===I?"Instant Learning On-The-Job":I,T=f.formTitle,F=void 0===T?"Instant Learning On-The-Job Form":T,A=f.onSave,V=f.headerMessageHandlers,L=f.aiResponse,D=f.setAIResponse,W=f.width,E=void 0===W?"90vw":W,B=f.height,P=void 0===B?"90vh":B,z=f.sendMessageInChat,O=void 0===z?"":z,N=f.setSendMessageInChat,j=f.validateCustom,U=f.onResetChat,J=f.template,_=f.templateProps,q=f.initialChatMessage,H=f.setCitations,G=f.isLoading,X=void 0!==G&&G,Y=f.isLocked,K=void 0!==Y&&Y,Q=f.saveButtonConfig,Z=void 0===Q?{label:"Save Learning",loadingLabel:"Saving Learning..."}:Q,$=f.saveButtonColor,ee=f.saveWithoutValBtnConfig,ne=void 0===ee?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:ee,oe=f.textareaPlaceholder,te=f.setCurrentRequestId,ie=f.showSavedMessage,ae=void 0!==ie&&ie,se=f.savedMessage,re=void 0===se?"Thank you teacher for teaching me, your learning has been saved successfully.":se,le=f.isError,de=void 0!==le&&le,ce=f.errorMessage,ue=void 0===ce?"I'm sorry, I couldn't save your changes. Please try again.":ce,me=f.isSaving,he=void 0!==me&&me,ge=f.isAiStreaming,pe=f.setIsAiStreaming,fe=f.showConfirmReset,Ce=void 0!==fe&&fe,ve=f.setShowConfirmReset,Se=f.confirmReset,xe=f.isLoadingVariants,be=f.isFormDirty,ke=f.onResetRequest,we=f.mainText,Me=void 0===we?"Adding a variant":we,ye=f.subText,Ie=void 0===ye?"This may take a moment as we update the learning with the new variant.":ye,Re=f.showComparison,Te=void 0!==Re&&Re,Fe=f.setShowComparison,Ae=f.showAgentComposerRuleComparison,Ve=void 0!==Ae&&Ae,Le=f.setShowAgentComposerRuleComparison,De=f.isFetchingComparison,We=f.handleOpenComparison,Ee=f.proposedRule,Be=f.variants,Pe=f.onAddAsVariant,ze=f.isCopyEnabled,Oe=f.showSaveWithoutValidation,Ne=void 0!==Oe&&Oe,je=f.onSaveWithoutValidation,Ue=f.onComparisonLinkClick,Je=f.targetComparisonVariantId,_e=f.highlightedComparisonField,qe=f.onSubmitFeedback,He=f.isUseNormalChat,Ge=void 0!==He&&He,Xe=f.userDetails,Ye=f.handleGlobalClickCapture,Ke=f.isGlobalEditActive,Qe=f.socketTimeOutInMilliSeconds,Ze=f.initialDraftMessage,$e=r(C),en=$e[0],nn=$e[1],on=r(!1);on[0];var tn=on[1],an=r(!1),sn=an[0],rn=an[1],ln=r(!1),dn=ln[0];ln[1];var cn=r(45),un=cn[0],mn=cn[1],hn=r("right"),gn=hn[0],pn=hn[1],fn=s.useRef(gn),Cn=r(!1),vn=Cn[0],Sn=Cn[1],xn=r(0),bn=xn[0],kn=xn[1],wn=r(40),Mn=wn[0],yn=wn[1];l(function(){fn.current=gn},[gn]),l(function(){nn(C)},[C]);var In=d(function(e){e.preventDefault(),Sn(!0),kn(e.clientX),yn(un)},[un]),Rn=d(function(e){if(vn){var n=document.querySelector("[data-dialog-content]");if(n){var o=n.getBoundingClientRect(),t=(e.clientX-bn)/o.width*100,i=Math.max(20,Math.min(80,Mn+t));mn(i),i>Mn&&pn("right"),i<Mn&&pn("left")}}},[vn,bn,Mn]),Tn=d(function(){Sn(!1)},[]);l(function(){if(vn)return document.addEventListener("mousemove",Rn),document.addEventListener("mouseup",Tn),function(){document.removeEventListener("mousemove",Rn),document.removeEventListener("mouseup",Tn)}},[vn,Rn,Tn]);var Fn=function(e,n){K&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==be?void 0:be())?(nn(!1),k()):null==ke||ke())},An=d(function(e){mn(function(n){var o;if("number"==typeof e)return e>n&&pn("right"),e<n&&pn("left"),e;var t=fn.current,i=null!==(o={20:30,30:"left"===t?20:50,50:"left"===t?30:75,75:"left"===t?50:100,100:75}[n])&&void 0!==o?o:40;return 100===i&&pn("left"),20===i&&pn("right"),i})},[]),Vn=d(function(){We&&(An(30),We())},[An,We]);return n(t,e({open:en,onClose:Fn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:E,height:P,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:o(i,e({"data-dialog-content":!0,onClickCapture:Ye,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n(a,e({sx:{width:"".concat(un,"%"),maxWidth:"".concat(un,"%"),transition:vn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===un?"none":"flex",flexDirection:"column"}},{children:Ge?n(p,{chatAssistantName:v,organizationName:S,baseUrl:x,baseWebsocketUrl:b,setIsNewChatClicked:tn,ThinkingBulbIconComponent:w,isFormSaveClicked:sn,setIsFormSavedClicked:rn,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:dn,chatTitle:R,customMetaData:y,headerMessageHandlers:V,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:un,movingTowards:gn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ue,isSaving:he,onStreamingStateChange:pe,onViewComparison:Vn,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe}):n(c,{chatAssistantName:v,organizationName:S,baseUrl:x,baseWebsocketUrl:b,setIsNewChatClicked:tn,ThinkingBulbIconComponent:w,isFormSaveClicked:sn,setIsFormSavedClicked:rn,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:dn,chatTitle:R,customMetaData:y,headerMessageHandlers:V,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:un,movingTowards:gn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ue,isSaving:he,onStreamingStateChange:pe,onViewComparison:Vn,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe,userDetails:Xe,isGlobalEditActive:Ke,socketTimeOutInMilliSeconds:Qe,initialDraftMessage:Ze})})),n(a,{sx:{width:"2px",cursor:"col-resize",backgroundColor:vn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:In}),o(a,e({sx:{width:"".concat(100-un,"%"),maxWidth:"".concat(100-un,"%"),transition:vn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===un?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n(m,{isLoading:De||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n(m,{isLoading:xe||!1,mainText:Me,subText:Ie}),Ve?n(g,{proposedRule:Ee,variants:Be,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Pe||Pe(),An(40),null==Le||Le(!1)},onSkip:function(){An(40),null==Le||Le(!1)},onBack:function(){An(40),null==Le||Le(!1)},targetVariantId:Je,highlightedField:_e}):Te?n(h,{variants:Be,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Pe||Pe(),An(40),null==Fe||Fe(!1)},onSkip:function(){An(40),null==Fe||Fe(!1)},onBack:function(){An(40),null==Fe||Fe(!1)},targetVariantId:Je}):n(u,{setIsFormSavedClicked:rn,customSections:M,onSave:A,formHeader:F,onClose:function(){return Fn(0,"manualClose")},validateCustom:j,template:J,templateProps:_,isLoading:X,isAiStreaming:ge,saveButtonConfig:Z,saveButtonColor:$,showSaveWithoutValidation:Ne,saveWithoutValBtnConfig:ne,onSaveWithoutValidation:je}),n(t,e({open:Ce,onClose:function(){return null==ve?void 0:ve(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:o(a,e({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n("h3",e({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n("p",e({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),o(a,e({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n("button",e({onClick:function(){return null==ve?void 0:ve(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n("button",e({onClick:Se,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};export{f as default};
1
+ import{__assign as e}from"tslib";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{Dialog as t,DialogContent as i,Box as a}from"@mui/material";import s,{useState as r,useEffect as l,useCallback as d}from"react";import u from"./_components/ChatComponents/ChatComponent.js";import c from"./_components/ILPopup.js";import m from"./_components/VariantLoadingOverlay.js";import h from"./_components/templates/RuleComparison/RuleComparison.js";import g from"./_components/templates/RuleComparison/AgentComposerRuleComparison.js";import p from"./_components/ChatComponents/NormalChat.js";var f=function(f){var C=f.open,v=f.chatAssistantName,S=f.organizationName,x=f.baseUrl,b=f.baseWebsocketUrl,k=f.closeFunction,w=f.ThinkingBulbIconComponent,M=f.customSections,y=f.customMetaData,R=f.chatTitle,I=void 0===R?"Instant Learning On-The-Job":R,F=f.formTitle,T=void 0===F?"Instant Learning On-The-Job Form":F,V=f.onSave,A=f.headerMessageHandlers,L=f.aiResponse,D=f.setAIResponse,W=f.width,E=void 0===W?"90vw":W,B=f.height,P=void 0===B?"90vh":B,z=f.sendMessageInChat,O=void 0===z?"":z,N=f.setSendMessageInChat,j=f.validateCustom,U=f.onResetChat,J=f.template,_=f.templateProps,q=f.initialChatMessage,H=f.setCitations,G=f.isLoading,X=void 0!==G&&G,Y=f.isLocked,K=void 0!==Y&&Y,Q=f.saveButtonConfig,Z=void 0===Q?{label:"Save Learning",loadingLabel:"Saving Learning..."}:Q,$=f.saveButtonColor,ee=f.saveWithoutValBtnConfig,ne=void 0===ee?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:ee,oe=f.textareaPlaceholder,te=f.setCurrentRequestId,ie=f.showSavedMessage,ae=void 0!==ie&&ie,se=f.savedMessage,re=void 0===se?"Thank you teacher for teaching me, your learning has been saved successfully.":se,le=f.isError,de=void 0!==le&&le,ue=f.errorMessage,ce=void 0===ue?"I'm sorry, I couldn't save your changes. Please try again.":ue,me=f.isSaving,he=void 0!==me&&me,ge=f.isAiStreaming,pe=f.setIsAiStreaming,fe=f.showConfirmReset,Ce=void 0!==fe&&fe,ve=f.setShowConfirmReset,Se=f.confirmReset,xe=f.isLoadingVariants,be=f.isFormDirty,ke=f.onResetRequest,we=f.mainText,Me=void 0===we?"Adding a variant":we,ye=f.subText,Re=void 0===ye?"This may take a moment as we update the learning with the new variant.":ye,Ie=f.showComparison,Fe=void 0!==Ie&&Ie,Te=f.setShowComparison,Ve=f.showAgentComposerRuleComparison,Ae=void 0!==Ve&&Ve,Le=f.setShowAgentComposerRuleComparison,De=f.isFetchingComparison,We=f.handleOpenComparison,Ee=f.proposedRule,Be=f.variants,Pe=f.onAddAsVariant,ze=f.isCopyEnabled,Oe=f.showSaveWithoutValidation,Ne=void 0!==Oe&&Oe,je=f.onSaveWithoutValidation,Ue=f.onComparisonLinkClick,Je=f.targetComparisonVariantId,_e=f.highlightedComparisonField,qe=f.onSubmitFeedback,He=f.isUseNormalChat,Ge=void 0!==He&&He,Xe=f.userDetails,Ye=f.handleGlobalClickCapture,Ke=f.isGlobalEditActive,Qe=f.socketTimeOutInMilliSeconds,Ze=f.initialDraftMessage,$e=f.onValidateSession,en=r(C),nn=en[0],on=en[1],tn=r(!1);tn[0];var an=tn[1],sn=r(!1),rn=sn[0],ln=sn[1],dn=r(!1),un=dn[0];dn[1];var cn=r(45),mn=cn[0],hn=cn[1],gn=r("right"),pn=gn[0],fn=gn[1],Cn=s.useRef(pn),vn=r(!1),Sn=vn[0],xn=vn[1],bn=r(0),kn=bn[0],wn=bn[1],Mn=r(40),yn=Mn[0],Rn=Mn[1];l(function(){Cn.current=pn},[pn]),l(function(){on(C)},[C]);var In=d(function(e){e.preventDefault(),xn(!0),wn(e.clientX),Rn(mn)},[mn]),Fn=d(function(e){if(Sn){var n=document.querySelector("[data-dialog-content]");if(n){var o=n.getBoundingClientRect(),t=(e.clientX-kn)/o.width*100,i=Math.max(20,Math.min(80,yn+t));hn(i),i>yn&&fn("right"),i<yn&&fn("left")}}},[Sn,kn,yn]),Tn=d(function(){xn(!1)},[]);l(function(){if(Sn)return document.addEventListener("mousemove",Fn),document.addEventListener("mouseup",Tn),function(){document.removeEventListener("mousemove",Fn),document.removeEventListener("mouseup",Tn)}},[Sn,Fn,Tn]);var Vn=function(e,n){K&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==be?void 0:be())?(on(!1),k()):null==ke||ke())},An=d(function(e){hn(function(n){var o;if("number"==typeof e)return e>n&&fn("right"),e<n&&fn("left"),e;var t=Cn.current,i=null!==(o={20:30,30:"left"===t?20:50,50:"left"===t?30:75,75:"left"===t?50:100,100:75}[n])&&void 0!==o?o:40;return 100===i&&fn("left"),20===i&&fn("right"),i})},[]),Ln=d(function(){We&&(An(30),We())},[An,We]);return n(t,e({open:nn,onClose:Vn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:E,height:P,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:o(i,e({"data-dialog-content":!0,onClickCapture:Ye,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n(a,e({sx:{width:"".concat(mn,"%"),maxWidth:"".concat(mn,"%"),transition:Sn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===mn?"none":"flex",flexDirection:"column"}},{children:Ge?n(p,{chatAssistantName:v,organizationName:S,baseUrl:x,baseWebsocketUrl:b,setIsNewChatClicked:an,ThinkingBulbIconComponent:w,isFormSaveClicked:rn,setIsFormSavedClicked:ln,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:un,chatTitle:I,customMetaData:y,headerMessageHandlers:A,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:V,chatSize:mn,movingTowards:pn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,isSaving:he,onStreamingStateChange:pe,onViewComparison:Ln,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe}):n(u,{chatAssistantName:v,organizationName:S,baseUrl:x,baseWebsocketUrl:b,setIsNewChatClicked:an,ThinkingBulbIconComponent:w,isFormSaveClicked:rn,setIsFormSavedClicked:ln,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:un,chatTitle:I,customMetaData:y,headerMessageHandlers:A,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:V,chatSize:mn,movingTowards:pn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,isSaving:he,onStreamingStateChange:pe,onViewComparison:Ln,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe,userDetails:Xe,isGlobalEditActive:Ke,socketTimeOutInMilliSeconds:Qe,initialDraftMessage:Ze,onValidateSession:$e,onCloseSessionModal:Se})})),n(a,{sx:{width:"2px",cursor:"col-resize",backgroundColor:Sn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:In}),o(a,e({sx:{width:"".concat(100-mn,"%"),maxWidth:"".concat(100-mn,"%"),transition:Sn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===mn?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n(m,{isLoading:De||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n(m,{isLoading:xe||!1,mainText:Me,subText:Re}),Ae?n(g,{proposedRule:Ee,variants:Be,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Pe||Pe(),An(40),null==Le||Le(!1)},onSkip:function(){An(40),null==Le||Le(!1)},onBack:function(){An(40),null==Le||Le(!1)},targetVariantId:Je,highlightedField:_e}):Fe?n(h,{proposedRule:Ee,variants:Be,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Pe||Pe(),An(40),null==Te||Te(!1)},onSkip:function(){An(40),null==Te||Te(!1)},onBack:function(){An(40),null==Te||Te(!1)},targetVariantId:Je,highlightedField:_e}):n(c,{setIsFormSavedClicked:ln,customSections:M,onSave:V,formHeader:T,onClose:function(){return Vn(0,"manualClose")},validateCustom:j,template:J,templateProps:_,isLoading:X,isAiStreaming:ge,saveButtonConfig:Z,saveButtonColor:$,showSaveWithoutValidation:Ne,saveWithoutValBtnConfig:ne,onSaveWithoutValidation:je}),n(t,e({open:Ce,onClose:function(){return null==ve?void 0:ve(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:o(a,e({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n("h3",e({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n("p",e({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),o(a,e({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n("button",e({onClick:function(){return null==ve?void 0:ve(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n("button",e({onClick:Se,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};export{f as default};
2
2
  //# sourceMappingURL=ILOTJ.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as t,__generator as o}from"tslib";import"react/jsx-runtime";import"@mui/material";import"lucide-react";import"react";import"uuid";import"./_components/templates/TemplatesMap/templatesMap.js";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import r from"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"./_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"./_components/MarkdownComponents/MarkdownElements.js";import"./_components/CitationLink.js";import"@e-llm-studio/citation";import"./store/CitationsContext.js";import"@viswa-test/test-citation";var i=function(i){return t(void 0,void 0,void 0,function(){var t;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,r.post("https://devllmstudio.creativeworkspace.ai/instant_learning/give-variant-info",i)];case 1:return[2,o.sent().data];case 2:throw t=o.sent(),console.error("Error getting variant info:",t),t;case 3:return[2]}})})};export{i as getVariantInfo};
1
+ import{__awaiter as t,__generator as o}from"tslib";import"react/jsx-runtime";import"@mui/material";import"lucide-react";import"react";import"uuid";import"./_components/templates/TemplatesMap/templatesMap.js";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import r from"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"./_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"./_components/MarkdownComponents/MarkdownElements.js";import"./_components/CitationLink.js";import"@e-llm-studio/citation";import"./store/CitationsContext.js";import"./_components/templates/RuleComparison/RuleComparison.js";var e=function(e){return t(void 0,void 0,void 0,function(){var t;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,r.post("https://devllmstudio.creativeworkspace.ai/instant_learning/give-variant-info",e)];case 1:return[2,o.sent().data];case 2:throw t=o.sent(),console.error("Error getting variant info:",t),t;case 3:return[2]}})})};export{e as getVariantInfo};
2
2
  //# sourceMappingURL=ILOTJTest.js.map
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as i,__generator as o,__rest as r}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as d,useState as c,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import C from"rehype-raw";import y from"axios";import{v4 as b}from"uuid";import{stopStreaming as S,startChatStream as w}from"@e-llm-studio/streaming-response";import{WatchMeWork as x}from"@e-llm-studio/watch-me-work";import k from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as T}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as E}from"../MessageRendering/ClickableChatComponents.js";import I from"../AudioWaveform.js";import M from"./ChatComponent.module.css.js";import R from"../../InstantLearning.module.css.js";import{ScrollToBottom as D}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as N,extractTextFromChildren as A}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import F from"../_svg/SparkleIcon.js";import{UserIcon as q}from"../_svg/UserIcon.js";var W,P=function(e,n){return y.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},j=function(P){var j=P.chatAssistantName,z=P.organizationName,B=P.baseUrl,H=P.baseWebsocketUrl,U=P.setIsNewChatClicked;P.ThinkingBulbIconComponent;var G=P.isFormSaveClicked,Z=P.setIsFormSavedClicked,K=P.onResetLearningData,O=P.sendMessageInChat,V=P.setSendMessageInChat,Q=P.isFormValidating,J=P.chatTitle,$=P.customMetaData,X=P.headerMessageHandlers;P.aiResponse;var Y=P.setAIResponse,ee=P.onResetChat,ne=P.initialChatMessage,te=void 0===ne?"":ne,ie=P.onSave,oe=P.chatSize,re=P.setChatSize,ae=P.movingTowards,se=P.setCitations,le=P.textareaPlaceholder,de=void 0===le?"Tell me more about this learning...":le,ce=P.setCurrentRequestId,ue=P.showSavedMessage,ve=void 0!==ue&&ue,me=P.savedMessage,he=P.isError,pe=void 0!==he&&he,ge=P.errorMessage,fe=void 0===ge?"There was an error saving your changes.":ge;P.isSaving;var Ce=P.isHighlighted,ye=void 0!==Ce&&Ce,be=P.onStreamingStateChange,Se=P.onViewComparison;P.isCopyEnabled;var we=P.onComparisonLinkClick,xe=P.onSubmitFeedback,ke=P.userDetails,_e=P.isGlobalEditActive,Te=P.socketTimeOutInMilliSeconds,Ee=P.initialDraftMessage,Ie=void 0===Ee?"":Ee,Me=j,Re=d("".concat(Me,"-").concat(z,"-").concat(b())),De=d("".concat(b())),Ne=B,Ae=d(null),Le=d(!0),Fe=d(null),qe=d(null),We=c(Ie),Pe=We[0],je=We[1],ze=c([]),Be=ze[0],He=ze[1],Ue=c(!1),Ge=Ue[0],Ze=Ue[1],Ke=c(!1);Ke[0];var Oe=Ke[1],Ve=c(!0),Qe=Ve[0],Je=Ve[1],$e=c(!0);$e[0];var Xe=$e[1],Ye=c("");Ye[0];var en=Ye[1],nn=c(""),tn=nn[0],on=nn[1],rn=c(!1),an=rn[0],sn=rn[1],ln=c(!1),dn=ln[0],cn=ln[1],un=c(!0),vn=un[0],mn=un[1],hn=c("100%");hn[0];var pn=hn[1],gn=c(null),fn=gn[0],Cn=gn[1],yn=c(!1);yn[0];var bn=yn[1],Sn=c(!1),wn=Sn[0],xn=Sn[1],kn=d(null),_n=d(new Set),Tn=c(null),En=Tn[0],In=Tn[1],Mn=c(!1),Rn=Mn[0],Dn=Mn[1],Nn=c(!1);Nn[0],Nn[1];var An=c(null);An[0],An[1],d(null),d(null);var Ln=d(new Map),Fn=d(""),qn=d(new Map),Wn=d(!1),Pn=d(0),jn=d(null);p(W||(W=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var zn=u(function(){return""===(null==Pe?void 0:Pe.trim())||an},[Pe,an]),Bn=u(function(){return Q},[Q]),Hn=u(function(){var e;return Be.length>0&&"user"===(null===(e=Be[Be.length-1])||void 0===e?void 0:e.role)},[Be]),Un=u(function(){return zn||Q||!!_e||Hn},[zn,Q,_e,Hn]);v(function(){Ie&&!Pe&&(je(Ie),cn(!0),setTimeout(function(){if(qe.current){qe.current.focus();var e=Ie.length;qe.current.setSelectionRange(e,e)}},400))},[Ie]),v(function(){null==be||be(an)},[an,be]),v(function(){return function(){jn.current&&clearTimeout(jn.current)}},[]),v(function(){var e=Ae.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;mn(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Be]);var Gn=N({handlers:X,setResult:Y}).processHeaderMessage;v(function(){ve&&xn(!0)},[ve]),v(function(){if(Rn){var e=setTimeout(function(){Dn(!1)},3e3);return function(){return clearTimeout(e)}}},[Rn]),v(function(){G&&!_e&&(Xn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),Z(!1))},[G]),v(function(){if(O)try{if(O.startsWith("__SKELETON__:")){var e=O.split(":"),i=e[1],o=e.slice(2).join(":"),r={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return He(function(e){return n(n([],e,!0),[r],!1)}),Xn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),In(i),V&&V(""),void setTimeout(function(){In(null)},2e3)}if(O.startsWith("__SKELETON_END__::")){var a=O.split("::")[1]||"";return He(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void(V&&V(""))}var s=b();Xn(new KeyboardEvent("keydown",{key:"Enter"}),!1,O,!1,s),In(s),V&&V(""),setTimeout(function(){return In(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[O]),v(function(){Kn(),On();var e=function(){var e,n=(null===(e=null==kn?void 0:kn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");pn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Zn=m(function(e){var n="string"==typeof e?e:"smooth";Fe.current&&Fe.current.scrollIntoView({behavior:n,block:"end"}),Le.current&&setTimeout(function(){Fe.current&&Le.current&&Fe.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!an){var e="";if(wn?e=me||"Thank you teacher for teaching me, your rule has been saved successfully.":pe&&(e=fe||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:b(),citations:[],time:new Date};He(function(e){return n(n([],e,!0),[t],!1)}),xn(!1),setTimeout(function(){return Zn("smooth")},100)}}},[wn,pe,an,me,fe,Zn]),v(function(){Le.current&&Zn("smooth")},[Zn]);var Kn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ne,"/api/chatbot/getChatSettings?name=").concat(Me,"&organizationName=").concat(z),headers:{}};y.request(e).then(function(e){var n,t,i;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Xe(!0)}).catch(function(e){console.error(e)})},On=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Ne,"/api/chat/history?name=").concat(Me,"&organizationName=").concat(z);try{n={method:"GET",params:{guestSessionId:Re.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(He(n),Zn()):Xe(!0)}).catch(function(e){console.error(e)})}catch(e){Ze(!1),console.error(e)}return[2]})})};function Vn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Qn=function(e,i,o,r,a,s,l){var d,c,u,v,m,h,p,g,f,C,y,S,w,x,k,_,T,E,I,M,R,D,N,A,L,F,q,W,P,j;if(null===(c=null===(d=null==e?void 0:e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.header_message){var z={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Gn(z)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,H=null==B?void 0:B.isEnd,U=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&U.length>0&&se&&se(U);var G={role:"assistant",content:"",id:b()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))Oe(!0),G.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var i=e.substring(t+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(w=null===(S=null==e?void 0:e.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===w?void 0:w.message)||void 0===x?void 0:x.content)+"\n\n"),""!==G.content&&(Ze(!1),He(n(n([],Be,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:s||!1,id:l||(null===(_=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===_?void 0:_.requestId)||"",reply:""},G],!1)));else{Oe(!1);var Z=null===(E=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===E?void 0:E.requestId;"string"==typeof Z&&Z&&ce&&ce(Z);var K=function(e,i,o,r){var a,s,l,d,c,u,v,m={role:"assistant",content:"",id:b(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,S=null==h?void 0:h.thinking_break,w=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=r.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),r.current.set(p,x))}var k=(p&&r.current.get(p)||[]).join("\n\n"),_="";if(f)_=k&&""!==k.trim()?k:C;else if(g)_=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),E=!1===y||S||0!==w.length?"":T;_=k?"".concat(k,"\n\n").concat(E):E}if(m.content=Vn(_),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var I=h.explainability_id,M=h.responded_by;o.has(I)||o.set(I,{responded_by:M,index:i.length})}o.has(h.explainability_id)?i[null==(R=o.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!0}:i=n(n([],i,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(I=h.explainability_id,M=h.responded_by,o.has(I)||o.set(I,{responded_by:M,index:i.length})),o.has(h.explainability_id)?i[null==(R=o.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:i},m)}(e,o,i,qn);K.time=new Date,K.citations=U,K.isEnd=null===(M=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===M?void 0:M.isEnd,K.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,K.sessionId=Re.current,null===(N=K.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&Gn(e)}),(""!==(null==K?void 0:K.content)||(null==K?void 0:K.orchestratorAndAgentsMessages)&&(null==K?void 0:K.orchestratorAndAgentsMessages.length)>0)&&(Ze(!1),He(n(n([],Be,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(L=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===L?void 0:L.requestId)||"",requestId:null!==(W=null===(q=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==W?W:""},K],!1))),Je(null===(j=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===j?void 0:j.isEnd)}},Jn=m(function(e){void 0===e&&(e="inactivity"),console.error("Stream failed or timed out due to: ".concat(e)),Wn.current=!1,Je(!0),sn(!1),bn(!1),Ze(!1),Oe(!1),Fn.current&&H&&(S(Fn.current,H,!1),qn.current.delete(Fn.current)),He(function(t){var i=n([],t,!0).reverse().find(function(e){return"user"===e.role}),o=((null==i?void 0:i.content)||"").replace(/"/g,"&quot;"),r=n([],t,!0),a=r[r.length-1];a&&"assistant"===a.role&&!a.isEnd&&r.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===e?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===e&&(s="I lost connection to the server while working on that."),n(n([],r,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(o,'">Retry</button>'),id:b(),time:new Date,isEnd:!0,citations:[]}],!1)})},[Te,H]),$n=m(function(){jn.current&&(clearTimeout(jn.current),jn.current=null),Te&&Te>0&&(jn.current=setTimeout(function(){return Jn("inactivity")},Te))},[Jn,Te]),Xn=function(e,i,o,r,a,s){var l,d,c,u,v,m,h=(void 0!==o?o:Pe||"").trim(),p="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!_e;p&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e));var g="user"===(null===(d=Be[Be.length-1])||void 0===d?void 0:d.role);if(!(!h||an||Wn.current||g||(null==e?void 0:e.key)&&!p)){if(Wn.current=!0,"I want to add a rule description"===h){Je(!1),Le.current=!0,sn(!0),!fn&&h&&Cn(o||"manual_entry");var f=new Date;return He(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=Vn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:f,isFirstQuestionSent:!1,id:a||b()}],!1)}),Zn("smooth"),void setTimeout(function(){He(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:b(),citations:[],time:new Date}],!1)}),Zn("smooth"),setTimeout(function(){sn(!1),Je(!0)},500)},500)}Je(!1),Le.current=!0,sn(!0),!fn&&h&&Cn(o||"manual_entry");var C=new Date;He(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=Vn(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return a&&i.some(function(e){return e.id===a})?i.map(function(e){return e.id===a?t(t({},e),{content:h}):e}):n(n([],i,!0),[{role:"user",content:h,time:C,isFirstQuestionSent:!1,id:a||b()}],!1)}),Zn("smooth");var y=new Map,S=[],x={WEBSOCKET_URL:H,organizationName:z,chatAssistantName:Me,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(c=null==ke?void 0:ke.name)&&void 0!==c?c:"Guest User",userEmailId:null!==(u=null==ke?void 0:ke.email)&&void 0!==u?u:"guestUser@example.com",userId:null!==(v=null==ke?void 0:ke.id)&&void 0!==v?v:"Guest User",query:h,requestId:"requestId-".concat(b()),customPrompt:"",enableForBackend:!1,guestSessionId:Re.current,chatPreviewId:De.current,customMetaData:$,aiModel:"",enableLogs:!0,onStreamEvent:function(e){var n,t,o,r,s,l,d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,c=null===(r=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===r?void 0:r.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(c)),$n();var u=null===(l=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===l?void 0:l.error_state;if(Array.isArray(u)&&u.length>0)return console.error("Agent returned an error_state during stream:",u),void Jn("agent_error");Qn(e,y,S,C,h,i,a)},onStreamEnd:function(e){var i,o,r=null===(o=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===o?void 0:o.requestId;console.log("✅ [Stream Completed] RequestID: ".concat(r)),jn.current&&clearTimeout(jn.current),Wn.current=!1,Je(!0),sn(!1),bn(!1);var a=Date.now(),s=Ln.current.get(Fn.current);if(s){var l=Math.round((a-s)/1e3).toFixed(1);He(function(e){var i=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===i)return e;var o=e.length-1-i;return e.map(function(e,n){return n===o?t(t({},e),{finalTimeTaken:l}):e})})}},onError:function(e){jn.current&&clearTimeout(jn.current),console.error("Stream error:",e),Jn("websocket_error")}};if(h)Ze(!0),null===(m=qe.current)||void 0===m||m.blur(),je(""),Zn(),on(a?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Ln.current.set(x.requestId,Date.now()),Fn.current=x.requestId,$n(),Pn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Pn.current,") | RequestID: ").concat(x.requestId,' | Query: "').concat(h,'"')),w(x);s&&s(!1)}},Yn=d(null);h(function(){Yn.current=Xn});var et=m(function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return null===(e=Yn.current)||void 0===e?void 0:e.call.apply(e,n([Yn],t,!1))},[]),nt=u(function(){return{p:function(e){e.node;var n=e.children;return r(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,i=e.children,o=r(e,["node","className","children"]),l=A(i),d=o["data-value"],c="Tester Genie"===l;return a(E,t({},o,{className:n,handleStream:et,isStreamEnd:Qe,disabled:!!fn||!!_e,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":fn===l||fn===d?"true":fn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,c&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[et,Qe,fn,_e]),tt=u(function(){return Be.some(function(e){return e.isSkeleton})},[Be]),it=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return xe?[4,xe(e)]:[3,2];case 1:t.sent(),He(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:b(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Zn("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(R.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ye&&!tt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Ae,className:M.scrollWrapper},{children:[a("div",t({ref:kn,className:M.stickyHeader},{children:a(k,{resetChatHistory:function(){var e="".concat(Ne,"/api/chat/resetHistory?name=").concat(Me,"&organizationName=").concat(z);try{var n={method:"GET",params:{guestSessionId:Re.current},withCredentials:!0};y.get(e,n).then(function(){U(!0),en(""),Cn(null),_n.current.clear(),qn.current.clear(),De.current="".concat(b()),He([]),Xe(!0),null==ee||ee(),K&&K()}).catch(function(e){console.error(e)}).finally(function(){Re.current="".concat(Me,"-").concat(z,"-").concat(b())})}catch(e){Ze(!1),console.error(e)}},isStreamEnd:Qe,chatTitle:J,onResize:re,chatSize:oe,movingTowards:ae})})),s("div",t({className:M.messagesList},{children:[s("div",t({className:M.initialMessageRow},{children:[a("div",t({className:M.iconWrapper},{children:a(F,{})})),a("div",t({className:M.welcomeTextWrapper},{children:a("div",t({className:M.welcomeMarkdownWrapper},{children:a("span",{children:a(f,t({rehypePlugins:[C],components:nt},{children:te}))})}))}))]})),Be.length>0&&Be.map(function(e,n){var i,o;return s("div",t({className:M.messageRow},{children:["assistant"===e.role?a("div",t({className:M.assistantIconContainer},{children:a(F,{})})):a("div",{className:M.userSpacer}),a("div",t({className:M.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(x,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Qe,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(i=null==e?void 0:e.finalTimeTaken)&&void 0!==i?i:null==e?void 0:e.id),a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Be,handleStream:Xn,isLastMessage:n===Be.length-1,onSave:ie,citations:null==e?void 0:e.citations,setChatSize:re,chatSize:oe,isStreamEnd:Qe,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:Se,onTypeResponseClick:function(){var e;Dn(!0),null===(e=qe.current)||void 0===e||e.focus()},onComparisonLinkClick:we,baseURL:Ne,onFeedbackSubmit:it,isGlobalEditActive:_e}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(o=null==e?void 0:e.content)||void 0===o?void 0:o.length)>0&&s(l,{children:[a(T,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(T,{variant:"text",width:"100%",height:40})]}),a("div",t({className:M.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:M.userMessageWrapper},{children:[s("div",t({className:M.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||tt||e.id!==En?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[a(T,{variant:"text",width:"100%",height:16}),a(T,{variant:"text",width:"80%",height:16})]})):a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Be,handleStream:Xn,isLastMessage:n===Be.length-1,onSave:ie,citations:null==e?void 0:e.citations,isStreamEnd:Qe,isGlobalEditActive:_e,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:Se,onComparisonLinkClick:we,baseURL:Ne,onFeedbackSubmit:it}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(q,{})}))]})),a("div",t({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ge&&s("div",t({className:M.loadingRow},{children:[a("div",t({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(F,{})})),a("div",t({className:M.loadingTextWrapper},{children:a("span",{children:tn})}))]})),a("div",{ref:Fe,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:M.inputAreaWrapper},{children:a(g,t({title:Q?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(M.inputBoxContainer," ").concat(Bn?M.disabled:""),style:Rn?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Be.length>0&&!vn&&a("div",t({onMouseDown:function(e){e.preventDefault(),Zn("smooth")},className:M.scrollToBottomBtn},{children:a(D,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:qe,placeholder:de,value:Pe||"",onChange:function(e){je(e.target.value)},onFocus:function(){return cn(!0)},onBlur:function(){return cn(!1)},onKeyDown:function(e){return Xn(e)},disabled:Bn,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:dn||Pe&&Pe.length>40?"120px":"50px",height:dn||Pe&&Pe.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:M.sendButtonWrapper},{children:a("button",t({onClick:function(e){Un||Xn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Un,className:"".concat(M.sendButton," ").concat(Un?M.disabled:M.active)},{children:a(L,{})}))}))]}))]}))}))})),s("div",t({className:M.footerTools},{children:[a(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:M.footerToolItem},{children:a(I,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:M.footerToolItem},{children:a(I,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{P as autoGeneratePrompt,j as default};
1
+ import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as o,__generator as i,__rest as r}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p,Dialog as g,Box as f}from"@mui/material";import C from"@mui/material/Tooltip";import y from"react-markdown";import b from"rehype-raw";import S from"axios";import{v4 as w}from"uuid";import{stopStreaming as x,startChatStream as k}from"@e-llm-studio/streaming-response";import{WatchMeWork as _}from"@e-llm-studio/watch-me-work";import T from"./ChatHeader.js";import E from"../MessageRendering/MessageRendering.js";import{Skeleton as I}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as M}from"../MessageRendering/ClickableChatComponents.js";import R from"../AudioWaveform.js";import D from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as F}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as A,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as W}from"../_svg/SendButton.js";import q from"../_svg/SparkleIcon.js";import{UserIcon as z}from"../_svg/UserIcon.js";var P,j=function(e,n){return S.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},B=function(j){var B=j.chatAssistantName,H=j.organizationName,O=j.baseUrl,U=j.baseWebsocketUrl,G=j.setIsNewChatClicked;j.ThinkingBulbIconComponent;var Z=j.isFormSaveClicked,K=j.setIsFormSavedClicked,V=j.onResetLearningData,Q=j.sendMessageInChat,J=j.setSendMessageInChat,$=j.isFormValidating,X=j.chatTitle,Y=j.customMetaData,ee=j.headerMessageHandlers;j.aiResponse;var ne=j.setAIResponse,te=j.onResetChat,oe=j.initialChatMessage,ie=void 0===oe?"":oe,re=j.onSave,ae=j.chatSize,se=j.setChatSize,le=j.movingTowards,ce=j.setCitations,de=j.textareaPlaceholder,ue=void 0===de?"Tell me more about this learning...":de,ve=j.setCurrentRequestId,me=j.showSavedMessage,he=void 0!==me&&me,pe=j.savedMessage,ge=j.isError,fe=void 0!==ge&&ge,Ce=j.errorMessage,ye=void 0===Ce?"There was an error saving your changes.":Ce;j.isSaving;var be=j.isHighlighted,Se=void 0!==be&&be,we=j.onStreamingStateChange,xe=j.onViewComparison;j.isCopyEnabled;var ke=j.onComparisonLinkClick,_e=j.onSubmitFeedback,Te=j.userDetails,Ee=j.isGlobalEditActive,Ie=j.socketTimeOutInMilliSeconds,Me=j.initialDraftMessage,Re=void 0===Me?"":Me,De=j.onValidateSession,Ne=j.onCloseSessionModal,Fe=B,Ae=c("".concat(Fe,"-").concat(H,"-").concat(w())),Le=c("".concat(w())),We=O,qe=c(null),ze=c(!0),Pe=c(null),je=c(null),Be=d(Re),He=Be[0],Oe=Be[1],Ue=d([]),Ge=Ue[0],Ze=Ue[1],Ke=d(!1),Ve=Ke[0],Qe=Ke[1],Je=d(!1);Je[0];var $e=Je[1],Xe=d(!0),Ye=Xe[0],en=Xe[1],nn=d(!0);nn[0];var tn=nn[1],on=d("");on[0];var rn=on[1],an=d(""),sn=an[0],ln=an[1],cn=d(!1),dn=cn[0],un=cn[1],vn=d(!1),mn=vn[0],hn=vn[1],pn=d(!0),gn=pn[0],fn=pn[1],Cn=d("100%");Cn[0];var yn=Cn[1],bn=d(null),Sn=bn[0],wn=bn[1],xn=d(!1);xn[0];var kn=xn[1],_n=d(!1),Tn=_n[0],En=_n[1],In=c(null),Mn=c(new Set),Rn=d(null),Dn=Rn[0],Nn=Rn[1],Fn=d(!1),An=Fn[0],Ln=Fn[1],Wn=d(!1);Wn[0],Wn[1];var qn=d(null);qn[0],qn[1],c(null),c(null);var zn=c(new Map),Pn=c(""),jn=c(new Map),Bn=c(!1),Hn=c(0),On=c(null),Un=c(null),Gn=d(!1),Zn=Gn[0],Kn=Gn[1];p(P||(P=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Vn=u(function(){return""===(null==He?void 0:He.trim())||dn},[He,dn]),Qn=u(function(){return $},[$]),Jn=u(function(){var e;return Ge.length>0&&"user"===(null===(e=Ge[Ge.length-1])||void 0===e?void 0:e.role)},[Ge]),$n=u(function(){return Vn||$||!!Ee||Jn},[Vn,$,Ee,Jn]);v(function(){Re&&!He&&(Oe(Re),hn(!0),setTimeout(function(){if(je.current){je.current.focus();var e=Re.length;je.current.setSelectionRange(e,e)}},400))},[Re]),v(function(){null==we||we(dn)},[dn,we]),v(function(){return function(){On.current&&clearTimeout(On.current)}},[]),v(function(){var e=qe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;fn(t-n-o<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Ge]);var Xn=A({handlers:ee,setResult:ne}).processHeaderMessage;v(function(){he&&En(!0)},[he]),v(function(){if(An){var e=setTimeout(function(){Ln(!1)},3e3);return function(){return clearTimeout(e)}}},[An]),v(function(){Z&&!Ee&&(st(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),K(!1))},[Z]),v(function(){if(Q)try{if(Q.startsWith("__SKELETON__:")){var e=Q.split(":"),o=e[1],i=e.slice(2).join(":"),r={role:"user",content:"",id:o,time:new Date,isSkeleton:!0,skeletonContent:i};return Ze(function(e){return n(n([],e,!0),[r],!1)}),st(new KeyboardEvent("keydown",{key:"Enter"}),!1,i,!1,o),Nn(o),J&&J(""),void setTimeout(function(){Nn(null)},2e3)}if(Q.startsWith("__SKELETON_END__::")){var a=Q.split("::")[1]||"";return Ze(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void(J&&J(""))}var s=w();st(new KeyboardEvent("keydown",{key:"Enter"}),!1,Q,!1,s),Nn(s),J&&J(""),setTimeout(function(){return Nn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[Q]),v(function(){et(),nt();var e=function(){var e,n=(null===(e=null==In?void 0:In.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");yn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Yn=m(function(e){var n="string"==typeof e?e:"smooth";Pe.current&&Pe.current.scrollIntoView({behavior:n,block:"end"}),ze.current&&setTimeout(function(){Pe.current&&ze.current&&Pe.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!dn){var e="";if(Tn?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":fe&&(e=ye||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:w(),citations:[],time:new Date};Ze(function(e){return n(n([],e,!0),[t],!1)}),En(!1),setTimeout(function(){return Yn("smooth")},100)}}},[Tn,fe,dn,pe,ye,Yn]),v(function(){ze.current&&Yn("smooth")},[Yn]);var et=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(We,"/api/chatbot/getChatSettings?name=").concat(Fe,"&organizationName=").concat(H),headers:{}};S.request(e).then(function(e){var n,t,o;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===o?void 0:o.chatInitialMessage)&&tn(!0)}).catch(function(e){console.error(e)})},nt=function(){return o(void 0,void 0,void 0,function(){var e,n;return i(this,function(t){e="".concat(We,"/api/chat/history?name=").concat(Fe,"&organizationName=").concat(H);try{n={method:"GET",params:{guestSessionId:Ae.current},withCredentials:!0},S.get(e,n).then(function(e){var n=e.data;n.length>0?(Ze(n),Yn()):tn(!0)}).catch(function(e){console.error(e)})}catch(e){Qe(!1),console.error(e)}return[2]})})},tt=function(){var e="".concat(We,"/api/chat/resetHistory?name=").concat(Fe,"&organizationName=").concat(H);try{var n={method:"GET",params:{guestSessionId:Ae.current},withCredentials:!0};S.get(e,n).then(function(){G(!0),rn(""),wn(null),Mn.current.clear(),jn.current.clear(),Le.current="".concat(w()),Ze([]),tn(!0),Un.current=null,null==te||te(),V&&V()}).catch(function(e){console.error(e)}).finally(function(){Ae.current="".concat(Fe,"-").concat(H,"-").concat(w())})}catch(e){Qe(!1),console.error(e)}};function ot(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var it=function(e,o,i,r,a,s,l){var c,d,u,v,m,h,p,g,f,C,y,b,S,x,k,_,T,E,I,M,R,D,N,F,A,L,W,q,z,P;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var j={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Xn(j)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,H=null==B?void 0:B.isEnd,O=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&O.length>0&&ce&&ce(O);var U={role:"assistant",content:"",id:w()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))$e(!0),U.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var o=e.substring(t+13);return null==o?void 0:o.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==U.content&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:s||!1,id:l||(null===(_=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===_?void 0:_.requestId)||"",reply:""},U],!1)));else{$e(!1);var G=null===(E=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===E?void 0:E.requestId;"string"==typeof G&&G&&ve&&ve(G);var Z=function(e,o,i,r){var a,s,l,c,d,u,v,m={role:"assistant",content:"",id:w(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,b=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=r.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),r.current.set(p,x))}var k=(p&&r.current.get(p)||[]).join("\n\n"),_="";if(f)_=k&&""!==k.trim()?k:C;else if(g)_=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),E=!1===y||b||0!==S.length?"":T;_=k?"".concat(k,"\n\n").concat(E):E}if(m.content=ot(_),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var I=h.explainability_id,M=h.responded_by;i.has(I)||i.set(I,{responded_by:M,index:o.length})}i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:o=n(n([],o,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(I=h.explainability_id,M=h.responded_by,i.has(I)||i.set(I,{responded_by:M,index:o.length})),i.has(h.explainability_id)?o[null==(R=i.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:o},m)}(e,i,o,jn);Z.time=new Date,Z.citations=O,Z.isEnd=null===(M=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,Z.sessionId=Ae.current,null===(N=Z.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&Xn(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(Qe(!1),Ze(n(n([],Ge,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(A=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(q=null===(W=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},Z],!1))),en(null===(P=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===P?void 0:P.isEnd)}},rt=m(function(e){void 0===e&&(e="inactivity"),console.error("Stream failed or timed out due to: ".concat(e)),Bn.current=!1,en(!0),un(!1),kn(!1),Qe(!1),$e(!1),Pn.current&&U&&(x(Pn.current,U,!1),jn.current.delete(Pn.current)),Ze(function(t){var o=n([],t,!0).reverse().find(function(e){return"user"===e.role}),i=((null==o?void 0:o.content)||"").replace(/"/g,"&quot;"),r=n([],t,!0),a=r[r.length-1];a&&"assistant"===a.role&&!a.isEnd&&r.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===e?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===e&&(s="I lost connection to the server while working on that."),n(n([],r,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(i,'">Retry</button>'),id:w(),time:new Date,isEnd:!0,citations:[]}],!1)})},[Ie,U]),at=m(function(){On.current&&(clearTimeout(On.current),On.current=null),Ie&&Ie>0&&(On.current=setTimeout(function(){return rt("inactivity")},Ie))},[rt,Ie]),st=function(e,r,a,s,l,c){return o(void 0,void 0,void 0,function(){var o,s,d,u,v,m,h,p,g,f,C,y,b,S,x;return i(this,function(i){switch(i.label){case 0:if(o=(void 0!==a?a:He||"").trim(),(s="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!Ee)&&(null===(f=null==e?void 0:e.preventDefault)||void 0===f||f.call(e)),d="user"===(null===(C=Ge[Ge.length-1])||void 0===C?void 0:C.role),!o||dn||Bn.current||d||(null==e?void 0:e.key)&&!s)return[2];if(Un.current||(Un.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Un.current))),!De)return[3,5];Qe(!0),ln("Validating session..."),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,De(Un.current)];case 2:return i.sent()?[3,4]:(Kn(!0),Qe(!1),c&&c(!1),[2]);case 3:return u=i.sent(),console.error("Validation error:",u),Kn(!0),Qe(!1),c&&c(!1),[2];case 4:Qe(!1),i.label=5;case 5:return Bn.current=!0,"I want to add a rule description"===o?(en(!1),ze.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),v=new Date,Ze(function(e){return n(n([],e.map(function(e,n){var o;return t(t({},e),{content:null===(o=ot(e.content))||void 0===o?void 0:o.replace("WaitMessage: ","")})}),!0),[{role:"user",content:o,time:v,isFirstQuestionSent:!1,id:l||w()}],!1)}),Yn("smooth"),setTimeout(function(){Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:w(),citations:[],time:new Date}],!1)}),Yn("smooth"),setTimeout(function(){un(!1),en(!0)},500)},500),[2]):(en(!1),ze.current=!0,un(!0),!Sn&&o&&wn(a||"manual_entry"),m=new Date,Ze(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=ot(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return l&&i.some(function(e){return e.id===l})?i.map(function(e){return e.id===l?t(t({},e),{content:o}):e}):n(n([],i,!0),[{role:"user",content:o,time:m,isFirstQuestionSent:!1,id:l||w()}],!1)}),Yn("smooth"),h=new Map,p=[],g={WEBSOCKET_URL:U,organizationName:H,chatAssistantName:Fe,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(y=null==Te?void 0:Te.name)&&void 0!==y?y:"Guest User",userEmailId:null!==(b=null==Te?void 0:Te.email)&&void 0!==b?b:"guestUser@example.com",userId:null!==(S=null==Te?void 0:Te.id)&&void 0!==S?S:"Guest User",query:o,requestId:"requestId-".concat(w()),customPrompt:"",enableForBackend:!1,guestSessionId:Ae.current,chatPreviewId:Le.current,customMetaData:Y,aiModel:"",enableLogs:!0,onStreamEvent:function(e){var n,t,i,a,s,c,d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,u=null===(a=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===a?void 0:a.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(u)),at();var v=null===(c=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===c?void 0:c.error_state;if(Array.isArray(v)&&v.length>0)return console.error("Agent returned an error_state during stream:",v),void rt("agent_error");it(e,h,p,m,o,r,l)},onStreamEnd:function(e){var o,i,r=null===(i=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===i?void 0:i.requestId;console.log("✅ [Stream Completed] RequestID: ".concat(r)),On.current&&clearTimeout(On.current),Bn.current=!1,en(!0),un(!1),kn(!1);var a=Date.now(),s=zn.current.get(Pn.current);if(s){var l=Math.round((a-s)/1e3).toFixed(1);Ze(function(e){var o=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===o)return e;var i=e.length-1-o;return e.map(function(e,n){return n===i?t(t({},e),{finalTimeTaken:l}):e})})}},onError:function(e){On.current&&clearTimeout(On.current),console.error("Stream error:",e),rt("websocket_error")}},o&&(Qe(!0),null===(x=je.current)||void 0===x||x.blur(),Oe(""),Yn(),ln(l?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),zn.current.set(g.requestId,Date.now()),Pn.current=g.requestId,at(),Hn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Hn.current,") | RequestID: ").concat(g.requestId,' | Query: "').concat(o,'"')),k(g)),c&&c(!1),[2])}})})},lt=c(null);h(function(){lt.current=st});var ct=m(function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return null===(e=lt.current)||void 0===e?void 0:e.call.apply(e,n([lt],t,!1))},[]),dt=u(function(){return{p:function(e){e.node;var n=e.children;return r(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,o=e.children,i=r(e,["node","className","children"]),l=L(o),c=i["data-value"],d="Tester Genie"===l;return a(M,t({},i,{className:n,handleStream:ct,isStreamEnd:Ye,disabled:!!Sn||!!Ee,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":Sn===l||Sn===c?"true":Sn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o,d&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[ct,Ye,Sn,Ee]),ut=u(function(){return Ge.some(function(e){return e.isSkeleton})},[Ge]),vt=function(e){return o(void 0,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return _e?[4,_e(e)]:[3,2];case 1:t.sent(),Ze(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:w(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Yn("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(D.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Se&&!ut?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:qe,className:D.scrollWrapper},{children:[a("div",t({ref:In,className:D.stickyHeader},{children:a(T,{resetChatHistory:tt,isStreamEnd:Ye,chatTitle:X,onResize:se,chatSize:ae,movingTowards:le})})),s("div",t({className:D.messagesList},{children:[s("div",t({className:D.initialMessageRow},{children:[a("div",t({className:D.iconWrapper},{children:a(q,{})})),a("div",t({className:D.welcomeTextWrapper},{children:a("div",t({className:D.welcomeMarkdownWrapper},{children:a("span",{children:a(y,t({rehypePlugins:[b],components:dt},{children:ie}))})}))}))]})),Ge.length>0&&Ge.map(function(e,n){var o,i;return s("div",t({className:D.messageRow},{children:["assistant"===e.role?a("div",t({className:D.assistantIconContainer},{children:a(q,{})})):a("div",{className:D.userSpacer}),a("div",t({className:D.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(_,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ye,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(o=null==e?void 0:e.finalTimeTaken)&&void 0!==o?o:null==e?void 0:e.id),a(E,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:st,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,setChatSize:se,chatSize:ae,isStreamEnd:Ye,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onTypeResponseClick:function(){var e;Ln(!0),null===(e=je.current)||void 0===e||e.focus()},onComparisonLinkClick:ke,baseURL:We,onFeedbackSubmit:vt,isGlobalEditActive:Ee}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(i=null==e?void 0:e.content)||void 0===i?void 0:i.length)>0&&s(l,{children:[a(I,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(I,{variant:"text",width:"100%",height:40})]}),a("div",t({className:D.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:D.userMessageWrapper},{children:[s("div",t({className:D.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||ut||e.id!==Dn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[a(I,{variant:"text",width:"100%",height:16}),a(I,{variant:"text",width:"80%",height:16})]})):a(E,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Ge,handleStream:st,isLastMessage:n===Ge.length-1,onSave:re,citations:null==e?void 0:e.citations,isStreamEnd:Ye,isGlobalEditActive:Ee,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:xe,onComparisonLinkClick:ke,baseURL:We,onFeedbackSubmit:vt}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(z,{})}))]})),a("div",t({className:D.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ve&&s("div",t({className:D.loadingRow},{children:[a("div",t({className:D.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(q,{})})),a("div",t({className:D.loadingTextWrapper},{children:a("span",{children:sn})}))]})),a("div",{ref:Pe,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:D.inputAreaWrapper},{children:a(C,t({title:$?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(D.inputBoxContainer," ").concat(Qn?D.disabled:""),style:An?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Ge.length>0&&!gn&&a("div",t({onMouseDown:function(e){e.preventDefault(),Yn("smooth")},className:D.scrollToBottomBtn},{children:a(F,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:je,placeholder:ue,value:He||"",onChange:function(e){Oe(e.target.value)},onFocus:function(){return hn(!0)},onBlur:function(){return hn(!1)},onKeyDown:function(e){return st(e)},disabled:Qn,className:"no-scrollbar ".concat(D.chatTextarea),style:{minHeight:mn||He&&He.length>40?"120px":"50px",height:mn||He&&He.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:D.sendButtonWrapper},{children:a("button",t({onClick:function(e){$n||st(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:$n,className:"".concat(D.sendButton," ").concat($n?D.disabled:D.active)},{children:a(W,{})}))}))]}))]}))}))})),s("div",t({className:D.footerTools},{children:[a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),a(g,t({open:Zn,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:s(f,t({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[a("h3",t({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"10px"}},{children:"Session Expired"})),a("p",t({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),s(f,t({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[a("button",t({onClick:function(){Kn(!1),tt()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Reset Session"})),a("button",t({onClick:function(){Kn(!1),null==Ne||Ne()},style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Discard & Close"}))]}))]}))}))]}))};export{j as autoGeneratePrompt,B as default};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t,useEffect as o,useMemo as l}from"react";import{Box as a,IconButton as c,Typography as s,Skeleton as d}from"@mui/material";import{ArrowLeft as p,ArrowRight as x}from"lucide-react";import{CognitiveCompare as f}from"@viswa-test/test-citation";var h=function(n){var t=n.data,o=n.isSelected,l=n.onClick;return i(a,e({id:"variant-card-".concat(t.id),onClick:l,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:t.isLoading?.7:1,border:o?"1.4px solid #2563EB":"1.4px solid transparent",boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[r(a,e({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:t.isLoading?r(d,{variant:"rounded",width:80,height:20}):r(a,e({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1",textTransform:"capitalize"}},{children:t.similarityScoreText||"0% Similarity"}))})),r(a,e({sx:{display:"flex",flexDirection:"column",gap:1}},{children:i(a,e({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[t.isLoading?r(d,{width:"90%"}):r(s,e({title:t.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:t.title})),t.scope&&r(a,e({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:t.scope}))]}))}))]}))},g=function(d){var g=d.variants,u=void 0===g?[]:g,m=d.onSelectVariant,b=d.onSkip,F=d.onBack,v=d.targetVariantId,y=n(v||null),w=y[0],S=y[1],k=t(null);o(function(){v&&S(v)},[v]);var E=function(e){k.current&&k.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},C=l(function(){if(w){var e=String(w).trim();return u.find(function(i){return i.id&&String(i.id).trim()===e})||u[0]}return u.length>0?u[0]:null},[w,u]);o(function(){if(w&&k.current){var e=w.trim();setTimeout(function(){var i=document.getElementById("variant-card-".concat(e)),r=k.current;if(i&&r){var n=i.offsetLeft-r.offsetLeft-r.clientWidth/2+i.clientWidth/2;r.scrollTo({left:n,behavior:"smooth"})}},150)}},[w,u]);o(function(){!w&&!v&&u.length>0&&!u[0].isLoading&&S(u[0].id)},[u,w,v]);var z=n(!1),D=z[0],B=z[1],L=n(!1),W=L[0],I=L[1];o(function(){var e=k.current;if(e){var i=function(){B(e.scrollLeft>0),I(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return i(),e.addEventListener("scroll",i),window.addEventListener("resize",i),function(){e.removeEventListener("scroll",i),window.removeEventListener("resize",i)}}},[u]);var T=(null==C?void 0:C.intentTreeData)||null,R=(null==C?void 0:C.behaviorTreeData)||null;return i(a,e({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#FFFFFF",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[i(a,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF"}},{children:[i(a,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:[r(c,e({onClick:F,size:"small"},{children:r(p,{})})),r(s,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),r(c,e({onClick:b,size:"small"},{children:r(a,e({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),r(a,e({sx:{bgcolor:"#F6F7F9B2"}},{children:u.length>1&&i(a,e({sx:{pb:2}},{children:[i(a,e({sx:{px:3,display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[r(s,e({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),i(a,e({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[r(c,e({onClick:function(){return E("left")},size:"small",disabled:!D},{children:r(p,{size:18})})),r(c,e({onClick:function(){return E("right")},size:"small",disabled:!W},{children:r(x,{size:18})}))]}))]})),r(a,e({ref:k,sx:{display:"flex",gap:1,overflowX:"auto",px:3,"&::-webkit-scrollbar":{display:"none"}}},{children:u.map(function(e){return r(h,{data:e,isSelected:(null==C?void 0:C.id)===e.id,onClick:function(){return S((i=e).id),void m(i);var i}},e.id)})}))]}))})),i(a,e({sx:{display:"flex",flexDirection:"column",gap:3,margin:3,overflowY:"auto",backgroundColor:"#fff","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"}}},{children:[T&&i(a,e({sx:{display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:[i(a,e({sx:{px:3,py:1.5,bgcolor:"#F8F9FB",borderBottom:"1px solid #E2E8F0",textAlign:"center"}},{children:[r(s,e({sx:{fontSize:"15px",fontWeight:600,color:"#0F172A",mb:.5}},{children:"Is the learning's intent matching?"})),r(s,e({sx:{fontSize:"13px",color:"#64748B"}},{children:"Checking if the learning you are creating is same as the existing learning."}))]})),r(f,{treeData:T,componentHeaderText:"Is the learning's intent matching?",displayConfig:{isHeaderVisible:!1,isToggleVisible:!1,maintainRelativeOrder:!1}})]})),R&&i(a,e({sx:{display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:[i(a,e({sx:{px:3,py:1.5,bgcolor:"#F8F9FB",borderBottom:"1px solid #E2E8F0",textAlign:"center"}},{children:[r(s,e({sx:{fontSize:"15px",fontWeight:600,color:"#0F172A",mb:.5}},{children:"Is the learning behavior matching?"})),r(s,e({sx:{fontSize:"13px",color:"#64748B"}},{children:"Checking if the variant you are trying to add is similar, overlapping or conflicting with the existing variant."}))]})),r(f,{treeData:R,componentHeaderText:"Is the learning behavior matching?",displayConfig:{isHeaderVisible:!1,isToggleVisible:!1,maintainRelativeOrder:!1}})]}))]}))]}))};export{g as default};
1
+ import{__assign as e,__spreadArray as n,__rest as t}from"tslib";import{jsxs as i,jsx as r}from"react/jsx-runtime";import o,{useState as l,useRef as a,useEffect as s,useMemo as d}from"react";import{Box as c,Typography as p,IconButton as h,Skeleton as g}from"@mui/material";import{ArrowLeft as u,ArrowRight as x}from"lucide-react";import f from"../../_svg/SparkleIcon.js";import{CognitiveDecisioningCard as m}from"@e-llm-studio/citation";import{ButtonCognitiveIcon as b}from"../../_svg/ButtonCognitiveIcon.js";var v=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},y=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},w=o.forwardRef(function(n,t){var o=n.label,l=n.content,a=n.highlights,s=void 0===a?[]:a,d=n.styleVariant,h=n.isHighlighted,g=void 0!==h&&h,u=Array.isArray(l)?l.join("\n"):l||"",x="#B91C1C"===d.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===d.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return i(c,e({sx:{mb:1.5}},{children:[r(p,e({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),r(c,e({ref:t,sx:{p:"4px 12px",borderRadius:"6px",border:g?"1.5px solid ".concat(x.borderColor):"1px solid ".concat(d.border),boxShadow:g?"0px 0px 0px 2px ".concat(x.shadow):"none",bgcolor:d.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:r(c,{children:function(){if(!u)return r(p,e({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!s||0===s.length)return u;var n=s.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===n.length)return u;var t=new RegExp("(".concat(n.join("|"),")"),"gi");return u.split(t).map(function(n,t){return s.some(function(e){return e&&e.toLowerCase()===n.toLowerCase()})?r(c,e({component:"span",sx:{bgcolor:d.highlightBg,borderRadius:"2px",px:"2px"}},{children:n}),t):n})}()})}))]}))}),F=function(n){var t=n.data,o=n.isSelected,l=n.isCognitiveOpen,a=n.onToggleCognitive,s=n.onClick,d=t.summaryText||t.description||"",h=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),u=h?d.replace(h[0],"").trim():d,x=!!h;return i(c,e({id:"variant-card-".concat(t.id),onClick:s,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:t.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[r(c,e({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:t.isLoading?r(g,{variant:"rounded",width:80,height:20}):i(c,e({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==t.similarity?t.similarity:0,"% Similarity"]}))})),i(c,e({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[r(p,e({title:t.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:t.title})),t.scope&&r(c,e({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:t.scope}))]})),t.isLoading?i(c,{children:[r(g,{width:"90%"}),r(g,{width:"60%"})]}):i(c,e({title:u,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[r(p,e({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:u})),x&&i(c,e({onClick:function(e){e.stopPropagation(),o||s(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[r("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:r(b,{})})),r("svg",e({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:r("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))},_=function(o){var g,_,C=o.proposedRule,B=o.variants,E=void 0===B?[]:B,k=o.onSelectVariant;o.onAddAsVariant;var S=o.onSkip,A=o.onBack,L=o.targetVariantId,D=o.highlightedField,W=l(L||null),z=W[0],T=W[1],I=l(!1),R=I[0],j=I[1],H=l(null),O=H[0],M=H[1],V=a(null),N=a(null);s(function(){if(L&&T(L),M(null!=D?D:null),D){var e=setTimeout(function(){return M(null)},6e3);return function(){return clearTimeout(e)}}},[L,D]);var U=function(e){V.current&&V.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},P=d(function(){return n([],E,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[E]),Y=d(function(){if(z){var e=String(z).trim();return E.find(function(n){return n.id&&String(n.id).trim()===e})||P[0]}return P.length>0?P[0]:null},[z,E,P]);s(function(){if(z&&V.current){var e=z.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=V.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[z,P]);var $=Y||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},q=null==Y?void 0:Y.analysis,J=(null===(_=null===(g=null==q?void 0:q.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===_?void 0:_.overall_summary)||"",X=J.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),G=!!X,K=X?X[1]:"",Q=v("reason",K)||"",Z=v("gap",K)||"",ee=v("relevance_score",K)||"",ne=d(function(){return{ul:function(n){n.node;var i=t(n,["node"]);return r("ol",e({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(n){n.node;var i=t(n,["node"]);return r("li",e({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(n){n.node;var i=t(n,["node"]);return r("li",e({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(n){var o=n.href,l=n.children,a=t(n,["href","children"]);if(!o)return r("a",e({},a,{children:l}));var s=o||"";try{s=decodeURIComponent(o)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var d="",c="",p=s.match(/variant_id=([^?&]+)/);p&&(d=p[1]);var h=s.match(/field_name=([^&]+)/);return h&&(c=h[1]),i("button",e({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),T(d),M(c),setTimeout(function(){return M(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[l,r("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:r("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return r("a",e({href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},a,{children:l}))}}},[]);s(function(){!z&&!L&&P.length>0&&!P[0].isLoading&&T(P[0].id)},[P,z,L]);var te=a(null),ie=l([]),re=ie[0],oe=ie[1],le=l(!1),ae=le[0],se=le[1],de=l(!1),ce=de[0],pe=de[1];s(function(){var e=V.current;if(e){var n=function(){se(e.scrollLeft>0),pe(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[P]);var he={title:a(null),scope:a(null),description:a(null),wta:a(null),wnta:a(null)},ge={title:a(null),scope:a(null),description:a(null),wta:a(null),wnta:a(null)};s(function(){if(O){var e="when_to_apply"===O?"wta":"when_not_to_apply"===O?"wnta":O,n=he[e]||ge[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[O]);var ue=function(e){var n,t,i,r,o,l=null===(n=null==q?void 0:q.rule_difference_comparison)||void 0===n?void 0:n.fields,a="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,s=!(!C[a]&&!$[a]);if(!l||!l[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=l[e];if(d.mappings){var c=d.mappings[0]||{};return{score:d.score,relation:c.relation||"",highlightsA:(null===(t=c.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=c.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:s}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(r=d.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=d.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:s}},xe=["title","scope","description","when_to_apply","when_not_to_apply"],fe=function(){if(te.current){var e=te.current.getBoundingClientRect(),n=[];xe.forEach(function(t){var i="when_to_apply"===t?he.wta:"when_not_to_apply"===t?he.wnta:he[t],r="when_to_apply"===t?ge.wta:"when_not_to_apply"===t?ge.wnta:ge[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),l=r.current.getBoundingClientRect(),a=Math.max(o.height,l.height);i.current.style.height="".concat(a,"px"),r.current.style.height="".concat(a,"px");var s=i.current.getBoundingClientRect(),d=r.current.getBoundingClientRect(),c=ue(t),p=y(c.score,c.relation,c.hasContent),h=s.top+s.height/2-e.top;n.push({x1:s.right-e.left,y1:h,x2:d.left-e.left,y2:h,style:p})}}),oe(n)}};return s(function(){var e=setTimeout(fe,250);window.addEventListener("resize",fe);var n=null;return te.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){fe()})})).observe(te.current),function(){clearTimeout(e),window.removeEventListener("resize",fe),n&&n.disconnect()}},[C,$,q,R]),i(c,e({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[i(c,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:[r(h,e({onClick:A,size:"small"},{children:r(u,{})})),r(p,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),r(h,e({onClick:S,size:"small"},{children:r(c,e({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),P.length>1&&i(c,e({sx:{px:3,pb:.25}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[r(p,e({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),i(c,e({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[r(h,e({onClick:function(){return U("left")},size:"small",disabled:!ae},{children:r(u,{size:18})})),r(h,e({onClick:function(){return U("right")},size:"small",disabled:!ce},{children:r(x,{size:18})}))]}))]})),r(c,e({ref:V,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:P.map(function(e){return r(F,{data:e,isSelected:(null==Y?void 0:Y.id)===e.id,isCognitiveOpen:R,onToggleCognitive:function(){j(function(e){var n=!e;return n&&N.current&&N.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return T((n=e).id),k(n),void j(!1);var n}},e.id)})}))]})),r(c,e({ref:N,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:J&&G&&R?"none":"1.5px solid #EEF0F4"}},{children:i(c,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[J&&G&&R&&r(c,e({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:r(m,{headerIcon:r(b,{}),reasoning:Q,gap:Z,score:ee,mdComponents:ne,isOpen:!0,onToggle:function(){return j(!1)}})})),i(c,e({ref:te,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[r("svg",e({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:re.map(function(n,t){var o=(n.x1+n.x2)/2,l=n.y1;return i("g",{children:[r("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder,strokeWidth:"1"}),r("foreignObject",e({x:o-125,y:l-16,width:"250",height:"32"},{children:r(c,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:r(c,e({sx:{fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:n.style.label}))}))}))]},t)})})),i(c,e({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[r(c,e({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:r(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),r(c,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:xe.map(function(e){var n=ue(e),t=y(n.score,n.relation,n.hasContent),i="when_to_apply"===e?he.wta:"when_not_to_apply"===e?he.wnta:he[e],o=C["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return r(w,{ref:i,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:n.highlightsA,styleVariant:t,isHighlighted:O===e},"left-".concat(e))})}))]})),r(c,{sx:{width:"1px"}}),i(c,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[r(c,e({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[r("div",e({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:r(f,{})})),"Existing Learning"]}))})),r(c,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:xe.map(function(e){var n=ue(e),t=y(n.score,n.relation,n.hasContent),i="when_to_apply"===e?ge.wta:"when_not_to_apply"===e?ge.wnta:ge[e],o=$["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return r(w,{ref:i,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:n.highlightsB,styleVariant:t,isHighlighted:O===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};export{_ as default};
2
2
  //# sourceMappingURL=RuleComparison.js.map
@@ -80,6 +80,7 @@ interface ILOTJProps {
80
80
  saveButtonColor?: string;
81
81
  socketTimeOutInMilliSeconds?: number;
82
82
  initialDraftMessage?: string;
83
+ onValidateSession?: (startTime: string) => Promise<boolean>;
83
84
  }
84
85
  declare const ILOTJ: React.FC<ILOTJProps>;
85
86
  export default ILOTJ;
@@ -1 +1 @@
1
- {"version":3,"file":"ILOTJ.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJ.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"ILOTJ.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJ.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAGjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAOvD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AACzE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B;AAED,UAAU,UAAU;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3C,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC7D,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAClE,+BAA+B,CAAC,EAAC,OAAO,CAAC;IACzC,kCAAkC,CAAC,EAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,yBAAyB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC7E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/D;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA6e/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ILOTJTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJTest.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,OAAO,EAA2E,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AAWrJ,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEzE,UAAU,UAAU;CACnB;AAKD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAKD,eAAO,MAAM,cAAc,YAAmB,qBAAqB,iBASlE,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA80EnC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ILOTJTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/IL-OTJ/ILOTJTest.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,OAAO,EAA2E,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AAWrJ,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEzE,UAAU,UAAU;CACnB;AAKD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAKD,eAAO,MAAM,cAAc,YAAmB,qBAAqB,iBASlE,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA61EnC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -46,6 +46,8 @@ interface ChatComponentProps {
46
46
  isGlobalEditActive?: boolean;
47
47
  socketTimeOutInMilliSeconds?: number | null;
48
48
  initialDraftMessage?: string;
49
+ onValidateSession?: (startTime: string) => Promise<boolean>;
50
+ onCloseSessionModal?: () => void;
49
51
  }
50
52
  export declare const autoGeneratePrompt: (baseUrl?: string, userInput?: string) => Promise<any>;
51
53
  declare const ChatComponent: React.FC<ChatComponentProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/ChatComponent.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"ChatComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/ChatComponent.tsx"],"names":[],"mappings":"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"}
@@ -1,21 +1,56 @@
1
+ interface ComparisonFieldAnalysis {
2
+ relation: string;
3
+ score: number;
4
+ highlights?: {
5
+ ruleA_spans?: string[];
6
+ ruleB_spans?: string[];
7
+ };
8
+ }
9
+ interface ComparisonAnalysis {
10
+ rule_difference_comparison: {
11
+ summary: {
12
+ overall_score: number;
13
+ overall_summary: string;
14
+ };
15
+ fields: {
16
+ title: ComparisonFieldAnalysis;
17
+ scope: ComparisonFieldAnalysis;
18
+ description: ComparisonFieldAnalysis;
19
+ when_to_apply: {
20
+ score: number;
21
+ mappings: any[];
22
+ };
23
+ when_not_to_apply: {
24
+ score: number;
25
+ mappings: any[];
26
+ };
27
+ };
28
+ };
29
+ }
1
30
  interface RuleData {
2
31
  id: string;
3
32
  title: string;
4
- similarityScoreText?: string;
5
- scope?: string;
33
+ scope: string;
34
+ description: string;
35
+ wta: string;
36
+ wnta: string;
37
+ similarity?: number;
38
+ summaryText?: string;
39
+ variantType?: string;
40
+ tierName?: string;
41
+ analysis?: ComparisonAnalysis;
6
42
  isLoading?: boolean;
7
- intentTreeData?: any;
8
- behaviorTreeData?: any;
9
43
  }
10
44
  export interface RuleComparisonProps {
11
- proposedRule?: any;
45
+ proposedRule: any;
12
46
  variants?: RuleData[];
13
47
  onSelectVariant: (variant: RuleData) => void;
14
48
  onAddAsVariant?: () => void;
15
49
  onSkip?: () => void;
16
50
  onBack?: () => void;
17
51
  targetVariantId?: string | null;
52
+ highlightedField?: string | null;
18
53
  }
19
- declare const RuleComparison: ({ variants, onSelectVariant, onSkip, onBack, targetVariantId, }: RuleComparisonProps) => import("react/jsx-runtime").JSX.Element;
54
+ declare const RuleComparison: ({ proposedRule, variants, onSelectVariant, onAddAsVariant, onSkip, onBack, targetVariantId, highlightedField }: RuleComparisonProps) => import("react/jsx-runtime").JSX.Element;
20
55
  export default RuleComparison;
21
56
  //# sourceMappingURL=RuleComparison.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleComparison.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.tsx"],"names":[],"mappings":"AAKA,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,gBAAgB,CAAC,EAAE,GAAG,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,eAAe,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AA6FD,QAAA,MAAM,cAAc,oEAMjB,mBAAmB,4CA+KrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"RuleComparison.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.tsx"],"names":[],"mappings":"AAOA,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;CACH;AAED,UAAU,kBAAkB;IAC1B,0BAA0B,EAAE;QAC1B,OAAO,EAAE;YACP,aAAa,EAAE,MAAM,CAAC;YACtB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;QACF,MAAM,EAAE;YACN,KAAK,EAAE,uBAAuB,CAAC;YAC/B,KAAK,EAAE,uBAAuB,CAAC;YAC/B,WAAW,EAAE,uBAAuB,CAAC;YACrC,aAAa,EAAE;gBACb,KAAK,EAAE,MAAM,CAAC;gBACd,QAAQ,EAAE,GAAG,EAAE,CAAC;aACjB,CAAC;YACF,iBAAiB,EAAE;gBACjB,KAAK,EAAE,MAAM,CAAC;gBACd,QAAQ,EAAE,GAAG,EAAE,CAAC;aACjB,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,eAAe,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAgVD,QAAA,MAAM,cAAc,mHASjB,mBAAmB,4CA4brB,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "0.0.303",
3
+ "version": "0.0.305",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",