@e-llm-studio/instant-learning 0.0.296 → 0.0.298

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"),o=require("react"),a=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(o);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,R=u.headerMessageHandlers,I=u.aiResponse,_=u.setAIResponse,j=u.width,F=void 0===j?"90vw":j,T=u.height,A=void 0===T?"90vh":T,V=u.sendMessageInChat,L=void 0===V?"":V,D=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,oe=u.isError,ae=void 0!==oe&&oe,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,Re=void 0!==Me&&Me,Ie=u.setShowAgentComposerRuleComparison,_e=u.isFetchingComparison,je=u.handleOpenComparison,Fe=u.proposedRule,Te=u.variants,Ae=u.onAddAsVariant,Ve=u.isCopyEnabled,Le=u.showSaveWithoutValidation,De=void 0!==Le&&Le,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=o.useState(g),Xe=Ge[0],Ye=Ge[1],Ke=o.useState(!1);Ke[0];var Qe=Ke[1],Ze=o.useState(!1),$e=Ze[0],en=Ze[1],nn=o.useState(!1),tn=nn[0];nn[1];var on=o.useState(45),an=on[0],sn=on[1],rn=o.useState("right"),ln=rn[0],dn=rn[1],un=c.default.useRef(ln),cn=o.useState(!1),gn=cn[0],hn=cn[1],mn=o.useState(0),pn=mn[0],fn=mn[1],Cn=o.useState(40),vn=Cn[0],xn=Cn[1];o.useEffect(function(){un.current=ln},[ln]),o.useEffect(function(){Ye(g)},[g]);var Sn=o.useCallback(function(e){e.preventDefault(),hn(!0),fn(e.clientX),xn(an)},[an]),bn=o.useCallback(function(e){if(gn){var n=document.querySelector("[data-dialog-content]");if(n){var t=n.getBoundingClientRect(),o=(e.clientX-pn)/t.width*100,a=Math.max(20,Math.min(80,vn+o));sn(a),a>vn&&dn("right"),a<vn&&dn("left")}}},[gn,pn,vn]),kn=o.useCallback(function(){hn(!1)},[]);o.useEffect(function(){if(gn)return document.addEventListener("mousemove",bn),document.addEventListener("mouseup",kn),function(){document.removeEventListener("mousemove",bn),document.removeEventListener("mouseup",kn)}},[gn,bn,kn]);var wn=function(e,n){J&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==fe?void 0:fe())?(Ye(!1),C()):null==Ce||Ce())},yn=o.useCallback(function(e){sn(function(n){var t;if("number"==typeof e)return e>n&&dn("right"),e<n&&dn("left"),e;var o=un.current,a=null!==(t={20:30,30:"left"===o?20:50,50:"left"===o?30:75,75:"left"===o?50:100,100:75}[n])&&void 0!==t?t:40;return 100===a&&dn("left"),20===a&&dn("right"),a})},[]),Mn=o.useCallback(function(){je&&(yn(30),je())},[yn,je]);return n.jsx(t.Dialog,e.__assign({open:Xe,onClose:wn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:F,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(an,"%"),maxWidth:"".concat(an,"%"),transition:gn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===an?"none":"flex",flexDirection:"column"}},{children:Oe?n.jsx(d.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:Qe,ThinkingBulbIconComponent:v,isFormSaveClicked:$e,setIsFormSavedClicked:en,onResetLearningData:function(){},sendMessageInChat:L,setSendMessageInChat:D,isFormValidating:tn,chatTitle:k,customMetaData:S,headerMessageHandlers:R,aiResponse:I,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:M,chatSize:an,movingTowards:ln,setChatSize:yn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:ae,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:Mn,isCopyEnabled:Ve,onComparisonLinkClick:Be,onSubmitFeedback:Pe}):n.jsx(a.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:Qe,ThinkingBulbIconComponent:v,isFormSaveClicked:$e,setIsFormSavedClicked:en,onResetLearningData:function(){},sendMessageInChat:L,setSendMessageInChat:D,isFormValidating:tn,chatTitle:k,customMetaData:S,headerMessageHandlers:R,aiResponse:I,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:M,chatSize:an,movingTowards:ln,setChatSize:yn,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:ae,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:Mn,isCopyEnabled:Ve,onComparisonLinkClick:Be,onSubmitFeedback:Pe,userDetails:Ne,isGlobalEditActive:Je,socketTimeOutInMilliSeconds:He})})),n.jsx(t.Box,{sx:{width:"2px",cursor:"col-resize",backgroundColor:gn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:Sn}),n.jsxs(t.Box,e.__assign({sx:{width:"".concat(100-an,"%"),maxWidth:"".concat(100-an,"%"),transition:gn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===an?"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==Ae||Ae(),yn(40),null==Ie||Ie(!1)},onSkip:function(){yn(40),null==Ie||Ie(!1)},onBack:function(){yn(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==Ae||Ae(),yn(40),null==ye||ye(!1)},onSkip:function(){yn(40),null==ye||ye(!1)},onBack:function(){yn(40),null==ye||ye(!1)},targetVariantId:We,highlightedField:qe}):n.jsx(i.default,{setIsFormSavedClicked:en,customSections:x,onSave:M,formHeader:y,onClose:function(){return wn(0,"manualClose")},validateCustom:E,template:W,templateProps:q,isLoading:N,isAiStreaming:de,saveButtonConfig:G,saveButtonColor:X,showSaveWithoutValidation:De,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,y=void 0===w?"Instant Learning On-The-Job Form":w,M=u.onSave,R=u.headerMessageHandlers,I=u.aiResponse,_=u.setAIResponse,j=u.width,F=void 0===j?"90vw":j,T=u.height,A=void 0===T?"90vh":T,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,Re=void 0!==Me&&Me,Ie=u.setShowAgentComposerRuleComparison,_e=u.isFetchingComparison,je=u.handleOpenComparison,Fe=u.proposedRule,Te=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})},[]),Rn=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:F,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:R,aiResponse:I,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:Rn,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:R,aiResponse:I,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:Rn,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}),Re?n.jsx(l.default,{proposedRule:Fe,variants:Te,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ae||Ae(),Mn(40),null==Ie||Ie(!1)},onSkip:function(){Mn(40),null==Ie||Ie(!1)},onBack:function(){Mn(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==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,highlightedField:qe}):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"}))]}))]}))}))]}))]}))}))};
2
2
  //# sourceMappingURL=ILOTJ.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"),s=require("lucide-react"),r=require("./TooltipComponent.js");exports.default=function(t){var o,d,l=t.title,a=t.subtitle,p=t.children,x=t.defaultOpen,c=void 0===x||x,g=t.footerData,f=t.readOnly,u=void 0!==f&&f,h=t.variant,_=void 0===h?"default":h,v=t.expanded,j=t.onToggle,y=t.actionButtons,b=t.isAiStreaming,F=t.editFlow,m=void 0!==F&&F,w=n.useState(c),C=w[0],D=w[1];n.useEffect(function(){D(c)},[c]);var E=void 0!==v,S=E?v:C,z=function(){E?null==j||j():D(!S)},k="variant"===l.type,I="other"===l.type,B="tier-header"===_,R="rule-behavior"===_,T={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:B?"0px":"8px",borderBottom:B?"1px solid #E2E8F0":"none"},A={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:I?"":"6px 10px",borderRadius:"4px",color:u?"#717b8c":B&&S?"#2563EB":"#19213D",backgroundColor:R&&!l.isNewVariant?"#F7F8FA":k?"#FDF2F8":l.isDefault?"#F7F8FA":"transparent",border:k?"1px solid #FCE7F3":l.isDefault?"1px solid #F0F2F5":"none"},W={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:I?"0px":"10px"},q={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}},L={width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:B?"none":R&&S?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"};return i.jsxs("div",e.__assign({style:L},{children:[i.jsxs("div",e.__assign({onClick:z,style:T},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!l.isNewVariant&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i.jsx("div",e.__assign({style:A},{children:l.label})),l.isDefault&&i.jsx("span",e.__assign({style:q.defaultTag},{children:"Default"})),l.isModified&&i.jsx("span",e.__assign({style:q.modifiedTag},{children:"MODIFIED"}))]})),i.jsx("div",{children:l.isNewVariant&&i.jsxs("div",e.__assign({style:q.badge},{children:[i.jsx("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:i.jsx("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),i.jsx("div",{children:"New Variant"})]}))}),a&&i.jsx("div",e.__assign({style:W},{children:a}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[y&&!b&&(m?i.jsx(r.default,e.__assign({description:"Coming Soon"},{children:i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:i.jsx("div",e.__assign({style:{pointerEvents:"none"}},{children:y(S,function(){})}))}))})):i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()}},{children:y(S,z)}))),i.jsx("div",e.__assign({onClick:z,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:S?i.jsx(s.ChevronUp,{size:18,color:B?"#2563EB":"#64748B"}):i.jsx(s.ChevronDown,{size:18,color:"#64748B"})}))]}))]})),!S&&g&&i.jsx("div",e.__assign({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:I?i.jsxs(i.Fragment,{children:[i.jsx("span",e.__assign({style:{fontWeight:500,color:"#475569"}},{children:g.ruleTitle||"No Title"})),(null!==(d=null===(o=g.tiers)||void 0===o?void 0:o.length)&&void 0!==d?d:0)>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),i.jsx("span",{children:Array.isArray(g.tiers)?g.tiers.join(", "):g.tiers})]})]}):i.jsx("span",e.__assign({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:g.description}))})),S&&i.jsx("div",e.__assign({style:{padding:"12px"}},{children:p}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),r=require("./TooltipComponent.js");exports.default=function(t){var o,d,l=t.title,a=t.subtitle,p=t.children,x=t.defaultOpen,c=void 0===x||x,g=t.footerData,f=t.readOnly,u=void 0!==f&&f,h=t.variant,_=void 0===h?"default":h,v=t.expanded,j=t.onToggle,y=t.actionButtons,b=t.isAiStreaming,F=t.editFlow,m=void 0!==F&&F,w=n.useState(c),C=w[0],D=w[1];n.useEffect(function(){D(c)},[c]);var E=void 0!==v,S=E?v:C,z=function(){E?null==j||j():D(!S)},k="variant"===l.type,I="other"===l.type,B="tier-header"===_,R="rule-behavior"===_,A={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:B?"0px":"8px",borderBottom:B?"1px solid #E2E8F0":"none"},T={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:I?"":"6px 10px",borderRadius:"4px",color:u?"#717b8c":B&&S?"#2563EB":"#19213D",backgroundColor:R&&!l.isNewVariant?"#F7F8FA":k?"#FDF2F8":l.isDefault?"#F7F8FA":"transparent",border:k?"1px solid #FCE7F3":l.isDefault?"1px solid #F0F2F5":"none"},W={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:I?"0px":"10px"},q={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}},L={width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:B?"none":R&&S?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"};return i.jsxs("div",e.__assign({style:L},{children:[i.jsxs("div",e.__assign({onClick:z,style:A},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!l.isNewVariant&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i.jsx("div",e.__assign({style:T},{children:l.label})),l.isDefault&&i.jsx("span",e.__assign({style:q.defaultTag},{children:"Default"})),l.isModified&&i.jsx("span",e.__assign({style:q.modifiedTag},{children:"MODIFIED"}))]})),i.jsx("div",{children:l.isNewVariant&&i.jsxs("div",e.__assign({style:q.badge},{children:[i.jsx("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:i.jsx("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),i.jsx("div",{children:"New Variant"})]}))}),a&&i.jsx("div",e.__assign({style:W},{children:a}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[y&&!b&&(m?i.jsx(r.default,e.__assign({description:"Coming Soon"},{children:i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:i.jsx("div",e.__assign({style:{pointerEvents:"none"}},{children:y(S,function(){})}))}))})):i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()}},{children:y(S,z)}))),i.jsx("div",e.__assign({onClick:z,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:S?i.jsx(s.ChevronUp,{size:18,color:B?"#2563EB":"#64748B"}):i.jsx(s.ChevronDown,{size:18,color:"#64748B"})}))]}))]})),!S&&g&&i.jsx("div",e.__assign({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:I?i.jsxs(i.Fragment,{children:[i.jsx("span",e.__assign({style:{fontWeight:500,color:"#475569"}},{children:g.ruleTitle||""})),(null!==(d=null===(o=g.tiers)||void 0===o?void 0:o.length)&&void 0!==d?d:0)>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),i.jsx("span",{children:Array.isArray(g.tiers)?g.tiers.join(", "):g.tiers})]})]}):i.jsx("span",e.__assign({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:g.description}))})),S&&i.jsx("div",e.__assign({style:{padding:"12px"}},{children:p}))]}))};
2
2
  //# sourceMappingURL=AccordianSection.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material"),s=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"),m=require("../atoms/SkeletonLoader/SkeletonLoader.js"),h=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(s),k=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(s){var i=s.chatAssistantName,r=s.organizationName,o=s.baseUrl,b=s.baseWebsocketUrl,M=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var R=s.isFormSaveClicked,A=s.setIsFormSavedClicked,I=s.onResetLearningData,N=s.sendMessageInChat,D=s.setSendMessageInChat,q=s.isFormValidating,F=s.chatTitle,L=s.customMetaData,W=s.headerMessageHandlers;s.aiResponse;var P=s.setAIResponse,B=s.onResetChat,z=s.initialChatMessage,H=void 0===z?"":z,G=s.onSave,O=s.chatSize,U=s.setChatSize,Z=s.movingTowards,K=s.setCitations,V=s.textareaPlaceholder,Q=void 0===V?"Tell me more about this learning...":V,J=s.setCurrentRequestId,$=s.showSavedMessage,X=void 0!==$&&$,Y=s.savedMessage,ee=s.isError,ne=void 0!==ee&&ee,te=s.errorMessage,ae=void 0===te?"There was an error saving your changes.":te;s.isSaving;var se=s.isHighlighted,ie=void 0!==se&&se,re=s.onStreamingStateChange,oe=s.onViewComparison;s.isCopyEnabled;var le=s.onComparisonLinkClick,ue=s.onSubmitFeedback,de=s.userDetails,ce=s.isGlobalEditActive,ve=s.socketTimeOutInMilliSeconds,me=i,he=t.useRef("".concat(me,"-").concat(r,"-").concat(l.v4())),fe=t.useRef("".concat(l.v4())),ge=o,pe=t.useRef(null),_e=t.useRef(!0),Ce=t.useRef(null),xe=t.useRef(null),ye=t.useState(""),Se=ye[0],be=ye[1],we=t.useState([]),je=we[0],ke=we[1],Ee=t.useState(!1),Te=Ee[0],Me=Ee[1],Re=t.useState(!1);Re[0];var Ae=Re[1],Ie=t.useState(!0),Ne=Ie[0],De=Ie[1],qe=t.useState(!0);qe[0];var Fe=qe[1],Le=t.useState("");Le[0];var We=Le[1],Pe=t.useState(""),Be=Pe[0],ze=Pe[1],He=t.useState(!1),Ge=He[0],Oe=He[1],Ue=t.useState(!1),Ze=Ue[0],Ke=Ue[1],Ve=t.useState(!0),Qe=Ve[0],Je=Ve[1],$e=t.useState("100%");$e[0];var Xe=$e[1],Ye=t.useState(null),en=Ye[0],nn=Ye[1],tn=t.useState(!1);tn[0];var an=tn[1],sn=t.useState(!1),rn=sn[0],on=sn[1],ln=t.useRef(null),un=t.useRef(new Set),dn=t.useState(null),cn=dn[0],vn=dn[1],mn=t.useState(!1),hn=mn[0],fn=mn[1],gn=t.useState(!1);gn[0],gn[1];var pn=t.useState(null);pn[0],pn[1],t.useRef(null),t.useRef(null);var _n=t.useRef(new Map),Cn=t.useRef(""),xn=t.useRef(new Map),yn=t.useRef(!1),Sn=t.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 bn=t.useMemo(function(){return""===(null==Se?void 0:Se.trim())||Ge},[Se,Ge]),wn=t.useMemo(function(){return q},[q]),jn=t.useMemo(function(){var e;return je.length>0&&"user"===(null===(e=je[je.length-1])||void 0===e?void 0:e.role)},[je]),kn=t.useMemo(function(){return bn||q||!!ce||jn},[bn,q,ce,jn]);t.useEffect(function(){null==re||re(Ge)},[Ge,re]),t.useEffect(function(){return function(){Sn.current&&clearTimeout(Sn.current)}},[]),t.useEffect(function(){var e=pe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,a=e.clientHeight;Je(t-n-a<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[je]);var En=C.useHeaderObserver({handlers:W,setResult:P}).processHeaderMessage;t.useEffect(function(){X&&on(!0)},[X]),t.useEffect(function(){if(hn){var e=setTimeout(function(){fn(!1)},3e3);return function(){return clearTimeout(e)}}},[hn]),t.useEffect(function(){R&&!ce&&(qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),A(!1))},[R]),t.useEffect(function(){if(N)try{if(N.startsWith("__SKELETON__:")){var n=N.split(":"),t=n[1],a=n.slice(2).join(":"),s={role:"user",content:"",id:t,time:new Date,isSkeleton:!0,skeletonContent:a};return ke(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[s],!1)}),qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,t),vn(t),D&&D(""),void setTimeout(function(){vn(null)},2e3)}if(N.startsWith("__SKELETON_END__::")){var i=N.split("::")[1]||"";return ke(function(n){return n.map(function(n){return n.isSkeleton?e.__assign(e.__assign({},n),{isSkeleton:!1,content:n.skeletonContent||i}):n})}),void(D&&D(""))}var r=l.v4();qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,N,!1,r),vn(r),D&&D(""),setTimeout(function(){return vn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[N]),t.useEffect(function(){Mn(),Rn();var e=function(){var e,n=(null===(e=null==ln?void 0:ln.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");Xe(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Tn=t.useCallback(function(e){var n="string"==typeof e?e:"smooth";Ce.current&&Ce.current.scrollIntoView({behavior:n,block:"end"}),_e.current&&setTimeout(function(){Ce.current&&_e.current&&Ce.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);t.useEffect(function(){if(!Ge){var n="";if(rn?n=Y||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(n=ae||"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};ke(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[t],!1)}),on(!1),setTimeout(function(){return Tn("smooth")},100)}}},[rn,ne,Ge,Y,ae,Tn]),t.useEffect(function(){_e.current&&Tn("smooth")},[Tn]);var Mn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(ge,"/api/chatbot/getChatSettings?name=").concat(me,"&organizationName=").concat(r),headers:{}};T.default.request(e).then(function(e){var n,t,a;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&Fe(!0)}).catch(function(e){console.error(e)})},Rn=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){n="".concat(ge,"/api/chat/history?name=").concat(me,"&organizationName=").concat(r);try{t={method:"GET",params:{guestSessionId:he.current},withCredentials:!0},T.default.get(n,t).then(function(e){var n=e.data;n.length>0?(ke(n),Tn()):Fe(!0)}).catch(function(e){console.error(e)})}catch(e){Me(!1),console.error(e)}return[2]})})};function An(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var In=function(n,t,a,s,i,r,o){var u,d,c,v,m,h,f,g,p,_,C,x,y,S,b,w,j,k,E,T,M,R,A,I,N,D,q,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 P={header_message:n.chatStream.continueChatResult.header_message,responsedata:null===(m=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===m?void 0:m.content};En(P)}var B=null===(h=null==n?void 0:n.chatStream)||void 0===h?void 0:h.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 G={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(g=null==n?void 0:n.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: "))Ae(!0),G.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var a=e.substring(t+13);return null==a?void 0:a.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"),""!==G.content&&(Me(!1),ke(e.__spreadArray(e.__spreadArray([],je,!0),[{role:"user",content:i,time:s,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:""},G],!1)));else{Ae(!1);var O=null===(k=null===(j=null==n?void 0:n.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===k?void 0:k.requestId;"string"==typeof O&&O&&J&&J(O);var U=function(n,t,a,s){var i,r,o,u,d,c,v,m={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},h=(null===(i=null==n?void 0:n.chatStream)||void 0===i?void 0:i.continueChatResult)||{},f=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,p=null==h?void 0:h.isEnd,_=(null===(r=null==h?void 0:h.message)||void 0===r?void 0:r.content)||"",C=null==h?void 0:h.is_orchestrator,x=null==h?void 0:h.thinking_break,y=(null===(o=null==h?void 0:h.message)||void 0===o?void 0:o.citations)||[];if(f&&g&&_&&!p){var S=s.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),s.current.set(f,S))}var b=(f&&s.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(m.content=An(w),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&t.push({responsedata:_,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 E=h.explainability_id,T=h.responded_by;a.has(E)||a.set(E,{responded_by:T,index:t.length})}a.has(h.explainability_id)?t[null==(M=a.get(h.explainability_id))?void 0:M.index]={responsedata:_,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:t=e.__spreadArray(e.__spreadArray([],t,!0),[{responsedata:_,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 M;h.explainability_id&&h.responded_by&&(E=h.explainability_id,T=h.responded_by,a.has(E)||a.set(E,{responded_by:T,index:t.length})),a.has(h.explainability_id)?t[null==(M=a.get(h.explainability_id))?void 0:M.index]={responsedata:_,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:t.push({responsedata:_,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 e.__assign({orchestratorAndAgentsMessages:t},m)}(n,a,t,xn);U.time=new Date,U.citations=H,U.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,U.requestId=null===(R=null===(M=null==n?void 0:n.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===R?void 0:R.requestId,U.sessionId=he.current,null===(A=U.orchestratorAndAgentsMessages)||void 0===A||A.forEach(function(e){e&&e.header_message&&En(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Me(!1),ke(e.__spreadArray(e.__spreadArray([],je,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:r||!1,id:o||(null===(N=null===(I=null==n?void 0:n.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId)||"",requestId:null!==(F=null===(q=null===(D=null==n?void 0:n.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==F?F:""},U],!1))),De(null===(W=null===(L=null==n?void 0:n.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Nn=t.useCallback(function(){console.error("Stream failed or timed out due to inactivity."),yn.current=!1,De(!0),Oe(!1),an(!1),Me(!1),Ae(!1),Cn.current&&b&&u.stopStreaming(Cn.current,b,!1),ke(function(n){var t=e.__spreadArray([],n,!0).reverse().find(function(e){return"user"===e.role}),a=((null==t?void 0:t.content)||"").replace(/"/g,"&quot;");return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:'Something went wrong—teaching is taking longer than expected. 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]),Dn=t.useCallback(function(){Sn.current&&(clearTimeout(Sn.current),Sn.current=null),ve&&ve>0&&(Sn.current=setTimeout(Nn,ve))},[Nn,ve]),qn=function(n,t,a,s,i,o){var d,c,v,m,h,f,g=(void 0!==a?a:Se||"").trim(),p="Enter"===(null==n?void 0:n.key)&&!(null==n?void 0:n.shiftKey)&&!ce;p&&(null===(d=null==n?void 0:n.preventDefault)||void 0===d||d.call(n));var _="user"===(null===(c=je[je.length-1])||void 0===c?void 0:c.role);if(!(!g||Ge||yn.current||_||(null==n?void 0:n.key)&&!p)){if(yn.current=!0,"I want to add a rule description"===g){De(!1),_e.current=!0,Oe(!0),!en&&g&&nn(a||"manual_entry");var C=new Date;return ke(function(n){return e.__spreadArray(e.__spreadArray([],n.map(function(n,t){var a;return e.__assign(e.__assign({},n),{content:null===(a=An(n.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:g,time:C,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Tn("smooth"),void setTimeout(function(){ke(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)}),Tn("smooth"),setTimeout(function(){Oe(!1),De(!0)},500)},500)}De(!1),_e.current=!0,Oe(!0),!en&&g&&nn(a||"manual_entry");var x=new Date;ke(function(n){var t=n.map(function(n){var t;return e.__assign(e.__assign({},n),{content:null===(t=An(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:g}):n}):e.__spreadArray(e.__spreadArray([],t,!0),[{role:"user",content:g,time:x,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Tn("smooth");var y=new Map,S=[],w={WEBSOCKET_URL:b,organizationName:r,chatAssistantName:me,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(v=null==de?void 0:de.name)&&void 0!==v?v:"Guest User",userEmailId:null!==(m=null==de?void 0:de.email)&&void 0!==m?m:"guestUser@example.com",userId:null!==(h=null==de?void 0:de.id)&&void 0!==h?h:"Guest User",query:g,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:he.current,chatPreviewId:fe.current,customMetaData:L,aiModel:"",onStreamEvent:function(e){Dn(),In(e,y,S,x,g,t,i)},onStreamEnd:function(n){Sn.current&&clearTimeout(Sn.current),yn.current=!1,De(!0),Oe(!1),an(!1);var t=Date.now(),a=_n.current.get(Cn.current);if(a){var s=Math.round((t-a)/1e3).toFixed(1);ke(function(n){var t=e.__spreadArray([],n,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===t)return n;var a=n.length-1-t;return n.map(function(n,t){return t===a?e.__assign(e.__assign({},n),{finalTimeTaken:s}):n})})}},onError:function(e){Sn.current&&clearTimeout(Sn.current),console.error("Stream error:",e),Nn()}};if(g)Me(!0),null===(f=xe.current)||void 0===f||f.blur(),be(""),Tn(),ze(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."),_n.current.set(w.requestId,Date.now()),Cn.current=w.requestId,Dn(),u.startChatStream(w);o&&o(!1)}},Fn=t.useRef(null);t.useLayoutEffect(function(){Fn.current=qn});var Ln=t.useCallback(function(){for(var n,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return null===(n=Fn.current)||void 0===n?void 0:n.call.apply(n,e.__spreadArray([Fn],t,!1))},[]),Wn=t.useMemo(function(){return{p:function(t){t.node;var a=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:a}))},button:function(t){t.node;var a=t.className,s=t.children,i=e.__rest(t,["node","className","children"]),r=C.extractTextFromChildren(s),o=i["data-value"],l=en===r||en===o,u=!!en||!!ce,d="Tester Genie"===r;return n.jsx(h.ActionableButton,e.__assign({},i,{className:a,handleStream:Ln,isStreamEnd:Ne,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":en?"false":void 0},{children:n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,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"})]}))]}))}))}}},[Ln,Ne,en,ce]),Pn=t.useMemo(function(){return je.some(function(e){return e.isSkeleton})},[je]),Bn=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(),ke(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 Tn("smooth")},100),t.label=2;case 2:return[2]}})})};return n.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!Pn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[n.jsxs("div",e.__assign({ref:pe,className:g.default.scrollWrapper},{children:[n.jsx("div",e.__assign({ref:ln,className:g.default.stickyHeader},{children:n.jsx(c.default,{resetChatHistory:function(){var e="".concat(ge,"/api/chat/resetHistory?name=").concat(me,"&organizationName=").concat(r);try{var n={method:"GET",params:{guestSessionId:he.current},withCredentials:!0};T.default.get(e,n).then(function(){M(!0),We(""),nn(null),un.current.clear(),xn.current.clear(),fe.current="".concat(l.v4()),ke([]),Fe(!0),null==B||B(),I&&I()}).catch(function(e){console.error(e)}).finally(function(){he.current="".concat(me,"-").concat(r,"-").concat(l.v4())})}catch(e){Me(!1),console.error(e)}},isStreamEnd:Ne,chatTitle:F,onResize:U,chatSize:O,movingTowards:Z})})),n.jsxs("div",e.__assign({className:g.default.messagesList},{children:[n.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:n.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:n.jsx("span",{children:n.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:Wn},{children:H}))})}))}))]})),je.length>0&&je.map(function(t,a){var s,i;return n.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===t.role?n.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:n.jsx(y.default,{})})):n.jsx("div",{className:g.default.userSpacer}),n.jsx("div",e.__assign({className:g.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:Ne,finalTimeTaken:null==t?void 0:t.finalTimeTaken},null!==(s=null==t?void 0:t.finalTimeTaken)&&void 0!==s?s:null==t?void 0:t.id),n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:je,handleStream:qn,isLastMessage:a===je.length-1,onSave:G,citations:null==t?void 0:t.citations,setChatSize:U,chatSize:O,isStreamEnd:Ne,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onTypeResponseClick:function(){var e;fn(!0),null===(e=xe.current)||void 0===e||e.focus()},onComparisonLinkClick:le,baseURL:ge,onFeedbackSubmit:Bn,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(m.Skeleton,{variant:"text",width:"50%",height:20}),n.jsx("div",{style:{marginTop:"10px"}}),n.jsx(m.Skeleton,{variant:"text",width:"100%",height:40})]}),n.jsx("div",e.__assign({className:g.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:g.default.userMessageWrapper},{children:[n.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:t.isSkeleton||Pn||t.id!==cn?"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(m.Skeleton,{variant:"text",width:"100%",height:16}),n.jsx(m.Skeleton,{variant:"text",width:"80%",height:16})]})):n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:je,handleStream:qn,isLastMessage:a===je.length-1,onSave:G,citations:null==t?void 0:t.citations,isStreamEnd:Ne,isGlobalEditActive:ce,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onComparisonLinkClick:le,baseURL:ge,onFeedbackSubmit:Bn}),n.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:n.jsx(S.UserIcon,{})}))]})),n.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),t.id)}),Te&&n.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:n.jsx("span",{children:Be})}))]})),n.jsx("div",{ref:Ce,style:{float:"left",clear:"both"}})]}))]})),n.jsx("div",e.__assign({className:g.default.inputAreaWrapper},{children:n.jsx(j.default,e.__assign({title:q?"Please wait for the validation to be completed.":""},{children:n.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(wn?g.default.disabled:""),style:hn?{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:[je.length>0&&!Qe&&n.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Tn("smooth")},className:g.default.scrollToBottomBtn},{children:n.jsx(_.ScrollToBottom,{})})),n.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[n.jsx("textarea",{ref:xe,placeholder:Q,value:Se||"",onChange:function(e){be(e.target.value)},onFocus:function(){return Ke(!0)},onBlur:function(){return Ke(!1)},onKeyDown:function(e){return qn(e)},disabled:wn,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ze?"120px":"50px",height:Ze?"120px":"50px",maxHeight:"120px"}}),n.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:n.jsx("button",e.__assign({onClick:function(e){kn||qn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:kn,className:"".concat(g.default.sendButton," ").concat(kn?g.default.disabled:g.default.active)},{children:n.jsx(x.SendButton,{})}))}))]}))]}))}))})),n.jsxs("div",e.__assign({className:g.default.footerTools},{children:[n.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:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n.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:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.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"),a=require("@mui/material"),s=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"),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(s),k=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(s){var i=s.chatAssistantName,r=s.organizationName,o=s.baseUrl,b=s.baseWebsocketUrl,M=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var R=s.isFormSaveClicked,A=s.setIsFormSavedClicked,I=s.onResetLearningData,N=s.sendMessageInChat,D=s.setSendMessageInChat,q=s.isFormValidating,F=s.chatTitle,L=s.customMetaData,W=s.headerMessageHandlers;s.aiResponse;var P=s.setAIResponse,B=s.onResetChat,z=s.initialChatMessage,H=void 0===z?"":z,G=s.onSave,O=s.chatSize,U=s.setChatSize,Z=s.movingTowards,K=s.setCitations,V=s.textareaPlaceholder,Q=void 0===V?"Tell me more about this learning...":V,J=s.setCurrentRequestId,$=s.showSavedMessage,X=void 0!==$&&$,Y=s.savedMessage,ee=s.isError,ne=void 0!==ee&&ee,te=s.errorMessage,ae=void 0===te?"There was an error saving your changes.":te;s.isSaving;var se=s.isHighlighted,ie=void 0!==se&&se,re=s.onStreamingStateChange,oe=s.onViewComparison;s.isCopyEnabled;var le=s.onComparisonLinkClick,ue=s.onSubmitFeedback,de=s.userDetails,ce=s.isGlobalEditActive,ve=s.socketTimeOutInMilliSeconds,he=s.initialDraftMessage,me=void 0===he?"":he,fe=i,ge=t.useRef("".concat(fe,"-").concat(r,"-").concat(l.v4())),pe=t.useRef("".concat(l.v4())),_e=o,Ce=t.useRef(null),xe=t.useRef(!0),ye=t.useRef(null),Se=t.useRef(null),be=t.useState(me),we=be[0],je=be[1],ke=t.useState([]),Ee=ke[0],Te=ke[1],Me=t.useState(!1),Re=Me[0],Ae=Me[1],Ie=t.useState(!1);Ie[0];var Ne=Ie[1],De=t.useState(!0),qe=De[0],Fe=De[1],Le=t.useState(!0);Le[0];var We=Le[1],Pe=t.useState("");Pe[0];var Be=Pe[1],ze=t.useState(""),He=ze[0],Ge=ze[1],Oe=t.useState(!1),Ue=Oe[0],Ze=Oe[1],Ke=t.useState(!1),Ve=Ke[0],Qe=Ke[1],Je=t.useState(!0),$e=Je[0],Xe=Je[1],Ye=t.useState("100%");Ye[0];var en=Ye[1],nn=t.useState(null),tn=nn[0],an=nn[1],sn=t.useState(!1);sn[0];var rn=sn[1],on=t.useState(!1),ln=on[0],un=on[1],dn=t.useRef(null),cn=t.useRef(new Set),vn=t.useState(null),hn=vn[0],mn=vn[1],fn=t.useState(!1),gn=fn[0],pn=fn[1],_n=t.useState(!1);_n[0],_n[1];var Cn=t.useState(null);Cn[0],Cn[1],t.useRef(null),t.useRef(null);var xn=t.useRef(new Map),yn=t.useRef(""),Sn=t.useRef(new Map),bn=t.useRef(!1),wn=t.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 jn=t.useMemo(function(){return""===(null==we?void 0:we.trim())||Ue},[we,Ue]),kn=t.useMemo(function(){return q},[q]),En=t.useMemo(function(){var e;return Ee.length>0&&"user"===(null===(e=Ee[Ee.length-1])||void 0===e?void 0:e.role)},[Ee]),Tn=t.useMemo(function(){return jn||q||!!ce||En},[jn,q,ce,En]);t.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]),t.useEffect(function(){null==re||re(Ue)},[Ue,re]),t.useEffect(function(){return function(){wn.current&&clearTimeout(wn.current)}},[]),t.useEffect(function(){var e=Ce.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,a=e.clientHeight;Xe(t-n-a<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Ee]);var Mn=C.useHeaderObserver({handlers:W,setResult:P}).processHeaderMessage;t.useEffect(function(){X&&un(!0)},[X]),t.useEffect(function(){if(gn){var e=setTimeout(function(){pn(!1)},3e3);return function(){return clearTimeout(e)}}},[gn]),t.useEffect(function(){R&&!ce&&(Ln(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),A(!1))},[R]),t.useEffect(function(){if(N)try{if(N.startsWith("__SKELETON__:")){var n=N.split(":"),t=n[1],a=n.slice(2).join(":"),s={role:"user",content:"",id:t,time:new Date,isSkeleton:!0,skeletonContent:a};return Te(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[s],!1)}),Ln(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,t),mn(t),D&&D(""),void setTimeout(function(){mn(null)},2e3)}if(N.startsWith("__SKELETON_END__::")){var i=N.split("::")[1]||"";return Te(function(n){return n.map(function(n){return n.isSkeleton?e.__assign(e.__assign({},n),{isSkeleton:!1,content:n.skeletonContent||i}):n})}),void(D&&D(""))}var r=l.v4();Ln(new KeyboardEvent("keydown",{key:"Enter"}),!1,N,!1,r),mn(r),D&&D(""),setTimeout(function(){return mn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[N]),t.useEffect(function(){An(),In();var e=function(){var e,n=(null===(e=null==dn?void 0:dn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");en(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Rn=t.useCallback(function(e){var n="string"==typeof e?e:"smooth";ye.current&&ye.current.scrollIntoView({behavior:n,block:"end"}),xe.current&&setTimeout(function(){ye.current&&xe.current&&ye.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);t.useEffect(function(){if(!Ue){var n="";if(ln?n=Y||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(n=ae||"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};Te(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[t],!1)}),un(!1),setTimeout(function(){return Rn("smooth")},100)}}},[ln,ne,Ue,Y,ae,Rn]),t.useEffect(function(){xe.current&&Rn("smooth")},[Rn]);var An=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 n,t,a;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&We(!0)}).catch(function(e){console.error(e)})},In=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){n="".concat(_e,"/api/chat/history?name=").concat(fe,"&organizationName=").concat(r);try{t={method:"GET",params:{guestSessionId:ge.current},withCredentials:!0},T.default.get(n,t).then(function(e){var n=e.data;n.length>0?(Te(n),Rn()):We(!0)}).catch(function(e){console.error(e)})}catch(e){Ae(!1),console.error(e)}return[2]})})};function Nn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Dn=function(n,t,a,s,i,r,o){var u,d,c,v,h,m,f,g,p,_,C,x,y,S,b,w,j,k,E,T,M,R,A,I,N,D,q,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 P={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};Mn(P)}var B=null===(m=null==n?void 0:n.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 G={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(g=null==n?void 0:n.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: "))Ne(!0),G.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var a=e.substring(t+13);return null==a?void 0:a.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"),""!==G.content&&(Ae(!1),Te(e.__spreadArray(e.__spreadArray([],Ee,!0),[{role:"user",content:i,time:s,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:""},G],!1)));else{Ne(!1);var O=null===(k=null===(j=null==n?void 0:n.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===k?void 0:k.requestId;"string"==typeof O&&O&&J&&J(O);var U=function(n,t,a,s){var i,r,o,u,d,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},m=(null===(i=null==n?void 0:n.chatStream)||void 0===i?void 0:i.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=s.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),s.current.set(f,S))}var b=(f&&s.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=Nn(w),!0===(null==m?void 0:m.thinking_break)&&!0===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)&&t.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:t.length})}a.has(m.explainability_id)?t[null==(M=a.get(m.explainability_id))?void 0:M.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}:t=e.__spreadArray(e.__spreadArray([],t,!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 M;m.explainability_id&&m.responded_by&&(E=m.explainability_id,T=m.responded_by,a.has(E)||a.set(E,{responded_by:T,index:t.length})),a.has(m.explainability_id)?t[null==(M=a.get(m.explainability_id))?void 0:M.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}:t.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:t},h)}(n,a,t,Sn);U.time=new Date,U.citations=H,U.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,U.requestId=null===(R=null===(M=null==n?void 0:n.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===R?void 0:R.requestId,U.sessionId=ge.current,null===(A=U.orchestratorAndAgentsMessages)||void 0===A||A.forEach(function(e){e&&e.header_message&&Mn(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Ae(!1),Te(e.__spreadArray(e.__spreadArray([],Ee,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:r||!1,id:o||(null===(N=null===(I=null==n?void 0:n.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId)||"",requestId:null!==(F=null===(q=null===(D=null==n?void 0:n.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==F?F:""},U],!1))),Fe(null===(W=null===(L=null==n?void 0:n.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},qn=t.useCallback(function(){console.error("Stream failed or timed out due to inactivity."),bn.current=!1,Fe(!0),Ze(!1),rn(!1),Ae(!1),Ne(!1),yn.current&&b&&u.stopStreaming(yn.current,b,!1),Te(function(n){var t=e.__spreadArray([],n,!0).reverse().find(function(e){return"user"===e.role}),a=((null==t?void 0:t.content)||"").replace(/"/g,"&quot;");return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:'Something went wrong—teaching is taking longer than expected. 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]),Fn=t.useCallback(function(){wn.current&&(clearTimeout(wn.current),wn.current=null),ve&&ve>0&&(wn.current=setTimeout(qn,ve))},[qn,ve]),Ln=function(n,t,a,s,i,o){var d,c,v,h,m,f,g=(void 0!==a?a:we||"").trim(),p="Enter"===(null==n?void 0:n.key)&&!(null==n?void 0:n.shiftKey)&&!ce;p&&(null===(d=null==n?void 0:n.preventDefault)||void 0===d||d.call(n));var _="user"===(null===(c=Ee[Ee.length-1])||void 0===c?void 0:c.role);if(!(!g||Ue||bn.current||_||(null==n?void 0:n.key)&&!p)){if(bn.current=!0,"I want to add a rule description"===g){Fe(!1),xe.current=!0,Ze(!0),!tn&&g&&an(a||"manual_entry");var C=new Date;return Te(function(n){return e.__spreadArray(e.__spreadArray([],n.map(function(n,t){var a;return e.__assign(e.__assign({},n),{content:null===(a=Nn(n.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:g,time:C,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Rn("smooth"),void setTimeout(function(){Te(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)}),Rn("smooth"),setTimeout(function(){Ze(!1),Fe(!0)},500)},500)}Fe(!1),xe.current=!0,Ze(!0),!tn&&g&&an(a||"manual_entry");var x=new Date;Te(function(n){var t=n.map(function(n){var t;return e.__assign(e.__assign({},n),{content:null===(t=Nn(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:g}):n}):e.__spreadArray(e.__spreadArray([],t,!0),[{role:"user",content:g,time:x,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),Rn("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:L,aiModel:"",onStreamEvent:function(e){Fn(),Dn(e,y,S,x,g,t,i)},onStreamEnd:function(n){wn.current&&clearTimeout(wn.current),bn.current=!1,Fe(!0),Ze(!1),rn(!1);var t=Date.now(),a=xn.current.get(yn.current);if(a){var s=Math.round((t-a)/1e3).toFixed(1);Te(function(n){var t=e.__spreadArray([],n,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===t)return n;var a=n.length-1-t;return n.map(function(n,t){return t===a?e.__assign(e.__assign({},n),{finalTimeTaken:s}):n})})}},onError:function(e){wn.current&&clearTimeout(wn.current),console.error("Stream error:",e),qn()}};if(g)Ae(!0),null===(f=Se.current)||void 0===f||f.blur(),je(""),Rn(),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."),xn.current.set(w.requestId,Date.now()),yn.current=w.requestId,Fn(),u.startChatStream(w);o&&o(!1)}},Wn=t.useRef(null);t.useLayoutEffect(function(){Wn.current=Ln});var Pn=t.useCallback(function(){for(var n,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return null===(n=Wn.current)||void 0===n?void 0:n.call.apply(n,e.__spreadArray([Wn],t,!1))},[]),Bn=t.useMemo(function(){return{p:function(t){t.node;var a=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:a}))},button:function(t){t.node;var a=t.className,s=t.children,i=e.__rest(t,["node","className","children"]),r=C.extractTextFromChildren(s),o=i["data-value"],l=tn===r||tn===o,u=!!tn||!!ce,d="Tester Genie"===r;return n.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:Pn,isStreamEnd:qe,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":tn?"false":void 0},{children:n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,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"})]}))]}))}))}}},[Pn,qe,tn,ce]),zn=t.useMemo(function(){return Ee.some(function(e){return e.isSkeleton})},[Ee]),Hn=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(),Te(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 Rn("smooth")},100),t.label=2;case 2:return[2]}})})};return n.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!zn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[n.jsxs("div",e.__assign({ref:Ce,className:g.default.scrollWrapper},{children:[n.jsx("div",e.__assign({ref:dn,className:g.default.stickyHeader},{children:n.jsx(c.default,{resetChatHistory:function(){var e="".concat(_e,"/api/chat/resetHistory?name=").concat(fe,"&organizationName=").concat(r);try{var n={method:"GET",params:{guestSessionId:ge.current},withCredentials:!0};T.default.get(e,n).then(function(){M(!0),Be(""),an(null),cn.current.clear(),Sn.current.clear(),pe.current="".concat(l.v4()),Te([]),We(!0),null==B||B(),I&&I()}).catch(function(e){console.error(e)}).finally(function(){ge.current="".concat(fe,"-").concat(r,"-").concat(l.v4())})}catch(e){Ae(!1),console.error(e)}},isStreamEnd:qe,chatTitle:F,onResize:U,chatSize:O,movingTowards:Z})})),n.jsxs("div",e.__assign({className:g.default.messagesList},{children:[n.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:n.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:n.jsx("span",{children:n.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:Bn},{children:H}))})}))}))]})),Ee.length>0&&Ee.map(function(t,a){var s,i;return n.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===t.role?n.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:n.jsx(y.default,{})})):n.jsx("div",{className:g.default.userSpacer}),n.jsx("div",e.__assign({className:g.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:qe,finalTimeTaken:null==t?void 0:t.finalTimeTaken},null!==(s=null==t?void 0:t.finalTimeTaken)&&void 0!==s?s:null==t?void 0:t.id),n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:Ee,handleStream:Ln,isLastMessage:a===Ee.length-1,onSave:G,citations:null==t?void 0:t.citations,setChatSize:U,chatSize:O,isStreamEnd:qe,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onTypeResponseClick:function(){var e;pn(!0),null===(e=Se.current)||void 0===e||e.focus()},onComparisonLinkClick:le,baseURL:_e,onFeedbackSubmit:Hn,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:g.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:g.default.userMessageWrapper},{children:[n.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:t.isSkeleton||zn||t.id!==hn?"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:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:Ee,handleStream:Ln,isLastMessage:a===Ee.length-1,onSave:G,citations:null==t?void 0:t.citations,isStreamEnd:qe,isGlobalEditActive:ce,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:oe,onComparisonLinkClick:le,baseURL:_e,onFeedbackSubmit:Hn}),n.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:n.jsx(S.UserIcon,{})}))]})),n.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),t.id)}),Re&&n.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:n.jsx("span",{children:He})}))]})),n.jsx("div",{ref:ye,style:{float:"left",clear:"both"}})]}))]})),n.jsx("div",e.__assign({className:g.default.inputAreaWrapper},{children:n.jsx(j.default,e.__assign({title:q?"Please wait for the validation to be completed.":""},{children:n.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(kn?g.default.disabled:""),style:gn?{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&&n.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Rn("smooth")},className:g.default.scrollToBottomBtn},{children:n.jsx(_.ScrollToBottom,{})})),n.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[n.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 Ln(e)},disabled:kn,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"}}),n.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:n.jsx("button",e.__assign({onClick:function(e){Tn||Ln(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Tn,className:"".concat(g.default.sendButton," ").concat(Tn?g.default.disabled:g.default.active)},{children:n.jsx(x.SendButton,{})}))}))]}))]}))}))})),n.jsxs("div",e.__assign({className:g.default.footerTools},{children:[n.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:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n.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:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
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"),s=require("../../molecules/Sections/SectionWrapper.js"),n=require("../../_svg/CognitiveDecisioning.js"),t=require("lucide-react"),o=require("../../TooltipComponent.js");exports.ScopeSection=function(r){var l=r.id,a=r.title,c=void 0===a?"Scope":a,d=r.required,p=void 0!==d&&d,g=r.openSections,x=r.setOpenSections,h=r.scopeData,u=r.onScopeChange;r.stationOptions;var v=r.tierOptions,_=void 0===v?[]:v;r.stationLabel;var y=r.tierLabel,f=void 0===y?"Where should this rule apply?":y,j=r.highlights,m=void 0===j?{}:j,b=r.isOpen,C=r.onToggle,w=r.showCognitiveIcon,S=r.cognitiveIcon,k=r.tooltipDescription,O=r.errorMessage,I=r.stationErrorMessage,L=r.tierErrorMessage,q=e.__rest(r,["id","title","required","openSections","setOpenSections","scopeData","onScopeChange","stationOptions","tierOptions","stationLabel","tierLabel","highlights","isOpen","onToggle","showCognitiveIcon","cognitiveIcon","tooltipDescription","errorMessage","stationErrorMessage","tierErrorMessage"]);return i.jsx(s.SectionWrapper,e.__assign({id:l,title:c,required:p,openSections:g,setOpenSections:x},q,{children:i.jsxs("div",e.__assign({className:"scope-content"},{children:[_.length>0&&i.jsxs("div",e.__assign({className:"form-group"},{children:[i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",marginBottom:"4px"}},{children:[i.jsx("span",e.__assign({style:{color:"#8F2C23",lineHeight:1}},{children:"*"})),i.jsx("label",e.__assign({className:(null==q?void 0:q.readOnly)?"readOnly":"form-label",style:{margin:0}},{children:f}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}},{children:[i.jsx("div",e.__assign({className:"checkbox-group",style:{display:"flex",gap:"16px"}},{children:_.map(function(s){var n,t,o=m["scope_".concat(s)],r="tier-".concat(l,"-").concat(s.replace(/\s+/g,"-").toLowerCase());return i.jsxs("div",e.__assign({className:"checkbox-item",style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[i.jsx("input",{type:"checkbox",id:r,checked:null===(n=h.tiers)||void 0===n?void 0:n.includes(s),onChange:function(){var i=h.tiers||[],n=i.includes(s)?i.filter(function(e){return e!==s}):e.__spreadArray(e.__spreadArray([],i,!0),[s],!1);u("tiers",n)},disabled:(null==q?void 0:q.readOnly)||!1,style:{position:"absolute",opacity:0,cursor:"pointer",width:"16px",height:"16px",zIndex:1}}),i.jsx("div",e.__assign({style:{width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",boxShadow:o?"0 0 14px 4px rgba(37, 99, 235, 0.35)":"none"}},{children:(null===(t=h.tiers)||void 0===t?void 0:t.includes(s))?i.jsxs("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i.jsx("path",{d:"M4 0.25H10C12.0711 0.25 13.75 1.92893 13.75 4V10C13.75 12.0711 12.0711 13.75 10 13.75H4C1.92893 13.75 0.25 12.0711 0.25 10V4C0.25 1.92893 1.92893 0.25 4 0.25Z",fill:"#2563EB",stroke:"#2563EB","stroke-width":"0.5"}),i.jsx("path",{d:"M4 7L6 9L10 5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})):i.jsx("div",{style:{width:"14px",height:"14px",border:"1px solid #64748B",borderRadius:"4px",backgroundColor:"white"}})})),i.jsx("label",e.__assign({style:{color:(null==q?void 0:q.readOnly)?"#9CA3AF":void 0,cursor:(null==q?void 0:q.readOnly)?"not-allowed":"pointer",margin:0,fontSize:"14px"},htmlFor:"tier-".concat(l,"-").concat(s.toLowerCase().replace(/\s+/g,"-"))},{children:s}))]}),r)})})),i.jsx("div",e.__assign({style:{width:"fit-content"}},{children:i.jsx(o.default,e.__assign({description:null!=k?k:""},{children:w&&i.jsxs("button",e.__assign({onClick:function(e){e.preventDefault(),null==C||C()},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"2px",padding:"2px 6px ",flexShrink:0,border:"none",backgroundColor:"transparent",borderRadius:"4px",cursor:"pointer",outline:"none",maxWidth:"fit-content",transition:"background-color 0.2s ease",marginTop:"6px",marginLeft:"6px"}},{children:[S||i.jsx(n.default,{}),b?i.jsx(t.ChevronUpIcon,{size:16}):i.jsx(t.ChevronDownIcon,{size:16})]}))}))}))]})),L&&i.jsx("div",e.__assign({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:L}))]})),O&&!I&&!L&&i.jsx("div",e.__assign({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:O}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),s=require("../../molecules/Sections/SectionWrapper.js"),n=require("../../_svg/CognitiveDecisioning.js"),o=require("lucide-react"),t=require("../../TooltipComponent.js");exports.ScopeSection=function(r){var l=r.id,a=r.title,c=void 0===a?"Scope":a,d=r.required,p=void 0!==d&&d,g=r.openSections,x=r.setOpenSections,h=r.scopeData,u=r.onScopeChange;r.stationOptions;var v=r.tierOptions,_=void 0===v?[]:v;r.stationLabel;var b=r.tierLabel,y=void 0===b?"Where should this rule apply?":b,j=r.highlights,f=void 0===j?{}:j,m=r.isOpen,S=r.onToggle,C=r.showCognitiveIcon,O=r.cognitiveIcon,w=r.tooltipDescription,I=r.errorMessage,k=r.stationErrorMessage,q=r.tierErrorMessage,z=e.__rest(r,["id","title","required","openSections","setOpenSections","scopeData","onScopeChange","stationOptions","tierOptions","stationLabel","tierLabel","highlights","isOpen","onToggle","showCognitiveIcon","cognitiveIcon","tooltipDescription","errorMessage","stationErrorMessage","tierErrorMessage"]);return i.jsx(s.SectionWrapper,e.__assign({id:l,title:c,required:p,openSections:g,setOpenSections:x},z,{children:i.jsxs("div",e.__assign({className:"scope-content"},{children:[_.length>0&&i.jsxs("div",e.__assign({className:"form-group"},{children:[i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",marginBottom:"4px"}},{children:[i.jsx("span",e.__assign({style:{color:"#8F2C23",lineHeight:1}},{children:"*"})),i.jsx("label",e.__assign({className:(null==z?void 0:z.readOnly)?"readOnly":"form-label",style:{margin:0}},{children:y}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}},{children:[i.jsx("div",e.__assign({className:"checkbox-group",style:{display:"flex",gap:"16px"}},{children:_.map(function(s){var n,o,t=f["scope_".concat(s)],r="tier-".concat(l,"-").concat(s.replace(/\s+/g,"-").toLowerCase());return i.jsxs("div",e.__assign({className:"checkbox-item",style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[i.jsx("input",{type:"radio",name:"scope-tiers-".concat(l),id:r,checked:null===(n=h.tiers)||void 0===n?void 0:n.includes(s),onChange:function(){u("tiers",[s])},disabled:(null==z?void 0:z.readOnly)||!1,style:{position:"absolute",opacity:0,cursor:"pointer",width:"16px",height:"16px",zIndex:1}}),i.jsx("div",e.__assign({style:{width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",boxShadow:t?"0 0 14px 4px rgba(37, 99, 235, 0.35)":"none",borderRadius:"50%"}},{children:(null===(o=h.tiers)||void 0===o?void 0:o.includes(s))?i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",border:"5px solid #2563EB",backgroundColor:"white",boxSizing:"border-box"}}):i.jsx("div",{style:{width:"16px",height:"16px",border:"1px solid #64748B",borderRadius:"50%",backgroundColor:"white",boxSizing:"border-box"}})})),i.jsx("label",e.__assign({style:{color:(null==z?void 0:z.readOnly)?"#9CA3AF":void 0,cursor:(null==z?void 0:z.readOnly)?"not-allowed":"pointer",margin:0,fontSize:"14px"},htmlFor:r},{children:s}))]}),r)})})),i.jsx("div",e.__assign({style:{width:"fit-content"}},{children:i.jsx(t.default,e.__assign({description:null!=w?w:""},{children:C&&i.jsxs("button",e.__assign({onClick:function(e){e.preventDefault(),null==S||S()},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"2px",padding:"2px 6px ",flexShrink:0,border:"none",backgroundColor:"transparent",borderRadius:"4px",cursor:"pointer",outline:"none",maxWidth:"fit-content",transition:"background-color 0.2s ease",marginTop:"6px",marginLeft:"6px"}},{children:[O||i.jsx(n.default,{}),m?i.jsx(o.ChevronUpIcon,{size:16}):i.jsx(o.ChevronDownIcon,{size:16})]}))}))}))]})),q&&i.jsx("div",e.__assign({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:q}))]})),I&&!k&&!q&&i.jsx("div",e.__assign({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:I}))]}))}))};
2
2
  //# sourceMappingURL=ScopeSection.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),t=require("../../InputDataReasoningCard.js"),o=require("../../organisms/ConditionSection/ConditionSection.js"),l=require("../../organisms/ConfigSection/ConfigSection.js"),a=require("../../organisms/ScopeSection/ScopeSection.js"),r=require("../../organisms/TextSection/TextSection.js"),d=require("../../AccordianSection.js"),s=require("../../_svg/ButtonCognitiveIcon.js"),u=require("lucide-react");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var v=c(n),p=function(n){var t=n.children,o=n.onAddVariant,l=n.isDisabled,a=n.showAddVariantBtn,r=void 0===a||a,d=v.default.Children.toArray(t);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,n){var t=!(n===d.length-1)||r;return e.jsxs(v.default.Fragment,{children:[i,t&&e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},n)}),r&&e.jsx("div",i.__assign({onClick:l?void 0:o,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:l?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:l?"not-allowed":"pointer",backgroundColor:l?"#f8fafc":"#FFFFFF",opacity:l?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))};exports.CreateRule=function(c){var g,f,h,x,y,_,T,S,m,D,C,I,A=c.state,j=c.handlers,b=c.uiState,O=(null==b?void 0:b.highlights)||new Map,E=O.get("global_0")||{},w=n.useState({}),R=w[0],V=w[1],N=n.useState(null),W=N[0],q=N[1],B="rule-setup"===(null==b?void 0:b.activeEditId),M=v.default.useRef(new Map),F=n.useState(null),k=F[0],L=F[1],z=n.useState(null),P=z[0],J=z[1],H=n.useState(!1),K=H[0],$=H[1],U=v.default.useRef(null==b?void 0:b.isAiStreaming);n.useEffect(function(){U.current&&!(null==b?void 0:b.isAiStreaming)&&K&&$(!1),U.current=null==b?void 0:b.isAiStreaming},[null==b?void 0:b.isAiStreaming,K]);var Z=function(){var i;L(null),J(null),null===(i=null==b?void 0:b.setActiveEditId)||void 0===i||i.call(b,null)},G=function(){var i,e,n=null!=k?k:A.ruleTitle,t=null!=P?P:A.scopeData,o=n!==A.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(A.scopeData);if(!o&&!l)return L(null),J(null),void(null===(i=null==b?void 0:b.setActiveEditId)||void 0===i||i.call(b,null));if(null==b?void 0:b.setSendMessageInChat){var a="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),r=[];if(o&&r.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,s=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";r.push(s)}var u=r.join(" and ");b.setSendMessageInChat("__SKELETON__:".concat(a,":Update Rule Setup ").concat(u))}$(!0),L(null),J(null),null===(e=null==b?void 0:b.setActiveEditId)||void 0===e||e.call(b,null)},Q=null!==k?null==k?void 0:k.trim():(A.ruleTitle||"").trim(),X=null!=P?P:A.scopeData,Y=Q!==(A.ruleTitle||"").trim(),ii=JSON.stringify(X)!==JSON.stringify(A.scopeData),ei=!Y&&!ii||""===Q,ni=v.default.useRef(null==b?void 0:b.defaultVariantOpen),ti=v.default.useRef(null==b?void 0:b.activeVariantAccordionIndex),oi=v.default.useRef(null==b?void 0:b.defaultTierOpen),li=v.default.useRef(null===(g=A.scopeData)||void 0===g?void 0:g.tiers),ai=v.default.useRef(A.variantsByTier);v.default.useEffect(function(){var i,e,n,t,o,l,a=null,r=!1;ni.current!==(null==b?void 0:b.defaultVariantOpen)&&(r=!0,ni.current=null==b?void 0:b.defaultVariantOpen),ti.current!==(null==b?void 0:b.activeVariantAccordionIndex)&&(r=!0,ti.current=null==b?void 0:b.activeVariantAccordionIndex),oi.current!==(null==b?void 0:b.defaultTierOpen)&&(r=!0,oi.current=null==b?void 0:b.defaultTierOpen);var d=(null===(i=A.scopeData)||void 0===i?void 0:i.tiers)||[];JSON.stringify(li.current)!==JSON.stringify(d)&&(r=!0,li.current=d);var s=(null===(e=null==b?void 0:b.tierOptions)||void 0===e?void 0:e.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||[],u=s.some(function(i){var e,n,t,o,l=i.toLowerCase().replace(/ /g,"_");return((null===(n=null===(e=ai.current)||void 0===e?void 0:e[l])||void 0===n?void 0:n.length)||0)!==((null===(o=null===(t=A.variantsByTier)||void 0===t?void 0:t[l])||void 0===o?void 0:o.length)||0)});if(u&&(r=!0),r){var c=null!==(n=null==b?void 0:b.activeVariantAccordionIndex)&&void 0!==n?n:null==b?void 0:b.defaultVariantOpen;if(null==c||c<0)return q(null),void(ai.current=A.variantsByTier);s.forEach(function(i,e){var n;if(!((null==b?void 0:b.defaultTierOpen)>=0&&e!==b.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_"),o=(null===(n=A.variantsByTier)||void 0===n?void 0:n[t])||[];o[c]&&(a="".concat(t,"-variant-").concat(c)),null!=(null==b?void 0:b.autoScrollVariantIndex)&&o[b.autoScrollVariantIndex]&&(a="".concat(t,"-variant-").concat(b.autoScrollVariantIndex))}}),a&&q(a)}if(null===W){var v=null!==(t=null==b?void 0:b.activeVariantAccordionIndex)&&void 0!==t?t:null==b?void 0:b.defaultVariantOpen;null!=v&&v>=0&&(null===(l=null===(o=null==b?void 0:b.tierOptions)||void 0===o?void 0:o.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===l||l.forEach(function(i,e){var n;if(!((null==b?void 0:b.defaultTierOpen)>=0&&e!==b.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_");((null===(n=A.variantsByTier)||void 0===n?void 0:n[t])||[])[v]&&q("".concat(t,"-variant-").concat(v))}}))}ai.current=A.variantsByTier},[A.variantsByTier,null==b?void 0:b.defaultVariantOpen,null==b?void 0:b.activeVariantAccordionIndex,null===(f=A.scopeData)||void 0===f?void 0:f.tiers,null==b?void 0:b.tierOptions,null==b?void 0:b.autoScrollVariantIndex,null==b?void 0:b.defaultTierOpen]);var ri=function(e){V(function(n){var t;return i.__assign(i.__assign({},n),((t={})[e]=!n[e],t))})},di=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],a=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,r=null===(e=A.fieldCitations)||void 0===e?void 0:e[a];if(Array.isArray(r)&&r.length>0)return r;var d=null===(n=A.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=A.citations)&&void 0!==t?t:[]},si={marginTop:"-17px",position:"relative",zIndex:1};n.useEffect(function(){var i,e;null!=(null==b?void 0:b.autoScrollVariantIndex)&&(null===(e=null===(i=null==b?void 0:b.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(b.autoScrollVariantIndex),t=M.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==b?void 0:b.scrollTrigger]),console.log("CreateRule state:",A),console.log("CreateRule uiState:",b);var ui=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},ci=!!(null==b?void 0:b.activeEditId);return e.jsxs("div",i.__assign({className:"traffic-manager-template"},{children:[e.jsx("div",i.__assign({"data-edit-id":"rule-setup"},{children:e.jsx(d.default,i.__assign({title:{type:"other",label:(null==b?void 0:b.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(B)return null;var o=!!(null==b?void 0:b.activeEditId)&&"rule-setup"!==b.activeEditId;return e.jsx("div",i.__assign({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e.jsx("button",i.__assign({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==b?void 0:b.setPendingEditId)&&b.setPendingEditId(b.activeEditId||null):(!function(){var e,n;(null==b?void 0:b.activeEditId)&&"rule-setup"!==b.activeEditId||(null===(e=null==b?void 0:b.setActiveEditId)||void 0===e||e.call(b,"rule-setup"),L(null!==(n=A.ruleTitle)&&void 0!==n?n:""),J(A.scopeData?i.__assign({},A.scopeData):{}))}(),(null==b?void 0:b.setPendingEditId)&&b.setPendingEditId(null),n||t())},disabled:K,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:K?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:K?.5:1}},{children:e.jsx(u.Pencil,{size:14})}))}))},footerData:{ruleTitle:A.ruleTitle,stations:[A.scopeData.station],tiers:null===(h=A.scopeData)||void 0===h?void 0:h.tiers},defaultOpen:"Create"===(null==b?void 0:b.usedFor),readOnly:"Create"!==(null==b?void 0:b.usedFor),isAiStreaming:null==b?void 0:b.isAiStreaming,editFlow:"Edit"===(null==b?void 0:b.usedFor)},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[K&&(null==b?void 0:b.isAiStreaming)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e.jsx(u.Loader2Icon,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e.jsx(r.TextSection,i.__assign({id:"rule-title",title:b.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:B&&null!==k?k:A.ruleTitle,onChange:function(i){return B?L(i):j.setRuleTitle(i)},readOnly:(null==b?void 0:b.isAiStreaming)||!B,isOpen:R.ruleTitle,onToggle:function(){return ri("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:A.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(x=b.validationErrors)||void 0===x?void 0:x.ruleTitle},b)),A.citation.ruleTitle&&e.jsx("div",i.__assign({style:si},{children:e.jsx(t.InputDataReasoningCard,{isVisible:R.ruleTitle,citation:A.citation.ruleTitle,citations:di("ruleTitle"),fieldName:"Rule Title",fieldValue:A.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:B&&null!==P?P:A.scopeData,onScopeChange:function(e,n){B?J(function(t){var o;return i.__assign(i.__assign({},null!=t?t:A.scopeData),((o={})[e]=n,o))}):j.onScopeChange(e,n)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:R.scopeData,onToggle:function(){return ri("scopeData")},showCognitiveIcon:A.citation.scopeData,cognitiveIcon:e.jsx(s.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(y=b.validationErrors)||void 0===y?void 0:y.station)||(null===(_=b.validationErrors)||void 0===_?void 0:_.tiers),stationErrorMessage:null===(T=b.validationErrors)||void 0===T?void 0:T.station,tierErrorMessage:null===(S=b.validationErrors)||void 0===S?void 0:S.tiers,readOnly:(null==b?void 0:b.isAiStreaming)||!B},b)),A.citation.scopeData&&e.jsx("div",i.__assign({style:si},{children:e.jsx(t.InputDataReasoningCard,{isVisible:R.scopeData,citation:A.citation.scopeData,citations:di("scopeData"),fieldName:"Scope",fieldValue:null===(D=null===(m=A.scopeData)||void 0===m?void 0:m.tiers)||void 0===D?void 0:D.join(", ")})})),B?e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e.jsxs("div",i.__assign({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e.jsx("button",i.__assign({onClick:Z,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:G,disabled:ei,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ei?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ei?.5:1}},{children:[e.jsx(u.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==b?void 0:b.pendingEditId)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"10px"}},{children:[e.jsx(u.AlertTriangle,{size:14,style:{color:"#C2410C"}}),e.jsx("div",i.__assign({style:{color:"#C2410C",fontSize:"13px"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(I=null===(C=null==b?void 0:b.tierOptions)||void 0===C?void 0:C.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===I?void 0:I.map(function(n,a,s){var u,c,v,g,f=n.toLowerCase().replace(/ /g,"_"),h=(null===(u=A.variantsByTier)||void 0===u?void 0:u[f])||[],x=h.length,y=!1;if(1===x){var _=h[0],T=!(null===(c=null==_?void 0:_.ruleDescription)||void 0===c?void 0:c.trim()),S=(null===(v=null==_?void 0:_.whenToApplyConditions)||void 0===v?void 0:v.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,m=(null===(g=null==_?void 0:_.whenNotToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;T&&!S&&!m&&(y=!0)}var D=y?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier"),C=!((null==b?void 0:b.defaultTierOpen)>=0)||a===b.defaultTierOpen;return console.log("Rendering tier : ",n),e.jsx(d.default,i.__assign({variant:"tier-header",title:{type:"other",label:n},subtitle:D,defaultOpen:C,footerData:{description:"Variants for ".concat(n)}},{children:e.jsx(p,i.__assign({onAddVariant:function(){var i;return null===(i=j.addNewVariant)||void 0===i?void 0:i.call(j,f)},isDisabled:null==b?void 0:b.isAiStreaming,showAddVariantBtn:"Edit"!==(null==b?void 0:b.usedFor)},{children:h.map(function(n,a){var s,u,c,v,p,g,h,x,y,_,T,S=n.variantType||"default",m="".concat(f,"-variant-").concat(a),D=!0===n.is_variant,C="default"===S||"default_variant"===S;(null==b?void 0:b.defaultVariantOpen)>=0&&b.defaultVariantOpen;var I="".concat(f,"_").concat(a),E=O.get(I)||{},w=(null===(u=null===(s=b.separationItemsByTier)||void 0===s?void 0:s[f])||void 0===u?void 0:u.get(a))||[],V=(null===(v=null===(c=b.togglesByTier)||void 0===c?void 0:c[f])||void 0===v?void 0:v.get(a))||[];(null==b?void 0:b.autoScrollVariantIndex)===a||n.is_variant,console.log("Rendering ".concat(f," variant ").concat(a,":"),n),console.log("Rendering Variant : ",n),console.log("Open Accordion ID:",W,"Current Variant ID:",m);var N=null===(p=null==b?void 0:b.activeEditId)||void 0===p?void 0:p.startsWith("condition-wta-".concat(f,"-").concat(a)),B=null===(g=null==b?void 0:b.activeEditId)||void 0===g?void 0:g.startsWith("condition-wnta-".concat(f,"-").concat(a));return e.jsx("div",i.__assign({ref:function(i){i?M.current.set(m,i):M.current.delete(m)},style:{width:"100%"}},{children:e.jsx(d.default,i.__assign({title:{type:C?"default":"variant",label:ui(S),number:a+1,isNewVariant:D,isDefault:n.isDefault,isModified:n.isModified},defaultOpen:!0,expanded:W===m,onToggle:function(){var i,e=W===m;console.log("is closing:",e),q(e?null:m),null===(i=null==b?void 0:b.setActiveVariantAccordionIndex)||void 0===i||i.call(b,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:S,description:n.ruleDescription||""}},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e.jsx(r.TextSection,i.__assign({id:"rule-description-".concat(f,"-").concat(a),title:b.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:n.isReadOnly||(null==b?void 0:b.isAiStreaming)||ci&&(null==b?void 0:b.activeEditId)!=="rule-description-".concat(f,"-").concat(a),value:n.ruleDescription||"",onChange:function(i){return j.setRuleDescription(f,a,i)},isOpen:R["ruleDescription-".concat(f)],onToggle:function(){return ri("ruleDescription-".concat(f))},isHighlighted:E.ruleDescription||!1,showCognitiveIcon:null===(h=A.citation)||void 0===h?void 0:h["ruleDescription_".concat(f)],tooltipDescription:"Why this Description?",errorMessage:null===(x=b.validationErrors)||void 0===x?void 0:x["ruleDescription-".concat(f,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==b?void 0:b.setSendMessageInChat,isAiStreaming:null==b?void 0:b.isAiStreaming,fieldName:"Rule Description"},b)),(null===(y=A.citation)||void 0===y?void 0:y["ruleDescription_".concat(f)])&&e.jsx("div",i.__assign({style:si},{children:e.jsx(t.InputDataReasoningCard,{isVisible:R["ruleDescription-".concat(f)],citation:A.citation["ruleDescription_".concat(f)],citations:di("ruleDescription_".concat(f,"_").concat(a)),fieldName:"Rule Description",fieldValue:n.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wta",title:b.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:n.isReadOnly||(null==b?void 0:b.isAiStreaming)||ci&&!N,conditions:n.whenToApplyConditions||[],onAdd:function(){return j.addWhenToApply(f,a)},onRemove:function(i,e,n){return j.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return j.editWhenToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:E.wta||!1,highlightedIds:null==b?void 0:b.highlightedIds,tooltipDescription:"Why this Condition?",citations:di("whenToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:b.isAiStreaming,errorMessage:(null===(_=b.validationErrors)||void 0===_?void 0:_["whenToApply-".concat(f,"-").concat(a)])||(null==b?void 0:b.conflictReason)},b)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wnta",title:b.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:n.isReadOnly||(null==b?void 0:b.isAiStreaming)||ci&&!B,conditions:n.whenNotToApplyConditions||[],onAdd:function(){return j.addWhenNotToApply(f,a)},onRemove:function(i,e,n){return j.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return j.editWhenNotToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:E.wnta||!1,highlightedIds:null==b?void 0:b.highlightedIds,tooltipDescription:"Why this Condition?",citations:di("whenNotToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:b.isAiStreaming},b)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(f,"-").concat(a),title:b.configTitle||"Configuration",required:!1,highlights:E,bordered:!0,readOnly:n.isReadOnly||(null==b?void 0:b.isAiStreaming)||ci&&(null==b?void 0:b.activeEditId)!=="config-".concat(f,"-").concat(a),onConfigChange:function(i,e){return j.onConfigChange(f,a,i,e)},separationItems:w,toggles:V,index:a},b)),(null===(T=n.reasoning)||void 0===T?void 0:T.configData)&&e.jsx("div",i.__assign({style:si},{children:e.jsx(t.InputDataReasoningCard,{citation:n.reasoning.configData,citations:di("configData_".concat(f,"_").concat(a)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),m)}),"".concat(f,"-variant-").concat(a))})}))}),"tier-".concat(a))})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),t=require("../../InputDataReasoningCard.js"),o=require("../../organisms/ConditionSection/ConditionSection.js"),l=require("../../organisms/ConfigSection/ConfigSection.js"),a=require("../../organisms/ScopeSection/ScopeSection.js"),r=require("../../organisms/TextSection/TextSection.js"),d=require("../../AccordianSection.js"),s=require("../../_svg/ButtonCognitiveIcon.js"),u=require("lucide-react");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var v=c(n),p=function(n){var t=n.children,o=n.onAddVariant,l=n.isDisabled,a=n.showAddVariantBtn,r=void 0===a||a,d=v.default.Children.toArray(t);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,n){var t=!(n===d.length-1)||r;return e.jsxs(v.default.Fragment,{children:[i,t&&e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},n)}),r&&e.jsx("div",i.__assign({onClick:l?void 0:o,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:l?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:l?"not-allowed":"pointer",backgroundColor:l?"#f8fafc":"#FFFFFF",opacity:l?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))};exports.CreateRule=function(c){var f,g,h,x,y,_,T,S,m,C,D,I=c.state,A=c.handlers,j=c.uiState,b=(null==j?void 0:j.highlights)||new Map,E=b.get("global_0")||{},O=n.useState({}),w=O[0],R=O[1],V=n.useState(null),N=V[0],W=V[1],q=n.useState(function(){var i,e,n;if((null==j?void 0:j.defaultTierOpen)>=0&&(null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i[j.defaultTierOpen]))return j.tierOptions[j.defaultTierOpen].toLowerCase().replace(/ /g,"_");var t=null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n[0];return t?t.toLowerCase().replace(/ /g,"_"):null});q[0];var L=q[1],B="rule-setup"===(null==j?void 0:j.activeEditId),M=v.default.useRef(new Map),F=n.useState(null),k=F[0],z=F[1],P=n.useState(null),J=P[0],H=P[1],K=n.useState(!1),$=K[0],U=K[1],Z=v.default.useRef(null==j?void 0:j.isAiStreaming);n.useEffect(function(){Z.current&&!(null==j?void 0:j.isAiStreaming)&&$&&U(!1),Z.current=null==j?void 0:j.isAiStreaming},[null==j?void 0:j.isAiStreaming,$]);var G=function(){var i;z(null),H(null),null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null)},Q=function(){var i,e,n=null!=k?k:I.ruleTitle,t=null!=J?J:I.scopeData,o=n!==I.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(I.scopeData);if(!o&&!l)return z(null),H(null),void(null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null));if(null==j?void 0:j.setSendMessageInChat){var a="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),r=[];if(o&&r.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,s=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";r.push(s)}var u=r.join(" and ");j.setSendMessageInChat("__SKELETON__:".concat(a,":Update Rule Setup ").concat(u))}U(!0),z(null),H(null),null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,null)},X=null!==k?null==k?void 0:k.trim():(I.ruleTitle||"").trim(),Y=null!=J?J:I.scopeData,ii=X!==(I.ruleTitle||"").trim(),ei=JSON.stringify(Y)!==JSON.stringify(I.scopeData),ni=!ii&&!ei||""===X,ti=v.default.useRef(null==j?void 0:j.defaultVariantOpen),oi=v.default.useRef(null==j?void 0:j.activeVariantAccordionIndex),li=v.default.useRef(null==j?void 0:j.defaultTierOpen),ai=v.default.useRef(null===(f=I.scopeData)||void 0===f?void 0:f.tiers),ri=v.default.useRef(I.variantsByTier);v.default.useEffect(function(){var i,e,n,t,o,l,a=null,r=!1;ti.current!==(null==j?void 0:j.defaultVariantOpen)&&(r=!0,ti.current=null==j?void 0:j.defaultVariantOpen),oi.current!==(null==j?void 0:j.activeVariantAccordionIndex)&&(r=!0,oi.current=null==j?void 0:j.activeVariantAccordionIndex),li.current!==(null==j?void 0:j.defaultTierOpen)&&(r=!0,li.current=null==j?void 0:j.defaultTierOpen);var d=(null===(i=I.scopeData)||void 0===i?void 0:i.tiers)||[];JSON.stringify(ai.current)!==JSON.stringify(d)&&(r=!0,ai.current=d,d.length>0&&L(d[0].toLowerCase().replace(/ /g,"_")));var s=(null===(e=null==j?void 0:j.tierOptions)||void 0===e?void 0:e.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||[],u=s.some(function(i){var e,n,t,o,l=i.toLowerCase().replace(/ /g,"_");return((null===(n=null===(e=ri.current)||void 0===e?void 0:e[l])||void 0===n?void 0:n.length)||0)!==((null===(o=null===(t=I.variantsByTier)||void 0===t?void 0:t[l])||void 0===o?void 0:o.length)||0)});if(u&&(r=!0),r){var c=null!==(n=null==j?void 0:j.activeVariantAccordionIndex)&&void 0!==n?n:null==j?void 0:j.defaultVariantOpen;if(null==c||c<0)return W(null),void(ri.current=I.variantsByTier);s.forEach(function(i,e){var n;if(!((null==j?void 0:j.defaultTierOpen)>=0&&e!==j.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_"),o=(null===(n=I.variantsByTier)||void 0===n?void 0:n[t])||[];o[c]&&(a="".concat(t,"-variant-").concat(c)),null!=(null==j?void 0:j.autoScrollVariantIndex)&&o[j.autoScrollVariantIndex]&&(a="".concat(t,"-variant-").concat(j.autoScrollVariantIndex))}}),a&&W(a)}if(null===N){var v=null!==(t=null==j?void 0:j.activeVariantAccordionIndex)&&void 0!==t?t:null==j?void 0:j.defaultVariantOpen;null!=v&&v>=0&&(null===(l=null===(o=null==j?void 0:j.tierOptions)||void 0===o?void 0:o.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===l||l.forEach(function(i,e){var n;if(!((null==j?void 0:j.defaultTierOpen)>=0&&e!==j.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_");((null===(n=I.variantsByTier)||void 0===n?void 0:n[t])||[])[v]&&W("".concat(t,"-variant-").concat(v))}}))}ri.current=I.variantsByTier},[I.variantsByTier,null==j?void 0:j.defaultVariantOpen,null==j?void 0:j.activeVariantAccordionIndex,null===(g=I.scopeData)||void 0===g?void 0:g.tiers,null==j?void 0:j.tierOptions,null==j?void 0:j.autoScrollVariantIndex,null==j?void 0:j.defaultTierOpen]);var di=function(e){R(function(n){var t;return i.__assign(i.__assign({},n),((t={})[e]=!n[e],t))})},si=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],a=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,r=null===(e=I.fieldCitations)||void 0===e?void 0:e[a];if(Array.isArray(r)&&r.length>0)return r;var d=null===(n=I.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=I.citations)&&void 0!==t?t:[]},ui={marginTop:"-17px",position:"relative",zIndex:1};n.useEffect(function(){var i,e;null!=(null==j?void 0:j.autoScrollVariantIndex)&&(null===(e=null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(j.autoScrollVariantIndex),t=M.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==j?void 0:j.scrollTrigger]),console.log("CreateRule state:",I),console.log("CreateRule uiState:",j);var ci=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},vi=!!(null==j?void 0:j.activeEditId);return e.jsxs("div",i.__assign({className:"traffic-manager-template"},{children:[e.jsx("div",i.__assign({"data-edit-id":"rule-setup"},{children:e.jsx(d.default,i.__assign({title:{type:"other",label:(null==j?void 0:j.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(B)return null;var o=!!(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId;return e.jsx("div",i.__assign({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e.jsx("button",i.__assign({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(j.activeEditId||null):(!function(){var e,n;(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId||(null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,"rule-setup"),z(null!==(n=I.ruleTitle)&&void 0!==n?n:""),H(I.scopeData?i.__assign({},I.scopeData):{}))}(),(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(null),n||t())},disabled:$,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:$?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:$?.5:1}},{children:e.jsx(u.Pencil,{size:14})}))}))},footerData:{ruleTitle:I.ruleTitle,stations:[I.scopeData.station],tiers:null===(h=I.scopeData)||void 0===h?void 0:h.tiers},defaultOpen:"Create"===(null==j?void 0:j.usedFor),readOnly:"Create"!==(null==j?void 0:j.usedFor),isAiStreaming:null==j?void 0:j.isAiStreaming,editFlow:"Edit"===(null==j?void 0:j.usedFor)},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[$&&(null==j?void 0:j.isAiStreaming)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e.jsx(u.Loader2Icon,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e.jsx(r.TextSection,i.__assign({id:"rule-title",title:j.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:B&&null!==k?k:I.ruleTitle,onChange:function(i){return B?z(i):A.setRuleTitle(i)},readOnly:(null==j?void 0:j.isAiStreaming)||!B,isOpen:w.ruleTitle,onToggle:function(){return di("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:I.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(x=j.validationErrors)||void 0===x?void 0:x.ruleTitle},j)),I.citation.ruleTitle&&e.jsx("div",i.__assign({style:ui},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.ruleTitle,citation:I.citation.ruleTitle,citations:si("ruleTitle"),fieldName:"Rule Title",fieldValue:I.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:B&&null!==J?J:I.scopeData,onScopeChange:function(e,n){B?H(function(t){var o;return i.__assign(i.__assign({},null!=t?t:I.scopeData),((o={})[e]=n,o))}):A.onScopeChange(e,n)},tierLabel:"Which tier are you configuring this learning for?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:w.scopeData,onToggle:function(){return di("scopeData")},showCognitiveIcon:I.citation.scopeData,cognitiveIcon:e.jsx(s.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(y=j.validationErrors)||void 0===y?void 0:y.station)||(null===(_=j.validationErrors)||void 0===_?void 0:_.tiers),stationErrorMessage:null===(T=j.validationErrors)||void 0===T?void 0:T.station,tierErrorMessage:null===(S=j.validationErrors)||void 0===S?void 0:S.tiers,readOnly:(null==j?void 0:j.isAiStreaming)||!B},j)),I.citation.scopeData&&e.jsx("div",i.__assign({style:ui},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.scopeData,citation:I.citation.scopeData,citations:si("scopeData"),fieldName:"Scope",fieldValue:null===(C=null===(m=I.scopeData)||void 0===m?void 0:m.tiers)||void 0===C?void 0:C.join(", ")})})),B?e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e.jsxs("div",i.__assign({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e.jsx("button",i.__assign({onClick:G,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:Q,disabled:ni,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ni?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ni?.5:1}},{children:[e.jsx(u.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==j?void 0:j.pendingEditId)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"10px"}},{children:[e.jsx(u.AlertTriangle,{size:14,style:{color:"#C2410C"}}),e.jsx("div",i.__assign({style:{color:"#C2410C",fontSize:"13px"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(D=null==j?void 0:j.tierOptions)||void 0===D?void 0:D.map(function(n,a){var s,u,c,v,f,g,h=n.toLowerCase().replace(/ /g,"_"),x=(null===(s=I.variantsByTier)||void 0===s?void 0:s[h])||[],y=null===(c=null===(u=I.scopeData)||void 0===u?void 0:u.tiers)||void 0===c?void 0:c.includes(n),_=x.length,T=!1;if(1===_){var S=x[0],m=!(null===(v=null==S?void 0:S.ruleDescription)||void 0===v?void 0:v.trim()),C=(null===(f=null==S?void 0:S.whenToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,D=(null===(g=null==S?void 0:S.whenNotToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;!m||C||D||(T=!0)}var E=T?void 0:"".concat(_," ").concat(1===_?"variant":"variants"," configured for this tier");return console.log("Rendering tier : ",n),e.jsx(d.default,i.__assign({variant:"tier-header",title:{type:"other",label:n},subtitle:E,defaultOpen:!0,footerData:{description:"Variants for ".concat(n)}},{children:e.jsx(p,i.__assign({onAddVariant:function(){var i;return null===(i=A.addNewVariant)||void 0===i?void 0:i.call(A,h)},isDisabled:!y||(null==j?void 0:j.isAiStreaming),showAddVariantBtn:"Edit"!==(null==j?void 0:j.usedFor)},{children:x.map(function(n,a){var s,u,c,v,p,f,g,x,_,T,S=n.variantType||"default",m="".concat(h,"-variant-").concat(a),C=!0===n.is_variant,D="default"===S||"default_variant"===S,E="".concat(h,"_").concat(a),O=b.get(E)||{},R=(null===(u=null===(s=j.separationItemsByTier)||void 0===s?void 0:s[h])||void 0===u?void 0:u.get(a))||[],V=(null===(v=null===(c=j.togglesByTier)||void 0===c?void 0:c[h])||void 0===v?void 0:v.get(a))||[],q=null===(p=null==j?void 0:j.activeEditId)||void 0===p?void 0:p.startsWith("condition-wta-".concat(h,"-").concat(a)),L=null===(f=null==j?void 0:j.activeEditId)||void 0===f?void 0:f.startsWith("condition-wnta-".concat(h,"-").concat(a)),B=!y||n.isReadOnly||(null==j?void 0:j.isAiStreaming);return e.jsx("div",i.__assign({ref:function(i){i?M.current.set(m,i):M.current.delete(m)},style:{width:"100%",opacity:y?1:.7}},{children:e.jsx(d.default,i.__assign({title:{type:D?"default":"variant",label:ci(S),number:a+1,isNewVariant:C,isDefault:n.isDefault,isModified:n.isModified},defaultOpen:!0,expanded:N===m,onToggle:function(){var i,e=N===m;W(e?null:m),null===(i=null==j?void 0:j.setActiveVariantAccordionIndex)||void 0===i||i.call(j,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:S,description:n.ruleDescription||""},readOnly:B},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e.jsx(r.TextSection,i.__assign({id:"rule-description-".concat(h,"-").concat(a),title:j.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:B||vi&&(null==j?void 0:j.activeEditId)!=="rule-description-".concat(h,"-").concat(a),value:n.ruleDescription||"",onChange:function(i){return A.setRuleDescription(h,a,i)},isOpen:w["ruleDescription-".concat(h)],onToggle:function(){return di("ruleDescription-".concat(h))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(g=I.citation)||void 0===g?void 0:g["ruleDescription_".concat(h)],tooltipDescription:"Why this Description?",errorMessage:null===(x=j.validationErrors)||void 0===x?void 0:x["ruleDescription-".concat(h,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==j?void 0:j.setSendMessageInChat,isAiStreaming:null==j?void 0:j.isAiStreaming,fieldName:"Rule Description"},j)),(null===(_=I.citation)||void 0===_?void 0:_["ruleDescription_".concat(h)])&&e.jsx("div",i.__assign({style:ui},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w["ruleDescription-".concat(h)],citation:I.citation["ruleDescription_".concat(h)],citations:si("ruleDescription_".concat(h,"_").concat(a)),fieldName:"Rule Description",fieldValue:n.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(h,"-").concat(a),idPrefix:"condition-wta",title:j.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:B||vi&&!q,conditions:n.whenToApplyConditions||[],onAdd:function(){return A.addWhenToApply(h,a)},onRemove:function(i,e,n){return A.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return A.editWhenToApply(i,e,n,t)},index:a,tierKey:h,isHighlighted:O.wta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:si("whenToApply_".concat(h,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:j.isAiStreaming,errorMessage:(null===(T=j.validationErrors)||void 0===T?void 0:T["whenToApply-".concat(h,"-").concat(a)])||(null==j?void 0:j.conflictReason)},j)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(h,"-").concat(a),idPrefix:"condition-wnta",title:j.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:B||vi&&!L,conditions:n.whenNotToApplyConditions||[],onAdd:function(){return A.addWhenNotToApply(h,a)},onRemove:function(i,e,n){return A.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return A.editWhenNotToApply(i,e,n,t)},index:a,tierKey:h,isHighlighted:O.wnta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:si("whenNotToApply_".concat(h,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:j.isAiStreaming},j)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(h,"-").concat(a),title:j.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:B||vi&&(null==j?void 0:j.activeEditId)!=="config-".concat(h,"-").concat(a),onConfigChange:function(i,e){return A.onConfigChange(h,a,i,e)},separationItems:R,toggles:V,index:a},j))]}))}),m)}),"".concat(h,"-variant-").concat(a))})}))}),"tier-".concat(a))})]}))};
2
2
  //# sourceMappingURL=CreateRule.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 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 C=function(C){var f=C.open,v=C.chatAssistantName,S=C.organizationName,x=C.baseUrl,b=C.baseWebsocketUrl,k=C.closeFunction,w=C.ThinkingBulbIconComponent,y=C.customSections,M=C.customMetaData,R=C.chatTitle,I=void 0===R?"Instant Learning On-The-Job":R,F=C.formTitle,T=void 0===F?"Instant Learning On-The-Job Form":F,A=C.onSave,V=C.headerMessageHandlers,L=C.aiResponse,W=C.setAIResponse,D=C.width,E=void 0===D?"90vw":D,B=C.height,P=void 0===B?"90vh":B,z=C.sendMessageInChat,O=void 0===z?"":z,N=C.setSendMessageInChat,j=C.validateCustom,U=C.onResetChat,J=C.template,_=C.templateProps,q=C.initialChatMessage,H=C.setCitations,G=C.isLoading,X=void 0!==G&&G,Y=C.isLocked,K=void 0!==Y&&Y,Q=C.saveButtonConfig,Z=void 0===Q?{label:"Save Learning",loadingLabel:"Saving Learning..."}:Q,$=C.saveButtonColor,ee=C.saveWithoutValBtnConfig,ne=void 0===ee?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:ee,oe=C.textareaPlaceholder,te=C.setCurrentRequestId,ie=C.showSavedMessage,ae=void 0!==ie&&ie,se=C.savedMessage,re=void 0===se?"Thank you teacher for teaching me, your learning has been saved successfully.":se,le=C.isError,de=void 0!==le&&le,ue=C.errorMessage,ce=void 0===ue?"I'm sorry, I couldn't save your changes. Please try again.":ue,me=C.isSaving,he=void 0!==me&&me,ge=C.isAiStreaming,pe=C.setIsAiStreaming,Ce=C.showConfirmReset,fe=void 0!==Ce&&Ce,ve=C.setShowConfirmReset,Se=C.confirmReset,xe=C.isLoadingVariants,be=C.isFormDirty,ke=C.onResetRequest,we=C.mainText,ye=void 0===we?"Adding a variant":we,Me=C.subText,Re=void 0===Me?"This may take a moment as we update the learning with the new variant.":Me,Ie=C.showComparison,Fe=void 0!==Ie&&Ie,Te=C.setShowComparison,Ae=C.showAgentComposerRuleComparison,Ve=void 0!==Ae&&Ae,Le=C.setShowAgentComposerRuleComparison,We=C.isFetchingComparison,De=C.handleOpenComparison,Ee=C.proposedRule,Be=C.variants,Pe=C.onAddAsVariant,ze=C.isCopyEnabled,Oe=C.showSaveWithoutValidation,Ne=void 0!==Oe&&Oe,je=C.onSaveWithoutValidation,Ue=C.onComparisonLinkClick,Je=C.targetComparisonVariantId,_e=C.highlightedComparisonField,qe=C.onSubmitFeedback,He=C.isUseNormalChat,Ge=void 0!==He&&He,Xe=C.userDetails,Ye=C.handleGlobalClickCapture,Ke=C.isGlobalEditActive,Qe=C.socketTimeOutInMilliSeconds,Ze=r(f),$e=Ze[0],en=Ze[1],nn=r(!1);nn[0];var on=nn[1],tn=r(!1),an=tn[0],sn=tn[1],rn=r(!1),ln=rn[0];rn[1];var dn=r(45),un=dn[0],cn=dn[1],mn=r("right"),hn=mn[0],gn=mn[1],pn=s.useRef(hn),Cn=r(!1),fn=Cn[0],vn=Cn[1],Sn=r(0),xn=Sn[0],bn=Sn[1],kn=r(40),wn=kn[0],yn=kn[1];l(function(){pn.current=hn},[hn]),l(function(){en(f)},[f]);var Mn=d(function(e){e.preventDefault(),vn(!0),bn(e.clientX),yn(un)},[un]),Rn=d(function(e){if(fn){var n=document.querySelector("[data-dialog-content]");if(n){var o=n.getBoundingClientRect(),t=(e.clientX-xn)/o.width*100,i=Math.max(20,Math.min(80,wn+t));cn(i),i>wn&&gn("right"),i<wn&&gn("left")}}},[fn,xn,wn]),In=d(function(){vn(!1)},[]);l(function(){if(fn)return document.addEventListener("mousemove",Rn),document.addEventListener("mouseup",In),function(){document.removeEventListener("mousemove",Rn),document.removeEventListener("mouseup",In)}},[fn,Rn,In]);var Fn=function(e,n){K&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==be?void 0:be())?(en(!1),k()):null==ke||ke())},Tn=d(function(e){cn(function(n){var o;if("number"==typeof e)return e>n&&gn("right"),e<n&&gn("left"),e;var t=pn.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&&gn("left"),20===i&&gn("right"),i})},[]),An=d(function(){De&&(Tn(30),De())},[Tn,De]);return n(t,e({open:$e,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:fn?"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:on,ThinkingBulbIconComponent:w,isFormSaveClicked:an,setIsFormSavedClicked:sn,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:ln,chatTitle:I,customMetaData:M,headerMessageHandlers:V,aiResponse:L,setAIResponse:W,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:un,movingTowards:hn,setChatSize:Tn,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,isSaving:he,onStreamingStateChange:pe,onViewComparison:An,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe}):n(u,{chatAssistantName:v,organizationName:S,baseUrl:x,baseWebsocketUrl:b,setIsNewChatClicked:on,ThinkingBulbIconComponent:w,isFormSaveClicked:an,setIsFormSavedClicked:sn,onResetLearningData:function(){},sendMessageInChat:O,setSendMessageInChat:N,isFormValidating:ln,chatTitle:I,customMetaData:M,headerMessageHandlers:V,aiResponse:L,setAIResponse:W,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:un,movingTowards:hn,setChatSize:Tn,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,isSaving:he,onStreamingStateChange:pe,onViewComparison:An,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe,userDetails:Xe,isGlobalEditActive:Ke,socketTimeOutInMilliSeconds:Qe})})),n(a,{sx:{width:"2px",cursor:"col-resize",backgroundColor:fn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:Mn}),o(a,e({sx:{width:"".concat(100-un,"%"),maxWidth:"".concat(100-un,"%"),transition:fn?"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:We||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n(m,{isLoading:xe||!1,mainText:ye,subText:Re}),Ve?n(g,{proposedRule:Ee,variants:Be,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Pe||Pe(),Tn(40),null==Le||Le(!1)},onSkip:function(){Tn(40),null==Le||Le(!1)},onBack:function(){Tn(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(),Tn(40),null==Te||Te(!1)},onSkip:function(){Tn(40),null==Te||Te(!1)},onBack:function(){Tn(40),null==Te||Te(!1)},targetVariantId:Je,highlightedField:_e}):n(c,{setIsFormSavedClicked:sn,customSections:y,onSave:A,formHeader:T,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:fe,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{C 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,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,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,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 un=r(45),cn=un[0],mn=un[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 Rn=d(function(e){e.preventDefault(),Sn(!0),kn(e.clientX),yn(cn)},[cn]),In=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]),Fn=d(function(){Sn(!1)},[]);l(function(){if(vn)return document.addEventListener("mousemove",In),document.addEventListener("mouseup",Fn),function(){document.removeEventListener("mousemove",In),document.removeEventListener("mouseup",Fn)}},[vn,In,Fn]);var Tn=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:Tn,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(cn,"%"),maxWidth:"".concat(cn,"%"),transition:vn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===cn?"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:I,customMetaData:y,headerMessageHandlers:V,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:cn,movingTowards:gn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,isSaving:he,onStreamingStateChange:pe,onViewComparison:Vn,isCopyEnabled:ze,onComparisonLinkClick:Ue,onSubmitFeedback:qe}):n(u,{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:I,customMetaData:y,headerMessageHandlers:V,aiResponse:L,setAIResponse:D,onResetChat:U,initialChatMessage:q,onSave:A,chatSize:cn,movingTowards:gn,setChatSize:An,setCitations:H,textareaPlaceholder:oe,setCurrentRequestId:te,showSavedMessage:ae,savedMessage:re,isError:de,errorMessage:ce,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:Rn}),o(a,e({sx:{width:"".concat(100-cn,"%"),maxWidth:"".concat(100-cn,"%"),transition:vn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===cn?"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}),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}):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:rn,customSections:M,onSave:A,formHeader:T,onClose:function(){return Tn(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{__assign as e}from"tslib";import{jsxs as i,jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";import a from"./TooltipComponent.js";var p=function(p){var s,c,f=p.title,x=p.subtitle,g=p.children,h=p.defaultOpen,u=void 0===h||h,v=p.footerData,y=p.readOnly,b=void 0!==y&&y,m=p.variant,F=void 0===m?"default":m,w=p.expanded,C=p.onToggle,D=p.actionButtons,E=p.isAiStreaming,S=p.editFlow,z=void 0!==S&&S,k=t(u),I=k[0],B=k[1];n(function(){B(u)},[u]);var R=void 0!==w,T=R?w:I,A=function(){R?null==C||C():B(!T)},W="variant"===f.type,j="other"===f.type,L="tier-header"===F,N="rule-behavior"===F,O={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:L?"0px":"8px",borderBottom:L?"1px solid #E2E8F0":"none"},V={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:j?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":L&&T?"#2563EB":"#19213D",backgroundColor:N&&!f.isNewVariant?"#F7F8FA":W?"#FDF2F8":f.isDefault?"#F7F8FA":"transparent",border:W?"1px solid #FCE7F3":f.isDefault?"1px solid #F0F2F5":"none"},M={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:j?"0px":"10px"},P={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}};return i("div",e({style:{width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:L?"none":N&&T?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:A,style:O},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!f.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o("div",e({style:V},{children:f.label})),f.isDefault&&o("span",e({style:P.defaultTag},{children:"Default"})),f.isModified&&o("span",e({style:P.modifiedTag},{children:"MODIFIED"}))]})),o("div",{children:f.isNewVariant&&i("div",e({style:P.badge},{children:[o("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:o("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),o("div",{children:"New Variant"})]}))}),x&&o("div",e({style:M},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!E&&(z?o(a,e({description:"Coming Soon"},{children:o("div",e({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:o("div",e({style:{pointerEvents:"none"}},{children:D(T,function(){})}))}))})):o("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(T,A)}))),o("div",e({onClick:A,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:T?o(d,{size:18,color:L?"#2563EB":"#64748B"}):o(l,{size:18,color:"#64748B"})}))]}))]})),!T&&v&&o("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:j?i(r,{children:[o("span",e({style:{fontWeight:500,color:"#475569"}},{children:v.ruleTitle||"No Title"})),(null!==(c=null===(s=v.tiers)||void 0===s?void 0:s.length)&&void 0!==c?c:0)>0&&i(r,{children:[o("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),o("span",{children:Array.isArray(v.tiers)?v.tiers.join(", "):v.tiers})]})]}):o("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:v.description}))})),T&&o("div",e({style:{padding:"12px"}},{children:g}))]}))};export{p as default};
1
+ import{__assign as e}from"tslib";import{jsxs as i,jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";import a from"./TooltipComponent.js";var p=function(p){var s,c,f=p.title,x=p.subtitle,g=p.children,h=p.defaultOpen,u=void 0===h||h,v=p.footerData,y=p.readOnly,b=void 0!==y&&y,m=p.variant,F=void 0===m?"default":m,w=p.expanded,C=p.onToggle,D=p.actionButtons,E=p.isAiStreaming,S=p.editFlow,z=void 0!==S&&S,k=t(u),I=k[0],B=k[1];n(function(){B(u)},[u]);var R=void 0!==w,A=R?w:I,T=function(){R?null==C||C():B(!A)},W="variant"===f.type,j="other"===f.type,L="tier-header"===F,N="rule-behavior"===F,O={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:L?"0px":"8px",borderBottom:L?"1px solid #E2E8F0":"none"},V={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:j?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":L&&A?"#2563EB":"#19213D",backgroundColor:N&&!f.isNewVariant?"#F7F8FA":W?"#FDF2F8":f.isDefault?"#F7F8FA":"transparent",border:W?"1px solid #FCE7F3":f.isDefault?"1px solid #F0F2F5":"none"},M={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:j?"0px":"10px"},P={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}};return i("div",e({style:{width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:L?"none":N&&A?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:T,style:O},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!f.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o("div",e({style:V},{children:f.label})),f.isDefault&&o("span",e({style:P.defaultTag},{children:"Default"})),f.isModified&&o("span",e({style:P.modifiedTag},{children:"MODIFIED"}))]})),o("div",{children:f.isNewVariant&&i("div",e({style:P.badge},{children:[o("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:o("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),o("div",{children:"New Variant"})]}))}),x&&o("div",e({style:M},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!E&&(z?o(a,e({description:"Coming Soon"},{children:o("div",e({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:o("div",e({style:{pointerEvents:"none"}},{children:D(A,function(){})}))}))})):o("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(A,T)}))),o("div",e({onClick:T,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:A?o(d,{size:18,color:L?"#2563EB":"#64748B"}):o(l,{size:18,color:"#64748B"})}))]}))]})),!A&&v&&o("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:j?i(r,{children:[o("span",e({style:{fontWeight:500,color:"#475569"}},{children:v.ruleTitle||""})),(null!==(c=null===(s=v.tiers)||void 0===s?void 0:s.length)&&void 0!==c?c:0)>0&&i(r,{children:[o("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),o("span",{children:Array.isArray(v.tiers)?v.tiers.join(", "):v.tiers})]})]}):o("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:v.description}))})),A&&o("div",e({style:{padding:"12px"}},{children:g}))]}))};export{p as default};
2
2
  //# sourceMappingURL=AccordianSection.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 w,startChatStream as S}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 M from"../AudioWaveform.js";import I from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as D}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as R,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as F}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as W}from"../_svg/UserIcon.js";var q,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,G=P.setIsNewChatClicked;P.ThinkingBulbIconComponent;var Z=P.isFormSaveClicked,K=P.setIsFormSavedClicked,U=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,we=P.onViewComparison;P.isCopyEnabled;var Se=P.onComparisonLinkClick,xe=P.onSubmitFeedback,ke=P.userDetails,_e=P.isGlobalEditActive,Te=P.socketTimeOutInMilliSeconds,Ee=j,Me=d("".concat(Ee,"-").concat(z,"-").concat(b())),Ie=d("".concat(b())),Ne=B,De=d(null),Re=d(!0),Le=d(null),Fe=d(null),Ae=c(""),We=Ae[0],qe=Ae[1],Pe=c([]),je=Pe[0],ze=Pe[1],Be=c(!1),He=Be[0],Ge=Be[1],Ze=c(!1);Ze[0];var Ke=Ze[1],Ue=c(!0),Oe=Ue[0],Ve=Ue[1],Qe=c(!0);Qe[0];var Je=Qe[1],$e=c("");$e[0];var Xe=$e[1],Ye=c(""),en=Ye[0],nn=Ye[1],tn=c(!1),on=tn[0],rn=tn[1],an=c(!1),sn=an[0],ln=an[1],dn=c(!0),cn=dn[0],un=dn[1],vn=c("100%");vn[0];var mn=vn[1],hn=c(null),pn=hn[0],gn=hn[1],fn=c(!1);fn[0];var Cn=fn[1],yn=c(!1),bn=yn[0],wn=yn[1],Sn=d(null),xn=d(new Set),kn=c(null),_n=kn[0],Tn=kn[1],En=c(!1),Mn=En[0],In=En[1],Nn=c(!1);Nn[0],Nn[1];var Dn=c(null);Dn[0],Dn[1],d(null),d(null);var Rn=d(new Map),Ln=d(""),Fn=d(new Map),An=d(!1),Wn=d(null);p(q||(q=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 qn=u(function(){return""===(null==We?void 0:We.trim())||on},[We,on]),Pn=u(function(){return Q},[Q]),jn=u(function(){var e;return je.length>0&&"user"===(null===(e=je[je.length-1])||void 0===e?void 0:e.role)},[je]),zn=u(function(){return qn||Q||!!_e||jn},[qn,Q,_e,jn]);v(function(){null==be||be(on)},[on,be]),v(function(){return function(){Wn.current&&clearTimeout(Wn.current)}},[]),v(function(){var e=De.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;un(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[je]);var Bn=R({handlers:X,setResult:Y}).processHeaderMessage;v(function(){ve&&wn(!0)},[ve]),v(function(){if(Mn){var e=setTimeout(function(){In(!1)},3e3);return function(){return clearTimeout(e)}}},[Mn]),v(function(){Z&&!_e&&(Qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),K(!1))},[Z]),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 ze(function(e){return n(n([],e,!0),[r],!1)}),Qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),Tn(i),V&&V(""),void setTimeout(function(){Tn(null)},2e3)}if(O.startsWith("__SKELETON_END__::")){var a=O.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(V&&V(""))}var s=b();Qn(new KeyboardEvent("keydown",{key:"Enter"}),!1,O,!1,s),Tn(s),V&&V(""),setTimeout(function(){return Tn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[O]),v(function(){Gn(),Zn();var e=function(){var e,n=(null===(e=null==Sn?void 0:Sn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");mn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Hn=m(function(e){var n="string"==typeof e?e:"smooth";Le.current&&Le.current.scrollIntoView({behavior:n,block:"end"}),Re.current&&setTimeout(function(){Le.current&&Re.current&&Le.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!on){var e="";if(bn?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};ze(function(e){return n(n([],e,!0),[t],!1)}),wn(!1),setTimeout(function(){return Hn("smooth")},100)}}},[bn,pe,on,me,fe,Hn]),v(function(){Re.current&&Hn("smooth")},[Hn]);var Gn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ne,"/api/chatbot/getChatSettings?name=").concat(Ee,"&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)&&Je(!0)}).catch(function(e){console.error(e)})},Zn=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(Ee,"&organizationName=").concat(z);try{n={method:"GET",params:{guestSessionId:Me.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(ze(n),Hn()):Je(!0)}).catch(function(e){console.error(e)})}catch(e){Ge(!1),console.error(e)}return[2]})})};function Kn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Un=function(e,i,o,r,a,s,l){var d,c,u,v,m,h,p,g,f,C,y,w,S,x,k,_,T,E,M,I,N,D,R,L,F,A,W,q,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};Bn(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,G=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&G.length>0&&se&&se(G);var Z={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: "))Ke(!0),Z.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===(S=null===(w=null==e?void 0:e.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==Z.content&&(Ge(!1),ze(n(n([],je,!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:""},Z],!1)));else{Ke(!1);var K=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 K&&K&&ce&&ce(K);var U=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,w=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||w||0!==S.length?"":T;_=k?"".concat(k,"\n\n").concat(E):E}if(m.content=Kn(_),!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 M=h.explainability_id,I=h.responded_by;o.has(M)||o.set(M,{responded_by:I,index:i.length})}o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.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 N;h.explainability_id&&h.responded_by&&(M=h.explainability_id,I=h.responded_by,o.has(M)||o.set(M,{responded_by:I,index:i.length})),o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.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,Fn);U.time=new Date,U.citations=G,U.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,U.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,U.sessionId=Me.current,null===(R=U.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Bn(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Ge(!1),ze(n(n([],je,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(q=null===(W=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},U],!1))),Ve(null===(j=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===j?void 0:j.isEnd)}},On=m(function(){console.error("Stream failed or timed out due to inactivity."),An.current=!1,Ve(!0),rn(!1),Cn(!1),Ge(!1),Ke(!1),Ln.current&&H&&w(Ln.current,H,!1),ze(function(e){var t=n([],e,!0).reverse().find(function(e){return"user"===e.role}),i=((null==t?void 0:t.content)||"").replace(/"/g,"&quot;");return n(n([],e,!0),[{role:"assistant",content:'Something went wrong—teaching is taking longer than expected. Please try again.\n\n<button class="clickable-button" data-value="'.concat(i,'">Retry</button>'),id:b(),time:new Date,isEnd:!0,citations:[]}],!1)})},[Te,H]),Vn=m(function(){Wn.current&&(clearTimeout(Wn.current),Wn.current=null),Te&&Te>0&&(Wn.current=setTimeout(On,Te))},[On,Te]),Qn=function(e,i,o,r,a,s){var l,d,c,u,v,m,h=(void 0!==o?o:We||"").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=je[je.length-1])||void 0===d?void 0:d.role);if(!(!h||on||An.current||g||(null==e?void 0:e.key)&&!p)){if(An.current=!0,"I want to add a rule description"===h){Ve(!1),Re.current=!0,rn(!0),!pn&&h&&gn(o||"manual_entry");var f=new Date;return ze(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=Kn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:f,isFirstQuestionSent:!1,id:a||b()}],!1)}),Hn("smooth"),void 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:b(),citations:[],time:new Date}],!1)}),Hn("smooth"),setTimeout(function(){rn(!1),Ve(!0)},500)},500)}Ve(!1),Re.current=!0,rn(!0),!pn&&h&&gn(o||"manual_entry");var C=new Date;ze(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=Kn(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)}),Hn("smooth");var y=new Map,w=[],x={WEBSOCKET_URL:H,organizationName:z,chatAssistantName:Ee,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:Me.current,chatPreviewId:Ie.current,customMetaData:$,aiModel:"",onStreamEvent:function(e){Vn(),Un(e,y,w,C,h,i,a)},onStreamEnd:function(e){Wn.current&&clearTimeout(Wn.current),An.current=!1,Ve(!0),rn(!1),Cn(!1);var i=Date.now(),o=Rn.current.get(Ln.current);if(o){var r=Math.round((i-o)/1e3).toFixed(1);ze(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:r}):e})})}},onError:function(e){Wn.current&&clearTimeout(Wn.current),console.error("Stream error:",e),On()}};if(h)Ge(!0),null===(m=Fe.current)||void 0===m||m.blur(),qe(""),Hn(),nn(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."),Rn.current.set(x.requestId,Date.now()),Ln.current=x.requestId,Vn(),S(x);s&&s(!1)}},Jn=d(null);h(function(){Jn.current=Qn});var $n=m(function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return null===(e=Jn.current)||void 0===e?void 0:e.call.apply(e,n([Jn],t,!1))},[]),Xn=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=L(i),d=o["data-value"],c="Tester Genie"===l;return a(E,t({},o,{className:n,handleStream:$n,isStreamEnd:Oe,disabled:!!pn||!!_e,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":pn===l||pn===d?"true":pn?"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"})]}))]}))}))}}},[$n,Oe,pn,_e]),Yn=u(function(){return je.some(function(e){return e.isSkeleton})},[je]),et=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(),ze(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 Hn("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(I.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ye&&!Yn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:De,className:I.scrollWrapper},{children:[a("div",t({ref:Sn,className:I.stickyHeader},{children:a(k,{resetChatHistory:function(){var e="".concat(Ne,"/api/chat/resetHistory?name=").concat(Ee,"&organizationName=").concat(z);try{var n={method:"GET",params:{guestSessionId:Me.current},withCredentials:!0};y.get(e,n).then(function(){G(!0),Xe(""),gn(null),xn.current.clear(),Fn.current.clear(),Ie.current="".concat(b()),ze([]),Je(!0),null==ee||ee(),U&&U()}).catch(function(e){console.error(e)}).finally(function(){Me.current="".concat(Ee,"-").concat(z,"-").concat(b())})}catch(e){Ge(!1),console.error(e)}},isStreamEnd:Oe,chatTitle:J,onResize:re,chatSize:oe,movingTowards:ae})})),s("div",t({className:I.messagesList},{children:[s("div",t({className:I.initialMessageRow},{children:[a("div",t({className:I.iconWrapper},{children:a(A,{})})),a("div",t({className:I.welcomeTextWrapper},{children:a("div",t({className:I.welcomeMarkdownWrapper},{children:a("span",{children:a(f,t({rehypePlugins:[C],components:Xn},{children:te}))})}))}))]})),je.length>0&&je.map(function(e,n){var i,o;return s("div",t({className:I.messageRow},{children:["assistant"===e.role?a("div",t({className:I.assistantIconContainer},{children:a(A,{})})):a("div",{className:I.userSpacer}),a("div",t({className:I.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(x,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Oe,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:je,handleStream:Qn,isLastMessage:n===je.length-1,onSave:ie,citations:null==e?void 0:e.citations,setChatSize:re,chatSize:oe,isStreamEnd:Oe,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onTypeResponseClick:function(){var e;In(!0),null===(e=Fe.current)||void 0===e||e.focus()},onComparisonLinkClick:Se,baseURL:Ne,onFeedbackSubmit:et,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:I.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:I.userMessageWrapper},{children:[s("div",t({className:I.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Yn||e.id!==_n?"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:je,handleStream:Qn,isLastMessage:n===je.length-1,onSave:ie,citations:null==e?void 0:e.citations,isStreamEnd:Oe,isGlobalEditActive:_e,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onComparisonLinkClick:Se,baseURL:Ne,onFeedbackSubmit:et}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(W,{})}))]})),a("div",t({className:I.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),He&&s("div",t({className:I.loadingRow},{children:[a("div",t({className:I.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(A,{})})),a("div",t({className:I.loadingTextWrapper},{children:a("span",{children:en})}))]})),a("div",{ref:Le,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:I.inputAreaWrapper},{children:a(g,t({title:Q?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(I.inputBoxContainer," ").concat(Pn?I.disabled:""),style:Mn?{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:[je.length>0&&!cn&&a("div",t({onMouseDown:function(e){e.preventDefault(),Hn("smooth")},className:I.scrollToBottomBtn},{children:a(D,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:Fe,placeholder:de,value:We||"",onChange:function(e){qe(e.target.value)},onFocus:function(){return ln(!0)},onBlur:function(){return ln(!1)},onKeyDown:function(e){return Qn(e)},disabled:Pn,className:"no-scrollbar ".concat(I.chatTextarea),style:{minHeight:sn?"120px":"50px",height:sn?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:I.sendButtonWrapper},{children:a("button",t({onClick:function(e){zn||Qn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:zn,className:"".concat(I.sendButton," ").concat(zn?I.disabled:I.active)},{children:a(F,{})}))}))]}))]}))}))})),s("div",t({className:I.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:I.footerToolItem},{children:a(M,{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:I.footerToolItem},{children:a(M,{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 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 w,startChatStream as S}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 M from"../AudioWaveform.js";import I from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as D}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as R,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as F}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as W}from"../_svg/UserIcon.js";var q,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,G=P.setIsNewChatClicked;P.ThinkingBulbIconComponent;var Z=P.isFormSaveClicked,K=P.setIsFormSavedClicked,U=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,we=P.onViewComparison;P.isCopyEnabled;var Se=P.onComparisonLinkClick,xe=P.onSubmitFeedback,ke=P.userDetails,_e=P.isGlobalEditActive,Te=P.socketTimeOutInMilliSeconds,Ee=P.initialDraftMessage,Me=void 0===Ee?"":Ee,Ie=j,Ne=d("".concat(Ie,"-").concat(z,"-").concat(b())),De=d("".concat(b())),Re=B,Le=d(null),Fe=d(!0),Ae=d(null),We=d(null),qe=c(Me),Pe=qe[0],je=qe[1],ze=c([]),Be=ze[0],He=ze[1],Ge=c(!1),Ze=Ge[0],Ke=Ge[1],Ue=c(!1);Ue[0];var Oe=Ue[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],wn=c(!1),Sn=wn[0],xn=wn[1],kn=d(null),_n=d(new Set),Tn=c(null),En=Tn[0],Mn=Tn[1],In=c(!1),Nn=In[0],Dn=In[1],Rn=c(!1);Rn[0],Rn[1];var Ln=c(null);Ln[0],Ln[1],d(null),d(null);var Fn=d(new Map),An=d(""),Wn=d(new Map),qn=d(!1),Pn=d(null);p(q||(q=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 jn=u(function(){return""===(null==Pe?void 0:Pe.trim())||an},[Pe,an]),zn=u(function(){return Q},[Q]),Bn=u(function(){var e;return Be.length>0&&"user"===(null===(e=Be[Be.length-1])||void 0===e?void 0:e.role)},[Be]),Hn=u(function(){return jn||Q||!!_e||Bn},[jn,Q,_e,Bn]);v(function(){Me&&!Pe&&(je(Me),cn(!0),setTimeout(function(){if(We.current){We.current.focus();var e=Me.length;We.current.setSelectionRange(e,e)}},400))},[Me]),v(function(){null==be||be(an)},[an,be]),v(function(){return function(){Pn.current&&clearTimeout(Pn.current)}},[]),v(function(){var e=Le.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=R({handlers:X,setResult:Y}).processHeaderMessage;v(function(){ve&&xn(!0)},[ve]),v(function(){if(Nn){var e=setTimeout(function(){Dn(!1)},3e3);return function(){return clearTimeout(e)}}},[Nn]),v(function(){Z&&!_e&&($n(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),K(!1))},[Z]),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)}),$n(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),Mn(i),V&&V(""),void setTimeout(function(){Mn(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();$n(new KeyboardEvent("keydown",{key:"Enter"}),!1,O,!1,s),Mn(s),V&&V(""),setTimeout(function(){return Mn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[O]),v(function(){Kn(),Un();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";Ae.current&&Ae.current.scrollIntoView({behavior:n,block:"end"}),Fe.current&&setTimeout(function(){Ae.current&&Fe.current&&Ae.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!an){var e="";if(Sn?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)}}},[Sn,pe,an,me,fe,Zn]),v(function(){Fe.current&&Zn("smooth")},[Zn]);var Kn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Re,"/api/chatbot/getChatSettings?name=").concat(Ie,"&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)})},Un=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Re,"/api/chat/history?name=").concat(Ie,"&organizationName=").concat(z);try{n={method:"GET",params:{guestSessionId:Ne.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){Ke(!1),console.error(e)}return[2]})})};function On(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Vn=function(e,i,o,r,a,s,l){var d,c,u,v,m,h,p,g,f,C,y,w,S,x,k,_,T,E,M,I,N,D,R,L,F,A,W,q,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,G=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&G.length>0&&se&&se(G);var Z={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),Z.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===(S=null===(w=null==e?void 0:e.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==Z.content&&(Ke(!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:""},Z],!1)));else{Oe(!1);var K=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 K&&K&&ce&&ce(K);var U=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,w=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||w||0!==S.length?"":T;_=k?"".concat(k,"\n\n").concat(E):E}if(m.content=On(_),!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 M=h.explainability_id,I=h.responded_by;o.has(M)||o.set(M,{responded_by:I,index:i.length})}o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.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 N;h.explainability_id&&h.responded_by&&(M=h.explainability_id,I=h.responded_by,o.has(M)||o.set(M,{responded_by:I,index:i.length})),o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.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,Wn);U.time=new Date,U.citations=G,U.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,U.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,U.sessionId=Ne.current,null===(R=U.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Gn(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Ke(!1),He(n(n([],Be,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(q=null===(W=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},U],!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)}},Qn=m(function(){console.error("Stream failed or timed out due to inactivity."),qn.current=!1,Je(!0),sn(!1),bn(!1),Ke(!1),Oe(!1),An.current&&H&&w(An.current,H,!1),He(function(e){var t=n([],e,!0).reverse().find(function(e){return"user"===e.role}),i=((null==t?void 0:t.content)||"").replace(/"/g,"&quot;");return n(n([],e,!0),[{role:"assistant",content:'Something went wrong—teaching is taking longer than expected. Please try again.\n\n<button class="clickable-button" data-value="'.concat(i,'">Retry</button>'),id:b(),time:new Date,isEnd:!0,citations:[]}],!1)})},[Te,H]),Jn=m(function(){Pn.current&&(clearTimeout(Pn.current),Pn.current=null),Te&&Te>0&&(Pn.current=setTimeout(Qn,Te))},[Qn,Te]),$n=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||qn.current||g||(null==e?void 0:e.key)&&!p)){if(qn.current=!0,"I want to add a rule description"===h){Je(!1),Fe.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=On(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),Fe.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=On(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,w=[],x={WEBSOCKET_URL:H,organizationName:z,chatAssistantName:Ie,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:Ne.current,chatPreviewId:De.current,customMetaData:$,aiModel:"",onStreamEvent:function(e){Jn(),Vn(e,y,w,C,h,i,a)},onStreamEnd:function(e){Pn.current&&clearTimeout(Pn.current),qn.current=!1,Je(!0),sn(!1),bn(!1);var i=Date.now(),o=Fn.current.get(An.current);if(o){var r=Math.round((i-o)/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:r}):e})})}},onError:function(e){Pn.current&&clearTimeout(Pn.current),console.error("Stream error:",e),Qn()}};if(h)Ke(!0),null===(m=We.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."),Fn.current.set(x.requestId,Date.now()),An.current=x.requestId,Jn(),S(x);s&&s(!1)}},Xn=d(null);h(function(){Xn.current=$n});var Yn=m(function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return null===(e=Xn.current)||void 0===e?void 0:e.call.apply(e,n([Xn],t,!1))},[]),et=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=L(i),d=o["data-value"],c="Tester Genie"===l;return a(E,t({},o,{className:n,handleStream:Yn,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"})]}))]}))}))}}},[Yn,Qe,fn,_e]),nt=u(function(){return Be.some(function(e){return e.isSkeleton})},[Be]),tt=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(N.customFont," ").concat(I.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ye&&!nt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Le,className:I.scrollWrapper},{children:[a("div",t({ref:kn,className:I.stickyHeader},{children:a(k,{resetChatHistory:function(){var e="".concat(Re,"/api/chat/resetHistory?name=").concat(Ie,"&organizationName=").concat(z);try{var n={method:"GET",params:{guestSessionId:Ne.current},withCredentials:!0};y.get(e,n).then(function(){G(!0),en(""),Cn(null),_n.current.clear(),Wn.current.clear(),De.current="".concat(b()),He([]),Xe(!0),null==ee||ee(),U&&U()}).catch(function(e){console.error(e)}).finally(function(){Ne.current="".concat(Ie,"-").concat(z,"-").concat(b())})}catch(e){Ke(!1),console.error(e)}},isStreamEnd:Qe,chatTitle:J,onResize:re,chatSize:oe,movingTowards:ae})})),s("div",t({className:I.messagesList},{children:[s("div",t({className:I.initialMessageRow},{children:[a("div",t({className:I.iconWrapper},{children:a(A,{})})),a("div",t({className:I.welcomeTextWrapper},{children:a("div",t({className:I.welcomeMarkdownWrapper},{children:a("span",{children:a(f,t({rehypePlugins:[C],components:et},{children:te}))})}))}))]})),Be.length>0&&Be.map(function(e,n){var i,o;return s("div",t({className:I.messageRow},{children:["assistant"===e.role?a("div",t({className:I.assistantIconContainer},{children:a(A,{})})):a("div",{className:I.userSpacer}),a("div",t({className:I.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:$n,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:we,onTypeResponseClick:function(){var e;Dn(!0),null===(e=We.current)||void 0===e||e.focus()},onComparisonLinkClick:Se,baseURL:Re,onFeedbackSubmit:tt,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:I.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:I.userMessageWrapper},{children:[s("div",t({className:I.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||nt||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:$n,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:we,onComparisonLinkClick:Se,baseURL:Re,onFeedbackSubmit:tt}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(W,{})}))]})),a("div",t({className:I.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ze&&s("div",t({className:I.loadingRow},{children:[a("div",t({className:I.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(A,{})})),a("div",t({className:I.loadingTextWrapper},{children:a("span",{children:tn})}))]})),a("div",{ref:Ae,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:I.inputAreaWrapper},{children:a(g,t({title:Q?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(I.inputBoxContainer," ").concat(zn?I.disabled:""),style:Nn?{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:I.scrollToBottomBtn},{children:a(D,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:We,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 $n(e)},disabled:zn,className:"no-scrollbar ".concat(I.chatTextarea),style:{minHeight:dn||Pe&&Pe.length>40?"120px":"50px",height:dn||Pe&&Pe.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:I.sendButtonWrapper},{children:a("button",t({onClick:function(e){Hn||$n(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Hn,className:"".concat(I.sendButton," ").concat(Hn?I.disabled:I.active)},{children:a(F,{})}))}))]}))]}))}))})),s("div",t({className:I.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:I.footerToolItem},{children:a(M,{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:I.footerToolItem},{children:a(M,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{P as autoGeneratePrompt,j as default};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as i,__spreadArray as t}from"tslib";import{jsx as o,jsxs as n}from"react/jsx-runtime";import{SectionWrapper as r}from"../../molecules/Sections/SectionWrapper.js";import l from"../../_svg/CognitiveDecisioning.js";import{ChevronUpIcon as s,ChevronDownIcon as a}from"lucide-react";import c from"../../TooltipComponent.js";var p=function(p){var d=p.id,h=p.title,g=void 0===h?"Scope":h,u=p.required,x=void 0!==u&&u,v=p.openSections,m=p.setOpenSections,f=p.scopeData,y=p.onScopeChange;p.stationOptions;var b=p.tierOptions,w=void 0===b?[]:b;p.stationLabel;var C=p.tierLabel,S=void 0===C?"Where should this rule apply?":C,k=p.highlights,O=void 0===k?{}:k,L=p.isOpen,I=p.onToggle,M=p.showCognitiveIcon,j=p.cognitiveIcon,D=p.tooltipDescription,E=p.errorMessage,T=p.stationErrorMessage,z=p.tierErrorMessage,B=e(p,["id","title","required","openSections","setOpenSections","scopeData","onScopeChange","stationOptions","tierOptions","stationLabel","tierLabel","highlights","isOpen","onToggle","showCognitiveIcon","cognitiveIcon","tooltipDescription","errorMessage","stationErrorMessage","tierErrorMessage"]);return o(r,i({id:d,title:g,required:x,openSections:v,setOpenSections:m},B,{children:n("div",i({className:"scope-content"},{children:[w.length>0&&n("div",i({className:"form-group"},{children:[n("div",i({style:{display:"flex",alignItems:"center",gap:"4px",marginBottom:"4px"}},{children:[o("span",i({style:{color:"#8F2C23",lineHeight:1}},{children:"*"})),o("label",i({className:(null==B?void 0:B.readOnly)?"readOnly":"form-label",style:{margin:0}},{children:S}))]})),n("div",i({style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}},{children:[o("div",i({className:"checkbox-group",style:{display:"flex",gap:"16px"}},{children:w.map(function(e){var r,l,s=O["scope_".concat(e)],a="tier-".concat(d,"-").concat(e.replace(/\s+/g,"-").toLowerCase());return n("div",i({className:"checkbox-item",style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[o("input",{type:"checkbox",id:a,checked:null===(r=f.tiers)||void 0===r?void 0:r.includes(e),onChange:function(){var i=f.tiers||[],o=i.includes(e)?i.filter(function(i){return i!==e}):t(t([],i,!0),[e],!1);y("tiers",o)},disabled:(null==B?void 0:B.readOnly)||!1,style:{position:"absolute",opacity:0,cursor:"pointer",width:"16px",height:"16px",zIndex:1}}),o("div",i({style:{width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",boxShadow:s?"0 0 14px 4px rgba(37, 99, 235, 0.35)":"none"}},{children:(null===(l=f.tiers)||void 0===l?void 0:l.includes(e))?n("svg",i({width:"16",height:"16",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[o("path",{d:"M4 0.25H10C12.0711 0.25 13.75 1.92893 13.75 4V10C13.75 12.0711 12.0711 13.75 10 13.75H4C1.92893 13.75 0.25 12.0711 0.25 10V4C0.25 1.92893 1.92893 0.25 4 0.25Z",fill:"#2563EB",stroke:"#2563EB","stroke-width":"0.5"}),o("path",{d:"M4 7L6 9L10 5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})):o("div",{style:{width:"14px",height:"14px",border:"1px solid #64748B",borderRadius:"4px",backgroundColor:"white"}})})),o("label",i({style:{color:(null==B?void 0:B.readOnly)?"#9CA3AF":void 0,cursor:(null==B?void 0:B.readOnly)?"not-allowed":"pointer",margin:0,fontSize:"14px"},htmlFor:"tier-".concat(d,"-").concat(e.toLowerCase().replace(/\s+/g,"-"))},{children:e}))]}),a)})})),o("div",i({style:{width:"fit-content"}},{children:o(c,i({description:null!=D?D:""},{children:M&&n("button",i({onClick:function(e){e.preventDefault(),null==I||I()},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"2px",padding:"2px 6px ",flexShrink:0,border:"none",backgroundColor:"transparent",borderRadius:"4px",cursor:"pointer",outline:"none",maxWidth:"fit-content",transition:"background-color 0.2s ease",marginTop:"6px",marginLeft:"6px"}},{children:[j||o(l,{}),o(L?s:a,{size:16})]}))}))}))]})),z&&o("div",i({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:z}))]})),E&&!T&&!z&&o("div",i({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:E}))]}))}))};export{p as ScopeSection};
1
+ import{__rest as e,__assign as i}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{SectionWrapper as n}from"../../molecules/Sections/SectionWrapper.js";import r from"../../_svg/CognitiveDecisioning.js";import{ChevronUpIcon as l,ChevronDownIcon as s}from"lucide-react";import a from"../../TooltipComponent.js";var d=function(d){var p=d.id,c=d.title,g=void 0===c?"Scope":c,h=d.required,x=void 0!==h&&h,u=d.openSections,m=d.setOpenSections,v=d.scopeData,b=d.onScopeChange;d.stationOptions;var f=d.tierOptions,y=void 0===f?[]:f;d.stationLabel;var S=d.tierLabel,C=void 0===S?"Where should this rule apply?":S,O=d.highlights,w=void 0===O?{}:O,I=d.isOpen,k=d.onToggle,z=d.showCognitiveIcon,j=d.cognitiveIcon,D=d.tooltipDescription,L=d.errorMessage,M=d.stationErrorMessage,T=d.tierErrorMessage,E=e(d,["id","title","required","openSections","setOpenSections","scopeData","onScopeChange","stationOptions","tierOptions","stationLabel","tierLabel","highlights","isOpen","onToggle","showCognitiveIcon","cognitiveIcon","tooltipDescription","errorMessage","stationErrorMessage","tierErrorMessage"]);return o(n,i({id:p,title:g,required:x,openSections:u,setOpenSections:m},E,{children:t("div",i({className:"scope-content"},{children:[y.length>0&&t("div",i({className:"form-group"},{children:[t("div",i({style:{display:"flex",alignItems:"center",gap:"4px",marginBottom:"4px"}},{children:[o("span",i({style:{color:"#8F2C23",lineHeight:1}},{children:"*"})),o("label",i({className:(null==E?void 0:E.readOnly)?"readOnly":"form-label",style:{margin:0}},{children:C}))]})),t("div",i({style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}},{children:[o("div",i({className:"checkbox-group",style:{display:"flex",gap:"16px"}},{children:y.map(function(e){var n,r,l=w["scope_".concat(e)],s="tier-".concat(p,"-").concat(e.replace(/\s+/g,"-").toLowerCase());return t("div",i({className:"checkbox-item",style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[o("input",{type:"radio",name:"scope-tiers-".concat(p),id:s,checked:null===(n=v.tiers)||void 0===n?void 0:n.includes(e),onChange:function(){b("tiers",[e])},disabled:(null==E?void 0:E.readOnly)||!1,style:{position:"absolute",opacity:0,cursor:"pointer",width:"16px",height:"16px",zIndex:1}}),o("div",i({style:{width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",boxShadow:l?"0 0 14px 4px rgba(37, 99, 235, 0.35)":"none",borderRadius:"50%"}},{children:(null===(r=v.tiers)||void 0===r?void 0:r.includes(e))?o("div",{style:{width:"16px",height:"16px",borderRadius:"50%",border:"5px solid #2563EB",backgroundColor:"white",boxSizing:"border-box"}}):o("div",{style:{width:"16px",height:"16px",border:"1px solid #64748B",borderRadius:"50%",backgroundColor:"white",boxSizing:"border-box"}})})),o("label",i({style:{color:(null==E?void 0:E.readOnly)?"#9CA3AF":void 0,cursor:(null==E?void 0:E.readOnly)?"not-allowed":"pointer",margin:0,fontSize:"14px"},htmlFor:s},{children:e}))]}),s)})})),o("div",i({style:{width:"fit-content"}},{children:o(a,i({description:null!=D?D:""},{children:z&&t("button",i({onClick:function(e){e.preventDefault(),null==k||k()},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"2px",padding:"2px 6px ",flexShrink:0,border:"none",backgroundColor:"transparent",borderRadius:"4px",cursor:"pointer",outline:"none",maxWidth:"fit-content",transition:"background-color 0.2s ease",marginTop:"6px",marginLeft:"6px"}},{children:[j||o(r,{}),o(I?l:s,{size:16})]}))}))}))]})),T&&o("div",i({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:T}))]})),L&&!M&&!T&&o("div",i({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:L}))]}))}))};export{d as ScopeSection};
2
2
  //# sourceMappingURL=ScopeSection.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import t,{useState as o,useEffect as l}from"react";import{InputDataReasoningCard as r}from"../../InputDataReasoningCard.js";import{ConditionSection as a}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as d}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as c}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as u}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as v}from"../../_svg/ButtonCognitiveIcon.js";import{Loader2Icon as p,Pencil as f,Check as g,AlertTriangle as h}from"lucide-react";var y=function(o){var l=o.children,r=o.onAddVariant,a=o.isDisabled,d=o.showAddVariantBtn,c=void 0===d||d,u=t.Children.toArray(l);return n("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[u.map(function(i,o){var l=!(o===u.length-1)||c;return n(t.Fragment,{children:[i,l&&e("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},o)}),c&&e("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},m=function(m){var x,T,D,S,A,C,I,b,O,E,w,V,R=m.state,_=m.handlers,N=m.uiState,W=(null==N?void 0:N.highlights)||new Map,B=W.get("global_0")||{},F=o({}),M=F[0],j=F[1],k=o(null),L=k[0],z=k[1],q="rule-setup"===(null==N?void 0:N.activeEditId),P=t.useRef(new Map),J=o(null),H=J[0],K=J[1],$=o(null),U=$[0],Z=$[1],G=o(!1),Q=G[0],X=G[1],Y=t.useRef(null==N?void 0:N.isAiStreaming);l(function(){Y.current&&!(null==N?void 0:N.isAiStreaming)&&Q&&X(!1),Y.current=null==N?void 0:N.isAiStreaming},[null==N?void 0:N.isAiStreaming,Q]);var ii=function(){var i;K(null),Z(null),null===(i=null==N?void 0:N.setActiveEditId)||void 0===i||i.call(N,null)},ni=function(){var i,n,e=null!=H?H:R.ruleTitle,t=null!=U?U:R.scopeData,o=e!==R.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(R.scopeData);if(!o&&!l)return K(null),Z(null),void(null===(i=null==N?void 0:N.setActiveEditId)||void 0===i||i.call(N,null));if(null==N?void 0:N.setSendMessageInChat){var r="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),a=[];if(o&&a.push((null==e?void 0:e.trim())?"Title with ".concat(e):"No Title"),l){var d=null==t?void 0:t.tiers,c=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";a.push(c)}var u=a.join(" and ");N.setSendMessageInChat("__SKELETON__:".concat(r,":Update Rule Setup ").concat(u))}X(!0),K(null),Z(null),null===(n=null==N?void 0:N.setActiveEditId)||void 0===n||n.call(N,null)},ei=null!==H?null==H?void 0:H.trim():(R.ruleTitle||"").trim(),ti=null!=U?U:R.scopeData,oi=ei!==(R.ruleTitle||"").trim(),li=JSON.stringify(ti)!==JSON.stringify(R.scopeData),ri=!oi&&!li||""===ei,ai=t.useRef(null==N?void 0:N.defaultVariantOpen),di=t.useRef(null==N?void 0:N.activeVariantAccordionIndex),ci=t.useRef(null==N?void 0:N.defaultTierOpen),ui=t.useRef(null===(x=R.scopeData)||void 0===x?void 0:x.tiers),si=t.useRef(R.variantsByTier);t.useEffect(function(){var i,n,e,t,o,l,r=null,a=!1;ai.current!==(null==N?void 0:N.defaultVariantOpen)&&(a=!0,ai.current=null==N?void 0:N.defaultVariantOpen),di.current!==(null==N?void 0:N.activeVariantAccordionIndex)&&(a=!0,di.current=null==N?void 0:N.activeVariantAccordionIndex),ci.current!==(null==N?void 0:N.defaultTierOpen)&&(a=!0,ci.current=null==N?void 0:N.defaultTierOpen);var d=(null===(i=R.scopeData)||void 0===i?void 0:i.tiers)||[];JSON.stringify(ui.current)!==JSON.stringify(d)&&(a=!0,ui.current=d);var c=(null===(n=null==N?void 0:N.tierOptions)||void 0===n?void 0:n.filter(function(i){var n,e;return null===(e=null===(n=R.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||[],u=c.some(function(i){var n,e,t,o,l=i.toLowerCase().replace(/ /g,"_");return((null===(e=null===(n=si.current)||void 0===n?void 0:n[l])||void 0===e?void 0:e.length)||0)!==((null===(o=null===(t=R.variantsByTier)||void 0===t?void 0:t[l])||void 0===o?void 0:o.length)||0)});if(u&&(a=!0),a){var s=null!==(e=null==N?void 0:N.activeVariantAccordionIndex)&&void 0!==e?e:null==N?void 0:N.defaultVariantOpen;if(null==s||s<0)return z(null),void(si.current=R.variantsByTier);c.forEach(function(i,n){var e;if(!((null==N?void 0:N.defaultTierOpen)>=0&&n!==N.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_"),o=(null===(e=R.variantsByTier)||void 0===e?void 0:e[t])||[];o[s]&&(r="".concat(t,"-variant-").concat(s)),null!=(null==N?void 0:N.autoScrollVariantIndex)&&o[N.autoScrollVariantIndex]&&(r="".concat(t,"-variant-").concat(N.autoScrollVariantIndex))}}),r&&z(r)}if(null===L){var v=null!==(t=null==N?void 0:N.activeVariantAccordionIndex)&&void 0!==t?t:null==N?void 0:N.defaultVariantOpen;null!=v&&v>=0&&(null===(l=null===(o=null==N?void 0:N.tierOptions)||void 0===o?void 0:o.filter(function(i){var n,e;return null===(e=null===(n=R.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===l||l.forEach(function(i,n){var e;if(!((null==N?void 0:N.defaultTierOpen)>=0&&n!==N.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_");((null===(e=R.variantsByTier)||void 0===e?void 0:e[t])||[])[v]&&z("".concat(t,"-variant-").concat(v))}}))}si.current=R.variantsByTier},[R.variantsByTier,null==N?void 0:N.defaultVariantOpen,null==N?void 0:N.activeVariantAccordionIndex,null===(T=R.scopeData)||void 0===T?void 0:T.tiers,null==N?void 0:N.tierOptions,null==N?void 0:N.autoScrollVariantIndex,null==N?void 0:N.defaultTierOpen]);var vi=function(n){j(function(e){var t;return i(i({},e),((t={})[n]=!e[n],t))})},pi=function(i){var n,e,t,o=i.split("_"),l=o[o.length-1],r=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,a=null===(n=R.fieldCitations)||void 0===n?void 0:n[r];if(Array.isArray(a)&&a.length>0)return a;var d=null===(e=R.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(d)&&d.length>0?d:null!==(t=R.citations)&&void 0!==t?t:[]},fi={marginTop:"-17px",position:"relative",zIndex:1};l(function(){var i,n;null!=(null==N?void 0:N.autoScrollVariantIndex)&&(null===(n=null===(i=null==N?void 0:N.tierOptions)||void 0===i?void 0:i.filter(function(i){var n,e;return null===(e=null===(n=R.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===n||n.forEach(function(i){var n=i.toLowerCase().replace(/ /g,"_"),e="".concat(n,"-variant-").concat(N.autoScrollVariantIndex),t=P.current.get(e);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==N?void 0:N.scrollTrigger]),console.log("CreateRule state:",R),console.log("CreateRule uiState:",N);var gi=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},hi=!!(null==N?void 0:N.activeEditId);return n("div",i({className:"traffic-manager-template"},{children:[e("div",i({"data-edit-id":"rule-setup"},{children:e(s,i({title:{type:"other",label:(null==N?void 0:N.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(q)return null;var o=!!(null==N?void 0:N.activeEditId)&&"rule-setup"!==N.activeEditId;return e("div",i({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e("button",i({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==N?void 0:N.setPendingEditId)&&N.setPendingEditId(N.activeEditId||null):(!function(){var n,e;(null==N?void 0:N.activeEditId)&&"rule-setup"!==N.activeEditId||(null===(n=null==N?void 0:N.setActiveEditId)||void 0===n||n.call(N,"rule-setup"),K(null!==(e=R.ruleTitle)&&void 0!==e?e:""),Z(R.scopeData?i({},R.scopeData):{}))}(),(null==N?void 0:N.setPendingEditId)&&N.setPendingEditId(null),n||t())},disabled:Q,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:Q?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:Q?.5:1}},{children:e(f,{size:14})}))}))},footerData:{ruleTitle:R.ruleTitle,stations:[R.scopeData.station],tiers:null===(D=R.scopeData)||void 0===D?void 0:D.tiers},defaultOpen:"Create"===(null==N?void 0:N.usedFor),readOnly:"Create"!==(null==N?void 0:N.usedFor),isAiStreaming:null==N?void 0:N.isAiStreaming,editFlow:"Edit"===(null==N?void 0:N.usedFor)},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[Q&&(null==N?void 0:N.isAiStreaming)&&n("div",i({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e(u,i({id:"rule-title",title:N.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:q&&null!==H?H:R.ruleTitle,onChange:function(i){return q?K(i):_.setRuleTitle(i)},readOnly:(null==N?void 0:N.isAiStreaming)||!q,isOpen:M.ruleTitle,onToggle:function(){return vi("ruleTitle")},isHighlighted:B.ruleTitle||!1,showCognitiveIcon:R.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(S=N.validationErrors)||void 0===S?void 0:S.ruleTitle},N)),R.citation.ruleTitle&&e("div",i({style:fi},{children:e(r,{isVisible:M.ruleTitle,citation:R.citation.ruleTitle,citations:pi("ruleTitle"),fieldName:"Rule Title",fieldValue:R.ruleTitle})})),e(c,i({id:"scope",title:"",required:!1,scopeData:q&&null!==U?U:R.scopeData,onScopeChange:function(n,e){q?Z(function(t){var o;return i(i({},null!=t?t:R.scopeData),((o={})[n]=e,o))}):_.onScopeChange(n,e)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:B,isOpen:M.scopeData,onToggle:function(){return vi("scopeData")},showCognitiveIcon:R.citation.scopeData,cognitiveIcon:e(v,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(A=N.validationErrors)||void 0===A?void 0:A.station)||(null===(C=N.validationErrors)||void 0===C?void 0:C.tiers),stationErrorMessage:null===(I=N.validationErrors)||void 0===I?void 0:I.station,tierErrorMessage:null===(b=N.validationErrors)||void 0===b?void 0:b.tiers,readOnly:(null==N?void 0:N.isAiStreaming)||!q},N)),R.citation.scopeData&&e("div",i({style:fi},{children:e(r,{isVisible:M.scopeData,citation:R.citation.scopeData,citations:pi("scopeData"),fieldName:"Scope",fieldValue:null===(E=null===(O=R.scopeData)||void 0===O?void 0:O.tiers)||void 0===E?void 0:E.join(", ")})})),q?n("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[n("div",i({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e("button",i({onClick:ii,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),n("button",i({onClick:ni,disabled:ri,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ri?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ri?.5:1}},{children:[e(g,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==N?void 0:N.pendingEditId)&&n("div",i({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"10px"}},{children:[e(h,{size:14,style:{color:"#C2410C"}}),e("div",i({style:{color:"#C2410C",fontSize:"13px"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(V=null===(w=null==N?void 0:N.tierOptions)||void 0===w?void 0:w.filter(function(i){var n,e;return null===(e=null===(n=R.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===V?void 0:V.map(function(t,o,l){var c,v,p,f,g=t.toLowerCase().replace(/ /g,"_"),h=(null===(c=R.variantsByTier)||void 0===c?void 0:c[g])||[],m=h.length,x=!1;if(1===m){var T=h[0],D=!(null===(v=null==T?void 0:T.ruleDescription)||void 0===v?void 0:v.trim()),S=(null===(p=null==T?void 0:T.whenToApplyConditions)||void 0===p?void 0:p.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,A=(null===(f=null==T?void 0:T.whenNotToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;D&&!S&&!A&&(x=!0)}var C=x?void 0:"".concat(m," ").concat(1===m?"variant":"variants"," configured for this tier"),I=!((null==N?void 0:N.defaultTierOpen)>=0)||o===N.defaultTierOpen;return console.log("Rendering tier : ",t),e(s,i({variant:"tier-header",title:{type:"other",label:t},subtitle:C,defaultOpen:I,footerData:{description:"Variants for ".concat(t)}},{children:e(y,i({onAddVariant:function(){var i;return null===(i=_.addNewVariant)||void 0===i?void 0:i.call(_,g)},isDisabled:null==N?void 0:N.isAiStreaming,showAddVariantBtn:"Edit"!==(null==N?void 0:N.usedFor)},{children:h.map(function(t,o){var l,c,v,p,f,h,y,m,x,T,D,S=t.variantType||"default",A="".concat(g,"-variant-").concat(o),C=!0===t.is_variant,I="default"===S||"default_variant"===S;(null==N?void 0:N.defaultVariantOpen)>=0&&N.defaultVariantOpen;var b="".concat(g,"_").concat(o),O=W.get(b)||{},E=(null===(c=null===(l=N.separationItemsByTier)||void 0===l?void 0:l[g])||void 0===c?void 0:c.get(o))||[],w=(null===(p=null===(v=N.togglesByTier)||void 0===v?void 0:v[g])||void 0===p?void 0:p.get(o))||[];(null==N?void 0:N.autoScrollVariantIndex)===o||t.is_variant,console.log("Rendering ".concat(g," variant ").concat(o,":"),t),console.log("Rendering Variant : ",t),console.log("Open Accordion ID:",L,"Current Variant ID:",A);var V=null===(f=null==N?void 0:N.activeEditId)||void 0===f?void 0:f.startsWith("condition-wta-".concat(g,"-").concat(o)),B=null===(h=null==N?void 0:N.activeEditId)||void 0===h?void 0:h.startsWith("condition-wnta-".concat(g,"-").concat(o));return e("div",i({ref:function(i){i?P.current.set(A,i):P.current.delete(A)},style:{width:"100%"}},{children:e(s,i({title:{type:I?"default":"variant",label:gi(S),number:o+1,isNewVariant:C,isDefault:t.isDefault,isModified:t.isModified},defaultOpen:!0,expanded:L===A,onToggle:function(){var i,n=L===A;console.log("is closing:",n),z(n?null:A),null===(i=null==N?void 0:N.setActiveVariantAccordionIndex)||void 0===i||i.call(N,n?null:o)},variant:"rule-behavior",footerData:{ruleTitle:S,description:t.ruleDescription||""}},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e(u,i({id:"rule-description-".concat(g,"-").concat(o),title:N.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:t.isReadOnly||(null==N?void 0:N.isAiStreaming)||hi&&(null==N?void 0:N.activeEditId)!=="rule-description-".concat(g,"-").concat(o),value:t.ruleDescription||"",onChange:function(i){return _.setRuleDescription(g,o,i)},isOpen:M["ruleDescription-".concat(g)],onToggle:function(){return vi("ruleDescription-".concat(g))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(y=R.citation)||void 0===y?void 0:y["ruleDescription_".concat(g)],tooltipDescription:"Why this Description?",errorMessage:null===(m=N.validationErrors)||void 0===m?void 0:m["ruleDescription-".concat(g,"-").concat(o)],enableInlineEdit:!0,setSendMessageInChat:null==N?void 0:N.setSendMessageInChat,isAiStreaming:null==N?void 0:N.isAiStreaming,fieldName:"Rule Description"},N)),(null===(x=R.citation)||void 0===x?void 0:x["ruleDescription_".concat(g)])&&e("div",i({style:fi},{children:e(r,{isVisible:M["ruleDescription-".concat(g)],citation:R.citation["ruleDescription_".concat(g)],citations:pi("ruleDescription_".concat(g,"_").concat(o)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),e(a,i({id:"when-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wta",title:N.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:t.isReadOnly||(null==N?void 0:N.isAiStreaming)||hi&&!V,conditions:t.whenToApplyConditions||[],onAdd:function(){return _.addWhenToApply(g,o)},onRemove:function(i,n,e){return _.removeWhenToApply(i,n,e)},onEdit:function(i,n,e,t){return _.editWhenToApply(i,n,e,t)},index:o,tierKey:g,isHighlighted:O.wta||!1,highlightedIds:null==N?void 0:N.highlightedIds,tooltipDescription:"Why this Condition?",citations:pi("whenToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:N.isAiStreaming,errorMessage:(null===(T=N.validationErrors)||void 0===T?void 0:T["whenToApply-".concat(g,"-").concat(o)])||(null==N?void 0:N.conflictReason)},N)),e(a,i({id:"when-not-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wnta",title:N.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:t.isReadOnly||(null==N?void 0:N.isAiStreaming)||hi&&!B,conditions:t.whenNotToApplyConditions||[],onAdd:function(){return _.addWhenNotToApply(g,o)},onRemove:function(i,n,e){return _.removeWhenNotToApply(i,n,e)},onEdit:function(i,n,e,t){return _.editWhenNotToApply(i,n,e,t)},index:o,tierKey:g,isHighlighted:O.wnta||!1,highlightedIds:null==N?void 0:N.highlightedIds,tooltipDescription:"Why this Condition?",citations:pi("whenNotToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:N.isAiStreaming},N)),e(d,i({id:"config-".concat(g,"-").concat(o),title:N.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:t.isReadOnly||(null==N?void 0:N.isAiStreaming)||hi&&(null==N?void 0:N.activeEditId)!=="config-".concat(g,"-").concat(o),onConfigChange:function(i,n){return _.onConfigChange(g,o,i,n)},separationItems:E,toggles:w,index:o},N)),(null===(D=t.reasoning)||void 0===D?void 0:D.configData)&&e("div",i({style:fi},{children:e(r,{citation:t.reasoning.configData,citations:pi("configData_".concat(g,"_").concat(o)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),A)}),"".concat(g,"-variant-").concat(o))})}))}),"tier-".concat(o))})]}))};export{m as CreateRule};
1
+ import{__assign as i}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import t,{useState as o,useEffect as l}from"react";import{InputDataReasoningCard as r}from"../../InputDataReasoningCard.js";import{ConditionSection as a}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as d}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as c}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as u}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as v}from"../../_svg/ButtonCognitiveIcon.js";import{Loader2Icon as p,Pencil as f,Check as g,AlertTriangle as h}from"lucide-react";var y=function(o){var l=o.children,r=o.onAddVariant,a=o.isDisabled,d=o.showAddVariantBtn,c=void 0===d||d,u=t.Children.toArray(l);return e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[u.map(function(i,o){var l=!(o===u.length-1)||c;return e(t.Fragment,{children:[i,l&&n("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},o)}),c&&n("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},m=function(m){var T,x,D,S,A,C,I,b,O,w,E,V=m.state,R=m.handlers,_=m.uiState,N=(null==_?void 0:_.highlights)||new Map,W=N.get("global_0")||{},L=o({}),B=L[0],F=L[1],M=o(null),j=M[0],k=M[1],z=o(function(){var i,e,n;if((null==_?void 0:_.defaultTierOpen)>=0&&(null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i[_.defaultTierOpen]))return _.tierOptions[_.defaultTierOpen].toLowerCase().replace(/ /g,"_");var t=null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n[0];return t?t.toLowerCase().replace(/ /g,"_"):null});z[0];var q=z[1],P="rule-setup"===(null==_?void 0:_.activeEditId),J=t.useRef(new Map),H=o(null),K=H[0],$=H[1],U=o(null),Z=U[0],G=U[1],Q=o(!1),X=Q[0],Y=Q[1],ii=t.useRef(null==_?void 0:_.isAiStreaming);l(function(){ii.current&&!(null==_?void 0:_.isAiStreaming)&&X&&Y(!1),ii.current=null==_?void 0:_.isAiStreaming},[null==_?void 0:_.isAiStreaming,X]);var ei=function(){var i;$(null),G(null),null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null)},ni=function(){var i,e,n=null!=K?K:V.ruleTitle,t=null!=Z?Z:V.scopeData,o=n!==V.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(V.scopeData);if(!o&&!l)return $(null),G(null),void(null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null));if(null==_?void 0:_.setSendMessageInChat){var r="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),a=[];if(o&&a.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,c=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";a.push(c)}var u=a.join(" and ");_.setSendMessageInChat("__SKELETON__:".concat(r,":Update Rule Setup ").concat(u))}Y(!0),$(null),G(null),null===(e=null==_?void 0:_.setActiveEditId)||void 0===e||e.call(_,null)},ti=null!==K?null==K?void 0:K.trim():(V.ruleTitle||"").trim(),oi=null!=Z?Z:V.scopeData,li=ti!==(V.ruleTitle||"").trim(),ri=JSON.stringify(oi)!==JSON.stringify(V.scopeData),ai=!li&&!ri||""===ti,di=t.useRef(null==_?void 0:_.defaultVariantOpen),ci=t.useRef(null==_?void 0:_.activeVariantAccordionIndex),ui=t.useRef(null==_?void 0:_.defaultTierOpen),si=t.useRef(null===(T=V.scopeData)||void 0===T?void 0:T.tiers),vi=t.useRef(V.variantsByTier);t.useEffect(function(){var i,e,n,t,o,l,r=null,a=!1;di.current!==(null==_?void 0:_.defaultVariantOpen)&&(a=!0,di.current=null==_?void 0:_.defaultVariantOpen),ci.current!==(null==_?void 0:_.activeVariantAccordionIndex)&&(a=!0,ci.current=null==_?void 0:_.activeVariantAccordionIndex),ui.current!==(null==_?void 0:_.defaultTierOpen)&&(a=!0,ui.current=null==_?void 0:_.defaultTierOpen);var d=(null===(i=V.scopeData)||void 0===i?void 0:i.tiers)||[];JSON.stringify(si.current)!==JSON.stringify(d)&&(a=!0,si.current=d,d.length>0&&q(d[0].toLowerCase().replace(/ /g,"_")));var c=(null===(e=null==_?void 0:_.tierOptions)||void 0===e?void 0:e.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||[],u=c.some(function(i){var e,n,t,o,l=i.toLowerCase().replace(/ /g,"_");return((null===(n=null===(e=vi.current)||void 0===e?void 0:e[l])||void 0===n?void 0:n.length)||0)!==((null===(o=null===(t=V.variantsByTier)||void 0===t?void 0:t[l])||void 0===o?void 0:o.length)||0)});if(u&&(a=!0),a){var s=null!==(n=null==_?void 0:_.activeVariantAccordionIndex)&&void 0!==n?n:null==_?void 0:_.defaultVariantOpen;if(null==s||s<0)return k(null),void(vi.current=V.variantsByTier);c.forEach(function(i,e){var n;if(!((null==_?void 0:_.defaultTierOpen)>=0&&e!==_.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_"),o=(null===(n=V.variantsByTier)||void 0===n?void 0:n[t])||[];o[s]&&(r="".concat(t,"-variant-").concat(s)),null!=(null==_?void 0:_.autoScrollVariantIndex)&&o[_.autoScrollVariantIndex]&&(r="".concat(t,"-variant-").concat(_.autoScrollVariantIndex))}}),r&&k(r)}if(null===j){var v=null!==(t=null==_?void 0:_.activeVariantAccordionIndex)&&void 0!==t?t:null==_?void 0:_.defaultVariantOpen;null!=v&&v>=0&&(null===(l=null===(o=null==_?void 0:_.tierOptions)||void 0===o?void 0:o.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===l||l.forEach(function(i,e){var n;if(!((null==_?void 0:_.defaultTierOpen)>=0&&e!==_.defaultTierOpen)){var t=i.toLowerCase().replace(/ /g,"_");((null===(n=V.variantsByTier)||void 0===n?void 0:n[t])||[])[v]&&k("".concat(t,"-variant-").concat(v))}}))}vi.current=V.variantsByTier},[V.variantsByTier,null==_?void 0:_.defaultVariantOpen,null==_?void 0:_.activeVariantAccordionIndex,null===(x=V.scopeData)||void 0===x?void 0:x.tiers,null==_?void 0:_.tierOptions,null==_?void 0:_.autoScrollVariantIndex,null==_?void 0:_.defaultTierOpen]);var pi=function(e){F(function(n){var t;return i(i({},n),((t={})[e]=!n[e],t))})},fi=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],r=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,a=null===(e=V.fieldCitations)||void 0===e?void 0:e[r];if(Array.isArray(a)&&a.length>0)return a;var d=null===(n=V.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=V.citations)&&void 0!==t?t:[]},gi={marginTop:"-17px",position:"relative",zIndex:1};l(function(){var i,e;null!=(null==_?void 0:_.autoScrollVariantIndex)&&(null===(e=null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(_.autoScrollVariantIndex),t=J.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==_?void 0:_.scrollTrigger]),console.log("CreateRule state:",V),console.log("CreateRule uiState:",_);var hi=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},yi=!!(null==_?void 0:_.activeEditId);return e("div",i({className:"traffic-manager-template"},{children:[n("div",i({"data-edit-id":"rule-setup"},{children:n(s,i({title:{type:"other",label:(null==_?void 0:_.setupLabel)||"Rule Setup"},actionButtons:function(e,t){if(P)return null;var o=!!(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId;return n("div",i({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:n("button",i({title:o?"Save active edits first":"Edit",onClick:function(n){n.stopPropagation(),o?(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(_.activeEditId||null):(!function(){var e,n;(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId||(null===(e=null==_?void 0:_.setActiveEditId)||void 0===e||e.call(_,"rule-setup"),$(null!==(n=V.ruleTitle)&&void 0!==n?n:""),G(V.scopeData?i({},V.scopeData):{}))}(),(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(null),e||t())},disabled:X,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:X?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:X?.5:1}},{children:n(f,{size:14})}))}))},footerData:{ruleTitle:V.ruleTitle,stations:[V.scopeData.station],tiers:null===(D=V.scopeData)||void 0===D?void 0:D.tiers},defaultOpen:"Create"===(null==_?void 0:_.usedFor),readOnly:"Create"!==(null==_?void 0:_.usedFor),isAiStreaming:null==_?void 0:_.isAiStreaming,editFlow:"Edit"===(null==_?void 0:_.usedFor)},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[X&&(null==_?void 0:_.isAiStreaming)&&e("div",i({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[n(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),n(u,i({id:"rule-title",title:_.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:P&&null!==K?K:V.ruleTitle,onChange:function(i){return P?$(i):R.setRuleTitle(i)},readOnly:(null==_?void 0:_.isAiStreaming)||!P,isOpen:B.ruleTitle,onToggle:function(){return pi("ruleTitle")},isHighlighted:W.ruleTitle||!1,showCognitiveIcon:V.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(S=_.validationErrors)||void 0===S?void 0:S.ruleTitle},_)),V.citation.ruleTitle&&n("div",i({style:gi},{children:n(r,{isVisible:B.ruleTitle,citation:V.citation.ruleTitle,citations:fi("ruleTitle"),fieldName:"Rule Title",fieldValue:V.ruleTitle})})),n(c,i({id:"scope",title:"",required:!1,scopeData:P&&null!==Z?Z:V.scopeData,onScopeChange:function(e,n){P?G(function(t){var o;return i(i({},null!=t?t:V.scopeData),((o={})[e]=n,o))}):R.onScopeChange(e,n)},tierLabel:"Which tier are you configuring this learning for?",stationLabel:"Which scope should this learning belong to?",highlights:W,isOpen:B.scopeData,onToggle:function(){return pi("scopeData")},showCognitiveIcon:V.citation.scopeData,cognitiveIcon:n(v,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(A=_.validationErrors)||void 0===A?void 0:A.station)||(null===(C=_.validationErrors)||void 0===C?void 0:C.tiers),stationErrorMessage:null===(I=_.validationErrors)||void 0===I?void 0:I.station,tierErrorMessage:null===(b=_.validationErrors)||void 0===b?void 0:b.tiers,readOnly:(null==_?void 0:_.isAiStreaming)||!P},_)),V.citation.scopeData&&n("div",i({style:gi},{children:n(r,{isVisible:B.scopeData,citation:V.citation.scopeData,citations:fi("scopeData"),fieldName:"Scope",fieldValue:null===(w=null===(O=V.scopeData)||void 0===O?void 0:O.tiers)||void 0===w?void 0:w.join(", ")})})),P?e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[n("button",i({onClick:ei,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e("button",i({onClick:ni,disabled:ai,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ai?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ai?.5:1}},{children:[n(g,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==_?void 0:_.pendingEditId)&&e("div",i({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"10px"}},{children:[n(h,{size:14,style:{color:"#C2410C"}}),n("div",i({style:{color:"#C2410C",fontSize:"13px"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(E=null==_?void 0:_.tierOptions)||void 0===E?void 0:E.map(function(t,o){var l,c,v,p,f,g,h=t.toLowerCase().replace(/ /g,"_"),m=(null===(l=V.variantsByTier)||void 0===l?void 0:l[h])||[],T=null===(v=null===(c=V.scopeData)||void 0===c?void 0:c.tiers)||void 0===v?void 0:v.includes(t),x=m.length,D=!1;if(1===x){var S=m[0],A=!(null===(p=null==S?void 0:S.ruleDescription)||void 0===p?void 0:p.trim()),C=(null===(f=null==S?void 0:S.whenToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,I=(null===(g=null==S?void 0:S.whenNotToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;!A||C||I||(D=!0)}var b=D?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier");return console.log("Rendering tier : ",t),n(s,i({variant:"tier-header",title:{type:"other",label:t},subtitle:b,defaultOpen:!0,footerData:{description:"Variants for ".concat(t)}},{children:n(y,i({onAddVariant:function(){var i;return null===(i=R.addNewVariant)||void 0===i?void 0:i.call(R,h)},isDisabled:!T||(null==_?void 0:_.isAiStreaming),showAddVariantBtn:"Edit"!==(null==_?void 0:_.usedFor)},{children:m.map(function(t,o){var l,c,v,p,f,g,y,m,x,D,S=t.variantType||"default",A="".concat(h,"-variant-").concat(o),C=!0===t.is_variant,I="default"===S||"default_variant"===S,b="".concat(h,"_").concat(o),O=N.get(b)||{},w=(null===(c=null===(l=_.separationItemsByTier)||void 0===l?void 0:l[h])||void 0===c?void 0:c.get(o))||[],E=(null===(p=null===(v=_.togglesByTier)||void 0===v?void 0:v[h])||void 0===p?void 0:p.get(o))||[],W=null===(f=null==_?void 0:_.activeEditId)||void 0===f?void 0:f.startsWith("condition-wta-".concat(h,"-").concat(o)),L=null===(g=null==_?void 0:_.activeEditId)||void 0===g?void 0:g.startsWith("condition-wnta-".concat(h,"-").concat(o)),F=!T||t.isReadOnly||(null==_?void 0:_.isAiStreaming);return n("div",i({ref:function(i){i?J.current.set(A,i):J.current.delete(A)},style:{width:"100%",opacity:T?1:.7}},{children:n(s,i({title:{type:I?"default":"variant",label:hi(S),number:o+1,isNewVariant:C,isDefault:t.isDefault,isModified:t.isModified},defaultOpen:!0,expanded:j===A,onToggle:function(){var i,e=j===A;k(e?null:A),null===(i=null==_?void 0:_.setActiveVariantAccordionIndex)||void 0===i||i.call(_,e?null:o)},variant:"rule-behavior",footerData:{ruleTitle:S,description:t.ruleDescription||""},readOnly:F},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[n(u,i({id:"rule-description-".concat(h,"-").concat(o),title:_.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:F||yi&&(null==_?void 0:_.activeEditId)!=="rule-description-".concat(h,"-").concat(o),value:t.ruleDescription||"",onChange:function(i){return R.setRuleDescription(h,o,i)},isOpen:B["ruleDescription-".concat(h)],onToggle:function(){return pi("ruleDescription-".concat(h))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(y=V.citation)||void 0===y?void 0:y["ruleDescription_".concat(h)],tooltipDescription:"Why this Description?",errorMessage:null===(m=_.validationErrors)||void 0===m?void 0:m["ruleDescription-".concat(h,"-").concat(o)],enableInlineEdit:!0,setSendMessageInChat:null==_?void 0:_.setSendMessageInChat,isAiStreaming:null==_?void 0:_.isAiStreaming,fieldName:"Rule Description"},_)),(null===(x=V.citation)||void 0===x?void 0:x["ruleDescription_".concat(h)])&&n("div",i({style:gi},{children:n(r,{isVisible:B["ruleDescription-".concat(h)],citation:V.citation["ruleDescription_".concat(h)],citations:fi("ruleDescription_".concat(h,"_").concat(o)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),n(a,i({id:"when-to-apply-".concat(h,"-").concat(o),idPrefix:"condition-wta",title:_.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:F||yi&&!W,conditions:t.whenToApplyConditions||[],onAdd:function(){return R.addWhenToApply(h,o)},onRemove:function(i,e,n){return R.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return R.editWhenToApply(i,e,n,t)},index:o,tierKey:h,isHighlighted:O.wta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:fi("whenToApply_".concat(h,"_").concat(o)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:_.isAiStreaming,errorMessage:(null===(D=_.validationErrors)||void 0===D?void 0:D["whenToApply-".concat(h,"-").concat(o)])||(null==_?void 0:_.conflictReason)},_)),n(a,i({id:"when-not-to-apply-".concat(h,"-").concat(o),idPrefix:"condition-wnta",title:_.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:F||yi&&!L,conditions:t.whenNotToApplyConditions||[],onAdd:function(){return R.addWhenNotToApply(h,o)},onRemove:function(i,e,n){return R.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return R.editWhenNotToApply(i,e,n,t)},index:o,tierKey:h,isHighlighted:O.wnta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:fi("whenNotToApply_".concat(h,"_").concat(o)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:_.isAiStreaming},_)),n(d,i({id:"config-".concat(h,"-").concat(o),title:_.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:F||yi&&(null==_?void 0:_.activeEditId)!=="config-".concat(h,"-").concat(o),onConfigChange:function(i,e){return R.onConfigChange(h,o,i,e)},separationItems:w,toggles:E,index:o},_))]}))}),A)}),"".concat(h,"-variant-").concat(o))})}))}),"tier-".concat(o))})]}))};export{m as CreateRule};
2
2
  //# sourceMappingURL=CreateRule.js.map
@@ -79,6 +79,7 @@ interface ILOTJProps {
79
79
  isGlobalEditActive?: boolean;
80
80
  saveButtonColor?: string;
81
81
  socketTimeOutInMilliSeconds?: number;
82
+ initialDraftMessage?: string;
82
83
  }
83
84
  declare const ILOTJ: React.FC<ILOTJProps>;
84
85
  export default ILOTJ;
@@ -1 +1 @@
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;CACxC;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAggB/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
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;CAChC;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAkgB/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -45,6 +45,7 @@ interface ChatComponentProps {
45
45
  };
46
46
  isGlobalEditActive?: boolean;
47
47
  socketTimeOutInMilliSeconds?: number | null;
48
+ initialDraftMessage?: string;
48
49
  }
49
50
  export declare const autoGeneratePrompt: (baseUrl?: string, userInput?: string) => Promise<any>;
50
51
  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":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAqClG,UAAU,kBAAkB;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,qBAAqB,EAAE,GAAG,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,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,oDAAoD;IACpD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAA;IACD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AACD,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAyoD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ChatComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/ChatComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAqClG,UAAU,kBAAkB;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,qBAAqB,EAAE,GAAG,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,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,oDAAoD;IACpD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAA;IACD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA4pD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScopeSection.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.tsx"],"names":[],"mappings":";AAMA,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,SAAS,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,8RAsBtB,iBAAiB,4CAmLnB,CAAC"}
1
+ {"version":3,"file":"ScopeSection.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.tsx"],"names":[],"mappings":";AAMA,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,SAAS,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,8RAsBtB,iBAAiB,4CAuLnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"AA6DA,eAAO,MAAM,UAAU,iCAAkC,GAAG,4CAosB3D,CAAC"}
1
+ {"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"AA6DA,eAAO,MAAM,UAAU,iCAAkC,GAAG,4CAwqB3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "0.0.296",
3
+ "version": "0.0.298",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",